Wireshark 4.5.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
wscbor.h
Go to the documentation of this file.
1
15#ifndef __WSCBOR_H__
16#define __WSCBOR_H__
17
18#include <ws_symbol_export.h>
19#include <epan/tvbuff.h>
20#include <epan/proto.h>
21#include <epan/expert.h>
23
24#ifdef __cplusplus
25extern "C" {
26#endif
27
30WS_DLL_PUBLIC
31void wscbor_init(void);
32
37WS_DLL_PUBLIC
38const ei_register_info * wscbor_expert_items(int *size);
39
51
53typedef enum {
54 CBOR_CTRL_NONE = 0,
55 CBOR_CTRL_FALSE = 20,
56 CBOR_CTRL_TRUE = 21,
57 CBOR_CTRL_NULL = 22,
58 CBOR_CTRL_UNDEF = 23
60
62typedef struct {
66 const char *msg;
68
76WS_DLL_PUBLIC
77wscbor_error_t * wscbor_error_new(wmem_allocator_t *alloc, expert_field *ei, const char *format, ...);
78
80typedef struct {
82 int start;
84 int length;
86 uint64_t value;
88
115
129WS_DLL_PUBLIC
130wscbor_chunk_t * wscbor_chunk_read(wmem_allocator_t *alloc, tvbuff_t *tvb, int *offset);
131
134WS_DLL_PUBLIC
136
143WS_DLL_PUBLIC
144uint64_t wscbor_chunk_mark_errors(packet_info *pinfo, proto_item *item, const wscbor_chunk_t *chunk);
145
150WS_DLL_PUBLIC
151unsigned wscbor_has_errors(const wscbor_chunk_t *chunk);
152
158WS_DLL_PUBLIC
160
171WS_DLL_PUBLIC
172bool wscbor_skip_next_item(wmem_allocator_t *alloc, tvbuff_t *tvb, int *offset);
173
184WS_DLL_PUBLIC
185bool wscbor_skip_if_errors(wmem_allocator_t *alloc, tvbuff_t *tvb, int *offset, const wscbor_chunk_t *chunk);
186
187
194WS_DLL_PUBLIC
196
202WS_DLL_PUBLIC
204
212WS_DLL_PUBLIC
213bool wscbor_require_array_size(wscbor_chunk_t *chunk, uint64_t count_min, uint64_t count_max);
214
220WS_DLL_PUBLIC
222
230WS_DLL_PUBLIC
232
241WS_DLL_PUBLIC
242uint64_t * wscbor_require_uint64(wmem_allocator_t *alloc, wscbor_chunk_t *chunk);
243
252WS_DLL_PUBLIC
254
267WS_DLL_PUBLIC
269
278WS_DLL_PUBLIC
280
285WS_DLL_PUBLIC
286proto_item * proto_tree_add_cbor_container(proto_tree *tree, int hfindex, packet_info *pinfo, tvbuff_t *tvb, const wscbor_chunk_t *chunk);
287
290WS_DLL_PUBLIC
291proto_item * proto_tree_add_cbor_ctrl(proto_tree *tree, int hfindex, packet_info *pinfo, tvbuff_t *tvb, const wscbor_chunk_t *chunk);
292
293WS_DLL_PUBLIC
294proto_item * proto_tree_add_cbor_boolean(proto_tree *tree, int hfindex, packet_info *pinfo, tvbuff_t *tvb, const wscbor_chunk_t *chunk, const bool *value);
295
296WS_DLL_PUBLIC
297proto_item * proto_tree_add_cbor_uint64(proto_tree *tree, int hfindex, packet_info *pinfo, tvbuff_t *tvb, const wscbor_chunk_t *chunk, const uint64_t *value);
298
299WS_DLL_PUBLIC
300proto_item * proto_tree_add_cbor_int64(proto_tree *tree, int hfindex, packet_info *pinfo, tvbuff_t *tvb, const wscbor_chunk_t *chunk, const int64_t *value);
301
302WS_DLL_PUBLIC
303proto_item * proto_tree_add_cbor_bitmask(proto_tree *tree, int hfindex, const int ett, int *const *fields, packet_info *pinfo, tvbuff_t *tvb, const wscbor_chunk_t *chunk, const uint64_t *value);
304
305WS_DLL_PUBLIC
306proto_item * proto_tree_add_cbor_tstr(proto_tree *tree, int hfindex, packet_info *pinfo, tvbuff_t *tvb, const wscbor_chunk_t *chunk);
307
308WS_DLL_PUBLIC
309proto_item * proto_tree_add_cbor_bstr(proto_tree *tree, int hfindex, packet_info *pinfo, tvbuff_t *tvb, const wscbor_chunk_t *chunk);
310
313WS_DLL_PUBLIC
314proto_item * proto_tree_add_cbor_strlen(proto_tree *tree, int hfindex, packet_info *pinfo, tvbuff_t *tvb, const wscbor_chunk_t *chunk);
315
316#ifdef __cplusplus
317}
318#endif
319
320#endif /* __WSCBOR_H__ */
Definition packet_info.h:43
Definition proto.h:901
Definition wmem_allocator.h:27
Definition wmem_list.c:23
Definition wscbor.c:140
Definition expert.h:67
Definition expert.h:39
Definition tvbuff-int.h:35
A data-containing, optionally-tagged chunk of CBOR.
Definition wscbor.h:92
int data_length
The length of this chunk and its immediate definite data (i.e. strings)
Definition wscbor.h:101
uint8_t type_minor
Minor type of this item.
Definition wscbor.h:111
wmem_list_t * tags
Tags on this chunk, in encoded order (type wscbor_tag_t*)
Definition wscbor.h:105
uint64_t head_value
The header-encoded value.
Definition wscbor.h:113
cbor_type type_major
Definition wscbor.h:109
int start
The start offset of this chunk.
Definition wscbor.h:97
int head_length
The length of just this header and any preceding tags.
Definition wscbor.h:99
wmem_list_t * errors
Errors processing this chunk (type wscbor_error_t*)
Definition wscbor.h:103
wscbor_chunk_priv_t * _priv
Internal private data.
Definition wscbor.h:94
Decoding or require_* error.
Definition wscbor.h:62
expert_field * ei
The associated expert info.
Definition wscbor.h:64
const char * msg
Optional specific text.
Definition wscbor.h:66
Tag metadata and value.
Definition wscbor.h:80
uint64_t value
The tag value.
Definition wscbor.h:86
int start
The start offset of this tag head.
Definition wscbor.h:82
int length
The length of just this tag head.
Definition wscbor.h:84
WS_DLL_PUBLIC uint64_t * wscbor_require_uint64(wmem_allocator_t *alloc, wscbor_chunk_t *chunk)
Definition wscbor.c:535
WS_DLL_PUBLIC char * wscbor_require_tstr(wmem_allocator_t *alloc, wscbor_chunk_t *chunk)
Definition wscbor.c:582
WS_DLL_PUBLIC const ei_register_info * wscbor_expert_items(int *size)
Definition wscbor.c:469
WS_DLL_PUBLIC bool wscbor_require_map(wscbor_chunk_t *chunk)
Definition wscbor.c:507
WS_DLL_PUBLIC wscbor_chunk_t * wscbor_chunk_read(wmem_allocator_t *alloc, tvbuff_t *tvb, int *offset)
Definition wscbor.c:186
cbor_type
The same enumeration from libcbor-0.5.
Definition wscbor.h:41
@ CBOR_TYPE_MAP
maps
Definition wscbor.h:47
@ CBOR_TYPE_FLOAT_CTRL
decimals and special values (true, false, nil, ...)
Definition wscbor.h:49
@ CBOR_TYPE_TAG
tags
Definition wscbor.h:48
@ CBOR_TYPE_UINT
positive integers
Definition wscbor.h:42
@ CBOR_TYPE_BYTESTRING
byte strings
Definition wscbor.h:44
@ CBOR_TYPE_STRING
text strings
Definition wscbor.h:45
@ CBOR_TYPE_NEGINT
negative integers
Definition wscbor.h:43
@ CBOR_TYPE_ARRAY
arrays
Definition wscbor.h:46
WS_DLL_PUBLIC bool wscbor_require_major_type(wscbor_chunk_t *chunk, cbor_type major)
Definition wscbor.c:476
WS_DLL_PUBLIC bool wscbor_is_indefinite_break(const wscbor_chunk_t *chunk)
Definition wscbor.c:353
WS_DLL_PUBLIC bool * wscbor_require_boolean(wmem_allocator_t *alloc, wscbor_chunk_t *chunk)
Definition wscbor.c:511
WS_DLL_PUBLIC bool wscbor_skip_next_item(wmem_allocator_t *alloc, tvbuff_t *tvb, int *offset)
Definition wscbor.c:440
WS_DLL_PUBLIC int64_t * wscbor_require_int64(wmem_allocator_t *alloc, wscbor_chunk_t *chunk)
Definition wscbor.c:545
_cbor_ctrl
The same enumeration from libcbor-0.5.
Definition wscbor.h:53
WS_DLL_PUBLIC bool wscbor_require_array_size(wscbor_chunk_t *chunk, uint64_t count_min, uint64_t count_max)
Definition wscbor.c:492
WS_DLL_PUBLIC bool wscbor_require_array(wscbor_chunk_t *chunk)
Definition wscbor.c:488
WS_DLL_PUBLIC unsigned wscbor_has_errors(const wscbor_chunk_t *chunk)
Definition wscbor.c:349
WS_DLL_PUBLIC proto_item * proto_tree_add_cbor_ctrl(proto_tree *tree, int hfindex, packet_info *pinfo, tvbuff_t *tvb, const wscbor_chunk_t *chunk)
Definition wscbor.c:614
WS_DLL_PUBLIC void wscbor_init(void)
Definition wscbor.c:454
WS_DLL_PUBLIC bool wscbor_skip_if_errors(wmem_allocator_t *alloc, tvbuff_t *tvb, int *offset, const wscbor_chunk_t *chunk)
Definition wscbor.c:444
WS_DLL_PUBLIC tvbuff_t * wscbor_require_bstr(wmem_allocator_t *alloc, wscbor_chunk_t *chunk)
WS_DLL_PUBLIC uint64_t wscbor_chunk_mark_errors(packet_info *pinfo, proto_item *item, const wscbor_chunk_t *chunk)
Definition wscbor.c:341
WS_DLL_PUBLIC void wscbor_chunk_free(wscbor_chunk_t *chunk)
Definition wscbor.c:310
WS_DLL_PUBLIC proto_item * proto_tree_add_cbor_container(proto_tree *tree, int hfindex, packet_info *pinfo, tvbuff_t *tvb, const wscbor_chunk_t *chunk)
Definition wscbor.c:598
WS_DLL_PUBLIC proto_item * proto_tree_add_cbor_strlen(proto_tree *tree, int hfindex, packet_info *pinfo, tvbuff_t *tvb, const wscbor_chunk_t *chunk)
WS_DLL_PUBLIC wscbor_error_t * wscbor_error_new(wmem_allocator_t *alloc, expert_field *ei, const char *format,...)
Definition wscbor.c:170