#include <AwdsRouting.h>
Classes | |
struct | FlowReceiverData |
struct | Hop2RefCount |
Public Types | |
enum | PeriodType { Constant, Adaptive } |
typedef std::map< NodeId, Hop2RefCount > | Hop2List |
typedef std::pair < recv_callback, void * > | RegisterEntry |
typedef std::vector < RegisterEntry > | RegisterList |
typedef std::map< int, RegisterList > | ProtocolRegister |
typedef std::map < FlowRouting::FlowId, struct FlowReceiverData > | FlowReceiverMap |
typedef std::map < FlowRouting::FlowId, NodeId > | ForwardingTable |
Public Member Functions | |
AwdsRouting (basic *base) | |
virtual | ~AwdsRouting () |
destructor | |
virtual size_t | getMTU () |
virtual void | send_topo () |
virtual std::string | getNameOfNode (const awds::NodeId &id) const |
virtual bool | getNodeByName (awds::NodeId &id, const char *name) const |
virtual int | foreachNode (awds::Routing::NodeFunctor, void *data) const |
virtual int | foreachEdge (awds::Routing::EdgeFunctor, void *data) const |
virtual void | addNodeObserver (struct awds::Routing::NodesObserver *observer) |
virtual void | addLinkObserver (struct LinksObserver *observer) |
void | recv_beacon (BasePacket *p) |
void | recv_flood (BasePacket *p) |
void | recv_unicast (BasePacket *p) |
virtual bool | isReachable (const NodeId &id) const |
virtual BasePacket * | newFloodPacket (int floodType) |
virtual BasePacket * | newUnicastPacket (int type) |
virtual void | sendBroadcast (BasePacket *p) |
virtual void | sendUnicast (BasePacket *p) |
virtual void | sendUnicastVia (BasePacket *p, NodeId nextHop) |
virtual void | registerUnicastProtocol (int num, recv_callback cb, void *data) |
virtual void | registerBroadcastProtocol (int num, recv_callback cb, void *data) |
int | findNeigh (const NodeId &id) const |
bool | hasNeigh (const NodeId &id) const |
void | removeOldNeigh () |
bool | refreshNeigh (BasePacket *p) |
void | stat2dyn () |
void | assert_stat () |
void | calcMpr () |
virtual int | addForwardingRule (FlowRouting::FlowId flowid, NodeId nextHop) |
virtual int | delForwardingRule (FlowRouting::FlowId flowid) |
virtual int | addFlowReceiver (FlowRouting::FlowId flowid, FlowRouting::FlowReceiver, void *data) |
virtual int | delFlowReceiver (FlowRouting::FlowId) |
virtual BasePacket * | newFlowPacket (FlowRouting::FlowId flowid) |
virtual int | sendFlowPacket (BasePacket *p) |
Static Public Member Functions | |
static void | send_beacon (gea::Handle *h, gea::AbsTime t, void *data) |
static void | recv_packet (BasePacket *p, void *data) |
static void | send_periodic_topo (gea::Handle *h, gea::AbsTime t, void *data) |
static void | checkLinkFailure (gea::Handle *h, gea::AbsTime t, void *data) |
Public Attributes | |
bool | verbose |
basic * | base |
int | topoPeriod_ms |
PeriodType | topoPeriodType |
gea::Blocker | beaconBlocker |
gea::Blocker | blocker |
class RTopology * | topology |
class FloodHistory * | floodHistory |
class awds::Firewall * | firewall |
Hop2List | hop2list |
ProtocolRegister | unicastRegister |
ProtocolRegister | broadcastRegister |
NodeDescr * | neighbors |
int | numNeigh |
gea::Blocker | linkFailBlocker |
Blocker for checkLinkFailure callback. | |
u_int16_t | beaconSeq |
gea::Duration | beaconPeriod |
gea::AbsTime | nextBeacon |
u_int16_t | floodSeq |
u_int16_t | unicastSeq |
FlowReceiverMap | flowReceiverMap |
ForwardingTable | forwardingTable |
Static Public Attributes | |
static const int | period = BEACON_INTERVAL |
static const int | MaxNeighbors = 40 |
void awds::AwdsRouting::checkLinkFailure | ( | gea::Handle * | h, | |
gea::AbsTime | t, | |||
void * | data | |||
) | [static] |
GEA callback that checks whether links have bacome inactive.
int awds::AwdsRouting::foreachEdge | ( | awds::Routing::EdgeFunctor | , | |
void * | data | |||
) | const [virtual] |
function to iterate over the list of nodes
Implements awds::Routing.
References awds::RTopology::adjList, and topology.
int awds::AwdsRouting::foreachNode | ( | awds::Routing::NodeFunctor | , | |
void * | data | |||
) | const [virtual] |
function to iterate over the list of nodes
Implements awds::Routing.
References awds::RTopology::adjList, and topology.
size_t awds::AwdsRouting::getMTU | ( | ) | [virtual] |
get the maximum transfer unit
Implements awds::Routing.
std::string awds::AwdsRouting::getNameOfNode | ( | const awds::NodeId & | id | ) | const [virtual] |
convert a node id to a unique name This method implements the abstact version in awds::Routing
id | which node is looked up |
Implements awds::Routing.
References awds::RTopology::getNameOfNode(), and topology.
bool awds::AwdsRouting::getNodeByName | ( | awds::NodeId & | id, | |
const char * | name | |||
) | const [virtual] |
convert a node name to an internal node id This method implements the abstact version in awds::Routing
id | a reference to a node id, where the return value is stored. | |
name | the name to look for. |
Implements awds::Routing.
References awds::RTopology::getNodeByName(), and topology.
BasePacket * awds::AwdsRouting::newFloodPacket | ( | int | floodType | ) | [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.
Implements awds::Routing.
References awds::basic::BroadcastId, floodSeq, awds::Routing::myNodeId, awds::BasePacket::setDest(), awds::Flood::setFloodType(), awds::Flood::setLastHop(), awds::SrcPacket::setSeq(), awds::SrcPacket::setSrc(), and awds::Flood::setTTL().
Referenced by send_topo().
void awds::AwdsRouting::send_topo | ( | ) | [virtual] |
Send a topology packet.
References awds::BasePacket::buffer, awds::Flood::getFloodType(), awds::RTopology::getNumNodes(), newFloodPacket(), awds::TopoPacket::setNeigh(), awds::TopoPacket::setValidity(), awds::BasePacket::size, topology, topoPeriod_ms, topoPeriodType, and awds::BasePacket::unref().
gea::Blocker awds::AwdsRouting::beaconBlocker |
for periodic sending of beacon packets
gea::Duration awds::AwdsRouting::beaconPeriod |
period of sending beacon packets
u_int16_t awds::AwdsRouting::beaconSeq |
becon sequence number
gea::Blocker awds::AwdsRouting::blocker |
for periodic sending of topo packets
used for packet filtering
history of recent flood packets
Referenced by ~AwdsRouting().
u_int16_t awds::AwdsRouting::floodSeq |
sequence number of flooding packets
Referenced by newFloodPacket().
gea::AbsTime awds::AwdsRouting::nextBeacon |
when the next beacon packet will be generated
const int awds::AwdsRouting::period = BEACON_INTERVAL [static] |
beacon period in milliseconds
for storing the topology
Referenced by foreachEdge(), foreachNode(), getNameOfNode(), getNodeByName(), send_topo(), awds::TopoPacket::setNeigh(), and ~AwdsRouting().
topology propagtion period in milliseconds
Referenced by send_topo().
period type for topo packets
Referenced by send_topo().
u_int16_t awds::AwdsRouting::unicastSeq |
sequence number of unicast packets
enable verbose debug output