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;
92 int opt_location_path;
94 int opt_location_query;
96 int opt_uri_path_recon;
102 int opt_block_number;
110 int opt_ocf_accept_version;
112 int opt_object_security_reserved;
113 int opt_object_security_kid_context_present;
114 int opt_object_security_kid_present;
115 int opt_object_security_piv_len;
116 int opt_object_security_piv;
117 int opt_object_security_kid_context_len;
118 int opt_object_security_kid_context;
119 int opt_object_security_kid;
151#define COAP_COMMON_LIST_T(name) \
152coap_common_dissect_t name
156#define COAP_COMMON_HF_LIST(name, prefix) \
158 { "Code", prefix ".code", \
159 FT_UINT8, BASE_DEC | BASE_EXT_STRING, &coap_vals_code_ext, 0x0, \
162 { & name .hf.payload, \
163 { "Payload", prefix ".payload", \
164 FT_STRING, BASE_NONE, NULL, 0x0, \
167 { & name .hf.payload_desc, \
168 { "Payload Desc", prefix ".payload_desc", \
169 FT_STRING, BASE_NONE, NULL, 0x0, \
172 { & name .hf.payload_length, \
173 { "Payload Length", prefix ".payload_length", \
174 FT_UINT32, BASE_DEC, NULL, 0x0, \
177 { & name .hf.opt_name, \
178 { "Opt Name", prefix ".opt.name", \
179 FT_STRING, BASE_NONE, NULL, 0x0, \
182 { & name .hf.opt_desc, \
183 { "Opt Desc", prefix ".opt.desc", \
184 FT_STRING, BASE_NONE, NULL, 0x0, \
187 { & name .hf.opt_delta, \
188 { "Opt Delta", prefix ".opt.delta", \
189 FT_UINT8, BASE_DEC, NULL, 0xf0, \
192 { & name .hf.opt_delta_ext, \
193 { "Opt Delta extended", prefix ".opt.delta_ext", \
194 FT_UINT16, BASE_DEC, NULL, 0x0, \
197 { & name .hf.opt_length, \
198 { "Opt Length", prefix ".opt.length", \
199 FT_UINT8, BASE_DEC, NULL, 0x0f, \
200 "Option Length", HFILL } \
202 { & name .hf.opt_length_ext, \
203 { "Opt Length extended", prefix ".opt.length_ext", \
204 FT_UINT16, BASE_DEC, NULL, 0x0, \
207 { & name .hf.opt_end_marker, \
208 { "End of options marker", prefix ".opt.end_marker", \
209 FT_UINT8, BASE_DEC, NULL, 0x00, \
212 { & name .hf.opt_ctype, \
213 { "Content-type", prefix ".opt.ctype", \
214 FT_STRING, BASE_NONE, NULL, 0x0, \
217 { & name .hf.opt_max_age, \
218 { "Max-age", prefix ".opt.max_age", \
219 FT_UINT32, BASE_DEC, NULL, 0x0, \
222 { & name .hf.opt_proxy_uri, \
223 { "Proxy-Uri", prefix ".opt.proxy_uri", \
224 FT_STRING, BASE_NONE, NULL, 0x0, \
227 { & name .hf.opt_proxy_scheme, \
228 { "Proxy-Scheme", prefix ".opt.proxy_scheme", \
229 FT_STRING, BASE_NONE, NULL, 0x0, \
232 { & name .hf.opt_size1, \
233 { "Size1", prefix ".opt.size1", \
234 FT_UINT32, BASE_DEC, NULL, 0x0, \
237 { & name .hf.opt_etag, \
238 { "Etag", prefix ".opt.etag", \
239 FT_BYTES, BASE_NONE, NULL, 0x0, \
240 "Option Etag", HFILL } \
242 { & name .hf.opt_uri_host, \
243 { "Uri-Host", prefix ".opt.uri_host", \
244 FT_STRING, BASE_NONE, NULL, 0x0, \
247 { & name .hf.opt_location_path, \
248 { "Location-Path", prefix ".opt.location_path", \
249 FT_STRING, BASE_NONE, NULL, 0x0, \
252 { & name .hf.opt_uri_port, \
253 { "Uri-Port", prefix ".opt.uri_port", \
254 FT_UINT16, BASE_DEC, NULL, 0x0, \
257 { & name .hf.opt_location_query, \
258 { "Location-Query", prefix ".opt.location_query", \
259 FT_STRING, BASE_NONE, NULL, 0x0, \
262 { & name .hf.opt_object_security_reserved, \
263 { "Reserved", prefix ".opt.object_security_reserved", \
264 FT_BOOLEAN, 8, NULL, COAP_OBJECT_SECURITY_RESERVED_MASK, \
267 { & name .hf.opt_object_security_kid_context_present, \
268 { "Key ID Context Present", prefix ".opt.object_security_kid_context_present",\
269 FT_BOOLEAN, 8, NULL, COAP_OBJECT_SECURITY_KID_CONTEXT_MASK, \
272 { & name .hf.opt_object_security_kid_present, \
273 { "Key ID Present", prefix ".opt.object_security_kid_present", \
274 FT_BOOLEAN, 8, NULL, COAP_OBJECT_SECURITY_KID_MASK, \
277 { & name .hf.opt_object_security_piv_len, \
278 { "Partial IV Length", prefix ".opt.object_security_piv_len", \
279 FT_UINT8, BASE_DEC, NULL, COAP_OBJECT_SECURITY_PIVLEN_MASK, \
282 { & name .hf.opt_object_security_piv, \
283 { "Partial IV", prefix ".opt.object_security_piv", \
284 FT_BYTES, BASE_NONE, NULL, 0x00, \
287 { & name .hf.opt_object_security_kid_context_len, \
288 { "Key ID Context Length", prefix ".opt.object_security_kid_context_len",\
289 FT_UINT8, BASE_DEC, NULL, 0x00, \
292 { & name .hf.opt_object_security_kid_context, \
293 { "Key ID Context", prefix ".opt.object_security_kid_context", \
294 FT_BYTES, BASE_NONE, NULL, 0x00, \
297 { & name .hf.opt_object_security_kid, \
298 { "Key ID", prefix ".opt.object_security_kid", \
299 FT_BYTES, BASE_NONE, NULL, 0x00, \
302 { & name .hf.opt_uri_path, \
303 { "Uri-Path", prefix ".opt.uri_path", \
304 FT_STRING, BASE_NONE, NULL, 0x0, \
307 { & name .hf.opt_uri_path_recon, \
308 { "Uri-Path", prefix ".opt.uri_path_recon", \
309 FT_STRING, BASE_NONE, NULL, 0x0, \
312 { & name .hf.opt_observe_req, \
313 { "Observe", prefix ".opt.observe", \
314 FT_UINT32, BASE_DEC, VALS(coap_vals_observe_options), 0x0, \
317 { & name .hf.opt_observe_rsp, \
318 { "Observe sequence number", prefix ".opt.observe", \
319 FT_UINT32, BASE_DEC, NULL, 0x0, \
322 { & name .hf.opt_hop_limit, \
323 { "Hop Limit", prefix ".opt.hop_limit", \
324 FT_UINT8, BASE_DEC, NULL, 0x0, \
327 { & name .hf.opt_accept, \
328 { "Accept", prefix ".opt.accept", \
329 FT_STRING, BASE_NONE, NULL, 0x0, \
332 { & name .hf.opt_if_match, \
333 { "If-Match", prefix ".opt.if_match", \
334 FT_BYTES, BASE_NONE, NULL, 0x0, \
337 { & name .hf.opt_block_number, \
338 { "Block Number", prefix ".opt.block_number", \
339 FT_UINT32, BASE_DEC, NULL, 0x0, \
342 { & name .hf.opt_block_mflag, \
343 { "More Flag", prefix ".opt.block_mflag", \
344 FT_UINT8, BASE_DEC, NULL, COAP_BLOCK_MFLAG_MASK, \
347 { & name .hf.opt_block_size, \
348 { "Encoded Block Size", prefix ".opt.block_size", \
349 FT_UINT8, BASE_DEC, NULL, COAP_BLOCK_SIZE_MASK, \
352 { & name .hf.opt_uri_query, \
353 { "Uri-Query", prefix ".opt.uri_query", \
354 FT_STRING, BASE_NONE, NULL, 0x0, \
357 { & name .hf.opt_echo, \
358 { "Echo", prefix ".opt.opt_echo", \
359 FT_BYTES, BASE_NONE, NULL, 0x0, \
362 { & name .hf.opt_no_response, \
363 { "No-Response", prefix ".opt.opt_no_response", \
364 FT_UINT8, BASE_DEC, NULL, 0x0, \
367 { & name .hf.opt_request_tag, \
368 { "Request-Tag", prefix ".opt.opt_request_tag", \
369 FT_BYTES, BASE_NONE, NULL, 0x0, \
372 { & name .hf.opt_ocf_version, \
373 { "OCF-Content-Format-Version", \
374 prefix ".opt.opt_ocf_version", \
375 FT_UINT8, BASE_DEC, NULL, 0x0, \
378 { & name .hf.opt_ocf_accept_version, \
379 { "OCF-Accept-Content-Format-Version", \
380 prefix ".opt.opt_ocf_accept_version", \
381 FT_UINT8, BASE_DEC, NULL, 0x0, \
384 { & name .hf.opt_unknown, \
385 { "Unknown", prefix ".opt.unknown", \
386 FT_BYTES, BASE_NONE, NULL, 0x0, \
392#define COAP_COMMON_ETT_LIST(name) \
393 & name .ett.payload, \
394 & name .ett.option, \
399#define COAP_COMMON_EI_LIST(name, prefix) \
400 { & name .ei.opt_unknown_number, \
401 { prefix ".unknown_option_number", PI_UNDECODED, PI_WARN, \
402 "Unknown Option Number", EXPFILL } \
404 { & name .ei.opt_invalid_number, \
405 { prefix ".invalid_option_number", PI_MALFORMED, PI_WARN, \
406 "Invalid Option Number", EXPFILL } \
408 { & name .ei.opt_invalid_range, \
409 { prefix ".invalid_option_range", PI_MALFORMED, PI_WARN, \
410 "Invalid Option Range", EXPFILL } \
412 { & name .ei.opt_length_bad, \
413 { prefix ".option_length_bad", PI_MALFORMED, PI_WARN, \
414 "Option length bad", EXPFILL } \
416 { & name .ei.opt_object_security_bad, \
417 { prefix ".option_oscore_bad", PI_MALFORMED, PI_WARN, \
418 "Invalid OSCORE Option Format", EXPFILL } \
Definition packet_info.h:43
Extended metadata for a value_string array.
Definition value_string.h:325
Mapping between a 32-bit integer value and its string representation.
Definition value_string.h:33
Internal structure representing a wmem-allocated string buffer.
Definition wmem_strbuf.h:38
Definition packet-coap.h:68
Definition packet-coap.h:49
Definition packet-coap.h:34
Definition packet-coap.h:61
Definition packet-coap.h:54
Definition packet-oscore.h:51
Definition tvbuff-int.h:35