2 * Definitions for protocol display
6 * Wireshark - Network traffic analyzer
7 * By Gerald Combs <gerald@wireshark.org>
8 * Copyright 1998 Gerald Combs
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License
12 * as published by the Free Software Foundation; either version 2
13 * of the License, or (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
27 The protocol tree related functions.<BR>
28 A protocol tree will hold all necessary data to display the whole dissected packet.
29 Creating a protocol tree is done in a two stage process:
30 A static part at program startup, and a dynamic part when the dissection with the real packet data is done.<BR>
31 The "static" information is provided by creating a hf_register_info hf[] array, and register it using the
32 proto_register_field_array() function. This is usually done at dissector registering.<BR>
33 The "dynamic" information is added to the protocol tree by calling one of the proto_tree_add_...() functions,
34 e.g. proto_tree_add_bytes().
48 #include "gnuc_format_check.h"
52 #include "ftypes/ftypes.h"
56 #endif /* __cplusplus */
58 /** The header-field index for the special text pseudo-field. Exported by libwireshark.dll */
59 WS_VAR_IMPORT int hf_text_only;
61 /** the maximum length of a protocol field string representation */
62 #define ITEM_LABEL_LENGTH 240
66 /** Make a const value_string[] look like a _value_string pointer, used to set header_field_info.strings */
67 #define VALS(x) (const struct _value_string*)(x)
69 /** Make a const true_false_string[] look like a _true_false_string pointer, used to set header_field_info.strings */
70 #define TFS(x) (const struct true_false_string*)(x)
74 /** Structure for information about a protocol */
75 typedef struct _protocol protocol_t;
77 /** check protocol activation
78 * @todo this macro looks like a hack */
79 #define CHECK_DISPLAY_AS_X(x_handle,index, tvb, pinfo, tree) { \
80 if (!proto_is_protocol_enabled(find_protocol_by_id(index))) { \
81 call_dissector(x_handle,tvb, pinfo, tree); \
86 /** Macro used for reporting errors in dissectors; it throws a
87 * DissectorError exception, with the string passed as an argument
88 * as the message for the exception, so that it can show up in
89 * the Info column and the protocol tree.
91 * If that string is dynamically allocated, it should be allocated with
92 * ep_alloc(); using ep_strdup_printf() would work.
94 * If the WIRESHARK_ABORT_ON_DISSECTOR_BUG environment variable is set,
95 * it will call abort(), instead, to make it easier to get a stack trace.
97 * @param message string to use as the message
99 #define REPORT_DISSECTOR_BUG(message) \
100 ((getenv("WIRESHARK_ABORT_ON_DISSECTOR_BUG") != NULL) ? \
102 THROW_MESSAGE(DissectorError, message))
104 /** Macro used for assertions in dissectors; it doesn't abort, it just
105 * throws a DissectorError exception, with the assertion failure
106 * message as a parameter, so that it can show up in the protocol tree.
108 * @param expression expression to test in the assertion
110 #define DISSECTOR_ASSERT(expression) \
111 ((void) ((expression) ? (void)0 : \
112 __DISSECTOR_ASSERT (expression, __FILE__, __LINE__)))
115 /* win32: using a debug breakpoint (int 3) can be very handy while debugging,
116 * as the assert handling of GTK/GLib is currently not very helpful */
117 #define DISSECTOR_ASSERT(expression) \
118 { if(!(expression)) _asm { int 3}; }
121 /** Same as DISSECTOR_ASSERT(), but will throw DissectorError exception
122 * unconditionally, much like GLIB's g_assert_not_reached works.
124 #define DISSECTOR_ASSERT_NOT_REACHED() \
125 (REPORT_DISSECTOR_BUG( \
126 ep_strdup_printf("%s:%u: failed assertion \"DISSECTOR_ASSERT_NOT_REACHED\"", \
127 __FILE__, __LINE__)))
129 #define __DISSECTOR_ASSERT_STRINGIFY(s) # s
131 #define __DISSECTOR_ASSERT(expression, file, lineno) \
132 (REPORT_DISSECTOR_BUG( \
133 ep_strdup_printf("%s:%u: failed assertion \"%s\"", \
134 file, lineno, __DISSECTOR_ASSERT_STRINGIFY(expression))))
136 /** radix for decimal values, used in header_field_info.display */
138 BASE_NONE, /**< none */
139 BASE_DEC, /**< decimal */
140 BASE_HEX, /**< hexadecimal */
141 BASE_OCT, /**< octal */
142 BASE_DEC_HEX, /**< decimal (hexadecimal) */
143 BASE_HEX_DEC /**< hexadecimal (decimal) */
146 #define IS_BASE_DUAL(b) ((b)==BASE_DEC_HEX||(b)==BASE_HEX_DEC)
148 /** information describing a header field */
149 typedef struct _header_field_info header_field_info;
151 /** information describing a header field */
152 struct _header_field_info {
153 /* ---------- set by dissector --------- */
154 const char *name; /**< full name of this field */
155 const char *abbrev; /**< abbreviated name of this field */
156 enum ftenum type; /**< field type, one of FT_ (from ftypes.h) */
157 int display; /**< one of BASE_, or number of field bits for FT_BOOLEAN */
158 const void *strings; /**< _value_string (or true_false_string for FT_BOOLEAN), typically converted by VALS() or TFS() If this is an FT_PROTOCOL then it points to the associated protocol_t structure*/
159 guint32 bitmask; /**< FT_BOOLEAN only: bitmask of interesting bits */
160 const char *blurb; /**< Brief description of field. */
162 /* ------- set by proto routines (prefilled by HFILL macro, see below) ------ */
163 int id; /**< Field ID */
164 int parent; /**< parent protocol tree */
165 /* This field keeps track of whether a field is
166 * referenced in any filter or not and if so how
167 * many times. If a filter is being referenced the
168 * refcount for the parent protocol is updated as well
170 int ref_count; /**< is this field referenced by a filter or not */
171 int bitshift; /**< bits to shift (FT_BOOLEAN only) */
172 header_field_info *same_name_next; /**< Link to next hfinfo with same abbrev*/
173 header_field_info *same_name_prev; /**< Link to previous hfinfo with same abbrev*/
177 * HFILL initializes all the "set by proto routines" fields in a
178 * _header_field_info. If new fields are added or removed, it should
179 * be changed as necessary.
181 #define HFILL 0, 0, 0, 0, NULL, NULL
183 /** Used when registering many fields at once, using proto_register_field_array() */
184 typedef struct hf_register_info {
185 int *p_id; /**< written to by register() function */
186 header_field_info hfinfo; /**< the field info to be registered */
192 /** string representation, if one of the proto_tree_add_..._format() functions used */
193 typedef struct _item_label_t {
194 char representation[ITEM_LABEL_LENGTH];
198 /** Contains the field information for the proto_item. */
199 typedef struct field_info {
200 header_field_info *hfinfo; /**< pointer to registered field information */
201 gint start; /**< current start of data in field_info.ds_tvb */
202 gint length; /**< current data length of item in field_info.ds_tvb */
203 gint tree_type; /**< one of ETT_ or -1 */
204 item_label_t *rep; /**< string for GUI tree */
205 int flags; /**< bitfield like FI_GENERATED, ... */
206 tvbuff_t *ds_tvb; /**< data source tvbuff */
211 /** The protocol field should not be shown in the tree (it's used for filtering only),
212 * used in field_info.flags. */
213 /* HIDING PROTOCOL FIELDS IS DEPRECATED, IT'S CONSIDERED TO BE BAD GUI DESIGN! */
214 #define FI_HIDDEN 0x0001
215 /** The protocol field should be displayed as "generated by Wireshark",
216 * used in field_info.flags. */
217 #define FI_GENERATED 0x0002
218 /* The protocol field is actually a URL */
219 #define FI_URL 0x0004
222 /** convenience macro to get field_info.flags */
223 #define FI_GET_FLAG(fi, flag) (fi->flags & flag)
224 /** convenience macro to set field_info.flags */
225 #define FI_SET_FLAG(fi, flag) (fi->flags = fi->flags | flag)
227 /** One of these exists for the entire protocol tree. Each proto_node
228 * in the protocol tree points to the same copy. */
230 GHashTable *interesting_hfids;
235 /** Each proto_tree, proto_item is one of these. */
236 typedef struct _proto_node {
237 struct _proto_node *first_child;
238 struct _proto_node *last_child;
239 struct _proto_node *next;
240 struct _proto_node *parent;
242 tree_data_t *tree_data;
245 /** A protocol tree element. */
246 typedef proto_node proto_tree;
247 /** A protocol item element. */
248 typedef proto_node proto_item;
250 /* expert severities */
251 #define PI_SEVERITY_MASK 0x001C /* mask usually for internal use only! */
252 /** Usual workflow, e.g. TCP connection establishing */
253 #define PI_CHAT 0x0004
254 /** Notable messages, e.g. an application returned an "usual" error code like HTTP 404 */
255 #define PI_NOTE 0x0008
256 /** Warning, e.g. application returned an "unusual" error code */
257 #define PI_WARN 0x000C
258 /** Serious problems, e.g. [Malformed Packet] */
259 #define PI_ERROR 0x0010
261 /* expert "event groups" */
262 #define PI_GROUP_MASK 0xFF00 /* mask usually for internal use only! */
263 /** The protocol field has a bad checksum, usually PI_WARN */
264 #define PI_CHECKSUM 0x0100
265 /** The protocol field indicates a sequence problem (e.g. TCP window is zero) */
266 #define PI_SEQUENCE 0x0200
267 /** The protocol field indicates a bad application response code (e.g. HTTP 404), usually PI_NOTE */
268 #define PI_RESPONSE_CODE 0x0400
269 /** The protocol field indicates an application request (e.g. File Handle == xxxx), usually PI_CHAT */
270 #define PI_REQUEST_CODE 0x0500
271 /** The data is undecoded, the protocol dissection is incomplete here, usually PI_WARN */
272 #define PI_UNDECODED 0x0800
273 /** The protocol field indicates a reassemble (e.g. DCE/RPC defragmentation), usually PI_CHAT (or PI_ERROR) */
274 #define PI_REASSEMBLE 0x1000
275 /** The packet data is malformed, the dissector has "given up", usually PI_ERROR */
276 #define PI_MALFORMED 0x2000
277 /** A generic debugging message (shouldn't remain in production code!), usually PI_ERROR */
278 #define PI_DEBUG 0x4000
279 /** The protocol field indicates a security probem (e.g. unsecure implementation) */
280 /*#define PI_SECURITY 0x8000*/
282 /* add more, see http://wiki.wireshark.org/Development/ExpertInfo */
285 /** is this protocol field hidden from the protocol tree display (used for filtering only)? */
286 /* HIDING PROTOCOL FIELDS IS DEPRECATED, IT'S CONSIDERED TO BE BAD GUI DESIGN! */
287 #define PROTO_ITEM_IS_HIDDEN(proto_item) \
288 ((proto_item) ? FI_GET_FLAG((proto_item)->finfo, FI_HIDDEN) : 0)
289 /** mark this protocol field to be hidden from the protocol tree display (used for filtering only) */
290 /* HIDING PROTOCOL FIELDS IS DEPRECATED, IT'S CONSIDERED TO BE BAD GUI DESIGN! */
291 #define PROTO_ITEM_SET_HIDDEN(proto_item) \
292 ((proto_item) ? FI_SET_FLAG((proto_item)->finfo, FI_HIDDEN) : 0)
293 /** is this protocol field generated by Wireshark (and not read from the packet data)? */
294 #define PROTO_ITEM_IS_GENERATED(proto_item) \
295 ((proto_item) ? FI_GET_FLAG((proto_item)->finfo, FI_GENERATED) : 0)
296 /** mark this protocol field as generated by Wireshark (and not read from the packet data) */
297 #define PROTO_ITEM_SET_GENERATED(proto_item) \
298 ((proto_item) ? FI_SET_FLAG((proto_item)->finfo, FI_GENERATED) : 0)
299 /* is this protocol field actually a URL */
300 #define PROTO_ITEM_IS_URL(proto_item) \
301 ((proto_item) ? FI_GET_FLAG((proto_item)->finfo, FI_URL) : 0)
302 /* mark this protocol field as a URL */
303 #define PROTO_ITEM_SET_URL(proto_item) \
304 ((proto_item) ? FI_SET_FLAG((proto_item)->finfo, FI_URL) : 0)
306 typedef void (*proto_tree_foreach_func)(proto_node *, gpointer);
308 extern void proto_tree_children_foreach(proto_tree *tree,
309 proto_tree_foreach_func func, gpointer data);
311 /** Retrieve the field_info from a proto_item */
312 #define PITEM_FINFO(proto_item) ((proto_item)->finfo)
314 /** Retrieve the tree_data_t from a proto_tree */
315 #define PTREE_DATA(proto_tree) ((proto_tree)->tree_data)
317 /** Sets up memory used by proto routines. Called at program startup */
318 extern void proto_init(void (register_all_protocols)(void),
319 void (register_all_handoffs)(void));
321 /** Frees memory used by proto routines. Called at program shutdown */
322 extern void proto_cleanup(void);
324 /** This function takes a tree and a protocol id as parameter and
325 will return TRUE/FALSE for whether the protocol or any of the filterable
326 fields in the protocol is referenced by any fitlers.
327 If this function returns FALSE then it is safe to skip any
328 proto_tree_add_...() calls and just treat the call as if the
329 dissector was called with tree==NULL.
330 If you reset the tree to NULL by this dissector returning FALSE,
331 you will still need to call any subdissector with the original value of
332 tree or filtering will break.
334 The purpose of this is to optimize wireshark for speed and make it
335 faster for when filters are being used.
337 extern gboolean proto_field_is_referenced(proto_tree *tree, int proto_id);
341 /** Create a subtree under an existing item.
342 @param ti the parent item of the new subtree
343 @param idx one of the ett_ array elements registered with proto_register_subtree_array()
344 @return the new subtree */
345 extern proto_tree* proto_item_add_subtree(proto_item *ti, gint idx);
347 /** Get an existing subtree under an item.
348 @param ti the parent item of the subtree
349 @return the subtree or NULL */
350 extern proto_tree* proto_item_get_subtree(proto_item *ti);
352 /** Get the parent of a subtree item.
353 @param ti the child item in the subtree
354 @return parent item or NULL */
355 extern proto_item* proto_item_get_parent(proto_item *ti);
357 /** Get Nth generation parent item.
358 @param ti the child item in the subtree
359 @param gen the generation to get (using 1 here is the same as using proto_item_get_parent())
360 @return parent item */
361 extern proto_item* proto_item_get_parent_nth(proto_item *ti, int gen);
363 /** Replace text of item after it already has been created.
364 @param ti the item to set the text
365 @param format printf like format string
366 @param ... printf like parameters */
367 extern void proto_item_set_text(proto_item *ti, const char *format, ...)
368 GNUC_FORMAT_CHECK(printf, 2,3);
370 /** Append to text of item after it has already been created.
371 @param ti the item to append the text to
372 @param format printf like format string
373 @param ... printf like parameters */
374 extern void proto_item_append_text(proto_item *ti, const char *format, ...)
375 GNUC_FORMAT_CHECK(printf, 2,3);
377 /** Set proto_item's length inside tvb, after it has already been created.
378 @param ti the item to set the length
379 @param length the new length ot the item */
380 extern void proto_item_set_len(proto_item *ti, gint length);
383 * Sets the length of the item based on its start and on the specified
384 * offset, which is the offset past the end of the item; as the start
385 * in the item is relative to the beginning of the data source tvbuff,
386 * we need to pass in a tvbuff.
387 @param ti the item to set the length
388 @param tvb end is relative to this tvbuff
389 @param end this end offset is relative to the beginning of tvb
390 @todo make usage clearer, I don't understand it!
392 extern void proto_item_set_end(proto_item *ti, tvbuff_t *tvb, gint end);
394 /** Get length of a proto_item. Useful after using proto_tree_add_item()
395 * to add a variable-length field (e.g., FT_NSTRING_UINT8).
396 @param ti the item to get the length from
397 @return the current length */
398 extern int proto_item_get_len(proto_item *ti);
401 * Sets an expert info to the proto_item.
402 @param ti the item to set the expert info
403 @param group the group of this info (e.g. PI_CHECKSUM)
404 @param severity of this info (e.g. PI_ERROR)
405 @return TRUE if value was written
407 extern gboolean proto_item_set_expert_flags(proto_item *ti, int group, int severity);
412 /** Creates a new proto_tree root.
413 @return the new tree root */
414 extern proto_tree* proto_tree_create_root(void);
416 /** Clear memory for entry proto_tree. Clears proto_tree struct also.
417 @param tree the tree to free */
418 extern void proto_tree_free(proto_tree *tree);
420 /** Set the tree visible or invisible.
421 Is the parsing being done for a visible proto_tree or an invisible one?
422 By setting this correctly, the proto_tree creation is sped up by not
423 having to call g_vsnprintf and copy strings around.
424 @param tree the tree to be set
425 @param visible ... or not */
427 proto_tree_set_visible(proto_tree *tree, gboolean visible);
429 /** Mark a field/protocol ID as "interesting".
430 @param tree the tree to be set
431 @param hfid the interesting field id
432 @todo what *does* interesting mean? */
434 proto_tree_prime_hfid(proto_tree *tree, int hfid);
436 /** Get a parent item of a subtree.
437 @param tree the tree to get the parent from
438 @return parent item */
439 extern proto_item* proto_tree_get_parent(proto_tree *tree);
441 /** Get the root tree from any subtree.
442 @param tree the tree to get the root from
444 extern proto_tree* proto_tree_get_root(proto_tree *tree);
446 /** Move an existing item behind another existing item.
447 @param tree the tree to which both items belong
448 @param fixed_item the item which keeps it's position
449 @param item_to_move the item which will be moved */
450 extern void proto_tree_move_item(proto_tree *tree, proto_item *fixed_item, proto_item *item_to_move);
454 /** Add an item to a proto_tree, using the text label registered to that item.
455 The item is extracted from the tvbuff handed to it.
456 @param tree the tree to append this item to
457 @param hfindex field index
458 @param tvb the tv buffer of the current data
459 @param start start of data in tvb
460 @param length length of data in tvb
461 @param little_endian big or little endian byte representation
462 @return the newly created item */
464 proto_tree_add_item(proto_tree *tree, int hfindex, tvbuff_t *tvb,
465 gint start, gint length, gboolean little_endian);
467 /** Add a hidden item to a proto_tree.
468 @deprecated use proto_tree_add_item() and a subsequent call to PROTO_ITEM_SET_HIDDEN() instead */
470 proto_tree_add_item_hidden(proto_tree *tree, int hfindex, tvbuff_t *tvb,
471 gint start, gint length, gboolean little_endian);
473 /** Add a text-only node to a proto_tree.
474 @param tree the tree to append this item to
475 @param tvb the tv buffer of the current data
476 @param start start of data in tvb
477 @param length length of data in tvb
478 @param format printf like format string
479 @param ... printf like parameters
480 @return the newly created item */
482 proto_tree_add_text(proto_tree *tree, tvbuff_t *tvb, gint start, gint length, const char *format,
483 ...) GNUC_FORMAT_CHECK(printf,5,6);
485 /** Add a text-only node to a proto_tree using a variable argument list.
486 @param tree the tree to append this item to
487 @param tvb the tv buffer of the current data
488 @param start start of data in tvb
489 @param length length of data in tvb
490 @param format printf like format string
491 @param ap variable argument list
492 @return the newly created item */
494 proto_tree_add_text_valist(proto_tree *tree, tvbuff_t *tvb, gint start,
495 gint length, const char *format, va_list ap);
498 /** Add a FT_NONE field to a proto_tree.
499 @param tree the tree to append this item to
500 @param hfindex field index
501 @param tvb the tv buffer of the current data
502 @param start start of data in tvb
503 @param length length of data in tvb
504 @param format printf like format string
505 @param ... printf like parameters
506 @return the newly created item */
508 proto_tree_add_none_format(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
509 gint length, const char *format, ...) GNUC_FORMAT_CHECK(printf,6,7);
511 /** Add a FT_PROTOCOL to a proto_tree.
512 @param tree the tree to append this item to
513 @param hfindex field index
514 @param tvb the tv buffer of the current data
515 @param start start of data in tvb
516 @param length length of data in tvb
517 @param format printf like format string
518 @param ... printf like parameters
519 @return the newly created item */
521 proto_tree_add_protocol_format(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
522 gint length, const char *format, ...) GNUC_FORMAT_CHECK(printf,6,7);
527 /** Add a FT_BYTES to a proto_tree.
528 @param tree the tree to append this item to
529 @param hfindex field index
530 @param tvb the tv buffer of the current data
531 @param start start of data in tvb
532 @param length length of data in tvb
533 @param start_ptr pointer to the data to display
534 @return the newly created item */
536 proto_tree_add_bytes(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
537 gint length, const guint8* start_ptr);
539 /** Add a hidden FT_BYTES to a proto_tree.
540 @deprecated use proto_tree_add_bytes() and a subsequent call to PROTO_ITEM_SET_HIDDEN() instead */
542 proto_tree_add_bytes_hidden(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
543 gint length, const guint8* start_ptr);
545 /** Add a formatted FT_BYTES to a proto_tree, with the format generating
546 the string for the value and with the field name being included
548 @param tree the tree to append this item to
549 @param hfindex field index
550 @param tvb the tv buffer of the current data
551 @param start start of data in tvb
552 @param length length of data in tvb
553 @param start_ptr pointer to the data to display
554 @param format printf like format string
555 @param ... printf like parameters
556 @return the newly created item */
558 proto_tree_add_bytes_format_value(proto_tree *tree, int hfindex, tvbuff_t *tvb,
559 gint start, gint length, const guint8* start_ptr, const char *format,
560 ...) GNUC_FORMAT_CHECK(printf,7,8);
562 /** Add a formatted FT_BYTES to a proto_tree, with the format generating
563 the entire string for the entry, including any field name.
564 @param tree the tree to append this item to
565 @param hfindex field index
566 @param tvb the tv buffer of the current data
567 @param start start of data in tvb
568 @param length length of data in tvb
569 @param start_ptr pointer to the data to display
570 @param format printf like format string
571 @param ... printf like parameters
572 @return the newly created item */
574 proto_tree_add_bytes_format(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
575 gint length, const guint8* start_ptr, const char *format, ...) GNUC_FORMAT_CHECK(printf,7,8);
577 /** Add a FT_ABSOLUTE_TIME or FT_RELATIVE_TIME to a proto_tree.
578 @param tree the tree to append this item to
579 @param hfindex field index
580 @param tvb the tv buffer of the current data
581 @param start start of data in tvb
582 @param length length of data in tvb
583 @param value_ptr pointer to the data to display
584 @return the newly created item */
586 proto_tree_add_time(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
587 gint length, nstime_t* value_ptr);
589 /** Add a hidden FT_ABSOLUTE_TIME or FT_RELATIVE_TIME to a proto_tree.
590 @deprecated use proto_tree_add_time() and a subsequent call to PROTO_ITEM_SET_HIDDEN() instead */
592 proto_tree_add_time_hidden(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
593 gint length, nstime_t* value_ptr);
595 /** Add a formatted FT_ABSOLUTE_TIME or FT_RELATIVE_TIME to a proto_tree, with
596 the format generating the string for the value and with the field name
597 being included automatically.
598 @param tree the tree to append this item to
599 @param hfindex field index
600 @param tvb the tv buffer of the current data
601 @param start start of data in tvb
602 @param length length of data in tvb
603 @param value_ptr pointer to the data to display
604 @param format printf like format string
605 @param ... printf like parameters
606 @return the newly created item */
608 proto_tree_add_time_format_value(proto_tree *tree, int hfindex, tvbuff_t *tvb,
609 gint start, gint length, nstime_t* value_ptr, const char *format, ...)
610 GNUC_FORMAT_CHECK(printf,7,8);
612 /** Add a formatted FT_ABSOLUTE_TIME or FT_RELATIVE_TIME to a proto_tree, with
613 the format generating the entire string for the entry, including any field
615 @param tree the tree to append this item to
616 @param hfindex field index
617 @param tvb the tv buffer of the current data
618 @param start start of data in tvb
619 @param length length of data in tvb
620 @param value_ptr pointer to the data to display
621 @param format printf like format string
622 @param ... printf like parameters
623 @return the newly created item */
625 proto_tree_add_time_format(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
626 gint length, nstime_t* value_ptr, const char *format, ...) GNUC_FORMAT_CHECK(printf,7,8);
628 /** Add a FT_IPXNET to a proto_tree.
629 @param tree the tree to append this item to
630 @param hfindex field index
631 @param tvb the tv buffer of the current data
632 @param start start of data in tvb
633 @param length length of data in tvb
634 @param value data to display
635 @return the newly created item */
637 proto_tree_add_ipxnet(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
638 gint length, guint32 value);
640 /** Add a hidden FT_IPXNET to a proto_tree.
641 @deprecated use proto_tree_add_ipxnet() and a subsequent call to PROTO_ITEM_SET_HIDDEN() instead */
643 proto_tree_add_ipxnet_hidden(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
644 gint length, guint32 value);
646 /** Add a formatted FT_IPXNET to a proto_tree, with the format generating
647 the string for the value and with the field name being included
649 @param tree the tree to append this item to
650 @param hfindex field index
651 @param tvb the tv buffer of the current data
652 @param start start of data in tvb
653 @param length length of data in tvb
654 @param value data to display
655 @param format printf like format string
656 @param ... printf like parameters
657 @return the newly created item */
659 proto_tree_add_ipxnet_format_value(proto_tree *tree, int hfindex, tvbuff_t *tvb,
660 gint start, gint length, guint32 value, const char *format, ...)
661 GNUC_FORMAT_CHECK(printf,7,8);
663 /** Add a formatted FT_IPXNET to a proto_tree, with the format generating
664 the entire string for the entry, including any field name.
665 @param tree the tree to append this item to
666 @param hfindex field index
667 @param tvb the tv buffer of the current data
668 @param start start of data in tvb
669 @param length length of data in tvb
670 @param value data to display
671 @param format printf like format string
672 @param ... printf like parameters
673 @return the newly created item */
675 proto_tree_add_ipxnet_format(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
676 gint length, guint32 value, const char *format, ...) GNUC_FORMAT_CHECK(printf,7,8);
678 /** Add a FT_IPv4 to a proto_tree.
679 @param tree the tree to append this item to
680 @param hfindex field index
681 @param tvb the tv buffer of the current data
682 @param start start of data in tvb
683 @param length length of data in tvb
684 @param value data to display
685 @return the newly created item */
687 proto_tree_add_ipv4(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
688 gint length, guint32 value);
690 /** Add a hidden FT_IPv4 to a proto_tree.
691 @deprecated use proto_tree_add_ipv4() and a subsequent call to PROTO_ITEM_SET_HIDDEN() instead */
693 proto_tree_add_ipv4_hidden(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
694 gint length, guint32 value);
696 /** Add a formatted FT_IPv4 to a proto_tree, with the format generating
697 the string for the value and with the field name being included
699 @param tree the tree to append this item to
700 @param hfindex field index
701 @param tvb the tv buffer of the current data
702 @param start start of data in tvb
703 @param length length of data in tvb
704 @param value data to display
705 @param format printf like format string
706 @param ... printf like parameters
707 @return the newly created item */
709 proto_tree_add_ipv4_format_value(proto_tree *tree, int hfindex, tvbuff_t *tvb,
710 gint start, gint length, guint32 value, const char *format, ...)
711 GNUC_FORMAT_CHECK(printf,7,8);
713 /** Add a formatted FT_IPv4 to a proto_tree, with the format generating
714 the entire string for the entry, including any field name.
715 @param tree the tree to append this item to
716 @param hfindex field index
717 @param tvb the tv buffer of the current data
718 @param start start of data in tvb
719 @param length length of data in tvb
720 @param value data to display
721 @param format printf like format string
722 @param ... printf like parameters
723 @return the newly created item */
725 proto_tree_add_ipv4_format(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
726 gint length, guint32 value, const char *format, ...) GNUC_FORMAT_CHECK(printf,7,8);
728 /** Add a FT_IPv6 to a proto_tree.
729 @param tree the tree to append this item to
730 @param hfindex field index
731 @param tvb the tv buffer of the current data
732 @param start start of data in tvb
733 @param length length of data in tvb
734 @param value_ptr data to display
735 @return the newly created item */
737 proto_tree_add_ipv6(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
738 gint length, const guint8* value_ptr);
740 /** Add a hidden FT_IPv6 to a proto_tree.
741 @deprecated use proto_tree_add_ipv6() and a subsequent call to PROTO_ITEM_SET_HIDDEN() instead */
743 proto_tree_add_ipv6_hidden(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
744 gint length, const guint8* value_ptr);
746 /** Add a formatted FT_IPv6 to a proto_tree, with the format generating
747 the string for the value and with the field name being included
749 @param tree the tree to append this item to
750 @param hfindex field index
751 @param tvb the tv buffer of the current data
752 @param start start of data in tvb
753 @param length length of data in tvb
754 @param value_ptr data to display
755 @param format printf like format string
756 @param ... printf like parameters
757 @return the newly created item */
759 proto_tree_add_ipv6_format_value(proto_tree *tree, int hfindex, tvbuff_t *tvb,
760 gint start, gint length, const guint8* value_ptr, const char *format,
761 ...) GNUC_FORMAT_CHECK(printf,7,8);
763 /** Add a formatted FT_IPv6 to a proto_tree, with the format generating
764 the entire string for the entry, including any field name.
765 @param tree the tree to append this item to
766 @param hfindex field index
767 @param tvb the tv buffer of the current data
768 @param start start of data in tvb
769 @param length length of data in tvb
770 @param value_ptr data to display
771 @param format printf like format string
772 @param ... printf like parameters
773 @return the newly created item */
775 proto_tree_add_ipv6_format(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
776 gint length, const guint8* value_ptr, const char *format, ...) GNUC_FORMAT_CHECK(printf,7,8);
778 /** Add a FT_ETHER to a proto_tree.
779 @param tree the tree to append this item to
780 @param hfindex field index
781 @param tvb the tv buffer of the current data
782 @param start start of data in tvb
783 @param length length of data in tvb
784 @param value data to display
785 @return the newly created item */
787 proto_tree_add_ether(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
788 gint length, const guint8* value);
790 /** Add a hidden FT_ETHER to a proto_tree.
791 @deprecated use proto_tree_add_ether() and a subsequent call to PROTO_ITEM_SET_HIDDEN() instead */
793 proto_tree_add_ether_hidden(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
794 gint length, const guint8* value);
796 /** Add a formatted FT_ETHER to a proto_tree, with the format generating
797 the string for the value and with the field name being included
799 @param tree the tree to append this item to
800 @param hfindex field index
801 @param tvb the tv buffer of the current data
802 @param start start of data in tvb
803 @param length length of data in tvb
804 @param value data to display
805 @param format printf like format string
806 @param ... printf like parameters
807 @return the newly created item */
809 proto_tree_add_ether_format_value(proto_tree *tree, int hfindex, tvbuff_t *tvb,
810 gint start, gint length, const guint8* value, const char *format, ...)
811 GNUC_FORMAT_CHECK(printf,7,8);
813 /** Add a formatted FT_ETHER to a proto_tree, with the format generating
814 the entire string for the entry, including any field name.
815 @param tree the tree to append this item to
816 @param hfindex field index
817 @param tvb the tv buffer of the current data
818 @param start start of data in tvb
819 @param length length of data in tvb
820 @param value data to display
821 @param format printf like format string
822 @param ... printf like parameters
823 @return the newly created item */
825 proto_tree_add_ether_format(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
826 gint length, const guint8* value, const char *format, ...) GNUC_FORMAT_CHECK(printf,7,8);
828 /** Add a FT_GUID to a proto_tree.
829 @param tree the tree to append this item to
830 @param hfindex field index
831 @param tvb the tv buffer of the current data
832 @param start start of data in tvb
833 @param length length of data in tvb
834 @param value_ptr data to display
835 @return the newly created item */
837 proto_tree_add_guid(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
838 gint length, const e_guid_t *value_ptr);
840 /** Add a hidden FT_GUID to a proto_tree.
841 @deprecated use proto_tree_add_guid() and a subsequent call to PROTO_ITEM_SET_HIDDEN() instead */
843 proto_tree_add_guid_hidden(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
844 gint length, const e_guid_t *value_ptr);
846 /** Add a formatted FT_GUID to a proto_tree, with the format generating
847 the string for the value and with the field name being included
849 @param tree the tree to append this item to
850 @param hfindex field index
851 @param tvb the tv buffer of the current data
852 @param start start of data in tvb
853 @param length length of data in tvb
854 @param value_ptr data to display
855 @param format printf like format string
856 @param ... printf like parameters
857 @return the newly created item */
859 proto_tree_add_guid_format_value(proto_tree *tree, int hfindex, tvbuff_t *tvb,
860 gint start, gint length, const e_guid_t *value_ptr, const char *format,
861 ...) GNUC_FORMAT_CHECK(printf,7,8);
863 /** Add a formatted FT_GUID to a proto_tree, with the format generating
864 the entire string for the entry, including any field name.
865 @param tree the tree to append this item to
866 @param hfindex field index
867 @param tvb the tv buffer of the current data
868 @param start start of data in tvb
869 @param length length of data in tvb
870 @param value_ptr data to display
871 @param format printf like format string
872 @param ... printf like parameters
873 @return the newly created item */
875 proto_tree_add_guid_format(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
876 gint length, const e_guid_t *value_ptr, const char *format, ...) GNUC_FORMAT_CHECK(printf,7,8);
878 /** Add a FT_OID to a proto_tree.
879 @param tree the tree to append this item to
880 @param hfindex field index
881 @param tvb the tv buffer of the current data
882 @param start start of data in tvb
883 @param length length of data in tvb
884 @param value_ptr data to display
885 @return the newly created item */
887 proto_tree_add_oid(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
888 gint length, const guint8* value_ptr);
890 /** Add a hidden FT_OID to a proto_tree.
891 @deprecated use proto_tree_add_oid() and a subsequent call to PROTO_ITEM_SET_HIDDEN() instead */
893 proto_tree_add_oid_hidden(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
894 gint length, const guint8* value_ptr);
896 /** Add a formatted FT_OID to a proto_tree, with the format generating
897 the string for the value and with the field name being included
899 @param tree the tree to append this item to
900 @param hfindex field index
901 @param tvb the tv buffer of the current data
902 @param start start of data in tvb
903 @param length length of data in tvb
904 @param value_ptr data to display
905 @param format printf like format string
906 @param ... printf like parameters
907 @return the newly created item */
909 proto_tree_add_oid_format_value(proto_tree *tree, int hfindex, tvbuff_t *tvb,
910 gint start, gint length, const guint8* value_ptr, const char *format,
911 ...) GNUC_FORMAT_CHECK(printf,7,8);
913 /** Add a formatted FT_OID to a proto_tree, with the format generating
914 the entire string for the entry, including any field name.
915 @param tree the tree to append this item to
916 @param hfindex field index
917 @param tvb the tv buffer of the current data
918 @param start start of data in tvb
919 @param length length of data in tvb
920 @param value_ptr data to display
921 @param format printf like format string
922 @param ... printf like parameters
923 @return the newly created item */
925 proto_tree_add_oid_format(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
926 gint length, const guint8* value_ptr, const char *format, ...) GNUC_FORMAT_CHECK(printf,7,8);
928 /** Add a FT_STRING to a proto_tree.
929 @param tree the tree to append this item to
930 @param hfindex field index
931 @param tvb the tv buffer of the current data
932 @param start start of data in tvb
933 @param length length of data in tvb
934 @param value data to display
935 @return the newly created item */
937 proto_tree_add_string(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
938 gint length, const char* value);
940 /** Add a hidden FT_STRING to a proto_tree.
941 @deprecated use proto_tree_add_string() and a subsequent call to PROTO_ITEM_SET_HIDDEN() instead */
943 proto_tree_add_string_hidden(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
944 gint length, const char* value);
946 /** Add a formatted FT_STRING to a proto_tree, with the format generating
947 the string for the value and with the field name being included
949 @param tree the tree to append this item to
950 @param hfindex field index
951 @param tvb the tv buffer of the current data
952 @param start start of data in tvb
953 @param length length of data in tvb
954 @param value data to display
955 @param format printf like format string
956 @param ... printf like parameters
957 @return the newly created item */
959 proto_tree_add_string_format_value(proto_tree *tree, int hfindex, tvbuff_t *tvb,
960 gint start, gint length, const char* value, const char *format, ...)
961 GNUC_FORMAT_CHECK(printf,7,8);
963 /** Add a formatted FT_STRING to a proto_tree, with the format generating
964 the entire string for the entry, including any field name.
965 @param tree the tree to append this item to
966 @param hfindex field index
967 @param tvb the tv buffer of the current data
968 @param start start of data in tvb
969 @param length length of data in tvb
970 @param value data to display
971 @param format printf like format string
972 @param ... printf like parameters
973 @return the newly created item */
975 proto_tree_add_string_format(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
976 gint length, const char* value, const char *format, ...) GNUC_FORMAT_CHECK(printf,7,8);
978 /** Add a FT_BOOLEAN to a proto_tree.
979 @param tree the tree to append this item to
980 @param hfindex field index
981 @param tvb the tv buffer of the current data
982 @param start start of data in tvb
983 @param length length of data in tvb
984 @param value data to display
985 @return the newly created item */
987 proto_tree_add_boolean(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
988 gint length, guint32 value);
990 /** Add a hidden FT_BOOLEAN to a proto_tree.
991 @deprecated use proto_tree_add_boolean() and a subsequent call to PROTO_ITEM_SET_HIDDEN() instead */
993 proto_tree_add_boolean_hidden(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
994 gint length, guint32 value);
996 /** Add a formatted FT_BOOLEAN to a proto_tree, with the format generating
997 the string for the value and with the field name being included
999 @param tree the tree to append this item to
1000 @param hfindex field index
1001 @param tvb the tv buffer of the current data
1002 @param start start of data in tvb
1003 @param length length of data in tvb
1004 @param value data to display
1005 @param format printf like format string
1006 @param ... printf like parameters
1007 @return the newly created item */
1009 proto_tree_add_boolean_format_value(proto_tree *tree, int hfindex,
1010 tvbuff_t *tvb, gint start, gint length, guint32 value,
1011 const char *format, ...) GNUC_FORMAT_CHECK(printf,7,8);
1013 /** Add a formatted FT_BOOLEAN to a proto_tree, with the format generating
1014 the entire string for the entry, including any field name.
1015 @param tree the tree to append this item to
1016 @param hfindex field index
1017 @param tvb the tv buffer of the current data
1018 @param start start of data in tvb
1019 @param length length of data in tvb
1020 @param value data to display
1021 @param format printf like format string
1022 @param ... printf like parameters
1023 @return the newly created item */
1025 proto_tree_add_boolean_format(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
1026 gint length, guint32 value, const char *format, ...) GNUC_FORMAT_CHECK(printf,7,8);
1028 /** Add a FT_FLOAT to a proto_tree.
1029 @param tree the tree to append this item to
1030 @param hfindex field index
1031 @param tvb the tv buffer of the current data
1032 @param start start of data in tvb
1033 @param length length of data in tvb
1034 @param value data to display
1035 @return the newly created item */
1037 proto_tree_add_float(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
1038 gint length, float value);
1040 /** Add a hidden FT_FLOAT to a proto_tree.
1041 @deprecated use proto_tree_add_float() and a subsequent call to PROTO_ITEM_SET_HIDDEN() instead */
1043 proto_tree_add_float_hidden(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
1044 gint length, float value);
1046 /** Add a formatted FT_FLOAT to a proto_tree, with the format generating
1047 the string for the value and with the field name being included
1049 @param tree the tree to append this item to
1050 @param hfindex field index
1051 @param tvb the tv buffer of the current data
1052 @param start start of data in tvb
1053 @param length length of data in tvb
1054 @param value data to display
1055 @param format printf like format string
1056 @param ... printf like parameters
1057 @return the newly created item */
1059 proto_tree_add_float_format_value(proto_tree *tree, int hfindex, tvbuff_t *tvb,
1060 gint start, gint length, float value, const char *format, ...)
1061 GNUC_FORMAT_CHECK(printf,7,8);
1063 /** Add a formatted FT_FLOAT to a proto_tree, with the format generating
1064 the entire string for the entry, including any field name.
1065 @param tree the tree to append this item to
1066 @param hfindex field index
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 value data to display
1071 @param format printf like format string
1072 @param ... printf like parameters
1073 @return the newly created item */
1075 proto_tree_add_float_format(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
1076 gint length, float value, const char *format, ...) GNUC_FORMAT_CHECK(printf,7,8);
1078 /** Add a FT_DOUBLE to a proto_tree.
1079 @param tree the tree to append this item to
1080 @param hfindex field index
1081 @param tvb the tv buffer of the current data
1082 @param start start of data in tvb
1083 @param length length of data in tvb
1084 @param value data to display
1085 @return the newly created item */
1087 proto_tree_add_double(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
1088 gint length, double value);
1090 /** Add a hidden FT_DOUBLE to a proto_tree.
1091 @deprecated use proto_tree_add_double() and a subsequent call to PROTO_ITEM_SET_HIDDEN() instead */
1093 proto_tree_add_double_hidden(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
1094 gint length, double value);
1096 /** Add a formatted FT_DOUBLE to a proto_tree, with the format generating
1097 the string for the value and with the field name being included
1099 @param tree the tree to append this item to
1100 @param hfindex field index
1101 @param tvb the tv buffer of the current data
1102 @param start start of data in tvb
1103 @param length length of data in tvb
1104 @param value data to display
1105 @param format printf like format string
1106 @param ... printf like parameters
1107 @return the newly created item */
1109 proto_tree_add_double_format_value(proto_tree *tree, int hfindex, tvbuff_t *tvb,
1110 gint start, gint length, double value, const char *format, ...)
1111 GNUC_FORMAT_CHECK(printf,7,8);
1113 /** Add a formatted FT_DOUBLE to a proto_tree, with the format generating
1114 the entire string for the entry, including any field name.
1115 @param tree the tree to append this item to
1116 @param hfindex field index
1117 @param tvb the tv buffer of the current data
1118 @param start start of data in tvb
1119 @param length length of data in tvb
1120 @param value data to display
1121 @param format printf like format string
1122 @param ... printf like parameters
1123 @return the newly created item */
1125 proto_tree_add_double_format(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
1126 gint length, double value, const char *format, ...) GNUC_FORMAT_CHECK(printf,7,8);
1128 /** Add one of FT_UINT8, FT_UINT16, FT_UINT24 or FT_UINT32 to a proto_tree.
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 value data to display
1135 @return the newly created item */
1137 proto_tree_add_uint(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
1138 gint length, guint32 value);
1140 /** Add a hidden FT_UINT8, FT_UINT16, FT_UINT24 or FT_UINT32 to a proto_tree.
1141 @deprecated use proto_tree_add_uint() and a subsequent call to PROTO_ITEM_SET_HIDDEN() instead */
1143 proto_tree_add_uint_hidden(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
1144 gint length, guint32 value);
1146 /** Add a formatted FT_UINT8, FT_UINT16, FT_UINT24 or FT_UINT32 to a proto_tree,
1147 with the format generating the string for the value and with the field
1148 name being included automatically.
1149 @param tree the tree to append this item to
1150 @param hfindex field index
1151 @param tvb the tv buffer of the current data
1152 @param start start of data in tvb
1153 @param length length of data in tvb
1154 @param value data to display
1155 @param format printf like format string
1156 @param ... printf like parameters
1157 @return the newly created item */
1159 proto_tree_add_uint_format_value(proto_tree *tree, int hfindex, tvbuff_t *tvb,
1160 gint start, gint length, guint32 value, const char *format, ...)
1161 GNUC_FORMAT_CHECK(printf,7,8);
1163 /** Add a formatted FT_UINT8, FT_UINT16, FT_UINT24 or FT_UINT32 to a proto_tree,
1164 with the format generating the entire string for the entry, including any
1166 @param tree the tree to append this item to
1167 @param hfindex field index
1168 @param tvb the tv buffer of the current data
1169 @param start start of data in tvb
1170 @param length length of data in tvb
1171 @param value data to display
1172 @param format printf like format string
1173 @param ... printf like parameters
1174 @return the newly created item */
1176 proto_tree_add_uint_format(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
1177 gint length, guint32 value, const char *format, ...) GNUC_FORMAT_CHECK(printf,7,8);
1179 /** Add an FT_UINT64 to a proto_tree.
1180 @param tree the tree to append this item to
1181 @param hfindex field index
1182 @param tvb the tv buffer of the current data
1183 @param start start of data in tvb
1184 @param length length of data in tvb
1185 @param value data to display
1186 @return the newly created item */
1188 proto_tree_add_uint64(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
1189 gint length, guint64 value);
1191 /** Add a formatted FT_UINT64 to a proto_tree, with the format generating
1192 the string for the value and with the field name being included
1194 @param tree the tree to append this item to
1195 @param hfindex field index
1196 @param tvb the tv buffer of the current data
1197 @param start start of data in tvb
1198 @param length length of data in tvb
1199 @param value data to display
1200 @param format printf like format string
1201 @param ... printf like parameters
1202 @return the newly created item */
1204 proto_tree_add_uint64_format_value(proto_tree *tree, int hfindex, tvbuff_t *tvb,
1205 gint start, gint length, guint64 value, const char *format, ...)
1206 GNUC_FORMAT_CHECK(printf,7,8);
1208 /** Add a formatted FT_UINT64 to a proto_tree, with the format generating
1209 the entire string for the entry, including any field name.
1210 @param tree the tree to append this item to
1211 @param hfindex field index
1212 @param tvb the tv buffer of the current data
1213 @param start start of data in tvb
1214 @param length length of data in tvb
1215 @param value data to display
1216 @param format printf like format string
1217 @param ... printf like parameters
1218 @return the newly created item */
1220 proto_tree_add_uint64_format(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
1221 gint length, guint64 value, const char *format, ...) GNUC_FORMAT_CHECK(printf,7,8);
1223 /** Add one of FT_INT8, FT_INT16, FT_INT24 or FT_INT32 to a proto_tree.
1224 @param tree the tree to append this item to
1225 @param hfindex field index
1226 @param tvb the tv buffer of the current data
1227 @param start start of data in tvb
1228 @param length length of data in tvb
1229 @param value data to display
1230 @return the newly created item */
1232 proto_tree_add_int(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
1233 gint length, gint32 value);
1235 /** Add a hidden FT_INT8, FT_INT16, FT_INT24 or FT_INT32 to a proto_tree.
1236 @deprecated use proto_tree_add_int() and a subsequent call to PROTO_ITEM_SET_HIDDEN() instead */
1238 proto_tree_add_int_hidden(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
1239 gint length, gint32 value);
1241 /** Add a formatted FT_INT8, FT_INT16, FT_INT24 or FT_INT32 to a proto_tree,
1242 with the format generating the string for the value and with the field
1243 name being included automatically.
1244 @param tree the tree to append this item to
1245 @param hfindex field index
1246 @param tvb the tv buffer of the current data
1247 @param start start of data in tvb
1248 @param length length of data in tvb
1249 @param value data to display
1250 @param format printf like format string
1251 @param ... printf like parameters
1252 @return the newly created item */
1254 proto_tree_add_int_format_value(proto_tree *tree, int hfindex, tvbuff_t *tvb,
1255 gint start, gint length, gint32 value, const char *format, ...)
1256 GNUC_FORMAT_CHECK(printf,7,8);
1258 /** Add a formatted FT_INT8, FT_INT16, FT_INT24 or FT_INT32 to a proto_tree,
1259 with the format generating the entire string for the entry, including
1261 @param tree the tree to append this item to
1262 @param hfindex field index
1263 @param tvb the tv buffer of the current data
1264 @param start start of data in tvb
1265 @param length length of data in tvb
1266 @param value data to display
1267 @param format printf like format string
1268 @param ... printf like parameters
1269 @return the newly created item */
1271 proto_tree_add_int_format(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
1272 gint length, gint32 value, const char *format, ...) GNUC_FORMAT_CHECK(printf,7,8);
1274 /** Add an FT_INT64 to a proto_tree.
1275 @param tree the tree to append this item to
1276 @param hfindex field index
1277 @param tvb the tv buffer of the current data
1278 @param start start of data in tvb
1279 @param length length of data in tvb
1280 @param value data to display
1281 @return the newly created item */
1283 proto_tree_add_int64(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
1284 gint length, gint64 value);
1286 /** Add a formatted FT_INT64 to a proto_tree, with the format generating
1287 the string for the value and with the field name being included
1289 @param tree the tree to append this item to
1290 @param hfindex field index
1291 @param tvb the tv buffer of the current data
1292 @param start start of data in tvb
1293 @param length length of data in tvb
1294 @param value data to display
1295 @param format printf like format string
1296 @param ... printf like parameters
1297 @return the newly created item */
1299 proto_tree_add_int64_format_value(proto_tree *tree, int hfindex, tvbuff_t *tvb,
1300 gint start, gint length, gint64 value, const char *format, ...)
1301 GNUC_FORMAT_CHECK(printf,7,8);
1303 /** Add a formatted FT_INT64 to a proto_tree, with the format generating
1304 the entire string for the entry, including any field name.
1305 @param tree the tree to append this item to
1306 @param hfindex field index
1307 @param tvb the tv buffer of the current data
1308 @param start start of data in tvb
1309 @param length length of data in tvb
1310 @param value data to display
1311 @param format printf like format string
1312 @param ... printf like parameters
1313 @return the newly created item */
1315 proto_tree_add_int64_format(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
1316 gint length, gint64 value, const char *format, ...) GNUC_FORMAT_CHECK(printf,7,8);
1318 /** Useful for quick debugging. Also sends string to STDOUT, so don't
1319 * leave call to this function in production code.
1320 @param tree the tree to append the text to
1321 @param format printf like format string
1322 @param ... printf like parameters
1323 @return the newly created item */
1325 proto_tree_add_debug_text(proto_tree *tree, const char *format,
1326 ...) GNUC_FORMAT_CHECK(printf,2,3);
1330 /** Append a string to a protocol item.<br>
1331 NOTE: this function will break with the TRY_TO_FAKE_THIS_ITEM()
1333 Currently only WSP use this function so it is not that bad but try to
1334 avoid using this one if possible.
1335 IF you must use this function you MUST also disable the
1336 TRY_TO_FAKE_THIS_ITEM() optimization for your dissector/function
1337 using proto_item_append_string().
1338 Do that by faking that the tree is visible by setting :
1339 PTREE_DATA(tree)->visible=1; (see packet-wsp.c)
1340 BEFORE you create the item you are later going to use
1341 proto_item_append_string() on.
1343 @param pi the item to append the string to
1344 @param str the string to append */
1346 proto_item_append_string(proto_item *pi, const char *str);
1350 /** Fill given label_str with string representation of field
1351 @param fi the item to get the info from
1352 @param label_str the string to fill
1353 @todo think about changing the parameter profile */
1355 proto_item_fill_label(field_info *fi, gchar *label_str);
1358 /** Register a new protocol.
1359 @param name the full name of the new protocol
1360 @param short_name abbreviated name of the new protocol
1361 @param filter_name protocol name used for a display filter string
1362 @return the new protocol handle */
1364 proto_register_protocol(const char *name, const char *short_name, const char *filter_name);
1366 /** Register a header_field array.
1367 @param parent the protocol handle from proto_register_protocol()
1368 @param hf the hf_register_info array
1369 @param num_records the number of records in hf */
1371 proto_register_field_array(int parent, hf_register_info *hf, int num_records);
1373 /** Register a protocol subtree (ett) array.
1374 @param indices array of ett indices
1375 @param num_indices the number of records in indices */
1377 proto_register_subtree_array(gint *const *indices, int num_indices);
1379 /** Returns number of items (protocols or header fields) registered.
1380 @return the number of items */
1381 extern int proto_registrar_n(void);
1383 /** Get name of registered header_field number n.
1384 @param n item # n (0-indexed)
1385 @return the name of this registered item */
1386 extern const char* proto_registrar_get_name(int n);
1388 /** Get abbreviation of registered header_field number n.
1389 @param n item # n (0-indexed)
1390 @return the abbreviation of this registered item */
1391 extern const char* proto_registrar_get_abbrev(int n);
1393 /** Get the header_field information based upon a field or protocol id.
1394 @param hfindex item # n (0-indexed)
1395 @return the registered item */
1396 extern header_field_info* proto_registrar_get_nth(guint hfindex);
1398 /** Get the header_field information based upon a field name.
1399 @param field_name the field name to search for
1400 @return the registered item */
1401 extern header_field_info* proto_registrar_get_byname(const char *field_name);
1403 /** Get enum ftenum FT_ of registered header_field number n.
1404 @param n item # n (0-indexed)
1405 @return the registered item */
1406 extern int proto_registrar_get_ftype(int n);
1408 /** Get parent protocol of registered header_field number n.
1409 @param n item # n (0-indexed)
1410 @return -1 if item _is_ a protocol */
1411 extern int proto_registrar_get_parent(int n);
1413 /** Is item # n a protocol?
1414 @param n item # n (0-indexed)
1415 @return TRUE if it's a protocol, FALSE if it's not */
1416 extern gboolean proto_registrar_is_protocol(int n);
1418 /* Get length of registered field according to field type.
1419 @param n item # n (0-indexed)
1420 @return 0 means undeterminable at registration time, * -1 means unknown field */
1421 extern gint proto_registrar_get_length(int n);
1424 /* Routines to use to iterate over the protocols and their fields;
1425 * they return the item number of the protocol in question or the
1426 * appropriate hfinfo pointer, and keep state in "*cookie". */
1427 extern int proto_get_first_protocol(void **cookie);
1428 extern int proto_get_next_protocol(void **cookie);
1429 extern header_field_info *proto_get_first_protocol_field(int proto_id, void **cookle);
1430 extern header_field_info *proto_get_next_protocol_field(void **cookle);
1432 /** Given a protocol's filter_name.
1433 @param filter_name the filter name to search for
1435 extern int proto_get_id_by_filter_name(const gchar* filter_name);
1437 /** Can item # n decoding be disabled?
1438 @param proto_id protocol id (0-indexed)
1439 @return TRUE if it's a protocol, FALSE if it's not */
1440 extern gboolean proto_can_toggle_protocol(int proto_id);
1442 /** Get the "protocol_t" structure for the given protocol's item number.
1443 @param proto_id protocol id (0-indexed) */
1444 extern protocol_t *find_protocol_by_id(int proto_id);
1446 /** Get the protocol's name for the given protocol's item number.
1447 @param proto_id protocol id (0-indexed)
1449 extern const char *proto_get_protocol_name(int proto_id);
1451 /** Get the protocol's item number, for the given protocol's "protocol_t".
1452 @return its proto_id */
1453 extern int proto_get_id(protocol_t *protocol);
1455 /** Get the protocol's short name, for the given protocol's "protocol_t".
1456 @return its short name. */
1457 extern const char *proto_get_protocol_short_name(protocol_t *protocol);
1459 /** Is protocol's decoding enabled ?
1461 @return TRUE if decoding is enabled, FALSE if not */
1462 extern gboolean proto_is_protocol_enabled(protocol_t *protocol);
1464 /** Get a protocol's filter name by it's item number.
1465 @param proto_id protocol id (0-indexed)
1466 @return its filter name. */
1467 extern const char *proto_get_protocol_filter_name(int proto_id);
1469 /** Enable / Disable protocol of the given item number.
1470 @param proto_id protocol id (0-indexed)
1471 @param enabled enable / disable the protocol */
1472 extern void proto_set_decoding(int proto_id, gboolean enabled);
1474 /** Disable disabling/enabling of protocol of the given item number.
1475 @param proto_id protocol id (0-indexed) */
1476 extern void proto_set_cant_toggle(int proto_id);
1478 /** Checks for existence any protocol or field within a tree.
1479 @param tree "Protocols" are assumed to be a child of the [empty] root node.
1481 @return TRUE = found, FALSE = not found
1482 @todo add explanation of id parameter */
1483 extern gboolean proto_check_for_protocol_or_field(proto_tree* tree, int id);
1485 /* Return GPtrArray* of field_info pointers for all hfindex that appear in
1486 * tree. Only works with primed trees, and is fast. */
1487 extern GPtrArray* proto_get_finfo_ptr_array(proto_tree *tree, int hfindex);
1489 /* Return GPtrArray* of field_info pointers for all hfindex that appear in
1490 * tree. Works with any tree, primed or unprimed, and is slower than
1491 * proto_get_finfo_ptr_array because it has to search through the tree. */
1492 extern GPtrArray* proto_find_finfo(proto_tree *tree, int hfindex);
1494 /* Return GPtrArray* of field_info pointers containg all hfindexes that appear in
1496 extern GPtrArray* proto_all_finfos(proto_tree *tree);
1498 /** Dumps a glossary of the protocol registrations to STDOUT */
1499 extern void proto_registrar_dump_protocols(void);
1501 /** Dumps a glossary of the field value strings or true/false strings to STDOUT */
1502 extern void proto_registrar_dump_values(void);
1504 /** Dumps a glossary of the protocol and field registrations to STDOUT.
1505 * Format 1 is the original format. Format 2 includes the base (for integers)
1507 extern void proto_registrar_dump_fields(int format);
1511 /** Points to the first element of an array of Booleans, indexed by
1512 a subtree item type. That array element is TRUE if subtrees of
1513 an item of that type are to be expanded. With MSVC and a
1514 libwireshark.dll, we need a special declaration. */
1515 WS_VAR_IMPORT gboolean *tree_is_expanded;
1517 /** Number of elements in the tree_is_expanded array. With MSVC and a
1518 * libwireshark.dll, we need a special declaration. */
1519 WS_VAR_IMPORT int num_tree_types;
1521 /** glib doesn't have g_ptr_array_len of all things!*/
1522 #ifndef g_ptr_array_len
1523 #define g_ptr_array_len(a) ((a)->len)
1526 /** Get number of bits of a header_field.
1527 @param hfinfo header_field
1528 @return the bitwidth */
1530 hfinfo_bitwidth(header_field_info *hfinfo);
1537 /** Can we do a "match selected" on this field.
1538 @param finfo field_info
1539 @param edt epan dissecting
1540 @return TRUE if we can do a "match selected" on the field, FALSE otherwise. */
1542 proto_can_match_selected(field_info *finfo, epan_dissect_t *edt);
1544 /** Construct a "match selected" display filter string.
1545 @param finfo field_info
1546 @param edt epan dissecting
1547 @return the display filter string */
1549 proto_construct_match_selected_string(field_info *finfo, epan_dissect_t *edt);
1551 /** Find field from offset in tvb.
1553 @param offset offset in the tvb
1554 @param tvb the tv buffer
1555 @return the corresponding field_info */
1557 proto_find_field_from_offset(proto_tree *tree, guint offset, tvbuff_t *tvb);
1561 proto_tree_add_bitmask(proto_tree *tree, tvbuff_t *tvb, int offset, int hf_hdr, gint ett, const int **fields, gboolean little_endian);
1565 #endif /* __cplusplus */
1567 #endif /* proto.h */