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