Wireshark 4.7.2
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
ftypes.h
Go to the documentation of this file.
1
10#pragma once
11#include <wireshark.h>
12
13#include <wsutil/regex.h>
14#include <epan/wmem_scopes.h>
15
16#ifdef __cplusplus
17extern "C" {
18#endif /* __cplusplus */
19
20#define ASSERT_FTYPE_NOT_REACHED(ft) \
21 ws_error("Invalid field type '%s'.", ftype_name(ft))
22
77
78
83#define FT_IS_INT32(ft) \
84 ((ft) == FT_INT8 || \
85 (ft) == FT_INT16 || \
86 (ft) == FT_INT24 || \
87 (ft) == FT_INT32)
88
93#define FT_IS_INT64(ft) \
94 ((ft) == FT_INT40 || \
95 (ft) == FT_INT48 || \
96 (ft) == FT_INT56 || \
97 (ft) == FT_INT64)
98
103#define FT_IS_INT(ft) (FT_IS_INT32(ft) || FT_IS_INT64(ft))
104
109#define FT_IS_UINT32(ft) \
110 ((ft) == FT_CHAR || \
111 (ft) == FT_UINT8 || \
112 (ft) == FT_UINT16 || \
113 (ft) == FT_UINT24 || \
114 (ft) == FT_UINT32 || \
115 (ft) == FT_FRAMENUM)
116
121#define FT_IS_UINT64(ft) \
122 ((ft) == FT_UINT40 || \
123 (ft) == FT_UINT48 || \
124 (ft) == FT_UINT56 || \
125 (ft) == FT_UINT64)
126
131#define FT_IS_UINT(ft) (FT_IS_UINT32(ft) || FT_IS_UINT64(ft))
132
137#define FT_IS_INTEGER(ft) (FT_IS_INT(ft) || FT_IS_UINT(ft))
138
143#define FT_IS_FLOATING(ft) ((ft) == FT_FLOAT || (ft) == FT_DOUBLE)
144
149#define FT_IS_TIME(ft) \
150 ((ft) == FT_ABSOLUTE_TIME || (ft) == FT_RELATIVE_TIME)
151
156#define FT_IS_STRING(ft) \
157 ((ft) == FT_STRING || (ft) == FT_STRINGZ || (ft) == FT_STRINGZPAD || \
158 (ft) == FT_STRINGZTRUNC || (ft) == FT_UINT_STRING || (ft) == FT_AX25)
159
164#define FT_IS_SCALAR(ft) ((ft) == FT_INT64 || (ft) == FT_DOUBLE)
165
166
168#define FT_ETHER_LEN 6
170#define FT_GUID_LEN 16
172#define FT_IPv4_LEN 4
174#define FT_IPv6_LEN 16
176#define FT_IPXNET_LEN 4
178#define FT_EUI64_LEN 8
180#define FT_AX25_ADDR_LEN 7
182#define FT_VINES_ADDR_LEN 6
184#define FT_FCWWN_LEN 8
186#define FT_VARINT_MAX_LEN 10
187
188
190typedef enum ftenum ftenum_t;
191
192
206
209
210struct _ftype_t;
211typedef struct _ftype_t ftype_t;
212
213
224
225
233typedef int ft_bool_t;
234#define FT_TRUE 1
235#define FT_FALSE 0
236
237
248
249typedef enum ftrepr ftrepr_t;
250
251/* Initialize the ftypes subsystem. Called once. */
252
258void
260
268void
270
271/* ---------------- FTYPE ----------------- */
272
273/* given two types, are they similar - for example can two
274 * duplicate fields be registered of these two types. */
283bool
284ftype_similar_types(const enum ftenum ftype_a, const enum ftenum ftype_b);
285
286/* Return a string representing the name of the type */
293WS_DLL_PUBLIC
294const char*
296
297/* Return a string presenting a "pretty" representation of the
298 * name of the type. The pretty name means more to the user than
299 * that "FT_*" name. */
300
309WS_DLL_PUBLIC
310const char*
312
313/* Returns length of field in packet, or 0 if not determinable/defined. */
320WS_DLL_PUBLIC
321int
323
330WS_DLL_PUBLIC
331bool
333
340WS_DLL_PUBLIC
341bool
343
350WS_DLL_PUBLIC
351bool
353
360WS_DLL_PUBLIC
361bool
363
370WS_DLL_PUBLIC
371bool
373
381WS_DLL_PUBLIC
382bool
384
391WS_DLL_PUBLIC
392bool
394
401WS_DLL_PUBLIC
402bool
404
412WS_DLL_PUBLIC
413bool
415
422WS_DLL_PUBLIC
423bool
425
432WS_DLL_PUBLIC
433bool
435
442WS_DLL_PUBLIC
443bool
445
452WS_DLL_PUBLIC
453bool
455
462WS_DLL_PUBLIC
463bool
465
472WS_DLL_PUBLIC
473bool
475
482WS_DLL_PUBLIC
483bool
485
492WS_DLL_PUBLIC
493bool
495
502WS_DLL_PUBLIC
503bool
505
512WS_DLL_PUBLIC
513bool
515
523WS_DLL_PUBLIC
524bool
526
535WS_DLL_PUBLIC
536bool
538
539/* ---------------- FVALUE ----------------- */
540
541#include <wsutil/inet_cidr.h>
542#include <epan/guid-utils.h>
543
544#include <epan/tvbuff.h>
545#include <wsutil/nstime.h>
546#include <epan/dfilter/drange.h>
547
551typedef struct _protocol_value_t
552{
553 tvbuff_t* tvb;
554 unsigned length;
558
559typedef struct _fvalue_t fvalue_t;
560
567WS_DLL_PUBLIC
568fvalue_t*
570
580WS_DLL_PUBLIC
581fvalue_t*
582fvalue_dup(const fvalue_t *fv);
583
590WS_DLL_PUBLIC
591void
592fvalue_init(fvalue_t *fv, ftenum_t ftype);
593
599WS_DLL_PUBLIC
600void
601fvalue_cleanup(fvalue_t *fv);
602
608WS_DLL_PUBLIC
609void
610fvalue_free(fvalue_t *fv);
611
621WS_DLL_PUBLIC
622fvalue_t*
623fvalue_from_literal(ftenum_t ftype, const char *s, bool allow_partial_value, char **err_msg);
624
636fvalue_t*
637fvalue_from_string(ftenum_t ftype, const char *s, size_t len, char **err_msg);
638
647fvalue_t*
648fvalue_from_charconst(ftenum_t ftype, unsigned long number, char **err_msg);
649
659fvalue_t*
660fvalue_from_sinteger64(ftenum_t ftype, const char *s, int64_t number, char **err_msg);
661
671
672fvalue_t*
673fvalue_from_uinteger64(ftenum_t ftype, const char *s, uint64_t number, char **err_msg);
674
684fvalue_t*
685fvalue_from_floating(ftenum_t ftype, const char *s, double number, char **err_msg);
686
705WS_DLL_PUBLIC char *
706fvalue_to_string_repr(wmem_allocator_t *scope, const fvalue_t *fv, ftrepr_t rtype, int field_display);
707
708#define fvalue_to_debug_repr(scope, fv) \
709 fvalue_to_string_repr(scope, fv, FTREPR_DFILTER, 0)
710
718WS_DLL_PUBLIC enum ft_result
719fvalue_to_uinteger(const fvalue_t *fv, uint32_t *repr);
720
728
729WS_DLL_PUBLIC enum ft_result
730fvalue_to_sinteger(const fvalue_t *fv, int32_t *repr);
731
739WS_DLL_PUBLIC enum ft_result
740fvalue_to_uinteger64(const fvalue_t *fv, uint64_t *repr);
741
749WS_DLL_PUBLIC enum ft_result
750fvalue_to_sinteger64(const fvalue_t *fv, int64_t *repr);
751
759WS_DLL_PUBLIC enum ft_result
760fvalue_to_double(const fvalue_t *fv, double *repr);
761
768WS_DLL_PUBLIC ftenum_t
769fvalue_type_ftenum(const fvalue_t *fv);
770
777WS_DLL_PUBLIC
778const char*
779fvalue_type_name(const fvalue_t *fv);
780
781/* GBytes reference count is automatically incremented. */
788WS_DLL_PUBLIC
789void
790fvalue_set_bytes(fvalue_t *fv, GBytes *value);
791
798WS_DLL_PUBLIC
799void
800fvalue_set_byte_array(fvalue_t *fv, GByteArray *value);
801
809WS_DLL_PUBLIC
810void
811fvalue_set_bytes_data(fvalue_t *fv, const void *data, size_t size);
812
819WS_DLL_PUBLIC
820void
821fvalue_set_fcwwn(fvalue_t *fv, const uint8_t *value);
822
823
830WS_DLL_PUBLIC
831void
832fvalue_set_ax25(fvalue_t *fv, const uint8_t *value);
833
834
841WS_DLL_PUBLIC
842void
843fvalue_set_vines(fvalue_t *fv, const uint8_t *value);
844
851WS_DLL_PUBLIC
852void
853fvalue_set_ether(fvalue_t *fv, const uint8_t *value);
854
861WS_DLL_PUBLIC
862void
863fvalue_set_guid(fvalue_t *fv, const e_guid_t *value);
864
871WS_DLL_PUBLIC
872void
873fvalue_set_time(fvalue_t *fv, const nstime_t *value);
874
881WS_DLL_PUBLIC
882void
883fvalue_set_string(fvalue_t *fv, const char *value);
884
891WS_DLL_PUBLIC
892void
893fvalue_set_strbuf(fvalue_t *fv, wmem_strbuf_t *value);
894
903WS_DLL_PUBLIC
904void
905fvalue_set_protocol(fvalue_t *fv, tvbuff_t *value, const char *name, unsigned length);
906
913WS_DLL_PUBLIC
914void
915fvalue_set_protocol_length(fvalue_t *fv, unsigned length);
916
917
924WS_DLL_PUBLIC
925void
926fvalue_set_uinteger(fvalue_t *fv, uint32_t value);
927
934WS_DLL_PUBLIC
935void
936fvalue_set_sinteger(fvalue_t *fv, int32_t value);
937
944WS_DLL_PUBLIC
945void
946fvalue_set_uinteger64(fvalue_t *fv, uint64_t value);
947
954WS_DLL_PUBLIC
955void
956fvalue_set_sinteger64(fvalue_t *fv, int64_t value);
957
964WS_DLL_PUBLIC
965void
966fvalue_set_floating(fvalue_t *fv, double value);
967
974WS_DLL_PUBLIC
975void
976fvalue_set_ipv4(fvalue_t *fv, const ipv4_addr_and_mask *value);
977
984WS_DLL_PUBLIC
985void
986fvalue_set_ipv6(fvalue_t *fv, const ipv6_addr_and_prefix *value);
987
988/* GBytes reference count is automatically incremented. */
995WS_DLL_PUBLIC
996GBytes *
997fvalue_get_bytes(fvalue_t *fv);
998
1005WS_DLL_PUBLIC
1006size_t
1007fvalue_get_bytes_size(fvalue_t *fv);
1008
1009/* Same as fvalue_length() */
1010
1017WS_DLL_PUBLIC
1018const void *
1019fvalue_get_bytes_data(fvalue_t *fv);
1020
1027WS_DLL_PUBLIC
1028const e_guid_t *
1029fvalue_get_guid(fvalue_t *fv);
1030
1037WS_DLL_PUBLIC
1038const nstime_t *
1039fvalue_get_time(fvalue_t *fv);
1040
1047WS_DLL_PUBLIC
1048const char *
1049fvalue_get_string(fvalue_t *fv);
1050
1057WS_DLL_PUBLIC
1058const wmem_strbuf_t *
1059fvalue_get_strbuf(fvalue_t *fv);
1060
1067WS_DLL_PUBLIC
1068tvbuff_t *
1069fvalue_get_protocol(fvalue_t *fv);
1070
1077WS_DLL_PUBLIC
1078uint32_t
1079fvalue_get_uinteger(fvalue_t *fv);
1080
1087WS_DLL_PUBLIC
1088int32_t
1089fvalue_get_sinteger(fvalue_t *fv);
1090
1097WS_DLL_PUBLIC
1098uint64_t
1099fvalue_get_uinteger64(fvalue_t *fv);
1100
1107WS_DLL_PUBLIC
1108int64_t
1109fvalue_get_sinteger64(fvalue_t *fv);
1110
1117WS_DLL_PUBLIC
1118double
1119fvalue_get_floating(fvalue_t *fv);
1120
1127WS_DLL_PUBLIC
1128const ipv4_addr_and_mask *
1129fvalue_get_ipv4(fvalue_t *fv);
1130
1137WS_DLL_PUBLIC
1139fvalue_get_ipv6(fvalue_t *fv);
1140
1148WS_DLL_PUBLIC
1150fvalue_eq(const fvalue_t *a, const fvalue_t *b);
1151
1159WS_DLL_PUBLIC
1161fvalue_ne(const fvalue_t *a, const fvalue_t *b);
1162
1170WS_DLL_PUBLIC
1172fvalue_gt(const fvalue_t *a, const fvalue_t *b);
1173
1181WS_DLL_PUBLIC
1183fvalue_ge(const fvalue_t *a, const fvalue_t *b);
1184
1192WS_DLL_PUBLIC
1194fvalue_lt(const fvalue_t *a, const fvalue_t *b);
1195
1203WS_DLL_PUBLIC
1205fvalue_le(const fvalue_t *a, const fvalue_t *b);
1206
1215WS_DLL_PUBLIC
1217fvalue_contains(const fvalue_t *a, const fvalue_t *b);
1218
1227WS_DLL_PUBLIC
1229fvalue_matches(const fvalue_t *a, const ws_regex_t *re);
1230
1231WS_DLL_PUBLIC
1232bool
1233
1240fvalue_is_zero(const fvalue_t *a);
1241
1248WS_DLL_PUBLIC
1249bool
1250fvalue_is_negative(const fvalue_t *a);
1251
1258WS_DLL_PUBLIC
1259bool
1260fvalue_is_nan(const fvalue_t *a);
1261
1268WS_DLL_PUBLIC
1269size_t
1270fvalue_length2(fvalue_t *fv);
1271
1279WS_DLL_PUBLIC
1280fvalue_t*
1281fvalue_slice(fvalue_t *fv, drange_t *dr);
1282
1291WS_DLL_PUBLIC
1292fvalue_t*
1293fvalue_bitwise_and(const fvalue_t *a, const fvalue_t *b, char **err_msg);
1294
1302WS_DLL_PUBLIC
1303fvalue_t*
1304fvalue_unary_minus(const fvalue_t *fv, char **err_msg);
1305
1314WS_DLL_PUBLIC
1315fvalue_t*
1316fvalue_add(const fvalue_t *a, const fvalue_t *b, char **err_msg);
1317
1326WS_DLL_PUBLIC
1327fvalue_t*
1328fvalue_subtract(const fvalue_t *a, const fvalue_t *b, char **err_msg);
1329
1338WS_DLL_PUBLIC
1339fvalue_t*
1340fvalue_multiply(const fvalue_t *a, const fvalue_t *b, char **err_msg);
1341
1350WS_DLL_PUBLIC
1351fvalue_t*
1352fvalue_divide(const fvalue_t *a, const fvalue_t *b, char **err_msg);
1353
1362WS_DLL_PUBLIC
1363fvalue_t*
1364fvalue_modulo(const fvalue_t *a, const fvalue_t *b, char **err_msg);
1365
1372WS_DLL_PUBLIC
1373unsigned
1374fvalue_hash(const fvalue_t *fv);
1375
1385WS_DLL_PUBLIC
1386bool
1387fvalue_equal(const fvalue_t *a, const fvalue_t *b);
1388
1389#ifdef __cplusplus
1390}
1391#endif /* __cplusplus */
1392
1393/*
1394 * Editor modelines - https://www.wireshark.org/tools/modelines.html
1395 *
1396 * Local variables:
1397 * c-basic-offset: 8
1398 * tab-width: 8
1399 * indent-tabs-mode: t
1400 * End:
1401 *
1402 * vi: set shiftwidth=8 tabstop=8 noexpandtab:
1403 * :indentSize=8:tabSize=8:noTabs=false:
1404 */
struct _drange drange_t
A display filter range composed of one or more drange_node slices.
WS_DLL_PUBLIC ft_bool_t fvalue_lt(const fvalue_t *a, const fvalue_t *b)
Compares two fvalue_t objects to determine if the first is less than the second.
Definition ftypes.c:1343
struct _protocol_value_t protocol_value_t
Holds a protocol value's buffer and associated metadata for use in display filter evaluation.
WS_DLL_PUBLIC ftenum_t fvalue_type_ftenum(const fvalue_t *fv)
Get the ftype of a fvalue_t.
Definition ftypes.c:705
WS_DLL_PUBLIC bool ftype_can_eq(enum ftenum ftype)
Checks if a given field type can be compared.
Definition ftypes.c:315
ftrepr
Output representation formats for field value serialization.
Definition ftypes.h:241
@ FTREPR_JSON
Definition ftypes.h:244
@ FTREPR_RAW
Definition ftypes.h:245
@ FTREPR_DFILTER
Definition ftypes.h:243
@ FTREPR_DISPLAY
Definition ftypes.h:242
@ FTREPR_EK
Definition ftypes.h:246
WS_DLL_PUBLIC fvalue_t * fvalue_add(const fvalue_t *a, const fvalue_t *b, char **err_msg)
Adds two fvalue_t objects.
Definition ftypes.c:1434
enum ftenum ftenum_t
Convenience typedef for ftenum.
Definition ftypes.h:190
WS_DLL_PUBLIC enum ft_result fvalue_to_uinteger64(const fvalue_t *fv, uint64_t *repr)
Convert a fvalue_t to an unsigned 64-bit integer.
Definition ftypes.c:769
WS_DLL_PUBLIC void fvalue_set_ipv4(fvalue_t *fv, const ipv4_addr_and_mask *value)
Set the IPv4 value of an fvalue_t structure.
Definition ftypes.c:1127
WS_DLL_PUBLIC ft_bool_t fvalue_matches(const fvalue_t *a, const ws_regex_t *re)
Checks if a fvalue_t matches a regular expression.
Definition ftypes.c:1382
WS_DLL_PUBLIC bool ftype_can_add(enum ftenum ftype)
Checks if a given field type can be added.
Definition ftypes.c:351
WS_DLL_PUBLIC fvalue_t * fvalue_new(ftenum_t ftype)
Creates a new fvalue_t structure.
Definition ftypes.c:492
WS_DLL_PUBLIC enum ft_result fvalue_to_sinteger64(const fvalue_t *fv, int64_t *repr)
Convert a fvalue_t to an int64_t.
Definition ftypes.c:778
bool ftype_similar_types(const enum ftenum ftype_a, const enum ftenum ftype_b)
Determine if two field types are similar.
Definition ftypes.c:160
WS_DLL_PUBLIC bool fvalue_is_zero(const fvalue_t *a)
Checks if a fvalue_t is zero.
Definition ftypes.c:1395
WS_DLL_PUBLIC const ipv6_addr_and_prefix * fvalue_get_ipv6(fvalue_t *fv)
Retrieves the IPv6 value from an fvalue_t structure.
Definition ftypes.c:1283
WS_DLL_PUBLIC const char * ftype_name(ftenum_t ftype)
Get the name of a field type.
WS_DLL_PUBLIC ft_bool_t fvalue_le(const fvalue_t *a, const fvalue_t *b)
Compares two fvalue_t objects lexicographically.
Definition ftypes.c:1356
ftenum
Fundamental field value types used throughout the Wireshark dissector framework.
Definition ftypes.h:26
@ FT_GUID
Definition ftypes.h:63
@ FT_INT64
Definition ftypes.h:46
@ FT_IPv4
Definition ftypes.h:59
@ FT_FLOAT
Definition ftypes.h:49
@ FT_BOOLEAN
Definition ftypes.h:29
@ FT_UINT_BYTES
Definition ftypes.h:58
@ FT_STRINGZ
Definition ftypes.h:54
@ FT_STRINGZTRUNC
Definition ftypes.h:72
@ FT_AX25
Definition ftypes.h:66
@ FT_IEEE_11073_FLOAT
Definition ftypes.h:48
@ FT_INT16
Definition ftypes.h:40
@ FT_PROTOCOL
Definition ftypes.h:28
@ FT_FRAMENUM
Definition ftypes.h:62
@ FT_RELATIVE_TIME
Definition ftypes.h:52
@ FT_UINT64
Definition ftypes.h:38
@ FT_INT32
Definition ftypes.h:42
@ FT_NUM_TYPES
Definition ftypes.h:73
@ FT_UINT_STRING
Definition ftypes.h:55
@ FT_OID
Definition ftypes.h:64
@ FT_STRING
Definition ftypes.h:53
@ FT_IEEE_11073_SFLOAT
Definition ftypes.h:47
@ FT_NONE
Definition ftypes.h:27
@ FT_INT8
Definition ftypes.h:39
@ FT_INT40
Definition ftypes.h:43
@ FT_UINT24
Definition ftypes.h:33
@ FT_INT24
Definition ftypes.h:41
@ FT_SCALAR
Definition ftypes.h:74
@ FT_UINT8
Definition ftypes.h:31
@ FT_CHAR
Definition ftypes.h:30
@ FT_STRINGZPAD
Definition ftypes.h:70
@ FT_IPv6
Definition ftypes.h:60
@ FT_INT48
Definition ftypes.h:44
@ FT_DOUBLE
Definition ftypes.h:50
@ FT_FCWWN
Definition ftypes.h:71
@ FT_ABSOLUTE_TIME
Definition ftypes.h:51
@ FT_INT56
Definition ftypes.h:45
@ FT_UINT48
Definition ftypes.h:36
@ FT_ETHER
Definition ftypes.h:56
@ FT_BYTES
Definition ftypes.h:57
@ FT_SYSTEM_ID
Definition ftypes.h:69
@ FT_UINT16
Definition ftypes.h:32
@ FT_VINES
Definition ftypes.h:67
@ FT_REL_OID
Definition ftypes.h:68
@ FT_ENUM_SIZE
Definition ftypes.h:75
@ FT_EUI64
Definition ftypes.h:65
@ FT_UINT32
Definition ftypes.h:34
@ FT_UINT56
Definition ftypes.h:37
@ FT_IPXNET
Definition ftypes.h:61
@ FT_UINT40
Definition ftypes.h:35
WS_DLL_PUBLIC void fvalue_set_floating(fvalue_t *fv, double value)
Set the floating-point value of an fvalue_t.
Definition ftypes.c:1118
WS_DLL_PUBLIC const nstime_t * fvalue_get_time(fvalue_t *fv)
Retrieves a time value from an fvalue_t structure.
Definition ftypes.c:1186
WS_DLL_PUBLIC char * fvalue_to_string_repr(wmem_allocator_t *scope, const fvalue_t *fv, ftrepr_t rtype, int field_display)
Convert a fvalue to its string representation.
Definition ftypes.c:728
WS_DLL_PUBLIC const char * fvalue_get_string(fvalue_t *fv)
Get a string representation of an fvalue.
Definition ftypes.c:1194
WS_DLL_PUBLIC const ipv4_addr_and_mask * fvalue_get_ipv4(fvalue_t *fv)
Retrieves the IPv4 address from an fvalue_t structure.
Definition ftypes.c:1275
WS_DLL_PUBLIC bool ftype_can_val_to_sinteger(enum ftenum ftype)
Checks if a given ftype can be converted to a signed integer.
Definition ftypes.c:441
WS_DLL_PUBLIC int64_t fvalue_get_sinteger64(fvalue_t *fv)
Get the 64-bit signed integer value from an fvalue_t structure.
Definition ftypes.c:1255
WS_DLL_PUBLIC fvalue_t * fvalue_subtract(const fvalue_t *a, const fvalue_t *b, char **err_msg)
Subtracts one fvalue from another.
Definition ftypes.c:1442
WS_DLL_PUBLIC const char * fvalue_type_name(const fvalue_t *fv)
Get the name of the type associated with a fvalue_t.
Definition ftypes.c:711
void ftypes_initialize(void)
Initializes various field types in Wireshark.
Definition ftypes.c:20
WS_DLL_PUBLIC bool ftype_can_divide(enum ftenum ftype)
Checks if a given field type can be divided.
Definition ftypes.c:378
WS_DLL_PUBLIC void fvalue_set_bytes(fvalue_t *fv, GBytes *value)
Set the value of an fvalue_t to a GBytes object.
Definition ftypes.c:937
WS_DLL_PUBLIC void fvalue_set_uinteger(fvalue_t *fv, uint32_t value)
Set the value of a fvalue_t to an unsigned 32-bit integer.
Definition ftypes.c:1068
WS_DLL_PUBLIC fvalue_t * fvalue_divide(const fvalue_t *a, const fvalue_t *b, char **err_msg)
Divides two fvalue_t objects.
Definition ftypes.c:1458
WS_DLL_PUBLIC void fvalue_set_ax25(fvalue_t *fv, const uint8_t *value)
Set the value of an fvalue_t to an AX.25 address.
Definition ftypes.c:977
WS_DLL_PUBLIC void fvalue_set_bytes_data(fvalue_t *fv, const void *data, size_t size)
Set the bytes data for a fvalue_t.
Definition ftypes.c:961
WS_DLL_PUBLIC double fvalue_get_floating(fvalue_t *fv)
Retrieves the floating-point value from an fvalue_t structure.
Definition ftypes.c:1266
WS_DLL_PUBLIC int ftype_wire_size(ftenum_t ftype)
Get the wire size of a field type.
WS_DLL_PUBLIC fvalue_t * fvalue_multiply(const fvalue_t *a, const fvalue_t *b, char **err_msg)
Multiplies two fvalue_t objects.
Definition ftypes.c:1450
WS_DLL_PUBLIC bool ftype_can_val_to_uinteger(enum ftenum ftype)
Checks if a given ftenum can be converted to an unsigned integer.
Definition ftypes.c:451
WS_DLL_PUBLIC ft_bool_t fvalue_ge(const fvalue_t *a, const fvalue_t *b)
Compares two fvalue_t structures for greater than or equal to.
Definition ftypes.c:1330
WS_DLL_PUBLIC void fvalue_set_fcwwn(fvalue_t *fv, const uint8_t *value)
Set the value of an fvalue_t to a FC-WWN (Fibre Channel World Wide Name).
Definition ftypes.c:969
WS_DLL_PUBLIC bool ftype_can_is_nan(enum ftenum ftype)
Check if the given ftenum can represent NaN values.
Definition ftypes.c:432
WS_DLL_PUBLIC bool ftype_can_matches(enum ftenum ftype)
Checks if a given field type can match another.
Definition ftypes.c:405
fvalue_t * fvalue_from_floating(ftenum_t ftype, const char *s, double number, char **err_msg)
Creates a floating-point field value from a string representation.
Definition ftypes.c:683
WS_DLL_PUBLIC enum ft_result fvalue_to_sinteger(const fvalue_t *fv, int32_t *repr)
Convert a fvalue_t to a 32-bit signed integer.
Definition ftypes.c:753
WS_DLL_PUBLIC void fvalue_set_string(fvalue_t *fv, const char *value)
Set the string value of an fvalue_t.
Definition ftypes.c:1027
WS_DLL_PUBLIC const e_guid_t * fvalue_get_guid(fvalue_t *fv)
Retrieves a GUID value from an fvalue_t structure.
Definition ftypes.c:1178
WS_DLL_PUBLIC void fvalue_free(fvalue_t *fv)
Frees an fvalue_t structure.
Definition ftypes.c:556
WS_DLL_PUBLIC void fvalue_cleanup(fvalue_t *fv)
Clean up a fvalue_t structure.
Definition ftypes.c:548
WS_DLL_PUBLIC ft_bool_t fvalue_eq(const fvalue_t *a, const fvalue_t *b)
Compares two fvalue_t structures for equality.
Definition ftypes.c:1291
WS_DLL_PUBLIC void fvalue_set_strbuf(fvalue_t *fv, wmem_strbuf_t *value)
Set the value of an fvalue_t to a string buffer.
Definition ftypes.c:1034
WS_DLL_PUBLIC uint32_t fvalue_get_uinteger(fvalue_t *fv)
Get the unsigned integer value from an fvalue_t structure.
Definition ftypes.c:1216
WS_DLL_PUBLIC void fvalue_set_guid(fvalue_t *fv, const e_guid_t *value)
Set the value of a fvalue_t to a GUID.
Definition ftypes.c:1011
WS_DLL_PUBLIC bool ftype_can_modulo(enum ftenum ftype)
Check if a given ftype can perform modulo operation.
Definition ftypes.c:387
WS_DLL_PUBLIC bool ftype_can_is_zero(enum ftenum ftype)
Determines if a given field type can be zero.
Definition ftypes.c:414
WS_DLL_PUBLIC ft_bool_t fvalue_ne(const fvalue_t *a, const fvalue_t *b)
Compares two fvalue_t structures for inequality.
Definition ftypes.c:1304
WS_DLL_PUBLIC enum ft_result fvalue_to_double(const fvalue_t *fv, double *repr)
Convert a fvalue_t to its double representation.
Definition ftypes.c:787
WS_DLL_PUBLIC void fvalue_set_ether(fvalue_t *fv, const uint8_t *value)
Set the value of an fvalue_t to a new Ethernet address.
Definition ftypes.c:1003
WS_DLL_PUBLIC bool ftype_can_length(enum ftenum ftype)
Determines if a given field type can have its length retrieved.
Definition ftypes.c:297
int ft_bool_t
Three-state boolean type for ftype comparison results.
Definition ftypes.h:233
WS_DLL_PUBLIC ft_bool_t fvalue_gt(const fvalue_t *a, const fvalue_t *b)
Compares two fvalue_t structures to determine if the first is greater than the second.
Definition ftypes.c:1317
WS_DLL_PUBLIC void fvalue_set_sinteger64(fvalue_t *fv, int64_t value)
Set the value of an fvalue_t to a 64-bit signed integer.
Definition ftypes.c:1107
fvalue_t * fvalue_from_uinteger64(ftenum_t ftype, const char *s, uint64_t number, char **err_msg)
Creates a new fvalue_t from an unsigned 64-bit integer.
Definition ftypes.c:661
WS_DLL_PUBLIC const void * fvalue_get_bytes_data(fvalue_t *fv)
Retrieves the bytes data from an fvalue_t.
Definition ftypes.c:1169
WS_DLL_PUBLIC bool ftype_can_val_to_double(enum ftenum ftype)
Determines if a given field type can be converted to a double.
Definition ftypes.c:479
WS_DLL_PUBLIC bool ftype_can_multiply(enum ftenum ftype)
Checks if the given field type can be multiplied.
Definition ftypes.c:369
WS_DLL_PUBLIC void fvalue_set_time(fvalue_t *fv, const nstime_t *value)
Set the time value of an fvalue_t structure.
Definition ftypes.c:1019
WS_DLL_PUBLIC bool ftype_can_is_negative(enum ftenum ftype)
Determines if a given field type can represent negative values.
Definition ftypes.c:423
WS_DLL_PUBLIC GBytes * fvalue_get_bytes(fvalue_t *fv)
Get the bytes value from an fvalue_t.
Definition ftypes.c:1143
WS_DLL_PUBLIC fvalue_t * fvalue_from_literal(ftenum_t ftype, const char *s, bool allow_partial_value, char **err_msg)
Create a new fvalue from a literal string.
Definition ftypes.c:563
WS_DLL_PUBLIC fvalue_t * fvalue_slice(fvalue_t *fv, drange_t *dr)
Slices a fvalue_t based on a drange_t.
Definition ftypes.c:928
WS_DLL_PUBLIC bool fvalue_is_negative(const fvalue_t *a)
Checks if a fvalue_t is negative.
Definition ftypes.c:1401
WS_DLL_PUBLIC void fvalue_set_ipv6(fvalue_t *fv, const ipv6_addr_and_prefix *value)
Set the IPv6 value of an fvalue_t.
Definition ftypes.c:1135
WS_DLL_PUBLIC fvalue_t * fvalue_modulo(const fvalue_t *a, const fvalue_t *b, char **err_msg)
Calculate the modulo of two fvalue_t objects.
Definition ftypes.c:1466
fvalue_t * fvalue_from_charconst(ftenum_t ftype, unsigned long number, char **err_msg)
Create a new fvalue from a character constant.
Definition ftypes.c:611
WS_DLL_PUBLIC void fvalue_set_protocol(fvalue_t *fv, tvbuff_t *value, const char *name, unsigned length)
Set the protocol value for a field value.
Definition ftypes.c:1046
fvalue_t * fvalue_from_sinteger64(ftenum_t ftype, const char *s, int64_t number, char **err_msg)
Creates a field value from a signed 64-bit integer.
Definition ftypes.c:639
WS_DLL_PUBLIC bool ftype_can_subtract(enum ftenum ftype)
Checks if the given ftype can be subtracted.
Definition ftypes.c:360
WS_DLL_PUBLIC void fvalue_set_vines(fvalue_t *fv, const uint8_t *value)
Set the value of an fvalue_t to a VINES address.
Definition ftypes.c:995
WS_DLL_PUBLIC const wmem_strbuf_t * fvalue_get_strbuf(fvalue_t *fv)
Retrieves the string buffer value from an fvalue_t structure.
Definition ftypes.c:1200
WS_DLL_PUBLIC void fvalue_set_uinteger64(fvalue_t *fv, uint64_t value)
Set the value of a fvalue_t to an unsigned 64-bit integer.
Definition ftypes.c:1095
WS_DLL_PUBLIC bool ftype_can_val_to_sinteger64(enum ftenum ftype)
Checks if a given field type can be converted to a signed 64-bit integer.
Definition ftypes.c:461
WS_DLL_PUBLIC bool ftype_can_slice(enum ftenum ftype)
Determines if a given field type can be sliced.
Definition ftypes.c:306
WS_DLL_PUBLIC void fvalue_set_protocol_length(fvalue_t *fv, unsigned length)
Set the protocol length for a fvalue_t structure.
Definition ftypes.c:1057
WS_DLL_PUBLIC void fvalue_set_sinteger(fvalue_t *fv, int32_t value)
Set the value of an fvalue_t to a signed 32-bit integer.
Definition ftypes.c:1084
enum ft_framenum_type ft_framenum_type_t
Convenience typedef for ft_framenum_type.
Definition ftypes.h:208
WS_DLL_PUBLIC bool ftype_can_bitwise_and(enum ftenum ftype)
Checks if a given field type can perform bitwise AND operation.
Definition ftypes.c:333
WS_DLL_PUBLIC bool ftype_can_contains(enum ftenum ftype)
Checks if a given ftype can contain other types.
Definition ftypes.c:396
WS_DLL_PUBLIC enum ft_result fvalue_to_uinteger(const fvalue_t *fv, uint32_t *repr)
Convert a fvalue_t to an unsigned 32-bit integer.
Definition ftypes.c:739
WS_DLL_PUBLIC unsigned fvalue_hash(const fvalue_t *fv)
Calculate the hash value for a fvalue_t.
Definition ftypes.c:1489
WS_DLL_PUBLIC ft_bool_t fvalue_contains(const fvalue_t *a, const fvalue_t *b)
Checks if one fvalue_t contains another.
Definition ftypes.c:1369
void ftypes_register_pseudofields(void)
Registers pseudofields for various data types in Wireshark.
Definition ftypes.c:36
WS_DLL_PUBLIC void fvalue_init(fvalue_t *fv, ftenum_t ftype)
Initialize a fvalue_t structure.
Definition ftypes.c:533
WS_DLL_PUBLIC void fvalue_set_byte_array(fvalue_t *fv, GByteArray *value)
Set the byte array value of an fvalue_t.
Definition ftypes.c:953
WS_DLL_PUBLIC bool ftype_can_unary_minus(enum ftenum ftype)
Check if a given ftenum can be negated using unary minus.
Definition ftypes.c:342
WS_DLL_PUBLIC bool ftype_can_val_to_uinteger64(enum ftenum ftype)
Checks if a given ftenum can be converted to an unsigned 64-bit integer.
Definition ftypes.c:470
WS_DLL_PUBLIC const char * ftype_pretty_name(ftenum_t ftype)
Returns a string representing the "pretty" name of the field type.
WS_DLL_PUBLIC bool fvalue_is_nan(const fvalue_t *a)
Checks if a fvalue_t is NaN.
Definition ftypes.c:1407
WS_DLL_PUBLIC tvbuff_t * fvalue_get_protocol(fvalue_t *fv)
Get the protocol value from an fvalue_t structure.
Definition ftypes.c:1208
WS_DLL_PUBLIC fvalue_t * fvalue_dup(const fvalue_t *fv)
Duplicates a fvalue_t structure.
Definition ftypes.c:512
fvalue_t * fvalue_from_string(ftenum_t ftype, const char *s, size_t len, char **err_msg)
Create a new fvalue_t from a string.
Definition ftypes.c:589
WS_DLL_PUBLIC fvalue_t * fvalue_bitwise_and(const fvalue_t *a, const fvalue_t *b, char **err_msg)
Perform a bitwise AND operation on two fvalue_t objects.
Definition ftypes.c:1426
WS_DLL_PUBLIC size_t fvalue_length2(fvalue_t *fv)
Get the length of a fvalue_t.
Definition ftypes.c:718
WS_DLL_PUBLIC bool ftype_can_cmp(enum ftenum ftype)
Determines if a given field type can be compared.
Definition ftypes.c:324
WS_DLL_PUBLIC uint64_t fvalue_get_uinteger64(fvalue_t *fv)
Retrieves an unsigned 64-bit integer value from a fvalue_t structure.
Definition ftypes.c:1243
ft_framenum_type
Semantic role of an FT_FRAMENUM field, describing the relationship it encodes.
Definition ftypes.h:196
@ FT_FRAMENUM_REQUEST
Definition ftypes.h:198
@ FT_FRAMENUM_NONE
Definition ftypes.h:197
@ FT_FRAMENUM_RETRANS_PREV
Definition ftypes.h:202
@ FT_FRAMENUM_RETRANS_NEXT
Definition ftypes.h:203
@ FT_FRAMENUM_DUP_ACK
Definition ftypes.h:201
@ FT_FRAMENUM_NUM_TYPES
Definition ftypes.h:204
@ FT_FRAMENUM_RESPONSE
Definition ftypes.h:199
@ FT_FRAMENUM_ACK
Definition ftypes.h:200
WS_DLL_PUBLIC bool fvalue_equal(const fvalue_t *a, const fvalue_t *b)
Compares two fvalue_t structures for equality.
Definition ftypes.c:1496
WS_DLL_PUBLIC int32_t fvalue_get_sinteger(fvalue_t *fv)
Retrieves a signed integer value from an fvalue_t structure.
Definition ftypes.c:1232
WS_DLL_PUBLIC fvalue_t * fvalue_unary_minus(const fvalue_t *fv, char **err_msg)
Applies unary minus operation to a fvalue.
Definition ftypes.c:1474
ft_result
Return codes for ftype operations such as conversion and comparison.
Definition ftypes.h:217
@ FT_ERROR
Definition ftypes.h:222
@ FT_OK
Definition ftypes.h:218
@ FT_BADARG
Definition ftypes.h:221
@ FT_OVERFLOW
Definition ftypes.h:219
@ FT_UNDERFLOW
Definition ftypes.h:220
WS_DLL_PUBLIC size_t fvalue_get_bytes_size(fvalue_t *fv)
Get the size of the bytes data stored in an fvalue_t.
Definition ftypes.c:1160
struct _wmem_allocator_t wmem_allocator_t
Definition wmem_core.h:44
struct _e_guid_t e_guid_t
Represents a GUID/UUID value; may be larger than GUID_LEN so must not be used to directly overlay pac...
Describes a field type and its associated operations for display filtering.
Definition ftypes-int.h:110
ftenum_t ftype
Definition ftypes-int.h:111
Represents a typed field value used in protocol dissection.
Definition ftypes-int.h:22
union _fvalue_t::@261174046216355056107116147205130335061271165154 value
const ftype_t * ftype
Definition ftypes-int.h:23
Holds a protocol value's buffer and associated metadata for use in display filter evaluation.
Definition ftypes.h:552
char * proto_string
Definition ftypes.h:555
bool tvb_is_private
Definition ftypes.h:556
tvbuff_t * tvb
Definition ftypes.h:553
unsigned length
Definition ftypes.h:554
Holds an IPv4 address paired with its subnet mask, both in host byte order.
Definition inet_cidr.h:25
Holds an IPv6 address paired with its prefix length.
Definition inet_cidr.h:33
Definition nstime.h:26