|
|
ProtoNode (int init_family, x_module_id init_module_id,
EventLoop& init_event_loop)
| ProtoNode |
Constructor for a given address family, module ID, and event loop.
Parameters:
init_family | the address family (AF_INET or AF_INET6 for IPv4 and IPv6 respectively). |
init_module_id | the module ID X_MODULE_* (x_module_id). |
init_event_loop | the event loop to use. |
~ProtoNode ()
| ~ProtoNode |
[virtual]
Destructor
int start ()
| start |
Reimplemented from ProtoUnit.
int stop ()
| stop |
Reimplemented from ProtoUnit.
void enable ()
| enable |
Reimplemented from ProtoUnit.
void disable ()
| disable |
Reimplemented from ProtoUnit.
inline uint16_t vif_name2vif_index (const string& vif_name)
| vif_name2vif_index |
[const]
Map a vif name to a vif index.
Parameters:
vif_name | the vif name to map to a vif index. |
Returns: the virtual interface index for vif name vif_name.
inline uint16_t find_unused_vif_index ()
| find_unused_vif_index |
[const]
Find an unused vif index.
Returns: the smallest unused vif index if there is one available, otherwise return Vif::VIF_INDEX_INVALID.
inline V * vif_find_by_name (const string& name)
| vif_find_by_name |
[const]
Find a virtual interface for a given name.
Parameters:
name | the name to search for. |
Returns: the virtual interface with name name if found, otherwise NULL.
inline V * vif_find_by_addr (const IPvX& ipaddr_test)
| vif_find_by_addr |
[const]
Find a virtual interface for a given address.
Parameters:
ipaddr_test | the address to search for. |
Returns: the virtual interface with address ipaddr_test if found, otherwise NULL.
inline V * vif_find_by_pif_index (uint16_t pif_index)
| vif_find_by_pif_index |
[const]
Find a virtual interface for a given physical interface index.
Parameters:
pif_index | the physical interface index to search for. |
Returns: the virtual interface with physical interface index pif_index if found, otherwise NULL.
inline V * vif_find_by_vif_index (uint16_t vif_index)
| vif_find_by_vif_index |
[const]
Find a virtual interface for a given virtual interface index.
Parameters:
vif_index | the virtual interface index to search for. |
Returns: the vvirtual interface with virtual interface index vif_index if found, otherwise NULL.
inline V * vif_find_direct (const IPvX& ipaddr_test)
| vif_find_direct |
[const]
Find a virtual interface that is directly connected to the given address.
Parameters:
ipaddr_test | the address to search by. |
Returns: the virtual interface that is directly connected to address ipaddr_test if found, otherwise NULL.
bool is_directly_connected (const IPvX& ipaddr_test)
| is_directly_connected |
[const]
Test if an address is directly connected to one of my virtual interfaces.
Parameters:
ipaddr_test | the address to test. |
Returns: true if ipaddr_test is directly connected to one of my virtual interfaces, otherwise false.
bool is_my_addr (const IPvX& ipaddr_test)
| is_my_addr |
[const]
Test if an address belongs to one of my virtual interfaces.
Parameters:
ipaddr_test | the address to test. |
Returns: true if ipaddr_test belongs to one of my virtual interfaces, otherwise false.
inline int add_vif (V *vif)
| add_vif |
Add a virtual interface.
Parameters:
vif | a pointer to the virtual interface to add. |
Returns: XORP_OK on success, otherwise XORP_ERROR.
inline int delete_vif (const V *vif)
| delete_vif |
Delete a virtual interface.
Note: the vif itself is not deleted, only its place in the array of protocol vifs.
Parameters:
vif | a pointer to the virtual interface to delete. |
Returns: XORP_OK on success, otherwise XORP_ERROR.
vector<V *>& proto_vifs ()
| proto_vifs |
Get the array of pointers to the virtual interfaces.
Returns: the array of pointers to the virtual interfaces.
size_t maxvifs ()
| maxvifs |
[const]
Get the maximum number of vifs.
Note: the interfaces that are not configured or are down are also included.
Returns: the maximum number of vifs we can have.
EventLoop& event_loop ()
| event_loop |
Get the event loop this node is added to.
Returns: the event loop this node is added to.
bool is_vif_setup_completed ()
| is_vif_setup_completed |
[const]
Test if the vif setup is completed.
Returns: true if the vif setup is completed, otherwise false.
void set_vif_setup_completed (bool v)
| set_vif_setup_completed |
Set/reset the flag that indicates whether the vif setup is completed.
Parameters:
v | if true, set the flag that the vif setup is completed, otherwise reset it. |
int proto_recv (const string& src_module_instance_name,
x_module_id src_module_id,
uint16_t vif_index,
const IPvX& src,
const IPvX& dst,
int ip_ttl,
int ip_tos,
bool router_alert_bool,
const uint8_t *rcvbuf,
size_t rcvlen)
| proto_recv |
[pure virtual]
Receive a protocol message.
This is a pure virtual function, and it must be implemented by the particular protocol node class that inherits this base class.
Parameters:
src_module_instance_name | the module instance name of the module-origin of the message. |
src_module_id | the module ID (x_module_id) of the module-origin of the message. |
vif_index | the vif index of the interface used to receive this message. |
src | the source address of the message. |
dst | the destination address of the message. |
ip_ttl | the IP TTL (Time To Live) of the message. If it has a negative value, it should be ignored. |
ip_tos | the IP TOS (Type of Service) of the message. If it has a negative value, it should be ignored. |
router_alert_bool | if true, the ROUTER_ALERT IP option for the IP packet of the incoming message was set. |
rcvbuf | the data buffer with the received message. |
rcvlen | the data length in rcvbuf. |
Returns: XORP_OK on success, otherwise XORP_ERROR.
int proto_send (const string& dst_module_instance_name,
x_module_id dst_module_id,
uint16_t vif_index,
const IPvX& src,
const IPvX& dst,
int ip_ttl,
int ip_tos,
bool router_alert_bool,
const uint8_t *sndbuf,
size_t sndlen)
| proto_send |
[pure virtual]
Send a protocol message.
This is a pure virtual function, and it must be implemented by the particular protocol node class that inherits this base class.
Parameters:
dst_module_instance_name | the module instance name of the module-recepient of the message. |
dst_module_id | the module ID (x_module_id) of the module-recepient of the message. |
vif_index | the vif index of the interface to send this message. |
src | the source address of the message. |
dst | the destination address of the message. |
ip_ttl | the IP TTL of the message. If it has a negative value, the TTL will be set by the lower layers. |
ip_tos | the IP TOS of the message. If it has a negative value, the TOS will be set by the lower layers. |
router_alert_bool | if true, set the ROUTER_ALERT IP option for the IP packet of the outgoung message. |
sndbuf | the data buffer with the outgoing message. |
sndlen | the data length in sndbuf. |
Returns: XORP_OK on success, otherwise XORP_ERROR.
int signal_message_recv (const string& src_module_instance_name,
x_module_id src_module_id,
int message_type,
uint16_t vif_index,
const IPvX& src,
const IPvX& dst,
const uint8_t *rcvbuf,
size_t rcvlen)
| signal_message_recv |
[pure virtual]
Receive a signal message.
This is a pure virtual function, and it must be implemented by the particular protocol node class that inherits this base class.
Parameters:
src_module_instance_name | the module instance name of the module-origin of the message. |
src_module_id | the module ID (x_module_id) of the module-origin of the message. |
message_type | the message type. The particular values are specific for the origin and recepient of this signal message. |
vif_index | the vif index of the related interface (message-specific relation). |
src | the source address of the message. The exact meaning of this address is message-specific. |
dst | the destination address of the message. The exact meaning of this address is message-specific. |
rcvbuf | the data buffer with the additional information in the message. |
rcvlen | the data length in rcvbuf. |
Returns: XORP_OK on success, otherwise XORP_ERROR.
int signal_message_send (const string& dst_module_instance_name,
x_module_id dst_module_id,
int message_type,
uint16_t vif_index,
const IPvX& src,
const IPvX& dst,
const uint8_t *sndbuf,
size_t sndlen)
| signal_message_send |
[pure virtual]
Send a signal message.
This is a pure virtual function, and it must be implemented by the particular protocol node class that inherits this base class.
Parameters:
dst_module_instance_name | the module instance name of the module-recepient of the message. |
dst_module_id | the module ID (x_module_id) of the module-recepient of the message. |
message_type | the message type. The particular values are specific for the origin and recepient of this signal message. |
vif_index | the vif index of the related interface (message-specific relation). |
src | the source address of the message. The exact meaning of this address is message-specific. |
dst | the destination address of the message. The exact meaning of this address is message-specific. |
sndbuf | the data buffer with the outgoing message. |
sndlen | the data length in sndbuf. |
Returns: XORP_OK on success, otherwise XORP_ERROR.
Generated by: pavlin on possum.icir.org on Wed Dec 11 16:50:44 2002, using kdoc 2.0a54+XORP. |