Contiki 2.5
Files | Functions
Basic discovery module

Files

file  discovery_basic.c
 Basic discovery module.
 

Functions

void discovery_basic_neighbour_found (rimeaddr_t *neighbour)
 We have found a new neighbour, now go and notify the agent. More...
 
void discovery_basic_refresh_neighbour (rimeaddr_t *neighbour)
 Checks if ''neighbours'' is already known Yes: refresh timestamp No: Create entry. More...
 
void discovery_basic_save_neighbour (rimeaddr_t *neighbour)
 Save neighbour to local cache. More...
 
void discovery_basic_stop_pending ()
 Stops pending discoveries.
 
 LIST (neighbour_list)
 List and memory blocks to save information about neighbours.
 
void discovery_basic_init ()
 Initialize basic discovery module.
 
uint8_t discovery_basic_is_neighbour (rimeaddr_t *dest)
 Is the provided address currently listed as neighbour? More...
 
void discovery_basic_send_discovery (rimeaddr_t *destination)
 Send out discovery to provided address. More...
 
uint8_t discovery_basic_is_beacon (uint8_t *msg)
 checks if incoming message is an answer to a discovery message More...
 
uint8_t discovery_basic_is_discovery (uint8_t *msg, rimeaddr_t *dest)
 checks if incoming message is a discovery message More...
 
void discovery_basic_enable ()
 Enable discovery functionality.
 
void discovery_basic_disable ()
 Disable discovery functionality Prevents outgoing packets from being sent.
 
void discovery_basic_receive (rimeaddr_t *source, uint8_t *payload, uint8_t length)
 DTN Network has received an incoming discovery packet. More...
 
uint8_t discovery_basic_discover (rimeaddr_t *dest)
 Start to discover a neighbour. More...
 
struct
discovery_neighbour_list_entry * 
discovery_basic_list_neighbours ()
 Returns the list of currently known neighbours. More...
 
void b_dis_start_pending ()
 Starts a periodic rediscovery.
 
 PROCESS_THREAD (discovery_process, ev, data)
 Basic Discovery Persistent Process. More...
 

Detailed Description

Function Documentation

uint8_t discovery_basic_discover ( rimeaddr_t *  dest)

Start to discover a neighbour.

Parameters
destAddress of the neighbour
Returns
1 if neighbour is already known in (likely) in range, 0 otherwise

Definition at line 317 of file discovery_basic.c.

References discovery_basic_is_neighbour(), discovery_basic_send_discovery(), and process_poll().

uint8_t discovery_basic_is_beacon ( uint8_t *  msg)

checks if incoming message is an answer to a discovery message

Parameters
msgpointer to the received message
Returns
1 if msg is an answer or 0 if not

Definition at line 127 of file discovery_basic.c.

Referenced by discovery_basic_receive().

uint8_t discovery_basic_is_discovery ( uint8_t *  msg,
rimeaddr_t *  dest 
)

checks if incoming message is a discovery message

Parameters
msgpointer to the received message
destNode the discovery was received from
Returns
1 if msg is a discovery message or 0 if not

Definition at line 145 of file discovery_basic.c.

Referenced by discovery_basic_receive().

uint8_t discovery_basic_is_neighbour ( rimeaddr_t *  dest)

Is the provided address currently listed as neighbour?

Parameters
destAddress of the potential neighbour
Returns
1 if neighbour, 0 otherwise

Definition at line 90 of file discovery_basic.c.

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

Referenced by discovery_basic_discover(), and discovery_basic_save_neighbour().

struct discovery_neighbour_list_entry* discovery_basic_list_neighbours ( )
read

Returns the list of currently known neighbours.

Returns
Pointer to list with neighbours

Definition at line 340 of file discovery_basic.c.

References list_head().

void discovery_basic_neighbour_found ( rimeaddr_t *  neighbour)

We have found a new neighbour, now go and notify the agent.

Parameters
neighbourAddress of the newly found neighbour

Definition at line 212 of file discovery_basic.c.

References discovery_basic_stop_pending(), entry, list_head(), NULL, process_post(), and rimeaddr_cmp().

Referenced by discovery_basic_receive().

void discovery_basic_receive ( rimeaddr_t *  source,
uint8_t *  payload,
uint8_t  length 
)

DTN Network has received an incoming discovery packet.

Parameters
sourceSource address of the packet
payloadPayload pointer of the packet
lengthLength of the payload

Definition at line 188 of file discovery_basic.c.

References discovery_basic_is_beacon(), discovery_basic_is_discovery(), discovery_basic_neighbour_found(), and discovery_basic_refresh_neighbour().

void discovery_basic_refresh_neighbour ( rimeaddr_t *  neighbour)

Checks if ''neighbours'' is already known Yes: refresh timestamp No: Create entry.

Parameters
neighbourAddress of the neighbour that should be refreshed

Definition at line 243 of file discovery_basic.c.

References clock_time(), discovery_basic_save_neighbour(), entry, list_head(), NULL, and rimeaddr_cmp().

Referenced by discovery_basic_receive().

void discovery_basic_save_neighbour ( rimeaddr_t *  neighbour)

Save neighbour to local cache.

Parameters
neighbourAddress of the neighbour

Definition at line 264 of file discovery_basic.c.

References clock_time(), discovery_basic_is_neighbour(), entry, list_add(), list_head(), list_remove(), memb_alloc(), memb_free(), NULL, and rimeaddr_copy().

Referenced by discovery_basic_refresh_neighbour().

void discovery_basic_send_discovery ( rimeaddr_t *  destination)

Send out discovery to provided address.

Parameters
destinationAddress to send the discovery to

Definition at line 110 of file discovery_basic.c.

Referenced by discovery_basic_discover(), and PROCESS_THREAD().

PROCESS_THREAD ( discovery_process  ,
ev  ,
data   
)

Basic Discovery Persistent Process.

If we have a discovery pending, resend the beacon multiple times

In case we should start the periodic discovery, do it here and now

Definition at line 366 of file discovery_basic.c.

References b_dis_start_pending(), CLOCK_SECOND, clock_time(), discovery_basic_send_discovery(), discovery_basic_stop_pending(), entry, etimer_expired(), etimer_restart(), etimer_set(), list_head(), list_remove(), memb_free(), NULL, PROCESS_BEGIN, PROCESS_END, and PROCESS_WAIT_EVENT.