Bug Summary

File:builds/wireshark/wireshark/epan/dissectors/packet-tns.c
Warning:line 786, column 3
Value stored to 'len' is never read

Annotated Source Code

Press '?' to see keyboard shortcuts

clang -cc1 -cc1 -triple x86_64-pc-linux-gnu -analyze -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name packet-tns.c -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -mrelocation-model pic -pic-level 2 -fhalf-no-semantic-interposition -fno-delete-null-pointer-checks -mframe-pointer=all -relaxed-aliasing -fmath-errno -ffp-contract=on -fno-rounding-math -ffloat16-excess-precision=fast -fbfloat16-excess-precision=fast -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -fdebug-compilation-dir=/builds/wireshark/wireshark/build -fcoverage-compilation-dir=/builds/wireshark/wireshark/build -resource-dir /usr/lib/llvm-22/lib/clang/22 -isystem /usr/include/glib-2.0 -isystem /usr/lib/x86_64-linux-gnu/glib-2.0/include -isystem /builds/wireshark/wireshark/epan/dissectors -isystem /builds/wireshark/wireshark/build/epan/dissectors -isystem /usr/include/mit-krb5 -isystem /usr/include/libxml2 -isystem /builds/wireshark/wireshark/epan -D CARES_NO_DEPRECATED -D G_DISABLE_DEPRECATED -D G_DISABLE_SINGLE_INCLUDES -D WS_BUILD_DLL -D WS_DEBUG -D WS_DEBUG_UTF_8 -I /builds/wireshark/wireshark/build -I /builds/wireshark/wireshark -I /builds/wireshark/wireshark/include -D _GLIBCXX_ASSERTIONS -internal-isystem /usr/lib/llvm-22/lib/clang/22/include -internal-isystem /usr/local/include -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/16/../../../../x86_64-linux-gnu/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -fmacro-prefix-map=/builds/wireshark/wireshark/= -fmacro-prefix-map=/builds/wireshark/wireshark/build/= -fmacro-prefix-map=../= -Wno-format-nonliteral -std=gnu17 -ferror-limit 19 -fvisibility=hidden -fwrapv -fwrapv-pointer -fstrict-flex-arrays=3 -stack-protector 2 -fstack-clash-protection -fcf-protection=full -fgnuc-version=4.2.1 -fskip-odr-check-in-gmf -fexceptions -fcolor-diagnostics -analyzer-output=html -faddrsig -fdwarf2-cfi-asm -o /builds/wireshark/wireshark/sbout/2026-10-01-100324-3662-1 -x c /builds/wireshark/wireshark/epan/dissectors/packet-tns.c
1/* packet-tns.c
2 * Routines for Oracle TNS packet dissection
3 *
4 * Wireshark - Network traffic analyzer
5 * By Gerald Combs <gerald@wireshark.org>
6 * Copyright 1998 Gerald Combs
7 *
8 * Copied from packet-tftp.c
9 *
10 * SPDX-License-Identifier: GPL-2.0-or-later
11 */
12
13#include "config.h"
14
15#include <epan/packet.h>
16#include "packet-tcp.h"
17
18#include <epan/prefs.h>
19#include <epan/expert.h>
20#include <epan/conversation.h>
21#include <epan/proto_data.h>
22#include <epan/unit_strings.h>
23
24#include <wsutil/array.h>
25
26void proto_register_tns(void);
27
28#define TNS_HDR_LEN8 8
29
30/* Packet Types */
31#define TNS_TYPE_CONNECT1 1
32#define TNS_TYPE_ACCEPT2 2
33#define TNS_TYPE_ACK3 3
34#define TNS_TYPE_REFUSE4 4
35#define TNS_TYPE_REDIRECT5 5
36#define TNS_TYPE_DATA6 6
37#define TNS_TYPE_NULL7 7
38#define TNS_TYPE_ABORT9 9
39#define TNS_TYPE_RESEND11 11
40#define TNS_TYPE_MARKER12 12
41#define TNS_TYPE_ATTENTION13 13
42#define TNS_TYPE_CONTROL14 14
43#define TNS_TYPE_DD15 15
44#define TNS_TYPE_MAX19 19
45
46/*
47 * Oracle datatype codes as they appear on the wire and in tns_data_types[].
48 * python-oracledb lists most of these as its ORA_TYPE_NUM_* constants.
49 */
50#define TNS_DATATYPE_VARCHAR1 1
51#define TNS_DATATYPE_NUMBER2 2
52#define TNS_DATATYPE_INTEGER3 3
53#define TNS_DATATYPE_FLOAT4 4
54#define TNS_DATATYPE_STRING5 5
55#define TNS_DATATYPE_VARNUM6 6
56#define TNS_DATATYPE_DECIMAL7 7
57#define TNS_DATATYPE_LONG8 8
58#define TNS_DATATYPE_VCS9 9
59#define TNS_DATATYPE_ROWID11 11 /* RID */
60#define TNS_DATATYPE_DATE12 12
61#define TNS_DATATYPE_VBI15 15
62#define TNS_DATATYPE_RAW23 23
63#define TNS_DATATYPE_LONG_RAW24 24
64#define TNS_DATATYPE_CHAR96 96
65#define TNS_DATATYPE_BINARY_FLOAT100 100
66#define TNS_DATATYPE_BINARY_DOUBLE101 101
67#define TNS_DATATYPE_REFCURSOR102 102
68#define TNS_DATATYPE_ROWID_EXT104 104 /* ROWID */
69#define TNS_DATATYPE_ADT109 109 /* object */
70#define TNS_DATATYPE_REF111 111
71#define TNS_DATATYPE_CLOB112 112
72#define TNS_DATATYPE_BLOB113 113
73#define TNS_DATATYPE_BFILE114 114
74#define TNS_DATATYPE_RSET116 116
75#define TNS_DATATYPE_JSON119 119 /* OSON */
76#define TNS_DATATYPE_VECTOR127 127
77#define TNS_DATATYPE_TIMESTAMP180 180
78#define TNS_DATATYPE_TIMESTAMP_TZ181 181
79#define TNS_DATATYPE_INTERVAL_YM182 182
80#define TNS_DATATYPE_INTERVAL_DS183 183
81#define TNS_DATATYPE_UROWID208 208
82#define TNS_DATATYPE_TIMESTAMP_LTZ231 231
83
84/* DALC length byte marking a slot with no value (see get_dalc_custom). */
85#define TNS_DALC_ABSENT0xFD 0xFD
86
87/* Data Packet Functions */
88#define SQLNET_SET_PROTOCOL1 1
89#define SQLNET_SET_DATATYPES2 2
90#define SQLNET_USER_OCI_FUNC3 3
91#define SQLNET_RETURN_STATUS4 4
92#define SQLNET_ACCESS_USR_ADDR5 5
93#define SQLNET_ROW_TRANSF_HDR6 6
94#define SQLNET_ROW_TRANSF_DATA7 7
95#define SQLNET_RETURN_OPI_PARAM8 8
96#define SQLNET_FUNCCOMPLETE9 9
97#define SQLNET_NERROR_RET_DEF10 10
98#define SQLNET_IOVEC_4FAST_UPI11 11
99#define SQLNET_LONG_4FAST_UPI12 12
100#define SQLNET_INVOKE_USER_CB13 13
101#define SQLNET_LOB_FILE_DF14 14
102#define SQLNET_WARNING15 15
103#define SQLNET_DESCRIBE_INFO16 16
104#define SQLNET_PIGGYBACK_FUNC17 17
105#define SQLNET_SIG_4UCS18 18
106#define SQLNET_FLUSH_BIND_DATA19 19
107#define SQLNET_END_OF_RESPONSE29 29
108#define SQLNET_SNS0xdeadbeef 0xdeadbeef
109#define SQLNET_XTRN_PROCSERV_R132 32
110#define SQLNET_XTRN_PROCSERV_R268 68
111
112/* Return OPI Parameter's Type */
113#define OPI_VERSION21 1
114#define OPI_OSESSKEY2 2
115#define OPI_OAUTH3 3
116
117/* OCI function ids (TTI_FUN sub-functions). */
118#define TTI_FETCH5 5
119#define TTI_ALL894 94
120#define TTI_LOBOPS96 96
121#define TTI_CLOSE_CURSORS105 105
122
123/* desegmentation of TNS over TCP */
124static bool_Bool tns_desegment = true1;
125
126static dissector_handle_t tns_handle;
127
128static int proto_tns;
129static int hf_tns_request;
130static int hf_tns_response;
131static int hf_tns_length;
132static int hf_tns_packet_checksum;
133static int hf_tns_header_checksum;
134static int hf_tns_packet_type;
135static int hf_tns_reserved_byte;
136static int hf_tns_version;
137static int hf_tns_compat_version;
138
139static int hf_tns_service_options;
140static int hf_tns_sopt_flag_bconn;
141static int hf_tns_sopt_flag_pc;
142static int hf_tns_sopt_flag_hc;
143static int hf_tns_sopt_flag_fd;
144static int hf_tns_sopt_flag_hd;
145static int hf_tns_sopt_flag_dc1;
146static int hf_tns_sopt_flag_dc2;
147static int hf_tns_sopt_flag_dio;
148static int hf_tns_sopt_flag_ap;
149static int hf_tns_sopt_flag_ra;
150static int hf_tns_sopt_flag_sa;
151
152static int hf_tns_sdu_size;
153static int hf_tns_max_tdu_size;
154
155static int hf_tns_nt_proto_characteristics;
156static int hf_tns_ntp_flag_hangon;
157static int hf_tns_ntp_flag_crel;
158static int hf_tns_ntp_flag_tduio;
159static int hf_tns_ntp_flag_srun;
160static int hf_tns_ntp_flag_dtest;
161static int hf_tns_ntp_flag_cbio;
162static int hf_tns_ntp_flag_asio;
163static int hf_tns_ntp_flag_pio;
164static int hf_tns_ntp_flag_grant;
165static int hf_tns_ntp_flag_handoff;
166static int hf_tns_ntp_flag_sigio;
167static int hf_tns_ntp_flag_sigpipe;
168static int hf_tns_ntp_flag_sigurg;
169static int hf_tns_ntp_flag_urgentio;
170static int hf_tns_ntp_flag_fdio;
171static int hf_tns_ntp_flag_testop;
172
173static int hf_tns_line_turnaround;
174static int hf_tns_value_of_one;
175static int hf_tns_connect_data_length;
176static int hf_tns_connect_data_offset;
177static int hf_tns_connect_data_max;
178
179static int hf_tns_connect_flags0;
180static int hf_tns_connect_flags1;
181static int hf_tns_conn_flag_nareq;
182static int hf_tns_conn_flag_nalink;
183static int hf_tns_conn_flag_enablena;
184static int hf_tns_conn_flag_ichg;
185static int hf_tns_conn_flag_wantna;
186
187static int hf_tns_connect_data;
188static int hf_tns_trace_cf1;
189static int hf_tns_trace_cf2;
190static int hf_tns_trace_cid;
191
192static int hf_tns_accept_data_length;
193static int hf_tns_accept_data_offset;
194static int hf_tns_accept_data;
195
196static int hf_tns_refuse_reason_user;
197static int hf_tns_refuse_reason_system;
198static int hf_tns_refuse_data_length;
199static int hf_tns_refuse_data;
200
201static int hf_tns_abort_reason_user;
202static int hf_tns_abort_reason_system;
203static int hf_tns_abort_data;
204
205static int hf_tns_marker_type;
206static int hf_tns_marker_data_byte;
207static int hf_tns_marker_function;
208/* static int hf_tns_marker_data; */
209
210static int hf_tns_redirect_data_length;
211static int hf_tns_redirect_data;
212
213static int hf_tns_control_cmd;
214static int hf_tns_control_data;
215
216static int hf_tns_data_flag;
217static int hf_tns_data_flag_send;
218static int hf_tns_data_flag_rc;
219static int hf_tns_data_flag_c;
220static int hf_tns_data_flag_reserved;
221static int hf_tns_data_flag_more;
222static int hf_tns_data_flag_eof;
223static int hf_tns_data_flag_dic;
224static int hf_tns_data_flag_rts;
225static int hf_tns_data_flag_sntt;
226
227static int hf_tns_data_id;
228static int hf_tns_data_length;
229static int hf_tns_data_oci_id;
230static int hf_tns_data_tseq;
231static int hf_tns_data_piggyback_id;
232static int hf_tns_data_unused;
233
234static int hf_tns_cursor;
235
236static int hf_tns_data_opi_version2_banner_len;
237static int hf_tns_data_opi_version2_banner;
238static int hf_tns_data_opi_version2_vsnum;
239
240static int hf_tns_data_opi_num_of_params;
241static int hf_tns_data_opi_param_length;
242static int hf_tns_data_opi_param_name;
243static int hf_tns_data_opi_param_value;
244
245static int hf_tns_data_setp_acc_version;
246static int hf_tns_data_setp_cli_plat;
247static int hf_tns_data_setp_version;
248static int hf_tns_data_setp_banner;
249
250static int hf_tns_data_sns_cli_vers;
251static int hf_tns_data_sns_srv_vers;
252static int hf_tns_data_sns_srvcnt;
253
254static int hf_tns_data_setdt_charset_in;
255static int hf_tns_data_setdt_charset_out;
256static int hf_tns_data_setdt_flag;
257static int hf_tns_data_setdt_caphdr;
258static int hf_tns_data_setdt_caphdr_version;
259static int hf_tns_data_setdt_caphdr_flags;
260static int hf_tns_data_setdt_tblhdr;
261static int hf_tns_data_setdt_idmap;
262static int hf_tns_data_setdt_overrides;
263static int hf_tns_data_setdt_override_client;
264static int hf_tns_data_setdt_override_repr;
265static int hf_tns_data_setdt_override_format;
266
267static int hf_tns_data_oer_call_status;
268static int hf_tns_data_oer_rowcount;
269static int hf_tns_data_oer_err_code;
270static int hf_tns_data_oer_cursor_id;
271static int hf_tns_data_oer_n_batch_errcodes;
272static int hf_tns_data_oer_n_batch_offsets;
273static int hf_tns_data_oer_n_batch_messages;
274static int hf_tns_data_oer_message;
275
276static int hf_tns_data_sta_call_status;
277static int hf_tns_data_sta_seq;
278static int hf_tns_data_call_status_txn;
279static int hf_tns_data_call_status_sess_release;
280
281static int hf_tns_data_iov_num_binds;
282static int hf_tns_data_iov_bind_dir;
283
284static int hf_tns_data_dcb_num_columns;
285static int hf_tns_data_col_type;
286static int hf_tns_data_col_precision;
287static int hf_tns_data_col_scale;
288static int hf_tns_data_col_max_length;
289static int hf_tns_data_col_charset;
290static int hf_tns_data_col_csform;
291static int hf_tns_data_col_max_size;
292static int hf_tns_data_col_nulls_ok;
293static int hf_tns_data_col_name;
294
295static int hf_tns_data_rxh_num_requests;
296static int hf_tns_data_rxh_iter_num;
297static int hf_tns_data_rxh_num_iters;
298
299static int hf_tns_data_all8_options;
300static int hf_tns_data_all8_opt_parse;
301static int hf_tns_data_all8_opt_bind;
302static int hf_tns_data_all8_opt_define;
303static int hf_tns_data_all8_opt_execute;
304static int hf_tns_data_all8_opt_commit;
305static int hf_tns_data_all8_opt_plsql;
306static int hf_tns_data_all8_opt_fetch;
307static int hf_tns_data_all8_fetch_rows;
308static int hf_tns_data_all8_bind_count;
309static int hf_tns_data_all8_sql;
310static int hf_tns_data_bind_value;
311static int hf_tns_data_fetch_rows;
312static int hf_tns_data_lob_op;
313static int hf_tns_data_lob_offset;
314static int hf_tns_data_col_value;
315
316static int hf_tns_data_descriptor_row_count;
317static int hf_tns_data_descriptor_row_size;
318
319static int ett_tns;
320static int ett_tns_connect;
321static int ett_tns_accept;
322static int ett_tns_refuse;
323static int ett_tns_abort;
324static int ett_tns_redirect;
325static int ett_tns_marker;
326static int ett_tns_attention;
327static int ett_tns_control;
328static int ett_tns_data;
329static int ett_tns_data_flag;
330static int ett_tns_acc_versions;
331static int ett_tns_opi_params;
332static int ett_tns_opi_par;
333static int ett_tns_sopt_flag;
334static int ett_tns_ntp_flag;
335static int ett_tns_conn_flag;
336static int ett_tns_rows;
337static int ett_tns_setdt_caphdr;
338static int ett_tns_setdt_overrides;
339static int ett_tns_setdt_override;
340static int ett_tns_oer;
341static int ett_tns_call_status;
342static int ett_tns_iov;
343static int ett_tns_dcb_col;
344static int ett_tns_all8_options;
345static int ett_tns_binds;
346static int ett_tns_bind;
347static int ett_tns_bind_row;
348static int ett_tns_rxd_row;
349static int ett_sql;
350
351static expert_field ei_tns_connect_data_next_packet;
352static expert_field ei_tns_data_descriptor_size_mismatch;
353static expert_field ei_tns_data_piggyback_cursors;
354static expert_field ei_tns_data_count_too_large;
355
356#define TCP_PORT_TNS1521 1521 /* Not IANA registered */
357
358static int * const tns_connect_flags[] = {
359 &hf_tns_conn_flag_nareq,
360 &hf_tns_conn_flag_nalink,
361 &hf_tns_conn_flag_enablena,
362 &hf_tns_conn_flag_ichg,
363 &hf_tns_conn_flag_wantna,
364 NULL((void*)0)
365};
366
367static int * const tns_service_options[] = {
368 &hf_tns_sopt_flag_bconn,
369 &hf_tns_sopt_flag_pc,
370 &hf_tns_sopt_flag_hc,
371 &hf_tns_sopt_flag_fd,
372 &hf_tns_sopt_flag_hd,
373 &hf_tns_sopt_flag_dc1,
374 &hf_tns_sopt_flag_dc2,
375 &hf_tns_sopt_flag_dio,
376 &hf_tns_sopt_flag_ap,
377 &hf_tns_sopt_flag_ra,
378 &hf_tns_sopt_flag_sa,
379 NULL((void*)0)
380};
381
382/* TTI_ALL8 (SQL execute) options bitmask. */
383static int * const tns_all8_options[] = {
384 &hf_tns_data_all8_opt_parse,
385 &hf_tns_data_all8_opt_bind,
386 &hf_tns_data_all8_opt_define,
387 &hf_tns_data_all8_opt_execute,
388 &hf_tns_data_all8_opt_commit,
389 &hf_tns_data_all8_opt_plsql,
390 &hf_tns_data_all8_opt_fetch,
391 NULL((void*)0)
392};
393
394static const value_string tns_type_vals[] = {
395 {TNS_TYPE_CONNECT1, "Connect" },
396 {TNS_TYPE_ACCEPT2, "Accept" },
397 {TNS_TYPE_ACK3, "Acknowledge" },
398 {TNS_TYPE_REFUSE4, "Refuse" },
399 {TNS_TYPE_REDIRECT5, "Redirect" },
400 {TNS_TYPE_DATA6, "Data" },
401 {TNS_TYPE_NULL7, "Null" },
402 {TNS_TYPE_ABORT9, "Abort" },
403 {TNS_TYPE_RESEND11, "Resend"},
404 {TNS_TYPE_MARKER12, "Marker"},
405 {TNS_TYPE_ATTENTION13, "Attention"},
406 {TNS_TYPE_CONTROL14, "Control"},
407 {TNS_TYPE_DD15, "Data Descriptor"},
408 {0, NULL((void*)0)}
409};
410
411static const value_string tns_data_funcs[] = {
412 {SQLNET_SET_PROTOCOL1, "Set Protocol"},
413 {SQLNET_SET_DATATYPES2, "Set Datatypes"},
414 {SQLNET_USER_OCI_FUNC3, "User OCI Functions"},
415 {SQLNET_RETURN_STATUS4, "Return Status"},
416 {SQLNET_ACCESS_USR_ADDR5, "Access User Address Space"},
417 {SQLNET_ROW_TRANSF_HDR6, "Row Transfer Header"},
418 {SQLNET_ROW_TRANSF_DATA7, "Row Transfer Data"},
419 {SQLNET_RETURN_OPI_PARAM8, "Return OPI Parameter"},
420 {SQLNET_FUNCCOMPLETE9, "Function Complete"},
421 {SQLNET_NERROR_RET_DEF10, "N Error return definitions follow"},
422 {SQLNET_IOVEC_4FAST_UPI11, "Sending I/O Vec only for fast UPI"},
423 {SQLNET_LONG_4FAST_UPI12, "Sending long for fast UPI"},
424 {SQLNET_INVOKE_USER_CB13, "Invoke user callback"},
425 {SQLNET_LOB_FILE_DF14, "LOB/FILE data follows"},
426 {SQLNET_WARNING15, "Warning messages - may be a set of them"},
427 {SQLNET_DESCRIBE_INFO16, "Describe Information"},
428 {SQLNET_PIGGYBACK_FUNC17, "Piggy back function follow"},
429 {SQLNET_SIG_4UCS18, "Signals special action for untrusted callout support"},
430 {SQLNET_FLUSH_BIND_DATA19, "Flush Out Bind data in DML/w RETURN when error"},
431 {SQLNET_END_OF_RESPONSE29, "End of Response"},
432 {SQLNET_XTRN_PROCSERV_R132, "External Procedures and Services Registrations"},
433 {SQLNET_XTRN_PROCSERV_R268, "External Procedures and Services Registrations"},
434 {SQLNET_SNS0xdeadbeef, "Secure Network Services"},
435 {0, NULL((void*)0)}
436};
437
438/* Oracle TNS native data-type ids. Used by the Set Datatypes
439 * negotiation to label override entries with human names. */
440static const value_string tns_data_types[] = {
441 {TNS_DATATYPE_VARCHAR1, "VARCHAR"},
442 {TNS_DATATYPE_NUMBER2, "NUMBER"},
443 {TNS_DATATYPE_INTEGER3, "INTEGER"},
444 {TNS_DATATYPE_FLOAT4, "FLOAT"},
445 {TNS_DATATYPE_STRING5, "STRING"},
446 {TNS_DATATYPE_VARNUM6, "VARNUM"},
447 {TNS_DATATYPE_DECIMAL7, "DECIMAL"},
448 {TNS_DATATYPE_LONG8, "LONG"},
449 {TNS_DATATYPE_VCS9, "VCS"},
450 {TNS_DATATYPE_ROWID11, "RID"},
451 {TNS_DATATYPE_DATE12, "DATE"},
452 {TNS_DATATYPE_VBI15, "VBI"},
453 {TNS_DATATYPE_RAW23, "RAW"},
454 {TNS_DATATYPE_LONG_RAW24, "LONG RAW"},
455 {TNS_DATATYPE_CHAR96, "CHAR"},
456 {TNS_DATATYPE_BINARY_FLOAT100, "BINARY_FLOAT"},
457 {TNS_DATATYPE_BINARY_DOUBLE101, "BINARY_DOUBLE"},
458 {TNS_DATATYPE_REFCURSOR102, "REFCURSOR"},
459 {TNS_DATATYPE_ROWID_EXT104, "ROWID"},
460 {TNS_DATATYPE_ADT109, "ADT"},
461 {TNS_DATATYPE_REF111, "REF"},
462 {TNS_DATATYPE_CLOB112, "CLOB"},
463 {TNS_DATATYPE_BLOB113, "BLOB"},
464 {TNS_DATATYPE_BFILE114, "BFILE"},
465 {TNS_DATATYPE_RSET116, "RSET"},
466 {TNS_DATATYPE_JSON119, "JSON"},
467 {TNS_DATATYPE_VECTOR127, "VECTOR"},
468 {TNS_DATATYPE_TIMESTAMP180, "TIMESTAMP"},
469 {TNS_DATATYPE_TIMESTAMP_TZ181, "TIMESTAMP WITH TIME ZONE"},
470 {TNS_DATATYPE_INTERVAL_YM182, "INTERVAL YEAR TO MONTH"},
471 {TNS_DATATYPE_INTERVAL_DS183, "INTERVAL DAY TO SECOND"},
472 {TNS_DATATYPE_UROWID208, "UROWID"},
473 {TNS_DATATYPE_TIMESTAMP_LTZ231, "TIMESTAMP WITH LOCAL TIME ZONE"},
474 {0, NULL((void*)0)}
475};
476
477/* Oracle NLS character-set ids - the well-known subset, enough to name
478 * the charsets seen in a Set Datatypes negotiation. */
479static const value_string tns_charsets[] = {
480 {31, "WE8ISO8859P1"},
481 {32, "EE8ISO8859P2"},
482 {35, "CL8ISO8859P5"},
483 {170, "EE8MSWIN1250"},
484 {171, "CL8MSWIN1251"},
485 {178, "WE8MSWIN1252"},
486 {830, "JA16EUC"},
487 {852, "ZHS16GBK"},
488 {865, "ZHT16BIG5"},
489 {867, "ZHT16MSWIN950"},
490 {871, "US7ASCII"},
491 {873, "AL32UTF8"},
492 {2000, "AL16UTF16"},
493 {0, NULL((void*)0)}
494};
495
496/* TTI_LOBOPS operation opcodes. */
497static const value_string tns_lob_ops[] = {
498 {0x00001, "GET_LENGTH"},
499 {0x00002, "READ"},
500 {0x00020, "TRIM"},
501 {0x00040, "WRITE"},
502 {0x00100, "FILE_OPEN"},
503 {0x00110, "CREATE_TEMP"},
504 {0x00111, "FREE_TEMP"},
505 {0x00200, "FILE_CLOSE"},
506 {0x00400, "FILE_ISOPEN"},
507 {0x00800, "FILE_EXISTS"},
508 {0x04000, "GET_CHUNK_SIZE"},
509 {0x08000, "OPEN"},
510 {0x10000, "CLOSE"},
511 {0x11000, "IS_OPEN"},
512 {0x80000, "ARRAY"},
513 {0, NULL((void*)0)}
514};
515
516/* Column character-set form (csfrm) in an OAC descriptor: whether char data
517 * is in the database charset or the national (AL16UTF16) charset. */
518static const value_string tns_csform_vals[] = {
519 {1, "Database charset"},
520 {2, "National (AL16UTF16)"},
521 {0, NULL((void*)0)}
522};
523
524/* Bind directions reported per bind in a TTI_IOV vector (TNS_BIND_DIR_*),
525 * cross-referenced with python-oracledb's constants. */
526static const value_string tns_iov_bind_dirs[] = {
527 {16, "OUT"},
528 {32, "IN"},
529 {48, "IN OUT"},
530 {0, NULL((void*)0)}
531};
532
533static const value_string tns_data_oci_subfuncs[] = {
534 {1, "Logon to Oracle"},
535 {2, "Open Cursor"},
536 {3, "Parse a Row"},
537 {4, "Execute a Row"},
538 {5, "Fetch a Row"},
539 {8, "Close Cursor"},
540 {9, "Logoff of Oracle"},
541 {10, "Describe a select list column"},
542 {11, "Define where the column goes"},
543 {12, "Auto commit on"},
544 {13, "Auto commit off"},
545 {14, "Commit"},
546 {15, "Rollback"},
547 {16, "Set fatal error options"},
548 {17, "Resume current operation"},
549 {18, "Get Oracle version-date string"},
550 {19, "Until we get rid of OASQL"},
551 {20, "Cancel the current operation"},
552 {21, "Get error message"},
553 {22, "Exit Oracle command"},
554 {23, "Special function"},
555 {24, "Abort"},
556 {25, "Dequeue by RowID"},
557 {26, "Fetch a long column value"},
558 {27, "Create Access Module"},
559 {28, "Save Access Module Statement"},
560 {29, "Save Access Module"},
561 {30, "Parse Access Module Statement"},
562 {31, "How many items?"},
563 {32, "Initialize Oracle"},
564 {33, "Change User ID"},
565 {34, "Bind by reference positional"},
566 {35, "Get n'th Bind Variable"},
567 {36, "Get n'th Into Variable"},
568 {37, "Bind by reference"},
569 {38, "Bind by reference numeric"},
570 {39, "Parse and Execute"},
571 {40, "Parse for syntax (only)"},
572 {41, "Parse for syntax and SQL Dictionary lookup"},
573 {42, "Continue serving after EOF"},
574 {43, "Array describe"},
575 {44, "Init sys pars command table"},
576 {45, "Finalize sys pars command table"},
577 {46, "Put sys par in command table"},
578 {47, "Get sys pars from command table"},
579 {48, "Start Oracle (V6)"},
580 {49, "Shutdown Oracle (V6)"},
581 {50, "Run Independent Process (V6)"},
582 {51, "Test RAM (V6)"},
583 {52, "Archive operation (V6)"},
584 {53, "Media Recovery - start (V6)"},
585 {54, "Media Recovery - record tablespace to recover (V6)"},
586 {55, "Media Recovery - get starting log seq # (V6)"},
587 {56, "Media Recovery - recover using offline log (V6)"},
588 {57, "Media Recovery - cancel media recovery (V6)"},
589 {58, "Logon to Oracle (V6)"},
590 {59, "Get Oracle version-date string in new format"},
591 {60, "Initialize Oracle"},
592 {61, "Reserved for MAC; close all cursors"},
593 {62, "Bundled execution call"},
594 {65, "For direct loader: functions"},
595 {66, "For direct loader: buffer transfer"},
596 {67, "Distrib. trans. mgr. RPC"},
597 {68, "Describe indexes for distributed query"},
598 {69, "Session operations"},
599 {70, "Execute using synchronized system commit numbers"},
600 {71, "Fast UPI calls to OPIAL7"},
601 {72, "Long Fetch (V7)"},
602 {73, "Call OPIEXE from OPIALL: no two-task access"},
603 {74, "Parse Call (V7) to deal with various flavours"},
604 {76, "RPC call from PL/SQL"},
605 {77, "Do a KGL operation"},
606 {78, "Execute and Fetch"},
607 {79, "X/Open XA operation"},
608 {80, "New KGL operation call"},
609 {81, "2nd Half of Logon"},
610 {82, "1st Half of Logon"},
611 {83, "Do Streaming Operation"},
612 {84, "Open Session (71 interface)"},
613 {85, "X/Open XA operations (71 interface)"},
614 {86, "Debugging operations"},
615 {87, "Special debugging operations"},
616 {88, "XA Start"},
617 {89, "XA Switch and Commit"},
618 {90, "Direct copy from db buffers to client address"},
619 {91, "OKOD Call (In Oracle <= 7 this used to be Connect"},
620 {93, "RPI Callback with ctxdef"},
621 {94, "Bundled execution call (V7)"},
622 {95, "Do Streaming Operation without begintxn"},
623 {96, "LOB and FILE related calls"},
624 {97, "File Create call"},
625 {98, "Describe query (V8) call"},
626 {99, "Connect (non-blocking attach host)"},
627 {100, "Open a recursive cursor"},
628 {101, "Bundled KPR Execution"},
629 {102, "Bundled PL/SQL execution"},
630 {103, "Transaction start, attach, detach"},
631 {104, "Transaction commit, rollback, recover"},
632 {105, "Cursor close all"},
633 {106, "Failover into piggyback"},
634 {107, "Session switching piggyback (V8)"},
635 {108, "Do Dummy Defines"},
636 {109, "Init sys pars (V8)"},
637 {110, "Finalize sys pars (V8)"},
638 {111, "Put sys par in par space (V8)"},
639 {112, "Terminate sys pars (V8)"},
640 {114, "Init Untrusted Callbacks"},
641 {115, "Generic authentication call"},
642 {116, "FailOver Get Instance call"},
643 {117, "Oracle Transaction service Commit remote sites"},
644 {118, "Get the session key"},
645 {119, "Describe any (V8)"},
646 {120, "Cancel All"},
647 {121, "AQ Enqueue"},
648 {122, "AQ Dequeue"},
649 {123, "Object transfer"},
650 {124, "RFS Call"},
651 {125, "Kernel programmatic notification"},
652 {126, "Listen"},
653 {127, "Oracle Transaction service Commit remote sites (V >= 8.1.3)"},
654 {128, "Dir Path Prepare"},
655 {129, "Dir Path Load Stream"},
656 {130, "Dir Path Misc. Ops"},
657 {131, "Memory Stats"},
658 {132, "AQ Properties Status"},
659 {134, "Remote Fetch Archive Log FAL"},
660 {135, "Client ID propagation"},
661 {136, "DR Server CNX Process"},
662 {138, "SPFILE parameter put"},
663 {139, "KPFC exchange"},
664 {140, "Object Transfer (V8.2)"},
665 {141, "Push Transaction"},
666 {142, "Pop Transaction"},
667 {143, "KFN Operation"},
668 {144, "Dir Path Unload Stream"},
669 {145, "AQ batch enqueue dequeue"},
670 {146, "File Transfer"},
671 {147, "Ping"},
672 {148, "TSM"},
673 {150, "Begin TSM"},
674 {151, "End TSM"},
675 {152, "Set schema"},
676 {153, "Fetch from suspended result set"},
677 {154, "Key/Value pair"},
678 {155, "XS Create session Operation"},
679 {156, "XS Session Roundtrip Operation"},
680 {157, "XS Piggyback Operation"},
681 {158, "KSRPC Execution"},
682 {159, "Streams combined capture apply"},
683 {160, "AQ replay information"},
684 {161, "SSCR"},
685 {162, "Session Get"},
686 {163, "Session RLS"},
687 {165, "Workload replay data"},
688 {166, "Replay statistic data"},
689 {167, "Query Cache Stats"},
690 {168, "Query Cache IDs"},
691 {169, "RPC Test Stream"},
692 {170, "Replay PL/SQL RPC"},
693 {171, "XStream Out"},
694 {172, "Golden Gate RPC"},
695 {0, NULL((void*)0)}
696};
697static value_string_ext tns_data_oci_subfuncs_ext = VALUE_STRING_EXT_INIT(tns_data_oci_subfuncs){ _try_val_to_str_ext_init, 0, (sizeof (tns_data_oci_subfuncs
) / sizeof ((tns_data_oci_subfuncs)[0]))-1, tns_data_oci_subfuncs
, "tns_data_oci_subfuncs", ((void*)0) }
;
698
699/* The final byte of a TNS_MARKER body selects break vs reset:
700 * 01 00 01 = break, 01 00 02 = reset. */
701static const value_string tns_marker_functions[] = {
702 {1, "Break (interrupt call)"},
703 {2, "Reset (clear line)"},
704 {0, NULL((void*)0)}
705};
706
707static const value_string tns_marker_types[] = {
708 {0, "Data Marker - 0 Data Bytes"},
709 {1, "Data Marker - 1 Data Bytes"},
710 {2, "Attention Marker"},
711 {0, NULL((void*)0)}
712};
713
714static const value_string tns_control_cmds[] = {
715 {1, "Oracle Trace Command"},
716 {0, NULL((void*)0)}
717};
718
719/* What a row decoder needs to know about one column: its datatype and
720 * the data length (buffer size) the describe gave it. */
721typedef struct _tns_column_t {
722 uint8_t type;
723 uint32_t data_len;
724} tns_column_t;
725
726/* Columns from the most recent describe (TTI_DCB), threaded to a later
727 * TTI_RXD response so its row values can be split per column. */
728typedef struct _tns_describe_t {
729 uint32_t num_cols;
730 tns_column_t *cols;
731} tns_describe_t;
732
733typedef struct _tns_conv_info_t {
734 uint32_t pending_connect_data;
735 tns_describe_t *last_describe;
736} tns_conv_info_t;
737
738/* p_add_proto_data key for the describe a TTI_RXD response packet uses. */
739#define TNS_PROTO_DATA_DESCRIBE1 1
740
741void proto_reg_handoff_tns(void);
742static int dissect_tns_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U___attribute__((unused)));
743
744static tns_conv_info_t*
745tns_get_conv_info(packet_info *pinfo)
746{
747 conversation_t *conversation = find_or_create_conversation(pinfo);
748
749 tns_conv_info_t *tns_info = (tns_conv_info_t *)conversation_get_proto_data(conversation, proto_tns);
750 if (!tns_info) {
751 tns_info = wmem_new0(wmem_file_scope(), tns_conv_info_t)((tns_conv_info_t*)wmem_alloc0((wmem_file_scope()), sizeof(tns_conv_info_t
)))
;
752 conversation_add_proto_data(conversation, proto_tns, tns_info);
753 }
754 return tns_info;
755}
756
757static unsigned get_data_func_id(tvbuff_t *tvb, int offset)
758{
759 /* Determine Data Function id */
760 uint8_t first_byte;
761
762 first_byte =
763 tvb_reported_length_remaining(tvb, offset) > 0 ? tvb_get_uint8(tvb, offset) : 0;
764
765 if ( tvb_bytes_exist(tvb, offset, 4) && first_byte == 0xDE &&
766 tvb_get_uint24(tvb, offset+1, ENC_BIG_ENDIAN0x00000000) == 0xADBEEF )
767 {
768 return SQLNET_SNS0xdeadbeef;
769 }
770 else
771 {
772 return (unsigned)first_byte;
773 }
774}
775
776static int get_strtype_custom(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
777{
778 int ret = 1; // 1st byte contains 254 or length if smaller than 64
779 int len = 0;
780
781 wmem_strbuf_t *strbuf = wmem_strbuf_new(pinfo->pool, "");
782
783 len = tvb_get_uint8(tvb, offset);
784 if (len == 254) {
785 int actual_len = 0;
786 len = 0;
Value stored to 'len' is never read
787 do { // walk over the chunks
788 len = tvb_get_uint8(tvb, offset + ret);
789 ret++; // 1st byte with the chunk size
790 wmem_strbuf_append(strbuf, (const char *)tvb_get_string_enc(pinfo->pool, tvb, offset + ret, len, ENC_ASCII0x00000000|ENC_NA0x00000000));
791 ret += len; // length of the string's chunk
792 actual_len += len;
793 } while (len == 64);
794 ret++; // has to be null-terminated
795 len = actual_len;
796 }
797 else {
798 ret += len;
799 wmem_strbuf_append(strbuf, (const char *)tvb_get_string_enc(pinfo->pool, tvb, offset + 1, len, ENC_ASCII0x00000000|ENC_NA0x00000000));
800 }
801
802 proto_tree_add_uint(tree, hf_tns_data_opi_param_length, tvb, offset, 1, len);
803 proto_tree_add_string(tree, hf_tns_data_opi_param_value, tvb, offset+1, ret-1, wmem_strbuf_get_str(strbuf));
804
805 return ret;
806}
807
808/* Decode an Oracle variable-length integer (ub4 / sb4):
809 * a length byte, then that many big-endian magnitude bytes. The low 7 bits
810 * of the length byte are the magnitude width (0..4); the high bit flags a
811 * negative value in sign-magnitude form (not two's complement) — so -1 is
812 * 0x81 0x01 and NUMBER scale -127 is 0x81 0x7f.
813 * Returns the number of bytes consumed. */
814static int get_sb4_custom(tvbuff_t *tvb, int offset, int *result)
815{
816 uint8_t first_byte = tvb_get_uint8(tvb, offset); // Contains length of a value
817 bool_Bool negative = (first_byte & 0x80) != 0;
818 uint8_t width = first_byte & 0x7f;
819 int magnitude = 0;
820
821 switch(width)
822 {
823 case 0:
824 magnitude = 0;
825 break;
826 case 1:
827 magnitude = tvb_get_uint8(tvb, offset+1);
828 break;
829 case 2:
830 magnitude = tvb_get_ntohs(tvb, offset+1);
831 break;
832 case 3:
833 magnitude = tvb_get_ntoh24(tvb, offset+1);
834 break;
835 case 4:
836 magnitude = tvb_get_ntohl(tvb, offset+1);
837 break;
838 default:
839 /* Width 5..0x7f is not a valid 1..4-byte integer. In practice
840 * only a raw ub2 counter read through this helper reaches here;
841 * the historic client behaviour is to consume two bytes and
842 * return the negated second byte, which keeps the stream
843 * aligned. The value is discarded by such callers. */
844 if ( tvb_reported_length_remaining(tvb, offset) < 2 )
845 {
846 /* Not even that second byte is present. The width came
847 * off the wire, so this is malformed input rather than
848 * a bug in the dissector - step over the width alone. */
849 *result = 0;
850 return 1;
851 }
852 *result = -(int)tvb_get_uint8(tvb, offset+1);
853 return 2;
854 }
855 *result = negative ? -magnitude : magnitude;
856 return width + 1;
857}
858
859/* Decode a DALC (Data-Length-And-Content) blob. The leading byte is a
860 * length only in the middle of its range:
861 *
862 * 0x00 empty
863 * 0x01..0xFC that many data bytes follow (252 is the longest)
864 * 0xFD absent value: the two-byte placeholder FD 01, no data
865 * 0xFE chunked: (len, bytes) pairs until a 0-length chunk
866 * 0xFF null - a marker only, no data follows
867 *
868 * The top three bytes are markers, not lengths. The null marker consumes
869 * just itself. The absent-value placeholder fills a bind slot that has no
870 * inline value - a pure OUT bind, or a NULL of a type with no inline form
871 * such as BOOLEAN - and consumes itself plus the 0x01 after it. Reading
872 * either as a length would claim bytes that are not there and misalign
873 * every field after it, so they have to be spelled out rather than left
874 * to the default.
875 *
876 * The chunk lengths in the 0xFE form are single bytes here, which is
877 * the 11g shape this dissector decodes throughout; 12.2 and later
878 * prefix each chunk with a variable-length ub4 instead. Telling the
879 * two apart needs the field version negotiated during the handshake,
880 * which is not threaded through yet.
881 *
882 * Returns the number of bytes consumed from the tvb and, when content
883 * is non-empty, a UTF-8 string allocated from pinfo->pool. */
884static int get_dalc_custom(tvbuff_t *tvb, packet_info *pinfo, int offset, const char **out_str)
885{
886 uint8_t first = tvb_get_uint8(tvb, offset);
887 if ( first == 0 || first == 255 )
888 {
889 if ( out_str )
890 *out_str = NULL((void*)0);
891 return 1;
892 }
893 if ( first == TNS_DALC_ABSENT0xFD )
894 {
895 if ( out_str )
896 *out_str = NULL((void*)0);
897 return 2;
898 }
899 if ( first != 254 )
900 {
901 if ( out_str )
902 *out_str = (const char *)tvb_get_string_enc(pinfo->pool, tvb, offset + 1, first, ENC_UTF_80x00000002|ENC_NA0x00000000);
903 return 1 + first;
904 }
905
906 /* Chunked form: walk (len, bytes)+ until a zero-length chunk. */
907 wmem_strbuf_t *strbuf = wmem_strbuf_new(pinfo->pool, "");
908 int o = offset + 1;
909 while ( tvb_reported_length_remaining(tvb, o) > 0 )
910 {
911 uint8_t chunk_len = tvb_get_uint8(tvb, o);
912 o += 1;
913 if ( chunk_len == 0 )
914 break;
915 wmem_strbuf_append(strbuf, (const char *)tvb_get_string_enc(pinfo->pool, tvb, o, chunk_len, ENC_UTF_80x00000002|ENC_NA0x00000000));
916 o += chunk_len;
917 }
918 if ( out_str )
919 *out_str = wmem_strbuf_get_str(strbuf);
920 return o - offset;
921}
922
923/* Decode a bytes_with_length / str_with_length field: a ub4 count, and
924 * a DALC carrying the value only when that count is non-zero. The count
925 * is not simply a byte to step over - an empty field is the count
926 * alone, so reading a DALC anyway consumes whatever follows it.
927 * Returns bytes consumed; *out_str (when non-NULL) gets the string, or
928 * NULL when the field is empty. */
929static int get_field_with_length(tvbuff_t *tvb, packet_info *pinfo, int offset, const char **out_str)
930{
931 int count = 0;
932 int used = get_sb4_custom(tvb, offset, &count);
933 if ( out_str )
934 *out_str = NULL((void*)0);
935 if ( count > 0 )
936 used += get_dalc_custom(tvb, pinfo, offset + used, out_str);
937 return used;
938}
939
940/* Render an Oracle NUMBER value as a decimal string.
941 * Base-100 float: byte 0 is the biased exponent (top bit = sign, inverted
942 * for negatives); the rest are base-100 mantissa groups, with a trailing
943 * 0x66 terminator on negatives.
944 * Returns a pinfo->pool string, or NULL if the value is not renderable. */
945static const char *tns_format_number(packet_info *pinfo, const uint8_t *data, int len)
946{
947 if ( len <= 0 )
948 return NULL((void*)0);
949 if ( len == 1 )
950 return (data[0] == 0x80) ? "0" : NULL((void*)0); /* 0x80 = zero; sentinels skipped */
951
952 uint8_t exp_byte = data[0];
953 bool_Bool is_pos = (exp_byte & 0x80) != 0;
954 int exponent = is_pos ? (exp_byte & 0x7f) - 65 : ((~exp_byte) & 0x7f) - 65;
955
956 int mant_len = len - 1;
957 if ( !is_pos && mant_len > 0 && data[len - 1] == 0x66 )
958 mant_len--; /* drop the negative terminator */
959
960 /* Build the base-100 digit string (two decimal digits per group). */
961 wmem_strbuf_t *digits = wmem_strbuf_new(pinfo->pool, "");
962 for ( int i = 0; i < mant_len; i++ )
963 {
964 int pair = is_pos ? (data[1 + i] - 1) : (101 - data[1 + i]);
965 if ( pair < 0 || pair > 99 )
966 return NULL((void*)0); /* malformed */
967 wmem_strbuf_append_printf(digits, "%02d", pair);
968 }
969 const char *ds = wmem_strbuf_get_str(digits);
970 int dlen = (int)wmem_strbuf_get_len(digits);
971 int int_digits = (exponent + 1) * 2;
972
973 wmem_strbuf_t *ip = wmem_strbuf_new(pinfo->pool, "");
974 wmem_strbuf_t *fp = wmem_strbuf_new(pinfo->pool, "");
975 if ( int_digits >= dlen )
976 {
977 wmem_strbuf_append(ip, ds);
978 for ( int i = 0; i < int_digits - dlen; i++ )
979 wmem_strbuf_append_c(ip, '0');
980 }
981 else if ( int_digits <= 0 )
982 {
983 wmem_strbuf_append_c(ip, '0');
984 for ( int i = 0; i < -int_digits; i++ )
985 wmem_strbuf_append_c(fp, '0');
986 wmem_strbuf_append(fp, ds);
987 }
988 else
989 {
990 wmem_strbuf_append(ip, wmem_strndup(pinfo->pool, ds, int_digits));
991 wmem_strbuf_append(fp, ds + int_digits);
992 }
993
994 /* Trim leading zeros on the integer part, trailing zeros on the fraction. */
995 const char *ips = wmem_strbuf_get_str(ip);
996 while ( ips[0] == '0' && ips[1] != '\0' )
997 ips++;
998 char *fps = wmem_strdup(pinfo->pool, wmem_strbuf_get_str(fp));
999 int flen = (int)strlen(fps);
1000 while ( flen > 0 && fps[flen - 1] == '0' )
1001 fps[--flen] = '\0';
1002
1003 const char *sign = is_pos ? "" : "-";
1004 if ( flen > 0 )
1005 return wmem_strdup_printf(pinfo->pool, "%s%s.%s", sign, ips, fps);
1006 return wmem_strdup_printf(pinfo->pool, "%s%s", sign, ips);
1007}
1008
1009/* Render an Oracle DATE / TIMESTAMP value as an
1010 * ISO-ish string. 7 bytes: century+100, year+100, month, day, hour+1,
1011 * minute+1, second+1; 11 bytes add 4-byte big-endian nanoseconds.
1012 * Returns a pinfo->pool string, or NULL. */
1013static const char *tns_format_date(packet_info *pinfo, const uint8_t *data, int len)
1014{
1015 if ( len < 7 )
1016 return NULL((void*)0);
1017 int year = (data[0] - 100) * 100 + (data[1] - 100);
1018 int month = data[2], day = data[3];
1019 int hour = data[4] - 1, minute = data[5] - 1, second = data[6] - 1;
1020 if ( month < 1 || month > 12 || day < 1 || day > 31 ||
1021 hour < 0 || hour > 23 || minute < 0 || minute > 59 || second < 0 || second > 59 )
1022 return NULL((void*)0);
1023 if ( len >= 11 )
1024 {
1025 uint32_t nsec = ((uint32_t)data[7] << 24) | ((uint32_t)data[8] << 16) |
1026 ((uint32_t)data[9] << 8) | data[10];
1027 if ( nsec > 0 )
1028 return wmem_strdup_printf(pinfo->pool, "%04d-%02d-%02d %02d:%02d:%02d.%09u",
1029 year, month, day, hour, minute, second, nsec);
1030 }
1031 return wmem_strdup_printf(pinfo->pool, "%04d-%02d-%02d %02d:%02d:%02d",
1032 year, month, day, hour, minute, second);
1033}
1034
1035/* Render an Oracle BINARY_FLOAT (4 bytes) / BINARY_DOUBLE (8 bytes) value
1036 * Stored in an order-preserving IEEE-754 form: if the
1037 * high bit is set the value was positive (clear it), else it was negative
1038 * (invert all bits); then read as big-endian IEEE-754. Returns a
1039 * pinfo->pool string, or NULL. */
1040static const char *tns_format_binary_float(packet_info *pinfo, const uint8_t *data, int len)
1041{
1042 char buf[G_ASCII_DTOSTR_BUF_SIZE(29 + 10)];
1043
1044 if ( len == 4 )
1045 {
1046 uint32_t u = ((uint32_t)data[0] << 24) | ((uint32_t)data[1] << 16) |
1047 ((uint32_t)data[2] << 8) | data[3];
1048 u = (u & 0x80000000u) ? (u & 0x7fffffffu) : ~u;
1049 float f;
1050 memcpy(&f, &u, 4);
1051 /* Locale-independent '.' decimal separator. */
1052 g_ascii_formatd(buf, sizeof(buf), "%g", (double)f);
1053 return wmem_strdup(pinfo->pool, buf);
1054 }
1055 if ( len == 8 )
1056 {
1057 uint64_t u = 0;
1058 for ( int i = 0; i < 8; i++ )
1059 u = (u << 8) | data[i];
1060 u = (u & UINT64_C(0x8000000000000000)0x8000000000000000UL) ? (u & UINT64_C(0x7fffffffffffffff)0x7fffffffffffffffUL) : ~u;
1061 double d;
1062 memcpy(&d, &u, 8);
1063 g_ascii_formatd(buf, sizeof(buf), "%g", d);
1064 return wmem_strdup(pinfo->pool, buf);
1065 }
1066 return NULL((void*)0);
1067}
1068
1069static void vsnum_to_vstext_basecustom(char *result, uint32_t vsnum)
1070{
1071 /*
1072 * Translate hex value to human readable version value, described at
1073 * http://docs.oracle.com/cd/B28359_01/server.111/b28310/dba004.htm
1074 */
1075 snprintf(result, ITEM_LABEL_LENGTH240, "%d.%d.%d.%d.%d",
1076 vsnum >> 24,
1077 (vsnum >> 20) & 0xf,
1078 (vsnum >> 12) & 0xf,
1079 (vsnum >> 8) & 0xf,
1080 vsnum & 0xff);
1081}
1082
1083/* End-of-call status flags, carried by both TTI_OER and TTI_STA. */
1084#define TNS_CALL_STATUS_TXN_IN_PROGRESS0x00000002 0x00000002
1085#define TNS_CALL_STATUS_SESS_RELEASE0x00008000 0x00008000
1086
1087/* Break out the flag bits of a call status item. A client reads the
1088 * transaction bit to decide whether closing or releasing the connection
1089 * owes a rollback. */
1090static void tns_add_call_status_flags(proto_item *ti, tvbuff_t *tvb, int start, int len, uint32_t status)
1091{
1092 proto_tree *st = proto_item_add_subtree(ti, ett_tns_call_status);
1093 proto_tree_add_boolean(st, hf_tns_data_call_status_txn, tvb, start, len, status);
1094 proto_tree_add_boolean(st, hf_tns_data_call_status_sess_release, tvb, start, len, status);
1095}
1096
1097/* Decode an OAC (Oracle Access Column) descriptor — the type/format core
1098 * shared by describe columns and bind descriptors. Fields
1099 * use the Oracle variable-length form (get_sb4_custom).
1100 * When col is not NULL it receives the type and data length.
1101 * Returns the new offset. */
1102static int dissect_tns_oac(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, tns_column_t *col)
1103{
1104 int v = 0, start;
1105
1106 if ( col )
1107 col->type = tvb_get_uint8(tvb, offset);
1108 /* type (ub1) */
1109 proto_tree_add_item(tree, hf_tns_data_col_type, tvb, offset, 1, ENC_BIG_ENDIAN0x00000000);
1110 offset += 1;
1111 /* flag (ub1, skip) */
1112 offset += 1;
1113 /* precision (sb1) */
1114 proto_tree_add_item(tree, hf_tns_data_col_precision, tvb, offset, 1, ENC_BIG_ENDIAN0x00000000);
1115 offset += 1;
1116 /* scale (ub4, may be negative — NUMBER default is -127) */
1117 start = offset;
1118 offset += get_sb4_custom(tvb, offset, &v);
1119 proto_tree_add_int(tree, hf_tns_data_col_scale, tvb, start, offset - start, v);
1120 /* max data length / buffer size (ub4) */
1121 start = offset;
1122 offset += get_sb4_custom(tvb, offset, &v);
1123 proto_tree_add_uint(tree, hf_tns_data_col_max_length, tvb, start, offset - start, v);
1124 if ( col )
1125 col->data_len = (uint32_t)v;
1126 /* max array elements (ub4, skip) */
1127 offset += get_sb4_custom(tvb, offset, &v);
1128 /* cont flags (ub4, skip) */
1129 offset += get_sb4_custom(tvb, offset, &v);
1130 /* type OID (bytes_with_length, skip) */
1131 offset += get_field_with_length(tvb, pinfo, offset, NULL((void*)0));
1132 /* version (ub4, skip) */
1133 offset += get_sb4_custom(tvb, offset, &v);
1134 /* charset id (ub4) */
1135 start = offset;
1136 offset += get_sb4_custom(tvb, offset, &v);
1137 proto_tree_add_uint(tree, hf_tns_data_col_charset, tvb, start, offset - start, v);
1138 /* charset form (ub1) */
1139 proto_tree_add_item(tree, hf_tns_data_col_csform, tvb, offset, 1, ENC_BIG_ENDIAN0x00000000);
1140 offset += 1;
1141 /* max size (ub4) */
1142 start = offset;
1143 offset += get_sb4_custom(tvb, offset, &v);
1144 proto_tree_add_uint(tree, hf_tns_data_col_max_size, tvb, start, offset - start, v);
1145
1146 return offset;
1147}
1148
1149/* Decode one per-column metadata block of a TTI_DCB describe (11g
1150 * shape): an OAC descriptor plus the nullability and naming fields.
1151 * When col is not NULL it receives what a row decoder needs.
1152 * Returns the new offset. */
1153static int dissect_tns_dcb_column(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, int idx, tns_column_t *col)
1154{
1155 proto_tree *col_tree;
1156 proto_item *col_item;
1157 int col_start = offset, v = 0;
1158 uint8_t col_type = tvb_get_uint8(tvb, offset);
1159 const char *name = NULL((void*)0);
1160
1161 col_tree = proto_tree_add_subtree_format(tree, tvb, offset, -1,
1162 ett_tns_dcb_col, &col_item, "Column %d", idx);
1163
1164 offset = dissect_tns_oac(tvb, pinfo, col_tree, offset, col);
1165
1166 /* nulls allowed (ub1) */
1167 proto_tree_add_item(col_tree, hf_tns_data_col_nulls_ok, tvb, offset, 1, ENC_BIG_ENDIAN0x00000000);
1168 offset += 1;
1169 /* v7 name length (ub1, skip) */
1170 offset += 1;
1171 /* column name (str_with_length) */
1172 int name_start = offset;
1173 offset += get_field_with_length(tvb, pinfo, offset, &name);
1174 if ( name )
1175 proto_tree_add_string(col_tree, hf_tns_data_col_name, tvb, name_start, offset - name_start, name);
1176 /* schema name, type name (str_with_length, skip) */
1177 offset += get_field_with_length(tvb, pinfo, offset, NULL((void*)0));
1178 offset += get_field_with_length(tvb, pinfo, offset, NULL((void*)0));
1179 /* column position (ub4, skip) */
1180 offset += get_sb4_custom(tvb, offset, &v);
1181 /* uds flags (ub4, skip) — 11g addition */
1182 offset += get_sb4_custom(tvb, offset, &v);
1183
1184 if ( name )
1185 proto_item_append_text(col_item, ": %s (%s)", name,
1186 val_to_str_const(col_type, tns_data_types, "unknown"));
1187 proto_item_set_len(col_item, offset - col_start);
1188 return offset;
1189}
1190
1191/* Decode one row/bind value by its data type, and add it as a
1192 * "<prefix> N (TYPE)" item under `hf`. Ordinary values are a
1193 * DALC blob; ROWID / UROWID / LONG / LOB carry their own framings.
1194 * Object / JSON / VECTOR values have richer image
1195 * framings not handled here, so on those the caller stops (sets *bail) and
1196 * leaves the remainder to the data dissector. Returns the new offset. */
1197static int dissect_tns_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, uint8_t dtype, int idx, int *bail, int hf, const char *prefix)
1198{
1199 int v_start = offset, disp_start = offset, v = 0;
1200 int is_null = 0, is_absent = 0;
1201 uint8_t first;
1202 const char *rendered = NULL((void*)0);
1203
1204 switch ( dtype )
1205 {
1206 case TNS_DATATYPE_ADT109: /* object */
1207 case TNS_DATATYPE_JSON119: /* OSON */
1208 case TNS_DATATYPE_VECTOR127:
1209 *bail = 1;
1210 return offset;
1211
1212 case TNS_DATATYPE_ROWID11: /* indicator, then obj/file/unused/block/slot (ub4) */
1213 first = tvb_get_uint8(tvb, offset);
1214 offset += 1;
1215 if ( first == 0 || first == 0xff )
1216 is_null = 1;
1217 else
1218 for ( int k = 0; k < 5; k++ )
1219 offset += get_sb4_custom(tvb, offset, &v);
1220 break;
1221
1222 case TNS_DATATYPE_UROWID208: /* ub4 num_bytes, a length echo byte, then the bytes */
1223 offset += get_sb4_custom(tvb, offset, &v);
1224 if ( v > 0 )
1225 offset += 1 + v;
1226 else
1227 is_null = 1;
1228 break;
1229
1230 case TNS_DATATYPE_LONG8:
1231 case TNS_DATATYPE_LONG_RAW24: /* value then two trailing ub4 length indicators */
1232 first = tvb_get_uint8(tvb, offset);
1233 if ( first == 0 )
1234 {
1235 offset += 1;
1236 is_null = 1;
1237 }
1238 else if ( first == 0xfe ) /* chunked: ub1 len chunks until 0 (11g) */
1239 {
1240 offset += 1;
1241 while ( tvb_reported_length_remaining(tvb, offset) > 0 )
1242 {
1243 uint8_t chunk_len = tvb_get_uint8(tvb, offset);
1244 offset += 1;
1245 if ( chunk_len == 0 )
1246 break;
1247 offset += chunk_len;
1248 }
1249 }
1250 else
1251 offset += 1 + first;
1252 offset += get_sb4_custom(tvb, offset, &v);
1253 offset += get_sb4_custom(tvb, offset, &v);
1254 break;
1255
1256 case TNS_DATATYPE_CLOB112:
1257 case TNS_DATATYPE_BLOB113:
1258 case TNS_DATATYPE_BFILE114: /* 0x00 NULL, else ub4 num_bytes + DALC locator block */
1259 first = tvb_get_uint8(tvb, offset);
1260 if ( first == 0 )
1261 {
1262 offset += 1;
1263 is_null = 1;
1264 }
1265 else
1266 {
1267 offset += get_sb4_custom(tvb, offset, &v);
1268 offset += get_dalc_custom(tvb, pinfo, offset, NULL((void*)0));
1269 }
1270 break;
1271
1272 default: /* ordinary: a single DALC value */
1273 first = tvb_get_uint8(tvb, offset);
1274 offset += get_dalc_custom(tvb, pinfo, offset, NULL((void*)0));
1275 if ( first == 0 )
1276 is_null = 1;
1277 else if ( first == TNS_DALC_ABSENT0xFD )
1278 is_absent = 1;
1279 else
1280 {
1281 disp_start = v_start + 1; /* show the value bytes, not the length */
1282 /* Render common scalar types (never chunked): NUMBER as
1283 * decimal, DATE / TIMESTAMP / TIMESTAMP LTZ as a datetime. */
1284 if ( first != 254 && offset > disp_start )
1285 {
1286 const uint8_t *vb = tvb_get_ptr(tvb, disp_start, offset - disp_start);
1287 int vlen = offset - disp_start;
1288 if ( dtype == TNS_DATATYPE_NUMBER2 )
1289 rendered = tns_format_number(pinfo, vb, vlen);
1290 else if ( dtype == TNS_DATATYPE_DATE12 || dtype == TNS_DATATYPE_TIMESTAMP180 || dtype == TNS_DATATYPE_TIMESTAMP_LTZ231 )
1291 rendered = tns_format_date(pinfo, vb, vlen);
1292 else if ( dtype == TNS_DATATYPE_BINARY_FLOAT100 || dtype == TNS_DATATYPE_BINARY_DOUBLE101 )
1293 rendered = tns_format_binary_float(pinfo, vb, vlen);
1294 else if ( dtype == TNS_DATATYPE_VARCHAR1 || dtype == TNS_DATATYPE_STRING5 || dtype == TNS_DATATYPE_CHAR96 )
1295 /* VARCHAR / STRING / CHAR: character data (session
1296 * charset, ordinarily UTF-8). */
1297 rendered = (const char *)tvb_get_string_enc(pinfo->pool,
1298 tvb, disp_start, vlen, ENC_UTF_80x00000002|ENC_NA0x00000000);
1299 }
1300 }
1301 break;
1302 }
1303
1304 if ( is_null )
1305 proto_tree_add_bytes_format(tree, hf, tvb,
1306 v_start, offset - v_start, NULL((void*)0), "%s %d (%s): NULL", prefix, idx,
1307 val_to_str_const(dtype, tns_data_types, "unknown"));
1308 else if ( is_absent )
1309 proto_tree_add_bytes_format(tree, hf, tvb,
1310 v_start, offset - v_start, NULL((void*)0), "%s %d (%s): no value", prefix, idx,
1311 val_to_str_const(dtype, tns_data_types, "unknown"));
1312 else if ( rendered )
1313 proto_tree_add_bytes_format(tree, hf, tvb,
1314 disp_start, offset - disp_start, NULL((void*)0), "%s %d (%s): %s", prefix, idx,
1315 val_to_str_const(dtype, tns_data_types, "unknown"), rendered);
1316 else
1317 proto_tree_add_bytes_format(tree, hf, tvb,
1318 disp_start, offset - disp_start, NULL((void*)0), "%s %d (%s)", prefix, idx,
1319 val_to_str_const(dtype, tns_data_types, "unknown"));
1320 return offset;
1321}
1322
1323static void dissect_tns_data_descriptor(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tns_tree, uint32_t length)
1324{
1325 /* This is used by Oracle 12c for at least sending LOB/FILE data. */
1326 proto_tree *dd_tree, *row_tree;
1327 proto_item *ti;
1328 uint32_t data_len, row_count, row_size, total_row_size = 0;
1329 int orig_offset = offset;
1330
1331 /* We only get here after tcp_dissect_pdus(), length is guaranteed. */
1332 DISSECTOR_ASSERT_CMPINT(length, >=, TNS_HDR_LEN)((void) ((length >= 8) ? (void)0 : (proto_report_dissector_bug
("%s:%u: failed assertion " "length" " " ">=" " " "8" " ("
"%" "l" "d" " " ">=" " " "%" "l" "d" ")", "epan/dissectors/packet-tns.c"
, 1332, (int64_t)length, (int64_t)8))))
;
1333
1334 dd_tree = proto_tree_add_subtree(tns_tree, tvb, offset, -1, ett_tns_data, NULL((void*)0), "Data Descriptor");
1335
1336 /* No idea what this is. Usually 0x0003. */
1337 offset += 4;
1338 proto_tree_add_item_ret_uint(dd_tree, hf_tns_data_length, tvb,
1339 offset, 4, ENC_BIG_ENDIAN0x00000000, &data_len);
1340 offset += 4;
1341
1342 /* This next parameter looks like: number of big endian shorts that follow,
1343 * the sum of the shorts equals the file length above - each short maxes
1344 * out at 0x1f7c = 8060, presumably related to the page size / max table
1345 * row size in Microsoft SQL Server? Something about how many rows it
1346 * would take to store this in-table?
1347 */
1348 proto_tree_add_item_ret_uint(dd_tree, hf_tns_data_descriptor_row_count, tvb,
1349 offset, 4, ENC_BIG_ENDIAN0x00000000, &row_count);
1350 offset += 4;
1351 row_tree = proto_tree_add_subtree(dd_tree, tvb, offset, row_count * 2,
1352 ett_tns_rows, &ti, "Rows");
1353 for (uint32_t i = 0; i < row_count; i++) {
1354 proto_tree_add_item_ret_uint(row_tree, hf_tns_data_descriptor_row_size, tvb,
1355 offset, 2, ENC_BIG_ENDIAN0x00000000, &row_size);
1356 total_row_size += row_size;
1357 offset += 2;
1358 }
1359 proto_item_append_text(ti, " (%u bytes)", total_row_size);
1360 if (total_row_size != data_len) {
1361 expert_add_info(pinfo, ti, &ei_tns_data_descriptor_size_mismatch);
1362 }
1363
1364 offset = orig_offset + (length - TNS_HDR_LEN8);
1365
1366 call_data_dissector(tvb_new_subset_length(tvb, offset, data_len), pinfo,
1367 dd_tree);
1368}
1369
1370static int dissect_tns_message(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *data_tree, bool_Bool is_request, unsigned data_func_id, bool_Bool *walk);
1371
1372/* Whether a message that follows another in the same packet is one we
1373 * step into. A response is a run of messages back to back - a describe,
1374 * a row header, the rows, a status - and a request may put piggybacks in
1375 * front of its call. */
1376static bool_Bool tns_is_next_message(unsigned data_func_id, bool_Bool is_request)
1377{
1378 if ( is_request )
1379 return data_func_id == SQLNET_USER_OCI_FUNC3 || data_func_id == SQLNET_PIGGYBACK_FUNC17;
1380
1381 switch ( data_func_id )
1382 {
1383 case SQLNET_RETURN_STATUS4:
1384 case SQLNET_FUNCCOMPLETE9:
1385 case SQLNET_END_OF_RESPONSE29:
1386 case SQLNET_ROW_TRANSF_HDR6:
1387 case SQLNET_ROW_TRANSF_DATA7:
1388 case SQLNET_RETURN_OPI_PARAM8:
1389 case SQLNET_IOVEC_4FAST_UPI11:
1390 case SQLNET_DESCRIBE_INFO16:
1391 return true1;
1392 default:
1393 return false0;
1394 }
1395}
1396
1397static void dissect_tns_data(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tns_tree)
1398{
1399 proto_tree *data_tree;
1400 unsigned data_func_id;
1401 bool_Bool is_request;
1402 static int * const flags[] = {
1403 &hf_tns_data_flag_send,
1404 &hf_tns_data_flag_rc,
1405 &hf_tns_data_flag_c,
1406 &hf_tns_data_flag_reserved,
1407 &hf_tns_data_flag_more,
1408 &hf_tns_data_flag_eof,
1409 &hf_tns_data_flag_dic,
1410 &hf_tns_data_flag_rts,
1411 &hf_tns_data_flag_sntt,
1412 NULL((void*)0)
1413 };
1414
1415 is_request = pinfo->match_uint == pinfo->destport;
1416 data_tree = proto_tree_add_subtree(tns_tree, tvb, offset, -1, ett_tns_data, NULL((void*)0), "Data");
1417
1418 proto_tree_add_bitmask(data_tree, tvb, offset, hf_tns_data_flag, ett_tns_data_flag, flags, ENC_BIG_ENDIAN0x00000000);
1419 offset += 2;
1420 data_func_id = get_data_func_id(tvb, offset);
1421
1422 /* Do this only if the Data message have a body. Otherwise, there are only Data flags. */
1423 int remaining = tvb_reported_length_remaining(tvb, offset);
1424 if ( remaining > 0 )
1425 {
1426 if (is_request) {
1427 if (!PINFO_FD_VISITED(pinfo)((pinfo)->fd->visited)) {
1428 tns_conv_info_t *tns_info = tns_get_conv_info(pinfo);
1429 if ((uint32_t)remaining == tns_info->pending_connect_data) {
1430 col_append_str(pinfo->cinfo, COL_INFO, ", Connect Data");
1431 proto_tree_add_item(data_tree, hf_tns_connect_data, tvb,
1432 offset, -1, ENC_ASCII0x00000000);
1433 p_add_proto_data(wmem_file_scope(), pinfo, proto_tns, 0,
1434 GUINT_TO_POINTER(tns_info->pending_connect_data)((gpointer) (gulong) (tns_info->pending_connect_data)));
1435 tns_info->pending_connect_data = 0;
1436 return;
1437 }
1438 } else {
1439 if (p_get_proto_data(wmem_file_scope(), pinfo, proto_tns, 0) != NULL((void*)0)) {
1440 col_append_str(pinfo->cinfo, COL_INFO, ", Connect Data");
1441 proto_tree_add_item(data_tree, hf_tns_connect_data, tvb,
1442 offset, -1, ENC_ASCII0x00000000);
1443 return;
1444 }
1445 }
1446 }
1447 col_append_fstr(pinfo->cinfo, COL_INFO, ", %s", val_to_str_const(data_func_id, tns_data_funcs, "unknown"));
1448
1449 if ( (data_func_id != SQLNET_SNS0xdeadbeef) && (try_val_to_str(data_func_id, tns_data_funcs) != NULL((void*)0)) )
1450 {
1451 proto_tree_add_item(data_tree, hf_tns_data_id, tvb, offset, 1, ENC_BIG_ENDIAN0x00000000);
1452 offset += 1;
1453 }
1454 }
1455
1456 /* Decode the first message, then step into each one after it for as
1457 * long as the previous decoder ended exactly on its last byte. */
1458 bool_Bool walk = false0;
1459 offset = dissect_tns_message(tvb, offset, pinfo, data_tree, is_request, data_func_id, &walk);
1460 while ( walk && tvb_reported_length_remaining(tvb, offset) > 0 )
1461 {
1462 data_func_id = tvb_get_uint8(tvb, offset);
1463 if ( !tns_is_next_message(data_func_id, is_request) )
1464 break;
1465 col_append_fstr(pinfo->cinfo, COL_INFO, ", %s", val_to_str_const(data_func_id, tns_data_funcs, "unknown"));
1466 proto_tree_add_item(data_tree, hf_tns_data_id, tvb, offset, 1, ENC_BIG_ENDIAN0x00000000);
1467 offset += 1;
1468 walk = false0;
1469 offset = dissect_tns_message(tvb, offset, pinfo, data_tree, is_request, data_func_id, &walk);
1470 }
1471
1472 if ( tvb_reported_length_remaining(tvb, offset) > 0 )
1473 call_data_dissector(tvb_new_subset_remaining(tvb, offset), pinfo, data_tree);
1474}
1475
1476/* Decode the body of one TTC message, whose id byte has already been
1477 * consumed. Sets *walk when the decoder ended exactly on the message's
1478 * last byte, so the caller can step into whatever follows it.
1479 * Returns the new offset. */
1480static int dissect_tns_message(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *data_tree, bool_Bool is_request, unsigned data_func_id, bool_Bool *walk)
1481{
1482 /* Handle data functions that have more than just ID */
1483 switch (data_func_id)
1484 {
1485 case SQLNET_SET_PROTOCOL1:
1486 {
1487 proto_tree *versions_tree;
1488 proto_item *ti;
1489 char sep;
1490 if ( is_request )
1491 {
1492 versions_tree = proto_tree_add_subtree(data_tree, tvb, offset, -1, ett_tns_acc_versions, &ti, "Accepted Versions");
1493 sep = ':';
1494 for (;;) {
1495 /*
1496 * Add each accepted version as a
1497 * separate item.
1498 */
1499 uint8_t vers;
1500
1501 vers = tvb_get_uint8(tvb, offset);
1502 if (vers == 0) {
1503 /*
1504 * A version of 0 terminates
1505 * the list.
1506 */
1507 break;
1508 }
1509 proto_item_append_text(ti, "%c %u", sep, vers);
1510 sep = ',';
1511 proto_tree_add_uint(versions_tree, hf_tns_data_setp_acc_version, tvb, offset, 1, vers);
1512 offset += 1;
1513 }
1514 offset += 1; /* skip the 0 terminator */
1515 proto_item_set_end(ti, tvb, offset);
1516 proto_tree_add_item(data_tree, hf_tns_data_setp_cli_plat, tvb, offset, -1, ENC_ASCII0x00000000);
1517
1518 return tvb_reported_length(tvb); /* skip call_data_dissector */
1519 }
1520 else
1521 {
1522 unsigned len;
1523 versions_tree = proto_tree_add_subtree(data_tree, tvb, offset, -1, ett_tns_acc_versions, &ti, "Versions");
1524 sep = ':';
1525 for (;;) {
1526 /*
1527 * Add each version as a separate item.
1528 */
1529 uint8_t vers;
1530
1531 vers = tvb_get_uint8(tvb, offset);
1532 if (vers == 0) {
1533 /*
1534 * A version of 0 terminates
1535 * the list.
1536 */
1537 break;
1538 }
1539 proto_item_append_text(ti, "%c %u", sep, vers);
1540 sep = ',';
1541 proto_tree_add_uint(versions_tree, hf_tns_data_setp_version, tvb, offset, 1, vers);
1542 offset += 1;
1543 }
1544 offset += 1; /* skip the 0 terminator */
1545 proto_item_set_end(ti, tvb, offset);
1546 proto_tree_add_item_ret_length(data_tree, hf_tns_data_setp_banner, tvb, offset, -1, ENC_ASCII0x00000000|ENC_NA0x00000000, &len);
1547 offset += len;
1548 }
1549 break;
1550 }
1551
1552 case SQLNET_SET_DATATYPES2:
1553 {
1554 /* TTI_DTY: Data Type Negotiation, sent right after TTI_PRO
1555 * during the TTC handshake. The body is a fixed-shape blob
1556 * the client uses to tell the server which native Oracle
1557 * data types it understands and what wire representation it
1558 * wants for each. Layout cross-referenced with
1559 * python-oracledb.
1560 *
1561 * charset_in 2 bytes LE NLS_LANGUAGE charset id
1562 * charset_out 2 bytes LE NLS_NCHAR charset id
1563 * flag 1 byte capability flag (1 = std)
1564 * capability header 39 bytes version triple + flag bytes
1565 * table header 8 bytes group/sub counts
1566 * identity map 980 bytes 245 x (type, type, 1, 0)
1567 * type overrides var entries, terminated by 0
1568 */
1569 proto_tree *caphdr_tree, *ov_tree;
1570 proto_item *caphdr_item, *ov_item;
1571
1572 if ( !is_request )
1573 break;
1574
1575 proto_tree_add_item(data_tree, hf_tns_data_setdt_charset_in, tvb, offset, 2, ENC_LITTLE_ENDIAN0x80000000);
1576 offset += 2;
1577 proto_tree_add_item(data_tree, hf_tns_data_setdt_charset_out, tvb, offset, 2, ENC_LITTLE_ENDIAN0x80000000);
1578 offset += 2;
1579 proto_tree_add_item(data_tree, hf_tns_data_setdt_flag, tvb, offset, 1, ENC_BIG_ENDIAN0x00000000);
1580 offset += 1;
1581
1582 caphdr_item = proto_tree_add_item(data_tree, hf_tns_data_setdt_caphdr, tvb, offset, 39, ENC_NA0x00000000);
1583 caphdr_tree = proto_item_add_subtree(caphdr_item, ett_tns_setdt_caphdr);
1584 proto_tree_add_item(caphdr_tree, hf_tns_data_setdt_caphdr_version, tvb, offset, 3, ENC_BIG_ENDIAN0x00000000);
1585 proto_tree_add_item(caphdr_tree, hf_tns_data_setdt_caphdr_flags, tvb, offset + 3, 36, ENC_NA0x00000000);
1586 offset += 39;
1587
1588 proto_tree_add_item(data_tree, hf_tns_data_setdt_tblhdr, tvb, offset, 8, ENC_NA0x00000000);
1589 offset += 8;
1590 proto_tree_add_item(data_tree, hf_tns_data_setdt_idmap, tvb, offset, 980, ENC_NA0x00000000);
1591 offset += 980;
1592
1593 /* Walk type-override entries until the 0 terminator. Each
1594 * entry is (client_type, server_repr[, format]); a 0 in the
1595 * server_repr slot marks a short "client knows the id but
1596 * has no override" entry. */
1597 ov_item = proto_tree_add_item(data_tree, hf_tns_data_setdt_overrides, tvb, offset, -1, ENC_NA0x00000000);
1598 ov_tree = proto_item_add_subtree(ov_item, ett_tns_setdt_overrides);
1599 int ov_start = offset;
1600 while ( tvb_reported_length_remaining(tvb, offset) > 0 )
1601 {
1602 uint8_t client_type = tvb_get_uint8(tvb, offset);
1603 if ( client_type == 0 )
1604 {
1605 proto_tree_add_item(ov_tree, hf_tns_data_setdt_override_client, tvb, offset, 1, ENC_BIG_ENDIAN0x00000000);
1606 offset += 1;
1607 break;
1608 }
1609 uint8_t repr = tvb_get_uint8(tvb, offset + 1);
1610 int entry_len = (repr == 0) ? 2 : 4;
1611 proto_tree *e_tree = proto_tree_add_subtree_format(ov_tree, tvb, offset, entry_len,
1612 ett_tns_setdt_override, NULL((void*)0), "Type %u (%s)",
1613 client_type, val_to_str_const(client_type, tns_data_types, "unknown"));
1614 proto_tree_add_item(e_tree, hf_tns_data_setdt_override_client, tvb, offset, 1, ENC_BIG_ENDIAN0x00000000);
1615 if ( entry_len == 4 )
1616 {
1617 proto_tree_add_item(e_tree, hf_tns_data_setdt_override_repr, tvb, offset + 1, 1, ENC_BIG_ENDIAN0x00000000);
1618 proto_tree_add_item(e_tree, hf_tns_data_setdt_override_format, tvb, offset + 2, 1, ENC_BIG_ENDIAN0x00000000);
1619 }
1620 offset += entry_len;
1621 }
1622 proto_item_set_len(ov_item, offset - ov_start);
1623 break;
1624 }
1625
1626 case SQLNET_RETURN_STATUS4:
1627 {
1628 /* TTI_OER: server-side end-of-call status block. Emitted at
1629 * the end of every response — success or failure. Layout
1630 * cross-referenced with python-oracledb's
1631 * _process_error_info, in the Oracle 11g shape (no extended
1632 * ub4 error number / ub8 rowcount that 12c+ adds).
1633 *
1634 * All multi-byte integers are stored in the ub4 variable-
1635 * length form (see get_sb4_custom): first byte holds the
1636 * value's width (0..4), followed by that many big-endian
1637 * data bytes. */
1638 proto_tree *oer_tree;
1639 proto_item *oer_item;
1640 int oer_start = offset;
1641 int v;
1642
1643 oer_tree = proto_tree_add_subtree(data_tree, tvb, offset, -1, ett_tns_oer, &oer_item, "Oracle Error Return");
1644
1645 /* call_status */
1646 offset += get_sb4_custom(tvb, offset, &v);
1647 tns_add_call_status_flags(
1648 proto_tree_add_int(oer_tree, hf_tns_data_oer_call_status, tvb, oer_start, offset - oer_start, v),
1649 tvb, oer_start, offset - oer_start, (uint32_t)v);
1650 /* end-to-end seq# (skipped) */
1651 offset += get_sb4_custom(tvb, offset, &v);
1652 /* rowcount (DML affected rows on 11g) */
1653 int rc_start = offset;
1654 offset += get_sb4_custom(tvb, offset, &v);
1655 proto_tree_add_int(oer_tree, hf_tns_data_oer_rowcount, tvb, rc_start, offset - rc_start, v);
1656 /* err_code (ORA-NNNNN, 0 on success) */
1657 int ec_start = offset;
1658 int err_code = 0;
1659 offset += get_sb4_custom(tvb, offset, &err_code);
1660 proto_tree_add_int(oer_tree, hf_tns_data_oer_err_code, tvb, ec_start, offset - ec_start, err_code);
1661 /* array elem error #1, #2 (skipped) */
1662 offset += get_sb4_custom(tvb, offset, &v);
1663 offset += get_sb4_custom(tvb, offset, &v);
1664 /* cursor_id */
1665 int ci_start = offset;
1666 offset += get_sb4_custom(tvb, offset, &v);
1667 proto_tree_add_int(oer_tree, hf_tns_data_oer_cursor_id, tvb, ci_start, offset - ci_start, v);
1668 /* error position (skipped) */
1669 offset += get_sb4_custom(tvb, offset, &v);
1670 /* 6 single-byte fields: sql_type, fatal, flags, user_cursor_opts, upi_param, warn_flags */
1671 offset += 6;
1672 /* rowid: ub4 rba, ub2 part_id, 1 byte reserved, ub4 block, ub2 slot */
1673 offset += get_sb4_custom(tvb, offset, &v);
1674 offset += get_sb4_custom(tvb, offset, &v);
1675 offset += 1;
1676 offset += get_sb4_custom(tvb, offset, &v);
1677 offset += get_sb4_custom(tvb, offset, &v);
1678 /* os error (skipped) */
1679 offset += get_sb4_custom(tvb, offset, &v);
1680 /* statement #, call # (1 byte each) */
1681 offset += 2;
1682 /* padding ub2 + successful iterations ub4 */
1683 offset += get_sb4_custom(tvb, offset, &v);
1684 offset += get_sb4_custom(tvb, offset, &v);
1685 /* oerrdd (logical rowid), a bytes_with_length — skipped */
1686 offset += get_field_with_length(tvb, pinfo, offset, NULL((void*)0));
1687
1688 /* Batch error arrays (array DML). The code and offset arrays
1689 * are each a ub4 count followed by one DALC packing that many
1690 * ub4 values back to back; the message array is a ub4 count,
1691 * an indicator byte, and then that many str_with_length
1692 * entries each with a 2-byte trailer. All three counts are
1693 * zero for an ordinary statement. */
1694 int n_codes = 0, n_offs = 0, n_msgs = 0;
1695 int nb_start = offset;
1696 offset += get_sb4_custom(tvb, offset, &n_codes);
1697 proto_tree_add_int(oer_tree, hf_tns_data_oer_n_batch_errcodes, tvb, nb_start, offset - nb_start, n_codes);
1698 if ( n_codes > 0 )
1699 offset += get_dalc_custom(tvb, pinfo, offset, NULL((void*)0));
1700 nb_start = offset;
1701 offset += get_sb4_custom(tvb, offset, &n_offs);
1702 proto_tree_add_int(oer_tree, hf_tns_data_oer_n_batch_offsets, tvb, nb_start, offset - nb_start, n_offs);
1703 if ( n_offs > 0 )
1704 offset += get_dalc_custom(tvb, pinfo, offset, NULL((void*)0));
1705 nb_start = offset;
1706 offset += get_sb4_custom(tvb, offset, &n_msgs);
1707 proto_tree_add_int(oer_tree, hf_tns_data_oer_n_batch_messages, tvb, nb_start, offset - nb_start, n_msgs);
1708 if ( n_msgs > 0 )
1709 {
1710 offset += 1;
1711 for ( int i = 0; i < n_msgs; i++ )
1712 {
1713 offset += get_field_with_length(tvb, pinfo, offset, NULL((void*)0));
1714 offset += 2;
1715 }
1716 }
1717
1718 /* Trailing message DALC — present (and meaningful) only when
1719 * err_code is non-zero. */
1720 if ( err_code != 0 && tvb_reported_length_remaining(tvb, offset) > 0 )
1721 {
1722 const char *msg = NULL((void*)0);
1723 int msg_start = offset;
1724 offset += get_dalc_custom(tvb, pinfo, offset, &msg);
1725 if ( msg )
1726 {
1727 proto_tree_add_string(oer_tree, hf_tns_data_oer_message, tvb, msg_start, offset - msg_start, msg);
1728 col_append_fstr(pinfo->cinfo, COL_INFO, " [%s]", msg);
1729 }
1730 }
1731 proto_item_set_len(oer_item, offset - oer_start);
1732 break;
1733 }
1734
1735 case SQLNET_FUNCCOMPLETE9:
1736 {
1737 /* TTI_STA: a bare status, with no error block. It answers a
1738 * commit, a rollback or a logoff: a ub4 call status and the
1739 * ub2 end-to-end sequence number. */
1740 int v = 0, start;
1741
1742 if ( is_request )
1743 break;
1744
1745 start = offset;
1746 offset += get_sb4_custom(tvb, offset, &v);
1747 tns_add_call_status_flags(
1748 proto_tree_add_uint(data_tree, hf_tns_data_sta_call_status, tvb, start, offset - start, v),
1749 tvb, start, offset - start, (uint32_t)v);
1750 start = offset;
1751 offset += get_sb4_custom(tvb, offset, &v);
1752 proto_tree_add_uint(data_tree, hf_tns_data_sta_seq, tvb, start, offset - start, v);
1753 *walk = true1;
1754 break;
1755 }
1756
1757 case SQLNET_END_OF_RESPONSE29:
1758 /* Marks the end of a response for a client that negotiated
1759 * it; there is no body. */
1760 *walk = true1;
1761 break;
1762
1763 case SQLNET_IOVEC_4FAST_UPI11:
1764 {
1765 /* TTI_IOV: the server's I/O vector for an executed anonymous
1766 * PL/SQL block that carried bind variables. It lists each
1767 * bind's direction (IN / OUT / IN OUT); when any bind is
1768 * OUT / IN OUT the returned values follow as a TTI_RXD row.
1769 * Layout cross-referenced with python-oracledb's
1770 * _process_io_vector, and
1771 * verified against XE 11g.
1772 *
1773 * All the leading counters are stored in the ub4 variable-
1774 * length form (see get_sb4_custom). The per-bind directions
1775 * are one raw byte each. The trailing RXD values need each
1776 * bind's declared type to decode, so we stop after the
1777 * direction vector and leave the rest to the data dissector. */
1778 int num_requests = 0, num_iters = 0, v = 0, bv_len = 0, rid_len = 0;
1779
1780 if ( !is_request )
1781 {
1782 /* flag (ub1, skip) */
1783 offset += 1;
1784 offset += get_sb4_custom(tvb, offset, &num_requests);
1785 offset += get_sb4_custom(tvb, offset, &num_iters);
1786 int num_binds = num_iters * 256 + num_requests;
1787 proto_tree_add_uint(data_tree, hf_tns_data_iov_num_binds, tvb, offset, 0, num_binds);
1788 /* num iters this time (skip) */
1789 offset += get_sb4_custom(tvb, offset, &v);
1790 /* uac buffer length (skip) */
1791 offset += get_sb4_custom(tvb, offset, &v);
1792 /* fast-fetch bit-vector: length + bytes (skip) */
1793 offset += get_sb4_custom(tvb, offset, &bv_len);
1794 if ( bv_len > 0 )
1795 offset += bv_len;
1796 /* rowid: length + bytes (skip) */
1797 offset += get_sb4_custom(tvb, offset, &rid_len);
1798 if ( rid_len > 0 )
1799 offset += rid_len;
1800
1801 /* Per-bind direction bytes, in bind order. Bound by both
1802 * the reported count and the bytes actually present so a
1803 * malformed vector cannot run away. */
1804 proto_tree *iov_tree;
1805 proto_item *iov_item;
1806 int iov_start = offset;
1807 iov_tree = proto_tree_add_subtree(data_tree, tvb, offset, -1, ett_tns_iov, &iov_item, "Bind Directions");
1808 for ( int i = 0; i < num_binds && tvb_reported_length_remaining(tvb, offset) > 0; i++ )
1809 {
1810 proto_tree_add_item(iov_tree, hf_tns_data_iov_bind_dir, tvb, offset, 1, ENC_BIG_ENDIAN0x00000000);
1811 offset += 1;
1812 }
1813 proto_item_set_len(iov_item, offset - iov_start);
1814 }
1815 break;
1816 }
1817
1818 case SQLNET_DESCRIBE_INFO16:
1819 {
1820 /* TTI_DCB: describe (column metadata) for a SELECT result set.
1821 * Layout is the Oracle 11g shape. All
1822 * counts use the ub4 variable-length form. Only the leading
1823 * describe token is decoded here; any RXH/RXD/OER that follow
1824 * in the same packet are left to the data dissector. */
1825 int v = 0, num_cols = 0;
1826
1827 if ( is_request )
1828 break;
1829
1830 /* describe-info preamble (chunked bytes: cursor uuid + date) */
1831 offset += get_dalc_custom(tvb, pinfo, offset, NULL((void*)0));
1832 /* max row size (ub4, skip) */
1833 offset += get_sb4_custom(tvb, offset, &v);
1834 /* number of columns */
1835 int nc_start = offset;
1836 offset += get_sb4_custom(tvb, offset, &num_cols);
1837 proto_tree_add_uint(data_tree, hf_tns_data_dcb_num_columns, tvb, nc_start, offset - nc_start, num_cols);
1838 /* The count comes off the wire and sizes the allocation
1839 * below, so a count larger than the data left cannot be
1840 * real - report it and decode no columns. */
1841 if ( num_cols < 0 ||
1842 (unsigned)num_cols > tvb_reported_length_remaining(tvb, offset) )
1843 {
1844 proto_tree_add_expert(data_tree, pinfo, &ei_tns_data_count_too_large,
1845 tvb, nc_start, offset - nc_start);
1846 num_cols = 0;
1847 }
1848 if ( num_cols > 0 )
1849 offset += 1; /* reserved byte */
1850 *walk = true1;
1851
1852 /* Remember each column so a later TTI_RXD response can split
1853 * its row values. Recorded once, on the first pass. */
1854 tns_column_t *cols = NULL((void*)0);
1855 if ( !PINFO_FD_VISITED(pinfo)((pinfo)->fd->visited) && num_cols > 0 )
1856 cols = wmem_alloc0_array(wmem_file_scope(), tns_column_t, num_cols)((tns_column_t*)wmem_alloc0((wmem_file_scope()), (((((num_cols
)) <= 0) || ((size_t)sizeof(tns_column_t) > (9223372036854775807L
/ (size_t)((num_cols))))) ? 0 : (sizeof(tns_column_t) * ((num_cols
))))))
;
1857 for ( int i = 0; i < num_cols && tvb_reported_length_remaining(tvb, offset) > 0; i++ )
1858 offset = dissect_tns_dcb_column(tvb, pinfo, data_tree, offset, i + 1,
1859 cols ? &cols[i] : NULL((void*)0));
1860 if ( cols )
1861 {
1862 tns_conv_info_t *tns_info = tns_get_conv_info(pinfo);
1863 tns_describe_t *desc = wmem_new0(wmem_file_scope(), tns_describe_t)((tns_describe_t*)wmem_alloc0((wmem_file_scope()), sizeof(tns_describe_t
)))
;
1864 desc->num_cols = num_cols;
1865 desc->cols = cols;
1866 tns_info->last_describe = desc;
1867 }
1868
1869 /* Trailer: current date (bytes_with_length), four ub4 flags,
1870 * and the query-cache key (bytes_with_length) — all skipped. */
1871 offset += get_field_with_length(tvb, pinfo, offset, NULL((void*)0));
1872 for ( int i = 0; i < 4; i++ )
1873 offset += get_sb4_custom(tvb, offset, &v);
1874 offset += get_field_with_length(tvb, pinfo, offset, NULL((void*)0));
1875 break;
1876 }
1877
1878 case SQLNET_ROW_TRANSF_HDR6:
1879 {
1880 /* TTI_RXH: row transfer header, precedes the row data in a
1881 * SELECT response. All numeric fields use the ub4 variable-
1882 * length form. Layout cross-referenced with
1883 * python-oracledb's _process_row_header. */
1884 int v = 0, bv_len = 0, start;
1885
1886 if ( is_request )
1887 break;
1888
1889 /* flag (ub1, skip) */
1890 offset += 1;
1891 /* number of requests */
1892 start = offset;
1893 offset += get_sb4_custom(tvb, offset, &v);
1894 proto_tree_add_uint(data_tree, hf_tns_data_rxh_num_requests, tvb, start, offset - start, v);
1895 /* iteration number */
1896 start = offset;
1897 offset += get_sb4_custom(tvb, offset, &v);
1898 proto_tree_add_uint(data_tree, hf_tns_data_rxh_iter_num, tvb, start, offset - start, v);
1899 /* number of iterations */
1900 start = offset;
1901 offset += get_sb4_custom(tvb, offset, &v);
1902 proto_tree_add_uint(data_tree, hf_tns_data_rxh_num_iters, tvb, start, offset - start, v);
1903 /* buffer length (ub4, skip) */
1904 offset += get_sb4_custom(tvb, offset, &v);
1905 /* bit vector: length + [repeated length byte + vector bytes] */
1906 offset += get_sb4_custom(tvb, offset, &bv_len);
1907 if ( bv_len > 0 )
1908 {
1909 offset += 1; /* repeated length byte */
1910 offset += bv_len; /* bit vector */
1911 }
1912 /* rxhrid (bytes_with_length, skip) */
1913 offset += get_field_with_length(tvb, pinfo, offset, NULL((void*)0));
1914 *walk = true1;
1915 break;
1916 }
1917
1918 case SQLNET_ROW_TRANSF_DATA7:
1919 {
1920 /* TTI_RXD: row data for a SELECT result set — typically a
1921 * TTI_FETCH continuation, where the describe (TTI_DCB) arrived
1922 * in an earlier packet. Split each row into columns using the
1923 * types remembered from that describe (threaded through
1924 * conversation state); ordinary values are shown raw.
1925 *
1926 * The leading RXD token was already consumed above, so offset
1927 * sits on the first row's first value. Differential (bit-vector)
1928 * row encoding is not handled — a row that reuses a prior value
1929 * would desync, so we only decode when no BVC context applies. */
1930 tns_describe_t *desc = NULL((void*)0);
1931
1932 if ( is_request )
1933 break;
1934
1935 if ( !PINFO_FD_VISITED(pinfo)((pinfo)->fd->visited) )
1936 {
1937 tns_conv_info_t *tns_info = tns_get_conv_info(pinfo);
1938 desc = tns_info->last_describe;
1939 if ( desc )
1940 p_add_proto_data(wmem_file_scope(), pinfo, proto_tns,
1941 TNS_PROTO_DATA_DESCRIBE1, desc);
1942 }
1943 else
1944 {
1945 desc = (tns_describe_t *)p_get_proto_data(wmem_file_scope(), pinfo,
1946 proto_tns, TNS_PROTO_DATA_DESCRIBE1);
1947 }
1948
1949 if ( desc && desc->num_cols > 0 )
1950 {
1951 int rownum = 0, first_row = 1, bail = 0;
1952 while ( tvb_reported_length_remaining(tvb, offset) > 0 && !bail )
1953 {
1954 proto_tree *row_tree;
1955 proto_item *row_item;
1956 int r_start;
1957
1958 if ( !first_row )
1959 {
1960 if ( tvb_get_uint8(tvb, offset) != SQLNET_ROW_TRANSF_DATA7 )
1961 break;
1962 offset += 1; /* RXD token for subsequent rows */
1963 }
1964 first_row = 0;
1965
1966 r_start = offset;
1967 row_tree = proto_tree_add_subtree_format(data_tree, tvb, offset, -1,
1968 ett_tns_rxd_row, &row_item, "Row %d", ++rownum);
1969 for ( uint32_t c = 0; c < desc->num_cols
1970 && tvb_reported_length_remaining(tvb, offset) > 0 && !bail; c++ )
1971 {
1972 const tns_column_t *col = &desc->cols[c];
1973 /* A column the describe gives no data length is
1974 * NULL by definition (SELECT NULL, SELECT '')
1975 * and sends no bytes at all - not even an empty
1976 * DALC. LONG, LONG RAW and UROWID are the
1977 * exceptions: they always carry their value. */
1978 if ( col->data_len == 0 && col->type != TNS_DATATYPE_LONG8
1979 && col->type != TNS_DATATYPE_LONG_RAW24
1980 && col->type != TNS_DATATYPE_UROWID208 )
1981 {
1982 proto_tree_add_bytes_format(row_tree, hf_tns_data_col_value,
1983 tvb, offset, 0, NULL((void*)0), "Column %u (%s): NULL (no data length)",
1984 c + 1, val_to_str_const(col->type, tns_data_types, "unknown"));
1985 continue;
1986 }
1987 offset = dissect_tns_value(tvb, pinfo, row_tree, offset,
1988 col->type, c + 1, &bail, hf_tns_data_col_value, "Column");
1989 }
1990 proto_item_set_len(row_item, offset - r_start);
1991 }
1992 *walk = !bail;
1993 }
1994 break;
1995 }
1996
1997 case SQLNET_USER_OCI_FUNC3:
1998 {
1999 guint32 oci_id = 0;
2000 proto_tree_add_item_ret_uint(data_tree, hf_tns_data_oci_id, tvb, offset, 1, ENC_BIG_ENDIAN0x00000000, &oci_id);
2001 offset += 1;
2002 /* Name the specific OCI call in the Info column — otherwise every
2003 * function call reads only as the generic "User OCI Functions". */
2004 col_append_fstr(pinfo->cinfo, COL_INFO, " (%s)",
2005 val_to_str_ext_const(oci_id, &tns_data_oci_subfuncs_ext, "unknown"));
2006 proto_tree_add_item(data_tree, hf_tns_data_tseq, tvb, offset, 1, ENC_BIG_ENDIAN0x00000000);
2007 offset += 1;
2008 if((oci_id == 115) || (oci_id == 118)){
2009 proto_tree_add_item(data_tree, hf_tns_data_unused, tvb, offset, 1, ENC_NA0x00000000);
2010 offset += 1;
2011 int user_len = 0;
2012 offset += get_sb4_custom(tvb, offset, &user_len);
2013 }
2014 else if ( oci_id == TTI_FETCH5 )
2015 {
2016 /* TTI_FETCH: fetch more rows from an open cursor.
2017 * [TTI_FUN, TTI_FETCH, seq] then cursor id and the row
2018 * count, both ub4. */
2019 int v = 0, start;
2020
2021 start = offset;
2022 offset += get_sb4_custom(tvb, offset, &v);
2023 proto_tree_add_uint(data_tree, hf_tns_cursor, tvb, start, offset - start, v);
2024 start = offset;
2025 offset += get_sb4_custom(tvb, offset, &v);
2026 proto_tree_add_uint(data_tree, hf_tns_data_fetch_rows, tvb, start, offset - start, v);
2027 }
2028 else if ( oci_id == TTI_ALL894 )
2029 {
2030 /* TTI_ALL8: the generic SQL execute — SELECT, DML and
2031 * PL/SQL all ride this call. Layout is the Oracle 11g
2032 * shape. All multi-byte integers use the ub4
2033 * variable-length form.
2034 *
2035 * The bind descriptors (OAC) and bind values (RXD) that can
2036 * trail the al8 array need per-bind type context to decode
2037 * safely, so we stop after the al8 array and leave them to
2038 * the data dissector. */
2039 int v = 0, options = 0, cursor = 0, query_len = 0, all8_len = 0;
2040 int fetch = 0, bind_count = 0, start;
2041 uint8_t query_flag;
2042
2043 /* options (ub4) + flag breakdown */
2044 start = offset;
2045 offset += get_sb4_custom(tvb, offset, &options);
2046 proto_tree_add_bitmask_value(data_tree, tvb, start, hf_tns_data_all8_options,
2047 ett_tns_all8_options, tns_all8_options, (uint64_t)(uint32_t)options);
2048 /* cursor id (ub4) */
2049 start = offset;
2050 offset += get_sb4_custom(tvb, offset, &cursor);
2051 proto_tree_add_uint(data_tree, hf_tns_cursor, tvb, start, offset - start, cursor);
2052 /* query present flag (ub1) */
2053 query_flag = tvb_get_uint8(tvb, offset);
2054 offset += 1;
2055 /* query length (ub4) */
2056 offset += get_sb4_custom(tvb, offset, &query_len);
2057 /* all8 present flag (ub1) */
2058 offset += 1;
2059 /* all8 length (ub4) */
2060 offset += get_sb4_custom(tvb, offset, &all8_len);
2061 /* two reserved bytes */
2062 offset += 2;
2063 /* long max value (ub4, skip) */
2064 offset += get_sb4_custom(tvb, offset, &v);
2065 /* fetch rows (ub4) */
2066 start = offset;
2067 offset += get_sb4_custom(tvb, offset, &fetch);
2068 proto_tree_add_uint(data_tree, hf_tns_data_all8_fetch_rows, tvb, start, offset - start, fetch);
2069 /* max value (ub4, skip) */
2070 offset += get_sb4_custom(tvb, offset, &v);
2071 /* bind indicator (ub1) */
2072 offset += 1;
2073 /* bind count (ub4) */
2074 start = offset;
2075 offset += get_sb4_custom(tvb, offset, &bind_count);
2076 proto_tree_add_uint(data_tree, hf_tns_data_all8_bind_count, tvb, start, offset - start, bind_count);
2077 /* The count comes off the wire and sizes an allocation
2078 * further down, so a count larger than the data left
2079 * cannot be real - report it and decode no binds. */
2080 if ( bind_count < 0 ||
2081 (unsigned)bind_count > tvb_reported_length_remaining(tvb, offset) )
2082 {
2083 proto_tree_add_expert(data_tree, pinfo, &ei_tns_data_count_too_large,
2084 tvb, start, offset - start);
2085 bind_count = 0;
2086 }
2087 /* five reserved bytes */
2088 offset += 5;
2089 /* define-columns present flag (ub1) */
2090 offset += 1;
2091 /* define-columns count (ub4, skip) */
2092 offset += get_sb4_custom(tvb, offset, &v);
2093 /* [0,0,1] marker (3 bytes) + server version slot (5 bytes) */
2094 offset += 8;
2095 /* SQL text — a flat run of query_len bytes on 11g */
2096 if ( query_flag && query_len > 0 )
2097 {
2098 const uint8_t *sql;
2099 proto_tree_add_item_ret_string(data_tree, hf_tns_data_all8_sql, tvb,
2100 offset, query_len, ENC_UTF_80x00000002|ENC_NA0x00000000, pinfo->pool, &sql);
2101 col_append_fstr(pinfo->cinfo, COL_INFO, " [%s]", sql);
2102 offset += query_len;
2103 }
2104 /* al8i4 option array: all8_len ub4 elements (skip) */
2105 for ( int i = 0; i < all8_len && tvb_reported_length_remaining(tvb, offset) > 0; i++ )
2106 offset += get_sb4_custom(tvb, offset, &v);
2107
2108 /* Bind section: on a fresh parse with binds, one bare OAC
2109 * descriptor per bind column, then one TTI_RXD row of values
2110 * per iteration. A cached re-execute (no query text) omits
2111 * the OACs — detecting that needs connection state, so we
2112 * only decode binds when the query was present. */
2113 if ( bind_count > 0 && query_flag )
2114 {
2115 proto_tree *binds_tree, *bind_tree, *row_tree;
2116 proto_item *binds_item, *bind_item, *row_item;
2117 int binds_start = offset, has_lob = 0, rownum = 0;
2118 uint8_t *btypes;
2119
2120 btypes = (uint8_t *)wmem_alloc_array(pinfo->pool, uint8_t, bind_count)((uint8_t*)wmem_alloc((pinfo->pool), (((((bind_count)) <=
0) || ((size_t)sizeof(uint8_t) > (9223372036854775807L / (
size_t)((bind_count))))) ? 0 : (sizeof(uint8_t) * ((bind_count
))))))
;
2121 binds_tree = proto_tree_add_subtree(data_tree, tvb, offset, -1,
2122 ett_tns_binds, &binds_item, "Binds");
2123
2124 for ( int i = 0; i < bind_count && tvb_reported_length_remaining(tvb, offset) > 0; i++ )
2125 {
2126 int b_start = offset;
2127 uint8_t btype = tvb_get_uint8(tvb, offset);
2128 btypes[i] = btype;
2129 /* CLOB / BLOB binds use a temp-LOB locator value
2130 * form we do not unpack. */
2131 if ( btype == TNS_DATATYPE_CLOB112 || btype == TNS_DATATYPE_BLOB113 )
2132 has_lob = 1;
2133 bind_tree = proto_tree_add_subtree_format(binds_tree, tvb, offset, -1,
2134 ett_tns_bind, &bind_item, "Bind %d: %s", i + 1,
2135 val_to_str_const(btype, tns_data_types, "unknown"));
2136 offset = dissect_tns_oac(tvb, pinfo, bind_tree, offset, NULL((void*)0));
2137 /* A CLOB/BLOB bind OAC carries a trailing oaccolid byte. */
2138 if ( btype == TNS_DATATYPE_CLOB112 || btype == TNS_DATATYPE_BLOB113 )
2139 offset += 1;
2140 proto_item_set_len(bind_item, offset - b_start);
2141 }
2142
2143 /* Value rows: a TTI_RXD token then one DALC value per bind
2144 * column (an ordinary execute sends one row, executemany
2145 * sends N), decoded and rendered by the bind's type. */
2146 while ( !has_lob && tvb_reported_length_remaining(tvb, offset) > 0
2147 && tvb_get_uint8(tvb, offset) == SQLNET_ROW_TRANSF_DATA7 )
2148 {
2149 int r_start = offset;
2150 offset += 1; /* TTI_RXD token */
2151 row_tree = proto_tree_add_subtree_format(binds_tree, tvb, offset, -1,
2152 ett_tns_bind_row, &row_item, "Row %d", ++rownum);
2153 int row_bail = 0;
2154 for ( int i = 0; i < bind_count
2155 && tvb_reported_length_remaining(tvb, offset) > 0 && !row_bail; i++ )
2156 offset = dissect_tns_value(tvb, pinfo, row_tree, offset,
2157 btypes[i], i + 1, &row_bail, hf_tns_data_bind_value, "Bind");
2158 proto_item_set_len(row_item, offset - r_start);
2159 if ( row_bail )
2160 break;
2161 }
2162 proto_item_set_len(binds_item, offset - binds_start);
2163 }
2164 }
2165 else if ( oci_id == TTI_LOBOPS96 )
2166 {
2167 /* TTI_LOBOPS: the LOB operation family (read, write, get
2168 * length, create/free temp, open/close, BFILE ops). One
2169 * common request layout selects behaviour by the operation
2170 * opcode. All multi-byte integers use
2171 * the ub4 variable-length form.
2172 *
2173 * We decode the common header through the source offset and
2174 * show the opcode; the locator framing and trailing amount /
2175 * write payload vary by opcode and locator variant, so they
2176 * are left to the data dissector. */
2177 int v = 0, op = 0, start;
2178
2179 /* CREATE_TEMP carries a fixed field block (01 01 28 ...) with
2180 * no source locator instead of the common header. */
2181 if ( tvb_bytes_exist(tvb, offset, 3)
2182 && tvb_get_uint24(tvb, offset, ENC_BIG_ENDIAN0x00000000) == 0x010128 )
2183 {
2184 proto_tree_add_uint(data_tree, hf_tns_data_lob_op, tvb, offset, 3, 0x00110);
2185 }
2186 else
2187 {
2188 offset += 1; /* source pointer flag */
2189 offset += get_sb4_custom(tvb, offset, &v); /* source locator length */
2190 offset += 1; /* dest pointer flag */
2191 offset += get_sb4_custom(tvb, offset, &v); /* dest length */
2192 offset += get_sb4_custom(tvb, offset, &v); /* short source offset */
2193 offset += get_sb4_custom(tvb, offset, &v); /* short dest offset */
2194 offset += 3; /* charset / amount / null-lob flags */
2195 /* operation opcode */
2196 start = offset;
2197 offset += get_sb4_custom(tvb, offset, &op);
2198 proto_tree_add_uint(data_tree, hf_tns_data_lob_op, tvb, start, offset - start, op);
2199 col_append_fstr(pinfo->cinfo, COL_INFO, " [%s]",
2200 val_to_str_const(op, tns_lob_ops, "unknown"));
2201 /* scn-array pointer flag + length */
2202 offset += 2;
2203 /* source offset (ub8, 1-based into the LOB) */
2204 start = offset;
2205 offset += get_sb4_custom(tvb, offset, &v);
2206 proto_tree_add_uint(data_tree, hf_tns_data_lob_offset, tvb, start, offset - start, v);
2207 }
2208 }
2209 break;
2210 }
2211 case SQLNET_RETURN_OPI_PARAM8:
2212 {
2213 uint8_t skip = 0, opi = 0;
2214
2215 if ( tvb_bytes_exist(tvb, offset, 11) )
2216 {
2217 /*
2218 * OPI_VERSION2 response has a following pattern:
2219 *
2220 * _ banner _ vsnum
2221 * / /
2222 * ..(.?)(Orac[le.+])(.?)(....).+$
2223 * |
2224 * \ banner length (if equal to 0 then next byte indicates the length).
2225 *
2226 * These differences (to skip 1 or 2 bytes) due to differences in the drivers.
2227 */
2228 /* Orac[le.+] */
2229 if ( tvb_get_ntohl(tvb, offset+2) == 0x4f726163 )
2230 {
2231 opi = OPI_VERSION21;
2232 skip = 1;
2233 }
2234
2235 else if ( tvb_get_ntohl(tvb, offset+3) == 0x4f726163 )
2236 {
2237 opi = OPI_VERSION21;
2238 skip = 2;
2239 }
2240
2241 /*
2242 * OPI_OSESSKEY response has a following pattern:
2243 *
2244 * _ pattern (v1|v2)
2245 * / _ params
2246 * / /
2247 * (....)(........)(.+).+$
2248 * ||
2249 * \ if these two bytes are equal to 0x0c00 then first byte is <Param Counts> (v1),
2250 * else next byte indicate it (v2).
2251 */
2252 /* ....AUTH (v1) */
2253 else if ( tvb_get_ntoh64(tvb, offset+3) == 0x0000000c41555448 )
2254 {
2255 opi = OPI_OSESSKEY2;
2256 skip = 1;
2257 }
2258 /* ..AUTH_V (v2) */
2259 else if ( tvb_get_ntoh64(tvb, offset+3) == 0x0c0c415554485f53 )
2260 {
2261 opi = OPI_OSESSKEY2;
2262 skip = 2;
2263 }
2264
2265 /*
2266 * OPI_OAUTH response has a following pattern:
2267 *
2268 * _ pattern (v1|v2)
2269 * / _ params
2270 * / /
2271 * (....)(........)(.+).+$
2272 * ||
2273 * \ if these two bytes are equal to 0x1300 then first byte is <Param Counts> (v1),
2274 * else next byte indicate it (v2).
2275 */
2276
2277 /* ....AUTH (v1) */
2278 else if ( tvb_get_ntoh64(tvb, offset+3) == 0x0000001341555448 )
2279 {
2280 opi = OPI_OAUTH3;
2281 skip = 1;
2282 }
2283 /* ..AUTH_V (v2) */
2284 else if ( tvb_get_ntoh64(tvb, offset+3) == 0x1313415554485f56 )
2285 {
2286 opi = OPI_OAUTH3;
2287 skip = 2;
2288 }
2289 }
2290
2291 if ( opi == OPI_VERSION21 )
2292 {
2293 proto_tree_add_item(data_tree, hf_tns_data_unused, tvb, offset, skip, ENC_NA0x00000000);
2294 offset += skip;
2295
2296 uint8_t len = tvb_get_uint8(tvb, offset);
2297
2298 proto_tree_add_item(data_tree, hf_tns_data_opi_version2_banner_len, tvb, offset, 1, ENC_BIG_ENDIAN0x00000000);
2299 offset += 1;
2300
2301 proto_tree_add_item(data_tree, hf_tns_data_opi_version2_banner, tvb, offset, len, ENC_ASCII0x00000000);
2302 offset += len + (skip == 1 ? 1 : 0);
2303
2304 proto_tree_add_item(data_tree, hf_tns_data_opi_version2_vsnum, tvb, offset, 4, (skip == 1) ? ENC_BIG_ENDIAN0x00000000 : ENC_LITTLE_ENDIAN0x80000000);
2305 offset += 4;
2306 }
2307 else if ( opi == OPI_OSESSKEY2 || opi == OPI_OAUTH3 )
2308 {
2309 proto_tree *params_tree;
2310 proto_item *params_ti;
2311 unsigned par, params;
2312
2313 if ( skip == 1 )
2314 {
2315 proto_tree_add_item_ret_uint(data_tree, hf_tns_data_opi_num_of_params, tvb, offset, 1, ENC_NA0x00000000, &params);
2316 offset += 1;
2317
2318 proto_tree_add_item(data_tree, hf_tns_data_unused, tvb, offset, 5, ENC_NA0x00000000);
2319 offset += 5;
2320 }
2321 else
2322 {
2323 proto_tree_add_item(data_tree, hf_tns_data_unused, tvb, offset, 1, ENC_NA0x00000000);
2324 offset += 1;
2325
2326 proto_tree_add_item_ret_uint(data_tree, hf_tns_data_opi_num_of_params, tvb, offset, 1, ENC_NA0x00000000, &params);
2327 offset += 1;
2328
2329 proto_tree_add_item(data_tree, hf_tns_data_unused, tvb, offset, 2, ENC_NA0x00000000);
2330 offset += 2;
2331 }
2332
2333 params_tree = proto_tree_add_subtree(data_tree, tvb, offset, -1, ett_tns_opi_params, &params_ti, "Parameters");
2334
2335 for ( par = 1; par <= params; par++ )
2336 {
2337 proto_tree *par_tree;
2338 proto_item *par_ti;
2339 unsigned len, offset_prev;
2340
2341 par_tree = proto_tree_add_subtree(params_tree, tvb, offset, -1, ett_tns_opi_par, &par_ti, "Parameter");
2342 proto_item_append_text(par_ti, " %u", par);
2343
2344 /* Name length */
2345 proto_tree_add_item_ret_uint(par_tree, hf_tns_data_opi_param_length, tvb, offset, 1, ENC_NA0x00000000, &len);
2346 offset += 1;
2347
2348 /* Name */
2349 if ( !(len == 0 || len == 2) ) /* Not empty (2 - SQLDeveloper specific sign). */
2350 {
2351 proto_tree_add_item(par_tree, hf_tns_data_opi_param_name, tvb, offset, len, ENC_ASCII0x00000000);
2352 offset += len;
2353 }
2354
2355 /* Value can be NULL. So, save offset to calculate unused data. */
2356 offset_prev = offset;
2357 offset += skip == 1 ? 4 : 2;
2358
2359 /* Value length */
2360 if ( opi == OPI_OSESSKEY2 )
2361 {
2362 len = get_strtype_custom(tvb, pinfo, par_tree, offset);
2363 }
2364 else /* OPI_OAUTH */
2365 {
2366 len = tvb_get_uint8(tvb, offset_prev) == 0 ? 0 : get_strtype_custom(tvb, pinfo, par_tree, offset);
2367 }
2368
2369 /*
2370 * Value
2371 * OPI_OSESSKEY: AUTH_VFR_DATA with length 0, 9, 0x39 comes without data.
2372 * OPI_OAUTH: AUTH_VFR_DATA with length 0, 0x39 comes without data.
2373 */
2374 if ( ((opi == OPI_OSESSKEY2) && !(len == 0 || len == 9 || len == 0x39))
2375 || ((opi == OPI_OAUTH3) && !(len == 0 || len == 0x39)) )
2376 {
2377 proto_tree_add_item(par_tree, hf_tns_data_unused, tvb, offset_prev, offset - offset_prev, ENC_NA0x00000000);
2378 offset += len;
2379
2380 offset_prev = offset; /* Save offset to calculate rest of unused data */
2381 }
2382 else
2383 {
2384 offset += 1;
2385 }
2386
2387 if ( opi == OPI_OSESSKEY2 )
2388 {
2389 /* SQL Developer specific fix */
2390 offset += tvb_get_uint8(tvb, offset) == 2 ? 5 : 3;
2391 }
2392 else /* OPI_OAUTH */
2393 {
2394 offset += len == 0 ? 1 : 3;
2395 }
2396
2397 if ( skip == 1 )
2398 {
2399 offset += 1 + ((len == 0 || len == 0x39) ? 3 : 4);
2400
2401 if ( opi == OPI_OAUTH3 )
2402 {
2403 offset += len == 0 ? 2 : 0;
2404 }
2405 }
2406
2407 proto_tree_add_item(par_tree, hf_tns_data_unused, tvb, offset_prev, offset - offset_prev, ENC_NA0x00000000);
2408 proto_item_set_end(par_ti, tvb, offset);
2409 }
2410 proto_item_set_end(params_ti, tvb, offset);
2411 }
2412 break;
2413 }
2414
2415 case SQLNET_PIGGYBACK_FUNC17:
2416 {
2417 int cursors_len = 0;
2418 int cursors_start;
2419 uint8_t piggyback_id = tvb_get_uint8(tvb, offset);
2420 proto_tree_add_item(data_tree, hf_tns_data_piggyback_id, tvb, offset, 1, ENC_BIG_ENDIAN0x00000000);
2421 offset += 1;
2422 proto_tree_add_item(data_tree, hf_tns_data_tseq, tvb, offset, 1, ENC_BIG_ENDIAN0x00000000);
2423 offset += 1;
2424 /* Only the close-cursors piggyback carries a cursor list:
2425 * a pointer byte, a ub4 count, then that many ub4 cursor
2426 * ids. The other piggybacks have bodies of their own. */
2427 if ( piggyback_id != TTI_CLOSE_CURSORS105 )
2428 break;
2429 offset += 1; /* pointer */
2430 cursors_start = offset;
2431 offset += get_sb4_custom(tvb, offset, &cursors_len);
2432 /* The count comes off the wire and every cursor takes at
2433 * least one byte, so a count larger than the data left
2434 * cannot be real. Say so and stop, rather than looping on
2435 * a number somebody else chose. */
2436 if ( cursors_len < 0 ||
2437 (unsigned)cursors_len > tvb_reported_length_remaining(tvb, offset) )
2438 {
2439 proto_tree_add_expert(data_tree, pinfo, &ei_tns_data_piggyback_cursors,
2440 tvb, cursors_start, offset - cursors_start);
2441 break;
2442 }
2443 for(int i = 0; i < cursors_len; i++) {
2444 int cursor = 0;
2445 int len = get_sb4_custom(tvb, offset, &cursor);
2446 proto_tree_add_uint(data_tree, hf_tns_cursor, tvb, offset, len, cursor);
2447 offset += len;
2448 }
2449 /* The call this piggyback rides in front of follows it. */
2450 *walk = true1;
2451 break;
2452 }
2453 case SQLNET_SNS0xdeadbeef:
2454 {
2455 proto_tree_add_item(data_tree, hf_tns_data_id, tvb, offset, 4, ENC_BIG_ENDIAN0x00000000);
2456 offset += 4;
2457 proto_tree_add_item(data_tree, hf_tns_data_length, tvb, offset, 2, ENC_BIG_ENDIAN0x00000000);
2458 offset += 2;
2459
2460 if ( is_request )
2461 {
2462 proto_tree_add_item(data_tree, hf_tns_data_sns_cli_vers, tvb, offset, 4, ENC_BIG_ENDIAN0x00000000);
2463 }
2464 else
2465 {
2466 proto_tree_add_item(data_tree, hf_tns_data_sns_srv_vers, tvb, offset, 4, ENC_BIG_ENDIAN0x00000000);
2467 }
2468 offset += 4;
2469
2470 proto_tree_add_item(data_tree, hf_tns_data_sns_srvcnt, tvb, offset, 2, ENC_BIG_ENDIAN0x00000000);
2471
2472 /* move back, to include data_id into data_dissector */
2473 offset -= 10;
2474 break;
2475 }
2476 }
2477
2478 return offset;
2479}
2480
2481static void dissect_tns_connect(tvbuff_t *tvb, int offset, packet_info *pinfo _U___attribute__((unused)), proto_tree *tns_tree)
2482{
2483 proto_tree *connect_tree;
2484 uint32_t cd_offset, cd_len;
2485 int tns_offset = offset-8;
2486 static int * const flags[] = {
2487 &hf_tns_ntp_flag_hangon,
2488 &hf_tns_ntp_flag_crel,
2489 &hf_tns_ntp_flag_tduio,
2490 &hf_tns_ntp_flag_srun,
2491 &hf_tns_ntp_flag_dtest,
2492 &hf_tns_ntp_flag_cbio,
2493 &hf_tns_ntp_flag_asio,
2494 &hf_tns_ntp_flag_pio,
2495 &hf_tns_ntp_flag_grant,
2496 &hf_tns_ntp_flag_handoff,
2497 &hf_tns_ntp_flag_sigio,
2498 &hf_tns_ntp_flag_sigpipe,
2499 &hf_tns_ntp_flag_sigurg,
2500 &hf_tns_ntp_flag_urgentio,
2501 &hf_tns_ntp_flag_fdio,
2502 &hf_tns_ntp_flag_testop,
2503 NULL((void*)0)
2504 };
2505
2506 connect_tree = proto_tree_add_subtree(tns_tree, tvb, offset, -1,
2507 ett_tns_connect, NULL((void*)0), "Connect");
2508
2509 proto_tree_add_item(connect_tree, hf_tns_version, tvb,
2510 offset, 2, ENC_BIG_ENDIAN0x00000000);
2511 offset += 2;
2512
2513 proto_tree_add_item(connect_tree, hf_tns_compat_version, tvb,
2514 offset, 2, ENC_BIG_ENDIAN0x00000000);
2515 offset += 2;
2516
2517 proto_tree_add_bitmask(connect_tree, tvb, offset, hf_tns_service_options, ett_tns_sopt_flag, tns_service_options, ENC_BIG_ENDIAN0x00000000);
2518 offset += 2;
2519
2520 proto_tree_add_item(connect_tree, hf_tns_sdu_size, tvb,
2521 offset, 2, ENC_BIG_ENDIAN0x00000000);
2522 offset += 2;
2523
2524 proto_tree_add_item(connect_tree, hf_tns_max_tdu_size, tvb,
2525 offset, 2, ENC_BIG_ENDIAN0x00000000);
2526 offset += 2;
2527
2528 proto_tree_add_bitmask(connect_tree, tvb, offset, hf_tns_nt_proto_characteristics, ett_tns_ntp_flag, flags, ENC_BIG_ENDIAN0x00000000);
2529 offset += 2;
2530
2531 proto_tree_add_item(connect_tree, hf_tns_line_turnaround, tvb,
2532 offset, 2, ENC_BIG_ENDIAN0x00000000);
2533 offset += 2;
2534
2535 proto_tree_add_item(connect_tree, hf_tns_value_of_one, tvb,
2536 offset, 2, ENC_NA0x00000000);
2537 offset += 2;
2538
2539 proto_tree_add_item_ret_uint(connect_tree, hf_tns_connect_data_length, tvb,
2540 offset, 2, ENC_BIG_ENDIAN0x00000000, &cd_len);
2541 offset += 2;
2542
2543 proto_tree_add_item_ret_uint(connect_tree, hf_tns_connect_data_offset, tvb,
2544 offset, 2, ENC_BIG_ENDIAN0x00000000, &cd_offset);
2545 offset += 2;
2546
2547 proto_tree_add_item(connect_tree, hf_tns_connect_data_max, tvb,
2548 offset, 4, ENC_BIG_ENDIAN0x00000000);
2549 offset += 4;
2550
2551 proto_tree_add_bitmask(connect_tree, tvb, offset, hf_tns_connect_flags0, ett_tns_conn_flag, tns_connect_flags, ENC_BIG_ENDIAN0x00000000);
2552 offset += 1;
2553
2554 proto_tree_add_bitmask(connect_tree, tvb, offset, hf_tns_connect_flags1, ett_tns_conn_flag, tns_connect_flags, ENC_BIG_ENDIAN0x00000000);
2555 offset += 1;
2556
2557 /*
2558 * XXX - sometimes it appears that this stuff isn't present
2559 * in the packet.
2560 */
2561 if ((uint32_t)(offset + 16) <= tns_offset+cd_offset)
2562 {
2563 proto_tree_add_item(connect_tree, hf_tns_trace_cf1, tvb,
2564 offset, 4, ENC_BIG_ENDIAN0x00000000);
2565 offset += 4;
2566
2567 proto_tree_add_item(connect_tree, hf_tns_trace_cf2, tvb,
2568 offset, 4, ENC_BIG_ENDIAN0x00000000);
2569 offset += 4;
2570
2571 proto_tree_add_item(connect_tree, hf_tns_trace_cid, tvb,
2572 offset, 8, ENC_BIG_ENDIAN0x00000000);
2573 /* offset += 8;*/
2574 }
2575
2576 if ( cd_len > 0)
2577 {
2578 /* Long Connect Data (> 221 bytes?) is not in the Connect PDU
2579 * but sent in an immediately following Data PDU.
2580 */
2581 if (tvb_reported_length_remaining(tvb, tns_offset + cd_offset)) {
2582 proto_tree_add_item(connect_tree, hf_tns_connect_data, tvb,
2583 tns_offset+cd_offset, -1, ENC_ASCII0x00000000);
2584 } else {
2585 proto_tree_add_expert(connect_tree, pinfo, &ei_tns_connect_data_next_packet, tvb, 0, 0);
2586 if (!PINFO_FD_VISITED(pinfo)((pinfo)->fd->visited)) {
2587 tns_conv_info_t *tns_info = tns_get_conv_info(pinfo);
2588 tns_info->pending_connect_data = cd_len;
2589 }
2590 }
2591 }
2592}
2593
2594static void dissect_tns_accept(tvbuff_t *tvb, int offset, packet_info *pinfo _U___attribute__((unused)), proto_tree *tns_tree)
2595{
2596 proto_tree *accept_tree;
2597 uint32_t accept_offset, accept_len;
2598 int tns_offset = offset-8;
2599
2600 accept_tree = proto_tree_add_subtree(tns_tree, tvb, offset, -1,
2601 ett_tns_accept, NULL((void*)0), "Accept");
2602
2603 proto_tree_add_item(accept_tree, hf_tns_version, tvb,
2604 offset, 2, ENC_BIG_ENDIAN0x00000000);
2605 offset += 2;
2606
2607 proto_tree_add_bitmask(accept_tree, tvb, offset, hf_tns_service_options, ett_tns_sopt_flag, tns_service_options, ENC_BIG_ENDIAN0x00000000);
2608 offset += 2;
2609
2610 proto_tree_add_item(accept_tree, hf_tns_sdu_size, tvb,
2611 offset, 2, ENC_BIG_ENDIAN0x00000000);
2612 offset += 2;
2613
2614 proto_tree_add_item(accept_tree, hf_tns_max_tdu_size, tvb,
2615 offset, 2, ENC_BIG_ENDIAN0x00000000);
2616 offset += 2;
2617
2618 proto_tree_add_item(accept_tree, hf_tns_value_of_one, tvb,
2619 offset, 2, ENC_NA0x00000000);
2620 offset += 2;
2621
2622 proto_tree_add_item_ret_uint(accept_tree, hf_tns_accept_data_length, tvb,
2623 offset, 2, ENC_BIG_ENDIAN0x00000000, &accept_len);
2624 offset += 2;
2625
2626 proto_tree_add_item_ret_uint(accept_tree, hf_tns_accept_data_offset, tvb,
2627 offset, 2, ENC_BIG_ENDIAN0x00000000, &accept_offset);
2628 offset += 2;
2629
2630 proto_tree_add_bitmask(accept_tree, tvb, offset, hf_tns_connect_flags0, ett_tns_conn_flag, tns_connect_flags, ENC_BIG_ENDIAN0x00000000);
2631 offset += 1;
2632
2633 proto_tree_add_bitmask(accept_tree, tvb, offset, hf_tns_connect_flags1, ett_tns_conn_flag, tns_connect_flags, ENC_BIG_ENDIAN0x00000000);
2634 /* offset += 1; */
2635
2636 if ( accept_len > 0)
2637 {
2638 proto_tree_add_item(accept_tree, hf_tns_accept_data, tvb,
2639 tns_offset+accept_offset, -1, ENC_ASCII0x00000000);
2640 }
2641 return;
2642}
2643
2644
2645static void dissect_tns_refuse(tvbuff_t *tvb, int offset, packet_info *pinfo _U___attribute__((unused)), proto_tree *tns_tree)
2646{
2647 /* TODO
2648 * According to some reverse engineers, the refuse packet is also sent when the login fails.
2649 * Byte 54 shows if this is due to invalid ID (0x02) or password (0x03).
2650 * At now we do not have pcaps with such messages to check this statement.
2651 */
2652 proto_tree *refuse_tree;
2653
2654 refuse_tree = proto_tree_add_subtree(tns_tree, tvb, offset, -1,
2655 ett_tns_refuse, NULL((void*)0), "Refuse");
2656
2657 proto_tree_add_item(refuse_tree, hf_tns_refuse_reason_user, tvb,
2658 offset, 1, ENC_BIG_ENDIAN0x00000000);
2659 offset += 1;
2660
2661 proto_tree_add_item(refuse_tree, hf_tns_refuse_reason_system, tvb,
2662 offset, 1, ENC_BIG_ENDIAN0x00000000);
2663 offset += 1;
2664
2665 proto_tree_add_item(refuse_tree, hf_tns_refuse_data_length, tvb,
2666 offset, 2, ENC_BIG_ENDIAN0x00000000);
2667 offset += 2;
2668
2669 proto_tree_add_item(refuse_tree, hf_tns_refuse_data, tvb,
2670 offset, -1, ENC_ASCII0x00000000);
2671}
2672
2673
2674static void dissect_tns_abort(tvbuff_t *tvb, int offset, packet_info *pinfo _U___attribute__((unused)), proto_tree *tns_tree)
2675{
2676 proto_tree *abort_tree;
2677
2678 abort_tree = proto_tree_add_subtree(tns_tree, tvb, offset, -1,
2679 ett_tns_abort, NULL((void*)0), "Abort");
2680
2681 proto_tree_add_item(abort_tree, hf_tns_abort_reason_user, tvb,
2682 offset, 1, ENC_BIG_ENDIAN0x00000000);
2683 offset += 1;
2684
2685 proto_tree_add_item(abort_tree, hf_tns_abort_reason_system, tvb,
2686 offset, 1, ENC_BIG_ENDIAN0x00000000);
2687 offset += 1;
2688
2689 proto_tree_add_item(abort_tree, hf_tns_abort_data, tvb,
2690 offset, -1, ENC_ASCII0x00000000);
2691}
2692
2693
2694static void dissect_tns_marker(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tns_tree, int is_attention)
2695{
2696 proto_tree *marker_tree;
2697
2698 marker_tree = proto_tree_add_subtree(tns_tree, tvb, offset, -1,
2699 ett_tns_marker, NULL((void*)0), is_attention ? "Attention" : "Marker");
2700
2701 proto_tree_add_item(marker_tree, hf_tns_marker_type, tvb,
2702 offset, 1, ENC_BIG_ENDIAN0x00000000);
2703 offset += 1;
2704
2705 proto_tree_add_item(marker_tree, hf_tns_marker_data_byte, tvb,
2706 offset, 1, ENC_BIG_ENDIAN0x00000000);
2707 offset += 1;
2708
2709 /* The last byte selects break vs reset for a data marker. */
2710 if ( tvb_reported_length_remaining(tvb, offset) > 0 )
2711 {
2712 uint32_t func = tvb_get_uint8(tvb, offset);
2713 proto_tree_add_item(marker_tree, hf_tns_marker_function, tvb,
2714 offset, 1, ENC_BIG_ENDIAN0x00000000);
2715 col_append_fstr(pinfo->cinfo, COL_INFO, ", %s",
2716 val_to_str_const(func, tns_marker_functions, "Unknown"));
2717 }
2718}
2719
2720static void dissect_tns_redirect(tvbuff_t *tvb, int offset, packet_info *pinfo _U___attribute__((unused)), proto_tree *tns_tree)
2721{
2722 proto_tree *redirect_tree;
2723
2724 redirect_tree = proto_tree_add_subtree(tns_tree, tvb, offset, -1,
2725 ett_tns_redirect, NULL((void*)0), "Redirect");
2726
2727 proto_tree_add_item(redirect_tree, hf_tns_redirect_data_length, tvb,
2728 offset, 2, ENC_BIG_ENDIAN0x00000000);
2729 offset += 2;
2730
2731 proto_tree_add_item(redirect_tree, hf_tns_redirect_data, tvb,
2732 offset, -1, ENC_ASCII0x00000000);
2733}
2734
2735static void dissect_tns_control(tvbuff_t *tvb, int offset, packet_info *pinfo _U___attribute__((unused)), proto_tree *tns_tree)
2736{
2737 proto_tree *control_tree;
2738
2739 control_tree = proto_tree_add_subtree(tns_tree, tvb, offset, -1,
2740 ett_tns_control, NULL((void*)0), "Control");
2741
2742 proto_tree_add_item(control_tree, hf_tns_control_cmd, tvb,
2743 offset, 2, ENC_BIG_ENDIAN0x00000000);
2744 offset += 2;
2745
2746 proto_tree_add_item(control_tree, hf_tns_control_data, tvb,
2747 offset, -1, ENC_NA0x00000000);
2748}
2749
2750static unsigned
2751get_tns_pdu_len(packet_info *pinfo _U___attribute__((unused)), tvbuff_t *tvb, int offset, void *data _U___attribute__((unused)))
2752{
2753 /*
2754 * Get the 16-bit length of the TNS message, including header
2755 */
2756 unsigned length = tvb_get_ntohs(tvb, offset);
2757 offset += 4;
2758 uint8_t type = tvb_get_uint8(tvb, offset);
2759 /* Type 0xf (data descriptor, LOB/FILE data) has data which follows
2760 * immediately (no new PDU header) but is not counted in the PDU
2761 * length field either.
2762 */
2763 if (type == TNS_TYPE_DD15) {
2764 offset += 8;
2765 if (!tvb_bytes_exist(tvb, offset, 4)) {
2766 /* return 0 makes tcp_dissect_pdus() report
2767 * DESEGMENT_ONE_MORE_SEGMENT to the TCP dissector.
2768 */
2769 return 0;
2770 }
2771 unsigned dd_len = tvb_get_ntohl(tvb, offset);
2772 return length + dd_len;
2773 }
2774 return length;
2775}
2776
2777static unsigned
2778get_tns_pdu_len_nochksum(packet_info *pinfo _U___attribute__((unused)), tvbuff_t *tvb, int offset, void *data _U___attribute__((unused)))
2779{
2780 /*
2781 * Get the 32-bit length of the TNS message, including header
2782 */
2783 unsigned length = tvb_get_ntohl(tvb, offset);
2784 offset += 4;
2785 uint8_t type = tvb_get_uint8(tvb, offset);
2786 /* Type 0xf (data descriptor, LOB/FILE data) has data which follows
2787 * immediately (no new PDU header) but is not counted in the PDU
2788 * length field either.
2789 */
2790 if (type == TNS_TYPE_DD15) {
2791 offset += 8;
2792 if (!tvb_bytes_exist(tvb, offset, 4)) {
2793 /* return 0 makes tcp_dissect_pdus() report
2794 * DESEGMENT_ONE_MORE_SEGMENT to the TCP dissector.
2795 */
2796 return 0;
2797 }
2798 unsigned dd_len = tvb_get_ntohl(tvb, offset);
2799 return length + dd_len;
2800 }
2801
2802 return length;
2803}
2804
2805static int
2806dissect_tns(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
2807{
2808 uint32_t length;
2809 uint16_t chksum;
2810 uint8_t type;
2811
2812 /*
2813 * First, do a sanity check to make sure what we have
2814 * starts with a TNS PDU.
2815 */
2816 if (tvb_bytes_exist(tvb, 4, 1)) {
2817 /*
2818 * Well, we have the packet type; let's make sure
2819 * it's a known type.
2820 */
2821 type = tvb_get_uint8(tvb, 4);
2822 if (type < TNS_TYPE_CONNECT1 || type > TNS_TYPE_MAX19)
2823 return 0; /* it's not a known type */
2824 }
2825
2826 /*
2827 * In some messages (observed in Oracle12c) packet length has 4 bytes
2828 * instead of 2.
2829 *
2830 * If packet length has 2 bytes, length and checksum equals two unsigned
2831 * 16-bit numbers. Packet checksum is generally unused (equal zero),
2832 * but 10g client may set 2nd byte to 4.
2833 *
2834 * Else, Oracle 12c combine these two 16-bit numbers into one 32-bit.
2835 * This number represents the packet length. Checksum is omitted.
2836 */
2837 chksum = tvb_get_ntohs(tvb, 2);
2838
2839 length = (chksum == 0 || chksum == 4) ? 2 : 4;
2840
2841 tcp_dissect_pdus(tvb, pinfo, tree, tns_desegment, TNS_HDR_LEN8,
2842 (length == 2 ? get_tns_pdu_len : get_tns_pdu_len_nochksum),
2843 dissect_tns_pdu, data);
2844
2845 return tvb_captured_length(tvb);
2846}
2847
2848static int
2849dissect_tns_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U___attribute__((unused)))
2850{
2851 proto_tree *tns_tree, *ti;
2852 proto_item *hidden_item;
2853 unsigned offset = 0;
2854 uint32_t length;
2855 uint16_t chksum;
2856 uint8_t type;
2857
2858 col_set_str(pinfo->cinfo, COL_PROTOCOL, "TNS");
2859
2860 col_set_str(pinfo->cinfo, COL_INFO,
2861 (pinfo->match_uint == pinfo->destport) ? "Request" : "Response");
2862
2863 ti = proto_tree_add_item(tree, proto_tns, tvb, 0, -1, ENC_NA0x00000000);
2864 tns_tree = proto_item_add_subtree(ti, ett_tns);
2865
2866 if (pinfo->match_uint == pinfo->destport)
2867 {
2868 hidden_item = proto_tree_add_boolean(tns_tree, hf_tns_request,
2869 tvb, offset, 0, true1);
2870 }
2871 else
2872 {
2873 hidden_item = proto_tree_add_boolean(tns_tree, hf_tns_response,
2874 tvb, offset, 0, true1);
2875 }
2876 proto_item_set_hidden(hidden_item);
2877
2878 chksum = tvb_get_ntohs(tvb, offset+2);
2879 if (chksum == 0 || chksum == 4)
2880 {
2881 proto_tree_add_item_ret_uint(tns_tree, hf_tns_length, tvb, offset,
2882 2, ENC_BIG_ENDIAN0x00000000, &length);
2883 offset += 2;
2884 proto_tree_add_checksum(tns_tree, tvb, offset, hf_tns_packet_checksum,
2885 -1, NULL((void*)0), pinfo, 0, ENC_BIG_ENDIAN0x00000000, PROTO_CHECKSUM_NO_FLAGS0x00);
2886 offset += 2;
2887 }
2888 else
2889 {
2890 /* Oracle 12c uses checksum bytes as part of the packet length. */
2891 proto_tree_add_item_ret_uint(tns_tree, hf_tns_length, tvb, offset,
2892 4, ENC_BIG_ENDIAN0x00000000, &length);
2893 offset += 4;
2894 }
2895
2896 type = tvb_get_uint8(tvb, offset);
2897 proto_tree_add_uint(tns_tree, hf_tns_packet_type, tvb,
2898 offset, 1, type);
2899 offset += 1;
2900
2901 col_append_fstr(pinfo->cinfo, COL_INFO, ", %s (%u)",
2902 val_to_str_const(type, tns_type_vals, "Unknown"), type);
2903
2904 proto_tree_add_item(tns_tree, hf_tns_reserved_byte, tvb,
2905 offset, 1, ENC_NA0x00000000);
2906 offset += 1;
2907
2908 proto_tree_add_checksum(tns_tree, tvb, offset, hf_tns_header_checksum, -1, NULL((void*)0), pinfo, 0, ENC_BIG_ENDIAN0x00000000, PROTO_CHECKSUM_NO_FLAGS0x00);
2909 offset += 2;
2910
2911 switch (type)
2912 {
2913 case TNS_TYPE_CONNECT1:
2914 dissect_tns_connect(tvb,offset,pinfo,tns_tree);
2915 break;
2916 case TNS_TYPE_ACCEPT2:
2917 dissect_tns_accept(tvb,offset,pinfo,tns_tree);
2918 break;
2919 case TNS_TYPE_REFUSE4:
2920 dissect_tns_refuse(tvb,offset,pinfo,tns_tree);
2921 break;
2922 case TNS_TYPE_REDIRECT5:
2923 dissect_tns_redirect(tvb,offset,pinfo,tns_tree);
2924 break;
2925 case TNS_TYPE_ABORT9:
2926 dissect_tns_abort(tvb,offset,pinfo,tns_tree);
2927 break;
2928 case TNS_TYPE_MARKER12:
2929 dissect_tns_marker(tvb,offset,pinfo,tns_tree, 0);
2930 break;
2931 case TNS_TYPE_ATTENTION13:
2932 dissect_tns_marker(tvb,offset,pinfo,tns_tree, 1);
2933 break;
2934 case TNS_TYPE_CONTROL14:
2935 dissect_tns_control(tvb,offset,pinfo,tns_tree);
2936 break;
2937 case TNS_TYPE_DATA6:
2938 dissect_tns_data(tvb,offset,pinfo,tns_tree);
2939 break;
2940 case TNS_TYPE_DD15:
2941 dissect_tns_data_descriptor(tvb,offset,pinfo,tns_tree, length);
2942 break;
2943 default:
2944 call_data_dissector(tvb_new_subset_remaining(tvb, offset), pinfo,
2945 tns_tree);
2946 break;
2947 }
2948
2949 return tvb_captured_length(tvb);
2950}
2951
2952void proto_register_tns(void)
2953{
2954 static hf_register_info hf[] = {
2955 { &hf_tns_response, {
2956 "Response", "tns.response", FT_BOOLEAN, BASE_NONE,
2957 NULL((void*)0), 0x0, "true if TNS response", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2958 { &hf_tns_request, {
2959 "Request", "tns.request", FT_BOOLEAN, BASE_NONE,
2960 NULL((void*)0), 0x0, "true if TNS request", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2961 { &hf_tns_length, {
2962 "Packet Length", "tns.length", FT_UINT32, BASE_DEC,
2963 NULL((void*)0), 0x0, "Length of TNS packet", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2964 { &hf_tns_packet_checksum, {
2965 "Packet Checksum", "tns.packet_checksum", FT_UINT16, BASE_HEX,
2966 NULL((void*)0), 0x0, "Checksum of Packet Data", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2967 { &hf_tns_header_checksum, {
2968 "Header Checksum", "tns.header_checksum", FT_UINT16, BASE_HEX,
2969 NULL((void*)0), 0x0, "Checksum of Header Data", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2970
2971 { &hf_tns_version, {
2972 "Version", "tns.version", FT_UINT16, BASE_DEC,
2973 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2974 { &hf_tns_compat_version, {
2975 "Version (Compatible)", "tns.compat_version", FT_UINT16, BASE_DEC,
2976 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2977
2978 { &hf_tns_service_options, {
2979 "Service Options", "tns.service_options", FT_UINT16, BASE_HEX,
2980 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2981
2982 { &hf_tns_sopt_flag_bconn, {
2983 "Broken Connect Notify", "tns.so_flag.bconn", FT_BOOLEAN, 16,
2984 NULL((void*)0), 0x2000, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2985 { &hf_tns_sopt_flag_pc, {
2986 "Packet Checksum", "tns.so_flag.pc", FT_BOOLEAN, 16,
2987 NULL((void*)0), 0x1000, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2988 { &hf_tns_sopt_flag_hc, {
2989 "Header Checksum", "tns.so_flag.hc", FT_BOOLEAN, 16,
2990 NULL((void*)0), 0x0800, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2991 { &hf_tns_sopt_flag_fd, {
2992 "Full Duplex", "tns.so_flag.fd", FT_BOOLEAN, 16,
2993 NULL((void*)0), 0x0400, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2994 { &hf_tns_sopt_flag_hd, {
2995 "Half Duplex", "tns.so_flag.hd", FT_BOOLEAN, 16,
2996 NULL((void*)0), 0x0200, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2997 { &hf_tns_sopt_flag_dc1, {
2998 "Don't Care", "tns.so_flag.dc1", FT_BOOLEAN, 16,
2999 NULL((void*)0), 0x0100, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3000 { &hf_tns_sopt_flag_dc2, {
3001 "Don't Care", "tns.so_flag.dc2", FT_BOOLEAN, 16,
3002 NULL((void*)0), 0x0080, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3003 { &hf_tns_sopt_flag_dio, {
3004 "Direct IO to Transport", "tns.so_flag.dio", FT_BOOLEAN, 16,
3005 NULL((void*)0), 0x0010, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3006 { &hf_tns_sopt_flag_ap, {
3007 "Attention Processing", "tns.so_flag.ap", FT_BOOLEAN, 16,
3008 NULL((void*)0), 0x0008, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3009 { &hf_tns_sopt_flag_ra, {
3010 "Can Receive Attention", "tns.so_flag.ra", FT_BOOLEAN, 16,
3011 NULL((void*)0), 0x0004, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3012 { &hf_tns_sopt_flag_sa, {
3013 "Can Send Attention", "tns.so_flag.sa", FT_BOOLEAN, 16,
3014 NULL((void*)0), 0x0002, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3015
3016
3017 { &hf_tns_sdu_size, {
3018 "Session Data Unit Size", "tns.sdu_size", FT_UINT16, BASE_DEC,
3019 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3020 { &hf_tns_max_tdu_size, {
3021 "Maximum Transmission Data Unit Size", "tns.max_tdu_size", FT_UINT16, BASE_DEC,
3022 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3023
3024 { &hf_tns_nt_proto_characteristics, {
3025 "NT Protocol Characteristics", "tns.nt_proto_characteristics", FT_UINT16, BASE_HEX,
3026 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3027 { &hf_tns_ntp_flag_hangon, {
3028 "Hangon to listener connect", "tns.ntp_flag.hangon", FT_BOOLEAN, 16,
3029 NULL((void*)0), 0x8000, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3030 { &hf_tns_ntp_flag_crel, {
3031 "Confirmed release", "tns.ntp_flag.crel", FT_BOOLEAN, 16,
3032 NULL((void*)0), 0x4000, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3033 { &hf_tns_ntp_flag_tduio, {
3034 "TDU based IO", "tns.ntp_flag.tduio", FT_BOOLEAN, 16,
3035 NULL((void*)0), 0x2000, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3036 { &hf_tns_ntp_flag_srun, {
3037 "Spawner running", "tns.ntp_flag.srun", FT_BOOLEAN, 16,
3038 NULL((void*)0), 0x1000, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3039 { &hf_tns_ntp_flag_dtest, {
3040 "Data test", "tns.ntp_flag.dtest", FT_BOOLEAN, 16,
3041 NULL((void*)0), 0x0800, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3042 { &hf_tns_ntp_flag_cbio, {
3043 "Callback IO supported", "tns.ntp_flag.cbio", FT_BOOLEAN, 16,
3044 NULL((void*)0), 0x0400, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3045 { &hf_tns_ntp_flag_asio, {
3046 "ASync IO Supported", "tns.ntp_flag.asio", FT_BOOLEAN, 16,
3047 NULL((void*)0), 0x0200, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3048 { &hf_tns_ntp_flag_pio, {
3049 "Packet oriented IO", "tns.ntp_flag.pio", FT_BOOLEAN, 16,
3050 NULL((void*)0), 0x0100, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3051 { &hf_tns_ntp_flag_grant, {
3052 "Can grant connection to another", "tns.ntp_flag.grant", FT_BOOLEAN, 16,
3053 NULL((void*)0), 0x0080, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3054 { &hf_tns_ntp_flag_handoff, {
3055 "Can handoff connection to another", "tns.ntp_flag.handoff", FT_BOOLEAN, 16,
3056 NULL((void*)0), 0x0040, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3057 { &hf_tns_ntp_flag_sigio, {
3058 "Generate SIGIO signal", "tns.ntp_flag.sigio", FT_BOOLEAN, 16,
3059 NULL((void*)0), 0x0020, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3060 { &hf_tns_ntp_flag_sigpipe, {
3061 "Generate SIGPIPE signal", "tns.ntp_flag.sigpipe", FT_BOOLEAN, 16,
3062 NULL((void*)0), 0x0010, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3063 { &hf_tns_ntp_flag_sigurg, {
3064 "Generate SIGURG signal", "tns.ntp_flag.sigurg", FT_BOOLEAN, 16,
3065 NULL((void*)0), 0x0008, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3066 { &hf_tns_ntp_flag_urgentio, {
3067 "Urgent IO supported", "tns.ntp_flag.urgentio", FT_BOOLEAN, 16,
3068 NULL((void*)0), 0x0004, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3069 { &hf_tns_ntp_flag_fdio, {
3070 "Full duplex IO supported", "tns.ntp_flag.dfio", FT_BOOLEAN, 16,
3071 NULL((void*)0), 0x0002, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3072 { &hf_tns_ntp_flag_testop, {
3073 "Test operation", "tns.ntp_flag.testop", FT_BOOLEAN, 16,
3074 NULL((void*)0), 0x0001, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3075
3076
3077
3078
3079 { &hf_tns_line_turnaround, {
3080 "Line Turnaround Value", "tns.line_turnaround", FT_UINT16, BASE_DEC,
3081 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3082 { &hf_tns_value_of_one, {
3083 "Value of 1 in Hardware", "tns.value_of_one", FT_BYTES, BASE_NONE,
3084 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3085
3086 { &hf_tns_connect_data_length, {
3087 "Length of Connect Data", "tns.connect_data_length", FT_UINT16,
3088 BASE_DEC|BASE_UNIT_STRING0x00001000, UNS(&units_byte_bytes)((0 ? (const struct unit_name_string*)0 : ((&units_byte_bytes
))))
, 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3089 { &hf_tns_connect_data_offset, {
3090 "Offset to Connect Data", "tns.connect_data_offset", FT_UINT16, BASE_DEC,
3091 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3092 { &hf_tns_connect_data_max, {
3093 "Maximum Receivable Connect Data", "tns.connect_data_max", FT_UINT32, BASE_DEC,
3094 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3095
3096 { &hf_tns_connect_flags0, {
3097 "Connect Flags 0", "tns.connect_flags0", FT_UINT8, BASE_HEX,
3098 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3099 { &hf_tns_connect_flags1, {
3100 "Connect Flags 1", "tns.connect_flags1", FT_UINT8, BASE_HEX,
3101 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3102
3103 { &hf_tns_conn_flag_nareq, {
3104 "NA services required", "tns.connect_flags.nareq", FT_BOOLEAN, 8,
3105 NULL((void*)0), 0x10, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3106 { &hf_tns_conn_flag_nalink, {
3107 "NA services linked in", "tns.connect_flags.nalink", FT_BOOLEAN, 8,
3108 NULL((void*)0), 0x08, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3109 { &hf_tns_conn_flag_enablena, {
3110 "NA services enabled", "tns.connect_flags.enablena", FT_BOOLEAN, 8,
3111 NULL((void*)0), 0x04, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3112 { &hf_tns_conn_flag_ichg, {
3113 "Interchange is involved", "tns.connect_flags.ichg", FT_BOOLEAN, 8,
3114 NULL((void*)0), 0x02, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3115 { &hf_tns_conn_flag_wantna, {
3116 "NA services wanted", "tns.connect_flags.wantna", FT_BOOLEAN, 8,
3117 NULL((void*)0), 0x01, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3118
3119
3120 { &hf_tns_trace_cf1, {
3121 "Trace Cross Facility Item 1", "tns.trace_cf1", FT_UINT32, BASE_HEX,
3122 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3123 { &hf_tns_trace_cf2, {
3124 "Trace Cross Facility Item 2", "tns.trace_cf2", FT_UINT32, BASE_HEX,
3125 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3126 { &hf_tns_trace_cid, {
3127 "Trace Unique Connection ID", "tns.trace_cid", FT_UINT64, BASE_HEX,
3128 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3129 { &hf_tns_connect_data, {
3130 "Connect Data", "tns.connect_data", FT_STRING, BASE_NONE,
3131 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3132
3133 { &hf_tns_accept_data_length, {
3134 "Accept Data Length", "tns.accept_data_length", FT_UINT16,
3135 BASE_DEC|BASE_UNIT_STRING0x00001000, UNS(&units_byte_bytes)((0 ? (const struct unit_name_string*)0 : ((&units_byte_bytes
))))
, 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3136 { &hf_tns_accept_data, {
3137 "Accept Data", "tns.accept_data", FT_STRING, BASE_NONE,
3138 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3139 { &hf_tns_accept_data_offset, {
3140 "Offset to Accept Data", "tns.accept_data_offset", FT_UINT16, BASE_DEC,
3141 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3142
3143 { &hf_tns_refuse_reason_user, {
3144 "Refuse Reason (User)", "tns.refuse_reason_user", FT_UINT8, BASE_HEX,
3145 NULL((void*)0), 0x0, "Refuse Reason from Application", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3146 { &hf_tns_refuse_reason_system, {
3147 "Refuse Reason (System)", "tns.refuse_reason_system", FT_UINT8, BASE_HEX,
3148 NULL((void*)0), 0x0, "Refuse Reason from System", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3149 { &hf_tns_refuse_data_length, {
3150 "Refuse Data Length", "tns.refuse_data_length", FT_UINT16,
3151 BASE_DEC|BASE_UNIT_STRING0x00001000, UNS(&units_byte_bytes)((0 ? (const struct unit_name_string*)0 : ((&units_byte_bytes
))))
, 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3152 { &hf_tns_refuse_data, {
3153 "Refuse Data", "tns.refuse_data", FT_STRING, BASE_NONE,
3154 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3155
3156 { &hf_tns_abort_reason_user, {
3157 "Abort Reason (User)", "tns.abort_reason_user", FT_UINT8, BASE_HEX,
3158 NULL((void*)0), 0x0, "Abort Reason from Application", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3159 { &hf_tns_abort_reason_system, {
3160 "Abort Reason (User)", "tns.abort_reason_system", FT_UINT8, BASE_HEX,
3161 NULL((void*)0), 0x0, "Abort Reason from System", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3162 { &hf_tns_abort_data, {
3163 "Abort Data", "tns.abort_data", FT_STRING, BASE_NONE,
3164 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3165
3166 { &hf_tns_marker_type, {
3167 "Marker Type", "tns.marker.type", FT_UINT8, BASE_HEX,
3168 VALS(tns_marker_types)((0 ? (const struct _value_string*)0 : ((tns_marker_types)))), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3169 { &hf_tns_marker_data_byte, {
3170 "Marker Data Byte", "tns.marker.databyte", FT_UINT8, BASE_HEX,
3171 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3172 { &hf_tns_marker_function, {
3173 "Marker Function", "tns.marker.function", FT_UINT8, BASE_DEC,
3174 VALS(tns_marker_functions)((0 ? (const struct _value_string*)0 : ((tns_marker_functions
))))
, 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3175#if 0
3176 { &hf_tns_marker_data, {
3177 "Marker Data", "tns.marker.data", FT_UINT16, BASE_HEX,
3178 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3179#endif
3180
3181 { &hf_tns_control_cmd, {
3182 "Control Command", "tns.control.cmd", FT_UINT16, BASE_HEX,
3183 VALS(tns_control_cmds)((0 ? (const struct _value_string*)0 : ((tns_control_cmds)))), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3184 { &hf_tns_control_data, {
3185 "Control Data", "tns.control.data", FT_BYTES, BASE_NONE,
3186 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3187
3188 { &hf_tns_redirect_data_length, {
3189 "Redirect Data Length", "tns.redirect_data_length", FT_UINT16,
3190 BASE_DEC|BASE_UNIT_STRING0x00001000, UNS(&units_byte_bytes)((0 ? (const struct unit_name_string*)0 : ((&units_byte_bytes
))))
, 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3191 { &hf_tns_redirect_data, {
3192 "Redirect Data", "tns.redirect_data", FT_STRING, BASE_NONE,
3193 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3194
3195 { &hf_tns_data_flag, {
3196 "Data Flag", "tns.data_flag", FT_UINT16, BASE_HEX,
3197 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3198 { &hf_tns_data_flag_send, {
3199 "Send Token", "tns.data_flag.send", FT_BOOLEAN, 16,
3200 NULL((void*)0), 0x1, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3201 { &hf_tns_data_flag_rc, {
3202 "Request Confirmation", "tns.data_flag.rc", FT_BOOLEAN, 16,
3203 NULL((void*)0), 0x2, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3204 { &hf_tns_data_flag_c, {
3205 "Confirmation", "tns.data_flag.c", FT_BOOLEAN, 16,
3206 NULL((void*)0), 0x4, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3207 { &hf_tns_data_flag_reserved, {
3208 "Reserved", "tns.data_flag.reserved", FT_BOOLEAN, 16,
3209 NULL((void*)0), 0x8, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3210 { &hf_tns_data_flag_more, {
3211 "More Data to Come", "tns.data_flag.more", FT_BOOLEAN, 16,
3212 NULL((void*)0), 0x0020, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3213 { &hf_tns_data_flag_eof, {
3214 "End of File", "tns.data_flag.eof", FT_BOOLEAN, 16,
3215 NULL((void*)0), 0x0040, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3216 { &hf_tns_data_flag_dic, {
3217 "Do Immediate Confirmation", "tns.data_flag.dic", FT_BOOLEAN, 16,
3218 NULL((void*)0), 0x0080, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3219 { &hf_tns_data_flag_rts, {
3220 "Request To Send", "tns.data_flag.rts", FT_BOOLEAN, 16,
3221 NULL((void*)0), 0x0100, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3222 { &hf_tns_data_flag_sntt, {
3223 "Send NT Trailer", "tns.data_flag.sntt", FT_BOOLEAN, 16,
3224 NULL((void*)0), 0x0200, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3225
3226 { &hf_tns_data_id, {
3227 "Data ID", "tns.data_id", FT_UINT32, BASE_HEX,
3228 VALS(tns_data_funcs)((0 ? (const struct _value_string*)0 : ((tns_data_funcs)))), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3229 { &hf_tns_data_length, {
3230 "Data Length", "tns.data_length", FT_UINT32,
3231 BASE_DEC|BASE_UNIT_STRING0x00001000, UNS(&units_byte_bytes)((0 ? (const struct unit_name_string*)0 : ((&units_byte_bytes
))))
, 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3232
3233 { &hf_tns_data_oci_id, {
3234 "Call ID", "tns.data_oci.id", FT_UINT8, BASE_HEX|BASE_EXT_STRING0x00000200,
3235 &tns_data_oci_subfuncs_ext, 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3236
3237 { &hf_tns_data_tseq, {
3238 "TSeq", "tns.data_tseq", FT_UINT8, BASE_HEX,
3239 NULL((void*)0), 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3240
3241 { &hf_tns_data_piggyback_id, {
3242 /* Also Call ID.
3243 Piggyback is a message what calls a small subset of functions
3244 declared in tns_data_oci_subfuncs. */
3245 "Call ID", "tns.data_piggyback.id", FT_UINT8, BASE_HEX|BASE_EXT_STRING0x00000200,
3246 &tns_data_oci_subfuncs_ext, 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3247
3248 { &hf_tns_data_unused, {
3249 "Unused", "tns.data.unused", FT_BYTES, BASE_NONE,
3250 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3251
3252 { &hf_tns_cursor, {
3253 "Cursor", "tns.data.cursor", FT_UINT32, BASE_DEC,
3254 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3255
3256 { &hf_tns_data_setp_acc_version, {
3257 "Accepted Version", "tns.data_setp_req.acc_vers", FT_UINT8, BASE_DEC,
3258 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3259 { &hf_tns_data_setp_cli_plat, {
3260 "Client Platform", "tns.data_setp_req.cli_plat", FT_STRINGZ, BASE_NONE,
3261 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3262 { &hf_tns_data_setp_version, {
3263 "Version", "tns.data_setp_resp.version", FT_UINT8, BASE_DEC,
3264 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3265 { &hf_tns_data_setp_banner, {
3266 "Server Banner", "tns.data_setp_resp.banner", FT_STRINGZ, BASE_NONE,
3267 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3268
3269 { &hf_tns_data_sns_cli_vers, {
3270 "Client Version", "tns.data_sns.cli_vers", FT_UINT32, BASE_CUSTOM,
3271 CF_FUNC(vsnum_to_vstext_basecustom)((const void *) (size_t) (vsnum_to_vstext_basecustom)), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3272 { &hf_tns_data_sns_srv_vers, {
3273 "Server Version", "tns.data_sns.srv_vers", FT_UINT32, BASE_CUSTOM,
3274 CF_FUNC(vsnum_to_vstext_basecustom)((const void *) (size_t) (vsnum_to_vstext_basecustom)), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3275 { &hf_tns_data_sns_srvcnt, {
3276 "Services", "tns.data_sns.srvcnt", FT_UINT16, BASE_DEC,
3277 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3278
3279 { &hf_tns_data_setdt_charset_in, {
3280 "Charset In", "tns.data_setdt.charset_in", FT_UINT16, BASE_DEC,
3281 VALS(tns_charsets)((0 ? (const struct _value_string*)0 : ((tns_charsets)))), 0x0, "NLS_LANGUAGE charset id", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3282 { &hf_tns_data_setdt_charset_out, {
3283 "Charset Out", "tns.data_setdt.charset_out", FT_UINT16, BASE_DEC,
3284 VALS(tns_charsets)((0 ? (const struct _value_string*)0 : ((tns_charsets)))), 0x0, "NLS_NCHAR charset id", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3285 { &hf_tns_data_setdt_flag, {
3286 "Flag", "tns.data_setdt.flag", FT_UINT8, BASE_HEX,
3287 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3288 { &hf_tns_data_setdt_caphdr, {
3289 "Capability Header", "tns.data_setdt.caphdr", FT_BYTES, BASE_NONE,
3290 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3291 { &hf_tns_data_setdt_caphdr_version, {
3292 "Version", "tns.data_setdt.caphdr.version", FT_UINT24, BASE_HEX,
3293 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3294 { &hf_tns_data_setdt_caphdr_flags, {
3295 "Flags", "tns.data_setdt.caphdr.flags", FT_BYTES, BASE_NONE,
3296 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3297 { &hf_tns_data_setdt_tblhdr, {
3298 "Table Header", "tns.data_setdt.tblhdr", FT_BYTES, BASE_NONE,
3299 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3300 { &hf_tns_data_setdt_idmap, {
3301 "Identity Map", "tns.data_setdt.idmap", FT_BYTES, BASE_NONE,
3302 NULL((void*)0), 0x0, "245 entries: type N -> repr N (default mapping)", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3303 { &hf_tns_data_setdt_overrides, {
3304 "Type Overrides", "tns.data_setdt.overrides", FT_NONE, BASE_NONE,
3305 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3306 { &hf_tns_data_setdt_override_client, {
3307 "Client Type", "tns.data_setdt.override.client", FT_UINT8, BASE_DEC,
3308 VALS(tns_data_types)((0 ? (const struct _value_string*)0 : ((tns_data_types)))), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3309 { &hf_tns_data_setdt_override_repr, {
3310 "Server Repr", "tns.data_setdt.override.repr", FT_UINT8, BASE_DEC,
3311 VALS(tns_data_types)((0 ? (const struct _value_string*)0 : ((tns_data_types)))), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3312 { &hf_tns_data_setdt_override_format, {
3313 "Format", "tns.data_setdt.override.format", FT_UINT8, BASE_DEC,
3314 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3315
3316 { &hf_tns_data_sta_call_status, {
3317 "Call Status", "tns.data_sta.call_status", FT_UINT32, BASE_HEX,
3318 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3319 { &hf_tns_data_sta_seq, {
3320 "End-to-End Sequence", "tns.data_sta.seq", FT_UINT16, BASE_DEC,
3321 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3322 { &hf_tns_data_call_status_txn, {
3323 "Transaction in progress", "tns.data.call_status.txn_in_progress", FT_BOOLEAN, 32,
3324 NULL((void*)0), TNS_CALL_STATUS_TXN_IN_PROGRESS0x00000002, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3325 { &hf_tns_data_call_status_sess_release, {
3326 "Session release", "tns.data.call_status.sess_release", FT_BOOLEAN, 32,
3327 NULL((void*)0), TNS_CALL_STATUS_SESS_RELEASE0x00008000, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3328 { &hf_tns_data_oer_call_status, {
3329 "Call Status", "tns.data_oer.call_status", FT_INT32, BASE_DEC,
3330 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3331 { &hf_tns_data_oer_rowcount, {
3332 "Row Count", "tns.data_oer.rowcount", FT_INT32, BASE_DEC,
3333 NULL((void*)0), 0x0, "DML affected rows (11g)", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3334 { &hf_tns_data_oer_err_code, {
3335 "Error Code", "tns.data_oer.err_code", FT_INT32, BASE_DEC,
3336 NULL((void*)0), 0x0, "ORA-NNNNN (0 = success)", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3337 { &hf_tns_data_oer_cursor_id, {
3338 "Cursor Id", "tns.data_oer.cursor_id", FT_INT32, BASE_DEC,
3339 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3340 { &hf_tns_data_oer_n_batch_errcodes, {
3341 "Batch Error Codes", "tns.data_oer.n_batch_errcodes", FT_INT32, BASE_DEC,
3342 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3343 { &hf_tns_data_oer_n_batch_offsets, {
3344 "Batch Error Offsets", "tns.data_oer.n_batch_offsets", FT_INT32, BASE_DEC,
3345 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3346 { &hf_tns_data_oer_n_batch_messages, {
3347 "Batch Error Messages", "tns.data_oer.n_batch_messages", FT_INT32, BASE_DEC,
3348 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3349 { &hf_tns_data_oer_message, {
3350 "Message", "tns.data_oer.message", FT_STRING, BASE_NONE,
3351 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3352
3353 { &hf_tns_data_opi_version2_banner_len, {
3354 "Banner Length", "tns.data_opi.vers2.banner_len", FT_UINT8, BASE_DEC,
3355 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3356 { &hf_tns_data_opi_version2_banner, {
3357 "Banner", "tns.data_opi.vers2.banner", FT_STRING, BASE_NONE,
3358 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3359 { &hf_tns_data_opi_version2_vsnum, {
3360 "Version", "tns.data_opi.vers2.version", FT_UINT32, BASE_CUSTOM,
3361 CF_FUNC(vsnum_to_vstext_basecustom)((const void *) (size_t) (vsnum_to_vstext_basecustom)), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3362
3363 { &hf_tns_data_opi_num_of_params, {
3364 "Number of parameters", "tns.data_opi.num_of_params", FT_UINT8, BASE_DEC,
3365 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3366 { &hf_tns_data_opi_param_length, {
3367 "Length", "tns.data_opi.param_length", FT_UINT8, BASE_DEC,
3368 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3369 { &hf_tns_data_opi_param_name, {
3370 "Name", "tns.data_opi.param_name", FT_STRING, BASE_NONE,
3371 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3372 { &hf_tns_data_opi_param_value, {
3373 "Value", "tns.data_opi.param_value", FT_STRING, BASE_NONE,
3374 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3375
3376 { &hf_tns_data_iov_num_binds, {
3377 "Number of Binds", "tns.data_iov.num_binds", FT_UINT32, BASE_DEC,
3378 NULL((void*)0), 0x0, "num_iters * 256 + num_requests", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3379 { &hf_tns_data_iov_bind_dir, {
3380 "Bind Direction", "tns.data_iov.bind_dir", FT_UINT8, BASE_DEC,
3381 VALS(tns_iov_bind_dirs)((0 ? (const struct _value_string*)0 : ((tns_iov_bind_dirs)))
)
, 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3382
3383 { &hf_tns_data_dcb_num_columns, {
3384 "Number of Columns", "tns.data_dcb.num_columns", FT_UINT32, BASE_DEC,
3385 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3386 { &hf_tns_data_col_type, {
3387 "Data Type", "tns.data_col.type", FT_UINT8, BASE_DEC,
3388 VALS(tns_data_types)((0 ? (const struct _value_string*)0 : ((tns_data_types)))), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3389 { &hf_tns_data_col_precision, {
3390 "Precision", "tns.data_col.precision", FT_UINT8, BASE_DEC,
3391 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3392 { &hf_tns_data_col_scale, {
3393 "Scale", "tns.data_col.scale", FT_INT32, BASE_DEC,
3394 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3395 { &hf_tns_data_col_max_length, {
3396 "Max Data Length", "tns.data_col.max_length", FT_UINT32, BASE_DEC,
3397 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3398 { &hf_tns_data_col_charset, {
3399 "Charset", "tns.data_col.charset", FT_UINT32, BASE_DEC,
3400 VALS(tns_charsets)((0 ? (const struct _value_string*)0 : ((tns_charsets)))), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3401 { &hf_tns_data_col_csform, {
3402 "Charset Form", "tns.data_col.csform", FT_UINT8, BASE_DEC,
3403 VALS(tns_csform_vals)((0 ? (const struct _value_string*)0 : ((tns_csform_vals)))), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3404 { &hf_tns_data_col_max_size, {
3405 "Max Size", "tns.data_col.max_size", FT_UINT32, BASE_DEC,
3406 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3407 { &hf_tns_data_col_nulls_ok, {
3408 "Nulls Allowed", "tns.data_col.nulls_ok", FT_UINT8, BASE_DEC,
3409 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3410 { &hf_tns_data_col_name, {
3411 "Column Name", "tns.data_col.name", FT_STRING, BASE_NONE,
3412 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3413
3414 { &hf_tns_data_rxh_num_requests, {
3415 "Number of Requests", "tns.data_rxh.num_requests", FT_UINT32, BASE_DEC,
3416 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3417 { &hf_tns_data_rxh_iter_num, {
3418 "Iteration Number", "tns.data_rxh.iter_num", FT_UINT32, BASE_DEC,
3419 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3420 { &hf_tns_data_rxh_num_iters, {
3421 "Number of Iterations", "tns.data_rxh.num_iters", FT_UINT32, BASE_DEC,
3422 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3423
3424 { &hf_tns_data_all8_options, {
3425 "Options", "tns.data_all8.options", FT_UINT32, BASE_HEX,
3426 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3427 { &hf_tns_data_all8_opt_parse, {
3428 "Parse", "tns.data_all8.options.parse", FT_BOOLEAN, 32,
3429 NULL((void*)0), 0x0001, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3430 { &hf_tns_data_all8_opt_bind, {
3431 "Bind Values Present", "tns.data_all8.options.bind", FT_BOOLEAN, 32,
3432 NULL((void*)0), 0x0008, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3433 { &hf_tns_data_all8_opt_define, {
3434 "Define Columns Present", "tns.data_all8.options.define", FT_BOOLEAN, 32,
3435 NULL((void*)0), 0x0010, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3436 { &hf_tns_data_all8_opt_execute, {
3437 "Execute", "tns.data_all8.options.execute", FT_BOOLEAN, 32,
3438 NULL((void*)0), 0x0020, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3439 { &hf_tns_data_all8_opt_commit, {
3440 "Autocommit", "tns.data_all8.options.commit", FT_BOOLEAN, 32,
3441 NULL((void*)0), 0x0100, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3442 { &hf_tns_data_all8_opt_plsql, {
3443 "PL/SQL Block", "tns.data_all8.options.plsql", FT_BOOLEAN, 32,
3444 NULL((void*)0), 0x0400, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3445 { &hf_tns_data_all8_opt_fetch, {
3446 "Fetch", "tns.data_all8.options.fetch", FT_BOOLEAN, 32,
3447 NULL((void*)0), 0x8000, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3448 { &hf_tns_data_all8_fetch_rows, {
3449 "Fetch Rows", "tns.data_all8.fetch_rows", FT_UINT32, BASE_DEC,
3450 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3451 { &hf_tns_data_all8_bind_count, {
3452 "Bind Count", "tns.data_all8.bind_count", FT_UINT32, BASE_DEC,
3453 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3454 { &hf_tns_data_all8_sql, {
3455 "SQL Text", "tns.data_all8.sql", FT_STRING, BASE_NONE,
3456 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3457 { &hf_tns_data_bind_value, {
3458 "Bind Value", "tns.data_bind.value", FT_BYTES, BASE_NONE,
3459 NULL((void*)0), 0x0, "Raw type-encoded bind value", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3460 { &hf_tns_data_fetch_rows, {
3461 "Rows to Fetch", "tns.data_fetch.rows", FT_UINT32, BASE_DEC,
3462 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3463 { &hf_tns_data_lob_op, {
3464 "LOB Operation", "tns.data_lob.op", FT_UINT32, BASE_HEX,
3465 VALS(tns_lob_ops)((0 ? (const struct _value_string*)0 : ((tns_lob_ops)))), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3466 { &hf_tns_data_lob_offset, {
3467 "Source Offset", "tns.data_lob.offset", FT_UINT32, BASE_DEC,
3468 NULL((void*)0), 0x0, "1-based offset into the LOB", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3469 { &hf_tns_data_col_value, {
3470 "Column Value", "tns.data_col.value", FT_BYTES, BASE_NONE,
3471 NULL((void*)0), 0x0, "Raw type-encoded row column value", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3472
3473 { &hf_tns_data_descriptor_row_count, {
3474 "Row Count", "tns.data_descriptor.row_count", FT_UINT32, BASE_DEC,
3475 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3476 { &hf_tns_data_descriptor_row_size, {
3477 "Row Size", "tns.data_descriptor.row_size", FT_UINT32, BASE_DEC,
3478 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3479
3480 { &hf_tns_reserved_byte, {
3481 "Reserved Byte", "tns.reserved_byte", FT_BYTES, BASE_NONE,
3482 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3483 { &hf_tns_packet_type, {
3484 "Packet Type", "tns.type", FT_UINT8, BASE_DEC,
3485 VALS(tns_type_vals)((0 ? (const struct _value_string*)0 : ((tns_type_vals)))), 0x0, "Type of TNS packet", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }}
3486
3487 };
3488
3489 static int *ett[] = {
3490 &ett_tns,
3491 &ett_tns_connect,
3492 &ett_tns_accept,
3493 &ett_tns_refuse,
3494 &ett_tns_abort,
3495 &ett_tns_redirect,
3496 &ett_tns_marker,
3497 &ett_tns_attention,
3498 &ett_tns_control,
3499 &ett_tns_data,
3500 &ett_tns_data_flag,
3501 &ett_tns_acc_versions,
3502 &ett_tns_opi_params,
3503 &ett_tns_opi_par,
3504 &ett_tns_sopt_flag,
3505 &ett_tns_ntp_flag,
3506 &ett_tns_conn_flag,
3507 &ett_tns_rows,
3508 &ett_tns_setdt_caphdr,
3509 &ett_tns_setdt_overrides,
3510 &ett_tns_setdt_override,
3511 &ett_tns_oer,
3512 &ett_tns_call_status,
3513 &ett_tns_iov,
3514 &ett_tns_dcb_col,
3515 &ett_tns_all8_options,
3516 &ett_tns_binds,
3517 &ett_tns_bind,
3518 &ett_tns_bind_row,
3519 &ett_tns_rxd_row,
3520 &ett_sql
3521 };
3522
3523 static ei_register_info ei[] = {
3524 { &ei_tns_connect_data_next_packet, { "tns.connect_data.next_packet", PI_REQUEST_CODE0x04000000, PI_CHAT0x00200000, "Long Connect Data (> 221 bytes) carried in subsequent Data packet", EXPFILL0, ((void*)0), 0, ((void*)0), {0, {((void*)0), ((void*)0), FT_NONE
, BASE_NONE, ((void*)0), 0, ((void*)0), -1, 0, HF_REF_TYPE_NONE
, -1, ((void*)0)}}
}},
3525 { &ei_tns_data_descriptor_size_mismatch, { "tns.data_descriptor.size_mismatch", PI_PROTOCOL0x09000000, PI_WARN0x00600000, "Data size from summing row sizes differs from size in descriptor", EXPFILL0, ((void*)0), 0, ((void*)0), {0, {((void*)0), ((void*)0), FT_NONE
, BASE_NONE, ((void*)0), 0, ((void*)0), -1, 0, HF_REF_TYPE_NONE
, -1, ((void*)0)}}
}},
3526 { &ei_tns_data_piggyback_cursors, { "tns.data.piggyback.cursors.invalid", PI_MALFORMED0x07000000, PI_ERROR0x00800000, "Cursor count is larger than the data left in the packet", EXPFILL0, ((void*)0), 0, ((void*)0), {0, {((void*)0), ((void*)0), FT_NONE
, BASE_NONE, ((void*)0), 0, ((void*)0), -1, 0, HF_REF_TYPE_NONE
, -1, ((void*)0)}}
}},
3527 { &ei_tns_data_count_too_large, { "tns.data.count.invalid", PI_MALFORMED0x07000000, PI_ERROR0x00800000, "Count is larger than the data left in the packet", EXPFILL0, ((void*)0), 0, ((void*)0), {0, {((void*)0), ((void*)0), FT_NONE
, BASE_NONE, ((void*)0), 0, ((void*)0), -1, 0, HF_REF_TYPE_NONE
, -1, ((void*)0)}}
}},
3528 };
3529
3530 module_t *tns_module;
3531 expert_module_t* expert_tns;
3532
3533 proto_tns = proto_register_protocol("Transparent Network Substrate Protocol", "TNS", "tns");
3534 proto_register_field_array(proto_tns, hf, array_length(hf)(sizeof (hf) / sizeof (hf)[0]));
3535 proto_register_subtree_array(ett, array_length(ett)(sizeof (ett) / sizeof (ett)[0]));
3536 expert_tns = expert_register_protocol(proto_tns);
3537 expert_register_field_array(expert_tns, ei, array_length(ei)(sizeof (ei) / sizeof (ei)[0]));
3538 tns_handle = register_dissector("tns", dissect_tns, proto_tns);
3539
3540 tns_module = prefs_register_protocol(proto_tns, NULL((void*)0));
3541 prefs_register_bool_preference(tns_module, "desegment_tns_messages",
3542 "Reassemble TNS messages spanning multiple TCP segments",
3543 "Whether the TNS dissector should reassemble messages spanning multiple TCP segments. "
3544 "To use this option, you must also enable \"Allow subdissectors to reassemble TCP streams\" in the TCP protocol settings.",
3545 &tns_desegment);
3546}
3547
3548void
3549proto_reg_handoff_tns(void)
3550{
3551 dissector_add_uint_with_preference("tcp.port", TCP_PORT_TNS1521, tns_handle);
3552}
3553
3554/*
3555 * Editor modelines - https://www.wireshark.org/tools/modelines.html
3556 *
3557 * Local variables:
3558 * c-basic-offset: 8
3559 * tab-width: 8
3560 * indent-tabs-mode: t
3561 * End:
3562 *
3563 * vi: set shiftwidth=8 tabstop=8 noexpandtab:
3564 * :indentSize=8:tabSize=8:noTabs=false:
3565 */