|
xorp
|
A class that manages raw link-level I/O. More...
#include <io_link_manager.hh>
Classes | |
| class | CommTableKey |
Public Types | |
|
typedef XorpCallback2< int, const uint8_t *, size_t > ::RefPtr | UpcallReceiverCb |
Public Member Functions | |
| IoLinkManager (FeaNode &fea_node, const IfTree &iftree) | |
| Constructor for IoLinkManager. | |
| virtual | ~IoLinkManager () |
| Virtual destructor. | |
| int | send (const string &if_name, const string &vif_name, const Mac &src_address, const Mac &dst_address, uint16_t ether_type, const vector< uint8_t > &payload, string &error_msg) |
| Send a raw link-level packet on an interface. | |
| int | register_receiver (const string &receiver_name, const string &if_name, const string &vif_name, uint16_t ether_type, const string &filter_program, bool enable_multicast_loopback, string &error_msg) |
| Register to receive raw link-level packets. | |
| int | unregister_receiver (const string &receiver_name, const string &if_name, const string &vif_name, uint16_t ether_type, const string &filter_program, string &error_msg) |
| Unregister to receive raw link-level packets. | |
| int | join_multicast_group (const string &receiver_name, const string &if_name, const string &vif_name, uint16_t ether_type, const string &filter_program, const Mac &group_address, string &error_msg) |
| Join a MAC multicast group. | |
| int | leave_multicast_group (const string &receiver_name, const string &if_name, const string &vif_name, uint16_t ether_type, const string &filter_program, const Mac &group_address, string &error_msg) |
| Leave a MAC multicast group. | |
| void | recv_event (const string &receiver_name, const struct MacHeaderInfo &header, const vector< uint8_t > &payload) |
| Data received event. | |
| void | instance_birth (const string &instance_name) |
| Inform the watcher that a component instance is alive. | |
| void | instance_death (const string &instance_name) |
| Inform the watcher that a component instance is dead. | |
| void | set_io_link_manager_receiver (IoLinkManagerReceiver *v) |
| Set the instance that is responsible for sending raw link-level packets to a receiver. | |
| const IfTree & | iftree () const |
| Get a reference to the interface tree. | |
| int | register_data_plane_manager (FeaDataPlaneManager *fea_data_plane_manager, bool is_exclusive) |
| Register FeaDataPlaneManager data plane manager. | |
| int | unregister_data_plane_manager (FeaDataPlaneManager *fea_data_plane_manager) |
| Unregister FeaDataPlaneManager data plane manager. | |
| list< FeaDataPlaneManager * > & | fea_data_plane_managers () |
| Get the list of registered data plane managers. | |
| int | add_multicast_mac (const string &if_name, const Mac &mac, string &error_msg) |
| Add a multicast MAC address to an interface. | |
| int | remove_multicast_mac (const string &if_name, const Mac &mac, string &error_msg) |
| Remove a multicast MAC address from an interface. | |
Private Types | |
|
typedef map< CommTableKey, IoLinkComm * > | CommTable |
|
typedef multimap< string, IoLinkComm::InputFilter * > | FilterBag |
Private Member Functions | |
| void | erase_filters_by_receiver_name (const string &receiver_name) |
| Erase filters for a given receiver name. | |
| bool | has_filter_by_receiver_name (const string &receiver_name) const |
| Test whether there is a filter for a given receiver name. | |
| void | erase_filters (CommTable &comm_table, FilterBag &filters, const FilterBag::iterator &begin, const FilterBag::iterator &end) |
| Erase filters for a given CommTable and FilterBag. | |
| IoLinkComm & | add_iolink_comm_txonly (const string &if_name, const string &vif_name, uint16_t ether_type) |
| Add a communication handler that can be used for raw link-level transmission only. | |
| IoLinkComm & | find_iolink_comm (const string &if_name, const string &vif_name, uint16_t ether_type) |
| Find the communication handler for a given interface/vif name and EtherType. | |
| int | add_remove_multicast_mac (bool add, const string &if_name, const Mac &mac, string &error_msg) |
| Add/remove a multicast MAC address on an interface. | |
Private Attributes | |
| FeaNode & | _fea_node |
| EventLoop & | _eventloop |
| const IfTree & | _iftree |
| CommTable | _comm_table |
| FilterBag | _filters |
| IoLinkManagerReceiver * | _io_link_manager_receiver |
| list< FeaDataPlaneManager * > | _fea_data_plane_managers |
A class that manages raw link-level I/O.
The IoLinkManager has two containers: a container for link-level handlers (IoLinkComm) indexed by the protocol associated with the handler, and a container for the filters associated with each receiver_name. When a receiver registers for interest in a particular type of raw packet a handler (IoLinkComm) is created if necessary, then the relevent filter is created and associated with the IoLinkComm.
| IoLinkComm & IoLinkManager::add_iolink_comm_txonly | ( | const string & | if_name, |
| const string & | vif_name, | ||
| uint16_t | ether_type | ||
| ) | [private] |
| int IoLinkManager::add_multicast_mac | ( | const string & | if_name, |
| const Mac & | mac, | ||
| string & | error_msg | ||
| ) |
| int IoLinkManager::add_remove_multicast_mac | ( | bool | add, |
| const string & | if_name, | ||
| const Mac & | mac, | ||
| string & | error_msg | ||
| ) | [private] |
| void IoLinkManager::erase_filters | ( | CommTable & | comm_table, |
| FilterBag & | filters, | ||
| const FilterBag::iterator & | begin, | ||
| const FilterBag::iterator & | end | ||
| ) | [private] |
| void IoLinkManager::erase_filters_by_receiver_name | ( | const string & | receiver_name | ) | [private] |
| list<FeaDataPlaneManager*>& IoLinkManager::fea_data_plane_managers | ( | ) | [inline] |
| IoLinkComm & IoLinkManager::find_iolink_comm | ( | const string & | if_name, |
| const string & | vif_name, | ||
| uint16_t | ether_type | ||
| ) | [private] |
Find the communication handler for a given interface/vif name and EtherType.
Note that if the handler is not found, a new one is created and returned.
| if_name | the interface name. |
| vif_name | the vif name. |
| ether_type | the EtherType protocol number. |
| bool IoLinkManager::has_filter_by_receiver_name | ( | const string & | receiver_name | ) | const [private] |
| const IfTree& IoLinkManager::iftree | ( | ) | const [inline] |
| void IoLinkManager::instance_birth | ( | const string & | instance_name | ) | [virtual] |
Inform the watcher that a component instance is alive.
Implements InstanceWatcher.
| void IoLinkManager::instance_death | ( | const string & | instance_name | ) | [virtual] |
Inform the watcher that a component instance is dead.
Implements InstanceWatcher.
| int IoLinkManager::join_multicast_group | ( | const string & | receiver_name, |
| const string & | if_name, | ||
| const string & | vif_name, | ||
| uint16_t | ether_type, | ||
| const string & | filter_program, | ||
| const Mac & | group_address, | ||
| string & | error_msg | ||
| ) |
Join a MAC multicast group.
| receiver_name | the name of the receiver. |
| if_name | the interface through which packets should be accepted. |
| vif_name | the vif through which packets should be accepted. |
| ether_type | the EtherType protocol number or the Destination SAP that the receiver is interested in. It must be between 1536 and 65535 to specify the EtherType, or between 1 and 255 to specify the Destination SAP for IEEE 802.2 LLC frames. A protocol number of 0 is used to specify all protocols. |
| filter_program | the optional filter program to be applied on the received packets. The program uses tcpdump(1) style expression. |
| group_address | the multicast group address to join. |
| error_msg | the error message (if error). |
| int IoLinkManager::leave_multicast_group | ( | const string & | receiver_name, |
| const string & | if_name, | ||
| const string & | vif_name, | ||
| uint16_t | ether_type, | ||
| const string & | filter_program, | ||
| const Mac & | group_address, | ||
| string & | error_msg | ||
| ) |
Leave a MAC multicast group.
| receiver_name | the name of the receiver. |
| if_name | the interface through which packets should not be accepted. |
| vif_name | the vif through which packets should not be accepted. |
| ether_type | the EtherType protocol number or the Destination SAP that the receiver is not interested in anymore. It must be between 1536 and 65535 to specify the EtherType, or between 1 and 255 to specify the Destination SAP for IEEE 802.2 LLC frames. A protocol number of 0 is used to specify all protocols. |
| filter_program | the filter program that was applied on the received packets. The program uses tcpdump(1) style expression. |
| group_address | the multicast group address to leave. |
| error_msg | the error message (if error). |
| void IoLinkManager::recv_event | ( | const string & | receiver_name, |
| const struct MacHeaderInfo & | header, | ||
| const vector< uint8_t > & | payload | ||
| ) | [virtual] |
| int IoLinkManager::register_data_plane_manager | ( | FeaDataPlaneManager * | fea_data_plane_manager, |
| bool | is_exclusive | ||
| ) |
Register FeaDataPlaneManager data plane manager.
| fea_data_plane_manager | the data plane manager to register. |
| is_exclusive | if true, the manager is registered as the exclusive manager, otherwise is added to the list of managers. |
| int IoLinkManager::register_receiver | ( | const string & | receiver_name, |
| const string & | if_name, | ||
| const string & | vif_name, | ||
| uint16_t | ether_type, | ||
| const string & | filter_program, | ||
| bool | enable_multicast_loopback, | ||
| string & | error_msg | ||
| ) |
Register to receive raw link-level packets.
| receiver_name | the name of the receiver. |
| if_name | the interface through which packets should be accepted. |
| vif_name | the vif through which packets should be accepted. |
| ether_type | the EtherType protocol number or the Destination SAP that the receiver is interested in. It must be between 1536 and 65535 to specify the EtherType, or between 1 and 255 to specify the Destination SAP for IEEE 802.2 LLC frames. A protocol number of 0 is used to specify all protocols. |
| filter_program | the optional filter program to be applied on the received packets. The program uses tcpdump(1) style expression. |
| enable_multicast_loopback | if true then enable delivering of multicast datagrams back to this host (assuming the host is a member of the same multicast group. |
| error_msg | the error message (if error). |
| int IoLinkManager::remove_multicast_mac | ( | const string & | if_name, |
| const Mac & | mac, | ||
| string & | error_msg | ||
| ) |
| int IoLinkManager::send | ( | const string & | if_name, |
| const string & | vif_name, | ||
| const Mac & | src_address, | ||
| const Mac & | dst_address, | ||
| uint16_t | ether_type, | ||
| const vector< uint8_t > & | payload, | ||
| string & | error_msg | ||
| ) |
Send a raw link-level packet on an interface.
| if_name | the interface to send the packet on. |
| vif_name | the vif to send the packet on. |
| src_address | the MAC source address. |
| dst_address | the MAC destination address. |
| ether_type | the EtherType protocol type or the Destination SAP. It must be between 1536 and 65535 to specify the EtherType, or between 1 and 255 to specify the Destination SAP IEEE 802.2 LLC frames. |
| payload | the payload, everything after the MAC header. |
| error_msg | the error message (if error). |
| int IoLinkManager::unregister_data_plane_manager | ( | FeaDataPlaneManager * | fea_data_plane_manager | ) |
Unregister FeaDataPlaneManager data plane manager.
| fea_data_plane_manager | the data plane manager to unregister. |
| int IoLinkManager::unregister_receiver | ( | const string & | receiver_name, |
| const string & | if_name, | ||
| const string & | vif_name, | ||
| uint16_t | ether_type, | ||
| const string & | filter_program, | ||
| string & | error_msg | ||
| ) |
Unregister to receive raw link-level packets.
| receiver_name | the name of the receiver. |
| if_name | the interface through which packets should not be accepted. |
| vif_name | the vif through which packets should not be accepted. |
| ether_type | the EtherType protocol number or the Destination SAP that the receiver is not interested in anymore. It must be between 1536 and 65535 to specify the EtherType, or between 1 and 255 to specify the Destination SAP for IEEE 802.2 LLC frames. A protocol number of 0 is used to specify all protocols. |
| filter_program | the filter program that was applied on the received packets. The program uses tcpdump(1) style expression. |
| error_msg | the error message (if error). |