MSWSP: add two more Property Sets
[wireshark-wip.git] / epan / dissectors / packet-dvb-s2-bb.c
blob93502a331795e2e90ebc94e3ea60f43dce7576b1
1 /* packet-dvb-s2-bb.c
2 * Routines for DVB Dynamic Mode Adaption dissection
3 * refer to
4 * http://satlabs.org/pdf/sl_561_Mode_Adaptation_Input_and_Output_Interfaces_for_DVB-S2_Equipment_v1.3.pdf
6 * Standards:
7 * ETSI EN 302 307 - Digital Video Broadcasting (DVB) - Framing Structure
8 * ETSI TS 102 606 - Digital Video Broadcasting (DVB) - Generic Stream Encapsulation (GSE) Protocol
10 * Copyright 2012, Tobias Rutz <tobias.rutz@work-microwave.de>
12 * $Id$
14 * Wireshark - Network traffic analyzer
15 * By Gerald Combs <gerald@wireshark.org>
16 * Copyright 1998 Gerald Combs
18 * This program is free software; you can redistribute it and/or modify
19 * it under the terms of the GNU General Public License as published by
20 * the Free Software Foundation; either version 2 of the License, or
21 * (at your option) any later version.
23 * This program is distributed in the hope that it will be useful,
24 * but WITHOUT ANY WARRANTY; without even the implied warranty of
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26 * GNU General Public License for more details.
28 * You should have received a copy of the GNU General Public License along
29 * with this program; if not, write to the Free Software Foundation, Inc.,
30 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
33 #include "config.h"
35 #include <glib.h>
36 #include <epan/packet.h>
37 #include <epan/prefs.h>
38 #include <epan/etypes.h>
40 #define BIT_IS_SET(var, bit) ((var) & (1 << (bit)))
41 #define BIT_IS_CLEAR(var, bit) !BIT_IS_SET(var, bit)
43 #define DVB_S2_MODEADAPT_MINSIZE (DVB_S2_MODEADAPT_OUTSIZE + DVB_S2_BB_OFFS_CRC + 1)
44 #define DVB_S2_MODEADAPT_INSIZE 2
45 #define DVB_S2_MODEADAPT_OUTSIZE 4
47 /* CRC table crc-8, poly=0xD5 */
48 static guint8 crc8_table[256] = {
49 0x00, 0xD5, 0x7F, 0xAA, 0xFE, 0x2B, 0x81, 0x54, 0x29, 0xFC, 0x56, 0x83, 0xD7, 0x02, 0xA8, 0x7D,
50 0x52, 0x87, 0x2D, 0xF8, 0xAC, 0x79, 0xD3, 0x06, 0x7B, 0xAE, 0x04, 0xD1, 0x85, 0x50, 0xFA, 0x2F,
51 0xA4, 0x71, 0xDB, 0x0E, 0x5A, 0x8F, 0x25, 0xF0, 0x8D, 0x58, 0xF2, 0x27, 0x73, 0xA6, 0x0C, 0xD9,
52 0xF6, 0x23, 0x89, 0x5C, 0x08, 0xDD, 0x77, 0xA2, 0xDF, 0x0A, 0xA0, 0x75, 0x21, 0xF4, 0x5E, 0x8B,
53 0x9D, 0x48, 0xE2, 0x37, 0x63, 0xB6, 0x1C, 0xC9, 0xB4, 0x61, 0xCB, 0x1E, 0x4A, 0x9F, 0x35, 0xE0,
54 0xCF, 0x1A, 0xB0, 0x65, 0x31, 0xE4, 0x4E, 0x9B, 0xE6, 0x33, 0x99, 0x4C, 0x18, 0xCD, 0x67, 0xB2,
55 0x39, 0xEC, 0x46, 0x93, 0xC7, 0x12, 0xB8, 0x6D, 0x10, 0xC5, 0x6F, 0xBA, 0xEE, 0x3B, 0x91, 0x44,
56 0x6B, 0xBE, 0x14, 0xC1, 0x95, 0x40, 0xEA, 0x3F, 0x42, 0x97, 0x3D, 0xE8, 0xBC, 0x69, 0xC3, 0x16,
57 0xEF, 0x3A, 0x90, 0x45, 0x11, 0xC4, 0x6E, 0xBB, 0xC6, 0x13, 0xB9, 0x6C, 0x38, 0xED, 0x47, 0x92,
58 0xBD, 0x68, 0xC2, 0x17, 0x43, 0x96, 0x3C, 0xE9, 0x94, 0x41, 0xEB, 0x3E, 0x6A, 0xBF, 0x15, 0xC0,
59 0x4B, 0x9E, 0x34, 0xE1, 0xB5, 0x60, 0xCA, 0x1F, 0x62, 0xB7, 0x1D, 0xC8, 0x9C, 0x49, 0xE3, 0x36,
60 0x19, 0xCC, 0x66, 0xB3, 0xE7, 0x32, 0x98, 0x4D, 0x30, 0xE5, 0x4F, 0x9A, 0xCE, 0x1B, 0xB1, 0x64,
61 0x72, 0xA7, 0x0D, 0xD8, 0x8C, 0x59, 0xF3, 0x26, 0x5B, 0x8E, 0x24, 0xF1, 0xA5, 0x70, 0xDA, 0x0F,
62 0x20, 0xF5, 0x5F, 0x8A, 0xDE, 0x0B, 0xA1, 0x74, 0x09, 0xDC, 0x76, 0xA3, 0xF7, 0x22, 0x88, 0x5D,
63 0xD6, 0x03, 0xA9, 0x7C, 0x28, 0xFD, 0x57, 0x82, 0xFF, 0x2A, 0x80, 0x55, 0x01, 0xD4, 0x7E, 0xAB,
64 0x84, 0x51, 0xFB, 0x2E, 0x7A, 0xAF, 0x05, 0xD0, 0xAD, 0x78, 0xD2, 0x07, 0x53, 0x86, 0x2C, 0xF9
68 static dissector_handle_t ip_handle;
69 static dissector_handle_t ipv6_handle;
71 void proto_register_dvb_s2_modeadapt(void);
72 void proto_reg_handoff_dvb_s2_modeadapt(void);
74 /* preferences */
75 static gboolean dvb_s2_enable = FALSE;
76 static gboolean dvb_s2_full_dissection = FALSE;
78 /* Initialize the protocol and registered fields */
79 static int proto_dvb_s2_modeadapt = -1;
80 static int hf_dvb_s2_modeadapt_sync = -1;
81 static int hf_dvb_s2_modeadapt_acm = -1;
82 static int hf_dvb_s2_modeadapt_acm_fecframe = -1;
83 static int hf_dvb_s2_modeadapt_acm_pilot = -1;
84 static int hf_dvb_s2_modeadapt_acm_modcod = -1;
85 static int hf_dvb_s2_modeadapt_cni = -1;
86 static int hf_dvb_s2_modeadapt_frameno = -1;
88 static int proto_dvb_s2_bb = -1;
89 static int hf_dvb_s2_bb_matype1 = -1;
90 static int hf_dvb_s2_bb_matype1_gs = -1;
91 static int hf_dvb_s2_bb_matype1_mis = -1;
92 static int hf_dvb_s2_bb_matype1_acm = -1;
93 static int hf_dvb_s2_bb_matype1_issyi = -1;
94 static int hf_dvb_s2_bb_matype1_npd = -1;
95 static int hf_dvb_s2_bb_matype1_ro = -1;
96 static int hf_dvb_s2_bb_matype2 = -1;
97 static int hf_dvb_s2_bb_upl = -1;
98 static int hf_dvb_s2_bb_dfl = -1;
99 static int hf_dvb_s2_bb_sync = -1;
100 static int hf_dvb_s2_bb_syncd = -1;
101 static int hf_dvb_s2_bb_crc = -1;
103 static int proto_dvb_s2_gse = -1;
104 static int hf_dvb_s2_gse_hdr = -1;
105 static int hf_dvb_s2_gse_hdr_start = -1;
106 static int hf_dvb_s2_gse_hdr_stop = -1;
107 static int hf_dvb_s2_gse_hdr_labeltype = -1;
108 static int hf_dvb_s2_gse_hdr_length = -1;
109 static int hf_dvb_s2_gse_proto = -1;
110 static int hf_dvb_s2_gse_label6 = -1;
111 static int hf_dvb_s2_gse_label3 = -1;
112 static int hf_dvb_s2_gse_fragid = -1;
113 static int hf_dvb_s2_gse_totlength = -1;
114 static int hf_dvb_s2_gse_exthdr = -1;
115 static int hf_dvb_s2_gse_data = -1;
116 static int hf_dvb_s2_gse_crc32 = -1;
118 /* Initialize the subtree pointers */
119 static gint ett_dvb_s2_modeadapt = -1;
120 static gint ett_dvb_s2_modeadapt_acm = -1;
122 static gint ett_dvb_s2_bb = -1;
123 static gint ett_dvb_s2_bb_matype1 = -1;
125 static gint ett_dvb_s2_gse = -1;
126 static gint ett_dvb_s2_gse_hdr = -1;
128 /* *** DVB-S2 Modeadaption Header *** */
130 /* first byte */
131 #define DVB_S2_MODEADAPT_OFFS_SYNCBYTE 0
132 #define DVB_S2_MODEADAPT_SYNCBYTE 0xB8
134 /* second byte */
135 #define DVB_S2_MODEADAPT_OFFS_ACMBYTE 1
136 #define DVB_S2_MODEADAPT_MODCODS_MASK 0x1F
137 static const value_string modeadapt_modcods[] = {
138 { 0, "DUMMY PLFRAME"},
139 { 1, "QPSK 1/4"},
140 { 2, "QPSK 1/3"},
141 { 3, "QPSK 2/5"},
142 { 4, "QPSK 1/2"},
143 { 5, "QPSK 3/5"},
144 { 6, "QPSK 2/3"},
145 { 7, "QPSK 3/4"},
146 { 8, "QPSK 4/5"},
147 { 9, "QPSK 5/6"},
148 {10, "QPSK 8/9"},
149 {11, "QPSK 9/10"},
150 {12, "8PSK 3/5"},
151 {13, "8PSK 2/3"},
152 {14, "8PSK 3/4"},
153 {15, "8PSK 5/6"},
154 {16, "8PSK 8/9"},
155 {17, "8PSK 9/10"},
156 {18, "16APSK 2/3"},
157 {19, "16APSK 3/4"},
158 {20, "16APSK 4/5"},
159 {21, "16APSK 5/6"},
160 {22, "16APSK 8/9"},
161 {23, "16APSK 9/10"},
162 {24, "32APSK 3/4"},
163 {25, "32APSK 4/5"},
164 {26, "32APSK 5/6"},
165 {27, "32APSK 8/9"},
166 {28, "32APSK 9/10"},
167 {29, "reserved"},
168 {30, "reserved"},
169 {31, "reserved"},
170 { 0, NULL}
172 static value_string_ext modeadapt_modcods_ext = VALUE_STRING_EXT_INIT(modeadapt_modcods);
174 #define DVB_S2_MODEADAPT_PILOTS_MASK 0x20
175 static const true_false_string tfs_modeadapt_pilots = {
176 "pilots on",
177 "pilots off"
180 #define DVB_S2_MODEADAPT_FECFRAME_MASK 0x40
181 static const true_false_string tfs_modeadapt_fecframe = {
182 "short",
183 "normal"
186 /* third byte */
187 #define DVB_S2_MODEADAPT_OFFS_CNI 2
188 static const value_string modeadapt_esno[] = {
189 { 0, "modem unlocked, SNR not available"},
190 { 1, "-1.000"},
191 { 2, "-0.875"},
192 { 3, "-0.750"},
193 { 4, "-0.625"},
194 { 5, "-0.500"},
195 { 6, "-0.375"},
196 { 7, "-0.250"},
197 { 8, "-0.125"},
198 { 9, "0.000"},
199 { 10, "0.125"},
200 { 11, "0.250"},
201 { 12, "0.375"},
202 { 13, "0.500"},
203 { 14, "0.625"},
204 { 15, "0.750"},
205 { 16, "0.875"},
206 { 17, "1.000"},
207 { 18, "1.125"},
208 { 19, "1.250"},
209 { 20, "1.375"},
210 { 21, "1.500"},
211 { 22, "1.625"},
212 { 23, "1.750"},
213 { 24, "1.875"},
214 { 25, "2.000"},
215 { 26, "2.125"},
216 { 27, "2.250"},
217 { 28, "2.375"},
218 { 29, "2.500"},
219 { 30, "2.625"},
220 { 31, "2.750"},
221 { 32, "2.875"},
222 { 33, "3.000"},
223 { 34, "3.125"},
224 { 35, "3.250"},
225 { 36, "3.375"},
226 { 37, "3.500"},
227 { 38, "3.625"},
228 { 39, "3.750"},
229 { 40, "3.875"},
230 { 41, "4.000"},
231 { 42, "4.125"},
232 { 43, "4.250"},
233 { 44, "4.375"},
234 { 45, "4.500"},
235 { 46, "4.625"},
236 { 47, "4.750"},
237 { 48, "4.875"},
238 { 49, "5.000"},
239 { 50, "5.125"},
240 { 51, "5.250"},
241 { 52, "5.375"},
242 { 53, "5.500"},
243 { 54, "5.625"},
244 { 55, "5.750"},
245 { 56, "5.875"},
246 { 57, "6.000"},
247 { 58, "6.125"},
248 { 59, "6.250"},
249 { 60, "6.375"},
250 { 61, "6.500"},
251 { 62, "6.625"},
252 { 63, "6.750"},
253 { 64, "6.875"},
254 { 65, "7.000"},
255 { 66, "7.125"},
256 { 67, "7.250"},
257 { 68, "7.375"},
258 { 69, "7.500"},
259 { 70, "7.625"},
260 { 71, "7.750"},
261 { 72, "7.875"},
262 { 73, "8.000"},
263 { 74, "8.125"},
264 { 75, "8.250"},
265 { 76, "8.375"},
266 { 77, "8.500"},
267 { 78, "8.625"},
268 { 79, "8.750"},
269 { 80, "8.875"},
270 { 81, "9.000"},
271 { 82, "9.125"},
272 { 83, "9.250"},
273 { 84, "9.375"},
274 { 85, "9.500"},
275 { 86, "9.625"},
276 { 87, "9.750"},
277 { 88, "9.875"},
278 { 89, "10.000"},
279 { 90, "10.125"},
280 { 91, "10.250"},
281 { 92, "10.375"},
282 { 93, "10.500"},
283 { 94, "10.625"},
284 { 95, "10.750"},
285 { 96, "10.875"},
286 { 97, "11.000"},
287 { 98, "11.125"},
288 { 99, "11.250"},
289 {100, "11.375"},
290 {101, "11.500"},
291 {102, "11.625"},
292 {103, "11.750"},
293 {104, "11.875"},
294 {105, "12.000"},
295 {106, "12.125"},
296 {107, "12.250"},
297 {108, "12.375"},
298 {109, "12.500"},
299 {110, "12.625"},
300 {111, "12.750"},
301 {112, "12.875"},
302 {113, "13.000"},
303 {114, "13.125"},
304 {115, "13.250"},
305 {116, "13.375"},
306 {117, "13.500"},
307 {118, "13.625"},
308 {119, "13.750"},
309 {120, "13.875"},
310 {121, "14.000"},
311 {122, "14.125"},
312 {123, "14.250"},
313 {124, "14.375"},
314 {125, "14.500"},
315 {126, "14.625"},
316 {127, "14.750"},
317 {128, "14.875"},
318 {129, "15.000"},
319 {130, "15.125"},
320 {131, "15.250"},
321 {132, "15.375"},
322 {133, "15.500"},
323 {134, "15.625"},
324 {135, "15.750"},
325 {136, "15.875"},
326 {137, "16.000"},
327 {138, "16.125"},
328 {139, "16.250"},
329 {140, "16.375"},
330 {141, "16.500"},
331 {142, "16.625"},
332 {143, "16.750"},
333 {144, "16.875"},
334 {145, "17.000"},
335 {146, "17.125"},
336 {147, "17.250"},
337 {148, "17.375"},
338 {149, "17.500"},
339 {150, "17.625"},
340 {151, "17.750"},
341 {152, "17.875"},
342 {153, "18.000"},
343 {154, "18.125"},
344 {155, "18.250"},
345 {156, "18.375"},
346 {157, "18.500"},
347 {158, "18.625"},
348 {159, "18.750"},
349 {160, "18.875"},
350 {161, "19.000"},
351 {162, "19.125"},
352 {163, "19.250"},
353 {164, "19.375"},
354 {165, "19.500"},
355 {166, "19.625"},
356 {167, "19.750"},
357 {168, "19.875"},
358 {169, "20.000"},
359 {170, "20.125"},
360 {171, "20.250"},
361 {172, "20.375"},
362 {173, "20.500"},
363 {174, "20.625"},
364 {175, "20.750"},
365 {176, "20.875"},
366 {177, "21.000"},
367 {178, "21.125"},
368 {179, "21.250"},
369 {180, "21.375"},
370 {181, "21.500"},
371 {182, "21.625"},
372 {183, "21.750"},
373 {184, "21.875"},
374 {185, "22.000"},
375 {186, "22.125"},
376 {187, "22.250"},
377 {188, "22.375"},
378 {189, "22.500"},
379 {190, "22.625"},
380 {191, "22.750"},
381 {192, "22.875"},
382 {193, "23.000"},
383 {194, "23.125"},
384 {195, "23.250"},
385 {196, "23.375"},
386 {197, "23.500"},
387 {198, "23.625"},
388 {199, "23.750"},
389 {200, "23.875"},
390 {201, "24.000"},
391 {202, "24.125"},
392 {203, "24.250"},
393 {204, "24.375"},
394 {205, "24.500"},
395 {206, "24.625"},
396 {207, "24.750"},
397 {208, "24.875"},
398 {209, "25.000"},
399 {210, "25.125"},
400 {211, "25.250"},
401 {212, "25.375"},
402 {213, "25.500"},
403 {214, "25.625"},
404 {215, "25.750"},
405 {216, "25.875"},
406 {217, "26.000"},
407 {218, "26.125"},
408 {219, "26.250"},
409 {220, "26.375"},
410 {221, "26.500"},
411 {222, "26.625"},
412 {223, "26.750"},
413 {224, "26.875"},
414 {225, "27.000"},
415 {226, "27.125"},
416 {227, "27.250"},
417 {228, "27.375"},
418 {229, "27.500"},
419 {230, "27.625"},
420 {231, "27.750"},
421 {232, "27.875"},
422 {233, "28.000"},
423 {234, "28.125"},
424 {235, "28.250"},
425 {236, "28.375"},
426 {237, "28.500"},
427 {238, "28.625"},
428 {239, "28.750"},
429 {240, "28.875"},
430 {241, "29.000"},
431 {242, "29.125"},
432 {243, "29.250"},
433 {244, "29.375"},
434 {245, "29.500"},
435 {246, "29.625"},
436 {247, "29.750"},
437 {248, "29.875"},
438 {249, "30.000"},
439 {250, "30.125"},
440 {251, "30.250"},
441 {252, "30.375"},
442 {253, "30.500"},
443 {254, "30.625"},
444 {255, ">30.750"},
445 { 0, NULL}
447 static value_string_ext modeadapt_esno_ext = VALUE_STRING_EXT_INIT(modeadapt_esno);
449 /* fourth byte */
450 #define DVB_S2_MODEADAPT_OFFS_FNO 3
452 /* *** DVB-S2 Base-Band Frame *** */
454 #define DVB_S2_BB_HEADER_LEN 10
456 #define DVB_S2_BB_OFFS_MATYPE1 0
457 #define DVB_S2_BB_GS_MASK 0xC0
458 static const value_string bb_gs[] = {
459 {0, "Generic Packetized (GSE)"},
460 {1, "Generic continuous (GSE)"},
461 {2, "reserved"},
462 {3, "Transport (TS)"},
463 {0, NULL}
466 #define DVB_S2_BB_MIS_POS 5
467 #define DVB_S2_BB_MIS_MASK 0x20
468 static const true_false_string tfs_bb_mis = {
469 "single (SIS)",
470 "multiple (MIS)"
473 #define DVB_S2_BB_ACM_MASK 0x10
474 static const true_false_string tfs_bb_acm = {
475 "constant (CCM)",
476 "adaptive (ACM)"
479 #define DVB_S2_BB_ISSYI_MASK 0x08
480 static const true_false_string tfs_bb_issyi = {
481 "active",
482 "not-active"
485 #define DVB_S2_BB_NPD_MASK 0x04
486 static const true_false_string tfs_bb_npd = {
487 "active",
488 "not-active"
491 #define DVB_S2_BB_RO_MASK 0x03
492 static const value_string bb_ro[] = {
493 {0, "0,35"},
494 {1, "0,25"},
495 {2, "0,20"},
496 {3, "<0,20 / reserved"},
497 {0, NULL}
500 #define DVB_S2_BB_OFFS_MATYPE2 1
501 #define DVB_S2_BB_OFFS_UPL 2
502 #define DVB_S2_BB_OFFS_DFL 4
503 #define DVB_S2_BB_OFFS_SYNC 6
504 #define DVB_S2_BB_OFFS_SYNCD 7
505 #define DVB_S2_BB_OFFS_CRC 9
507 /* *** DVB-S2 GSE Frame *** */
509 #define DVB_S2_GSE_MINSIZE 2
511 #define DVB_S2_GSE_OFFS_HDR 0
512 #define DVB_S2_GSE_HDR_START_MASK 0x8000
513 #define DVB_S2_GSE_HDR_START_POS 15
514 #define DVB_S2_GSE_HDR_STOP_MASK 0x4000
515 #define DVB_S2_GSE_HDR_STOP_POS 14
516 static const true_false_string tfs_gse_ss = {
517 "enabled",
518 "disabled"
521 #define DVB_S2_GSE_HDR_LABELTYPE_MASK 0x3000
522 #define DVB_S2_GSE_HDR_LABELTYPE_POS1 13
523 #define DVB_S2_GSE_HDR_LABELTYPE_POS2 12
524 static const value_string gse_labeltype[] = {
525 {0, "6 byte"},
526 {1, "3 byte"},
527 {2, "0 byte (Broadcast)"},
528 {3, "re-use last label"},
529 {0, NULL}
532 #define DVB_S2_GSE_HDR_LENGTH_MASK 0x0FFF
534 static const range_string gse_proto_str[] = {
535 {0x0000 , 0x00FF , "not implemented"},
536 {0x0100 , 0x05FF , "not implemented"},
537 {0x0600 , 0x07FF , "not implemented"},
538 {ETHERTYPE_IP , ETHERTYPE_IP , "IPv4 Payload" },
539 {0x0801 , 0x86DC , "not implemented"},
540 {ETHERTYPE_IPv6, ETHERTYPE_IPv6, "IPv6 Payload" },
541 {0x86DE , 0xFFFF , "not implemented"},
542 {0 , 0 , NULL }
545 #define DVB_S2_GSE_CRC32_LEN 4
547 /* *** helper functions *** */
548 static gboolean check_crc8(tvbuff_t *p, guint8 len, guint8 offset, guint8 received_fcs)
550 int i;
551 guint8 crc = 0, tmp;
553 for (i = 0; i < len; i++) {
554 tmp = tvb_get_guint8(p, offset++);
555 crc = crc8_table[crc ^ tmp];
557 if (received_fcs == crc)
558 return TRUE;
559 else
560 return FALSE;
563 /* *** Code to actually dissect the packets *** */
564 static int dissect_dvb_s2_gse(tvbuff_t *tvb, int cur_off, proto_tree *tree, packet_info *pinfo)
566 int new_off = 0;
567 int frag_len;
568 guint16 gse_hdr, data_len, gse_proto = 0;
570 proto_item *ti, *tf;
571 proto_tree *dvb_s2_gse_tree, *dvb_s2_gse_hdr_tree;
573 tvbuff_t *next_tvb;
575 col_append_str(pinfo->cinfo, COL_INFO, "GSE");
577 /* get header and determine length */
578 gse_hdr = tvb_get_ntohs(tvb, cur_off + DVB_S2_GSE_OFFS_HDR);
579 new_off += 2;
580 frag_len = (gse_hdr & DVB_S2_GSE_HDR_LENGTH_MASK)+2;
582 ti = proto_tree_add_item(tree, proto_dvb_s2_gse, tvb, cur_off, frag_len, ENC_NA);
583 dvb_s2_gse_tree = proto_item_add_subtree(ti, ett_dvb_s2_gse);
585 tf = proto_tree_add_item(dvb_s2_gse_tree, hf_dvb_s2_gse_hdr, tvb, cur_off + DVB_S2_GSE_OFFS_HDR, 2, gse_hdr);
587 dvb_s2_gse_hdr_tree = proto_item_add_subtree(tf, ett_dvb_s2_gse_hdr);
588 proto_tree_add_item(dvb_s2_gse_hdr_tree, hf_dvb_s2_gse_hdr_start, tvb, cur_off + DVB_S2_GSE_OFFS_HDR, 2, ENC_BIG_ENDIAN);
589 proto_tree_add_item(dvb_s2_gse_hdr_tree, hf_dvb_s2_gse_hdr_stop, tvb, cur_off + DVB_S2_GSE_OFFS_HDR, 2, ENC_BIG_ENDIAN);
590 proto_tree_add_item(dvb_s2_gse_hdr_tree, hf_dvb_s2_gse_hdr_labeltype, tvb,
591 cur_off + DVB_S2_GSE_OFFS_HDR, 2, ENC_BIG_ENDIAN);
592 proto_tree_add_item(dvb_s2_gse_hdr_tree, hf_dvb_s2_gse_hdr_length, tvb, cur_off + DVB_S2_GSE_OFFS_HDR, 2, ENC_BIG_ENDIAN);
594 if (BIT_IS_CLEAR(gse_hdr, DVB_S2_GSE_HDR_START_POS) &&
595 BIT_IS_CLEAR(gse_hdr, DVB_S2_GSE_HDR_STOP_POS) &&
596 BIT_IS_CLEAR(gse_hdr, DVB_S2_GSE_HDR_LABELTYPE_POS1) && BIT_IS_CLEAR(gse_hdr, DVB_S2_GSE_HDR_LABELTYPE_POS2)) {
597 col_append_str(pinfo->cinfo, COL_INFO, " ");
598 return new_off;
599 } else {
600 if (BIT_IS_CLEAR(gse_hdr, DVB_S2_GSE_HDR_START_POS) || BIT_IS_CLEAR(gse_hdr, DVB_S2_GSE_HDR_STOP_POS)) {
602 proto_tree_add_item(dvb_s2_gse_tree, hf_dvb_s2_gse_fragid, tvb, cur_off + new_off, 1, ENC_BIG_ENDIAN);
604 new_off += 1;
606 if (BIT_IS_SET(gse_hdr, DVB_S2_GSE_HDR_START_POS) && BIT_IS_CLEAR(gse_hdr, DVB_S2_GSE_HDR_STOP_POS)) {
608 proto_tree_add_item(dvb_s2_gse_tree, hf_dvb_s2_gse_totlength, tvb, cur_off + new_off, 2, ENC_BIG_ENDIAN);
609 col_append_str(pinfo->cinfo, COL_INFO, "(frag) ");
611 new_off += 2;
613 if (BIT_IS_SET(gse_hdr, DVB_S2_GSE_HDR_START_POS)) {
614 gse_proto = tvb_get_ntohs(tvb, cur_off + new_off);
616 proto_tree_add_item(dvb_s2_gse_tree, hf_dvb_s2_gse_proto, tvb, cur_off + new_off, 2, ENC_BIG_ENDIAN);
618 new_off += 2;
620 if (BIT_IS_CLEAR(gse_hdr, DVB_S2_GSE_HDR_LABELTYPE_POS1) && BIT_IS_CLEAR(gse_hdr, DVB_S2_GSE_HDR_LABELTYPE_POS2)) {
621 /* 6 byte label */
622 if (BIT_IS_SET(gse_hdr, DVB_S2_GSE_HDR_STOP_POS))
623 col_append_str(pinfo->cinfo, COL_INFO, "6 ");
625 proto_tree_add_item(dvb_s2_gse_tree, hf_dvb_s2_gse_label6, tvb, cur_off + new_off, 6, ENC_NA);
627 new_off += 6;
628 } else if (BIT_IS_CLEAR(gse_hdr, DVB_S2_GSE_HDR_LABELTYPE_POS1) &&
629 BIT_IS_SET(gse_hdr, DVB_S2_GSE_HDR_LABELTYPE_POS2)) {
630 /* 3 byte label */
631 if (BIT_IS_SET(gse_hdr, DVB_S2_GSE_HDR_STOP_POS))
632 col_append_str(pinfo->cinfo, COL_INFO, "3 ");
634 proto_tree_add_item(dvb_s2_gse_tree, hf_dvb_s2_gse_label3, tvb, cur_off + new_off, 3, ENC_NA);
636 new_off += 3;
637 } else {
638 /* 0 byte label */
639 if (BIT_IS_SET(gse_hdr, DVB_S2_GSE_HDR_STOP_POS))
640 col_append_str(pinfo->cinfo, COL_INFO, "0 ");
642 if (gse_proto < 0x0600 && gse_proto >= 0x100) {
643 /* Only display optional extension headers */
644 /* TODO: needs to be tested */
646 /* TODO: implementation needs to be checked (len of ext-header??) */
647 proto_tree_add_item(dvb_s2_gse_tree, hf_dvb_s2_gse_exthdr, tvb, cur_off + new_off, 1, ENC_BIG_ENDIAN);
649 new_off += 1;
652 else
654 /* correct cinfo */
655 col_append_str(pinfo->cinfo, COL_INFO, "(frag) ");
658 next_tvb = tvb_new_subset_remaining(tvb, cur_off + new_off);
660 if (dvb_s2_full_dissection)
662 switch (gse_proto) {
663 case ETHERTYPE_IP:
664 new_off += call_dissector(ip_handle, next_tvb, pinfo, tree);
665 break;
666 case ETHERTYPE_IPv6:
667 new_off += call_dissector(ipv6_handle, next_tvb, pinfo, tree);
668 break;
669 default:
670 if (BIT_IS_CLEAR(gse_hdr, DVB_S2_GSE_HDR_START_POS) && BIT_IS_SET(gse_hdr, DVB_S2_GSE_HDR_STOP_POS)) {
671 data_len = (gse_hdr & DVB_S2_GSE_HDR_LENGTH_MASK) - (new_off - DVB_S2_GSE_MINSIZE) - DVB_S2_GSE_CRC32_LEN;
672 } else
673 data_len = (gse_hdr & DVB_S2_GSE_HDR_LENGTH_MASK) - (new_off - DVB_S2_GSE_MINSIZE);
675 proto_tree_add_item(dvb_s2_gse_tree, hf_dvb_s2_gse_data, tvb, cur_off + new_off, data_len, ENC_NA);
676 new_off += data_len;
677 break;
680 else
682 if (BIT_IS_CLEAR(gse_hdr, DVB_S2_GSE_HDR_START_POS) && BIT_IS_SET(gse_hdr, DVB_S2_GSE_HDR_STOP_POS)) {
683 data_len = (gse_hdr & DVB_S2_GSE_HDR_LENGTH_MASK) - (new_off - DVB_S2_GSE_MINSIZE) - DVB_S2_GSE_CRC32_LEN;
684 } else
685 data_len = (gse_hdr & DVB_S2_GSE_HDR_LENGTH_MASK) - (new_off - DVB_S2_GSE_MINSIZE);
687 proto_tree_add_item(dvb_s2_gse_tree, hf_dvb_s2_gse_data, tvb, cur_off + new_off, data_len, ENC_NA);
688 new_off += data_len;
691 /* add crc32 if last fragment */
692 if (BIT_IS_CLEAR(gse_hdr, DVB_S2_GSE_HDR_START_POS) && BIT_IS_SET(gse_hdr, DVB_S2_GSE_HDR_STOP_POS)) {
693 proto_tree_add_item(dvb_s2_gse_tree, hf_dvb_s2_gse_crc32, tvb, cur_off + new_off, DVB_S2_GSE_CRC32_LEN, ENC_NA);
694 new_off += DVB_S2_GSE_CRC32_LEN;
698 return new_off;
701 static gboolean test_dvb_s2_crc(tvbuff_t *tvb, guint offset) {
703 guint8 input8;
705 /* only check BB Header and return */
706 if (tvb_length(tvb) < (offset + DVB_S2_BB_HEADER_LEN))
707 return FALSE;
709 input8 = tvb_get_guint8(tvb, offset + DVB_S2_BB_OFFS_CRC);
711 if (!check_crc8(tvb, DVB_S2_BB_HEADER_LEN - 1, offset, input8))
712 return FALSE;
713 else
714 return TRUE;
720 static int dissect_dvb_s2_bb(tvbuff_t *tvb, int cur_off, proto_tree *tree, packet_info *pinfo)
722 proto_item *ti, *tf;
723 proto_tree *dvb_s2_bb_tree, *dvb_s2_bb_matype1_tree;
725 guint8 input8;
726 guint16 input16, bb_data_len = 0;
728 int sub_dissected = 0, flag_is_ms = 0, new_off = 0;
730 col_append_str(pinfo->cinfo, COL_PROTOCOL, "BB ");
731 col_append_str(pinfo->cinfo, COL_INFO, "Baseband ");
733 /* create display subtree for the protocol */
734 ti = proto_tree_add_item(tree, proto_dvb_s2_bb, tvb, cur_off, DVB_S2_BB_HEADER_LEN, ENC_NA);
735 dvb_s2_bb_tree = proto_item_add_subtree(ti, ett_dvb_s2_bb);
737 input8 = tvb_get_guint8(tvb, cur_off + DVB_S2_BB_OFFS_MATYPE1);
738 new_off += 1;
740 if (BIT_IS_CLEAR(input8, DVB_S2_BB_MIS_POS))
741 flag_is_ms = 1;
743 tf = proto_tree_add_item(dvb_s2_bb_tree, hf_dvb_s2_bb_matype1, tvb, cur_off + DVB_S2_BB_OFFS_MATYPE1, 1, input8);
744 dvb_s2_bb_matype1_tree = proto_item_add_subtree(tf, ett_dvb_s2_bb_matype1);
745 proto_tree_add_item(dvb_s2_bb_matype1_tree, hf_dvb_s2_bb_matype1_gs, tvb,
746 cur_off + DVB_S2_BB_OFFS_MATYPE1, 1, ENC_BIG_ENDIAN);
747 proto_tree_add_item(dvb_s2_bb_matype1_tree, hf_dvb_s2_bb_matype1_mis, tvb,
748 cur_off + DVB_S2_BB_OFFS_MATYPE1, 1, ENC_BIG_ENDIAN);
749 proto_tree_add_item(dvb_s2_bb_matype1_tree, hf_dvb_s2_bb_matype1_acm, tvb,
750 cur_off + DVB_S2_BB_OFFS_MATYPE1, 1, ENC_BIG_ENDIAN);
751 proto_tree_add_item(dvb_s2_bb_matype1_tree, hf_dvb_s2_bb_matype1_issyi, tvb,
752 cur_off + DVB_S2_BB_OFFS_MATYPE1, 1, ENC_BIG_ENDIAN);
753 proto_tree_add_item(dvb_s2_bb_matype1_tree, hf_dvb_s2_bb_matype1_npd, tvb,
754 cur_off + DVB_S2_BB_OFFS_MATYPE1, 1, ENC_BIG_ENDIAN);
755 proto_tree_add_item(dvb_s2_bb_matype1_tree, hf_dvb_s2_bb_matype1_ro, tvb,
756 cur_off + DVB_S2_BB_OFFS_MATYPE1, 1, ENC_BIG_ENDIAN);
758 input8 = tvb_get_guint8(tvb, cur_off + DVB_S2_BB_OFFS_MATYPE2);
759 new_off += 1;
760 if (flag_is_ms) {
761 proto_tree_add_uint_format_value(dvb_s2_bb_tree, hf_dvb_s2_bb_matype2, tvb,
762 cur_off + DVB_S2_BB_OFFS_MATYPE2, 1, input8, "Input Stream Identifier (ISI): %d",
763 input8);
764 } else {
765 proto_tree_add_uint_format_value(dvb_s2_bb_tree, hf_dvb_s2_bb_matype2, tvb,
766 cur_off + DVB_S2_BB_OFFS_MATYPE2, 1, input8, "reserved");
769 input16 = tvb_get_ntohs(tvb, cur_off + DVB_S2_BB_OFFS_UPL);
770 new_off += 2;
772 proto_tree_add_uint_format(dvb_s2_bb_tree, hf_dvb_s2_bb_upl, tvb,
773 cur_off + DVB_S2_BB_OFFS_UPL, 2, input16, "User Packet Length: %d bits (%d bytes)",
774 (guint16) input16, (guint16) input16 / 8);
776 bb_data_len = input16 = tvb_get_ntohs(tvb, cur_off + DVB_S2_BB_OFFS_DFL);
777 bb_data_len /= 8;
778 new_off += 2;
780 proto_tree_add_uint_format_value(dvb_s2_bb_tree, hf_dvb_s2_bb_dfl, tvb,
781 cur_off + DVB_S2_BB_OFFS_DFL, 2, input16, "%d bits (%d bytes)", input16, input16 / 8);
783 new_off += 1;
784 proto_tree_add_item(dvb_s2_bb_tree, hf_dvb_s2_bb_sync, tvb, cur_off + DVB_S2_BB_OFFS_SYNC, 1, ENC_BIG_ENDIAN);
786 new_off += 2;
787 proto_tree_add_item(dvb_s2_bb_tree, hf_dvb_s2_bb_syncd, tvb, cur_off + DVB_S2_BB_OFFS_SYNCD, 2, ENC_BIG_ENDIAN);
789 input8 = tvb_get_guint8(tvb, cur_off + DVB_S2_BB_OFFS_CRC);
790 new_off += 1;
791 if (check_crc8(tvb, DVB_S2_BB_HEADER_LEN - 1, cur_off, input8)) {
792 proto_tree_add_uint_format(dvb_s2_bb_tree, hf_dvb_s2_bb_crc, tvb,
793 cur_off + DVB_S2_BB_OFFS_CRC, 1, 1, "Checksum: correct (0x%2.2x)", input8);
794 } else {
795 proto_tree_add_uint_format(dvb_s2_bb_tree, hf_dvb_s2_bb_crc, tvb,
796 cur_off + DVB_S2_BB_OFFS_CRC, 1, -1, "Checksum: incorrect! (0x%2.2x)", input8);
799 while (bb_data_len) {
800 /* start DVB-GSE dissector */
801 sub_dissected = dissect_dvb_s2_gse(tvb, cur_off + new_off, tree, pinfo);
802 new_off += sub_dissected;
804 if ((sub_dissected <= bb_data_len) && (sub_dissected >= DVB_S2_GSE_MINSIZE)) {
805 bb_data_len -= sub_dissected;
806 if (bb_data_len < DVB_S2_GSE_MINSIZE)
807 bb_data_len = 0;
808 } else
809 bb_data_len = 0;
812 return new_off;
815 static int dissect_dvb_s2_modeadapt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
817 int cur_off = 0, dvb_s2_modeadapt_len = -1;
819 proto_item *ti, *tf;
820 proto_tree *dvb_s2_modeadapt_tree;
821 proto_tree *dvb_s2_modeadapt_acm_tree;
823 guint8 byte;
825 /* Check that there's enough data */
826 if (tvb_length(tvb) < 1)
827 return 0;
829 /* Check if first byte is valid for this dissector */
830 byte = tvb_get_guint8(tvb, DVB_S2_MODEADAPT_OFFS_SYNCBYTE);
831 cur_off++;
832 if (byte != DVB_S2_MODEADAPT_SYNCBYTE)
833 return 0;
835 /* Check if BB-Header CRC is valid and determine input or output */
837 if (test_dvb_s2_crc(tvb, DVB_S2_MODEADAPT_INSIZE)) {
838 dvb_s2_modeadapt_len = 2;
839 } else if (test_dvb_s2_crc(tvb, DVB_S2_MODEADAPT_OUTSIZE)) {
840 dvb_s2_modeadapt_len = 4;
841 } else {
842 return 0;
845 col_set_str(pinfo->cinfo, COL_PROTOCOL, "DVB-S2 ");
846 col_set_str(pinfo->cinfo, COL_INFO, "DVB-S2 ");
848 /* create display subtree for the protocol */
849 ti = proto_tree_add_item(tree, proto_dvb_s2_modeadapt, tvb, 0, dvb_s2_modeadapt_len, ENC_NA);
850 dvb_s2_modeadapt_tree = proto_item_add_subtree(ti, ett_dvb_s2_modeadapt);
852 proto_tree_add_item(dvb_s2_modeadapt_tree, hf_dvb_s2_modeadapt_sync, tvb, DVB_S2_MODEADAPT_OFFS_SYNCBYTE, 1, ENC_BIG_ENDIAN);
854 cur_off++;
855 tf = proto_tree_add_item(dvb_s2_modeadapt_tree, hf_dvb_s2_modeadapt_acm, tvb,
856 DVB_S2_MODEADAPT_OFFS_ACMBYTE, 1, ENC_BIG_ENDIAN);
858 dvb_s2_modeadapt_acm_tree = proto_item_add_subtree(tf, ett_dvb_s2_modeadapt_acm);
860 proto_tree_add_item(dvb_s2_modeadapt_acm_tree, hf_dvb_s2_modeadapt_acm_fecframe, tvb,
861 DVB_S2_MODEADAPT_OFFS_ACMBYTE, 1, ENC_BIG_ENDIAN);
862 proto_tree_add_item(dvb_s2_modeadapt_acm_tree, hf_dvb_s2_modeadapt_acm_pilot, tvb,
863 DVB_S2_MODEADAPT_OFFS_ACMBYTE, 1, ENC_BIG_ENDIAN);
864 proto_tree_add_item(dvb_s2_modeadapt_acm_tree, hf_dvb_s2_modeadapt_acm_modcod, tvb,
865 DVB_S2_MODEADAPT_OFFS_ACMBYTE, 1, ENC_BIG_ENDIAN);
867 if (dvb_s2_modeadapt_len > 2) {
868 cur_off++;
869 proto_tree_add_item(dvb_s2_modeadapt_tree, hf_dvb_s2_modeadapt_cni, tvb, DVB_S2_MODEADAPT_OFFS_CNI, 1, ENC_BIG_ENDIAN);
871 cur_off++;
872 proto_tree_add_item(dvb_s2_modeadapt_tree, hf_dvb_s2_modeadapt_frameno, tvb, DVB_S2_MODEADAPT_OFFS_FNO, 1, ENC_BIG_ENDIAN);
875 /* start DVB-BB dissector */
876 cur_off = dissect_dvb_s2_bb(tvb, cur_off, tree, pinfo);
879 return cur_off;
883 /* Register the protocol with Wireshark */
884 void proto_register_dvb_s2_modeadapt(void)
886 module_t *dvb_s2_modeadapt_module;
888 static hf_register_info hf_modeadapt[] = {
889 {&hf_dvb_s2_modeadapt_sync, {
890 "Sync Byte", "dvb-s2_modeadapt.sync",
891 FT_UINT8, BASE_HEX, NULL, 0x0,
892 "Das Sync Byte", HFILL}
894 {&hf_dvb_s2_modeadapt_acm, {
895 "ACM command", "dvb-s2_modeadapt.acmcmd",
896 FT_UINT8, BASE_HEX, NULL, 0x0,
897 NULL, HFILL}
899 {&hf_dvb_s2_modeadapt_acm_fecframe, {
900 "FEC frame size", "dvb-s2_modeadapt.acmcmd.fecframe",
901 FT_BOOLEAN, 8, TFS(&tfs_modeadapt_fecframe), DVB_S2_MODEADAPT_FECFRAME_MASK,
902 "FEC", HFILL}
904 {&hf_dvb_s2_modeadapt_acm_pilot, {
905 "Pilots configuration", "dvb-s2_modeadapt.acmcmd.pilots",
906 FT_BOOLEAN, 8, TFS(&tfs_modeadapt_pilots), DVB_S2_MODEADAPT_PILOTS_MASK,
907 "Pilots", HFILL}
909 {&hf_dvb_s2_modeadapt_acm_modcod, {
910 "Modcod indicator", "dvb-s2_modeadapt.acmcmd.modcod",
911 FT_UINT8, BASE_DEC|BASE_EXT_STRING, &modeadapt_modcods_ext, DVB_S2_MODEADAPT_MODCODS_MASK,
912 "Modcod", HFILL}
914 {&hf_dvb_s2_modeadapt_cni, {
915 "Carrier to Noise [dB]", "dvb-s2_modeadapt.cni",
916 FT_UINT8, BASE_DEC|BASE_EXT_STRING, &modeadapt_esno_ext, 0x0,
917 "CNI", HFILL}
919 {&hf_dvb_s2_modeadapt_frameno, {
920 "Frame number", "dvb-s2_modeadapt.frameno",
921 FT_UINT8, BASE_DEC, NULL, 0x0,
922 "fno", HFILL}
926 /* Setup protocol subtree array */
927 static gint *ett_modeadapt[] = {
928 &ett_dvb_s2_modeadapt,
929 &ett_dvb_s2_modeadapt_acm
932 static hf_register_info hf_bb[] = {
933 {&hf_dvb_s2_bb_matype1, {
934 "MATYPE1", "dvb-s2_bb.matype1",
935 FT_UINT8, BASE_HEX, NULL, 0x0,
936 "MATYPE1 Header Field", HFILL}
938 {&hf_dvb_s2_bb_matype1_gs, {
939 "Stream Input", "dvb-s2_bb.matype1.gs",
940 FT_UINT8, BASE_DEC, VALS(bb_gs), DVB_S2_BB_GS_MASK,
941 "Transport Stream Input or Generic Stream Input", HFILL}
943 {&hf_dvb_s2_bb_matype1_mis, {
944 "Input Stream", "dvb-s2_bb.matype1.mis",
945 FT_BOOLEAN, 8, TFS(&tfs_bb_mis), DVB_S2_BB_MIS_MASK,
946 "Single Input Stream or Multiple Input Stream", HFILL}
948 {&hf_dvb_s2_bb_matype1_acm, {
949 "Coding and Modulation", "dvb-s2_bb.matype1.acm",
950 FT_BOOLEAN, 8, TFS(&tfs_bb_acm), DVB_S2_BB_ACM_MASK,
951 "Constant Coding and Modulation or Adaptive Coding and Modulation", HFILL}
953 {&hf_dvb_s2_bb_matype1_issyi, {
954 "ISSYI", "dvb-s2_bb.matype1.issyi",
955 FT_BOOLEAN, 8, TFS(&tfs_bb_issyi), DVB_S2_BB_ISSYI_MASK,
956 "Input Stream Synchronization Indicator", HFILL}
958 {&hf_dvb_s2_bb_matype1_npd, {
959 "NPD", "dvb-s2_bb.matype1.npd",
960 FT_BOOLEAN, 8, TFS(&tfs_bb_npd), DVB_S2_BB_NPD_MASK,
961 "Null-packet deletion enabled", HFILL}
963 {&hf_dvb_s2_bb_matype1_ro, {
964 "RO", "dvb-s2_bb.matype1.ro",
965 FT_UINT8, BASE_DEC, VALS(bb_ro), DVB_S2_BB_RO_MASK,
966 "Transmission Roll-off factor", HFILL}
968 {&hf_dvb_s2_bb_matype2, {
969 "MATYPE2", "dvb-s2_bb.matype2",
970 FT_UINT8, BASE_HEX, NULL, 0x0,
971 "MATYPE2 Header Field", HFILL}
973 {&hf_dvb_s2_bb_upl, {
974 "UPL", "dvb-s2_bb.upl",
975 FT_UINT16, BASE_HEX, NULL, 0x0,
976 "User Packet Length", HFILL}
978 {&hf_dvb_s2_bb_dfl, {
979 "DFL", "dvb-s2_bb.dfl",
980 FT_UINT16, BASE_HEX, NULL, 0x0,
981 "Data Field Length", HFILL}
983 {&hf_dvb_s2_bb_sync, {
984 "SYNC", "dvb-s2_bb.sync",
985 FT_UINT8, BASE_HEX, NULL, 0x0,
986 "Copy of the User Packet Sync-byte", HFILL}
988 {&hf_dvb_s2_bb_syncd, {
989 "SYNCD", "dvb-s2_bb.syncd",
990 FT_UINT16, BASE_HEX, NULL, 0x0,
991 "Distance to first user packet", HFILL}
993 {&hf_dvb_s2_bb_crc, {
994 "CRC", "dvb-s2_bb.crc",
995 FT_UINT8, BASE_HEX, NULL, 0x0,
996 "CRC-8", HFILL}
1000 static gint *ett_bb[] = {
1001 &ett_dvb_s2_bb,
1002 &ett_dvb_s2_bb_matype1
1005 /* DVB-S2 GSE Frame */
1006 static hf_register_info hf_gse[] = {
1007 {&hf_dvb_s2_gse_hdr, {
1008 "GSE header", "dvb-s2_gse.hdr",
1009 FT_UINT16, BASE_HEX, NULL, 0x0,
1010 "GSE Header (start/stop/length)", HFILL}
1012 {&hf_dvb_s2_gse_hdr_start, {
1013 "Start", "dvb-s2_gse.hdr.start",
1014 FT_BOOLEAN, 16, TFS(&tfs_gse_ss), DVB_S2_GSE_HDR_START_MASK,
1015 "Start Indicator", HFILL}
1017 {&hf_dvb_s2_gse_hdr_stop, {
1018 "Stop", "dvb-s2_gse.hdr.stop",
1019 FT_BOOLEAN, 16, TFS(&tfs_gse_ss), DVB_S2_GSE_HDR_STOP_MASK,
1020 "Stop Indicator", HFILL}
1022 {&hf_dvb_s2_gse_hdr_labeltype, {
1023 "Label Type", "dvb-s2_gse.hdr.labeltype",
1024 FT_UINT16, BASE_HEX, VALS(gse_labeltype), DVB_S2_GSE_HDR_LABELTYPE_MASK,
1025 "Label Type Indicator", HFILL}
1027 {&hf_dvb_s2_gse_hdr_length, {
1028 "Length", "dvb-s2_gse.hdr.length",
1029 FT_UINT16, BASE_DEC, NULL, DVB_S2_GSE_HDR_LENGTH_MASK,
1030 "GSE Length", HFILL}
1032 {&hf_dvb_s2_gse_proto, {
1033 "Protocol", "dvb-s2_gse.proto",
1034 FT_UINT16, BASE_HEX | BASE_RANGE_STRING, RVALS(gse_proto_str), 0x0,
1035 "Protocol Type", HFILL}
1037 {&hf_dvb_s2_gse_label6, {
1038 "Label", "dvb-s2_gse.label",
1039 FT_ETHER, BASE_NONE, NULL, 0x0,
1040 "Label Field", HFILL}
1042 {&hf_dvb_s2_gse_label3, {
1043 "Label", "dvb-s2_gse.label",
1044 FT_UINT24, BASE_HEX, NULL, 0x0,
1045 "Label Field", HFILL}
1047 {&hf_dvb_s2_gse_fragid, {
1048 "Frag ID", "dvb-s2_gse.fragid",
1049 FT_UINT8, BASE_HEX, NULL, 0x0,
1050 "Fragment ID", HFILL}
1052 {&hf_dvb_s2_gse_totlength, {
1053 "Total Length", "dvb-s2_gse.totlength",
1054 FT_UINT16, BASE_DEC, NULL, 0x0,
1055 "GSE Total Frame Length", HFILL}
1057 {&hf_dvb_s2_gse_exthdr, {
1058 "Extension Header", "dvb-s2_gse.exthdr",
1059 FT_UINT8, BASE_HEX, NULL, 0x0,
1060 "optional Extension Header", HFILL}
1062 {&hf_dvb_s2_gse_data, {
1063 "PDU Data", "dvb-s2_gse.data",
1064 FT_BYTES, BASE_NONE, NULL, 0x0,
1065 "GSE Frame User Data", HFILL}
1067 {&hf_dvb_s2_gse_crc32, {
1068 "CRC", "dvb-s2_gse.crc",
1069 FT_UINT32, BASE_HEX, NULL, 0x0,
1070 "CRC-32", HFILL}
1074 static gint *ett_gse[] = {
1075 &ett_dvb_s2_gse,
1076 &ett_dvb_s2_gse_hdr
1079 proto_dvb_s2_modeadapt = proto_register_protocol("DVB-S2 Modeadaption Header", "DVB-S2", "dvb-s2_modeadapt");
1081 proto_dvb_s2_bb = proto_register_protocol("DVB-S2 Baseband Frame", "DVB-S2-BB", "dvb-s2_bb");
1083 proto_dvb_s2_gse = proto_register_protocol("DVB-S2 GSE Packet", "DVB-S2-GSE", "dvb-s2_gse");
1085 proto_register_field_array(proto_dvb_s2_modeadapt, hf_modeadapt, array_length(hf_modeadapt));
1086 proto_register_subtree_array(ett_modeadapt, array_length(ett_modeadapt));
1088 proto_register_field_array(proto_dvb_s2_bb, hf_bb, array_length(hf_bb));
1089 proto_register_subtree_array(ett_bb, array_length(ett_bb));
1091 proto_register_field_array(proto_dvb_s2_gse, hf_gse, array_length(hf_gse));
1092 proto_register_subtree_array(ett_gse, array_length(ett_gse));
1094 dvb_s2_modeadapt_module = prefs_register_protocol(proto_dvb_s2_modeadapt, proto_reg_handoff_dvb_s2_modeadapt);
1096 prefs_register_bool_preference(dvb_s2_modeadapt_module, "enable", "Enable dissector",
1097 "Enable DVB-S2 dissector", &dvb_s2_enable);
1099 prefs_register_bool_preference(dvb_s2_modeadapt_module, "full_decode",
1100 "Enable dissection of GSE data",
1101 "Check this to enable full protocol dissection of data above GSE Layer",
1102 &dvb_s2_full_dissection);
1105 void proto_reg_handoff_dvb_s2_modeadapt(void)
1107 static gboolean prefs_initialized = FALSE;
1109 if (!prefs_initialized) {
1110 heur_dissector_add("udp", dissect_dvb_s2_modeadapt, proto_dvb_s2_modeadapt);
1111 ip_handle = find_dissector("ip");
1112 ipv6_handle = find_dissector("ipv6");
1113 prefs_initialized = TRUE;
1116 proto_set_decoding(proto_dvb_s2_modeadapt, dvb_s2_enable);
1120 * Editor modelines - http://www.wireshark.org/tools/modelines.html
1122 * Local variables:
1123 * c-basic-offset: 4
1124 * tab-width: 8
1125 * indent-tabs-mode: nil
1126 * End:
1128 * vi: set shiftwidth=4 tabstop=8 expandtab:
1129 * :indentSize=4:tabSize=8:noTabs=true: