2 * Routines for Oracle TNS packet dissection
4 * $Id: packet-tns.c,v 1.29 2002/02/01 04:34:15 gram Exp $
6 * Ethereal - Network traffic analyzer
7 * By Gerald Combs <gerald@ethereal.com>
8 * Copyright 1998 Gerald Combs
10 * Copied from packet-tftp.c
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
33 #ifdef HAVE_SYS_TYPES_H
34 # include <sys/types.h>
37 #ifdef HAVE_NETINET_IN_H
38 # include <netinet/in.h>
43 #include <epan/packet.h>
44 #include "packet-tns.h"
46 static int proto_tns = -1;
47 static int hf_tns_request = -1;
48 static int hf_tns_response = -1;
49 static int hf_tns_length = -1;
50 static int hf_tns_packet_checksum = -1;
51 static int hf_tns_header_checksum = -1;
52 static int hf_tns_packet_type = -1;
53 static int hf_tns_reserved_byte = -1;
54 static int hf_tns_connect = -1;
55 static int hf_tns_version = -1;
56 static int hf_tns_compat_version = -1;
57 static int hf_tns_service_options = -1;
58 static int hf_tns_sdu_size = -1;
59 static int hf_tns_max_tdu_size = -1;
60 static int hf_tns_nt_proto_characteristics = -1;
61 static int hf_tns_line_turnaround = -1;
62 static int hf_tns_value_of_one = -1;
63 static int hf_tns_connect_data_length = -1;
64 static int hf_tns_connect_data_offset = -1;
65 static int hf_tns_connect_data_max = -1;
66 static int hf_tns_connect_flags0 = -1;
67 static int hf_tns_connect_flags1 = -1;
68 static int hf_tns_connect_data = -1;
69 static int hf_tns_trace_cf1 = -1;
70 static int hf_tns_trace_cf2 = -1;
71 static int hf_tns_trace_cid = -1;
73 static int hf_tns_accept = -1;
74 static int hf_tns_accept_data_length = -1;
75 static int hf_tns_accept_data_offset = -1;
76 static int hf_tns_accept_data = -1;
78 static int hf_tns_refuse = -1;
79 static int hf_tns_refuse_reason_user = -1;
80 static int hf_tns_refuse_reason_system = -1;
81 static int hf_tns_refuse_data_length = -1;
82 static int hf_tns_refuse_data = -1;
84 static int hf_tns_abort = -1;
85 static int hf_tns_abort_reason_user = -1;
86 static int hf_tns_abort_reason_system = -1;
87 static int hf_tns_abort_data = -1;
89 static int hf_tns_marker = -1;
90 static int hf_tns_marker_type = -1;
91 static int hf_tns_marker_data_byte = -1;
92 static int hf_tns_marker_data = -1;
94 static int hf_tns_redirect = -1;
95 static int hf_tns_redirect_data_length = -1;
96 static int hf_tns_redirect_data = -1;
98 static int hf_tns_control = -1;
99 static int hf_tns_control_cmd = -1;
100 static int hf_tns_control_data = -1;
102 static int hf_tns_data_flag = -1;
103 static int hf_tns_data_flag_send = -1;
104 static int hf_tns_data_flag_rc = -1;
105 static int hf_tns_data_flag_c = -1;
106 static int hf_tns_data_flag_reserved = -1;
107 static int hf_tns_data_flag_more = -1;
108 static int hf_tns_data_flag_eof = -1;
109 static int hf_tns_data_flag_dic = -1;
110 static int hf_tns_data_flag_rts = -1;
111 static int hf_tns_data_flag_sntt = -1;
112 static int hf_tns_data = -1;
114 static gint ett_tns = -1;
115 static gint ett_tns_connect = -1;
116 static gint ett_tns_accept = -1;
117 static gint ett_tns_refuse = -1;
118 static gint ett_tns_abort = -1;
119 static gint ett_tns_redirect = -1;
120 static gint ett_tns_marker = -1;
121 static gint ett_tns_attention = -1;
122 static gint ett_tns_control = -1;
123 static gint ett_tns_data = -1;
124 static gint ett_tns_data_flag = -1;
125 static gint ett_sql = -1;
127 static dissector_handle_t data_handle;
129 #define TCP_PORT_TNS 1521
131 static const value_string tns_type_vals[] = {
132 {TNS_TYPE_CONNECT, "Connect" },
133 {TNS_TYPE_ACCEPT, "Accept" },
134 {TNS_TYPE_ACK, "Acknowledge" },
135 {TNS_TYPE_REFUSE, "Refuse" },
136 {TNS_TYPE_REDIRECT, "Redirect" },
137 {TNS_TYPE_DATA, "Data" },
138 {TNS_TYPE_NULL, "Null" },
139 {TNS_TYPE_ABORT, "Abort" },
140 {TNS_TYPE_RESEND, "Resend"},
141 {TNS_TYPE_MARKER, "Marker"},
142 {TNS_TYPE_ATTENTION, "Attention"},
143 {TNS_TYPE_CONTROL, "Control"},
147 static const value_string tns_marker_types[] = {
148 {0, "Data Marker - 0 Data Bytes"},
149 {1, "Data Marker - 1 Data Bytes"},
150 {2, "Attention Marker"},
154 static const value_string tns_control_cmds[] = {
155 {1, "Oracle Trace Command"},
159 static void dissect_tns_data(tvbuff_t *tvb, int offset, packet_info *pinfo,
160 proto_tree *tree, proto_tree *tns_tree)
162 proto_tree *data_tree = NULL, *ti;
165 if ( tvb_bytes_exist(tvb, offset+2, 4) )
167 if ( tvb_get_guint8(tvb, offset+2) == 0xDE &&
168 tvb_get_guint8(tvb, offset+3) == 0xAD &&
169 tvb_get_guint8(tvb, offset+4) == 0xBE &&
170 tvb_get_guint8(tvb, offset+5) == 0xEF )
180 ti = proto_tree_add_text(tns_tree, tvb, offset, -1,
181 "Secure Network Services");
185 ti = proto_tree_add_text(tns_tree, tvb, offset, -1,
188 data_tree = proto_item_add_subtree(ti, ett_tns_data);
190 proto_tree_add_boolean_hidden(tns_tree, hf_tns_data, tvb, 0, 0,
196 proto_tree *df_tree = NULL;
198 ti = proto_tree_add_item(data_tree, hf_tns_data_flag, tvb, offset, 2, FALSE);
200 df_tree = proto_item_add_subtree(ti, ett_tns_data_flag);
201 proto_tree_add_item(df_tree, hf_tns_data_flag_send, tvb, offset, 2, FALSE);
202 proto_tree_add_item(df_tree, hf_tns_data_flag_rc, tvb, offset, 2, FALSE);
203 proto_tree_add_item(df_tree, hf_tns_data_flag_c, tvb, offset, 2, FALSE);
204 proto_tree_add_item(df_tree, hf_tns_data_flag_reserved, tvb, offset, 2, FALSE);
205 proto_tree_add_item(df_tree, hf_tns_data_flag_more, tvb, offset, 2, FALSE);
206 proto_tree_add_item(df_tree, hf_tns_data_flag_eof, tvb, offset, 2, FALSE);
207 proto_tree_add_item(df_tree, hf_tns_data_flag_dic, tvb, offset, 2, FALSE);
208 proto_tree_add_item(df_tree, hf_tns_data_flag_rts, tvb, offset, 2, FALSE);
209 proto_tree_add_item(df_tree, hf_tns_data_flag_sntt, tvb, offset, 2, FALSE);
213 if ( check_col(pinfo->cinfo, COL_INFO) )
217 col_append_fstr(pinfo->cinfo, COL_INFO, ", SNS");
221 col_append_fstr(pinfo->cinfo, COL_INFO, ", Data");
227 call_dissector(data_handle,tvb_new_subset(tvb,offset,-1,tvb_reported_length_remaining(tvb,offset)),pinfo,data_tree);
233 static void dissect_tns_connect(tvbuff_t *tvb, int offset, packet_info *pinfo,
234 proto_tree *tree, proto_tree *tns_tree)
236 proto_tree *connect_tree = NULL, *ti;
239 int tns_offset = offset-8;
243 ti = proto_tree_add_text(tns_tree, tvb, offset, -1,
245 connect_tree = proto_item_add_subtree(ti, ett_tns_connect);
247 proto_tree_add_boolean_hidden(tns_tree, hf_tns_connect, tvb,
251 if ( check_col(pinfo->cinfo, COL_INFO) )
253 col_append_str(pinfo->cinfo, COL_INFO, ", Connect");
258 proto_tree_add_item(connect_tree, hf_tns_version, tvb,
265 proto_tree_add_item(connect_tree, hf_tns_compat_version, tvb,
272 /* need to break down w/ bitfield */
273 proto_tree_add_item(connect_tree, hf_tns_service_options, tvb,
280 proto_tree_add_item(connect_tree, hf_tns_sdu_size, tvb,
287 proto_tree_add_item(connect_tree, hf_tns_max_tdu_size, tvb,
294 proto_tree_add_item(connect_tree, hf_tns_nt_proto_characteristics, tvb,
301 proto_tree_add_item(connect_tree, hf_tns_line_turnaround, tvb,
308 proto_tree_add_item(connect_tree, hf_tns_value_of_one, tvb,
313 cd_len = tvb_get_ntohs(tvb, offset);
316 proto_tree_add_uint(connect_tree, hf_tns_connect_data_length, tvb,
321 cd_offset = tvb_get_ntohs(tvb, offset);
324 proto_tree_add_uint(connect_tree, hf_tns_connect_data_offset, tvb,
325 offset, 2, cd_offset);
331 proto_tree_add_item(connect_tree, hf_tns_connect_data_max, tvb,
338 proto_tree_add_item(connect_tree, hf_tns_connect_flags0, tvb,
345 proto_tree_add_item(connect_tree, hf_tns_connect_flags1, tvb,
352 proto_tree_add_item(connect_tree, hf_tns_trace_cf1, tvb,
359 proto_tree_add_item(connect_tree, hf_tns_trace_cf2, tvb,
366 proto_tree_add_item(connect_tree, hf_tns_trace_cid, tvb,
371 if ( connect_tree && cd_len > 0)
373 proto_tree_add_item(connect_tree, hf_tns_connect_data, tvb,
374 tns_offset+cd_offset, -1, FALSE);
379 static void dissect_tns_accept(tvbuff_t *tvb, int offset, packet_info *pinfo,
380 proto_tree *tree, proto_tree *tns_tree)
382 proto_tree *accept_tree = NULL, *ti;
385 int tns_offset = offset-8;
389 ti = proto_tree_add_text(tns_tree, tvb, offset, -1,
391 accept_tree = proto_item_add_subtree(ti, ett_tns_accept);
393 proto_tree_add_boolean_hidden(tns_tree, hf_tns_accept, tvb,
397 if ( check_col(pinfo->cinfo, COL_INFO) )
399 col_append_str(pinfo->cinfo, COL_INFO, ", Accept");
404 proto_tree_add_item(accept_tree, hf_tns_version, tvb,
411 proto_tree_add_item(accept_tree, hf_tns_service_options, tvb,
418 proto_tree_add_item(accept_tree, hf_tns_sdu_size, tvb,
425 proto_tree_add_item(accept_tree, hf_tns_max_tdu_size, tvb,
432 proto_tree_add_item(accept_tree, hf_tns_value_of_one, tvb,
437 accept_len = tvb_get_ntohs(tvb, offset);
440 proto_tree_add_uint(accept_tree, hf_tns_accept_data_length, tvb,
441 offset, 2, accept_len);
445 accept_offset = tvb_get_ntohs(tvb, offset);
448 proto_tree_add_uint(accept_tree, hf_tns_accept_data_offset, tvb,
449 offset, 2, accept_offset);
455 proto_tree_add_item(accept_tree, hf_tns_connect_flags0, tvb,
462 proto_tree_add_item(accept_tree, hf_tns_connect_flags1, tvb,
467 if ( accept_tree && accept_len > 0)
469 proto_tree_add_item(accept_tree, hf_tns_accept_data, tvb,
470 tns_offset+accept_offset, -1, FALSE);
476 static void dissect_tns_refuse(tvbuff_t *tvb, int offset, packet_info *pinfo,
477 proto_tree *tree, proto_tree *tns_tree)
479 proto_tree *refuse_tree = NULL, *ti;
483 ti = proto_tree_add_text(tns_tree, tvb, offset, -1,
485 refuse_tree = proto_item_add_subtree(ti, ett_tns_refuse);
487 proto_tree_add_boolean_hidden(tns_tree, hf_tns_refuse, tvb,
491 if ( check_col(pinfo->cinfo, COL_INFO) )
493 col_append_str(pinfo->cinfo, COL_INFO, ", Refuse");
498 proto_tree_add_item(refuse_tree, hf_tns_refuse_reason_user, tvb,
505 proto_tree_add_item(refuse_tree, hf_tns_refuse_reason_system, tvb,
512 proto_tree_add_item(refuse_tree, hf_tns_refuse_data_length, tvb,
519 proto_tree_add_item(refuse_tree, hf_tns_refuse_data, tvb,
526 static void dissect_tns_abort(tvbuff_t *tvb, int offset, packet_info *pinfo,
527 proto_tree *tree, proto_tree *tns_tree)
529 proto_tree *abort_tree = NULL, *ti;
533 ti = proto_tree_add_text(tns_tree, tvb, offset, -1,
535 abort_tree = proto_item_add_subtree(ti, ett_tns_abort);
537 proto_tree_add_boolean_hidden(tns_tree, hf_tns_abort, tvb,
541 if ( check_col(pinfo->cinfo, COL_INFO) )
543 col_append_str(pinfo->cinfo, COL_INFO, ", Abort");
548 proto_tree_add_item(abort_tree, hf_tns_abort_reason_user, tvb,
555 proto_tree_add_item(abort_tree, hf_tns_abort_reason_system, tvb,
562 proto_tree_add_item(abort_tree, hf_tns_abort_data, tvb,
569 static void dissect_tns_marker(tvbuff_t *tvb, int offset, packet_info *pinfo,
570 proto_tree *tree, proto_tree *tns_tree, int is_attention)
572 proto_tree *marker_tree = NULL, *ti;
578 ti = proto_tree_add_text(tns_tree, tvb, offset, -1,
583 ti = proto_tree_add_text(tns_tree, tvb, offset, -1,
587 marker_tree = proto_item_add_subtree(ti, ett_tns_marker);
588 proto_tree_add_boolean_hidden(tns_tree, hf_tns_marker, tvb,
592 if ( check_col(pinfo->cinfo, COL_INFO) )
596 col_append_str(pinfo->cinfo, COL_INFO, ", Marker");
600 col_append_str(pinfo->cinfo, COL_INFO, ", Attention");
606 proto_tree_add_item(marker_tree, hf_tns_marker_type, tvb,
613 proto_tree_add_item(marker_tree, hf_tns_marker_data_byte, tvb,
620 proto_tree_add_item(marker_tree, hf_tns_marker_data_byte, tvb,
628 static void dissect_tns_redirect(tvbuff_t *tvb, int offset, packet_info *pinfo,
629 proto_tree *tree, proto_tree *tns_tree)
631 proto_tree *redirect_tree = NULL, *ti;
635 ti = proto_tree_add_text(tns_tree, tvb, offset, -1,
637 redirect_tree = proto_item_add_subtree(ti, ett_tns_redirect);
639 proto_tree_add_boolean_hidden(tns_tree, hf_tns_redirect, tvb,
643 if ( check_col(pinfo->cinfo, COL_INFO) )
645 col_append_str(pinfo->cinfo, COL_INFO, ", Redirect");
650 proto_tree_add_item(redirect_tree, hf_tns_redirect_data_length, tvb,
657 proto_tree_add_item(redirect_tree, hf_tns_redirect_data, tvb,
663 static void dissect_tns_control(tvbuff_t *tvb, int offset, packet_info *pinfo,
664 proto_tree *tree, proto_tree *tns_tree)
666 proto_tree *control_tree = NULL, *ti;
670 ti = proto_tree_add_text(tns_tree, tvb, offset, -1,
672 control_tree = proto_item_add_subtree(ti, ett_tns_control);
674 proto_tree_add_boolean_hidden(tns_tree, hf_tns_control, tvb,
678 if ( check_col(pinfo->cinfo, COL_INFO) )
680 col_append_str(pinfo->cinfo, COL_INFO, ", Control");
685 proto_tree_add_item(control_tree, hf_tns_control_cmd, tvb,
692 proto_tree_add_item(control_tree, hf_tns_control_data, tvb,
701 dissect_tns(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
703 proto_tree *tns_tree = NULL, *ti;
708 if (check_col(pinfo->cinfo, COL_PROTOCOL))
709 col_set_str(pinfo->cinfo, COL_PROTOCOL, "TNS");
711 if (check_col(pinfo->cinfo, COL_INFO))
713 col_add_str(pinfo->cinfo, COL_INFO,
714 (pinfo->match_port == pinfo->destport) ? "Request" : "Response");
719 ti = proto_tree_add_item(tree, proto_tns, tvb, 0, -1, FALSE);
720 tns_tree = proto_item_add_subtree(ti, ett_tns);
722 if (pinfo->match_port == pinfo->destport)
724 proto_tree_add_boolean_hidden(tns_tree, hf_tns_request,
725 tvb, offset, 0, TRUE);
729 proto_tree_add_boolean_hidden(tns_tree, hf_tns_response,
730 tvb, offset, 0, TRUE);
734 length = tvb_get_ntohs(tvb, offset);
737 proto_tree_add_uint(tns_tree, hf_tns_length, tvb,
744 proto_tree_add_item(tns_tree, hf_tns_packet_checksum, tvb,
749 type = tvb_get_guint8(tvb, offset);
752 proto_tree_add_uint(tns_tree, hf_tns_packet_type, tvb,
757 if ( check_col(pinfo->cinfo, COL_INFO))
759 col_append_fstr(pinfo->cinfo, COL_INFO, ", %s (%u)",
760 val_to_str(type, tns_type_vals, "Unknown"), type);
765 proto_tree_add_item(tns_tree, hf_tns_reserved_byte, tvb,
772 proto_tree_add_item(tns_tree, hf_tns_header_checksum, tvb,
779 case TNS_TYPE_CONNECT:
780 dissect_tns_connect(tvb,offset,pinfo,tree,tns_tree);
782 case TNS_TYPE_ACCEPT:
783 dissect_tns_accept(tvb,offset,pinfo,tree,tns_tree);
785 case TNS_TYPE_REFUSE:
786 dissect_tns_refuse(tvb,offset,pinfo,tree,tns_tree);
788 case TNS_TYPE_REDIRECT:
789 dissect_tns_redirect(tvb,offset,pinfo,tree,tns_tree);
792 dissect_tns_abort(tvb,offset,pinfo,tree,tns_tree);
794 case TNS_TYPE_MARKER:
795 dissect_tns_marker(tvb,offset,pinfo,tree,tns_tree, 0);
797 case TNS_TYPE_ATTENTION:
798 dissect_tns_marker(tvb,offset,pinfo,tree,tns_tree, 1);
800 case TNS_TYPE_CONTROL:
801 dissect_tns_control(tvb,offset,pinfo,tree,tns_tree);
804 dissect_tns_data(tvb,offset,pinfo,tree,tns_tree);
807 call_dissector(data_handle,tvb_new_subset(tvb,offset,-1,tvb_reported_length_remaining(tvb,offset)),pinfo,tns_tree);
811 void proto_register_tns(void)
813 static hf_register_info hf[] = {
814 { &hf_tns_response, {
815 "Response", "tns.response", FT_BOOLEAN, BASE_NONE,
816 NULL, 0x0, "TRUE if TNS response", HFILL }},
818 "Request", "tns.request", FT_BOOLEAN, BASE_NONE,
819 NULL, 0x0, "TRUE if TNS request", HFILL }},
821 "Packet Length", "tns.length", FT_UINT16, BASE_DEC,
822 NULL, 0x0, "Length of TNS packet", HFILL }},
823 { &hf_tns_packet_checksum, {
824 "Packet Checksum", "tns.packet_checksum", FT_UINT16, BASE_HEX,
825 NULL, 0x0, "Checksum of Packet Data", HFILL }},
826 { &hf_tns_header_checksum, {
827 "Header Checksum", "tns.header_checksum", FT_UINT16, BASE_HEX,
828 NULL, 0x0, "Checksum of Header Data", HFILL }},
831 "Version", "tns.version", FT_UINT16, BASE_DEC,
832 NULL, 0x0, "Version", HFILL }},
833 { &hf_tns_compat_version, {
834 "Version (Compatible)", "tns.compat_version", FT_UINT16, BASE_DEC,
835 NULL, 0x0, "Version (Compatible)", HFILL }},
836 { &hf_tns_service_options, {
837 "Service Options", "tns.service_options", FT_UINT16, BASE_HEX,
838 NULL, 0x0, "Service Options", HFILL }},
839 { &hf_tns_sdu_size, {
840 "Session Data Unit Size", "tns.sdu_size", FT_UINT16, BASE_DEC,
841 NULL, 0x0, "Session Data Unit Size", HFILL }},
842 { &hf_tns_max_tdu_size, {
843 "Maximum Transmission Data Unit Size", "tns.max_tdu_size", FT_UINT16, BASE_DEC,
844 NULL, 0x0, "Maximum Transmission Data Unit Size", HFILL }},
845 { &hf_tns_nt_proto_characteristics, {
846 "NT Protocol Characteristics", "tns.nt_proto_characteristics", FT_UINT16, BASE_HEX,
847 NULL, 0x0, "NT Protocol Characteristics", HFILL }},
848 { &hf_tns_line_turnaround, {
849 "Line Turnaround Value", "tns.line_turnaround", FT_UINT16, BASE_DEC,
850 NULL, 0x0, "Line Turnaround Value", HFILL }},
851 { &hf_tns_value_of_one, {
852 "Value of 1 in Hardware", "tns.value_of_one", FT_BYTES, BASE_NONE,
853 NULL, 0x0, "Value of 1 in Hardware", HFILL }},
856 "Connect", "tns.connect", FT_BOOLEAN, BASE_NONE,
857 NULL, 0x0, "Connect", HFILL }},
858 { &hf_tns_connect_data_length, {
859 "Length of Connect Data", "tns.connect_data_length", FT_UINT16, BASE_DEC,
860 NULL, 0x0, "Length of Connect Data", HFILL }},
861 { &hf_tns_connect_data_offset, {
862 "Offset to Connect Data", "tns.connect_data_offset", FT_UINT16, BASE_DEC,
863 NULL, 0x0, "Offset to Connect Data", HFILL }},
864 { &hf_tns_connect_data_max, {
865 "Maximum Receivable Connect Data", "tns.connect_data_max", FT_UINT32, BASE_DEC,
866 NULL, 0x0, "Maximum Receivable Connect Data", HFILL }},
867 { &hf_tns_connect_flags0, {
868 "Connect Flags 0", "tns.connect_flags0", FT_UINT8, BASE_HEX,
869 NULL, 0x0, "Connect Flags 0", HFILL }},
870 { &hf_tns_connect_flags1, {
871 "Connect Flags 1", "tns.connect_flags1", FT_UINT8, BASE_HEX,
872 NULL, 0x0, "Connect Flags 1", HFILL }},
873 { &hf_tns_trace_cf1, {
874 "Trace Cross Facility Item 1", "tns.trace_cf1", FT_UINT16, BASE_HEX,
875 NULL, 0x0, "Trace Cross Facility Item 1", HFILL }},
876 { &hf_tns_trace_cf2, {
877 "Trace Cross Facility Item 2", "tns.trace_cf2", FT_UINT16, BASE_HEX,
878 NULL, 0x0, "Trace Cross Facility Item 2", HFILL }},
879 { &hf_tns_trace_cid, {
880 "Trace Unique Connection ID", "tns.trace_cid", FT_UINT16, BASE_HEX,
881 NULL, 0x0, "Trace Unique Connection ID", HFILL }},
882 { &hf_tns_connect_data, {
883 "Connect Data", "tns.connect_data", FT_STRING, BASE_NONE,
884 NULL, 0x0, "Connect Data", HFILL }},
887 "Accept", "tns.accept", FT_BOOLEAN, BASE_NONE,
888 NULL, 0x0, "Accept", HFILL }},
889 { &hf_tns_accept_data_length, {
890 "Accept Data Length", "tns.accept_data_length", FT_UINT16, BASE_HEX,
891 NULL, 0x0, "Length of Accept Data", HFILL }},
892 { &hf_tns_accept_data, {
893 "Accept Data", "tns.accept_data", FT_STRING, BASE_NONE,
894 NULL, 0x0, "Accept Data", HFILL }},
895 { &hf_tns_accept_data_offset, {
896 "Offset to Accept Data", "tns.accept_data_offset", FT_UINT16, BASE_DEC,
897 NULL, 0x0, "Offset to Accept Data", HFILL }},
901 "Refuse", "tns.refuse", FT_BOOLEAN, BASE_NONE,
902 NULL, 0x0, "Refuse", HFILL }},
903 { &hf_tns_refuse_reason_user, {
904 "Refuse Reason (User)", "tns.refuse_reason_user", FT_UINT8, BASE_HEX,
905 NULL, 0x0, "Refuse Reason from Application", HFILL }},
906 { &hf_tns_refuse_reason_system, {
907 "Refuse Reason (User)", "tns.refuse_reason_system", FT_UINT8, BASE_HEX,
908 NULL, 0x0, "Refuse Reason from System", HFILL }},
909 { &hf_tns_refuse_data_length, {
910 "Refuse Data Length", "tns.refuse_data_length", FT_UINT16, BASE_HEX,
911 NULL, 0x0, "Length of Refuse Data", HFILL }},
912 { &hf_tns_refuse_data, {
913 "Refuse Data", "tns.refuse_data", FT_STRING, BASE_NONE,
914 NULL, 0x0, "Refuse Data", HFILL }},
917 "Abort", "tns.abort", FT_BOOLEAN, BASE_NONE,
918 NULL, 0x0, "Abort", HFILL }},
919 { &hf_tns_abort_reason_user, {
920 "Abort Reason (User)", "tns.abort_reason_user", FT_UINT8, BASE_HEX,
921 NULL, 0x0, "Abort Reason from Application", HFILL }},
922 { &hf_tns_abort_reason_system, {
923 "Abort Reason (User)", "tns.abort_reason_system", FT_UINT8, BASE_HEX,
924 NULL, 0x0, "Abort Reason from System", HFILL }},
925 { &hf_tns_abort_data, {
926 "Abort Data", "tns.abort_data", FT_STRING, BASE_NONE,
927 NULL, 0x0, "Abort Data", HFILL }},
930 "Marker", "tns.marker", FT_BOOLEAN, BASE_NONE,
931 NULL, 0x0, "Marker", HFILL }},
932 { &hf_tns_marker_type, {
933 "Marker Type", "tns.marker.type", FT_UINT8, BASE_HEX,
934 VALS(tns_marker_types), 0x0, "Marker Type", HFILL }},
935 { &hf_tns_marker_data_byte, {
936 "Marker Data Byte", "tns.marker.databyte", FT_UINT8, BASE_HEX,
937 NULL, 0x0, "Marker Data Byte", HFILL }},
938 { &hf_tns_marker_data, {
939 "Marker Data", "tns.marker.data", FT_UINT16, BASE_HEX,
940 NULL, 0x0, "Marker Data", HFILL }},
943 "Control", "tns.control", FT_BOOLEAN, BASE_NONE,
944 NULL, 0x0, "Control", HFILL }},
945 { &hf_tns_control_cmd, {
946 "Control Command", "tns.control.cmd", FT_UINT16, BASE_HEX,
947 VALS(tns_control_cmds), 0x0, "Control Command", HFILL }},
948 { &hf_tns_control_data, {
949 "Control Data", "tns.control.data", FT_BYTES, BASE_HEX,
950 NULL, 0x0, "Control Data", HFILL }},
952 { &hf_tns_redirect, {
953 "Redirect", "tns.redirect", FT_BOOLEAN, BASE_NONE,
954 NULL, 0x0, "Redirect", HFILL }},
955 { &hf_tns_redirect_data_length, {
956 "Redirect Data Length", "tns.redirect_data_length", FT_UINT16, BASE_HEX,
957 NULL, 0x0, "Length of Redirect Data", HFILL }},
958 { &hf_tns_redirect_data, {
959 "Redirect Data", "tns.redirect_data", FT_STRING, BASE_NONE,
960 NULL, 0x0, "Redirect Data", HFILL }},
963 "Data", "tns.data", FT_BOOLEAN, BASE_NONE,
964 NULL, 0x0, "Data", HFILL }},
965 { &hf_tns_data_flag, {
966 "Data Flag", "tns.data_flag", FT_UINT16, BASE_HEX,
967 NULL, 0x0, "Data Flag", HFILL }},
968 { &hf_tns_data_flag_send, {
969 "Send Token", "tns.data_flag.send", FT_UINT16, BASE_BIN,
970 NULL, 0x1, "Send Token", HFILL }},
971 { &hf_tns_data_flag_rc, {
972 "Request Confirmation", "tns.data_flag.rc", FT_UINT16, BASE_BIN,
973 NULL, 0x2, "Request Confirmation", HFILL }},
974 { &hf_tns_data_flag_c, {
975 "Confirmation", "tns.data_flag.c", FT_UINT16, BASE_BIN,
976 NULL, 0x4, "Confirmation", HFILL }},
977 { &hf_tns_data_flag_reserved, {
978 "Reserved", "tns.data_flag.reserved", FT_UINT16, BASE_BIN,
979 NULL, 0x8, "Reserved", HFILL }},
980 { &hf_tns_data_flag_more, {
981 "More Data to Come", "tns.data_flag.more", FT_UINT16, BASE_BIN,
982 NULL, 0x20, "More Data to Come", HFILL }},
983 { &hf_tns_data_flag_eof, {
984 "End of File", "tns.data_flag.eof", FT_UINT16, BASE_BIN,
985 NULL, 0x40, "End of File", HFILL }},
986 { &hf_tns_data_flag_dic, {
987 "Do Immediate Confirmation", "tns.data_flag.dic", FT_UINT16, BASE_BIN,
988 NULL, 0x80, "Do Immediate Confirmation", HFILL }},
989 { &hf_tns_data_flag_rts, {
990 "Request To Send", "tns.data_flag.rts", FT_UINT16, BASE_BIN,
991 NULL, 0x100, "Request To Send", HFILL }},
992 { &hf_tns_data_flag_sntt, {
993 "Send NT Trailer", "tns.data_flag.sntt", FT_UINT16, BASE_BIN,
994 NULL, 0x200, "Send NT Trailer", HFILL }},
997 { &hf_tns_reserved_byte, {
998 "Reserved Byte", "tns.reserved_byte", FT_BYTES, BASE_HEX,
999 NULL, 0x0, "Reserved Byte", HFILL }},
1000 { &hf_tns_packet_type, {
1001 "Packet Type", "tns.type", FT_UINT8, BASE_DEC,
1002 VALS(tns_type_vals), 0x0, "Type of TNS packet", HFILL }}
1006 static gint *ett[] = {
1020 proto_tns = proto_register_protocol(
1021 "Transparent Network Substrate Protocol", "TNS", "tns");
1022 proto_register_field_array(proto_tns, hf, array_length(hf));
1023 proto_register_subtree_array(ett, array_length(ett));
1027 proto_reg_handoff_tns(void)
1029 dissector_handle_t tns_handle;
1031 tns_handle = create_dissector_handle(dissect_tns, proto_tns);
1032 dissector_add("tcp.port", TCP_PORT_TNS, tns_handle);
1033 data_handle = find_dissector("data");