awds::Routing Class Reference
[Awdsrouting_mod]

base class for the actual routing class.

The Routing class is used as base class for the actual routing class. It contains virtual functions for all methods that belong to the API of the routing. The AwdsRouting class inherits from this and implements the functions. The Routing class should used whenever the stable interface to the routing funtionality is required. The AwdsRouting might change over time. More...

#include <routing.h>

Inheritance diagram for awds::Routing:

awds::FlowRouting awds::AwdsRouting

List of all members.

Classes

struct  LinksObserver
struct  NodesObserver

Public Types

enum  Metrics { TransmitDurationMetrics = 0, EtxMetrics = 1, PacketLossMetrics = 2, HopCountMetrics = 3 }
typedef void(* recv_callback )(BasePacket *p, void *data)
typedef int(* NodeFunctor )(void *data, const NodeId &id)
typedef int(* EdgeFunctor )(void *data, const NodeId &from, const NodeId &to)

Public Member Functions

 Routing (const NodeId &id)
virtual ~Routing ()
virtual std::string getNameOfNode (const NodeId &id) const =0
virtual bool getNodeByName (NodeId &id, const char *name) const =0
virtual int foreachNode (NodeFunctor, void *data) const =0
virtual int foreachEdge (EdgeFunctor, void *data) const =0
virtual void addNodeObserver (struct NodesObserver *observer)=0
virtual void addLinkObserver (struct LinksObserver *observer)=0
virtual BasePacketnewFloodPacket (int floodType)=0
virtual BasePacketnewUnicastPacket (int type)=0
virtual bool isReachable (const NodeId &id) const =0
virtual void sendBroadcast (BasePacket *p)=0
virtual void sendUnicast (BasePacket *p)=0
virtual void sendUnicastVia (BasePacket *p, NodeId nextHop)=0
virtual void registerUnicastProtocol (int num, recv_callback cb, void *data)=0
virtual void registerBroadcastProtocol (int num, recv_callback cb, void *data)=0
virtual size_t getMTU ()=0

Public Attributes

CryptoUnit * cryptoUnit
const NodeId myNodeId
enum Metrics x_metrics


Detailed Description

base class for the actual routing class.

The Routing class is used as base class for the actual routing class. It contains virtual functions for all methods that belong to the API of the routing. The AwdsRouting class inherits from this and implements the functions. The Routing class should used whenever the stable interface to the routing funtionality is required. The AwdsRouting might change over time.


Member Typedef Documentation

typedef void(* awds::Routing::recv_callback)(BasePacket *p, void *data)

type of a callback function, which is used for receiving packets. The recv_callback type represents a callback function for receiving from the reouting.

Parameters:
p the packet that was received.
data a generic pointer that can be used to carry additional data. Typically it will be a pointer to an object.


Constructor & Destructor Documentation

awds::Routing::Routing ( const NodeId id  )  [inline]

default contructor

virtual awds::Routing::~Routing (  )  [inline, virtual]

desctructor


Member Function Documentation

virtual int awds::Routing::foreachEdge ( EdgeFunctor  ,
void *  data 
) const [pure virtual]

function to iterate over the list of nodes

Implemented in awds::AwdsRouting.

virtual int awds::Routing::foreachNode ( NodeFunctor  ,
void *  data 
) const [pure virtual]

function to iterate over the list of nodes

Implemented in awds::AwdsRouting.

virtual std::string awds::Routing::getNameOfNode ( const NodeId id  )  const [pure virtual]

convert a node id to a unique name

Parameters:
id which node is looked up
Returns:
a unique string for identifying the node.

Implemented in awds::AwdsRouting.

virtual bool awds::Routing::getNodeByName ( NodeId id,
const char *  name 
) const [pure virtual]

convert a node name to an internal node id

Parameters:
id a reference to a node id, where the return value is stored.
name the name to look for.
Returns:
0 on success, -1 otherwise.

Implemented in awds::AwdsRouting.

Referenced by Pinger::parse_opts().

virtual BasePacket* awds::Routing::newFloodPacket ( int  floodType  )  [pure virtual]

allocate a new flood packet. This function allocates a new flood packet that can be transmitted. via sendBroadcast(BasePacket *). The packets content should be accessed by created a awds::Flood wrapper around it.

The packet should never be freed directly via delete. Instead the refence counting mechanism of BasePacket should be used.

See also:
awds::BasePacket::unref().

Implemented in awds::AwdsRouting.


Member Data Documentation

the node ID of this instance.

Referenced by awds::AwdsRouting::newFloodPacket(), and awds::TopoPacket::setNeigh().


The documentation for this class was generated from the following file:

Generated on Fri Mar 27 13:58:27 2009 for AWDS by  doxygen 1.5.8