|
|
An abstract class that defines packet reception and transmission. The details of how packets are received or transmitted are therefore hidden from the internals of the OLSR code.
IO ()
| IO |
~IO ()
| ~IO |
[virtual]
bool enable_address (const string& interface, const string& vif,
const IPv4& address, const uint16_t& port,
const IPv4& all_nodes_address)
| enable_address |
[pure virtual]
Enable an IPv4 address and port for OLSR datagram reception and transmission.
Parameters:
interface | the interface to enable. |
vif | the vif to enable. |
address | the address to enable. |
port | the port to enable. |
all_nodes_address | the all-nodes address to enable. |
Returns: true if the address was enabled, otherwise false.
bool disable_address (const string& interface, const string& vif,
const IPv4& address, const uint16_t& port)
| disable_address |
[pure virtual]
Disable an IPv4 address and port for OLSR datagram reception.
Parameters:
interface | the interface to disable. |
vif | the vif to disable. |
address | the address to disable. |
port | the port to disable. |
Returns: true if the address was disabled, otherwise false.
bool is_interface_enabled (const string& interface)
| is_interface_enabled |
[const pure virtual]
Test whether this interface is enabled.
Parameters:
interface | the interface to test. |
Returns: true if it exists and is enabled, otherwise false.
bool is_vif_enabled (const string& interface,
const string& vif)
| is_vif_enabled |
[const pure virtual]
Test whether this interface/vif is enabled.
Parameters:
interface | the interface to test. |
vif | the vif to test. |
Returns: true if it exists and is enabled, otherwise false.
bool is_vif_broadcast_capable (const string& interface,
const string& vif)
| is_vif_broadcast_capable |
[pure virtual]
Test whether this interface/vif is broadcast capable.
Parameters:
interface | the interface to test. |
vif | the vif to test. |
Returns: true if it is broadcast capable, otherwise false.
bool is_vif_multicast_capable (const string& interface,
const string& vif)
| is_vif_multicast_capable |
[pure virtual]
Test whether this interface/vif is multicast capable.
Parameters:
interface | the interface to test. |
vif | the vif to test. |
Returns: true if it is multicast capable, otherwise false.
bool is_vif_loopback (const string& interface,
const string& vif)
| is_vif_loopback |
[pure virtual]
Test whether this interface/vif is a loopback interface.
Parameters:
interface | the interface to test. |
vif | the vif to test. |
Returns: true if it is a loopback interface, otherwise false.
bool is_address_enabled (const string& interface,
const string& vif, const IPv4& address)
| is_address_enabled |
[const pure virtual]
Test whether this interface/vif/address is enabled.
Parameters:
interface | the interface to test. |
vif | the vif to test. |
address | the address to test. |
Returns: true if it exists and is enabled, otherwise false.
typedef XorpCallback2<void, const string&, bool>::RefPtr InterfaceStatusCb | InterfaceStatusCb |
Callback for interface status from the FEA.
typedef XorpCallback3<void, const string&, const string&, bool>::RefPtr VifStatusCb | VifStatusCb |
Callback for vif status from the FEA.
typedef XorpCallback4<void, const string&, const string&, IPv4, bool>::RefPtr AddressStatusCb | AddressStatusCb |
Callback for address status from the FEA.
typedef XorpCallback8<void, const string&, const string&, IPv4, uint16_t, IPv4, uint16_t, uint8_t*, uint32_t>::RefPtr ReceiveCallback | ReceiveCallback |
Callback for packet reception from the FEA.
bool get_addresses (const string& interface, const string& vif,
list<IPv4>& addresses)
| get_addresses |
[const pure virtual]
Get all addresses associated with this interface/vif.
Parameters:
interface | the name of the interface |
vif | the name of the vif |
addresses | (out argument) list of associated addresses |
Returns: true if there are no errors.
bool get_broadcast_address (const string& interface,
const string& vif,
const IPv4& address,
IPv4& bcast_address)
| get_broadcast_address |
[const pure virtual]
Get the broadcast address associated with this interface/vif/address.
Parameters:
interface | the name of the interface |
vif | the name of the vif |
address | IPv4 binding address |
bcast_address | (out argument) primary broadcast address |
Returns: true if there are no errors.
bool get_interface_id (const string& interface,
uint32_t& interface_id)
| get_interface_id |
[pure virtual]
Get the ID of the interface, as seen by libfeaclient.
Parameters:
interface | the name of the interface. |
interface_id | (out argument) interface ID. |
Returns: the interface id for this interface.
uint32_t get_mtu (const string& interface)
| get_mtu |
[pure virtual]
Get the MTU for an interface.
Parameters:
interface | the name of the interface. |
Returns: the mtu for this interface.
inline void register_interface_status (InterfaceStatusCb cb)
| register_interface_status |
Add a callback for tracking the interface status.
The callback will be invoked whenever the status of the interface is changed from disabled to enabled or vice-versa.
Parameters:
cb | the callback to register. |
inline void register_vif_status (VifStatusCb cb)
| register_vif_status |
Add a callback for tracking the interface/vif status.
The callback will be invoked whenever the status of the interface/vif is changed from disabled to enabled or vice-versa.
Parameters:
cb | the callback to register. |
inline void register_address_status (AddressStatusCb cb)
| register_address_status |
Add a callback for tracking the interface/vif/address status.
The callback will be invoked whenever the status of the tuple (interface, vif, address) is changed from disabled to enabled or vice-versa.
Parameters:
cb | the callback to register. |
inline void register_receive (ReceiveCallback cb)
| register_receive |
Register for receiving datagrams.
Parameters:
cb | the callback to register. |
ReceiveCallback _receive_cb | _receive_cb |
[protected]
InterfaceStatusCb _interface_status_cb | _interface_status_cb |
[protected]
VifStatusCb _vif_status_cb | _vif_status_cb |
[protected]
AddressStatusCb _address_status_cb | _address_status_cb |
[protected]
interface_vif (struct) | interface_vif |
bool send (const string& interface, const string& vif,
const IPv4& src, const uint16_t& sport,
const IPv4& dst, const uint16_t& dport,
uint8_t* data, const uint32_t& len)
| send |
[pure virtual]
Send a UDP datagram from src:sport to dst:dport, on the given interface, if possible.
Parameters:
interface | the interface to transmit from. |
vif | the vif to transmit from. |
src | the IPv4 source address to transmit from. |
sport | the UDP source port to transmit from. |
dst | the IPv4 destination address to send to. |
dport | the UDP destination port to send to. |
data | the datagram to transmit. |
len | the length of the datagram to transmit. |
Returns: true if the datagram was sent OK, otherwise false.
bool add_route (IPv4Net net, IPv4 nexthop, uint32_t faceid,
uint32_t metric,
const PolicyTags& policytags)
| add_route |
[pure virtual]
Add route.
Parameters:
net | network |
faceid | interface ID towards the nexthop |
metric | to network |
policytags | policy info to the RIB. |
Returns: true if the route was added OK, otherwise false.
bool replace_route (IPv4Net net, IPv4 nexthop, uint32_t faceid,
uint32_t metric,
const PolicyTags& policytags)
| replace_route |
[pure virtual]
Replace route.
Parameters:
net | network |
faceid | interface ID towards the nexthop |
metric | to network |
policytags | policy info to the RIB. |
Returns: true if the route was replaced OK, otherwise false.
bool delete_route (IPv4Net net)
| delete_route |
[pure virtual]
Delete route.
Parameters:
net | network |
Returns: true if the route was deleted OK, otherwise false.
inline void set_interface_mapping (uint32_t interface_id,
const string& interface, const string& vif)
| set_interface_mapping |
Store a mapping of the OLSR internal interface ID to interface/vif. This will be required by when installing a route.
Parameters:
interface_id | the ID of the interface, as seen by libfeaclient. |
interface | the name of the interface mapped to interface_id. |
vif | the name of vif mapped to interface_id. |
inline bool get_interface_vif_by_interface_id (uint32_t interface_id,
string& interface, string& vif)
| get_interface_vif_by_interface_id |
Given an OLSR interface ID, return the interface/vif.
Parameters:
interface_id | the ID of the interface, as seen by libfeaclient. |
interface | the name of the interface mapped to interface_id. |
vif | the name of vif mapped to interface_id. |
Returns: true if interface_id was found, otherwise false.
map<uint32_t, interface_vif> _interface_vif | _interface_vif |
[protected]