aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-rmt-fec.h
blob: ca2eb9ac216c960bfdf4abc0e1df1f44a0e07aa2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
/* packet-rmt-fec.h
 * Reliable Multicast Transport (RMT)
 * FEC Building Block function definitions
 * Copyright 2005, Stefano Pettini <spettini@users.sourceforge.net>
 *
 * $Id$
 *
 * Ethereal - Network traffic analyzer
 * By Gerald Combs <gerald@ethereal.com>
 * Copyright 1998 Gerald Combs
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 */
 
#ifndef __PACKET_RMT_FEC__
#define __PACKET_RMT_FEC__

#include "packet-rmt-common.h"

/* String tables external references */
extern const value_string string_fec_encoding_id[];

/* Type definitions */
/* ================ */

struct _fec
{
	gboolean encoding_id_present;
	gboolean instance_id_present;
	guint8 encoding_id;
	guint8 instance_id;
	guint64 transfer_length;
	guint32 encoding_symbol_length;
	guint32 max_source_block_length;
	guint32 max_number_encoding_symbols;
	gboolean sbn_present;
	gboolean sbl_present;
	gboolean esi_present;
	guint32 sbn;
	guint32 sbl;
	guint32 esi;
};

/* Ethereal stuff */
/* ============== */

/* FEC header field definitions */
struct _fec_hf
{
	int header;
	int encoding_id;
	int instance_id;
	int sbn;
	int sbl;
	int esi;
	int fti_header;
	int fti_transfer_length;
	int fti_encoding_symbol_length;
	int fti_max_source_block_length;
	int fti_max_number_encoding_symbols;
};

/* FEC subtrees */
struct _fec_ett
{
	gint main;
};

/* FEC preferences */
struct _fec_prefs
{
	gboolean dummy;
};

/* FEC pointers */
struct _fec_ptr
{
	struct _fec *fec;
	struct _fec_hf *hf;
	struct _fec_ett *ett;
	struct _fec_prefs *prefs;
};

/* Macros to generate static arrays */

#define FEC_FIELD_ARRAY(base_structure, base_protocol)	\
	{ &base_structure.header,	\
		{ "Forward Error Correction (FEC) header", base_protocol ".fec", FT_NONE, BASE_NONE, NULL, 0x0, "", HFILL }},	\
	{ &base_structure.encoding_id,	\
		{ "FEC Encoding ID", base_protocol ".fec.encoding_id", FT_UINT8, BASE_DEC, VALS(string_fec_encoding_id), 0x0, "", HFILL }},	\
	{ &base_structure.instance_id,	\
		{ "FEC Instance ID", base_protocol ".fec.instance_id", FT_UINT8, BASE_DEC, NULL, 0x0, "", HFILL }},	\
	{ &base_structure.sbn,	\
		{ "Source Block Number", base_protocol ".fec.sbn", FT_UINT32, BASE_DEC, NULL, 0x0, "", HFILL }},	\
	{ &base_structure.sbl,	\
		{ "Source Block Length", base_protocol ".fec.sbl", FT_UINT32, BASE_DEC, NULL, 0x0, "", HFILL }},	\
	{ &base_structure.esi,	\
		{ "Encoding Symbol ID", base_protocol ".fec.esi", FT_UINT32, BASE_HEX, NULL, 0x0, "", HFILL }},	\
	{ &base_structure.fti_header,	\
		{ "FEC Object Transmission Information", base_protocol ".fec.fti", FT_NONE, BASE_NONE, NULL, 0x0, "", HFILL }},	\
	{ &base_structure.fti_transfer_length,	\
		{ "Transfer Length", base_protocol ".fec.fti.transfer_length", FT_UINT64, BASE_DEC, NULL, 0x0, "", HFILL }},	\
	{ &base_structure.fti_encoding_symbol_length,	\
		{ "Encoding Symbol Length", base_protocol ".fec.fti.encoding_symbol_length", FT_UINT32, BASE_DEC, NULL, 0x0, "", HFILL }},	\
	{ &base_structure.fti_max_source_block_length,	\
		{ "Maximum Source Block Length", base_protocol ".fec.fti.max_source_block_length", FT_UINT32, BASE_DEC, NULL, 0x0, "", HFILL }},	\
	{ &base_structure.fti_max_number_encoding_symbols,	\
		{ "Maximum Number of Encoding Symbols", base_protocol ".fec.fti.max_number_encoding_symbols", FT_UINT32, BASE_DEC, NULL, 0x0, "", HFILL }}

#define FEC_SUBTREE_ARRAY(base_structure) \
	&base_structure.main
	
/* FEC exported functions */
/* ====================== */

void fec_info_column(struct _fec *fec, packet_info *pinfo);

void fec_dissector(struct _fec_ptr f, tvbuff_t *tvb, proto_tree *tree, guint *offset);
void fec_dissector_free(struct _fec *fec);

void fec_decode_ext_fti(struct _ext *e, tvbuff_t *tvb, proto_tree *tree, gint ett, struct _fec_ptr f);

void fec_prefs_set_default(struct _fec_prefs *prefs);
void fec_prefs_register(struct _fec_prefs *prefs, module_t *module);

#endif