xorp

Ospf< A > Class Template Reference

List of all members.

Public Member Functions

 Ospf (OspfTypes::Version version, EventLoop &eventloop, IO< A > *io)
OspfTypes::Version version ()
bool running ()
ProcessStatus status (string &reason)
 Status of process.
void shutdown ()
 Shutdown OSPF.
bool transmit (const string &interface, const string &vif, A dst, A src, int ttl, uint8_t *data, uint32_t len)
 Used to send traffic on the IO interface.
void receive (const string &interface, const string &vif, A dst, A src, uint8_t *data, uint32_t len)
 The callback method that is called when data arrives on the IO interface.
bool enable_interface_vif (const string &interface, const string &vif)
 Enable the interface/vif to receive frames.
bool disable_interface_vif (const string &interface, const string &vif)
 Disable this interface/vif from receiving frames.
bool enabled (const string &interface, const string &vif)
 Is this interface/vif enabled? This is a question asked of the FEA, has the interface/vif been marked as up.
bool enabled (const string &interface, const string &vif, A address)
 Is this interface/vif/address enabled? This is a question asked of the FEA, has the interface/vif been marked as up.
void register_vif_status (typename IO< A >::VifStatusCb cb)
 Add a callback for tracking the interface/vif status.
void register_address_status (typename IO< A >::AddressStatusCb cb)
 Add a callback for tracking the interface/vif/address status.
bool get_addresses (const string &interface, const string &vif, list< A > &addresses) const
 Get all addresses associated with this interface/vif.
bool get_link_local_address (const string &interface, const string &vif, A &address)
 Get a link local address for this interface/vif if available.
bool get_interface_id (const string &interface, const string &vif, uint32_t &interface_id)
 Get the interface ID required for OSPFv3.
bool get_interface_vif_by_interface_id (uint32_t interface_id, string &interface, string &vif)
 Given an interface ID return the interface and vif.
bool get_prefix_length (const string &interface, const string &vif, A address, uint16_t &prefix_length)
uint32_t get_mtu (const string &interface)
bool join_multicast_group (const string &interface, const string &vif, A mcast)
 On the interface/vif join this multicast group.
bool leave_multicast_group (const string &interface, const string &vif, A mcast)
 On the interface/vif leave this multicast group.
bool set_hello_interval (const string &interface, const string &vif, OspfTypes::AreaID area, uint16_t hello_interval)
 Set the hello interval in seconds.
bool create_virtual_link (OspfTypes::RouterID rid)
 Create a virtual link.
bool delete_virtual_link (OspfTypes::RouterID rid)
 Delete a virtual link.
bool transit_area_virtual_link (OspfTypes::RouterID rid, OspfTypes::AreaID transit_area)
 Attach this transit area to the neighbours router ID.
bool set_router_priority (const string &interface, const string &vif, OspfTypes::AreaID area, uint8_t priority)
 Set router priority.
bool set_router_dead_interval (const string &interface, const string &vif, OspfTypes::AreaID area, uint32_t router_dead_interval)
 Set the router dead interval in seconds.
bool set_interface_cost (const string &interface, const string &vif, OspfTypes::AreaID area, uint16_t interface_cost)
 Set the interface cost.
bool set_retransmit_interval (const string &interface, const string &vif, OspfTypes::AreaID area, uint16_t retransmit_interval)
 Set the RxmtInterval.
bool set_inftransdelay (const string &interface, const string &vif, OspfTypes::AreaID area, uint16_t inftransdelay)
 Set InfTransDelay.
bool set_simple_authentication_key (const string &interface, const string &vif, OspfTypes::AreaID area, const string &password, string &error_msg)
 Set a simple password authentication key.
bool delete_simple_authentication_key (const string &interface, const string &vif, OspfTypes::AreaID area, string &error_msg)
 Delete a simple password authentication key.
bool set_md5_authentication_key (const string &interface, const string &vif, OspfTypes::AreaID area, uint8_t key_id, const string &password, const TimeVal &start_timeval, const TimeVal &end_timeval, const TimeVal &max_time_drift, string &error_msg)
 Set an MD5 authentication key.
bool delete_md5_authentication_key (const string &interface, const string &vif, OspfTypes::AreaID area, uint8_t key_id, string &error_msg)
 Delete an MD5 authentication key.
bool set_passive (const string &interface, const string &vif, OspfTypes::AreaID area, bool passive, bool host)
 Toggle the passive status of an interface.
bool originate_default_route (OspfTypes::AreaID area, bool enable)
 If this is a "stub" or "nssa" area toggle the sending of a default route.
bool stub_default_cost (OspfTypes::AreaID area, uint32_t cost)
 Set the StubDefaultCost, the default cost sent in a default route in a "stub" or "nssa" area.
bool summaries (OspfTypes::AreaID area, bool enable)
 Toggle the sending of summaries into "stub" or "nssa" areas.
bool set_ip_router_alert (bool alert)
 Send router alerts in IP packets or not.
bool area_range_add (OspfTypes::AreaID area, IPNet< A > net, bool advertise)
 Add area range.
bool area_range_delete (OspfTypes::AreaID area, IPNet< A > net)
 Delete area range.
bool area_range_change_state (OspfTypes::AreaID area, IPNet< A > net, bool advertise)
 Change the advertised state of this area.
bool get_lsa (const OspfTypes::AreaID area, const uint32_t index, bool &valid, bool &toohigh, bool &self, vector< uint8_t > &lsa)
 Get a single lsa from an area.
bool get_area_list (list< OspfTypes::AreaID > &areas) const
 Get a list of all the configured areas.
bool get_neighbour_list (list< OspfTypes::NeighbourID > &neighbours) const
 Get a list of all the neighbours.
bool get_neighbour_info (OspfTypes::NeighbourID nid, NeighbourInfo &ninfo) const
 Get state information about this neighbour.
bool clear_database ()
 Clear the database.
bool add_route (IPNet< A > net, A nexthop, uint32_t nexthop_id, uint32_t metric, bool equal, bool discard, const PolicyTags &policytags)
 Add route.
bool replace_route (IPNet< A > net, A nexthop, uint32_t nexthop_id, uint32_t metric, bool equal, bool discard, const PolicyTags &policytags)
 Replace route.
bool delete_route (IPNet< A > net)
 Delete route.
void configure_filter (const uint32_t &filter, const string &conf)
 Configure a policy filter.
void reset_filter (const uint32_t &filter)
 Reset a policy filter.
void push_routes ()
 Push routes through policy filters for re-filtering.
bool originate_route (const IPNet< A > &net, const A &nexthop, const uint32_t &metric, const PolicyTags &policytags)
 Originate a route.
bool withdraw_route (const IPNet< A > &net)
 Withdraw a route.
OspfTypes::Version get_version () const
 Get the current OSPF version.
EventLoopget_eventloop ()
void set_testing (bool testing)
 The test status of OSPF.
bool get_testing () const
PeerManager< A > & get_peer_manager ()
RoutingTable< A > & get_routing_table ()
LsaDecoderget_lsa_decoder ()
PolicyFiltersget_policy_filters ()
uint8_t get_instance_id () const
 Get the Instance ID.
void set_instance_id (uint8_t instance_id)
 Set the Instance ID.
OspfTypes::RouterID get_router_id () const
 Get the Router ID.
void set_router_id (OspfTypes::RouterID id)
 Set the Router ID.
bool get_rfc1583_compatibility () const
 Get RFC 1583 compatibility.
void set_rfc1583_compatibility (bool compatibility)
 Set RFC 1583 compatibility.
Tracetrace ()

Private Attributes

const OspfTypes::Version _version
EventLoop_eventloop
bool _testing
IO< A > * _io
string _reason
ProcessStatus _process_status
PacketDecoder _packet_decoder
LsaDecoder _lsa_decoder
PeerManager< A > _peer_manager
RoutingTable< A > _routing_table
PolicyFilters _policy_filters
uint8_t _instance_id
OspfTypes::RouterID _router_id
bool _rfc1583_compatibility
map< string, uint32_t > _iidmap
Trace _trace

template<typename A>
class Ospf< A >


Member Function Documentation

template<typename A>
bool Ospf< A >::add_route ( IPNet< A >  net,
nexthop,
uint32_t  nexthop_id,
uint32_t  metric,
bool  equal,
bool  discard,
const PolicyTags policytags 
)

Add route.

Parameters:
netnetwork
nexthop
nexthop_idinterface ID towards the nexthop
metricto network
equaltrue if this in another route to the same destination.
discardtrue if this is a discard route.
policytagspolicy info to the RIB.
template<typename A >
void Ospf< A >::configure_filter ( const uint32_t &  filter,
const string &  conf 
)

Configure a policy filter.

Parameters:
filterId of filter to configure.
confConfiguration of filter.
template<typename A >
bool Ospf< A >::create_virtual_link ( OspfTypes::RouterID  rid)

Create a virtual link.

Parameters:
ridneighbours router ID.
template<typename A >
bool Ospf< A >::delete_md5_authentication_key ( const string &  interface,
const string &  vif,
OspfTypes::AreaID  area,
uint8_t  key_id,
string &  error_msg 
)

Delete an MD5 authentication key.

Note that after the deletion if there are no more valid MD5 keys, the MD5 authentication handler is replaced with a Null authentication handler.

Parameters:
interfacethe interface name.
vifthe vif name.
areathe area ID.
key_idthe ID of the key to delete.
theerror message (if error).
Returns:
true on success, otherwise false.
template<typename A >
bool Ospf< A >::delete_simple_authentication_key ( const string &  interface,
const string &  vif,
OspfTypes::AreaID  area,
string &  error_msg 
)

Delete a simple password authentication key.

Note that after the deletion the simple password authentication handler is replaced with a Null authentication handler.

Parameters:
interfacethe interface name.
vifthe vif name.
areathe area ID.
theerror message (if error).
Returns:
true on success, otherwise false.
template<typename A >
bool Ospf< A >::delete_virtual_link ( OspfTypes::RouterID  rid)

Delete a virtual link.

Parameters:
ridneighbours router ID.
template<typename A >
bool Ospf< A >::enabled ( const string &  interface,
const string &  vif 
)

Is this interface/vif enabled? This is a question asked of the FEA, has the interface/vif been marked as up.

Returns:
true if it is.
template<typename A>
bool Ospf< A >::enabled ( const string &  interface,
const string &  vif,
address 
)

Is this interface/vif/address enabled? This is a question asked of the FEA, has the interface/vif been marked as up.

Returns:
true if it is.
template<typename A>
bool Ospf< A >::get_addresses ( const string &  interface,
const string &  vif,
list< A > &  addresses 
) const

Get all addresses associated with this interface/vif.

Parameters:
interfacethe name of the interface
vifthe name of the vif
addresses(out argument) list of associated addresses
Returns:
true if there are no errors.
template<typename A>
EventLoop& Ospf< A >::get_eventloop ( ) [inline]
Returns:
a reference to the eventloop, required for timers etc...
template<typename A >
bool Ospf< A >::get_interface_id ( const string &  interface,
const string &  vif,
uint32_t &  interface_id 
)

Get the interface ID required for OSPFv3.

The vif argument is required for virtual links.

template<typename A>
bool Ospf< A >::get_link_local_address ( const string &  interface,
const string &  vif,
A &  address 
)

Get a link local address for this interface/vif if available.

Parameters:
interfacethe name of the interface
vifthe name of the vif
address(out argument) set if address is found.
Returns:
true if a link local address is available.
template<typename A >
bool Ospf< A >::get_lsa ( const OspfTypes::AreaID  area,
const uint32_t  index,
bool &  valid,
bool &  toohigh,
bool &  self,
vector< uint8_t > &  lsa 
)

Get a single lsa from an area.

A stateless mechanism to get LSAs. The client of this interface should start from zero and continue to request LSAs (incrementing index) until toohigh becomes true.

Parameters:
areadatabase that is being searched.
indexinto database starting from 0.
validtrue if a LSA has been returned. Some index values do not contain LSAs. This should not be considered an error.
toohightrue if no more LSA exist after this index.
selfif true this LSA was originated by this router.
lsaif valid is true the LSA at index.
template<typename A>
LsaDecoder& Ospf< A >::get_lsa_decoder ( ) [inline]
Returns:
a reference to the LSA decoder.
template<typename A >
uint32_t Ospf< A >::get_mtu ( const string &  interface)
Returns:
the mtu for this interface.
template<typename A >
bool Ospf< A >::get_neighbour_info ( OspfTypes::NeighbourID  nid,
NeighbourInfo ninfo 
) const

Get state information about this neighbour.

Parameters:
nidneighbour information is being request about.
ninfoif neighbour is found its information.
template<typename A>
PeerManager<A>& Ospf< A >::get_peer_manager ( ) [inline]
Returns:
a reference to the PeerManager.
template<typename A>
PolicyFilters& Ospf< A >::get_policy_filters ( ) [inline]
Returns:
a reference to the policy filters
template<typename A>
bool Ospf< A >::get_prefix_length ( const string &  interface,
const string &  vif,
address,
uint16_t &  prefix_length 
)
Returns:
prefix length for this address.
template<typename A>
RoutingTable<A>& Ospf< A >::get_routing_table ( ) [inline]
Returns:
a reference to the RoutingTable.
template<typename A>
bool Ospf< A >::get_testing ( ) const [inline]
Returns:
true if OSPF is being tested.
template<typename A>
bool Ospf< A >::originate_route ( const IPNet< A > &  net,
const A &  nexthop,
const uint32_t &  metric,
const PolicyTags policytags 
)

Originate a route.

Parameters:
netto announce
nexthopto forward to
metric
policytagspolicy-tags associated with route.
Returns:
true on success
template<typename A>
void Ospf< A >::receive ( const string &  interface,
const string &  vif,
dst,
src,
uint8_t *  data,
uint32_t  len 
)

The callback method that is called when data arrives on the IO interface.

All packets for OSPF are received through this interface.

All good packets are sent to the peer manager which verifies that the packet is expected and authenticates the packet if necessary. The peer manager can choose to accept the packet in which case it becomes the owner. If the packet is rejected this routine will delete the packet.

template<typename A>
void Ospf< A >::register_address_status ( typename IO< A >::AddressStatusCb  cb) [inline]

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:
cbthe callback to register.
template<typename A>
void Ospf< A >::register_vif_status ( typename IO< A >::VifStatusCb  cb) [inline]

Add a callback for tracking the interface/vif status.

The callback will be invoked whenever the status of the tuple (interface, vif) is changed from disabled to enabled or vice-versa.

Parameters:
cbthe callback to register.
template<typename A>
bool Ospf< A >::replace_route ( IPNet< A >  net,
nexthop,
uint32_t  nexthop_id,
uint32_t  metric,
bool  equal,
bool  discard,
const PolicyTags policytags 
)

Replace route.

Parameters:
netnetwork
nexthop
nexthop_idinterface ID towards the nexthop
metricto network
equaltrue if this in another route to the same destination.
discardtrue if this is a discard route.
policytagspolicy info to the RIB.
template<typename A >
void Ospf< A >::reset_filter ( const uint32_t &  filter)

Reset a policy filter.

Parameters:
filterId of filter to reset.
template<typename A>
bool Ospf< A >::running ( ) [inline]
Returns:
true if ospf should still be running.
template<typename A >
bool Ospf< A >::set_md5_authentication_key ( const string &  interface,
const string &  vif,
OspfTypes::AreaID  area,
uint8_t  key_id,
const string &  password,
const TimeVal start_timeval,
const TimeVal end_timeval,
const TimeVal max_time_drift,
string &  error_msg 
)

Set an MD5 authentication key.

Note that the current authentication handler is replaced with an MD5 authentication handler.

Parameters:
interfacethe interface name.
vifthe vif name.
areathe area ID.
key_idunique ID associated with key.
passwordphrase used for MD5 digest computation.
start_timevalstart time when key becomes valid.
end_timevalend time when key becomes invalid.
max_time_driftthe maximum time drift among all routers.
theerror message (if error).
Returns:
true on success, otherwise false.
template<typename A >
bool Ospf< A >::set_simple_authentication_key ( const string &  interface,
const string &  vif,
OspfTypes::AreaID  area,
const string &  password,
string &  error_msg 
)

Set a simple password authentication key.

Note that the current authentication handler is replaced with a simple password authentication handler.

Parameters:
interfacethe interface name.
vifthe vif name.
areathe area ID.
passwordthe password to set.
theerror message (if error).
Returns:
true on success, otherwise false.
template<typename A>
OspfTypes::Version Ospf< A >::version ( ) [inline]
Returns:
version of OSPF this implementation represents.
template<typename A>
bool Ospf< A >::withdraw_route ( const IPNet< A > &  net)

Withdraw a route.

Parameters:
netto withdraw
Returns:
true on success

The documentation for this class was generated from the following files:
 All Classes Namespaces Functions Variables Typedefs Enumerations