This implementation is designed to work together with the RoutingForChipcon (RFC) layer. The implementation has been tailored towards the use with btnodes, but could easily be adaptet to Nut/OS.
Much performance can be gained, by adjusting the parameters to the task that the operating set of nodes is assigned to. For a detailed description of the parameters see [Perkins et al., Ad hoc On-Demand Distance Vector (AODV) Routing] or [Schuetz, Implementation and Testing of an Ad-hoc Routing Protocol for the Chipcon-Interface of BTnodes].
Further, in debug mode, this implementation alows to change most of the parmameter, inject packages, observe routing states and gather metrics easily. It is therefore well suited to gain insight into routing in distributed, wireless sensor networks.
#include <sys/types.h>
#include <cc/ccc.h>
#include "routing.h"
Defines | |
#define | _BT_ADOV_H_ |
#define | ACTIVE_ROUTE_TIMEOUT 10000 |
#define | ALLOWED_HELLO_LOSS 2 |
#define | BLACKLIST_SIZE 10 |
#define | BLACKLIST_TIMEOUT 4 * (RREQ_RETRIES * (long)NET_TRAVERSAL_TIME) |
#define | CONTROL_PACKET_QUEUE_SIZE 10 |
#define | DELETE_PERIOD (5 * MAX((long)ACTIVE_ROUTE_TIMEOUT, (long)HELLO_INTERVAL)) |
#define | DISCOVERY_BUFFER_SIZE 10 |
#define | HELLO_INTERVAL 0 |
#define | LOCAL_ADD_TTL 2 |
#define | MAX_REPAIR_TTL 12 |
#define | MY_ROUTE_TIMEOUT (2 * ACTIVE_ROUTE_TIMEOUT) |
#define | NET_DIAMETER 15 |
#define | NET_TRAVERSAL_TIME (2 * NODE_TRAVERSAL_TIME * NET_DIAMETER) |
#define | NEXT_HOP_WAIT (NODE_TRAVERSAL_TIME + 10) |
#define | NODE_TRAVERSAL_TIME 200 |
#define | PATH_DISCOVERY_TIME (2 * NET_TRAVERSAL_TIME) |
#define | RERR_RATELIMIT 10 |
#define | RING_TRAVERSAL_TIME (2 * NODE_TRAVERSAL_TIME * (TTL_VALUE + TIMEOUT_BUFFER)) |
#define | ROUTING_TABLE_SIZE 20 |
#define | RREP_BUFFER_SIZE 20 |
#define | RREP_RETRY 7 |
#define | RREQ_BUFFER_SIZE 50 |
#define | RREQ_RATELIMIT 10 |
#define | RREQ_RETRIES 7 |
#define | TIMEOUT_BUFFER 2 |
#define | TTL_INCREMENT 2 |
#define | TTL_START 1 |
#define | TTL_THRESHOLD 7 |
#define | TTL_VALUE 2 |
Functions | |
void | aodv_enable_led (int enable_led) |
u_short | aodv_get_address (void) |
int | aodv_get_rreq_id (void) |
int | aodv_get_sequence_no (void) |
int | aodv_init (u_short address) |
void | aodv_print_rt (void) |
void | aodv_print_rt_entry (int entry) |
int | aodv_route_discover (u_short dst) |
u_short | aodv_set_address (u_short addr) |
Variables | |
routing_interface_t | aodv_interface |
routing_interface_t | aodv_interface |
Interface of the routing protocol. | |
u_short | aodv_invalid_count |
Number of invalid packets targeted for this node. | |
u_short | aodv_rerr_recv_count |
Number of RERR packets targeted for this node. | |
u_short | aodv_rerr_send_count |
Number of RERR packets sent from this node. (including failed). | |
u_short | aodv_rerr_send_fail_count |
Number of send failures of RERR packets. | |
u_short | aodv_rrep_ack_recv_count |
Number of RREP-ACK packets targeted for this node. | |
u_short | aodv_rrep_ack_send_count |
Number of RREP-ACK packets sent from this node. (including failed). | |
u_short | aodv_rrep_ack_send_fail_count |
Number of send failures of RREP-ACK packets. | |
u_short | aodv_rrep_recv_count |
Number of RREP packets targeted for this node.(including failed). | |
u_short | aodv_rrep_recv_fail_count |
Number of failed RREP packets passing through this node. | |
u_short | aodv_rrep_send_count |
Number of RREP packets sent from this node. (including failed). | |
u_short | aodv_rrep_send_fail_count |
Number of send failures of RREP packets. | |
u_short | aodv_rreq_ignore_count |
Number of ignored RREQs (received twice or more). | |
u_short | aodv_rreq_recv_count |
Number of RREQ packets targeted for this node. (including failed). | |
u_short | aodv_rreq_recv_fail_count |
Number of failed RREQ packets passing through this node. | |
u_short | aodv_rreq_send_count |
Number of RREQ packets sent from this node. (including failed). | |
u_short | aodv_rreq_send_fail_count |
Number of send failures of RREQ packets. |
#define ACTIVE_ROUTE_TIMEOUT 10000 |
How long a unused route is considered active (in ms, paper: 3000ms)
#define ALLOWED_HELLO_LOSS 2 |
Number of HELLO messages that may be lost before route is deactivated.
#define BLACKLIST_SIZE 10 |
Number of nodes that can be blacklisted at the same time.
#define BLACKLIST_TIMEOUT 4 * (RREQ_RETRIES * (long)NET_TRAVERSAL_TIME) |
How long nodes are kept on the blacklist. (in ms ) (RREQ_RETRIES * (long)NET_TRAVERSAL_TIME)
#define CONTROL_PACKET_QUEUE_SIZE 10 |
Size of the queues for control packets.
#define DELETE_PERIOD (5 * MAX((long)ACTIVE_ROUTE_TIMEOUT, (long)HELLO_INTERVAL)) |
Time until an inactive route is deleted. (in ms)
#define DISCOVERY_BUFFER_SIZE 10 |
Size of the route discovery buffer. (Limits simultanious discoveries)
#define HELLO_INTERVAL 0 |
Intervall between HELLO messages (if there was no other message). Set to 0 to disable HELLO messages. (in ms, paper: 1000ms)
#define LOCAL_ADD_TTL 2 |
Accounts for local delays. (in ms)
#define MAX_REPAIR_TTL 12 |
Must be 0.3 * NET_DIAMETER.
#define MY_ROUTE_TIMEOUT (2 * ACTIVE_ROUTE_TIMEOUT) |
How long this specific node consideres a route acitve.
#define NET_DIAMETER 15 |
Number of nodes on longest path in the network.
#define NET_TRAVERSAL_TIME (2 * NODE_TRAVERSAL_TIME * NET_DIAMETER) |
How long it takes a message to traverse the longest path in the network. (in ms)
#define NEXT_HOP_WAIT (NODE_TRAVERSAL_TIME + 10) |
How long the processing overhead of the next hop is expected. (in ms)
#define NODE_TRAVERSAL_TIME 200 |
Time that a packet need to traverse a node. This is calculated by by the average time a packet needs to be received, processed and sent. (in ms)
#define PATH_DISCOVERY_TIME (2 * NET_TRAVERSAL_TIME) |
Worst case thime for discovering a path between two nodes. (in ms)
#define RERR_RATELIMIT 10 |
Maximum number of RERRs that can be emitted dring an intervall.
#define RING_TRAVERSAL_TIME (2 * NODE_TRAVERSAL_TIME * (TTL_VALUE + TIMEOUT_BUFFER)) |
Time that is needed to traverse the ring during expanding ring search. (in ms)
#define ROUTING_TABLE_SIZE 20 |
Size of the routing table. MUST not be biger than sizeof(char) - 1. (in hops).
#define RREP_BUFFER_SIZE 20 |
Size of the buffer for RREPs that must be ACKed.
#define RREP_RETRY 7 |
Defines how many times a RREP is resent in absence of RREP-ACKs.
#define RREQ_BUFFER_SIZE 50 |
Size of the buffer for RREQs.
#define RREQ_RATELIMIT 10 |
Limits the number of RREQs a node may emit dring an interval.
#define RREQ_RETRIES 7 |
Number of route requests sent until destination is accepted unreachable.
#define TIMEOUT_BUFFER 2 |
Adds a timeout to the RREP to count for congestion. (in ms)
#define TTL_INCREMENT 2 |
The increment of the ttl for the expanding ring search. (in hops)
#define TTL_START 1 |
The start value for the expanding ring search. (in hops)
#define TTL_THRESHOLD 7 |
Threshold of the ttl during expanding ring search. (in hops)
#define TTL_VALUE 2 |
ttl field in header during expanding ring search. (in hops)
void aodv_enable_led | ( | int | enable_led | ) |
Enables LED status reporting.
enable_led | [in] 0 to disable LED reporting, 1 to enable. |
u_short aodv_get_address | ( | void | ) |
Returns the configured mac address.
int aodv_get_rreq_id | ( | void | ) |
Get the actual RREQ id of this node.
int aodv_get_sequence_no | ( | void | ) |
Get the actual AODV sequence number of this node.
int aodv_init | ( | u_short | address | ) |
Initialises the AODV library.
address | [in] mac address of the node. |
void aodv_print_rt | ( | void | ) |
Prints the routing table
void aodv_print_rt_entry | ( | int | entry | ) |
Prints an entry of the routing table.
entry | [in] Entry that should be printed. |
int aodv_route_discover | ( | u_short | dst | ) |
Starts a route discovery.
dest | [in] Destination to which a route shall be built. |
Sets the new node address.
addr | [in] packet length |
Routing Interface
Interface of the routing protocol.
Routing-Interface