Wiselib
|
Basic Concept for Routing Algorithms. More...
Inherits concepts::BasicAlgorithm_concept, concepts::Radio_concept, and concepts::BasicReturnValues_concept.
Public Types | |
enum | SpecialNodeIds { BROADCAST_ADDRESS, NULL_NODE_ID } |
enum | Restrictions { MAX_MESSAGE_LENGTH } |
enum | { SUCCESS, ERR_UNSPEC, ERR_NOMEM, ERR_BUSY, ERR_NOTIMPL, ERR_NETDOWN, ERR_HOSTUNREACH } |
enum | StateValues { READY, NO_VALUE, INACTIVE } |
Public Member Functions | |
int | init () |
Reset algorithm. | |
int | destruct () |
Turn off algorithm - and thus all Os facets where possible. | |
int | enable_radio (void) |
Turn on radio. | |
int | disable_radio (void) |
Turn off radio. | |
int | send (node_id_t receiver, size_t len, block_data_t *data) |
Send message of len units beginning at *data to given receiver. | |
template<class T , void(T::*)(node_id_t, size_t, block_data_t *) TMethod> | |
int | reg_recv_callback (T *obj_pnt) |
Register message reception callback function. | |
void | unreg_recv_callback (int idx) |
Unregister message reception callback function - use unique identifier returned by registration. | |
node_id_t | id () |
Return id of node for current radio. | |
Public Attributes | |
typedef | OsModel |
Type of Os Concept which has been set for the radio. | |
typedef | Radio |
Radio that is used for message sending and registration of message reception callback. | |
typedef | self_type |
typedef | self_pointer_t |
Defines type of pointer to this radio. | |
typedef | node_id_t |
Type of node id - must be unique for a node in the network. | |
typedef | size_t |
Unsigned integer that represents length information. | |
typedef | block_data_t |
Data type used for raw data in message sending process. | |
typedef | message_id_t |
Type of message Ids - should be common for all radios if heterogeneity should be supported. |
Basic Concept for Routing Algorithms.
The routing concept basically refines the radio concept, since messages are sent via a send() method to a given destination, and messages can be received when a callback method is registered. In addition, it implements the basic algorithm concept (and thus provides an init() and destruct() method).
There are several kinds of routing algorithms available: one distinction is, for example, route maintenance. Proactive protocols build the routing tables directly after algorithm initialization. That means, if a message is going to be sent, the route to the destination is generally known in advance. However, since nodes may move or fail after some time, routes must be maintained continuously to ensure that the initially built routing tables are valid. An example for a proactive protocol is DSDV. In contrast, reactive protocols build routes on demand. That means, whenever a node sends a message to a destination, the required route is spontaneously built. This does not require any overhead for route maintenance, but may lead to delays in message sending, because of the additional build phase. An example for such an algorithm is DSR.
The routing algorithm concept is therefore as abstract as possible, to cover all kinds of possible algorithms. Thus, a routing algorithm is supposed to provide only seven methods. Enable/disable are for starting/initializing/stopping an algorithm. It must also, of course, be possible to send a message to a given destination, and to (un)register a callback method for received routing methods. At last, the Os pointer that is passed to static member functions in the external interface can be set/accessed.
anonymous enum [inherited] |
enum concepts::Radio_concept::Restrictions [inherited] |
enum concepts::Radio_concept::SpecialNodeIds [inherited] |
enum concepts::BasicReturnValues_concept::StateValues [inherited] |
int concepts::Routing_concept::destruct | ( | ) |
Turn off algorithm - and thus all Os facets where possible.
Do not use any Os facet functionality until init() is called.
Reimplemented from concepts::BasicAlgorithm_concept.
int concepts::Routing_concept::disable_radio | ( | void | ) |
Turn off radio.
Messages can
not be sent and received.
Reimplemented from concepts::Radio_concept.
int concepts::Routing_concept::enable_radio | ( | void | ) |
Turn on radio.
Messages can be sent and received.
Reimplemented from concepts::Radio_concept.
node_id_t concepts::Radio_concept::id | ( | ) | [inherited] |
Return id of node for current radio.
This can just be the id provided by the Os, but also any other one for special models. For example, a virtual radio model providing IPv6 addresses.
int concepts::Routing_concept::init | ( | ) |
Reset algorithm.
Re-init all states, turn on Os facets (if used and enable function is existent).
Reimplemented from concepts::BasicAlgorithm_concept.
int concepts::Routing_concept::reg_recv_callback | ( | T * | obj_pnt | ) |
Register message reception callback function.
Reimplemented from concepts::Radio_concept.
int concepts::Routing_concept::send | ( | node_id_t | receiver, |
size_t | len, | ||
block_data_t * | data | ||
) |
Send message of len units beginning at *data to given receiver.
Reimplemented from concepts::Radio_concept.
void concepts::Routing_concept::unreg_recv_callback | ( | int | idx | ) |
Unregister message reception callback function - use unique identifier returned by registration.
Reimplemented from concepts::Radio_concept.
Data type used for raw data in message sending process.
Usually an\ uint8_t.
Reimplemented from concepts::Radio_concept.
Type of message Ids - should be common for all radios if heterogeneity should be supported.
Standard is unit16_t.
Reimplemented from concepts::Radio_concept.
Type of node id - must be unique for a node in the network.
Reimplemented from concepts::Radio_concept.
Type of Os Concept which has been set for the radio.
Reimplemented from concepts::Radio_concept.
typedef concepts::Routing_concept::Radio |
Radio that is used for message sending and registration of message reception callback.
Provided type is implementation of Radio Facet.
Defines type of pointer to this radio.
Reimplemented from concepts::Radio_concept.
Unsigned integer that represents length information.
Reimplemented from concepts::Radio_concept.