ctx.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2015 Martine Lenders <mlenders@inf.fu-berlin.de>
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 
26 #ifndef NET_GNRC_SIXLOWPAN_CTX_H
27 #define NET_GNRC_SIXLOWPAN_CTX_H
28 
29 #include <inttypes.h>
30 #include <stdbool.h>
31 
32 #include "net/ipv6/addr.h"
33 
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
37 
38 #define GNRC_SIXLOWPAN_CTX_SIZE (16)
46 #define GNRC_SIXLOWPAN_CTX_FLAGS_CID_MASK (0x0f)
47 #define GNRC_SIXLOWPAN_CTX_FLAGS_COMP (0x10)
55 typedef struct {
56  ipv6_addr_t prefix;
57  uint8_t prefix_len;
66  uint8_t flags_id;
74  uint16_t ltime;
76 
86 
96 
113  uint8_t prefix_len, uint16_t ltime,
114  bool comp);
115 
116 #ifdef MODULE_GNRC_SIXLOWPAN_CTX
117 
122 static inline void gnrc_sixlowpan_ctx_remove(uint8_t id)
123 {
125 }
126 #endif
127 
128 #ifdef TEST_SUITES
129 
132 void gnrc_sixlowpan_ctx_reset(void);
133 #endif
134 
135 #ifdef __cplusplus
136 }
137 #endif
138 
139 #endif /* NET_GNRC_SIXLOWPAN_CTX_H */
140 
Definitions for IPv6 addresses.
gnrc_sixlowpan_ctx_t * gnrc_sixlowpan_ctx_lookup_addr(const ipv6_addr_t *addr)
Gets a context matching the given IPv6 address best with its prefix.
gnrc_sixlowpan_ctx_t * gnrc_sixlowpan_ctx_lookup_id(uint8_t id)
Gets context by ID.
gnrc_sixlowpan_ctx_t * gnrc_sixlowpan_ctx_update(uint8_t id, const ipv6_addr_t *prefix, uint8_t prefix_len, uint16_t ltime, bool comp)
Updates (or adds if currently not registered) a context.
Adds include for missing inttype definitions.
Entry in the 6LoWPAN context buffer.
Definition: ctx.h:56
Data type to represent an IPv6 address.
Definition: ipv6/addr.h:74
uint8_t prefix_len
Length of gnrc_sixlowpan_ctx_t::prefix in bit.
Definition: ctx.h:58
void gnrc_sixlowpan_ctx_reset(void)
Resets the whole context buffer.