The friendly Operating System for the Internet of Things
nhdp_address.h File Reference

Centralized address storage interface for NHDP. More...

Detailed Description

+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  nhdp_addr
 NHDP address representation. More...
 
struct  nhdp_addr_entry
 Container for NHDP address storage in a list. More...
 

Macros

NHDP address temp usage helper macros
#define NHDP_ADDR_TMP_NONE   (0x00)
 
#define NHDP_ADDR_TMP_ANY   (0x01)
 
#define NHDP_ADDR_TMP_SYM   (0x03)
 
#define NHDP_ADDR_TMP_REM_LIST   (0x04)
 
#define NHDP_ADDR_TMP_TH_REM_LIST   (0x08)
 
#define NHDP_ADDR_TMP_TH_SYM_LIST   (0x10)
 
#define NHDP_ADDR_TMP_NB_LIST   (0x20)
 
#define NHDP_ADDR_TMP_SEND_LIST   (0x60)
 
#define NHDP_ADDR_TMP_IN_ANY(addr)   ((addr->in_tmp_table & 0x01))
 
#define NHDP_ADDR_TMP_IN_SYM(addr)   ((addr->in_tmp_table & 0x02) >> 1)
 
#define NHDP_ADDR_TMP_IN_REM_LIST(addr)   ((addr->in_tmp_table & 0x04) >> 2)
 
#define NHDP_ADDR_TMP_IN_TH_REM_LIST(addr)   ((addr->in_tmp_table & 0x08) >> 3)
 
#define NHDP_ADDR_TMP_IN_TH_SYM_LIST(addr)   ((addr->in_tmp_table & 0x10) >> 4)
 
#define NHDP_ADDR_TMP_IN_NB_LIST(addr)   ((addr->in_tmp_table & 0x20) >> 5)
 
#define NHDP_ADDR_TMP_IN_SEND_LIST(addr)   ((addr->in_tmp_table & 0x40) >> 6)
 

Typedefs

typedef struct nhdp_addr nhdp_addr_t
 NHDP address representation.
 
typedef struct nhdp_addr_entry nhdp_addr_entry_t
 Container for NHDP address storage in a list.
 

Functions

nhdp_addr_tnhdp_addr_db_get_address (uint8_t *addr, size_t addr_size, uint8_t addr_type)
 Get or create a NHDP address for the given address. More...
 
void nhdp_decrement_addr_usage (nhdp_addr_t *addr)
 Decrement the usage counter of a given NHDP address. More...
 
void nhdp_free_addr_list (nhdp_addr_entry_t *list_head)
 Free the given address list. More...
 
void nhdp_free_addr_entry (nhdp_addr_entry_t *addr_entry)
 Free the given address list entry. More...
 
nhdp_addr_entry_tnhdp_generate_addr_list_from_tmp (uint8_t tmp_type)
 Construct an addr list containing all addresses with the given tmp_type. More...
 
void nhdp_reset_addresses_tmp_usg (uint8_t decr_usg)
 Reset in_tmp_table flag of all NHDP addresses. More...
 
nhdp_addr_tnhdp_get_addr_db_head (void)
 Get a pointer to the head of the address storage list. More...
 

Function Documentation

nhdp_addr_t* nhdp_addr_db_get_address ( uint8_t *  addr,
size_t  addr_size,
uint8_t  addr_type 
)
Parameters
[in]addrPointer to the given address
[in]addr_sizeLength in bytes of the given address
[in]addr_typeAF type of the given address
Returns
Pointer to the NHDP address representation of the given address
NULL on error
void nhdp_decrement_addr_usage ( nhdp_addr_t addr)

The NHDP address is deleted if the usage counter reaches zero.

Parameters
[in]addrPointer to the NHDP address
void nhdp_free_addr_entry ( nhdp_addr_entry_t addr_entry)

Additionally to freeing the address entry, this function takes care that the usage counter of the list entry's address is decremented.

Parameters
[in]addr_entryPointer to the address list entry to free
void nhdp_free_addr_list ( nhdp_addr_entry_t list_head)

This function frees every address list entry of the given address list.

Parameters
[in]list_headPointer to the head of the address list to free
nhdp_addr_entry_t* nhdp_generate_addr_list_from_tmp ( uint8_t  tmp_type)
Returns
Pointer to the head of the newly created address list
NULL on error
nhdp_addr_t* nhdp_get_addr_db_head ( void  )
Returns
Pointer to the head of the central storage address list
NULL if no addresses are registered
void nhdp_reset_addresses_tmp_usg ( uint8_t  decr_usg)
Note
Must not be called from outside the NHDP writer's or reader's message creation process.
Parameters
[in]decr_usgFlag whether the usage counter of a resetted addr has to be decremented