2 * Routines for Oracle TNS packet dissection
6 * Wireshark - Network traffic analyzer
7 * By Gerald Combs <gerald@wireshark.org>
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
30 #include <epan/packet.h>
31 #include "packet-tcp.h"
32 #include "packet-tns.h"
34 #include <epan/prefs.h>
36 /* desegmentation of TNS over TCP */
37 static gboolean tns_desegment
= TRUE
;
39 static int proto_tns
= -1;
40 static int hf_tns_request
= -1;
41 static int hf_tns_response
= -1;
42 static int hf_tns_length
= -1;
43 static int hf_tns_packet_checksum
= -1;
44 static int hf_tns_header_checksum
= -1;
45 static int hf_tns_packet_type
= -1;
46 static int hf_tns_reserved_byte
= -1;
47 static int hf_tns_connect
= -1;
48 static int hf_tns_version
= -1;
49 static int hf_tns_compat_version
= -1;
51 static int hf_tns_service_options
= -1;
52 static int hf_tns_sopt_flag_bconn
= -1;
53 static int hf_tns_sopt_flag_pc
= -1;
54 static int hf_tns_sopt_flag_hc
= -1;
55 static int hf_tns_sopt_flag_fd
= -1;
56 static int hf_tns_sopt_flag_hd
= -1;
57 static int hf_tns_sopt_flag_dc1
= -1;
58 static int hf_tns_sopt_flag_dc2
= -1;
59 static int hf_tns_sopt_flag_dio
= -1;
60 static int hf_tns_sopt_flag_ap
= -1;
61 static int hf_tns_sopt_flag_ra
= -1;
62 static int hf_tns_sopt_flag_sa
= -1;
64 static int hf_tns_sdu_size
= -1;
65 static int hf_tns_max_tdu_size
= -1;
67 static int hf_tns_nt_proto_characteristics
= -1;
68 static int hf_tns_ntp_flag_hangon
= -1;
69 static int hf_tns_ntp_flag_crel
= -1;
70 static int hf_tns_ntp_flag_tduio
= -1;
71 static int hf_tns_ntp_flag_srun
= -1;
72 static int hf_tns_ntp_flag_dtest
= -1;
73 static int hf_tns_ntp_flag_cbio
= -1;
74 static int hf_tns_ntp_flag_asio
= -1;
75 static int hf_tns_ntp_flag_pio
= -1;
76 static int hf_tns_ntp_flag_grant
= -1;
77 static int hf_tns_ntp_flag_handoff
= -1;
78 static int hf_tns_ntp_flag_sigio
= -1;
79 static int hf_tns_ntp_flag_sigpipe
= -1;
80 static int hf_tns_ntp_flag_sigurg
= -1;
81 static int hf_tns_ntp_flag_urgentio
= -1;
82 static int hf_tns_ntp_flag_fdio
= -1;
83 static int hf_tns_ntp_flag_testop
= -1;
85 static int hf_tns_line_turnaround
= -1;
86 static int hf_tns_value_of_one
= -1;
87 static int hf_tns_connect_data_length
= -1;
88 static int hf_tns_connect_data_offset
= -1;
89 static int hf_tns_connect_data_max
= -1;
91 static int hf_tns_connect_flags0
= -1;
92 static int hf_tns_connect_flags1
= -1;
93 static int hf_tns_conn_flag_nareq
= -1;
94 static int hf_tns_conn_flag_nalink
= -1;
95 static int hf_tns_conn_flag_enablena
= -1;
96 static int hf_tns_conn_flag_ichg
= -1;
97 static int hf_tns_conn_flag_wantna
= -1;
99 static int hf_tns_connect_data
= -1;
100 static int hf_tns_trace_cf1
= -1;
101 static int hf_tns_trace_cf2
= -1;
102 static int hf_tns_trace_cid
= -1;
104 static int hf_tns_accept
= -1;
105 static int hf_tns_accept_data_length
= -1;
106 static int hf_tns_accept_data_offset
= -1;
107 static int hf_tns_accept_data
= -1;
109 static int hf_tns_refuse
= -1;
110 static int hf_tns_refuse_reason_user
= -1;
111 static int hf_tns_refuse_reason_system
= -1;
112 static int hf_tns_refuse_data_length
= -1;
113 static int hf_tns_refuse_data
= -1;
115 static int hf_tns_abort
= -1;
116 static int hf_tns_abort_reason_user
= -1;
117 static int hf_tns_abort_reason_system
= -1;
118 static int hf_tns_abort_data
= -1;
120 static int hf_tns_marker
= -1;
121 static int hf_tns_marker_type
= -1;
122 static int hf_tns_marker_data_byte
= -1;
123 /* static int hf_tns_marker_data = -1; */
125 static int hf_tns_redirect
= -1;
126 static int hf_tns_redirect_data_length
= -1;
127 static int hf_tns_redirect_data
= -1;
129 static int hf_tns_control
= -1;
130 static int hf_tns_control_cmd
= -1;
131 static int hf_tns_control_data
= -1;
133 static int hf_tns_data_flag
= -1;
134 static int hf_tns_data_flag_send
= -1;
135 static int hf_tns_data_flag_rc
= -1;
136 static int hf_tns_data_flag_c
= -1;
137 static int hf_tns_data_flag_reserved
= -1;
138 static int hf_tns_data_flag_more
= -1;
139 static int hf_tns_data_flag_eof
= -1;
140 static int hf_tns_data_flag_dic
= -1;
141 static int hf_tns_data_flag_rts
= -1;
142 static int hf_tns_data_flag_sntt
= -1;
143 static int hf_tns_data
= -1;
145 static gint ett_tns
= -1;
146 static gint ett_tns_connect
= -1;
147 static gint ett_tns_accept
= -1;
148 static gint ett_tns_refuse
= -1;
149 static gint ett_tns_abort
= -1;
150 static gint ett_tns_redirect
= -1;
151 static gint ett_tns_marker
= -1;
152 static gint ett_tns_attention
= -1;
153 static gint ett_tns_control
= -1;
154 static gint ett_tns_data
= -1;
155 static gint ett_tns_data_flag
= -1;
156 static gint ett_tns_sopt_flag
= -1;
157 static gint ett_tns_ntp_flag
= -1;
158 static gint ett_tns_conn_flag
= -1;
159 static gint ett_sql
= -1;
161 static dissector_handle_t data_handle
;
163 #define TCP_PORT_TNS 1521
165 static const value_string tns_type_vals
[] = {
166 {TNS_TYPE_CONNECT
, "Connect" },
167 {TNS_TYPE_ACCEPT
, "Accept" },
168 {TNS_TYPE_ACK
, "Acknowledge" },
169 {TNS_TYPE_REFUSE
, "Refuse" },
170 {TNS_TYPE_REDIRECT
, "Redirect" },
171 {TNS_TYPE_DATA
, "Data" },
172 {TNS_TYPE_NULL
, "Null" },
173 {TNS_TYPE_ABORT
, "Abort" },
174 {TNS_TYPE_RESEND
, "Resend"},
175 {TNS_TYPE_MARKER
, "Marker"},
176 {TNS_TYPE_ATTENTION
, "Attention"},
177 {TNS_TYPE_CONTROL
, "Control"},
181 static const value_string tns_marker_types
[] = {
182 {0, "Data Marker - 0 Data Bytes"},
183 {1, "Data Marker - 1 Data Bytes"},
184 {2, "Attention Marker"},
188 static const value_string tns_control_cmds
[] = {
189 {1, "Oracle Trace Command"},
193 void proto_reg_handoff_tns(void);
194 static guint
get_tns_pdu_len(packet_info
*pinfo
, tvbuff_t
*tvb
, int offset
);
195 static int dissect_tns_pdu(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void* data _U_
);
197 static void dissect_tns_service_options(tvbuff_t
*tvb
, int offset
,
198 proto_tree
*sopt_tree
)
201 proto_tree_add_item(sopt_tree
, hf_tns_sopt_flag_bconn
, tvb
,
202 offset
, 2, ENC_BIG_ENDIAN
);
203 proto_tree_add_item(sopt_tree
, hf_tns_sopt_flag_pc
, tvb
,
204 offset
, 2, ENC_BIG_ENDIAN
);
205 proto_tree_add_item(sopt_tree
, hf_tns_sopt_flag_hc
, tvb
,
206 offset
, 2, ENC_BIG_ENDIAN
);
207 proto_tree_add_item(sopt_tree
, hf_tns_sopt_flag_fd
, tvb
,
208 offset
, 2, ENC_BIG_ENDIAN
);
209 proto_tree_add_item(sopt_tree
, hf_tns_sopt_flag_hd
, tvb
,
210 offset
, 2, ENC_BIG_ENDIAN
);
211 proto_tree_add_item(sopt_tree
, hf_tns_sopt_flag_dc1
, tvb
,
212 offset
, 2, ENC_BIG_ENDIAN
);
213 proto_tree_add_item(sopt_tree
, hf_tns_sopt_flag_dc2
, tvb
,
214 offset
, 2, ENC_BIG_ENDIAN
);
215 proto_tree_add_item(sopt_tree
, hf_tns_sopt_flag_dio
, tvb
,
216 offset
, 2, ENC_BIG_ENDIAN
);
217 proto_tree_add_item(sopt_tree
, hf_tns_sopt_flag_ap
, tvb
,
218 offset
, 2, ENC_BIG_ENDIAN
);
219 proto_tree_add_item(sopt_tree
, hf_tns_sopt_flag_ra
, tvb
,
220 offset
, 2, ENC_BIG_ENDIAN
);
221 proto_tree_add_item(sopt_tree
, hf_tns_sopt_flag_sa
, tvb
,
222 offset
, 2, ENC_BIG_ENDIAN
);
226 static void dissect_tns_connect_flag(tvbuff_t
*tvb
, int offset
,
227 proto_tree
*cflag_tree
)
230 proto_tree_add_item(cflag_tree
, hf_tns_conn_flag_nareq
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
231 proto_tree_add_item(cflag_tree
, hf_tns_conn_flag_nalink
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
232 proto_tree_add_item(cflag_tree
, hf_tns_conn_flag_enablena
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
233 proto_tree_add_item(cflag_tree
, hf_tns_conn_flag_ichg
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
234 proto_tree_add_item(cflag_tree
, hf_tns_conn_flag_wantna
, tvb
, offset
, 1, ENC_BIG_ENDIAN
);
237 static void dissect_tns_data(tvbuff_t
*tvb
, int offset
, packet_info
*pinfo
,
238 proto_tree
*tree
, proto_tree
*tns_tree
)
240 proto_tree
*data_tree
= NULL
, *ti
;
241 proto_item
*hidden_item
;
244 if ( tvb_bytes_exist(tvb
, offset
+2, 4) )
246 if ( tvb_get_guint8(tvb
, offset
+2) == 0xDE &&
247 tvb_get_guint8(tvb
, offset
+3) == 0xAD &&
248 tvb_get_guint8(tvb
, offset
+4) == 0xBE &&
249 tvb_get_guint8(tvb
, offset
+5) == 0xEF )
259 ti
= proto_tree_add_text(tns_tree
, tvb
, offset
, -1,
260 "Secure Network Services");
264 ti
= proto_tree_add_text(tns_tree
, tvb
, offset
, -1,
267 data_tree
= proto_item_add_subtree(ti
, ett_tns_data
);
269 hidden_item
= proto_tree_add_boolean(tns_tree
, hf_tns_data
, tvb
, 0, 0,
271 PROTO_ITEM_SET_HIDDEN(hidden_item
);
276 proto_tree
*df_tree
= NULL
;
278 ti
= proto_tree_add_item(data_tree
, hf_tns_data_flag
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
280 df_tree
= proto_item_add_subtree(ti
, ett_tns_data_flag
);
281 proto_tree_add_item(df_tree
, hf_tns_data_flag_send
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
282 proto_tree_add_item(df_tree
, hf_tns_data_flag_rc
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
283 proto_tree_add_item(df_tree
, hf_tns_data_flag_c
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
284 proto_tree_add_item(df_tree
, hf_tns_data_flag_reserved
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
285 proto_tree_add_item(df_tree
, hf_tns_data_flag_more
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
286 proto_tree_add_item(df_tree
, hf_tns_data_flag_eof
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
287 proto_tree_add_item(df_tree
, hf_tns_data_flag_dic
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
288 proto_tree_add_item(df_tree
, hf_tns_data_flag_rts
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
289 proto_tree_add_item(df_tree
, hf_tns_data_flag_sntt
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
295 col_append_str(pinfo
->cinfo
, COL_INFO
, ", SNS");
299 col_append_str(pinfo
->cinfo
, COL_INFO
, ", Data");
302 call_dissector(data_handle
,
303 tvb_new_subset_remaining(tvb
, offset
), pinfo
, data_tree
);
308 static void dissect_tns_connect(tvbuff_t
*tvb
, int offset
, packet_info
*pinfo
,
309 proto_tree
*tree
, proto_tree
*tns_tree
)
311 proto_tree
*connect_tree
= NULL
, *ti
;
312 proto_item
*hidden_item
;
315 int tns_offset
= offset
-8;
319 ti
= proto_tree_add_text(tns_tree
, tvb
, offset
, -1,
321 connect_tree
= proto_item_add_subtree(ti
, ett_tns_connect
);
323 hidden_item
= proto_tree_add_boolean(tns_tree
, hf_tns_connect
, tvb
,
325 PROTO_ITEM_SET_HIDDEN(hidden_item
);
328 col_append_str(pinfo
->cinfo
, COL_INFO
, ", Connect");
332 proto_tree_add_item(connect_tree
, hf_tns_version
, tvb
,
333 offset
, 2, ENC_BIG_ENDIAN
);
339 proto_tree_add_item(connect_tree
, hf_tns_compat_version
, tvb
,
340 offset
, 2, ENC_BIG_ENDIAN
);
346 proto_tree
*sopt_tree
= NULL
;
348 ti
= proto_tree_add_item(connect_tree
, hf_tns_service_options
, tvb
,
349 offset
, 2, ENC_BIG_ENDIAN
);
351 sopt_tree
= proto_item_add_subtree(ti
, ett_tns_sopt_flag
);
353 dissect_tns_service_options(tvb
, offset
, sopt_tree
);
361 proto_tree_add_item(connect_tree
, hf_tns_sdu_size
, tvb
,
362 offset
, 2, ENC_BIG_ENDIAN
);
368 proto_tree_add_item(connect_tree
, hf_tns_max_tdu_size
, tvb
,
369 offset
, 2, ENC_BIG_ENDIAN
);
375 proto_tree
*ntp_tree
= NULL
;
377 ti
= proto_tree_add_item(connect_tree
, hf_tns_nt_proto_characteristics
, tvb
,
378 offset
, 2, ENC_BIG_ENDIAN
);
380 ntp_tree
= proto_item_add_subtree(ti
, ett_tns_ntp_flag
);
382 proto_tree_add_item(ntp_tree
, hf_tns_ntp_flag_hangon
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
383 proto_tree_add_item(ntp_tree
, hf_tns_ntp_flag_crel
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
384 proto_tree_add_item(ntp_tree
, hf_tns_ntp_flag_tduio
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
385 proto_tree_add_item(ntp_tree
, hf_tns_ntp_flag_srun
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
386 proto_tree_add_item(ntp_tree
, hf_tns_ntp_flag_dtest
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
387 proto_tree_add_item(ntp_tree
, hf_tns_ntp_flag_cbio
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
388 proto_tree_add_item(ntp_tree
, hf_tns_ntp_flag_asio
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
389 proto_tree_add_item(ntp_tree
, hf_tns_ntp_flag_pio
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
390 proto_tree_add_item(ntp_tree
, hf_tns_ntp_flag_grant
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
391 proto_tree_add_item(ntp_tree
, hf_tns_ntp_flag_handoff
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
392 proto_tree_add_item(ntp_tree
, hf_tns_ntp_flag_sigio
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
393 proto_tree_add_item(ntp_tree
, hf_tns_ntp_flag_sigpipe
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
394 proto_tree_add_item(ntp_tree
, hf_tns_ntp_flag_sigurg
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
395 proto_tree_add_item(ntp_tree
, hf_tns_ntp_flag_urgentio
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
396 proto_tree_add_item(ntp_tree
, hf_tns_ntp_flag_fdio
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
397 proto_tree_add_item(ntp_tree
, hf_tns_ntp_flag_testop
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
403 proto_tree_add_item(connect_tree
, hf_tns_line_turnaround
, tvb
,
404 offset
, 2, ENC_BIG_ENDIAN
);
410 proto_tree_add_item(connect_tree
, hf_tns_value_of_one
, tvb
,
415 cd_len
= tvb_get_ntohs(tvb
, offset
);
418 proto_tree_add_uint(connect_tree
, hf_tns_connect_data_length
, tvb
,
423 cd_offset
= tvb_get_ntohs(tvb
, offset
);
426 proto_tree_add_uint(connect_tree
, hf_tns_connect_data_offset
, tvb
,
427 offset
, 2, cd_offset
);
433 proto_tree_add_item(connect_tree
, hf_tns_connect_data_max
, tvb
,
434 offset
, 4, ENC_BIG_ENDIAN
);
440 proto_tree
*cflag_tree
= NULL
;
442 ti
= proto_tree_add_item(connect_tree
, hf_tns_connect_flags0
, tvb
,
443 offset
, 1, ENC_BIG_ENDIAN
);
445 cflag_tree
= proto_item_add_subtree(ti
, ett_tns_conn_flag
);
447 dissect_tns_connect_flag(tvb
, offset
, cflag_tree
);
453 proto_tree
*cflag_tree
= NULL
;
455 ti
= proto_tree_add_item(connect_tree
, hf_tns_connect_flags1
, tvb
,
456 offset
, 1, ENC_BIG_ENDIAN
);
458 cflag_tree
= proto_item_add_subtree(ti
, ett_tns_conn_flag
);
460 dissect_tns_connect_flag(tvb
, offset
, cflag_tree
);
465 * XXX - sometimes it appears that this stuff isn't present
468 if (offset
+ 16 <= tns_offset
+cd_offset
)
472 proto_tree_add_item(connect_tree
, hf_tns_trace_cf1
, tvb
,
473 offset
, 4, ENC_BIG_ENDIAN
);
479 proto_tree_add_item(connect_tree
, hf_tns_trace_cf2
, tvb
,
480 offset
, 4, ENC_BIG_ENDIAN
);
486 proto_tree_add_item(connect_tree
, hf_tns_trace_cid
, tvb
,
487 offset
, 8, ENC_BIG_ENDIAN
);
492 if ( connect_tree
&& cd_len
> 0)
494 proto_tree_add_item(connect_tree
, hf_tns_connect_data
, tvb
,
495 tns_offset
+cd_offset
, -1, ENC_ASCII
|ENC_NA
);
500 static void dissect_tns_accept(tvbuff_t
*tvb
, int offset
, packet_info
*pinfo
,
501 proto_tree
*tree
, proto_tree
*tns_tree
)
503 proto_tree
*accept_tree
= NULL
, *ti
;
504 proto_item
*hidden_item
;
507 int tns_offset
= offset
-8;
511 ti
= proto_tree_add_text(tns_tree
, tvb
, offset
, -1,
513 accept_tree
= proto_item_add_subtree(ti
, ett_tns_accept
);
515 hidden_item
= proto_tree_add_boolean(tns_tree
, hf_tns_accept
, tvb
,
517 PROTO_ITEM_SET_HIDDEN(hidden_item
);
520 col_append_str(pinfo
->cinfo
, COL_INFO
, ", Accept");
524 proto_tree_add_item(accept_tree
, hf_tns_version
, tvb
,
525 offset
, 2, ENC_BIG_ENDIAN
);
531 proto_tree
*sopt_tree
= NULL
;
533 ti
= proto_tree_add_item(accept_tree
, hf_tns_service_options
,
534 tvb
, offset
, 2, ENC_BIG_ENDIAN
);
536 sopt_tree
= proto_item_add_subtree(ti
, ett_tns_sopt_flag
);
538 dissect_tns_service_options(tvb
, offset
, sopt_tree
);
545 proto_tree_add_item(accept_tree
, hf_tns_sdu_size
, tvb
,
546 offset
, 2, ENC_BIG_ENDIAN
);
552 proto_tree_add_item(accept_tree
, hf_tns_max_tdu_size
, tvb
,
553 offset
, 2, ENC_BIG_ENDIAN
);
559 proto_tree_add_item(accept_tree
, hf_tns_value_of_one
, tvb
,
564 accept_len
= tvb_get_ntohs(tvb
, offset
);
567 proto_tree_add_uint(accept_tree
, hf_tns_accept_data_length
, tvb
,
568 offset
, 2, accept_len
);
572 accept_offset
= tvb_get_ntohs(tvb
, offset
);
575 proto_tree_add_uint(accept_tree
, hf_tns_accept_data_offset
, tvb
,
576 offset
, 2, accept_offset
);
582 proto_tree
*cflag_tree
= NULL
;
584 ti
= proto_tree_add_item(accept_tree
, hf_tns_connect_flags0
, tvb
,
585 offset
, 1, ENC_BIG_ENDIAN
);
587 cflag_tree
= proto_item_add_subtree(ti
, ett_tns_conn_flag
);
589 dissect_tns_connect_flag(tvb
, offset
, cflag_tree
);
596 proto_tree
*cflag_tree
= NULL
;
598 ti
= proto_tree_add_item(accept_tree
, hf_tns_connect_flags1
, tvb
,
599 offset
, 1, ENC_BIG_ENDIAN
);
601 cflag_tree
= proto_item_add_subtree(ti
, ett_tns_conn_flag
);
603 dissect_tns_connect_flag(tvb
, offset
, cflag_tree
);
608 if ( accept_tree
&& accept_len
> 0)
610 proto_tree_add_item(accept_tree
, hf_tns_accept_data
, tvb
,
611 tns_offset
+accept_offset
, -1, ENC_ASCII
|ENC_NA
);
617 static void dissect_tns_refuse(tvbuff_t
*tvb
, int offset
, packet_info
*pinfo
,
618 proto_tree
*tree
, proto_tree
*tns_tree
)
620 proto_tree
*refuse_tree
= NULL
, *ti
;
621 proto_item
*hidden_item
;
625 ti
= proto_tree_add_text(tns_tree
, tvb
, offset
, -1,
627 refuse_tree
= proto_item_add_subtree(ti
, ett_tns_refuse
);
629 hidden_item
= proto_tree_add_boolean(tns_tree
, hf_tns_refuse
, tvb
,
631 PROTO_ITEM_SET_HIDDEN(hidden_item
);
634 col_append_str(pinfo
->cinfo
, COL_INFO
, ", Refuse");
638 proto_tree_add_item(refuse_tree
, hf_tns_refuse_reason_user
, tvb
,
639 offset
, 1, ENC_BIG_ENDIAN
);
645 proto_tree_add_item(refuse_tree
, hf_tns_refuse_reason_system
, tvb
,
646 offset
, 1, ENC_BIG_ENDIAN
);
652 proto_tree_add_item(refuse_tree
, hf_tns_refuse_data_length
, tvb
,
653 offset
, 2, ENC_BIG_ENDIAN
);
659 proto_tree_add_item(refuse_tree
, hf_tns_refuse_data
, tvb
,
660 offset
, -1, ENC_ASCII
|ENC_NA
);
666 static void dissect_tns_abort(tvbuff_t
*tvb
, int offset
, packet_info
*pinfo
,
667 proto_tree
*tree
, proto_tree
*tns_tree
)
669 proto_tree
*abort_tree
= NULL
, *ti
;
670 proto_item
*hidden_item
;
674 ti
= proto_tree_add_text(tns_tree
, tvb
, offset
, -1,
676 abort_tree
= proto_item_add_subtree(ti
, ett_tns_abort
);
678 hidden_item
= proto_tree_add_boolean(tns_tree
, hf_tns_abort
, tvb
,
680 PROTO_ITEM_SET_HIDDEN(hidden_item
);
683 col_append_str(pinfo
->cinfo
, COL_INFO
, ", Abort");
687 proto_tree_add_item(abort_tree
, hf_tns_abort_reason_user
, tvb
,
688 offset
, 1, ENC_BIG_ENDIAN
);
694 proto_tree_add_item(abort_tree
, hf_tns_abort_reason_system
, tvb
,
695 offset
, 1, ENC_BIG_ENDIAN
);
701 proto_tree_add_item(abort_tree
, hf_tns_abort_data
, tvb
,
702 offset
, -1, ENC_ASCII
|ENC_NA
);
708 static void dissect_tns_marker(tvbuff_t
*tvb
, int offset
, packet_info
*pinfo
,
709 proto_tree
*tree
, proto_tree
*tns_tree
, int is_attention
)
711 proto_tree
*marker_tree
= NULL
, *ti
;
712 proto_item
*hidden_item
;
718 ti
= proto_tree_add_text(tns_tree
, tvb
, offset
, -1,
723 ti
= proto_tree_add_text(tns_tree
, tvb
, offset
, -1,
727 marker_tree
= proto_item_add_subtree(ti
, ett_tns_marker
);
728 hidden_item
= proto_tree_add_boolean(tns_tree
, hf_tns_marker
, tvb
,
730 PROTO_ITEM_SET_HIDDEN(hidden_item
);
735 col_append_str(pinfo
->cinfo
, COL_INFO
, ", Marker");
739 col_append_str(pinfo
->cinfo
, COL_INFO
, ", Attention");
744 proto_tree_add_item(marker_tree
, hf_tns_marker_type
, tvb
,
745 offset
, 1, ENC_BIG_ENDIAN
);
751 proto_tree_add_item(marker_tree
, hf_tns_marker_data_byte
, tvb
,
752 offset
, 1, ENC_BIG_ENDIAN
);
758 proto_tree_add_item(marker_tree
, hf_tns_marker_data_byte
, tvb
,
759 offset
, 1, ENC_BIG_ENDIAN
);
766 static void dissect_tns_redirect(tvbuff_t
*tvb
, int offset
, packet_info
*pinfo
,
767 proto_tree
*tree
, proto_tree
*tns_tree
)
769 proto_tree
*redirect_tree
= NULL
, *ti
;
770 proto_item
*hidden_item
;
774 ti
= proto_tree_add_text(tns_tree
, tvb
, offset
, -1,
776 redirect_tree
= proto_item_add_subtree(ti
, ett_tns_redirect
);
778 hidden_item
= proto_tree_add_boolean(tns_tree
, hf_tns_redirect
, tvb
,
780 PROTO_ITEM_SET_HIDDEN(hidden_item
);
783 col_append_str(pinfo
->cinfo
, COL_INFO
, ", Redirect");
787 proto_tree_add_item(redirect_tree
, hf_tns_redirect_data_length
, tvb
,
788 offset
, 2, ENC_BIG_ENDIAN
);
794 proto_tree_add_item(redirect_tree
, hf_tns_redirect_data
, tvb
,
795 offset
, -1, ENC_ASCII
|ENC_NA
);
800 static void dissect_tns_control(tvbuff_t
*tvb
, int offset
, packet_info
*pinfo
,
801 proto_tree
*tree
, proto_tree
*tns_tree
)
803 proto_tree
*control_tree
= NULL
, *ti
;
804 proto_item
*hidden_item
;
808 ti
= proto_tree_add_text(tns_tree
, tvb
, offset
, -1,
810 control_tree
= proto_item_add_subtree(ti
, ett_tns_control
);
812 hidden_item
= proto_tree_add_boolean(tns_tree
, hf_tns_control
, tvb
,
814 PROTO_ITEM_SET_HIDDEN(hidden_item
);
817 col_append_str(pinfo
->cinfo
, COL_INFO
, ", Control");
821 proto_tree_add_item(control_tree
, hf_tns_control_cmd
, tvb
,
822 offset
, 2, ENC_BIG_ENDIAN
);
828 proto_tree_add_item(control_tree
, hf_tns_control_data
, tvb
,
835 get_tns_pdu_len(packet_info
*pinfo _U_
, tvbuff_t
*tvb
, int offset
)
838 * Get the length of the TNS message, including header
840 return tvb_get_ntohs(tvb
, offset
);
844 dissect_tns(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void *data
)
849 * First, do a sanity check to make sure what we have
850 * starts with a TNS PDU.
852 if (tvb_bytes_exist(tvb
, 4, 1)) {
854 * Well, we have the packet type; let's make sure
857 type
= tvb_get_guint8(tvb
, 4);
858 if (type
< TNS_TYPE_CONNECT
|| type
> TNS_TYPE_MAX
)
859 return 0; /* it's not a known type */
862 tcp_dissect_pdus(tvb
, pinfo
, tree
, tns_desegment
, 2,
863 get_tns_pdu_len
, dissect_tns_pdu
, data
);
864 return tvb_length(tvb
);
868 dissect_tns_pdu(tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
, void* data _U_
)
870 proto_tree
*tns_tree
= NULL
, *ti
;
871 proto_item
*hidden_item
;
876 col_set_str(pinfo
->cinfo
, COL_PROTOCOL
, "TNS");
878 col_set_str(pinfo
->cinfo
, COL_INFO
,
879 (pinfo
->match_uint
== pinfo
->destport
) ? "Request" : "Response");
883 ti
= proto_tree_add_item(tree
, proto_tns
, tvb
, 0, -1, ENC_NA
);
884 tns_tree
= proto_item_add_subtree(ti
, ett_tns
);
886 if (pinfo
->match_uint
== pinfo
->destport
)
888 hidden_item
= proto_tree_add_boolean(tns_tree
, hf_tns_request
,
889 tvb
, offset
, 0, TRUE
);
893 hidden_item
= proto_tree_add_boolean(tns_tree
, hf_tns_response
,
894 tvb
, offset
, 0, TRUE
);
896 PROTO_ITEM_SET_HIDDEN(hidden_item
);
899 length
= tvb_get_ntohs(tvb
, offset
);
902 proto_tree_add_uint(tns_tree
, hf_tns_length
, tvb
,
909 proto_tree_add_item(tns_tree
, hf_tns_packet_checksum
, tvb
,
910 offset
, 2, ENC_BIG_ENDIAN
);
914 type
= tvb_get_guint8(tvb
, offset
);
917 proto_tree_add_uint(tns_tree
, hf_tns_packet_type
, tvb
,
922 col_append_fstr(pinfo
->cinfo
, COL_INFO
, ", %s (%u)",
923 val_to_str_const(type
, tns_type_vals
, "Unknown"), type
);
927 proto_tree_add_item(tns_tree
, hf_tns_reserved_byte
, tvb
,
934 proto_tree_add_item(tns_tree
, hf_tns_header_checksum
, tvb
,
935 offset
, 2, ENC_BIG_ENDIAN
);
941 case TNS_TYPE_CONNECT
:
942 dissect_tns_connect(tvb
,offset
,pinfo
,tree
,tns_tree
);
944 case TNS_TYPE_ACCEPT
:
945 dissect_tns_accept(tvb
,offset
,pinfo
,tree
,tns_tree
);
947 case TNS_TYPE_REFUSE
:
948 dissect_tns_refuse(tvb
,offset
,pinfo
,tree
,tns_tree
);
950 case TNS_TYPE_REDIRECT
:
951 dissect_tns_redirect(tvb
,offset
,pinfo
,tree
,tns_tree
);
954 dissect_tns_abort(tvb
,offset
,pinfo
,tree
,tns_tree
);
956 case TNS_TYPE_MARKER
:
957 dissect_tns_marker(tvb
,offset
,pinfo
,tree
,tns_tree
, 0);
959 case TNS_TYPE_ATTENTION
:
960 dissect_tns_marker(tvb
,offset
,pinfo
,tree
,tns_tree
, 1);
962 case TNS_TYPE_CONTROL
:
963 dissect_tns_control(tvb
,offset
,pinfo
,tree
,tns_tree
);
966 dissect_tns_data(tvb
,offset
,pinfo
,tree
,tns_tree
);
969 call_dissector(data_handle
,
970 tvb_new_subset_remaining(tvb
, offset
), pinfo
,
975 return tvb_length(tvb
);
978 void proto_register_tns(void)
980 static hf_register_info hf
[] = {
981 { &hf_tns_response
, {
982 "Response", "tns.response", FT_BOOLEAN
, BASE_NONE
,
983 NULL
, 0x0, "TRUE if TNS response", HFILL
}},
985 "Request", "tns.request", FT_BOOLEAN
, BASE_NONE
,
986 NULL
, 0x0, "TRUE if TNS request", HFILL
}},
988 "Packet Length", "tns.length", FT_UINT16
, BASE_DEC
,
989 NULL
, 0x0, "Length of TNS packet", HFILL
}},
990 { &hf_tns_packet_checksum
, {
991 "Packet Checksum", "tns.packet_checksum", FT_UINT16
, BASE_HEX
,
992 NULL
, 0x0, "Checksum of Packet Data", HFILL
}},
993 { &hf_tns_header_checksum
, {
994 "Header Checksum", "tns.header_checksum", FT_UINT16
, BASE_HEX
,
995 NULL
, 0x0, "Checksum of Header Data", HFILL
}},
998 "Version", "tns.version", FT_UINT16
, BASE_DEC
,
999 NULL
, 0x0, NULL
, HFILL
}},
1000 { &hf_tns_compat_version
, {
1001 "Version (Compatible)", "tns.compat_version", FT_UINT16
, BASE_DEC
,
1002 NULL
, 0x0, NULL
, HFILL
}},
1004 { &hf_tns_service_options
, {
1005 "Service Options", "tns.service_options", FT_UINT16
, BASE_HEX
,
1006 NULL
, 0x0, NULL
, HFILL
}},
1008 { &hf_tns_sopt_flag_bconn
, {
1009 "Broken Connect Notify", "tns.so_flag.bconn", FT_BOOLEAN
, 16,
1010 NULL
, 0x2000, NULL
, HFILL
}},
1011 { &hf_tns_sopt_flag_pc
, {
1012 "Packet Checksum", "tns.so_flag.pc", FT_BOOLEAN
, 16,
1013 NULL
, 0x1000, NULL
, HFILL
}},
1014 { &hf_tns_sopt_flag_hc
, {
1015 "Header Checksum", "tns.so_flag.hc", FT_BOOLEAN
, 16,
1016 NULL
, 0x0800, NULL
, HFILL
}},
1017 { &hf_tns_sopt_flag_fd
, {
1018 "Full Duplex", "tns.so_flag.fd", FT_BOOLEAN
, 16,
1019 NULL
, 0x0400, NULL
, HFILL
}},
1020 { &hf_tns_sopt_flag_hd
, {
1021 "Half Duplex", "tns.so_flag.hd", FT_BOOLEAN
, 16,
1022 NULL
, 0x0200, NULL
, HFILL
}},
1023 { &hf_tns_sopt_flag_dc1
, {
1024 "Don't Care", "tns.so_flag.dc1", FT_BOOLEAN
, 16,
1025 NULL
, 0x0100, NULL
, HFILL
}},
1026 { &hf_tns_sopt_flag_dc2
, {
1027 "Don't Care", "tns.so_flag.dc2", FT_BOOLEAN
, 16,
1028 NULL
, 0x0080, NULL
, HFILL
}},
1029 { &hf_tns_sopt_flag_dio
, {
1030 "Direct IO to Transport", "tns.so_flag.dio", FT_BOOLEAN
, 16,
1031 NULL
, 0x0010, NULL
, HFILL
}},
1032 { &hf_tns_sopt_flag_ap
, {
1033 "Attention Processing", "tns.so_flag.ap", FT_BOOLEAN
, 16,
1034 NULL
, 0x0008, NULL
, HFILL
}},
1035 { &hf_tns_sopt_flag_ra
, {
1036 "Can Receive Attention", "tns.so_flag.ra", FT_BOOLEAN
, 16,
1037 NULL
, 0x0004, NULL
, HFILL
}},
1038 { &hf_tns_sopt_flag_sa
, {
1039 "Can Send Attention", "tns.so_flag.sa", FT_BOOLEAN
, 16,
1040 NULL
, 0x0002, NULL
, HFILL
}},
1043 { &hf_tns_sdu_size
, {
1044 "Session Data Unit Size", "tns.sdu_size", FT_UINT16
, BASE_DEC
,
1045 NULL
, 0x0, NULL
, HFILL
}},
1046 { &hf_tns_max_tdu_size
, {
1047 "Maximum Transmission Data Unit Size", "tns.max_tdu_size", FT_UINT16
, BASE_DEC
,
1048 NULL
, 0x0, NULL
, HFILL
}},
1050 { &hf_tns_nt_proto_characteristics
, {
1051 "NT Protocol Characteristics", "tns.nt_proto_characteristics", FT_UINT16
, BASE_HEX
,
1052 NULL
, 0x0, NULL
, HFILL
}},
1053 { &hf_tns_ntp_flag_hangon
, {
1054 "Hangon to listener connect", "tns.ntp_flag.hangon", FT_BOOLEAN
, 16,
1055 NULL
, 0x8000, NULL
, HFILL
}},
1056 { &hf_tns_ntp_flag_crel
, {
1057 "Confirmed release", "tns.ntp_flag.crel", FT_BOOLEAN
, 16,
1058 NULL
, 0x4000, NULL
, HFILL
}},
1059 { &hf_tns_ntp_flag_tduio
, {
1060 "TDU based IO", "tns.ntp_flag.tduio", FT_BOOLEAN
, 16,
1061 NULL
, 0x2000, NULL
, HFILL
}},
1062 { &hf_tns_ntp_flag_srun
, {
1063 "Spawner running", "tns.ntp_flag.srun", FT_BOOLEAN
, 16,
1064 NULL
, 0x1000, NULL
, HFILL
}},
1065 { &hf_tns_ntp_flag_dtest
, {
1066 "Data test", "tns.ntp_flag.dtest", FT_BOOLEAN
, 16,
1067 NULL
, 0x0800, NULL
, HFILL
}},
1068 { &hf_tns_ntp_flag_cbio
, {
1069 "Callback IO supported", "tns.ntp_flag.cbio", FT_BOOLEAN
, 16,
1070 NULL
, 0x0400, NULL
, HFILL
}},
1071 { &hf_tns_ntp_flag_asio
, {
1072 "ASync IO Supported", "tns.ntp_flag.asio", FT_BOOLEAN
, 16,
1073 NULL
, 0x0200, NULL
, HFILL
}},
1074 { &hf_tns_ntp_flag_pio
, {
1075 "Packet oriented IO", "tns.ntp_flag.pio", FT_BOOLEAN
, 16,
1076 NULL
, 0x0100, NULL
, HFILL
}},
1077 { &hf_tns_ntp_flag_grant
, {
1078 "Can grant connection to another", "tns.ntp_flag.grant", FT_BOOLEAN
, 16,
1079 NULL
, 0x0080, NULL
, HFILL
}},
1080 { &hf_tns_ntp_flag_handoff
, {
1081 "Can handoff connection to another", "tns.ntp_flag.handoff", FT_BOOLEAN
, 16,
1082 NULL
, 0x0040, NULL
, HFILL
}},
1083 { &hf_tns_ntp_flag_sigio
, {
1084 "Generate SIGIO signal", "tns.ntp_flag.sigio", FT_BOOLEAN
, 16,
1085 NULL
, 0x0020, NULL
, HFILL
}},
1086 { &hf_tns_ntp_flag_sigpipe
, {
1087 "Generate SIGPIPE signal", "tns.ntp_flag.sigpipe", FT_BOOLEAN
, 16,
1088 NULL
, 0x0010, NULL
, HFILL
}},
1089 { &hf_tns_ntp_flag_sigurg
, {
1090 "Generate SIGURG signal", "tns.ntp_flag.sigurg", FT_BOOLEAN
, 16,
1091 NULL
, 0x0008, NULL
, HFILL
}},
1092 { &hf_tns_ntp_flag_urgentio
, {
1093 "Urgent IO supported", "tns.ntp_flag.urgentio", FT_BOOLEAN
, 16,
1094 NULL
, 0x0004, NULL
, HFILL
}},
1095 { &hf_tns_ntp_flag_fdio
, {
1096 "Full duplex IO supported", "tns.ntp_flag.dfio", FT_BOOLEAN
, 16,
1097 NULL
, 0x0002, NULL
, HFILL
}},
1098 { &hf_tns_ntp_flag_testop
, {
1099 "Test operation", "tns.ntp_flag.testop", FT_BOOLEAN
, 16,
1100 NULL
, 0x0001, NULL
, HFILL
}},
1105 { &hf_tns_line_turnaround
, {
1106 "Line Turnaround Value", "tns.line_turnaround", FT_UINT16
, BASE_DEC
,
1107 NULL
, 0x0, NULL
, HFILL
}},
1108 { &hf_tns_value_of_one
, {
1109 "Value of 1 in Hardware", "tns.value_of_one", FT_BYTES
, BASE_NONE
,
1110 NULL
, 0x0, NULL
, HFILL
}},
1112 { &hf_tns_connect
, {
1113 "Connect", "tns.connect", FT_BOOLEAN
, BASE_NONE
,
1114 NULL
, 0x0, NULL
, HFILL
}},
1115 { &hf_tns_connect_data_length
, {
1116 "Length of Connect Data", "tns.connect_data_length", FT_UINT16
, BASE_DEC
,
1117 NULL
, 0x0, NULL
, HFILL
}},
1118 { &hf_tns_connect_data_offset
, {
1119 "Offset to Connect Data", "tns.connect_data_offset", FT_UINT16
, BASE_DEC
,
1120 NULL
, 0x0, NULL
, HFILL
}},
1121 { &hf_tns_connect_data_max
, {
1122 "Maximum Receivable Connect Data", "tns.connect_data_max", FT_UINT32
, BASE_DEC
,
1123 NULL
, 0x0, NULL
, HFILL
}},
1125 { &hf_tns_connect_flags0
, {
1126 "Connect Flags 0", "tns.connect_flags0", FT_UINT8
, BASE_HEX
,
1127 NULL
, 0x0, NULL
, HFILL
}},
1128 { &hf_tns_connect_flags1
, {
1129 "Connect Flags 1", "tns.connect_flags1", FT_UINT8
, BASE_HEX
,
1130 NULL
, 0x0, NULL
, HFILL
}},
1132 { &hf_tns_conn_flag_nareq
, {
1133 "NA services required", "tns.connect_flags.nareq", FT_BOOLEAN
, 8,
1134 NULL
, 0x10, NULL
, HFILL
}},
1135 { &hf_tns_conn_flag_nalink
, {
1136 "NA services linked in", "tns.connect_flags.nalink", FT_BOOLEAN
, 8,
1137 NULL
, 0x08, NULL
, HFILL
}},
1138 { &hf_tns_conn_flag_enablena
, {
1139 "NA services enabled", "tns.connect_flags.enablena", FT_BOOLEAN
, 8,
1140 NULL
, 0x04, NULL
, HFILL
}},
1141 { &hf_tns_conn_flag_ichg
, {
1142 "Interchange is involved", "tns.connect_flags.ichg", FT_BOOLEAN
, 8,
1143 NULL
, 0x02, NULL
, HFILL
}},
1144 { &hf_tns_conn_flag_wantna
, {
1145 "NA services wanted", "tns.connect_flags.wantna", FT_BOOLEAN
, 8,
1146 NULL
, 0x01, NULL
, HFILL
}},
1149 { &hf_tns_trace_cf1
, {
1150 "Trace Cross Facility Item 1", "tns.trace_cf1", FT_UINT32
, BASE_HEX
,
1151 NULL
, 0x0, NULL
, HFILL
}},
1152 { &hf_tns_trace_cf2
, {
1153 "Trace Cross Facility Item 2", "tns.trace_cf2", FT_UINT32
, BASE_HEX
,
1154 NULL
, 0x0, NULL
, HFILL
}},
1155 { &hf_tns_trace_cid
, {
1156 "Trace Unique Connection ID", "tns.trace_cid", FT_UINT64
, BASE_HEX
,
1157 NULL
, 0x0, NULL
, HFILL
}},
1158 { &hf_tns_connect_data
, {
1159 "Connect Data", "tns.connect_data", FT_STRING
, BASE_NONE
,
1160 NULL
, 0x0, NULL
, HFILL
}},
1163 "Accept", "tns.accept", FT_BOOLEAN
, BASE_NONE
,
1164 NULL
, 0x0, NULL
, HFILL
}},
1165 { &hf_tns_accept_data_length
, {
1166 "Accept Data Length", "tns.accept_data_length", FT_UINT16
, BASE_DEC
,
1167 NULL
, 0x0, "Length of Accept Data", HFILL
}},
1168 { &hf_tns_accept_data
, {
1169 "Accept Data", "tns.accept_data", FT_STRING
, BASE_NONE
,
1170 NULL
, 0x0, NULL
, HFILL
}},
1171 { &hf_tns_accept_data_offset
, {
1172 "Offset to Accept Data", "tns.accept_data_offset", FT_UINT16
, BASE_DEC
,
1173 NULL
, 0x0, NULL
, HFILL
}},
1177 "Refuse", "tns.refuse", FT_BOOLEAN
, BASE_NONE
,
1178 NULL
, 0x0, NULL
, HFILL
}},
1179 { &hf_tns_refuse_reason_user
, {
1180 "Refuse Reason (User)", "tns.refuse_reason_user", FT_UINT8
, BASE_HEX
,
1181 NULL
, 0x0, "Refuse Reason from Application", HFILL
}},
1182 { &hf_tns_refuse_reason_system
, {
1183 "Refuse Reason (System)", "tns.refuse_reason_system", FT_UINT8
, BASE_HEX
,
1184 NULL
, 0x0, "Refuse Reason from System", HFILL
}},
1185 { &hf_tns_refuse_data_length
, {
1186 "Refuse Data Length", "tns.refuse_data_length", FT_UINT16
, BASE_DEC
,
1187 NULL
, 0x0, "Length of Refuse Data", HFILL
}},
1188 { &hf_tns_refuse_data
, {
1189 "Refuse Data", "tns.refuse_data", FT_STRING
, BASE_NONE
,
1190 NULL
, 0x0, NULL
, HFILL
}},
1193 "Abort", "tns.abort", FT_BOOLEAN
, BASE_NONE
,
1194 NULL
, 0x0, NULL
, HFILL
}},
1195 { &hf_tns_abort_reason_user
, {
1196 "Abort Reason (User)", "tns.abort_reason_user", FT_UINT8
, BASE_HEX
,
1197 NULL
, 0x0, "Abort Reason from Application", HFILL
}},
1198 { &hf_tns_abort_reason_system
, {
1199 "Abort Reason (User)", "tns.abort_reason_system", FT_UINT8
, BASE_HEX
,
1200 NULL
, 0x0, "Abort Reason from System", HFILL
}},
1201 { &hf_tns_abort_data
, {
1202 "Abort Data", "tns.abort_data", FT_STRING
, BASE_NONE
,
1203 NULL
, 0x0, NULL
, HFILL
}},
1206 "Marker", "tns.marker", FT_BOOLEAN
, BASE_NONE
,
1207 NULL
, 0x0, NULL
, HFILL
}},
1208 { &hf_tns_marker_type
, {
1209 "Marker Type", "tns.marker.type", FT_UINT8
, BASE_HEX
,
1210 VALS(tns_marker_types
), 0x0, NULL
, HFILL
}},
1211 { &hf_tns_marker_data_byte
, {
1212 "Marker Data Byte", "tns.marker.databyte", FT_UINT8
, BASE_HEX
,
1213 NULL
, 0x0, NULL
, HFILL
}},
1215 { &hf_tns_marker_data
, {
1216 "Marker Data", "tns.marker.data", FT_UINT16
, BASE_HEX
,
1217 NULL
, 0x0, NULL
, HFILL
}},
1220 { &hf_tns_control
, {
1221 "Control", "tns.control", FT_BOOLEAN
, BASE_NONE
,
1222 NULL
, 0x0, NULL
, HFILL
}},
1223 { &hf_tns_control_cmd
, {
1224 "Control Command", "tns.control.cmd", FT_UINT16
, BASE_HEX
,
1225 VALS(tns_control_cmds
), 0x0, NULL
, HFILL
}},
1226 { &hf_tns_control_data
, {
1227 "Control Data", "tns.control.data", FT_BYTES
, BASE_NONE
,
1228 NULL
, 0x0, NULL
, HFILL
}},
1230 { &hf_tns_redirect
, {
1231 "Redirect", "tns.redirect", FT_BOOLEAN
, BASE_NONE
,
1232 NULL
, 0x0, NULL
, HFILL
}},
1233 { &hf_tns_redirect_data_length
, {
1234 "Redirect Data Length", "tns.redirect_data_length", FT_UINT16
, BASE_DEC
,
1235 NULL
, 0x0, "Length of Redirect Data", HFILL
}},
1236 { &hf_tns_redirect_data
, {
1237 "Redirect Data", "tns.redirect_data", FT_STRING
, BASE_NONE
,
1238 NULL
, 0x0, NULL
, HFILL
}},
1241 "Data", "tns.data", FT_BOOLEAN
, BASE_NONE
,
1242 NULL
, 0x0, NULL
, HFILL
}},
1244 { &hf_tns_data_flag
, {
1245 "Data Flag", "tns.data_flag", FT_UINT16
, BASE_HEX
,
1246 NULL
, 0x0, NULL
, HFILL
}},
1247 { &hf_tns_data_flag_send
, {
1248 "Send Token", "tns.data_flag.send", FT_BOOLEAN
, 16,
1249 NULL
, 0x1, NULL
, HFILL
}},
1250 { &hf_tns_data_flag_rc
, {
1251 "Request Confirmation", "tns.data_flag.rc", FT_BOOLEAN
, 16,
1252 NULL
, 0x2, NULL
, HFILL
}},
1253 { &hf_tns_data_flag_c
, {
1254 "Confirmation", "tns.data_flag.c", FT_BOOLEAN
, 16,
1255 NULL
, 0x4, NULL
, HFILL
}},
1256 { &hf_tns_data_flag_reserved
, {
1257 "Reserved", "tns.data_flag.reserved", FT_BOOLEAN
, 16,
1258 NULL
, 0x8, NULL
, HFILL
}},
1259 { &hf_tns_data_flag_more
, {
1260 "More Data to Come", "tns.data_flag.more", FT_BOOLEAN
, 16,
1261 NULL
, 0x20, NULL
, HFILL
}},
1262 { &hf_tns_data_flag_eof
, {
1263 "End of File", "tns.data_flag.eof", FT_BOOLEAN
, 16,
1264 NULL
, 0x40, NULL
, HFILL
}},
1265 { &hf_tns_data_flag_dic
, {
1266 "Do Immediate Confirmation", "tns.data_flag.dic", FT_BOOLEAN
, 16,
1267 NULL
, 0x80, NULL
, HFILL
}},
1268 { &hf_tns_data_flag_rts
, {
1269 "Request To Send", "tns.data_flag.rts", FT_BOOLEAN
, 16,
1270 NULL
, 0x100, NULL
, HFILL
}},
1271 { &hf_tns_data_flag_sntt
, {
1272 "Send NT Trailer", "tns.data_flag.sntt", FT_BOOLEAN
, 16,
1273 NULL
, 0x200, NULL
, HFILL
}},
1276 { &hf_tns_reserved_byte
, {
1277 "Reserved Byte", "tns.reserved_byte", FT_BYTES
, BASE_NONE
,
1278 NULL
, 0x0, NULL
, HFILL
}},
1279 { &hf_tns_packet_type
, {
1280 "Packet Type", "tns.type", FT_UINT8
, BASE_DEC
,
1281 VALS(tns_type_vals
), 0x0, "Type of TNS packet", HFILL
}}
1285 static gint
*ett
[] = {
1302 module_t
*tns_module
;
1304 proto_tns
= proto_register_protocol(
1305 "Transparent Network Substrate Protocol", "TNS", "tns");
1306 proto_register_field_array(proto_tns
, hf
, array_length(hf
));
1307 proto_register_subtree_array(ett
, array_length(ett
));
1309 tns_module
= prefs_register_protocol(proto_tns
, NULL
);
1310 prefs_register_bool_preference(tns_module
, "desegment_tns_messages",
1311 "Reassemble TNS messages spanning multiple TCP segments",
1312 "Whether the TNS dissector should reassemble messages spanning multiple TCP segments. "
1313 "To use this option, you must also enable \"Allow subdissectors to reassemble TCP streams\" in the TCP protocol settings.",
1318 proto_reg_handoff_tns(void)
1320 dissector_handle_t tns_handle
;
1322 tns_handle
= new_create_dissector_handle(dissect_tns
, proto_tns
);
1323 dissector_add_uint("tcp.port", TCP_PORT_TNS
, tns_handle
);
1324 data_handle
= find_dissector("data");