#include <routing.h>
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 BasePacket * | newFloodPacket (int floodType)=0 |
virtual BasePacket * | newUnicastPacket (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 |
Classes | |
struct | LinksObserver |
struct | NodesObserver |
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.
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.
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. |
awds::Routing::Routing | ( | const NodeId & | id | ) | [inline] |
default contructor
virtual awds::Routing::~Routing | ( | ) | [inline, virtual] |
desctructor
virtual std::string awds::Routing::getNameOfNode | ( | const NodeId & | id | ) | const [pure virtual] |
convert a node id to a unique name
id | which node is looked up |
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
id | a reference to a node id, where the return value is stored. | |
name | the name to look for. |
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 int awds::Routing::foreachEdge | ( | EdgeFunctor | , | |
void * | data | |||
) | const [pure virtual] |
function to iterate over the list of nodes
Implemented in awds::AwdsRouting.
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.
Implemented in awds::AwdsRouting.
the node ID of this instance.