27static const struct schc_ipv6_rule_t ipv6_rule1 = {
28 .up = 10, .down = 10, .length = 11,
31 { IP6_V, 0, 4, 1, BI, {6}, &mo_equal, NOTSENT },
32 { IP6_TC, 0, 8, 1, BI, {0}, &mo_ignore, NOTSENT },
33 { IP6_FL, 0, 20, 1, BI, {0, 0, 0}, &mo_ignore, NOTSENT },
34 { IP6_LEN, 0, 16, 1, BI, {0, 0}, &mo_ignore, COMPLENGTH },
35 { IP6_NH, 0, 8, 1, BI, {17}, &mo_equal, NOTSENT },
36 { IP6_HL, 0, 8, 1, UP, {64}, &mo_equal, NOTSENT },
37 { IP6_HL, 0, 8, 1, DOWN, {0}, &mo_ignore, VALUESENT },
38 { IP6_DEVPRE, 0, 64, 1, BI, {
39 0x20, 0x01, 0x0d, 0xb8, 0x00, 0x01, 0x00, 0x00
40 }, &mo_equal, NOTSENT },
41 { IP6_DEVIID, 0, 64, 1, BI, {
42 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01
43 }, &mo_equal, NOTSENT },
44 { IP6_APPPRE, 4, 64, 1, BI, {
46 0x20, 0x01, 0x0d, 0xb8, 0x00, 0x01, 0x00, 0x00,
47 0x20, 0x01, 0x0d, 0xb8, 0x00, 0x02, 0x00, 0x00,
48 0x20, 0x01, 0x0d, 0xb8, 0x00, 0x03, 0x00, 0x00,
49 0x20, 0x01, 0x0d, 0xb8, 0x00, 0x04, 0x00, 0x00
50 }, &mo_matchmap, MAPPINGSENT },
51 { IP6_APPIID, 0, 64, 1, BI, {
52 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02
53 }, &mo_equal, NOTSENT },
58static const struct schc_ipv6_rule_t ipv6_rule2 = {
59 .up = 10, .down = 10, .length = 10,
62 { IP6_V, 0, 4, 1, BI, {6}, &mo_equal, NOTSENT },
63 { IP6_TC, 0, 8, 1, BI, {0}, &mo_ignore, NOTSENT },
64 { IP6_FL, 0, 20, 1, BI, {0, 0, 0}, &mo_ignore, NOTSENT },
65 { IP6_LEN, 0, 16, 1, BI, {0, 0}, &mo_ignore, COMPLENGTH },
66 { IP6_NH, 2, 8, 1, BI, {17, 58}, &mo_matchmap, MAPPINGSENT },
67 { IP6_HL, 2, 8, 1, BI, {64, 255}, &mo_matchmap, NOTSENT },
68 { IP6_DEVPRE, 0, 64, 1, BI, {
69 0xFE, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
70 }, &mo_equal, NOTSENT },
71 { IP6_DEVIID, 62, 64, 1, BI, {
72 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01
74 { IP6_APPPRE, 0, 64, 1, BI, {
75 0xFE, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
76 }, &mo_equal, NOTSENT },
77 { IP6_APPIID, 62, 64, 1, BI, {
78 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01
85static const struct schc_udp_rule_t udp_rule1 = {
86 .up = 4, .down = 4, .length = 4,
91 { UDP_DEV, 2, 16, 1, BI, {
94 }, &mo_matchmap, MAPPINGSENT },
95 { UDP_APP, 2, 16, 1, BI, {
98 }, &mo_matchmap, MAPPINGSENT },
99 { UDP_LEN, 0, 16, 1, BI, {0, 0}, &mo_ignore, COMPLENGTH },
100 { UDP_CHK, 0, 16, 1, BI, {0, 0}, &mo_ignore, COMPCHK },
104static const struct schc_udp_rule_t udp_rule2 = {
105 .up = 4, .down = 4, .length = 4,
108 { UDP_DEV, 12, 16, 1, BI, {0x1F, 0x40}, &mo_MSB, LSB },
109 { UDP_APP, 12, 16, 1, BI, {0x1F, 0x40}, &mo_MSB, LSB },
110 { UDP_LEN, 0, 16, 1, BI, {0, 0}, &mo_ignore, COMPLENGTH },
111 { UDP_CHK, 0, 16, 1, BI, {0, 0}, &mo_ignore, COMPCHK },
115static const struct schc_udp_rule_t udp_rule3 = {
116 .up = 4, .down = 4, .length = 4,
119 { UDP_DEV, 0, 16, 1, BI, {0x13, 0x89}, &mo_equal, NOTSENT },
120 { UDP_APP, 0, 16, 1, BI, {0x13, 0x88}, &mo_equal, NOTSENT },
121 { UDP_LEN, 0, 16, 1, BI, {0, 0}, &mo_ignore, COMPLENGTH },
122 { UDP_CHK, 0, 16, 1, BI, {0, 0}, &mo_ignore, COMPCHK },
131static const struct schc_coap_rule_t coap_rule1 = {
132 .up = 9, .down = 7, .length = 9,
135 { COAP_V, 0, 2, 1, BI, {
COAP_V1}, &mo_equal, NOTSENT },
137 { COAP_T, 4, 2, 1, BI, {
138 COAP_TYPE_CON, COAP_TYPE_NON, COAP_TYPE_ACK, COAP_TYPE_RST
139 }, &mo_matchmap, MAPPINGSENT },
140 { COAP_TKL, 0, 4, 1, BI, {4}, &mo_equal, NOTSENT },
142 { COAP_MID, 0, 16, 1, BI, {0x23, 0xBB}, &mo_equal, NOTSENT },
143 { COAP_TKN, 24, 32, 1, BI, {
144 0x21, 0xFA, 0x01, 0x00
146 { COAP_URIPATH, 0, 40, 1, BI,
"usage", &mo_equal, NOTSENT },
147 { COAP_NORESP, 0, 8, 1, BI, {0x1A}, &mo_equal, NOTSENT },
148 { COAP_PAYLOAD, 0, 8, 1, BI, {0xFF}, &mo_equal, NOTSENT }
153static const struct schc_coap_rule_t coap_rule2 = {
154 .up = 7, .down = 7, .length = 10,
157 { COAP_V, 0, 2, 1, BI, {
COAP_V1}, &mo_equal, NOTSENT },
158 { COAP_T, 0, 2, 1, BI, {0}, &mo_ignore, VALUESENT },
159 { COAP_TKL, 0, 4, 1, BI, {4}, &mo_equal, NOTSENT },
163 { COAP_MID, 12, 16, 1, UP, {0x23, 0xBB}, &mo_MSB, LSB },
164 { COAP_MID, 0, 16, 1, DOWN, {0, 0}, &mo_ignore, VALUESENT },
165 { COAP_TKN, 0, 32, 1, BI, {0, 0, 0, 0}, &mo_ignore, VALUESENT },
166 { COAP_URIPATH, 0, 32, 1, DOWN,
"temp", &mo_equal, NOTSENT },
168 { COAP_PAYLOAD, 0, 8, 1, UP, {0xFF}, &mo_equal, NOTSENT }
172static const struct schc_coap_rule_t coap_rule3 = {
173 .up = 1, .down = 1, .length = 1,
176 { COAP_V, 0, 2, 1, BI, {
COAP_V1}, &mo_equal, NOTSENT },
180static const struct schc_coap_rule_t coap_rule4 = {
181 .up = 12, .down = 12, .length = 12,
184 { COAP_V, 0, 2, 1, BI, {
COAP_V1}, &mo_equal, NOTSENT },
185 { COAP_T, 0, 2, 1, BI, {COAP_TYPE_CON}, &mo_equal, NOTSENT },
186 { COAP_TKL, 0, 4, 1, BI, {8}, &mo_equal, NOTSENT },
188 { COAP_MID, 0, 16, 1, BI, {0x23, 0xBB}, &mo_ignore, VALUESENT },
190 { COAP_TKN, 24, 32, 1, BI, {
191 0x21, 0xFA, 0x01, 0x00
193 { COAP_URIPATH, 0, 16, 1, BI,
"rd", &mo_equal, NOTSENT },
194 { COAP_CONTENTF, 0, 8, 1, BI, {0x28}, &mo_equal, NOTSENT },
195 { COAP_URIQUERY, 0, 72, 1, BI,
"lwm2m=1.0", &mo_equal, NOTSENT },
196 { COAP_URIQUERY, 0, 88, 1, BI,
"ep=magician", &mo_equal, NOTSENT },
197 { COAP_URIQUERY, 0, 48, 1, BI,
"lt=121", &mo_equal, NOTSENT },
199 { COAP_PAYLOAD, 0, 8, 1, BI, {0xff}, &mo_equal, NOTSENT }
204static const struct schc_compression_rule_t comp_rule_1 = {
206 .rule_id_size_bits = 8U,
218static const struct schc_compression_rule_t comp_rule_2 = {
220 .rule_id_size_bits = 8U,
232static const struct schc_compression_rule_t comp_rule_3 = {
234 .rule_id_size_bits = 8U,
246static const struct schc_compression_rule_t comp_rule_4 = {
248 .rule_id_size_bits = 8U,
260static const struct schc_fragmentation_rule_t frag_rule_21 = {
262 .rule_id_size_bits = 8,
271static const struct schc_fragmentation_rule_t frag_rule_22 = {
273 .rule_id_size_bits = 8,
274 .mode = ACK_ON_ERROR,
282static const struct schc_fragmentation_rule_t frag_rule_23 = {
284 .rule_id_size_bits = 8,
294static const struct schc_compression_rule_t* node1_compression_rules[] = {
295 &comp_rule_1, &comp_rule_2, &comp_rule_3, &comp_rule_4
299static const struct schc_fragmentation_rule_t* node1_fragmentation_rules[] = {
300 &frag_rule_21, &frag_rule_22, &frag_rule_23,
304static const struct schc_device node1 = {
307 .uncomp_rule_id_size_bits = 8,
308 .compression_rule_count =
ARRAY_SIZE(node1_compression_rules),
309 .compression_context = &node1_compression_rules,
310 .fragmentation_rule_count =
ARRAY_SIZE(node1_fragmentation_rules),
311 .fragmentation_context = &node1_fragmentation_rules
313static const struct schc_device node2 = {
316 .uncomp_rule_id_size_bits = 8,
317 .compression_rule_count =
ARRAY_SIZE(node1_compression_rules),
318 .compression_context = &node1_compression_rules,
319 .fragmentation_rule_count =
ARRAY_SIZE(node1_fragmentation_rules),
320 .fragmentation_context = &node1_fragmentation_rules
324static const struct schc_device* devices[] = { &node1, &node2 };
326#define DEVICE_COUNT ((int)ARRAY_SIZE(devices))
#define ARRAY_SIZE(a)
Calculate the number of elements in a static array.
#define COAP_CODE_CONTENT
Response Code: 2.05 Content.
#define COAP_V1
Identifier for CoAP version 1 (RFC 7252)
@ COAP_METHOD_GET
GET request (no paylod)
@ COAP_METHOD_PUT
PUT request (update resource with payload)
@ COAP_METHOD_POST
POST request (resource processes payload)
Common macros and compiler attributes/pragmas configuration.
Generic CoAP values as defined by RFC7252.