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