nhdp.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 
21 #ifndef NHDP_H
22 #define NHDP_H
23 
24 #include "timex.h"
25 #include "xtimer.h"
26 #include "kernel_types.h"
27 
28 #include "nhdp_metric.h"
29 #include "rfc5444/rfc5444_writer.h"
30 
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34 
36 #define ENABLE_DEBUG (0)
37 #include "debug.h"
38 
44 #ifndef MANET_PORT
45 
46 #define MANET_PORT (269)
47 #endif
48 
50 #if ENABLE_DEBUG
51 #define NHDP_STACK_SIZE (THREAD_STACKSIZE_DEFAULT + THREAD_EXTRA_STACKSIZE_PRINTF)
52 #else
53 #define NHDP_STACK_SIZE (THREAD_STACKSIZE_DEFAULT)
54 #endif
55 
57 #define NHDP_WR_MSG_BUF_SIZE (256)
58 
59 #define NHDP_WR_TLV_BUF_SIZE (512)
60 
61 /* TODO: Determine a good value */
63 #define NHDP_MSG_QUEUE_SIZE (16)
64 
66 #define NHDP_MAX_RFC5444_PACKET_SZ (128)
67 
69 #define NHDP_DEFAULT_HELLO_INT_MS (2000)
70 
71 #define NHDP_DEFAULT_HOLD_TIME_MS (3 * NHDP_DEFAULT_HELLO_INT_MS)
72 
78 #define NHDP_INITIAL_PENDING (0)
79 
81 #define NHDP_HP_MAXJITTER_MS (200)
82 
83 #define NHDP_L_HOLD_TIME_MS (NHDP_DEFAULT_HOLD_TIME_MS)
84 #define NHDP_N_HOLD_TIME_MS (NHDP_DEFAULT_HOLD_TIME_MS)
85 #define NHDP_I_HOLD_TIME_MS (NHDP_DEFAULT_HOLD_TIME_MS)
86 
91 typedef struct {
96  uint16_t seq_no;
97  struct rfc5444_writer_target wr_target;
99 
104  AF_CC110X = AF_MAX + 3,
105 };
106 
113 void nhdp_init(void);
114 
122 
144 int nhdp_register_if_default(kernel_pid_t if_pid, uint8_t *addr, size_t addr_size,
145  uint8_t addr_type, uint16_t max_pl_size);
146 
166 int nhdp_register_if(kernel_pid_t if_pid, uint8_t *addr, size_t addr_size, uint8_t addr_type,
167  uint16_t max_pl_size, uint16_t hello_int_ms, uint16_t val_time_ms);
168 
184 int nhdp_register_non_manet_if(kernel_pid_t if_pid, uint8_t *addr, size_t addr_size,
185  uint8_t addr_type);
186 
201 int nhdp_add_address(kernel_pid_t if_pid, uint8_t *addr, size_t addr_size, uint8_t addr_type);
202 
203 #ifdef __cplusplus
204 }
205 #endif
206 
207 #endif /* NHDP_H */
208 
Types used by the kernel.
kernel_pid_t if_pid
PID of the interface's handling thread.
Definition: nhdp.h:92
int nhdp_register_if(kernel_pid_t if_pid, uint8_t *addr, size_t addr_size, uint8_t addr_type, uint16_t max_pl_size, uint16_t hello_int_ms, uint16_t val_time_ms)
Register an interface for NHDP operation.
A timex timestamp.
Definition: timex.h:79
xtimer_t if_timer
xtimer used for the periodic signaling
Definition: nhdp.h:93
int16_t kernel_pid_t
Unique process identifier.
Definition: kernel_types.h:83
Debug-header.
int nhdp_register_if_default(kernel_pid_t if_pid, uint8_t *addr, size_t addr_size, uint8_t addr_type, uint16_t max_pl_size)
Register an interface for NHDP operation with default values.
timex_t hello_interval
Interval time for periodic HELLOs.
Definition: nhdp.h:94
kernel_pid_t nhdp_start(void)
Start NHDP's operational thread.
Utility library for comparing and computing timestamps.
uint16_t seq_no
Sequence number of last send RFC5444 packet.
Definition: nhdp.h:96
void nhdp_init(void)
Initialize NHDP for operation.
xtimer interface definitions
#define AF_MAX
alias for AF_NUMOF
Definition: af.h:44
nhdp_address_type_t
Additional address types for link layer operation.
Definition: nhdp.h:103
xtimer timer structure
Definition: xtimer.h:70
Macros for NHDP metric computation.
MANET interface representation.
Definition: nhdp.h:91
int nhdp_add_address(kernel_pid_t if_pid, uint8_t *addr, size_t addr_size, uint8_t addr_type)
Register an additional address for an interface in NHDP.
timex_t validity_time
Validity time for propagated information.
Definition: nhdp.h:95
int nhdp_register_non_manet_if(kernel_pid_t if_pid, uint8_t *addr, size_t addr_size, uint8_t addr_type)
Register a non MANET interface in NHDP.