39static const struct schc_ipv6_rule_t ipv6_rule1 = {
40 .up = 10, .down = 10, .length = 11,
43 { IP6_V, 0, 4, 1, BI, {6}, &mo_equal, NOTSENT },
44 { IP6_TC, 0, 8, 1, BI, {0}, &mo_ignore, NOTSENT },
45 { IP6_FL, 0, 20, 1, BI, {0, 0, 0}, &mo_ignore, NOTSENT },
46 { IP6_LEN, 0, 16, 1, BI, {0, 0}, &mo_ignore, COMPLENGTH },
47 { IP6_NH, 0, 8, 1, BI, {17}, &mo_equal, NOTSENT },
48 { IP6_HL, 0, 8, 1, UP, {64}, &mo_equal, NOTSENT },
49 { IP6_HL, 0, 8, 1, DOWN, {0}, &mo_ignore, VALUESENT },
50 { IP6_DEVPRE, 0, 64, 1, BI, {
51 0x20, 0x01, 0x0d, 0xb8, 0x00, 0x01, 0x00, 0x00
52 }, &mo_equal, NOTSENT },
53 { IP6_DEVIID, 0, 64, 1, BI, {
54 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01
55 }, &mo_equal, NOTSENT },
56 { IP6_APPPRE, 4, 64, 1, BI, {
58 0x20, 0x01, 0x0d, 0xb8, 0x00, 0x01, 0x00, 0x00,
59 0x20, 0x01, 0x0d, 0xb8, 0x00, 0x02, 0x00, 0x00,
60 0x20, 0x01, 0x0d, 0xb8, 0x00, 0x03, 0x00, 0x00,
61 0x20, 0x01, 0x0d, 0xb8, 0x00, 0x04, 0x00, 0x00
62 }, &mo_matchmap, MAPPINGSENT },
63 { IP6_APPIID, 0, 64, 1, BI, {
64 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02
65 }, &mo_equal, NOTSENT },
70static const struct schc_ipv6_rule_t ipv6_rule2 = {
71 .up = 10, .down = 10, .length = 10,
74 { IP6_V, 0, 4, 1, BI, {6}, &mo_equal, NOTSENT },
75 { IP6_TC, 0, 8, 1, BI, {0}, &mo_ignore, NOTSENT },
76 { IP6_FL, 0, 20, 1, BI, {0, 0, 0}, &mo_ignore, NOTSENT },
77 { IP6_LEN, 0, 16, 1, BI, {0, 0}, &mo_ignore, COMPLENGTH },
78 { IP6_NH, 2, 8, 1, BI, {17, 58}, &mo_matchmap, MAPPINGSENT },
79 { IP6_HL, 2, 8, 1, BI, {64, 255}, &mo_matchmap, NOTSENT },
80 { IP6_DEVPRE, 0, 64, 1, BI, {
81 0xFE, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
82 }, &mo_equal, NOTSENT },
83 { IP6_DEVIID, 62, 64, 1, BI, {
84 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01
86 { IP6_APPPRE, 0, 64, 1, BI, {
87 0xFE, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
88 }, &mo_equal, NOTSENT },
89 { IP6_APPIID, 62, 64, 1, BI, {
90 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01
97static const struct schc_udp_rule_t udp_rule1 = {
98 .up = 4, .down = 4, .length = 4,
103 { UDP_DEV, 2, 16, 1, BI, {
106 }, &mo_matchmap, MAPPINGSENT },
107 { UDP_APP, 2, 16, 1, BI, {
110 }, &mo_matchmap, MAPPINGSENT },
111 { UDP_LEN, 0, 16, 1, BI, {0, 0}, &mo_ignore, COMPLENGTH },
112 { UDP_CHK, 0, 16, 1, BI, {0, 0}, &mo_ignore, COMPCHK },
116static const struct schc_udp_rule_t udp_rule2 = {
117 .up = 4, .down = 4, .length = 4,
120 { UDP_DEV, 12, 16, 1, BI, {0x1F, 0x40}, &mo_MSB, LSB },
121 { UDP_APP, 12, 16, 1, BI, {0x1F, 0x40}, &mo_MSB, LSB },
122 { UDP_LEN, 0, 16, 1, BI, {0, 0}, &mo_ignore, COMPLENGTH },
123 { UDP_CHK, 0, 16, 1, BI, {0, 0}, &mo_ignore, COMPCHK },
127static const struct schc_udp_rule_t udp_rule3 = {
128 .up = 4, .down = 4, .length = 4,
131 { UDP_DEV, 0, 16, 1, BI, {0x13, 0x89}, &mo_equal, NOTSENT },
132 { UDP_APP, 0, 16, 1, BI, {0x13, 0x88}, &mo_equal, NOTSENT },
133 { UDP_LEN, 0, 16, 1, BI, {0, 0}, &mo_ignore, COMPLENGTH },
134 { UDP_CHK, 0, 16, 1, BI, {0, 0}, &mo_ignore, COMPCHK },
143static const struct schc_coap_rule_t coap_rule1 = {
144 .up = 9, .down = 7, .length = 9,
147 { COAP_V, 0, 2, 1, BI, {
COAP_V1}, &mo_equal, NOTSENT },
149 { COAP_T, 4, 2, 1, BI, {
150 COAP_TYPE_CON, COAP_TYPE_NON, COAP_TYPE_ACK, COAP_TYPE_RST
151 }, &mo_matchmap, MAPPINGSENT },
152 { COAP_TKL, 0, 4, 1, BI, {4}, &mo_equal, NOTSENT },
154 { COAP_MID, 0, 16, 1, BI, {0x23, 0xBB}, &mo_equal, NOTSENT },
155 { COAP_TKN, 24, 32, 1, BI, {
156 0x21, 0xFA, 0x01, 0x00
158 { COAP_URIPATH, 0, 40, 1, BI,
"usage", &mo_equal, NOTSENT },
159 { COAP_NORESP, 0, 8, 1, BI, {0x1A}, &mo_equal, NOTSENT },
160 { COAP_PAYLOAD, 0, 8, 1, BI, {0xFF}, &mo_equal, NOTSENT }
165static const struct schc_coap_rule_t coap_rule2 = {
166 .up = 7, .down = 7, .length = 10,
169 { COAP_V, 0, 2, 1, BI, {
COAP_V1}, &mo_equal, NOTSENT },
170 { COAP_T, 0, 2, 1, BI, {0}, &mo_ignore, VALUESENT },
171 { COAP_TKL, 0, 4, 1, BI, {4}, &mo_equal, NOTSENT },
172 { COAP_C, 0, 8, 1, UP, {COAP_CODE_CONTENT}, &mo_equal, NOTSENT },
175 { COAP_MID, 12, 16, 1, UP, {0x23, 0xBB}, &mo_MSB, LSB },
176 { COAP_MID, 0, 16, 1, DOWN, {0, 0}, &mo_ignore, VALUESENT },
177 { COAP_TKN, 0, 32, 1, BI, {0, 0, 0, 0}, &mo_ignore, VALUESENT },
178 { COAP_URIPATH, 0, 32, 1, DOWN,
"temp", &mo_equal, NOTSENT },
180 { COAP_PAYLOAD, 0, 8, 1, UP, {0xFF}, &mo_equal, NOTSENT }
184static const struct schc_coap_rule_t coap_rule3 = {
185 .up = 1, .down = 1, .length = 1,
188 { COAP_V, 0, 2, 1, BI, {
COAP_V1}, &mo_equal, NOTSENT },
192static const struct schc_coap_rule_t coap_rule4 = {
193 .up = 12, .down = 12, .length = 12,
196 { COAP_V, 0, 2, 1, BI, {
COAP_V1}, &mo_equal, NOTSENT },
197 { COAP_T, 0, 2, 1, BI, {COAP_TYPE_CON}, &mo_equal, NOTSENT },
198 { COAP_TKL, 0, 4, 1, BI, {8}, &mo_equal, NOTSENT },
200 { COAP_MID, 0, 16, 1, BI, {0x23, 0xBB}, &mo_ignore, VALUESENT },
202 { COAP_TKN, 24, 32, 1, BI, {
203 0x21, 0xFA, 0x01, 0x00
205 { COAP_URIPATH, 0, 16, 1, BI,
"rd", &mo_equal, NOTSENT },
206 { COAP_CONTENTF, 0, 8, 1, BI, {0x28}, &mo_equal, NOTSENT },
207 { COAP_URIQUERY, 0, 72, 1, BI,
"lwm2m=1.0", &mo_equal, NOTSENT },
208 { COAP_URIQUERY, 0, 88, 1, BI,
"ep=magician", &mo_equal, NOTSENT },
209 { COAP_URIQUERY, 0, 48, 1, BI,
"lt=121", &mo_equal, NOTSENT },
211 { COAP_PAYLOAD, 0, 8, 1, BI, {0xff}, &mo_equal, NOTSENT }
216static const struct schc_compression_rule_t comp_rule_1 = {
218 .rule_id_size_bits = 8U,
230static const struct schc_compression_rule_t comp_rule_2 = {
232 .rule_id_size_bits = 8U,
244static const struct schc_compression_rule_t comp_rule_3 = {
246 .rule_id_size_bits = 8U,
258static const struct schc_compression_rule_t comp_rule_4 = {
260 .rule_id_size_bits = 8U,
272static const struct schc_fragmentation_rule_t frag_rule_21 = {
274 .rule_id_size_bits = 8,
283static const struct schc_fragmentation_rule_t frag_rule_22 = {
285 .rule_id_size_bits = 8,
286 .mode = ACK_ON_ERROR,
294static const struct schc_fragmentation_rule_t frag_rule_23 = {
296 .rule_id_size_bits = 8,
306static const struct schc_compression_rule_t* node1_compression_rules[] = {
307 &comp_rule_1, &comp_rule_2, &comp_rule_3, &comp_rule_4
311static const struct schc_fragmentation_rule_t* node1_fragmentation_rules[] = {
312 &frag_rule_21, &frag_rule_22, &frag_rule_23,
316static const struct schc_device node1 = {
319 .uncomp_rule_id_size_bits = 8,
320 .compression_rule_count =
ARRAY_SIZE(node1_compression_rules),
321 .compression_context = &node1_compression_rules,
322 .fragmentation_rule_count =
ARRAY_SIZE(node1_fragmentation_rules),
323 .fragmentation_context = &node1_fragmentation_rules
325static const struct schc_device node2 = {
328 .uncomp_rule_id_size_bits = 8,
329 .compression_rule_count =
ARRAY_SIZE(node1_compression_rules),
330 .compression_context = &node1_compression_rules,
331 .fragmentation_rule_count =
ARRAY_SIZE(node1_fragmentation_rules),
332 .fragmentation_context = &node1_fragmentation_rules
336static const struct schc_device* devices[] = { &node1, &node2 };
338#define DEVICE_COUNT ((int)ARRAY_SIZE(devices))
#define ARRAY_SIZE(a)
Calculate the number of elements in a static array.
#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.