Ethereal-dev: [Ethereal-dev] COTP dissector updates
Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.
Date: Mon, 16 Aug 2004 21:23:40 +0100
Hello, This patch adds fields to the COTP dissector for: 1. DT TPDU number 2. Whether or not the DT data is the last data unit of a sequence 3. AK your TPDU number. Many thanks, Matthew Index: packet-clnp.c =================================================================== --- packet-clnp.c (revision 11753) +++ packet-clnp.c (working copy) @@ -77,6 +77,11 @@ static int hf_cotp_srcref = -1; static int hf_cotp_destref = -1; +static int hf_cotp_tpdu_number = -1; +static int hf_cotp_next_tpdu_number = -1; +static int hf_cotp_eot = -1; +static int hf_cotp_eot_extended = -1; + static int hf_cotp_type = -1; static int hf_cotp_segments = -1; static int hf_cotp_segment = -1; @@ -87,6 +92,11 @@ static int hf_cotp_segment_error = -1; static int hf_cotp_reassembled_in = -1; +static const true_false_string fragment_descriptions = { + "Yes", + "No" + }; + static int proto_cltp = -1; static gint ett_cltp = -1; @@ -861,6 +871,7 @@ guint tpdu_nr; guint fragment = 0; guint32 fragment_length = 0; + tvbuff_t *next_tvb; tvbuff_t *reassembled_tvb = NULL; fragment_data *fd_head; @@ -879,7 +890,7 @@ tpdu_nr = tvb_get_guint8(tvb, offset + P_TPDU_NR_234); if ( tpdu_nr & 0x80 ) tpdu_nr = tpdu_nr & 0x7F; - else + else fragment = 1; is_extended = FALSE; is_class_234 = TRUE; @@ -893,6 +904,7 @@ case LI_EXTENDED_DT_WITHOUT_CHECKSUM : tpdu_nr = tvb_get_ntohl(tvb, offset + P_TPDU_NR_234); + if ( tpdu_nr & 0x80000000 ) tpdu_nr = tpdu_nr & 0x7FFFFFFF; else @@ -904,6 +916,7 @@ case LI_NORMAL_DT_CLASS_01 : tpdu_nr = tvb_get_guint8(tvb, offset + P_TPDU_NR_0_1); + if ( tpdu_nr & 0x80 ) tpdu_nr = tpdu_nr & 0x7F; else @@ -959,19 +972,17 @@ if (is_extended) { if (tree) { - proto_tree_add_text(cotp_tree, tvb, offset, 4, - "TPDU number: 0x%08x (%s)", - tpdu_nr, - (fragment)? "fragment":"complete"); + proto_tree_add_uint(cotp_tree, hf_cotp_tpdu_number, tvb, offset, 4, tpdu_nr); + proto_tree_add_item(cotp_tree, hf_cotp_eot_extended, tvb, offset, 4, TRUE); + } offset += 4; li -= 4; } else { if (tree) { - proto_tree_add_text(cotp_tree, tvb, offset, 1, - "TPDU number: 0x%02x (%s)", - tpdu_nr, - (fragment)? "fragment":"complete"); + proto_tree_add_uint(cotp_tree, hf_cotp_tpdu_number, tvb, offset, 1, tpdu_nr); + proto_tree_add_item(cotp_tree, hf_cotp_eot, tvb, offset, 1, TRUE); + } offset += 1; li -= 1; @@ -1143,6 +1154,8 @@ if (is_extended) { if (tree) { + proto_tree_add_uint(cotp_tree, hf_cotp_tpdu_number, tvb, offset, 4, tpdu_nr); + proto_tree_add_text(cotp_tree, tvb, offset, 4, "TPDU number: 0x%02x", tpdu_nr); } @@ -1150,6 +1163,7 @@ li -= 4; } else { if (tree) { + proto_tree_add_uint(cotp_tree, hf_cotp_tpdu_number, tvb, offset, 1, tpdu_nr); proto_tree_add_text(cotp_tree, tvb, offset, 1, "TPDU number: 0x%02x", tpdu_nr); } @@ -1213,10 +1227,12 @@ proto_tree_add_text(cotp_tree, tvb, offset + 1, 1, "Credit: %u", cdt); proto_tree_add_uint(cotp_tree, hf_cotp_destref, tvb, offset + 2, 2, dst_ref); - if (li == LI_NORMAL_RJ) + if (li == LI_NORMAL_RJ) { + proto_tree_add_uint(cotp_tree, hf_cotp_next_tpdu_number, tvb, offset +4 , 1, tpdu_nr); proto_tree_add_text(cotp_tree, tvb, offset + 4, 1, "Your TPDU number: 0x%02x", tpdu_nr); - else { + } else { + proto_tree_add_item(cotp_tree, hf_cotp_next_tpdu_number, tvb, offset +4 , 4, TRUE); proto_tree_add_text(cotp_tree, tvb, offset + 4, 4, "Your TPDU number: 0x%02x", tpdu_nr); proto_tree_add_text(cotp_tree, tvb, offset + 8, 2, @@ -1415,6 +1431,7 @@ li -= 2; if (tree) { + proto_tree_add_uint(cotp_tree, hf_cotp_next_tpdu_number, tvb, offset , 1, tpdu_nr); proto_tree_add_text(cotp_tree, tvb, offset, 1, "Your TPDU number: 0x%02x", tpdu_nr); } @@ -1456,6 +1473,7 @@ li -= 2; if (tree) { + proto_tree_add_uint(cotp_tree, hf_cotp_next_tpdu_number, tvb, offset , 4, tpdu_nr); proto_tree_add_text(cotp_tree, tvb, offset, 4, "Your TPDU number: 0x%08x", tpdu_nr); } @@ -1553,6 +1571,7 @@ if (is_extended) { if (tree) { + proto_tree_add_uint(cotp_tree, hf_cotp_next_tpdu_number, tvb, offset , 4, tpdu_nr); proto_tree_add_text(cotp_tree, tvb, offset, 4, "Your TPDU number: 0x%08x", tpdu_nr); } @@ -1560,6 +1579,7 @@ li -= 4; } else { if (tree) { + proto_tree_add_uint(cotp_tree, hf_cotp_next_tpdu_number, tvb, offset , 1, tpdu_nr); proto_tree_add_text(cotp_tree, tvb, offset, 1, "Your TPDU number: 0x%02x", tpdu_nr); } @@ -2292,7 +2312,20 @@ { &hf_cotp_type, { "COTP PDU Type", "cotp.type", FT_UINT8, BASE_HEX, VALS(cotp_tpdu_type_abbrev_vals), 0x0, "COTP PDU Type", HFILL}}, - { &hf_cotp_segment_overlap, + { &hf_cotp_tpdu_number, + { "TPDU Number", "cotp.tpdu-number", FT_UINT8, BASE_HEX, NULL, 0x0, + "TPDU number", HFILL}}, + { &hf_cotp_next_tpdu_number, + { "Your TPDU Number", "cotp.next-tpdu-number", FT_UINT8, BASE_HEX, NULL, 0x0, + "Your TPDU number", HFILL}}, + { &hf_cotp_eot, + { "Last data unit", "cotp.eot", FT_BOOLEAN, 8, TFS(&fragment_descriptions), 0x80, + "Is current TPDU the last data unit of a complete DT TPDU sequence?", HFILL}}, + { &hf_cotp_eot_extended, + { "Last data unit", "cotp.eot", FT_BOOLEAN, 32, TFS(&fragment_descriptions), 0x80000000, + "Is current TPDU the last data unit of a complete DT TPDU sequence?", HFILL}}, + + { &hf_cotp_segment_overlap, { "Segment overlap", "cotp.segment.overlap", FT_BOOLEAN, BASE_NONE, NULL, 0x0, "Segment overlaps with other segments", HFILL }}, { &hf_cotp_segment_overlap_conflict, Community Network Services Ltd.. 204-207 Western Docks, Southampton, Hants. SO15 1DA Switchboard : +44 (0)845 6589920 Fax : +44 (0)2380 799602 Help Desk : +44 (0)845 6589930 http://www.cnsonline.net/ Reg. no. 2084279 England ************************************************************* All views or opinions expressed herein are solely those of the author and do not necessarily represent those of Community Network Services Ltd who do not accept liability for any action taken in reliance on the contents of this message (other than where the company has a legal or regulatory obligation to do so) or for the consequences of any computer viruses which may have been transmitted by this E-Mail The E-Mail and any files transmitted with it, are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this message in error please notify the sender and delete the message immediately or alternatively email postmaster@xxxxxxxxxxxxx ***************************************************************
- Prev by Date: [Ethereal-dev] RTP decode question
- Next by Date: Re: [Ethereal-dev] RTP decode question
- Previous by thread: Re: [Ethereal-dev] RTP decode question
- Next by thread: [Ethereal-dev] 0.10.6 and OpenBSD 3.5
- Index(es):