Removed trailing whitespaces from .h and .c files using the
[obnox/wireshark/wip.git] / ptvcursor.h
1 /* ptvcursor.h
2  *
3  * Proto Tree TVBuff cursor
4  * Gilbert Ramirez <gram@alumni.rice.edu>
5  *
6  * $Id: ptvcursor.h,v 1.7 2002/08/28 21:00:41 jmayer Exp $
7  *
8  * Ethereal - Network traffic analyzer
9  * By Gerald Combs <gerald@ethereal.com>
10  * Copyright 2000 Gerald Combs
11  *
12  * This program is free software; you can redistribute it and/or
13  * modify it under the terms of the GNU General Public License
14  * as published by the Free Software Foundation; either version 2
15  * of the License, or (at your option) any later version.
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20  * GNU General Public License for more details.
21  *
22  * You should have received a copy of the GNU General Public License
23  * along with this program; if not, write to the Free Software
24  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
25  */
26
27 #ifndef __PTVCURSOR_H__
28 #define __PTVCURSOR_H__
29
30 #ifdef HAVE_CONFIG_H
31 # include "config.h"
32 #endif
33
34 #include <glib.h>
35 #include <epan/packet.h>
36
37 typedef struct ptvcursor ptvcursor_t;
38
39 /* Allocates an initializes a ptvcursor_t with 3 variables:
40  *      proto_tree, tvbuff, and offset. */
41 ptvcursor_t*
42 ptvcursor_new(proto_tree*, tvbuff_t*, gint);
43
44 /* Gets data from tvbuff, adds it to proto_tree, increments offset,
45  * and returns proto_item* */
46 proto_item*
47 ptvcursor_add(ptvcursor_t*, int hf, gint length, gboolean endianness);
48
49
50 /* Gets data from tvbuff, adds it to proto_tree, *DOES NOT* increment
51  * offset, and returns proto_item* */
52 proto_item*
53 ptvcursor_add_no_advance(ptvcursor_t*, int hf, gint length, gboolean endianness);
54
55 /* Advance the ptvcursor's offset within its tvbuff without
56  * adding anything to the proto_tree. */
57 void
58 ptvcursor_advance(ptvcursor_t* ptvc, gint length);
59
60 /* Frees memory for ptvcursor_t, but nothing deeper than that. */
61 void
62 ptvcursor_free(ptvcursor_t*);
63
64 /* Returns tvbuff. */
65 tvbuff_t*
66 ptvcursor_tvbuff(ptvcursor_t*);
67
68 /* Returns current offset. */
69 gint
70 ptvcursor_current_offset(ptvcursor_t*);
71
72 /* Returns the proto_tree* */
73 proto_tree*
74 ptvcursor_tree(ptvcursor_t* ptvc);
75
76 /* Sets a new proto_tree* for the ptvcursor_t */
77 void
78 ptvcursor_set_tree(ptvcursor_t* ptvc, proto_tree *tree);
79
80 #endif /* __PTVCURSOR_H__ */