Bug Summary

File:builds/wireshark/wireshark/epan/ftypes/ftypes.c
Warning:line 170, column 14
Value stored to 's' during its initialization is never read

Annotated Source Code

Press '?' to see keyboard shortcuts

clang -cc1 -cc1 -triple x86_64-pc-linux-gnu -analyze -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name ftypes.c -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -mrelocation-model pic -pic-level 2 -fhalf-no-semantic-interposition -fno-delete-null-pointer-checks -mframe-pointer=all -relaxed-aliasing -fmath-errno -ffp-contract=on -fno-rounding-math -ffloat16-excess-precision=fast -fbfloat16-excess-precision=fast -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -fdebug-compilation-dir=/builds/wireshark/wireshark/build -fcoverage-compilation-dir=/builds/wireshark/wireshark/build -resource-dir /usr/lib/llvm-22/lib/clang/22 -isystem /usr/include/glib-2.0 -isystem /usr/lib/x86_64-linux-gnu/glib-2.0/include -D CARES_NO_DEPRECATED -D G_DISABLE_DEPRECATED -D G_DISABLE_SINGLE_INCLUDES -D WS_BUILD_DLL -D WS_DEBUG -D WS_DEBUG_UTF_8 -I /builds/wireshark/wireshark/build -I /builds/wireshark/wireshark -I /builds/wireshark/wireshark/include -I /builds/wireshark/wireshark/build/epan/ftypes -I /builds/wireshark/wireshark/epan/ftypes -I /builds/wireshark/wireshark/epan -D _GLIBCXX_ASSERTIONS -internal-isystem /usr/lib/llvm-22/lib/clang/22/include -internal-isystem /usr/local/include -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/16/../../../../x86_64-linux-gnu/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -fmacro-prefix-map=/builds/wireshark/wireshark/= -fmacro-prefix-map=/builds/wireshark/wireshark/build/= -fmacro-prefix-map=../= -Wno-format-nonliteral -std=gnu17 -ferror-limit 19 -fvisibility=hidden -fwrapv -fwrapv-pointer -fstrict-flex-arrays=3 -stack-protector 2 -fstack-clash-protection -fcf-protection=full -fgnuc-version=4.2.1 -fskip-odr-check-in-gmf -fexceptions -fcolor-diagnostics -analyzer-output=html -faddrsig -fdwarf2-cfi-asm -o /builds/wireshark/wireshark/sbout/2026-07-20-100411-3661-1 -x c /builds/wireshark/wireshark/epan/ftypes/ftypes.c
1/*
2 * Wireshark - Network traffic analyzer
3 * By Gerald Combs <[email protected]>
4 * Copyright 2001 Gerald Combs
5 *
6 * SPDX-License-Identifier: GPL-2.0-or-later
7 */
8
9#include "config.h"
10
11#include "ftypes-int.h"
12
13#include <wsutil/ws_assert.h>
14
15/* Keep track of ftype_t's via their ftenum number */
16const ftype_t* type_list[FT_ENUM_SIZE + 1];
17
18/* Initialize the ftype module. */
19void
20ftypes_initialize(void)
21{
22 ftype_register_bytes();
23 ftype_register_double();
24 ftype_register_ieee_11073_float();
25 ftype_register_integers();
26 ftype_register_ipv4();
27 ftype_register_ipv6();
28 ftype_register_guid();
29 ftype_register_none();
30 ftype_register_string();
31 ftype_register_time();
32 ftype_register_tvbuff();
33}
34
35void
36ftypes_register_pseudofields(void)
37{
38 static int proto_ftypes;
39
40 proto_ftypes = proto_register_protocol("Wireshark Field/Fundamental Types", "Wireshark FTypes", "_ws.ftypes");
41
42 ftype_register_pseudofields_bytes(proto_ftypes);
43 ftype_register_pseudofields_double(proto_ftypes);
44 ftype_register_pseudofields_ieee_11073_float(proto_ftypes);
45 ftype_register_pseudofields_integer(proto_ftypes);
46 ftype_register_pseudofields_ipv4(proto_ftypes);
47 ftype_register_pseudofields_ipv6(proto_ftypes);
48 ftype_register_pseudofields_guid(proto_ftypes);
49 ftype_register_pseudofields_none(proto_ftypes);
50 ftype_register_pseudofields_string(proto_ftypes);
51 ftype_register_pseudofields_time(proto_ftypes);
52 ftype_register_pseudofields_tvbuff(proto_ftypes);
53
54 proto_set_cant_toggle(proto_ftypes);
55}
56
57/* Each ftype_t is registered via this function */
58void
59ftype_register(enum ftenum ftype, const ftype_t *ft)
60{
61 /* Check input */
62 ws_assert(ftype < FT_NUM_TYPES)do { if ((1) && !(ftype < FT_NUM_TYPES)) ws_log_fatal_full
("", LOG_LEVEL_ERROR, "epan/ftypes/ftypes.c", 62, __func__, "assertion failed: %s"
, "ftype < FT_NUM_TYPES"); } while (0)
;
63 ws_assert(ftype == ft->ftype)do { if ((1) && !(ftype == ft->ftype)) ws_log_fatal_full
("", LOG_LEVEL_ERROR, "epan/ftypes/ftypes.c", 63, __func__, "assertion failed: %s"
, "ftype == ft->ftype"); } while (0)
;
64
65 /* Don't re-register. */
66 ws_assert(type_list[ftype] == NULL)do { if ((1) && !(type_list[ftype] == ((void*)0))) ws_log_fatal_full
("", LOG_LEVEL_ERROR, "epan/ftypes/ftypes.c", 66, __func__, "assertion failed: %s"
, "type_list[ftype] == ((void*)0)"); } while (0)
;
67
68 type_list[ftype] = ft;
69}
70
71
72/* from README.dissector:
73 Note that the formats used must all belong to the same list as defined below:
74 - FT_INT8, FT_INT16, FT_INT24 and FT_INT32, FT_CHAR, FT_UINT8, FT_UINT16,
75 FT_UINT24, FT_UINT32, FT_IPXNET, FT_FRAMENUM, FT_INT40, FT_INT48, FT_INT56
76 FT_INT64, FT_UINT40, FT_UINT48, FT_UINT56 and FT_UINT64
77 - FT_ABSOLUTE_TIME and FT_RELATIVE_TIME
78 - FT_STRING, FT_STRINGZ, FT_UINT_STRING, FT_STRINGZPAD, FT_STRINGZTRUNC and FT_AX25
79 - FT_FLOAT, FT_DOUBLE, FT_IEEE_11073_SFLOAT and FT_IEEE_11073_FLOAT
80 - FT_BYTES, FT_UINT_BYTES, FT_ETHER, FT_VINES, FT_FCWWN and FT_EUI64
81 - FT_OID, FT_REL_OID and FT_SYSTEM_ID
82
83 We thus divide the types into equivalence classes of compatible types.
84 The same field abbreviation can be used by more than one field, even of
85 different types, so long as the types are compatible.
86
87 This function returns the canonical representative of a type. It can
88 be used to check if two fields are compatible.
89
90 XXX - Currently epan/dfilter/semcheck.c has its own implementation of
91 compatible types.
92*/
93static enum ftenum
94same_ftype(const enum ftenum ftype)
95{
96 switch (ftype) {
97 case FT_INT8:
98 case FT_INT16:
99 case FT_INT24:
100 case FT_INT32:
101 case FT_CHAR:
102 case FT_UINT8:
103 case FT_UINT16:
104 case FT_UINT24:
105 case FT_UINT32:
106 case FT_IPXNET:
107 case FT_FRAMENUM:
108 case FT_INT40:
109 case FT_INT48:
110 case FT_INT56:
111 case FT_INT64:
112 case FT_UINT40:
113 case FT_UINT48:
114 case FT_UINT56:
115 case FT_UINT64:
116 return FT_UINT64;
117
118 case FT_STRING:
119 case FT_STRINGZ:
120 case FT_UINT_STRING:
121 case FT_STRINGZPAD:
122 case FT_STRINGZTRUNC:
123 case FT_AX25:
124 return FT_STRING;
125
126 case FT_FLOAT:
127 case FT_DOUBLE:
128 return FT_DOUBLE;
129
130 case FT_BYTES:
131 case FT_UINT_BYTES:
132 case FT_ETHER:
133 case FT_VINES:
134 case FT_FCWWN:
135 case FT_EUI64:
136 return FT_BYTES;
137
138 case FT_OID:
139 case FT_REL_OID:
140 case FT_SYSTEM_ID:
141 /* XXX - dfilter/semcheck.c treats this group as compatible with BYTES */
142 return FT_OID;
143
144 /* XXX: the following are unique for now */
145 case FT_IPv4:
146 case FT_IPv6:
147 case FT_IEEE_11073_SFLOAT: /* XXX - should be able to compare with DOUBLE (#19011) */
148 case FT_IEEE_11073_FLOAT: /* XXX - should be able to compare with DOUBLE */
149
150 /* everything else is unique */
151 /* XXX - README.dissector claims the time types are compatible. */
152 default:
153 return ftype;
154 }
155}
156
157/* given two types, are they similar - for example can two
158 * duplicate fields be registered of these two types. */
159bool_Bool
160ftype_similar_types(const enum ftenum ftype_a, const enum ftenum ftype_b)
161{
162 return (same_ftype(ftype_a) == same_ftype(ftype_b));
163}
164
165/* Returns a string representing the name of the type. Useful
166 * for glossary production. */
167const char*
168ftype_name(enum ftenum ftype)
169{
170 const char *s = "(null)";
Value stored to 's' during its initialization is never read
171
172 switch (ftype) {
173 case FT_NONE: s = "FT_NONE"; break;
174 case FT_PROTOCOL: s = "FT_PROTOCOL"; break;
175 case FT_BOOLEAN: s = "FT_BOOLEAN"; break;
176 case FT_CHAR: s = "FT_CHAR"; break;
177 case FT_UINT8: s = "FT_UINT8"; break;
178 case FT_UINT16: s = "FT_UINT16"; break;
179 case FT_UINT24: s = "FT_UINT24"; break;
180 case FT_UINT32: s = "FT_UINT32"; break;
181 case FT_UINT40: s = "FT_UINT40"; break;
182 case FT_UINT48: s = "FT_UINT48"; break;
183 case FT_UINT56: s = "FT_UINT56"; break;
184 case FT_UINT64: s = "FT_UINT64"; break;
185 case FT_INT8: s = "FT_INT8"; break;
186 case FT_INT16: s = "FT_INT16"; break;
187 case FT_INT24: s = "FT_INT24"; break;
188 case FT_INT32: s = "FT_INT32"; break;
189 case FT_INT40: s = "FT_INT40"; break;
190 case FT_INT48: s = "FT_INT48"; break;
191 case FT_INT56: s = "FT_INT56"; break;
192 case FT_INT64: s = "FT_INT64"; break;
193 case FT_IEEE_11073_SFLOAT: s = "FT_IEEE_11073_SFLOAT"; break;
194 case FT_IEEE_11073_FLOAT: s = "FT_IEEE_11073_FLOAT"; break;
195 case FT_FLOAT: s = "FT_FLOAT"; break;
196 case FT_DOUBLE: s = "FT_DOUBLE"; break;
197 case FT_ABSOLUTE_TIME: s = "FT_ABSOLUTE_TIME"; break;
198 case FT_RELATIVE_TIME: s = "FT_RELATIVE_TIME"; break;
199 case FT_STRING: s = "FT_STRING"; break;
200 case FT_STRINGZ: s = "FT_STRINGZ"; break;
201 case FT_UINT_STRING: s = "FT_UINT_STRING"; break;
202 case FT_ETHER: s = "FT_ETHER"; break;
203 case FT_BYTES: s = "FT_BYTES"; break;
204 case FT_UINT_BYTES: s = "FT_UINT_BYTES"; break;
205 case FT_IPv4: s = "FT_IPv4"; break;
206 case FT_IPv6: s = "FT_IPv6"; break;
207 case FT_IPXNET: s = "FT_IPXNET"; break;
208 case FT_FRAMENUM: s = "FT_FRAMENUM"; break;
209 case FT_GUID: s = "FT_GUID"; break;
210 case FT_OID: s = "FT_OID"; break;
211 case FT_EUI64: s = "FT_EUI64"; break;
212 case FT_AX25: s = "FT_AX25"; break;
213 case FT_VINES: s = "FT_VINES"; break;
214 case FT_REL_OID: s = "FT_REL_OID"; break;
215 case FT_SYSTEM_ID: s = "FT_SYSTEM_ID"; break;
216 case FT_STRINGZPAD: s = "FT_STRINGZPAD"; break;
217 case FT_FCWWN: s = "FT_FCWWN"; break;
218 case FT_STRINGZTRUNC: s = "FT_STRINGZTRUNC"; break;
219 case FT_NUM_TYPES: s = "FT_NUM_TYPES"; break;
220 case FT_SCALAR: s = "FT_SCALAR"; break;
221 }
222 return s;
223}
224
225const char*
226ftype_pretty_name(enum ftenum ftype)
227{
228 const char *s = "(null)";
229
230 switch (ftype) {
231 case FT_NONE: s = "Label"; break;
232 case FT_PROTOCOL: s = "Protocol"; break;
233 case FT_BOOLEAN: s = "Boolean"; break;
234 case FT_CHAR: s = "Character (8 bits)"; break;
235 case FT_UINT8: s = "Unsigned integer (8 bits)"; break;
236 case FT_UINT16: s = "Unsigned integer (16 bits)"; break;
237 case FT_UINT24: s = "Unsigned integer (24 bits)"; break;
238 case FT_UINT32: s = "Unsigned integer (32 bits)"; break;
239 case FT_UINT40: s = "Unsigned integer (40 bits)"; break;
240 case FT_UINT48: s = "Unsigned integer (48 bits)"; break;
241 case FT_UINT56: s = "Unsigned integer (56 bits)"; break;
242 case FT_UINT64: s = "Unsigned integer (64 bits)"; break;
243 case FT_INT8: s = "Signed integer (8 bits)"; break;
244 case FT_INT16: s = "Signed integer (16 bits)"; break;
245 case FT_INT24: s = "Signed integer (24 bits)"; break;
246 case FT_INT32: s = "Signed integer (32 bits)"; break;
247 case FT_INT40: s = "Signed integer (40 bits)"; break;
248 case FT_INT48: s = "Signed integer (48 bits)"; break;
249 case FT_INT56: s = "Signed integer (56 bits)"; break;
250 case FT_INT64: s = "Signed integer (64 bits)"; break;
251 case FT_IEEE_11073_SFLOAT: s = "IEEE-11073 floating point (16-bit)"; break;
252 case FT_IEEE_11073_FLOAT: s = "IEEE-11073 Floating point (32-bit)"; break;
253 case FT_FLOAT: s = "Floating point (single-precision)"; break;
254 case FT_DOUBLE: s = "Floating point (double-precision)"; break;
255 case FT_ABSOLUTE_TIME: s = "Date and time"; break;
256 case FT_RELATIVE_TIME: s = "Time offset"; break;
257 case FT_STRING: s = "Character string"; break;
258 case FT_STRINGZ: s = "Character string"; break;
259 case FT_UINT_STRING: s = "Character string"; break;
260 case FT_ETHER: s = "Ethernet or other MAC address"; break;
261 case FT_BYTES: s = "Byte sequence"; break;
262 case FT_UINT_BYTES: s = "Byte sequence"; break;
263 case FT_IPv4: s = "IPv4 address"; break;
264 case FT_IPv6: s = "IPv6 address"; break;
265 case FT_IPXNET: s = "IPX network number"; break;
266 case FT_FRAMENUM: s = "Frame number"; break;
267 case FT_GUID: s = "Globally Unique Identifier"; break;
268 case FT_OID: s = "ASN.1 object identifier"; break;
269 case FT_EUI64: s = "EUI64 address"; break;
270 case FT_AX25: s = "AX.25 address"; break;
271 case FT_VINES: s = "VINES address"; break;
272 case FT_REL_OID: s = "ASN.1 relative object identifier"; break;
273 case FT_SYSTEM_ID: s = "OSI System-ID"; break;
274 case FT_STRINGZPAD: s = "Character string"; break;
275 case FT_FCWWN: s = "Fibre Channel WWN"; break;
276 case FT_STRINGZTRUNC: s = "Character string"; break;
277 case FT_NUM_TYPES: s = "(num types)"; break;
278 case FT_SCALAR: s = "Scalar"; break;
279 }
280 return s;
281}
282
283int
284ftype_wire_size(enum ftenum ftype)
285{
286 const ftype_t *ft;
287
288 FTYPE_LOOKUP(ftype, ft)do { if ((1) && !(ftype < FT_NUM_TYPES)) ws_log_fatal_full
("", LOG_LEVEL_ERROR, "epan/ftypes/ftypes.c", 288, __func__, "assertion failed: %s"
, "ftype < FT_NUM_TYPES"); } while (0); ft = type_list[ftype
];
;
289 return ft->wire_size;
290}
291
292bool_Bool
293ftype_can_length(enum ftenum ftype)
294{
295 const ftype_t *ft;
296
297 FTYPE_LOOKUP(ftype, ft)do { if ((1) && !(ftype < FT_NUM_TYPES)) ws_log_fatal_full
("", LOG_LEVEL_ERROR, "epan/ftypes/ftypes.c", 297, __func__, "assertion failed: %s"
, "ftype < FT_NUM_TYPES"); } while (0); ft = type_list[ftype
];
;
298 return ft->len ? true1 : false0;
299}
300
301bool_Bool
302ftype_can_slice(enum ftenum ftype)
303{
304 const ftype_t *ft;
305
306 FTYPE_LOOKUP(ftype, ft)do { if ((1) && !(ftype < FT_NUM_TYPES)) ws_log_fatal_full
("", LOG_LEVEL_ERROR, "epan/ftypes/ftypes.c", 306, __func__, "assertion failed: %s"
, "ftype < FT_NUM_TYPES"); } while (0); ft = type_list[ftype
];
;
307 return ft->slice ? true1 : false0;
308}
309
310bool_Bool
311ftype_can_eq(enum ftenum ftype)
312{
313 const ftype_t *ft;
314
315 FTYPE_LOOKUP(ftype, ft)do { if ((1) && !(ftype < FT_NUM_TYPES)) ws_log_fatal_full
("", LOG_LEVEL_ERROR, "epan/ftypes/ftypes.c", 315, __func__, "assertion failed: %s"
, "ftype < FT_NUM_TYPES"); } while (0); ft = type_list[ftype
];
;
316 return ft->compare != NULL((void*)0);
317}
318
319bool_Bool
320ftype_can_cmp(enum ftenum ftype)
321{
322 const ftype_t *ft;
323
324 FTYPE_LOOKUP(ftype, ft)do { if ((1) && !(ftype < FT_NUM_TYPES)) ws_log_fatal_full
("", LOG_LEVEL_ERROR, "epan/ftypes/ftypes.c", 324, __func__, "assertion failed: %s"
, "ftype < FT_NUM_TYPES"); } while (0); ft = type_list[ftype
];
;
325 return ft->compare != NULL((void*)0);
326}
327
328bool_Bool
329ftype_can_bitwise_and(enum ftenum ftype)
330{
331 const ftype_t *ft;
332
333 FTYPE_LOOKUP(ftype, ft)do { if ((1) && !(ftype < FT_NUM_TYPES)) ws_log_fatal_full
("", LOG_LEVEL_ERROR, "epan/ftypes/ftypes.c", 333, __func__, "assertion failed: %s"
, "ftype < FT_NUM_TYPES"); } while (0); ft = type_list[ftype
];
;
334 return ft->bitwise_and ? true1 : false0;
335}
336
337bool_Bool
338ftype_can_unary_minus(enum ftenum ftype)
339{
340 const ftype_t *ft;
341
342 FTYPE_LOOKUP(ftype, ft)do { if ((1) && !(ftype < FT_NUM_TYPES)) ws_log_fatal_full
("", LOG_LEVEL_ERROR, "epan/ftypes/ftypes.c", 342, __func__, "assertion failed: %s"
, "ftype < FT_NUM_TYPES"); } while (0); ft = type_list[ftype
];
;
343 return ft->unary_minus != NULL((void*)0);
344}
345
346bool_Bool
347ftype_can_add(enum ftenum ftype)
348{
349 const ftype_t *ft;
350
351 FTYPE_LOOKUP(ftype, ft)do { if ((1) && !(ftype < FT_NUM_TYPES)) ws_log_fatal_full
("", LOG_LEVEL_ERROR, "epan/ftypes/ftypes.c", 351, __func__, "assertion failed: %s"
, "ftype < FT_NUM_TYPES"); } while (0); ft = type_list[ftype
];
;
352 return ft->add != NULL((void*)0);
353}
354
355bool_Bool
356ftype_can_subtract(enum ftenum ftype)
357{
358 const ftype_t *ft;
359
360 FTYPE_LOOKUP(ftype, ft)do { if ((1) && !(ftype < FT_NUM_TYPES)) ws_log_fatal_full
("", LOG_LEVEL_ERROR, "epan/ftypes/ftypes.c", 360, __func__, "assertion failed: %s"
, "ftype < FT_NUM_TYPES"); } while (0); ft = type_list[ftype
];
;
361 return ft->subtract != NULL((void*)0);
362}
363
364bool_Bool
365ftype_can_multiply(enum ftenum ftype)
366{
367 const ftype_t *ft;
368
369 FTYPE_LOOKUP(ftype, ft)do { if ((1) && !(ftype < FT_NUM_TYPES)) ws_log_fatal_full
("", LOG_LEVEL_ERROR, "epan/ftypes/ftypes.c", 369, __func__, "assertion failed: %s"
, "ftype < FT_NUM_TYPES"); } while (0); ft = type_list[ftype
];
;
370 return ft->multiply != NULL((void*)0);
371}
372
373bool_Bool
374ftype_can_divide(enum ftenum ftype)
375{
376 const ftype_t *ft;
377
378 FTYPE_LOOKUP(ftype, ft)do { if ((1) && !(ftype < FT_NUM_TYPES)) ws_log_fatal_full
("", LOG_LEVEL_ERROR, "epan/ftypes/ftypes.c", 378, __func__, "assertion failed: %s"
, "ftype < FT_NUM_TYPES"); } while (0); ft = type_list[ftype
];
;
379 return ft->divide != NULL((void*)0);
380}
381
382bool_Bool
383ftype_can_modulo(enum ftenum ftype)
384{
385 const ftype_t *ft;
386
387 FTYPE_LOOKUP(ftype, ft)do { if ((1) && !(ftype < FT_NUM_TYPES)) ws_log_fatal_full
("", LOG_LEVEL_ERROR, "epan/ftypes/ftypes.c", 387, __func__, "assertion failed: %s"
, "ftype < FT_NUM_TYPES"); } while (0); ft = type_list[ftype
];
;
388 return ft->modulo != NULL((void*)0);
389}
390
391bool_Bool
392ftype_can_contains(enum ftenum ftype)
393{
394 const ftype_t *ft;
395
396 FTYPE_LOOKUP(ftype, ft)do { if ((1) && !(ftype < FT_NUM_TYPES)) ws_log_fatal_full
("", LOG_LEVEL_ERROR, "epan/ftypes/ftypes.c", 396, __func__, "assertion failed: %s"
, "ftype < FT_NUM_TYPES"); } while (0); ft = type_list[ftype
];
;
397 return ft->contains ? true1 : false0;
398}
399
400bool_Bool
401ftype_can_matches(enum ftenum ftype)
402{
403 const ftype_t *ft;
404
405 FTYPE_LOOKUP(ftype, ft)do { if ((1) && !(ftype < FT_NUM_TYPES)) ws_log_fatal_full
("", LOG_LEVEL_ERROR, "epan/ftypes/ftypes.c", 405, __func__, "assertion failed: %s"
, "ftype < FT_NUM_TYPES"); } while (0); ft = type_list[ftype
];
;
406 return ft->matches ? true1 : false0;
407}
408
409bool_Bool
410ftype_can_is_zero(enum ftenum ftype)
411{
412 const ftype_t *ft;
413
414 FTYPE_LOOKUP(ftype, ft)do { if ((1) && !(ftype < FT_NUM_TYPES)) ws_log_fatal_full
("", LOG_LEVEL_ERROR, "epan/ftypes/ftypes.c", 414, __func__, "assertion failed: %s"
, "ftype < FT_NUM_TYPES"); } while (0); ft = type_list[ftype
];
;
415 return ft->is_zero ? true1 : false0;
416}
417
418bool_Bool
419ftype_can_is_negative(enum ftenum ftype)
420{
421 const ftype_t *ft;
422
423 FTYPE_LOOKUP(ftype, ft)do { if ((1) && !(ftype < FT_NUM_TYPES)) ws_log_fatal_full
("", LOG_LEVEL_ERROR, "epan/ftypes/ftypes.c", 423, __func__, "assertion failed: %s"
, "ftype < FT_NUM_TYPES"); } while (0); ft = type_list[ftype
];
;
424 return ft->is_negative ? true1 : false0;
425}
426
427bool_Bool
428ftype_can_is_nan(enum ftenum ftype)
429{
430 const ftype_t *ft;
431
432 FTYPE_LOOKUP(ftype, ft)do { if ((1) && !(ftype < FT_NUM_TYPES)) ws_log_fatal_full
("", LOG_LEVEL_ERROR, "epan/ftypes/ftypes.c", 432, __func__, "assertion failed: %s"
, "ftype < FT_NUM_TYPES"); } while (0); ft = type_list[ftype
];
;
433 return ft->is_nan ? true1 : false0;
434}
435
436bool_Bool
437ftype_can_val_to_sinteger(enum ftenum ftype)
438{
439 const ftype_t *ft;
440
441 FTYPE_LOOKUP(ftype, ft)do { if ((1) && !(ftype < FT_NUM_TYPES)) ws_log_fatal_full
("", LOG_LEVEL_ERROR, "epan/ftypes/ftypes.c", 441, __func__, "assertion failed: %s"
, "ftype < FT_NUM_TYPES"); } while (0); ft = type_list[ftype
];
;
442 /* We first convert to 64 bit and then check for overflow. */
443 return ft->val_to_sinteger64 ? true1 : false0;
444}
445
446bool_Bool
447ftype_can_val_to_uinteger(enum ftenum ftype)
448{
449 const ftype_t *ft;
450
451 FTYPE_LOOKUP(ftype, ft)do { if ((1) && !(ftype < FT_NUM_TYPES)) ws_log_fatal_full
("", LOG_LEVEL_ERROR, "epan/ftypes/ftypes.c", 451, __func__, "assertion failed: %s"
, "ftype < FT_NUM_TYPES"); } while (0); ft = type_list[ftype
];
;
452 /* We first convert to 64 bit and then check for overflow. */
453 return ft->val_to_uinteger64 ? true1 : false0;
454}
455
456bool_Bool
457ftype_can_val_to_sinteger64(enum ftenum ftype)
458{
459 const ftype_t *ft;
460
461 FTYPE_LOOKUP(ftype, ft)do { if ((1) && !(ftype < FT_NUM_TYPES)) ws_log_fatal_full
("", LOG_LEVEL_ERROR, "epan/ftypes/ftypes.c", 461, __func__, "assertion failed: %s"
, "ftype < FT_NUM_TYPES"); } while (0); ft = type_list[ftype
];
;
462 return ft->val_to_sinteger64 ? true1 : false0;
463}
464
465bool_Bool
466ftype_can_val_to_uinteger64(enum ftenum ftype)
467{
468 const ftype_t *ft;
469
470 FTYPE_LOOKUP(ftype, ft)do { if ((1) && !(ftype < FT_NUM_TYPES)) ws_log_fatal_full
("", LOG_LEVEL_ERROR, "epan/ftypes/ftypes.c", 470, __func__, "assertion failed: %s"
, "ftype < FT_NUM_TYPES"); } while (0); ft = type_list[ftype
];
;
471 return ft->val_to_uinteger64 ? true1 : false0;
472}
473
474bool_Bool
475ftype_can_val_to_double(enum ftenum ftype)
476{
477 const ftype_t *ft;
478
479 FTYPE_LOOKUP(ftype, ft)do { if ((1) && !(ftype < FT_NUM_TYPES)) ws_log_fatal_full
("", LOG_LEVEL_ERROR, "epan/ftypes/ftypes.c", 479, __func__, "assertion failed: %s"
, "ftype < FT_NUM_TYPES"); } while (0); ft = type_list[ftype
];
;
480 /* We first convert to 64 bit and then check for overflow. */
481 return ft->val_to_double ? true1 : false0;
482}
483
484/* ---------------------------------------------------------- */
485
486/* Allocate and initialize an fvalue_t, given an ftype using a GSlice. */
487fvalue_t*
488fvalue_new(ftenum_t ftype)
489{
490 fvalue_t *fv;
491
492 fv = g_slice_new(fvalue_t)((fvalue_t*) g_slice_alloc ((sizeof (fvalue_t) > 0 ? sizeof
(fvalue_t) : 1)))
;
493 fvalue_init(fv, ftype);
494
495 return fv;
496}
497
498/* Allocate and initialize an fvalue_t, given an ftype using wmem. */
499fvalue_t *
500fvalue_new_pool(wmem_allocator_t *scope, ftenum_t ftype)
501{
502 fvalue_t *fv;
503
504 fv = wmem_new(scope, fvalue_t)((fvalue_t*)wmem_alloc((scope), sizeof(fvalue_t)));
505 fvalue_init(fv, ftype);
506
507 return fv;
508}
509
510fvalue_t*
511fvalue_dup(const fvalue_t *fv_orig)
512{
513 fvalue_t *fv_new;
514 FvalueCopyFunc copy_value;
515
516 fv_new = g_slice_new(fvalue_t)((fvalue_t*) g_slice_alloc ((sizeof (fvalue_t) > 0 ? sizeof
(fvalue_t) : 1)))
;
517 fv_new->ftype = fv_orig->ftype;
518 copy_value = fv_new->ftype->copy_value;
519 if (copy_value != NULL((void*)0)) {
520 /* deep copy */
521 copy_value(fv_new, fv_orig);
522 }
523 else {
524 /* shallow copy */
525 memcpy(&fv_new->value, &fv_orig->value, sizeof(fv_orig->value));
526 }
527
528 return fv_new;
529}
530
531void
532fvalue_init(fvalue_t *fv, ftenum_t ftype)
533{
534 const ftype_t *ft;
535 FvalueNewFunc new_value;
536
537 FTYPE_LOOKUP(ftype, ft)do { if ((1) && !(ftype < FT_NUM_TYPES)) ws_log_fatal_full
("", LOG_LEVEL_ERROR, "epan/ftypes/ftypes.c", 537, __func__, "assertion failed: %s"
, "ftype < FT_NUM_TYPES"); } while (0); ft = type_list[ftype
];
;
538 fv->ftype = ft;
539
540 new_value = ft->new_value;
541 if (new_value) {
542 new_value(fv);
543 }
544}
545
546void
547fvalue_cleanup(fvalue_t *fv)
548{
549 if (!fv->ftype->free_value)
550 return;
551 fv->ftype->free_value(fv);
552}
553
554void
555fvalue_free(fvalue_t *fv)
556{
557 fvalue_cleanup(fv);
558 g_slice_free(fvalue_t, fv)do { if (1) g_slice_free1 (sizeof (fvalue_t), (fv)); else (void
) ((fvalue_t*) 0 == (fv)); } while (0)
;
559}
560
561fvalue_t*
562fvalue_from_literal(ftenum_t ftype, const char *s, bool_Bool allow_partial_value, char **err_msg)
563{
564 fvalue_t *fv;
565 bool_Bool ok = false0;
566
567 fv = fvalue_new(ftype);
568 if (fv->ftype->val_from_literal) {
569 ok = fv->ftype->val_from_literal(fv, s, allow_partial_value, err_msg);
570 }
571 if (ok) {
572 /* Success */
573 if (err_msg != NULL((void*)0))
574 *err_msg = NULL((void*)0);
575 return fv;
576 }
577 else {
578 if (err_msg != NULL((void*)0) && *err_msg == NULL((void*)0)) {
579 *err_msg = ws_strdup_printf("\"%s\" cannot be converted to %s.",wmem_strdup_printf(((void*)0), "\"%s\" cannot be converted to %s."
, s, ftype_pretty_name(ftype))
580 s, ftype_pretty_name(ftype))wmem_strdup_printf(((void*)0), "\"%s\" cannot be converted to %s."
, s, ftype_pretty_name(ftype))
;
581 }
582 }
583 fvalue_free(fv);
584 return NULL((void*)0);
585}
586
587fvalue_t*
588fvalue_from_string(ftenum_t ftype, const char *str, size_t len, char **err_msg)
589{
590 fvalue_t *fv;
591
592 fv = fvalue_new(ftype);
593 if (fv->ftype->val_from_string && fv->ftype->val_from_string(fv, str, len, err_msg)) {
594 /* Success */
595 if (err_msg != NULL((void*)0))
596 *err_msg = NULL((void*)0);
597 return fv;
598 }
599 else {
600 if (err_msg != NULL((void*)0) && *err_msg == NULL((void*)0)) {
601 *err_msg = ws_strdup_printf("%s cannot be converted from a string (\"%s\").",wmem_strdup_printf(((void*)0), "%s cannot be converted from a string (\"%s\")."
, ftype_pretty_name(ftype), str)
602 ftype_pretty_name(ftype), str)wmem_strdup_printf(((void*)0), "%s cannot be converted from a string (\"%s\")."
, ftype_pretty_name(ftype), str)
;
603 }
604 }
605 fvalue_free(fv);
606 return NULL((void*)0);
607}
608
609fvalue_t*
610fvalue_from_charconst(ftenum_t ftype, unsigned long num, char **err_msg)
611{
612 fvalue_t *fv;
613
614 fv = fvalue_new(ftype);
615 if (fv->ftype->val_from_charconst && fv->ftype->val_from_charconst(fv, num, err_msg)) {
616 /* Success */
617 if (err_msg != NULL((void*)0))
618 *err_msg = NULL((void*)0);
619 return fv;
620 }
621 else {
622 if (err_msg != NULL((void*)0) && *err_msg == NULL((void*)0)) {
623 if (num <= 0x7f && g_ascii_isprint(num)((g_ascii_table[(guchar) (num)] & G_ASCII_PRINT) != 0)) {
624 *err_msg = ws_strdup_printf("Character constant '%c' (0x%lx) cannot be converted to %s.",wmem_strdup_printf(((void*)0), "Character constant '%c' (0x%lx) cannot be converted to %s."
, (int)num, num, ftype_pretty_name(ftype))
625 (int)num, num, ftype_pretty_name(ftype))wmem_strdup_printf(((void*)0), "Character constant '%c' (0x%lx) cannot be converted to %s."
, (int)num, num, ftype_pretty_name(ftype))
;
626 }
627 else {
628 *err_msg = ws_strdup_printf("Character constant 0x%lx cannot be converted to %s.",wmem_strdup_printf(((void*)0), "Character constant 0x%lx cannot be converted to %s."
, num, ftype_pretty_name(ftype))
629 num, ftype_pretty_name(ftype))wmem_strdup_printf(((void*)0), "Character constant 0x%lx cannot be converted to %s."
, num, ftype_pretty_name(ftype))
;
630 }
631 }
632 }
633 fvalue_free(fv);
634 return NULL((void*)0);
635}
636
637fvalue_t*
638fvalue_from_sinteger64(ftenum_t ftype, const char *s, int64_t num, char **err_msg)
639{
640 fvalue_t *fv;
641
642 fv = fvalue_new(ftype);
643 if (fv->ftype->val_from_sinteger64 && fv->ftype->val_from_sinteger64(fv, s, num, err_msg)) {
644 /* Success */
645 if (err_msg != NULL((void*)0))
646 *err_msg = NULL((void*)0);
647 return fv;
648 }
649 else {
650 if (err_msg != NULL((void*)0) && *err_msg == NULL((void*)0)) {
651 *err_msg = ws_strdup_printf("Integer %"PRId64" cannot be converted to %s.",wmem_strdup_printf(((void*)0), "Integer %""l" "d"" cannot be converted to %s."
, num, ftype_pretty_name(ftype))
652 num, ftype_pretty_name(ftype))wmem_strdup_printf(((void*)0), "Integer %""l" "d"" cannot be converted to %s."
, num, ftype_pretty_name(ftype))
;
653 }
654 }
655 fvalue_free(fv);
656 return NULL((void*)0);
657}
658
659fvalue_t*
660fvalue_from_uinteger64(ftenum_t ftype, const char *s, uint64_t num, char **err_msg)
661{
662 fvalue_t *fv;
663
664 fv = fvalue_new(ftype);
665 if (fv->ftype->val_from_uinteger64 && fv->ftype->val_from_uinteger64(fv, s, num, err_msg)) {
666 /* Success */
667 if (err_msg != NULL((void*)0))
668 *err_msg = NULL((void*)0);
669 return fv;
670 }
671 else {
672 if (err_msg != NULL((void*)0) && *err_msg == NULL((void*)0)) {
673 *err_msg = ws_strdup_printf("Unsigned integer %"PRIu64" cannot be converted to %s.",wmem_strdup_printf(((void*)0), "Unsigned integer %""l" "u"" cannot be converted to %s."
, num, ftype_pretty_name(ftype))
674 num, ftype_pretty_name(ftype))wmem_strdup_printf(((void*)0), "Unsigned integer %""l" "u"" cannot be converted to %s."
, num, ftype_pretty_name(ftype))
;
675 }
676 }
677 fvalue_free(fv);
678 return NULL((void*)0);
679}
680
681fvalue_t*
682fvalue_from_floating(ftenum_t ftype, const char *s, double num, char **err_msg)
683{
684 fvalue_t *fv;
685
686 fv = fvalue_new(ftype);
687 if (fv->ftype->val_from_double && fv->ftype->val_from_double(fv, s, num, err_msg)) {
688 /* Success */
689 if (err_msg != NULL((void*)0))
690 *err_msg = NULL((void*)0);
691 return fv;
692 }
693 else {
694 if (err_msg != NULL((void*)0) && *err_msg == NULL((void*)0)) {
695 *err_msg = ws_strdup_printf("Double %g cannot be converted to %s.",wmem_strdup_printf(((void*)0), "Double %g cannot be converted to %s."
, num, ftype_pretty_name(ftype))
696 num, ftype_pretty_name(ftype))wmem_strdup_printf(((void*)0), "Double %g cannot be converted to %s."
, num, ftype_pretty_name(ftype))
;
697 }
698 }
699 fvalue_free(fv);
700 return NULL((void*)0);
701}
702
703ftenum_t
704fvalue_type_ftenum(const fvalue_t *fv)
705{
706 return fv->ftype->ftype;
707}
708
709const char*
710fvalue_type_name(const fvalue_t *fv)
711{
712 return ftype_name(fv->ftype->ftype);
713}
714
715
716size_t
717fvalue_length2(fvalue_t *fv)
718{
719 if (!fv->ftype->len) {
720 ws_critical("fv->ftype->len is NULL")do { if (1) { ws_log_full("", LOG_LEVEL_CRITICAL, "epan/ftypes/ftypes.c"
, 720, __func__, "fv->ftype->len is NULL"); } } while (
0)
;
721 return 0;
722 }
723 return fv->ftype->len(fv);
724}
725
726char *
727fvalue_to_string_repr(wmem_allocator_t *scope, const fvalue_t *fv, ftrepr_t rtype, int field_display)
728{
729 if (fv->ftype->val_to_string_repr == NULL((void*)0)) {
730 /* no value-to-string-representation function, so the value cannot be represented */
731 return NULL((void*)0);
732 }
733
734 return fv->ftype->val_to_string_repr(scope, fv, rtype, field_display);
735}
736
737enum ft_result
738fvalue_to_uinteger(const fvalue_t *fv, uint32_t *repr)
739{
740 uint64_t val;
741 enum ft_result res = fv->ftype->val_to_uinteger64(fv, &val);
742 if (res != FT_OK)
743 return res;
744 if (val > UINT32_MAX(4294967295U))
745 return FT_OVERFLOW;
746
747 *repr = (uint32_t)val;
748 return FT_OK;
749}
750
751enum ft_result
752fvalue_to_sinteger(const fvalue_t *fv, int32_t *repr)
753{
754 int64_t val;
755 enum ft_result res = fv->ftype->val_to_sinteger64(fv, &val);
756 if (res != FT_OK)
757 return res;
758 if (val > INT32_MAX(2147483647))
759 return FT_OVERFLOW;
760 if (val < INT32_MIN(-2147483647-1))
761 return FT_UNDERFLOW;
762
763 *repr = (int32_t)val;
764 return FT_OK;
765}
766
767enum ft_result
768fvalue_to_uinteger64(const fvalue_t *fv, uint64_t *repr)
769{
770 if (!fv->ftype->val_to_uinteger64) {
771 return FT_BADARG;
772 }
773 return fv->ftype->val_to_uinteger64(fv, repr);
774}
775
776enum ft_result
777fvalue_to_sinteger64(const fvalue_t *fv, int64_t *repr)
778{
779 if (!fv->ftype->val_to_sinteger64) {
780 return FT_BADARG;
781 }
782 return fv->ftype->val_to_sinteger64(fv, repr);
783}
784
785enum ft_result
786fvalue_to_double(const fvalue_t *fv, double *repr)
787{
788 /* We should be able to test this earlier (e.g., in semantic check)
789 * but there are non-compatible fields that share the same abbrev
790 * so we have to check it on each fvalue.
791 */
792 if (!fv->ftype->val_to_double) {
793 return FT_BADARG;
794 }
795 return fv->ftype->val_to_double(fv, repr);
796}
797
798typedef struct {
799 fvalue_t *fv;
800 void *ptr;
801 bool_Bool slice_failure;
802} slice_data_t;
803
804static bool_Bool
805compute_drnode(size_t field_length, drange_node *drnode, size_t *offset_ptr, size_t *length_ptr)
806{
807 ssize_t start_offset;
808 ssize_t length = 0;
809 ssize_t end_offset = 0;
810 drange_node_end_t ending;
811
812 start_offset = drange_node_get_start_offset(drnode);
813 ending = drange_node_get_ending(drnode);
814
815 /* Check for negative start */
816 if (start_offset < 0) {
817 start_offset = field_length + start_offset;
818 if (start_offset < 0) {
819 return false0;
820 }
821 }
822
823 /* Check the end type and set the length */
824
825 if (ending == DRANGE_NODE_END_T_TO_THE_END) {
826 length = field_length - start_offset;
827 if (length <= 0) {
828 return false0;
829 }
830 }
831 else if (ending == DRANGE_NODE_END_T_LENGTH) {
832 length = drange_node_get_length(drnode);
833 if (start_offset + length > (int) field_length) {
834 return false0;
835 }
836 }
837 else if (ending == DRANGE_NODE_END_T_OFFSET) {
838 end_offset = drange_node_get_end_offset(drnode);
839 if (end_offset < 0) {
840 end_offset = field_length + end_offset;
841 if (end_offset < start_offset) {
842 return false0;
843 }
844 } else if (end_offset >= (int) field_length) {
845 return false0;
846 }
847 length = end_offset - start_offset + 1;
848 }
849 else {
850 ws_assert_not_reached()ws_log_fatal_full("", LOG_LEVEL_ERROR, "epan/ftypes/ftypes.c"
, 850, __func__, "assertion \"not reached\" failed")
;
851 }
852
853 *offset_ptr = start_offset;
854 *length_ptr = length;
855 return true1;
856}
857
858static void
859slice_func(void * data, void * user_data)
860{
861 drange_node *drnode = (drange_node *)data;
862 slice_data_t *slice_data = (slice_data_t *)user_data;
863 size_t start_offset;
864 size_t length = 0;
865 fvalue_t *fv;
866
867 if (slice_data->slice_failure) {
868 return;
869 }
870
871 fv = slice_data->fv;
872 if (!compute_drnode((unsigned)fvalue_length2(fv), drnode, &start_offset, &length)) {
873 slice_data->slice_failure = true1;
874 return;
875 }
876
877 ws_assert(length > 0)do { if ((1) && !(length > 0)) ws_log_fatal_full(""
, LOG_LEVEL_ERROR, "epan/ftypes/ftypes.c", 877, __func__, "assertion failed: %s"
, "length > 0"); } while (0)
;
878 fv->ftype->slice(fv, slice_data->ptr, (unsigned)start_offset, (unsigned)length);
879}
880
881static fvalue_t *
882slice_string(fvalue_t *fv, drange_t *d_range)
883{
884 slice_data_t slice_data;
885 fvalue_t *new_fv;
886
887 slice_data.fv = fv;
888 slice_data.ptr = wmem_strbuf_create(NULL)wmem_strbuf_new(((void*)0), "");
889 slice_data.slice_failure = false0;
890
891 /* XXX - We could make some optimizations here based on
892 * drange_has_total_length() and
893 * drange_get_max_offset().
894 */
895
896 drange_foreach_drange_node(d_range, slice_func, &slice_data);
897
898 new_fv = fvalue_new(FT_STRING);
899 fvalue_set_strbuf(new_fv, slice_data.ptr);
900 return new_fv;
901}
902
903static fvalue_t *
904slice_bytes(fvalue_t *fv, drange_t *d_range)
905{
906 slice_data_t slice_data;
907 fvalue_t *new_fv;
908
909 slice_data.fv = fv;
910 slice_data.ptr = g_byte_array_new();
911 slice_data.slice_failure = false0;
912
913 /* XXX - We could make some optimizations here based on
914 * drange_has_total_length() and
915 * drange_get_max_offset().
916 */
917
918 drange_foreach_drange_node(d_range, slice_func, &slice_data);
919
920 new_fv = fvalue_new(FT_BYTES);
921 fvalue_set_byte_array(new_fv, slice_data.ptr);
922 return new_fv;
923}
924
925/* Returns a new slice fvalue_t* if possible, otherwise NULL */
926fvalue_t*
927fvalue_slice(fvalue_t *fv, drange_t *d_range)
928{
929 if (FT_IS_STRING(fvalue_type_ftenum(fv))((fvalue_type_ftenum(fv)) == FT_STRING || (fvalue_type_ftenum
(fv)) == FT_STRINGZ || (fvalue_type_ftenum(fv)) == FT_STRINGZPAD
|| (fvalue_type_ftenum(fv)) == FT_STRINGZTRUNC || (fvalue_type_ftenum
(fv)) == FT_UINT_STRING || (fvalue_type_ftenum(fv)) == FT_AX25
)
) {
930 return slice_string(fv, d_range);
931 }
932 return slice_bytes(fv, d_range);
933}
934
935void
936fvalue_set_bytes(fvalue_t *fv, GBytes *value)
937{
938 ws_assert(fv->ftype->ftype == FT_BYTES ||do { if ((1) && !(fv->ftype->ftype == FT_BYTES ||
fv->ftype->ftype == FT_UINT_BYTES || fv->ftype->
ftype == FT_OID || fv->ftype->ftype == FT_REL_OID || fv
->ftype->ftype == FT_SYSTEM_ID || fv->ftype->ftype
== FT_VINES || fv->ftype->ftype == FT_ETHER || fv->
ftype->ftype == FT_EUI64 || fv->ftype->ftype == FT_FCWWN
)) ws_log_fatal_full("", LOG_LEVEL_ERROR, "epan/ftypes/ftypes.c"
, 946, __func__, "assertion failed: %s", "fv->ftype->ftype == FT_BYTES || fv->ftype->ftype == FT_UINT_BYTES || fv->ftype->ftype == FT_OID || fv->ftype->ftype == FT_REL_OID || fv->ftype->ftype == FT_SYSTEM_ID || fv->ftype->ftype == FT_VINES || fv->ftype->ftype == FT_ETHER || fv->ftype->ftype == FT_EUI64 || fv->ftype->ftype == FT_FCWWN"
); } while (0)
939 fv->ftype->ftype == FT_UINT_BYTES ||do { if ((1) && !(fv->ftype->ftype == FT_BYTES ||
fv->ftype->ftype == FT_UINT_BYTES || fv->ftype->
ftype == FT_OID || fv->ftype->ftype == FT_REL_OID || fv
->ftype->ftype == FT_SYSTEM_ID || fv->ftype->ftype
== FT_VINES || fv->ftype->ftype == FT_ETHER || fv->
ftype->ftype == FT_EUI64 || fv->ftype->ftype == FT_FCWWN
)) ws_log_fatal_full("", LOG_LEVEL_ERROR, "epan/ftypes/ftypes.c"
, 946, __func__, "assertion failed: %s", "fv->ftype->ftype == FT_BYTES || fv->ftype->ftype == FT_UINT_BYTES || fv->ftype->ftype == FT_OID || fv->ftype->ftype == FT_REL_OID || fv->ftype->ftype == FT_SYSTEM_ID || fv->ftype->ftype == FT_VINES || fv->ftype->ftype == FT_ETHER || fv->ftype->ftype == FT_EUI64 || fv->ftype->ftype == FT_FCWWN"
); } while (0)
940 fv->ftype->ftype == FT_OID ||do { if ((1) && !(fv->ftype->ftype == FT_BYTES ||
fv->ftype->ftype == FT_UINT_BYTES || fv->ftype->
ftype == FT_OID || fv->ftype->ftype == FT_REL_OID || fv
->ftype->ftype == FT_SYSTEM_ID || fv->ftype->ftype
== FT_VINES || fv->ftype->ftype == FT_ETHER || fv->
ftype->ftype == FT_EUI64 || fv->ftype->ftype == FT_FCWWN
)) ws_log_fatal_full("", LOG_LEVEL_ERROR, "epan/ftypes/ftypes.c"
, 946, __func__, "assertion failed: %s", "fv->ftype->ftype == FT_BYTES || fv->ftype->ftype == FT_UINT_BYTES || fv->ftype->ftype == FT_OID || fv->ftype->ftype == FT_REL_OID || fv->ftype->ftype == FT_SYSTEM_ID || fv->ftype->ftype == FT_VINES || fv->ftype->ftype == FT_ETHER || fv->ftype->ftype == FT_EUI64 || fv->ftype->ftype == FT_FCWWN"
); } while (0)
941 fv->ftype->ftype == FT_REL_OID ||do { if ((1) && !(fv->ftype->ftype == FT_BYTES ||
fv->ftype->ftype == FT_UINT_BYTES || fv->ftype->
ftype == FT_OID || fv->ftype->ftype == FT_REL_OID || fv
->ftype->ftype == FT_SYSTEM_ID || fv->ftype->ftype
== FT_VINES || fv->ftype->ftype == FT_ETHER || fv->
ftype->ftype == FT_EUI64 || fv->ftype->ftype == FT_FCWWN
)) ws_log_fatal_full("", LOG_LEVEL_ERROR, "epan/ftypes/ftypes.c"
, 946, __func__, "assertion failed: %s", "fv->ftype->ftype == FT_BYTES || fv->ftype->ftype == FT_UINT_BYTES || fv->ftype->ftype == FT_OID || fv->ftype->ftype == FT_REL_OID || fv->ftype->ftype == FT_SYSTEM_ID || fv->ftype->ftype == FT_VINES || fv->ftype->ftype == FT_ETHER || fv->ftype->ftype == FT_EUI64 || fv->ftype->ftype == FT_FCWWN"
); } while (0)
942 fv->ftype->ftype == FT_SYSTEM_ID ||do { if ((1) && !(fv->ftype->ftype == FT_BYTES ||
fv->ftype->ftype == FT_UINT_BYTES || fv->ftype->
ftype == FT_OID || fv->ftype->ftype == FT_REL_OID || fv
->ftype->ftype == FT_SYSTEM_ID || fv->ftype->ftype
== FT_VINES || fv->ftype->ftype == FT_ETHER || fv->
ftype->ftype == FT_EUI64 || fv->ftype->ftype == FT_FCWWN
)) ws_log_fatal_full("", LOG_LEVEL_ERROR, "epan/ftypes/ftypes.c"
, 946, __func__, "assertion failed: %s", "fv->ftype->ftype == FT_BYTES || fv->ftype->ftype == FT_UINT_BYTES || fv->ftype->ftype == FT_OID || fv->ftype->ftype == FT_REL_OID || fv->ftype->ftype == FT_SYSTEM_ID || fv->ftype->ftype == FT_VINES || fv->ftype->ftype == FT_ETHER || fv->ftype->ftype == FT_EUI64 || fv->ftype->ftype == FT_FCWWN"
); } while (0)
943 fv->ftype->ftype == FT_VINES ||do { if ((1) && !(fv->ftype->ftype == FT_BYTES ||
fv->ftype->ftype == FT_UINT_BYTES || fv->ftype->
ftype == FT_OID || fv->ftype->ftype == FT_REL_OID || fv
->ftype->ftype == FT_SYSTEM_ID || fv->ftype->ftype
== FT_VINES || fv->ftype->ftype == FT_ETHER || fv->
ftype->ftype == FT_EUI64 || fv->ftype->ftype == FT_FCWWN
)) ws_log_fatal_full("", LOG_LEVEL_ERROR, "epan/ftypes/ftypes.c"
, 946, __func__, "assertion failed: %s", "fv->ftype->ftype == FT_BYTES || fv->ftype->ftype == FT_UINT_BYTES || fv->ftype->ftype == FT_OID || fv->ftype->ftype == FT_REL_OID || fv->ftype->ftype == FT_SYSTEM_ID || fv->ftype->ftype == FT_VINES || fv->ftype->ftype == FT_ETHER || fv->ftype->ftype == FT_EUI64 || fv->ftype->ftype == FT_FCWWN"
); } while (0)
944 fv->ftype->ftype == FT_ETHER ||do { if ((1) && !(fv->ftype->ftype == FT_BYTES ||
fv->ftype->ftype == FT_UINT_BYTES || fv->ftype->
ftype == FT_OID || fv->ftype->ftype == FT_REL_OID || fv
->ftype->ftype == FT_SYSTEM_ID || fv->ftype->ftype
== FT_VINES || fv->ftype->ftype == FT_ETHER || fv->
ftype->ftype == FT_EUI64 || fv->ftype->ftype == FT_FCWWN
)) ws_log_fatal_full("", LOG_LEVEL_ERROR, "epan/ftypes/ftypes.c"
, 946, __func__, "assertion failed: %s", "fv->ftype->ftype == FT_BYTES || fv->ftype->ftype == FT_UINT_BYTES || fv->ftype->ftype == FT_OID || fv->ftype->ftype == FT_REL_OID || fv->ftype->ftype == FT_SYSTEM_ID || fv->ftype->ftype == FT_VINES || fv->ftype->ftype == FT_ETHER || fv->ftype->ftype == FT_EUI64 || fv->ftype->ftype == FT_FCWWN"
); } while (0)
945 fv->ftype->ftype == FT_EUI64 ||do { if ((1) && !(fv->ftype->ftype == FT_BYTES ||
fv->ftype->ftype == FT_UINT_BYTES || fv->ftype->
ftype == FT_OID || fv->ftype->ftype == FT_REL_OID || fv
->ftype->ftype == FT_SYSTEM_ID || fv->ftype->ftype
== FT_VINES || fv->ftype->ftype == FT_ETHER || fv->
ftype->ftype == FT_EUI64 || fv->ftype->ftype == FT_FCWWN
)) ws_log_fatal_full("", LOG_LEVEL_ERROR, "epan/ftypes/ftypes.c"
, 946, __func__, "assertion failed: %s", "fv->ftype->ftype == FT_BYTES || fv->ftype->ftype == FT_UINT_BYTES || fv->ftype->ftype == FT_OID || fv->ftype->ftype == FT_REL_OID || fv->ftype->ftype == FT_SYSTEM_ID || fv->ftype->ftype == FT_VINES || fv->ftype->ftype == FT_ETHER || fv->ftype->ftype == FT_EUI64 || fv->ftype->ftype == FT_FCWWN"
); } while (0)
946 fv->ftype->ftype == FT_FCWWN)do { if ((1) && !(fv->ftype->ftype == FT_BYTES ||
fv->ftype->ftype == FT_UINT_BYTES || fv->ftype->
ftype == FT_OID || fv->ftype->ftype == FT_REL_OID || fv
->ftype->ftype == FT_SYSTEM_ID || fv->ftype->ftype
== FT_VINES || fv->ftype->ftype == FT_ETHER || fv->
ftype->ftype == FT_EUI64 || fv->ftype->ftype == FT_FCWWN
)) ws_log_fatal_full("", LOG_LEVEL_ERROR, "epan/ftypes/ftypes.c"
, 946, __func__, "assertion failed: %s", "fv->ftype->ftype == FT_BYTES || fv->ftype->ftype == FT_UINT_BYTES || fv->ftype->ftype == FT_OID || fv->ftype->ftype == FT_REL_OID || fv->ftype->ftype == FT_SYSTEM_ID || fv->ftype->ftype == FT_VINES || fv->ftype->ftype == FT_ETHER || fv->ftype->ftype == FT_EUI64 || fv->ftype->ftype == FT_FCWWN"
); } while (0)
;
947 ws_assert(fv->ftype->set_value.set_value_bytes)do { if ((1) && !(fv->ftype->set_value.set_value_bytes
)) ws_log_fatal_full("", LOG_LEVEL_ERROR, "epan/ftypes/ftypes.c"
, 947, __func__, "assertion failed: %s", "fv->ftype->set_value.set_value_bytes"
); } while (0)
;
948 fv->ftype->set_value.set_value_bytes(fv, value);
949}
950
951void
952fvalue_set_byte_array(fvalue_t *fv, GByteArray *value)
953{
954 GBytes *bytes = g_byte_array_free_to_bytes(value);
955 fvalue_set_bytes(fv, bytes);
956 g_bytes_unref(bytes);
957}
958
959void
960fvalue_set_bytes_data(fvalue_t *fv, const void *data, size_t size)
961{
962 GBytes *bytes = g_bytes_new(data, size);
963 fvalue_set_bytes(fv, bytes);
964 g_bytes_unref(bytes);
965}
966
967void
968fvalue_set_fcwwn(fvalue_t *fv, const uint8_t *value)
969{
970 GBytes *bytes = g_bytes_new(value, FT_FCWWN_LEN8);
971 fvalue_set_bytes(fv, bytes);
972 g_bytes_unref(bytes);
973}
974
975void
976fvalue_set_ax25(fvalue_t *fv, const uint8_t *value)
977{
978 wmem_strbuf_t *buf = wmem_strbuf_new(NULL((void*)0), NULL((void*)0));
979 for (size_t i = 0; i < FT_AX25_ADDR_LEN7 - 1; i++) {
980 if (value[i] != 0x40) {
981 /* ignore space-padding */
982 wmem_strbuf_append_c(buf, value[i] >> 1);
983 }
984 }
985 /* Ignore C-bit and reserved bits, and end of address bits. */
986 uint8_t ssid = (value[FT_AX25_ADDR_LEN7 - 1] >> 1) & 0x0f;
987 if (ssid != 0) {
988 wmem_strbuf_append_printf(buf, "-%u", ssid);
989 }
990 fvalue_set_strbuf(fv, buf);
991}
992
993void
994fvalue_set_vines(fvalue_t *fv, const uint8_t *value)
995{
996 GBytes *bytes = g_bytes_new(value, FT_VINES_ADDR_LEN6);
997 fvalue_set_bytes(fv, bytes);
998 g_bytes_unref(bytes);
999}
1000
1001void
1002fvalue_set_ether(fvalue_t *fv, const uint8_t *value)
1003{
1004 GBytes *bytes = g_bytes_new(value, FT_ETHER_LEN6);
1005 fvalue_set_bytes(fv, bytes);
1006 g_bytes_unref(bytes);
1007}
1008
1009void
1010fvalue_set_guid(fvalue_t *fv, const e_guid_t *value)
1011{
1012 ws_assert(fv->ftype->ftype == FT_GUID)do { if ((1) && !(fv->ftype->ftype == FT_GUID))
ws_log_fatal_full("", LOG_LEVEL_ERROR, "epan/ftypes/ftypes.c"
, 1012, __func__, "assertion failed: %s", "fv->ftype->ftype == FT_GUID"
); } while (0)
;
1013 ws_assert(fv->ftype->set_value.set_value_guid)do { if ((1) && !(fv->ftype->set_value.set_value_guid
)) ws_log_fatal_full("", LOG_LEVEL_ERROR, "epan/ftypes/ftypes.c"
, 1013, __func__, "assertion failed: %s", "fv->ftype->set_value.set_value_guid"
); } while (0)
;
1014 fv->ftype->set_value.set_value_guid(fv, value);
1015}
1016
1017void
1018fvalue_set_time(fvalue_t *fv, const nstime_t *value)
1019{
1020 ws_assert(FT_IS_TIME(fv->ftype->ftype))do { if ((1) && !(((fv->ftype->ftype) == FT_ABSOLUTE_TIME
|| (fv->ftype->ftype) == FT_RELATIVE_TIME))) ws_log_fatal_full
("", LOG_LEVEL_ERROR, "epan/ftypes/ftypes.c", 1020, __func__,
"assertion failed: %s", "((fv->ftype->ftype) == FT_ABSOLUTE_TIME || (fv->ftype->ftype) == FT_RELATIVE_TIME)"
); } while (0)
;
1021 ws_assert(fv->ftype->set_value.set_value_time)do { if ((1) && !(fv->ftype->set_value.set_value_time
)) ws_log_fatal_full("", LOG_LEVEL_ERROR, "epan/ftypes/ftypes.c"
, 1021, __func__, "assertion failed: %s", "fv->ftype->set_value.set_value_time"
); } while (0)
;
1022 fv->ftype->set_value.set_value_time(fv, value);
1023}
1024
1025void
1026fvalue_set_string(fvalue_t *fv, const char *value)
1027{
1028 wmem_strbuf_t *buf = wmem_strbuf_new(NULL((void*)0), value);
1029 fvalue_set_strbuf(fv, buf);
1030}
1031
1032void
1033fvalue_set_strbuf(fvalue_t *fv, wmem_strbuf_t *value)
1034{
1035 if (value->allocator != NULL((void*)0)) {
1036 /* XXX Can this condition be relaxed? */
1037 ws_critical("Fvalue strbuf allocator must be NULL")do { if (1) { ws_log_full("", LOG_LEVEL_CRITICAL, "epan/ftypes/ftypes.c"
, 1037, __func__, "Fvalue strbuf allocator must be NULL"); } }
while (0)
;
1038 }
1039 ws_assert(FT_IS_STRING(fv->ftype->ftype))do { if ((1) && !(((fv->ftype->ftype) == FT_STRING
|| (fv->ftype->ftype) == FT_STRINGZ || (fv->ftype->
ftype) == FT_STRINGZPAD || (fv->ftype->ftype) == FT_STRINGZTRUNC
|| (fv->ftype->ftype) == FT_UINT_STRING || (fv->ftype
->ftype) == FT_AX25))) ws_log_fatal_full("", LOG_LEVEL_ERROR
, "epan/ftypes/ftypes.c", 1039, __func__, "assertion failed: %s"
, "((fv->ftype->ftype) == FT_STRING || (fv->ftype->ftype) == FT_STRINGZ || (fv->ftype->ftype) == FT_STRINGZPAD || (fv->ftype->ftype) == FT_STRINGZTRUNC || (fv->ftype->ftype) == FT_UINT_STRING || (fv->ftype->ftype) == FT_AX25)"
); } while (0)
;
1040 ws_assert(fv->ftype->set_value.set_value_strbuf)do { if ((1) && !(fv->ftype->set_value.set_value_strbuf
)) ws_log_fatal_full("", LOG_LEVEL_ERROR, "epan/ftypes/ftypes.c"
, 1040, __func__, "assertion failed: %s", "fv->ftype->set_value.set_value_strbuf"
); } while (0)
;
1041 fv->ftype->set_value.set_value_strbuf(fv, value);
1042}
1043
1044void
1045fvalue_set_protocol(fvalue_t *fv, tvbuff_t *value, const char *name, unsigned length)
1046{
1047 ws_assert(fv->ftype->ftype == FT_PROTOCOL)do { if ((1) && !(fv->ftype->ftype == FT_PROTOCOL
)) ws_log_fatal_full("", LOG_LEVEL_ERROR, "epan/ftypes/ftypes.c"
, 1047, __func__, "assertion failed: %s", "fv->ftype->ftype == FT_PROTOCOL"
); } while (0)
;
1048 ws_assert(fv->ftype->set_value.set_value_protocol)do { if ((1) && !(fv->ftype->set_value.set_value_protocol
)) ws_log_fatal_full("", LOG_LEVEL_ERROR, "epan/ftypes/ftypes.c"
, 1048, __func__, "assertion failed: %s", "fv->ftype->set_value.set_value_protocol"
); } while (0)
;
1049 // We probably should check the below, but some parts of proto.c
1050 // don't guarantee this.
1051 ws_assert(value == NULL || tvb_captured_length(value) >= length)do { if ((1) && !(value == ((void*)0) || tvb_captured_length
(value) >= length)) ws_log_fatal_full("", LOG_LEVEL_ERROR,
"epan/ftypes/ftypes.c", 1051, __func__, "assertion failed: %s"
, "value == ((void*)0) || tvb_captured_length(value) >= length"
); } while (0)
;
1052 fv->ftype->set_value.set_value_protocol(fv, value, name, length);
1053}
1054
1055void
1056fvalue_set_protocol_length(fvalue_t *fv, unsigned length)
1057{
1058 ws_assert(fv->ftype->ftype == FT_PROTOCOL)do { if ((1) && !(fv->ftype->ftype == FT_PROTOCOL
)) ws_log_fatal_full("", LOG_LEVEL_ERROR, "epan/ftypes/ftypes.c"
, 1058, __func__, "assertion failed: %s", "fv->ftype->ftype == FT_PROTOCOL"
); } while (0)
;
1059 protocol_value_t *proto = &fv->value.protocol;
1060 // We probably should check the below, but some parts of proto.c
1061 // don't guarantee this.
1062 ws_assert(proto->tvb == NULL || tvb_captured_length(proto->tvb) >= length)do { if ((1) && !(proto->tvb == ((void*)0) || tvb_captured_length
(proto->tvb) >= length)) ws_log_fatal_full("", LOG_LEVEL_ERROR
, "epan/ftypes/ftypes.c", 1062, __func__, "assertion failed: %s"
, "proto->tvb == ((void*)0) || tvb_captured_length(proto->tvb) >= length"
); } while (0)
;
1063 proto->length = length;
1064}
1065
1066void
1067fvalue_set_uinteger(fvalue_t *fv, uint32_t value)
1068{
1069 ws_assert(fv->ftype->ftype == FT_IEEE_11073_SFLOAT ||do { if ((1) && !(fv->ftype->ftype == FT_IEEE_11073_SFLOAT
|| fv->ftype->ftype == FT_IEEE_11073_FLOAT || fv->ftype
->ftype == FT_CHAR || fv->ftype->ftype == FT_UINT8 ||
fv->ftype->ftype == FT_UINT16 || fv->ftype->ftype
== FT_UINT24 || fv->ftype->ftype == FT_UINT32 || fv->
ftype->ftype == FT_IPXNET || fv->ftype->ftype == FT_FRAMENUM
)) ws_log_fatal_full("", LOG_LEVEL_ERROR, "epan/ftypes/ftypes.c"
, 1077, __func__, "assertion failed: %s", "fv->ftype->ftype == FT_IEEE_11073_SFLOAT || fv->ftype->ftype == FT_IEEE_11073_FLOAT || fv->ftype->ftype == FT_CHAR || fv->ftype->ftype == FT_UINT8 || fv->ftype->ftype == FT_UINT16 || fv->ftype->ftype == FT_UINT24 || fv->ftype->ftype == FT_UINT32 || fv->ftype->ftype == FT_IPXNET || fv->ftype->ftype == FT_FRAMENUM"
); } while (0)
1070 fv->ftype->ftype == FT_IEEE_11073_FLOAT ||do { if ((1) && !(fv->ftype->ftype == FT_IEEE_11073_SFLOAT
|| fv->ftype->ftype == FT_IEEE_11073_FLOAT || fv->ftype
->ftype == FT_CHAR || fv->ftype->ftype == FT_UINT8 ||
fv->ftype->ftype == FT_UINT16 || fv->ftype->ftype
== FT_UINT24 || fv->ftype->ftype == FT_UINT32 || fv->
ftype->ftype == FT_IPXNET || fv->ftype->ftype == FT_FRAMENUM
)) ws_log_fatal_full("", LOG_LEVEL_ERROR, "epan/ftypes/ftypes.c"
, 1077, __func__, "assertion failed: %s", "fv->ftype->ftype == FT_IEEE_11073_SFLOAT || fv->ftype->ftype == FT_IEEE_11073_FLOAT || fv->ftype->ftype == FT_CHAR || fv->ftype->ftype == FT_UINT8 || fv->ftype->ftype == FT_UINT16 || fv->ftype->ftype == FT_UINT24 || fv->ftype->ftype == FT_UINT32 || fv->ftype->ftype == FT_IPXNET || fv->ftype->ftype == FT_FRAMENUM"
); } while (0)
1071 fv->ftype->ftype == FT_CHAR ||do { if ((1) && !(fv->ftype->ftype == FT_IEEE_11073_SFLOAT
|| fv->ftype->ftype == FT_IEEE_11073_FLOAT || fv->ftype
->ftype == FT_CHAR || fv->ftype->ftype == FT_UINT8 ||
fv->ftype->ftype == FT_UINT16 || fv->ftype->ftype
== FT_UINT24 || fv->ftype->ftype == FT_UINT32 || fv->
ftype->ftype == FT_IPXNET || fv->ftype->ftype == FT_FRAMENUM
)) ws_log_fatal_full("", LOG_LEVEL_ERROR, "epan/ftypes/ftypes.c"
, 1077, __func__, "assertion failed: %s", "fv->ftype->ftype == FT_IEEE_11073_SFLOAT || fv->ftype->ftype == FT_IEEE_11073_FLOAT || fv->ftype->ftype == FT_CHAR || fv->ftype->ftype == FT_UINT8 || fv->ftype->ftype == FT_UINT16 || fv->ftype->ftype == FT_UINT24 || fv->ftype->ftype == FT_UINT32 || fv->ftype->ftype == FT_IPXNET || fv->ftype->ftype == FT_FRAMENUM"
); } while (0)
1072 fv->ftype->ftype == FT_UINT8 ||do { if ((1) && !(fv->ftype->ftype == FT_IEEE_11073_SFLOAT
|| fv->ftype->ftype == FT_IEEE_11073_FLOAT || fv->ftype
->ftype == FT_CHAR || fv->ftype->ftype == FT_UINT8 ||
fv->ftype->ftype == FT_UINT16 || fv->ftype->ftype
== FT_UINT24 || fv->ftype->ftype == FT_UINT32 || fv->
ftype->ftype == FT_IPXNET || fv->ftype->ftype == FT_FRAMENUM
)) ws_log_fatal_full("", LOG_LEVEL_ERROR, "epan/ftypes/ftypes.c"
, 1077, __func__, "assertion failed: %s", "fv->ftype->ftype == FT_IEEE_11073_SFLOAT || fv->ftype->ftype == FT_IEEE_11073_FLOAT || fv->ftype->ftype == FT_CHAR || fv->ftype->ftype == FT_UINT8 || fv->ftype->ftype == FT_UINT16 || fv->ftype->ftype == FT_UINT24 || fv->ftype->ftype == FT_UINT32 || fv->ftype->ftype == FT_IPXNET || fv->ftype->ftype == FT_FRAMENUM"
); } while (0)
1073 fv->ftype->ftype == FT_UINT16 ||do { if ((1) && !(fv->ftype->ftype == FT_IEEE_11073_SFLOAT
|| fv->ftype->ftype == FT_IEEE_11073_FLOAT || fv->ftype
->ftype == FT_CHAR || fv->ftype->ftype == FT_UINT8 ||
fv->ftype->ftype == FT_UINT16 || fv->ftype->ftype
== FT_UINT24 || fv->ftype->ftype == FT_UINT32 || fv->
ftype->ftype == FT_IPXNET || fv->ftype->ftype == FT_FRAMENUM
)) ws_log_fatal_full("", LOG_LEVEL_ERROR, "epan/ftypes/ftypes.c"
, 1077, __func__, "assertion failed: %s", "fv->ftype->ftype == FT_IEEE_11073_SFLOAT || fv->ftype->ftype == FT_IEEE_11073_FLOAT || fv->ftype->ftype == FT_CHAR || fv->ftype->ftype == FT_UINT8 || fv->ftype->ftype == FT_UINT16 || fv->ftype->ftype == FT_UINT24 || fv->ftype->ftype == FT_UINT32 || fv->ftype->ftype == FT_IPXNET || fv->ftype->ftype == FT_FRAMENUM"
); } while (0)
1074 fv->ftype->ftype == FT_UINT24 ||do { if ((1) && !(fv->ftype->ftype == FT_IEEE_11073_SFLOAT
|| fv->ftype->ftype == FT_IEEE_11073_FLOAT || fv->ftype
->ftype == FT_CHAR || fv->ftype->ftype == FT_UINT8 ||
fv->ftype->ftype == FT_UINT16 || fv->ftype->ftype
== FT_UINT24 || fv->ftype->ftype == FT_UINT32 || fv->
ftype->ftype == FT_IPXNET || fv->ftype->ftype == FT_FRAMENUM
)) ws_log_fatal_full("", LOG_LEVEL_ERROR, "epan/ftypes/ftypes.c"
, 1077, __func__, "assertion failed: %s", "fv->ftype->ftype == FT_IEEE_11073_SFLOAT || fv->ftype->ftype == FT_IEEE_11073_FLOAT || fv->ftype->ftype == FT_CHAR || fv->ftype->ftype == FT_UINT8 || fv->ftype->ftype == FT_UINT16 || fv->ftype->ftype == FT_UINT24 || fv->ftype->ftype == FT_UINT32 || fv->ftype->ftype == FT_IPXNET || fv->ftype->ftype == FT_FRAMENUM"
); } while (0)
1075 fv->ftype->ftype == FT_UINT32 ||do { if ((1) && !(fv->ftype->ftype == FT_IEEE_11073_SFLOAT
|| fv->ftype->ftype == FT_IEEE_11073_FLOAT || fv->ftype
->ftype == FT_CHAR || fv->ftype->ftype == FT_UINT8 ||
fv->ftype->ftype == FT_UINT16 || fv->ftype->ftype
== FT_UINT24 || fv->ftype->ftype == FT_UINT32 || fv->
ftype->ftype == FT_IPXNET || fv->ftype->ftype == FT_FRAMENUM
)) ws_log_fatal_full("", LOG_LEVEL_ERROR, "epan/ftypes/ftypes.c"
, 1077, __func__, "assertion failed: %s", "fv->ftype->ftype == FT_IEEE_11073_SFLOAT || fv->ftype->ftype == FT_IEEE_11073_FLOAT || fv->ftype->ftype == FT_CHAR || fv->ftype->ftype == FT_UINT8 || fv->ftype->ftype == FT_UINT16 || fv->ftype->ftype == FT_UINT24 || fv->ftype->ftype == FT_UINT32 || fv->ftype->ftype == FT_IPXNET || fv->ftype->ftype == FT_FRAMENUM"
); } while (0)
1076 fv->ftype->ftype == FT_IPXNET ||do { if ((1) && !(fv->ftype->ftype == FT_IEEE_11073_SFLOAT
|| fv->ftype->ftype == FT_IEEE_11073_FLOAT || fv->ftype
->ftype == FT_CHAR || fv->ftype->ftype == FT_UINT8 ||
fv->ftype->ftype == FT_UINT16 || fv->ftype->ftype
== FT_UINT24 || fv->ftype->ftype == FT_UINT32 || fv->
ftype->ftype == FT_IPXNET || fv->ftype->ftype == FT_FRAMENUM
)) ws_log_fatal_full("", LOG_LEVEL_ERROR, "epan/ftypes/ftypes.c"
, 1077, __func__, "assertion failed: %s", "fv->ftype->ftype == FT_IEEE_11073_SFLOAT || fv->ftype->ftype == FT_IEEE_11073_FLOAT || fv->ftype->ftype == FT_CHAR || fv->ftype->ftype == FT_UINT8 || fv->ftype->ftype == FT_UINT16 || fv->ftype->ftype == FT_UINT24 || fv->ftype->ftype == FT_UINT32 || fv->ftype->ftype == FT_IPXNET || fv->ftype->ftype == FT_FRAMENUM"
); } while (0)
1077 fv->ftype->ftype == FT_FRAMENUM)do { if ((1) && !(fv->ftype->ftype == FT_IEEE_11073_SFLOAT
|| fv->ftype->ftype == FT_IEEE_11073_FLOAT || fv->ftype
->ftype == FT_CHAR || fv->ftype->ftype == FT_UINT8 ||
fv->ftype->ftype == FT_UINT16 || fv->ftype->ftype
== FT_UINT24 || fv->ftype->ftype == FT_UINT32 || fv->
ftype->ftype == FT_IPXNET || fv->ftype->ftype == FT_FRAMENUM
)) ws_log_fatal_full("", LOG_LEVEL_ERROR, "epan/ftypes/ftypes.c"
, 1077, __func__, "assertion failed: %s", "fv->ftype->ftype == FT_IEEE_11073_SFLOAT || fv->ftype->ftype == FT_IEEE_11073_FLOAT || fv->ftype->ftype == FT_CHAR || fv->ftype->ftype == FT_UINT8 || fv->ftype->ftype == FT_UINT16 || fv->ftype->ftype == FT_UINT24 || fv->ftype->ftype == FT_UINT32 || fv->ftype->ftype == FT_IPXNET || fv->ftype->ftype == FT_FRAMENUM"
); } while (0)
;
1078 ws_assert(fv->ftype->set_value.set_value_uinteger)do { if ((1) && !(fv->ftype->set_value.set_value_uinteger
)) ws_log_fatal_full("", LOG_LEVEL_ERROR, "epan/ftypes/ftypes.c"
, 1078, __func__, "assertion failed: %s", "fv->ftype->set_value.set_value_uinteger"
); } while (0)
;
1079 fv->ftype->set_value.set_value_uinteger(fv, value);
1080}
1081
1082void
1083fvalue_set_sinteger(fvalue_t *fv, int32_t value)
1084{
1085 ws_assert(fv->ftype->ftype == FT_INT8 ||do { if ((1) && !(fv->ftype->ftype == FT_INT8 ||
fv->ftype->ftype == FT_INT16 || fv->ftype->ftype
== FT_INT24 || fv->ftype->ftype == FT_INT32)) ws_log_fatal_full
("", LOG_LEVEL_ERROR, "epan/ftypes/ftypes.c", 1088, __func__,
"assertion failed: %s", "fv->ftype->ftype == FT_INT8 || fv->ftype->ftype == FT_INT16 || fv->ftype->ftype == FT_INT24 || fv->ftype->ftype == FT_INT32"
); } while (0)
1086 fv->ftype->ftype == FT_INT16 ||do { if ((1) && !(fv->ftype->ftype == FT_INT8 ||
fv->ftype->ftype == FT_INT16 || fv->ftype->ftype
== FT_INT24 || fv->ftype->ftype == FT_INT32)) ws_log_fatal_full
("", LOG_LEVEL_ERROR, "epan/ftypes/ftypes.c", 1088, __func__,
"assertion failed: %s", "fv->ftype->ftype == FT_INT8 || fv->ftype->ftype == FT_INT16 || fv->ftype->ftype == FT_INT24 || fv->ftype->ftype == FT_INT32"
); } while (0)
1087 fv->ftype->ftype == FT_INT24 ||do { if ((1) && !(fv->ftype->ftype == FT_INT8 ||
fv->ftype->ftype == FT_INT16 || fv->ftype->ftype
== FT_INT24 || fv->ftype->ftype == FT_INT32)) ws_log_fatal_full
("", LOG_LEVEL_ERROR, "epan/ftypes/ftypes.c", 1088, __func__,
"assertion failed: %s", "fv->ftype->ftype == FT_INT8 || fv->ftype->ftype == FT_INT16 || fv->ftype->ftype == FT_INT24 || fv->ftype->ftype == FT_INT32"
); } while (0)
1088 fv->ftype->ftype == FT_INT32)do { if ((1) && !(fv->ftype->ftype == FT_INT8 ||
fv->ftype->ftype == FT_INT16 || fv->ftype->ftype
== FT_INT24 || fv->ftype->ftype == FT_INT32)) ws_log_fatal_full
("", LOG_LEVEL_ERROR, "epan/ftypes/ftypes.c", 1088, __func__,
"assertion failed: %s", "fv->ftype->ftype == FT_INT8 || fv->ftype->ftype == FT_INT16 || fv->ftype->ftype == FT_INT24 || fv->ftype->ftype == FT_INT32"
); } while (0)
;
1089 ws_assert(fv->ftype->set_value.set_value_sinteger)do { if ((1) && !(fv->ftype->set_value.set_value_sinteger
)) ws_log_fatal_full("", LOG_LEVEL_ERROR, "epan/ftypes/ftypes.c"
, 1089, __func__, "assertion failed: %s", "fv->ftype->set_value.set_value_sinteger"
); } while (0)
;
1090 fv->ftype->set_value.set_value_sinteger(fv, value);
1091}
1092
1093void
1094fvalue_set_uinteger64(fvalue_t *fv, uint64_t value)
1095{
1096 ws_assert(fv->ftype->ftype == FT_UINT40 ||do { if ((1) && !(fv->ftype->ftype == FT_UINT40
|| fv->ftype->ftype == FT_UINT48 || fv->ftype->ftype
== FT_UINT56 || fv->ftype->ftype == FT_UINT64 || fv->
ftype->ftype == FT_BOOLEAN)) ws_log_fatal_full("", LOG_LEVEL_ERROR
, "epan/ftypes/ftypes.c", 1100, __func__, "assertion failed: %s"
, "fv->ftype->ftype == FT_UINT40 || fv->ftype->ftype == FT_UINT48 || fv->ftype->ftype == FT_UINT56 || fv->ftype->ftype == FT_UINT64 || fv->ftype->ftype == FT_BOOLEAN"
); } while (0)
1097 fv->ftype->ftype == FT_UINT48 ||do { if ((1) && !(fv->ftype->ftype == FT_UINT40
|| fv->ftype->ftype == FT_UINT48 || fv->ftype->ftype
== FT_UINT56 || fv->ftype->ftype == FT_UINT64 || fv->
ftype->ftype == FT_BOOLEAN)) ws_log_fatal_full("", LOG_LEVEL_ERROR
, "epan/ftypes/ftypes.c", 1100, __func__, "assertion failed: %s"
, "fv->ftype->ftype == FT_UINT40 || fv->ftype->ftype == FT_UINT48 || fv->ftype->ftype == FT_UINT56 || fv->ftype->ftype == FT_UINT64 || fv->ftype->ftype == FT_BOOLEAN"
); } while (0)
1098 fv->ftype->ftype == FT_UINT56 ||do { if ((1) && !(fv->ftype->ftype == FT_UINT40
|| fv->ftype->ftype == FT_UINT48 || fv->ftype->ftype
== FT_UINT56 || fv->ftype->ftype == FT_UINT64 || fv->
ftype->ftype == FT_BOOLEAN)) ws_log_fatal_full("", LOG_LEVEL_ERROR
, "epan/ftypes/ftypes.c", 1100, __func__, "assertion failed: %s"
, "fv->ftype->ftype == FT_UINT40 || fv->ftype->ftype == FT_UINT48 || fv->ftype->ftype == FT_UINT56 || fv->ftype->ftype == FT_UINT64 || fv->ftype->ftype == FT_BOOLEAN"
); } while (0)
1099 fv->ftype->ftype == FT_UINT64 ||do { if ((1) && !(fv->ftype->ftype == FT_UINT40
|| fv->ftype->ftype == FT_UINT48 || fv->ftype->ftype
== FT_UINT56 || fv->ftype->ftype == FT_UINT64 || fv->
ftype->ftype == FT_BOOLEAN)) ws_log_fatal_full("", LOG_LEVEL_ERROR
, "epan/ftypes/ftypes.c", 1100, __func__, "assertion failed: %s"
, "fv->ftype->ftype == FT_UINT40 || fv->ftype->ftype == FT_UINT48 || fv->ftype->ftype == FT_UINT56 || fv->ftype->ftype == FT_UINT64 || fv->ftype->ftype == FT_BOOLEAN"
); } while (0)
1100 fv->ftype->ftype == FT_BOOLEAN)do { if ((1) && !(fv->ftype->ftype == FT_UINT40
|| fv->ftype->ftype == FT_UINT48 || fv->ftype->ftype
== FT_UINT56 || fv->ftype->ftype == FT_UINT64 || fv->
ftype->ftype == FT_BOOLEAN)) ws_log_fatal_full("", LOG_LEVEL_ERROR
, "epan/ftypes/ftypes.c", 1100, __func__, "assertion failed: %s"
, "fv->ftype->ftype == FT_UINT40 || fv->ftype->ftype == FT_UINT48 || fv->ftype->ftype == FT_UINT56 || fv->ftype->ftype == FT_UINT64 || fv->ftype->ftype == FT_BOOLEAN"
); } while (0)
;
1101 ws_assert(fv->ftype->set_value.set_value_uinteger64)do { if ((1) && !(fv->ftype->set_value.set_value_uinteger64
)) ws_log_fatal_full("", LOG_LEVEL_ERROR, "epan/ftypes/ftypes.c"
, 1101, __func__, "assertion failed: %s", "fv->ftype->set_value.set_value_uinteger64"
); } while (0)
;
1102 fv->ftype->set_value.set_value_uinteger64(fv, value);
1103}
1104
1105void
1106fvalue_set_sinteger64(fvalue_t *fv, int64_t value)
1107{
1108 ws_assert(fv->ftype->ftype == FT_INT40 ||do { if ((1) && !(fv->ftype->ftype == FT_INT40 ||
fv->ftype->ftype == FT_INT48 || fv->ftype->ftype
== FT_INT56 || fv->ftype->ftype == FT_INT64)) ws_log_fatal_full
("", LOG_LEVEL_ERROR, "epan/ftypes/ftypes.c", 1111, __func__,
"assertion failed: %s", "fv->ftype->ftype == FT_INT40 || fv->ftype->ftype == FT_INT48 || fv->ftype->ftype == FT_INT56 || fv->ftype->ftype == FT_INT64"
); } while (0)
1109 fv->ftype->ftype == FT_INT48 ||do { if ((1) && !(fv->ftype->ftype == FT_INT40 ||
fv->ftype->ftype == FT_INT48 || fv->ftype->ftype
== FT_INT56 || fv->ftype->ftype == FT_INT64)) ws_log_fatal_full
("", LOG_LEVEL_ERROR, "epan/ftypes/ftypes.c", 1111, __func__,
"assertion failed: %s", "fv->ftype->ftype == FT_INT40 || fv->ftype->ftype == FT_INT48 || fv->ftype->ftype == FT_INT56 || fv->ftype->ftype == FT_INT64"
); } while (0)
1110 fv->ftype->ftype == FT_INT56 ||do { if ((1) && !(fv->ftype->ftype == FT_INT40 ||
fv->ftype->ftype == FT_INT48 || fv->ftype->ftype
== FT_INT56 || fv->ftype->ftype == FT_INT64)) ws_log_fatal_full
("", LOG_LEVEL_ERROR, "epan/ftypes/ftypes.c", 1111, __func__,
"assertion failed: %s", "fv->ftype->ftype == FT_INT40 || fv->ftype->ftype == FT_INT48 || fv->ftype->ftype == FT_INT56 || fv->ftype->ftype == FT_INT64"
); } while (0)
1111 fv->ftype->ftype == FT_INT64)do { if ((1) && !(fv->ftype->ftype == FT_INT40 ||
fv->ftype->ftype == FT_INT48 || fv->ftype->ftype
== FT_INT56 || fv->ftype->ftype == FT_INT64)) ws_log_fatal_full
("", LOG_LEVEL_ERROR, "epan/ftypes/ftypes.c", 1111, __func__,
"assertion failed: %s", "fv->ftype->ftype == FT_INT40 || fv->ftype->ftype == FT_INT48 || fv->ftype->ftype == FT_INT56 || fv->ftype->ftype == FT_INT64"
); } while (0)
;
1112 ws_assert(fv->ftype->set_value.set_value_sinteger64)do { if ((1) && !(fv->ftype->set_value.set_value_sinteger64
)) ws_log_fatal_full("", LOG_LEVEL_ERROR, "epan/ftypes/ftypes.c"
, 1112, __func__, "assertion failed: %s", "fv->ftype->set_value.set_value_sinteger64"
); } while (0)
;
1113 fv->ftype->set_value.set_value_sinteger64(fv, value);
1114}
1115
1116void
1117fvalue_set_floating(fvalue_t *fv, double value)
1118{
1119 ws_assert(fv->ftype->ftype == FT_FLOAT ||do { if ((1) && !(fv->ftype->ftype == FT_FLOAT ||
fv->ftype->ftype == FT_DOUBLE)) ws_log_fatal_full("", LOG_LEVEL_ERROR
, "epan/ftypes/ftypes.c", 1120, __func__, "assertion failed: %s"
, "fv->ftype->ftype == FT_FLOAT || fv->ftype->ftype == FT_DOUBLE"
); } while (0)
1120 fv->ftype->ftype == FT_DOUBLE)do { if ((1) && !(fv->ftype->ftype == FT_FLOAT ||
fv->ftype->ftype == FT_DOUBLE)) ws_log_fatal_full("", LOG_LEVEL_ERROR
, "epan/ftypes/ftypes.c", 1120, __func__, "assertion failed: %s"
, "fv->ftype->ftype == FT_FLOAT || fv->ftype->ftype == FT_DOUBLE"
); } while (0)
;
1121 ws_assert(fv->ftype->set_value.set_value_floating)do { if ((1) && !(fv->ftype->set_value.set_value_floating
)) ws_log_fatal_full("", LOG_LEVEL_ERROR, "epan/ftypes/ftypes.c"
, 1121, __func__, "assertion failed: %s", "fv->ftype->set_value.set_value_floating"
); } while (0)
;
1122 fv->ftype->set_value.set_value_floating(fv, value);
1123}
1124
1125void
1126fvalue_set_ipv4(fvalue_t *fv, const ipv4_addr_and_mask *value)
1127{
1128 ws_assert(fv->ftype->ftype == FT_IPv4)do { if ((1) && !(fv->ftype->ftype == FT_IPv4))
ws_log_fatal_full("", LOG_LEVEL_ERROR, "epan/ftypes/ftypes.c"
, 1128, __func__, "assertion failed: %s", "fv->ftype->ftype == FT_IPv4"
); } while (0)
;
1129 ws_assert(fv->ftype->set_value.set_value_ipv4)do { if ((1) && !(fv->ftype->set_value.set_value_ipv4
)) ws_log_fatal_full("", LOG_LEVEL_ERROR, "epan/ftypes/ftypes.c"
, 1129, __func__, "assertion failed: %s", "fv->ftype->set_value.set_value_ipv4"
); } while (0)
;
1130 fv->ftype->set_value.set_value_ipv4(fv, value);
1131}
1132
1133void
1134fvalue_set_ipv6(fvalue_t *fv, const ipv6_addr_and_prefix *value)
1135{
1136 ws_assert(fv->ftype->ftype == FT_IPv6)do { if ((1) && !(fv->ftype->ftype == FT_IPv6))
ws_log_fatal_full("", LOG_LEVEL_ERROR, "epan/ftypes/ftypes.c"
, 1136, __func__, "assertion failed: %s", "fv->ftype->ftype == FT_IPv6"
); } while (0)
;
1137 ws_assert(fv->ftype->set_value.set_value_ipv6)do { if ((1) && !(fv->ftype->set_value.set_value_ipv6
)) ws_log_fatal_full("", LOG_LEVEL_ERROR, "epan/ftypes/ftypes.c"
, 1137, __func__, "assertion failed: %s", "fv->ftype->set_value.set_value_ipv6"
); } while (0)
;
1138 fv->ftype->set_value.set_value_ipv6(fv, value);
1139}
1140
1141GBytes *
1142fvalue_get_bytes(fvalue_t *fv)
1143{
1144 ws_assert(fv->ftype->ftype == FT_BYTES ||do { if ((1) && !(fv->ftype->ftype == FT_BYTES ||
fv->ftype->ftype == FT_UINT_BYTES || fv->ftype->
ftype == FT_VINES || fv->ftype->ftype == FT_ETHER || fv
->ftype->ftype == FT_OID || fv->ftype->ftype == FT_REL_OID
|| fv->ftype->ftype == FT_SYSTEM_ID || fv->ftype->
ftype == FT_FCWWN || fv->ftype->ftype == FT_EUI64 || fv
->ftype->ftype == FT_IPv6)) ws_log_fatal_full("", LOG_LEVEL_ERROR
, "epan/ftypes/ftypes.c", 1153, __func__, "assertion failed: %s"
, "fv->ftype->ftype == FT_BYTES || fv->ftype->ftype == FT_UINT_BYTES || fv->ftype->ftype == FT_VINES || fv->ftype->ftype == FT_ETHER || fv->ftype->ftype == FT_OID || fv->ftype->ftype == FT_REL_OID || fv->ftype->ftype == FT_SYSTEM_ID || fv->ftype->ftype == FT_FCWWN || fv->ftype->ftype == FT_EUI64 || fv->ftype->ftype == FT_IPv6"
); } while (0)
1145 fv->ftype->ftype == FT_UINT_BYTES ||do { if ((1) && !(fv->ftype->ftype == FT_BYTES ||
fv->ftype->ftype == FT_UINT_BYTES || fv->ftype->
ftype == FT_VINES || fv->ftype->ftype == FT_ETHER || fv
->ftype->ftype == FT_OID || fv->ftype->ftype == FT_REL_OID
|| fv->ftype->ftype == FT_SYSTEM_ID || fv->ftype->
ftype == FT_FCWWN || fv->ftype->ftype == FT_EUI64 || fv
->ftype->ftype == FT_IPv6)) ws_log_fatal_full("", LOG_LEVEL_ERROR
, "epan/ftypes/ftypes.c", 1153, __func__, "assertion failed: %s"
, "fv->ftype->ftype == FT_BYTES || fv->ftype->ftype == FT_UINT_BYTES || fv->ftype->ftype == FT_VINES || fv->ftype->ftype == FT_ETHER || fv->ftype->ftype == FT_OID || fv->ftype->ftype == FT_REL_OID || fv->ftype->ftype == FT_SYSTEM_ID || fv->ftype->ftype == FT_FCWWN || fv->ftype->ftype == FT_EUI64 || fv->ftype->ftype == FT_IPv6"
); } while (0)
1146 fv->ftype->ftype == FT_VINES ||do { if ((1) && !(fv->ftype->ftype == FT_BYTES ||
fv->ftype->ftype == FT_UINT_BYTES || fv->ftype->
ftype == FT_VINES || fv->ftype->ftype == FT_ETHER || fv
->ftype->ftype == FT_OID || fv->ftype->ftype == FT_REL_OID
|| fv->ftype->ftype == FT_SYSTEM_ID || fv->ftype->
ftype == FT_FCWWN || fv->ftype->ftype == FT_EUI64 || fv
->ftype->ftype == FT_IPv6)) ws_log_fatal_full("", LOG_LEVEL_ERROR
, "epan/ftypes/ftypes.c", 1153, __func__, "assertion failed: %s"
, "fv->ftype->ftype == FT_BYTES || fv->ftype->ftype == FT_UINT_BYTES || fv->ftype->ftype == FT_VINES || fv->ftype->ftype == FT_ETHER || fv->ftype->ftype == FT_OID || fv->ftype->ftype == FT_REL_OID || fv->ftype->ftype == FT_SYSTEM_ID || fv->ftype->ftype == FT_FCWWN || fv->ftype->ftype == FT_EUI64 || fv->ftype->ftype == FT_IPv6"
); } while (0)
1147 fv->ftype->ftype == FT_ETHER ||do { if ((1) && !(fv->ftype->ftype == FT_BYTES ||
fv->ftype->ftype == FT_UINT_BYTES || fv->ftype->
ftype == FT_VINES || fv->ftype->ftype == FT_ETHER || fv
->ftype->ftype == FT_OID || fv->ftype->ftype == FT_REL_OID
|| fv->ftype->ftype == FT_SYSTEM_ID || fv->ftype->
ftype == FT_FCWWN || fv->ftype->ftype == FT_EUI64 || fv
->ftype->ftype == FT_IPv6)) ws_log_fatal_full("", LOG_LEVEL_ERROR
, "epan/ftypes/ftypes.c", 1153, __func__, "assertion failed: %s"
, "fv->ftype->ftype == FT_BYTES || fv->ftype->ftype == FT_UINT_BYTES || fv->ftype->ftype == FT_VINES || fv->ftype->ftype == FT_ETHER || fv->ftype->ftype == FT_OID || fv->ftype->ftype == FT_REL_OID || fv->ftype->ftype == FT_SYSTEM_ID || fv->ftype->ftype == FT_FCWWN || fv->ftype->ftype == FT_EUI64 || fv->ftype->ftype == FT_IPv6"
); } while (0)
1148 fv->ftype->ftype == FT_OID ||do { if ((1) && !(fv->ftype->ftype == FT_BYTES ||
fv->ftype->ftype == FT_UINT_BYTES || fv->ftype->
ftype == FT_VINES || fv->ftype->ftype == FT_ETHER || fv
->ftype->ftype == FT_OID || fv->ftype->ftype == FT_REL_OID
|| fv->ftype->ftype == FT_SYSTEM_ID || fv->ftype->
ftype == FT_FCWWN || fv->ftype->ftype == FT_EUI64 || fv
->ftype->ftype == FT_IPv6)) ws_log_fatal_full("", LOG_LEVEL_ERROR
, "epan/ftypes/ftypes.c", 1153, __func__, "assertion failed: %s"
, "fv->ftype->ftype == FT_BYTES || fv->ftype->ftype == FT_UINT_BYTES || fv->ftype->ftype == FT_VINES || fv->ftype->ftype == FT_ETHER || fv->ftype->ftype == FT_OID || fv->ftype->ftype == FT_REL_OID || fv->ftype->ftype == FT_SYSTEM_ID || fv->ftype->ftype == FT_FCWWN || fv->ftype->ftype == FT_EUI64 || fv->ftype->ftype == FT_IPv6"
); } while (0)
1149 fv->ftype->ftype == FT_REL_OID ||do { if ((1) && !(fv->ftype->ftype == FT_BYTES ||
fv->ftype->ftype == FT_UINT_BYTES || fv->ftype->
ftype == FT_VINES || fv->ftype->ftype == FT_ETHER || fv
->ftype->ftype == FT_OID || fv->ftype->ftype == FT_REL_OID
|| fv->ftype->ftype == FT_SYSTEM_ID || fv->ftype->
ftype == FT_FCWWN || fv->ftype->ftype == FT_EUI64 || fv
->ftype->ftype == FT_IPv6)) ws_log_fatal_full("", LOG_LEVEL_ERROR
, "epan/ftypes/ftypes.c", 1153, __func__, "assertion failed: %s"
, "fv->ftype->ftype == FT_BYTES || fv->ftype->ftype == FT_UINT_BYTES || fv->ftype->ftype == FT_VINES || fv->ftype->ftype == FT_ETHER || fv->ftype->ftype == FT_OID || fv->ftype->ftype == FT_REL_OID || fv->ftype->ftype == FT_SYSTEM_ID || fv->ftype->ftype == FT_FCWWN || fv->ftype->ftype == FT_EUI64 || fv->ftype->ftype == FT_IPv6"
); } while (0)
1150 fv->ftype->ftype == FT_SYSTEM_ID ||do { if ((1) && !(fv->ftype->ftype == FT_BYTES ||
fv->ftype->ftype == FT_UINT_BYTES || fv->ftype->
ftype == FT_VINES || fv->ftype->ftype == FT_ETHER || fv
->ftype->ftype == FT_OID || fv->ftype->ftype == FT_REL_OID
|| fv->ftype->ftype == FT_SYSTEM_ID || fv->ftype->
ftype == FT_FCWWN || fv->ftype->ftype == FT_EUI64 || fv
->ftype->ftype == FT_IPv6)) ws_log_fatal_full("", LOG_LEVEL_ERROR
, "epan/ftypes/ftypes.c", 1153, __func__, "assertion failed: %s"
, "fv->ftype->ftype == FT_BYTES || fv->ftype->ftype == FT_UINT_BYTES || fv->ftype->ftype == FT_VINES || fv->ftype->ftype == FT_ETHER || fv->ftype->ftype == FT_OID || fv->ftype->ftype == FT_REL_OID || fv->ftype->ftype == FT_SYSTEM_ID || fv->ftype->ftype == FT_FCWWN || fv->ftype->ftype == FT_EUI64 || fv->ftype->ftype == FT_IPv6"
); } while (0)
1151 fv->ftype->ftype == FT_FCWWN ||do { if ((1) && !(fv->ftype->ftype == FT_BYTES ||
fv->ftype->ftype == FT_UINT_BYTES || fv->ftype->
ftype == FT_VINES || fv->ftype->ftype == FT_ETHER || fv
->ftype->ftype == FT_OID || fv->ftype->ftype == FT_REL_OID
|| fv->ftype->ftype == FT_SYSTEM_ID || fv->ftype->
ftype == FT_FCWWN || fv->ftype->ftype == FT_EUI64 || fv
->ftype->ftype == FT_IPv6)) ws_log_fatal_full("", LOG_LEVEL_ERROR
, "epan/ftypes/ftypes.c", 1153, __func__, "assertion failed: %s"
, "fv->ftype->ftype == FT_BYTES || fv->ftype->ftype == FT_UINT_BYTES || fv->ftype->ftype == FT_VINES || fv->ftype->ftype == FT_ETHER || fv->ftype->ftype == FT_OID || fv->ftype->ftype == FT_REL_OID || fv->ftype->ftype == FT_SYSTEM_ID || fv->ftype->ftype == FT_FCWWN || fv->ftype->ftype == FT_EUI64 || fv->ftype->ftype == FT_IPv6"
); } while (0)
1152 fv->ftype->ftype == FT_EUI64 ||do { if ((1) && !(fv->ftype->ftype == FT_BYTES ||
fv->ftype->ftype == FT_UINT_BYTES || fv->ftype->
ftype == FT_VINES || fv->ftype->ftype == FT_ETHER || fv
->ftype->ftype == FT_OID || fv->ftype->ftype == FT_REL_OID
|| fv->ftype->ftype == FT_SYSTEM_ID || fv->ftype->
ftype == FT_FCWWN || fv->ftype->ftype == FT_EUI64 || fv
->ftype->ftype == FT_IPv6)) ws_log_fatal_full("", LOG_LEVEL_ERROR
, "epan/ftypes/ftypes.c", 1153, __func__, "assertion failed: %s"
, "fv->ftype->ftype == FT_BYTES || fv->ftype->ftype == FT_UINT_BYTES || fv->ftype->ftype == FT_VINES || fv->ftype->ftype == FT_ETHER || fv->ftype->ftype == FT_OID || fv->ftype->ftype == FT_REL_OID || fv->ftype->ftype == FT_SYSTEM_ID || fv->ftype->ftype == FT_FCWWN || fv->ftype->ftype == FT_EUI64 || fv->ftype->ftype == FT_IPv6"
); } while (0)
1153 fv->ftype->ftype == FT_IPv6)do { if ((1) && !(fv->ftype->ftype == FT_BYTES ||
fv->ftype->ftype == FT_UINT_BYTES || fv->ftype->
ftype == FT_VINES || fv->ftype->ftype == FT_ETHER || fv
->ftype->ftype == FT_OID || fv->ftype->ftype == FT_REL_OID
|| fv->ftype->ftype == FT_SYSTEM_ID || fv->ftype->
ftype == FT_FCWWN || fv->ftype->ftype == FT_EUI64 || fv
->ftype->ftype == FT_IPv6)) ws_log_fatal_full("", LOG_LEVEL_ERROR
, "epan/ftypes/ftypes.c", 1153, __func__, "assertion failed: %s"
, "fv->ftype->ftype == FT_BYTES || fv->ftype->ftype == FT_UINT_BYTES || fv->ftype->ftype == FT_VINES || fv->ftype->ftype == FT_ETHER || fv->ftype->ftype == FT_OID || fv->ftype->ftype == FT_REL_OID || fv->ftype->ftype == FT_SYSTEM_ID || fv->ftype->ftype == FT_FCWWN || fv->ftype->ftype == FT_EUI64 || fv->ftype->ftype == FT_IPv6"
); } while (0)
;
1154 ws_assert(fv->ftype->get_value.get_value_bytes)do { if ((1) && !(fv->ftype->get_value.get_value_bytes
)) ws_log_fatal_full("", LOG_LEVEL_ERROR, "epan/ftypes/ftypes.c"
, 1154, __func__, "assertion failed: %s", "fv->ftype->get_value.get_value_bytes"
); } while (0)
;
1155 return fv->ftype->get_value.get_value_bytes(fv);
1156}
1157
1158size_t
1159fvalue_get_bytes_size(fvalue_t *fv)
1160{
1161 GBytes *bytes = fvalue_get_bytes(fv);
1162 size_t size = g_bytes_get_size(bytes);
1163 g_bytes_unref(bytes);
1164 return size;
1165}
1166
1167const void *
1168fvalue_get_bytes_data(fvalue_t *fv)
1169{
1170 GBytes *bytes = fvalue_get_bytes(fv);
1171 const void *data = g_bytes_get_data(bytes, NULL((void*)0));
1172 g_bytes_unref(bytes);
1173 return data;
1174}
1175
1176const e_guid_t *
1177fvalue_get_guid(fvalue_t *fv)
1178{
1179 ws_assert(fv->ftype->ftype == FT_GUID)do { if ((1) && !(fv->ftype->ftype == FT_GUID))
ws_log_fatal_full("", LOG_LEVEL_ERROR, "epan/ftypes/ftypes.c"
, 1179, __func__, "assertion failed: %s", "fv->ftype->ftype == FT_GUID"
); } while (0)
;
1180 ws_assert(fv->ftype->get_value.get_value_guid)do { if ((1) && !(fv->ftype->get_value.get_value_guid
)) ws_log_fatal_full("", LOG_LEVEL_ERROR, "epan/ftypes/ftypes.c"
, 1180, __func__, "assertion failed: %s", "fv->ftype->get_value.get_value_guid"
); } while (0)
;
1181 return fv->ftype->get_value.get_value_guid(fv);
1182}
1183
1184const nstime_t *
1185fvalue_get_time(fvalue_t *fv)
1186{
1187 ws_assert(FT_IS_TIME(fv->ftype->ftype))do { if ((1) && !(((fv->ftype->ftype) == FT_ABSOLUTE_TIME
|| (fv->ftype->ftype) == FT_RELATIVE_TIME))) ws_log_fatal_full
("", LOG_LEVEL_ERROR, "epan/ftypes/ftypes.c", 1187, __func__,
"assertion failed: %s", "((fv->ftype->ftype) == FT_ABSOLUTE_TIME || (fv->ftype->ftype) == FT_RELATIVE_TIME)"
); } while (0)
;
1188 ws_assert(fv->ftype->get_value.get_value_time)do { if ((1) && !(fv->ftype->get_value.get_value_time
)) ws_log_fatal_full("", LOG_LEVEL_ERROR, "epan/ftypes/ftypes.c"
, 1188, __func__, "assertion failed: %s", "fv->ftype->get_value.get_value_time"
); } while (0)
;
1189 return fv->ftype->get_value.get_value_time(fv);
1190}
1191
1192const char *
1193fvalue_get_string(fvalue_t *fv)
1194{
1195 return wmem_strbuf_get_str(fvalue_get_strbuf(fv));
1196}
1197
1198const wmem_strbuf_t *
1199fvalue_get_strbuf(fvalue_t *fv)
1200{
1201 ws_assert(FT_IS_STRING(fv->ftype->ftype))do { if ((1) && !(((fv->ftype->ftype) == FT_STRING
|| (fv->ftype->ftype) == FT_STRINGZ || (fv->ftype->
ftype) == FT_STRINGZPAD || (fv->ftype->ftype) == FT_STRINGZTRUNC
|| (fv->ftype->ftype) == FT_UINT_STRING || (fv->ftype
->ftype) == FT_AX25))) ws_log_fatal_full("", LOG_LEVEL_ERROR
, "epan/ftypes/ftypes.c", 1201, __func__, "assertion failed: %s"
, "((fv->ftype->ftype) == FT_STRING || (fv->ftype->ftype) == FT_STRINGZ || (fv->ftype->ftype) == FT_STRINGZPAD || (fv->ftype->ftype) == FT_STRINGZTRUNC || (fv->ftype->ftype) == FT_UINT_STRING || (fv->ftype->ftype) == FT_AX25)"
); } while (0)
;
1202 ws_assert(fv->ftype->get_value.get_value_strbuf)do { if ((1) && !(fv->ftype->get_value.get_value_strbuf
)) ws_log_fatal_full("", LOG_LEVEL_ERROR, "epan/ftypes/ftypes.c"
, 1202, __func__, "assertion failed: %s", "fv->ftype->get_value.get_value_strbuf"
); } while (0)
;
1203 return fv->ftype->get_value.get_value_strbuf(fv);
1204}
1205
1206tvbuff_t *
1207fvalue_get_protocol(fvalue_t *fv)
1208{
1209 ws_assert(fv->ftype->ftype == FT_PROTOCOL)do { if ((1) && !(fv->ftype->ftype == FT_PROTOCOL
)) ws_log_fatal_full("", LOG_LEVEL_ERROR, "epan/ftypes/ftypes.c"
, 1209, __func__, "assertion failed: %s", "fv->ftype->ftype == FT_PROTOCOL"
); } while (0)
;
1210 ws_assert(fv->ftype->get_value.get_value_protocol)do { if ((1) && !(fv->ftype->get_value.get_value_protocol
)) ws_log_fatal_full("", LOG_LEVEL_ERROR, "epan/ftypes/ftypes.c"
, 1210, __func__, "assertion failed: %s", "fv->ftype->get_value.get_value_protocol"
); } while (0)
;
1211 return fv->ftype->get_value.get_value_protocol(fv);
1212}
1213
1214uint32_t
1215fvalue_get_uinteger(fvalue_t *fv)
1216{
1217 ws_assert(fv->ftype->ftype == FT_IEEE_11073_SFLOAT ||do { if ((1) && !(fv->ftype->ftype == FT_IEEE_11073_SFLOAT
|| fv->ftype->ftype == FT_IEEE_11073_FLOAT || fv->ftype
->ftype == FT_CHAR || fv->ftype->ftype == FT_UINT8 ||
fv->ftype->ftype == FT_UINT16 || fv->ftype->ftype
== FT_UINT24 || fv->ftype->ftype == FT_UINT32 || fv->
ftype->ftype == FT_IPXNET || fv->ftype->ftype == FT_FRAMENUM
)) ws_log_fatal_full("", LOG_LEVEL_ERROR, "epan/ftypes/ftypes.c"
, 1225, __func__, "assertion failed: %s", "fv->ftype->ftype == FT_IEEE_11073_SFLOAT || fv->ftype->ftype == FT_IEEE_11073_FLOAT || fv->ftype->ftype == FT_CHAR || fv->ftype->ftype == FT_UINT8 || fv->ftype->ftype == FT_UINT16 || fv->ftype->ftype == FT_UINT24 || fv->ftype->ftype == FT_UINT32 || fv->ftype->ftype == FT_IPXNET || fv->ftype->ftype == FT_FRAMENUM"
); } while (0)
1218 fv->ftype->ftype == FT_IEEE_11073_FLOAT ||do { if ((1) && !(fv->ftype->ftype == FT_IEEE_11073_SFLOAT
|| fv->ftype->ftype == FT_IEEE_11073_FLOAT || fv->ftype
->ftype == FT_CHAR || fv->ftype->ftype == FT_UINT8 ||
fv->ftype->ftype == FT_UINT16 || fv->ftype->ftype
== FT_UINT24 || fv->ftype->ftype == FT_UINT32 || fv->
ftype->ftype == FT_IPXNET || fv->ftype->ftype == FT_FRAMENUM
)) ws_log_fatal_full("", LOG_LEVEL_ERROR, "epan/ftypes/ftypes.c"
, 1225, __func__, "assertion failed: %s", "fv->ftype->ftype == FT_IEEE_11073_SFLOAT || fv->ftype->ftype == FT_IEEE_11073_FLOAT || fv->ftype->ftype == FT_CHAR || fv->ftype->ftype == FT_UINT8 || fv->ftype->ftype == FT_UINT16 || fv->ftype->ftype == FT_UINT24 || fv->ftype->ftype == FT_UINT32 || fv->ftype->ftype == FT_IPXNET || fv->ftype->ftype == FT_FRAMENUM"
); } while (0)
1219 fv->ftype->ftype == FT_CHAR ||do { if ((1) && !(fv->ftype->ftype == FT_IEEE_11073_SFLOAT
|| fv->ftype->ftype == FT_IEEE_11073_FLOAT || fv->ftype
->ftype == FT_CHAR || fv->ftype->ftype == FT_UINT8 ||
fv->ftype->ftype == FT_UINT16 || fv->ftype->ftype
== FT_UINT24 || fv->ftype->ftype == FT_UINT32 || fv->
ftype->ftype == FT_IPXNET || fv->ftype->ftype == FT_FRAMENUM
)) ws_log_fatal_full("", LOG_LEVEL_ERROR, "epan/ftypes/ftypes.c"
, 1225, __func__, "assertion failed: %s", "fv->ftype->ftype == FT_IEEE_11073_SFLOAT || fv->ftype->ftype == FT_IEEE_11073_FLOAT || fv->ftype->ftype == FT_CHAR || fv->ftype->ftype == FT_UINT8 || fv->ftype->ftype == FT_UINT16 || fv->ftype->ftype == FT_UINT24 || fv->ftype->ftype == FT_UINT32 || fv->ftype->ftype == FT_IPXNET || fv->ftype->ftype == FT_FRAMENUM"
); } while (0)
1220 fv->ftype->ftype == FT_UINT8 ||do { if ((1) && !(fv->ftype->ftype == FT_IEEE_11073_SFLOAT
|| fv->ftype->ftype == FT_IEEE_11073_FLOAT || fv->ftype
->ftype == FT_CHAR || fv->ftype->ftype == FT_UINT8 ||
fv->ftype->ftype == FT_UINT16 || fv->ftype->ftype
== FT_UINT24 || fv->ftype->ftype == FT_UINT32 || fv->
ftype->ftype == FT_IPXNET || fv->ftype->ftype == FT_FRAMENUM
)) ws_log_fatal_full("", LOG_LEVEL_ERROR, "epan/ftypes/ftypes.c"
, 1225, __func__, "assertion failed: %s", "fv->ftype->ftype == FT_IEEE_11073_SFLOAT || fv->ftype->ftype == FT_IEEE_11073_FLOAT || fv->ftype->ftype == FT_CHAR || fv->ftype->ftype == FT_UINT8 || fv->ftype->ftype == FT_UINT16 || fv->ftype->ftype == FT_UINT24 || fv->ftype->ftype == FT_UINT32 || fv->ftype->ftype == FT_IPXNET || fv->ftype->ftype == FT_FRAMENUM"
); } while (0)
1221 fv->ftype->ftype == FT_UINT16 ||do { if ((1) && !(fv->ftype->ftype == FT_IEEE_11073_SFLOAT
|| fv->ftype->ftype == FT_IEEE_11073_FLOAT || fv->ftype
->ftype == FT_CHAR || fv->ftype->ftype == FT_UINT8 ||
fv->ftype->ftype == FT_UINT16 || fv->ftype->ftype
== FT_UINT24 || fv->ftype->ftype == FT_UINT32 || fv->
ftype->ftype == FT_IPXNET || fv->ftype->ftype == FT_FRAMENUM
)) ws_log_fatal_full("", LOG_LEVEL_ERROR, "epan/ftypes/ftypes.c"
, 1225, __func__, "assertion failed: %s", "fv->ftype->ftype == FT_IEEE_11073_SFLOAT || fv->ftype->ftype == FT_IEEE_11073_FLOAT || fv->ftype->ftype == FT_CHAR || fv->ftype->ftype == FT_UINT8 || fv->ftype->ftype == FT_UINT16 || fv->ftype->ftype == FT_UINT24 || fv->ftype->ftype == FT_UINT32 || fv->ftype->ftype == FT_IPXNET || fv->ftype->ftype == FT_FRAMENUM"
); } while (0)
1222 fv->ftype->ftype == FT_UINT24 ||do { if ((1) && !(fv->ftype->ftype == FT_IEEE_11073_SFLOAT
|| fv->ftype->ftype == FT_IEEE_11073_FLOAT || fv->ftype
->ftype == FT_CHAR || fv->ftype->ftype == FT_UINT8 ||
fv->ftype->ftype == FT_UINT16 || fv->ftype->ftype
== FT_UINT24 || fv->ftype->ftype == FT_UINT32 || fv->
ftype->ftype == FT_IPXNET || fv->ftype->ftype == FT_FRAMENUM
)) ws_log_fatal_full("", LOG_LEVEL_ERROR, "epan/ftypes/ftypes.c"
, 1225, __func__, "assertion failed: %s", "fv->ftype->ftype == FT_IEEE_11073_SFLOAT || fv->ftype->ftype == FT_IEEE_11073_FLOAT || fv->ftype->ftype == FT_CHAR || fv->ftype->ftype == FT_UINT8 || fv->ftype->ftype == FT_UINT16 || fv->ftype->ftype == FT_UINT24 || fv->ftype->ftype == FT_UINT32 || fv->ftype->ftype == FT_IPXNET || fv->ftype->ftype == FT_FRAMENUM"
); } while (0)
1223 fv->ftype->ftype == FT_UINT32 ||do { if ((1) && !(fv->ftype->ftype == FT_IEEE_11073_SFLOAT
|| fv->ftype->ftype == FT_IEEE_11073_FLOAT || fv->ftype
->ftype == FT_CHAR || fv->ftype->ftype == FT_UINT8 ||
fv->ftype->ftype == FT_UINT16 || fv->ftype->ftype
== FT_UINT24 || fv->ftype->ftype == FT_UINT32 || fv->
ftype->ftype == FT_IPXNET || fv->ftype->ftype == FT_FRAMENUM
)) ws_log_fatal_full("", LOG_LEVEL_ERROR, "epan/ftypes/ftypes.c"
, 1225, __func__, "assertion failed: %s", "fv->ftype->ftype == FT_IEEE_11073_SFLOAT || fv->ftype->ftype == FT_IEEE_11073_FLOAT || fv->ftype->ftype == FT_CHAR || fv->ftype->ftype == FT_UINT8 || fv->ftype->ftype == FT_UINT16 || fv->ftype->ftype == FT_UINT24 || fv->ftype->ftype == FT_UINT32 || fv->ftype->ftype == FT_IPXNET || fv->ftype->ftype == FT_FRAMENUM"
); } while (0)
1224 fv->ftype->ftype == FT_IPXNET ||do { if ((1) && !(fv->ftype->ftype == FT_IEEE_11073_SFLOAT
|| fv->ftype->ftype == FT_IEEE_11073_FLOAT || fv->ftype
->ftype == FT_CHAR || fv->ftype->ftype == FT_UINT8 ||
fv->ftype->ftype == FT_UINT16 || fv->ftype->ftype
== FT_UINT24 || fv->ftype->ftype == FT_UINT32 || fv->
ftype->ftype == FT_IPXNET || fv->ftype->ftype == FT_FRAMENUM
)) ws_log_fatal_full("", LOG_LEVEL_ERROR, "epan/ftypes/ftypes.c"
, 1225, __func__, "assertion failed: %s", "fv->ftype->ftype == FT_IEEE_11073_SFLOAT || fv->ftype->ftype == FT_IEEE_11073_FLOAT || fv->ftype->ftype == FT_CHAR || fv->ftype->ftype == FT_UINT8 || fv->ftype->ftype == FT_UINT16 || fv->ftype->ftype == FT_UINT24 || fv->ftype->ftype == FT_UINT32 || fv->ftype->ftype == FT_IPXNET || fv->ftype->ftype == FT_FRAMENUM"
); } while (0)
1225 fv->ftype->ftype == FT_FRAMENUM)do { if ((1) && !(fv->ftype->ftype == FT_IEEE_11073_SFLOAT
|| fv->ftype->ftype == FT_IEEE_11073_FLOAT || fv->ftype
->ftype == FT_CHAR || fv->ftype->ftype == FT_UINT8 ||
fv->ftype->ftype == FT_UINT16 || fv->ftype->ftype
== FT_UINT24 || fv->ftype->ftype == FT_UINT32 || fv->
ftype->ftype == FT_IPXNET || fv->ftype->ftype == FT_FRAMENUM
)) ws_log_fatal_full("", LOG_LEVEL_ERROR, "epan/ftypes/ftypes.c"
, 1225, __func__, "assertion failed: %s", "fv->ftype->ftype == FT_IEEE_11073_SFLOAT || fv->ftype->ftype == FT_IEEE_11073_FLOAT || fv->ftype->ftype == FT_CHAR || fv->ftype->ftype == FT_UINT8 || fv->ftype->ftype == FT_UINT16 || fv->ftype->ftype == FT_UINT24 || fv->ftype->ftype == FT_UINT32 || fv->ftype->ftype == FT_IPXNET || fv->ftype->ftype == FT_FRAMENUM"
); } while (0)
;
1226 ws_assert(fv->ftype->get_value.get_value_uinteger)do { if ((1) && !(fv->ftype->get_value.get_value_uinteger
)) ws_log_fatal_full("", LOG_LEVEL_ERROR, "epan/ftypes/ftypes.c"
, 1226, __func__, "assertion failed: %s", "fv->ftype->get_value.get_value_uinteger"
); } while (0)
;
1227 return fv->ftype->get_value.get_value_uinteger(fv);
1228}
1229
1230int32_t
1231fvalue_get_sinteger(fvalue_t *fv)
1232{
1233 ws_assert(fv->ftype->ftype == FT_INT8 ||do { if ((1) && !(fv->ftype->ftype == FT_INT8 ||
fv->ftype->ftype == FT_INT16 || fv->ftype->ftype
== FT_INT24 || fv->ftype->ftype == FT_INT32)) ws_log_fatal_full
("", LOG_LEVEL_ERROR, "epan/ftypes/ftypes.c", 1236, __func__,
"assertion failed: %s", "fv->ftype->ftype == FT_INT8 || fv->ftype->ftype == FT_INT16 || fv->ftype->ftype == FT_INT24 || fv->ftype->ftype == FT_INT32"
); } while (0)
1234 fv->ftype->ftype == FT_INT16 ||do { if ((1) && !(fv->ftype->ftype == FT_INT8 ||
fv->ftype->ftype == FT_INT16 || fv->ftype->ftype
== FT_INT24 || fv->ftype->ftype == FT_INT32)) ws_log_fatal_full
("", LOG_LEVEL_ERROR, "epan/ftypes/ftypes.c", 1236, __func__,
"assertion failed: %s", "fv->ftype->ftype == FT_INT8 || fv->ftype->ftype == FT_INT16 || fv->ftype->ftype == FT_INT24 || fv->ftype->ftype == FT_INT32"
); } while (0)
1235 fv->ftype->ftype == FT_INT24 ||do { if ((1) && !(fv->ftype->ftype == FT_INT8 ||
fv->ftype->ftype == FT_INT16 || fv->ftype->ftype
== FT_INT24 || fv->ftype->ftype == FT_INT32)) ws_log_fatal_full
("", LOG_LEVEL_ERROR, "epan/ftypes/ftypes.c", 1236, __func__,
"assertion failed: %s", "fv->ftype->ftype == FT_INT8 || fv->ftype->ftype == FT_INT16 || fv->ftype->ftype == FT_INT24 || fv->ftype->ftype == FT_INT32"
); } while (0)
1236 fv->ftype->ftype == FT_INT32)do { if ((1) && !(fv->ftype->ftype == FT_INT8 ||
fv->ftype->ftype == FT_INT16 || fv->ftype->ftype
== FT_INT24 || fv->ftype->ftype == FT_INT32)) ws_log_fatal_full
("", LOG_LEVEL_ERROR, "epan/ftypes/ftypes.c", 1236, __func__,
"assertion failed: %s", "fv->ftype->ftype == FT_INT8 || fv->ftype->ftype == FT_INT16 || fv->ftype->ftype == FT_INT24 || fv->ftype->ftype == FT_INT32"
); } while (0)
;
1237 ws_assert(fv->ftype->get_value.get_value_sinteger)do { if ((1) && !(fv->ftype->get_value.get_value_sinteger
)) ws_log_fatal_full("", LOG_LEVEL_ERROR, "epan/ftypes/ftypes.c"
, 1237, __func__, "assertion failed: %s", "fv->ftype->get_value.get_value_sinteger"
); } while (0)
;
1238 return fv->ftype->get_value.get_value_sinteger(fv);
1239}
1240
1241uint64_t
1242fvalue_get_uinteger64(fvalue_t *fv)
1243{
1244 ws_assert(fv->ftype->ftype == FT_UINT40 ||do { if ((1) && !(fv->ftype->ftype == FT_UINT40
|| fv->ftype->ftype == FT_UINT48 || fv->ftype->ftype
== FT_UINT56 || fv->ftype->ftype == FT_UINT64 || fv->
ftype->ftype == FT_BOOLEAN)) ws_log_fatal_full("", LOG_LEVEL_ERROR
, "epan/ftypes/ftypes.c", 1248, __func__, "assertion failed: %s"
, "fv->ftype->ftype == FT_UINT40 || fv->ftype->ftype == FT_UINT48 || fv->ftype->ftype == FT_UINT56 || fv->ftype->ftype == FT_UINT64 || fv->ftype->ftype == FT_BOOLEAN"
); } while (0)
1245 fv->ftype->ftype == FT_UINT48 ||do { if ((1) && !(fv->ftype->ftype == FT_UINT40
|| fv->ftype->ftype == FT_UINT48 || fv->ftype->ftype
== FT_UINT56 || fv->ftype->ftype == FT_UINT64 || fv->
ftype->ftype == FT_BOOLEAN)) ws_log_fatal_full("", LOG_LEVEL_ERROR
, "epan/ftypes/ftypes.c", 1248, __func__, "assertion failed: %s"
, "fv->ftype->ftype == FT_UINT40 || fv->ftype->ftype == FT_UINT48 || fv->ftype->ftype == FT_UINT56 || fv->ftype->ftype == FT_UINT64 || fv->ftype->ftype == FT_BOOLEAN"
); } while (0)
1246 fv->ftype->ftype == FT_UINT56 ||do { if ((1) && !(fv->ftype->ftype == FT_UINT40
|| fv->ftype->ftype == FT_UINT48 || fv->ftype->ftype
== FT_UINT56 || fv->ftype->ftype == FT_UINT64 || fv->
ftype->ftype == FT_BOOLEAN)) ws_log_fatal_full("", LOG_LEVEL_ERROR
, "epan/ftypes/ftypes.c", 1248, __func__, "assertion failed: %s"
, "fv->ftype->ftype == FT_UINT40 || fv->ftype->ftype == FT_UINT48 || fv->ftype->ftype == FT_UINT56 || fv->ftype->ftype == FT_UINT64 || fv->ftype->ftype == FT_BOOLEAN"
); } while (0)
1247 fv->ftype->ftype == FT_UINT64 ||do { if ((1) && !(fv->ftype->ftype == FT_UINT40
|| fv->ftype->ftype == FT_UINT48 || fv->ftype->ftype
== FT_UINT56 || fv->ftype->ftype == FT_UINT64 || fv->
ftype->ftype == FT_BOOLEAN)) ws_log_fatal_full("", LOG_LEVEL_ERROR
, "epan/ftypes/ftypes.c", 1248, __func__, "assertion failed: %s"
, "fv->ftype->ftype == FT_UINT40 || fv->ftype->ftype == FT_UINT48 || fv->ftype->ftype == FT_UINT56 || fv->ftype->ftype == FT_UINT64 || fv->ftype->ftype == FT_BOOLEAN"
); } while (0)
1248 fv->ftype->ftype == FT_BOOLEAN)do { if ((1) && !(fv->ftype->ftype == FT_UINT40
|| fv->ftype->ftype == FT_UINT48 || fv->ftype->ftype
== FT_UINT56 || fv->ftype->ftype == FT_UINT64 || fv->
ftype->ftype == FT_BOOLEAN)) ws_log_fatal_full("", LOG_LEVEL_ERROR
, "epan/ftypes/ftypes.c", 1248, __func__, "assertion failed: %s"
, "fv->ftype->ftype == FT_UINT40 || fv->ftype->ftype == FT_UINT48 || fv->ftype->ftype == FT_UINT56 || fv->ftype->ftype == FT_UINT64 || fv->ftype->ftype == FT_BOOLEAN"
); } while (0)
;
1249 ws_assert(fv->ftype->get_value.get_value_uinteger64)do { if ((1) && !(fv->ftype->get_value.get_value_uinteger64
)) ws_log_fatal_full("", LOG_LEVEL_ERROR, "epan/ftypes/ftypes.c"
, 1249, __func__, "assertion failed: %s", "fv->ftype->get_value.get_value_uinteger64"
); } while (0)
;
1250 return fv->ftype->get_value.get_value_uinteger64(fv);
1251}
1252
1253int64_t
1254fvalue_get_sinteger64(fvalue_t *fv)
1255{
1256 ws_assert(fv->ftype->ftype == FT_INT40 ||do { if ((1) && !(fv->ftype->ftype == FT_INT40 ||
fv->ftype->ftype == FT_INT48 || fv->ftype->ftype
== FT_INT56 || fv->ftype->ftype == FT_INT64)) ws_log_fatal_full
("", LOG_LEVEL_ERROR, "epan/ftypes/ftypes.c", 1259, __func__,
"assertion failed: %s", "fv->ftype->ftype == FT_INT40 || fv->ftype->ftype == FT_INT48 || fv->ftype->ftype == FT_INT56 || fv->ftype->ftype == FT_INT64"
); } while (0)
1257 fv->ftype->ftype == FT_INT48 ||do { if ((1) && !(fv->ftype->ftype == FT_INT40 ||
fv->ftype->ftype == FT_INT48 || fv->ftype->ftype
== FT_INT56 || fv->ftype->ftype == FT_INT64)) ws_log_fatal_full
("", LOG_LEVEL_ERROR, "epan/ftypes/ftypes.c", 1259, __func__,
"assertion failed: %s", "fv->ftype->ftype == FT_INT40 || fv->ftype->ftype == FT_INT48 || fv->ftype->ftype == FT_INT56 || fv->ftype->ftype == FT_INT64"
); } while (0)
1258 fv->ftype->ftype == FT_INT56 ||do { if ((1) && !(fv->ftype->ftype == FT_INT40 ||
fv->ftype->ftype == FT_INT48 || fv->ftype->ftype
== FT_INT56 || fv->ftype->ftype == FT_INT64)) ws_log_fatal_full
("", LOG_LEVEL_ERROR, "epan/ftypes/ftypes.c", 1259, __func__,
"assertion failed: %s", "fv->ftype->ftype == FT_INT40 || fv->ftype->ftype == FT_INT48 || fv->ftype->ftype == FT_INT56 || fv->ftype->ftype == FT_INT64"
); } while (0)
1259 fv->ftype->ftype == FT_INT64)do { if ((1) && !(fv->ftype->ftype == FT_INT40 ||
fv->ftype->ftype == FT_INT48 || fv->ftype->ftype
== FT_INT56 || fv->ftype->ftype == FT_INT64)) ws_log_fatal_full
("", LOG_LEVEL_ERROR, "epan/ftypes/ftypes.c", 1259, __func__,
"assertion failed: %s", "fv->ftype->ftype == FT_INT40 || fv->ftype->ftype == FT_INT48 || fv->ftype->ftype == FT_INT56 || fv->ftype->ftype == FT_INT64"
); } while (0)
;
1260 ws_assert(fv->ftype->get_value.get_value_sinteger64)do { if ((1) && !(fv->ftype->get_value.get_value_sinteger64
)) ws_log_fatal_full("", LOG_LEVEL_ERROR, "epan/ftypes/ftypes.c"
, 1260, __func__, "assertion failed: %s", "fv->ftype->get_value.get_value_sinteger64"
); } while (0)
;
1261 return fv->ftype->get_value.get_value_sinteger64(fv);
1262}
1263
1264double
1265fvalue_get_floating(fvalue_t *fv)
1266{
1267 ws_assert(fv->ftype->ftype == FT_FLOAT ||do { if ((1) && !(fv->ftype->ftype == FT_FLOAT ||
fv->ftype->ftype == FT_DOUBLE)) ws_log_fatal_full("", LOG_LEVEL_ERROR
, "epan/ftypes/ftypes.c", 1268, __func__, "assertion failed: %s"
, "fv->ftype->ftype == FT_FLOAT || fv->ftype->ftype == FT_DOUBLE"
); } while (0)
1268 fv->ftype->ftype == FT_DOUBLE)do { if ((1) && !(fv->ftype->ftype == FT_FLOAT ||
fv->ftype->ftype == FT_DOUBLE)) ws_log_fatal_full("", LOG_LEVEL_ERROR
, "epan/ftypes/ftypes.c", 1268, __func__, "assertion failed: %s"
, "fv->ftype->ftype == FT_FLOAT || fv->ftype->ftype == FT_DOUBLE"
); } while (0)
;
1269 ws_assert(fv->ftype->get_value.get_value_floating)do { if ((1) && !(fv->ftype->get_value.get_value_floating
)) ws_log_fatal_full("", LOG_LEVEL_ERROR, "epan/ftypes/ftypes.c"
, 1269, __func__, "assertion failed: %s", "fv->ftype->get_value.get_value_floating"
); } while (0)
;
1270 return fv->ftype->get_value.get_value_floating(fv);
1271}
1272
1273const ipv4_addr_and_mask *
1274fvalue_get_ipv4(fvalue_t *fv)
1275{
1276 ws_assert(fv->ftype->ftype == FT_IPv4)do { if ((1) && !(fv->ftype->ftype == FT_IPv4))
ws_log_fatal_full("", LOG_LEVEL_ERROR, "epan/ftypes/ftypes.c"
, 1276, __func__, "assertion failed: %s", "fv->ftype->ftype == FT_IPv4"
); } while (0)
;
1277 ws_assert(fv->ftype->get_value.get_value_ipv4)do { if ((1) && !(fv->ftype->get_value.get_value_ipv4
)) ws_log_fatal_full("", LOG_LEVEL_ERROR, "epan/ftypes/ftypes.c"
, 1277, __func__, "assertion failed: %s", "fv->ftype->get_value.get_value_ipv4"
); } while (0)
;
1278 return fv->ftype->get_value.get_value_ipv4(fv);
1279}
1280
1281const ipv6_addr_and_prefix *
1282fvalue_get_ipv6(fvalue_t *fv)
1283{
1284 ws_assert(fv->ftype->ftype == FT_IPv6)do { if ((1) && !(fv->ftype->ftype == FT_IPv6))
ws_log_fatal_full("", LOG_LEVEL_ERROR, "epan/ftypes/ftypes.c"
, 1284, __func__, "assertion failed: %s", "fv->ftype->ftype == FT_IPv6"
); } while (0)
;
1285 ws_assert(fv->ftype->get_value.get_value_ipv6)do { if ((1) && !(fv->ftype->get_value.get_value_ipv6
)) ws_log_fatal_full("", LOG_LEVEL_ERROR, "epan/ftypes/ftypes.c"
, 1285, __func__, "assertion failed: %s", "fv->ftype->get_value.get_value_ipv6"
); } while (0)
;
1286 return fv->ftype->get_value.get_value_ipv6(fv);
1287}
1288
1289ft_bool_t
1290fvalue_eq(const fvalue_t *a, const fvalue_t *b)
1291{
1292 int cmp;
1293 enum ft_result res;
1294
1295 ws_assert(a->ftype->compare)do { if ((1) && !(a->ftype->compare)) ws_log_fatal_full
("", LOG_LEVEL_ERROR, "epan/ftypes/ftypes.c", 1295, __func__,
"assertion failed: %s", "a->ftype->compare"); } while (
0)
;
1296 res = a->ftype->compare(a, b, &cmp);
1297 if (res != FT_OK)
1298 return -res;
1299 return cmp == 0 ? FT_TRUE1 : FT_FALSE0;
1300}
1301
1302ft_bool_t
1303fvalue_ne(const fvalue_t *a, const fvalue_t *b)
1304{
1305 int cmp;
1306 enum ft_result res;
1307
1308 ws_assert(a->ftype->compare)do { if ((1) && !(a->ftype->compare)) ws_log_fatal_full
("", LOG_LEVEL_ERROR, "epan/ftypes/ftypes.c", 1308, __func__,
"assertion failed: %s", "a->ftype->compare"); } while (
0)
;
1309 res = a->ftype->compare(a, b, &cmp);
1310 if (res != FT_OK)
1311 return -res;
1312 return cmp != 0 ? FT_TRUE1 : FT_FALSE0;
1313}
1314
1315ft_bool_t
1316fvalue_gt(const fvalue_t *a, const fvalue_t *b)
1317{
1318 int cmp;
1319 enum ft_result res;
1320
1321 ws_assert(a->ftype->compare)do { if ((1) && !(a->ftype->compare)) ws_log_fatal_full
("", LOG_LEVEL_ERROR, "epan/ftypes/ftypes.c", 1321, __func__,
"assertion failed: %s", "a->ftype->compare"); } while (
0)
;
1322 res = a->ftype->compare(a, b, &cmp);
1323 if (res != FT_OK)
1324 return -res;
1325 return cmp > 0 ? FT_TRUE1 : FT_FALSE0;
1326}
1327
1328ft_bool_t
1329fvalue_ge(const fvalue_t *a, const fvalue_t *b)
1330{
1331 int cmp;
1332 enum ft_result res;
1333
1334 ws_assert(a->ftype->compare)do { if ((1) && !(a->ftype->compare)) ws_log_fatal_full
("", LOG_LEVEL_ERROR, "epan/ftypes/ftypes.c", 1334, __func__,
"assertion failed: %s", "a->ftype->compare"); } while (
0)
;
1335 res = a->ftype->compare(a, b, &cmp);
1336 if (res != FT_OK)
1337 return -res;
1338 return cmp >= 0 ? FT_TRUE1 : FT_FALSE0;
1339}
1340
1341ft_bool_t
1342fvalue_lt(const fvalue_t *a, const fvalue_t *b)
1343{
1344 int cmp;
1345 enum ft_result res;
1346
1347 ws_assert(a->ftype->compare)do { if ((1) && !(a->ftype->compare)) ws_log_fatal_full
("", LOG_LEVEL_ERROR, "epan/ftypes/ftypes.c", 1347, __func__,
"assertion failed: %s", "a->ftype->compare"); } while (
0)
;
1348 res = a->ftype->compare(a, b, &cmp);
1349 if (res != FT_OK)
1350 return -res;
1351 return cmp < 0 ? FT_TRUE1 : FT_FALSE0;
1352}
1353
1354ft_bool_t
1355fvalue_le(const fvalue_t *a, const fvalue_t *b)
1356{
1357 int cmp;
1358 enum ft_result res;
1359
1360 ws_assert(a->ftype->compare)do { if ((1) && !(a->ftype->compare)) ws_log_fatal_full
("", LOG_LEVEL_ERROR, "epan/ftypes/ftypes.c", 1360, __func__,
"assertion failed: %s", "a->ftype->compare"); } while (
0)
;
1361 res = a->ftype->compare(a, b, &cmp);
1362 if (res != FT_OK)
1363 return -res;
1364 return cmp <= 0 ? FT_TRUE1 : FT_FALSE0;
1365}
1366
1367ft_bool_t
1368fvalue_contains(const fvalue_t *a, const fvalue_t *b)
1369{
1370 bool_Bool yes;
1371 enum ft_result res;
1372
1373 ws_assert(a->ftype->contains)do { if ((1) && !(a->ftype->contains)) ws_log_fatal_full
("", LOG_LEVEL_ERROR, "epan/ftypes/ftypes.c", 1373, __func__,
"assertion failed: %s", "a->ftype->contains"); } while
(0)
;
1374 res = a->ftype->contains(a, b, &yes);
1375 if (res != FT_OK)
1376 return -res;
1377 return yes ? FT_TRUE1 : FT_FALSE0;
1378}
1379
1380ft_bool_t
1381fvalue_matches(const fvalue_t *a, const ws_regex_t *re)
1382{
1383 bool_Bool yes;
1384 enum ft_result res;
1385
1386 ws_assert(a->ftype->matches)do { if ((1) && !(a->ftype->matches)) ws_log_fatal_full
("", LOG_LEVEL_ERROR, "epan/ftypes/ftypes.c", 1386, __func__,
"assertion failed: %s", "a->ftype->matches"); } while (
0)
;
1387 res = a->ftype->matches(a, re, &yes);
1388 if (res != FT_OK)
1389 return -res;
1390 return yes ? FT_TRUE1 : FT_FALSE0;
1391}
1392
1393bool_Bool
1394fvalue_is_zero(const fvalue_t *a)
1395{
1396 return a->ftype->is_zero(a);
1397}
1398
1399bool_Bool
1400fvalue_is_negative(const fvalue_t *a)
1401{
1402 return a->ftype->is_negative(a);
1403}
1404
1405bool_Bool
1406fvalue_is_nan(const fvalue_t *a)
1407{
1408 return a->ftype->is_nan(a);
1409}
1410
1411static fvalue_t *
1412_fvalue_binop(FvalueBinaryOp op, const fvalue_t *a, const fvalue_t *b, char **err_msg)
1413{
1414 fvalue_t *result;
1415
1416 result = fvalue_new(a->ftype->ftype);
1417 if (op(result, a, b, err_msg) != FT_OK) {
1418 fvalue_free(result);
1419 return NULL((void*)0);
1420 }
1421 return result;
1422}
1423
1424fvalue_t *
1425fvalue_bitwise_and(const fvalue_t *a, const fvalue_t *b, char **err_msg)
1426{
1427 /* XXX - check compatibility of a and b */
1428 ws_assert(a->ftype->bitwise_and)do { if ((1) && !(a->ftype->bitwise_and)) ws_log_fatal_full
("", LOG_LEVEL_ERROR, "epan/ftypes/ftypes.c", 1428, __func__,
"assertion failed: %s", "a->ftype->bitwise_and"); } while
(0)
;
1429 return _fvalue_binop(a->ftype->bitwise_and, a, b, err_msg);
1430}
1431
1432fvalue_t *
1433fvalue_add(const fvalue_t *a, const fvalue_t *b, char **err_msg)
1434{
1435 /* XXX - check compatibility of a and b */
1436 ws_assert(a->ftype->add)do { if ((1) && !(a->ftype->add)) ws_log_fatal_full
("", LOG_LEVEL_ERROR, "epan/ftypes/ftypes.c", 1436, __func__,
"assertion failed: %s", "a->ftype->add"); } while (0)
;
1437 return _fvalue_binop(a->ftype->add, a, b, err_msg);
1438}
1439
1440fvalue_t *
1441fvalue_subtract(const fvalue_t *a, const fvalue_t *b, char **err_msg)
1442{
1443 /* XXX - check compatibility of a and b */
1444 ws_assert(a->ftype->subtract)do { if ((1) && !(a->ftype->subtract)) ws_log_fatal_full
("", LOG_LEVEL_ERROR, "epan/ftypes/ftypes.c", 1444, __func__,
"assertion failed: %s", "a->ftype->subtract"); } while
(0)
;
1445 return _fvalue_binop(a->ftype->subtract, a, b, err_msg);
1446}
1447
1448fvalue_t *
1449fvalue_multiply(const fvalue_t *a, const fvalue_t *b, char **err_msg)
1450{
1451 /* XXX - check compatibility of a and b */
1452 ws_assert(a->ftype->multiply)do { if ((1) && !(a->ftype->multiply)) ws_log_fatal_full
("", LOG_LEVEL_ERROR, "epan/ftypes/ftypes.c", 1452, __func__,
"assertion failed: %s", "a->ftype->multiply"); } while
(0)
;
1453 return _fvalue_binop(a->ftype->multiply, a, b, err_msg);
1454}
1455
1456fvalue_t *
1457fvalue_divide(const fvalue_t *a, const fvalue_t *b, char **err_msg)
1458{
1459 /* XXX - check compatibility of a and b */
1460 ws_assert(a->ftype->divide)do { if ((1) && !(a->ftype->divide)) ws_log_fatal_full
("", LOG_LEVEL_ERROR, "epan/ftypes/ftypes.c", 1460, __func__,
"assertion failed: %s", "a->ftype->divide"); } while (
0)
;
1461 return _fvalue_binop(a->ftype->divide, a, b, err_msg);
1462}
1463
1464fvalue_t *
1465fvalue_modulo(const fvalue_t *a, const fvalue_t *b, char **err_msg)
1466{
1467 /* XXX - check compatibility of a and b */
1468 ws_assert(a->ftype->modulo)do { if ((1) && !(a->ftype->modulo)) ws_log_fatal_full
("", LOG_LEVEL_ERROR, "epan/ftypes/ftypes.c", 1468, __func__,
"assertion failed: %s", "a->ftype->modulo"); } while (
0)
;
1469 return _fvalue_binop(a->ftype->modulo, a, b, err_msg);
1470}
1471
1472fvalue_t*
1473fvalue_unary_minus(const fvalue_t *fv, char **err_msg)
1474{
1475 fvalue_t *result;
1476
1477 ws_assert(fv->ftype->unary_minus)do { if ((1) && !(fv->ftype->unary_minus)) ws_log_fatal_full
("", LOG_LEVEL_ERROR, "epan/ftypes/ftypes.c", 1477, __func__,
"assertion failed: %s", "fv->ftype->unary_minus"); } while
(0)
;
1478
1479 result = fvalue_new(fv->ftype->ftype);
1480 if (fv->ftype->unary_minus(result, fv, err_msg) != FT_OK) {
1481 fvalue_free(result);
1482 return NULL((void*)0);
1483 }
1484 return result;
1485}
1486
1487unsigned
1488fvalue_hash(const fvalue_t *fv)
1489{
1490 ws_assert(fv->ftype->hash)do { if ((1) && !(fv->ftype->hash)) ws_log_fatal_full
("", LOG_LEVEL_ERROR, "epan/ftypes/ftypes.c", 1490, __func__,
"assertion failed: %s", "fv->ftype->hash"); } while (0
)
;
1491 return fv->ftype->hash(fv);
1492}
1493
1494bool_Bool
1495fvalue_equal(const fvalue_t *a, const fvalue_t *b)
1496{
1497 return fvalue_eq(a, b) == FT_TRUE1;
1498}
1499
1500/*
1501 * Editor modelines - https://www.wireshark.org/tools/modelines.html
1502 *
1503 * Local variables:
1504 * c-basic-offset: 8
1505 * tab-width: 8
1506 * indent-tabs-mode: t
1507 * End:
1508 *
1509 * vi: set shiftwidth=8 tabstop=8 noexpandtab:
1510 * :indentSize=8:tabSize=8:noTabs=false:
1511 */