Wiselib
Public Types | Public Member Functions | Public Attributes
concepts::Routing_concept Class Reference

Basic Concept for Routing Algorithms. More...

Inherits concepts::BasicAlgorithm_concept, concepts::Radio_concept, and concepts::BasicReturnValues_concept.

List of all members.

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.

Detailed Description

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.


Member Enumeration Documentation

anonymous enum [inherited]
Enumerator:
SUCCESS 

Default return value of success.

ERR_UNSPEC 

Unspecified error value - if no other fits.

ERR_NOMEM 

Out of memory.

ERR_BUSY 

Device or resource busy - try again later.

ERR_NOTIMPL 

Function not implemented.

ERR_NETDOWN 

Network is down.

ERR_HOSTUNREACH 

No route to host.

Enumerator:
MAX_MESSAGE_LENGTH 

Maximal size of a message in bytes.

Enumerator:
BROADCAST_ADDRESS 

Send a message to all nodes in communication range of the radio.

NULL_NODE_ID 

Used if node id is not known or not (yet) set.

Enumerator:
READY 

Ready for asking for data.

NO_VALUE 

Currently no data available.

INACTIVE 

Currently inactive - so no values available.


Member Function Documentation

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.

Returns:
Error (or success) value from Basic Return Values.

Reimplemented from concepts::Radio_concept.

int concepts::Routing_concept::enable_radio ( void  )

Turn on radio.

Messages can be sent and received.

Returns:
Error (or success) value from Basic Return Values.

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.

Returns:
Unique node identifier of type node_id_t.
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.

template<class T , void(T::*)(node_id_t, size_t, block_data_t *) TMethod>
int concepts::Routing_concept::reg_recv_callback ( T *  obj_pnt)

Register message reception callback function.

Returns:
Unique identifier for this registration. Value must be used when
un-registering a callback.

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.

Returns:
If message has successfully passed to radio.
Not if message has really been sent!

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.

Returns:
Error (or success) value from Basic Return Values.

Reimplemented from concepts::Radio_concept.


Member Data Documentation

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.

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.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines