2 * Routines for ETSI Distribution & Communication Protocol
3 * Copyright 2006, British Broadcasting Corporation
7 * Wireshark - Network traffic analyzer
8 * By Gerald Combs <gerald@wireshark.org>
9 * Copyright 1998 Gerald Combs
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License
13 * as published by the Free Software Foundation; either version 2
14 * of the License, or (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26 * Ref: ETSI DCP (ETSI TS 102 821)
34 #include <epan/packet.h>
35 #include <epan/prefs.h>
36 #include <epan/reassemble.h>
37 #include <epan/crcdrm.h>
38 #include <epan/reedsolomon.h>
41 /* forward reference */
43 static gboolean dissect_dcp_etsi (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree);
44 static void dissect_af (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree);
45 static void dissect_pft (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree);
46 static void dissect_tpl(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree);
48 static dissector_table_t dcp_dissector_table;
49 static dissector_table_t af_dissector_table;
50 static dissector_table_t tpl_dissector_table;
52 static int proto_dcp_etsi = -1;
53 static int proto_af = -1;
54 static int proto_pft = -1;
55 static int proto_tpl = -1;
56 static dissector_handle_t af_handle;
57 static dissector_handle_t pft_handle;
58 static dissector_handle_t tpl_handle;
59 static int hf_edcp_sync = -1;
60 static int hf_edcp_len = -1;
61 static int hf_edcp_seq = -1;
62 static int hf_edcp_crcflag = -1;
63 static int hf_edcp_maj = -1;
64 static int hf_edcp_min = -1;
65 static int hf_edcp_pt = -1;
66 static int hf_edcp_crc = -1;
67 static int hf_edcp_crc_ok = -1;
68 static int hf_edcp_pft_pt = -1;
69 static int hf_edcp_pseq = -1;
70 static int hf_edcp_findex = -1;
71 static int hf_edcp_fcount = -1;
72 static int hf_edcp_fecflag = -1;
73 static int hf_edcp_addrflag = -1;
74 static int hf_edcp_plen = -1;
75 static int hf_edcp_rsk = -1;
76 static int hf_edcp_rsz = -1;
77 static int hf_edcp_source = -1;
78 static int hf_edcp_dest = -1;
79 static int hf_edcp_hcrc = -1;
80 static int hf_edcp_hcrc_ok = -1;
81 static int hf_edcp_c_max = -1;
82 static int hf_edcp_rx_min = -1;
83 static int hf_edcp_rs_corrected = -1;
84 static int hf_edcp_rs_ok = -1;
85 static int hf_edcp_pft_payload = -1;
87 static int hf_tpl_tlv = -1;
88 static int hf_tpl_ptr = -1;
90 static int hf_edcp_fragments = -1;
91 static int hf_edcp_fragment = -1;
92 static int hf_edcp_fragment_overlap = -1;
93 static int hf_edcp_fragment_overlap_conflicts = -1;
94 static int hf_edcp_fragment_multiple_tails = -1;
95 static int hf_edcp_fragment_too_long_fragment = -1;
96 static int hf_edcp_fragment_error = -1;
97 static int hf_edcp_reassembled_in = -1;
99 /* Initialize the subtree pointers */
100 static gint ett_edcp = -1;
101 static gint ett_af = -1;
102 static gint ett_pft = -1;
103 static gint ett_tpl = -1;
104 static gint ett_edcp_fragment = -1;
105 static gint ett_edcp_fragments = -1;
107 static GHashTable *dcp_fragment_table = NULL;
108 static GHashTable *dcp_reassembled_table = NULL;
110 static const fragment_items dcp_frag_items = {
111 /* Fragment subtrees */
114 /* Fragment fields */
117 &hf_edcp_fragment_overlap,
118 &hf_edcp_fragment_overlap_conflicts,
119 &hf_edcp_fragment_multiple_tails,
120 &hf_edcp_fragment_too_long_fragment,
121 &hf_edcp_fragment_error,
122 /* Reassembled in field */
123 &hf_edcp_reassembled_in,
128 /** initialise the DCP protocol. Details follow
132 dcp_init_protocol(void)
134 fragment_table_init (&dcp_fragment_table);
135 reassembled_table_init (&dcp_reassembled_table);
139 /** Dissect a DCP packet. Details follow
141 * \param[in,out] tvb The buffer containing the packet
142 * \param[in,out] pinfo The packet info structure
143 * \param[in,out] tree The structure containing the details which will be displayed, filtered, etc.
147 dissect_dcp_etsi (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree)
150 proto_tree *dcp_tree = NULL;
151 sync = tvb_get_string (tvb, 0, 2);
152 if((sync[0]!='A' && sync[0]!='P') || sync[1]!='F')
155 pinfo->current_proto = "DCP (ETSI)";
157 /* Clear out stuff in the info column */
158 if (check_col (pinfo->cinfo, COL_INFO)) {
159 col_clear (pinfo->cinfo, COL_INFO);
161 if (check_col (pinfo->cinfo, COL_PROTOCOL)) {
162 col_set_str (pinfo->cinfo, COL_PROTOCOL, "DCP (ETSI)");
163 /*col_append_fstr (pinfo->cinfo, COL_INFO, " tvb %d", tvb_length(tvb));*/
167 proto_item *ti = NULL;
168 ti = proto_tree_add_item (tree, proto_dcp_etsi, tvb, 0, -1, FALSE);
169 dcp_tree = proto_item_add_subtree (ti, ett_edcp);
172 dissector_try_string(dcp_dissector_table, (char*)sync, tvb, pinfo, dcp_tree);
177 #define PFT_RS_N_MAX 207
179 #define PFT_RS_P (PFT_RS_K - PFT_RS_N_MAX)
183 void rs_deinterleave(const guint8 *input, guint8 *output, guint16 plen, guint32 fcount)
186 for(fidx=0; fidx<fcount; fidx++)
189 for (r=0; r<plen; r++)
191 output[fidx+r*fcount] = input[fidx*plen+r];
197 gboolean rs_correct_data(guint8 *deinterleaved, guint8 *output,
198 guint32 c_max, guint16 rsk, guint16 rsz _U_)
200 guint32 i, index_coded = 0, index_out = 0;
202 for (i=0; i<c_max; i++)
204 memcpy(output+index_out, deinterleaved+index_coded, rsk);
206 memcpy(output+index_out+PFT_RS_N_MAX, deinterleaved+index_coded, PFT_RS_P);
207 index_coded += PFT_RS_P;
208 err_corr = eras_dec_rs(output+index_out, NULL, 0);
220 dissect_pft_fec_detailed(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree,
232 guint16 decoded_size;
235 gboolean first, last, decoded = TRUE;
236 tvbuff_t *new_tvb=NULL;
239 last = fcount == (findex+1);
240 decoded_size = fcount*plen;
241 c_max = fcount*plen/(rsk+PFT_RS_P); /* rounded down */
242 rx_min = c_max*rsk/plen;
243 if(rx_min*plen<c_max*rsk)
246 new_tvb = process_reassembled_data (tvb, offset, pinfo,
247 "Reassembled Message",
252 guint32 *got = g_malloc(fcount*sizeof(guint32));
254 fragment_data *fd = fragment_get(pinfo, seq, dcp_fragment_table);
255 fragment_data *fd_head;
256 for (fd_head = fd; fd_head != NULL; fd_head = fd_head->next) {
258 got[fragments] = fd_head->offset;
262 if(fragments>=rx_min) {
264 fragment_data *frag=NULL;
265 guint8 *dummy_data = (guint8*) g_malloc (plen);
266 tvbuff_t *dummytvb = tvb_new_real_data(dummy_data, plen, plen);
267 /* try and decode with missing fragments */
269 proto_tree_add_text (tree, tvb, 0, -1, "want %d, got %d need %d",
270 fcount, fragments, rx_min
272 memset(dummy_data, 0, plen);
273 for(i=0,j=0; i<fragments; i++,j++) {
275 frag = fragment_add_seq_check (dummytvb, 0, pinfo, seq,
276 dcp_fragment_table, dcp_reassembled_table, j, plen, (j+1!=fcount));
278 proto_tree_add_text (tree, tvb, 0, -1, "missing %d", j);
280 proto_tree_add_text (tree, tvb, 0, -1, "fragment %d was what we needed", j);
283 proto_tree_add_text (tree, tvb, 0, -1, "added %d but still not reassembled", j);
290 new_tvb = process_reassembled_data (tvb, offset, pinfo,
291 "Reassembled Message",
292 frag, &dcp_frag_items,
298 tvbuff_t *dtvb = NULL;
299 const guint8 *input = tvb_get_ptr(new_tvb, 0, -1);
300 guint16 reassembled_size = tvb_length(new_tvb);
301 guint8 *deinterleaved = (guint8*) g_malloc (reassembled_size);
302 guint8 *output = (guint8*) g_malloc (decoded_size);
303 rs_deinterleave(input, deinterleaved, plen, fcount);
305 dtvb = tvb_new_real_data(deinterleaved, reassembled_size, reassembled_size);
306 tvb_set_child_real_data_tvbuff(tvb, dtvb);
307 add_new_data_source(pinfo, dtvb, "Deinterleaved");
308 tvb_set_free_cb(dtvb, g_free);
310 decoded = rs_correct_data(deinterleaved, output, c_max, rsk, rsz);
312 proto_tree_add_boolean (tree, hf_edcp_rs_ok, tvb, offset, 2, decoded);
314 new_tvb = tvb_new_real_data(output, decoded_size, decoded_size);
315 tvb_set_child_real_data_tvbuff(dtvb, new_tvb);
316 add_new_data_source(pinfo, new_tvb, "RS Error Corrected Data");
317 tvb_set_free_cb(new_tvb, g_free);
323 /** Handle a PFT packet which has the fragmentation header. This uses the
324 * standard ethereal methods for reassembling fragments. If FEC is used,
325 * the FEC is handled too. For the moment, all the fragments must be
326 * available but this could be improved.
327 * \param[in,out] tvb The buffer containing the current fragment
328 * \param[in,out] pinfo The packet info structure
329 * \param[in,out] tree The structure containing the details which will be displayed, filtered, etc.
330 * \param[in] findex the fragment count
331 * \param[in] fcount the number of fragments
332 * \param[in] seq the sequence number of the reassembled packet
333 * \param[in] offset the offset into the tvb of the fragment
334 * \param[in] plen the length of each fragment
335 * \param[in] fec is fec used
336 * \param[in] rsk the number of useful bytes in each chunk
337 * \param[in] rsz the number of padding bytes in each chunk
340 dissect_pft_fragmented(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree,
351 gboolean first, last;
352 tvbuff_t *new_tvb=NULL;
353 fragment_data *frag_edcp = NULL;
354 pinfo->fragmented = TRUE;
356 last = fcount == (findex+1);
357 frag_edcp = fragment_add_seq_check (
360 dcp_fragment_table, dcp_reassembled_table,
365 new_tvb = dissect_pft_fec_detailed(
366 tvb, pinfo, tree, findex, fcount, seq, offset, plen, fec, rsk, rsz, frag_edcp
369 new_tvb = process_reassembled_data (tvb, offset, pinfo,
370 "Reassembled Message",
371 frag_edcp, &dcp_frag_items,
374 if (check_col (pinfo->cinfo, COL_INFO)) {
376 col_append_str (pinfo->cinfo, COL_INFO, " (Message Reassembled)");
379 col_append_str (pinfo->cinfo, COL_INFO, " (Message Reassembly failure)");
381 col_append_fstr (pinfo->cinfo, COL_INFO, " (Message fragment %u)", findex);
385 col_append_str (pinfo->cinfo, COL_INFO, " (first)");
387 col_append_str (pinfo->cinfo, COL_INFO, " (last)");
392 /** Dissect a PFT packet. Details follow
394 * \param[in,out] tvb The buffer containing the packet
395 * \param[in,out] pinfo The packet info structure
396 * \param[in,out] tree The structure containing the details which will be displayed, filtered, etc.
399 dissect_pft(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree)
403 guint16 seq, payload_len, hcrc;
404 guint32 findex, fcount;
405 proto_tree *pft_tree = NULL;
406 proto_item *ti = NULL, *li = NULL;
407 tvbuff_t *next_tvb = NULL;
408 gboolean fec = FALSE;
409 guint16 rsk=0, rsz=0;
411 pinfo->current_proto = "DCP-PFT";
412 if (check_col (pinfo->cinfo, COL_PROTOCOL)) {
413 col_set_str (pinfo->cinfo, COL_PROTOCOL, "DCP-PFT");
416 if (tree) { /* we are being asked for details */
417 ti = proto_tree_add_item (tree, proto_pft, tvb, 0, -1, FALSE);
418 pft_tree = proto_item_add_subtree (ti, ett_pft);
419 proto_tree_add_item (pft_tree, hf_edcp_sync, tvb, offset, 2, FALSE);
422 seq = tvb_get_ntohs (tvb, offset);
424 proto_tree_add_item (pft_tree, hf_edcp_pseq, tvb, offset, 2, FALSE);
427 findex = tvb_get_ntoh24 (tvb, offset);
429 proto_tree_add_item (pft_tree, hf_edcp_findex, tvb, offset, 3, FALSE);
432 fcount = tvb_get_ntoh24 (tvb, offset);
434 proto_tree_add_item (pft_tree, hf_edcp_fcount, tvb, offset, 3, FALSE);
437 plen = tvb_get_ntohs (tvb, offset);
438 payload_len = plen & 0x3fff;
440 proto_tree_add_item (pft_tree, hf_edcp_fecflag, tvb, offset, 2, FALSE);
441 proto_tree_add_item (pft_tree, hf_edcp_addrflag, tvb, offset, 2, FALSE);
442 li = proto_tree_add_item (pft_tree, hf_edcp_plen, tvb, offset, 2, FALSE);
447 rsk = tvb_get_guint8 (tvb, offset);
449 proto_tree_add_item (pft_tree, hf_edcp_rsk, tvb, offset, 1, FALSE);
451 rsz = tvb_get_guint8 (tvb, offset);
453 proto_tree_add_item (pft_tree, hf_edcp_rsz, tvb, offset, 1, FALSE);
458 proto_tree_add_item (pft_tree, hf_edcp_source, tvb, offset, 2, FALSE);
461 proto_tree_add_item (pft_tree, hf_edcp_dest, tvb, offset, 2, FALSE);
465 proto_item *ci = NULL;
466 guint header_len = offset+2;
467 const char *crc_buf = (const char *) tvb_get_ptr(tvb, 0, header_len);
468 unsigned long c = crc_drm(crc_buf, header_len, 16, 0x11021, 1);
469 ci = proto_tree_add_item (pft_tree, hf_edcp_hcrc, tvb, offset, 2, FALSE);
470 proto_item_append_text(ci, " (%s)", (c==0xe2f0)?"Ok":"bad");
471 proto_tree_add_boolean(pft_tree, hf_edcp_hcrc_ok, tvb, offset, 2, c==0xe2f0);
473 hcrc = tvb_get_ntohs (tvb, offset);
475 if (fcount > 1) { /* fragmented*/
476 gboolean save_fragmented = pinfo->fragmented;
477 guint16 real_len = tvb_length(tvb)-offset;
478 proto_tree_add_item (pft_tree, hf_edcp_pft_payload, tvb, offset, real_len, FALSE);
479 if(real_len != payload_len) {
481 proto_item_append_text(li, " (length error (%d))", real_len);
483 next_tvb = dissect_pft_fragmented(tvb, pinfo, pft_tree,
484 findex, fcount, seq, offset, real_len,
487 pinfo->fragmented = save_fragmented;
489 next_tvb = tvb_new_subset (tvb, offset, -1, -1);
492 dissect_af(next_tvb, pinfo, tree);
496 /** Dissect an AF Packet. Parse an AF packet, checking the CRC if the CRC valid
497 * flag is set and calling any registered sub dissectors on the payload type.
498 * Currently only a payload type 'T' is defined which is the tag packet layer.
499 * If any others are defined then they can register themselves.
500 * \param[in,out] tvb The buffer containing the packet
501 * \param[in,out] pinfo The packet info structure
502 * \param[in,out] tree The structure containing the details which will be displayed, filtered, etc.
505 dissect_af (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree)
508 proto_item *ti = NULL;
509 proto_item *li = NULL;
510 proto_item *ci = NULL;
511 proto_tree *af_tree = NULL;
514 tvbuff_t *next_tvb = NULL;
516 pinfo->current_proto = "DCP-AF";
517 if (check_col (pinfo->cinfo, COL_PROTOCOL)) {
518 col_set_str (pinfo->cinfo, COL_PROTOCOL, "DCP-AF");
521 if (tree) { /* we are being asked for details */
522 ti = proto_tree_add_item (tree, proto_af, tvb, 0, -1, FALSE);
523 af_tree = proto_item_add_subtree (ti, ett_af);
524 proto_tree_add_item (af_tree, hf_edcp_sync, tvb, offset, 2, FALSE);
527 payload_len = tvb_get_ntohl(tvb, offset);
529 guint32 real_payload_len = tvb_length(tvb)-12;
530 li = proto_tree_add_item (af_tree, hf_edcp_len, tvb, offset, 4, FALSE);
531 if(real_payload_len < payload_len) {
532 proto_item_append_text (li, " (wrong len claims %d is %d)",
533 payload_len, real_payload_len
535 } else if(real_payload_len > payload_len) {
536 proto_item_append_text (li, " (%d bytes in packet after end of AF frame)",
537 real_payload_len-payload_len
543 proto_tree_add_item (af_tree, hf_edcp_seq, tvb, offset, 2, FALSE);
545 ver = tvb_get_guint8 (tvb, offset);
547 proto_tree_add_item (af_tree, hf_edcp_crcflag, tvb, offset, 1, FALSE);
548 proto_tree_add_item (af_tree, hf_edcp_maj, tvb, offset, 1, FALSE);
549 proto_tree_add_item (af_tree, hf_edcp_min, tvb, offset, 1, FALSE);
552 pt = tvb_get_guint8 (tvb, offset);
554 proto_tree_add_item (af_tree, hf_edcp_pt, tvb, offset, 1, FALSE);
556 next_tvb = tvb_new_subset (tvb, offset, payload_len, -1);
557 offset += payload_len;
559 ci = proto_tree_add_item (af_tree, hf_edcp_crc, tvb, offset, 2, FALSE);
560 if (ver & 0x80) { /* crc valid */
561 guint len = offset+2;
562 const char *crc_buf = (const char *) tvb_get_ptr(tvb, 0, len);
563 unsigned long c = crc_drm(crc_buf, len, 16, 0x11021, 1);
565 proto_item_append_text(ci, " (%s)", (c==0xe2f0)?"Ok":"bad");
566 proto_tree_add_boolean(af_tree, hf_edcp_crc_ok, tvb, offset, 2, c==0xe2f0);
570 dissector_try_port(af_dissector_table, pt, next_tvb, pinfo, tree);
573 /** Dissect the Tag Packet Layer.
574 * Split the AF packet into its tag items. Each tag item has a 4 character
575 * tag, a length in bits and a value. The *ptr tag is dissected in the routine.
576 * All other tags are listed and may be handled by other dissectors.
577 * Child dissectors are tied to the parent tree, not to this tree, so that
578 * they appear at the same level as DCP.
579 * \param[in,out] tvb The buffer containing the packet
580 * \param[in,out] pinfo The packet info structure
581 * \param[in,out] tree The structure containing the details which will be displayed, filtered, etc.
584 dissect_tpl(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree)
586 proto_tree *tpl_tree = NULL;
591 pinfo->current_proto = "DCP-TPL";
592 if (check_col (pinfo->cinfo, COL_PROTOCOL)) {
593 col_set_str (pinfo->cinfo, COL_PROTOCOL, "DCP-TPL");
597 proto_item *ti = NULL;
598 ti = proto_tree_add_item (tree, proto_tpl, tvb, 0, -1, FALSE);
599 tpl_tree = proto_item_add_subtree (ti, ett_tpl);
601 while(offset<tvb_length(tvb)) {
604 char *tag = (char*)tvb_get_string (tvb, offset, 4); offset += 4;
605 bits = tvb_get_ntohl(tvb, offset); offset += 4;
610 proto_item *i = NULL;
611 const guint8 *p = tvb_get_ptr(tvb, offset, bytes);
612 if(strcmp(tag, "*ptr")==0) {
613 prot = (char*)tvb_get_string (tvb, offset, 4);
614 maj = tvb_get_ntohs(tvb, offset+4);
615 min = tvb_get_ntohs(tvb, offset+6);
616 i = proto_tree_add_bytes_format(tpl_tree, hf_tpl_tlv, tvb,
617 offset-8, bytes+8, p, "%s %s rev %d.%d", tag, prot, maj, min);
619 i = proto_tree_add_bytes_format(tpl_tree, hf_tpl_tlv, tvb,
620 offset-8, bytes+8, p, "%s (%u bits)", tag, bits);
625 if(prot) { /* prot is non-NULL only if we have our tree. */
626 dissector_try_string(tpl_dissector_table, prot, tvb, pinfo, tree->parent);
631 proto_reg_handoff_dcp_etsi (void)
633 static int Initialized = FALSE;
636 af_handle = create_dissector_handle(dissect_af, proto_af);
637 pft_handle = create_dissector_handle(dissect_pft, proto_pft);
638 tpl_handle = create_dissector_handle(dissect_tpl, proto_tpl);
639 heur_dissector_add("udp", dissect_dcp_etsi, proto_dcp_etsi);
640 dissector_add_string("dcp-etsi.sync", "AF", af_handle);
641 dissector_add_string("dcp-etsi.sync", "PF", pft_handle);
642 /* if there are ever other payload types ...*/
643 dissector_add("dcp-af.pt", 'T', tpl_handle);
648 proto_register_dcp_etsi (void)
650 module_t *dcp_module;
651 static hf_register_info hf_edcp[] = {
653 {"sync", "dcp-etsi.sync",
654 FT_STRING, BASE_NONE, NULL, 0,
658 static hf_register_info hf_af[] = {
660 {"length", "dcp-af.len",
661 FT_UINT32, BASE_DEC, NULL, 0,
662 "length in bytes of the payload", HFILL}
665 {"frame count", "dcp-af.seq",
666 FT_UINT16, BASE_DEC, NULL, 0,
667 "Logical Frame Number", HFILL}
670 {"crc flag", "dcp-af.crcflag",
671 FT_BOOLEAN, BASE_NONE, NULL, 0x80,
672 "Frame is protected by CRC", HFILL}
675 {"Major Revision", "dcp-af.maj",
676 FT_UINT8, BASE_DEC, NULL, 0x70,
677 "Major Protocol Revision", HFILL}
680 {"Minor Revision", "dcp-af.min",
681 FT_UINT8, BASE_DEC, NULL, 0x0f,
682 "Minor Protocol Revision", HFILL}
685 {"Payload Type", "dcp-af.pt",
686 FT_STRING, BASE_NONE, NULL, 0,
687 "T means Tag Packets, all other values reserved", HFILL}
690 {"CRC", "dcp-af.crc",
691 FT_UINT16, BASE_HEX, NULL, 0,
695 {"CRC OK", "dcp-af.crc_ok",
696 FT_BOOLEAN, BASE_NONE, NULL, 0,
701 static hf_register_info hf_pft[] = {
703 {"Sub-protocol", "dcp-pft.pt",
704 FT_UINT8, BASE_DEC, NULL, 0,
708 {"Sequence No", "dcp-pft.seq",
709 FT_UINT16, BASE_DEC, NULL, 0,
710 "PFT Sequence No", HFILL}
713 {"Fragment Index", "dcp-pft.findex",
714 FT_UINT24, BASE_DEC, NULL, 0,
715 "Index of the fragment within one AF Packet", HFILL}
718 {"Fragment Count", "dcp-pft.fcount",
719 FT_UINT24, BASE_DEC, NULL, 0,
720 "Number of fragments produced from this AF Packet", HFILL}
723 {"FEC", "dcp-pft.fec",
724 FT_BOOLEAN, BASE_NONE, NULL, 0x8000,
725 "When set the optional RS header is present", HFILL}
728 {"Addr", "dcp-pft.addr",
729 FT_BOOLEAN, BASE_NONE, NULL, 0x4000,
730 "When set the optional transport header is present", HFILL}
733 {"fragment length", "dcp-pft.len",
734 FT_UINT16, BASE_DEC, NULL, 0x3fff,
735 "length in bytes of the payload of this fragment", HFILL}
738 {"RSk", "dcp-pft.rsk",
739 FT_UINT8, BASE_DEC, NULL, 0,
740 "The length of the Reed Solomon data word", HFILL}
743 {"RSz", "dcp-pft.rsz",
744 FT_UINT8, BASE_DEC, NULL, 0,
745 "The number of padding bytes in the last Reed Solomon block", HFILL}
748 {"source addr", "dcp-pft.source",
749 FT_UINT16, BASE_DEC, NULL, 0,
750 "PFT source identifier", HFILL}
753 {"dest addr", "dcp-pft.dest",
754 FT_UINT16, BASE_DEC, NULL, 0,
755 "PFT destination identifier", HFILL}
758 {"header CRC", "dcp-pft.crc",
759 FT_UINT16, BASE_HEX, NULL, 0,
760 "PFT Header CRC", HFILL}
763 {"PFT CRC OK", "dcp-pft.crc_ok",
764 FT_BOOLEAN, BASE_NONE, NULL, 0,
765 "PFT Header CRC OK", HFILL}
768 {"Message fragments", "dcp-pft.fragments",
769 FT_NONE, BASE_NONE, NULL, 0x00, NULL, HFILL}},
771 {"Message fragment", "dcp-pft.fragment",
772 FT_FRAMENUM, BASE_NONE, NULL, 0x00, NULL, HFILL}},
773 {&hf_edcp_fragment_overlap,
774 {"Message fragment overlap", "dcp-pft.fragment.overlap",
775 FT_BOOLEAN, BASE_NONE, NULL, 0x00, NULL, HFILL}},
776 {&hf_edcp_fragment_overlap_conflicts,
777 {"Message fragment overlapping with conflicting data",
778 "dcp-pft.fragment.overlap.conflicts",
779 FT_BOOLEAN, BASE_NONE, NULL, 0x00, NULL, HFILL}},
780 {&hf_edcp_fragment_multiple_tails,
781 {"Message has multiple tail fragments",
782 "dcp-pft.fragment.multiple_tails",
783 FT_BOOLEAN, BASE_NONE, NULL, 0x00, NULL, HFILL}},
784 {&hf_edcp_fragment_too_long_fragment,
785 {"Message fragment too long", "dcp-pft.fragment.too_long_fragment",
786 FT_BOOLEAN, BASE_NONE, NULL, 0x00, NULL, HFILL}},
787 {&hf_edcp_fragment_error,
788 {"Message defragmentation error", "dcp-pft.fragment.error",
789 FT_FRAMENUM, BASE_NONE, NULL, 0x00, NULL, HFILL}},
790 {&hf_edcp_reassembled_in,
791 {"Reassembled in", "dcp-pft.reassembled.in",
792 FT_FRAMENUM, BASE_NONE, NULL, 0x00, NULL, HFILL}},
794 {"C max", "dcp-pft.cmax",
795 FT_UINT16, BASE_DEC, NULL, 0,
796 "Maximum number of RS chunks sent", HFILL}
799 {"Rx min", "dcp-pft.rxmin",
800 FT_UINT16, BASE_DEC, NULL, 0,
801 "Minimum number of fragments needed for RS decode", HFILL}
803 {&hf_edcp_rs_corrected,
804 {"RS Symbols Corrected", "dcp-pft.rs_corrected",
805 FT_INT16, BASE_DEC, NULL, 0,
806 "Number of symbols corrected by RS decode or -1 for failure", HFILL}
809 {"RS decode OK", "dcp-pft.rs_ok",
810 FT_BOOLEAN, BASE_NONE, NULL, 0,
811 "successfully decoded RS blocks", HFILL}
813 {&hf_edcp_pft_payload,
814 {"payload", "dcp-pft.payload",
815 FT_BYTES, BASE_HEX, NULL, 0,
816 "PFT Payload", HFILL}
820 static hf_register_info hf_tpl[] = {
822 {"tag", "dcp-tpl.tlv",
823 FT_BYTES, BASE_HEX, NULL, 0,
827 {"Type", "dcp-tpl.ptr",
828 FT_STRING, BASE_NONE, NULL, 0,
829 "Protocol Type & Revision", HFILL}
833 /* Setup protocol subtree array */
834 static gint *ett[] = {
843 if (proto_dcp_etsi == -1) {
844 proto_dcp_etsi = proto_register_protocol ("ETSI Distribution & Communication Protocol (for DRM)", /* name */
845 "DCP (ETSI)", /* short name */
846 "dcp-etsi" /* abbrev */
848 proto_af = proto_register_protocol ("DCP Application Framing Layer", "DCP-AF", "dcp-af");
849 proto_pft = proto_register_protocol ("DCP Protection, Fragmentation & Transport Layer", "DCP-PFT", "dcp-pft");
850 proto_tpl = proto_register_protocol ("DCP Tag Packet Layer", "DCP-TPL", "dcp-tpl");
854 dcp_module = prefs_register_protocol (proto_dcp_etsi, proto_reg_handoff_dcp_etsi);
855 proto_register_field_array (proto_dcp_etsi, hf_edcp, array_length (hf_edcp));
856 proto_register_field_array (proto_af, hf_af, array_length (hf_af));
857 proto_register_field_array (proto_pft, hf_pft, array_length (hf_pft));
858 proto_register_field_array (proto_tpl, hf_tpl, array_length (hf_tpl));
859 proto_register_subtree_array (ett, array_length (ett));
861 /* subdissector code */
862 dcp_dissector_table = register_dissector_table("dcp-etsi.sync",
863 "DCP Sync", FT_STRING, BASE_NONE);
864 af_dissector_table = register_dissector_table("dcp-af.pt",
865 "AF Payload Type", FT_UINT8, BASE_DEC);
867 tpl_dissector_table = register_dissector_table("dcp-tpl.ptr",
868 "AF Payload Type", FT_STRING, BASE_NONE);
870 register_init_routine(dcp_init_protocol);