|
xorp
|
A base class for I/O link raw communication. More...
#include <io_link.hh>
Public Member Functions | |
| IoLink (FeaDataPlaneManager &fea_data_plane_manager, const IfTree &iftree, const string &if_name, const string &vif_name, uint16_t ether_type, const string &filter_program) | |
| Constructor for link-level access for a given interface and vif. | |
| virtual | ~IoLink () |
| Virtual destructor. | |
| IoLinkManager & | io_link_manager () |
| Get the IoLinkManager instance. | |
| FeaDataPlaneManager & | fea_data_plane_manager () |
| Get the FeaDataPlaneManager instance. | |
| virtual bool | is_running () const |
| Test whether this instance is running. | |
| EventLoop & | eventloop () |
| Get the event loop. | |
| const IfTree & | iftree () const |
| Get the interface tree. | |
| virtual const string & | if_name () const |
| Get the interface name. | |
| virtual const string & | vif_name () const |
| Get the vif name. | |
| virtual uint16_t | ether_type () const |
| Get the EtherType protocol number. | |
| const string & | filter_program () const |
| Get the optional filter program. | |
| IoLinkReceiver * | io_link_receiver () |
| Get the registered receiver. | |
| virtual void | register_io_link_receiver (IoLinkReceiver *io_link_receiver) |
| Register the I/O Link raw packets receiver. | |
| virtual void | unregister_io_link_receiver () |
| Unregister the I/O Link raw packets receiver. | |
| virtual int | start (string &error_msg)=0 |
| Start operation. | |
| virtual int | stop (string &error_msg)=0 |
| Stop operation. | |
| virtual int | join_multicast_group (const Mac &group, string &error_msg)=0 |
| Join a multicast group on an interface. | |
| virtual int | leave_multicast_group (const Mac &group, string &error_msg)=0 |
| Leave a multicast group on an interface. | |
| virtual int | send_packet (const Mac &src_address, const Mac &dst_address, uint16_t ether_type, const vector< uint8_t > &payload, string &error_msg)=0 |
| Send a link-level packet. | |
| bool | is_log_trace () const |
| Test if trace log is enabled. | |
| void | set_log_trace (bool is_enabled) |
| Enable/disable trace log. | |
Protected Member Functions | |
| virtual void | recv_packet (const Mac &src_address, const Mac &dst_address, uint16_t ether_type, const vector< uint8_t > &payload) |
| Received a link-level packet. | |
| void | recv_ethernet_packet (const uint8_t *packet, size_t packet_size) |
| Receved an Ethernet packet. | |
| int | prepare_ethernet_packet (const Mac &src_address, const Mac &dst_address, uint16_t ether_type, const vector< uint8_t > &payload, vector< uint8_t > &packet, string &error_msg) |
| Prepare an Ethernet packet for transmission. | |
Protected Attributes | |
| bool | _is_running |
Static Protected Attributes | |
| static const uint32_t | L2_MAX_PACKET_SIZE = (64*1024) |
| static const uint16_t | ETHERNET_HEADER_SIZE = 14 |
| static const uint16_t | ETHERNET_LENGTH_TYPE_THRESHOLD = 1536 |
| static const uint16_t | ETHERNET_MIN_FRAME_SIZE = 60 |
Private Attributes | |
| IoLinkManager & | _io_link_manager |
| FeaDataPlaneManager & | _fea_data_plane_manager |
| EventLoop & | _eventloop |
| const IfTree & | _iftree |
| const string | _if_name |
| const string | _vif_name |
| const uint16_t | _ether_type |
| const string | _filter_program |
| IoLinkReceiver * | _io_link_receiver |
| bool | _is_log_trace |
A base class for I/O link raw communication.
Each protocol 'registers' for I/O per interface and vif and gets assigned one object (per interface and vif) of this class.
| IoLink::IoLink | ( | FeaDataPlaneManager & | fea_data_plane_manager, |
| const IfTree & | iftree, | ||
| const string & | if_name, | ||
| const string & | vif_name, | ||
| uint16_t | ether_type, | ||
| const string & | filter_program | ||
| ) |
Constructor for link-level access for a given interface and vif.
| fea_data_plane_manager | the corresponding data plane manager (FeaDataPlaneManager). |
| iftree | the interface tree to use. |
| if_name | the interface name. |
| vif_name | the vif name. |
| ether_type | the EtherType protocol number. If it is 0 then it is unused. |
| filter_program | the optional filter program to be applied on the received packets. |
| virtual uint16_t IoLink::ether_type | ( | ) | const [inline, virtual] |
| FeaDataPlaneManager& IoLink::fea_data_plane_manager | ( | ) | [inline] |
Get the FeaDataPlaneManager instance.
| const string& IoLink::filter_program | ( | ) | const [inline] |
| virtual const string& IoLink::if_name | ( | ) | const [inline, virtual] |
| IoLinkManager& IoLink::io_link_manager | ( | ) | [inline] |
Get the IoLinkManager instance.
| IoLinkReceiver* IoLink::io_link_receiver | ( | ) | [inline] |
| bool IoLink::is_log_trace | ( | ) | const [inline] |
Test if trace log is enabled.
This method is used to test whether to output trace log debug messges.
| virtual bool IoLink::is_running | ( | ) | const [inline, virtual] |
Test whether this instance is running.
| virtual int IoLink::join_multicast_group | ( | const Mac & | group, |
| string & | error_msg | ||
| ) | [pure virtual] |
Join a multicast group on an interface.
Implemented in IoLinkDummy, and IoLinkPcap.
| virtual int IoLink::leave_multicast_group | ( | const Mac & | group, |
| string & | error_msg | ||
| ) | [pure virtual] |
Leave a multicast group on an interface.
Implemented in IoLinkDummy, and IoLinkPcap.
| int IoLink::prepare_ethernet_packet | ( | const Mac & | src_address, |
| const Mac & | dst_address, | ||
| uint16_t | ether_type, | ||
| const vector< uint8_t > & | payload, | ||
| vector< uint8_t > & | packet, | ||
| string & | error_msg | ||
| ) | [protected] |
Prepare an Ethernet packet for transmission.
| src_address | the MAC source address. |
| dst_address | the MAC destination address. |
| ether_type | the EtherType protocol number. |
| payload | the payload, everything after the MAC header. |
| packet | the return-by-reference packet prepared for transmission. |
| error_msg | the error message (if error). |
| void IoLink::recv_ethernet_packet | ( | const uint8_t * | packet, |
| size_t | packet_size | ||
| ) | [protected] |
| void IoLink::register_io_link_receiver | ( | IoLinkReceiver * | io_link_receiver | ) | [virtual] |
| virtual int IoLink::send_packet | ( | const Mac & | src_address, |
| const Mac & | dst_address, | ||
| uint16_t | ether_type, | ||
| const vector< uint8_t > & | payload, | ||
| string & | error_msg | ||
| ) | [pure virtual] |
Send a link-level packet.
| src_address | the MAC source address. |
| dst_address | the MAC destination address. |
| ether_type | the EtherType protocol number. |
| payload | the payload, everything after the MAC header. |
| error_msg | the error message (if error). |
Implemented in IoLinkDummy, and IoLinkPcap.
| void IoLink::set_log_trace | ( | bool | is_enabled | ) | [inline] |
Enable/disable trace log.
This method is used to enable/disable trace log debug messages output.
| is_enabled | if true, trace log is enabled, otherwise is disabled. |
| virtual int IoLink::start | ( | string & | error_msg | ) | [pure virtual] |
Start operation.
| error_msg | the error message (if error). |
Implemented in IoLinkDummy, and IoLinkPcap.
| virtual int IoLink::stop | ( | string & | error_msg | ) | [pure virtual] |
Stop operation.
| error_msg | the error message (if error). |
Implemented in IoLinkDummy, and IoLinkPcap.
| virtual const string& IoLink::vif_name | ( | ) | const [inline, virtual] |