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