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
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
112struct _ftype_t {
113 ftenum_t ftype;
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;
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;
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 */
Definition guid-utils.h:23
Describes a field type and its associated operations for display filtering.
Definition ftypes-int.h:112
FvalueToDouble val_to_double
Definition ftypes-int.h:131
union _ftype_t::@480 set_value
Union of function pointers for setting typed field values.
FvalueSetIpv6Func set_value_ipv6
Definition ftypes-int.h:150
FvalueFromCharConst val_from_charconst
Definition ftypes-int.h:122
FvalueSetFloatingFunc set_value_floating
Definition ftypes-int.h:148
FvalueIs is_nan
Definition ftypes-int.h:180
FvalueGetUnsignedIntegerFunc get_value_uinteger
Definition ftypes-int.h:164
FvalueSetStrbufFunc set_value_strbuf
Definition ftypes-int.h:142
FvalueFromDouble val_from_double
Definition ftypes-int.h:125
FvalueContains contains
Definition ftypes-int.h:174
FvalueSetSignedInteger64Func set_value_sinteger64
Definition ftypes-int.h:147
FvalueBinaryOp subtract
Definition ftypes-int.h:187
FvalueCompare compare
Definition ftypes-int.h:173
FvalueGetSignedIntegerFunc get_value_sinteger
Definition ftypes-int.h:165
FvalueLen len
Definition ftypes-int.h:181
FvalueIs is_negative
Definition ftypes-int.h:179
FvalueSetIpv4Func set_value_ipv4
Definition ftypes-int.h:149
FvalueGetIpv4Func get_value_ipv4
Definition ftypes-int.h:169
FvalueSetTimeFunc set_value_time
Definition ftypes-int.h:141
FvalueFreeFunc free_value
Definition ftypes-int.h:118
FvalueMatches matches
Definition ftypes-int.h:175
FvalueFromSignedInt64 val_from_sinteger64
Definition ftypes-int.h:124
FvalueGetSignedInteger64Func get_value_sinteger64
Definition ftypes-int.h:167
FvalueSlice slice
Definition ftypes-int.h:182
FvalueToSignedInt64 val_to_sinteger64
Definition ftypes-int.h:130
FvalueFromLiteral val_from_literal
Definition ftypes-int.h:120
FvalueBinaryOp modulo
Definition ftypes-int.h:190
FvalueFromUnsignedInt64 val_from_uinteger64
Definition ftypes-int.h:123
FvalueGetProtocolFunc get_value_protocol
Definition ftypes-int.h:163
FvalueSetGuidFunc set_value_guid
Definition ftypes-int.h:140
FvalueSetBytesFunc set_value_bytes
Definition ftypes-int.h:139
FvalueBinaryOp divide
Definition ftypes-int.h:189
FvalueSetUnsignedIntegerFunc set_value_uinteger
Definition ftypes-int.h:144
FvalueFromString val_from_string
Definition ftypes-int.h:121
FvalueBinaryOp bitwise_and
Definition ftypes-int.h:184
FvalueGetStrbufFunc get_value_strbuf
Definition ftypes-int.h:162
FvalueUnaryOp unary_minus
Definition ftypes-int.h:185
FvalueSetUnsignedInteger64Func set_value_uinteger64
Definition ftypes-int.h:146
FvalueSetProtocolFunc set_value_protocol
Definition ftypes-int.h:143
int wire_size
Definition ftypes-int.h:114
FvalueBinaryOp multiply
Definition ftypes-int.h:188
union _ftype_t::@481 get_value
Union of function pointers for retrieving typed field values.
FvalueGetBytesFunc get_value_bytes
Definition ftypes-int.h:159
FvalueToUnsignedInt64 val_to_uinteger64
Definition ftypes-int.h:129
FvalueGetGuidFunc get_value_guid
Definition ftypes-int.h:160
ftenum_t ftype
Definition ftypes-int.h:113
FvalueHashFunc hash
Definition ftypes-int.h:177
FvalueBinaryOp add
Definition ftypes-int.h:186
FvalueGetUnsignedInteger64Func get_value_uinteger64
Definition ftypes-int.h:166
FvalueGetIpv6Func get_value_ipv6
Definition ftypes-int.h:170
FvalueSetSignedIntegerFunc set_value_sinteger
Definition ftypes-int.h:145
FvalueToStringRepr val_to_string_repr
Definition ftypes-int.h:127
FvalueGetTimeFunc get_value_time
Definition ftypes-int.h:161
FvalueCopyFunc copy_value
Definition ftypes-int.h:117
FvalueNewFunc new_value
Definition ftypes-int.h:116
FvalueGetFloatingFunc get_value_floating
Definition ftypes-int.h:168
FvalueIs is_zero
Definition ftypes-int.h:178
Represents a typed field value used in protocol dissection.
Definition ftypes-int.h:24
protocol_value_t protocol
Definition ftypes-int.h:37
double floating
Definition ftypes-int.h:30
int64_t sinteger64
Definition ftypes-int.h:29
uint16_t sfloat_ieee_11073
Definition ftypes-int.h:38
ipv4_addr_and_mask ipv4
Definition ftypes-int.h:33
uint64_t uinteger64
Definition ftypes-int.h:28
GBytes * bytes
Definition ftypes-int.h:32
ipv6_addr_and_prefix ipv6
Definition ftypes-int.h:34
e_guid_t guid
Definition ftypes-int.h:35
const ftype_t * ftype
Definition ftypes-int.h:25
union _fvalue_t::@479 value
wmem_strbuf_t * strbuf
Definition ftypes-int.h:31
uint32_t float_ieee_11073
Definition ftypes-int.h:39
nstime_t time
Definition ftypes-int.h:36
Definition ftypes.h:310
Internal memory allocator interface used by the wmem subsystem.
Definition wmem_allocator.h:34
Internal structure representing a wmem-allocated string buffer.
Definition wmem_strbuf.h:38
Definition regex.c:17
Definition inet_cidr.h:22
Definition inet_cidr.h:27
Definition nstime.h:26
Definition tvbuff-int.h:35