Contiki 2.5
Files | Data Structures | Macros | Functions
Bundle Protocol Agent

Files

file  agent.c
 
file  agent.h
 
file  bundleslot.c
 Bundle Slot memory management.
 
file  bundleslot.h
 Header for Bundle Slot memory management.
 
file  delivery.c
 
file  delivery.h
 Headerfile for Bundle delivery.
 
file  dispatching.c
 
file  dispatching.h
 Bundle dispatching module.
 
file  registration.h
 Handle Service Registrations.
 

Data Structures

struct  registration
 structure of registration More...
 

Macros

#define LOG_NET   0
 uDTN log domains
 

Functions

void agent_init (void)
 Bundle Protocols initialisation. More...
 
void delivery_unblock_service (struct mmem *bundlemem)
 unblocks a service that was previously delivering a bundle More...
 
int delivery_deliver_bundle (struct mmem *bundlemem)
 Delivers bundle to a local service. More...
 
int dispatching_check_report (struct mmem *bundlemem)
 This function checks, whether an incoming admin record is a bundle delivery report. More...
 
int dispatching_dispatch_bundle (struct mmem *bundlemem)
 Handles Admin Records, custody bundles and regular bundles. More...
 
void registration_init (void)
 called by agent at startup
 
int registration_new_application (uint32_t app_id, struct process *application_process, uint32_t node_id)
 registers a new service More...
 
void registration_remove_application (uint32_t app_id, uint32_t node_id)
 deletes registration of service More...
 
int registration_set_active (uint32_t app_id, uint32_t node_id)
 sets state of service active More...
 
int registration_set_passive (uint32_t app_id, uint32_t node_id)
 sets state of service passive More...
 
int registration_return_status (uint32_t app_id, uint32_t node_id)
 Returns the status of a registred service. More...
 
struct process * registration_get_process (uint32_t app_id, uint32_t node_id)
 returns the process struct for a specific registration More...
 
uint32_t registration_get_application_id (struct process *application_process)
 provides the endpoint id of a registred process (if any) More...
 
uint8_t registration_is_local (uint32_t app_id, uint32_t node_id)
 Checks whether the bundle is for a local process. More...
 

Events internal communication

process_event_t dtn_receive_bundle_event
 
process_event_t dtn_bundle_in_storage_event
 
process_event_t dtn_send_admin_record_event
 
process_event_t dtn_send_bundle_to_node_event
 

Detailed Description

Function Documentation

void agent_init ( void  )

Bundle Protocols initialisation.

called by contikis main function

Definition at line 47 of file agent.c.

References NULL, process_is_running(), and process_start().

int delivery_deliver_bundle ( struct mmem *  bundlemem)

Delivers bundle to a local service.

delivers bundle to a registered service

Parameters
bundlememPointer to the MMEM bundle representation
Returns
<0 on error >=0 on success
Parameters
bundlememPointer to MMEM structure

Definition at line 77 of file delivery.c.

References bundle_decrement(), BUNDLE_STORAGE, clock_time(), CUSTODY, list_head(), list_item_next(), MMEM_PTR, NO_ADDITIONAL_INFORMATION, NULL, process_post(), statistics_bundle_delivered(), STATUSREPORT, and submit_data_to_application_event.

Referenced by routing_epidemic_send_to_local(), and routing_flooding_send_to_local().

void delivery_unblock_service ( struct mmem *  bundlemem)

unblocks a service that was previously delivering a bundle

Parameters
bundlememPointer to MMEM structure

Definition at line 34 of file delivery.c.

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

Referenced by routing_epidemic_bundle_delivered_locally(), and routing_flooding_bundle_delivered_locally().

int dispatching_check_report ( struct mmem *  bundlemem)

This function checks, whether an incoming admin record is a bundle delivery report.

If so, the corresponding bundle is deleted from storage

Parameters
bundlememPointer to the MMEM struct containing the bundle
Returns
1 on success, < 0 otherwise

Definition at line 39 of file dispatching.c.

References bundle_get_payload_block(), bundle_number, BUNDLE_STORAGE, HASH, MMEM_PTR, NULL, and TYPE_CODE_BUNDLE_STATUS_REPORT.

Referenced by dispatching_dispatch_bundle().

int dispatching_dispatch_bundle ( struct mmem *  bundlemem)

Handles Admin Records, custody bundles and regular bundles.

Parameters
bundlememPointer to MMEM structure
Returns
<= 0 on error >0 on success

Definition at line 91 of file dispatching.c.

References bundle_decrement(), bundle_number, BUNDLE_STORAGE, CUSTODY, dispatching_check_report(), HASH, MMEM_PTR, NO_ADDITIONAL_INFORMATION, NODE_RECEIVED_BUNDLE, NULL, process_post(), REDUNDANCE, and STATUSREPORT.

uint32_t registration_get_application_id ( struct process *  application_process)

provides the endpoint id of a registred process (if any)

Parameters
application_processPointer to the process
Returns
app_id, 0xFFFF on error

Definition at line 174 of file registration.c.

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

struct process* registration_get_process ( uint32_t  app_id,
uint32_t  node_id 
)
read

returns the process struct for a specific registration

Parameters
app_idService identifier
node_idNode ID
Returns
pointer to process struct

Definition at line 81 of file registration.c.

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

uint8_t registration_is_local ( uint32_t  app_id,
uint32_t  node_id 
)

Checks whether the bundle is for a local process.

Parameters
app_idService Identifier
node_idNode Identifier
Returns
1 on local, 0 otherwise

Definition at line 187 of file registration.c.

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

Referenced by routing_epidemic_new_bundle(), and routing_flooding_new_bundle().

int registration_new_application ( uint32_t  app_id,
struct process *  application_process,
uint32_t  node_id 
)

registers a new service

Parameters
app_idid of service
application_processpointer to service
node_idNode ID
Returns
1 on success, 0 on error

Definition at line 46 of file registration.c.

References list_add(), list_head(), list_item_next(), memb_alloc(), and NULL.

void registration_remove_application ( uint32_t  app_id,
uint32_t  node_id 
)

deletes registration of service

Parameters
app_idservice id
node_idNode ID

Definition at line 98 of file registration.c.

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

int registration_return_status ( uint32_t  app_id,
uint32_t  node_id 
)

Returns the status of a registred service.

Parameters
app_idid of service
node_idNode ID
Returns
state of service

Definition at line 157 of file registration.c.

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

int registration_set_active ( uint32_t  app_id,
uint32_t  node_id 
)

sets state of service active

Parameters
app_idid of service
node_idNode ID
Returns
New status when successful, -1 on error

Definition at line 114 of file registration.c.

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

int registration_set_passive ( uint32_t  app_id,
uint32_t  node_id 
)

sets state of service passive

Parameters
app_idid of service
node_idNode ID
Returns
New status when successful, -1 on error

Definition at line 135 of file registration.c.

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