From Jakub Zawadzki:
[obnox/wireshark/wip.git] / epan / proto.h
1 /* proto.h
2  * Definitions for protocol display
3  *
4  * $Id$
5  *
6  * Wireshark - Network traffic analyzer
7  * By Gerald Combs <gerald@wireshark.org>
8  * Copyright 1998 Gerald Combs
9  *
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.
14  *
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.
19  *
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.
23  */
24
25
26 /*! @file proto.h
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().
35 */
36
37 #ifndef __PROTO_H__
38 #define __PROTO_H__
39
40 #ifdef HAVE_STDARG_H
41 # include <stdarg.h>
42 #else
43 # include <varargs.h>
44 #endif
45
46 #include <glib.h>
47
48 #include "ipv4.h"
49 #include "nstime.h"
50 #include "time_fmt.h"
51 #include "tvbuff.h"
52 #include "ftypes/ftypes.h"
53 #include "register.h"
54
55 #ifdef __cplusplus
56 extern "C" {
57 #endif /* __cplusplus */
58
59 /** The header-field index for the special text pseudo-field. Exported by libwireshark.dll */
60 WS_VAR_IMPORT int hf_text_only;
61
62 /** the maximum length of a protocol field string representation */
63 #define ITEM_LABEL_LENGTH       240
64
65 struct _value_string;
66
67 /** Make a const value_string[] look like a _value_string pointer, used to set header_field_info.strings */
68 #define VALS(x) (const struct _value_string*)(x)
69
70 /** Make a const true_false_string[] look like a _true_false_string pointer, used to set header_field_info.strings */
71 #define TFS(x)  (const struct true_false_string*)(x)
72
73 typedef void (*custom_fmt_func_t)(gchar *, guint32);
74
75 /** Make a const range_string[] look like a _range_string pointer, used to set
76  * header_field_info.strings */
77 #define RVALS(x) (const struct _range_string*)(x)
78
79 struct _protocol;
80
81 /** Structure for information about a protocol */
82 typedef struct _protocol protocol_t;
83
84 /** check protocol activation
85  * @todo this macro looks like a hack */
86 #define CHECK_DISPLAY_AS_X(x_handle,index, tvb, pinfo, tree) {  \
87         if (!proto_is_protocol_enabled(find_protocol_by_id(index))) {   \
88                 call_dissector(x_handle,tvb, pinfo, tree);              \
89                 return;                                                 \
90         }                                                               \
91   }
92
93 /** Macro used for reporting errors in dissectors; it throws a
94  * DissectorError exception, with the string passed as an argument
95  * as the message for the exception, so that it can show up in
96  * the Info column and the protocol tree.
97  *
98  * If that string is dynamically allocated, it should be allocated with
99  * ep_alloc(); using ep_strdup_printf() would work.
100  *
101  * If the WIRESHARK_ABORT_ON_DISSECTOR_BUG environment variable is set,
102  * it will call abort(), instead, to make it easier to get a stack trace.
103  *
104  * @param message string to use as the message
105  */
106 #define REPORT_DISSECTOR_BUG(message)  \
107   ((getenv("WIRESHARK_ABORT_ON_DISSECTOR_BUG") != NULL) ? \
108     abort() : \
109     THROW_MESSAGE(DissectorError, message))
110
111 /** Macro used for assertions in dissectors; it doesn't abort, it just
112  * throws a DissectorError exception, with the assertion failure
113  * message as a parameter, so that it can show up in the protocol tree.
114  *
115  * @param expression expression to test in the assertion
116  */
117 #define DISSECTOR_ASSERT(expression)  \
118   ((void) ((expression) ? (void)0 : \
119    __DISSECTOR_ASSERT (expression, __FILE__, __LINE__)))
120
121 #if 0
122 /* win32: using a debug breakpoint (int 3) can be very handy while debugging,
123  * as the assert handling of GTK/GLib is currently not very helpful */
124 #define DISSECTOR_ASSERT(expression)  \
125 { if(!(expression)) _asm { int 3}; }
126 #endif
127
128 /** Same as DISSECTOR_ASSERT(), but will throw DissectorError exception
129  * unconditionally, much like GLIB's g_assert_not_reached works.
130  */
131 #define DISSECTOR_ASSERT_NOT_REACHED()  \
132   (REPORT_DISSECTOR_BUG( \
133     ep_strdup_printf("%s:%u: failed assertion \"DISSECTOR_ASSERT_NOT_REACHED\"", \
134      __FILE__, __LINE__)))
135
136 #define __DISSECTOR_ASSERT_STRINGIFY(s) # s
137
138 #define __DISSECTOR_ASSERT(expression, file, lineno)  \
139   (REPORT_DISSECTOR_BUG( \
140     ep_strdup_printf("%s:%u: failed assertion \"%s\"", \
141      file, lineno, __DISSECTOR_ASSERT_STRINGIFY(expression))))
142
143 /* Values for header_field_info.display */
144
145 /* For integral types, the display format is a base_display_e value
146  * possibly ORed with BASE_RANGE_STRING. */
147
148 /* BASE_DISPLAY_E_MASK selects the base_display_e value.  Its current
149  * value means that we may have at most 16 base_display_e values. */
150 #define BASE_DISPLAY_E_MASK 0x0F
151
152 typedef enum {
153         BASE_NONE,      /**< none */
154         BASE_DEC,       /**< decimal */
155         BASE_HEX,       /**< hexadecimal */
156         BASE_OCT,       /**< octal */
157         BASE_DEC_HEX,   /**< decimal (hexadecimal) */
158         BASE_HEX_DEC,   /**< hexadecimal (decimal) */
159         BASE_CUSTOM     /**< call custom routine (in ->strings) to format */
160 } base_display_e;
161
162 #define IS_INT_TYPE(type) \
163   ((type) == FT_UINT8 || (type) == FT_UINT16 || (type) == FT_UINT24 || (type) == FT_UINT32 || (type) == FT_UINT64 || \
164    (type) == FT_INT8 || (type) == FT_INT16 || (type) == FT_INT24 || (type) == FT_INT32 || (type) == FT_INT64)
165
166 /* Following constants have to be ORed with a base_display_e when dissector
167  * want to use specials MACROs (for the moment, only RVALS) for a
168  * header_field_info */
169 #define BASE_RANGE_STRING 0x10
170 #define BASE_EXT_STRING 0x20
171
172 /* BASE_ values that cause the field value to be displayed twice */
173 #define IS_BASE_DUAL(b) ((b)==BASE_DEC_HEX||(b)==BASE_HEX_DEC)
174
175 /* For FT_ABSOLUTE_TIME, the display format is an absolute_time_display_e
176  * as per time_fmt.h. */
177
178 typedef enum {
179     HF_REF_TYPE_NONE,       /**< Field is not referenced */
180     HF_REF_TYPE_INDIRECT,   /**< Field is indirectly referenced (only applicable for FT_PROTOCOL) via. its child */
181     HF_REF_TYPE_DIRECT      /**< Field is directly referenced */
182 } hf_ref_type;
183
184 /** information describing a header field */
185 typedef struct _header_field_info header_field_info;
186
187 /** information describing a header field */
188 struct _header_field_info {
189         /* ---------- set by dissector --------- */
190         const char              *name;           /**< full name of this field */
191         const char              *abbrev;         /**< abbreviated name of this field */
192         enum ftenum              type;           /**< field type, one of FT_ (from ftypes.h) */
193         int                      display;        /**< one of BASE_, or field bit-width if FT_BOOLEAN and non-zero bitmask */
194         const void              *strings;        /**< value_string, range_string or true_false_string,
195                                                       typically converted by VALS(), RVALS() or TFS().
196                                                       If this is an FT_PROTOCOL then it points to the
197                                                       associated protocol_t structure */
198         guint32                  bitmask;        /**< bitmask of interesting bits */
199         const char              *blurb;          /**< Brief description of field */
200
201         /* ------- set by proto routines (prefilled by HFILL macro, see below) ------ */
202         int                      id;             /**< Field ID */
203         int                      parent;         /**< parent protocol tree */
204         hf_ref_type              ref_type;       /**< is this field referenced by a filter */
205         int                      bitshift;       /**< bits to shift */
206         header_field_info       *same_name_next; /**< Link to next hfinfo with same abbrev */
207         header_field_info       *same_name_prev; /**< Link to previous hfinfo with same abbrev */
208 };
209
210 /**
211  * HFILL initializes all the "set by proto routines" fields in a
212  * _header_field_info. If new fields are added or removed, it should
213  * be changed as necessary.
214  */
215 #define HFILL 0, 0, HF_REF_TYPE_NONE, 0, NULL, NULL
216
217 /** Used when registering many fields at once, using proto_register_field_array() */
218 typedef struct hf_register_info {
219         int                     *p_id;           /**< written to by register() function */
220         header_field_info        hfinfo;         /**< the field info to be registered */
221 } hf_register_info;
222
223
224
225
226 /** string representation, if one of the proto_tree_add_..._format() functions used */
227 typedef struct _item_label_t {
228         char representation[ITEM_LABEL_LENGTH];
229 } item_label_t;
230
231
232 /** Contains the field information for the proto_item. */
233 typedef struct field_info {
234         header_field_info       *hfinfo;          /**< pointer to registered field information */
235         gint                     start;           /**< current start of data in field_info.ds_tvb */
236         gint                     length;          /**< current data length of item in field_info.ds_tvb */
237         gint                     appendix_start;  /**< start of appendix data */
238         gint                     appendix_length; /**< length of appendix data */
239         gint                     tree_type;       /**< one of ETT_ or -1 */
240         item_label_t            *rep;             /**< string for GUI tree */
241         guint32                  flags;           /**< bitfield like FI_GENERATED, ... */
242         tvbuff_t                *ds_tvb;          /**< data source tvbuff */
243         fvalue_t                 value;
244 } field_info;
245
246
247 /*
248  * Flag fields.  Do not assign values greater than 0x00000080 unless you
249  * shuffle the expert information upward; see below.
250  */
251
252 /** The protocol field should not be shown in the tree (it's used for filtering only),
253  * used in field_info.flags. */
254 /* HIDING PROTOCOL FIELDS IS DEPRECATED, IT'S CONSIDERED TO BE BAD GUI DESIGN!
255    A user cannot tell by looking at the packet detail that the field exists
256    and that they can filter on its value. */
257 #define FI_HIDDEN               0x00000001
258 /** The protocol field should be displayed as "generated by Wireshark",
259  * used in field_info.flags. */
260 #define FI_GENERATED            0x00000002
261 /** The protocol field is actually a URL */
262 #define FI_URL                  0x00000004
263
264 /** The protocol field value is in little endian */
265 #define FI_LITTLE_ENDIAN        0x00000008
266 /** The protocol field value is in big endian */
267 #define FI_BIG_ENDIAN           0x00000010
268
269 /** convenience macro to get field_info.flags */
270 #define FI_GET_FLAG(fi, flag) ((fi) ? (fi->flags & flag) : 0)
271 /** convenience macro to set field_info.flags */
272 #define FI_SET_FLAG(fi, flag) \
273     do { \
274       if (fi) \
275         (fi)->flags = (fi)->flags | (flag); \
276     } while(0)
277
278 /** One of these exists for the entire protocol tree. Each proto_node
279  * in the protocol tree points to the same copy. */
280 typedef struct {
281     GHashTable  *interesting_hfids;
282     gboolean    visible;
283     gboolean    fake_protocols;
284     gint        count;
285 } tree_data_t;
286
287 /** Each proto_tree, proto_item is one of these. */
288 typedef struct _proto_node {
289         struct _proto_node *first_child;
290         struct _proto_node *last_child;
291         struct _proto_node *next;
292         struct _proto_node *parent;
293         field_info  *finfo;
294         tree_data_t *tree_data;
295 } proto_node;
296
297 /** A protocol tree element. */
298 typedef proto_node proto_tree;
299 /** A protocol item element. */
300 typedef proto_node proto_item;
301
302 /*
303  * Expert information.
304  * This is in the flags field; we allocate this from the top down,
305  * so as not to collide with FI_ flags, which are allocated from
306  * the bottom up.
307  */
308
309 /* expert severities */
310 #define PI_SEVERITY_MASK        0x00000E00      /* mask usually for internal use only! */
311 /** Usual workflow, e.g. TCP connection establishing */
312 #define PI_CHAT                 0x00000200
313 /** Notable messages, e.g. an application returned an "usual" error code like HTTP 404 */
314 #define PI_NOTE                 0x00000400
315 /** Warning, e.g. application returned an "unusual" error code */
316 #define PI_WARN                 0x00000600
317 /** Serious problems, e.g. [Malformed Packet] */
318 #define PI_ERROR                0x00000800
319
320 /* expert "event groups" */
321 #define PI_GROUP_MASK           0xFFFFF000      /* mask usually for internal use only! */
322 /** The protocol field has a bad checksum, usually PI_WARN */
323 #define PI_CHECKSUM             0x00001000
324 /** The protocol field indicates a sequence problem (e.g. TCP window is zero) */
325 #define PI_SEQUENCE             0x00002000
326 /** The protocol field indicates a bad application response code (e.g. HTTP 404), usually PI_NOTE */
327 #define PI_RESPONSE_CODE        0x00004000
328 /** The protocol field indicates an application request (e.g. File Handle == xxxx), usually PI_CHAT */
329 #define PI_REQUEST_CODE         0x00005000
330 /** The data is undecoded, the protocol dissection is incomplete here, usually PI_WARN */
331 #define PI_UNDECODED            0x00008000
332 /** The protocol field indicates a reassemble (e.g. DCE/RPC defragmentation), usually PI_CHAT (or PI_ERROR) */
333 #define PI_REASSEMBLE           0x00010000
334 /** The packet data is malformed, the dissector has "given up", usually PI_ERROR */
335 #define PI_MALFORMED            0x00020000
336 /** A generic debugging message (shouldn't remain in production code!), usually PI_ERROR */
337 #define PI_DEBUG                0x00040000
338 /** The protocol field violates a protocol specification, usually PI_WARN */
339 #define PI_PROTOCOL             0x00080000
340 /* The protocol field indicates a security probem (e.g. unsecure implementation) */
341 #define PI_SECURITY             0x00100000
342
343 /* add more, see http://wiki.wireshark.org/Development/ExpertInfo */
344
345
346 /** is this protocol field hidden from the protocol tree display (used for filtering only)? */
347 /* HIDING PROTOCOL FIELDS IS DEPRECATED, IT'S CONSIDERED TO BE BAD GUI DESIGN! */
348 #define PROTO_ITEM_IS_HIDDEN(proto_item)        \
349         ((proto_item) ? FI_GET_FLAG(PITEM_FINFO(proto_item), FI_HIDDEN) : 0)
350 /** mark this protocol field to be hidden from the protocol tree display (used for filtering only) */
351 /* HIDING PROTOCOL FIELDS IS DEPRECATED, IT'S CONSIDERED TO BE BAD GUI DESIGN! */
352 #define PROTO_ITEM_SET_HIDDEN(proto_item)       \
353   do { \
354     if (proto_item) \
355       FI_SET_FLAG(PITEM_FINFO(proto_item), FI_HIDDEN); \
356         } while(0)
357 /** is this protocol field generated by Wireshark (and not read from the packet data)? */
358 #define PROTO_ITEM_IS_GENERATED(proto_item)     \
359         ((proto_item) ? FI_GET_FLAG(PITEM_FINFO(proto_item), FI_GENERATED) : 0)
360 /** mark this protocol field as generated by Wireshark (and not read from the packet data) */
361 #define PROTO_ITEM_SET_GENERATED(proto_item)    \
362     do { \
363       if (proto_item) \
364         FI_SET_FLAG(PITEM_FINFO(proto_item), FI_GENERATED); \
365     } while(0)
366 /** is this protocol field actually a URL? */
367 #define PROTO_ITEM_IS_URL(proto_item)   \
368         ((proto_item) ? FI_GET_FLAG(PITEM_FINFO(proto_item), FI_URL) : 0)
369 /** mark this protocol field as a URL */
370 #define PROTO_ITEM_SET_URL(proto_item)  \
371     do { \
372       if (proto_item) \
373         FI_SET_FLAG(PITEM_FINFO(proto_item), FI_URL); \
374     } while(0)
375
376 typedef void (*proto_tree_foreach_func)(proto_node *, gpointer);
377 typedef gboolean (*proto_tree_traverse_func)(proto_node *, gpointer);
378
379 extern gboolean proto_tree_traverse_post_order(proto_tree *tree,
380     proto_tree_traverse_func func, gpointer data);
381 extern void proto_tree_children_foreach(proto_tree *tree,
382     proto_tree_foreach_func func, gpointer data);
383
384 /** Retrieve the field_info from a proto_node */
385 #define PNODE_FINFO(proto_node)  ((proto_node)->finfo)
386
387 /** Retrieve the field_info from a proto_item */
388 #define PITEM_FINFO(proto_item)  PNODE_FINFO(proto_item)
389
390 /** Retrieve the field_info from a proto_tree */
391 #define PTREE_FINFO(proto_tree)  PNODE_FINFO(proto_tree)
392
393 /** Retrieve the tree_data_t from a proto_tree */
394 #define PTREE_DATA(proto_tree)   ((proto_tree)->tree_data)
395
396 /** Sets up memory used by proto routines. Called at program startup */
397 extern void proto_init(void (register_all_protocols_func)(register_cb cb, gpointer client_data),
398                        void (register_all_handoffs_func)(register_cb cb, gpointer client_data),
399                        register_cb cb, void *client_data);
400
401
402 /** Frees memory used by proto routines. Called at program shutdown */
403 extern void proto_cleanup(void);
404
405 /** This function takes a tree and a protocol id as parameter and
406     will return TRUE/FALSE for whether the protocol or any of the filterable
407     fields in the protocol is referenced by any fitlers.
408     If this function returns FALSE then it is safe to skip any
409     proto_tree_add_...() calls and just treat the call as if the
410     dissector was called with tree==NULL.
411     If you reset the tree to NULL by this dissector returning FALSE,
412     you will still need to call any subdissector with the original value of
413     tree or filtering will break.
414
415     The purpose of this is to optimize wireshark for speed and make it
416     faster for when filters are being used.
417 */
418 extern gboolean proto_field_is_referenced(proto_tree *tree, int proto_id);
419
420
421
422 /** Create a subtree under an existing item.
423  @param ti the parent item of the new subtree
424  @param idx one of the ett_ array elements registered with proto_register_subtree_array()
425  @return the new subtree */
426 extern proto_tree* proto_item_add_subtree(proto_item *ti, const gint idx);
427
428 /** Get an existing subtree under an item.
429  @param ti the parent item of the subtree
430  @return the subtree or NULL */
431 extern proto_tree* proto_item_get_subtree(const proto_item *ti);
432
433 /** Get the parent of a subtree item.
434  @param ti the child item in the subtree
435  @return parent item or NULL */
436 extern proto_item* proto_item_get_parent(const proto_item *ti);
437
438 /** Get Nth generation parent item.
439  @param ti the child item in the subtree
440  @param gen the generation to get (using 1 here is the same as using proto_item_get_parent())
441  @return parent item */
442 extern proto_item* proto_item_get_parent_nth(proto_item *ti, int gen);
443
444 /** Replace text of item after it already has been created.
445  @param ti the item to set the text
446  @param format printf like format string
447  @param ... printf like parameters */
448 extern void proto_item_set_text(proto_item *ti, const char *format, ...)
449         G_GNUC_PRINTF(2,3);
450
451 /** Append to text of item after it has already been created.
452  @param ti the item to append the text to
453  @param format printf like format string
454  @param ... printf like parameters */
455 extern void proto_item_append_text(proto_item *ti, const char *format, ...)
456         G_GNUC_PRINTF(2,3);
457
458 /** Set proto_item's length inside tvb, after it has already been created.
459  @param ti the item to set the length
460  @param length the new length ot the item */
461 extern void proto_item_set_len(proto_item *ti, const gint length);
462
463 /**
464  * Sets the length of the item based on its start and on the specified
465  * offset, which is the offset past the end of the item; as the start
466  * in the item is relative to the beginning of the data source tvbuff,
467  * we need to pass in a tvbuff.
468  @param ti the item to set the length
469  @param tvb end is relative to this tvbuff
470  @param end this end offset is relative to the beginning of tvb
471  @todo make usage clearer, I don't understand it!
472  */
473 extern void proto_item_set_end(proto_item *ti, tvbuff_t *tvb, gint end);
474
475 /** Get length of a proto_item. Useful after using proto_tree_add_item()
476  * to add a variable-length field (e.g., FT_NSTRING_UINT8).
477  @param ti the item to get the length from
478  @return the current length */
479 extern int proto_item_get_len(const proto_item *ti);
480
481 /**
482  * Sets an expert info to the proto_item.
483  @param ti the item to set the expert info
484  @param group the group of this info (e.g. PI_CHECKSUM)
485  @param severity of this info (e.g. PI_ERROR)
486  @return TRUE if value was written
487  */
488 extern gboolean proto_item_set_expert_flags(proto_item *ti, const int group, const guint severity);
489
490
491
492
493 /** Creates a new proto_tree root.
494  @return the new tree root */
495 extern proto_tree* proto_tree_create_root(void);
496
497 /** Clear memory for entry proto_tree. Clears proto_tree struct also.
498  @param tree the tree to free */
499 extern void proto_tree_free(proto_tree *tree);
500
501 /** Set the tree visible or invisible.
502  Is the parsing being done for a visible proto_tree or an invisible one?
503  By setting this correctly, the proto_tree creation is sped up by not
504  having to call g_vsnprintf and copy strings around.
505  @param tree the tree to be set
506  @param visible ... or not
507  @return the old value */
508 extern gboolean
509 proto_tree_set_visible(proto_tree *tree, gboolean visible);
510
511 /** Indicate whether we should fake protocols during dissection (default = TRUE)
512  @param tree the tree to be set
513  @param fake_protocols TRUE if we should fake protocols */
514 extern void
515 proto_tree_set_fake_protocols(proto_tree *tree, gboolean fake_protocols);
516
517 /** Mark a field/protocol ID as "interesting".
518  @param tree the tree to be set
519  @param hfid the interesting field id
520  @todo what *does* interesting mean? */
521 extern void
522 proto_tree_prime_hfid(proto_tree *tree, const int hfid);
523
524 /** Get a parent item of a subtree.
525  @param tree the tree to get the parent from
526  @return parent item */
527 extern proto_item* proto_tree_get_parent(const proto_tree *tree);
528
529 /** Get the root tree from any subtree.
530  @param tree the tree to get the root from
531  @return root tree */
532 extern proto_tree* proto_tree_get_root(proto_tree *tree);
533
534 /** Move an existing item behind another existing item.
535  @param tree the tree to which both items belong
536  @param fixed_item the item which keeps it's position
537  @param item_to_move the item which will be moved */
538 extern void proto_tree_move_item(proto_tree *tree, proto_item *fixed_item, proto_item *item_to_move);
539
540
541 /** Set start and length of an appendix for a proto_tree.
542   @param tree the tree to set the appendix start and length
543   @param tvb the tv buffer of the current data
544   @param start the start offset of the appendix
545   @param length the length of the appendix */
546 extern void proto_tree_set_appendix(proto_tree *tree, tvbuff_t *tvb, gint start, const gint length);
547
548
549 /** Add an item to a proto_tree, using the text label registered to that item.
550    The item is extracted from the tvbuff handed to it.
551  @param tree the tree to append this item to
552  @param hfindex field index
553  @param tvb the tv buffer of the current data
554  @param start start of data in tvb
555  @param length length of data in tvb
556  @param little_endian big or little endian byte representation
557  @return the newly created item */
558 extern proto_item *
559 proto_tree_add_item(proto_tree *tree, const int hfindex, tvbuff_t *tvb,
560     const gint start, gint length, const gboolean little_endian);
561
562 /** Add a text-only node to a proto_tree.
563  @param tree the tree to append this item to
564  @param tvb the tv buffer of the current data
565  @param start start of data in tvb
566  @param length length of data in tvb
567  @param format printf like format string
568  @param ... printf like parameters
569  @return the newly created item */
570 extern proto_item *
571 proto_tree_add_text(proto_tree *tree, tvbuff_t *tvb, gint start, gint length, const char *format,
572         ...) G_GNUC_PRINTF(5,6);
573
574 /** Add a text-only node to a proto_tree using a variable argument list.
575  @param tree the tree to append this item to
576  @param tvb the tv buffer of the current data
577  @param start start of data in tvb
578  @param length length of data in tvb
579  @param format printf like format string
580  @param ap variable argument list
581  @return the newly created item */
582 extern proto_item *
583 proto_tree_add_text_valist(proto_tree *tree, tvbuff_t *tvb, gint start,
584         gint length, const char *format, va_list ap);
585
586
587 /** Add a FT_NONE field to a proto_tree.
588  @param tree the tree to append this item to
589  @param hfindex field index
590  @param tvb the tv buffer of the current data
591  @param start start of data in tvb
592  @param length length of data in tvb
593  @param format printf like format string
594  @param ... printf like parameters
595  @return the newly created item */
596 extern proto_item *
597 proto_tree_add_none_format(proto_tree *tree, const int hfindex, tvbuff_t *tvb, const gint start,
598         gint length, const char *format, ...) G_GNUC_PRINTF(6,7);
599
600 /** Add a FT_PROTOCOL to a proto_tree.
601  @param tree the tree to append this item to
602  @param hfindex field index
603  @param tvb the tv buffer of the current data
604  @param start start of data in tvb
605  @param length length of data in tvb
606  @param format printf like format string
607  @param ... printf like parameters
608  @return the newly created item */
609 extern proto_item *
610 proto_tree_add_protocol_format(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
611         gint length, const char *format, ...) G_GNUC_PRINTF(6,7);
612
613
614
615
616 /** Add a FT_BYTES to a proto_tree.
617  @param tree the tree to append this item to
618  @param hfindex field index
619  @param tvb the tv buffer of the current data
620  @param start start of data in tvb
621  @param length length of data in tvb
622  @param start_ptr pointer to the data to display
623  @return the newly created item */
624 extern proto_item *
625 proto_tree_add_bytes(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
626         gint length, const guint8* start_ptr);
627
628 /** Add a formatted FT_BYTES to a proto_tree, with the format generating
629     the string for the value and with the field name being included
630     automatically.
631  @param tree the tree to append this item to
632  @param hfindex field index
633  @param tvb the tv buffer of the current data
634  @param start start of data in tvb
635  @param length length of data in tvb
636  @param start_ptr pointer to the data to display
637  @param format printf like format string
638  @param ... printf like parameters
639  @return the newly created item */
640 extern proto_item *
641 proto_tree_add_bytes_format_value(proto_tree *tree, int hfindex, tvbuff_t *tvb,
642         gint start, gint length, const guint8* start_ptr, const char *format,
643         ...) G_GNUC_PRINTF(7,8);
644
645 /** Add a formatted FT_BYTES to a proto_tree, with the format generating
646     the entire string for the entry, including any field name.
647  @param tree the tree to append this item to
648  @param hfindex field index
649  @param tvb the tv buffer of the current data
650  @param start start of data in tvb
651  @param length length of data in tvb
652  @param start_ptr pointer to the data to display
653  @param format printf like format string
654  @param ... printf like parameters
655  @return the newly created item */
656 extern proto_item *
657 proto_tree_add_bytes_format(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
658         gint length, const guint8* start_ptr, const char *format, ...) G_GNUC_PRINTF(7,8);
659
660 /** Add a FT_ABSOLUTE_TIME or FT_RELATIVE_TIME to a proto_tree.
661  @param tree the tree to append this item to
662  @param hfindex field index
663  @param tvb the tv buffer of the current data
664  @param start start of data in tvb
665  @param length length of data in tvb
666  @param value_ptr pointer to the data to display
667  @return the newly created item */
668 extern proto_item *
669 proto_tree_add_time(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
670         gint length, nstime_t* value_ptr);
671
672 /** Add a formatted FT_ABSOLUTE_TIME or FT_RELATIVE_TIME to a proto_tree, with
673     the format generating the string for the value and with the field name
674     being included automatically.
675  @param tree the tree to append this item to
676  @param hfindex field index
677  @param tvb the tv buffer of the current data
678  @param start start of data in tvb
679  @param length length of data in tvb
680  @param value_ptr pointer to the data to display
681  @param format printf like format string
682  @param ... printf like parameters
683  @return the newly created item */
684 extern proto_item *
685 proto_tree_add_time_format_value(proto_tree *tree, int hfindex, tvbuff_t *tvb,
686         gint start, gint length, nstime_t* value_ptr, const char *format, ...)
687         G_GNUC_PRINTF(7,8);
688
689 /** Add a formatted FT_ABSOLUTE_TIME or FT_RELATIVE_TIME to a proto_tree, with
690     the format generating the entire string for the entry, including any field
691     name.
692  @param tree the tree to append this item to
693  @param hfindex field index
694  @param tvb the tv buffer of the current data
695  @param start start of data in tvb
696  @param length length of data in tvb
697  @param value_ptr pointer to the data to display
698  @param format printf like format string
699  @param ... printf like parameters
700  @return the newly created item */
701 extern proto_item *
702 proto_tree_add_time_format(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
703         gint length, nstime_t* value_ptr, const char *format, ...) G_GNUC_PRINTF(7,8);
704
705 /** Add a FT_IPXNET to a proto_tree.
706  @param tree the tree to append this item to
707  @param hfindex field index
708  @param tvb the tv buffer of the current data
709  @param start start of data in tvb
710  @param length length of data in tvb
711  @param value data to display
712  @return the newly created item */
713 extern proto_item *
714 proto_tree_add_ipxnet(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
715         gint length, guint32 value);
716
717 /** Add a formatted FT_IPXNET to a proto_tree, with the format generating
718     the string for the value and with the field name being included
719     automatically.
720  @param tree the tree to append this item to
721  @param hfindex field index
722  @param tvb the tv buffer of the current data
723  @param start start of data in tvb
724  @param length length of data in tvb
725  @param value data to display
726  @param format printf like format string
727  @param ... printf like parameters
728  @return the newly created item */
729 extern proto_item *
730 proto_tree_add_ipxnet_format_value(proto_tree *tree, int hfindex, tvbuff_t *tvb,
731         gint start, gint length, guint32 value, const char *format, ...)
732         G_GNUC_PRINTF(7,8);
733
734 /** Add a formatted FT_IPXNET to a proto_tree, with the format generating
735     the entire string for the entry, including any field name.
736  @param tree the tree to append this item to
737  @param hfindex field index
738  @param tvb the tv buffer of the current data
739  @param start start of data in tvb
740  @param length length of data in tvb
741  @param value data to display
742  @param format printf like format string
743  @param ... printf like parameters
744  @return the newly created item */
745 extern proto_item *
746 proto_tree_add_ipxnet_format(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
747         gint length, guint32 value, const char *format, ...) G_GNUC_PRINTF(7,8);
748
749 /** Add a FT_IPv4 to a proto_tree.
750  @param tree the tree to append this item to
751  @param hfindex field index
752  @param tvb the tv buffer of the current data
753  @param start start of data in tvb
754  @param length length of data in tvb
755  @param value data to display
756  @return the newly created item */
757 extern proto_item *
758 proto_tree_add_ipv4(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
759         gint length, guint32 value);
760
761 /** Add a formatted FT_IPv4 to a proto_tree, with the format generating
762     the string for the value and with the field name being included
763     automatically.
764  @param tree the tree to append this item to
765  @param hfindex field index
766  @param tvb the tv buffer of the current data
767  @param start start of data in tvb
768  @param length length of data in tvb
769  @param value data to display
770  @param format printf like format string
771  @param ... printf like parameters
772  @return the newly created item */
773 extern proto_item *
774 proto_tree_add_ipv4_format_value(proto_tree *tree, int hfindex, tvbuff_t *tvb,
775         gint start, gint length, guint32 value, const char *format, ...)
776         G_GNUC_PRINTF(7,8);
777
778 /** Add a formatted FT_IPv4 to a proto_tree, with the format generating
779     the entire string for the entry, including any field name.
780  @param tree the tree to append this item to
781  @param hfindex field index
782  @param tvb the tv buffer of the current data
783  @param start start of data in tvb
784  @param length length of data in tvb
785  @param value data to display
786  @param format printf like format string
787  @param ... printf like parameters
788  @return the newly created item */
789 extern proto_item *
790 proto_tree_add_ipv4_format(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
791         gint length, guint32 value, const char *format, ...) G_GNUC_PRINTF(7,8);
792
793 /** Add a FT_IPv6 to a proto_tree.
794  @param tree the tree to append this item to
795  @param hfindex field index
796  @param tvb the tv buffer of the current data
797  @param start start of data in tvb
798  @param length length of data in tvb
799  @param value_ptr data to display
800  @return the newly created item */
801 extern proto_item *
802 proto_tree_add_ipv6(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
803         gint length, const guint8* value_ptr);
804
805 /** Add a formatted FT_IPv6 to a proto_tree, with the format generating
806     the string for the value and with the field name being included
807     automatically.
808  @param tree the tree to append this item to
809  @param hfindex field index
810  @param tvb the tv buffer of the current data
811  @param start start of data in tvb
812  @param length length of data in tvb
813  @param value_ptr data to display
814  @param format printf like format string
815  @param ... printf like parameters
816  @return the newly created item */
817 extern proto_item *
818 proto_tree_add_ipv6_format_value(proto_tree *tree, int hfindex, tvbuff_t *tvb,
819         gint start, gint length, const guint8* value_ptr, const char *format,
820         ...) G_GNUC_PRINTF(7,8);
821
822 /** Add a formatted FT_IPv6 to a proto_tree, with the format generating
823     the entire string for the entry, including any field name.
824  @param tree the tree to append this item to
825  @param hfindex field index
826  @param tvb the tv buffer of the current data
827  @param start start of data in tvb
828  @param length length of data in tvb
829  @param value_ptr data to display
830  @param format printf like format string
831  @param ... printf like parameters
832  @return the newly created item */
833 extern proto_item *
834 proto_tree_add_ipv6_format(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
835         gint length, const guint8* value_ptr, const char *format, ...) G_GNUC_PRINTF(7,8);
836
837 /** Add a FT_ETHER to a proto_tree.
838  @param tree the tree to append this item to
839  @param hfindex field index
840  @param tvb the tv buffer of the current data
841  @param start start of data in tvb
842  @param length length of data in tvb
843  @param value data to display
844  @return the newly created item */
845 extern proto_item *
846 proto_tree_add_ether(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
847         gint length, const guint8* value);
848
849 /** Add a formatted FT_ETHER to a proto_tree, with the format generating
850     the string for the value and with the field name being included
851     automatically.
852  @param tree the tree to append this item to
853  @param hfindex field index
854  @param tvb the tv buffer of the current data
855  @param start start of data in tvb
856  @param length length of data in tvb
857  @param value data to display
858  @param format printf like format string
859  @param ... printf like parameters
860  @return the newly created item */
861 extern proto_item *
862 proto_tree_add_ether_format_value(proto_tree *tree, int hfindex, tvbuff_t *tvb,
863         gint start, gint length, const guint8* value, const char *format, ...)
864         G_GNUC_PRINTF(7,8);
865
866 /** Add a formatted FT_ETHER to a proto_tree, with the format generating
867     the entire string for the entry, including any field name.
868  @param tree the tree to append this item to
869  @param hfindex field index
870  @param tvb the tv buffer of the current data
871  @param start start of data in tvb
872  @param length length of data in tvb
873  @param value data to display
874  @param format printf like format string
875  @param ... printf like parameters
876  @return the newly created item */
877 extern proto_item *
878 proto_tree_add_ether_format(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
879         gint length, const guint8* value, const char *format, ...) G_GNUC_PRINTF(7,8);
880
881 /** Add a FT_GUID to a proto_tree.
882  @param tree the tree to append this item to
883  @param hfindex field index
884  @param tvb the tv buffer of the current data
885  @param start start of data in tvb
886  @param length length of data in tvb
887  @param value_ptr data to display
888  @return the newly created item */
889 extern proto_item *
890 proto_tree_add_guid(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
891         gint length, const e_guid_t *value_ptr);
892
893 /** Add a formatted FT_GUID to a proto_tree, with the format generating
894     the string for the value and with the field name being included
895     automatically.
896  @param tree the tree to append this item to
897  @param hfindex field index
898  @param tvb the tv buffer of the current data
899  @param start start of data in tvb
900  @param length length of data in tvb
901  @param value_ptr data to display
902  @param format printf like format string
903  @param ... printf like parameters
904  @return the newly created item */
905 extern proto_item *
906 proto_tree_add_guid_format_value(proto_tree *tree, int hfindex, tvbuff_t *tvb,
907         gint start, gint length, const e_guid_t *value_ptr, const char *format,
908         ...) G_GNUC_PRINTF(7,8);
909
910 /** Add a formatted FT_GUID to a proto_tree, with the format generating
911     the entire string for the entry, including any field name.
912  @param tree the tree to append this item to
913  @param hfindex field index
914  @param tvb the tv buffer of the current data
915  @param start start of data in tvb
916  @param length length of data in tvb
917  @param value_ptr data to display
918  @param format printf like format string
919  @param ... printf like parameters
920  @return the newly created item */
921 extern proto_item *
922 proto_tree_add_guid_format(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
923         gint length, const e_guid_t *value_ptr, const char *format, ...) G_GNUC_PRINTF(7,8);
924
925 /** Add a FT_OID to a proto_tree.
926  @param tree the tree to append this item to
927  @param hfindex field index
928  @param tvb the tv buffer of the current data
929  @param start start of data in tvb
930  @param length length of data in tvb
931  @param value_ptr data to display
932  @return the newly created item */
933 extern proto_item *
934 proto_tree_add_oid(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
935         gint length, const guint8* value_ptr);
936
937 /** Add a formatted FT_OID to a proto_tree, with the format generating
938     the string for the value and with the field name being included
939     automatically.
940  @param tree the tree to append this item to
941  @param hfindex field index
942  @param tvb the tv buffer of the current data
943  @param start start of data in tvb
944  @param length length of data in tvb
945  @param value_ptr data to display
946  @param format printf like format string
947  @param ... printf like parameters
948  @return the newly created item */
949 extern proto_item *
950 proto_tree_add_oid_format_value(proto_tree *tree, int hfindex, tvbuff_t *tvb,
951         gint start, gint length, const guint8* value_ptr, const char *format,
952         ...) G_GNUC_PRINTF(7,8);
953
954 /** Add a formatted FT_OID to a proto_tree, with the format generating
955     the entire string for the entry, including any field name.
956  @param tree the tree to append this item to
957  @param hfindex field index
958  @param tvb the tv buffer of the current data
959  @param start start of data in tvb
960  @param length length of data in tvb
961  @param value_ptr data to display
962  @param format printf like format string
963  @param ... printf like parameters
964  @return the newly created item */
965 extern proto_item *
966 proto_tree_add_oid_format(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
967         gint length, const guint8* value_ptr, const char *format, ...) G_GNUC_PRINTF(7,8);
968
969 /** Add a FT_STRING to a proto_tree.
970  @param tree the tree to append this item to
971  @param hfindex field index
972  @param tvb the tv buffer of the current data
973  @param start start of data in tvb
974  @param length length of data in tvb
975  @param value data to display
976  @return the newly created item */
977 extern proto_item *
978 proto_tree_add_string(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
979         gint length, const char* value);
980
981 /** Add a formatted FT_STRING to a proto_tree, with the format generating
982     the string for the value and with the field name being included
983     automatically.
984  @param tree the tree to append this item to
985  @param hfindex field index
986  @param tvb the tv buffer of the current data
987  @param start start of data in tvb
988  @param length length of data in tvb
989  @param value data to display
990  @param format printf like format string
991  @param ... printf like parameters
992  @return the newly created item */
993 extern proto_item *
994 proto_tree_add_string_format_value(proto_tree *tree, int hfindex, tvbuff_t *tvb,
995         gint start, gint length, const char* value, const char *format, ...)
996         G_GNUC_PRINTF(7,8);
997
998 /** Add a formatted FT_STRING to a proto_tree, with the format generating
999     the entire string for the entry, including any field name.
1000  @param tree the tree to append this item to
1001  @param hfindex field index
1002  @param tvb the tv buffer of the current data
1003  @param start start of data in tvb
1004  @param length length of data in tvb
1005  @param value data to display
1006  @param format printf like format string
1007  @param ... printf like parameters
1008  @return the newly created item */
1009 extern proto_item *
1010 proto_tree_add_string_format(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
1011         gint length, const char* value, const char *format, ...) G_GNUC_PRINTF(7,8);
1012
1013 /** Add a FT_BOOLEAN to a proto_tree.
1014  @param tree the tree to append this item to
1015  @param hfindex field index
1016  @param tvb the tv buffer of the current data
1017  @param start start of data in tvb
1018  @param length length of data in tvb
1019  @param value data to display
1020  @return the newly created item */
1021 extern proto_item *
1022 proto_tree_add_boolean(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
1023         gint length, guint32 value);
1024
1025 /** Add a formatted FT_BOOLEAN to a proto_tree, with the format generating
1026     the string for the value and with the field name being included
1027     automatically.
1028  @param tree the tree to append this item to
1029  @param hfindex field index
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 value data to display
1034  @param format printf like format string
1035  @param ... printf like parameters
1036  @return the newly created item */
1037 extern proto_item *
1038 proto_tree_add_boolean_format_value(proto_tree *tree, int hfindex,
1039         tvbuff_t *tvb, gint start, gint length, guint32 value,
1040         const char *format, ...) G_GNUC_PRINTF(7,8);
1041
1042 /** Add a formatted FT_BOOLEAN to a proto_tree, with the format generating
1043     the entire string for the entry, including any field name.
1044  @param tree the tree to append this item to
1045  @param hfindex field index
1046  @param tvb the tv buffer of the current data
1047  @param start start of data in tvb
1048  @param length length of data in tvb
1049  @param value data to display
1050  @param format printf like format string
1051  @param ... printf like parameters
1052  @return the newly created item */
1053 extern proto_item *
1054 proto_tree_add_boolean_format(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
1055         gint length, guint32 value, const char *format, ...) G_GNUC_PRINTF(7,8);
1056
1057 /** Add a FT_FLOAT to a proto_tree.
1058  @param tree the tree to append this item to
1059  @param hfindex field index
1060  @param tvb the tv buffer of the current data
1061  @param start start of data in tvb
1062  @param length length of data in tvb
1063  @param value data to display
1064  @return the newly created item */
1065 extern proto_item *
1066 proto_tree_add_float(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
1067         gint length, float value);
1068
1069 /** Add a formatted FT_FLOAT to a proto_tree, with the format generating
1070     the string for the value and with the field name being included
1071     automatically.
1072  @param tree the tree to append this item to
1073  @param hfindex field index
1074  @param tvb the tv buffer of the current data
1075  @param start start of data in tvb
1076  @param length length of data in tvb
1077  @param value data to display
1078  @param format printf like format string
1079  @param ... printf like parameters
1080  @return the newly created item */
1081 extern proto_item *
1082 proto_tree_add_float_format_value(proto_tree *tree, int hfindex, tvbuff_t *tvb,
1083         gint start, gint length, float value, const char *format, ...)
1084         G_GNUC_PRINTF(7,8);
1085
1086 /** Add a formatted FT_FLOAT to a proto_tree, with the format generating
1087     the entire string for the entry, including any field name.
1088  @param tree the tree to append this item to
1089  @param hfindex field index
1090  @param tvb the tv buffer of the current data
1091  @param start start of data in tvb
1092  @param length length of data in tvb
1093  @param value data to display
1094  @param format printf like format string
1095  @param ... printf like parameters
1096  @return the newly created item */
1097 extern proto_item *
1098 proto_tree_add_float_format(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
1099         gint length, float value, const char *format, ...) G_GNUC_PRINTF(7,8);
1100
1101 /** Add a FT_DOUBLE to a proto_tree.
1102  @param tree the tree to append this item to
1103  @param hfindex field index
1104  @param tvb the tv buffer of the current data
1105  @param start start of data in tvb
1106  @param length length of data in tvb
1107  @param value data to display
1108  @return the newly created item */
1109 extern proto_item *
1110 proto_tree_add_double(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
1111         gint length, double value);
1112
1113 /** Add a formatted FT_DOUBLE to a proto_tree, with the format generating
1114     the string for the value and with the field name being included
1115     automatically.
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 value data to display
1122  @param format printf like format string
1123  @param ... printf like parameters
1124  @return the newly created item */
1125 extern proto_item *
1126 proto_tree_add_double_format_value(proto_tree *tree, int hfindex, tvbuff_t *tvb,
1127         gint start, gint length, double value, const char *format, ...)
1128         G_GNUC_PRINTF(7,8);
1129
1130 /** Add a formatted FT_DOUBLE to a proto_tree, with the format generating
1131     the entire string for the entry, including any field name.
1132  @param tree the tree to append this item to
1133  @param hfindex field index
1134  @param tvb the tv buffer of the current data
1135  @param start start of data in tvb
1136  @param length length of data in tvb
1137  @param value data to display
1138  @param format printf like format string
1139  @param ... printf like parameters
1140  @return the newly created item */
1141 extern proto_item *
1142 proto_tree_add_double_format(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
1143         gint length, double value, const char *format, ...) G_GNUC_PRINTF(7,8);
1144
1145 /** Add one of FT_UINT8, FT_UINT16, FT_UINT24 or FT_UINT32 to a proto_tree.
1146  @param tree the tree to append this item to
1147  @param hfindex field index
1148  @param tvb the tv buffer of the current data
1149  @param start start of data in tvb
1150  @param length length of data in tvb
1151  @param value data to display
1152  @return the newly created item */
1153 extern proto_item *
1154 proto_tree_add_uint(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
1155         gint length, guint32 value);
1156
1157 /** Add a formatted FT_UINT8, FT_UINT16, FT_UINT24 or FT_UINT32 to a proto_tree,
1158     with the format generating the string for the value and with the field
1159     name being included automatically.
1160  @param tree the tree to append this item to
1161  @param hfindex field index
1162  @param tvb the tv buffer of the current data
1163  @param start start of data in tvb
1164  @param length length of data in tvb
1165  @param value data to display
1166  @param format printf like format string
1167  @param ... printf like parameters
1168  @return the newly created item */
1169 extern proto_item *
1170 proto_tree_add_uint_format_value(proto_tree *tree, int hfindex, tvbuff_t *tvb,
1171         gint start, gint length, guint32 value, const char *format, ...)
1172         G_GNUC_PRINTF(7,8);
1173
1174 /** Add a formatted FT_UINT8, FT_UINT16, FT_UINT24 or FT_UINT32 to a proto_tree,
1175     with the format generating the entire string for the entry, including any
1176     field name.
1177  @param tree the tree to append this item to
1178  @param hfindex field index
1179  @param tvb the tv buffer of the current data
1180  @param start start of data in tvb
1181  @param length length of data in tvb
1182  @param value data to display
1183  @param format printf like format string
1184  @param ... printf like parameters
1185  @return the newly created item */
1186 extern proto_item *
1187 proto_tree_add_uint_format(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
1188         gint length, guint32 value, const char *format, ...) G_GNUC_PRINTF(7,8);
1189
1190 /** Add an FT_UINT64 to a proto_tree.
1191  @param tree the tree to append this item to
1192  @param hfindex field index
1193  @param tvb the tv buffer of the current data
1194  @param start start of data in tvb
1195  @param length length of data in tvb
1196  @param value data to display
1197  @return the newly created item */
1198 extern proto_item *
1199 proto_tree_add_uint64(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
1200         gint length, guint64 value);
1201
1202 /** Add a formatted FT_UINT64 to a proto_tree, with the format generating
1203     the string for the value and with the field name being included
1204     automatically.
1205  @param tree the tree to append this item to
1206  @param hfindex field index
1207  @param tvb the tv buffer of the current data
1208  @param start start of data in tvb
1209  @param length length of data in tvb
1210  @param value data to display
1211  @param format printf like format string
1212  @param ... printf like parameters
1213  @return the newly created item */
1214 extern proto_item *
1215 proto_tree_add_uint64_format_value(proto_tree *tree, int hfindex, tvbuff_t *tvb,
1216         gint start, gint length, guint64 value, const char *format, ...)
1217         G_GNUC_PRINTF(7,8);
1218
1219 /** Add a formatted FT_UINT64 to a proto_tree, with the format generating
1220     the entire string for the entry, including any field name.
1221  @param tree the tree to append this item to
1222  @param hfindex field index
1223  @param tvb the tv buffer of the current data
1224  @param start start of data in tvb
1225  @param length length of data in tvb
1226  @param value data to display
1227  @param format printf like format string
1228  @param ... printf like parameters
1229  @return the newly created item */
1230 extern proto_item *
1231 proto_tree_add_uint64_format(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
1232         gint length, guint64 value, const char *format, ...) G_GNUC_PRINTF(7,8);
1233
1234 /** Add one of FT_INT8, FT_INT16, FT_INT24 or FT_INT32 to a proto_tree.
1235  @param tree the tree to append this item to
1236  @param hfindex field index
1237  @param tvb the tv buffer of the current data
1238  @param start start of data in tvb
1239  @param length length of data in tvb
1240  @param value data to display
1241  @return the newly created item */
1242 extern proto_item *
1243 proto_tree_add_int(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
1244         gint length, gint32 value);
1245
1246 /** Add a formatted FT_INT8, FT_INT16, FT_INT24 or FT_INT32 to a proto_tree,
1247     with the format generating the string for the value and with the field
1248     name being included automatically.
1249  @param tree the tree to append this item to
1250  @param hfindex field index
1251  @param tvb the tv buffer of the current data
1252  @param start start of data in tvb
1253  @param length length of data in tvb
1254  @param value data to display
1255  @param format printf like format string
1256  @param ... printf like parameters
1257  @return the newly created item */
1258 extern proto_item *
1259 proto_tree_add_int_format_value(proto_tree *tree, int hfindex, tvbuff_t *tvb,
1260         gint start, gint length, gint32 value, const char *format, ...)
1261         G_GNUC_PRINTF(7,8);
1262
1263 /** Add a formatted FT_INT8, FT_INT16, FT_INT24 or FT_INT32 to a proto_tree,
1264     with the format generating the entire string for the entry, including
1265     any field name.
1266  @param tree the tree to append this item to
1267  @param hfindex field index
1268  @param tvb the tv buffer of the current data
1269  @param start start of data in tvb
1270  @param length length of data in tvb
1271  @param value data to display
1272  @param format printf like format string
1273  @param ... printf like parameters
1274  @return the newly created item */
1275 extern proto_item *
1276 proto_tree_add_int_format(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
1277         gint length, gint32 value, const char *format, ...) G_GNUC_PRINTF(7,8);
1278
1279 /** Add an FT_INT64 to a proto_tree.
1280  @param tree the tree to append this item to
1281  @param hfindex field index
1282  @param tvb the tv buffer of the current data
1283  @param start start of data in tvb
1284  @param length length of data in tvb
1285  @param value data to display
1286  @return the newly created item */
1287 extern proto_item *
1288 proto_tree_add_int64(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
1289         gint length, gint64 value);
1290
1291 /** Add a formatted FT_INT64 to a proto_tree, with the format generating
1292     the string for the value and with the field name being included
1293     automatically.
1294  @param tree the tree to append this item to
1295  @param hfindex field index
1296  @param tvb the tv buffer of the current data
1297  @param start start of data in tvb
1298  @param length length of data in tvb
1299  @param value data to display
1300  @param format printf like format string
1301  @param ... printf like parameters
1302  @return the newly created item */
1303 extern proto_item *
1304 proto_tree_add_int64_format_value(proto_tree *tree, int hfindex, tvbuff_t *tvb,
1305         gint start, gint length, gint64 value, const char *format, ...)
1306         G_GNUC_PRINTF(7,8);
1307
1308 /** Add a formatted FT_INT64 to a proto_tree, with the format generating
1309     the entire string for the entry, including any field name.
1310  @param tree the tree to append this item to
1311  @param hfindex field index
1312  @param tvb the tv buffer of the current data
1313  @param start start of data in tvb
1314  @param length length of data in tvb
1315  @param value data to display
1316  @param format printf like format string
1317  @param ... printf like parameters
1318  @return the newly created item */
1319 extern proto_item *
1320 proto_tree_add_int64_format(proto_tree *tree, int hfindex, tvbuff_t *tvb, gint start,
1321         gint length, gint64 value, const char *format, ...) G_GNUC_PRINTF(7,8);
1322
1323 /** Useful for quick debugging. Also sends string to STDOUT, so don't
1324     leave call to this function in production code.
1325  @param tree the tree to append the text to
1326  @param format printf like format string
1327  @param ... printf like parameters
1328  @return the newly created item */
1329 extern proto_item *
1330 proto_tree_add_debug_text(proto_tree *tree, const char *format,
1331         ...) G_GNUC_PRINTF(2,3);
1332
1333
1334
1335 /** Append a string to a protocol item.<br>
1336     NOTE: this function will break with the TRY_TO_FAKE_THIS_ITEM()
1337     speed optimization.
1338     Currently only WSP use this function so it is not that bad but try to
1339     avoid using this one if possible.
1340     IF you must use this function you MUST also disable the
1341     TRY_TO_FAKE_THIS_ITEM() optimization for your dissector/function
1342     using proto_item_append_string().
1343     Do that by faking that the tree is visible by calling
1344     proto_tree_set_visible(tree, TRUE) (see packet-wsp.c)
1345     BEFORE you create the item you are later going to use
1346     proto_item_append_string() on.
1347  @param pi the item to append the string to
1348  @param str the string to append */
1349 extern void
1350 proto_item_append_string(proto_item *pi, const char *str);
1351
1352
1353
1354 /** Fill given label_str with string representation of field
1355  @param fi the item to get the info from
1356  @param label_str the string to fill
1357  @todo think about changing the parameter profile */
1358 extern void
1359 proto_item_fill_label(field_info *fi, gchar *label_str);
1360
1361
1362 /** Register a new protocol.
1363  @param name the full name of the new protocol
1364  @param short_name abbreviated name of the new protocol
1365  @param filter_name protocol name used for a display filter string
1366  @return the new protocol handle */
1367 extern int
1368 proto_register_protocol(const char *name, const char *short_name, const char *filter_name);
1369
1370 /** Mark protocol as private
1371  @param proto_id the handle of the protocol */
1372 extern void
1373 proto_mark_private(const int proto_id);
1374
1375 /** Return if protocol is private
1376  @param proto_id the handle of the protocol
1377  @return TRUE if it is a private protocol, FALSE is not. */
1378 extern gboolean
1379 proto_is_private(const int proto_id);
1380
1381 /** This is the type of function can be registered to get called whenever
1382     a given field was not found but a its prefix is matched
1383         it can be used to procrastinate the hf array registration
1384    @param match  what's being matched */
1385 typedef void (*prefix_initializer_t)(const char* match);
1386
1387 /** Register a new prefix for delayed initialization of field arrays
1388 @param prefix the prefix for the new protocol
1389 @param initializer function that will initialize the field array for the given prefix */
1390 extern void
1391 proto_register_prefix(const char *prefix,  prefix_initializer_t initializer);
1392
1393 /** Initialize every remaining uninitialized prefix. */
1394 extern void proto_initialize_all_prefixes(void);
1395
1396 /** Register a header_field array.
1397  @param parent the protocol handle from proto_register_protocol()
1398  @param hf the hf_register_info array
1399  @param num_records the number of records in hf */
1400 extern void
1401 proto_register_field_array(const int parent, hf_register_info *hf, const int num_records);
1402
1403 /** Register a protocol subtree (ett) array.
1404  @param indices array of ett indices
1405  @param num_indices the number of records in indices */
1406 extern void
1407 proto_register_subtree_array(gint *const *indices, const int num_indices);
1408
1409 /** Returns number of items (protocols or header fields) registered.
1410  @return the number of items */
1411 extern int proto_registrar_n(void);
1412
1413 /** Get name of registered header_field number n.
1414  @param n item # n (0-indexed)
1415  @return the name of this registered item */
1416 extern const char* proto_registrar_get_name(const int n);
1417
1418 /** Get abbreviation of registered header_field number n.
1419  @param n item # n (0-indexed)
1420  @return the abbreviation of this registered item */
1421 extern const char* proto_registrar_get_abbrev(const int n);
1422
1423 /** Get the header_field information based upon a field or protocol id.
1424  @param hfindex item # n (0-indexed)
1425  @return the registered item */
1426 extern header_field_info* proto_registrar_get_nth(guint hfindex);
1427
1428 /** Get the header_field information based upon a field name.
1429  @param field_name the field name to search for
1430  @return the registered item */
1431 extern header_field_info* proto_registrar_get_byname(const char *field_name);
1432
1433 /** Get enum ftenum FT_ of registered header_field number n.
1434  @param n item # n (0-indexed)
1435  @return the registered item */
1436 extern int proto_registrar_get_ftype(const int n);
1437
1438 /** Get parent protocol of registered header_field number n.
1439  @param n item # n (0-indexed)
1440  @return -1 if item _is_ a protocol */
1441 extern int proto_registrar_get_parent(const int n);
1442
1443 /** Is item # n a protocol?
1444  @param n item # n (0-indexed)
1445  @return TRUE if it's a protocol, FALSE if it's not */
1446 extern gboolean proto_registrar_is_protocol(const int n);
1447
1448 /** Get length of registered field according to field type.
1449  @param n item # n (0-indexed)
1450  @return 0 means undeterminable at registration time, -1 means unknown field */
1451 extern gint proto_registrar_get_length(const int n);
1452
1453
1454 /** Routines to use to iterate over the protocols and their fields;
1455  * they return the item number of the protocol in question or the
1456  * appropriate hfinfo pointer, and keep state in "*cookie". */
1457 extern int proto_get_first_protocol(void **cookie);
1458 extern int proto_get_next_protocol(void **cookie);
1459 extern header_field_info *proto_get_first_protocol_field(const int proto_id, void **cookle);
1460 extern header_field_info *proto_get_next_protocol_field(void **cookle);
1461
1462 /** Given a protocol's filter_name.
1463  @param filter_name the filter name to search for
1464  @return proto_id */
1465 extern int proto_get_id_by_filter_name(const gchar* filter_name);
1466
1467 /** Can item # n decoding be disabled?
1468  @param proto_id protocol id (0-indexed)
1469  @return TRUE if it's a protocol, FALSE if it's not */
1470 extern gboolean proto_can_toggle_protocol(const int proto_id);
1471
1472 /** Get the "protocol_t" structure for the given protocol's item number.
1473  @param proto_id protocol id (0-indexed) */
1474 extern protocol_t *find_protocol_by_id(const int proto_id);
1475
1476 /** Get the protocol's name for the given protocol's item number.
1477  @param proto_id protocol id (0-indexed)
1478  @return its name */
1479 extern const char *proto_get_protocol_name(const int proto_id);
1480
1481 /** Get the protocol's item number, for the given protocol's "protocol_t".
1482  @return its proto_id */
1483 extern int proto_get_id(const protocol_t *protocol);
1484
1485 /** Get the protocol's short name, for the given protocol's "protocol_t".
1486  @return its short name. */
1487 extern const char *proto_get_protocol_short_name(const protocol_t *protocol);
1488
1489 /** Get the protocol's long name, for the given protocol's "protocol_t".
1490  @return its long name. */
1491 extern const char *proto_get_protocol_long_name(const protocol_t *protocol);
1492
1493 /** Is protocol's decoding enabled ?
1494  @param protocol
1495  @return TRUE if decoding is enabled, FALSE if not */
1496 extern gboolean proto_is_protocol_enabled(const protocol_t *protocol);
1497
1498 /** Get a protocol's filter name by it's item number.
1499  @param proto_id protocol id (0-indexed)
1500  @return its filter name. */
1501 extern const char *proto_get_protocol_filter_name(const int proto_id);
1502
1503 /** Enable / Disable protocol of the given item number.
1504  @param proto_id protocol id (0-indexed)
1505  @param enabled enable / disable the protocol */
1506 extern void proto_set_decoding(const int proto_id, const gboolean enabled);
1507
1508 /** Enable all protocols */
1509 extern void proto_enable_all(void);
1510
1511 /** Disable disabling/enabling of protocol of the given item number.
1512  @param proto_id protocol id (0-indexed) */
1513 extern void proto_set_cant_toggle(const int proto_id);
1514
1515 /** Checks for existence any protocol or field within a tree.
1516  @param tree "Protocols" are assumed to be a child of the [empty] root node.
1517  @param id hfindex of protocol or field
1518  @return TRUE = found, FALSE = not found
1519  @todo add explanation of id parameter */
1520 extern gboolean proto_check_for_protocol_or_field(const proto_tree* tree, const int id);
1521
1522 /** Return GPtrArray* of field_info pointers for all hfindex that appear in
1523     tree. Only works with primed trees, and is fast.
1524  @param tree tree of interest
1525  @param hfindex primed hfindex
1526  @return GPtrArry pointer */
1527 extern GPtrArray* proto_get_finfo_ptr_array(const proto_tree *tree, const int hfindex);
1528
1529 /** Return whether we're tracking any interesting fields.
1530     Only works with primed trees, and is fast.
1531  @param tree tree of interest
1532  @return TRUE if we're tracking interesting fields */
1533 extern gboolean proto_tracking_interesting_fields(const proto_tree *tree);
1534
1535 /** Return GPtrArray* of field_info pointers for all hfindex that appear in
1536     tree. Works with any tree, primed or unprimed, and is slower than
1537     proto_get_finfo_ptr_array because it has to search through the tree.
1538  @param tree tree of interest
1539  @param hfidex index of field info of interest
1540  @return GPtrArry pointer */
1541 extern GPtrArray* proto_find_finfo(proto_tree *tree, const int hfindex);
1542
1543 /** Return GPtrArray* of field_info pointers containg all hfindexes that appear
1544     in tree.
1545  @param tree tree of interest
1546  @return GPtrArry pointer */
1547 extern GPtrArray* proto_all_finfos(proto_tree *tree);
1548
1549 /** Dumps a glossary of the protocol registrations to STDOUT */
1550 extern void proto_registrar_dump_protocols(void);
1551
1552 /** Dumps a glossary of the field value strings or true/false strings to STDOUT */
1553 extern void proto_registrar_dump_values(void);
1554
1555 /** Dumps a glossary of the protocol and field registrations to STDOUT.
1556  * Format 1 is the original format. Format 2 includes the base (for integers)
1557  * and the blurb. */
1558 extern void proto_registrar_dump_fields(const int format);
1559
1560
1561
1562 /** Points to the first element of an array of Booleans, indexed by
1563    a subtree item type. That array element is TRUE if subtrees of
1564    an item of that type are to be expanded. With MSVC and a
1565    libwireshark.dll, we need a special declaration. */
1566 WS_VAR_IMPORT gboolean       *tree_is_expanded;
1567
1568 /** Number of elements in the tree_is_expanded array. With MSVC and a
1569  * libwireshark.dll, we need a special declaration. */
1570 WS_VAR_IMPORT int           num_tree_types;
1571
1572 /** glib doesn't have g_ptr_array_len of all things!*/
1573 #ifndef g_ptr_array_len
1574 #define g_ptr_array_len(a)      ((a)?(a)->len:0)
1575 #endif
1576
1577 /** Get number of bits of a header_field.
1578  @param hfinfo header_field
1579  @return the bitwidth */
1580 extern int
1581 hfinfo_bitwidth(const header_field_info *hfinfo);
1582
1583
1584
1585
1586 #include "epan.h"
1587
1588 /** Can we do a "match selected" on this field.
1589  @param finfo field_info
1590  @param edt epan dissecting
1591  @return TRUE if we can do a "match selected" on the field, FALSE otherwise. */
1592 extern gboolean
1593 proto_can_match_selected(field_info *finfo, epan_dissect_t *edt);
1594
1595 /** Construct a "match selected" display filter string.
1596  @param finfo field_info
1597  @param edt epan dissecting
1598  @return the display filter string */
1599 extern char*
1600 proto_construct_match_selected_string(field_info *finfo, epan_dissect_t *edt);
1601
1602 /** Find field from offset in tvb.
1603  @param tree tree of interest
1604  @param offset offset in the tvb
1605  @param tvb the tv buffer
1606  @return the corresponding field_info */
1607 extern field_info*
1608 proto_find_field_from_offset(proto_tree *tree, guint offset, tvbuff_t *tvb);
1609
1610 /** This function will dissect a sequence of bytes that describe a bitmask.
1611  @param tree the tree to append this item to
1612  @param tvb the tv buffer of the current data
1613  @param offset start of data in tvb
1614  @param hf_hdr an 8/16/24/32 bit integer that describes the bitmask to be dissected.
1615         This field will form an expansion under which the individual fields of the
1616         bitmask is dissected and displayed.
1617         This field must be of the type FT_[U]INT{8|16|24|32}.
1618  @param ett subtree index
1619  @param fields an array of pointers to int that lists all the fields of the
1620         bitmask. These fields can be either of the type FT_BOOLEAN for flags
1621         or another integer of the same type/size as hf_hdr with a mask specified.
1622         This array is terminated by a NULL entry.
1623         FT_BOOLEAN bits that are set to 1 will have the name added to the expansion.
1624         FT_integer fields that have a value_string attached will have the
1625         matched string displayed on the expansion line.
1626  @param little_endian big or little endian byte representation
1627  @return the newly created item */
1628 extern proto_item *
1629 proto_tree_add_bitmask(proto_tree *tree, tvbuff_t *tvb, const guint offset,
1630                 const int hf_hdr, const gint ett, const int **fields, const gboolean little_endian);
1631
1632 /** Add a text with a subtree of bitfields.
1633  @param tree the tree to append this item to
1634  @param tvb the tv buffer of the current data
1635  @param offset start of data in tvb
1636  @param name field name (NULL if bitfield contents should be used)
1637  @param fallback field name if none of bitfields were usable
1638  @param ett subtree index
1639  @param fields NULL-terminated array of bitfield indexes
1640  @param little_endian big or little endian byte representation
1641  @return the newly created item */
1642 extern proto_item *
1643 proto_tree_add_bitmask_text(proto_tree *tree, tvbuff_t *tvb, const guint offset, const guint len,
1644                 const char *name, const char *fallback,
1645                 const gint ett, const int **fields, const gboolean little_endian, const int flags);
1646
1647 #define BMT_NO_APPEND   0x01    /**< Don't change the title at all */
1648 #define BMT_NO_INT      0x02    /**< Don't add integral (non-boolean) fields to title */
1649 #define BMT_NO_FALSE    0x04    /**< Don't add booleans unless they're TRUE */
1650 #define BMT_NO_TFS      0x08    /**< Don't use true_false_string while formatting booleans */
1651
1652 /** Add bits to a proto_tree, using the text label registered to that item.
1653    The item is extracted from the tvbuff handed to it.
1654  @param tree the tree to append this item to
1655  @param hfindex field index. Fields for use with this function should have bitmask==0.
1656  @param tvb the tv buffer of the current data
1657  @param bit_offset start of data in tvb expressed in bits
1658  @param no_of_bits length of data in tvb expressed in bits
1659  @param little_endian big or little endian byte representation
1660  @return the newly created item */
1661 extern proto_item *
1662 proto_tree_add_bits_item(proto_tree *tree, const int hf_index, tvbuff_t *tvb, const gint bit_offset, const gint no_of_bits, const gboolean little_endian);
1663
1664 /** Add bits to a proto_tree, using the text label registered to that item.
1665    The item is extracted from the tvbuff handed to it.
1666  @param tree the tree to append this item to
1667  @param hfindex field index. Fields for use with this function should have bitmask==0.
1668  @param tvb the tv buffer of the current data
1669  @param bit_offset start of data in tvb expressed in bits
1670  @param no_of_bits length of data in tvb expressed in bits
1671  @param return_value if a pointer is passed here the value is returned.
1672  @param little_endian big or little endian byte representation
1673  @return the newly created item */
1674 extern proto_item *
1675 proto_tree_add_bits_ret_val(proto_tree *tree, const int hf_index, tvbuff_t *tvb, const gint bit_offset, const gint no_of_bits, guint64 *return_value, const gboolean little_endian);
1676
1677 /** Add bits for a FT_UINT8, FT_UINT16, FT_UINT24 or FT_UINT32
1678     header field to a proto_tree, with the format generating the
1679     string for the value and with the field name being included automatically.
1680  @param tree the tree to append this item to
1681  @param hfindex field index
1682  @param tvb the tv buffer of the current data
1683  @param bit_offset start of data in tvb expressed in bits
1684  @param no_of_bits length of data in tvb expressed in bit
1685  @param value data to display
1686  @param format printf like format string
1687  @param ... printf like parameters
1688  @return the newly created item */
1689 extern proto_item *
1690 proto_tree_add_uint_bits_format_value(proto_tree *tree, const int hf_index, tvbuff_t *tvb, const gint bit_offset, const gint no_of_bits,
1691         guint32 value, const char *format, ...) G_GNUC_PRINTF(7,8);
1692
1693 /** Add bits for a FT_BOOLEAN header field to a proto_tree, with
1694     the format generating the string for the value and with the field
1695     name being included automatically.
1696  @param tree the tree to append this item to
1697  @param hfindex field index
1698  @param tvb the tv buffer of the current data
1699  @param bit_offset start of data in tvb expressed in bits
1700  @param no_of_bits length of data in tvb expressed in bit
1701  @param value data to display
1702  @param format printf like format string
1703  @param ... printf like parameters
1704  @return the newly created item */
1705 extern proto_item *
1706 proto_tree_add_boolean_bits_format_value(proto_tree *tree, const int hf_index, tvbuff_t *tvb, const gint bit_offset, const gint no_of_bits,
1707         guint32 value, const char *format, ...) G_GNUC_PRINTF(7,8);
1708
1709 /** Add bits for a FT_INT8, FT_INT16, FT_INT24 or FT_INT32
1710     header field to a proto_tree, with the format generating the
1711     string for the value and with the field name being included automatically.
1712  @param tree the tree to append this item to
1713  @param hfindex field index
1714  @param tvb the tv buffer of the current data
1715  @param bit_offset start of data in tvb expressed in bits
1716  @param no_of_bits length of data in tvb expressed in bit
1717  @param value data to display
1718  @param format printf like format string
1719  @param ... printf like parameters
1720  @return the newly created item */
1721 extern proto_item *
1722 proto_tree_add_int_bits_format_value(proto_tree *tree, const int hf_index, tvbuff_t *tvb, const gint bit_offset, const gint no_of_bits,
1723         gint32 value, const char *format, ...) G_GNUC_PRINTF(7,8);
1724
1725 /** Add bits for a FT_FLOAT header field to a proto_tree, with
1726     the format generating the string for the value and with the field
1727     name being included automatically.
1728  @param tree the tree to append this item to
1729  @param hfindex field index
1730  @param tvb the tv buffer of the current data
1731  @param bit_offset start of data in tvb expressed in bits
1732  @param no_of_bits length of data in tvb expressed in bit
1733  @param value data to display
1734  @param format printf like format string
1735  @param ... printf like parameters
1736  @return the newly created item */
1737 extern proto_item *
1738 proto_tree_add_float_bits_format_value(proto_tree *tree, const int hf_index, tvbuff_t *tvb, const gint bit_offset, const gint no_of_bits,
1739         float value, const char *format, ...) G_GNUC_PRINTF(7,8);
1740
1741 /** Check if given string is a valid field name
1742  @param field_name the field name to check
1743  @return 0 if valid, else first illegal character */
1744 extern guchar
1745 proto_check_field_name(const gchar *field_name);
1746
1747
1748 /** Check if given string is a valid field name
1749  @param field_id the field id used for custom column
1750  @param result the buffer to fill with the field string
1751  @param expr the filter expression
1752  @param aize the size of the string buffer */
1753 const gchar *
1754 proto_custom_set(proto_tree* tree, const int field_id,
1755                              gchar *result,
1756                              gchar *expr, const int size );
1757
1758 #ifdef __cplusplus
1759 }
1760 #endif /* __cplusplus */
1761
1762 #endif /* proto.h */