| 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
43 extern 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
51 typedef void (*FvalueNewFunc)(fvalue_t*);
52 typedef void (*FvalueCopyFunc)(fvalue_t*, const fvalue_t*);
53 typedef void (*FvalueFreeFunc)(fvalue_t*);
54
55 typedef bool (*FvalueFromLiteral)(fvalue_t*, const char*, bool, char **);
56 typedef bool (*FvalueFromString)(fvalue_t*, const char*, size_t, char **);
57 typedef bool (*FvalueFromCharConst)(fvalue_t*, unsigned long, char **);
58 typedef bool (*FvalueFromUnsignedInt64)(fvalue_t*, const char *, uint64_t, char **);
59 typedef bool (*FvalueFromSignedInt64)(fvalue_t*, const char *, int64_t, char **);
60 typedef bool (*FvalueFromDouble)(fvalue_t*, const char *, double, char **);
61
62 typedef char *(*FvalueToStringRepr)(wmem_allocator_t *, const fvalue_t*, ftrepr_t, int field_display);
63
64 typedef enum ft_result (*FvalueToUnsignedInt64)(const fvalue_t*, uint64_t *);
65 typedef enum ft_result (*FvalueToSignedInt64)(const fvalue_t*, int64_t *);
66 typedef enum ft_result (*FvalueToDouble)(const fvalue_t*, double *);
67
68 typedef void (*FvalueSetBytesFunc)(fvalue_t*, GBytes *);
69 typedef void (*FvalueSetGuidFunc)(fvalue_t*, const e_guid_t *);
70 typedef void (*FvalueSetTimeFunc)(fvalue_t*, const nstime_t *);
71 typedef void (*FvalueSetStrbufFunc)(fvalue_t*, wmem_strbuf_t *);
72 typedef void (*FvalueSetProtocolFunc)(fvalue_t*, tvbuff_t *value, const char *name, int length);
73 typedef void (*FvalueSetUnsignedIntegerFunc)(fvalue_t*, uint32_t);
74 typedef void (*FvalueSetSignedIntegerFunc)(fvalue_t*, int32_t);
75 typedef void (*FvalueSetUnsignedInteger64Func)(fvalue_t*, uint64_t);
76 typedef void (*FvalueSetSignedInteger64Func)(fvalue_t*, int64_t);
77 typedef void (*FvalueSetFloatingFunc)(fvalue_t*, double);
78 typedef void (*FvalueSetIpv4Func)(fvalue_t*, const ipv4_addr_and_mask *);
79 typedef void (*FvalueSetIpv6Func)(fvalue_t*, const ipv6_addr_and_prefix *);
80
81 typedef GBytes *(*FvalueGetBytesFunc)(fvalue_t*);
82 typedef const e_guid_t *(*FvalueGetGuidFunc)(fvalue_t*);
83 typedef const nstime_t *(*FvalueGetTimeFunc)(fvalue_t*);
84 typedef const wmem_strbuf_t *(*FvalueGetStrbufFunc)(fvalue_t*);
85 typedef tvbuff_t *(*FvalueGetProtocolFunc)(fvalue_t*);
86 typedef uint32_t (*FvalueGetUnsignedIntegerFunc)(fvalue_t*);
87 typedef int32_t (*FvalueGetSignedIntegerFunc)(fvalue_t*);
88 typedef uint64_t (*FvalueGetUnsignedInteger64Func)(fvalue_t*);
89 typedef int64_t (*FvalueGetSignedInteger64Func)(fvalue_t*);
90 typedef double (*FvalueGetFloatingFunc)(fvalue_t*);
91 typedef const ipv4_addr_and_mask *(*FvalueGetIpv4Func)(fvalue_t*);
92 typedef const ipv6_addr_and_prefix *(*FvalueGetIpv6Func)(fvalue_t*);
93
94 typedef enum ft_result (*FvalueCompare)(const fvalue_t*, const fvalue_t*, int*);
95 typedef enum ft_result (*FvalueContains)(const fvalue_t*, const fvalue_t*, bool*);
96 typedef enum ft_result (*FvalueMatches)(const fvalue_t*, const ws_regex_t*, bool*);
97
98 typedef bool (*FvalueIs)(const fvalue_t*);
99 typedef unsigned (*FvalueLen)(fvalue_t*);
100 typedef unsigned (*FvalueHashFunc)(const fvalue_t *);
101 typedef void (*FvalueSlice)(fvalue_t*, void *, unsigned offset, unsigned length);
102 typedef enum ft_result (*FvalueUnaryOp)(fvalue_t *, const fvalue_t*, char **);
103 typedef 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
201 void ftype_register(enum ftenum ftype, const ftype_t *ft);
202
206 void ftype_register_bytes(void);
207
211 void ftype_register_double(void);
212
216 void ftype_register_ieee_11073_float(void);
217
221 void ftype_register_integers(void);
222
226 void ftype_register_ipv4(void);
227
231 void ftype_register_ipv6(void);
232
236 void ftype_register_guid(void);
237
241 void ftype_register_none(void);
242
246 void ftype_register_string(void);
247
251 void ftype_register_time(void);
252
256 void ftype_register_tvbuff(void);
257
258/* For debugging. */
259
265 void ftype_register_pseudofields_bytes(int proto);
266
272 void ftype_register_pseudofields_double(int proto);
273
279 void ftype_register_pseudofields_ieee_11073_float(int proto);
280
286 void ftype_register_pseudofields_integer(int proto);
287
293 void ftype_register_pseudofields_ipv4(int proto);
294
300 void ftype_register_pseudofields_ipv6(int proto);
301
307 void ftype_register_pseudofields_guid(int proto);
308
314 void ftype_register_pseudofields_none(int proto);
315
321 void ftype_register_pseudofields_string(int proto);
322
328 void ftype_register_pseudofields_time(int proto);
329
335 void ftype_register_pseudofields_tvbuff(int proto);
336
347GByteArray *
348 byte_array_from_literal(const char *s, char **err_msg);
349
357GByteArray *
358 byte_array_from_charconst(unsigned long num, char **err_msg);
359
371 char *
372 bytes_to_dfilter_repr(wmem_allocator_t *scope,
373 const uint8_t *src, size_t src_size);
374
375#endif /* FTYPES_INT_H */
376
377/*
378 * Editor modelines - https://www.wireshark.org/tools/modelines.html
379 *
380 * Local variables:
381 * c-basic-offset: 8
382 * tab-width: 8
383 * indent-tabs-mode: t
384 * End:
385 *
386 * vi: set shiftwidth=8 tabstop=8 noexpandtab:
387 * :indentSize=8:tabSize=8:noTabs=false:
388 */
ftype_register_ipv4
void ftype_register_ipv4(void)
Registers IPv4 data type.
Definition ftype-ipv4.c:171
ftype_register_pseudofields_bytes
void ftype_register_pseudofields_bytes(int proto)
Registers pseudofields for byte-related data types.
Definition ftype-bytes.c:983
ftype_register_ipv6
void ftype_register_ipv6(void)
Registers IPv6 data type.
Definition ftype-ipv6.c:202
ftype_register_pseudofields_guid
void ftype_register_pseudofields_guid(int proto)
Registers pseudofields for GUID type.
Definition ftype-guid.c:152
ftype_register
void ftype_register(enum ftenum ftype, const ftype_t *ft)
Registers a field type handler for Wireshark.
Definition ftypes.c:59
ftype_register_pseudofields_string
void ftype_register_pseudofields_string(int proto)
Registers pseudofields for string types.
Definition ftype-string.c:511
byte_array_from_charconst
GByteArray * byte_array_from_charconst(unsigned long num, char **err_msg)
Convert an unsigned long to a byte array.
Definition ftype-bytes.c:223
ftype_register_pseudofields_tvbuff
void ftype_register_pseudofields_tvbuff(int proto)
Registers pseudofields for TVB (Protocol Data Unit) data.
Definition ftype-protocol.c:416
bytes_to_dfilter_repr
char * bytes_to_dfilter_repr(wmem_allocator_t *scope, const uint8_t *src, size_t src_size)
Convert bytes to a string representation suitable for display filters.
Definition ftype-bytes.c:79
ftype_register_guid
void ftype_register_guid(void)
Registers the GUID data type.
Definition ftype-guid.c:105
ftype_register_tvbuff
void ftype_register_tvbuff(void)
Registers a new ftype for TVB (Protocol Data Unit) data.
Definition ftype-protocol.c:368
ftype_register_pseudofields_ipv6
void ftype_register_pseudofields_ipv6(int proto)
Registers pseudofields for IPv6 data types.
Definition ftype-ipv6.c:248
ftype_register_pseudofields_ieee_11073_float
void ftype_register_pseudofields_ieee_11073_float(int proto)
Registers pseudofields for IEEE 11073 float type.
Definition ftype-ieee-11073-float.c:1259
ftype_register_ieee_11073_float
void ftype_register_ieee_11073_float(void)
Registers the IEEE 11073 float data type.
Definition ftype-ieee-11073-float.c:1103
ftype_register_pseudofields_integer
void ftype_register_pseudofields_integer(int proto)
Registers pseudofields for integer types.
Definition ftype-integer.c:1754
ftype_register_bytes
void ftype_register_bytes(void)
Registers the bytes data type handler for Wireshark.
Definition ftype-bytes.c:608
ftype_register_pseudofields_time
void ftype_register_pseudofields_time(int proto)
Registers pseudofields for time-related data types.
Definition ftype-time.c:776
byte_array_from_literal
GByteArray * byte_array_from_literal(const char *s, char **err_msg)
Convert a literal string to a GByteArray.
Definition ftype-bytes.c:157
ftype_register_pseudofields_none
void ftype_register_pseudofields_none(int proto)
Registers pseudofields for a protocol with no specific type.
Definition ftype-none.c:61
ftype_register_double
void ftype_register_double(void)
Registers the double data type handler for Wireshark.
Definition ftype-double.c:186
ftype_register_string
void ftype_register_string(void)
Registers string field types.
Definition ftype-string.c:263
ftype_register_time
void ftype_register_time(void)
Registers time-related field types.
Definition ftype-time.c:689
ftype_register_integers
void ftype_register_integers(void)
Registers all integer-related field types.
Definition ftype-integer.c:946
ftype_register_none
void ftype_register_none(void)
Registers the "none" data type.
Definition ftype-none.c:15
ftype_register_pseudofields_ipv4
void ftype_register_pseudofields_ipv4(int proto)
Registers pseudofields for IPv4 data types.
Definition ftype-ipv4.c:218
ftype_register_pseudofields_double
void ftype_register_pseudofields_double(int proto)
Registers pseudofields for double type.
Definition ftype-double.c:274
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:483
_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:36