diff options
author | Nathan Neulinger <nneul@umr.edu> | 1999-11-30 17:58:32 +0000 |
---|---|---|
committer | Nathan Neulinger <nneul@umr.edu> | 1999-11-30 17:58:32 +0000 |
commit | 191f4cd4676d55182d3820627544d968d759de2b (patch) | |
tree | 0c79ac1794d077fbe787aa3a77cf0cbc0bfcee2b /packet-tns.c | |
parent | 4457d99d2e387ece6c0aba9c4d9fc4abe7eda382 (diff) | |
download | wireshark-191f4cd4676d55182d3820627544d968d759de2b.tar.gz wireshark-191f4cd4676d55182d3820627544d968d759de2b.tar.bz2 wireshark-191f4cd4676d55182d3820627544d968d759de2b.zip |
additions to tns dissector - sns and connect started
svn path=/trunk/; revision=1169
Diffstat (limited to 'packet-tns.c')
-rw-r--r-- | packet-tns.c | 136 |
1 files changed, 126 insertions, 10 deletions
diff --git a/packet-tns.c b/packet-tns.c index 326718879f..de4e469a54 100644 --- a/packet-tns.c +++ b/packet-tns.c @@ -1,7 +1,7 @@ /* packet-tns.c * Routines for MSX tns packet dissection * - * $Id: packet-tns.c,v 1.2 1999/11/30 09:48:31 guy Exp $ + * $Id: packet-tns.c,v 1.3 1999/11/30 17:58:32 nneul Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@unicom.net> @@ -51,8 +51,17 @@ static int hf_tns_packet_checksum = -1; static int hf_tns_header_checksum = -1; static int hf_tns_packet_type = -1; static int hf_tns_reserved_byte = -1; +static int hf_tns_data_flag = -1; +static int hf_tns_sns = -1; +static int hf_tns_connect = -1; +static int hf_tns_version = -1; +static int hf_tns_compat_version = -1; +static int hf_tns_service_options = -1; static gint ett_tns = -1; +static gint ett_tns_sns = -1; +static gint ett_tns_connect = -1; +static gint ett_sql = -1; static const value_string tns_type_vals[] = { {TNS_TYPE_CONNECT, "Connect" }, @@ -67,24 +76,110 @@ static const value_string tns_type_vals[] = { #define TRUNC(length) if ( ! BYTES_ARE_IN_FRAME(offset, length)) { \ dissect_data(pd,offset,fd,tree); return; } +void dissect_tns_sns(const u_char *pd, int offset, frame_data *fd, + proto_tree *tree, proto_tree *tns_tree) +{ + proto_tree *sns_tree = NULL, *ti; + + if ( tree ) + { + ti = proto_tree_add_text(tns_tree, offset, END_OF_FRAME, "Secure Network Services"); + sns_tree = proto_item_add_subtree(ti, ett_tns_sns); + + proto_tree_add_item_hidden(tns_tree, hf_tns_sns, 0, 0, TRUE); + } + + if ( check_col(fd, COL_INFO) ) + { + col_append_fstr(fd, COL_INFO, ", SNS"); + } + + if ( sns_tree ) + { + dissect_data(pd,offset,fd,sns_tree); + } +} + void dissect_tns_data(const u_char *pd, int offset, frame_data *fd, - proto_tree *tree) + proto_tree *tree, proto_tree *tns_tree) { + + TRUNC(2); + if ( tree ) + { + proto_tree_add_item(tns_tree, hf_tns_data_flag, + offset, 2, pntohs(&pd[offset])); + } + offset += 2; + + if ( BYTES_ARE_IN_FRAME(offset, 4) ) + { + if ( pd[offset] == 0xDE && pd[offset+1] == 0xAD && + pd[offset+2] == 0xBE && pd[offset+3] == 0xEF ) + { + dissect_tns_sns(pd,offset,fd,tree,tns_tree); + return; + } + } + dissect_data(pd,offset,fd,tree); return; } void dissect_tns_connect(const u_char *pd, int offset, frame_data *fd, - proto_tree *tree) + proto_tree *tree, proto_tree *tns_tree) { - dissect_data(pd,offset,fd,tree); + proto_tree *connect_tree = NULL, *ti; + + if ( tree ) + { + ti = proto_tree_add_text(tns_tree, offset, END_OF_FRAME, "Connect"); + connect_tree = proto_item_add_subtree(ti, ett_tns_connect); + + proto_tree_add_item_hidden(tns_tree, hf_tns_connect, 0, 0, TRUE); + } + + if ( check_col(fd, COL_INFO) ) + { + col_append_fstr(fd, COL_INFO, ", Connect"); + } + + TRUNC(2); + if ( connect_tree ) + { + proto_tree_add_item(connect_tree, hf_tns_version, + offset, 2, pntohs(&pd[offset])); + } + offset += 2; + + TRUNC(2); + if ( connect_tree ) + { + proto_tree_add_item(connect_tree, hf_tns_compat_version, + offset, 2, pntohs(&pd[offset])); + } + offset += 2; + + TRUNC(2); + if ( connect_tree ) + { + /* need to break down w/ bitfield */ + proto_tree_add_item(connect_tree, hf_tns_service_options, + offset, 2, pntohs(&pd[offset])); + } + offset += 2; + + if ( connect_tree ) + { + dissect_data(pd,offset,fd,connect_tree); + } return; } void dissect_tns_accept(const u_char *pd, int offset, frame_data *fd, - proto_tree *tree) + proto_tree *tree, proto_tree *tns_tree) { - dissect_data(pd,offset,fd,tree); + dissect_data(pd,offset,fd,tns_tree); return; } @@ -180,22 +275,28 @@ dissect_tns(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) switch (type) { case TNS_TYPE_CONNECT: - dissect_tns_connect(pd,offset,fd,tree); + dissect_tns_connect(pd,offset,fd,tree,tns_tree); break; case TNS_TYPE_ACCEPT: - dissect_tns_accept(pd,offset,fd,tree); + dissect_tns_accept(pd,offset,fd,tree,tns_tree); break; case TNS_TYPE_DATA: - dissect_tns_data(pd,offset,fd,tree); + dissect_tns_data(pd,offset,fd,tree,tns_tree); break; default: - dissect_data(pd,offset,fd,tree); + dissect_data(pd,offset,fd,tns_tree); } } void proto_register_tns(void) { static hf_register_info hf[] = { + { &hf_tns_sns, { + "Secure Network Services", "tns.sns", FT_BOOLEAN, BASE_NONE, + NULL, 0x0, "Secure Network Services" }}, + { &hf_tns_connect, { + "Connect", "tns.connect", FT_BOOLEAN, BASE_NONE, + NULL, 0x0, "Connect" }}, { &hf_tns_response, { "Response", "tns.response", FT_BOOLEAN, BASE_NONE, NULL, 0x0, "TRUE if TNS response" }}, @@ -211,6 +312,18 @@ void proto_register_tns(void) { &hf_tns_header_checksum, { "Header Checksum", "tns.header_checksum", FT_UINT16, BASE_HEX, NULL, 0x0, "Checksum of Header Data" }}, + { &hf_tns_data_flag, { + "Data Flag", "tns.data_flag", FT_UINT16, BASE_HEX, + NULL, 0x0, "Data Flag" }}, + { &hf_tns_version, { + "Version", "tns.version", FT_UINT16, BASE_DEC, + NULL, 0x0, "Version" }}, + { &hf_tns_compat_version, { + "Version (Compatible)", "tns.compat_version", FT_UINT16, BASE_DEC, + NULL, 0x0, "Version (Compatible)" }}, + { &hf_tns_service_options, { + "Service Options", "tns.service_options", FT_UINT16, BASE_HEX, + NULL, 0x0, "Service Options" }}, { &hf_tns_reserved_byte, { "Reserved Byte", "tns.reserved_byte", FT_BYTES, BASE_HEX, NULL, 0x0, "Reserved Byte" }}, @@ -221,6 +334,9 @@ void proto_register_tns(void) static gint *ett[] = { &ett_tns, + &ett_tns_sns, + &ett_tns_connect, + &ett_sql }; proto_tns = proto_register_protocol( "Transparent Network Substrate Protocol", "tns"); |