class FaceManager

Class which manages all interface bindings in the OLSR routing process. More...

 
LOGO
 Annotated List  Files  Globals  Hierarchy  Index  Top

Public Methods


Detailed Description

 FaceManager (Olsr& olsr, EventLoop& ev)

FaceManager

 ~FaceManager ()

~FaceManager

MessageDecoder&  message_decoder ()

message_decoder

Neighborhood*  neighborhood ()

neighborhood

void  set_neighborhood (Neighborhood* nh)

set_neighborhood

uint32_t  get_face_count ()

get_face_count

[const]

Returns: the number of interfaces known to FaceManager.

const Face*  get_face_by_id (const OlsrTypes::FaceID faceid)
throw(BadFace)

get_face_by_id

[const]

Get a pointer to a Face given its ID.

Parameters:

faceidthe face ID.

Returns: pointer to the face. @throw BadFace if the face ID cannot be found.

void  get_face_list (list<OlsrTypes::FaceID>& face_list)

get_face_list

[const]

Fill out a list of all face IDs.

Parameters:

face_listthe list to fill out.
IPv4  get_main_addr ()

get_main_addr

[const]

Returns: the OLSR main address of this node.

bool  set_main_addr (const IPv4& addr)

set_main_addr

Attempt to set main address on node.

TODO: Track address changes on interfaces. TODO: Add a flag which does NOT allow the main address to automatically change when interfaces change.

This will fulfil the RFC requirement that the main address may never change, but will effectively halt olsr when the main address is set to an address we are not configured for.

TimeVal  get_mid_interval ()

get_mid_interval

[const]

Returns: the MID_INTERVAL protocol variable.

void  set_mid_interval (const TimeVal& interval)

set_mid_interval

Set the MID_INTERVAL protocol variable. The timer will be rescheduled if it is running.

Parameters:

intervalthe new MID_INTERVAL.
TimeVal  get_mid_hold_time ()

get_mid_hold_time

[const]

Returns: the MID_HOLD_TIME protocol variable.

TimeVal  get_dup_hold_time ()

get_dup_hold_time

[const]

Returns: the DUP_HOLD_TIME protocol variable.

void  set_dup_hold_time (const TimeVal& dup_hold_time)

set_dup_hold_time

Set the hold time for duplicate messages.

Note: This does not affect messages which are currently being tracked in the duplicate set.

Parameters:

dup_hold_timethe new hold time for duplicate messages.
void  receive (const string& interface, const string& vif, const IPv4 & dst, const uint16_t & dport, const IPv4 & src, const uint16_t & sport, uint8_t* data, const uint32_t & len)

receive

Process a received datagram.

Parameters:

interfacethe interface where the datagram was received.
vifthe vif where the datagram was received.
dstthe IPv4 destination address of the datagram.
dportthe UDP destination port of the datagram.
srcthe IPv4 source address of the datagram.
sportthe UDP source port of the datagram.
datathe received datagram.
lenthe length of the received datagram.
bool  transmit (const string& interface, const string& vif, const IPv4 & dst, const uint16_t & dport, const IPv4 & src, const uint16_t & sport, uint8_t* data, const uint32_t & len)

transmit

Transmit a datagram.

Parameters:

interfacethe interface to transmit from.
vifthe vif to transmit from.
dstthe IPv4 destination address to send to.
dportthe UDP destination port to send to.
srcthe IPv4 source address to transmit from.
sportthe UDP source port to transmit from.
datathe datagram to transmit.
lenthe length of the datagram to transmit.

Returns: true if the datagram was sent OK, otherwise false.

OlsrTypes::FaceID  create_face (const string& interface, const string& vif)
throw(BadFace)

create_face

Add a new interface.

Parameters:

interfacethe name of the interface as known to the FEA.
vifthe name of the vif as known to the FEA.

Returns: the ID of the new interface. @throw BadFace if the interface could not be added.

void  clear_faces ()

clear_faces

Clear the interface list.

bool  activate_face (const string & interface, const string & vif)

activate_face

Activate the OLSR binding to the given interface.

This means recomputing address lists and choosing the primary address on that interface; we do not yet support changing the address used.

We do not bring up any sockets until set_face_enabled().

bool  delete_face (OlsrTypes::FaceID faceid)

delete_face

Delete an interface.

Parameters:

faceidthe ID of the Face to delete.

Returns: true if the interface was deleted.

bool  recompute_addresses_face (OlsrTypes::FaceID faceid)

recompute_addresses_face

Recompute the list of protocol addresses used by OLSR to send and receive protocol control traffic on this Face.

This method works significantly differently than in OSPF. In OLSR, we need to recompute the list of addresses to which OLSR control traffic may originate from or be received on whenever the configured addresses on an interface change.

This relates only to the MID message; there is no strict parallel to the network LSA in OSPF.

Parameters:

faceidthe ID of the Face to recompute addresses on.

Returns: true if the address lists were recomputed successfully.

void  vif_status_change (const string& interface, const string& vif, bool state)

vif_status_change

Callback method to: Process a change of vif status from the FEA.

Parameters:

interfacethe name of the affected interface.
vifthe name of the affected vif.
statethe new state of the vif.
void  address_status_change (const string& interface, const string& vif, IPv4 addr, bool state)

address_status_change

Callback method to: Process a change of address status from the FEA.

Parameters:

interfacethe name of the affected interface.
vifthe name of the affected vif.
addrthe affected IPv4 interface address.
statethe new state of the address.
OlsrTypes::FaceID  get_faceid (const string& interface, const string& vif)
throw(BadFace)

get_faceid

Get the ID of an interface, given its names as known to the FEA.

Parameters:

interfacethe name of the interface to look up.
vifthe name of the vif to look up.

Returns: the ID of the face. @throw BadFace if the interface was not found.

bool  get_interface_vif_by_faceid (OlsrTypes::FaceID faceid, string & interface, string & vif)

get_interface_vif_by_faceid

Get the FEA names of an interface, given its OLSR interface ID.

Parameters:

faceidthe ID of the interface to look up.
interfacethe name of the interface if found.
vifthe name of the vif if found.

Returns: true if the interface was found, otherwise false.

bool  get_interface_cost (OlsrTypes::FaceID faceid, int& cost)

get_interface_cost

Set the cost of an interface. Used by shortest path calculation.

Parameters:

faceidthe ID of the interface to set cost for.
costthe interface cost to set.

Returns: true if the interface cost was set, otherwise false.

bool  set_face_enabled (OlsrTypes::FaceID faceid, bool enabled)

set_face_enabled

Enable the OLSR binding on the given interface.

This method is responsible for realizing the socket needed by the Face. If more than one interface is enabled, this method MAY start the MID protocol t imer.

bool  get_face_enabled (OlsrTypes::FaceID faceid)

get_face_enabled

Get the "administratively up" status of an OLSR interface.

Parameters:

faceidthe ID of Face to query enabled state for.

Returns: true if faceid is enabled.

bool  set_interface_cost (OlsrTypes::FaceID faceid, const int cost)

set_interface_cost

Set the cost of an OLSR interface.

Parameters:

faceidthe ID of Face to set cost for.
costthe cost to set.

Returns: true if the cost was set successfully, otherwise false.

bool  set_local_addr (OlsrTypes::FaceID faceid, const IPv4& local_addr)

set_local_addr

Set the IPv4 local address of an interface.

Parameters:

faceidthe ID of Face to set local address for.
local_addrthe local address to set.

Returns: true if the local address was set successfully, otherwise false.

bool  get_local_addr (OlsrTypes::FaceID faceid, IPv4& local_addr)

get_local_addr

Get the IPv4 local address of an interface.

Parameters:

faceidthe ID of Face to get local address for.
local_addrthe local address, if interface was found.

Returns: true if the local address was retrieved successfully, otherwise false.

bool  set_local_port (OlsrTypes::FaceID faceid, const uint16_t local_port)

set_local_port

Set the UDP local port of an interface.

Parameters:

faceidthe ID of Face to set local port for.
local_portthe local port to set.

Returns: true if the local port was set successfully, otherwise false.

bool  get_local_port (OlsrTypes::FaceID faceid, uint16_t& local_port)

get_local_port

Get the UDP local port of an interface.

Uses [] so can't be declared const.

Parameters:

faceidthe ID of Face to get local port for.
local_portthe UDP local port, if interface was found.

Returns: true if the local port was retrieved successfully, otherwise false.

bool  set_all_nodes_addr (OlsrTypes::FaceID faceid, const IPv4& all_nodes_addr)

set_all_nodes_addr

Set the IPv4 all-nodes address of an interface.

Parameters:

faceidthe ID of Face to set all-nodes address for.
all_nodes_addrthe all-nodes address to set.

Returns: true if the all-nodes address was set successfully, otherwise false.

bool  get_all_nodes_addr (OlsrTypes::FaceID faceid, IPv4& all_nodes_addr)

get_all_nodes_addr

Get the IPv4 all-nodes address of an interface.

Uses [] so can't be declared const.

Parameters:

faceidthe ID of Face to get all-nodes address for.
all_nodes_addroutput variable which will contain the all-nodes address.

Returns: true if the all-nodes address was retrieved successfully, otherwise false.

bool  set_all_nodes_port (OlsrTypes::FaceID faceid, const uint16_t all_nodes_port)

set_all_nodes_port

Set the UDP all-nodes port of an interface.

Parameters:

faceidthe ID of Face to set the all-nodes port for.
all_nodes_portthe all-nodes port to set.

Returns: true if the all-nodes port was set successfully, otherwise false.

bool  get_all_nodes_port (OlsrTypes::FaceID faceid, uint16_t& all_nodes_port)

get_all_nodes_port

Get the UDP all-nodes port of an interface.

Parameters:

faceidthe ID of Face to get the all-nodes port for.
all_nodes_portoutput variable which will contain the all-nodes port.

Returns: true if the all-nodes port was retrieved successfully, otherwise false.

bool  flood_message (Message* message)

flood_message

Flood a message on all interfaces, performing appropriate fragmentation for each interface.

Parameters:

messageThe message to flood, will be deleted by this method.
uint16_t  get_msg_seqno ()

get_msg_seqno

Returns: the next sequence number to use for a transmitted Message.

void  stop_all_timers ()

stop_all_timers

Stop all timers (HELLO and MID).

void  start_hello_timer ()

start_hello_timer

void  stop_hello_timer ()

stop_hello_timer

void  restart_hello_timer ()

restart_hello_timer

void  reschedule_hello_timer ()

reschedule_hello_timer

Reschedule the HELLO protocol timer, if its interval changed.

void  reschedule_immediate_hello_timer ()

reschedule_immediate_hello_timer

Reschedule the HELLO protocol timer to fire as soon as possible.

bool  event_send_hello ()

event_send_hello

Broadcast a HELLO message on each enabled interface.

void  start_mid_timer ()

start_mid_timer

void  stop_mid_timer ()

stop_mid_timer

void  restart_mid_timer ()

restart_mid_timer

void  reschedule_mid_timer ()

reschedule_mid_timer

Reschedule the MID protocol timer, if its interval changed.

void  reschedule_immediate_mid_timer ()

reschedule_immediate_mid_timer

Reschedule the MID protocol timer to fire as soon as possible.

bool  event_send_mid ()

event_send_mid

Callback method to: Send a MID message on each enabled interface.

void  set_hello_interval (const TimeVal& interval)

set_hello_interval

Set the HELLO_INTERVAL protocol variable.

The HELLO timer will be rescheduled if running.

TimeVal  get_hello_interval ()

get_hello_interval

Returns: the HELLO_INTERVAL protocol variable.

TimeVal  get_max_jitter ()

get_max_jitter

Returns: the MAX_JITTER protocol variable.

inline uint32_t  get_enabled_face_count ()

get_enabled_face_count

[const]

Returns: the number of interfaces enabled for OLSR.

void  add_message_cb (MessageReceiveCB cb)

add_message_cb

Register an OLSR protocol message handler.

MessageReceiveCBs are invoked in reverse order to which they have been registered. The FaceManager always registers a handler for unknown message types first, so that such messages will be forwarded, even if XORP has no handler for it. Each handler thus registered is given an opportunity to claim the message as its own, by returning true.

C++ dynamic casts are used at runtime by each MessageReceiveCB to determine if it should consume the message.

Parameters:

cbthe message receive callback function to register.
bool  delete_message_cb (MessageReceiveCB cb)

delete_message_cb

Deregister an OLSR protocol message handler.

Parameters:

cbthe message receive callback function to deregister.

Returns: true if cb was deregistered, otherwise false.

bool  event_receive_unknown (Message* msg, const IPv4& remote_addr, const IPv4& local_addr)

event_receive_unknown

Callback method to: forward a Message of unknown type to the rest of the OLSR topology.

bool  forward_message (const IPv4& remote_addr, Message* msg)

forward_message

Implement the Default Forwarding Algorithm (Section 3.4.1).

Parameters:

remote_addrthe interface address of the node which sent or forwarded this message to us. Note: This may not be the origin if the message has previously been forwarded.
msgthe message itself.

Returns: true if the message will be forwarded to other nodes.

bool  is_duplicate_message (const Message* msg)

is_duplicate_message

[const]

Check if a message is a previously seen duplicate.

Returns: true if the message is a duplicate and should neither be processed or forwarded.

bool  is_forwarded_message (const Message* msg)

is_forwarded_message

[const]

Check if a message should be forwarded, according to the default forwarding rules.

Parameters:

msgthe message to check.

Returns: true if the message SHOULD NOT be forwarded, false if it is OK to forward the message.

DupeTuple*  get_dupetuple (const IPv4& origin_addr, const uint16_t seqno)

get_dupetuple

[const]

Get a pointer to a tuple in the duplicate set for a message, given its origin address and sequence number.

Avoid throwing an exception as this path may be called very frequently when forwarding or flooding messages. This however means we return a pointer.

Parameters:

origin_addrthe protocol address of the message origin.
seqnothe sequence number of the message.

Returns: the pointer to the duplicate set entry, or 0 if none exists.

void  update_dupetuple (const Message* msg, const bool is_forwarded)

update_dupetuple

Update or create an entry in the duplicate message set.

Given a message, update or create its duplicate set tuple in order that we can detect if other nodes in the OLSR domain loop a message back to us. OLSR uses histogram based message loop detection, as the shortest path tree may be out of phase with the real network topology.

Parameters:

msgthe message itself.
is_forwardedtrue if the message will be forwarded.
void  event_dupetuple_expired (const IPv4& origin, const uint16_t seqno)

event_dupetuple_expired

Delete a duplicate set entry when it expires.

void  clear_dupetuples ()

clear_dupetuples

Clear the duplicate set.

bool  is_local_addr (const IPv4& addr)

is_local_addr

Returns: true if the given address belongs to any locally configured interface.

bool  get_face_stats (const string& ifname, const string& vifname, FaceCounters& stats)

get_face_stats

Get the statistics for the given face.

Parameters:

ifnamethe name of the interface to retrieve stats for.
vifnamethe name of the vif to retrieve stats for.
statsoutput; reference to an empty FaceCounters object.

Returns: true if the stats were retrieved, otherwise false.


Generated by: pavlin on kobe.xorp.net on Wed Jan 7 19:11:15 2009, using kdoc 2.0a54+XORP.