The friendly Operating System for the Internet of Things
nhdp_address.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2014 Freie Universit├Ąt Berlin
3  *
4  * This file is subject to the terms and conditions of the GNU Lesser
5  * General Public License v2.1. See the file LICENSE in the top level
6  * directory for more details.
7  */
8 
19 #ifndef NHDP_ADDRESS_H
20 #define NHDP_ADDRESS_H
21 
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25 
29 typedef struct nhdp_addr {
30  uint8_t *addr;
31  size_t addr_size;
32  uint8_t addr_type;
33  uint8_t usg_count;
34  uint8_t in_tmp_table;
35  uint16_t tmp_metric_val;
36  struct nhdp_addr *next;
37 } nhdp_addr_t;
38 
42 typedef struct nhdp_addr_entry {
43  struct nhdp_addr *address;
46 
52 #define NHDP_ADDR_TMP_NONE (0x00)
53 #define NHDP_ADDR_TMP_ANY (0x01)
54 #define NHDP_ADDR_TMP_SYM (0x03)
55 #define NHDP_ADDR_TMP_REM_LIST (0x04)
56 #define NHDP_ADDR_TMP_TH_REM_LIST (0x08)
57 #define NHDP_ADDR_TMP_TH_SYM_LIST (0x10)
58 #define NHDP_ADDR_TMP_NB_LIST (0x20)
59 #define NHDP_ADDR_TMP_SEND_LIST (0x60)
60 
61 #define NHDP_ADDR_TMP_IN_ANY(addr) ((addr->in_tmp_table & 0x01))
62 #define NHDP_ADDR_TMP_IN_SYM(addr) ((addr->in_tmp_table & 0x02) >> 1)
63 #define NHDP_ADDR_TMP_IN_REM_LIST(addr) ((addr->in_tmp_table & 0x04) >> 2)
64 #define NHDP_ADDR_TMP_IN_TH_REM_LIST(addr) ((addr->in_tmp_table & 0x08) >> 3)
65 #define NHDP_ADDR_TMP_IN_TH_SYM_LIST(addr) ((addr->in_tmp_table & 0x10) >> 4)
66 #define NHDP_ADDR_TMP_IN_NB_LIST(addr) ((addr->in_tmp_table & 0x20) >> 5)
67 #define NHDP_ADDR_TMP_IN_SEND_LIST(addr) ((addr->in_tmp_table & 0x40) >> 6)
68 
80 nhdp_addr_t *nhdp_addr_db_get_address(uint8_t *addr, size_t addr_size, uint8_t addr_type);
81 
90 
98 void nhdp_free_addr_list(nhdp_addr_entry_t *list_head);
99 
108 void nhdp_free_addr_entry(nhdp_addr_entry_t *addr_entry);
109 
118 
127 void nhdp_reset_addresses_tmp_usg(uint8_t decr_usg);
128 
136 
137 #ifdef __cplusplus
138 }
139 #endif
140 
141 #endif /* NHDP_ADDRESS_H */
142 
struct nhdp_addr_entry nhdp_addr_entry_t
Container for NHDP address storage in a list.
size_t addr_size
Size in bytes of the address.
Definition: nhdp_address.h:31
uint8_t * addr
Pointer to the address data.
Definition: nhdp_address.h:30
NHDP address representation.
Definition: nhdp_address.h:29
struct nhdp_addr_entry * next
Pointer to the next address list element.
Definition: nhdp_address.h:44
void nhdp_free_addr_list(nhdp_addr_entry_t *list_head)
Free the given address list.
struct nhdp_addr * address
Pointer to NHDP address storage entry.
Definition: nhdp_address.h:43
Container for NHDP address storage in a list.
Definition: nhdp_address.h:42
uint8_t usg_count
Usage count in information bases.
Definition: nhdp_address.h:33
nhdp_addr_entry_t * nhdp_generate_addr_list_from_tmp(uint8_t tmp_type)
Construct an addr list containing all addresses with the given tmp_type.
uint8_t in_tmp_table
Signals usage in a writers temp table.
Definition: nhdp_address.h:34
void nhdp_decrement_addr_usage(nhdp_addr_t *addr)
Decrement the usage counter of a given NHDP address.
nhdp_addr_t * nhdp_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.
uint16_t tmp_metric_val
Encoded metric value used during HELLO processing.
Definition: nhdp_address.h:35
struct nhdp_addr * next
Pointer to next address (used in central storage)
Definition: nhdp_address.h:36
nhdp_addr_t * nhdp_get_addr_db_head(void)
Get a pointer to the head of the address storage list.
uint8_t addr_type
AF type for the address.
Definition: nhdp_address.h:32
struct nhdp_addr nhdp_addr_t
NHDP address representation.
void nhdp_reset_addresses_tmp_usg(uint8_t decr_usg)
Reset in_tmp_table flag of all NHDP addresses.
void nhdp_free_addr_entry(nhdp_addr_entry_t *addr_entry)
Free the given address list entry.