QSIG fully implemented
[obnox/wireshark/wip.git] / epan / dissectors / packet-rmt-lct.h
1 /* packet-rmt-lct.h
2  * Reliable Multicast Transport (RMT)
3  * LCT Building Block function definitions
4  * Copyright 2005, Stefano Pettini <spettini@users.sourceforge.net>
5  *
6  * $Id$
7  *
8  * Wireshark - Network traffic analyzer
9  * By Gerald Combs <gerald@wireshark.org>
10  * Copyright 1998 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 __PACKET_RMT_LCT__
28 #define __PACKET_RMT_LCT__
29
30 #include "packet-rmt-common.h"
31 #include "packet-rmt-fec.h"
32
33 /* Type definitions */
34 /* ================ */
35
36 /* Logical LCT header representation */
37 struct _lct
38 {
39         guint8 version;
40         guint8 cci_size;
41         guint8 tsi_size;
42         guint8 toi_size;
43         gboolean tsi_present;
44         gboolean toi_present;
45         gboolean sct_present;
46         gboolean ert_present;
47         gboolean close_session;
48         gboolean close_object;
49         guint16 hlen;
50         guint8 codepoint;
51         guint8 *cci;
52         guint64 tsi;
53         guint64 toi;
54         const guint8 *toi_extended;
55         nstime_t sct;
56         nstime_t ert;
57         GArray *ext;
58 };
59
60 /* Wireshark stuff */
61 /* ============== */
62
63 /* LCT header field definitions */
64 struct _lct_hf
65 {
66         int header;
67         int version;
68         int fsize_header;
69         int fsize_cci;
70         int fsize_tsi;
71         int fsize_toi;
72         int flags_header;
73         int flags_sct_present;
74         int flags_ert_present;
75         int flags_close_session;
76         int flags_close_object;
77         int hlen;
78         int codepoint;
79         int cci;
80         int tsi;
81         int toi;
82         int toi_extended;
83         int sct;
84         int ert;
85         int ext;
86 };
87
88 /* LCT subtrees */
89 struct _lct_ett
90 {
91         gint main;
92
93         gint fsize;
94         gint flags;
95         gint ext;
96         gint ext_ext;
97 };
98
99 /* LCT preferences */
100
101 #define LCT_PREFS_EXT_192_NONE 0
102 #define LCT_PREFS_EXT_192_FLUTE 1
103
104 #define LCT_PREFS_EXT_193_NONE 0
105 #define LCT_PREFS_EXT_193_FLUTE 1
106
107 struct _lct_prefs
108 {
109         gboolean codepoint_as_fec_encoding;
110         gint ext_192;
111         gint ext_193;
112 };
113
114 /* LCT pointers */
115 struct _lct_ptr
116 {
117         struct _lct *lct;
118         struct _lct_hf *hf;
119         struct _lct_ett *ett;
120         struct _lct_prefs *prefs;
121 };
122
123 /* Macros to generate static arrays */
124
125 #define LCT_FIELD_ARRAY(base_structure, base_protocol)  \
126                 { &base_structure.header,       \
127                         { "Layered Coding Transport (LCT) header", base_protocol ".lct", FT_NONE, BASE_NONE, NULL, 0x0, "", HFILL }},   \
128                 { &base_structure.version,      \
129                         { "Version", base_protocol ".lct.version", FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL }}, \
130                 { &base_structure.fsize_header, \
131                         { "Field sizes (bytes)", base_protocol ".lct.fsize", FT_NONE, BASE_NONE, NULL, 0x0, "", HFILL }},       \
132                 { &base_structure.fsize_cci,    \
133                         { "Congestion Control Information field size", base_protocol ".lct.fsize.cci", FT_UINT8,        BASE_DEC, NULL, 0x0, "", HFILL }},      \
134                 { &base_structure.fsize_tsi,    \
135                         { "Transport Session Identifier field size", base_protocol ".lct.fsize.tsi", FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL }},       \
136                 { &base_structure.fsize_toi,    \
137                         { "Transport Object Identifier field size", base_protocol ".lct.fsize.toi", FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL }},        \
138                 { &base_structure.flags_header, \
139                         { "Flags", base_protocol ".lct.flags", FT_NONE, BASE_NONE, NULL, 0x0, "", HFILL }},     \
140                 { &base_structure.flags_sct_present,    \
141                         { "Sender Current Time present flag", base_protocol ".lct.flags.sct_present", FT_BOOLEAN, BASE_NONE, TFS(&boolean_set_notset), 0x0, "", HFILL }},       \
142                 { &base_structure.flags_ert_present,    \
143                         { "Expected Residual Time present flag", base_protocol ".lct.flags.ert_present", FT_BOOLEAN, BASE_NONE, TFS(&boolean_set_notset), 0x0, "", HFILL }},    \
144                 { &base_structure.flags_close_session,  \
145                         { "Close Session flag", base_protocol ".lct.flags.close_session", FT_BOOLEAN, BASE_NONE, TFS(&boolean_set_notset), 0x0, "", HFILL }},   \
146                 { &base_structure.flags_close_object,   \
147                         { "Close Object flag", base_protocol ".lct.flags.close_object", FT_BOOLEAN, BASE_NONE, TFS(&boolean_set_notset), 0x0, "", HFILL }},     \
148                 { &base_structure.hlen, \
149                         { "Header length", base_protocol ".lct.hlen", FT_UINT16, BASE_DEC, NULL, 0x0, "", HFILL }},     \
150                 { &base_structure.codepoint,    \
151                         { "Codepoint", base_protocol ".lct.codepoint", FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL }},     \
152                 { &base_structure.cci,  \
153                         { "Congestion Control Information", base_protocol ".lct.cci", FT_BYTES, BASE_NONE, NULL, 0x0, "", HFILL }},     \
154                 { &base_structure.tsi,  \
155                         { "Transport Session Identifier", base_protocol ".lct.tsi", FT_UINT64, BASE_DEC, NULL, 0x0, "", HFILL }},       \
156                 { &base_structure.toi,  \
157                         { "Transport Object Identifier (up to 64 bites)", base_protocol ".lct.toi", FT_UINT64, BASE_DEC, NULL, 0x0, "", HFILL }},       \
158                 { &base_structure.toi_extended, \
159                         { "Transport Object Identifier (up to 112 bits)", base_protocol ".lct.toi_extended", FT_BYTES, BASE_NONE, NULL, 0x0, "", HFILL }},      \
160                 { &base_structure.sct,  \
161                         { "Sender Current Time", base_protocol ".lct.sct", FT_RELATIVE_TIME, BASE_NONE, NULL, 0x0, "", HFILL }},        \
162                 { &base_structure.ert,  \
163                         { "Expected Residual Time", base_protocol ".lct.ert", FT_RELATIVE_TIME, BASE_NONE, NULL, 0x0, "", HFILL }},     \
164                 { &base_structure.ext,  \
165                         { "Extension count", base_protocol ".lct.ext", FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL }}
166
167 #define LCT_SUBTREE_ARRAY(base_structure) \
168         &base_structure.main,   \
169         &base_structure.fsize,  \
170         &base_structure.flags,  \
171         &base_structure.ext,    \
172         &base_structure.ext_ext
173
174 /* LCT exported functions */
175 /* ====================== */
176
177 void lct_info_column(struct _lct *lct, packet_info *pinfo);
178
179 void lct_dissector(struct _lct_ptr l, struct _fec_ptr f, tvbuff_t *tvb, proto_tree *tree, guint *offset);
180 void lct_dissector_free(struct _lct *lct);
181
182 void lct_prefs_set_default(struct _lct_prefs *prefs);
183 void lct_prefs_register(struct _lct_prefs *prefs, module_t *module);
184 void lct_ext_decode(struct _ext *e, struct _lct_prefs *prefs, tvbuff_t *tvb, proto_tree *tree, gint ett, struct _fec_ptr f);
185
186 #endif