Contiki 2.5
Files | Macros | Functions | Variables
Flooding Routing module

Files

file  routing_epidemic.c
 implementation of flood routing
 
file  routing_flooding.c
 implementation of flood routing
 

Macros

#define EPIDEMIC_ROUTE_RETURN_OK   1
 Internally used return values.
 
#define FLOOD_ROUTE_RETURN_OK   1
 Internally used return values.
 

Functions

 PROCESS (routing_process,"Epidemic ROUTE process")
 Routing process.
 
void routing_epidemic_init (void)
 called by agent at startup
 
void routing_epidemic_schedule_resubmission (void)
 Poll our process, so that we can resubmit bundles.
 
struct neighbour_list_entry_t * routing_epidemic_get_neighbour (rimeaddr_t *dest)
 checks for a neighbour in the neighbour list More...
 
void routing_epidemic_new_neighbour (rimeaddr_t *dest)
 checks if there are bundle to send to dest More...
 
int routing_epidemic_send_bundle (uint32_t bundle_number, rimeaddr_t *neighbour)
 Send bundle to neighbour. More...
 
int routing_epidemic_send_to_local (struct routing_entry_t *entry)
 Deliver a bundle to a local service. More...
 
int routing_epidemic_forward (struct routing_entry_t *entry)
 Forward a bundle to the next hop. More...
 
void routing_epidemic_send_to_known_neighbours (void)
 iterate through all bundles and forward bundles More...
 
void routing_epidemic_resubmit_bundles ()
 Wrapper function for agent calls to resubmit bundles for already known neighbours.
 
int routing_epidemic_new_bundle (uint32_t *bundle_number)
 Adds a new bundle to the list of bundles. More...
 
void routing_epidemic_delete_bundle (uint32_t bundle_number)
 deletes bundle from list More...
 
void routing_epidemic_bundle_sent (struct transmit_ticket_t *ticket, uint8_t status)
 Callback function informing us about the status of a sent bundle. More...
 
void routing_epidemic_bundle_delivered_locally (struct mmem *bundlemem)
 Incoming notification, that service has finished processing bundle. More...
 
 PROCESS_THREAD (routing_process, ev, data)
 Routing persistent process.
 
 PROCESS (routing_process,"FLOOD ROUTE process")
 Routing process.
 
void routing_flooding_send_to_known_neighbours (void)
 iterate through all bundles and forward bundles More...
 
void routing_flooding_check_keep_bundle (uint32_t bundle_number)
 Checks whether a bundle still has to be kept or can be deleted. More...
 
int routing_flooding_blacklist_add (rimeaddr_t *neighbour)
 Adds (or refreshes) the entry of 'neighbour' on the blacklist. More...
 
void routing_flooding_blacklist_delete (rimeaddr_t *neighbour)
 Deletes a neighbour from the blacklist. More...
 
void routing_flooding_init (void)
 called by agent at startup
 
void routing_flooding_schedule_resubmission (void)
 Poll our process, so that we can resubmit bundles.
 
void routing_flooding_new_neighbour (rimeaddr_t *dest)
 checks if there are bundle to send to dest More...
 
int routing_flooding_send_bundle (uint32_t bundle_number, rimeaddr_t *neighbour)
 Send bundle to neighbour. More...
 
int routing_flooding_send_to_local (struct routing_entry_t *entry)
 Deliver a bundle to a local service. More...
 
int routing_flooding_forward_directly (struct routing_entry_t *entry)
 Forward a bundle to its destination. More...
 
int routing_flooding_forward_normal (struct routing_entry_t *entry)
 Forward a bundle to the next hop. More...
 
void routing_flooding_resubmit_bundles ()
 Wrapper function for agent calls to resubmit bundles for already known neighbours.
 
int routing_flooding_new_bundle (uint32_t *bundle_number)
 Adds a new bundle to the list of bundles. More...
 
void routing_flooding_delete_bundle (uint32_t bundle_number)
 deletes bundle from list More...
 
void routing_flooding_bundle_sent (struct transmit_ticket_t *ticket, uint8_t status)
 Callback function informing us about the status of a sent bundle. More...
 
void routing_flooding_bundle_delivered_locally (struct mmem *bundlemem)
 Incoming notification, that service has finished processing bundle. More...
 

Variables

rimeaddr_t neighbour_list_entry_t::neighbour
 address of the neighbour
 
uint32_t neighbour_list_entry_t::bundles [ROUTING_BUNDLES_PER_NEIGHBOUR]
 bundles that have been sent to the neighbour
 
uint8_t neighbour_list_entry_t::bundles_pointer
 Point to where to next bundle number will be stored.
 
struct routing_entry_t * routing_entry_t::next
 Pointer to the next entry.
 
uint32_t routing_entry_t::bundle_number
 number of the bundle
 
uint8_t routing_entry_t::flags
 bundle flags
 
uint32_t routing_entry_t::destination_node
 destination node More...
 
struct routing_list_entry_t * routing_list_entry_t::next
 pointer to the next entry
 
struct mmem routing_list_entry_t::entry
 pointer to MMEM containing the routing_entry_t
 
struct routing_list_entry_t * next
 pointer to the next entry
 
struct mmem entry
 pointer to MMEM containing the routing_entry_t
 
uint8_t routing_entry_t::send_to
 number of nodes the bundle has been sent to already
 
rimeaddr_t routing_entry_t::neighbours [ROUTING_NEI_MEM]
 addresses of nodes this bundle was sent to
 
uint32_t routing_entry_t::source_node
 bundle source
 
rimeaddr_t routing_entry_t::received_from_node
 neighbour from which we have received the bundle
 
uint32_t bundle_number
 number of the bundle
 
uint8_t flags
 bundle flags
 
uint8_t send_to
 number of nodes the bundle has been sent to already
 
rimeaddr_t neighbours [ROUTING_NEI_MEM]
 addresses of nodes this bundle was sent to
 
uint32_t destination_node
 bundle destination
 
uint32_t source_node
 bundle source
 
rimeaddr_t received_from_node
 neighbour from which we have received the bundle
 

Detailed Description

Function Documentation

void routing_epidemic_bundle_delivered_locally ( struct mmem *  bundlemem)

Incoming notification, that service has finished processing bundle.

Parameters
bundlememPointer to the MMEM struct of the bundle

Definition at line 558 of file routing_epidemic.c.

References bundle_decrement(), delivery_unblock_service(), list_head(), list_item_next(), MMEM_PTR, NULL, rimeaddr_node_addr, routing_epidemic_schedule_resubmission(), and ROUTING_FLAG_IN_DELIVERY.

void routing_epidemic_bundle_sent ( struct transmit_ticket_t ticket,
uint8_t  status 
)

Callback function informing us about the status of a sent bundle.

Parameters
ticketCL transmit ticket of the bundle
statusstatus code

Definition at line 495 of file routing_epidemic.c.

References list_head(), list_item_next(), NULL, routing_epidemic_schedule_resubmission(), and statistics_bundle_outgoing().

void routing_epidemic_delete_bundle ( uint32_t  bundle_number)

deletes bundle from list

Parameters
bundle_numberbundle number of the bundle

Definition at line 463 of file routing_epidemic.c.

References list_head(), list_item_next(), list_remove(), memb_free(), and NULL.

int routing_epidemic_forward ( struct routing_entry_t *  entry)

Forward a bundle to the next hop.

Parameters
entryPointer to the routing entry of the bundle
Returns
EPIDEMIC_ROUTE_RETURN_OK if queued, EPIDEMIC_ROUTE_RETURN_CONTINUE if not queued and EPIDEMIC_ROUTE_RETURN_FAIL of queue is full

Definition at line 271 of file routing_epidemic.c.

References EPIDEMIC_ROUTE_RETURN_OK, list_head(), list_item_next(), NULL, and routing_epidemic_send_bundle().

Referenced by routing_epidemic_send_to_known_neighbours().

struct neighbour_list_entry_t* routing_epidemic_get_neighbour ( rimeaddr_t *  dest)
read

checks for a neighbour in the neighbour list

Parameters
destpointer to the address of the neighbor
Returns
pointer to the address list entry, NULL otherwise

Definition at line 107 of file routing_epidemic.c.

References entry, list_head(), list_item_next(), NULL, and rimeaddr_cmp().

int routing_epidemic_new_bundle ( uint32_t *  bundle_number)

Adds a new bundle to the list of bundles.

Parameters
bundle_numberbundle number of the bundle
Returns
>0 on success, <0 on error

Definition at line 359 of file routing_epidemic.c.

References bundle_decrement(), bundle_get_attr(), bundle_number, BUNDLE_STORAGE, convert_eid_to_rime(), list_add(), list_head(), list_item_next(), memb_alloc(), memb_free(), MMEM_PTR, NULL, registration_is_local(), routing_epidemic_schedule_resubmission(), source_node, and statistics_bundle_incoming().

void routing_epidemic_new_neighbour ( rimeaddr_t *  dest)

checks if there are bundle to send to dest

Parameters
destpointer to the address of the new neighbor

Definition at line 208 of file routing_epidemic.c.

int routing_epidemic_send_bundle ( uint32_t  bundle_number,
rimeaddr_t *  neighbour 
)

Send bundle to neighbour.

Parameters
bundle_numberNumber of the bundle
neighbourAddress of the neighbour
Returns
1 on success, -1 on error

Definition at line 220 of file routing_epidemic.c.

References bundle_number, NULL, and rimeaddr_copy().

Referenced by routing_epidemic_forward().

void routing_epidemic_send_to_known_neighbours ( void  )

iterate through all bundles and forward bundles

It is likely, that we will have less neighbours than bundles - therefore, we want to to go through bundles only once

Definition at line 309 of file routing_epidemic.c.

References EPIDEMIC_ROUTE_RETURN_OK, list_head(), list_item_next(), NULL, routing_epidemic_forward(), and routing_epidemic_send_to_local().

Referenced by PROCESS_THREAD().

int routing_epidemic_send_to_local ( struct routing_entry_t *  entry)

Deliver a bundle to a local service.

Parameters
entryPointer to the routing entry of the bundle
Returns
EPIDEMIC_ROUTE_RETURN_OK if delivered, EPIDEMIC_ROUTE_RETURN_CONTINUE otherwise

Definition at line 246 of file routing_epidemic.c.

References BUNDLE_STORAGE, delivery_deliver_bundle(), EPIDEMIC_ROUTE_RETURN_OK, NULL, and ROUTING_FLAG_IN_DELIVERY.

Referenced by routing_epidemic_send_to_known_neighbours().

int routing_flooding_blacklist_add ( rimeaddr_t *  neighbour)

Adds (or refreshes) the entry of 'neighbour' on the blacklist.

Parameters
neighbourAddress of the neighbour
Returns
1 if neighbour is (now) blacklisted, 0 otherwise

Definition at line 111 of file routing_flooding.c.

References CLOCK_SECOND, clock_time(), entry, list_add(), list_head(), list_item_next(), memb_alloc(), NULL, rimeaddr_cmp(), and rimeaddr_copy().

Referenced by routing_flooding_bundle_sent().

void routing_flooding_blacklist_delete ( rimeaddr_t *  neighbour)

Deletes a neighbour from the blacklist.

Parameters
neighbourAddress of the neighbour

Definition at line 157 of file routing_flooding.c.

References entry, list_head(), list_item_next(), list_remove(), memb_free(), NULL, and rimeaddr_cmp().

Referenced by routing_flooding_bundle_sent().

void routing_flooding_bundle_delivered_locally ( struct mmem *  bundlemem)

Incoming notification, that service has finished processing bundle.

Parameters
bundlememPointer to the MMEM struct of the bundle

Definition at line 766 of file routing_flooding.c.

References bundle_decrement(), delivery_unblock_service(), entry, list_head(), list_item_next(), MMEM_PTR, NULL, rimeaddr_copy(), rimeaddr_node_addr, ROUTING_FLAG_IN_DELIVERY, routing_flooding_check_keep_bundle(), routing_flooding_schedule_resubmission(), and ROUTING_NEI_MEM.

void routing_flooding_bundle_sent ( struct transmit_ticket_t ticket,
uint8_t  status 
)
void routing_flooding_check_keep_bundle ( uint32_t  bundle_number)

Checks whether a bundle still has to be kept or can be deleted.

Parameters
bundle_numberNumber of the bundle

Definition at line 462 of file routing_flooding.c.

References BUNDLE_STORAGE, entry, list_head(), list_item_next(), MMEM_PTR, and NULL.

Referenced by routing_flooding_bundle_delivered_locally(), routing_flooding_bundle_sent(), and routing_flooding_send_to_local().

void routing_flooding_delete_bundle ( uint32_t  bundle_number)

deletes bundle from list

Parameters
bundle_numberbundle number of the bundle

Definition at line 611 of file routing_flooding.c.

References entry, list_head(), list_item_next(), list_remove(), memb_free(), mmem_free(), MMEM_PTR, and NULL.

int routing_flooding_forward_directly ( struct routing_entry_t *  entry)

Forward a bundle to its destination.

Parameters
entryPointer to the routing entry of the bundle
Returns
FLOOD_ROUTE_RETURN_OK if queued, FLOOD_ROUTE_RETURN_CONTINUE if not queued and FLOOD_ROUTE_RETURN_FAIL of queue is full

Definition at line 272 of file routing_flooding.c.

References convert_eid_to_rime(), DISCOVERY, FLOOD_ROUTE_RETURN_OK, list_item_next(), NULL, rimeaddr_cmp(), and routing_flooding_send_bundle().

Referenced by routing_flooding_send_to_known_neighbours().

int routing_flooding_forward_normal ( struct routing_entry_t *  entry)

Forward a bundle to the next hop.

Parameters
entryPointer to the routing entry of the bundle
Returns
FLOOD_ROUTE_RETURN_OK if queued, FLOOD_ROUTE_RETURN_CONTINUE if not queued and FLOOD_ROUTE_RETURN_FAIL of queue is full

Definition at line 320 of file routing_flooding.c.

References convert_eid_to_rime(), DISCOVERY, FLOOD_ROUTE_RETURN_OK, list_item_next(), NULL, rimeaddr_cmp(), routing_flooding_send_bundle(), ROUTING_NEI_MEM, and source_node.

Referenced by routing_flooding_send_to_known_neighbours().

int routing_flooding_new_bundle ( uint32_t *  bundle_number)

Adds a new bundle to the list of bundles.

Parameters
bundle_numberbundle number of the bundle
Returns
>0 on success, <0 on error

Definition at line 496 of file routing_flooding.c.

References bundle_decrement(), bundle_get_attr(), bundle_number, BUNDLE_STORAGE, entry, list_add(), list_head(), list_item_next(), memb_alloc(), memb_free(), mmem_alloc(), mmem_free(), MMEM_PTR, NULL, registration_is_local(), rimeaddr_copy(), routing_flooding_schedule_resubmission(), and statistics_bundle_incoming().

void routing_flooding_new_neighbour ( rimeaddr_t *  dest)

checks if there are bundle to send to dest

Parameters
destpointer to the address of the new neighbor

Definition at line 194 of file routing_flooding.c.

References routing_flooding_schedule_resubmission().

int routing_flooding_send_bundle ( uint32_t  bundle_number,
rimeaddr_t *  neighbour 
)

Send bundle to neighbour.

Parameters
bundle_numberNumber of the bundle
neighbourAddress of the neighbour
Returns
1 on success, -1 on error

Definition at line 205 of file routing_flooding.c.

References bundle_number, NULL, and rimeaddr_copy().

Referenced by routing_flooding_forward_directly(), and routing_flooding_forward_normal().

void routing_flooding_send_to_known_neighbours ( void  )

iterate through all bundles and forward bundles

It is likely, that we will have less neighbours than bundles - therefore, we want to to go through bundles only once

Definition at line 387 of file routing_flooding.c.

References entry, FLOOD_ROUTE_RETURN_OK, list_head(), list_item_next(), MMEM_PTR, NULL, routing_flooding_forward_directly(), routing_flooding_forward_normal(), and routing_flooding_send_to_local().

int routing_flooding_send_to_local ( struct routing_entry_t *  entry)

Deliver a bundle to a local service.

Parameters
entryPointer to the routing entry of the bundle
Returns
FLOOD_ROUTE_RETURN_OK if delivered, FLOOD_ROUTE_RETURN_CONTINUE otherwise

Definition at line 231 of file routing_flooding.c.

References BUNDLE_STORAGE, delivery_deliver_bundle(), FLOOD_ROUTE_RETURN_OK, NULL, ROUTING_FLAG_IN_DELIVERY, routing_flooding_check_keep_bundle(), and routing_flooding_schedule_resubmission().

Referenced by routing_flooding_send_to_known_neighbours().

Variable Documentation

uint32_t routing_entry_t::destination_node

destination node

bundle destination

Definition at line 71 of file routing_epidemic.c.