| Wireshark 4.7.0 The Wireshark network protocol analyzer

Loading...
Searching...
No Matches
ftypes-int.h
Go to the documentation of this file.
1
10#ifndef FTYPES_INT_H
11#define FTYPES_INT_H
12
13#include "ftypes.h"
14#include <epan/proto.h>
15#include <epan/packet.h>
16
24 struct _fvalue_t {
25 const ftype_t *ftype;
27 union {
28 uint64_t uinteger64;
29 int64_t sinteger64;
30 double floating;
31 wmem_strbuf_t *strbuf;
32 GBytes *bytes;
33 ipv4_addr_and_mask ipv4;
34 ipv6_addr_and_prefix ipv6;
35 e_guid_t guid;
36 nstime_t time;
37 protocol_value_t protocol;
38 uint16_t sfloat_ieee_11073;
39 uint32_t float_ieee_11073;
40 } value;
41};
42
43extern const ftype_t* type_list[FT_ENUM_SIZE + 1];
44
45/* Given an ftenum number, return an ftype_t* */
46#define FTYPE_LOOKUP(ftype, result) \
47 /* Check input */ \
48 ws_assert(ftype < FT_NUM_TYPES); \
49 result = type_list[ftype];
50
51typedef void (*FvalueNewFunc)(fvalue_t*);
52typedef void (*FvalueCopyFunc)(fvalue_t*, const fvalue_t*);
53typedef void (*FvalueFreeFunc)(fvalue_t*);
54
55typedef bool (*FvalueFromLiteral)(fvalue_t*, const char*, bool, char **);
56typedef bool (*FvalueFromString)(fvalue_t*, const char*, size_t, char **);
57typedef bool (*FvalueFromCharConst)(fvalue_t*, unsigned long, char **);
58typedef bool (*FvalueFromUnsignedInt64)(fvalue_t*, const char *, uint64_t, char **);
59typedef bool (*FvalueFromSignedInt64)(fvalue_t*, const char *, int64_t, char **);
60typedef bool (*FvalueFromDouble)(fvalue_t*, const char *, double, char **);
61
62typedef char *(*FvalueToStringRepr)(wmem_allocator_t *, const fvalue_t*, ftrepr_t, int field_display);
63
64typedef enum ft_result (*FvalueToUnsignedInt64)(const fvalue_t*, uint64_t *);
65typedef enum ft_result (*FvalueToSignedInt64)(const fvalue_t*, int64_t *);
66typedef enum ft_result (*FvalueToDouble)(const fvalue_t*, double *);
67
68typedef void (*FvalueSetBytesFunc)(fvalue_t*, GBytes *);
69typedef void (*FvalueSetGuidFunc)(fvalue_t*, const e_guid_t *);
70typedef void (*FvalueSetTimeFunc)(fvalue_t*, const nstime_t *);
71typedef void (*FvalueSetStrbufFunc)(fvalue_t*, wmem_strbuf_t *);
72typedef void (*FvalueSetProtocolFunc)(fvalue_t*, tvbuff_t *value, const char *name, int length);
73typedef void (*FvalueSetUnsignedIntegerFunc)(fvalue_t*, uint32_t);
74typedef void (*FvalueSetSignedIntegerFunc)(fvalue_t*, int32_t);
75typedef void (*FvalueSetUnsignedInteger64Func)(fvalue_t*, uint64_t);
76typedef void (*FvalueSetSignedInteger64Func)(fvalue_t*, int64_t);
77typedef void (*FvalueSetFloatingFunc)(fvalue_t*, double);
78typedef void (*FvalueSetIpv4Func)(fvalue_t*, const ipv4_addr_and_mask *);
79typedef void (*FvalueSetIpv6Func)(fvalue_t*, const ipv6_addr_and_prefix *);
80
81typedef GBytes *(*FvalueGetBytesFunc)(fvalue_t*);
82typedef const e_guid_t *(*FvalueGetGuidFunc)(fvalue_t*);
83typedef const nstime_t *(*FvalueGetTimeFunc)(fvalue_t*);
84typedef const wmem_strbuf_t *(*FvalueGetStrbufFunc)(fvalue_t*);
85typedef tvbuff_t *(*FvalueGetProtocolFunc)(fvalue_t*);
86typedef uint32_t (*FvalueGetUnsignedIntegerFunc)(fvalue_t*);
87typedef int32_t (*FvalueGetSignedIntegerFunc)(fvalue_t*);
88typedef uint64_t (*FvalueGetUnsignedInteger64Func)(fvalue_t*);
89typedef int64_t (*FvalueGetSignedInteger64Func)(fvalue_t*);
90typedef double (*FvalueGetFloatingFunc)(fvalue_t*);
91typedef const ipv4_addr_and_mask *(*FvalueGetIpv4Func)(fvalue_t*);
92typedef const ipv6_addr_and_prefix *(*FvalueGetIpv6Func)(fvalue_t*);
93
94typedef enum ft_result (*FvalueCompare)(const fvalue_t*, const fvalue_t*, int*);
95typedef enum ft_result (*FvalueContains)(const fvalue_t*, const fvalue_t*, bool*);
96typedef enum ft_result (*FvalueMatches)(const fvalue_t*, const ws_regex_t*, bool*);
97
98typedef bool (*FvalueIs)(const fvalue_t*);
99typedef unsigned (*FvalueLen)(fvalue_t*);
100typedef unsigned (*FvalueHashFunc)(const fvalue_t *);
101typedef void (*FvalueSlice)(fvalue_t*, void *, unsigned offset, unsigned length);
102typedef enum ft_result (*FvalueUnaryOp)(fvalue_t *, const fvalue_t*, char **);
103typedef enum ft_result (*FvalueBinaryOp)(fvalue_t *, const fvalue_t*, const fvalue_t*, char **);
104
112 struct _ftype_t {
113 ftenum_t ftype;
114 int wire_size;
116 FvalueNewFunc new_value;
117 FvalueCopyFunc copy_value;
118 FvalueFreeFunc free_value;
120 FvalueFromLiteral val_from_literal;
121 FvalueFromString val_from_string;
122 FvalueFromCharConst val_from_charconst;
123 FvalueFromUnsignedInt64 val_from_uinteger64;
124 FvalueFromSignedInt64 val_from_sinteger64;
125 FvalueFromDouble val_from_double;
127 FvalueToStringRepr val_to_string_repr;
129 FvalueToUnsignedInt64 val_to_uinteger64;
130 FvalueToSignedInt64 val_to_sinteger64;
131 FvalueToDouble val_to_double;
138 union {
139 FvalueSetBytesFunc set_value_bytes;
140 FvalueSetGuidFunc set_value_guid;
141 FvalueSetTimeFunc set_value_time;
142 FvalueSetStrbufFunc set_value_strbuf;
143 FvalueSetProtocolFunc set_value_protocol;
144 FvalueSetUnsignedIntegerFunc set_value_uinteger;
145 FvalueSetSignedIntegerFunc set_value_sinteger;
146 FvalueSetUnsignedInteger64Func set_value_uinteger64;
147 FvalueSetSignedInteger64Func set_value_sinteger64;
148 FvalueSetFloatingFunc set_value_floating;
149 FvalueSetIpv4Func set_value_ipv4;
150 FvalueSetIpv6Func set_value_ipv6;
151 } set_value;
152
158 union {
159 FvalueGetBytesFunc get_value_bytes;
160 FvalueGetGuidFunc get_value_guid;
161 FvalueGetTimeFunc get_value_time;
162 FvalueGetStrbufFunc get_value_strbuf;
163 FvalueGetProtocolFunc get_value_protocol;
164 FvalueGetUnsignedIntegerFunc get_value_uinteger;
165 FvalueGetSignedIntegerFunc get_value_sinteger;
166 FvalueGetUnsignedInteger64Func get_value_uinteger64;
167 FvalueGetSignedInteger64Func get_value_sinteger64;
168 FvalueGetFloatingFunc get_value_floating;
169 FvalueGetIpv4Func get_value_ipv4;
170 FvalueGetIpv6Func get_value_ipv6;
171 } get_value;
172
173 FvalueCompare compare;
174 FvalueContains contains;
175 FvalueMatches matches;
177 FvalueHashFunc hash;
178 FvalueIs is_zero;
179 FvalueIs is_negative;
180 FvalueIs is_nan;
181 FvalueLen len;
182 FvalueSlice slice;
184 FvalueBinaryOp bitwise_and;
185 FvalueUnaryOp unary_minus;
186 FvalueBinaryOp add;
187 FvalueBinaryOp subtract;
188 FvalueBinaryOp multiply;
189 FvalueBinaryOp divide;
190 FvalueBinaryOp modulo;
191};
192
193void ftype_register(enum ftenum ftype, const ftype_t *ft);
194
195void ftype_register_bytes(void);
196void ftype_register_double(void);
197void ftype_register_ieee_11073_float(void);
198void ftype_register_integers(void);
199void ftype_register_ipv4(void);
200void ftype_register_ipv6(void);
201void ftype_register_guid(void);
202void ftype_register_none(void);
203void ftype_register_string(void);
204void ftype_register_time(void);
205void ftype_register_tvbuff(void);
206
207/* For debugging. */
208void ftype_register_pseudofields_bytes(int proto);
209void ftype_register_pseudofields_double(int proto);
210void ftype_register_pseudofields_ieee_11073_float(int proto);
211void ftype_register_pseudofields_integer(int proto);
212void ftype_register_pseudofields_ipv4(int proto);
213void ftype_register_pseudofields_ipv6(int proto);
214void ftype_register_pseudofields_guid(int proto);
215void ftype_register_pseudofields_none(int proto);
216void ftype_register_pseudofields_string(int proto);
217void ftype_register_pseudofields_time(int proto);
218void ftype_register_pseudofields_tvbuff(int proto);
219
220GByteArray *
221byte_array_from_literal(const char *s, char **err_msg);
222
223GByteArray *
224byte_array_from_charconst(unsigned long num, char **err_msg);
225
226char *
227bytes_to_dfilter_repr(wmem_allocator_t *scope,
228 const uint8_t *src, size_t src_size);
229
230#endif /* FTYPES_INT_H */
231
232/*
233 * Editor modelines - https://www.wireshark.org/tools/modelines.html
234 *
235 * Local variables:
236 * c-basic-offset: 8
237 * tab-width: 8
238 * indent-tabs-mode: t
239 * End:
240 *
241 * vi: set shiftwidth=8 tabstop=8 noexpandtab:
242 * :indentSize=8:tabSize=8:noTabs=false:
243 */
ftypes.h
packet.h
proto.h
_e_guid_t
Definition guid-utils.h:23
_ftype_t
Describes a field type and its associated operations for display filtering.
Definition ftypes-int.h:112
_ftype_t::val_to_double
FvalueToDouble val_to_double
Definition ftypes-int.h:131
_ftype_t::set_value
union _ftype_t::@480 set_value
Union of function pointers for setting typed field values.
_ftype_t::set_value_ipv6
FvalueSetIpv6Func set_value_ipv6
Definition ftypes-int.h:150
_ftype_t::val_from_charconst
FvalueFromCharConst val_from_charconst
Definition ftypes-int.h:122
_ftype_t::set_value_floating
FvalueSetFloatingFunc set_value_floating
Definition ftypes-int.h:148
_ftype_t::is_nan
FvalueIs is_nan
Definition ftypes-int.h:180
_ftype_t::get_value_uinteger
FvalueGetUnsignedIntegerFunc get_value_uinteger
Definition ftypes-int.h:164
_ftype_t::set_value_strbuf
FvalueSetStrbufFunc set_value_strbuf
Definition ftypes-int.h:142
_ftype_t::val_from_double
FvalueFromDouble val_from_double
Definition ftypes-int.h:125
_ftype_t::contains
FvalueContains contains
Definition ftypes-int.h:174
_ftype_t::set_value_sinteger64
FvalueSetSignedInteger64Func set_value_sinteger64
Definition ftypes-int.h:147
_ftype_t::subtract
FvalueBinaryOp subtract
Definition ftypes-int.h:187
_ftype_t::compare
FvalueCompare compare
Definition ftypes-int.h:173
_ftype_t::get_value_sinteger
FvalueGetSignedIntegerFunc get_value_sinteger
Definition ftypes-int.h:165
_ftype_t::len
FvalueLen len
Definition ftypes-int.h:181
_ftype_t::is_negative
FvalueIs is_negative
Definition ftypes-int.h:179
_ftype_t::set_value_ipv4
FvalueSetIpv4Func set_value_ipv4
Definition ftypes-int.h:149
_ftype_t::get_value_ipv4
FvalueGetIpv4Func get_value_ipv4
Definition ftypes-int.h:169
_ftype_t::set_value_time
FvalueSetTimeFunc set_value_time
Definition ftypes-int.h:141
_ftype_t::free_value
FvalueFreeFunc free_value
Definition ftypes-int.h:118
_ftype_t::matches
FvalueMatches matches
Definition ftypes-int.h:175
_ftype_t::val_from_sinteger64
FvalueFromSignedInt64 val_from_sinteger64
Definition ftypes-int.h:124
_ftype_t::get_value_sinteger64
FvalueGetSignedInteger64Func get_value_sinteger64
Definition ftypes-int.h:167
_ftype_t::slice
FvalueSlice slice
Definition ftypes-int.h:182
_ftype_t::val_to_sinteger64
FvalueToSignedInt64 val_to_sinteger64
Definition ftypes-int.h:130
_ftype_t::val_from_literal
FvalueFromLiteral val_from_literal
Definition ftypes-int.h:120
_ftype_t::modulo
FvalueBinaryOp modulo
Definition ftypes-int.h:190
_ftype_t::val_from_uinteger64
FvalueFromUnsignedInt64 val_from_uinteger64
Definition ftypes-int.h:123
_ftype_t::get_value_protocol
FvalueGetProtocolFunc get_value_protocol
Definition ftypes-int.h:163
_ftype_t::set_value_guid
FvalueSetGuidFunc set_value_guid
Definition ftypes-int.h:140
_ftype_t::set_value_bytes
FvalueSetBytesFunc set_value_bytes
Definition ftypes-int.h:139
_ftype_t::divide
FvalueBinaryOp divide
Definition ftypes-int.h:189
_ftype_t::set_value_uinteger
FvalueSetUnsignedIntegerFunc set_value_uinteger
Definition ftypes-int.h:144
_ftype_t::val_from_string
FvalueFromString val_from_string
Definition ftypes-int.h:121
_ftype_t::bitwise_and
FvalueBinaryOp bitwise_and
Definition ftypes-int.h:184
_ftype_t::get_value_strbuf
FvalueGetStrbufFunc get_value_strbuf
Definition ftypes-int.h:162
_ftype_t::unary_minus
FvalueUnaryOp unary_minus
Definition ftypes-int.h:185
_ftype_t::set_value_uinteger64
FvalueSetUnsignedInteger64Func set_value_uinteger64
Definition ftypes-int.h:146
_ftype_t::set_value_protocol
FvalueSetProtocolFunc set_value_protocol
Definition ftypes-int.h:143
_ftype_t::wire_size
int wire_size
Definition ftypes-int.h:114
_ftype_t::multiply
FvalueBinaryOp multiply
Definition ftypes-int.h:188
_ftype_t::get_value
union _ftype_t::@481 get_value
Union of function pointers for retrieving typed field values.
_ftype_t::get_value_bytes
FvalueGetBytesFunc get_value_bytes
Definition ftypes-int.h:159
_ftype_t::val_to_uinteger64
FvalueToUnsignedInt64 val_to_uinteger64
Definition ftypes-int.h:129
_ftype_t::get_value_guid
FvalueGetGuidFunc get_value_guid
Definition ftypes-int.h:160
_ftype_t::ftype
ftenum_t ftype
Definition ftypes-int.h:113
_ftype_t::hash
FvalueHashFunc hash
Definition ftypes-int.h:177
_ftype_t::add
FvalueBinaryOp add
Definition ftypes-int.h:186
_ftype_t::get_value_uinteger64
FvalueGetUnsignedInteger64Func get_value_uinteger64
Definition ftypes-int.h:166
_ftype_t::get_value_ipv6
FvalueGetIpv6Func get_value_ipv6
Definition ftypes-int.h:170
_ftype_t::set_value_sinteger
FvalueSetSignedIntegerFunc set_value_sinteger
Definition ftypes-int.h:145
_ftype_t::val_to_string_repr
FvalueToStringRepr val_to_string_repr
Definition ftypes-int.h:127
_ftype_t::get_value_time
FvalueGetTimeFunc get_value_time
Definition ftypes-int.h:161
_ftype_t::copy_value
FvalueCopyFunc copy_value
Definition ftypes-int.h:117
_ftype_t::new_value
FvalueNewFunc new_value
Definition ftypes-int.h:116
_ftype_t::get_value_floating
FvalueGetFloatingFunc get_value_floating
Definition ftypes-int.h:168
_ftype_t::is_zero
FvalueIs is_zero
Definition ftypes-int.h:178
_fvalue_t
Represents a typed field value used in protocol dissection.
Definition ftypes-int.h:24
_fvalue_t::protocol
protocol_value_t protocol
Definition ftypes-int.h:37
_fvalue_t::floating
double floating
Definition ftypes-int.h:30
_fvalue_t::sinteger64
int64_t sinteger64
Definition ftypes-int.h:29
_fvalue_t::sfloat_ieee_11073
uint16_t sfloat_ieee_11073
Definition ftypes-int.h:38
_fvalue_t::ipv4
ipv4_addr_and_mask ipv4
Definition ftypes-int.h:33
_fvalue_t::uinteger64
uint64_t uinteger64
Definition ftypes-int.h:28
_fvalue_t::bytes
GBytes * bytes
Definition ftypes-int.h:32
_fvalue_t::ipv6
ipv6_addr_and_prefix ipv6
Definition ftypes-int.h:34
_fvalue_t::guid
e_guid_t guid
Definition ftypes-int.h:35
_fvalue_t::ftype
const ftype_t * ftype
Definition ftypes-int.h:25
_fvalue_t::value
union _fvalue_t::@479 value
_fvalue_t::strbuf
wmem_strbuf_t * strbuf
Definition ftypes-int.h:31
_fvalue_t::float_ieee_11073
uint32_t float_ieee_11073
Definition ftypes-int.h:39
_fvalue_t::time
nstime_t time
Definition ftypes-int.h:36
_protocol_value_t
Definition ftypes.h:310
_wmem_allocator_t
Internal memory allocator interface used by the wmem subsystem.
Definition wmem_allocator.h:34
_wmem_strbuf_t
Internal structure representing a wmem-allocated string buffer.
Definition wmem_strbuf.h:38
_ws_regex
Definition regex.c:17
ipv4_addr_and_mask
Definition inet_cidr.h:22
ipv6_addr_and_prefix
Definition inet_cidr.h:27
nstime_t
Definition nstime.h:26
tvbuff
Definition tvbuff-int.h:35