|
xorp
|
A base class for I/O IP raw communication. More...
#include <io_ip.hh>
Public Member Functions | |
| IoIp (FeaDataPlaneManager &fea_data_plane_manager, const IfTree &iftree, int family, uint8_t ip_protocol) | |
| Constructor for a given address family and protocol. | |
| virtual | ~IoIp () |
| Virtual destructor. | |
| IoIpManager & | io_ip_manager () |
| Get the IoIpManager 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 int | family () const |
| Get the address family. | |
| virtual uint8_t | ip_protocol () const |
| Get the IP protocol number. | |
| IoIpReceiver * | io_ip_receiver () |
| Get the registered receiver. | |
| virtual void | register_io_ip_receiver (IoIpReceiver *io_ip_receiver) |
| Register the I/O IP raw packets receiver. | |
| virtual void | unregister_io_ip_receiver () |
| Unregister the I/O IP raw packets receiver. | |
| virtual int | start (string &error_msg)=0 |
| Start operation. | |
| virtual int | stop (string &error_msg)=0 |
| Stop operation. | |
| virtual int | set_multicast_ttl (int ttl, string &error_msg)=0 |
| Set the default TTL (or hop-limit in IPv6) for the outgoing multicast packets. | |
| virtual int | enable_multicast_loopback (bool is_enabled, string &error_msg)=0 |
| Enable/disable multicast loopback when transmitting multicast packets. | |
| virtual int | set_default_multicast_interface (const string &if_name, const string &vif_name, string &error_msg)=0 |
| Set default interface for transmitting multicast packets. | |
| virtual int | join_multicast_group (const string &if_name, const string &vif_name, const IPvX &group, string &error_msg)=0 |
| Join a multicast group on an interface. | |
| virtual int | leave_multicast_group (const string &if_name, const string &vif_name, const IPvX &group, string &error_msg)=0 |
| Leave a multicast group on an interface. | |
| virtual int | send_packet (const string &if_name, const string &vif_name, const IPvX &src_address, const IPvX &dst_address, int32_t ip_ttl, int32_t ip_tos, bool ip_router_alert, bool ip_internet_control, const vector< uint8_t > &ext_headers_type, const vector< vector< uint8_t > > &ext_headers_payload, const vector< uint8_t > &payload, string &error_msg)=0 |
| Send a raw IP packet. | |
| virtual XorpFd * | mcast_protocol_fd_in ()=0 |
| Get the file descriptor for receiving protocol messages. | |
Protected Member Functions | |
| virtual void | recv_packet (const string &if_name, const string &vif_name, const IPvX &src_address, const IPvX &dst_address, int32_t ip_ttl, int32_t ip_tos, bool ip_router_alert, bool ip_internet_control, const vector< uint8_t > &ext_headers_type, const vector< vector< uint8_t > > &ext_headers_payload, const vector< uint8_t > &payload) |
| Received a raw IP packet. | |
| virtual void | recv_system_multicast_upcall (const vector< uint8_t > &payload) |
| Received a multicast forwarding related upcall from the system. | |
Protected Attributes | |
| bool | _is_running |
Private Attributes | |
| IoIpManager & | _io_ip_manager |
| FeaDataPlaneManager & | _fea_data_plane_manager |
| EventLoop & | _eventloop |
| const IfTree & | _iftree |
| int | _family |
| uint8_t | _ip_protocol |
| IoIpReceiver * | _io_ip_receiver |
A base class for I/O IP raw communication.
Each protocol 'registers' for I/O and gets assigned one object of this class.
| IoIp::IoIp | ( | FeaDataPlaneManager & | fea_data_plane_manager, |
| const IfTree & | iftree, | ||
| int | family, | ||
| uint8_t | ip_protocol | ||
| ) |
Constructor for a given address family and protocol.
| virtual int IoIp::enable_multicast_loopback | ( | bool | is_enabled, |
| string & | error_msg | ||
| ) | [pure virtual] |
Enable/disable multicast loopback when transmitting multicast packets.
If the multicast loopback is enabled, a transmitted multicast packet will be delivered back to this host (assuming the host is a member of the same multicast group).
| is_enabled | if true, enable the loopback, otherwise disable it. |
| error_msg | the error message (if error). |
Implemented in IoIpDummy, and IoIpSocket.
| virtual int IoIp::family | ( | ) | const [inline, virtual] |
| FeaDataPlaneManager& IoIp::fea_data_plane_manager | ( | ) | [inline] |
Get the FeaDataPlaneManager instance.
| IoIpManager& IoIp::io_ip_manager | ( | ) | [inline] |
Get the IoIpManager instance.
| IoIpReceiver* IoIp::io_ip_receiver | ( | ) | [inline] |
| virtual uint8_t IoIp::ip_protocol | ( | ) | const [inline, virtual] |
| virtual bool IoIp::is_running | ( | ) | const [inline, virtual] |
Test whether this instance is running.
| virtual int IoIp::join_multicast_group | ( | const string & | if_name, |
| const string & | vif_name, | ||
| const IPvX & | group, | ||
| string & | error_msg | ||
| ) | [pure virtual] |
Join a multicast group on an interface.
| if_name | the name of the interface to join the multicast group. |
| vif_name | the name of the vif to join the multicast group. |
| group | the multicast group to join. |
| error_msg | the error message (if error). |
Implemented in IoIpDummy, and IoIpSocket.
| virtual int IoIp::leave_multicast_group | ( | const string & | if_name, |
| const string & | vif_name, | ||
| const IPvX & | group, | ||
| string & | error_msg | ||
| ) | [pure virtual] |
Leave a multicast group on an interface.
| if_name | the name of the interface to leave the multicast group. |
| vif_name | the name of the vif to leave the multicast group. |
| group | the multicast group to leave. |
| error_msg | the error message (if error). |
Implemented in IoIpDummy, and IoIpSocket.
| virtual XorpFd* IoIp::mcast_protocol_fd_in | ( | ) | [pure virtual] |
Get the file descriptor for receiving protocol messages.
Implemented in IoIpDummy, and IoIpSocket.
| void IoIp::recv_packet | ( | const string & | if_name, |
| const string & | vif_name, | ||
| const IPvX & | src_address, | ||
| const IPvX & | dst_address, | ||
| int32_t | ip_ttl, | ||
| int32_t | ip_tos, | ||
| bool | ip_router_alert, | ||
| bool | ip_internet_control, | ||
| const vector< uint8_t > & | ext_headers_type, | ||
| const vector< vector< uint8_t > > & | ext_headers_payload, | ||
| const vector< uint8_t > & | payload | ||
| ) | [protected, virtual] |
Received a raw IP packet.
| if_name | the interface name the packet arrived on. |
| vif_name | the vif name the packet arrived on. |
| src_address | the IP source address. |
| dst_address | the IP destination address. |
| ip_ttl | the IP TTL (hop-limit). If it has a negative value, then the received value is unknown. |
| ip_tos | The type of service (Diffserv/ECN bits for IPv4). If it has a negative value, then the received value is unknown. |
| ip_router_alert | if true, the IP Router Alert option was included in the IP packet. |
| ip_internet_control | if true, then this is IP control traffic. |
| ext_headers_type | a vector of integers with the types of the optional IPv6 extention headers. |
| ext_headers_payload | a vector of payload data, one for each optional IPv6 extention header. The number of entries must match ext_headers_type. |
| packet | the payload, everything after the IP header and options. |
| void IoIp::recv_system_multicast_upcall | ( | const vector< uint8_t > & | payload | ) | [protected, virtual] |
| void IoIp::register_io_ip_receiver | ( | IoIpReceiver * | io_ip_receiver | ) | [virtual] |
| virtual int IoIp::send_packet | ( | const string & | if_name, |
| const string & | vif_name, | ||
| const IPvX & | src_address, | ||
| const IPvX & | dst_address, | ||
| int32_t | ip_ttl, | ||
| int32_t | ip_tos, | ||
| bool | ip_router_alert, | ||
| bool | ip_internet_control, | ||
| const vector< uint8_t > & | ext_headers_type, | ||
| const vector< vector< uint8_t > > & | ext_headers_payload, | ||
| const vector< uint8_t > & | payload, | ||
| string & | error_msg | ||
| ) | [pure virtual] |
Send a raw IP packet.
| if_name | the interface to send the packet on. It is essential for multicast. In the unicast case this field may be empty. |
| vif_name | the vif to send the packet on. It is essential for multicast. In the unicast case this field may be empty. |
| src_address | the IP source address. |
| dst_address | the IP destination address. |
| ip_ttl | the IP TTL (hop-limit). If it has a negative value, the TTL will be set internally before transmission. |
| ip_tos | the Type Of Service (Diffserv/ECN bits for IPv4 or IP traffic class for IPv6). If it has a negative value, the TOS will be set internally before transmission. |
| ip_router_alert | if true, then add the IP Router Alert option to the IP packet. |
| ip_internet_control | if true, then this is IP control traffic. |
| ext_headers_type | a vector of integers with the types of the optional IPv6 extention headers. |
| ext_headers_payload | a vector of payload data, one for each optional IPv6 extention header. The number of entries must match ext_headers_type. |
| payload | the payload, everything after the IP header and options. |
| error_msg | the error message (if error). |
Implemented in IoIpDummy, and IoIpSocket.
| virtual int IoIp::set_default_multicast_interface | ( | const string & | if_name, |
| const string & | vif_name, | ||
| string & | error_msg | ||
| ) | [pure virtual] |
Set default interface for transmitting multicast packets.
| if_name | the name of the interface that would become the default multicast interface. |
| vif_name | the name of the vif that would become the default multicast interface. |
| error_msg | the error message (if error). |
Implemented in IoIpDummy, and IoIpSocket.
| virtual int IoIp::set_multicast_ttl | ( | int | ttl, |
| string & | error_msg | ||
| ) | [pure virtual] |
| virtual int IoIp::start | ( | string & | error_msg | ) | [pure virtual] |
Start operation.
| error_msg | the error message (if error). |
Implemented in IoIpDummy, and IoIpSocket.
| virtual int IoIp::stop | ( | string & | error_msg | ) | [pure virtual] |
Stop operation.
| error_msg | the error message (if error). |
Implemented in IoIpDummy, and IoIpSocket.