Wireshark 4.7.3
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
568WS_DLL_PUBLIC
569fvalue_t*
571
580WS_DLL_PUBLIC
581fvalue_t*
583
593WS_DLL_PUBLIC
594fvalue_t*
595fvalue_dup(const fvalue_t *fv);
596
603WS_DLL_PUBLIC
604void
605fvalue_init(fvalue_t *fv, ftenum_t ftype);
606
612WS_DLL_PUBLIC
613void
614fvalue_cleanup(fvalue_t *fv);
615
621WS_DLL_PUBLIC
622void
623fvalue_free(fvalue_t *fv);
624
634WS_DLL_PUBLIC
635fvalue_t*
636fvalue_from_literal(ftenum_t ftype, const char *s, bool allow_partial_value, char **err_msg);
637
649fvalue_t*
650fvalue_from_string(ftenum_t ftype, const char *s, size_t len, char **err_msg);
651
660fvalue_t*
661fvalue_from_charconst(ftenum_t ftype, unsigned long number, char **err_msg);
662
672fvalue_t*
673fvalue_from_sinteger64(ftenum_t ftype, const char *s, int64_t number, char **err_msg);
674
684
685fvalue_t*
686fvalue_from_uinteger64(ftenum_t ftype, const char *s, uint64_t number, char **err_msg);
687
697fvalue_t*
698fvalue_from_floating(ftenum_t ftype, const char *s, double number, char **err_msg);
699
718WS_DLL_PUBLIC char *
719fvalue_to_string_repr(wmem_allocator_t *scope, const fvalue_t *fv, ftrepr_t rtype, int field_display);
720
721#define fvalue_to_debug_repr(scope, fv) \
722 fvalue_to_string_repr(scope, fv, FTREPR_DFILTER, 0)
723
731WS_DLL_PUBLIC enum ft_result
732fvalue_to_uinteger(const fvalue_t *fv, uint32_t *repr);
733
741
742WS_DLL_PUBLIC enum ft_result
743fvalue_to_sinteger(const fvalue_t *fv, int32_t *repr);
744
752WS_DLL_PUBLIC enum ft_result
753fvalue_to_uinteger64(const fvalue_t *fv, uint64_t *repr);
754
762WS_DLL_PUBLIC enum ft_result
763fvalue_to_sinteger64(const fvalue_t *fv, int64_t *repr);
764
772WS_DLL_PUBLIC enum ft_result
773fvalue_to_double(const fvalue_t *fv, double *repr);
774
781WS_DLL_PUBLIC ftenum_t
782fvalue_type_ftenum(const fvalue_t *fv);
783
790WS_DLL_PUBLIC
791const char*
792fvalue_type_name(const fvalue_t *fv);
793
794/* GBytes reference count is automatically incremented. */
801WS_DLL_PUBLIC
802void
803fvalue_set_bytes(fvalue_t *fv, GBytes *value);
804
811WS_DLL_PUBLIC
812void
813fvalue_set_byte_array(fvalue_t *fv, GByteArray *value);
814
822WS_DLL_PUBLIC
823void
824fvalue_set_bytes_data(fvalue_t *fv, const void *data, size_t size);
825
832WS_DLL_PUBLIC
833void
834fvalue_set_fcwwn(fvalue_t *fv, const uint8_t *value);
835
836
843WS_DLL_PUBLIC
844void
845fvalue_set_ax25(fvalue_t *fv, const uint8_t *value);
846
847
854WS_DLL_PUBLIC
855void
856fvalue_set_vines(fvalue_t *fv, const uint8_t *value);
857
864WS_DLL_PUBLIC
865void
866fvalue_set_ether(fvalue_t *fv, const uint8_t *value);
867
874WS_DLL_PUBLIC
875void
876fvalue_set_guid(fvalue_t *fv, const e_guid_t *value);
877
884WS_DLL_PUBLIC
885void
886fvalue_set_time(fvalue_t *fv, const nstime_t *value);
887
894WS_DLL_PUBLIC
895void
896fvalue_set_string(fvalue_t *fv, const char *value);
897
904WS_DLL_PUBLIC
905void
906fvalue_set_strbuf(fvalue_t *fv, wmem_strbuf_t *value);
907
916WS_DLL_PUBLIC
917void
918fvalue_set_protocol(fvalue_t *fv, tvbuff_t *value, const char *name, unsigned length);
919
926WS_DLL_PUBLIC
927void
928fvalue_set_protocol_length(fvalue_t *fv, unsigned length);
929
930
937WS_DLL_PUBLIC
938void
939fvalue_set_uinteger(fvalue_t *fv, uint32_t value);
940
947WS_DLL_PUBLIC
948void
949fvalue_set_sinteger(fvalue_t *fv, int32_t value);
950
957WS_DLL_PUBLIC
958void
959fvalue_set_uinteger64(fvalue_t *fv, uint64_t value);
960
967WS_DLL_PUBLIC
968void
969fvalue_set_sinteger64(fvalue_t *fv, int64_t value);
970
977WS_DLL_PUBLIC
978void
979fvalue_set_floating(fvalue_t *fv, double value);
980
987WS_DLL_PUBLIC
988void
989fvalue_set_ipv4(fvalue_t *fv, const ipv4_addr_and_mask *value);
990
997WS_DLL_PUBLIC
998void
999fvalue_set_ipv6(fvalue_t *fv, const ipv6_addr_and_prefix *value);
1000
1001/* GBytes reference count is automatically incremented. */
1008WS_DLL_PUBLIC
1009GBytes *
1010fvalue_get_bytes(fvalue_t *fv);
1011
1018WS_DLL_PUBLIC
1019size_t
1020fvalue_get_bytes_size(fvalue_t *fv);
1021
1022/* Same as fvalue_length() */
1023
1030WS_DLL_PUBLIC
1031const void *
1032fvalue_get_bytes_data(fvalue_t *fv);
1033
1040WS_DLL_PUBLIC
1041const e_guid_t *
1042fvalue_get_guid(fvalue_t *fv);
1043
1050WS_DLL_PUBLIC
1051const nstime_t *
1052fvalue_get_time(fvalue_t *fv);
1053
1060WS_DLL_PUBLIC
1061const char *
1062fvalue_get_string(fvalue_t *fv);
1063
1070WS_DLL_PUBLIC
1071const wmem_strbuf_t *
1072fvalue_get_strbuf(fvalue_t *fv);
1073
1080WS_DLL_PUBLIC
1081tvbuff_t *
1082fvalue_get_protocol(fvalue_t *fv);
1083
1090WS_DLL_PUBLIC
1091uint32_t
1092fvalue_get_uinteger(fvalue_t *fv);
1093
1100WS_DLL_PUBLIC
1101int32_t
1102fvalue_get_sinteger(fvalue_t *fv);
1103
1110WS_DLL_PUBLIC
1111uint64_t
1112fvalue_get_uinteger64(fvalue_t *fv);
1113
1120WS_DLL_PUBLIC
1121int64_t
1122fvalue_get_sinteger64(fvalue_t *fv);
1123
1130WS_DLL_PUBLIC
1131double
1132fvalue_get_floating(fvalue_t *fv);
1133
1140WS_DLL_PUBLIC
1141const ipv4_addr_and_mask *
1142fvalue_get_ipv4(fvalue_t *fv);
1143
1150WS_DLL_PUBLIC
1152fvalue_get_ipv6(fvalue_t *fv);
1153
1161WS_DLL_PUBLIC
1163fvalue_eq(const fvalue_t *a, const fvalue_t *b);
1164
1172WS_DLL_PUBLIC
1174fvalue_ne(const fvalue_t *a, const fvalue_t *b);
1175
1183WS_DLL_PUBLIC
1185fvalue_gt(const fvalue_t *a, const fvalue_t *b);
1186
1194WS_DLL_PUBLIC
1196fvalue_ge(const fvalue_t *a, const fvalue_t *b);
1197
1205WS_DLL_PUBLIC
1207fvalue_lt(const fvalue_t *a, const fvalue_t *b);
1208
1216WS_DLL_PUBLIC
1218fvalue_le(const fvalue_t *a, const fvalue_t *b);
1219
1228WS_DLL_PUBLIC
1230fvalue_contains(const fvalue_t *a, const fvalue_t *b);
1231
1240WS_DLL_PUBLIC
1242fvalue_matches(const fvalue_t *a, const ws_regex_t *re);
1243
1244WS_DLL_PUBLIC
1245bool
1246
1253fvalue_is_zero(const fvalue_t *a);
1254
1261WS_DLL_PUBLIC
1262bool
1263fvalue_is_negative(const fvalue_t *a);
1264
1271WS_DLL_PUBLIC
1272bool
1273fvalue_is_nan(const fvalue_t *a);
1274
1281WS_DLL_PUBLIC
1282size_t
1283fvalue_length2(fvalue_t *fv);
1284
1292WS_DLL_PUBLIC
1293fvalue_t*
1294fvalue_slice(fvalue_t *fv, drange_t *dr);
1295
1304WS_DLL_PUBLIC
1305fvalue_t*
1306fvalue_bitwise_and(const fvalue_t *a, const fvalue_t *b, char **err_msg);
1307
1315WS_DLL_PUBLIC
1316fvalue_t*
1317fvalue_unary_minus(const fvalue_t *fv, char **err_msg);
1318
1327WS_DLL_PUBLIC
1328fvalue_t*
1329fvalue_add(const fvalue_t *a, const fvalue_t *b, char **err_msg);
1330
1339WS_DLL_PUBLIC
1340fvalue_t*
1341fvalue_subtract(const fvalue_t *a, const fvalue_t *b, char **err_msg);
1342
1351WS_DLL_PUBLIC
1352fvalue_t*
1353fvalue_multiply(const fvalue_t *a, const fvalue_t *b, char **err_msg);
1354
1363WS_DLL_PUBLIC
1364fvalue_t*
1365fvalue_divide(const fvalue_t *a, const fvalue_t *b, char **err_msg);
1366
1375WS_DLL_PUBLIC
1376fvalue_t*
1377fvalue_modulo(const fvalue_t *a, const fvalue_t *b, char **err_msg);
1378
1385WS_DLL_PUBLIC
1386unsigned
1387fvalue_hash(const fvalue_t *fv);
1388
1398WS_DLL_PUBLIC
1399bool
1400fvalue_equal(const fvalue_t *a, const fvalue_t *b);
1401
1402#ifdef __cplusplus
1403}
1404#endif /* __cplusplus */
1405
1406/*
1407 * Editor modelines - https://www.wireshark.org/tools/modelines.html
1408 *
1409 * Local variables:
1410 * c-basic-offset: 8
1411 * tab-width: 8
1412 * indent-tabs-mode: t
1413 * End:
1414 *
1415 * vi: set shiftwidth=8 tabstop=8 noexpandtab:
1416 * :indentSize=8:tabSize=8:noTabs=false:
1417 */
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:1342
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:704
WS_DLL_PUBLIC bool ftype_can_eq(enum ftenum ftype)
Checks if a given field type can be compared.
Definition ftypes.c:311
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:1433
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:768
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:1126
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:1381
WS_DLL_PUBLIC bool ftype_can_add(enum ftenum ftype)
Checks if a given field type can be added.
Definition ftypes.c:347
WS_DLL_PUBLIC fvalue_t * fvalue_new(ftenum_t ftype)
Create and initialize a new fvalue_t structure.
Definition ftypes.c:488
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:777
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:1394
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:1282
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:1355
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:1117
WS_DLL_PUBLIC const nstime_t * fvalue_get_time(fvalue_t *fv)
Retrieves a time value from an fvalue_t structure.
Definition ftypes.c:1185
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:727
WS_DLL_PUBLIC const char * fvalue_get_string(fvalue_t *fv)
Get a string representation of an fvalue.
Definition ftypes.c:1193
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:1274
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:437
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:1254
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:1441
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:710
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:374
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:936
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:1067
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:1457
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:976
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:960
WS_DLL_PUBLIC double fvalue_get_floating(fvalue_t *fv)
Retrieves the floating-point value from an fvalue_t structure.
Definition ftypes.c:1265
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:1449
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:447
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:1329
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:968
WS_DLL_PUBLIC bool ftype_can_is_nan(enum ftenum ftype)
Check if the given ftenum can represent NaN values.
Definition ftypes.c:428
WS_DLL_PUBLIC bool ftype_can_matches(enum ftenum ftype)
Checks if a given field type can match another.
Definition ftypes.c:401
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:682
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:752
WS_DLL_PUBLIC void fvalue_set_string(fvalue_t *fv, const char *value)
Set the string value of an fvalue_t.
Definition ftypes.c:1026
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:1177
WS_DLL_PUBLIC void fvalue_free(fvalue_t *fv)
Frees an fvalue_t structure.
Definition ftypes.c:555
WS_DLL_PUBLIC void fvalue_cleanup(fvalue_t *fv)
Clean up a fvalue_t structure.
Definition ftypes.c:547
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:1290
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:1033
WS_DLL_PUBLIC uint32_t fvalue_get_uinteger(fvalue_t *fv)
Get the unsigned integer value from an fvalue_t structure.
Definition ftypes.c:1215
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:1010
WS_DLL_PUBLIC bool ftype_can_modulo(enum ftenum ftype)
Check if a given ftype can perform modulo operation.
Definition ftypes.c:383
WS_DLL_PUBLIC bool ftype_can_is_zero(enum ftenum ftype)
Determines if a given field type can be zero.
Definition ftypes.c:410
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:1303
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:786
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:1002
WS_DLL_PUBLIC bool ftype_can_length(enum ftenum ftype)
Determines if a given field type can have its length retrieved.
Definition ftypes.c:293
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:1316
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:1106
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:660
WS_DLL_PUBLIC const void * fvalue_get_bytes_data(fvalue_t *fv)
Retrieves the bytes data from an fvalue_t.
Definition ftypes.c:1168
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:475
WS_DLL_PUBLIC bool ftype_can_multiply(enum ftenum ftype)
Checks if the given field type can be multiplied.
Definition ftypes.c:365
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:1018
WS_DLL_PUBLIC bool ftype_can_is_negative(enum ftenum ftype)
Determines if a given field type can represent negative values.
Definition ftypes.c:419
WS_DLL_PUBLIC GBytes * fvalue_get_bytes(fvalue_t *fv)
Get the bytes value from an fvalue_t.
Definition ftypes.c:1142
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:562
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:927
WS_DLL_PUBLIC bool fvalue_is_negative(const fvalue_t *a)
Checks if a fvalue_t is negative.
Definition ftypes.c:1400
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:1134
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:1465
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:610
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:1045
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:638
WS_DLL_PUBLIC bool ftype_can_subtract(enum ftenum ftype)
Checks if the given ftype can be subtracted.
Definition ftypes.c:356
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:994
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:1199
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:1094
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:457
WS_DLL_PUBLIC bool ftype_can_slice(enum ftenum ftype)
Determines if a given field type can be sliced.
Definition ftypes.c:302
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:1056
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:1083
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:329
WS_DLL_PUBLIC bool ftype_can_contains(enum ftenum ftype)
Checks if a given ftype can contain other types.
Definition ftypes.c:392
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:738
WS_DLL_PUBLIC unsigned fvalue_hash(const fvalue_t *fv)
Calculate the hash value for a fvalue_t.
Definition ftypes.c:1488
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:1368
void ftypes_register_pseudofields(void)
Registers pseudofields for various data types in Wireshark.
Definition ftypes.c:36
WS_DLL_PUBLIC fvalue_t * fvalue_new_pool(wmem_allocator_t *scope, ftenum_t ftype)
Create and initialize a new fvalue_t structure using a wmem pool.
Definition ftypes.c:500
WS_DLL_PUBLIC void fvalue_init(fvalue_t *fv, ftenum_t ftype)
Initialize a fvalue_t structure.
Definition ftypes.c:532
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:952
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:338
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:466
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:1406
WS_DLL_PUBLIC tvbuff_t * fvalue_get_protocol(fvalue_t *fv)
Get the protocol value from an fvalue_t structure.
Definition ftypes.c:1207
WS_DLL_PUBLIC fvalue_t * fvalue_dup(const fvalue_t *fv)
Duplicates a fvalue_t structure.
Definition ftypes.c:511
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:588
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:1425
WS_DLL_PUBLIC size_t fvalue_length2(fvalue_t *fv)
Get the length of a fvalue_t.
Definition ftypes.c:717
WS_DLL_PUBLIC bool ftype_can_cmp(enum ftenum ftype)
Determines if a given field type can be compared.
Definition ftypes.c:320
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:1242
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:1495
WS_DLL_PUBLIC int32_t fvalue_get_sinteger(fvalue_t *fv)
Retrieves a signed integer value from an fvalue_t structure.
Definition ftypes.c:1231
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:1473
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:1159
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