10 #ifndef __PACKET_COAP_H__
11 #define __PACKET_COAP_H__
13 #include "packet-oscore.h"
16 #define COAP_VERSION_MASK 0xC0
17 #define COAP_TYPE_MASK 0x30
18 #define COAP_TOKEN_LEN_MASK 0x0F
19 #define COAP_BLOCK_MFLAG_MASK 0x08
20 #define COAP_BLOCK_SIZE_MASK 0x07
21 #define COAP_OBJECT_SECURITY_RESERVED_MASK 0xE0
22 #define COAP_OBJECT_SECURITY_KID_CONTEXT_MASK 0x10
23 #define COAP_OBJECT_SECURITY_KID_MASK 0x08
24 #define COAP_OBJECT_SECURITY_PIVLEN_MASK 0x07
31 } coap_parent_protocol;
35 const gchar *ctype_str;
42 gboolean is_coap_for_tmf;
43 gboolean object_security;
90 int opt_location_path;
92 int opt_location_query;
94 int opt_uri_path_recon;
100 int opt_block_number;
108 int opt_ocf_accept_version;
110 int opt_object_security_reserved;
111 int opt_object_security_kid_context_present;
112 int opt_object_security_kid_present;
113 int opt_object_security_piv_len;
114 int opt_object_security_piv;
115 int opt_object_security_kid_context_len;
116 int opt_object_security_kid_context;
117 int opt_object_security_kid;
149 #define COAP_COMMON_LIST_T(name) \
150 coap_common_dissect_t name = { \
152 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, \
153 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, \
154 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, \
155 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, \
156 -1, -1, -1, -1, -1, -1, \
162 EI_INIT, EI_INIT, EI_INIT, EI_INIT, EI_INIT, \
168 #define COAP_COMMON_HF_LIST(name, prefix) \
170 { "Code", prefix ".code", \
171 FT_UINT8, BASE_DEC | BASE_EXT_STRING, &coap_vals_code_ext, 0x0, \
174 { & name .hf.payload, \
175 { "Payload", prefix ".payload", \
176 FT_STRING, BASE_NONE, NULL, 0x0, \
179 { & name .hf.payload_desc, \
180 { "Payload Desc", prefix ".payload_desc", \
181 FT_STRING, BASE_NONE, NULL, 0x0, \
184 { & name .hf.payload_length, \
185 { "Payload Length", prefix ".payload_length", \
186 FT_UINT32, BASE_DEC, NULL, 0x0, \
189 { & name .hf.opt_name, \
190 { "Opt Name", prefix ".opt.name", \
191 FT_STRING, BASE_NONE, NULL, 0x0, \
194 { & name .hf.opt_desc, \
195 { "Opt Desc", prefix ".opt.desc", \
196 FT_STRING, BASE_NONE, NULL, 0x0, \
199 { & name .hf.opt_delta, \
200 { "Opt Delta", prefix ".opt.delta", \
201 FT_UINT8, BASE_DEC, NULL, 0xf0, \
204 { & name .hf.opt_delta_ext, \
205 { "Opt Delta extended", prefix ".opt.delta_ext", \
206 FT_UINT16, BASE_DEC, NULL, 0x0, \
209 { & name .hf.opt_length, \
210 { "Opt Length", prefix ".opt.length", \
211 FT_UINT8, BASE_DEC, NULL, 0x0f, \
212 "Option Length", HFILL } \
214 { & name .hf.opt_length_ext, \
215 { "Opt Length extended", prefix ".opt.length_ext", \
216 FT_UINT16, BASE_DEC, NULL, 0x0, \
219 { & name .hf.opt_end_marker, \
220 { "End of options marker", prefix ".opt.end_marker", \
221 FT_UINT8, BASE_DEC, NULL, 0x00, \
224 { & name .hf.opt_ctype, \
225 { "Content-type", prefix ".opt.ctype", \
226 FT_STRING, BASE_NONE, NULL, 0x0, \
229 { & name .hf.opt_max_age, \
230 { "Max-age", prefix ".opt.max_age", \
231 FT_UINT32, BASE_DEC, NULL, 0x0, \
234 { & name .hf.opt_proxy_uri, \
235 { "Proxy-Uri", prefix ".opt.proxy_uri", \
236 FT_STRING, BASE_NONE, NULL, 0x0, \
239 { & name .hf.opt_proxy_scheme, \
240 { "Proxy-Scheme", prefix ".opt.proxy_scheme", \
241 FT_STRING, BASE_NONE, NULL, 0x0, \
244 { & name .hf.opt_size1, \
245 { "Size1", prefix ".opt.size1", \
246 FT_UINT32, BASE_DEC, NULL, 0x0, \
249 { & name .hf.opt_etag, \
250 { "Etag", prefix ".opt.etag", \
251 FT_BYTES, BASE_NONE, NULL, 0x0, \
252 "Option Etag", HFILL } \
254 { & name .hf.opt_uri_host, \
255 { "Uri-Host", prefix ".opt.uri_host", \
256 FT_STRING, BASE_NONE, NULL, 0x0, \
259 { & name .hf.opt_location_path, \
260 { "Location-Path", prefix ".opt.location_path", \
261 FT_STRING, BASE_NONE, NULL, 0x0, \
264 { & name .hf.opt_uri_port, \
265 { "Uri-Port", prefix ".opt.uri_port", \
266 FT_UINT16, BASE_DEC, NULL, 0x0, \
269 { & name .hf.opt_location_query, \
270 { "Location-Query", prefix ".opt.location_query", \
271 FT_STRING, BASE_NONE, NULL, 0x0, \
274 { & name .hf.opt_object_security_reserved, \
275 { "Reserved", prefix ".opt.object_security_reserved", \
276 FT_BOOLEAN, 8, NULL, COAP_OBJECT_SECURITY_RESERVED_MASK, \
279 { & name .hf.opt_object_security_kid_context_present, \
280 { "Key ID Context Present", prefix ".opt.object_security_kid_context_present",\
281 FT_BOOLEAN, 8, NULL, COAP_OBJECT_SECURITY_KID_CONTEXT_MASK, \
284 { & name .hf.opt_object_security_kid_present, \
285 { "Key ID Present", prefix ".opt.object_security_kid_present", \
286 FT_BOOLEAN, 8, NULL, COAP_OBJECT_SECURITY_KID_MASK, \
289 { & name .hf.opt_object_security_piv_len, \
290 { "Partial IV Length", prefix ".opt.object_security_piv_len", \
291 FT_UINT8, BASE_DEC, NULL, COAP_OBJECT_SECURITY_PIVLEN_MASK, \
294 { & name .hf.opt_object_security_piv, \
295 { "Partial IV", prefix ".opt.object_security_piv", \
296 FT_BYTES, BASE_NONE, NULL, 0x00, \
299 { & name .hf.opt_object_security_kid_context_len, \
300 { "Key ID Context Length", prefix ".opt.object_security_kid_context_len",\
301 FT_UINT8, BASE_DEC, NULL, 0x00, \
304 { & name .hf.opt_object_security_kid_context, \
305 { "Key ID Context", prefix ".opt.object_security_kid_context", \
306 FT_BYTES, BASE_NONE, NULL, 0x00, \
309 { & name .hf.opt_object_security_kid, \
310 { "Key ID", prefix ".opt.object_security_kid", \
311 FT_BYTES, BASE_NONE, NULL, 0x00, \
314 { & name .hf.opt_uri_path, \
315 { "Uri-Path", prefix ".opt.uri_path", \
316 FT_STRING, BASE_NONE, NULL, 0x0, \
319 { & name .hf.opt_uri_path_recon, \
320 { "Uri-Path", prefix ".opt.uri_path_recon", \
321 FT_STRING, BASE_NONE, NULL, 0x0, \
324 { & name .hf.opt_observe_req, \
325 { "Observe", prefix ".opt.observe", \
326 FT_UINT32, BASE_DEC, VALS(coap_vals_observe_options), 0x0, \
329 { & name .hf.opt_observe_rsp, \
330 { "Observe sequence number", prefix ".opt.observe", \
331 FT_UINT32, BASE_DEC, NULL, 0x0, \
334 { & name .hf.opt_hop_limit, \
335 { "Hop Limit", prefix ".opt.hop_limit", \
336 FT_UINT8, BASE_DEC, NULL, 0x0, \
339 { & name .hf.opt_accept, \
340 { "Accept", prefix ".opt.accept", \
341 FT_STRING, BASE_NONE, NULL, 0x0, \
344 { & name .hf.opt_if_match, \
345 { "If-Match", prefix ".opt.if_match", \
346 FT_BYTES, BASE_NONE, NULL, 0x0, \
349 { & name .hf.opt_block_number, \
350 { "Block Number", prefix ".opt.block_number", \
351 FT_UINT32, BASE_DEC, NULL, 0x0, \
354 { & name .hf.opt_block_mflag, \
355 { "More Flag", prefix ".opt.block_mflag", \
356 FT_UINT8, BASE_DEC, NULL, COAP_BLOCK_MFLAG_MASK, \
359 { & name .hf.opt_block_size, \
360 { "Encoded Block Size", prefix ".opt.block_size", \
361 FT_UINT8, BASE_DEC, NULL, COAP_BLOCK_SIZE_MASK, \
364 { & name .hf.opt_uri_query, \
365 { "Uri-Query", prefix ".opt.uri_query", \
366 FT_STRING, BASE_NONE, NULL, 0x0, \
369 { & name .hf.opt_echo, \
370 { "Echo", prefix ".opt.opt_echo", \
371 FT_BYTES, BASE_NONE, NULL, 0x0, \
374 { & name .hf.opt_no_response, \
375 { "No-Response", prefix ".opt.opt_no_response", \
376 FT_UINT8, BASE_DEC, NULL, 0x0, \
379 { & name .hf.opt_request_tag, \
380 { "Request-Tag", prefix ".opt.opt_request_tag", \
381 FT_BYTES, BASE_NONE, NULL, 0x0, \
384 { & name .hf.opt_ocf_version, \
385 { "OCF-Content-Format-Version", \
386 prefix ".opt.opt_ocf_version", \
387 FT_UINT8, BASE_DEC, NULL, 0x0, \
390 { & name .hf.opt_ocf_accept_version, \
391 { "OCF-Accept-Content-Format-Version", \
392 prefix ".opt.opt_ocf_accept_version", \
393 FT_UINT8, BASE_DEC, NULL, 0x0, \
396 { & name .hf.opt_unknown, \
397 { "Unknown", prefix ".opt.unknown", \
398 FT_BYTES, BASE_NONE, NULL, 0x0, \
404 #define COAP_COMMON_ETT_LIST(name) \
405 & name .ett.payload, \
406 & name .ett.option, \
411 #define COAP_COMMON_EI_LIST(name, prefix) \
412 { & name .ei.opt_unknown_number, \
413 { prefix ".unknown_option_number", PI_UNDECODED, PI_WARN, \
414 "Unknown Option Number", EXPFILL } \
416 { & name .ei.opt_invalid_number, \
417 { prefix ".invalid_option_number", PI_MALFORMED, PI_WARN, \
418 "Invalid Option Number", EXPFILL } \
420 { & name .ei.opt_invalid_range, \
421 { prefix ".invalid_option_range", PI_MALFORMED, PI_WARN, \
422 "Invalid Option Range", EXPFILL } \
424 { & name .ei.opt_length_bad, \
425 { prefix ".option_length_bad", PI_MALFORMED, PI_WARN, \
426 "Option length bad", EXPFILL } \
428 { & name .ei.opt_object_security_bad, \
429 { prefix ".option_oscore_bad", PI_MALFORMED, PI_WARN, \
430 "Invalid OSCORE Option Format", EXPFILL } \
Definition: packet_info.h:44
Definition: value_string.h:170
Definition: value_string.h:26
Definition: wmem_map.c:44
Definition: wmem_strbuf.h:42
Definition: packet-coap.h:66
Definition: packet-coap.h:48
Definition: packet-coap.h:34
Definition: packet-coap.h:59
Definition: packet-coap.h:53
Definition: packet-oscore.h:51
Definition: tvbuff-int.h:35