xorp

DebugIO< A > Class Template Reference

The DebugIO class realizes the interface IO. More...

#include <debug_io.hh>

Inheritance diagram for DebugIO< A >:
IO< A > IO< A > ServiceBase ServiceBase ServiceBase ServiceBase BugCatcher BugCatcher BugCatcher BugCatcher

List of all members.

Classes

struct  DebugRouteEntry

Public Member Functions

 DebugIO (TestInfo &info, EventLoop &eventloop)
void pp (const string &which, int level, const string &interface, const string &vif, IPv4 dst, uint16_t dport, IPv4 src, uint16_t sport, uint8_t *data, uint32_t len)
 Pretty print frames.
int startup ()
 Start service.
int shutdown ()
 Shutdown service.
bool enable_address (const string &interface, const string &vif, const IPv4 &address, const uint16_t &port, const IPv4 &all_nodes_address)
 Enable an IPv4 address and port for OLSR datagram reception.
bool disable_address (const string &interface, const string &vif, const IPv4 &address, const uint16_t &port)
 Disable an IPv4 address and port for OLSR datagram reception.
bool is_interface_enabled (const string &interface) const
 Test whether this interface is enabled.
bool is_vif_enabled (const string &interface, const string &vif) const
 Test whether this interface/vif is enabled.
bool is_vif_broadcast_capable (const string &interface, const string &vif)
 Return true if the given vif is broadcast capable.
bool is_vif_multicast_capable (const string &interface, const string &vif)
 Return true if the given vif is multicast capable.
bool is_vif_loopback (const string &interface, const string &vif)
 Return true if the given vif is a loopback vif.
bool is_address_enabled (const string &interface, const string &vif, const IPv4 &address) const
 Test whether this interface/vif/address is enabled.
bool get_addresses (const string &interface, const string &vif, list< IPv4 > &addresses) const
 Get all addresses associated with this interface/vif.
bool get_broadcast_address (const string &interface, const string &vif, const IPv4 &address, IPv4 &bcast_address) const
 Get the broadcast address associated with this IPv4 address.
bool get_interface_id (const string &interface, uint32_t &interface_id)
uint32_t get_mtu (const string &interface)
int packets () const
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 a UDP datagram from src:sport to dst:dport, preferably on the given link.
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 frames.
bool register_forward (const string &interface, const string &vif, IO::ReceiveCallback cb)
 Register where datagrams should be forwarded.
void unregister_forward (const string &interface, const string &vif)
 Unregister an existing callback registered with register_forward().
bool add_route (IPv4Net net, IPv4 nexthop, uint32_t nexthop_id, uint32_t metric, const PolicyTags &policytags)
 Add route.
bool replace_route (IPv4Net net, IPv4 nexthop, uint32_t nexthop_id, uint32_t metric, const PolicyTags &policytags)
 Replace route.
bool delete_route (IPv4Net net)
 Delete route.
void routing_table_empty ()
uint32_t routing_table_size ()
bool routing_table_verify (IPv4Net net, IPv4 nexthop, uint32_t metric)
 Verify that this route is in the routing table.
void routing_table_dump (ostream &o)
 Dump the routing table contents to the given ostream (not necessarily what's in the TestInfo).
 DebugIO (TestInfo &info, OspfTypes::Version version, EventLoop &eventloop)
void pp (const string &which, int level, const string &interface, const string &vif, A dst, A src, uint8_t *data, uint32_t len)
 Pretty print frames.
int startup ()
 Start service.
int shutdown ()
 Shutdown service.
bool send (const string &interface, const string &vif, A dst, A src, int ttl, uint8_t *data, uint32_t len)
 Send Raw frames.
bool register_forward (typename IO< A >::ReceiveCallback cb)
 Register where frames should be forwarded.
void receive (const string &interface, const string &vif, A dst, A src, uint8_t *data, uint32_t len)
 Receive frames.
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 is_interface_enabled (const string &interface) const
 Test whether this interface is enabled.
bool is_vif_enabled (const string &interface, const string &vif) const
 Test whether this interface/vif is enabled.
bool is_address_enabled (const string &interface, const string &vif, const A &address) const
 Test whether this interface/vif/address is enabled.
bool get_addresses (const string &interface, const string &vif, list< A > &) const
 Get all addresses associated with this interface/vif.
bool get_link_local_address (const string &interface, const string &vif, IPv4 &address)
bool get_link_local_address (const string &interface, const string &vif, IPv6 &address)
bool get_interface_id (const string &interface, uint32_t &interface_id)
 Get the ID of the interface, as seen by libfeaclient.
uint32_t get_prefix_length (const string &interface, const string &vif, A address)
uint32_t get_mtu (const string &interface)
 Get the MTU for an 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 add_route (IPNet< A > net, A nexthop, uint32_t nexthop_id, uint32_t metric, bool equal, bool discard, const PolicyTags &policytags)
 Add route to RIB.
bool replace_route (IPNet< A > net, A nexthop, uint32_t nexthop_id, uint32_t metric, bool equal, bool discard, const PolicyTags &policytags)
 Replace route in RIB.
bool delete_route (IPNet< A > net)
 Delete route from RIB.
void routing_table_empty ()
 A debugging entry point.
uint32_t routing_table_size ()
bool routing_table_verify (IPNet< A > net, A nexthop, uint32_t metric, bool equal, bool discard)
 Verify that this route is in the routing table.
int packets ()
 Return the number of packets that have seen so far.

Private Attributes

TestInfo_info
EventLoop_eventloop
int _packets
uint32_t _next_interface_id
map< string, uint32_t > _interface_ids
MessageDecoder _md
map< pair< string, string >
, IO::ReceiveCallback
_forward_cbs
 Forwarding callback, one per emulated interface, so that interfaces may be bound to separate EmulateSubnet instances.
map< IPv4Net, DebugRouteEntry_routing_table
PacketDecoder _dec
LsaDecoder _lsa_decoder
IO< A >::ReceiveCallback _forward_cb
map< IPNet< A >, DebugRouteEntry_routing_table

Detailed Description

template<typename A>
class DebugIO< A >

The DebugIO class realizes the interface IO.

Debugging implementation of IO for use by test programs.

It is used for OLSR regression tests.


Member Function Documentation

template<typename A >
bool DebugIO< A >::add_route ( IPv4Net  net,
IPv4  nexthop,
uint32_t  faceid,
uint32_t  metric,
const PolicyTags policytags 
) [virtual]

Add route.

Parameters:
netnetwork
nexthop
faceidinterface ID towards the nexthop
metricto network
policytagspolicy info to the RIB.
Returns:
true if the route was added OK, otherwise false.

Implements IO< A >.

template<typename A >
bool DebugIO< A >::delete_route ( IPv4Net  net) [virtual]

Delete route.

Parameters:
netnetwork
Returns:
true if the route was deleted OK, otherwise false.

Implements IO< A >.

template<typename A >
bool DebugIO< A >::get_addresses ( const string &  interface,
const string &  vif,
list< A > &  addresses 
) const [inline, virtual]

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.

Implements IO< A >.

template<typename A >
bool DebugIO< A >::get_addresses ( const string &  interface,
const string &  vif,
list< IPv4 > &  addresses 
) const [virtual]

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.

Implements IO< A >.

template<typename A >
bool DebugIO< A >::get_broadcast_address ( const string &  interface,
const string &  vif,
const IPv4 address,
IPv4 bcast_address 
) const [virtual]

Get the broadcast address associated with this IPv4 address.

Parameters:
interfacethe name of the interface
vifthe name of the vif
addressthe IPv4 interface address
bcast_address(out argument) the IPv4 broadcast address
Returns:
true if there are no errors.

Implements IO< A >.

template<typename A >
bool DebugIO< A >::get_interface_id ( const string &  interface,
uint32_t &  interface_id 
) [inline, virtual]

Get the ID of the interface, as seen by libfeaclient.

Parameters:
interfacethe name of the interface.
interface_id(out argument) interface ID.
Returns:
the interface id for this interface.

Implements IO< A >.

template<typename A >
bool DebugIO< A >::get_interface_id ( const string &  interface,
uint32_t &  interface_id 
) [virtual]
Returns:
the interface id for this interface, as seen by libfeaclient.

Implements IO< A >.

template<typename A >
uint32_t DebugIO< A >::get_mtu ( const string &  interface) [inline, virtual]

Get the MTU for an interface.

Parameters:
interfacethe name of the interface.
Returns:
the mtu for this interface.

Implements IO< A >.

template<typename A >
uint32_t DebugIO< A >::get_mtu ( const string &  interface) [virtual]
Returns:
the mtu for this interface.

Implements IO< A >.

template<typename A >
uint32_t DebugIO< A >::get_prefix_length ( const string &  interface,
const string &  vif,
address 
) [inline, virtual]
Returns:
prefix length for this address.

Implements IO< A >.

template<typename A >
bool DebugIO< A >::is_address_enabled ( const string &  interface,
const string &  vif,
const A &  address 
) const [inline, virtual]

Test whether this interface/vif/address is enabled.

Returns:
true if it exists and is enabled, otherwise false.

Implements IO< A >.

template<typename A >
bool DebugIO< A >::is_address_enabled ( const string &  interface,
const string &  vif,
const IPv4 address 
) const [virtual]

Test whether this interface/vif/address is enabled.

Returns:
true if it exists and is enabled, otherwise false.

Implements IO< A >.

template<typename A >
bool DebugIO< A >::is_interface_enabled ( const string &  interface) const [inline, virtual]

Test whether this interface is enabled.

Returns:
true if it exists and is enabled, otherwise false.

Implements IO< A >.

template<typename A >
bool DebugIO< A >::is_interface_enabled ( const string &  interface) const [virtual]

Test whether this interface is enabled.

Returns:
true if it exists and is enabled, otherwise false.

Implements IO< A >.

template<typename A >
bool DebugIO< A >::is_vif_enabled ( const string &  interface,
const string &  vif 
) const [inline, virtual]

Test whether this interface/vif is enabled.

Returns:
true if it exists and is enabled, otherwise false.

Implements IO< A >.

template<typename A >
bool DebugIO< A >::is_vif_enabled ( const string &  interface,
const string &  vif 
) const [virtual]

Test whether this interface/vif is enabled.

Returns:
true if it exists and is enabled, otherwise false.

Implements IO< A >.

template<typename A >
int DebugIO< A >::packets ( ) const [inline]
Returns:
the number of packets which have transited this interface.
template<typename A >
void DebugIO< A >::pp ( const string &  which,
int  level,
const string &  interface,
const string &  vif,
IPv4  dst,
uint16_t  dport,
IPv4  src,
uint16_t  sport,
uint8_t *  data,
uint32_t  len 
)

Pretty print frames.

Specific to DebugIo.

template<typename A >
void DebugIO< A >::pp ( const string &  which,
int  level,
const string &  interface,
const string &  vif,
dst,
src,
uint8_t *  data,
uint32_t  len 
) [inline]

Pretty print frames.

Specific to DebugIO.

template<typename A >
void DebugIO< A >::receive ( const string &  interface,
const string &  vif,
dst,
src,
uint8_t *  data,
uint32_t  len 
) [inline]

Receive frames.

Specific to DebugIO.

template<typename A >
void DebugIO< A >::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 frames.

Specific to DebugIo.

template<typename A >
bool DebugIO< A >::register_forward ( const string &  interface,
const string &  vif,
IO::ReceiveCallback  cb 
)

Register where datagrams should be forwarded.

Specific to DebugIo.

template<typename A >
bool DebugIO< A >::register_forward ( typename IO< A >::ReceiveCallback  cb) [inline]

Register where frames should be forwarded.

Specific to DebugIO.

template<typename A >
bool DebugIO< A >::replace_route ( IPv4Net  net,
IPv4  nexthop,
uint32_t  faceid,
uint32_t  metric,
const PolicyTags policytags 
) [virtual]

Replace route.

Parameters:
netnetwork
nexthop
faceidinterface ID towards the nexthop
metricto network
policytagspolicy info to the RIB.
Returns:
true if the route was replaced OK, otherwise false.

Implements IO< A >.

template<typename A >
void DebugIO< A >::routing_table_empty ( ) [inline]

A debugging entry point.

Empty the routing table.

template<typename A >
int DebugIO< A >::shutdown ( ) [inline, virtual]

Shutdown service.

Service should transition from SERVICE_RUNNING to SERVICE_SHUTTING_DOWN immediately and onto SERVICE_SHUTDOWN or SERVICE_FAILED in the near future.

Returns:
XORP_OK on success, otherwise XORP_ERROR.

Implements ServiceBase.

template<typename A >
int DebugIO< A >::shutdown ( ) [virtual]

Shutdown service.

Service should transition from SERVICE_RUNNING to SERVICE_SHUTTING_DOWN immediately and onto SERVICE_SHUTDOWN or SERVICE_FAILED in the near future.

Returns:
XORP_OK on success, otherwise XORP_ERROR.

Implements ServiceBase.

template<typename A >
int DebugIO< A >::startup ( ) [inline, virtual]

Start service.

Service should transition from SERVICE_READY to SERVICE_STARTING immediately and onto SERVICE_RUNNING or SERVICE_FAILED in the near future.

Returns:
XORP_OK on success, otherwise XORP_ERROR.

Implements ServiceBase.

template<typename A >
int DebugIO< A >::startup ( ) [virtual]

Start service.

Service should transition from SERVICE_READY to SERVICE_STARTING immediately and onto SERVICE_RUNNING or SERVICE_FAILED in the near future.

Returns:
XORP_OK on success, otherwise XORP_ERROR.

Implements ServiceBase.

template<typename A >
void DebugIO< A >::unregister_forward ( const string &  interface,
const string &  vif 
)

Unregister an existing callback registered with register_forward().

Specific to DebugIo.


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