There is one Face per physical if/vif which OLSR is configured to run on.
Whilst an IPv4 interface may have multiple addresses, OLSR uses IPv4 addresses as primary keys in the protocol. Therefore it is necessary to track the first configured address on each vif, and use that as the Face's address. This happens in the absence of any IPv4 link-scope addresses as the system does not have any concept of such things. This may be considered the same limitation as IGMP has.
The analogue in XORP's OSPF implementation is class Peer. Unlike OSPF, we do not split Face in the same way as Peer/PeerOut are split, as there is no concept of Areas in version 1 of OLSR.
A face is associated with Links to each Neighbor. An instance of Olsr must have at least one Face configured to run Olsr, otherwise, it isn't an Olsr router. If no Faces exist, OLSR is not active. If only one Face exists, only a subset of the full OLSR protocol is used.
Face (Olsr& olsr, FaceManager& fm, Neighborhood* nh,
MessageDecoder& md,
const string& interface, const string& vif,
OlsrTypes::FaceID id)
| Face |
inline OlsrTypes::FaceID id ()
| id |
[const]
Returns: the internal ID of this OLSR interface.
string interface ()
| interface |
[const]
Returns: the name of this OLSR interface as known to the FEA.
string vif ()
| vif |
[const]
Returns: the name of this OLSR interface's vif as known to the FEA.
FaceCounters& counters ()
| counters |
Returns: the protocol counters for this OLSR interface.
const FaceCounters& counters ()
| counters |
[const]
Returns: the protocol counters for this OLSR interface.
inline uint32_t mtu ()
| mtu |
[const]
Returns: the MTU of this interface.
inline void set_mtu (const uint32_t mtu)
| set_mtu |
Set the MTU of this interface.
inline uint32_t get_pkt_seqno ()
| get_pkt_seqno |
Returns: the next available sequence number for a Packet to be sent from this OLSR interface.
inline bool enabled ()
| enabled |
[const]
Returns: true if this OLSR interface is administratively up.
inline IPv4 all_nodes_addr ()
| all_nodes_addr |
[const]
Returns: the "all nodes" address configured for this OLSR interface.
inline uint16_t all_nodes_port ()
| all_nodes_port |
[const]
Returns: the "all nodes" UDP port configured for this OLSR interface.
inline IPv4 local_addr ()
| local_addr |
[const]
Returns: the source address configured for this OLSR interface.
inline uint16_t local_port ()
| local_port |
[const]
Returns: the UDP source port configured for this OLSR interface.
inline int cost ()
| cost |
[const]
Returns: the default cost of transiting this OLSR interface. Used by the shortest path algorithm.
void set_enabled (bool value)
| set_enabled |
Set the "administratively up" state of an OLSR interface.
Parameters:
value | true if this interface is enabled for OLSR, otherwise false. |
inline void set_all_nodes_addr (const IPv4& all_nodes_addr)
| set_all_nodes_addr |
Set the "all nodes" address for this OLSR interface.
Parameters:
all_nodes_addr | the "all nodes" address to set. |
inline void set_all_nodes_port (const uint16_t all_nodes_port)
| set_all_nodes_port |
Set the "all nodes" UDP port for this OLSR interface.
Parameters:
all_nodes_port | the "all nodes" port to set. |
inline void set_local_addr (const IPv4& local_addr)
| set_local_addr |
Set the local address for this OLSR interface.
Parameters:
local_addr | the local address to set. |
inline void set_local_port (const uint16_t local_port)
| set_local_port |
Set the UDP local port for this OLSR interface.
Parameters:
local_port | the local port to set. |
inline void set_cost (int cost)
| set_cost |
Set the shortest path tree cost for this OLSR interface.
Parameters:
cost | the cost to set. |
bool transmit (uint8_t* data, const uint32_t& len)
| transmit |
Transmit a datagram on this Face.
Parameters:
data | the datagram to be sent. |
len | the length of the datagram to be sent. |
Returns: true if the datagram was successfully transmitted.
void originate_hello ()
| originate_hello |
Originate a HELLO message on this interface.
The message thus originated will be filled out appropriately, containing the relevant OLSR protocol state as seen from this Face.
TODO: Perform MTU-based message segmentation.