Contiki 2.5
|
Files | |
file | bundle.c |
this file implements the bundle memory representation | |
file | bundle.h |
this file defines the bundle memory representation | |
Data Structures | |
struct | bundle_t |
this struct defines the bundle for internal processing More... | |
Functions | |
struct mmem * | bundle_create_bundle () |
Get a new bundle structure allocated. More... | |
int | bundle_add_block (struct mmem *bundlemem, uint8_t type, uint8_t flags, uint8_t *data, uint8_t d_len) |
Add a block to a bundle. More... | |
struct bundle_block_t * | bundle_get_block (struct mmem *bundlemem, uint8_t i) |
Returns a pointer a bundle block. More... | |
struct bundle_block_t * | bundle_get_block_by_type (struct mmem *bundlemem, uint8_t type) |
Returns pointer to first bundle block of specific type. More... | |
struct bundle_block_t * | bundle_get_payload_block (struct mmem *bundlemem) |
Returns pointer to bundle payload block. More... | |
uint8_t | bundle_set_attr (struct mmem *bundlemem, uint8_t attr, uint32_t *val) |
sets an attribute of a bundle More... | |
uint8_t | bundle_get_attr (struct mmem *bundlemem, uint8_t attr, uint32_t *val) |
Gets an attribute of a bundle. More... | |
struct mmem * | bundle_recover_bundle (uint8_t *buffer, int size) |
generates the bundle struct from raw data More... | |
int | bundle_encode_bundle (struct mmem *bundlemem, uint8_t *buffer, int max_len) |
Encodes the bundle to raw data. More... | |
int | bundle_increment (struct mmem *bundlemem) |
Increments the reference counter for a MMEM struct containing a bundle. More... | |
int | bundle_decrement (struct mmem *bundlemem) |
Decrements the reference counter for a MMEM struct containing a bundle Frees the struct when reference counter is down to 0. More... | |
uint16_t | bundle_delete_bundle (struct mmem *bundlemem) |
free a given MMEM allocation of a bundle struct More... | |
rimeaddr_t | convert_eid_to_rime (uint32_t eid) |
converts IPN EIDs (uint32_t) into the RIME address | |
uint32_t | convert_rime_to_eid (rimeaddr_t *dest) |
converts a RIME address into an IPN EID | |
int bundle_add_block | ( | struct mmem * | bundlemem, |
uint8_t | type, | ||
uint8_t | flags, | ||
uint8_t * | data, | ||
uint8_t | d_len | ||
) |
Add a block to a bundle.
bundlemem | pointer to the MMEM allocation of the bundle |
type | type of the block |
flags | processing flags of the block |
data | pointer to the block payload |
d_len | length of the block payload |
Definition at line 67 of file bundle.c.
References flags, MMEM_PTR, and mmem_realloc().
Referenced by statusreport_basic_send().
|
read |
Get a new bundle structure allocated.
Definition at line 38 of file bundle.c.
References mmem_alloc(), MMEM_PTR, NULL, and PROCESS_CURRENT.
Referenced by bundle_recover_bundle(), statusreport_basic_send(), and storage_coffee_read_bundle().
int bundle_decrement | ( | struct mmem * | bundlemem | ) |
Decrements the reference counter for a MMEM struct containing a bundle Frees the struct when reference counter is down to 0.
Definition at line 562 of file bundle.c.
References MMEM_PTR.
Referenced by delivery_deliver_bundle(), delivery_unblock_service(), dispatching_dispatch_bundle(), routing_epidemic_bundle_delivered_locally(), routing_epidemic_new_bundle(), routing_flooding_bundle_delivered_locally(), routing_flooding_new_bundle(), statusreport_basic_send(), storage_coffee_delete_bundle(), storage_coffee_read_bundle(), storage_coffee_reconstruct_bundles(), storage_coffee_save_bundle(), storage_mmem_delete_bundle(), and storage_mmem_save_bundle().
uint16_t bundle_delete_bundle | ( | struct mmem * | bundlemem | ) |
free a given MMEM allocation of a bundle struct
bundlemem | the MMEM allocation to free |
A bit of magic is involved here because we want to also free the bundleslot that this bundle belongs to.
Definition at line 572 of file bundle.c.
References MMEM_PTR.
Referenced by bundle_recover_bundle().
int bundle_encode_bundle | ( | struct mmem * | bundlemem, |
uint8_t * | buffer, | ||
int | max_len | ||
) |
Encodes the bundle to raw data.
bundlemem | pointer to the MMEM struct containing the bundle |
buffer | pointer to a buffer |
max_len | Size of the buffer |
Definition at line 394 of file bundle.c.
References MMEM_PTR, sdnv_encode(), and sdnv_encoding_len().
uint8_t bundle_get_attr | ( | struct mmem * | bundlemem, |
uint8_t | attr, | ||
uint32_t * | val | ||
) |
Gets an attribute of a bundle.
bundlemem | pointer to the MMEM struct containing the bundle |
attr | attribute to get |
val | pointer to the variable where the value will be written |
Definition at line 196 of file bundle.c.
References MMEM_PTR.
Referenced by routing_epidemic_new_bundle(), routing_flooding_new_bundle(), and statusreport_basic_send().
|
read |
|
read |
|
read |
Returns pointer to bundle payload block.
bundlemem | MMEM allocation of the bundle |
Definition at line 134 of file bundle.c.
References bundle_get_block_by_type().
Referenced by dispatching_check_report().
int bundle_increment | ( | struct mmem * | bundlemem | ) |
Increments the reference counter for a MMEM struct containing a bundle.
Definition at line 552 of file bundle.c.
References MMEM_PTR.
Referenced by storage_mmem_read_bundle(), and storage_mmem_save_bundle().
|
read |
generates the bundle struct from raw data
buffer | pointer to the buffer with raw data |
size | size of raw data |
Definition at line 252 of file bundle.c.
References bundle_create_bundle(), bundle_delete_bundle(), MMEM_PTR, NULL, and sdnv_decode().
uint8_t bundle_set_attr | ( | struct mmem * | bundlemem, |
uint8_t | attr, | ||
uint32_t * | val | ||
) |
sets an attribute of a bundle
bundlemem | pointer to the MMEM struct containing bundle |
attr | attribute to be set |
val | pointer to the value to be set |
Definition at line 138 of file bundle.c.
References MMEM_PTR.
Referenced by statusreport_basic_send().