OpenWSN Firmware
iphc.h
Go to the documentation of this file.
1 #ifndef __IPHC_H
2 #define __IPHC_H
3 
11 #include "openwsn.h"
12 
13 //=========================== define ==========================================
14 
15 #define IPHC_DEFAULT_HOP_LIMIT 65
16 #define IPv6HOP_HDR_LEN 3
17 
18 enum IPHC_enums {
20  IPHC_TF = 3,
21  IPHC_NH = 2,
22  IPHC_HLIM = 0,
23  IPHC_CID = 7,
24  IPHC_SAC = 6,
25  IPHC_SAM = 4,
26  IPHC_M = 3,
27  IPHC_DAC = 2,
28  IPHC_DAM = 0,
29 };
30 
33 };
34 
40 };
41 
45 };
46 
47 enum NHC_enums {
48  // IPv6 Extension Header Encoding starts with b1110 xxxx
49  NHC_IPv6EXT_MASK = 0xf0, // b1111 0000
50  NHC_IPv6EXT_ID = 0xe0, // b1110 0000
51  // UDP Header Encoding starts with b1111 0xxx
52  NHC_UDP_MASK = 0xf8, // b1111 1000
53  NHC_UDP_ID = 0xf0, // b1111 0000
54 };
55 
60 };
61 
62 
66 };
67 
73 };
74 
80 };
81 
85 };
86 
90 };
91 
97 };
98 
102 };
103 
107 };
108 
114 };
115 
116 //=========================== typedef =========================================
117 
118 typedef struct {
119  uint8_t traffic_class;
120  uint32_t flow_label;
122  uint8_t next_header;
123  uint8_t hop_limit;
126  uint8_t header_length;
127 } ipv6_header_iht; // iht for "internal header type"
128 
149 typedef struct {
150  uint8_t headerlen;
152  uint8_t lowpan_nhc;
153  uint8_t nextHeader;
154  uint8_t HdrExtLen;
156 
162 BEGIN_PACK
163 typedef struct {
164  uint8_t optionType;
165  uint8_t optionLen;
166  uint8_t flags;
167  uint8_t rplInstanceID;
168  uint16_t senderRank;
169 } rpl_option_ht;
170 END_PACK
171 
172 //=========================== variables =======================================
173 
174 //=========================== prototypes ======================================
175 
176 void iphc_init(void);
178  OpenQueueEntry_t* msg,
179  ipv6_header_iht* ipv6_header,
180  rpl_option_ht* rpl_option,
181  uint32_t* flow_label,
182  uint8_t fw_SendOrfw_Rcv
183 );
185 void iphc_sendDone(OpenQueueEntry_t *msg, owerror_t error);
186 void iphc_receive(OpenQueueEntry_t *msg);
187 
193 #endif
Definition: iphc.h:69
Definition: iphc.h:57
IPHC_M_enums
Definition: iphc.h:99
uint8_t hop_limit
Definition: iphc.h:123
Definition: iphc.h:110
IPHC_SAM_enums
Definition: iphc.h:92
uint8_t optionLen
8-bit field indicating the length of the option, in octets, excluding the Option Type and Opt Data Le...
Definition: iphc.h:165
open_addr_t src
Definition: iphc.h:124
IPHC_CID_enums
Definition: iphc.h:82
Definition: iphc.h:96
Definition: iphc.h:101
Definition: iphc.h:43
Definition: iphc.h:19
uint8_t nextHeader
Definition: iphc.h:153
void iphc_init()
Definition: iphc.c:51
uint8_t optionType
RPL_HOPBYHOP_HEADER_OPTION_TYPE.
Definition: iphc.h:164
uint32_t flow_label
Definition: iphc.h:120
NHC_UDP_enums
Definition: iphc.h:63
Definition: iphc.h:70
Definition: iphc.h:118
Definition: iphc.h:88
Definition: iphc.h:37
Definition: iphc.h:58
RPL Option header type.
Definition: iphc.h:163
Definition: iphc.h:111
Definition: iphc.h:94
uint8_t next_header
Definition: iphc.h:122
Definition: iphc.h:59
Definition: iphc.h:112
uint8_t header_length
Counter for internal use.
Definition: iphc.h:126
Definition: iphc.h:25
NHC_UDP_PORTS_enums
Definition: iphc.h:68
uint8_t owerror_t
Definition: openwsn.h:265
IPHC_enums
Definition: iphc.h:18
Definition: iphc.h:106
Definition: iphc.h:77
IPHC_SAC_enums
Definition: iphc.h:87
uint16_t senderRank
RPL rank of the sender of the packet.
Definition: iphc.h:168
Definition: iphc.h:26
Definition: iphc.h:72
uint8_t rplInstanceID
instanceid
Definition: iphc.h:167
Definition: iphc.h:49
Definition: iphc.h:50
Definition: iphc.h:24
owerror_t iphc_sendFromForwarding(OpenQueueEntry_t *msg, ipv6_header_iht *ipv6_header, rpl_option_ht *rpl_option, uint32_t *flow_label, uint8_t fw_SendOrfw_Rcv)
Definition: iphc.c:55
open_addr_t dest
Definition: iphc.h:125
IPHC_DISPATCH_enums
Definition: iphc.h:31
Definition: iphc.h:28
Definition: iphc.h:20
Definition: iphc.h:39
uint8_t HdrExtLen
Definition: iphc.h:154
owerror_t iphc_sendFromBridge(OpenQueueEntry_t *msg)
Definition: iphc.c:199
Definition: iphc.h:105
Definition: iphc.h:27
IPHC_HLIM_enums
Definition: iphc.h:75
uint8_t lowpan_nhc
Definition: iphc.h:152
Definition: openwsn.h:276
Definition: iphc.h:23
Definition: iphc.h:78
Definition: iphc.h:32
IPHC_DAM_enums
Definition: iphc.h:109
Definition: iphc.h:84
Definition: iphc.h:64
Definition: iphc.h:83
NHC_IPv6HOP_enums
Definition: iphc.h:56
IPHC_DAC_enums
Definition: iphc.h:104
IPHC_TF_enums
Definition: iphc.h:35
Definition: iphc.h:71
Definition: iphc.h:113
Definition: iphc.h:44
Definition: iphc.h:93
Definition: iphc.h:100
void iphc_sendDone(OpenQueueEntry_t *msg, owerror_t error)
Definition: iphc.c:211
IPv6 hop-by-hop option.
Definition: iphc.h:149
IPHC_NH_enums
Definition: iphc.h:42
Definition: iphc.h:95
uint8_t flags
ORF00000.
Definition: iphc.h:166
Definition: openwsn.h:288
bool next_header_compressed
Definition: iphc.h:151
Definition: iphc.h:52
Definition: iphc.h:79
bool next_header_compressed
Definition: iphc.h:121
uint8_t headerlen
Counter for internal use.
Definition: iphc.h:150
Definition: iphc.h:21
Definition: iphc.h:76
Definition: iphc.h:53
void iphc_receive(OpenQueueEntry_t *msg)
Definition: iphc.c:220
Definition: iphc.h:36
uint8_t traffic_class
Definition: iphc.h:119
Definition: iphc.h:65
Definition: iphc.h:89
Definition: iphc.h:38
Definition: iphc.h:22
NHC_enums
Definition: iphc.h:47