forked from osmocom/wireshark
From Laurent Meyer: add filterable fields to COTP.
svn path=/trunk/; revision=7463
This commit is contained in:
parent
e04f6f760a
commit
8b1339c7fc
1
AUTHORS
1
AUTHORS
|
@ -1635,6 +1635,7 @@ Wayne Parrott <wayne_p [AT] pacific.net.au> {
|
|||
|
||||
Laurent Meyer <laurent.meyer [AT] thales-avionics.com> {
|
||||
X.25 reassembly
|
||||
Filterable fields in COTP
|
||||
}
|
||||
|
||||
Lars Roland <Lars.Roland [AT] gmx.net> {
|
||||
|
|
124
packet-clnp.c
124
packet-clnp.c
|
@ -1,7 +1,7 @@
|
|||
/* packet-clnp.c
|
||||
* Routines for ISO/OSI network and transport protocol packet disassembly
|
||||
*
|
||||
* $Id: packet-clnp.c,v 1.68 2003/03/04 06:47:08 guy Exp $
|
||||
* $Id: packet-clnp.c,v 1.69 2003/04/15 10:25:55 guy Exp $
|
||||
* Laurent Deniel <laurent.deniel@free.fr>
|
||||
* Ralf Schneider <Ralf.Schneider@t-online.de>
|
||||
*
|
||||
|
@ -73,6 +73,10 @@ static int hf_clnp_segment_multiple_tails = -1;
|
|||
static int hf_clnp_segment_too_long_segment = -1;
|
||||
static int hf_clnp_segment_error = -1;
|
||||
|
||||
static int hf_cotp_srcref = -1;
|
||||
static int hf_cotp_destref = -1;
|
||||
static int hf_cotp_type = -1;
|
||||
|
||||
static const fragment_items clnp_frag_items = {
|
||||
&ett_clnp_segment,
|
||||
&ett_clnp_segments,
|
||||
|
@ -183,6 +187,21 @@ struct clnp_segment {
|
|||
#define CR_TPDU 0xE /* COTP */
|
||||
#define DT_TPDU 0xF /* COTP */
|
||||
|
||||
static const value_string tpdu_type_abbrev_vals[] = {
|
||||
{ ED_TPDU, "ED" },
|
||||
{ EA_TPDU, "EA" },
|
||||
{ UD_TPDU, "UD" },
|
||||
{ RJ_TPDU, "RJ" },
|
||||
{ AK_TPDU, "AK" },
|
||||
{ ER_TPDU, "ER" },
|
||||
{ DR_TPDU, "DR" },
|
||||
{ DC_TPDU, "DC" },
|
||||
{ CC_TPDU, "CC" },
|
||||
{ CR_TPDU, "CR" },
|
||||
{ DT_TPDU, "DT" },
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
/* field position */
|
||||
|
||||
#define P_LI 0
|
||||
|
@ -683,7 +702,9 @@ static int ositp_decode_DR(tvbuff_t *tvb, int offset, guint8 li, guint8 tpdu,
|
|||
return -1;
|
||||
|
||||
dst_ref = tvb_get_ntohs(tvb, offset + P_DST_REF);
|
||||
|
||||
src_ref = tvb_get_ntohs(tvb, offset + P_SRC_REF);
|
||||
|
||||
reason = tvb_get_guint8(tvb, offset + P_REASON_IN_DR);
|
||||
|
||||
switch(reason) {
|
||||
|
@ -715,11 +736,11 @@ static int ositp_decode_DR(tvbuff_t *tvb, int offset, guint8 li, guint8 tpdu,
|
|||
cotp_tree = proto_item_add_subtree(ti, ett_cotp);
|
||||
proto_tree_add_text(cotp_tree, tvb, offset, 1,
|
||||
"Length indicator: %u", li);
|
||||
proto_tree_add_text(cotp_tree, tvb, offset + 1, 1,
|
||||
"TPDU code: 0x%x (DR)", tpdu);
|
||||
proto_tree_add_text(cotp_tree, tvb, offset + 2, 2,
|
||||
proto_tree_add_uint_format(cotp_tree, hf_cotp_type, tvb, offset + 1, 1, tpdu,
|
||||
"TPDU code: 0x%x (DR)", tpdu);
|
||||
proto_tree_add_uint_format(cotp_tree, hf_cotp_destref, tvb, offset + 2, 2, dst_ref,
|
||||
"Destination reference: 0x%04x", dst_ref);
|
||||
proto_tree_add_text(cotp_tree, tvb, offset + 4, 2,
|
||||
proto_tree_add_uint_format(cotp_tree, hf_cotp_srcref, tvb, offset + 4, 2, src_ref,
|
||||
"Source reference: 0x%04x", src_ref);
|
||||
proto_tree_add_text(cotp_tree, tvb, offset + 6, 1,
|
||||
"Cause: %s", str);
|
||||
|
@ -826,16 +847,15 @@ static int ositp_decode_DT(tvbuff_t *tvb, int offset, guint8 li, guint8 tpdu,
|
|||
offset += 1;
|
||||
|
||||
if (tree) {
|
||||
proto_tree_add_text(cotp_tree, tvb, offset, 1,
|
||||
proto_tree_add_uint_format(cotp_tree, hf_cotp_type, tvb, offset, 1, tpdu,
|
||||
"TPDU code: 0x%x (DT)", tpdu);
|
||||
|
||||
}
|
||||
offset += 1;
|
||||
li -= 1;
|
||||
|
||||
if (is_class_234) {
|
||||
if (tree) {
|
||||
proto_tree_add_text(cotp_tree, tvb, offset, 2,
|
||||
proto_tree_add_uint_format(cotp_tree, hf_cotp_destref, tvb, offset, 2, dst_ref,
|
||||
"Destination reference: 0x%04x", dst_ref);
|
||||
}
|
||||
offset += 2;
|
||||
|
@ -955,14 +975,14 @@ static int ositp_decode_ED(tvbuff_t *tvb, int offset, guint8 li, guint8 tpdu,
|
|||
offset += 1;
|
||||
|
||||
if (tree) {
|
||||
proto_tree_add_text(cotp_tree, tvb, offset, 1,
|
||||
proto_tree_add_uint_format(cotp_tree, hf_cotp_type, tvb, offset, 1, tpdu,
|
||||
"TPDU code: 0x%x (ED)", tpdu);
|
||||
}
|
||||
offset += 1;
|
||||
li -= 1;
|
||||
|
||||
if (tree) {
|
||||
proto_tree_add_text(cotp_tree, tvb, offset, 2,
|
||||
proto_tree_add_uint_format(cotp_tree, hf_cotp_destref, tvb, offset, 2, dst_ref,
|
||||
"Destination reference: 0x%04x", dst_ref);
|
||||
}
|
||||
offset += 2;
|
||||
|
@ -1031,12 +1051,12 @@ static int ositp_decode_RJ(tvbuff_t *tvb, int offset, guint8 li, guint8 tpdu,
|
|||
cotp_tree = proto_item_add_subtree(ti, ett_cotp);
|
||||
proto_tree_add_text(cotp_tree, tvb, offset, 1,
|
||||
"Length indicator: %u", li);
|
||||
proto_tree_add_text(cotp_tree, tvb, offset + 1, 1,
|
||||
proto_tree_add_uint_format(cotp_tree, hf_cotp_type, tvb, offset + 1, 1, tpdu,
|
||||
"TPDU code: 0x%x (RJ)", tpdu);
|
||||
if (li == LI_NORMAL_RJ)
|
||||
proto_tree_add_text(cotp_tree, tvb, offset + 1, 1,
|
||||
"Credit: %u", cdt);
|
||||
proto_tree_add_text(cotp_tree, tvb, offset + 2, 2,
|
||||
proto_tree_add_uint_format(cotp_tree, hf_cotp_destref, tvb, offset + 2, 2, dst_ref,
|
||||
"Destination reference: 0x%04x", dst_ref);
|
||||
if (li == LI_NORMAL_RJ)
|
||||
proto_tree_add_text(cotp_tree, tvb, offset + 4, 1,
|
||||
|
@ -1070,6 +1090,7 @@ static int ositp_decode_CC(tvbuff_t *tvb, int offset, guint8 li, guint8 tpdu,
|
|||
tvbuff_t *next_tvb;
|
||||
|
||||
src_ref = tvb_get_ntohs(tvb, offset + P_SRC_REF);
|
||||
|
||||
class_option = (tvb_get_guint8(tvb, offset + P_CLASS_OPTION) >> 4 ) & 0x0F;
|
||||
if (class_option > 4)
|
||||
return -1;
|
||||
|
@ -1091,7 +1112,7 @@ static int ositp_decode_CC(tvbuff_t *tvb, int offset, guint8 li, guint8 tpdu,
|
|||
offset += 1;
|
||||
|
||||
if (tree) {
|
||||
proto_tree_add_text(cotp_tree, tvb, offset, 1,
|
||||
proto_tree_add_uint_format(cotp_tree, hf_cotp_type, tvb, offset, 1, tpdu,
|
||||
"TPDU code: 0x%x (%s)", tpdu,
|
||||
(tpdu == CR_TPDU) ? "CR" : "CC");
|
||||
}
|
||||
|
@ -1099,14 +1120,14 @@ static int ositp_decode_CC(tvbuff_t *tvb, int offset, guint8 li, guint8 tpdu,
|
|||
li -= 1;
|
||||
|
||||
if (tree) {
|
||||
proto_tree_add_text(cotp_tree, tvb, offset, 2,
|
||||
proto_tree_add_uint_format(cotp_tree, hf_cotp_destref, tvb, offset, 2, dst_ref,
|
||||
"Destination reference: 0x%04x", dst_ref);
|
||||
}
|
||||
offset += 2;
|
||||
li -= 2;
|
||||
|
||||
if (tree) {
|
||||
proto_tree_add_text(cotp_tree, tvb, offset, 2,
|
||||
proto_tree_add_uint_format(cotp_tree, hf_cotp_srcref, tvb, offset, 2, src_ref,
|
||||
"Source reference: 0x%04x", src_ref);
|
||||
}
|
||||
offset += 2;
|
||||
|
@ -1169,21 +1190,21 @@ static int ositp_decode_DC(tvbuff_t *tvb, int offset, guint8 li, guint8 tpdu,
|
|||
offset += 1;
|
||||
|
||||
if (tree) {
|
||||
proto_tree_add_text(cotp_tree, tvb, offset, 1,
|
||||
proto_tree_add_uint_format(cotp_tree, hf_cotp_type, tvb, offset, 1, tpdu,
|
||||
"TPDU code: 0x%x (DC)", tpdu);
|
||||
}
|
||||
offset += 1;
|
||||
li -= 1;
|
||||
|
||||
if (tree) {
|
||||
proto_tree_add_text(cotp_tree, tvb, offset, 2,
|
||||
proto_tree_add_uint_format(cotp_tree, hf_cotp_destref, tvb, offset, 2, dst_ref,
|
||||
"Destination reference: 0x%04x", dst_ref);
|
||||
}
|
||||
offset += 2;
|
||||
li -= 2;
|
||||
|
||||
if (tree) {
|
||||
proto_tree_add_text(cotp_tree, tvb, offset, 2,
|
||||
proto_tree_add_uint_format(cotp_tree, hf_cotp_srcref, tvb, offset, 2, src_ref,
|
||||
"Source reference: 0x%04x", src_ref);
|
||||
}
|
||||
offset += 2;
|
||||
|
@ -1227,7 +1248,7 @@ static int ositp_decode_AK(tvbuff_t *tvb, int offset, guint8 li, guint8 tpdu,
|
|||
offset += 1;
|
||||
|
||||
if (tree) {
|
||||
proto_tree_add_text(cotp_tree, tvb, offset, 1,
|
||||
proto_tree_add_uint_format(cotp_tree, hf_cotp_type, tvb, offset, 1, tpdu,
|
||||
"TPDU code: 0x%x (AK)", tpdu);
|
||||
proto_tree_add_text(cotp_tree, tvb, offset, 1,
|
||||
"Credit: %u", cdt);
|
||||
|
@ -1236,7 +1257,7 @@ static int ositp_decode_AK(tvbuff_t *tvb, int offset, guint8 li, guint8 tpdu,
|
|||
li -= 1;
|
||||
|
||||
if (tree) {
|
||||
proto_tree_add_text(cotp_tree, tvb, offset, 2,
|
||||
proto_tree_add_uint_format(cotp_tree, hf_cotp_destref, tvb, offset, 2, dst_ref,
|
||||
"Destination reference: 0x%04x", dst_ref);
|
||||
}
|
||||
offset += 2;
|
||||
|
@ -1272,14 +1293,14 @@ static int ositp_decode_AK(tvbuff_t *tvb, int offset, guint8 li, guint8 tpdu,
|
|||
offset += 1;
|
||||
|
||||
if (tree) {
|
||||
proto_tree_add_text(cotp_tree, tvb, offset, 1,
|
||||
proto_tree_add_uint_format(cotp_tree, hf_cotp_type, tvb, offset, 1, tpdu,
|
||||
"TPDU code: 0x%x (AK)", tpdu);
|
||||
}
|
||||
offset += 1;
|
||||
li -= 1;
|
||||
|
||||
if (tree) {
|
||||
proto_tree_add_text(cotp_tree, tvb, offset, 2,
|
||||
proto_tree_add_uint_format(cotp_tree, hf_cotp_destref, tvb, offset, 2, dst_ref,
|
||||
"Destination reference: 0x%04x", dst_ref);
|
||||
}
|
||||
offset += 2;
|
||||
|
@ -1368,14 +1389,14 @@ static int ositp_decode_EA(tvbuff_t *tvb, int offset, guint8 li, guint8 tpdu,
|
|||
offset += 1;
|
||||
|
||||
if (tree) {
|
||||
proto_tree_add_text(cotp_tree, tvb, offset, 1,
|
||||
proto_tree_add_uint_format(cotp_tree, hf_cotp_type, tvb, offset, 1, tpdu,
|
||||
"TPDU code: 0x%x (EA)", tpdu);
|
||||
}
|
||||
offset += 1;
|
||||
li -= 1;
|
||||
|
||||
if (tree) {
|
||||
proto_tree_add_text(cotp_tree, tvb, offset, 2,
|
||||
proto_tree_add_uint_format(cotp_tree, hf_cotp_destref, tvb, offset, 2, dst_ref,
|
||||
"Destination reference: 0x%04x", dst_ref);
|
||||
}
|
||||
offset += 2;
|
||||
|
@ -1444,9 +1465,9 @@ static int ositp_decode_ER(tvbuff_t *tvb, int offset, guint8 li, guint8 tpdu,
|
|||
cotp_tree = proto_item_add_subtree(ti, ett_cotp);
|
||||
proto_tree_add_text(cotp_tree, tvb, offset, 1,
|
||||
"Length indicator: %u", li);
|
||||
proto_tree_add_text(cotp_tree, tvb, offset + 1, 1,
|
||||
proto_tree_add_uint_format(cotp_tree, hf_cotp_type, tvb, offset + 1, 1, tpdu,
|
||||
"TPDU code: 0x%x (ER)", tpdu);
|
||||
proto_tree_add_text(cotp_tree, tvb, offset + 2, 2,
|
||||
proto_tree_add_uint_format(cotp_tree, hf_cotp_destref, tvb, offset + 2, 2, dst_ref,
|
||||
"Destination reference: 0x%04x", dst_ref);
|
||||
proto_tree_add_text(cotp_tree, tvb, offset + 4, 1,
|
||||
"Reject cause: %s", str);
|
||||
|
@ -1477,7 +1498,7 @@ static int ositp_decode_UD(tvbuff_t *tvb, int offset, guint8 li, guint8 tpdu,
|
|||
offset += 1;
|
||||
|
||||
if (tree) {
|
||||
proto_tree_add_text(cltp_tree, tvb, offset, 1,
|
||||
proto_tree_add_uint_format(cltp_tree, hf_cotp_type, tvb, offset, 1, tpdu,
|
||||
"TPDU code: 0x%x (UD)", tpdu);
|
||||
}
|
||||
offset += 1;
|
||||
|
@ -2105,26 +2126,33 @@ void proto_register_clnp(void)
|
|||
|
||||
void proto_register_cotp(void)
|
||||
{
|
||||
/* static hf_register_info hf[] = {
|
||||
{ &variable,
|
||||
{ "Name", "cotp.abbreviation", TYPE, VALS_POINTER }},
|
||||
};*/
|
||||
static gint *ett[] = {
|
||||
&ett_cotp,
|
||||
};
|
||||
static hf_register_info hf[] = {
|
||||
{ &hf_cotp_srcref,
|
||||
{ "Source address reference", "cotp.srcref", FT_UINT16, BASE_HEX, NULL, 0x0,
|
||||
"Source address reference", HFILL}},
|
||||
{ &hf_cotp_destref,
|
||||
{ "Destination address reference", "cotp.destref", FT_UINT16, BASE_HEX, NULL, 0x0,
|
||||
"Destination address reference", HFILL}},
|
||||
{ &hf_cotp_type,
|
||||
{ "COTP PDU Type", "cotp.type", FT_UINT8, BASE_HEX, VALS(tpdu_type_abbrev_vals), 0x0,
|
||||
"COTP PDU Type", HFILL}},
|
||||
};
|
||||
static gint *ett[] = {
|
||||
&ett_cotp,
|
||||
};
|
||||
|
||||
proto_cotp = proto_register_protocol(PROTO_STRING_COTP, "COTP", "cotp");
|
||||
/* proto_register_field_array(proto_cotp, hf, array_length(hf));*/
|
||||
proto_register_subtree_array(ett, array_length(ett));
|
||||
proto_cotp = proto_register_protocol(PROTO_STRING_COTP, "COTP", "cotp");
|
||||
proto_register_field_array(proto_cotp, hf, array_length(hf));
|
||||
proto_register_subtree_array(ett, array_length(ett));
|
||||
|
||||
/* subdissector code in inactive subset */
|
||||
register_heur_dissector_list("cotp_is", &cotp_is_heur_subdissector_list);
|
||||
/* subdissector code in inactive subset */
|
||||
register_heur_dissector_list("cotp_is", &cotp_is_heur_subdissector_list);
|
||||
|
||||
/* other COTP/ISO 8473 subdissectors */
|
||||
register_heur_dissector_list("cotp", &cotp_heur_subdissector_list);
|
||||
/* other COTP/ISO 8473 subdissectors */
|
||||
register_heur_dissector_list("cotp", &cotp_heur_subdissector_list);
|
||||
|
||||
/* XXX - what about CLTP and proto_cltp? */
|
||||
register_dissector("ositp", dissect_ositp, proto_cotp);
|
||||
/* XXX - what about CLTP and proto_cltp? */
|
||||
register_dissector("ositp", dissect_ositp, proto_cotp);
|
||||
}
|
||||
|
||||
void proto_register_cltp(void)
|
||||
|
@ -2146,10 +2174,10 @@ void proto_register_cltp(void)
|
|||
void
|
||||
proto_reg_handoff_clnp(void)
|
||||
{
|
||||
data_handle = find_dissector("data");
|
||||
data_handle = find_dissector("data");
|
||||
|
||||
clnp_handle = create_dissector_handle(dissect_clnp, proto_clnp);
|
||||
dissector_add("osinl", NLPID_ISO8473_CLNP, clnp_handle);
|
||||
dissector_add("osinl", NLPID_NULL, clnp_handle); /* Inactive subset */
|
||||
dissector_add("x.25.spi", NLPID_ISO8473_CLNP, clnp_handle);
|
||||
clnp_handle = create_dissector_handle(dissect_clnp, proto_clnp);
|
||||
dissector_add("osinl", NLPID_ISO8473_CLNP, clnp_handle);
|
||||
dissector_add("osinl", NLPID_NULL, clnp_handle); /* Inactive subset */
|
||||
dissector_add("x.25.spi", NLPID_ISO8473_CLNP, clnp_handle);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue