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 char *ctype_str;
37 unsigned block_option;
38 unsigned block_number;
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) \
150coap_common_dissect_t name;
154#define COAP_COMMON_HF_LIST(name, prefix) \
156 { "Code", prefix ".code", \
157 FT_UINT8, BASE_DEC | BASE_EXT_STRING, &coap_vals_code_ext, 0x0, \
160 { & name .hf.payload, \
161 { "Payload", prefix ".payload", \
162 FT_STRING, BASE_NONE, NULL, 0x0, \
165 { & name .hf.payload_desc, \
166 { "Payload Desc", prefix ".payload_desc", \
167 FT_STRING, BASE_NONE, NULL, 0x0, \
170 { & name .hf.payload_length, \
171 { "Payload Length", prefix ".payload_length", \
172 FT_UINT32, BASE_DEC, NULL, 0x0, \
175 { & name .hf.opt_name, \
176 { "Opt Name", prefix ".opt.name", \
177 FT_STRING, BASE_NONE, NULL, 0x0, \
180 { & name .hf.opt_desc, \
181 { "Opt Desc", prefix ".opt.desc", \
182 FT_STRING, BASE_NONE, NULL, 0x0, \
185 { & name .hf.opt_delta, \
186 { "Opt Delta", prefix ".opt.delta", \
187 FT_UINT8, BASE_DEC, NULL, 0xf0, \
190 { & name .hf.opt_delta_ext, \
191 { "Opt Delta extended", prefix ".opt.delta_ext", \
192 FT_UINT16, BASE_DEC, NULL, 0x0, \
195 { & name .hf.opt_length, \
196 { "Opt Length", prefix ".opt.length", \
197 FT_UINT8, BASE_DEC, NULL, 0x0f, \
198 "Option Length", HFILL } \
200 { & name .hf.opt_length_ext, \
201 { "Opt Length extended", prefix ".opt.length_ext", \
202 FT_UINT16, BASE_DEC, NULL, 0x0, \
205 { & name .hf.opt_end_marker, \
206 { "End of options marker", prefix ".opt.end_marker", \
207 FT_UINT8, BASE_DEC, NULL, 0x00, \
210 { & name .hf.opt_ctype, \
211 { "Content-type", prefix ".opt.ctype", \
212 FT_STRING, BASE_NONE, NULL, 0x0, \
215 { & name .hf.opt_max_age, \
216 { "Max-age", prefix ".opt.max_age", \
217 FT_UINT32, BASE_DEC, NULL, 0x0, \
220 { & name .hf.opt_proxy_uri, \
221 { "Proxy-Uri", prefix ".opt.proxy_uri", \
222 FT_STRING, BASE_NONE, NULL, 0x0, \
225 { & name .hf.opt_proxy_scheme, \
226 { "Proxy-Scheme", prefix ".opt.proxy_scheme", \
227 FT_STRING, BASE_NONE, NULL, 0x0, \
230 { & name .hf.opt_size1, \
231 { "Size1", prefix ".opt.size1", \
232 FT_UINT32, BASE_DEC, NULL, 0x0, \
235 { & name .hf.opt_etag, \
236 { "Etag", prefix ".opt.etag", \
237 FT_BYTES, BASE_NONE, NULL, 0x0, \
238 "Option Etag", HFILL } \
240 { & name .hf.opt_uri_host, \
241 { "Uri-Host", prefix ".opt.uri_host", \
242 FT_STRING, BASE_NONE, NULL, 0x0, \
245 { & name .hf.opt_location_path, \
246 { "Location-Path", prefix ".opt.location_path", \
247 FT_STRING, BASE_NONE, NULL, 0x0, \
250 { & name .hf.opt_uri_port, \
251 { "Uri-Port", prefix ".opt.uri_port", \
252 FT_UINT16, BASE_DEC, NULL, 0x0, \
255 { & name .hf.opt_location_query, \
256 { "Location-Query", prefix ".opt.location_query", \
257 FT_STRING, BASE_NONE, NULL, 0x0, \
260 { & name .hf.opt_object_security_reserved, \
261 { "Reserved", prefix ".opt.object_security_reserved", \
262 FT_BOOLEAN, 8, NULL, COAP_OBJECT_SECURITY_RESERVED_MASK, \
265 { & name .hf.opt_object_security_kid_context_present, \
266 { "Key ID Context Present", prefix ".opt.object_security_kid_context_present",\
267 FT_BOOLEAN, 8, NULL, COAP_OBJECT_SECURITY_KID_CONTEXT_MASK, \
270 { & name .hf.opt_object_security_kid_present, \
271 { "Key ID Present", prefix ".opt.object_security_kid_present", \
272 FT_BOOLEAN, 8, NULL, COAP_OBJECT_SECURITY_KID_MASK, \
275 { & name .hf.opt_object_security_piv_len, \
276 { "Partial IV Length", prefix ".opt.object_security_piv_len", \
277 FT_UINT8, BASE_DEC, NULL, COAP_OBJECT_SECURITY_PIVLEN_MASK, \
280 { & name .hf.opt_object_security_piv, \
281 { "Partial IV", prefix ".opt.object_security_piv", \
282 FT_BYTES, BASE_NONE, NULL, 0x00, \
285 { & name .hf.opt_object_security_kid_context_len, \
286 { "Key ID Context Length", prefix ".opt.object_security_kid_context_len",\
287 FT_UINT8, BASE_DEC, NULL, 0x00, \
290 { & name .hf.opt_object_security_kid_context, \
291 { "Key ID Context", prefix ".opt.object_security_kid_context", \
292 FT_BYTES, BASE_NONE, NULL, 0x00, \
295 { & name .hf.opt_object_security_kid, \
296 { "Key ID", prefix ".opt.object_security_kid", \
297 FT_BYTES, BASE_NONE, NULL, 0x00, \
300 { & name .hf.opt_uri_path, \
301 { "Uri-Path", prefix ".opt.uri_path", \
302 FT_STRING, BASE_NONE, NULL, 0x0, \
305 { & name .hf.opt_uri_path_recon, \
306 { "Uri-Path", prefix ".opt.uri_path_recon", \
307 FT_STRING, BASE_NONE, NULL, 0x0, \
310 { & name .hf.opt_observe_req, \
311 { "Observe", prefix ".opt.observe", \
312 FT_UINT32, BASE_DEC, VALS(coap_vals_observe_options), 0x0, \
315 { & name .hf.opt_observe_rsp, \
316 { "Observe sequence number", prefix ".opt.observe", \
317 FT_UINT32, BASE_DEC, NULL, 0x0, \
320 { & name .hf.opt_hop_limit, \
321 { "Hop Limit", prefix ".opt.hop_limit", \
322 FT_UINT8, BASE_DEC, NULL, 0x0, \
325 { & name .hf.opt_accept, \
326 { "Accept", prefix ".opt.accept", \
327 FT_STRING, BASE_NONE, NULL, 0x0, \
330 { & name .hf.opt_if_match, \
331 { "If-Match", prefix ".opt.if_match", \
332 FT_BYTES, BASE_NONE, NULL, 0x0, \
335 { & name .hf.opt_block_number, \
336 { "Block Number", prefix ".opt.block_number", \
337 FT_UINT32, BASE_DEC, NULL, 0x0, \
340 { & name .hf.opt_block_mflag, \
341 { "More Flag", prefix ".opt.block_mflag", \
342 FT_UINT8, BASE_DEC, NULL, COAP_BLOCK_MFLAG_MASK, \
345 { & name .hf.opt_block_size, \
346 { "Encoded Block Size", prefix ".opt.block_size", \
347 FT_UINT8, BASE_DEC, NULL, COAP_BLOCK_SIZE_MASK, \
350 { & name .hf.opt_uri_query, \
351 { "Uri-Query", prefix ".opt.uri_query", \
352 FT_STRING, BASE_NONE, NULL, 0x0, \
355 { & name .hf.opt_echo, \
356 { "Echo", prefix ".opt.opt_echo", \
357 FT_BYTES, BASE_NONE, NULL, 0x0, \
360 { & name .hf.opt_no_response, \
361 { "No-Response", prefix ".opt.opt_no_response", \
362 FT_UINT8, BASE_DEC, NULL, 0x0, \
365 { & name .hf.opt_request_tag, \
366 { "Request-Tag", prefix ".opt.opt_request_tag", \
367 FT_BYTES, BASE_NONE, NULL, 0x0, \
370 { & name .hf.opt_ocf_version, \
371 { "OCF-Content-Format-Version", \
372 prefix ".opt.opt_ocf_version", \
373 FT_UINT8, BASE_DEC, NULL, 0x0, \
376 { & name .hf.opt_ocf_accept_version, \
377 { "OCF-Accept-Content-Format-Version", \
378 prefix ".opt.opt_ocf_accept_version", \
379 FT_UINT8, BASE_DEC, NULL, 0x0, \
382 { & name .hf.opt_unknown, \
383 { "Unknown", prefix ".opt.unknown", \
384 FT_BYTES, BASE_NONE, NULL, 0x0, \
390#define COAP_COMMON_ETT_LIST(name) \
391 & name .ett.payload, \
392 & name .ett.option, \
397#define COAP_COMMON_EI_LIST(name, prefix) \
398 { & name .ei.opt_unknown_number, \
399 { prefix ".unknown_option_number", PI_UNDECODED, PI_WARN, \
400 "Unknown Option Number", EXPFILL } \
402 { & name .ei.opt_invalid_number, \
403 { prefix ".invalid_option_number", PI_MALFORMED, PI_WARN, \
404 "Invalid Option Number", EXPFILL } \
406 { & name .ei.opt_invalid_range, \
407 { prefix ".invalid_option_range", PI_MALFORMED, PI_WARN, \
408 "Invalid Option Range", EXPFILL } \
410 { & name .ei.opt_length_bad, \
411 { prefix ".option_length_bad", PI_MALFORMED, PI_WARN, \
412 "Option length bad", EXPFILL } \
414 { & name .ei.opt_object_security_bad, \
415 { prefix ".option_oscore_bad", PI_MALFORMED, PI_WARN, \
416 "Invalid OSCORE Option Format", EXPFILL } \
Definition packet_info.h:43
Definition value_string.h:169
Definition value_string.h:25
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