2 * Definitions for protocol display
4 * Wireshark - Network traffic analyzer
5 * By Gerald Combs <gerald@wireshark.org>
6 * Copyright 1998 Gerald Combs
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version 2
11 * of the License, or (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
25 The protocol tree related functions.<BR>
26 A protocol tree will hold all necessary data to display the whole dissected packet.
27 Creating a protocol tree is done in a two stage process:
28 A static part at program startup, and a dynamic part when the dissection with the real packet data is done.<BR>
29 The "static" information is provided by creating a hf_register_info hf[] array, and register it using the
30 proto_register_field_array() function. This is usually done at dissector registering.<BR>
31 The "dynamic" information is added to the protocol tree by calling one of the proto_tree_add_...() functions,
32 e.g. proto_tree_add_bytes().
42 #include <epan/wmem/wmem.h>
45 #include "wsutil/nstime.h"
48 #include "ftypes/ftypes.h"
50 #include "ws_symbol_export.h"
54 #endif /* __cplusplus */
56 /** @defgroup prototree The Protocol Tree
58 * Dissectors use proto_tree_add_* to add items to the protocol tree. In
59 * most cases you'll want to use proto_tree_add_item().
64 /** The header-field index for the special text pseudo-field. Exported by libwireshark.dll */
65 WS_DLL_PUBLIC int hf_text_only;
67 /** the maximum length of a protocol field string representation */
68 #define ITEM_LABEL_LENGTH 240
73 /** Make a const value_string[] look like a _value_string pointer, used to set header_field_info.strings */
74 #define VALS(x) (const struct _value_string*)(x)
76 /** Make a const val64_string[] look like a _val64_string pointer, used to set header_field_info.strings */
77 #define VALS64(x) (const struct _val64_string*)(x)
79 /** Something to satisfy checkAPIs when you have a pointer to a value_string_ext (e.g., one built with value_string_ext_new()) */
80 #define VALS_EXT_PTR(x) (x)
82 /** Make a const true_false_string[] look like a _true_false_string pointer, used to set header_field_info.strings */
83 #define TFS(x) (const struct true_false_string*)(x)
85 typedef void (*custom_fmt_func_t)(gchar *, guint32);
87 typedef void (*custom_fmt_func_64_t)(gchar *, guint64);
89 /** Make a custom format function pointer look like a void pointer. Used to set header_field_info.strings.
91 * We cast to gsize first, which 1) is guaranteed to be wide enough to
92 * hold a pointer and 2) lets us side-step warnings about casting function
93 * pointers to 'void *'. This violates ISO C but should be fine on POSIX
96 #define CF_FUNC(x) ((const void *) (gsize) (x))
98 /** Make a const range_string[] look like a _range_string pointer, used to set
99 * header_field_info.strings */
100 #define RVALS(x) (const struct _range_string*)(x)
102 /** Cast a ft_framenum_type_t, used to set header_field_info.strings */
103 #define FRAMENUM_TYPE(x) GINT_TO_POINTER(x)
107 /** Structure for information about a protocol */
108 typedef struct _protocol protocol_t;
110 /** Function used for reporting errors in dissectors; it throws a
111 * DissectorError exception, with the string passed as an argument
112 * as the message for the exception, so that it can show up in
113 * the Info column and the protocol tree.
115 * If that string is dynamically allocated, it should be allocated with
116 * wmem_alloc() with wmem_packet_scope(); using wmem_strdup_printf() would work.
118 * If the WIRESHARK_ABORT_ON_DISSECTOR_BUG environment variable is set,
119 * it will call abort(), instead, to make it easier to get a stack trace.
121 * @param message string to use as the message
123 WS_DLL_PUBLIC WS_MSVC_NORETURN void proto_report_dissector_bug(const char *message) G_GNUC_NORETURN;
125 #define REPORT_DISSECTOR_BUG(message) \
126 proto_report_dissector_bug(message)
128 /** Macro used to provide a hint to static analysis tools.
129 * (Currently only Visual C++.)
132 /* XXX - Is there a way to say "quit checking at this point"? */
133 #define __DISSECTOR_ASSERT_STATIC_ANALYSIS_HINT(expression) \
134 ; __analysis_assume(expression);
136 #define __DISSECTOR_ASSERT_STATIC_ANALYSIS_HINT(expression)
139 /** Macro used for assertions in dissectors; it doesn't abort, it just
140 * throws a DissectorError exception, with the assertion failure
141 * message as a parameter, so that it can show up in the protocol tree.
143 * NOTE: this should only be used to detect bugs in the dissector (e.g., logic
144 * conditions that shouldn't happen). It should NOT be used for showing
145 * that a packet is malformed. For that, use expert_infos instead.
147 * @param s expression to test in the assertion
150 #define __DISSECTOR_ASSERT_STRINGIFY(s) # s
152 #define __DISSECTOR_ASSERT(expression, file, lineno) \
153 (REPORT_DISSECTOR_BUG( \
154 wmem_strdup_printf(wmem_packet_scope(), \
155 "%s:%u: failed assertion \"%s\"", \
156 file, lineno, __DISSECTOR_ASSERT_STRINGIFY(expression))))
158 #define __DISSECTOR_ASSERT_HINT(expression, file, lineno, hint) \
159 (REPORT_DISSECTOR_BUG( \
160 wmem_strdup_printf(wmem_packet_scope(), \
161 "%s:%u: failed assertion \"%s\" (%s)", \
162 file, lineno, __DISSECTOR_ASSERT_STRINGIFY(expression), hint)))
164 #define DISSECTOR_ASSERT(expression) \
165 ((void) ((expression) ? (void)0 : \
166 __DISSECTOR_ASSERT (expression, __FILE__, __LINE__))) \
167 __DISSECTOR_ASSERT_STATIC_ANALYSIS_HINT(expression)
170 * Same as DISSECTOR_ASSERT(), but takes an extra 'hint' parameter that
171 * can be used to provide information as to why the assertion might fail.
173 * @param expression expression to test in the assertion
174 * @param hint message providing extra information
176 #define DISSECTOR_ASSERT_HINT(expression, hint) \
177 ((void) ((expression) ? (void)0 : \
178 __DISSECTOR_ASSERT_HINT (expression, __FILE__, __LINE__, hint))) \
179 __DISSECTOR_ASSERT_STATIC_ANALYSIS_HINT(expression)
182 /* win32: using a debug breakpoint (int 3) can be very handy while debugging,
183 * as the assert handling of GTK/GLib is currently not very helpful */
184 #define DISSECTOR_ASSERT(expression) \
185 { if(!(expression)) _asm { int 3}; }
188 /** Same as DISSECTOR_ASSERT(), but will throw DissectorError exception
189 * unconditionally, much like GLIB's g_assert_not_reached works.
191 * NOTE: this should only be used to detect bugs in the dissector (e.g., logic
192 * conditions that shouldn't happen). It should NOT be used for showing
193 * that a packet is malformed. For that, use expert_infos instead.
196 #define DISSECTOR_ASSERT_NOT_REACHED() \
197 (REPORT_DISSECTOR_BUG( \
198 wmem_strdup_printf(wmem_packet_scope(), \
199 "%s:%u: failed assertion \"DISSECTOR_ASSERT_NOT_REACHED\"", \
200 __FILE__, __LINE__)))
202 /** Compare two integers.
204 * This is functionally the same as `DISSECTOR_ASSERT(a op b)` except that it
205 * will display the values of a and b upon failure.
207 * DISSECTOR_ASSERT_CMPINT(a, ==, b);
208 * DISSECTOR_ASSERT_CMPINT(min, <=, max);
210 * This function can currently compare values that fit inside a gint64.
212 * WARNING: The number of times the arguments are evaluated is undefined. Do
213 * not use expressions with side effects as arguments.
215 * @param a The first integer.
216 * @param op Any binary operator.
217 * @param b The second integer.
218 * @param type the type operator
219 * @param fmt the fmt operator
221 #define __DISSECTOR_ASSERT_CMPINT(a, op, b, type, fmt) \
222 (REPORT_DISSECTOR_BUG( \
223 wmem_strdup_printf(wmem_packet_scope(), \
224 "%s:%u: failed assertion " #a " " #op " " #b " (" fmt " " #op " " fmt ")", \
225 __FILE__, __LINE__, (type)a, (type)b)))
227 #define DISSECTOR_ASSERT_CMPINT(a, op, b) \
228 ((void) ((a op b) ? (void)0 : \
229 __DISSECTOR_ASSERT_CMPINT (a, op, b, gint64, "%" G_GINT64_MODIFIER "d"))) \
230 __DISSECTOR_ASSERT_STATIC_ANALYSIS_HINT(a op b)
232 /** Like DISSECTOR_ASSERT_CMPINT() except the arguments are treated as
235 * This function can currently compare values that fit inside a guint64.
237 #define DISSECTOR_ASSERT_CMPUINT(a, op, b) \
238 ((void) ((a op b) ? (void)0 : \
239 __DISSECTOR_ASSERT_CMPINT (a, op, b, guint64, "%" G_GINT64_MODIFIER "u"))) \
240 __DISSECTOR_ASSERT_STATIC_ANALYSIS_HINT(a op b)
242 /** Like DISSECTOR_ASSERT_CMPUINT() except the values are displayed in
243 * hexadecimal upon assertion failure.
245 #define DISSECTOR_ASSERT_CMPUINTHEX(a, op, b) \
246 ((void) ((a op b) ? (void)0 : \
247 __DISSECTOR_ASSERT_CMPINT (a, op, b, guint64, "0x%" G_GINT64_MODIFIER "X"))) \
248 __DISSECTOR_ASSERT_STATIC_ANALYSIS_HINT(a op b)
251 * This is similar to DISSECTOR_ASSERT(hfinfo->type == type) except that
252 * it will report the name of the field with the wrong type as well as
255 * @param hfinfo The hfinfo for the field being tested
256 * @param type The type it's expected to have
258 #define __DISSECTOR_ASSERT_FIELD_TYPE(hfinfo, t) \
259 (REPORT_DISSECTOR_BUG( \
260 wmem_strdup_printf(wmem_packet_scope(), \
261 "%s:%u: field %s is not of type "#t, \
262 __FILE__, __LINE__, (hfinfo)->abbrev)))
264 #define DISSECTOR_ASSERT_FIELD_TYPE(hfinfo, t) \
265 ((void) (((hfinfo)->type == t) ? (void)0 : \
266 __DISSECTOR_ASSERT_FIELD_TYPE ((hfinfo), t))) \
267 __DISSECTOR_ASSERT_STATIC_ANALYSIS_HINT((hfinfo)->type == t)
269 #define DISSECTOR_ASSERT_FIELD_TYPE_IS_INTEGRAL(hfinfo) \
270 ((void) ((IS_FT_INT((hfinfo)->type) || \
271 IS_FT_UINT((hfinfo)->type)) ? (void)0 : \
272 REPORT_DISSECTOR_BUG( \
273 wmem_strdup_printf(wmem_packet_scope(), \
274 "%s:%u: field %s is not of an FT_{U}INTn type", \
275 __FILE__, __LINE__, (hfinfo)->abbrev)))) \
276 __DISSECTOR_ASSERT_STATIC_ANALYSIS_HINT(IS_FT_INT((hfinfo)->type) || \
277 IS_FT_UINT((hfinfo)->type))
279 #define DISSECTOR_ASSERT_FIELD_TYPE_IS_TIME(hfinfo) \
280 ((void) (((hfinfo)->type == FT_ABSOLUTE_TIME || \
281 (hfinfo)->type == FT_RELATIVE_TIME) ? (void)0 : \
282 __DISSECTOR_ASSERT_FIELD_TYPE_IS_TIME ((hfinfo)))) \
283 __DISSECTOR_ASSERT_STATIC_ANALYSIS_HINT((hfinfo)->type == FT_ABSOLUTE_TIME || \
284 (hfinfo)->type == FT_RELATIVE_TIME)
286 #define __DISSECTOR_ASSERT_FIELD_TYPE_IS_STRING(hfinfo) \
287 (REPORT_DISSECTOR_BUG( \
288 wmem_strdup_printf(wmem_packet_scope(), \
289 "%s:%u: field %s is not of type FT_STRING, FT_STRINGZ, or FT_STRINGZPAD", \
290 __FILE__, __LINE__, (hfinfo)->abbrev)))
292 #define DISSECTOR_ASSERT_FIELD_TYPE_IS_STRING(hfinfo) \
293 ((void) (((hfinfo)->type == FT_STRING || (hfinfo)->type == FT_STRINGZ || \
294 (hfinfo)->type == FT_STRINGZPAD) ? (void)0 : \
295 __DISSECTOR_ASSERT_FIELD_TYPE_IS_STRING ((hfinfo)))) \
296 __DISSECTOR_ASSERT_STATIC_ANALYSIS_HINT((hfinfo)->type == FT_STRING || \
297 (hfinfo)->type == FT_STRINGZ || \
298 (hfinfo)->type == FT_STRINGZPAD)
300 #define __DISSECTOR_ASSERT_FIELD_TYPE_IS_TIME(hfinfo) \
301 (REPORT_DISSECTOR_BUG( \
302 wmem_strdup_printf(wmem_packet_scope(), \
303 "%s:%u: field %s is not of type FT_ABSOLUTE_TIME or FT_RELATIVE_TIME", \
304 __FILE__, __LINE__, (hfinfo)->abbrev)))
307 * The encoding of a field of a particular type may involve more
308 * than just whether it's big-endian or little-endian and its size.
310 * For integral values, that's it, as 99.9999999999999% of the machines
311 * out there are 2's complement binary machines with 8-bit bytes,
312 * so the protocols out there expect that and, for example, any Unisys
313 * 2200 series machines out there just have to translate between 2's
314 * complement and 1's complement (and nobody's put any IBM 709x's on
315 * any networks lately :-)).
319 * for floating-point numbers, in addition to IEEE decimal
320 * floating-point, there's also IBM System/3x0 and PDP-11/VAX
321 * floating-point - most protocols use IEEE binary, but DCE RPC
322 * can use other formats if that's what the sending host uses;
324 * for character strings, there are various character encodings
325 * (various ISO 646 sets, ISO 8859/x, various other national
326 * standards, various DOS and Windows encodings, various Mac
327 * encodings, UTF-8, UTF-16, other extensions to ASCII, EBCDIC,
330 * for absolute times, there's UNIX time_t, UNIX time_t followed
331 * by 32-bit microseconds, UNIX time_t followed by 32-bit
332 * nanoseconds, DOS date/time, Windows FILETIME, NTP time, etc..
334 * We might also, in the future, want to allow a field specifier to
335 * indicate the encoding of the field, or at least its default
336 * encoding, as most fields in most protocols always use the
337 * same encoding (although that's not true of all fields, so we
338 * still need to be able to specify that at run time).
340 * So, for now, we define ENC_BIG_ENDIAN and ENC_LITTLE_ENDIAN as
341 * bit flags, to be combined, in the future, with other information
342 * to specify the encoding in the last argument to
343 * proto_tree_add_item(), and possibly to specify in a field
344 * definition (e.g., ORed in with the type value).
346 * Currently, proto_tree_add_item() treats its last argument as a
347 * Boolean - if it's zero, the field is big-endian, and if it's non-zero,
348 * the field is little-endian - and other code in epan/proto.c does
349 * the same. We therefore define ENC_BIG_ENDIAN as 0x00000000 and
350 * ENC_LITTLE_ENDIAN as 0x80000000 - we're using the high-order bit
351 * so that we could put a field type and/or a value such as a character
352 * encoding in the lower bits.
354 #define ENC_BIG_ENDIAN 0x00000000
355 #define ENC_LITTLE_ENDIAN 0x80000000
357 #if G_BYTE_ORDER == G_LITTLE_ENDIAN
358 #define ENC_HOST_ENDIAN ENC_LITTLE_ENDIAN
360 #define ENC_HOST_ENDIAN ENC_BIG_ENDIAN
365 * Historically FT_TIMEs were only timespecs; the only question was whether
366 * they were stored in big- or little-endian format.
368 * For backwards compatibility, we interpret an encoding of 1 as meaning
369 * "little-endian timespec", so that passing TRUE is interpreted as that.
371 #define ENC_TIME_TIMESPEC 0x00000000 /* "struct timespec" */
372 #define ENC_TIME_NTP 0x00000002 /* NTP times */
373 #define ENC_TIME_TOD 0x00000004 /* System/3xx and z/Architecture time-of-day clock */
376 * Historically, the only place the representation mattered for strings
377 * was with FT_UINT_STRINGs, where we had FALSE for the string length
378 * being big-endian and TRUE for it being little-endian.
380 * We now have encoding values for the character encoding. The encoding
381 * values are encoded in all but the top bit (which is the byte-order
382 * bit, required for FT_UINT_STRING and for UCS-2 and UTF-16 strings)
383 * and the bottom bit (which we ignore for now so that programs that
384 * pass TRUE for the encoding just do ASCII). (The encodings are given
385 * directly as even numbers in hex, so that make-init-lua.pl can just
386 * turn them into numbers for use in init.lua.)
388 * We don't yet process ASCII and UTF-8 differently. Ultimately, for
389 * ASCII, all bytes with the 8th bit set should be mapped to some "this
390 * is not a valid character" code point, as ENC_ASCII should mean "this
391 * is ASCII, not some extended variant thereof". We should also map
392 * 0x00 to that as well - null-terminated and null-padded strings
393 * never have NULs in them, but counted strings might. (Either that,
394 * or the values for strings should be counted, not null-terminated.)
395 * For UTF-8, invalid UTF-8 sequences should be mapped to the same
398 * For display, perhaps we should also map control characters to the
399 * Unicode glyphs showing the name of the control character in small
400 * caps, diagonally. (Unfortunately, those only exist for C0, not C1.)
402 #define ENC_CHARENCODING_MASK 0x7FFFFFFE /* mask out byte-order bits */
403 #define ENC_ASCII 0x00000000
404 #define ENC_UTF_8 0x00000002
405 #define ENC_UTF_16 0x00000004
406 #define ENC_UCS_2 0x00000006
407 #define ENC_UCS_4 0x00000008
408 #define ENC_ISO_8859_1 0x0000000A
409 #define ENC_ISO_8859_2 0x0000000C
410 #define ENC_ISO_8859_3 0x0000000E
411 #define ENC_ISO_8859_4 0x00000010
412 #define ENC_ISO_8859_5 0x00000012
413 #define ENC_ISO_8859_6 0x00000014
414 #define ENC_ISO_8859_7 0x00000016
415 #define ENC_ISO_8859_8 0x00000018
416 #define ENC_ISO_8859_9 0x0000001A
417 #define ENC_ISO_8859_10 0x0000001C
418 #define ENC_ISO_8859_11 0x0000001E
419 /* #define ENC_ISO_8859_12 0x00000020 ISO 8859-12 was abandoned */
420 #define ENC_ISO_8859_13 0x00000022
421 #define ENC_ISO_8859_14 0x00000024
422 #define ENC_ISO_8859_15 0x00000026
423 #define ENC_ISO_8859_16 0x00000028
424 #define ENC_WINDOWS_1250 0x0000002A
425 #define ENC_3GPP_TS_23_038_7BITS 0x0000002C
426 #define ENC_EBCDIC 0x0000002E
427 #define ENC_MAC_ROMAN 0x00000030
428 #define ENC_CP437 0x00000032
429 #define ENC_ASCII_7BITS 0x00000034
434 * These could probably be used by existing code:
439 * As those are added, change code such as the code in packet-bacapp.c
444 * For protocols (FT_PROTOCOL), aggregate items with subtrees (FT_NONE),
445 * opaque byte-array fields (FT_BYTES), and other fields where there
446 * is no choice of encoding (either because it's "just a bucket
447 * of bytes" or because the encoding is completely fixed), we
448 * have ENC_NA (for "Not Applicable").
450 #define ENC_NA 0x00000000
452 /* For cases where either native type or string encodings could both be
453 * valid arguments, we need something to distinguish which one is being
454 * passed as the argument, because ENC_BIG_ENDIAN and ENC_ASCII are both
455 * 0x00000000. So we use ENC_STR_NUM or ENC_STR_HEX bit-or'ed with
456 * ENC_ASCII and its ilk.
458 /* this is for strings as numbers "12345" */
459 #define ENC_STR_NUM 0x01000000
460 /* this is for strings as hex "1a2b3c" */
461 #define ENC_STR_HEX 0x02000000
462 /* a convenience macro for either of the above */
463 #define ENC_STRING 0x03000000
464 /* mask out ENC_STR_* and related bits - should this replace ENC_CHARENCODING_MASK? */
465 #define ENC_STR_MASK 0x0000FFFE
467 /* for cases where the number is allowed to have a leading '+'/'-' */
468 /* this can't collide with ENC_SEP_* because they can be used simultaneously */
469 #define ENC_NUM_PREF 0x00200000
471 /* For cases where a string encoding contains hex, bit-or one or more
472 * of these for the allowed separator(s), as well as with ENC_STR_HEX.
473 * See hex_str_to_bytes_encoding() in epan/strutil.h for details.
475 #define ENC_SEP_NONE 0x00010000
476 #define ENC_SEP_COLON 0x00020000
477 #define ENC_SEP_DASH 0x00040000
478 #define ENC_SEP_DOT 0x00080000
479 #define ENC_SEP_SPACE 0x00100000
480 /* a convenience macro for the above */
481 #define ENC_SEP_MASK 0x001F0000
483 /* For cases where a string encoding contains a timestamp, use one
484 * of these (but only one). These values can collide with above, because
485 * you can't do both at the same time.
487 #define ENC_ISO_8601_DATE 0x00010000
488 #define ENC_ISO_8601_TIME 0x00020000
489 #define ENC_ISO_8601_DATE_TIME 0x00030000
490 #define ENC_RFC_822 0x00040000
491 #define ENC_RFC_1123 0x00080000
492 /* a convenience macro for the above - for internal use only */
493 #define ENC_STR_TIME_MASK 0x000F0000
495 /* Values for header_field_info.display */
497 /* For integral types, the display format is a BASE_* field_display_e value
498 * possibly ORed with BASE_*_STRING */
500 /** FIELD_DISPLAY_E_MASK selects the field_display_e value. Its current
501 * value means that we may have at most 16 field_display_e values. */
502 #define FIELD_DISPLAY_E_MASK 0x0F
506 BASE_NONE = 0, /**< none */
507 BASE_DEC = 1, /**< decimal */
508 BASE_HEX = 2, /**< hexadecimal */
509 BASE_OCT = 3, /**< octal */
510 BASE_DEC_HEX = 4, /**< decimal (hexadecimal) */
511 BASE_HEX_DEC = 5, /**< hexadecimal (decimal) */
512 BASE_CUSTOM = 6, /**< call custom routine (in ->strings) to format */
515 STR_ASCII = BASE_NONE, /**< shows non-printable ASCII characters as C-style escapes */
516 /* XXX, support for format_text_wsp() ? */
517 STR_UNICODE = 7, /**< shows non-printable UNICODE characters as \\uXXXX (XXX for now non-printable characters display depends on UI) */
520 SEP_DOT = 8, /**< hexadecimal bytes with a period (.) between each byte */
521 SEP_DASH = 9, /**< hexadecimal bytes with a dash (-) between each byte */
522 SEP_COLON = 10, /**< hexadecimal bytes with a colon (:) between each byte */
523 SEP_SPACE = 11, /**< hexadecimal bytes with a space between each byte */
526 BASE_NETMASK = 12 /**< Used for IPv4 address that shouldn't be resolved (like for netmasks) */
530 /* Following constants have to be ORed with a field_display_e when dissector
531 * want to use specials value-string MACROs for a header_field_info */
532 #define BASE_RANGE_STRING 0x10
533 #define BASE_EXT_STRING 0x20
534 #define BASE_VAL64_STRING 0x40
536 /** BASE_ values that cause the field value to be displayed twice */
537 #define IS_BASE_DUAL(b) ((b)==BASE_DEC_HEX||(b)==BASE_HEX_DEC)
539 /* For FT_ABSOLUTE_TIME, the display format is an absolute_time_display_e
540 * as per time_fmt.h. */
543 HF_REF_TYPE_NONE, /**< Field is not referenced */
544 HF_REF_TYPE_INDIRECT, /**< Field is indirectly referenced (only applicable for FT_PROTOCOL) via. its child */
545 HF_REF_TYPE_DIRECT /**< Field is directly referenced */
548 /** information describing a header field */
549 typedef struct _header_field_info header_field_info;
551 /** information describing a header field */
552 struct _header_field_info {
553 /* ---------- set by dissector --------- */
554 const char *name; /**< [FIELDNAME] full name of this field */
555 const char *abbrev; /**< [FIELDABBREV] abbreviated name of this field */
556 enum ftenum type; /**< [FIELDTYPE] field type, one of FT_ (from ftypes.h) */
557 int display; /**< [FIELDDISPLAY] one of BASE_, or field bit-width if FT_BOOLEAN and non-zero bitmask */
558 const void *strings; /**< [FIELDCONVERT] value_string, val64_string, range_string or true_false_string,
559 typically converted by VALS(), RVALS() or TFS().
560 If this is an FT_PROTOCOL then it points to the
561 associated protocol_t structure */
562 guint64 bitmask; /**< [BITMASK] bitmask of interesting bits */
563 const char *blurb; /**< [FIELDDESCR] Brief description of field */
565 /* ------- set by proto routines (prefilled by HFILL macro, see below) ------ */
566 int id; /**< Field ID */
567 int parent; /**< parent protocol tree */
568 hf_ref_type ref_type; /**< is this field referenced by a filter */
569 int same_name_prev_id; /**< ID of previous hfinfo with same abbrev */
570 header_field_info *same_name_next; /**< Link to next hfinfo with same abbrev */
574 * HFILL initializes all the "set by proto routines" fields in a
575 * _header_field_info. If new fields are added or removed, it should
576 * be changed as necessary.
578 #define HFILL -1, 0, HF_REF_TYPE_NONE, -1, NULL
580 #define HFILL_INIT(hf) \
582 hf.hfinfo.parent = 0; \
583 hf.hfinfo.ref_type = HF_REF_TYPE_NONE; \
584 hf.hfinfo.same_name_prev_id = -1; \
585 hf.hfinfo.same_name_next = NULL;
587 /** Used when registering many fields at once, using proto_register_field_array() */
588 typedef struct hf_register_info {
589 int *p_id; /**< written to by register() function */
590 header_field_info hfinfo; /**< the field info to be registered */
596 /** string representation, if one of the proto_tree_add_..._format() functions used */
597 typedef struct _item_label_t {
598 char representation[ITEM_LABEL_LENGTH];
602 /** Contains the field information for the proto_item. */
603 typedef struct field_info {
604 header_field_info *hfinfo; /**< pointer to registered field information */
605 gint start; /**< current start of data in field_info.ds_tvb */
606 gint length; /**< current data length of item in field_info.ds_tvb */
607 gint appendix_start; /**< start of appendix data */
608 gint appendix_length; /**< length of appendix data */
609 gint tree_type; /**< one of ETT_ or -1 */
610 guint32 flags; /**< bitfield like FI_GENERATED, ... */
611 item_label_t *rep; /**< string for GUI tree */
612 tvbuff_t *ds_tvb; /**< data source tvbuff */
618 * This structure describes one segment of a split-bits item
619 * crumb_bit_offset is the bit offset in the input tvb of the first (most significant) bit of this crumb
620 * crumb_bit_length is the number of contiguous bits of this crumb.
621 * The first element of an array of bits_specs describes the most significant crumb of the output value.
622 * The second element of an array of bits_specs describes the next-most significant crumb of the output value, etc.
623 * The array is terminated by a sentinal entry with crumb_bit_length of 0.
627 guint crumb_bit_offset;
628 guint8 crumb_bit_length;
632 * Flag fields. Do not assign values greater than 0x00000080 unless you
633 * shuffle the expert information upward; see below.
636 /** The protocol field should not be shown in the tree (it's used for filtering only),
637 * used in field_info.flags. */
638 /** HIDING PROTOCOL FIELDS IS DEPRECATED, IT'S CONSIDERED TO BE BAD GUI DESIGN!
639 A user cannot tell by looking at the packet detail that the field exists
640 and that they can filter on its value. */
641 #define FI_HIDDEN 0x00000001
642 /** The protocol field should be displayed as "generated by Wireshark",
643 * used in field_info.flags. */
644 #define FI_GENERATED 0x00000002
645 /** The protocol field is actually a URL */
646 #define FI_URL 0x00000004
648 /** The protocol field value is in little endian */
649 #define FI_LITTLE_ENDIAN 0x00000008
650 /** The protocol field value is in big endian */
651 #define FI_BIG_ENDIAN 0x00000010
652 /** Field value start from nth bit (values from 0x20 - 0x100) */
653 #define FI_BITS_OFFSET(n) (((n) & 7) << 5)
654 /** Field value takes n bits (values from 0x100 - 0x4000) */
655 /* if 0, it means that field takes fi->length * 8 */
656 #define FI_BITS_SIZE(n) (((n) & 63) << 8)
658 /** convenience macro to get field_info.flags */
659 #define FI_GET_FLAG(fi, flag) ((fi) ? ((fi)->flags & (flag)) : 0)
660 /** convenience macro to set field_info.flags */
661 #define FI_SET_FLAG(fi, flag) \
664 (fi)->flags = (fi)->flags | (flag); \
666 /** convenience macro to reset field_info.flags */
667 #define FI_RESET_FLAG(fi, flag) \
670 (fi)->flags = (fi)->flags & ~(flag); \
673 #define FI_GET_BITS_OFFSET(fi) (FI_GET_FLAG(fi, FI_BITS_OFFSET(7)) >> 5)
674 #define FI_GET_BITS_SIZE(fi) (FI_GET_FLAG(fi, FI_BITS_SIZE(63)) >> 8)
676 /** One of these exists for the entire protocol tree. Each proto_node
677 * in the protocol tree points to the same copy. */
679 GHashTable *interesting_hfids;
681 gboolean fake_protocols;
683 struct _packet_info *pinfo;
686 /** Each proto_tree, proto_item is one of these. */
687 typedef struct _proto_node {
688 struct _proto_node *first_child;
689 struct _proto_node *last_child;
690 struct _proto_node *next;
691 struct _proto_node *parent;
693 tree_data_t *tree_data;
696 /** A protocol tree element. */
697 typedef proto_node proto_tree;
698 /** A protocol item element. */
699 typedef proto_node proto_item;
702 * Expert information.
703 * This is in the flags field; we allocate this from the top down,
704 * so as not to collide with FI_ flags, which are allocated from
708 /* do not modify the PI_SEVERITY_MASK name - it's used by make-init-lua.pl */
709 /* expert severities */
710 #define PI_SEVERITY_MASK 0x00F00000 /**< mask usually for internal use only! */
711 /** Packet comment */
712 #define PI_COMMENT 0x00100000
713 /** Usual workflow, e.g. TCP connection establishing */
714 #define PI_CHAT 0x00200000
715 /** Notable messages, e.g. an application returned an "unusual" error code like HTTP 404 */
716 #define PI_NOTE 0x00400000
717 /** Warning, e.g. application returned an "unusual" error code */
718 #define PI_WARN 0x00600000
719 /** Serious problems, e.g. a malformed packet */
720 #define PI_ERROR 0x00800000
722 /* do not modify the PI_GROUP_MASK name - it's used by make-init-lua.pl */
723 /* expert "event groups" */
724 #define PI_GROUP_MASK 0xFF000000 /**< mask usually for internal use only! */
725 /** The protocol field has a bad checksum, usually uses PI_WARN severity */
726 #define PI_CHECKSUM 0x01000000
727 /** The protocol field indicates a sequence problem (e.g. TCP window is zero) */
728 #define PI_SEQUENCE 0x02000000
729 /** The protocol field indicates a bad application response code (e.g. HTTP 404), usually PI_NOTE severity */
730 #define PI_RESPONSE_CODE 0x03000000
731 /** The protocol field indicates an application request (e.g. File Handle == xxxx), usually PI_CHAT severity */
732 #define PI_REQUEST_CODE 0x04000000
733 /** The data is undecoded, the protocol dissection is incomplete here, usually PI_WARN severity */
734 #define PI_UNDECODED 0x05000000
735 /** The protocol field indicates a reassemble (e.g. DCE/RPC defragmentation), usually PI_CHAT severity (or PI_ERROR) */
736 #define PI_REASSEMBLE 0x06000000
737 /** The packet data is malformed, the dissector has "given up", usually PI_ERROR severity */
738 #define PI_MALFORMED 0x07000000
739 /** A generic debugging message (shouldn't remain in production code!), usually PI_ERROR severity */
740 #define PI_DEBUG 0x08000000
741 /** The protocol field violates a protocol specification, usually PI_WARN severity */
742 #define PI_PROTOCOL 0x09000000
743 /** The protocol field indicates a security problem (e.g. insecure implementation) */
744 #define PI_SECURITY 0x0a000000
745 /** The protocol field indicates a packet comment */
746 #define PI_COMMENTS_GROUP 0x0b000000
747 /** The protocol field indicates a decryption problem */
748 #define PI_DECRYPTION 0x0c000000
750 /* add more, see https://wiki.wireshark.org/Development/ExpertInfo */
753 /** is this protocol field hidden from the protocol tree display (used for filtering only)? */
754 /* HIDING PROTOCOL FIELDS IS DEPRECATED, IT'S CONSIDERED TO BE BAD GUI DESIGN! */
755 #define PROTO_ITEM_IS_HIDDEN(proto_item) \
756 ((proto_item) ? FI_GET_FLAG(PITEM_FINFO(proto_item), FI_HIDDEN) : 0)
757 /** mark this protocol field to be hidden from the protocol tree display (used for filtering only) */
758 /* HIDING PROTOCOL FIELDS IS DEPRECATED, IT'S CONSIDERED TO BE BAD GUI DESIGN! */
759 #define PROTO_ITEM_SET_HIDDEN(proto_item) \
762 FI_SET_FLAG(PITEM_FINFO(proto_item), FI_HIDDEN); \
764 /** mark this protocol field to be visible from the protocol tree display */
765 #define PROTO_ITEM_SET_VISIBLE(proto_item) \
768 FI_RESET_FLAG(PITEM_FINFO(proto_item), FI_HIDDEN); \
771 /** is this protocol field generated by Wireshark (and not read from the packet data)? */
772 #define PROTO_ITEM_IS_GENERATED(proto_item) \
773 ((proto_item) ? FI_GET_FLAG(PITEM_FINFO(proto_item), FI_GENERATED) : 0)
774 /** mark this protocol field as generated by Wireshark (and not read from the packet data) */
775 #define PROTO_ITEM_SET_GENERATED(proto_item) \
778 FI_SET_FLAG(PITEM_FINFO(proto_item), FI_GENERATED); \
780 /** is this protocol field actually a URL? */
781 #define PROTO_ITEM_IS_URL(proto_item) \
782 ((proto_item) ? FI_GET_FLAG(PITEM_FINFO(proto_item), FI_URL) : 0)
783 /** mark this protocol field as a URL */
784 #define PROTO_ITEM_SET_URL(proto_item) \
787 FI_SET_FLAG(PITEM_FINFO(proto_item), FI_URL); \
790 typedef void (*proto_tree_foreach_func)(proto_node *, gpointer);
791 typedef gboolean (*proto_tree_traverse_func)(proto_node *, gpointer);
793 extern gboolean proto_tree_traverse_post_order(proto_tree *tree,
794 proto_tree_traverse_func func, gpointer data);
796 WS_DLL_PUBLIC void proto_tree_children_foreach(proto_tree *tree,
797 proto_tree_foreach_func func, gpointer data);
799 /** Retrieve the field_info from a proto_node */
800 #define PNODE_FINFO(proto_node) ((proto_node)->finfo)
802 /** Retrieve the field_info from a proto_item */
803 #define PITEM_FINFO(proto_item) PNODE_FINFO(proto_item)
805 /** Retrieve the field_info from a proto_tree */
806 #define PTREE_FINFO(proto_tree) PNODE_FINFO(proto_tree)
808 /** Retrieve the tree_data_t from a proto_tree */
809 #define PTREE_DATA(proto_tree) ((proto_tree)->tree_data)
811 /** Retrieve the wmem_allocator_t from a proto_node */
812 #define PNODE_POOL(proto_node) ((proto_node)->tree_data->pinfo->pool)
815 /** Register dissector plugin type with the plugin system.
816 Called by epan_register_plugin_types(); do not call it yourself. */
817 extern void register_dissector_plugin_type(void);
820 /** Sets up memory used by proto routines. Called at program startup */
821 void proto_init(void (register_all_protocols_func)(register_cb cb, gpointer client_data),
822 void (register_all_handoffs_func)(register_cb cb, gpointer client_data),
823 register_cb cb, void *client_data);
826 /** Frees memory used by proto routines. Called at program shutdown */
827 extern void proto_cleanup(void);
829 /** This function takes a tree and a protocol id as parameter and
830 will return TRUE/FALSE for whether the protocol or any of the filterable
831 fields in the protocol is referenced by any fitlers.
832 If this function returns FALSE then it is safe to skip any
833 proto_tree_add_...() calls and just treat the call as if the
834 dissector was called with tree==NULL.
835 If you reset the tree to NULL by this dissector returning FALSE,
836 you will still need to call any subdissector with the original value of
837 tree or filtering will break.
839 The purpose of this is to optimize wireshark for speed and make it
840 faster for when filters are being used.
842 WS_DLL_PUBLIC gboolean proto_field_is_referenced(proto_tree *tree, int proto_id);
844 /** Create a subtree under an existing item.
845 @param ti the parent item of the new subtree
846 @param idx one of the ett_ array elements registered with proto_register_subtree_array()
847 @return the new subtree */
848 WS_DLL_PUBLIC proto_tree* proto_item_add_subtree(proto_item *ti, const gint idx) G_GNUC_WARN_UNUSED_RESULT;
850 /** Get an existing subtree under an item.
851 @param ti the parent item of the subtree
852 @return the subtree or NULL */
853 WS_DLL_PUBLIC proto_tree* proto_item_get_subtree(proto_item *ti);
855 /** Get the parent of a subtree item.
856 @param ti the child item in the subtree
857 @return parent item or NULL */
858 WS_DLL_PUBLIC proto_item* proto_item_get_parent(const proto_item *ti);
860 /** Get Nth generation parent item.
861 @param ti the child item in the subtree
862 @param gen the generation to get (using 1 here is the same as using proto_item_get_parent())
863 @return parent item */
864 WS_DLL_PUBLIC proto_item* proto_item_get_parent_nth(proto_item *ti, int gen);
866 /** Replace text of item after it already has been created.
867 @param ti the item to set the text
868 @param format printf like format string
869 @param ... printf like parameters */
870 WS_DLL_PUBLIC void proto_item_set_text(proto_item *ti, const char *format, ...)
873 /** Append to text of item after it has already been created.
874 @param ti the item to append the text to
875 @param format printf like format string
876 @param ... printf like parameters */
877 WS_DLL_PUBLIC void proto_item_append_text(proto_item *ti, const char *format, ...)
880 /** Prepend to text of item after it has already been created.
881 @param ti the item to prepend the text to
882 @param format printf like format string
883 @param ... printf like parameters */
884 WS_DLL_PUBLIC void proto_item_prepend_text(proto_item *ti, const char *format, ...)
887 /** Set proto_item's length inside tvb, after it has already been created.
888 @param ti the item to set the length
889 @param length the new length ot the item */
890 WS_DLL_PUBLIC void proto_item_set_len(proto_item *ti, const gint length);
893 * Sets the length of the item based on its start and on the specified
894 * offset, which is the offset past the end of the item; as the start
895 * in the item is relative to the beginning of the data source tvbuff,
896 * we need to pass in a tvbuff.
897 @param ti the item to set the length
898 @param tvb end is relative to this tvbuff
899 @param end this end offset is relative to the beginning of tvb
900 @todo make usage clearer, I don't understand it!
902 WS_DLL_PUBLIC void proto_item_set_end(proto_item *ti, tvbuff_t *tvb, gint end);
904 /** Get length of a proto_item. Useful after using proto_tree_add_item()
905 * to add a variable-length field (e.g., FT_NSTRING_UINT8).
906 @param ti the item to get the length from
907 @return the current length */
908 WS_DLL_PUBLIC int proto_item_get_len(const proto_item *ti);
912 /** Creates a new proto_tree root.
913 @return the new tree root */
914 extern proto_tree* proto_tree_create_root(struct _packet_info *pinfo);
916 void proto_tree_reset(proto_tree *tree);
918 /** Clear memory for entry proto_tree. Clears proto_tree struct also.
919 @param tree the tree to free */
920 WS_DLL_PUBLIC void proto_tree_free(proto_tree *tree);
922 /** Set the tree visible or invisible.
923 Is the parsing being done for a visible proto_tree or an invisible one?
924 By setting this correctly, the proto_tree creation is sped up by not
925 having to call g_vsnprintf and copy strings around.
926 @param tree the tree to be set
927 @param visible ... or not
928 @return the old value */
929 WS_DLL_PUBLIC gboolean
930 proto_tree_set_visible(proto_tree *tree, gboolean visible);
932 /** Indicate whether we should fake protocols during dissection (default = TRUE)
933 @param tree the tree to be set
934 @param fake_protocols TRUE if we should fake protocols */
936 proto_tree_set_fake_protocols(proto_tree *tree, gboolean fake_protocols);
938 /** Mark a field/protocol ID as "interesting".
939 @param tree the tree to be set (currently ignored)
940 @param hfid the interesting field id
941 @todo what *does* interesting mean? */
943 proto_tree_prime_hfid(proto_tree *tree, const int hfid);
945 /** Get a parent item of a subtree.
946 @param tree the tree to get the parent from
947 @return parent item */
948 WS_DLL_PUBLIC proto_item* proto_tree_get_parent(proto_tree *tree);
950 /** Get the parent tree of a subtree.
951 @param tree the tree to get the parent from
952 @return parent tree */
953 WS_DLL_PUBLIC proto_tree *proto_tree_get_parent_tree(proto_tree *tree);
955 /** Get the root tree from any subtree.
956 @param tree the tree to get the root from
958 WS_DLL_PUBLIC proto_tree* proto_tree_get_root(proto_tree *tree);
960 /** Move an existing item behind another existing item.
961 @param tree the tree to which both items belong
962 @param fixed_item the item which keeps its position
963 @param item_to_move the item which will be moved */
964 WS_DLL_PUBLIC void proto_tree_move_item(proto_tree *tree, proto_item *fixed_item, proto_item *item_to_move);
967 /** Set start and length of an appendix for a proto_tree.
968 @param tree the tree to set the appendix start and length
969 @param tvb the tv buffer of the current data
970 @param start the start offset of the appendix
971 @param length the length of the appendix */
972 WS_DLL_PUBLIC void proto_tree_set_appendix(proto_tree *tree, tvbuff_t *tvb, gint start, const gint length);
975 /** Add an item to a proto_tree, using the text label registered to that item.
976 The item is extracted from the tvbuff handed to it.
977 @param tree the tree to append this item to
979 @param tvb the tv buffer of the current data
980 @param start start of data in tvb
981 @param length length of data in tvb
982 @param encoding data encoding
983 @return the newly created item */
984 WS_DLL_PUBLIC proto_item *
985 proto_tree_add_item_new(proto_tree *tree, header_field_info *hfinfo, tvbuff_t *tvb,
986 const gint start, gint length, const guint encoding);
988 WS_DLL_PUBLIC proto_item *
989 proto_tree_add_item(proto_tree *tree, int hfindex, tvbuff_t *tvb,
990 const gint start, gint length, const guint encoding);
992 /** Add an item to a proto_tree, using the text label registered to that item.
993 The item is extracted from the tvbuff handed to it, and the retrieved
994 value is also set to *retval so the caller gets it back for other uses.
996 This function retrieves the value even if the passed-in tree param is NULL,
997 so that it can be used by dissectors at all times to both get the value
998 and set the tree item to it.
1000 Like other proto_tree_add functions, if there is a tree and the value cannot
1001 be decoded from the tvbuff, then an expert info error is reported.
1003 This function accepts ENC_LITTLE_ENDIAN and ENC_BIG_ENDIAN for native number
1004 encoding in the tvbuff
1006 The length argument must
1007 be set to the appropriate size of the native type as in other proto_add routines.
1009 Integers of 8, 16, 24 and 32 bits can be retreived with these functions.
1011 @param tree the tree to append this item to
1012 @param hfindex field
1013 @param tvb the tv buffer of the current data
1014 @param start start of data in tvb (cannot be negative)
1015 @param length length of data in tvb (for strings can be -1 for remaining)
1016 @param encoding data encoding (e.g, ENC_LITTLE_ENDIAN, ENC_BIG_ENDIAN, ENC_ASCII|ENC_STRING, etc.)
1017 @param[out] retval points to a gint/guint 8/16/32/64 or gfloat/gdouble which will be set
1018 @return the newly created item, and value is set to the decoded value
1020 WS_DLL_PUBLIC proto_item *
1021 proto_tree_add_item_ret_int(proto_tree *tree, int hfindex, tvbuff_t *tvb,
1022 const gint start, gint length, const guint encoding, gint32 *retval);
1024 WS_DLL_PUBLIC proto_item *
1025 proto_tree_add_item_ret_uint(proto_tree *tree, int hfindex, tvbuff_t *tvb,
1026 const gint start, gint length, const guint encoding, guint32 *retval);
1028 /** (INTERNAL USE ONLY) Add a text-only node to a proto_tree.
1029 @param tree the tree to append this item to
1030 @param tvb the tv buffer of the current data
1031 @param start start of data in tvb
1032 @param length length of data in tvb
1033 @param format printf like format string
1034 @param ... printf like parameters
1035 @return the newly created item */
1037 proto_tree_add_text_internal(proto_tree *tree, tvbuff_t *tvb, gint start, gint length, const char *format,
1038 ...) G_GNUC_PRINTF(5,6);
1040 /** (INTERNAL USE ONLY) Add a text-only node to a proto_tree using a variable argument list.
1041 @param tree the tree to append this item to
1042 @param tvb the tv buffer of the current data
1043 @param start start of data in tvb
1044 @param length length of data in tvb
1045 @param format printf like format string
1046 @param ap variable argument list
1047 @return the newly created item */
1049 proto_tree_add_text_valist_internal(proto_tree *tree, tvbuff_t *tvb, gint start,
1050 gint length, const char *format, va_list ap)
1051 G_GNUC_PRINTF(5, 0);
1053 /** Add a text-only node that creates a subtree underneath.
1054 @param tree the tree to append this item to
1055 @param tvb the tv buffer of the current data
1056 @param start start of data in tvb
1057 @param length length of data in tvb
1058 @param idx one of the ett_ array elements registered with proto_register_subtree_array()
1059 @param tree_item item returned with tree creation. Can be NULL if going to be unused
1060 @param text label for the tree
1061 @return the newly created tree */
1062 WS_DLL_PUBLIC proto_tree *
1063 proto_tree_add_subtree(proto_tree *tree, tvbuff_t *tvb, gint start, gint length, gint idx, proto_item **tree_item, const char *text);
1065 /** Add a text-only node that creates a subtree underneath.
1066 @param tree the tree to append this item to
1067 @param tvb the tv buffer of the current data
1068 @param start start of data in tvb
1069 @param length length of data in tvb
1070 @param idx one of the ett_ array elements registered with proto_register_subtree_array()
1071 @param tree_item item returned with tree creation. Can be NULL if going to be unused
1072 @param format printf like format string
1073 @param ... printf like parameters
1074 @return the newly created tree */
1075 WS_DLL_PUBLIC proto_tree *
1076 proto_tree_add_subtree_format(proto_tree *tree, tvbuff_t *tvb, gint start, gint length, gint idx, proto_item **tree_item, const char *format, ...) G_GNUC_PRINTF(7,8);
1078 /** Add a text-only node to a proto_tree with tvb_format_text() string. */
1080 proto_tree_add_format_text(proto_tree *tree, tvbuff_t *tvb, gint start, gint length);
1082 /** Add a text-only node to a proto_tree with tvb_format_text_wsp() string. */
1084 proto_tree_add_format_wsp_text(proto_tree *tree, tvbuff_t *tvb, gint start, gint length);
1086 /** Add a FT_NONE field to a proto_tree.
1087 @param tree the tree to append this item to
1088 @param hfindex field index
1089 @param tvb the tv buffer of the current data
1090 @param start start of data in tvb
1091 @param length length of data in tvb
1092 @param format printf like format string
1093 @param ... printf like parameters
1094 @return the newly created item */
1095 WS_DLL_PUBLIC proto_item *
1096 proto_tree_add_none_format(proto_tree *tree, const int hfindex, tvbuff_t *tvb, const gint start,
1097 gint length, const char *format, ...) G_GNUC_PRINTF(6,7);
1099 /** Add a FT_PROTOCOL to a proto_tree.
1100 @param tree the tree to append this item to
1101 @param hfindex field index
1102 @param tvb the tv buffer of the current data
1103 @param start start of data in tvb
1104 @param length length of data in tvb
1105 @param format printf like format string
1106 @param ... printf like parameters
1107 @return the newly created item */
1108 WS_DLL_PUBLIC proto_item *
1109 proto_tree_add_protocol_format(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
1110 gint length, const char *format, ...) G_GNUC_PRINTF(6,7);
1115 /** Add a FT_BYTES to a proto_tree.
1116 @param tree the tree to append this item to
1117 @param hfindex field index
1118 @param tvb the tv buffer of the current data
1119 @param start start of data in tvb
1120 @param length length of data in tvb
1121 @param start_ptr pointer to the data to display
1122 @return the newly created item */
1123 WS_DLL_PUBLIC proto_item *
1124 proto_tree_add_bytes(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
1125 gint length, const guint8* start_ptr);
1127 /** Add a FT_BYTES to a proto_tree like proto_tree_add_bytes,
1128 but used when the tvb data length does not match the bytes length.
1129 @param tree the tree to append this item to
1130 @param hfindex field index
1131 @param tvb the tv buffer of the current data
1132 @param start start of data in tvb
1133 @param length length of data in tvb
1134 @param start_ptr pointer to the data to display
1135 @param ptr_length length of data in start_ptr
1136 @return the newly created item */
1137 WS_DLL_PUBLIC proto_item *
1138 proto_tree_add_bytes_with_length(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
1139 gint length, const guint8 *start_ptr, gint ptr_length);
1141 /** Get and add a byte-array-based FT_* to a proto_tree.
1143 Supported: FT_BYTES, FT_UINT_BYTES, FT_OID, FT_REL_OID, and FT_SYSTEM_ID.
1145 The item is extracted from the tvbuff handed to it, based on the ENC_* passed
1146 in for the encoding, and the retrieved byte array is also set to *retval so the
1147 caller gets it back for other uses.
1149 This function retrieves the value even if the passed-in tree param is NULL,
1150 so that it can be used by dissectors at all times to both get the value
1151 and set the tree item to it.
1153 Like other proto_tree_add functions, if there is a tree and the value cannot
1154 be decoded from the tvbuff, then an expert info error is reported. For string
1155 encoding, this means that a failure to decode the hex value from the string
1156 results in an expert info error being added to the tree.
1158 If encoding is string-based, it will convert using tvb_get_string_bytes(); see
1159 that function's comments for details.
1161 @note The GByteArray retval must be pre-constructed using g_byte_array_new().
1163 @param tree the tree to append this item to
1164 @param hfindex field index
1165 @param tvb the tv buffer of the current data
1166 @param start start of data in tvb
1167 @param length length of data in tvb
1168 @param encoding data encoding (e.g, ENC_LITTLE_ENDIAN, or ENC_UTF_8|ENC_STR_HEX)
1169 @param[in,out] retval points to a GByteArray which will be set to the bytes from the Tvb.
1170 @param[in,out] endoff if not NULL, gets set to the character after those consumed.
1171 @param[in,out] err if not NULL, gets set to 0 if no failure, else the errno code (e.g., EDOM, ERANGE).
1172 @return the newly created item, and retval is set to the decoded value
1174 WS_DLL_PUBLIC proto_item *
1175 proto_tree_add_bytes_item(proto_tree *tree, int hfindex, tvbuff_t *tvb,
1176 const gint start, gint length, const guint encoding,
1177 GByteArray *retval, gint *endoff, gint *err);
1179 /** Add a formatted FT_BYTES to a proto_tree, with the format generating
1180 the string for the value and with the field name being included
1182 @param tree the tree to append this item to
1183 @param hfindex field index
1184 @param tvb the tv buffer of the current data
1185 @param start start of data in tvb
1186 @param length length of data in tvb
1187 @param start_ptr pointer to the data to display
1188 @param format printf like format string
1189 @param ... printf like parameters
1190 @return the newly created item */
1191 WS_DLL_PUBLIC proto_item *
1192 proto_tree_add_bytes_format_value(proto_tree *tree, int hfindex, tvbuff_t *tvb,
1193 gint start, gint length, const guint8* start_ptr, const char *format,
1194 ...) G_GNUC_PRINTF(7,8);
1196 /** Add a formatted FT_BYTES to a proto_tree, with the format generating
1197 the entire string for the entry, including any field name.
1198 @param tree the tree to append this item to
1199 @param hfindex field index
1200 @param tvb the tv buffer of the current data
1201 @param start start of data in tvb
1202 @param length length of data in tvb
1203 @param start_ptr pointer to the data to display
1204 @param format printf like format string
1205 @param ... printf like parameters
1206 @return the newly created item */
1207 WS_DLL_PUBLIC proto_item *
1208 proto_tree_add_bytes_format(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
1209 gint length, const guint8* start_ptr, const char *format, ...) G_GNUC_PRINTF(7,8);
1211 /** Add a FT_ABSOLUTE_TIME or FT_RELATIVE_TIME to a proto_tree.
1212 @param tree the tree to append this item to
1213 @param hfindex field index
1214 @param tvb the tv buffer of the current data
1215 @param start start of data in tvb
1216 @param length length of data in tvb
1217 @param value_ptr pointer to the data to display
1218 @return the newly created item */
1219 WS_DLL_PUBLIC proto_item *
1220 proto_tree_add_time(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
1221 gint length, const nstime_t* value_ptr);
1223 /** Get and add a FT_ABSOLUTE_TIME or FT_RELATIVE_TIME to a proto_tree.
1224 The item is extracted from the tvbuff handed to it, based on the ENC_* passed
1225 in for the encoding, and the retrieved value is also set to *retval so the
1226 caller gets it back for other uses.
1228 This function retrieves the value even if the passed-in tree param is NULL,
1229 so that it can be used by dissectors at all times to both get the value
1230 and set the tree item to it.
1232 Like other proto_tree_add functions, if there is a tree and the value cannot
1233 be decoded from the tvbuff, then an expert info error is reported. For string
1234 encoding, this means that a failure to decode the time value from the string
1235 results in an expert info error being added to the tree.
1237 If encoding is string-based, it will convert using tvb_get_string_time(); see
1238 that function's comments for details.
1240 @note The nstime_t *retval must be pre-allocated as a nstime_t.
1242 @param tree the tree to append this item to
1243 @param hfindex field index
1244 @param tvb the tv buffer of the current data
1245 @param start start of data in tvb
1246 @param length length of data in tvb
1247 @param encoding data encoding (e.g, ENC_LITTLE_ENDIAN, ENC_UTF_8|ENC_ISO_8601_DATE_TIME, etc.)
1248 @param[in,out] retval points to a nstime_t which will be set to the value
1249 @param[in,out] endoff if not NULL, gets set to the character after those consumed.
1250 @param[in,out] err if not NULL, gets set to 0 if no failure, else the errno code (e.g., EDOM, ERANGE).
1251 @return the newly created item, and retval is set to the decoded value
1253 WS_DLL_PUBLIC proto_item *
1254 proto_tree_add_time_item(proto_tree *tree, int hfindex, tvbuff_t *tvb,
1255 const gint start, gint length, const guint encoding,
1256 nstime_t *retval, gint *endoff, gint *err);
1259 /** Add a formatted FT_ABSOLUTE_TIME or FT_RELATIVE_TIME to a proto_tree, with
1260 the format generating the string for the value and with the field name
1261 being included automatically.
1262 @param tree the tree to append this item to
1263 @param hfindex field index
1264 @param tvb the tv buffer of the current data
1265 @param start start of data in tvb
1266 @param length length of data in tvb
1267 @param value_ptr pointer to the data to display
1268 @param format printf like format string
1269 @param ... printf like parameters
1270 @return the newly created item */
1271 WS_DLL_PUBLIC proto_item *
1272 proto_tree_add_time_format_value(proto_tree *tree, int hfindex, tvbuff_t *tvb,
1273 gint start, gint length, nstime_t* value_ptr, const char *format, ...)
1276 /** Add a formatted FT_ABSOLUTE_TIME or FT_RELATIVE_TIME to a proto_tree, with
1277 the format generating the entire string for the entry, including any field
1279 @param tree the tree to append this item to
1280 @param hfindex field index
1281 @param tvb the tv buffer of the current data
1282 @param start start of data in tvb
1283 @param length length of data in tvb
1284 @param value_ptr pointer to the data to display
1285 @param format printf like format string
1286 @param ... printf like parameters
1287 @return the newly created item */
1288 WS_DLL_PUBLIC proto_item *
1289 proto_tree_add_time_format(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
1290 gint length, nstime_t* value_ptr, const char *format, ...) G_GNUC_PRINTF(7,8);
1292 /** Add a FT_IPXNET to a proto_tree.
1293 @param tree the tree to append this item to
1294 @param hfindex field index
1295 @param tvb the tv buffer of the current data
1296 @param start start of data in tvb
1297 @param length length of data in tvb
1298 @param value data to display
1299 @return the newly created item */
1300 WS_DLL_PUBLIC proto_item *
1301 proto_tree_add_ipxnet(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
1302 gint length, guint32 value);
1304 /** Add a formatted FT_IPXNET to a proto_tree, with the format generating
1305 the string for the value and with the field name being included
1307 @param tree the tree to append this item to
1308 @param hfindex field index
1309 @param tvb the tv buffer of the current data
1310 @param start start of data in tvb
1311 @param length length of data in tvb
1312 @param value data to display
1313 @param format printf like format string
1314 @param ... printf like parameters
1315 @return the newly created item */
1316 WS_DLL_PUBLIC proto_item *
1317 proto_tree_add_ipxnet_format_value(proto_tree *tree, int hfindex, tvbuff_t *tvb,
1318 gint start, gint length, guint32 value, const char *format, ...)
1321 /** Add a formatted FT_IPXNET to a proto_tree, with the format generating
1322 the entire string for the entry, including any field name.
1323 @param tree the tree to append this item to
1324 @param hfindex field index
1325 @param tvb the tv buffer of the current data
1326 @param start start of data in tvb
1327 @param length length of data in tvb
1328 @param value data to display
1329 @param format printf like format string
1330 @param ... printf like parameters
1331 @return the newly created item */
1332 WS_DLL_PUBLIC proto_item *
1333 proto_tree_add_ipxnet_format(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
1334 gint length, guint32 value, const char *format, ...) G_GNUC_PRINTF(7,8);
1336 /** Add a FT_IPv4 to a proto_tree.
1337 @param tree the tree to append this item to
1338 @param hfindex field index
1339 @param tvb the tv buffer of the current data
1340 @param start start of data in tvb
1341 @param length length of data in tvb
1342 @param value data to display
1343 @return the newly created item */
1344 WS_DLL_PUBLIC proto_item *
1345 proto_tree_add_ipv4(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
1346 gint length, guint32 value);
1348 /** Add a formatted FT_IPv4 to a proto_tree, with the format generating
1349 the string for the value and with the field name being included
1351 @param tree the tree to append this item to
1352 @param hfindex field index
1353 @param tvb the tv buffer of the current data
1354 @param start start of data in tvb
1355 @param length length of data in tvb
1356 @param value data to display
1357 @param format printf like format string
1358 @param ... printf like parameters
1359 @return the newly created item */
1360 WS_DLL_PUBLIC proto_item *
1361 proto_tree_add_ipv4_format_value(proto_tree *tree, int hfindex, tvbuff_t *tvb,
1362 gint start, gint length, guint32 value, const char *format, ...)
1365 /** Add a formatted FT_IPv4 to a proto_tree, with the format generating
1366 the entire string for the entry, including any field name.
1367 @param tree the tree to append this item to
1368 @param hfindex field index
1369 @param tvb the tv buffer of the current data
1370 @param start start of data in tvb
1371 @param length length of data in tvb
1372 @param value data to display
1373 @param format printf like format string
1374 @param ... printf like parameters
1375 @return the newly created item */
1376 WS_DLL_PUBLIC proto_item *
1377 proto_tree_add_ipv4_format(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
1378 gint length, guint32 value, const char *format, ...) G_GNUC_PRINTF(7,8);
1380 /** Add a FT_IPv6 to a proto_tree.
1381 @param tree the tree to append this item to
1382 @param hfindex field index
1383 @param tvb the tv buffer of the current data
1384 @param start start of data in tvb
1385 @param length length of data in tvb
1386 @param value_ptr data to display
1387 @return the newly created item */
1388 WS_DLL_PUBLIC proto_item *
1389 proto_tree_add_ipv6(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
1390 gint length, const guint8* value_ptr);
1392 /** Add a formatted FT_IPv6 to a proto_tree, with the format generating
1393 the string for the value and with the field name being included
1395 @param tree the tree to append this item to
1396 @param hfindex field index
1397 @param tvb the tv buffer of the current data
1398 @param start start of data in tvb
1399 @param length length of data in tvb
1400 @param value_ptr data to display
1401 @param format printf like format string
1402 @param ... printf like parameters
1403 @return the newly created item */
1404 WS_DLL_PUBLIC proto_item *
1405 proto_tree_add_ipv6_format_value(proto_tree *tree, int hfindex, tvbuff_t *tvb,
1406 gint start, gint length, const guint8* value_ptr, const char *format,
1407 ...) G_GNUC_PRINTF(7,8);
1409 /** Add a formatted FT_IPv6 to a proto_tree, with the format generating
1410 the entire string for the entry, including any field name.
1411 @param tree the tree to append this item to
1412 @param hfindex field index
1413 @param tvb the tv buffer of the current data
1414 @param start start of data in tvb
1415 @param length length of data in tvb
1416 @param value_ptr data to display
1417 @param format printf like format string
1418 @param ... printf like parameters
1419 @return the newly created item */
1420 WS_DLL_PUBLIC proto_item *
1421 proto_tree_add_ipv6_format(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
1422 gint length, const guint8* value_ptr, const char *format, ...) G_GNUC_PRINTF(7,8);
1424 /** Add a FT_ETHER to a proto_tree.
1425 @param tree the tree to append this item to
1426 @param hfindex field index
1427 @param tvb the tv buffer of the current data
1428 @param start start of data in tvb
1429 @param length length of data in tvb
1430 @param value data to display
1431 @return the newly created item */
1432 WS_DLL_PUBLIC proto_item *
1433 proto_tree_add_ether(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
1434 gint length, const guint8* value);
1436 /** Add a formatted FT_ETHER to a proto_tree, with the format generating
1437 the string for the value and with the field name being included
1439 @param tree the tree to append this item to
1440 @param hfindex field index
1441 @param tvb the tv buffer of the current data
1442 @param start start of data in tvb
1443 @param length length of data in tvb
1444 @param value data to display
1445 @param format printf like format string
1446 @param ... printf like parameters
1447 @return the newly created item */
1448 WS_DLL_PUBLIC proto_item *
1449 proto_tree_add_ether_format_value(proto_tree *tree, int hfindex, tvbuff_t *tvb,
1450 gint start, gint length, const guint8* value, const char *format, ...)
1453 /** Add a formatted FT_ETHER to a proto_tree, with the format generating
1454 the entire string for the entry, including any field name.
1455 @param tree the tree to append this item to
1456 @param hfindex field index
1457 @param tvb the tv buffer of the current data
1458 @param start start of data in tvb
1459 @param length length of data in tvb
1460 @param value data to display
1461 @param format printf like format string
1462 @param ... printf like parameters
1463 @return the newly created item */
1464 WS_DLL_PUBLIC proto_item *
1465 proto_tree_add_ether_format(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
1466 gint length, const guint8* value, const char *format, ...) G_GNUC_PRINTF(7,8);
1468 /** Add a FT_GUID to a proto_tree.
1469 @param tree the tree to append this item to
1470 @param hfindex field index
1471 @param tvb the tv buffer of the current data
1472 @param start start of data in tvb
1473 @param length length of data in tvb
1474 @param value_ptr data to display
1475 @return the newly created item */
1476 WS_DLL_PUBLIC proto_item *
1477 proto_tree_add_guid(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
1478 gint length, const e_guid_t *value_ptr);
1480 /** Add a formatted FT_GUID to a proto_tree, with the format generating
1481 the string for the value and with the field name being included
1483 @param tree the tree to append this item to
1484 @param hfindex field index
1485 @param tvb the tv buffer of the current data
1486 @param start start of data in tvb
1487 @param length length of data in tvb
1488 @param value_ptr data to display
1489 @param format printf like format string
1490 @param ... printf like parameters
1491 @return the newly created item */
1492 WS_DLL_PUBLIC proto_item *
1493 proto_tree_add_guid_format_value(proto_tree *tree, int hfindex, tvbuff_t *tvb,
1494 gint start, gint length, const e_guid_t *value_ptr, const char *format,
1495 ...) G_GNUC_PRINTF(7,8);
1497 /** Add a formatted FT_GUID to a proto_tree, with the format generating
1498 the entire string for the entry, including any field name.
1499 @param tree the tree to append this item to
1500 @param hfindex field index
1501 @param tvb the tv buffer of the current data
1502 @param start start of data in tvb
1503 @param length length of data in tvb
1504 @param value_ptr data to display
1505 @param format printf like format string
1506 @param ... printf like parameters
1507 @return the newly created item */
1508 WS_DLL_PUBLIC proto_item *
1509 proto_tree_add_guid_format(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
1510 gint length, const e_guid_t *value_ptr, const char *format, ...) G_GNUC_PRINTF(7,8);
1512 /** Add a FT_OID to a proto_tree.
1513 @param tree the tree to append this item to
1514 @param hfindex field index
1515 @param tvb the tv buffer of the current data
1516 @param start start of data in tvb
1517 @param length length of data in tvb
1518 @param value_ptr data to display
1519 @return the newly created item */
1521 proto_tree_add_oid(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
1522 gint length, const guint8* value_ptr);
1524 /** Add a formatted FT_OID to a proto_tree, with the format generating
1525 the string for the value and with the field name being included
1527 @param tree the tree to append this item to
1528 @param hfindex field index
1529 @param tvb the tv buffer of the current data
1530 @param start start of data in tvb
1531 @param length length of data in tvb
1532 @param value_ptr data to display
1533 @param format printf like format string
1534 @param ... printf like parameters
1535 @return the newly created item */
1537 proto_tree_add_oid_format_value(proto_tree *tree, int hfindex, tvbuff_t *tvb,
1538 gint start, gint length, const guint8* value_ptr, const char *format,
1539 ...) G_GNUC_PRINTF(7,8);
1541 /** Add a formatted FT_OID to a proto_tree, with the format generating
1542 the entire string for the entry, including any field name.
1543 @param tree the tree to append this item to
1544 @param hfindex field index
1545 @param tvb the tv buffer of the current data
1546 @param start start of data in tvb
1547 @param length length of data in tvb
1548 @param value_ptr data to display
1549 @param format printf like format string
1550 @param ... printf like parameters
1551 @return the newly created item */
1553 proto_tree_add_oid_format(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
1554 gint length, const guint8* value_ptr, const char *format, ...) G_GNUC_PRINTF(7,8);
1556 /** Add a FT_STRING or FT_STRINGZPAD to a proto_tree.
1557 @param tree the tree to append this item to
1558 @param hfindex field index
1559 @param tvb the tv buffer of the current data
1560 @param start start of data in tvb
1561 @param length length of data in tvb
1562 @param value data to display
1563 @return the newly created item */
1564 WS_DLL_PUBLIC proto_item *
1565 proto_tree_add_string(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
1566 gint length, const char* value);
1568 /** Add a formatted FT_STRING or FT_STRINGZPAD to a proto_tree, with the
1569 format generating the string for the value and with the field name
1570 being included automatically.
1571 @param tree the tree to append this item to
1572 @param hfindex field index
1573 @param tvb the tv buffer of the current data
1574 @param start start of data in tvb
1575 @param length length of data in tvb
1576 @param value data to display
1577 @param format printf like format string
1578 @param ... printf like parameters
1579 @return the newly created item */
1580 WS_DLL_PUBLIC proto_item *
1581 proto_tree_add_string_format_value(proto_tree *tree, int hfindex, tvbuff_t *tvb,
1582 gint start, gint length, const char* value, const char *format, ...)
1585 /** Add a formatted FT_STRING or FT_STRINGZPAD to a proto_tree, with the
1586 format generating the entire string for the entry, including any field
1588 @param tree the tree to append this item to
1589 @param hfindex field index
1590 @param tvb the tv buffer of the current data
1591 @param start start of data in tvb
1592 @param length length of data in tvb
1593 @param value data to display
1594 @param format printf like format string
1595 @param ... printf like parameters
1596 @return the newly created item */
1597 WS_DLL_PUBLIC proto_item *
1598 proto_tree_add_string_format(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
1599 gint length, const char* value, const char *format, ...) G_GNUC_PRINTF(7,8);
1601 /** Add a FT_BOOLEAN to a proto_tree.
1602 @param tree the tree to append this item to
1603 @param hfindex field index
1604 @param tvb the tv buffer of the current data
1605 @param start start of data in tvb
1606 @param length length of data in tvb
1607 @param value data to display
1608 @return the newly created item */
1609 WS_DLL_PUBLIC proto_item *
1610 proto_tree_add_boolean(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
1611 gint length, guint32 value);
1613 /** Add a formatted FT_BOOLEAN to a proto_tree, with the format generating
1614 the string for the value and with the field name being included
1616 @param tree the tree to append this item to
1617 @param hfindex field index
1618 @param tvb the tv buffer of the current data
1619 @param start start of data in tvb
1620 @param length length of data in tvb
1621 @param value data to display
1622 @param format printf like format string
1623 @param ... printf like parameters
1624 @return the newly created item */
1625 WS_DLL_PUBLIC proto_item *
1626 proto_tree_add_boolean_format_value(proto_tree *tree, int hfindex,
1627 tvbuff_t *tvb, gint start, gint length, guint32 value,
1628 const char *format, ...) G_GNUC_PRINTF(7,8);
1630 /** Add a formatted FT_BOOLEAN to a proto_tree, with the format generating
1631 the entire string for the entry, including any field name.
1632 @param tree the tree to append this item to
1633 @param hfindex field index
1634 @param tvb the tv buffer of the current data
1635 @param start start of data in tvb
1636 @param length length of data in tvb
1637 @param value data to display
1638 @param format printf like format string
1639 @param ... printf like parameters
1640 @return the newly created item */
1641 WS_DLL_PUBLIC proto_item *
1642 proto_tree_add_boolean_format(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
1643 gint length, guint32 value, const char *format, ...) G_GNUC_PRINTF(7,8);
1645 /** Add a FT_FLOAT to a proto_tree.
1646 @param tree the tree to append this item to
1647 @param hfindex field index
1648 @param tvb the tv buffer of the current data
1649 @param start start of data in tvb
1650 @param length length of data in tvb
1651 @param value data to display
1652 @return the newly created item */
1653 WS_DLL_PUBLIC proto_item *
1654 proto_tree_add_float(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
1655 gint length, float value);
1657 /** Add a formatted FT_FLOAT to a proto_tree, with the format generating
1658 the string for the value and with the field name being included
1660 @param tree the tree to append this item to
1661 @param hfindex field index
1662 @param tvb the tv buffer of the current data
1663 @param start start of data in tvb
1664 @param length length of data in tvb
1665 @param value data to display
1666 @param format printf like format string
1667 @param ... printf like parameters
1668 @return the newly created item */
1669 WS_DLL_PUBLIC proto_item *
1670 proto_tree_add_float_format_value(proto_tree *tree, int hfindex, tvbuff_t *tvb,
1671 gint start, gint length, float value, const char *format, ...)
1674 /** Add a formatted FT_FLOAT to a proto_tree, with the format generating
1675 the entire string for the entry, including any field name.
1676 @param tree the tree to append this item to
1677 @param hfindex field index
1678 @param tvb the tv buffer of the current data
1679 @param start start of data in tvb
1680 @param length length of data in tvb
1681 @param value data to display
1682 @param format printf like format string
1683 @param ... printf like parameters
1684 @return the newly created item */
1685 WS_DLL_PUBLIC proto_item *
1686 proto_tree_add_float_format(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
1687 gint length, float value, const char *format, ...) G_GNUC_PRINTF(7,8);
1689 /** Add a FT_DOUBLE to a proto_tree.
1690 @param tree the tree to append this item to
1691 @param hfindex field index
1692 @param tvb the tv buffer of the current data
1693 @param start start of data in tvb
1694 @param length length of data in tvb
1695 @param value data to display
1696 @return the newly created item */
1697 WS_DLL_PUBLIC proto_item *
1698 proto_tree_add_double(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
1699 gint length, double value);
1701 /** Add a formatted FT_DOUBLE to a proto_tree, with the format generating
1702 the string for the value and with the field name being included
1704 @param tree the tree to append this item to
1705 @param hfindex field index
1706 @param tvb the tv buffer of the current data
1707 @param start start of data in tvb
1708 @param length length of data in tvb
1709 @param value data to display
1710 @param format printf like format string
1711 @param ... printf like parameters
1712 @return the newly created item */
1713 WS_DLL_PUBLIC proto_item *
1714 proto_tree_add_double_format_value(proto_tree *tree, int hfindex, tvbuff_t *tvb,
1715 gint start, gint length, double value, const char *format, ...)
1718 /** Add a formatted FT_DOUBLE to a proto_tree, with the format generating
1719 the entire string for the entry, including any field name.
1720 @param tree the tree to append this item to
1721 @param hfindex field index
1722 @param tvb the tv buffer of the current data
1723 @param start start of data in tvb
1724 @param length length of data in tvb
1725 @param value data to display
1726 @param format printf like format string
1727 @param ... printf like parameters
1728 @return the newly created item */
1729 WS_DLL_PUBLIC proto_item *
1730 proto_tree_add_double_format(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
1731 gint length, double value, const char *format, ...) G_GNUC_PRINTF(7,8);
1733 /** Add one of FT_UINT8, FT_UINT16, FT_UINT24 or FT_UINT32 to a proto_tree.
1734 @param tree the tree to append this item to
1735 @param hfindex field index
1736 @param tvb the tv buffer of the current data
1737 @param start start of data in tvb
1738 @param length length of data in tvb
1739 @param value data to display
1740 @return the newly created item */
1741 WS_DLL_PUBLIC proto_item *
1742 proto_tree_add_uint(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
1743 gint length, guint32 value);
1745 /** Add a formatted FT_UINT8, FT_UINT16, FT_UINT24 or FT_UINT32 to a proto_tree,
1746 with the format generating the string for the value and with the field
1747 name being included automatically.
1748 @param tree the tree to append this item to
1749 @param hfindex field index
1750 @param tvb the tv buffer of the current data
1751 @param start start of data in tvb
1752 @param length length of data in tvb
1753 @param value data to display
1754 @param format printf like format string
1755 @param ... printf like parameters
1756 @return the newly created item */
1757 WS_DLL_PUBLIC proto_item *
1758 proto_tree_add_uint_format_value(proto_tree *tree, int hfindex, tvbuff_t *tvb,
1759 gint start, gint length, guint32 value, const char *format, ...)
1762 /** Add a formatted FT_UINT8, FT_UINT16, FT_UINT24 or FT_UINT32 to a proto_tree,
1763 with the format generating the entire string for the entry, including any
1765 @param tree the tree to append this item to
1766 @param hfindex field index
1767 @param tvb the tv buffer of the current data
1768 @param start start of data in tvb
1769 @param length length of data in tvb
1770 @param value data to display
1771 @param format printf like format string
1772 @param ... printf like parameters
1773 @return the newly created item */
1774 WS_DLL_PUBLIC proto_item *
1775 proto_tree_add_uint_format(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
1776 gint length, guint32 value, const char *format, ...) G_GNUC_PRINTF(7,8);
1778 /** Add an FT_UINT64 to a proto_tree.
1779 @param tree the tree to append this item to
1780 @param hfindex field index
1781 @param tvb the tv buffer of the current data
1782 @param start start of data in tvb
1783 @param length length of data in tvb
1784 @param value data to display
1785 @return the newly created item */
1786 WS_DLL_PUBLIC proto_item *
1787 proto_tree_add_uint64(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
1788 gint length, guint64 value);
1790 /** Add a formatted FT_UINT64 to a proto_tree, with the format generating
1791 the string for the value and with the field name being included
1793 @param tree the tree to append this item to
1794 @param hfindex field index
1795 @param tvb the tv buffer of the current data
1796 @param start start of data in tvb
1797 @param length length of data in tvb
1798 @param value data to display
1799 @param format printf like format string
1800 @param ... printf like parameters
1801 @return the newly created item */
1802 WS_DLL_PUBLIC proto_item *
1803 proto_tree_add_uint64_format_value(proto_tree *tree, int hfindex, tvbuff_t *tvb,
1804 gint start, gint length, guint64 value, const char *format, ...)
1807 /** Add a formatted FT_UINT64 to a proto_tree, with the format generating
1808 the entire string for the entry, including any field name.
1809 @param tree the tree to append this item to
1810 @param hfindex field index
1811 @param tvb the tv buffer of the current data
1812 @param start start of data in tvb
1813 @param length length of data in tvb
1814 @param value data to display
1815 @param format printf like format string
1816 @param ... printf like parameters
1817 @return the newly created item */
1818 WS_DLL_PUBLIC proto_item *
1819 proto_tree_add_uint64_format(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
1820 gint length, guint64 value, const char *format, ...) G_GNUC_PRINTF(7,8);
1822 /** Add one of FT_INT8, FT_INT16, FT_INT24 or FT_INT32 to a proto_tree.
1823 @param tree the tree to append this item to
1824 @param hfindex field index
1825 @param tvb the tv buffer of the current data
1826 @param start start of data in tvb
1827 @param length length of data in tvb
1828 @param value data to display
1829 @return the newly created item */
1830 WS_DLL_PUBLIC proto_item *
1831 proto_tree_add_int(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
1832 gint length, gint32 value);
1834 /** Add a formatted FT_INT8, FT_INT16, FT_INT24 or FT_INT32 to a proto_tree,
1835 with the format generating the string for the value and with the field
1836 name being included automatically.
1837 @param tree the tree to append this item to
1838 @param hfindex field index
1839 @param tvb the tv buffer of the current data
1840 @param start start of data in tvb
1841 @param length length of data in tvb
1842 @param value data to display
1843 @param format printf like format string
1844 @param ... printf like parameters
1845 @return the newly created item */
1846 WS_DLL_PUBLIC proto_item *
1847 proto_tree_add_int_format_value(proto_tree *tree, int hfindex, tvbuff_t *tvb,
1848 gint start, gint length, gint32 value, const char *format, ...)
1851 /** Add a formatted FT_INT8, FT_INT16, FT_INT24 or FT_INT32 to a proto_tree,
1852 with the format generating the entire string for the entry, including
1854 @param tree the tree to append this item to
1855 @param hfindex field index
1856 @param tvb the tv buffer of the current data
1857 @param start start of data in tvb
1858 @param length length of data in tvb
1859 @param value data to display
1860 @param format printf like format string
1861 @param ... printf like parameters
1862 @return the newly created item */
1863 WS_DLL_PUBLIC proto_item *
1864 proto_tree_add_int_format(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
1865 gint length, gint32 value, const char *format, ...) G_GNUC_PRINTF(7,8);
1867 /** Add an FT_INT64 to a proto_tree.
1868 @param tree the tree to append this item to
1869 @param hfindex field index
1870 @param tvb the tv buffer of the current data
1871 @param start start of data in tvb
1872 @param length length of data in tvb
1873 @param value data to display
1874 @return the newly created item */
1875 WS_DLL_PUBLIC proto_item *
1876 proto_tree_add_int64(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
1877 gint length, gint64 value);
1879 /** Add a formatted FT_INT64 to a proto_tree, with the format generating
1880 the string for the value and with the field name being included
1882 @param tree the tree to append this item to
1883 @param hfindex field index
1884 @param tvb the tv buffer of the current data
1885 @param start start of data in tvb
1886 @param length length of data in tvb
1887 @param value data to display
1888 @param format printf like format string
1889 @param ... printf like parameters
1890 @return the newly created item */
1891 WS_DLL_PUBLIC proto_item *
1892 proto_tree_add_int64_format_value(proto_tree *tree, int hfindex, tvbuff_t *tvb,
1893 gint start, gint length, gint64 value, const char *format, ...)
1896 /** Add a formatted FT_INT64 to a proto_tree, with the format generating
1897 the entire string for the entry, including any field name.
1898 @param tree the tree to append this item to
1899 @param hfindex field index
1900 @param tvb the tv buffer of the current data
1901 @param start start of data in tvb
1902 @param length length of data in tvb
1903 @param value data to display
1904 @param format printf like format string
1905 @param ... printf like parameters
1906 @return the newly created item */
1907 WS_DLL_PUBLIC proto_item *
1908 proto_tree_add_int64_format(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
1909 gint length, gint64 value, const char *format, ...) G_GNUC_PRINTF(7,8);
1911 /** Add a FT_EUI64 to a proto_tree.
1912 @param tree the tree to append this item to
1913 @param hfindex field index
1914 @param tvb the tv buffer of the current data
1915 @param start start of data in tvb
1916 @param length length of data in tvb
1917 @param value data to display
1918 @return the newly created item */
1919 WS_DLL_PUBLIC proto_item *
1920 proto_tree_add_eui64(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
1921 gint length, const guint64 value);
1923 /** Add a formatted FT_EUI64 to a proto_tree, with the format generating
1924 the string for the value and with the field name being included
1926 @param tree the tree to append this item to
1927 @param hfindex field index
1928 @param tvb the tv buffer of the current data
1929 @param start start of data in tvb
1930 @param length length of data in tvb
1931 @param value data to display
1932 @param format printf like format string
1933 @param ... printf like parameters
1934 @return the newly created item */
1935 WS_DLL_PUBLIC proto_item *
1936 proto_tree_add_eui64_format_value(proto_tree *tree, int hfindex, tvbuff_t *tvb,
1937 gint start, gint length, const guint64 value, const char *format, ...)
1940 /** Add a formatted FT_EUI64 to a proto_tree, with the format generating
1941 the entire string for the entry, including any field name.
1942 @param tree the tree to append this item to
1943 @param hfindex field index
1944 @param tvb the tv buffer of the current data
1945 @param start start of data in tvb
1946 @param length length of data in tvb
1947 @param value data to display
1948 @param format printf like format string
1949 @param ... printf like parameters
1950 @return the newly created item */
1951 WS_DLL_PUBLIC proto_item *
1952 proto_tree_add_eui64_format(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
1953 gint length, const guint64 value, const char *format, ...) G_GNUC_PRINTF(7,8);
1956 /** Useful for quick debugging. Also sends string to STDOUT, so don't
1957 leave call to this function in production code.
1958 @param tree the tree to append the text to
1959 @param format printf like format string
1960 @param ... printf like parameters
1961 @return the newly created item */
1962 WS_DLL_PUBLIC proto_item *
1963 proto_tree_add_debug_text(proto_tree *tree, const char *format,
1964 ...) G_GNUC_PRINTF(2,3);
1968 /** Append a string to a protocol item.<br>
1969 NOTE: this function will break with the TRY_TO_FAKE_THIS_ITEM()
1971 Currently only WSP use this function so it is not that bad but try to
1972 avoid using this one if possible.
1973 IF you must use this function you MUST also disable the
1974 TRY_TO_FAKE_THIS_ITEM() optimization for your dissector/function
1975 using proto_item_append_string().
1976 Do that by faking that the tree is visible by calling
1977 proto_tree_set_visible(tree, TRUE) (see packet-wsp.c)
1978 BEFORE you create the item you are later going to use
1979 proto_item_append_string() on.
1980 @param pi the item to append the string to
1981 @param str the string to append */
1983 proto_item_append_string(proto_item *pi, const char *str);
1987 /** Fill given label_str with string representation of field
1988 @param fi the item to get the info from
1989 @param label_str the string to fill
1990 @todo think about changing the parameter profile */
1992 proto_item_fill_label(field_info *fi, gchar *label_str);
1995 /** Register a new protocol.
1996 @param name the full name of the new protocol
1997 @param short_name abbreviated name of the new protocol
1998 @param filter_name protocol name used for a display filter string
1999 @return the new protocol handle */
2001 proto_register_protocol(const char *name, const char *short_name, const char *filter_name);
2003 /** Deregister a protocol.
2004 @param short_name abbreviated name of the protocol
2005 @return TRUE if protocol is removed */
2006 WS_DLL_PUBLIC gboolean
2007 proto_deregister_protocol(const char *short_name);
2009 /** Mark protocol as private
2010 @param proto_id the handle of the protocol */
2013 proto_mark_private(const int proto_id);
2015 /** Return if protocol is private
2016 @param proto_id the handle of the protocol
2017 @return TRUE if it is a private protocol, FALSE is not. */
2018 WS_DLL_PUBLIC gboolean
2019 proto_is_private(const int proto_id);
2021 /** This type of function can be registered to get called whenever
2022 a given field was not found but a its prefix is matched;
2023 It can be used to procrastinate the hf array registration.
2024 @param match what's being matched */
2025 typedef void (*prefix_initializer_t)(const char* match);
2027 /** Register a new prefix for delayed initialization of field arrays
2028 @param prefix the prefix for the new protocol
2029 @param initializer function that will initialize the field array for the given prefix */
2031 proto_register_prefix(const char *prefix, prefix_initializer_t initializer);
2033 /** Initialize every remaining uninitialized prefix. */
2034 WS_DLL_PUBLIC void proto_initialize_all_prefixes(void);
2036 WS_DLL_PUBLIC void proto_register_fields_manual(const int parent, header_field_info **hfi, const int num_records);
2037 WS_DLL_PUBLIC void proto_register_fields_section(const int parent, header_field_info *hfi, const int num_records);
2039 /** Register a header_field array.
2040 @param parent the protocol handle from proto_register_protocol()
2041 @param hf the hf_register_info array
2042 @param num_records the number of records in hf */
2044 proto_register_field_array(const int parent, hf_register_info *hf, const int num_records);
2046 /** Deregister an already registered field.
2047 @param parent the protocol handle from proto_register_protocol()
2048 @param hf_id the field to deregister */
2050 proto_deregister_field (const int parent, gint hf_id);
2052 /** Add data to be freed when deregistered fields are freed.
2053 @param data a pointer to data to free */
2055 proto_add_deregistered_data (void *data);
2057 /** Free fields deregistered in proto_deregister_field(). */
2059 proto_free_deregistered_fields (void);
2061 /** Register a protocol subtree (ett) array.
2062 @param indices array of ett indices
2063 @param num_indices the number of records in indices */
2065 proto_register_subtree_array(gint *const *indices, const int num_indices);
2067 /** Get name of registered header_field number n.
2068 @param n item # n (0-indexed)
2069 @return the name of this registered item */
2070 WS_DLL_PUBLIC const char* proto_registrar_get_name(const int n);
2072 /** Get abbreviation of registered header_field number n.
2073 @param n item # n (0-indexed)
2074 @return the abbreviation of this registered item */
2075 WS_DLL_PUBLIC const char* proto_registrar_get_abbrev(const int n);
2077 /** Get the header_field information based upon a field or protocol id.
2078 @param hfindex item # n (0-indexed)
2079 @return the registered item */
2080 WS_DLL_PUBLIC header_field_info* proto_registrar_get_nth(guint hfindex);
2082 /** Get the header_field information based upon a field name.
2083 @param field_name the field name to search for
2084 @return the registered item */
2085 WS_DLL_PUBLIC header_field_info* proto_registrar_get_byname(const char *field_name);
2087 /** Get the header_field id based upon a field name.
2088 @param field_name the field name to search for
2089 @return the field id for the registered item */
2090 extern int proto_registrar_get_id_byname(const char *field_name);
2092 /** Get enum ftenum FT_ of registered header_field number n.
2093 @param n item # n (0-indexed)
2094 @return the registered item */
2095 WS_DLL_PUBLIC enum ftenum proto_registrar_get_ftype(const int n);
2097 /** Get parent protocol of registered header_field number n.
2098 @param n item # n (0-indexed)
2099 @return -1 if item _is_ a protocol */
2100 WS_DLL_PUBLIC int proto_registrar_get_parent(const int n);
2102 /** Is item # n a protocol?
2103 @param n item # n (0-indexed)
2104 @return TRUE if it's a protocol, FALSE if it's not */
2105 WS_DLL_PUBLIC gboolean proto_registrar_is_protocol(const int n);
2107 /** Get length of registered field according to field type.
2108 @param n item # n (0-indexed)
2109 @return 0 means undeterminable at registration time, -1 means unknown field */
2110 extern gint proto_registrar_get_length(const int n);
2113 /** Routines to use to iterate over the protocols and their fields;
2114 * they return the item number of the protocol in question or the
2115 * appropriate hfinfo pointer, and keep state in "*cookie". */
2116 WS_DLL_PUBLIC int proto_get_first_protocol(void **cookie);
2117 WS_DLL_PUBLIC int proto_get_data_protocol(void *cookie);
2118 WS_DLL_PUBLIC int proto_get_next_protocol(void **cookie);
2119 WS_DLL_PUBLIC header_field_info *proto_get_first_protocol_field(const int proto_id, void **cookie);
2120 WS_DLL_PUBLIC header_field_info *proto_get_next_protocol_field(const int proto_id, void **cookie);
2122 /** Given a protocol's filter_name.
2123 @param filter_name the filter name to search for
2125 WS_DLL_PUBLIC int proto_get_id_by_filter_name(const gchar* filter_name);
2127 /** Given a protocol's short name.
2128 @param short_name the protocol short name to search for
2130 WS_DLL_PUBLIC int proto_get_id_by_short_name(const gchar* short_name);
2132 /** Can item # n decoding be disabled?
2133 @param proto_id protocol id (0-indexed)
2134 @return TRUE if it's a protocol, FALSE if it's not */
2135 WS_DLL_PUBLIC gboolean proto_can_toggle_protocol(const int proto_id);
2137 /** Get the "protocol_t" structure for the given protocol's item number.
2138 @param proto_id protocol id (0-indexed) */
2139 WS_DLL_PUBLIC protocol_t *find_protocol_by_id(const int proto_id);
2141 /** Get the protocol's name for the given protocol's item number.
2142 @param proto_id protocol id (0-indexed)
2144 WS_DLL_PUBLIC const char *proto_get_protocol_name(const int proto_id);
2146 /** Get the protocol's item number, for the given protocol's "protocol_t".
2147 @return its proto_id */
2148 WS_DLL_PUBLIC int proto_get_id(const protocol_t *protocol);
2150 /** Get the protocol's short name, for the given protocol's "protocol_t".
2151 @return its short name. */
2152 WS_DLL_PUBLIC const char *proto_get_protocol_short_name(const protocol_t *protocol);
2154 /** Get the protocol's long name, for the given protocol's "protocol_t".
2155 @return its long name. */
2156 WS_DLL_PUBLIC const char *proto_get_protocol_long_name(const protocol_t *protocol);
2158 /** Is protocol's decoding enabled ?
2159 @return TRUE if decoding is enabled, FALSE if not */
2160 WS_DLL_PUBLIC gboolean proto_is_protocol_enabled(const protocol_t *protocol);
2162 /** Get a protocol's filter name by its item number.
2163 @param proto_id protocol id (0-indexed)
2164 @return its filter name. */
2165 WS_DLL_PUBLIC const char *proto_get_protocol_filter_name(const int proto_id);
2167 /** Associate a heuristic dissector with a protocol
2168 * INTERNAL USE ONLY!!!
2169 * @param protocol to associate the heuristic with
2170 * @param short_name heuristic dissector's short name
2172 extern void proto_add_heuristic_dissector(protocol_t *protocol, const char *short_name);
2174 /** Apply func to all heuristic dissectors of a protocol
2175 * @param protocol to iterate over heuristics
2176 * @param func function to execute on heuristics
2177 * @param user_data user-specific data for function
2179 WS_DLL_PUBLIC void proto_heuristic_dissector_foreach(const protocol_t *protocol, GFunc func, gpointer user_data);
2182 /** Find commonly-used protocols in a layer list.
2183 * @param layers Protocol layer list
2184 * @param is_ip Set to TRUE if the layer list contains IPv4 or IPv6, otherwise
2185 * unchanged. May be NULL.
2186 * @param is_tcp Set to TRUE if the layer list contains TCP, otherwise
2187 * unchanged. May be NULL.
2188 * @param is_udp Set to TRUE if the layer list contains UDP, otherwise
2189 * unchanged. May be NULL.
2190 * @param is_sctp Set to TRUE if the layer list contains SCTP, otherwise
2191 * unchanged. May be NULL.
2192 * @param is_ssl Set to TRUE if the layer list contains SSL/TLS, otherwise
2193 * unchanged. May be NULL.
2195 WS_DLL_PUBLIC void proto_get_frame_protocols(const wmem_list_t *layers,
2196 gboolean *is_ip, gboolean *is_tcp, gboolean *is_udp, gboolean *is_sctp,
2197 gboolean *is_ssl, gboolean *is_rtp);
2199 /** Find a protocol by name in a layer list.
2200 * @param layers Protocol layer list
2201 * @param proto_name Name of protocol to find
2203 WS_DLL_PUBLIC gboolean proto_is_frame_protocol(const wmem_list_t *layers, const char* proto_name);
2205 /** Enable / Disable protocol of the given item number.
2206 @param proto_id protocol id (0-indexed)
2207 @param enabled enable / disable the protocol */
2208 WS_DLL_PUBLIC void proto_set_decoding(const int proto_id, const gboolean enabled);
2210 /** Enable all protocols */
2211 WS_DLL_PUBLIC void proto_enable_all(void);
2213 /** Disable disabling/enabling of protocol of the given item number.
2214 @param proto_id protocol id (0-indexed) */
2215 WS_DLL_PUBLIC void proto_set_cant_toggle(const int proto_id);
2217 /** Checks for existence any protocol or field within a tree.
2218 @param tree "Protocols" are assumed to be a child of the [empty] root node.
2219 @param id hfindex of protocol or field
2220 @return TRUE = found, FALSE = not found
2221 @todo add explanation of id parameter */
2222 extern gboolean proto_check_for_protocol_or_field(const proto_tree* tree, const int id);
2224 /** Return GPtrArray* of field_info pointers for all hfindex that appear in
2225 tree. Only works with primed trees, and is fast.
2226 @param tree tree of interest
2227 @param hfindex primed hfindex
2228 @return GPtrArry pointer */
2229 WS_DLL_PUBLIC GPtrArray* proto_get_finfo_ptr_array(const proto_tree *tree, const int hfindex);
2231 /** Return whether we're tracking any interesting fields.
2232 Only works with primed trees, and is fast.
2233 @param tree tree of interest
2234 @return TRUE if we're tracking interesting fields */
2235 WS_DLL_PUBLIC gboolean proto_tracking_interesting_fields(const proto_tree *tree);
2237 /** Return GPtrArray* of field_info pointers for all hfindex that appear in
2238 tree. Works with any tree, primed or unprimed, and is slower than
2240 proto_get_finfo_ptr_array because it has to search through the tree.
2241 @param tree tree of interest
2242 @param hfindex index of field info of interest
2243 @return GPtrArry pointer */
2244 WS_DLL_PUBLIC GPtrArray* proto_find_finfo(proto_tree *tree, const int hfindex);
2246 /** Return GPtrArray* of field_info pointers containg all hfindexes that appear
2248 @param tree tree of interest
2249 @return GPtrArry pointer */
2250 WS_DLL_PUBLIC GPtrArray* proto_all_finfos(proto_tree *tree);
2252 /** Dumps a glossary of the protocol registrations to STDOUT */
2253 WS_DLL_PUBLIC void proto_registrar_dump_protocols(void);
2255 /** Dumps a glossary of the field value strings or true/false strings to STDOUT */
2256 WS_DLL_PUBLIC void proto_registrar_dump_values(void);
2258 /** Dumps the number of protocol and field registrations to STDOUT.
2259 @return FALSE if we pre-allocated enough fields, TRUE otherwise. */
2260 WS_DLL_PUBLIC gboolean proto_registrar_dump_fieldcount(void);
2262 /** Dumps a glossary of the protocol and field registrations to STDOUT. */
2263 WS_DLL_PUBLIC void proto_registrar_dump_fields(void);
2265 /** Dumps a glossary field types and descriptive names to STDOUT */
2266 WS_DLL_PUBLIC void proto_registrar_dump_ftypes(void);
2269 /** Number of elements in the tree_is_expanded array. With MSVC and a
2270 * libwireshark.dll, we need a special declaration. */
2271 WS_DLL_PUBLIC int num_tree_types;
2273 /** Returns TRUE if subtrees of that type are to be expanded. */
2274 WS_DLL_PUBLIC gboolean tree_expanded(int tree_type);
2276 /** Sets if subtrees of that type are to be expanded. */
2277 WS_DLL_PUBLIC void tree_expanded_set(int tree_type, gboolean value);
2279 /** glib doesn't have g_ptr_array_len of all things!*/
2280 #ifndef g_ptr_array_len
2281 #define g_ptr_array_len(a) ((a)?(a)->len:0)
2284 /** Get number of bits of a header_field.
2285 @param hfinfo header_field
2286 @return the bitwidth */
2288 hfinfo_bitwidth(const header_field_info *hfinfo);
2291 hfinfo_bitshift(const header_field_info *hfinfo);
2293 struct epan_dissect;
2295 /** Can we do a "match selected" on this field.
2296 @param finfo field_info
2297 @param edt epan dissecting
2298 @return TRUE if we can do a "match selected" on the field, FALSE otherwise. */
2299 WS_DLL_PUBLIC gboolean
2300 proto_can_match_selected(field_info *finfo, struct epan_dissect *edt);
2302 /** Construct a "match selected" display filter string.
2303 @param finfo field_info
2304 @param edt epan dissecting
2305 @return the wmem NULL alloced display filter string. Needs to be freed with wmem_free(NULL, ...) */
2307 proto_construct_match_selected_string(field_info *finfo, struct epan_dissect *edt);
2309 /** Find field from offset in tvb.
2310 @param tree tree of interest
2311 @param offset offset in the tvb
2312 @param tvb the tv buffer
2313 @return the corresponding field_info */
2314 WS_DLL_PUBLIC field_info*
2315 proto_find_field_from_offset(proto_tree *tree, guint offset, tvbuff_t *tvb);
2317 /** Find undecoded bytes in a tree
2318 @param tree tree of interest
2319 @param length the length of the frame
2320 @return an array to be used as bitmap of decoded bytes */
2321 WS_DLL_PUBLIC gchar*
2322 proto_find_undecoded_data(proto_tree *tree, guint length);
2324 /** This function will dissect a sequence of bytes that describe a bitmask.
2325 @param tree the tree to append this item to
2326 @param tvb the tv buffer of the current data
2327 @param offset start of data in tvb
2328 @param hf_hdr an 8/16/24/32 bit integer that describes the bitmask to be dissected.
2329 This field will form an expansion under which the individual fields of the
2330 bitmask is dissected and displayed.
2331 This field must be of the type FT_[U]INT{8|16|24|32}.
2332 @param ett subtree index
2333 @param fields an array of pointers to int that lists all the fields of the
2334 bitmask. These fields can be either of the type FT_BOOLEAN for flags
2335 or another integer of the same type/size as hf_hdr with a mask specified.
2336 This array is terminated by a NULL entry.
2337 FT_BOOLEAN bits that are set to 1 will have the name added to the expansion.
2338 FT_integer fields that have a value_string attached will have the
2339 matched string displayed on the expansion line.
2340 @param encoding big or little endian byte representation (ENC_BIG_ENDIAN/ENC_LITTLE_ENDIAN/ENC_HOST_ENDIAN)
2341 @return the newly created item */
2342 WS_DLL_PUBLIC proto_item *
2343 proto_tree_add_bitmask(proto_tree *tree, tvbuff_t *tvb, const guint offset,
2344 const int hf_hdr, const gint ett, const int **fields, const guint encoding);
2346 /** This function will dissect a sequence of bytes that describe a bitmask.
2347 * This has "filterable" bitmask header functionality of proto_tree_add_bitmask
2348 * with the ability to control what data is appended to the header like
2349 * proto_tree_add_bitmask_text
2350 @param tree the tree to append this item to
2351 @param tvb the tv buffer of the current data
2352 @param offset start of data in tvb
2353 @param hf_hdr an 8/16/24/32 bit integer that describes the bitmask to be dissected.
2354 This field will form an expansion under which the individual fields of the
2355 bitmask is dissected and displayed.
2356 This field must be of the type FT_[U]INT{8|16|24|32}.
2357 @param ett subtree index
2358 @param fields an array of pointers to int that lists all the fields of the
2359 bitmask. These fields can be either of the type FT_BOOLEAN for flags
2360 or another integer of the same type/size as hf_hdr with a mask specified.
2361 This array is terminated by a NULL entry.
2362 FT_BOOLEAN bits that are set to 1 will have the name added to the expansion.
2363 FT_integer fields that have a value_string attached will have the
2364 matched string displayed on the expansion line.
2365 @param encoding big or little endian byte representation (ENC_BIG_ENDIAN/ENC_LITTLE_ENDIAN/ENC_HOST_ENDIAN)
2366 @param flags bitmask field using BMT_NO_* flags to determine behavior
2367 @return the newly created item */
2368 WS_DLL_PUBLIC proto_item *
2369 proto_tree_add_bitmask_with_flags(proto_tree *tree, tvbuff_t *tvb, const guint offset,
2370 const int hf_hdr, const gint ett, const int **fields, const guint encoding, const int flags);
2372 /** This function will dissect a value that describe a bitmask. Similar to proto_tree_add_bitmask(),
2373 but with a passed in value (presumably because it can't be retrieved directly from tvb)
2374 @param tree the tree to append this item to
2375 @param tvb the tv buffer of the current data
2376 @param offset start of data in tvb
2377 @param hf_hdr an 8/16/24/32/64 bit integer that describes the bitmask to be dissected.
2378 This field will form an expansion under which the individual fields of the
2379 bitmask is dissected and displayed.
2380 This field must be of the type FT_[U]INT{8|16|24|32|64}.
2381 @param ett subtree index
2382 @param fields an array of pointers to int that lists all the fields of the
2383 bitmask. These fields can be either of the type FT_BOOLEAN for flags
2384 or another integer of the same type/size as hf_hdr with a mask specified.
2385 This array is terminated by a NULL entry.
2386 FT_BOOLEAN bits that are set to 1 will have the name added to the expansion.
2387 FT_integer fields that have a value_string attached will have the
2388 matched string displayed on the expansion line.
2389 @param value bitmask value
2390 @return the newly created item */
2391 WS_DLL_PUBLIC proto_item *
2392 proto_tree_add_bitmask_value(proto_tree *tree, tvbuff_t *tvb, const guint offset,
2393 const int hf_hdr, const gint ett, const int **fields, const guint64 value);
2395 /** This function will dissect a value that describe a bitmask. Similar to proto_tree_add_bitmask(),
2396 but with a passed in value (presumably because it can't be retrieved directly from tvb)
2397 This has "filterable" bitmask header functionality of proto_tree_add_bitmask_value
2398 with the ability to control what data is appended to the header like
2399 proto_tree_add_bitmask_text
2400 @param tree the tree to append this item to
2401 @param tvb the tv buffer of the current data
2402 @param offset start of data in tvb
2403 @param hf_hdr an 8/16/24/32/64 bit integer that describes the bitmask to be dissected.
2404 This field will form an expansion under which the individual fields of the
2405 bitmask is dissected and displayed.
2406 This field must be of the type FT_[U]INT{8|16|24|32|64}.
2407 @param ett subtree index
2408 @param fields an array of pointers to int that lists all the fields of the
2409 bitmask. These fields can be either of the type FT_BOOLEAN for flags
2410 or another integer of the same type/size as hf_hdr with a mask specified.
2411 This array is terminated by a NULL entry.
2412 FT_BOOLEAN bits that are set to 1 will have the name added to the expansion.
2413 FT_integer fields that have a value_string attached will have the
2414 matched string displayed on the expansion line.
2415 @param value bitmask value
2416 @param flags bitmask field using BMT_NO_* flags to determine behavior
2417 @return the newly created item */
2418 WS_DLL_PUBLIC proto_item *
2419 proto_tree_add_bitmask_value_with_flags(proto_tree *tree, tvbuff_t *tvb, const guint offset,
2420 const int hf_hdr, const gint ett, const int **fields, const guint64 value, const int flags);
2422 /** This function will dissect a sequence of bytes that describe a bitmask. Similar
2423 to proto_tree_add_bitmask(), but with no "header" item to group all of the fields
2424 @param tree the tree to append this item to
2425 @param tvb the tv buffer of the current data
2426 @param offset start of data in tvb
2427 @param len number of bytes of data
2428 @param fields an array of pointers to int that lists all the fields of the
2429 bitmask. These fields can be either of the type FT_BOOLEAN for flags
2430 or another integer of the same type/size as hf_hdr with a mask specified.
2431 This array is terminated by a NULL entry.
2432 FT_BOOLEAN bits that are set to 1 will have the name added to the expansion.
2433 FT_integer fields that have a value_string attached will have the
2434 matched string displayed on the expansion line.
2435 @param encoding big or little endian byte representation (ENC_BIG_ENDIAN/ENC_LITTLE_ENDIAN/ENC_HOST_ENDIAN)
2438 proto_tree_add_bitmask_list(proto_tree *tree, tvbuff_t *tvb, const guint offset,
2439 const int len, const int **fields, const guint encoding);
2443 /** This function will dissect a sequence of bytes that describe a bitmask.
2444 @param tree the tree to append this item to
2445 @param tvb the tv buffer of the current data
2446 @param offset start of data in tvb
2447 @param len number of bytes of data
2448 @param hf_hdr an 8/16/24/32 bit integer that describes the bitmask to be dissected.
2449 This field will form an expansion under which the individual fields of the
2450 bitmask are dissected and displayed.
2451 This field must be of the type FT_[U]INT{8|16|24|32}.
2452 @param ett subtree index
2453 @param fields an array of pointers to int that lists all the fields of the
2454 bitmask. These fields can be either of the type FT_BOOLEAN for flags
2455 or another integer with a mask specified.
2456 This array is terminated by a NULL entry.
2457 FT_BOOLEAN bits that are set to 1 will have the name added to the expansion.
2458 FT_integer fields that have a value_string attached will have the
2459 matched string displayed on the expansion line.
2460 @param exp expert info field used when decodable_len < len. This also means this function
2461 should be called even when tree == NULL
2462 @param encoding big or little endian byte representation (ENC_BIG_ENDIAN/ENC_LITTLE_ENDIAN/ENC_HOST_ENDIAN)
2463 @return the newly created item */
2464 WS_DLL_PUBLIC proto_item *
2465 proto_tree_add_bitmask_len(proto_tree *tree, tvbuff_t *tvb, const guint offset, const guint len,
2466 const int hf_hdr, const gint ett, const int **fields, struct expert_field* exp, const guint encoding);
2468 /** Add a text with a subtree of bitfields.
2469 @param tree the tree to append this item to
2470 @param tvb the tv buffer of the current data
2471 @param offset start of data in tvb
2472 @param len length of the field name
2473 @param name field name (NULL if bitfield contents should be used)
2474 @param fallback field name if none of bitfields were usable
2475 @param ett subtree index
2476 @param fields NULL-terminated array of bitfield indexes
2477 @param encoding big or little endian byte representation (ENC_BIG_ENDIAN/ENC_LITTLE_ENDIAN/ENC_HOST_ENDIAN)
2478 @param flags bitmask field
2479 @return the newly created item */
2480 WS_DLL_PUBLIC proto_item *
2481 proto_tree_add_bitmask_text(proto_tree *tree, tvbuff_t *tvb, const guint offset, const guint len,
2482 const char *name, const char *fallback,
2483 const gint ett, const int **fields, const guint encoding, const int flags);
2485 #define BMT_NO_APPEND 0x01 /**< Don't change the title at all */
2486 #define BMT_NO_INT 0x02 /**< Don't add integral (non-boolean) fields to title */
2487 #define BMT_NO_FALSE 0x04 /**< Don't add booleans unless they're TRUE */
2488 #define BMT_NO_TFS 0x08 /**< Don't use true_false_string while formatting booleans */
2490 /** Add bits to a proto_tree, using the text label registered to that item.
2491 The item is extracted from the tvbuff handed to it.
2492 @param tree the tree to append this item to
2493 @param hf_index field index. Fields for use with this function should have bitmask==0.
2494 @param tvb the tv buffer of the current data
2495 @param bit_offset start of data in tvb expressed in bits
2496 @param no_of_bits length of data in tvb expressed in bits
2497 @param encoding data encoding
2498 @return the newly created item */
2499 WS_DLL_PUBLIC proto_item *
2500 proto_tree_add_bits_item(proto_tree *tree, const int hf_index, tvbuff_t *tvb, const guint bit_offset, const gint no_of_bits, const guint encoding);
2502 /** Add bits to a proto_tree, using the text label registered to that item.
2503 * The item is extracted from the tvbuff handed to it as a set
2504 * of crumbs (segments) of contiguous bits, specified by an
2505 * array of crumb_spec elements. The crumbs are assembled to
2506 * create the value. There may be any number of crumbs
2507 * specifying up to a total of 64 bits which may occur anywhere
2508 * within the tvb. If the span of the crumbs within the tvb is 4
2509 * octets or less, a bitmap of the crumbs is produced.
2510 @param tree the tree to append this item to
2511 @param hf_index field index. Fields for use with this function should have bitmask==0.
2512 @param tvb the tv buffer of the current data
2513 @param bit_offset of the first crumb in tvb expressed in bits
2514 @param crumb_spec pointer to crumb_spec array
2515 @param return_value if a pointer is passed here the value is returned.
2516 @return the newly created item */
2518 proto_tree_add_split_bits_item_ret_val(proto_tree *tree, const int hf_index, tvbuff_t *tvb,
2519 const guint bit_offset, const crumb_spec_t *crumb_spec,
2520 guint64 *return_value);
2523 /** Add bitmap text for a split-bits crumb to a proto_tree,
2524 * using the text label registered to an item. The bitmap is
2525 * extracted from the tvbuff handed to it as a crumb (segment)
2526 * of contiguous bits, specified by one of an array of
2527 * crumb_spec elements. This function is normally called once
2528 * per crumb, after the call to
2529 proto_tree_add_split_bits_item_ret_val
2530 @param tree the tree to append this item to
2531 @param hf_index field index. Fields for use with this function should have bitmask==0.
2532 @param tvb the tv buffer of the current data
2533 @param bit_offset of the first crumb in tvb expressed in bits
2534 @param crumb_spec pointer to crumb_spec array
2535 @param crumb_index into the crumb_spec array for this crumb */
2537 proto_tree_add_split_bits_crumb(proto_tree *tree, const int hf_index, tvbuff_t *tvb, const guint bit_offset,
2538 const crumb_spec_t *crumb_spec, guint16 crumb_index);
2540 /** Add bits to a proto_tree, using the text label registered to that item.
2541 The item is extracted from the tvbuff handed to it.
2542 @param tree the tree to append this item to
2543 @param hf_index field index. Fields for use with this function should have bitmask==0.
2544 @param tvb the tv buffer of the current data
2545 @param bit_offset start of data in tvb expressed in bits
2546 @param no_of_bits length of data in tvb expressed in bits
2547 @param return_value if a pointer is passed here the value is returned.
2548 @param encoding data encoding
2549 @return the newly created item */
2550 WS_DLL_PUBLIC proto_item *
2551 proto_tree_add_bits_ret_val(proto_tree *tree, const int hf_index, tvbuff_t *tvb, const guint bit_offset, const gint no_of_bits, guint64 *return_value, const guint encoding);
2553 /** Add bits for a FT_UINT8, FT_UINT16, FT_UINT24 or FT_UINT32
2554 header field to a proto_tree, with the format generating the
2555 string for the value and with the field name being included automatically.
2556 @param tree the tree to append this item to
2557 @param hf_index field index
2558 @param tvb the tv buffer of the current data
2559 @param bit_offset start of data in tvb expressed in bits
2560 @param no_of_bits length of data in tvb expressed in bit
2561 @param value data to display
2562 @param format printf like format string
2563 @return the newly created item */
2564 WS_DLL_PUBLIC proto_item *
2565 proto_tree_add_uint_bits_format_value(proto_tree *tree, const int hf_index, tvbuff_t *tvb, const guint bit_offset, const gint no_of_bits,
2566 guint32 value, const char *format, ...) G_GNUC_PRINTF(7,8);
2568 /** Add bits for a FT_UINT8, FT_UINT16, FT_UINT24 or FT_UINT32
2569 header field to a proto_tree, with the format generating the
2570 string for the value and with the field name being included automatically.
2571 @param tree the tree to append this item to
2572 @param hf_index field index
2573 @param tvb the tv buffer of the current data
2574 @param bit_offset start of data in tvb expressed in bits
2575 @param no_of_bits length of data in tvb expressed in bit
2576 @param value data to display
2577 @param format printf like format string
2578 @return the newly created item */
2579 WS_DLL_PUBLIC proto_item *
2580 proto_tree_add_uint64_bits_format_value(proto_tree *tree, const int hf_index, tvbuff_t *tvb, const guint bit_offset, const gint no_of_bits,
2581 guint64 value, const char *format, ...) G_GNUC_PRINTF(7,8);
2583 /** Add bits for a FT_BOOLEAN header field to a proto_tree, with
2584 the format generating the string for the value and with the field
2585 name being included automatically.
2586 @param tree the tree to append this item to
2587 @param hf_index field index
2588 @param tvb the tv buffer of the current data
2589 @param bit_offset start of data in tvb expressed in bits
2590 @param no_of_bits length of data in tvb expressed in bit
2591 @param value data to display
2592 @param format printf like format string
2593 @param ... printf like parameters
2594 @return the newly created item */
2596 proto_tree_add_boolean_bits_format_value(proto_tree *tree, const int hf_index, tvbuff_t *tvb, const guint bit_offset, const gint no_of_bits,
2597 guint32 value, const char *format, ...) G_GNUC_PRINTF(7,8);
2599 /** Add bits for a FT_BOOLEAN header field to a proto_tree, with
2600 the format generating the string for the value and with the field
2601 name being included automatically.
2602 @param tree the tree to append this item to
2603 @param hf_index field index
2604 @param tvb the tv buffer of the current data
2605 @param bit_offset start of data in tvb expressed in bits
2606 @param no_of_bits length of data in tvb expressed in bit
2607 @param value data to display
2608 @param format printf like format string
2609 @param ... printf like parameters
2610 @return the newly created item */
2612 proto_tree_add_boolean_bits_format_value64(proto_tree *tree, const int hf_index, tvbuff_t *tvb, const guint bit_offset, const gint no_of_bits,
2613 guint64 value, const char *format, ...) G_GNUC_PRINTF(7,8);
2615 /** Add bits for a FT_INT8, FT_INT16, FT_INT24 or FT_INT32
2616 header field to a proto_tree, with the format generating the
2617 string for the value and with the field name being included automatically.
2618 @param tree the tree to append this item to
2619 @param hf_index field index
2620 @param tvb the tv buffer of the current data
2621 @param bit_offset start of data in tvb expressed in bits
2622 @param no_of_bits length of data in tvb expressed in bit
2623 @param value data to display
2624 @param format printf like format string
2625 @param ... printf like parameters
2626 @return the newly created item */
2628 proto_tree_add_int_bits_format_value(proto_tree *tree, const int hf_index, tvbuff_t *tvb, const guint bit_offset, const gint no_of_bits,
2629 gint32 value, const char *format, ...) G_GNUC_PRINTF(7,8);
2631 /** Add bits for a FT_INT8, FT_INT16, FT_INT24 or FT_INT32
2632 header field to a proto_tree, with the format generating the
2633 string for the value and with the field name being included automatically.
2634 @param tree the tree to append this item to
2635 @param hf_index field index
2636 @param tvb the tv buffer of the current data
2637 @param bit_offset start of data in tvb expressed in bits
2638 @param no_of_bits length of data in tvb expressed in bit
2639 @param value data to display
2640 @param format printf like format string
2641 @param ... printf like parameters
2642 @return the newly created item */
2644 proto_tree_add_int64_bits_format_value(proto_tree *tree, const int hf_index, tvbuff_t *tvb, const guint bit_offset, const gint no_of_bits,
2645 gint64 value, const char *format, ...) G_GNUC_PRINTF(7,8);
2647 /** Add bits for a FT_FLOAT header field to a proto_tree, with
2648 the format generating the string for the value and with the field
2649 name being included automatically.
2650 @param tree the tree to append this item to
2651 @param hf_index field index
2652 @param tvb the tv buffer of the current data
2653 @param bit_offset start of data in tvb expressed in bits
2654 @param no_of_bits length of data in tvb expressed in bit
2655 @param value data to display
2656 @param format printf like format string
2657 @param ... printf like parameters
2658 @return the newly created item */
2660 proto_tree_add_float_bits_format_value(proto_tree *tree, const int hf_index, tvbuff_t *tvb, const guint bit_offset, const gint no_of_bits,
2661 float value, const char *format, ...) G_GNUC_PRINTF(7,8);
2664 /** Add a FT_STRING with ENC_3GPP_TS_23_038_7BITS encoding to a proto_tree.
2665 @param tree the tree to append this item to
2666 @param hfindex field index
2667 @param tvb the tv buffer of the current data
2668 @param bit_offset start of data in tvb expressed in bits
2669 @param no_of_chars number of 7bits characters to display
2670 @return the newly created item */
2671 WS_DLL_PUBLIC proto_item *
2672 proto_tree_add_ts_23_038_7bits_item(proto_tree *tree, const int hfindex, tvbuff_t *tvb,
2673 const guint bit_offset, const gint no_of_chars);
2675 /** Add a FT_STRING with ENC_ASCII_7BITS encoding to a proto_tree.
2676 @param tree the tree to append this item to
2677 @param hfindex field index
2678 @param tvb the tv buffer of the current data
2679 @param bit_offset start of data in tvb expressed in bits
2680 @param no_of_chars number of 7bits characters to display
2681 @return the newly created item */
2682 WS_DLL_PUBLIC proto_item *
2683 proto_tree_add_ascii_7bits_item(proto_tree *tree, const int hfindex, tvbuff_t *tvb,
2684 const guint bit_offset, const gint no_of_chars);
2686 /** Check if given string is a valid field name
2687 @param field_name the field name to check
2688 @return 0 if valid, else first illegal character */
2689 WS_DLL_PUBLIC guchar
2690 proto_check_field_name(const gchar *field_name);
2693 /** Check if given string is a valid field name
2694 @param tree the tree to append this item to
2695 @param field_id the field id used for custom column
2696 @param occurrence the occurrence of the field used for custom column
2697 @param result the buffer to fill with the field string
2698 @param expr the filter expression
2699 @param size the size of the string buffer */
2701 proto_custom_set(proto_tree* tree, GSList *field_id,
2704 gchar *expr, const int size );
2706 /* #define HAVE_HFI_SECTION_INIT */
2708 #ifdef HAVE_HFI_SECTION_INIT
2709 #define HFI_INIT(proto) __attribute__((section( "_data_" G_STRINGIFY(proto)))) __attribute__((aligned(sizeof(void *))))
2711 #define proto_register_fields(proto, hfi, count) \
2713 extern header_field_info __start__data_ ##proto[]; \
2714 extern header_field_info __stop__data_ ##proto[]; \
2716 proto_register_fields_section(proto, __start__data_ ##proto, (int) (__stop__data_ ##proto - __start__data_ ##proto)); \
2719 #define HFI_INIT(proto)
2720 #define proto_register_fields(proto, hfi, count) \
2721 proto_register_fields_manual(proto, hfi, count)
2724 #ifdef NEW_PROTO_TREE_API
2725 #define proto_tree_add_item(tree, hfinfo, tvb, start, length, encoding) \
2726 proto_tree_add_item_new(tree, hfinfo, tvb, start, length, encoding)
2728 #define proto_tree_add_boolean(tree, hfinfo, tvb, start, length, value) \
2729 proto_tree_add_boolean(tree, (hfinfo)->id, tvb, start, length, value)
2731 #define proto_tree_add_string(tree, hfinfo, tvb, start, length, value) \
2732 proto_tree_add_string(tree, (hfinfo)->id, tvb, start, length, value)
2734 #define proto_tree_add_time(tree, hfinfo, tvb, start, length, value) \
2735 proto_tree_add_time(tree, (hfinfo)->id, tvb, start, length, value)
2737 #define proto_tree_add_int(tree, hfinfo, tvb, start, length, value) \
2738 proto_tree_add_int(tree, (hfinfo)->id, tvb, start, length, value)
2740 #define proto_tree_add_uint(tree, hfinfo, tvb, start, length, value) \
2741 proto_tree_add_uint(tree, (hfinfo)->id, tvb, start, length, value)
2743 #define proto_tree_add_float_format_value(tree, hfinfo, \
2744 tvb, start, length, value, format, ...) \
2745 proto_tree_add_float_format_value(tree, (hfinfo)->id, \
2746 tvb, start, length, value, format, __VA_ARGS__)
2753 #endif /* __cplusplus */
2755 #endif /* proto.h */