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;
41 wmem_strbuf_t *uri_host_strbuf;
42 wmem_strbuf_t *uri_path_strbuf;
43 wmem_strbuf_t *uri_query_strbuf;
46 oscore_info_t *oscore_info;
57 wmem_strbuf_t *uri_host_strbuf;
58 wmem_strbuf_t *uri_path_strbuf;
59 oscore_info_t *oscore_info;
93 int opt_location_path;
95 int opt_location_query;
97 int opt_uri_path_recon;
103 int opt_block_number;
111 int opt_ocf_accept_version;
113 int opt_object_security_reserved;
114 int opt_object_security_kid_context_present;
115 int opt_object_security_kid_present;
116 int opt_object_security_piv_len;
117 int opt_object_security_piv;
118 int opt_object_security_kid_context_len;
119 int opt_object_security_kid_context;
120 int opt_object_security_kid;
142} coap_common_dissect_t;
144uint8_t dissect_coap_code(tvbuff_t *tvb, proto_tree *coap_tree,
unsigned *offset, coap_common_dissect_t *dissect_hf, uint8_t *code_class);
145unsigned dissect_coap_options(tvbuff_t *tvb,
packet_info *pinfo, proto_tree *coap_tree,
unsigned offset,
unsigned offset_end, uint8_t code_class,
coap_info *coinfo, coap_common_dissect_t *dissect_hf,
bool *ok);
146void dissect_coap_payload(tvbuff_t *tvb,
packet_info *pinfo, proto_tree *coap_tree, proto_tree *parent_tree,
int offset,
int offset_end, uint8_t code_class,
coap_info *coinfo, coap_common_dissect_t *dissect_hf,
bool oscore);
149extern value_string_ext coap_vals_code_ext;
152#define COAP_COMMON_LIST_T(name) \
153coap_common_dissect_t name
157#define COAP_COMMON_HF_LIST(name, prefix) \
159 { "Code", prefix ".code", \
160 FT_UINT8, BASE_DEC | BASE_EXT_STRING, &coap_vals_code_ext, 0x0, \
163 { & name .hf.payload, \
164 { "Payload", prefix ".payload", \
165 FT_STRING, BASE_NONE, NULL, 0x0, \
168 { & name .hf.payload_desc, \
169 { "Payload Desc", prefix ".payload_desc", \
170 FT_STRING, BASE_NONE, NULL, 0x0, \
173 { & name .hf.payload_length, \
174 { "Payload Length", prefix ".payload_length", \
175 FT_UINT32, BASE_DEC, NULL, 0x0, \
178 { & name .hf.opt_name, \
179 { "Opt Name", prefix ".opt.name", \
180 FT_STRING, BASE_NONE, NULL, 0x0, \
183 { & name .hf.opt_desc, \
184 { "Opt Desc", prefix ".opt.desc", \
185 FT_STRING, BASE_NONE, NULL, 0x0, \
188 { & name .hf.opt_delta, \
189 { "Opt Delta", prefix ".opt.delta", \
190 FT_UINT8, BASE_DEC, NULL, 0xf0, \
193 { & name .hf.opt_delta_ext, \
194 { "Opt Delta extended", prefix ".opt.delta_ext", \
195 FT_UINT16, BASE_DEC, NULL, 0x0, \
198 { & name .hf.opt_length, \
199 { "Opt Length", prefix ".opt.length", \
200 FT_UINT8, BASE_DEC, NULL, 0x0f, \
201 "Option Length", HFILL } \
203 { & name .hf.opt_length_ext, \
204 { "Opt Length extended", prefix ".opt.length_ext", \
205 FT_UINT16, BASE_DEC, NULL, 0x0, \
208 { & name .hf.opt_end_marker, \
209 { "End of options marker", prefix ".opt.end_marker", \
210 FT_UINT8, BASE_DEC, NULL, 0x00, \
213 { & name .hf.opt_ctype, \
214 { "Content-type", prefix ".opt.ctype", \
215 FT_STRING, BASE_NONE, NULL, 0x0, \
218 { & name .hf.opt_max_age, \
219 { "Max-age", prefix ".opt.max_age", \
220 FT_UINT32, BASE_DEC, NULL, 0x0, \
223 { & name .hf.opt_proxy_uri, \
224 { "Proxy-Uri", prefix ".opt.proxy_uri", \
225 FT_STRING, BASE_NONE, NULL, 0x0, \
228 { & name .hf.opt_proxy_scheme, \
229 { "Proxy-Scheme", prefix ".opt.proxy_scheme", \
230 FT_STRING, BASE_NONE, NULL, 0x0, \
233 { & name .hf.opt_size1, \
234 { "Size1", prefix ".opt.size1", \
235 FT_UINT32, BASE_DEC, NULL, 0x0, \
238 { & name .hf.opt_etag, \
239 { "Etag", prefix ".opt.etag", \
240 FT_BYTES, BASE_NONE, NULL, 0x0, \
241 "Option Etag", HFILL } \
243 { & name .hf.opt_uri_host, \
244 { "Uri-Host", prefix ".opt.uri_host", \
245 FT_STRING, BASE_NONE, NULL, 0x0, \
248 { & name .hf.opt_location_path, \
249 { "Location-Path", prefix ".opt.location_path", \
250 FT_STRING, BASE_NONE, NULL, 0x0, \
253 { & name .hf.opt_uri_port, \
254 { "Uri-Port", prefix ".opt.uri_port", \
255 FT_UINT16, BASE_DEC, NULL, 0x0, \
258 { & name .hf.opt_location_query, \
259 { "Location-Query", prefix ".opt.location_query", \
260 FT_STRING, BASE_NONE, NULL, 0x0, \
263 { & name .hf.opt_object_security_reserved, \
264 { "Reserved", prefix ".opt.object_security_reserved", \
265 FT_BOOLEAN, 8, NULL, COAP_OBJECT_SECURITY_RESERVED_MASK, \
268 { & name .hf.opt_object_security_kid_context_present, \
269 { "Key ID Context Present", prefix ".opt.object_security_kid_context_present",\
270 FT_BOOLEAN, 8, NULL, COAP_OBJECT_SECURITY_KID_CONTEXT_MASK, \
273 { & name .hf.opt_object_security_kid_present, \
274 { "Key ID Present", prefix ".opt.object_security_kid_present", \
275 FT_BOOLEAN, 8, NULL, COAP_OBJECT_SECURITY_KID_MASK, \
278 { & name .hf.opt_object_security_piv_len, \
279 { "Partial IV Length", prefix ".opt.object_security_piv_len", \
280 FT_UINT8, BASE_DEC, NULL, COAP_OBJECT_SECURITY_PIVLEN_MASK, \
283 { & name .hf.opt_object_security_piv, \
284 { "Partial IV", prefix ".opt.object_security_piv", \
285 FT_BYTES, BASE_NONE, NULL, 0x00, \
288 { & name .hf.opt_object_security_kid_context_len, \
289 { "Key ID Context Length", prefix ".opt.object_security_kid_context_len",\
290 FT_UINT8, BASE_DEC, NULL, 0x00, \
293 { & name .hf.opt_object_security_kid_context, \
294 { "Key ID Context", prefix ".opt.object_security_kid_context", \
295 FT_BYTES, BASE_NONE, NULL, 0x00, \
298 { & name .hf.opt_object_security_kid, \
299 { "Key ID", prefix ".opt.object_security_kid", \
300 FT_BYTES, BASE_NONE, NULL, 0x00, \
303 { & name .hf.opt_uri_path, \
304 { "Uri-Path", prefix ".opt.uri_path", \
305 FT_STRING, BASE_NONE, NULL, 0x0, \
308 { & name .hf.opt_uri_path_recon, \
309 { "Uri-Path", prefix ".opt.uri_path_recon", \
310 FT_STRING, BASE_NONE, NULL, 0x0, \
313 { & name .hf.opt_observe_req, \
314 { "Observe", prefix ".opt.observe", \
315 FT_UINT32, BASE_DEC, VALS(coap_vals_observe_options), 0x0, \
318 { & name .hf.opt_observe_rsp, \
319 { "Observe sequence number", prefix ".opt.observe", \
320 FT_UINT32, BASE_DEC, NULL, 0x0, \
323 { & name .hf.opt_hop_limit, \
324 { "Hop Limit", prefix ".opt.hop_limit", \
325 FT_UINT8, BASE_DEC, NULL, 0x0, \
328 { & name .hf.opt_accept, \
329 { "Accept", prefix ".opt.accept", \
330 FT_STRING, BASE_NONE, NULL, 0x0, \
333 { & name .hf.opt_if_match, \
334 { "If-Match", prefix ".opt.if_match", \
335 FT_BYTES, BASE_NONE, NULL, 0x0, \
338 { & name .hf.opt_block_number, \
339 { "Block Number", prefix ".opt.block_number", \
340 FT_UINT32, BASE_DEC, NULL, 0x0, \
343 { & name .hf.opt_block_mflag, \
344 { "More Flag", prefix ".opt.block_mflag", \
345 FT_UINT8, BASE_DEC, NULL, COAP_BLOCK_MFLAG_MASK, \
348 { & name .hf.opt_block_size, \
349 { "Encoded Block Size", prefix ".opt.block_size", \
350 FT_UINT8, BASE_DEC, NULL, COAP_BLOCK_SIZE_MASK, \
353 { & name .hf.opt_uri_query, \
354 { "Uri-Query", prefix ".opt.uri_query", \
355 FT_STRING, BASE_NONE, NULL, 0x0, \
358 { & name .hf.opt_echo, \
359 { "Echo", prefix ".opt.opt_echo", \
360 FT_BYTES, BASE_NONE, NULL, 0x0, \
363 { & name .hf.opt_no_response, \
364 { "No-Response", prefix ".opt.opt_no_response", \
365 FT_UINT8, BASE_DEC, NULL, 0x0, \
368 { & name .hf.opt_request_tag, \
369 { "Request-Tag", prefix ".opt.opt_request_tag", \
370 FT_BYTES, BASE_NONE, NULL, 0x0, \
373 { & name .hf.opt_ocf_version, \
374 { "OCF-Content-Format-Version", \
375 prefix ".opt.opt_ocf_version", \
376 FT_UINT8, BASE_DEC, NULL, 0x0, \
379 { & name .hf.opt_ocf_accept_version, \
380 { "OCF-Accept-Content-Format-Version", \
381 prefix ".opt.opt_ocf_accept_version", \
382 FT_UINT8, BASE_DEC, NULL, 0x0, \
385 { & name .hf.opt_unknown, \
386 { "Unknown", prefix ".opt.unknown", \
387 FT_BYTES, BASE_NONE, NULL, 0x0, \
393#define COAP_COMMON_ETT_LIST(name) \
394 & name .ett.payload, \
395 & name .ett.option, \
400#define COAP_COMMON_EI_LIST(name, prefix) \
401 { & name .ei.opt_unknown_number, \
402 { prefix ".unknown_option_number", PI_UNDECODED, PI_WARN, \
403 "Unknown Option Number", EXPFILL } \
405 { & name .ei.opt_invalid_number, \
406 { prefix ".invalid_option_number", PI_MALFORMED, PI_WARN, \
407 "Invalid Option Number", EXPFILL } \
409 { & name .ei.opt_invalid_range, \
410 { prefix ".invalid_option_range", PI_MALFORMED, PI_WARN, \
411 "Invalid Option Range", EXPFILL } \
413 { & name .ei.opt_length_bad, \
414 { prefix ".option_length_bad", PI_MALFORMED, PI_WARN, \
415 "Option length bad", EXPFILL } \
417 { & name .ei.opt_object_security_bad, \
418 { prefix ".option_oscore_bad", PI_MALFORMED, PI_WARN, \
419 "Invalid OSCORE Option Format", EXPFILL } \
struct _packet_info packet_info
Represents the metadata and indexing information for a single captured frame.
struct _wmem_map_t wmem_map_t
Opaque type representing a wmem-managed hash map.
Definition wmem_map.h:46
Definition packet-coap.h:69
Definition packet-coap.h:50
Definition packet-coap.h:34
Definition packet-coap.h:62
Definition packet-coap.h:55
Pairs an expert info index with its associated header field index for registration and display.
Definition expert.h:41
struct _value_string value_string
Mapping between a 32-bit integer value and its string representation.