Bug Summary

File:builds/wireshark/wireshark/epan/dissectors/packet-tns.c
Warning:line 1573, 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-13-100354-3663-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#include <epan/charsets.h>
24
25#include <wsutil/array.h>
26#include <wsutil/pint.h>
27
28void proto_register_tns(void);
29
30#define TNS_HDR_LEN8 8
31
32/* Packet Types */
33#define TNS_TYPE_CONNECT1 1
34#define TNS_TYPE_ACCEPT2 2
35#define TNS_TYPE_ACK3 3
36#define TNS_TYPE_REFUSE4 4
37#define TNS_TYPE_REDIRECT5 5
38#define TNS_TYPE_DATA6 6
39#define TNS_TYPE_NULL7 7
40#define TNS_TYPE_ABORT9 9
41#define TNS_TYPE_RESEND11 11
42#define TNS_TYPE_MARKER12 12
43#define TNS_TYPE_ATTENTION13 13
44#define TNS_TYPE_CONTROL14 14
45#define TNS_TYPE_DD15 15
46#define TNS_TYPE_MAX19 19
47
48/*
49 * Oracle datatype codes as they appear on the wire and in tns_data_types[].
50 * python-oracledb lists most of these as its ORA_TYPE_NUM_* constants.
51 */
52#define TNS_DATATYPE_VARCHAR1 1
53#define TNS_DATATYPE_NUMBER2 2
54#define TNS_DATATYPE_INTEGER3 3 /* BINARY_INTEGER */
55#define TNS_DATATYPE_FLOAT4 4
56#define TNS_DATATYPE_STRING5 5
57#define TNS_DATATYPE_VARNUM6 6
58#define TNS_DATATYPE_DECIMAL7 7
59#define TNS_DATATYPE_LONG8 8
60#define TNS_DATATYPE_VCS9 9
61#define TNS_DATATYPE_ROWID11 11 /* RID */
62#define TNS_DATATYPE_DATE12 12
63#define TNS_DATATYPE_VBI15 15
64#define TNS_DATATYPE_RAW23 23
65#define TNS_DATATYPE_LONG_RAW24 24
66#define TNS_DATATYPE_CHAR96 96
67#define TNS_DATATYPE_BINARY_FLOAT100 100
68#define TNS_DATATYPE_BINARY_DOUBLE101 101
69#define TNS_DATATYPE_REFCURSOR102 102
70#define TNS_DATATYPE_ROWID_EXT104 104 /* ROWID */
71#define TNS_DATATYPE_ADT109 109 /* object */
72#define TNS_DATATYPE_REF111 111
73#define TNS_DATATYPE_CLOB112 112
74#define TNS_DATATYPE_BLOB113 113
75#define TNS_DATATYPE_BFILE114 114
76#define TNS_DATATYPE_RSET116 116
77#define TNS_DATATYPE_JSON119 119 /* OSON */
78#define TNS_DATATYPE_VECTOR127 127
79#define TNS_DATATYPE_TIMESTAMP180 180
80#define TNS_DATATYPE_TIMESTAMP_TZ181 181
81#define TNS_DATATYPE_INTERVAL_YM182 182
82#define TNS_DATATYPE_INTERVAL_DS183 183
83#define TNS_DATATYPE_UROWID208 208
84#define TNS_DATATYPE_TIMESTAMP_LTZ231 231
85#define TNS_DATATYPE_BOOLEAN252 252
86
87/* DALC length byte marking a slot with no value (see get_dalc_custom). */
88#define TNS_DALC_ABSENT0xFD 0xFD
89
90/* TTC field versions (compile capability 7), as python-oracledb's
91 * TNS_CCAP_FIELD_VERSION_* name them. The wire shape of several messages
92 * depends on the one a connection negotiates. */
93#define TNS_CCAP_FIELD_VERSION7 7
94#define TNS_FV_11_26 6
95#define TNS_FV_12_17 7
96#define TNS_FV_12_28 8
97#define TNS_FV_12_2_EXT19 9
98#define TNS_FV_18_110 10
99#define TNS_FV_18_1_EXT_111 11
100#define TNS_FV_19_112 12
101#define TNS_FV_19_1_EXT_113 13
102#define TNS_FV_20_114 14
103#define TNS_FV_20_1_EXT_115 15
104#define TNS_FV_21_116 16
105#define TNS_FV_23_117 17
106#define TNS_FV_23_1_EXT_118 18
107#define TNS_FV_23_1_EXT_219 19
108#define TNS_FV_23_1_EXT_320 20
109#define TNS_FV_23_1_EXT_421 21
110#define TNS_FV_23_1_EXT_522 22
111#define TNS_FV_23_3_EXT_623 23
112#define TNS_FV_23_424 24
113
114/* Data Packet Functions */
115#define SQLNET_SET_PROTOCOL1 1
116#define SQLNET_SET_DATATYPES2 2
117#define SQLNET_USER_OCI_FUNC3 3
118#define SQLNET_RETURN_STATUS4 4
119#define SQLNET_ACCESS_USR_ADDR5 5
120#define SQLNET_ROW_TRANSF_HDR6 6
121#define SQLNET_ROW_TRANSF_DATA7 7
122#define SQLNET_RETURN_OPI_PARAM8 8
123#define SQLNET_FUNCCOMPLETE9 9
124#define SQLNET_NERROR_RET_DEF10 10
125#define SQLNET_IOVEC_4FAST_UPI11 11
126#define SQLNET_LONG_4FAST_UPI12 12
127#define SQLNET_INVOKE_USER_CB13 13
128#define SQLNET_LOB_FILE_DF14 14
129#define SQLNET_WARNING15 15
130#define SQLNET_DESCRIBE_INFO16 16
131#define SQLNET_PIGGYBACK_FUNC17 17
132#define SQLNET_SIG_4UCS18 18
133#define SQLNET_FLUSH_BIND_DATA19 19
134#define SQLNET_BIT_VECTOR21 21
135#define SQLNET_SERVER_PIGGYBACK23 23
136#define SQLNET_IMPLICIT_RESULTS27 27
137#define SQLNET_END_OF_RESPONSE29 29
138#define SQLNET_TOKEN33 33
139#define SQLNET_FAST_AUTH34 34
140#define SQLNET_SNS0xdeadbeef 0xdeadbeef
141#define SQLNET_XTRN_PROCSERV_R132 32
142#define SQLNET_XTRN_PROCSERV_R268 68
143
144/* Return OPI Parameter's Type */
145#define OPI_VERSION21 1
146#define OPI_OSESSKEY2 2
147#define OPI_OAUTH3 3
148
149/* An OCI client's execute preamble: offsets from the TTI_FUN byte, and
150 * the 8-byte pointer indicator its fixed slots sit between. */
151#define TNS_OCI_INDICATOR0xfeffffffffffffffUL UINT64_C(0xfeffffffffffffff)0xfeffffffffffffffUL
152#define TNS_OCI_ALL8_CURSOR7 7
153#define TNS_OCI_ALL8_IND11 11
154#define TNS_OCI_ALL8_SQLLEN319 19
155#define TNS_OCI_ALL8_IND2_NARROW23 23
156#define TNS_OCI_ALL8_IND2_WIDE27 27
157
158/* An OCI client's object-type describe (TTI_KOD): the opcodes of its
159 * request, where the request's name or REF sits from the TTI_FUN byte,
160 * the kinds of message in its reply, and the last byte of SYS.KOTTD's
161 * id, the type a type descriptor is an instance of. */
162#define TNS_KOD_BY_NAME3 3
163#define TNS_KOD_BY_REF4 4
164#define TNS_KOD_FRAME99 99
165#define TNS_KOD_RECORD1 1
166#define TNS_KOD_HEADER2 2
167#define TNS_KOD_KOTTD1 1
168
169/* OCI function ids (TTI_FUN sub-functions). */
170#define TTI_REEXECUTE4 4
171#define TTI_FETCH5 5
172#define TTI_REEXECUTE_AND_FETCH78 78
173#define TTI_KOD92 92
174#define TTI_ALL894 94
175#define TTI_LOBOPS96 96
176#define TTI_AQ_ENQUEUE121 121
177#define TTI_AQ_DEQUEUE122 122
178#define TTI_AQ_ARRAY145 145
179#define TTI_TPC_TXN_SWITCH103 103
180#define TTI_TPC_TXN_CHANGE_STATE104 104
181#define TTI_CLOSE_CURSORS105 105
182#define TTI_SET_END_TO_END_ATTR135 135
183#define TTI_SET_SCHEMA152 152
184#define TTI_APP_CONTEXT154 154
185#define TTI_SESSION_RELEASE163 163
186#define TTI_SESSION_STATE176 176
187#define TTI_PIPELINE_BEGIN199 199
188#define TTI_PIPELINE_END200 200
189#define TTI_END_USER_SEC_CTX205 205
190
191/* desegmentation of TNS over TCP */
192static bool_Bool tns_desegment = true1;
193
194static dissector_handle_t tns_handle;
195
196static int proto_tns;
197static int hf_tns_request;
198static int hf_tns_response;
199static int hf_tns_length;
200static int hf_tns_packet_checksum;
201static int hf_tns_header_checksum;
202static int hf_tns_packet_type;
203static int hf_tns_reserved_byte;
204static int hf_tns_version;
205static int hf_tns_compat_version;
206
207static int hf_tns_service_options;
208static int hf_tns_sopt_flag_bconn;
209static int hf_tns_sopt_flag_pc;
210static int hf_tns_sopt_flag_hc;
211static int hf_tns_sopt_flag_fd;
212static int hf_tns_sopt_flag_hd;
213static int hf_tns_sopt_flag_dc1;
214static int hf_tns_sopt_flag_dc2;
215static int hf_tns_sopt_flag_dio;
216static int hf_tns_sopt_flag_ap;
217static int hf_tns_sopt_flag_ra;
218static int hf_tns_sopt_flag_sa;
219
220static int hf_tns_sdu_size;
221static int hf_tns_max_tdu_size;
222
223static int hf_tns_nt_proto_characteristics;
224static int hf_tns_ntp_flag_hangon;
225static int hf_tns_ntp_flag_crel;
226static int hf_tns_ntp_flag_tduio;
227static int hf_tns_ntp_flag_srun;
228static int hf_tns_ntp_flag_dtest;
229static int hf_tns_ntp_flag_cbio;
230static int hf_tns_ntp_flag_asio;
231static int hf_tns_ntp_flag_pio;
232static int hf_tns_ntp_flag_grant;
233static int hf_tns_ntp_flag_handoff;
234static int hf_tns_ntp_flag_sigio;
235static int hf_tns_ntp_flag_sigpipe;
236static int hf_tns_ntp_flag_sigurg;
237static int hf_tns_ntp_flag_urgentio;
238static int hf_tns_ntp_flag_fdio;
239static int hf_tns_ntp_flag_testop;
240
241static int hf_tns_line_turnaround;
242static int hf_tns_value_of_one;
243static int hf_tns_connect_data_length;
244static int hf_tns_connect_data_offset;
245static int hf_tns_connect_data_max;
246
247static int hf_tns_connect_flags0;
248static int hf_tns_connect_flags1;
249static int hf_tns_conn_flag_nareq;
250static int hf_tns_conn_flag_nalink;
251static int hf_tns_conn_flag_enablena;
252static int hf_tns_conn_flag_ichg;
253static int hf_tns_conn_flag_wantna;
254
255static int hf_tns_connect_data;
256static int hf_tns_trace_cf1;
257static int hf_tns_trace_cf2;
258static int hf_tns_trace_cid;
259
260static int hf_tns_accept_data_length;
261static int hf_tns_accept_data_offset;
262static int hf_tns_accept_sdu;
263static int hf_tns_accept_flags2;
264static int hf_tns_accept_flags2_check_oob;
265static int hf_tns_accept_flags2_end_of_response;
266static int hf_tns_accept_flags2_fast_auth;
267static int hf_tns_accept_data;
268
269static int hf_tns_refuse_reason_user;
270static int hf_tns_refuse_reason_system;
271static int hf_tns_refuse_data_length;
272static int hf_tns_refuse_data;
273
274static int hf_tns_abort_reason_user;
275static int hf_tns_abort_reason_system;
276static int hf_tns_abort_data;
277
278static int hf_tns_marker_type;
279static int hf_tns_marker_data_byte;
280static int hf_tns_marker_function;
281/* static int hf_tns_marker_data; */
282
283static int hf_tns_redirect_data_length;
284static int hf_tns_redirect_data;
285
286static int hf_tns_control_cmd;
287static int hf_tns_control_data;
288
289static int hf_tns_data_flag;
290static int hf_tns_data_flag_send;
291static int hf_tns_data_flag_rc;
292static int hf_tns_data_flag_c;
293static int hf_tns_data_flag_reserved;
294static int hf_tns_data_flag_more;
295static int hf_tns_data_flag_eof;
296static int hf_tns_data_flag_dic;
297static int hf_tns_data_flag_rts;
298static int hf_tns_data_flag_sntt;
299static int hf_tns_data_flag_end_of_request;
300static int hf_tns_data_flag_begin_pipeline;
301static int hf_tns_data_flag_end_of_response;
302
303static int hf_tns_data_id;
304static int hf_tns_data_length;
305static int hf_tns_data_oci_id;
306static int hf_tns_data_tseq;
307static int hf_tns_data_token;
308static int hf_tns_data_piggyback_id;
309static int hf_tns_data_unused;
310
311static int hf_tns_cursor;
312
313static int hf_tns_data_opi_version2_banner_len;
314static int hf_tns_data_opi_version2_banner;
315static int hf_tns_data_opi_version2_vsnum;
316
317static int hf_tns_data_opi_num_of_params;
318static int hf_tns_data_opi_param_length;
319static int hf_tns_data_opi_param_name;
320static int hf_tns_data_opi_param_value;
321static int hf_tns_data_auth_mode;
322static int hf_tns_data_auth_mode_logon;
323static int hf_tns_data_auth_mode_change_password;
324static int hf_tns_data_auth_mode_sysdba;
325static int hf_tns_data_auth_mode_sysoper;
326static int hf_tns_data_auth_mode_with_password;
327static int hf_tns_data_auth_user;
328
329static int hf_tns_data_setp_acc_version;
330static int hf_tns_data_setp_cli_plat;
331static int hf_tns_data_fastauth_version;
332static int hf_tns_data_setp_version;
333static int hf_tns_data_setp_banner;
334static int hf_tns_data_setp_charset;
335static int hf_tns_data_setp_flags;
336static int hf_tns_data_setp_ncharset;
337static int hf_tns_data_setp_compile_caps;
338static int hf_tns_data_setp_runtime_caps;
339static int hf_tns_data_setp_field_version;
340
341static int hf_tns_data_sns_cli_vers;
342static int hf_tns_data_sns_srv_vers;
343static int hf_tns_data_sns_srvcnt;
344static int hf_tns_data_sns_error;
345static int hf_tns_data_sns_service;
346static int hf_tns_data_sns_subpackets;
347static int hf_tns_data_sns_svc_error;
348static int hf_tns_data_sns_sub_type;
349static int hf_tns_data_sns_sub_data;
350static int hf_tns_data_sns_version;
351static int hf_tns_data_sns_encryption;
352static int hf_tns_data_sns_integrity;
353
354static int hf_tns_data_setdt_charset_in;
355static int hf_tns_data_setdt_charset_out;
356static int hf_tns_data_setdt_flag;
357static int hf_tns_data_setdt_caphdr;
358static int hf_tns_data_setdt_caphdr_version;
359static int hf_tns_data_setdt_caphdr_flags;
360static int hf_tns_data_setdt_field_version;
361static int hf_tns_data_setdt_type;
362static int hf_tns_data_setdt_conv_type;
363static int hf_tns_data_setdt_rep;
364static int hf_tns_data_field_version;
365static int hf_tns_data_setdt_tblhdr;
366static int hf_tns_data_setdt_idmap;
367static int hf_tns_data_setdt_overrides;
368static int hf_tns_data_setdt_override_client;
369static int hf_tns_data_setdt_override_repr;
370static int hf_tns_data_setdt_override_format;
371
372static int hf_tns_data_oer_call_status;
373static int hf_tns_data_oer_rowcount;
374static int hf_tns_data_oer_err_code;
375static int hf_tns_data_oer_cursor_id;
376static int hf_tns_data_oer_rowid;
377static int hf_tns_data_oer_n_batch_errcodes;
378static int hf_tns_data_oer_n_batch_offsets;
379static int hf_tns_data_oer_n_batch_messages;
380static int hf_tns_data_oer_message;
381static int hf_tns_data_oer_warn_flags;
382static int hf_tns_data_oer_warn_compile;
383static int hf_tns_data_oer_err_num_ext;
384static int hf_tns_data_oer_rowcount_ext;
385static int hf_tns_data_oer_sql_type;
386static int hf_tns_data_oer_checksum;
387
388static int hf_tns_data_rpa_num_al8o4;
389static int hf_tns_data_rpa_al8o4;
390static int hf_tns_data_rpa_al8txl;
391static int hf_tns_data_rpa_num_kv;
392static int hf_tns_data_rpa_registration;
393static int hf_tns_data_rpa_num_rowcounts;
394static int hf_tns_data_rpa_dml_rowcount;
395static int hf_tns_data_spb_opcode;
396static int hf_tns_data_spb_ltxid;
397static int hf_tns_data_spb_os_pid;
398static int hf_tns_data_spb_num_kv;
399static int hf_tns_data_spb_flags;
400static int hf_tns_data_spb_session_id;
401static int hf_tns_data_spb_serial_num;
402static int hf_tns_data_kv_text;
403static int hf_tns_data_kv_binary;
404static int hf_tns_data_kv_keyword;
405
406static int hf_tns_data_wrn_code;
407static int hf_tns_data_wrn_length;
408static int hf_tns_data_wrn_flags;
409static int hf_tns_data_wrn_message;
410
411static int hf_tns_data_oci_oer_status;
412static int hf_tns_data_oci_oer_seq;
413static int hf_tns_data_oci_oer_category;
414static int hf_tns_data_oci_oer_error_pos;
415static int hf_tns_data_oci_oer_command;
416static int hf_tns_data_oci_oer_call_seq;
417
418static int hf_tns_data_sta_call_status;
419static int hf_tns_data_sta_seq;
420static int hf_tns_data_call_status_txn;
421static int hf_tns_data_call_status_sess_release;
422
423static int hf_tns_data_iov_num_binds;
424static int hf_tns_data_iov_bind_dir;
425static int hf_tns_data_bind_actual_len;
426
427static int hf_tns_data_dcb_num_columns;
428static int hf_tns_data_col_type;
429static int hf_tns_data_col_precision;
430static int hf_tns_data_col_scale;
431static int hf_tns_data_col_max_length;
432static int hf_tns_data_col_charset;
433static int hf_tns_data_col_csform;
434static int hf_tns_data_col_max_size;
435static int hf_tns_data_col_max_elements;
436static int hf_tns_data_bind_num_elements;
437static int hf_tns_data_col_nulls_ok;
438static int hf_tns_data_col_name;
439static int hf_tns_data_col_uds_flags;
440static int hf_tns_data_col_domain_schema;
441static int hf_tns_data_col_domain_name;
442static int hf_tns_data_col_annotation;
443static int hf_tns_data_col_vector_dims;
444static int hf_tns_data_col_vector_format;
445
446static int hf_tns_data_rxh_num_requests;
447static int hf_tns_data_rxh_iter_num;
448static int hf_tns_data_rxh_num_iters;
449static int hf_tns_data_bit_vector;
450static int hf_tns_data_bvc_num_cols_sent;
451static int hf_tns_data_irs_num_results;
452
453static int hf_tns_data_all8_options;
454static int hf_tns_data_all8_opt_parse;
455static int hf_tns_data_all8_opt_bind;
456static int hf_tns_data_all8_opt_define;
457static int hf_tns_data_all8_opt_execute;
458static int hf_tns_data_all8_opt_commit;
459static int hf_tns_data_all8_opt_plsql;
460static int hf_tns_data_all8_opt_fetch;
461static int hf_tns_data_all8_opt_not_plsql;
462static int hf_tns_data_all8_parse_only;
463static int hf_tns_data_all8_opt_describe;
464static int hf_tns_data_all8_opt_batch_errors;
465static int hf_tns_data_all8_iterations;
466static int hf_tns_data_all8_prefetch;
467static int hf_tns_data_all8_is_query;
468static int hf_tns_data_all8_exec_flags;
469static int hf_tns_data_all8_xflag_scrollable;
470static int hf_tns_data_all8_xflag_no_cancel_on_eof;
471static int hf_tns_data_all8_xflag_dml_rowcounts;
472static int hf_tns_data_all8_xflag_implicit_rs;
473static int hf_tns_data_all8_fetch_orientation;
474static int hf_tns_data_all8_fetch_pos;
475static int hf_tns_data_all8_fetch_rows;
476static int hf_tns_data_all8_bind_count;
477static int hf_tns_data_all8_define_count;
478static int hf_tns_data_all8_oci_preamble;
479static int hf_tns_data_all8_sql;
480static int hf_tns_data_bind_value;
481static int hf_tns_data_fetch_rows;
482static int hf_tns_data_kod_opcode;
483static int hf_tns_data_kod_kind;
484static int hf_tns_data_kod_schema;
485static int hf_tns_data_kod_name;
486static int hf_tns_data_kod_oid;
487static int hf_tns_data_kod_type_oid;
488static int hf_tns_data_kod_system_type;
489static int hf_tns_data_kod_image;
490static int hf_tns_data_kod_version;
491static int hf_tns_data_kod_typecode;
492static int hf_tns_data_reexec_iterations;
493static int hf_tns_data_reexec_options2;
494static int hf_tns_data_reexec_opt2_commit;
495static int hf_tns_data_lob_op;
496static int hf_tns_data_lob_offset;
497static int hf_tns_data_lob_locator;
498static int hf_tns_data_lob_directory;
499static int hf_tns_data_lob_file_name;
500static int hf_tns_data_lob_charset;
501static int hf_tns_data_lob_csform;
502static int hf_tns_data_lob_type;
503static int hf_tns_data_lob_data;
504static int hf_tns_data_lob_amount;
505static int hf_tns_data_lob_flag;
506static int hf_tns_data_tpc_switch_op;
507static int hf_tns_data_aq_queue;
508static int hf_tns_data_aq_consumer;
509static int hf_tns_data_aq_correlation;
510static int hf_tns_data_aq_exception_queue;
511static int hf_tns_data_aq_condition;
512static int hf_tns_data_aq_msgid;
513static int hf_tns_data_aq_toid;
514static int hf_tns_data_aq_payload;
515static int hf_tns_data_aq_priority;
516static int hf_tns_data_aq_delay;
517static int hf_tns_data_aq_expiration;
518static int hf_tns_data_aq_attempts;
519static int hf_tns_data_aq_state;
520static int hf_tns_data_aq_enq_time;
521static int hf_tns_data_aq_visibility;
522static int hf_tns_data_aq_deq_mode;
523static int hf_tns_data_aq_navigation;
524static int hf_tns_data_aq_wait;
525static int hf_tns_data_aq_flags;
526static int hf_tns_data_aq_delivery_flags;
527static int hf_tns_data_aq_array_op;
528static int hf_tns_data_aq_num_messages;
529static int hf_tns_data_release_tag;
530static int hf_tns_data_release_mode;
531static int hf_tns_data_release_mode_deauth;
532static int hf_tns_data_tpc_change_op;
533static int hf_tns_data_tpc_format_id;
534static int hf_tns_data_tpc_gtrid;
535static int hf_tns_data_tpc_bqual;
536static int hf_tns_data_tpc_flags;
537static int hf_tns_data_tpc_timeout;
538static int hf_tns_data_tpc_state;
539static int hf_tns_data_tpc_context;
540static int hf_tns_data_tpc_app_value;
541static int hf_tns_data_tpc_internal_name;
542static int hf_tns_data_tpc_external_name;
543static int hf_tns_data_lob_text;
544static int hf_tns_data_lob_total_size;
545static int hf_tns_data_pgy_schema;
546static int hf_tns_data_pgy_app_ctx_op;
547static int hf_tns_data_pgy_app_ctx_namespace;
548static int hf_tns_data_pgy_app_ctx_attr;
549static int hf_tns_data_pgy_app_ctx_value;
550static int hf_tns_data_pgy_session_state;
551static int hf_tns_data_pgy_e2e_flags;
552static int hf_tns_data_pgy_client_id;
553static int hf_tns_data_pgy_module;
554static int hf_tns_data_pgy_action;
555static int hf_tns_data_pgy_client_info;
556static int hf_tns_data_pgy_dbop;
557static int hf_tns_data_pgy_error_set_id;
558static int hf_tns_data_pgy_error_set_mode;
559static int hf_tns_data_pgy_pipeline_mode;
560static int hf_tns_data_pgy_sec_flags;
561static int hf_tns_data_pgy_sec_key;
562static int hf_tns_data_pgy_sec_value;
563static int hf_tns_data_col_value;
564static int hf_tns_data_lob_size;
565static int hf_tns_data_lob_chunk_size;
566static int hf_tns_data_json_image;
567static int hf_tns_data_vector_image;
568static int hf_tns_data_obj_toid;
569static int hf_tns_data_obj_image;
570
571static int hf_tns_data_descriptor_row_count;
572static int hf_tns_data_descriptor_row_size;
573
574static int ett_tns;
575static int ett_tns_connect;
576static int ett_tns_accept;
577static int ett_tns_refuse;
578static int ett_tns_abort;
579static int ett_tns_redirect;
580static int ett_tns_marker;
581static int ett_tns_attention;
582static int ett_tns_control;
583static int ett_tns_data;
584static int ett_tns_data_flag;
585static int ett_tns_acc_versions;
586static int ett_tns_opi_params;
587static int ett_tns_opi_par;
588static int ett_tns_sopt_flag;
589static int ett_tns_ntp_flag;
590static int ett_tns_conn_flag;
591static int ett_tns_accept_flags2;
592static int ett_tns_rows;
593static int ett_tns_setdt_caphdr;
594static int ett_tns_setdt_overrides;
595static int ett_tns_setdt_override;
596static int ett_tns_oer;
597static int ett_tns_call_status;
598static int ett_tns_warn_flags;
599static int ett_tns_auth_mode;
600static int ett_tns_sns_service;
601static int ett_tns_sns_subpacket;
602static int ett_tns_release_mode;
603static int ett_tns_aq_props;
604static int ett_tns_rpa;
605static int ett_tns_kv;
606static int ett_tns_iov;
607static int ett_tns_dcb_col;
608static int ett_tns_all8_options;
609static int ett_tns_all8_i4;
610static int ett_tns_all8_exec_flags;
611static int ett_tns_binds;
612static int ett_tns_bind;
613static int ett_tns_defines;
614static int ett_tns_reexec_options2;
615static int ett_tns_bind_row;
616static int ett_tns_rxd_row;
617static int ett_tns_value;
618static int ett_tns_irs;
619static int ett_tns_out_binds;
620static int ett_sql;
621static int ett_tns_kod;
622static int ett_tns_app_ctx;
623
624static expert_field ei_tns_connect_data_next_packet;
625static expert_field ei_tns_data_descriptor_size_mismatch;
626static expert_field ei_tns_data_piggyback_cursors;
627static expert_field ei_tns_data_count_too_large;
628static expert_field ei_tns_data_encrypted;
629static expert_field ei_tns_data_compilation_error;
630static expert_field ei_tns_data_value_truncated;
631
632#define TCP_PORT_TNS1521 1521 /* Not IANA registered */
633
634/* The ACCEPT's flags2 word, what the server offers from version 318. */
635static int * const tns_accept_flags2[] = {
636 &hf_tns_accept_flags2_check_oob,
637 &hf_tns_accept_flags2_end_of_response,
638 &hf_tns_accept_flags2_fast_auth,
639 NULL((void*)0)
640};
641
642static int * const tns_connect_flags[] = {
643 &hf_tns_conn_flag_nareq,
644 &hf_tns_conn_flag_nalink,
645 &hf_tns_conn_flag_enablena,
646 &hf_tns_conn_flag_ichg,
647 &hf_tns_conn_flag_wantna,
648 NULL((void*)0)
649};
650
651static int * const tns_service_options[] = {
652 &hf_tns_sopt_flag_bconn,
653 &hf_tns_sopt_flag_pc,
654 &hf_tns_sopt_flag_hc,
655 &hf_tns_sopt_flag_fd,
656 &hf_tns_sopt_flag_hd,
657 &hf_tns_sopt_flag_dc1,
658 &hf_tns_sopt_flag_dc2,
659 &hf_tns_sopt_flag_dio,
660 &hf_tns_sopt_flag_ap,
661 &hf_tns_sopt_flag_ra,
662 &hf_tns_sopt_flag_sa,
663 NULL((void*)0)
664};
665
666/* TTI_ALL8 (SQL execute) options bitmask. */
667static int * const tns_all8_options[] = {
668 &hf_tns_data_all8_opt_parse,
669 &hf_tns_data_all8_opt_bind,
670 &hf_tns_data_all8_opt_define,
671 &hf_tns_data_all8_opt_execute,
672 &hf_tns_data_all8_opt_fetch,
673 &hf_tns_data_all8_opt_commit,
674 &hf_tns_data_all8_opt_plsql,
675 &hf_tns_data_all8_opt_not_plsql,
676 &hf_tns_data_all8_opt_describe,
677 &hf_tns_data_all8_opt_batch_errors,
678 NULL((void*)0)
679};
680
681static const value_string tns_type_vals[] = {
682 {TNS_TYPE_CONNECT1, "Connect" },
683 {TNS_TYPE_ACCEPT2, "Accept" },
684 {TNS_TYPE_ACK3, "Acknowledge" },
685 {TNS_TYPE_REFUSE4, "Refuse" },
686 {TNS_TYPE_REDIRECT5, "Redirect" },
687 {TNS_TYPE_DATA6, "Data" },
688 {TNS_TYPE_NULL7, "Null" },
689 {TNS_TYPE_ABORT9, "Abort" },
690 {TNS_TYPE_RESEND11, "Resend"},
691 {TNS_TYPE_MARKER12, "Marker"},
692 {TNS_TYPE_ATTENTION13, "Attention"},
693 {TNS_TYPE_CONTROL14, "Control"},
694 {TNS_TYPE_DD15, "Data Descriptor"},
695 {0, NULL((void*)0)}
696};
697
698static const value_string tns_data_funcs[] = {
699 {SQLNET_SET_PROTOCOL1, "Set Protocol"},
700 {SQLNET_SET_DATATYPES2, "Set Datatypes"},
701 {SQLNET_USER_OCI_FUNC3, "User OCI Functions"},
702 {SQLNET_RETURN_STATUS4, "Return Status"},
703 {SQLNET_ACCESS_USR_ADDR5, "Access User Address Space"},
704 {SQLNET_ROW_TRANSF_HDR6, "Row Transfer Header"},
705 {SQLNET_ROW_TRANSF_DATA7, "Row Transfer Data"},
706 {SQLNET_RETURN_OPI_PARAM8, "Return OPI Parameter"},
707 {SQLNET_FUNCCOMPLETE9, "Function Complete"},
708 {SQLNET_NERROR_RET_DEF10, "N Error return definitions follow"},
709 {SQLNET_IOVEC_4FAST_UPI11, "Sending I/O Vec only for fast UPI"},
710 {SQLNET_LONG_4FAST_UPI12, "Sending long for fast UPI"},
711 {SQLNET_INVOKE_USER_CB13, "Invoke user callback"},
712 {SQLNET_LOB_FILE_DF14, "LOB/FILE data follows"},
713 {SQLNET_WARNING15, "Warning messages - may be a set of them"},
714 {SQLNET_DESCRIBE_INFO16, "Describe Information"},
715 {SQLNET_PIGGYBACK_FUNC17, "Piggy back function follow"},
716 {SQLNET_SIG_4UCS18, "Signals special action for untrusted callout support"},
717 {SQLNET_FLUSH_BIND_DATA19, "Flush Out Bind data in DML/w RETURN when error"},
718 {SQLNET_BIT_VECTOR21, "Bit Vector"},
719 {SQLNET_SERVER_PIGGYBACK23, "Server-side Piggyback"},
720 {SQLNET_IMPLICIT_RESULTS27, "Implicit Result Sets"},
721 {SQLNET_END_OF_RESPONSE29, "End of Response"},
722 {SQLNET_TOKEN33, "Token"},
723 {SQLNET_FAST_AUTH34, "Fast Authentication"},
724 {SQLNET_XTRN_PROCSERV_R132, "External Procedures and Services Registrations"},
725 {SQLNET_XTRN_PROCSERV_R268, "External Procedures and Services Registrations"},
726 {SQLNET_SNS0xdeadbeef, "Secure Network Services"},
727 {0, NULL((void*)0)}
728};
729
730/* The authentication mode of an authentication call. */
731static int * const tns_auth_modes[] = {
732 &hf_tns_data_auth_mode_logon,
733 &hf_tns_data_auth_mode_change_password,
734 &hf_tns_data_auth_mode_sysdba,
735 &hf_tns_data_auth_mode_sysoper,
736 &hf_tns_data_auth_mode_with_password,
737 NULL((void*)0)
738};
739
740/* The mode of a DRCP session release. */
741static int * const tns_release_modes[] = {
742 &hf_tns_data_release_mode_deauth,
743 NULL((void*)0)
744};
745
746/* The second options word of a re-execute. */
747static int * const tns_reexec_options2[] = {
748 &hf_tns_data_reexec_opt2_commit,
749 NULL((void*)0)
750};
751
752/* Execute flags, the al8i4[9] word of a TTI_ALL8 execute. */
753static int * const tns_all8_exec_flags[] = {
754 &hf_tns_data_all8_xflag_scrollable,
755 &hf_tns_data_all8_xflag_no_cancel_on_eof,
756 &hf_tns_data_all8_xflag_dml_rowcounts,
757 &hf_tns_data_all8_xflag_implicit_rs,
758 NULL((void*)0)
759};
760
761/* Scrollable-cursor fetch orientation, al8i4[10] of a TTI_ALL8 execute. */
762static const value_string tns_fetch_orientations[] = {
763 {0x00, "None"},
764 {0x01, "Current"},
765 {0x02, "Next"},
766 {0x04, "First"},
767 {0x08, "Last"},
768 {0x10, "Prior"},
769 {0x20, "Absolute"},
770 {0x40, "Relative"},
771 {0, NULL((void*)0)}
772};
773
774/* Server-side piggyback opcodes (python-oracledb's
775 * TNS_SERVER_PIGGYBACK_*). */
776#define TNS_SPB_QUERY_CACHE_INVALIDATION1 1
777#define TNS_SPB_OS_PID_MTS2 2
778#define TNS_SPB_TRACE_EVENT3 3
779#define TNS_SPB_SESS_RET4 4
780#define TNS_SPB_SYNC5 5
781#define TNS_SPB_LTXID7 7
782#define TNS_SPB_AC_REPLAY_CONTEXT8 8
783#define TNS_SPB_EXT_SYNC9 9
784#define TNS_SPB_SESS_SIGNATURE10 10
785
786static const value_string tns_spb_opcodes[] = {
787 {TNS_SPB_QUERY_CACHE_INVALIDATION1, "Query Cache Invalidation"},
788 {TNS_SPB_OS_PID_MTS2, "OS PID (shared server)"},
789 {TNS_SPB_TRACE_EVENT3, "Trace Event"},
790 {TNS_SPB_SESS_RET4, "Session Return"},
791 {TNS_SPB_SYNC5, "Session State Sync"},
792 {TNS_SPB_LTXID7, "Logical Transaction Id"},
793 {TNS_SPB_AC_REPLAY_CONTEXT8, "Application Continuity Replay Context"},
794 {TNS_SPB_EXT_SYNC9, "Extended Sync"},
795 {TNS_SPB_SESS_SIGNATURE10, "Session Signature"},
796 {0, NULL((void*)0)}
797};
798
799/* Status byte of an OCI client's status block. */
800static const value_string tns_oci_oer_status_vals[] = {
801 {1, "Success"},
802 {5, "Error"},
803 {0, NULL((void*)0)}
804};
805
806/* Statement command types, as V$SQL.COMMAND_TYPE numbers them. */
807static const value_string tns_command_types[] = {
808 {1, "CREATE TABLE"},
809 {2, "INSERT"},
810 {3, "SELECT"},
811 {6, "UPDATE"},
812 {7, "DELETE"},
813 {9, "CREATE INDEX"},
814 {12, "DROP TABLE"},
815 {15, "ALTER TABLE"},
816 {21, "CREATE VIEW"},
817 {22, "DROP VIEW"},
818 {44, "COMMIT"},
819 {45, "ROLLBACK"},
820 {47, "PL/SQL EXECUTE"},
821 {85, "TRUNCATE TABLE"},
822 {0, NULL((void*)0)}
823};
824
825static const value_string tns_field_versions[] = {
826 {TNS_FV_11_26, "11.2"},
827 {TNS_FV_12_17, "12.1"},
828 {TNS_FV_12_28, "12.2"},
829 {TNS_FV_12_2_EXT19, "12.2 ext 1"},
830 {TNS_FV_18_110, "18.1"},
831 {TNS_FV_18_1_EXT_111, "18.1 ext 1"},
832 {TNS_FV_19_112, "19.1"},
833 {TNS_FV_19_1_EXT_113, "19.1 ext 1"},
834 {TNS_FV_20_114, "20.1"},
835 {TNS_FV_20_1_EXT_115, "20.1 ext 1"},
836 {TNS_FV_21_116, "21.1"},
837 {TNS_FV_23_117, "23.1"},
838 {TNS_FV_23_1_EXT_118, "23.1 ext 1"},
839 {TNS_FV_23_1_EXT_219, "23.1 ext 2"},
840 {TNS_FV_23_1_EXT_320, "23.1 ext 3"},
841 {TNS_FV_23_1_EXT_421, "23.1 ext 4"},
842 {TNS_FV_23_1_EXT_522, "23.1 ext 5"},
843 {TNS_FV_23_3_EXT_623, "23.3 ext 6"},
844 {TNS_FV_23_424, "23.4"},
845 {0, NULL((void*)0)}
846};
847
848/* Advanced Queuing (python-oracledb's TNS_AQ_*). */
849static const value_string tns_aq_states[] = {
850 {0, "Ready"},
851 {1, "Waiting"},
852 {2, "Processed"},
853 {3, "Expired"},
854 {0, NULL((void*)0)}
855};
856
857static const value_string tns_aq_visibility[] = {
858 {1, "Immediate"},
859 {2, "On commit"},
860 {0, NULL((void*)0)}
861};
862
863static const value_string tns_aq_deq_modes[] = {
864 {1, "Browse"},
865 {2, "Locked"},
866 {3, "Remove"},
867 {4, "Remove, no data"},
868 {0, NULL((void*)0)}
869};
870
871static const value_string tns_aq_navigation[] = {
872 {1, "First message"},
873 {2, "Next transaction"},
874 {3, "Next message"},
875 {0, NULL((void*)0)}
876};
877
878static const value_string tns_aq_array_ops[] = {
879 {1, "Enqueue"},
880 {2, "Dequeue"},
881 {0, NULL((void*)0)}
882};
883
884/* Two-phase commit operations (python-oracledb's TNS_TPC_*). */
885static const value_string tns_tpc_switch_ops[] = {
886 {0x01, "Start"},
887 {0x02, "Detach"},
888 {0x04, "Post-detach"},
889 {0, NULL((void*)0)}
890};
891
892static const value_string tns_tpc_change_ops[] = {
893 {0x01, "Commit"},
894 {0x02, "Abort"},
895 {0x03, "Prepare"},
896 {0x04, "Forget"},
897 {0, NULL((void*)0)}
898};
899
900static const value_string tns_tpc_states[] = {
901 {0, "Prepared"},
902 {1, "Requires commit"},
903 {2, "Committed"},
904 {3, "Aborted"},
905 {4, "Read only"},
906 {5, "Forgotten"},
907 {0, NULL((void*)0)}
908};
909
910/* Native network services (ANO) negotiation: services, sub-packet types
911 * and the encryption and integrity algorithm ids. */
912#define TNS_ANO_AUTHENTICATION1 1
913#define TNS_ANO_ENCRYPTION2 2
914#define TNS_ANO_DATA_INTEGRITY3 3
915#define TNS_ANO_SUPERVISOR4 4
916#define TNS_ANO_SP_BYTES1 1
917#define TNS_ANO_SP_UB12 2
918#define TNS_ANO_SP_VERSION5 5
919
920static const value_string tns_sns_services[] = {
921 {TNS_ANO_AUTHENTICATION1, "Authentication"},
922 {TNS_ANO_ENCRYPTION2, "Encryption"},
923 {TNS_ANO_DATA_INTEGRITY3, "Data Integrity"},
924 {TNS_ANO_SUPERVISOR4, "Supervisor"},
925 {0, NULL((void*)0)}
926};
927
928static const value_string tns_sns_subpacket_types[] = {
929 {0, "String"},
930 {1, "Bytes"},
931 {2, "UB1"},
932 {3, "UB2"},
933 {4, "UB4"},
934 {5, "Version"},
935 {6, "Status"},
936 {0, NULL((void*)0)}
937};
938
939static const value_string tns_sns_encryption_algs[] = {
940 {0, "None"},
941 {1, "RC4_40"},
942 {2, "DES"},
943 {3, "DES40"},
944 {6, "RC4_256"},
945 {8, "RC4_56"},
946 {10, "RC4_128"},
947 {11, "3DES112"},
948 {12, "3DES168"},
949 {15, "AES128"},
950 {16, "AES192"},
951 {17, "AES256"},
952 {0, NULL((void*)0)}
953};
954
955static const value_string tns_sns_integrity_algs[] = {
956 {0, "None"},
957 {1, "MD5"},
958 {3, "SHA1"},
959 {4, "SHA512"},
960 {5, "SHA256"},
961 {6, "SHA384"},
962 {0, NULL((void*)0)}
963};
964
965/* Keyword numbers of the key/value pairs a server reports back, for a
966 * session attribute a statement changed (python-oracledb's
967 * TNS_KEYWORD_NUM_*). */
968static const value_string tns_kv_keywords[] = {
969 {168, "CURRENT_SCHEMA"},
970 {172, "EDITION"},
971 {201, "TRANSACTION_ID"},
972 {0, NULL((void*)0)}
973};
974
975/* Oracle TNS native data-type ids. Used by the Set Datatypes
976 * negotiation to label override entries with human names. */
977static const value_string tns_data_types[] = {
978 {TNS_DATATYPE_VARCHAR1, "VARCHAR"},
979 {TNS_DATATYPE_NUMBER2, "NUMBER"},
980 {TNS_DATATYPE_INTEGER3, "BINARY_INTEGER"},
981 {TNS_DATATYPE_FLOAT4, "FLOAT"},
982 {TNS_DATATYPE_STRING5, "STRING"},
983 {TNS_DATATYPE_VARNUM6, "VARNUM"},
984 {TNS_DATATYPE_DECIMAL7, "DECIMAL"},
985 {TNS_DATATYPE_LONG8, "LONG"},
986 {TNS_DATATYPE_VCS9, "VCS"},
987 {TNS_DATATYPE_ROWID11, "RID"},
988 {TNS_DATATYPE_DATE12, "DATE"},
989 {TNS_DATATYPE_VBI15, "VBI"},
990 {TNS_DATATYPE_RAW23, "RAW"},
991 {TNS_DATATYPE_LONG_RAW24, "LONG RAW"},
992 {TNS_DATATYPE_CHAR96, "CHAR"},
993 {TNS_DATATYPE_BINARY_FLOAT100, "BINARY_FLOAT"},
994 {TNS_DATATYPE_BINARY_DOUBLE101, "BINARY_DOUBLE"},
995 {TNS_DATATYPE_REFCURSOR102, "REFCURSOR"},
996 {TNS_DATATYPE_ROWID_EXT104, "ROWID"},
997 {TNS_DATATYPE_ADT109, "ADT"},
998 {TNS_DATATYPE_REF111, "REF"},
999 {TNS_DATATYPE_CLOB112, "CLOB"},
1000 {TNS_DATATYPE_BLOB113, "BLOB"},
1001 {TNS_DATATYPE_BFILE114, "BFILE"},
1002 {TNS_DATATYPE_RSET116, "RSET"},
1003 {TNS_DATATYPE_JSON119, "JSON"},
1004 {TNS_DATATYPE_VECTOR127, "VECTOR"},
1005 {TNS_DATATYPE_TIMESTAMP180, "TIMESTAMP"},
1006 {TNS_DATATYPE_TIMESTAMP_TZ181, "TIMESTAMP WITH TIME ZONE"},
1007 {TNS_DATATYPE_INTERVAL_YM182, "INTERVAL YEAR TO MONTH"},
1008 {TNS_DATATYPE_INTERVAL_DS183, "INTERVAL DAY TO SECOND"},
1009 {TNS_DATATYPE_UROWID208, "UROWID"},
1010 {TNS_DATATYPE_TIMESTAMP_LTZ231, "TIMESTAMP WITH LOCAL TIME ZONE"},
1011 {TNS_DATATYPE_BOOLEAN252, "BOOLEAN"},
1012 {0, NULL((void*)0)}
1013};
1014
1015/* Oracle NLS character-set ids - the well-known subset, enough to name
1016 * the charsets seen in a Set Datatypes negotiation. */
1017static const value_string tns_charsets[] = {
1018 {1, "US7ASCII"},
1019 {31, "WE8ISO8859P1"},
1020 {32, "EE8ISO8859P2"},
1021 {33, "SE8ISO8859P3"},
1022 {34, "NEE8ISO8859P4"},
1023 {35, "CL8ISO8859P5"},
1024 {36, "AR8ISO8859P6"},
1025 {37, "EL8ISO8859P7"},
1026 {38, "IW8ISO8859P8"},
1027 {39, "WE8ISO8859P9"},
1028 {40, "NE8ISO8859P10"},
1029 {41, "TH8TISASCII"},
1030 {46, "WE8ISO8859P15"},
1031 {47, "BLT8ISO8859P13"},
1032 {170, "EE8MSWIN1250"},
1033 {171, "CL8MSWIN1251"},
1034 {172, "EL8MSWIN1253"},
1035 {173, "TR8MSWIN1254"},
1036 {174, "IW8MSWIN1255"},
1037 {175, "AR8MSWIN1256"},
1038 {176, "BLT8MSWIN1257"},
1039 {177, "VN8MSWIN1258"},
1040 {178, "WE8MSWIN1252"},
1041 {351, "WE8PC850"},
1042 {354, "US8PC437"},
1043 {368, "RU8PC866"},
1044 {382, "EE8PC852"},
1045 {829, "ZHT16BIG5"},
1046 {830, "KO16KSC5601"},
1047 {831, "JA16EUC"},
1048 {832, "JA16SJIS"},
1049 {833, "JA16SJISTILDE"},
1050 {834, "JA16EUCTILDE"},
1051 {846, "ZHS16GBK"},
1052 {850, "ZHT16HKSCS"},
1053 {852, "KO16MSWIN949"},
1054 {854, "ZHT16MSWIN950"},
1055 {870, "ZHS32GB18030"},
1056 {871, "UTF8"},
1057 {873, "AL32UTF8"},
1058 {2000, "AL16UTF16"},
1059 {0, NULL((void*)0)}
1060};
1061
1062/* A LOB locator's flag bytes, at these offsets in the locator as a
1063 * client holds and sends it (python-oracledb's TNS_LOB_LOC_*). Flag 1
1064 * says what kind of LOB it is; flags 3 and 4 how a CLOB's characters are
1065 * encoded: UTF-16 with the variable-length charset bit, little-endian
1066 * with the little-endian bit too, UTF-8 without. An NCLOB is UTF-16. */
1067#define TNS_LOB_LOC_FLAG_10x04 0x04
1068#define TNS_LOB_LOC_FLAG_30x06 0x06
1069#define TNS_LOB_LOC_FLAG_40x07 0x07
1070#define TNS_LOB_LOC_FLAGS_BLOB0x01 0x01
1071#define TNS_LOB_LOC_FLAGS_CLOB0x02 0x02
1072#define TNS_LOB_LOC_FLAGS_NCLOB0x04 0x04
1073#define TNS_LOB_LOC_FLAGS_VAR_LENGTH_CHARSET0x80 0x80
1074#define TNS_LOB_LOC_FLAGS_LITTLE_ENDIAN0x40 0x40
1075
1076/* TTI_LOBOPS operation opcodes. */
1077#define TNS_LOB_OP_FILE_ISOPEN0x00400 0x00400
1078#define TNS_LOB_OP_FILE_EXISTS0x00800 0x00800
1079#define TNS_LOB_OP_CREATE_TEMP0x00110 0x00110
1080#define TNS_LOB_OP_IS_OPEN0x11000 0x11000
1081
1082static const value_string tns_lob_ops[] = {
1083 {0x00001, "GET_LENGTH"},
1084 {0x00002, "READ"},
1085 {0x00020, "TRIM"},
1086 {0x00040, "WRITE"},
1087 {0x00100, "FILE_OPEN"},
1088 {0x00110, "CREATE_TEMP"},
1089 {0x00111, "FREE_TEMP"},
1090 {0x00200, "FILE_CLOSE"},
1091 {0x00400, "FILE_ISOPEN"},
1092 {0x00800, "FILE_EXISTS"},
1093 {0x04000, "GET_CHUNK_SIZE"},
1094 {0x08000, "OPEN"},
1095 {0x10000, "CLOSE"},
1096 {0x11000, "IS_OPEN"},
1097 {0x80000, "ARRAY"},
1098 {0, NULL((void*)0)}
1099};
1100
1101/* Column character-set form (csfrm) in an OAC descriptor: whether char data
1102 * is in the database charset or the national (AL16UTF16) charset. */
1103#define TNS_CSFORM_NCHAR2 2
1104/* The charset form and type of a temporary LOB a CREATE_TEMP asks for. */
1105static const val64_string tns_csform_vals64[] = {
1106 {0, "None (BLOB)"},
1107 {1, "Implicit (CLOB)"},
1108 {2, "National (NCLOB)"},
1109 {0, NULL((void*)0)}
1110};
1111
1112static const val64_string tns_lob_types64[] = {
1113 {TNS_DATATYPE_CLOB112, "CLOB"},
1114 {TNS_DATATYPE_BLOB113, "BLOB"},
1115 {0, NULL((void*)0)}
1116};
1117
1118static const value_string tns_csform_vals[] = {
1119 {1, "Database charset"},
1120 {2, "National (AL16UTF16)"},
1121 {0, NULL((void*)0)}
1122};
1123
1124/* Bind directions reported per bind in a TTI_IOV vector (TNS_BIND_DIR_*),
1125 * cross-referenced with python-oracledb's constants. */
1126#define TNS_BIND_DIR_OUTPUT16 16
1127#define TNS_BIND_DIR_INPUT32 32
1128
1129/* The length of an Advanced Queuing message id. */
1130#define TNS_AQ_MSGID_LEN16 16
1131#define TNS_AQ_TOID_LEN16 16
1132#define TNS_AQ_ARRAY_ENQ1 1
1133
1134/* An OAC flag marking a PL/SQL associative-array bind: in the flag byte
1135 * from 12.2, in the continuation flags before. */
1136#define TNS_BIND_ARRAY0x40 0x40
1137static const value_string tns_iov_bind_dirs[] = {
1138 {16, "OUT"},
1139 {32, "IN"},
1140 {48, "IN OUT"},
1141 {0, NULL((void*)0)}
1142};
1143
1144/* What an application-context piggyback does to its namespace. */
1145static const value_string tns_app_ctx_ops[] = {
1146 {1, "Set"},
1147 {2, "Clear"},
1148 {0, NULL((void*)0)}
1149};
1150
1151/* What a TTI_KOD call asks for. */
1152static const value_string tns_kod_opcodes[] = {
1153 {TNS_KOD_BY_NAME3, "Describe by name"},
1154 {TNS_KOD_BY_REF4, "Describe by REF"},
1155 {0, NULL((void*)0)}
1156};
1157
1158/* The messages of a TTI_KOD reply. */
1159static const value_string tns_kod_kinds[] = {
1160 {TNS_KOD_RECORD1, "Type record"},
1161 {TNS_KOD_HEADER2, "Name header"},
1162 {0, NULL((void*)0)}
1163};
1164
1165/* The system types, by the last byte of an id whose first 15 are zero. */
1166static const value_string tns_kod_system_types[] = {
1167 {TNS_KOD_KOTTD1, "SYS.KOTTD"},
1168 {0x02, "SYS.KOTTB"},
1169 {0x03, "SYS.KOTAD"},
1170 {0x0f, "SYS.NUMBER"},
1171 {0, NULL((void*)0)}
1172};
1173
1174/* The typecodes a type descriptor names. */
1175static const value_string tns_kod_typecodes[] = {
1176 {108, "Object"},
1177 {122, "Named collection"},
1178 {0, NULL((void*)0)}
1179};
1180
1181static const value_string tns_data_oci_subfuncs[] = {
1182 {1, "Logon to Oracle"},
1183 {2, "Open Cursor"},
1184 {3, "Parse a Row"},
1185 {4, "Execute a Row"},
1186 {5, "Fetch a Row"},
1187 {8, "Close Cursor"},
1188 {9, "Logoff of Oracle"},
1189 {10, "Describe a select list column"},
1190 {11, "Define where the column goes"},
1191 {12, "Auto commit on"},
1192 {13, "Auto commit off"},
1193 {14, "Commit"},
1194 {15, "Rollback"},
1195 {16, "Set fatal error options"},
1196 {17, "Resume current operation"},
1197 {18, "Get Oracle version-date string"},
1198 {19, "Until we get rid of OASQL"},
1199 {20, "Cancel the current operation"},
1200 {21, "Get error message"},
1201 {22, "Exit Oracle command"},
1202 {23, "Special function"},
1203 {24, "Abort"},
1204 {25, "Dequeue by RowID"},
1205 {26, "Fetch a long column value"},
1206 {27, "Create Access Module"},
1207 {28, "Save Access Module Statement"},
1208 {29, "Save Access Module"},
1209 {30, "Parse Access Module Statement"},
1210 {31, "How many items?"},
1211 {32, "Initialize Oracle"},
1212 {33, "Change User ID"},
1213 {34, "Bind by reference positional"},
1214 {35, "Get n'th Bind Variable"},
1215 {36, "Get n'th Into Variable"},
1216 {37, "Bind by reference"},
1217 {38, "Bind by reference numeric"},
1218 {39, "Parse and Execute"},
1219 {40, "Parse for syntax (only)"},
1220 {41, "Parse for syntax and SQL Dictionary lookup"},
1221 {42, "Continue serving after EOF"},
1222 {43, "Array describe"},
1223 {44, "Init sys pars command table"},
1224 {45, "Finalize sys pars command table"},
1225 {46, "Put sys par in command table"},
1226 {47, "Get sys pars from command table"},
1227 {48, "Start Oracle (V6)"},
1228 {49, "Shutdown Oracle (V6)"},
1229 {50, "Run Independent Process (V6)"},
1230 {51, "Test RAM (V6)"},
1231 {52, "Archive operation (V6)"},
1232 {53, "Media Recovery - start (V6)"},
1233 {54, "Media Recovery - record tablespace to recover (V6)"},
1234 {55, "Media Recovery - get starting log seq # (V6)"},
1235 {56, "Media Recovery - recover using offline log (V6)"},
1236 {57, "Media Recovery - cancel media recovery (V6)"},
1237 {58, "Logon to Oracle (V6)"},
1238 {59, "Get Oracle version-date string in new format"},
1239 {60, "Initialize Oracle"},
1240 {61, "Reserved for MAC; close all cursors"},
1241 {62, "Bundled execution call"},
1242 {65, "For direct loader: functions"},
1243 {66, "For direct loader: buffer transfer"},
1244 {67, "Distrib. trans. mgr. RPC"},
1245 {68, "Describe indexes for distributed query"},
1246 {69, "Session operations"},
1247 {70, "Execute using synchronized system commit numbers"},
1248 {71, "Fast UPI calls to OPIAL7"},
1249 {72, "Long Fetch (V7)"},
1250 {73, "Call OPIEXE from OPIALL: no two-task access"},
1251 {74, "Parse Call (V7) to deal with various flavours"},
1252 {76, "RPC call from PL/SQL"},
1253 {77, "Do a KGL operation"},
1254 {78, "Execute and Fetch"},
1255 {79, "X/Open XA operation"},
1256 {80, "New KGL operation call"},
1257 {81, "2nd Half of Logon"},
1258 {82, "1st Half of Logon"},
1259 {83, "Do Streaming Operation"},
1260 {84, "Open Session (71 interface)"},
1261 {85, "X/Open XA operations (71 interface)"},
1262 {86, "Debugging operations"},
1263 {87, "Special debugging operations"},
1264 {88, "XA Start"},
1265 {89, "XA Switch and Commit"},
1266 {90, "Direct copy from db buffers to client address"},
1267 {91, "OKOD Call (In Oracle <= 7 this used to be Connect"},
1268 {92, "Describe an object type (KOD)"},
1269 {93, "RPI Callback with ctxdef"},
1270 {94, "Bundled execution call (V7)"},
1271 {95, "Do Streaming Operation without begintxn"},
1272 {96, "LOB and FILE related calls"},
1273 {97, "File Create call"},
1274 {98, "Describe query (V8) call"},
1275 {99, "Connect (non-blocking attach host)"},
1276 {100, "Open a recursive cursor"},
1277 {101, "Bundled KPR Execution"},
1278 {102, "Bundled PL/SQL execution"},
1279 {103, "Transaction start, attach, detach"},
1280 {104, "Transaction commit, rollback, recover"},
1281 {105, "Cursor close all"},
1282 {106, "Failover into piggyback"},
1283 {107, "Session switching piggyback (V8)"},
1284 {108, "Do Dummy Defines"},
1285 {109, "Init sys pars (V8)"},
1286 {110, "Finalize sys pars (V8)"},
1287 {111, "Put sys par in par space (V8)"},
1288 {112, "Terminate sys pars (V8)"},
1289 {114, "Init Untrusted Callbacks"},
1290 {115, "Generic authentication call"},
1291 {116, "FailOver Get Instance call"},
1292 {117, "Oracle Transaction service Commit remote sites"},
1293 {118, "Get the session key"},
1294 {119, "Describe any (V8)"},
1295 {120, "Cancel All"},
1296 {121, "AQ Enqueue"},
1297 {122, "AQ Dequeue"},
1298 {123, "Object transfer"},
1299 {124, "RFS Call"},
1300 {125, "Kernel programmatic notification"},
1301 {126, "Listen"},
1302 {127, "Oracle Transaction service Commit remote sites (V >= 8.1.3)"},
1303 {128, "Dir Path Prepare"},
1304 {129, "Dir Path Load Stream"},
1305 {130, "Dir Path Misc. Ops"},
1306 {131, "Memory Stats"},
1307 {132, "AQ Properties Status"},
1308 {134, "Remote Fetch Archive Log FAL"},
1309 {135, "Client ID propagation"},
1310 {136, "DR Server CNX Process"},
1311 {138, "SPFILE parameter put"},
1312 {139, "KPFC exchange"},
1313 {140, "Object Transfer (V8.2)"},
1314 {141, "Push Transaction"},
1315 {142, "Pop Transaction"},
1316 {143, "KFN Operation"},
1317 {144, "Dir Path Unload Stream"},
1318 {145, "AQ batch enqueue dequeue"},
1319 {146, "File Transfer"},
1320 {147, "Ping"},
1321 {148, "TSM"},
1322 {150, "Begin TSM"},
1323 {151, "End TSM"},
1324 {152, "Set schema"},
1325 {153, "Fetch from suspended result set"},
1326 {154, "Key/Value pair"},
1327 {155, "XS Create session Operation"},
1328 {156, "XS Session Roundtrip Operation"},
1329 {157, "XS Piggyback Operation"},
1330 {158, "KSRPC Execution"},
1331 {159, "Streams combined capture apply"},
1332 {160, "AQ replay information"},
1333 {161, "SSCR"},
1334 {162, "Session Get"},
1335 {163, "Session RLS"},
1336 {165, "Workload replay data"},
1337 {166, "Replay statistic data"},
1338 {167, "Query Cache Stats"},
1339 {168, "Query Cache IDs"},
1340 {169, "RPC Test Stream"},
1341 {170, "Replay PL/SQL RPC"},
1342 {171, "XStream Out"},
1343 {172, "Golden Gate RPC"},
1344 {176, "Session state"},
1345 {187, "Notify"},
1346 {199, "Pipeline begin"},
1347 {200, "Pipeline end"},
1348 {205, "End-user security context"},
1349 {0, NULL((void*)0)}
1350};
1351static 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) }
;
1352
1353/* The final byte of a TNS_MARKER body selects break vs reset:
1354 * 01 00 01 = break, 01 00 02 = reset. */
1355static const value_string tns_marker_functions[] = {
1356 {1, "Break (interrupt call)"},
1357 {2, "Reset (clear line)"},
1358 {0, NULL((void*)0)}
1359};
1360
1361static const value_string tns_marker_types[] = {
1362 {0, "Data Marker - 0 Data Bytes"},
1363 {1, "Data Marker - 1 Data Bytes"},
1364 {2, "Attention Marker"},
1365 {0, NULL((void*)0)}
1366};
1367
1368static const value_string tns_control_cmds[] = {
1369 {1, "Oracle Trace Command"},
1370 {0, NULL((void*)0)}
1371};
1372
1373/* What a value decoder needs to know about one column or bind: its
1374 * datatype, character set form, and the data length (buffer size) the
1375 * describe gave it. */
1376typedef struct _tns_column_t {
1377 uint8_t type;
1378 uint8_t csform; /* character set form: 2 = national */
1379 bool_Bool is_array; /* a PL/SQL associative-array bind */
1380 uint32_t data_len;
1381} tns_column_t;
1382
1383/* Columns from the most recent describe (TTI_DCB), threaded to a later
1384 * TTI_RXD response so its row values can be split per column. */
1385typedef struct _tns_describe_t {
1386 uint32_t num_cols;
1387 tns_column_t *cols;
1388} tns_describe_t;
1389
1390/* The bind types of a cursor, from the execute that opened it. A later
1391 * execute of the same cursor may send its values with no descriptors. */
1392typedef struct _tns_binds_t {
1393 uint32_t count;
1394 uint32_t num_return; /* the last num_return are RETURNING ... INTO binds */
1395 bool_Bool plsql; /* bound to a PL/SQL block */
1396 tns_column_t *cols;
1397 /* A PL/SQL block's bind directions, which only the reply to its
1398 * first execute reports; NULL until then. Its re-executes send no
1399 * value for an OUT bind and are answered with no directions. */
1400 uint8_t *dirs;
1401} tns_binds_t;
1402
1403/* The call a response answers: some response messages can only be read
1404 * knowing what was asked. */
1405typedef struct _tns_call_t {
1406 uint8_t func; /* OCI function id */
1407 uint32_t exec_flags; /* al8i4[9] of a TTI_ALL8 execute */
1408 uint32_t num_binds; /* bind types of an execute */
1409 uint32_t num_return; /* ... of which the last are RETURNING ... INTO binds */
1410 tns_column_t *binds;
1411 tns_binds_t *bind_rec; /* ... and the cursor's record of them */
1412 uint32_t lob_op; /* TTI_LOBOPS operation */
1413 uint32_t lob_locator_len; /* ... its source locator length */
1414 bool_Bool lob_amount; /* ... whether it sent an amount */
1415 uint8_t lob_flags[4]; /* ... its locator's flag bytes 1 to 4 */
1416 bool_Bool lob_flags_known;
1417} tns_call_t;
1418
1419typedef struct _tns_conv_info_t {
1420 uint32_t pending_connect_data;
1421 /* The most recent call the client made. */
1422 tns_call_t *last_call;
1423 /* The client speaks the OCI dialect: fixed-width little-endian
1424 * integers and 8-byte pointer indicators, where a thin client uses
1425 * variable-length integers and 1-byte pointer flags. */
1426 bool_Bool oci_dialect;
1427 /* ... and at the 12c band, whose status blocks are 144 bytes. */
1428 bool_Bool oci_band_12c;
1429 /* The TTC field version the client and server settled on, from the
1430 * client's TTI_DTY; 0 until seen. */
1431 uint8_t field_version;
1432 /* The TTC field version the server offered in its TTI_PRO reply,
1433 * which can be higher; 0 until seen. */
1434 uint8_t server_field_version;
1435 /* Native network encryption: the server picked an algorithm, and
1436 * the frame of the client's last negotiation packet, after which the
1437 * data packets are encrypted. */
1438 bool_Bool ano_encryption;
1439 uint32_t ano_active_after;
1440 tns_describe_t *last_describe;
1441 /* Bind types of an execute that opened a new cursor, waiting for the
1442 * status that names the cursor id. */
1443 tns_binds_t *pending_binds;
1444 /* Cursor id -> tns_binds_t. */
1445 wmem_map_t *cursor_binds;
1446} tns_conv_info_t;
1447
1448/* p_add_proto_data key for the describe a TTI_RXD response packet uses. */
1449#define TNS_PROTO_DATA_DESCRIBE1 1
1450/* p_add_proto_data key for the remembered binds of a re-execute. */
1451#define TNS_PROTO_DATA_BINDS2 2
1452/* p_add_proto_data key for the call a response packet answers. */
1453#define TNS_PROTO_DATA_CALL3 3
1454/* p_add_proto_data key for whether a packet is in the OCI dialect. */
1455#define TNS_PROTO_DATA_OCI4 4
1456/* p_add_proto_data key for the field version in force for a packet. */
1457#define TNS_PROTO_DATA_FV5 5
1458/* p_add_proto_data key for whether a packet is encrypted. */
1459#define TNS_PROTO_DATA_ENCRYPTED6 6
1460/* p_add_proto_data key for the field version the server offered. */
1461#define TNS_PROTO_DATA_SERVER_FV7 7
1462/* p_add_proto_data key for whether an OCI session is at the 12c band. */
1463#define TNS_PROTO_DATA_OCI_12C8 8
1464
1465/* Execute option set on every SQL statement, clear on a PL/SQL block. */
1466#define TNS_EXEC_OPTION_NOT_PLSQL0x8000 0x8000
1467
1468/* The execute options that ask the server to do something: run the
1469 * statement, take a set of defines, or return rows. */
1470#define TNS_EXEC_OPTION_DEFINE0x0010 0x0010
1471#define TNS_EXEC_OPTION_EXECUTE0x0020 0x0020
1472#define TNS_EXEC_OPTION_FETCH0x0040 0x0040
1473
1474/* Execute flag asking for the rows each array DML iteration affected. */
1475#define TNS_EXEC_FLAGS_DML_ROWCOUNTS0x4000 0x4000
1476
1477void proto_reg_handoff_tns(void);
1478static int dissect_tns_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U___attribute__((unused)));
1479
1480static tns_conv_info_t*
1481tns_get_conv_info(packet_info *pinfo)
1482{
1483 conversation_t *conversation = find_or_create_conversation(pinfo);
1484
1485 tns_conv_info_t *tns_info = (tns_conv_info_t *)conversation_get_proto_data(conversation, proto_tns);
1486 if (!tns_info) {
1487 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
)))
;
1488 tns_info->cursor_binds = wmem_map_new(wmem_file_scope(), g_direct_hash, g_direct_equal);
1489 conversation_add_proto_data(conversation, proto_tns, tns_info);
1490 }
1491 return tns_info;
1492}
1493
1494/* The TTC field version negotiated on the packet's connection, or 0 when
1495 * the negotiation was not seen - which the decoders read as the 11g
1496 * shape. Stored per packet on the first pass. */
1497static unsigned tns_field_version(packet_info *pinfo)
1498{
1499 void *stored = p_get_proto_data(wmem_file_scope(), pinfo, proto_tns, TNS_PROTO_DATA_FV5);
1500 if ( stored || PINFO_FD_VISITED(pinfo)((pinfo)->fd->visited) )
1501 return stored ? GPOINTER_TO_UINT(stored)((guint) (gulong) (stored)) - 1 : 0;
1502
1503 unsigned fv = tns_get_conv_info(pinfo)->field_version;
1504 p_add_proto_data(wmem_file_scope(), pinfo, proto_tns, TNS_PROTO_DATA_FV5, GUINT_TO_POINTER(fv + 1)((gpointer) (gulong) (fv + 1)));
1505 return fv;
1506}
1507
1508/* The TTC field version the server offered on the packet's connection -
1509 * its own release, before the client lowered it - or 0 when the
1510 * negotiation was not seen. Stored per packet on the first pass. */
1511static unsigned tns_server_field_version(packet_info *pinfo)
1512{
1513 void *stored = p_get_proto_data(wmem_file_scope(), pinfo, proto_tns, TNS_PROTO_DATA_SERVER_FV7);
1514 if ( stored || PINFO_FD_VISITED(pinfo)((pinfo)->fd->visited) )
1515 return stored ? GPOINTER_TO_UINT(stored)((guint) (gulong) (stored)) - 1 : 0;
1516
1517 unsigned fv = tns_get_conv_info(pinfo)->server_field_version;
1518 p_add_proto_data(wmem_file_scope(), pinfo, proto_tns, TNS_PROTO_DATA_SERVER_FV7, GUINT_TO_POINTER(fv + 1)((gpointer) (gulong) (fv + 1)));
1519 return fv;
1520}
1521
1522/* Whether the connection is known to predate 11g (a 10g server): its
1523 * describe lacks the fields 11g added. */
1524static bool_Bool tns_before_11g(packet_info *pinfo)
1525{
1526 unsigned fv = tns_field_version(pinfo);
1527 return fv != 0 && fv < TNS_FV_11_26;
1528}
1529
1530/* Whether a data packet is encrypted by native network encryption.
1531 * Stored per packet on the first pass. */
1532static bool_Bool tns_is_encrypted(packet_info *pinfo)
1533{
1534 void *stored = p_get_proto_data(wmem_file_scope(), pinfo, proto_tns, TNS_PROTO_DATA_ENCRYPTED6);
1535 if ( stored || PINFO_FD_VISITED(pinfo)((pinfo)->fd->visited) )
1536 return GPOINTER_TO_UINT(stored)((guint) (gulong) (stored)) == 2;
1537
1538 tns_conv_info_t *tns_info = tns_get_conv_info(pinfo);
1539 bool_Bool encrypted = tns_info->ano_active_after && pinfo->num > tns_info->ano_active_after;
1540 p_add_proto_data(wmem_file_scope(), pinfo, proto_tns, TNS_PROTO_DATA_ENCRYPTED6, GUINT_TO_POINTER(encrypted ? 2 : 1)((gpointer) (gulong) (encrypted ? 2 : 1)));
1541 return encrypted;
1542}
1543
1544static unsigned get_data_func_id(tvbuff_t *tvb, int offset)
1545{
1546 /* Determine Data Function id */
1547 uint8_t first_byte;
1548
1549 first_byte =
1550 tvb_reported_length_remaining(tvb, offset) > 0 ? tvb_get_uint8(tvb, offset) : 0;
1551
1552 if ( tvb_bytes_exist(tvb, offset, 4) && first_byte == 0xDE &&
1553 tvb_get_uint24(tvb, offset+1, ENC_BIG_ENDIAN0x00000000) == 0xADBEEF )
1554 {
1555 return SQLNET_SNS0xdeadbeef;
1556 }
1557 else
1558 {
1559 return (unsigned)first_byte;
1560 }
1561}
1562
1563static int get_strtype_custom(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
1564{
1565 int ret = 1; // 1st byte contains 254 or length if smaller than 64
1566 int len = 0;
1567
1568 wmem_strbuf_t *strbuf = wmem_strbuf_new(pinfo->pool, "");
1569
1570 len = tvb_get_uint8(tvb, offset);
1571 if (len == 254) {
1572 int actual_len = 0;
1573 len = 0;
Value stored to 'len' is never read
1574 do { // walk over the chunks
1575 len = tvb_get_uint8(tvb, offset + ret);
1576 ret++; // 1st byte with the chunk size
1577 wmem_strbuf_append(strbuf, (const char *)tvb_get_string_enc(pinfo->pool, tvb, offset + ret, len, ENC_ASCII0x00000000|ENC_NA0x00000000));
1578 ret += len; // length of the string's chunk
1579 actual_len += len;
1580 } while (len == 64);
1581 ret++; // has to be null-terminated
1582 len = actual_len;
1583 }
1584 else {
1585 ret += len;
1586 wmem_strbuf_append(strbuf, (const char *)tvb_get_string_enc(pinfo->pool, tvb, offset + 1, len, ENC_ASCII0x00000000|ENC_NA0x00000000));
1587 }
1588
1589 proto_tree_add_uint(tree, hf_tns_data_opi_param_length, tvb, offset, 1, len);
1590 proto_tree_add_string(tree, hf_tns_data_opi_param_value, tvb, offset+1, ret-1, wmem_strbuf_get_str(strbuf));
1591
1592 return ret;
1593}
1594
1595/* Decode an Oracle variable-length integer (ub4 / sb4):
1596 * a length byte, then that many big-endian magnitude bytes. The low 7 bits
1597 * of the length byte are the magnitude width (0..4); the high bit flags a
1598 * negative value in sign-magnitude form (not two's complement) — so -1 is
1599 * 0x81 0x01 and NUMBER scale -127 is 0x81 0x7f.
1600 * Returns the number of bytes consumed. */
1601static int get_sb4_custom(tvbuff_t *tvb, int offset, int *result)
1602{
1603 uint8_t first_byte = tvb_get_uint8(tvb, offset); // Contains length of a value
1604 bool_Bool negative = (first_byte & 0x80) != 0;
1605 uint8_t width = first_byte & 0x7f;
1606 int magnitude = 0;
1607
1608 switch(width)
1609 {
1610 case 0:
1611 magnitude = 0;
1612 break;
1613 case 1:
1614 magnitude = tvb_get_uint8(tvb, offset+1);
1615 break;
1616 case 2:
1617 magnitude = tvb_get_ntohs(tvb, offset+1);
1618 break;
1619 case 3:
1620 magnitude = tvb_get_ntoh24(tvb, offset+1);
1621 break;
1622 case 4:
1623 magnitude = tvb_get_ntohl(tvb, offset+1);
1624 break;
1625 default:
1626 /* Width 5..0x7f is not a valid 1..4-byte integer. In practice
1627 * only a raw ub2 counter read through this helper reaches here;
1628 * the historic client behaviour is to consume two bytes and
1629 * return the negated second byte, which keeps the stream
1630 * aligned. The value is discarded by such callers. */
1631 if ( tvb_reported_length_remaining(tvb, offset) < 2 )
1632 {
1633 /* Not even that second byte is present. The width came
1634 * off the wire, so this is malformed input rather than
1635 * a bug in the dissector - step over the width alone. */
1636 *result = 0;
1637 return 1;
1638 }
1639 *result = -(int)tvb_get_uint8(tvb, offset+1);
1640 return 2;
1641 }
1642 *result = negative ? -magnitude : magnitude;
1643 return width + 1;
1644}
1645
1646/* Decode an Oracle variable-length ub8: a width byte (0..8), then that
1647 * many big-endian bytes. Returns the number of bytes consumed. */
1648static int get_ub8_custom(tvbuff_t *tvb, int offset, uint64_t *result)
1649{
1650 uint8_t width = tvb_get_uint8(tvb, offset);
1651 uint64_t value = 0;
1652
1653 if ( width > 8 )
1654 {
1655 /* Not a valid width; the value came off the wire, so step over
1656 * the width byte alone rather than claim bytes. */
1657 *result = 0;
1658 return 1;
1659 }
1660 for ( int i = 0; i < width; i++ )
1661 value = (value << 8) | tvb_get_uint8(tvb, offset + 1 + i);
1662 *result = value;
1663 return 1 + width;
1664}
1665
1666/* Walk the chunks of a chunked (0xFE) value, starting after the 0xFE:
1667 * (length, bytes) pairs until a zero length. A length is one byte below
1668 * field version 12.1 and a variable-length ub4 from 12.1 on. The data is
1669 * appended to strbuf as UTF-8 when strbuf is not NULL. Returns the bytes
1670 * consumed, the terminating zero included. */
1671static int tns_chunks_len(tvbuff_t *tvb, packet_info *pinfo, int offset, wmem_strbuf_t *strbuf)
1672{
1673 bool_Bool ub4_lengths = tns_field_version(pinfo) >= TNS_FV_12_17;
1674 int o = offset;
1675
1676 while ( tvb_reported_length_remaining(tvb, o) > 0 )
1677 {
1678 int chunk_len;
1679 if ( ub4_lengths )
1680 o += get_sb4_custom(tvb, o, &chunk_len);
1681 else
1682 {
1683 chunk_len = tvb_get_uint8(tvb, o);
1684 o += 1;
1685 }
1686 if ( chunk_len <= 0 )
1687 break;
1688 if ( strbuf )
1689 wmem_strbuf_append(strbuf, (const char *)tvb_get_string_enc(pinfo->pool, tvb, o, chunk_len, ENC_UTF_80x00000002|ENC_NA0x00000000));
1690 o += chunk_len;
1691 }
1692 return o - offset;
1693}
1694
1695/* The data of a DALC value at offset, chunks joined, in pinfo->pool;
1696 * *len receives its length. NULL for an empty, NULL or absent value. */
1697static const uint8_t *tns_dalc_bytes(tvbuff_t *tvb, packet_info *pinfo, int offset, int *len)
1698{
1699 uint8_t first = tvb_get_uint8(tvb, offset);
1700 bool_Bool ub4_lengths = tns_field_version(pinfo) >= TNS_FV_12_17;
1701 wmem_array_t *out;
1702 int o;
1703
1704 *len = 0;
1705 if ( first == 0 || first >= TNS_DALC_ABSENT0xFD )
1706 {
1707 if ( first != 0xfe )
1708 return NULL((void*)0);
1709 }
1710 else
1711 {
1712 *len = first;
1713 return tvb_memdup(pinfo->pool, tvb, offset + 1, first);
1714 }
1715
1716 out = wmem_array_new(pinfo->pool, 1);
1717 o = offset + 1;
1718 while ( tvb_reported_length_remaining(tvb, o) > 0 )
1719 {
1720 int chunk_len;
1721 if ( ub4_lengths )
1722 o += get_sb4_custom(tvb, o, &chunk_len);
1723 else
1724 {
1725 chunk_len = tvb_get_uint8(tvb, o);
1726 o += 1;
1727 }
1728 if ( chunk_len <= 0 )
1729 break;
1730 wmem_array_append(out, tvb_get_ptr(tvb, o, chunk_len), chunk_len);
1731 o += chunk_len;
1732 }
1733 *len = (int)wmem_array_get_count(out);
1734 return (const uint8_t *)wmem_array_get_raw(out);
1735}
1736
1737/* Decode a DALC (Data-Length-And-Content) blob. The leading byte is a
1738 * length only in the middle of its range:
1739 *
1740 * 0x00 empty
1741 * 0x01..0xFC that many data bytes follow (252 is the longest)
1742 * 0xFD absent value: the two-byte placeholder FD 01, no data
1743 * 0xFE chunked: (len, bytes) pairs until a 0-length chunk
1744 * 0xFF null - a marker only, no data follows
1745 *
1746 * The top three bytes are markers, not lengths. The null marker consumes
1747 * just itself. The absent-value placeholder fills a bind slot that has no
1748 * inline value - a pure OUT bind, or a NULL of a type with no inline form
1749 * such as BOOLEAN - and consumes itself plus the 0x01 after it. Reading
1750 * either as a length would claim bytes that are not there and misalign
1751 * every field after it, so they have to be spelled out rather than left
1752 * to the default.
1753 *
1754 * The chunk lengths in the 0xFE form are single bytes up to field version
1755 * 12.1, and variable-length ub4s from 12.2 on.
1756 *
1757 * Returns the number of bytes consumed from the tvb and, when content
1758 * is non-empty, a UTF-8 string allocated from pinfo->pool. */
1759static int get_dalc_custom(tvbuff_t *tvb, packet_info *pinfo, int offset, const char **out_str)
1760{
1761 uint8_t first = tvb_get_uint8(tvb, offset);
1762 if ( first == 0 || first == 255 )
1763 {
1764 if ( out_str )
1765 *out_str = NULL((void*)0);
1766 return 1;
1767 }
1768 if ( first == TNS_DALC_ABSENT0xFD )
1769 {
1770 if ( out_str )
1771 *out_str = NULL((void*)0);
1772 return 2;
1773 }
1774 if ( first != 254 )
1775 {
1776 if ( out_str )
1777 *out_str = (const char *)tvb_get_string_enc(pinfo->pool, tvb, offset + 1, first, ENC_UTF_80x00000002|ENC_NA0x00000000);
1778 return 1 + first;
1779 }
1780
1781 /* Chunked form: (len, bytes)+ until a zero-length chunk. */
1782 wmem_strbuf_t *strbuf = wmem_strbuf_new(pinfo->pool, "");
1783 int used = 1 + tns_chunks_len(tvb, pinfo, offset + 1, strbuf);
1784 if ( out_str )
1785 *out_str = wmem_strbuf_get_str(strbuf);
1786 return used;
1787}
1788
1789/* A server's message text carries a trailing newline; a client strips it
1790 * before showing the error. Returns a pinfo->pool string, or NULL. */
1791static const char *tns_trim_message(packet_info *pinfo, const char *msg)
1792{
1793 size_t len;
1794
1795 if ( !msg )
1796 return NULL((void*)0);
1797 len = strlen(msg);
1798 while ( len > 0 && (msg[len - 1] == '\n' || msg[len - 1] == '\r' || msg[len - 1] == ' ') )
1799 len--;
1800 return wmem_strndup(pinfo->pool, msg, len);
1801}
1802
1803/* Decode a bytes_with_length / str_with_length field: a ub4 count, and
1804 * a DALC carrying the value only when that count is non-zero. The count
1805 * is not simply a byte to step over - an empty field is the count
1806 * alone, so reading a DALC anyway consumes whatever follows it.
1807 * Returns bytes consumed; *out_str (when non-NULL) gets the string, or
1808 * NULL when the field is empty. */
1809static int get_field_with_length(tvbuff_t *tvb, packet_info *pinfo, int offset, const char **out_str)
1810{
1811 int count = 0;
1812 int used = get_sb4_custom(tvb, offset, &count);
1813 if ( out_str )
1814 *out_str = NULL((void*)0);
1815 if ( count > 0 )
1816 used += get_dalc_custom(tvb, pinfo, offset + used, out_str);
1817 return used;
1818}
1819
1820/* Render an Oracle NUMBER value as a decimal string.
1821 * Base-100 float: byte 0 is the biased exponent (top bit = sign, inverted
1822 * for negatives); the rest are base-100 mantissa groups, with a trailing
1823 * 0x66 terminator on negatives.
1824 * Returns a pinfo->pool string, or NULL if the value is not renderable. */
1825static const char *tns_format_number(packet_info *pinfo, const uint8_t *data, int len)
1826{
1827 if ( len <= 0 )
1828 return NULL((void*)0);
1829 if ( len == 1 )
1830 return (data[0] == 0x80) ? "0" : NULL((void*)0); /* 0x80 = zero; sentinels skipped */
1831
1832 uint8_t exp_byte = data[0];
1833 bool_Bool is_pos = (exp_byte & 0x80) != 0;
1834 int exponent = is_pos ? (exp_byte & 0x7f) - 65 : ((~exp_byte) & 0x7f) - 65;
1835
1836 int mant_len = len - 1;
1837 if ( !is_pos && mant_len > 0 && data[len - 1] == 0x66 )
1838 mant_len--; /* drop the negative terminator */
1839
1840 /* Build the base-100 digit string (two decimal digits per group). */
1841 wmem_strbuf_t *digits = wmem_strbuf_new(pinfo->pool, "");
1842 for ( int i = 0; i < mant_len; i++ )
1843 {
1844 int pair = is_pos ? (data[1 + i] - 1) : (101 - data[1 + i]);
1845 if ( pair < 0 || pair > 99 )
1846 return NULL((void*)0); /* malformed */
1847 wmem_strbuf_append_printf(digits, "%02d", pair);
1848 }
1849 const char *ds = wmem_strbuf_get_str(digits);
1850 int dlen = (int)wmem_strbuf_get_len(digits);
1851 int int_digits = (exponent + 1) * 2;
1852
1853 wmem_strbuf_t *ip = wmem_strbuf_new(pinfo->pool, "");
1854 wmem_strbuf_t *fp = wmem_strbuf_new(pinfo->pool, "");
1855 if ( int_digits >= dlen )
1856 {
1857 wmem_strbuf_append(ip, ds);
1858 for ( int i = 0; i < int_digits - dlen; i++ )
1859 wmem_strbuf_append_c(ip, '0');
1860 }
1861 else if ( int_digits <= 0 )
1862 {
1863 wmem_strbuf_append_c(ip, '0');
1864 for ( int i = 0; i < -int_digits; i++ )
1865 wmem_strbuf_append_c(fp, '0');
1866 wmem_strbuf_append(fp, ds);
1867 }
1868 else
1869 {
1870 wmem_strbuf_append(ip, wmem_strndup(pinfo->pool, ds, int_digits));
1871 wmem_strbuf_append(fp, ds + int_digits);
1872 }
1873
1874 /* Trim leading zeros on the integer part, trailing zeros on the fraction. */
1875 const char *ips = wmem_strbuf_get_str(ip);
1876 while ( ips[0] == '0' && ips[1] != '\0' )
1877 ips++;
1878 char *fps = wmem_strdup(pinfo->pool, wmem_strbuf_get_str(fp));
1879 int flen = (int)strlen(fps);
1880 while ( flen > 0 && fps[flen - 1] == '0' )
1881 fps[--flen] = '\0';
1882
1883 const char *sign = is_pos ? "" : "-";
1884 if ( flen > 0 )
1885 return wmem_strdup_printf(pinfo->pool, "%s%s.%s", sign, ips, fps);
1886 return wmem_strdup_printf(pinfo->pool, "%s%s", sign, ips);
1887}
1888
1889/* Render an Oracle DATE / TIMESTAMP value as an
1890 * ISO-ish string. 7 bytes: century+100, year+100, month, day, hour+1,
1891 * minute+1, second+1; 11 bytes add 4-byte big-endian nanoseconds.
1892 * A year before 1 - a DATE reaches back to 4712 BC, with no year 0 -
1893 * counts down from the same bias, so the same sum gives it negative,
1894 * and it is shown as the BC year it is. Returns a pinfo->pool string, or
1895 * NULL. */
1896static const char *tns_format_date(packet_info *pinfo, const uint8_t *data, int len)
1897{
1898 if ( len < 7 )
1899 return NULL((void*)0);
1900 int year = (data[0] - 100) * 100 + (data[1] - 100);
1901 const char *era = "";
1902 if ( year < 0 )
1903 {
1904 year = -year;
1905 era = " BC";
1906 }
1907 int month = data[2], day = data[3];
1908 int hour = data[4] - 1, minute = data[5] - 1, second = data[6] - 1;
1909 if ( month < 1 || month > 12 || day < 1 || day > 31 ||
1910 hour < 0 || hour > 23 || minute < 0 || minute > 59 || second < 0 || second > 59 )
1911 return NULL((void*)0);
1912 if ( len >= 11 )
1913 {
1914 uint32_t nsec = ((uint32_t)data[7] << 24) | ((uint32_t)data[8] << 16) |
1915 ((uint32_t)data[9] << 8) | data[10];
1916 if ( nsec > 0 )
1917 return wmem_strdup_printf(pinfo->pool, "%04d-%02d-%02d %02d:%02d:%02d.%09u%s",
1918 year, month, day, hour, minute, second, nsec, era);
1919 }
1920 return wmem_strdup_printf(pinfo->pool, "%04d-%02d-%02d %02d:%02d:%02d%s",
1921 year, month, day, hour, minute, second, era);
1922}
1923
1924/* Days since 1970-01-01 of a proleptic Gregorian date, and back. */
1925static int64_t tns_days_from_civil(int64_t y, unsigned m, unsigned d)
1926{
1927 y -= m <= 2;
1928 int64_t era = (y >= 0 ? y : y - 399) / 400;
1929 unsigned yoe = (unsigned)(y - era * 400);
1930 unsigned doy = (153 * (m + (m > 2 ? -3 : 9)) + 2) / 5 + d - 1;
1931 unsigned doe = yoe * 365 + yoe / 4 - yoe / 100 + doy;
1932 return era * 146097 + (int64_t)doe - 719468;
1933}
1934
1935static void tns_civil_from_days(int64_t z, int64_t *y, unsigned *m, unsigned *d)
1936{
1937 z += 719468;
1938 int64_t era = (z >= 0 ? z : z - 146096) / 146097;
1939 unsigned doe = (unsigned)(z - era * 146097);
1940 unsigned yoe = (doe - doe / 1460 + doe / 36524 - doe / 146096) / 365;
1941 unsigned doy = doe - (365 * yoe + yoe / 4 - yoe / 100);
1942 unsigned mp = (5 * doy + 2) / 153;
1943 *d = doy - (153 * mp + 2) / 5 + 1;
1944 *m = mp < 10 ? mp + 3 : mp - 9;
1945 *y = (int64_t)yoe + era * 400 + (*m <= 2);
1946}
1947
1948/* Render an Oracle TIMESTAMP WITH TIME ZONE value: 13 bytes, the
1949 * 11-byte TIMESTAMP form holding the instant in UTC, then two zone
1950 * bytes. With the top bit of the first clear they are an offset, hour
1951 * + 20 and minute + 60, and the value is shown in local time with that
1952 * offset; with it set they hold a named zone's region id,
1953 * ((b0 & 0x7f) << 6) + (b1 >> 2), and the value is shown in UTC.
1954 * Returns a pinfo->pool string, or NULL. */
1955static const char *tns_format_timestamp_tz(packet_info *pinfo, const uint8_t *data, int len)
1956{
1957 const char *utc;
1958 uint32_t nsec;
1959 int64_t minutes, days, year;
1960 unsigned month, day;
1961 int tz_hour, tz_min, minute_of_day;
1962 char sign;
1963
1964 if ( len != 13 )
1965 return tns_format_date(pinfo, data, len);
1966 utc = tns_format_date(pinfo, data, 11);
1967 if ( !utc )
1968 return NULL((void*)0);
1969 if ( data[11] & 0x80 )
1970 return wmem_strdup_printf(pinfo->pool, "%s UTC (time zone region %u)", utc,
1971 ((unsigned)(data[11] & 0x7f) << 6) + (data[12] >> 2));
1972
1973 /* Shift the UTC wall clock by the offset, in whole minutes. */
1974 tz_hour = data[11] - 20;
1975 tz_min = data[12] - 60;
1976 days = tns_days_from_civil((data[0] - 100) * 100 + (data[1] - 100), data[2], data[3]);
1977 minutes = days * 1440 + (data[4] - 1) * 60 + (data[5] - 1) + tz_hour * 60 + tz_min;
1978 days = minutes >= 0 ? minutes / 1440 : -((-minutes + 1439) / 1440);
1979 minute_of_day = (int)(minutes - days * 1440);
1980 tns_civil_from_days(days, &year, &month, &day);
1981
1982 nsec = ((uint32_t)data[7] << 24) | ((uint32_t)data[8] << 16) | ((uint32_t)data[9] << 8) | data[10];
1983 /* The sign goes on the whole offset: -03:30 is hour -3, minute -30. */
1984 sign = (tz_hour < 0 || tz_min < 0) ? '-' : '+';
1985 if ( nsec )
1986 return wmem_strdup_printf(pinfo->pool, "%04" PRId64"l" "d" "-%02u-%02u %02d:%02d:%02d.%09u %c%02d:%02d",
1987 year, month, day, minute_of_day / 60, minute_of_day % 60, data[6] - 1, nsec,
1988 sign, abs(tz_hour), abs(tz_min));
1989 return wmem_strdup_printf(pinfo->pool, "%04" PRId64"l" "d" "-%02u-%02u %02d:%02d:%02d %c%02d:%02d",
1990 year, month, day, minute_of_day / 60, minute_of_day % 60, data[6] - 1,
1991 sign, abs(tz_hour), abs(tz_min));
1992}
1993
1994/* Render an Oracle INTERVAL YEAR TO MONTH (5 bytes: years as a
1995 * big-endian ub4 biased by 2^31, months biased by 60) or INTERVAL DAY TO
1996 * SECOND (11 bytes: days as a ub4 biased by 2^31, hours, minutes and
1997 * seconds each biased by 60, nanoseconds as a ub4 biased by 2^31). All
1998 * fields carry the interval's sign. Rendered as Oracle writes an
1999 * interval literal: [-]Y-MM, or [-]D HH:MM:SS[.fffffffff].
2000 * Returns a pinfo->pool string, or NULL. */
2001static const char *tns_format_interval(packet_info *pinfo, uint8_t dtype, const uint8_t *data, int len)
2002{
2003 int32_t lead = (int32_t)((((uint32_t)data[0] << 24) | ((uint32_t)data[1] << 16) |
2004 ((uint32_t)data[2] << 8) | data[3]) - 0x80000000u);
2005
2006 if ( dtype == TNS_DATATYPE_INTERVAL_YM182 && len == 5 )
2007 {
2008 int months = data[4] - 60;
2009 bool_Bool neg = lead < 0 || months < 0;
2010 return wmem_strdup_printf(pinfo->pool, "%s%d-%02d", neg ? "-" : "",
2011 abs(lead), abs(months));
2012 }
2013 if ( dtype == TNS_DATATYPE_INTERVAL_DS183 && len == 11 )
2014 {
2015 int hours = data[4] - 60, minutes = data[5] - 60, seconds = data[6] - 60;
2016 int32_t nsec = (int32_t)((((uint32_t)data[7] << 24) | ((uint32_t)data[8] << 16) |
2017 ((uint32_t)data[9] << 8) | data[10]) - 0x80000000u);
2018 bool_Bool neg = lead < 0 || hours < 0 || minutes < 0 || seconds < 0 || nsec < 0;
2019 if ( nsec )
2020 return wmem_strdup_printf(pinfo->pool, "%s%d %02d:%02d:%02d.%09d", neg ? "-" : "",
2021 abs(lead), abs(hours), abs(minutes), abs(seconds), abs(nsec));
2022 return wmem_strdup_printf(pinfo->pool, "%s%d %02d:%02d:%02d", neg ? "-" : "",
2023 abs(lead), abs(hours), abs(minutes), abs(seconds));
2024 }
2025 return NULL((void*)0);
2026}
2027
2028/* Render an Oracle BINARY_FLOAT (4 bytes) / BINARY_DOUBLE (8 bytes) value
2029 * Stored in an order-preserving IEEE-754 form: if the
2030 * high bit is set the value was positive (clear it), else it was negative
2031 * (invert all bits); then read as big-endian IEEE-754. Returns a
2032 * pinfo->pool string, or NULL. */
2033static const char *tns_format_binary_float(packet_info *pinfo, const uint8_t *data, int len)
2034{
2035 char buf[G_ASCII_DTOSTR_BUF_SIZE(29 + 10)];
2036
2037 if ( len == 4 )
2038 {
2039 uint32_t u = ((uint32_t)data[0] << 24) | ((uint32_t)data[1] << 16) |
2040 ((uint32_t)data[2] << 8) | data[3];
2041 u = (u & 0x80000000u) ? (u & 0x7fffffffu) : ~u;
2042 float f;
2043 memcpy(&f, &u, 4);
2044 /* Locale-independent '.' decimal separator. */
2045 g_ascii_formatd(buf, sizeof(buf), "%g", (double)f);
2046 return wmem_strdup(pinfo->pool, buf);
2047 }
2048 if ( len == 8 )
2049 {
2050 uint64_t u = 0;
2051 for ( int i = 0; i < 8; i++ )
2052 u = (u << 8) | data[i];
2053 u = (u & UINT64_C(0x8000000000000000)0x8000000000000000UL) ? (u & UINT64_C(0x7fffffffffffffff)0x7fffffffffffffffUL) : ~u;
2054 double d;
2055 memcpy(&d, &u, 8);
2056 g_ascii_formatd(buf, sizeof(buf), "%g", d);
2057 return wmem_strdup(pinfo->pool, buf);
2058 }
2059 return NULL((void*)0);
2060}
2061
2062/* The base-64 alphabet of Oracle's printable rowids. */
2063static const char tns_rowid_alphabet[] =
2064 "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
2065
2066/* Append value to buf as `digits` base-64 characters, most significant
2067 * first. */
2068static void tns_rowid_append(wmem_strbuf_t *buf, uint32_t value, int digits)
2069{
2070 char chars[6];
2071
2072 for ( int i = digits - 1; i >= 0; i-- )
2073 {
2074 chars[i] = tns_rowid_alphabet[value & 0x3f];
2075 value >>= 6;
2076 }
2077 wmem_strbuf_append_len(buf, chars, digits);
2078}
2079
2080/* Render a physical rowid as the 18-character extended rowid ROWIDTOCHAR
2081 * prints: object, file, block and slot in 6, 3, 6 and 3 base-64 digits.
2082 * Returns a pinfo->pool string. */
2083static const char *tns_format_rowid(packet_info *pinfo, uint32_t rba, uint32_t part, uint32_t block, uint32_t slot)
2084{
2085 wmem_strbuf_t *buf = wmem_strbuf_new(pinfo->pool, "");
2086
2087 tns_rowid_append(buf, rba, 6);
2088 tns_rowid_append(buf, part, 3);
2089 tns_rowid_append(buf, block, 6);
2090 tns_rowid_append(buf, slot, 3);
2091 return wmem_strbuf_get_str(buf);
2092}
2093
2094/* Render a universal rowid. A leading type byte of 1 marks a physical
2095 * rowid, printed as above; anything else is a logical one - an
2096 * index-organized table's, carrying its primary key - printed as "*" and
2097 * the base-64 of the bytes after the type byte, unpadded. Returns a
2098 * pinfo->pool string, or NULL. */
2099static const char *tns_format_urowid(packet_info *pinfo, const uint8_t *data, int len)
2100{
2101 if ( len >= 13 && data[0] == 1 )
2102 return tns_format_rowid(pinfo,
2103 ((uint32_t)data[1] << 24) | ((uint32_t)data[2] << 16) | ((uint32_t)data[3] << 8) | data[4],
2104 ((uint32_t)data[5] << 8) | data[6],
2105 ((uint32_t)data[7] << 24) | ((uint32_t)data[8] << 16) | ((uint32_t)data[9] << 8) | data[10],
2106 ((uint32_t)data[11] << 8) | data[12]);
2107 if ( len < 2 )
2108 return NULL((void*)0);
2109
2110 wmem_strbuf_t *buf = wmem_strbuf_new(pinfo->pool, "*");
2111 for ( int i = 1; i < len; i += 3 )
2112 {
2113 int n = MIN(3, len - i)(((3) < (len - i)) ? (3) : (len - i));
2114 uint32_t group = (uint32_t)data[i] << 16;
2115 if ( n > 1 )
2116 group |= (uint32_t)data[i + 1] << 8;
2117 if ( n > 2 )
2118 group |= data[i + 2];
2119 /* n bytes give n + 1 characters */
2120 for ( int k = 0; k <= n; k++ )
2121 wmem_strbuf_append_c(buf, tns_rowid_alphabet[(group >> (18 - 6 * k)) & 0x3f]);
2122 }
2123 return wmem_strbuf_get_str(buf);
2124}
2125
2126/* Render a VECTOR image:
2127 * 0xDB | version (ub1) | flags (be16) | format (ub1) | elements (be32) |
2128 * [norm, 8 bytes, with flag 0x02 or 0x10] |
2129 * [sparse (flag 0x20): count (be16), count x be32 index] | values
2130 * FLOAT32 / FLOAT64 values use the order-preserving BINARY_FLOAT /
2131 * BINARY_DOUBLE encoding, INT8 plain bytes, BINARY bits packed eight to a
2132 * byte (the element count is then a bit count). The first few values are
2133 * shown. Returns a pinfo->pool string, or NULL. */
2134static const char *tns_format_vector(packet_info *pinfo, const uint8_t *data, int len)
2135{
2136 static const char *formats[] = { NULL((void*)0), NULL((void*)0), "FLOAT32", "FLOAT64", "INT8", "BINARY" };
2137 const int shown = 16;
2138 uint16_t flags;
2139 uint8_t format;
2140 uint32_t count, dims;
2141 int pos = 9, size;
2142 const uint8_t *indices = NULL((void*)0);
2143 wmem_strbuf_t *buf;
2144
2145 if ( len < 9 || data[0] != 0xdb )
2146 return NULL((void*)0);
2147 flags = (uint16_t)((data[2] << 8) | data[3]);
2148 format = data[4];
2149 dims = count = ((uint32_t)data[5] << 24) | ((uint32_t)data[6] << 16) | ((uint32_t)data[7] << 8) | data[8];
2150 if ( format < 2 || format > 5 )
2151 return NULL((void*)0);
2152 if ( flags & 0x0012 )
2153 pos += 8;
2154 if ( flags & 0x0020 )
2155 {
2156 if ( pos + 2 > len )
2157 return NULL((void*)0);
2158 count = (uint32_t)((data[pos] << 8) | data[pos + 1]);
2159 pos += 2;
2160 indices = data + pos;
2161 if ( (uint64_t)count * 4 > (uint64_t)(len - pos) )
2162 return NULL((void*)0);
2163 pos += count * 4;
2164 }
2165 else if ( format == 5 )
2166 count = (count + 7) / 8;
2167 size = format == 2 ? 4 : format == 3 ? 8 : 1;
2168 if ( (uint64_t)count * size > (uint64_t)(len - pos) )
2169 return NULL((void*)0);
2170
2171 buf = wmem_strbuf_new(pinfo->pool, "");
2172 if ( indices )
2173 wmem_strbuf_append_printf(buf, "sparse %s of %u dimensions: {", formats[format], dims);
2174 else
2175 wmem_strbuf_append_printf(buf, "%s[%u]: [", formats[format], dims);
2176 for ( uint32_t i = 0; i < count && i < (uint32_t)shown; i++ )
2177 {
2178 const uint8_t *e = data + pos + i * size;
2179 if ( i )
2180 wmem_strbuf_append(buf, ", ");
2181 if ( indices )
2182 wmem_strbuf_append_printf(buf, "%u: ", ((uint32_t)indices[4 * i] << 24)
2183 | ((uint32_t)indices[4 * i + 1] << 16) | ((uint32_t)indices[4 * i + 2] << 8) | indices[4 * i + 3]);
2184 if ( size > 1 )
2185 wmem_strbuf_append(buf, tns_format_binary_float(pinfo, e, size));
2186 else if ( format == 4 )
2187 wmem_strbuf_append_printf(buf, "%d", (int8_t)e[0]);
2188 else
2189 wmem_strbuf_append_printf(buf, "%u", e[0]);
2190 }
2191 if ( count > (uint32_t)shown )
2192 wmem_strbuf_append(buf, ", ...");
2193 wmem_strbuf_append_c(buf, indices ? '}' : ']');
2194 return wmem_strbuf_get_str(buf);
2195}
2196
2197#define TNS_OSON_MAX_DEPTH32 32
2198#define TNS_OSON_MAX_NODES4096 4096
2199#define TNS_OSON_MAX_TEXT2048 2048
2200
2201/* A reader over an OSON image; every access is bounds checked, and a
2202 * failed one marks the reader bad instead of throwing. */
2203typedef struct _tns_oson_t {
2204 const uint8_t *data;
2205 uint32_t len;
2206 bool_Bool bad;
2207 uint32_t tree; /* start of the tree segment */
2208 uint8_t field_id_len; /* 1, 2 or 4 */
2209 bool_Bool relative; /* container children count from the container */
2210 uint32_t num_names;
2211 const uint8_t **names;
2212 uint32_t *name_lens;
2213} tns_oson_t;
2214
2215typedef struct _tns_oson_frame_t {
2216 bool_Bool is_object;
2217 uint8_t node_type;
2218 uint32_t count, next;
2219 uint32_t ids_pos, offsets_pos, container;
2220} tns_oson_frame_t;
2221
2222static uint32_t tns_oson_uint(tns_oson_t *o, uint32_t pos, int width)
2223{
2224 uint32_t v = 0;
2225
2226 if ( o->bad || pos > o->len || (uint32_t)width > o->len - pos )
2227 {
2228 o->bad = true1;
2229 return 0;
2230 }
2231 for ( int i = 0; i < width; i++ )
2232 v = (v << 8) | o->data[pos + i];
2233 return v;
2234}
2235
2236/* Read the field names of one segment: a hash array (hash_size bytes a
2237 * name), an offsets array, then the names, each behind a length of
2238 * len_size bytes. */
2239static uint32_t tns_oson_names(tns_oson_t *o, uint32_t pos, uint32_t first, uint32_t num,
2240 int hash_size, int off_size, uint32_t seg_size, int len_size)
2241{
2242 uint32_t offsets = pos + num * hash_size;
2243 uint32_t seg = offsets + num * off_size;
2244
2245 for ( uint32_t i = 0; i < num && !o->bad; i++ )
2246 {
2247 uint32_t at = tns_oson_uint(o, offsets + i * off_size, off_size);
2248 uint32_t n = tns_oson_uint(o, seg + at, len_size);
2249 if ( at + len_size + n > seg_size || seg + at + len_size + n > o->len )
2250 o->bad = true1;
2251 else
2252 {
2253 o->names[first + i] = o->data + seg + at + len_size;
2254 o->name_lens[first + i] = n;
2255 }
2256 }
2257 return seg + seg_size;
2258}
2259
2260static void tns_oson_append_string(wmem_strbuf_t *buf, const uint8_t *s, uint32_t len)
2261{
2262 wmem_strbuf_append_c(buf, '"');
2263 for ( uint32_t i = 0; i < len; i++ )
2264 {
2265 if ( s[i] == '"' || s[i] == '\\' )
2266 wmem_strbuf_append_printf(buf, "\\%c", s[i]);
2267 else if ( s[i] < 0x20 )
2268 wmem_strbuf_append_printf(buf, "\\u%04x", s[i]);
2269 else
2270 wmem_strbuf_append_c(buf, s[i]);
2271 }
2272 wmem_strbuf_append_c(buf, '"');
2273}
2274
2275/* How an OSON scalar's payload is rendered. */
2276typedef enum {
2277 TNS_OSON_STRING,
2278 TNS_OSON_NUMBER,
2279 TNS_OSON_DATETIME,
2280 TNS_OSON_FLOAT,
2281 TNS_OSON_INTERVAL,
2282 TNS_OSON_BYTES
2283} tns_oson_kind_t;
2284
2285/* Render the scalar node at pos; returns false on a malformed or unknown
2286 * node. The tag selects the type and says where its length is: in a byte,
2287 * a be16 or a be32 after the tag, fixed by the type, or in the tag's low
2288 * bits. */
2289static bool_Bool tns_oson_scalar(packet_info *pinfo, tns_oson_t *o, uint32_t pos, wmem_strbuf_t *buf)
2290{
2291 uint8_t t = (uint8_t)tns_oson_uint(o, pos, 1);
2292 uint32_t n = 0, at = pos + 1;
2293 tns_oson_kind_t kind;
2294 const char *text = NULL((void*)0);
2295
2296 if ( o->bad )
2297 return false0;
2298 switch ( t )
2299 {
2300 case 0x30: wmem_strbuf_append(buf, "null"); return true1;
2301 case 0x31: wmem_strbuf_append(buf, "true"); return true1;
2302 case 0x32: wmem_strbuf_append(buf, "false"); return true1;
2303 case 0x33: kind = TNS_OSON_STRING; n = tns_oson_uint(o, at, 1); at += 1; break;
2304 case 0x37: kind = TNS_OSON_STRING; n = tns_oson_uint(o, at, 2); at += 2; break;
2305 case 0x38: kind = TNS_OSON_STRING; n = tns_oson_uint(o, at, 4); at += 4; break;
2306 case 0x34: kind = TNS_OSON_NUMBER; n = tns_oson_uint(o, at, 1); at += 1; break;
2307 case 0x3c: case 0x7d: kind = TNS_OSON_DATETIME; n = 7; break;
2308 case 0x39: kind = TNS_OSON_DATETIME; n = 11; break;
2309 case 0x7c: kind = TNS_OSON_DATETIME; n = 13; break;
2310 case 0x7f: kind = TNS_OSON_FLOAT; n = 4; break;
2311 case 0x36: kind = TNS_OSON_FLOAT; n = 8; break;
2312 case 0x3d: kind = TNS_OSON_INTERVAL; n = 5; break;
2313 case 0x3e: kind = TNS_OSON_INTERVAL; n = 11; break;
2314 case 0x7e: kind = TNS_OSON_BYTES; n = tns_oson_uint(o, at, 1); at += 1; break;
2315 case 0x3a: kind = TNS_OSON_BYTES; n = tns_oson_uint(o, at, 2); at += 2; break;
2316 case 0x3b: kind = TNS_OSON_BYTES; n = tns_oson_uint(o, at, 4); at += 4; break;
2317 case 0x7b:
2318 /* extended type: a vector, with a be32 image length */
2319 if ( tns_oson_uint(o, at, 1) != 0x01 )
2320 return false0;
2321 n = tns_oson_uint(o, at + 1, 4);
2322 at += 5;
2323 if ( o->bad || n > o->len - at )
2324 return false0;
2325 text = tns_format_vector(pinfo, o->data + at, n);
2326 if ( !text )
2327 return false0;
2328 tns_oson_append_string(buf, (const uint8_t *)text, (uint32_t)strlen(text));
2329 return true1;
2330 default:
2331 if ( (t & 0xf0) == 0x20 || (t & 0xf0) == 0x60 )
2332 {
2333 kind = TNS_OSON_NUMBER;
2334 n = (t & 0x0f) + 1u;
2335 }
2336 else if ( (t & 0xf0) == 0x40 || (t & 0xf0) == 0x50 )
2337 {
2338 kind = TNS_OSON_NUMBER;
2339 n = t & 0x0f;
2340 }
2341 else if ( (t & 0xe0) == 0 )
2342 {
2343 kind = TNS_OSON_STRING;
2344 n = t;
2345 }
2346 else
2347 return false0;
2348 break;
2349 }
2350 if ( o->bad || n > o->len - at )
2351 return false0;
2352
2353 switch ( kind )
2354 {
2355 case TNS_OSON_STRING:
2356 tns_oson_append_string(buf, o->data + at, n);
2357 return true1;
2358 case TNS_OSON_BYTES:
2359 wmem_strbuf_append_c(buf, '"');
2360 for ( uint32_t i = 0; i < n; i++ )
2361 wmem_strbuf_append_printf(buf, "%02x", o->data[at + i]);
2362 wmem_strbuf_append_c(buf, '"');
2363 return true1;
2364 case TNS_OSON_NUMBER:
2365 text = n ? tns_format_number(pinfo, o->data + at, (int)n) : "0";
2366 break;
2367 case TNS_OSON_FLOAT:
2368 text = tns_format_binary_float(pinfo, o->data + at, (int)n);
2369 break;
2370 case TNS_OSON_DATETIME:
2371 text = t == 0x7c ? tns_format_timestamp_tz(pinfo, o->data + at, (int)n)
2372 : tns_format_date(pinfo, o->data + at, (int)n);
2373 break;
2374 case TNS_OSON_INTERVAL:
2375 text = tns_format_interval(pinfo, t == 0x3d ? TNS_DATATYPE_INTERVAL_YM182 : TNS_DATATYPE_INTERVAL_DS183,
2376 o->data + at, (int)n);
2377 break;
2378 }
2379 if ( !text )
2380 return false0;
2381 /* numbers stand bare; dates and intervals are strings in JSON */
2382 if ( kind == TNS_OSON_NUMBER || kind == TNS_OSON_FLOAT )
2383 wmem_strbuf_append(buf, text);
2384 else
2385 tns_oson_append_string(buf, (const uint8_t *)text, (uint32_t)strlen(text));
2386 return true1;
2387}
2388
2389/* Open the container node at pos into frame f. A container's tag says
2390 * whether it is an object or an array (0x40), how wide its child count is
2391 * (bits 0x18: one, two or four bytes), and how wide its offsets are
2392 * (0x20). With both count bits set, an object shares another object's
2393 * field ids: the donor's offset - absolute even in relative mode - takes
2394 * the count's place, and the donor supplies the count and ids. */
2395static bool_Bool tns_oson_open(tns_oson_t *o, uint32_t pos, tns_oson_frame_t *f)
2396{
2397 uint8_t t = (uint8_t)tns_oson_uint(o, pos, 1);
2398 int off_size = (t & 0x20) ? 4 : 2;
2399 uint32_t at = pos + 1;
2400
2401 f->node_type = t;
2402 f->is_object = (t & 0x40) == 0;
2403 f->next = 0;
2404 f->container = pos - o->tree;
2405 switch ( t & 0x18 )
2406 {
2407 case 0x00: f->count = tns_oson_uint(o, at, 1); at += 1; break;
2408 case 0x08: f->count = tns_oson_uint(o, at, 2); at += 2; break;
2409 case 0x10: f->count = tns_oson_uint(o, at, 4); at += 4; break;
2410 default:
2411 {
2412 uint32_t donor = o->tree + tns_oson_uint(o, at, off_size);
2413 uint8_t dt = (uint8_t)tns_oson_uint(o, donor, 1);
2414 at += off_size;
2415 f->offsets_pos = at;
2416 switch ( dt & 0x18 )
2417 {
2418 case 0x00: f->count = tns_oson_uint(o, donor + 1, 1); f->ids_pos = donor + 2; break;
2419 case 0x08: f->count = tns_oson_uint(o, donor + 1, 2); f->ids_pos = donor + 3; break;
2420 case 0x10: f->count = tns_oson_uint(o, donor + 1, 4); f->ids_pos = donor + 5; break;
2421 default: return false0;
2422 }
2423 return !o->bad;
2424 }
2425 }
2426 if ( f->is_object )
2427 {
2428 f->ids_pos = at;
2429 f->offsets_pos = at + o->field_id_len * f->count;
2430 }
2431 else
2432 f->offsets_pos = at;
2433 return !o->bad;
2434}
2435
2436/* Render an OSON image as JSON text, or NULL when it is not one this
2437 * decoder understands. Containers are walked with an explicit stack, not
2438 * recursion, and the depth, the nodes visited and the text are bounded:
2439 * the offsets come off the wire and may point anywhere. */
2440static const char *tns_format_oson(packet_info *pinfo, const uint8_t *data, int len)
2441{
2442 tns_oson_t o = { data, (uint32_t)len, false0, 0, 1, false0, 0, NULL((void*)0), NULL((void*)0) };
2443 tns_oson_frame_t stack[TNS_OSON_MAX_DEPTH32];
2444 int depth = 0, nodes = 0;
2445 wmem_strbuf_t *buf;
2446 uint32_t pos, num_short, short_seg, num_long = 0, long_seg = 0;
2447 int short_off = 2, long_off = 4;
2448 uint16_t flags;
2449 uint8_t version;
2450
2451 if ( len < 6 || data[0] != 0xff || data[1] != 0x4a || data[2] != 0x5a )
2452 return NULL((void*)0);
2453 version = data[3];
2454 if ( version != 1 && version != 3 )
2455 return NULL((void*)0);
2456 flags = (uint16_t)tns_oson_uint(&o, 4, 2);
2457 o.relative = (flags & 0x01) != 0;
2458 pos = 6;
2459 buf = wmem_strbuf_new(pinfo->pool, "");
2460
2461 if ( flags & 0x10 )
2462 {
2463 /* a scalar document: the tree segment size, then the value */
2464 pos += (flags & 0x1000) ? 4 : 2;
2465 return tns_oson_scalar(pinfo, &o, pos, buf) ? wmem_strbuf_get_str(buf) : NULL((void*)0);
2466 }
2467
2468 if ( flags & 0x08 )
2469 {
2470 num_short = tns_oson_uint(&o, pos, 4);
2471 pos += 4;
2472 o.field_id_len = 4;
2473 }
2474 else if ( flags & 0x0400 )
2475 {
2476 num_short = tns_oson_uint(&o, pos, 2);
2477 pos += 2;
2478 o.field_id_len = 2;
2479 }
2480 else
2481 {
2482 num_short = tns_oson_uint(&o, pos, 1);
2483 pos += 1;
2484 }
2485 if ( flags & 0x0800 )
2486 {
2487 short_off = 4;
2488 short_seg = tns_oson_uint(&o, pos, 4);
2489 pos += 4;
2490 }
2491 else
2492 {
2493 short_seg = tns_oson_uint(&o, pos, 2);
2494 pos += 2;
2495 }
2496 /* version 3 adds a segment of field names over 255 bytes */
2497 if ( version == 3 )
2498 {
2499 if ( tns_oson_uint(&o, pos, 2) & 0x0100 )
2500 long_off = 2;
2501 num_long = tns_oson_uint(&o, pos + 2, 4);
2502 long_seg = tns_oson_uint(&o, pos + 6, 4);
2503 pos += 10;
2504 }
2505 pos += (flags & 0x1000) ? 4 : 2; /* tree segment size */
2506 pos += 2; /* number of tiny nodes */
2507 if ( o.bad || num_short > o.len || num_long > o.len )
2508 return NULL((void*)0);
2509
2510 o.num_names = num_short + num_long;
2511 o.names = wmem_alloc0_array(pinfo->pool, const uint8_t *, o.num_names + 1)((const uint8_t **)wmem_alloc0((pinfo->pool), (((((o.num_names
+ 1)) <= 0) || ((size_t)sizeof(const uint8_t *) > (9223372036854775807L
/ (size_t)((o.num_names + 1))))) ? 0 : (sizeof(const uint8_t
*) * ((o.num_names + 1))))))
;
2512 o.name_lens = wmem_alloc0_array(pinfo->pool, uint32_t, o.num_names + 1)((uint32_t*)wmem_alloc0((pinfo->pool), (((((o.num_names + 1
)) <= 0) || ((size_t)sizeof(uint32_t) > (9223372036854775807L
/ (size_t)((o.num_names + 1))))) ? 0 : (sizeof(uint32_t) * (
(o.num_names + 1))))))
;
2513 if ( num_short )
2514 pos = tns_oson_names(&o, pos, 0, num_short, 1, short_off, short_seg, 1);
2515 if ( num_long )
2516 pos = tns_oson_names(&o, pos, num_short, num_long, 2, long_off, long_seg, 2);
2517 if ( o.bad )
2518 return NULL((void*)0);
2519 o.tree = pos;
2520
2521 /* the root node */
2522 if ( !(tns_oson_uint(&o, pos, 1) & 0x80) )
2523 return tns_oson_scalar(pinfo, &o, pos, buf) ? wmem_strbuf_get_str(buf) : NULL((void*)0);
2524 if ( !tns_oson_open(&o, pos, &stack[0]) )
2525 return NULL((void*)0);
2526 wmem_strbuf_append_c(buf, stack[0].is_object ? '{' : '[');
2527 depth = 1;
2528
2529 while ( depth > 0 )
2530 {
2531 tns_oson_frame_t *f = &stack[depth - 1];
2532 uint32_t child, off;
2533
2534 if ( f->next == f->count )
2535 {
2536 wmem_strbuf_append_c(buf, f->is_object ? '}' : ']');
2537 depth--;
2538 continue;
2539 }
2540 if ( ++nodes > TNS_OSON_MAX_NODES4096 || wmem_strbuf_get_len(buf) > TNS_OSON_MAX_TEXT2048 )
2541 {
2542 wmem_strbuf_append(buf, "...");
2543 return wmem_strbuf_get_str(buf);
2544 }
2545 if ( f->next > 0 )
2546 wmem_strbuf_append(buf, ", ");
2547 if ( f->is_object )
2548 {
2549 uint32_t id = tns_oson_uint(&o, f->ids_pos + f->next * o.field_id_len, o.field_id_len);
2550 if ( o.bad || id == 0 || id > o.num_names )
2551 return NULL((void*)0);
2552 tns_oson_append_string(buf, o.names[id - 1], o.name_lens[id - 1]);
2553 wmem_strbuf_append(buf, ": ");
2554 }
2555 off = tns_oson_uint(&o, f->offsets_pos + f->next * ((f->node_type & 0x20) ? 4 : 2),
2556 (f->node_type & 0x20) ? 4 : 2);
2557 if ( o.relative )
2558 off += f->container;
2559 child = o.tree + off;
2560 f->next++;
2561 if ( o.bad )
2562 return NULL((void*)0);
2563
2564 if ( tns_oson_uint(&o, child, 1) & 0x80 )
2565 {
2566 if ( depth == TNS_OSON_MAX_DEPTH32 || !tns_oson_open(&o, child, &stack[depth]) )
2567 return NULL((void*)0);
2568 wmem_strbuf_append_c(buf, stack[depth].is_object ? '{' : '[');
2569 depth++;
2570 }
2571 else if ( !tns_oson_scalar(pinfo, &o, child, buf) )
2572 return NULL((void*)0);
2573 }
2574 return wmem_strbuf_get_str(buf);
2575}
2576
2577static void vsnum_to_vstext_basecustom(char *result, uint32_t vsnum)
2578{
2579 /*
2580 * Translate hex value to human readable version value, described at
2581 * http://docs.oracle.com/cd/B28359_01/server.111/b28310/dba004.htm
2582 */
2583 snprintf(result, ITEM_LABEL_LENGTH240, "%d.%d.%d.%d.%d",
2584 vsnum >> 24,
2585 (vsnum >> 20) & 0xf,
2586 (vsnum >> 12) & 0xf,
2587 (vsnum >> 8) & 0xf,
2588 vsnum & 0xff);
2589}
2590
2591/* The warning-flags byte of an error block: a PL/SQL object was created
2592 * with compilation errors, though the call itself succeeded. */
2593#define TNS_WARN_COMPILATION_ERROR0x20 0x20
2594
2595/* End-of-call status flags, carried by both TTI_OER and TTI_STA. */
2596#define TNS_CALL_STATUS_TXN_IN_PROGRESS0x00000002 0x00000002
2597#define TNS_CALL_STATUS_SESS_RELEASE0x00008000 0x00008000
2598
2599/* Show the warning flags of an error block, and say so when the
2600 * compilation-warning bit is set. */
2601static void tns_add_warn_flags(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
2602{
2603 proto_item *ti = proto_tree_add_item(tree, hf_tns_data_oer_warn_flags, tvb, offset, 1, ENC_NA0x00000000);
2604 proto_tree *wt = proto_item_add_subtree(ti, ett_tns_warn_flags);
2605
2606 proto_tree_add_item(wt, hf_tns_data_oer_warn_compile, tvb, offset, 1, ENC_NA0x00000000);
2607 if ( tvb_get_uint8(tvb, offset) & TNS_WARN_COMPILATION_ERROR0x20 )
2608 {
2609 expert_add_info(pinfo, ti, &ei_tns_data_compilation_error);
2610 col_append_str(pinfo->cinfo, COL_INFO, " [created with compilation errors]");
2611 }
2612}
2613
2614/* Break out the flag bits of a call status item. A client reads the
2615 * transaction bit to decide whether closing or releasing the connection
2616 * owes a rollback. */
2617static void tns_add_call_status_flags(proto_item *ti, tvbuff_t *tvb, int start, int len, uint32_t status)
2618{
2619 proto_tree *st = proto_item_add_subtree(ti, ett_tns_call_status);
2620 proto_tree_add_boolean(st, hf_tns_data_call_status_txn, tvb, start, len, status);
2621 proto_tree_add_boolean(st, hf_tns_data_call_status_sess_release, tvb, start, len, status);
2622}
2623
2624/* Decode an OAC (Oracle Access Column) descriptor — the type/format core
2625 * shared by describe columns and bind descriptors. Fields
2626 * use the Oracle variable-length form (get_sb4_custom). From field version
2627 * 12.1 the scale is a single signed byte, where 11g sends a variable-length
2628 * sb4 (NUMBER's default -127 as 0x81 0x7f), and the flag byte marks an
2629 * array bind; from 12.2 a ub4 oaccolid also follows the max size.
2630 * When col is not NULL it receives the type and data length.
2631 * Returns the new offset. */
2632static int dissect_tns_oac(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, tns_column_t *col)
2633{
2634 int v = 0, start;
2635 uint64_t u = 0;
2636 unsigned fv = tns_field_version(pinfo);
2637 bool_Bool fv_12_1 = fv >= TNS_FV_12_17, fv_12_2 = fv >= TNS_FV_12_28;
2638
2639 if ( col )
2640 col->type = tvb_get_uint8(tvb, offset);
2641 /* type (ub1) */
2642 proto_tree_add_item(tree, hf_tns_data_col_type, tvb, offset, 1, ENC_BIG_ENDIAN0x00000000);
2643 offset += 1;
2644 /* flag (ub1); from 12.1 it marks an array bind */
2645 if ( col && fv_12_1 )
2646 col->is_array = (tvb_get_uint8(tvb, offset) & TNS_BIND_ARRAY0x40) != 0;
2647 offset += 1;
2648 /* precision (sb1) */
2649 proto_tree_add_item(tree, hf_tns_data_col_precision, tvb, offset, 1, ENC_BIG_ENDIAN0x00000000);
2650 offset += 1;
2651 /* scale (may be negative — NUMBER default is -127) */
2652 start = offset;
2653 if ( fv_12_1 )
2654 {
2655 v = (int8_t)tvb_get_uint8(tvb, offset);
2656 offset += 1;
2657 }
2658 else
2659 offset += get_sb4_custom(tvb, offset, &v);
2660 proto_tree_add_int(tree, hf_tns_data_col_scale, tvb, start, offset - start, v);
2661 /* max data length / buffer size (ub4) */
2662 start = offset;
2663 offset += get_sb4_custom(tvb, offset, &v);
2664 proto_tree_add_uint(tree, hf_tns_data_col_max_length, tvb, start, offset - start, v);
2665 if ( col )
2666 col->data_len = (uint32_t)v;
2667 /* max array elements (ub4) */
2668 start = offset;
2669 offset += get_sb4_custom(tvb, offset, &v);
2670 if ( v > 0 )
2671 proto_tree_add_uint(tree, hf_tns_data_col_max_elements, tvb, start, offset - start, v);
2672 /* cont flags (ub8); below 12.1 they mark an array bind */
2673 offset += get_ub8_custom(tvb, offset, &u);
2674 if ( col && !fv_12_1 )
2675 col->is_array = (u & TNS_BIND_ARRAY0x40) != 0;
2676 /* type OID (bytes_with_length, skip) */
2677 offset += get_field_with_length(tvb, pinfo, offset, NULL((void*)0));
2678 /* version (ub4, skip) */
2679 offset += get_sb4_custom(tvb, offset, &v);
2680 /* charset id (ub4) */
2681 start = offset;
2682 offset += get_sb4_custom(tvb, offset, &v);
2683 proto_tree_add_uint(tree, hf_tns_data_col_charset, tvb, start, offset - start, v);
2684 /* charset form (ub1) */
2685 proto_tree_add_item(tree, hf_tns_data_col_csform, tvb, offset, 1, ENC_BIG_ENDIAN0x00000000);
2686 if ( col )
2687 col->csform = tvb_get_uint8(tvb, offset);
2688 offset += 1;
2689 /* max size (ub4) */
2690 start = offset;
2691 offset += get_sb4_custom(tvb, offset, &v);
2692 proto_tree_add_uint(tree, hf_tns_data_col_max_size, tvb, start, offset - start, v);
2693 /* oaccolid (ub4, skip) */
2694 if ( fv_12_2 )
2695 offset += get_sb4_custom(tvb, offset, &v);
2696
2697 return offset;
2698}
2699
2700/* Decode one per-column metadata block of a TTI_DCB describe (11g
2701 * shape): an OAC descriptor plus the nullability and naming fields.
2702 * When col is not NULL it receives what a row decoder needs.
2703 * Returns the new offset. */
2704static int dissect_tns_dcb_column(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, int idx, tns_column_t *col)
2705{
2706 unsigned fv = tns_field_version(pinfo);
2707 int start;
2708 proto_tree *col_tree;
2709 proto_item *col_item;
2710 int col_start = offset, v = 0;
2711 uint8_t col_type = tvb_get_uint8(tvb, offset);
2712 const char *name = NULL((void*)0);
2713
2714 col_tree = proto_tree_add_subtree_format(tree, tvb, offset, -1,
2715 ett_tns_dcb_col, &col_item, "Column %d", idx);
2716
2717 offset = dissect_tns_oac(tvb, pinfo, col_tree, offset, col);
2718
2719 /* nulls allowed (ub1) */
2720 proto_tree_add_item(col_tree, hf_tns_data_col_nulls_ok, tvb, offset, 1, ENC_BIG_ENDIAN0x00000000);
2721 offset += 1;
2722 /* v7 name length (ub1, skip) */
2723 offset += 1;
2724 /* column name (str_with_length) */
2725 int name_start = offset;
2726 offset += get_field_with_length(tvb, pinfo, offset, &name);
2727 if ( name )
2728 proto_tree_add_string(col_tree, hf_tns_data_col_name, tvb, name_start, offset - name_start, name);
2729 /* schema name, type name (str_with_length, skip) */
2730 offset += get_field_with_length(tvb, pinfo, offset, NULL((void*)0));
2731 offset += get_field_with_length(tvb, pinfo, offset, NULL((void*)0));
2732 /* column position (ub4, skip) */
2733 offset += get_sb4_custom(tvb, offset, &v);
2734 /* uds flags (ub4) — an 11g addition; it marks a JSON column */
2735 if ( !tns_before_11g(pinfo) )
2736 {
2737 start = offset;
2738 offset += get_sb4_custom(tvb, offset, &v);
2739 proto_tree_add_uint(col_tree, hf_tns_data_col_uds_flags, tvb, start, offset - start, v);
2740 }
2741 /* 23ai: the column's SQL domain, its annotations, and a vector
2742 * column's dimensions and format */
2743 if ( fv >= TNS_FV_23_117 )
2744 {
2745 const char *str = NULL((void*)0);
2746 start = offset;
2747 offset += get_field_with_length(tvb, pinfo, offset, &str);
2748 if ( str )
2749 proto_tree_add_string(col_tree, hf_tns_data_col_domain_schema, tvb, start, offset - start, str);
2750 start = offset;
2751 offset += get_field_with_length(tvb, pinfo, offset, &str);
2752 if ( str )
2753 proto_tree_add_string(col_tree, hf_tns_data_col_domain_name, tvb, start, offset - start, str);
2754 }
2755 if ( fv >= TNS_FV_23_1_EXT_320 )
2756 {
2757 int num = 0;
2758 offset += get_sb4_custom(tvb, offset, &num);
2759 if ( num > 0 )
2760 {
2761 offset += 1;
2762 offset += get_sb4_custom(tvb, offset, &num);
2763 offset += 1;
2764 for ( int i = 0; i < num && tvb_reported_length_remaining(tvb, offset) > 0; i++ )
2765 {
2766 const char *key = NULL((void*)0), *value = NULL((void*)0);
2767 start = offset;
2768 offset += get_field_with_length(tvb, pinfo, offset, &key);
2769 offset += get_field_with_length(tvb, pinfo, offset, &value);
2770 proto_tree_add_string_format_value(col_tree, hf_tns_data_col_annotation, tvb,
2771 start, offset - start, key ? key : "", "%s = %s",
2772 key ? key : "", value ? value : "");
2773 offset += get_sb4_custom(tvb, offset, &v); /* flags */
2774 }
2775 offset += get_sb4_custom(tvb, offset, &v); /* flags */
2776 }
2777 }
2778 if ( fv >= TNS_FV_23_424 )
2779 {
2780 start = offset;
2781 offset += get_sb4_custom(tvb, offset, &v);
2782 proto_tree_add_uint(col_tree, hf_tns_data_col_vector_dims, tvb, start, offset - start, v);
2783 proto_tree_add_item(col_tree, hf_tns_data_col_vector_format, tvb, offset, 1, ENC_NA0x00000000);
2784 offset += 1;
2785 offset += 1; /* vector flags */
2786 }
2787
2788 if ( name )
2789 proto_item_append_text(col_item, ": %s (%s)", name,
2790 val_to_str_const(col_type, tns_data_types, "unknown"));
2791 proto_item_set_len(col_item, offset - col_start);
2792 return offset;
2793}
2794
2795/* Decode a describe body - the column metadata of a result set - as a
2796 * TTI_DCB carries it after its preamble: a ub4 max row size, a ub4 column
2797 * count, a reserved byte when there are columns, the columns, and a
2798 * trailer. When out is not NULL it receives the columns, allocated in
2799 * file scope. Returns the new offset. */
2800static int dissect_tns_describe_body(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, tns_describe_t **out)
2801{
2802 int v = 0, num_cols = 0, nc_start;
2803 tns_column_t *cols = NULL((void*)0);
2804
2805 /* max row size (ub4, skip) */
2806 offset += get_sb4_custom(tvb, offset, &v);
2807 /* number of columns */
2808 nc_start = offset;
2809 offset += get_sb4_custom(tvb, offset, &num_cols);
2810 proto_tree_add_uint(tree, hf_tns_data_dcb_num_columns, tvb, nc_start, offset - nc_start, num_cols);
2811 /* The count comes off the wire and sizes the allocation below, so a
2812 * count larger than the data left cannot be real - report it and
2813 * decode no columns. */
2814 if ( num_cols < 0 ||
2815 (unsigned)num_cols > tvb_reported_length_remaining(tvb, offset) )
2816 {
2817 proto_tree_add_expert(tree, pinfo, &ei_tns_data_count_too_large,
2818 tvb, nc_start, offset - nc_start);
2819 num_cols = 0;
2820 }
2821 if ( num_cols > 0 )
2822 offset += 1; /* reserved byte */
2823
2824 if ( out && num_cols > 0 )
2825 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
))))))
;
2826 for ( int i = 0; i < num_cols && tvb_reported_length_remaining(tvb, offset) > 0; i++ )
2827 offset = dissect_tns_dcb_column(tvb, pinfo, tree, offset, i + 1,
2828 cols ? &cols[i] : NULL((void*)0));
2829 if ( cols )
2830 {
2831 tns_describe_t *desc = wmem_new0(wmem_file_scope(), tns_describe_t)((tns_describe_t*)wmem_alloc0((wmem_file_scope()), sizeof(tns_describe_t
)))
;
2832 desc->num_cols = num_cols;
2833 desc->cols = cols;
2834 *out = desc;
2835 }
2836
2837 /* Trailer: current date (bytes_with_length), four ub4 flags,
2838 * and the query-cache key (bytes_with_length) — all skipped. The key
2839 * came with the 11g result cache: a 10g describe ends after the
2840 * flags. */
2841 offset += get_field_with_length(tvb, pinfo, offset, NULL((void*)0));
2842 for ( int i = 0; i < 4; i++ )
2843 offset += get_sb4_custom(tvb, offset, &v);
2844 if ( !tns_before_11g(pinfo) )
2845 offset += get_field_with_length(tvb, pinfo, offset, NULL((void*)0));
2846 return offset;
2847}
2848
2849static tns_call_t *tns_answered_call(packet_info *pinfo);
2850
2851/* A BFILE's locator names its file: a big-endian ub2 length and the
2852 * directory object's name, then a ub2 length and the file name, which end
2853 * the locator. They start 16 bytes into the locator as a value carries it,
2854 * behind its own ub2 length, and 14 bytes in in a LOB operation, which
2855 * sends it without that length. Finds the names in the len bytes at
2856 * offset, or returns false. */
2857static bool_Bool tns_bfile_names(tvbuff_t *tvb, int offset, int len,
2858 int *dir_off, int *dir_len, int *file_off, int *file_len)
2859{
2860 static const int bases[] = { 16, 14 };
2861
2862 for ( unsigned i = 0; i < array_length(bases)(sizeof (bases) / sizeof (bases)[0]); i++ )
2863 {
2864 int b = bases[i], dl, fl;
2865
2866 if ( len < b + 4 )
2867 continue;
2868 dl = tvb_get_ntohs(tvb, offset + b);
2869 if ( dl == 0 || b + 2 + dl + 2 > len )
2870 continue;
2871 fl = tvb_get_ntohs(tvb, offset + b + 2 + dl);
2872 if ( fl == 0 || b + 2 + dl + 2 + fl != len )
2873 continue;
2874 if ( !tvb_utf_8_isprint(tvb, offset + b + 2, dl)
2875 || !tvb_utf_8_isprint(tvb, offset + b + 2 + dl + 2, fl) )
2876 continue;
2877 *dir_off = offset + b + 2;
2878 *dir_len = dl;
2879 *file_off = offset + b + 2 + dl + 2;
2880 *file_len = fl;
2881 return true1;
2882 }
2883 return false0;
2884}
2885
2886/* Where a value is being carried, which decides the framing some types
2887 * use: a fetched row column, a value a client binds, or a value a server
2888 * returns for a bind - an OUT or IN OUT bind, or a RETURNING one. */
2889typedef enum {
2890 TNS_VALUE_FETCH,
2891 TNS_VALUE_BIND,
2892 TNS_VALUE_OUT
2893} tns_value_kind_t;
2894
2895/* Decode one row/bind value by its data type, and add it as a
2896 * "<prefix> N (TYPE)" item under `hf`. Ordinary values are a
2897 * DALC blob; ROWID / UROWID / LONG / LOB / JSON / VECTOR / object carry
2898 * their own framings - though out of a fetch (fetch false: a bind or OUT
2899 * value) a ROWID or UROWID is its string and a LONG has no trailing
2900 * indicators. Returns the new offset. */
2901static int dissect_tns_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, uint8_t dtype, uint8_t csform, tns_value_kind_t kind, int idx, int hf, const char *prefix)
2902{
2903 int v_start = offset, disp_start = offset, v = 0;
2904 int is_null = 0, is_absent = 0;
2905 uint8_t first;
2906 const char *rendered = NULL((void*)0);
2907 /* LOB metadata: size and chunk size, with where they sit */
2908 bool_Bool lob_meta = false0;
2909 uint64_t lob_size = 0;
2910 int lob_chunk = 0, size_start = 0, size_len = 0, lchunk_start = 0, lchunk_len = 0;
2911 int image_start = 0, image_len = 0, obj_toid_start = 0, obj_toid_len = 0;
2912 proto_item *ti;
2913 uint8_t frame = dtype;
2914
2915 if ( kind != TNS_VALUE_FETCH && (dtype == TNS_DATATYPE_ROWID11 || dtype == TNS_DATATYPE_UROWID208
2916 || dtype == TNS_DATATYPE_LONG8) )
2917 frame = TNS_DATATYPE_VARCHAR1;
2918 else if ( kind != TNS_VALUE_FETCH && dtype == TNS_DATATYPE_LONG_RAW24 )
2919 frame = TNS_DATATYPE_RAW23;
2920
2921 switch ( frame )
2922 {
2923 case TNS_DATATYPE_REFCURSOR102:
2924 {
2925 /* A cursor - a CURSOR(...) column, or a REF CURSOR OUT
2926 * bind: a ub1 length (a fixed value, ignored), the describe
2927 * of the cursor's result set inline, and the ub2 id the
2928 * client drains it with. The value's length is known only
2929 * once the describe is read, so read it once to size the
2930 * item and again to show it. */
2931 proto_item *ci;
2932 proto_tree *ct;
2933 int end, cursor = 0, start;
2934 const tns_call_t *call = tns_answered_call(pinfo);
2935
2936 /* Rows a TTI_FETCH returns carry a cursor cut short before
2937 * 23ai: the length byte and the id, with no describe. An
2938 * execute's reply, and a fetch-only execute's, carry it
2939 * whole. */
2940 if ( call && call->func == TTI_FETCH5 && tns_field_version(pinfo) < TNS_FV_23_117 )
2941 {
2942 start = offset;
2943 end = offset + 1;
2944 end += get_sb4_custom(tvb, end, &cursor);
2945 ci = proto_tree_add_bytes_format(tree, hf, tvb, start, end - start, NULL((void*)0),
2946 "%s %d (%s): cursor %d", prefix, idx,
2947 val_to_str_const(dtype, tns_data_types, "unknown"), cursor);
2948 ct = proto_item_add_subtree(ci, ett_tns_value);
2949 proto_tree_add_uint(ct, hf_tns_cursor, tvb, offset + 1, end - offset - 1, cursor);
2950 return end;
2951 }
2952
2953 end = dissect_tns_describe_body(tvb, pinfo, NULL((void*)0), offset + 1, NULL((void*)0));
2954 end += get_sb4_custom(tvb, end, &cursor);
2955 ci = proto_tree_add_bytes_format(tree, hf, tvb, offset, end - offset, NULL((void*)0),
2956 "%s %d (%s): cursor %d", prefix, idx,
2957 val_to_str_const(dtype, tns_data_types, "unknown"), cursor);
2958 ct = proto_item_add_subtree(ci, ett_tns_value);
2959 offset = dissect_tns_describe_body(tvb, pinfo, ct, offset + 1, NULL((void*)0));
2960 start = offset;
2961 offset += get_sb4_custom(tvb, offset, &cursor);
2962 proto_tree_add_uint(ct, hf_tns_cursor, tvb, start, offset - start, cursor);
2963 return offset;
2964 }
2965
2966 case TNS_DATATYPE_ADT109:
2967 {
2968 /* An object - or an XMLType, which is an ADT by describe - is
2969 * framed the same way whether it is NULL or not:
2970 * bytes_with_length type OID | bytes_with_length OID |
2971 * bytes_with_length snapshot | ub2 version |
2972 * ub4 image length | ub2 flags | [DALC image]
2973 * A NULL object has an image length of 0 and no image. */
2974 int toid_start = offset, img_len = 0;
2975 offset += get_field_with_length(tvb, pinfo, offset, NULL((void*)0));
2976 obj_toid_start = toid_start;
2977 obj_toid_len = offset - toid_start;
2978 offset += get_field_with_length(tvb, pinfo, offset, NULL((void*)0)); /* OID */
2979 offset += get_field_with_length(tvb, pinfo, offset, NULL((void*)0)); /* snapshot */
2980 offset += get_sb4_custom(tvb, offset, &v); /* version */
2981 offset += get_sb4_custom(tvb, offset, &img_len);
2982 offset += get_sb4_custom(tvb, offset, &v); /* flags */
2983 if ( img_len > 0 )
2984 {
2985 image_start = offset;
2986 offset += get_dalc_custom(tvb, pinfo, offset, NULL((void*)0));
2987 image_len = offset - image_start;
2988 rendered = wmem_strdup_printf(pinfo->pool, "object, %d-byte image", img_len);
2989 }
2990 else
2991 rendered = "NULL object";
2992 break;
2993 }
2994
2995 case TNS_DATATYPE_JSON119: /* OSON */
2996 case TNS_DATATYPE_VECTOR127:
2997 /* LOB-class, but the value itself rides in the row: the LOB
2998 * metadata framing with the image spliced in ahead of the
2999 * locator,
3000 * ub4 locator length | ub8 image size | ub4 chunk size |
3001 * DALC image | DALC locator
3002 * The locator is a placeholder. A 0x00 is NULL. A server may
3003 * instead send a bare locator, as for a CLOB, and leave the
3004 * image to a LOB read; that is told apart as for a CLOB.
3005 *
3006 * A bind sends the locator and the image behind it, and a
3007 * value a server returns for a bind is the LOB block alone,
3008 * as for a CLOB. */
3009 first = tvb_get_uint8(tvb, offset);
3010 if ( first == 0 )
3011 {
3012 offset += 1;
3013 is_null = 1;
3014 break;
3015 }
3016 offset += get_sb4_custom(tvb, offset, &v);
3017 if ( kind == TNS_VALUE_OUT )
3018 {
3019 lob_meta = true1;
3020 size_start = offset;
3021 offset += get_ub8_custom(tvb, offset, &lob_size);
3022 size_len = offset - size_start;
3023 lchunk_start = offset;
3024 offset += get_sb4_custom(tvb, offset, &lob_chunk);
3025 lchunk_len = offset - lchunk_start;
3026 offset += get_dalc_custom(tvb, pinfo, offset, NULL((void*)0));
3027 rendered = wmem_strdup_printf(pinfo->pool, "locator, size %" PRIu64"l" "u", lob_size);
3028 break;
3029 }
3030 if ( kind == TNS_VALUE_BIND )
3031 {
3032 /* the locator the value rides under, then the image */
3033 offset += get_dalc_custom(tvb, pinfo, offset, NULL((void*)0));
3034 image_start = offset;
3035 offset += get_dalc_custom(tvb, pinfo, offset, NULL((void*)0));
3036 image_len = offset - image_start;
3037 }
3038 else if ( v > 8 && tvb_get_uint8(tvb, offset) == v )
3039 {
3040 /* bare locator */
3041 offset += get_dalc_custom(tvb, pinfo, offset, NULL((void*)0));
3042 rendered = "locator only";
3043 break;
3044 }
3045 else
3046 {
3047 lob_meta = true1;
3048 size_start = offset;
3049 offset += get_ub8_custom(tvb, offset, &lob_size);
3050 size_len = offset - size_start;
3051 lchunk_start = offset;
3052 offset += get_sb4_custom(tvb, offset, &lob_chunk);
3053 lchunk_len = offset - lchunk_start;
3054 image_start = offset;
3055 offset += get_dalc_custom(tvb, pinfo, offset, NULL((void*)0));
3056 image_len = offset - image_start;
3057 offset += get_dalc_custom(tvb, pinfo, offset, NULL((void*)0));
3058 }
3059 if ( image_len > 1 )
3060 {
3061 int img_len = 0;
3062 const uint8_t *img = tns_dalc_bytes(tvb, pinfo, image_start, &img_len);
3063 if ( img )
3064 rendered = dtype == TNS_DATATYPE_VECTOR127 ? tns_format_vector(pinfo, img, img_len)
3065 : tns_format_oson(pinfo, img, img_len);
3066 }
3067 if ( !rendered )
3068 rendered = wmem_strdup_printf(pinfo->pool, "%s image, %d bytes",
3069 dtype == TNS_DATATYPE_JSON119 ? "OSON" : "vector",
3070 lob_meta ? (int)lob_size : image_len - 1);
3071 break;
3072
3073 case TNS_DATATYPE_ROWID11:
3074 {
3075 /* a present indicator (0 / 0xff = NULL), then the object id
3076 * (ub4), file number (ub2), an unused byte, block number
3077 * (ub4) and slot number (ub2) */
3078 int rba = 0, part = 0, block = 0, slot = 0;
3079 first = tvb_get_uint8(tvb, offset);
3080 offset += 1;
3081 if ( first == 0 || first == 0xff )
3082 {
3083 is_null = 1;
3084 break;
3085 }
3086 offset += get_sb4_custom(tvb, offset, &rba);
3087 offset += get_sb4_custom(tvb, offset, &part);
3088 offset += 1;
3089 offset += get_sb4_custom(tvb, offset, &block);
3090 offset += get_sb4_custom(tvb, offset, &slot);
3091 rendered = tns_format_rowid(pinfo, (uint32_t)rba, (uint32_t)part, (uint32_t)block, (uint32_t)slot);
3092 break;
3093 }
3094
3095 case TNS_DATATYPE_UROWID208: /* ub4 num_bytes, a length echo byte, then the bytes */
3096 offset += get_sb4_custom(tvb, offset, &v);
3097 if ( v > 0 )
3098 {
3099 offset += 1;
3100 rendered = tns_format_urowid(pinfo, tvb_get_ptr(tvb, offset, v), v);
3101 offset += v;
3102 }
3103 else
3104 is_null = 1;
3105 break;
3106
3107 case TNS_DATATYPE_LONG8:
3108 case TNS_DATATYPE_LONG_RAW24: /* value then two trailing ub4 length indicators */
3109 first = tvb_get_uint8(tvb, offset);
3110 if ( first == 0 )
3111 {
3112 offset += 1;
3113 is_null = 1;
3114 }
3115 else if ( first == 0xfe ) /* chunked */
3116 offset += 1 + tns_chunks_len(tvb, pinfo, offset + 1, NULL((void*)0));
3117 else
3118 offset += 1 + first;
3119 offset += get_sb4_custom(tvb, offset, &v);
3120 offset += get_sb4_custom(tvb, offset, &v);
3121 break;
3122
3123 case TNS_DATATYPE_CLOB112:
3124 case TNS_DATATYPE_BLOB113:
3125 case TNS_DATATYPE_BFILE114:
3126 /* 0x00 NULL, else a ub4 locator length and the locator. A
3127 * server sends CLOB / BLOB in one of two forms: with the LOB's
3128 * size (ub8) and chunk size (ub4) between the two, or bare -
3129 * and which one it picks for a client is not known. They are
3130 * told apart by the byte after the length: the bare form's is
3131 * the locator's own length prefix (or 0xFE when chunked), the
3132 * metadata form's is the size's width, at most 8. A real
3133 * locator is far longer than 8 bytes, so the two cannot meet.
3134 * A BFILE is always bare, as is the locator a client binds;
3135 * a value a server returns for a bind always carries the
3136 * size and chunk size. */
3137 first = tvb_get_uint8(tvb, offset);
3138 if ( first == 0 )
3139 {
3140 offset += 1;
3141 is_null = 1;
3142 }
3143 else
3144 {
3145 offset += get_sb4_custom(tvb, offset, &v);
3146 if ( dtype != TNS_DATATYPE_BFILE114 && v > 8 && kind != TNS_VALUE_BIND )
3147 {
3148 uint8_t next = tvb_get_uint8(tvb, offset);
3149 if ( kind == TNS_VALUE_OUT || (next <= 8 && next != v) )
3150 {
3151 lob_meta = true1;
3152 size_start = offset;
3153 offset += get_ub8_custom(tvb, offset, &lob_size);
3154 size_len = offset - size_start;
3155 lchunk_start = offset;
3156 offset += get_sb4_custom(tvb, offset, &lob_chunk);
3157 lchunk_len = offset - lchunk_start;
3158 rendered = wmem_strdup_printf(pinfo->pool, "locator, size %" PRIu64"l" "u", lob_size);
3159 }
3160 }
3161 int loc_start = offset, dir_off, dir_len, file_off, file_len;
3162 uint8_t loc_len = tvb_get_uint8(tvb, offset);
3163 offset += get_dalc_custom(tvb, pinfo, offset, NULL((void*)0));
3164 if ( dtype == TNS_DATATYPE_BFILE114 && loc_len <= 0xfc
3165 && tns_bfile_names(tvb, loc_start + 1, loc_len, &dir_off, &dir_len, &file_off, &file_len) )
3166 rendered = wmem_strdup_printf(pinfo->pool, "BFILENAME('%s', '%s')",
3167 tvb_get_string_enc(pinfo->pool, tvb, dir_off, dir_len, ENC_UTF_80x00000002),
3168 tvb_get_string_enc(pinfo->pool, tvb, file_off, file_len, ENC_UTF_80x00000002));
3169 if ( !rendered )
3170 rendered = "locator";
3171 }
3172 break;
3173
3174 default: /* ordinary: a single DALC value */
3175 first = tvb_get_uint8(tvb, offset);
3176 offset += get_dalc_custom(tvb, pinfo, offset, NULL((void*)0));
3177 if ( first == 0 )
3178 is_null = 1;
3179 else if ( first == TNS_DALC_ABSENT0xFD )
3180 is_absent = 1;
3181 else
3182 {
3183 disp_start = v_start + 1; /* show the value bytes, not the length */
3184 /* Render common scalar types (never chunked): NUMBER as
3185 * decimal, DATE / TIMESTAMP / TIMESTAMP LTZ as a datetime. */
3186 if ( first != 254 && offset > disp_start )
3187 {
3188 const uint8_t *vb = tvb_get_ptr(tvb, disp_start, offset - disp_start);
3189 int vlen = offset - disp_start;
3190 /* A BINARY_INTEGER carries NUMBER bytes, not a native
3191 * integer. */
3192 if ( dtype == TNS_DATATYPE_NUMBER2 || dtype == TNS_DATATYPE_INTEGER3 )
3193 rendered = tns_format_number(pinfo, vb, vlen);
3194 else if ( dtype == TNS_DATATYPE_DATE12 || dtype == TNS_DATATYPE_TIMESTAMP180 || dtype == TNS_DATATYPE_TIMESTAMP_LTZ231 )
3195 rendered = tns_format_date(pinfo, vb, vlen);
3196 else if ( dtype == TNS_DATATYPE_TIMESTAMP_TZ181 )
3197 rendered = tns_format_timestamp_tz(pinfo, vb, vlen);
3198 else if ( (dtype == TNS_DATATYPE_INTERVAL_YM182 || dtype == TNS_DATATYPE_INTERVAL_DS183) && vlen >= 5 )
3199 rendered = tns_format_interval(pinfo, dtype, vb, vlen);
3200 else if ( dtype == TNS_DATATYPE_BOOLEAN252 )
3201 /* an encoded integer: 00 false, 01 01 true */
3202 rendered = vb[0] == 1 ? "TRUE" : "FALSE";
3203 else if ( dtype == TNS_DATATYPE_BINARY_FLOAT100 || dtype == TNS_DATATYPE_BINARY_DOUBLE101 )
3204 rendered = tns_format_binary_float(pinfo, vb, vlen);
3205 else if ( frame == TNS_DATATYPE_VARCHAR1 || dtype == TNS_DATATYPE_STRING5 || dtype == TNS_DATATYPE_CHAR96 )
3206 /* VARCHAR / STRING / CHAR: character data, in the
3207 * session charset (ordinarily UTF-8), or UTF-16BE
3208 * for the national charset form (NCHAR,
3209 * NVARCHAR2) - in a column and an OUT bind alike. */
3210 rendered = (const char *)tvb_get_string_enc(pinfo->pool,
3211 tvb, disp_start, vlen,
3212 csform == TNS_CSFORM_NCHAR2 ? ENC_UTF_160x00000004|ENC_BIG_ENDIAN0x00000000 : ENC_UTF_80x00000002|ENC_NA0x00000000);
3213 }
3214 }
3215 break;
3216 }
3217
3218 if ( is_null )
3219 proto_tree_add_bytes_format(tree, hf, tvb,
3220 v_start, offset - v_start, NULL((void*)0), "%s %d (%s): NULL", prefix, idx,
3221 val_to_str_const(dtype, tns_data_types, "unknown"));
3222 else if ( is_absent )
3223 proto_tree_add_bytes_format(tree, hf, tvb,
3224 v_start, offset - v_start, NULL((void*)0), "%s %d (%s): no value", prefix, idx,
3225 val_to_str_const(dtype, tns_data_types, "unknown"));
3226 else if ( rendered )
3227 {
3228 ti = proto_tree_add_bytes_format(tree, hf, tvb,
3229 disp_start, offset - disp_start, NULL((void*)0), "%s %d (%s): %s", prefix, idx,
3230 val_to_str_const(dtype, tns_data_types, "unknown"), rendered);
3231 if ( dtype == TNS_DATATYPE_ADT109 )
3232 {
3233 proto_tree *vt = proto_item_add_subtree(ti, ett_tns_value);
3234 /* the type OID, without its ub4 count and DALC length */
3235 if ( obj_toid_len > 2 )
3236 {
3237 int w = 1 + (tvb_get_uint8(tvb, obj_toid_start) & 0x7f);
3238 proto_tree_add_item(vt, hf_tns_data_obj_toid, tvb,
3239 obj_toid_start + w + 1, obj_toid_len - w - 1, ENC_NA0x00000000);
3240 }
3241 if ( image_len > 1 )
3242 {
3243 bool_Bool chunked = tvb_get_uint8(tvb, image_start) == 0xfe;
3244 proto_tree_add_item(vt, hf_tns_data_obj_image, tvb,
3245 chunked ? image_start : image_start + 1, chunked ? image_len : image_len - 1, ENC_NA0x00000000);
3246 }
3247 }
3248 if ( lob_meta )
3249 {
3250 proto_tree *vt = proto_item_add_subtree(ti, ett_tns_value);
3251 proto_tree_add_uint64(vt, hf_tns_data_lob_size, tvb, size_start, size_len, lob_size);
3252 proto_tree_add_uint(vt, hf_tns_data_lob_chunk_size, tvb, lchunk_start, lchunk_len, lob_chunk);
3253 /* the image of a prefetched JSON / VECTOR value, without its
3254 * DALC length byte (chunked images are shown whole) */
3255 if ( image_len > 1 )
3256 {
3257 bool_Bool chunked = tvb_get_uint8(tvb, image_start) == 0xfe;
3258 proto_tree_add_item(vt, dtype == TNS_DATATYPE_JSON119 ? hf_tns_data_json_image : hf_tns_data_vector_image,
3259 tvb, chunked ? image_start : image_start + 1, chunked ? image_len : image_len - 1, ENC_NA0x00000000);
3260 }
3261 }
3262 }
3263 else
3264 proto_tree_add_bytes_format(tree, hf, tvb,
3265 disp_start, offset - disp_start, NULL((void*)0), "%s %d (%s)", prefix, idx,
3266 val_to_str_const(dtype, tns_data_types, "unknown"));
3267 return offset;
3268}
3269
3270/* The describe a row-data message is split by: the conversation's most
3271 * recent one, stored per packet on the first pass so a later pass uses
3272 * the same. */
3273static tns_describe_t *tns_current_describe(packet_info *pinfo)
3274{
3275 tns_describe_t *desc;
3276
3277 if ( PINFO_FD_VISITED(pinfo)((pinfo)->fd->visited) )
3278 return (tns_describe_t *)p_get_proto_data(wmem_file_scope(), pinfo,
3279 proto_tns, TNS_PROTO_DATA_DESCRIBE1);
3280
3281 desc = tns_get_conv_info(pinfo)->last_describe;
3282 if ( desc && !p_get_proto_data(wmem_file_scope(), pinfo, proto_tns, TNS_PROTO_DATA_DESCRIBE1) )
3283 p_add_proto_data(wmem_file_scope(), pinfo, proto_tns,
3284 TNS_PROTO_DATA_DESCRIBE1, desc);
3285 return desc;
3286}
3287
3288/* Count the RETURNING ... INTO binds of a statement: the placeholders
3289 * after INTO, in a DML statement that has RETURNING ... INTO. Each
3290 * placeholder is a bind of its own, and those after INTO come last. A
3291 * PL/SQL block is never this form - a RETURNING INTO inside one is its
3292 * own PL/SQL, and its target an ordinary OUT bind. String literals and
3293 * comments are skipped. */
3294static unsigned tns_count_return_binds(const char *sql)
3295{
3296 const char *p = sql;
3297 bool_Bool first_word = true1, returning = false0, into = false0;
3298 unsigned n = 0;
3299
3300 while ( *p )
3301 {
3302 if ( *p == '\'' )
3303 {
3304 for ( p++; *p && *p != '\''; p++ )
3305 ;
3306 if ( *p )
3307 p++;
3308 }
3309 else if ( p[0] == '-' && p[1] == '-' )
3310 {
3311 while ( *p && *p != '\n' )
3312 p++;
3313 }
3314 else if ( p[0] == '/' && p[1] == '*' )
3315 {
3316 const char *end = strstr(p + 2, "*/");
3317 p = end ? end + 2 : p + strlen(p);
3318 }
3319 else if ( g_ascii_isalpha(*p)((g_ascii_table[(guchar) (*p)] & G_ASCII_ALPHA) != 0) )
3320 {
3321 const char *w = p;
3322 size_t len;
3323 while ( g_ascii_isalnum(*p)((g_ascii_table[(guchar) (*p)] & G_ASCII_ALNUM) != 0) || *p == '_' || *p == '$' || *p == '#' )
3324 p++;
3325 len = p - w;
3326 if ( first_word )
3327 {
3328 first_word = false0;
3329 if ( !((len == 6 && (g_ascii_strncasecmp(w, "INSERT", 6) == 0
3330 || g_ascii_strncasecmp(w, "UPDATE", 6) == 0
3331 || g_ascii_strncasecmp(w, "DELETE", 6) == 0))
3332 || (len == 5 && g_ascii_strncasecmp(w, "MERGE", 5) == 0)) )
3333 return 0;
3334 }
3335 else if ( !returning && len == 9 && g_ascii_strncasecmp(w, "RETURNING", 9) == 0 )
3336 returning = true1;
3337 else if ( returning && !into && len == 4 && g_ascii_strncasecmp(w, "INTO", 4) == 0 )
3338 into = true1;
3339 }
3340 else if ( *p == ':' && into && (g_ascii_isalnum(p[1])((g_ascii_table[(guchar) (p[1])] & G_ASCII_ALNUM) != 0) || p[1] == '_' || p[1] == '"') )
3341 {
3342 n++;
3343 for ( p++; g_ascii_isalnum(*p)((g_ascii_table[(guchar) (*p)] & G_ASCII_ALNUM) != 0) || *p == '_' || *p == '"'; p++ )
3344 ;
3345 }
3346 else
3347 p++;
3348 }
3349 return n;
3350}
3351
3352/* Look up the bind types remembered for a cursor, for an execute that
3353 * sends its values without descriptors. Stashed per packet on the first
3354 * pass, so a later pass gets the same answer. */
3355static tns_binds_t *tns_lookup_cursor_binds(packet_info *pinfo, uint32_t cursor)
3356{
3357 if ( PINFO_FD_VISITED(pinfo)((pinfo)->fd->visited) )
3358 return (tns_binds_t *)p_get_proto_data(wmem_file_scope(), pinfo, proto_tns, TNS_PROTO_DATA_BINDS2);
3359
3360 tns_conv_info_t *tns_info = tns_get_conv_info(pinfo);
3361 tns_binds_t *binds = (tns_binds_t *)wmem_map_lookup(tns_info->cursor_binds, GUINT_TO_POINTER(cursor)((gpointer) (gulong) (cursor)));
3362 if ( binds )
3363 p_add_proto_data(wmem_file_scope(), pinfo, proto_tns, TNS_PROTO_DATA_BINDS2, binds);
3364 return binds;
3365}
3366
3367/* Whether a bind is LONG-class: a LONG or LONG RAW whose buffer exceeds
3368 * the longest string a server takes in place. */
3369static bool_Bool tns_is_long_bind(const tns_column_t *col)
3370{
3371 return (col->type == TNS_DATATYPE_LONG8 || col->type == TNS_DATATYPE_LONG_RAW24)
3372 && col->data_len > 4000;
3373}
3374
3375/* Decode one bind's value in a bind row or an OUT reply, framed as out of
3376 * a fetch. An array bind's value is a ub4 element count and that many
3377 * elements. In an OUT reply each value - each element of an array - is
3378 * followed by its sb4 return code. Returns the new offset. */
3379/* After each value a server returns for a bind - an OUT bind or a
3380 * RETURNING one, never a fetched column - comes an sb4 with the value's
3381 * actual length: 0 when it fitted, -1 when it is NULL, and otherwise the
3382 * length the value had before the server cut it to the size the client
3383 * declared. Only a value that arrived as plain bytes can have been cut -
3384 * VARCHAR2, CHAR or RAW; the others are fixed width or carry framing of
3385 * their own. value_start is where the value began. Returns the new
3386 * offset. */
3387static int dissect_tns_actual_length(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset,
3388 int value_start, uint8_t dtype)
3389{
3390 int actual = 0, start = offset, got = 0;
3391 proto_item *ti;
3392
3393 offset += get_sb4_custom(tvb, offset, &actual);
3394 ti = proto_tree_add_int(tree, hf_tns_data_bind_actual_len, tvb, start, offset - start, actual);
3395 if ( actual == -1 )
3396 proto_item_append_text(ti, " (NULL)");
3397 else if ( actual > 0 && (dtype == TNS_DATATYPE_VARCHAR1 || dtype == TNS_DATATYPE_CHAR96
3398 || dtype == TNS_DATATYPE_RAW23 || dtype == TNS_DATATYPE_LONG8 || dtype == TNS_DATATYPE_LONG_RAW24) )
3399 {
3400 /* A server may echo the length of a value that fitted, so the
3401 * value is cut only when it had more than arrived. */
3402 tns_dalc_bytes(tvb, pinfo, value_start, &got);
3403 if ( actual > got )
3404 {
3405 proto_item_append_text(ti, " (truncated to %d)", got);
3406 expert_add_info_format(pinfo, ti, &ei_tns_data_value_truncated,
3407 "The value was cut to %d of its %d", got, actual);
3408 col_append_str(pinfo->cinfo, COL_INFO, " [truncated]");
3409 }
3410 }
3411 return offset;
3412}
3413
3414static int dissect_tns_bind_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, const tns_column_t *col, int idx, bool_Bool out)
3415{
3416 int num = 1, start;
3417
3418 if ( col->is_array )
3419 {
3420 start = offset;
3421 offset += get_sb4_custom(tvb, offset, &num);
3422 proto_tree_add_uint(tree, hf_tns_data_bind_num_elements, tvb, start, offset - start, num);
3423 }
3424 for ( int i = 0; i < num && tvb_reported_length_remaining(tvb, offset) > 0; i++ )
3425 {
3426 start = offset;
3427 offset = dissect_tns_value(tvb, pinfo, tree, offset, col->type, col->csform,
3428 out ? TNS_VALUE_OUT : TNS_VALUE_BIND, idx, hf_tns_data_bind_value, "Bind");
3429 if ( out )
3430 offset = dissect_tns_actual_length(tvb, pinfo, tree, offset, start, col->type);
3431 }
3432 return offset;
3433}
3434
3435/* Decode the TTI_RXD value rows of a bind section - one row per
3436 * execution - with each value typed by cols[]. Returns the new offset. */
3437static int dissect_tns_bind_rows(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, const tns_column_t *cols, uint32_t count, bool_Bool plsql, const uint8_t *dirs)
3438{
3439 int rownum = 0;
3440
3441 while ( tvb_reported_length_remaining(tvb, offset) > 0
3442 && tvb_get_uint8(tvb, offset) == SQLNET_ROW_TRANSF_DATA7 )
3443 {
3444 proto_tree *row_tree;
3445 proto_item *row_item;
3446 int r_start = offset;
3447
3448 offset += 1; /* TTI_RXD token */
3449 row_tree = proto_tree_add_subtree_format(tree, tvb, offset, -1,
3450 ett_tns_bind_row, &row_item, "Row %d", ++rownum);
3451 /* In a SQL statement a LONG-class value - one too long for a
3452 * string, sent as LONG or LONG RAW - rides after all the others;
3453 * a PL/SQL block takes its values in bind order. */
3454 for ( int pass = 0; pass < 2; pass++ )
3455 for ( uint32_t i = 0; i < count
3456 && tvb_reported_length_remaining(tvb, offset) > 0; i++ )
3457 {
3458 bool_Bool late = !plsql && tns_is_long_bind(&cols[i]);
3459 /* a re-executed block sends no value for an OUT bind */
3460 if ( dirs && dirs[i] == TNS_BIND_DIR_OUTPUT16 )
3461 continue;
3462 if ( late == (pass == 1) )
3463 offset = dissect_tns_bind_value(tvb, pinfo, row_tree, offset, &cols[i], i + 1, false0);
3464 }
3465 proto_item_set_len(row_item, offset - r_start);
3466 }
3467 return offset;
3468}
3469
3470/* Remember the call a request makes, so the response can be read in its
3471 * light. Returns the record to fill in, or NULL on a later pass. */
3472static tns_call_t *tns_remember_call(packet_info *pinfo, uint8_t func)
3473{
3474 if ( PINFO_FD_VISITED(pinfo)((pinfo)->fd->visited) )
3475 return NULL((void*)0);
3476
3477 tns_call_t *call = wmem_new0(wmem_file_scope(), tns_call_t)((tns_call_t*)wmem_alloc0((wmem_file_scope()), sizeof(tns_call_t
)))
;
3478 call->func = func;
3479 tns_get_conv_info(pinfo)->last_call = call;
3480 return call;
3481}
3482
3483/* The call a response packet answers, or NULL if none was seen. */
3484static tns_call_t *tns_answered_call(packet_info *pinfo)
3485{
3486 if ( PINFO_FD_VISITED(pinfo)((pinfo)->fd->visited) )
3487 return (tns_call_t *)p_get_proto_data(wmem_file_scope(), pinfo, proto_tns, TNS_PROTO_DATA_CALL3);
3488
3489 tns_call_t *call = tns_get_conv_info(pinfo)->last_call;
3490 if ( call )
3491 p_add_proto_data(wmem_file_scope(), pinfo, proto_tns, TNS_PROTO_DATA_CALL3, call);
3492 return call;
3493}
3494
3495/* Decode num key/value pairs: each a ub2 text length and text, a ub2
3496 * binary length and bytes, and a ub2 keyword number saying which session
3497 * attribute the value is for. Returns the new offset. */
3498static int dissect_tns_kv_pairs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, int num)
3499{
3500 for ( int i = 0; i < num && tvb_reported_length_remaining(tvb, offset) > 0; i++ )
3501 {
3502 proto_tree *kv_tree;
3503 proto_item *kv_item;
3504 const char *text = NULL((void*)0);
3505 int kv_start = offset, len = 0, keyword = 0, start;
3506
3507 kv_tree = proto_tree_add_subtree_format(tree, tvb, offset, -1, ett_tns_kv,
3508 &kv_item, "Key/Value Pair %d", i + 1);
3509 offset += get_sb4_custom(tvb, offset, &len);
3510 if ( len > 0 )
3511 {
3512 start = offset;
3513 offset += get_dalc_custom(tvb, pinfo, offset, &text);
3514 proto_tree_add_string(kv_tree, hf_tns_data_kv_text, tvb, start, offset - start, text);
3515 }
3516 offset += get_sb4_custom(tvb, offset, &len);
3517 if ( len > 0 )
3518 {
3519 start = offset;
3520 offset += get_dalc_custom(tvb, pinfo, offset, NULL((void*)0));
3521 proto_tree_add_item(kv_tree, hf_tns_data_kv_binary, tvb, start + 1, offset - start - 1, ENC_NA0x00000000);
3522 }
3523 start = offset;
3524 offset += get_sb4_custom(tvb, offset, &keyword);
3525 proto_tree_add_uint(kv_tree, hf_tns_data_kv_keyword, tvb, start, offset - start, keyword);
3526 proto_item_append_text(kv_item, ": %s", val_to_str(pinfo->pool, keyword, tns_kv_keywords, "keyword %u"));
3527 if ( text )
3528 proto_item_append_text(kv_item, " = %s", text);
3529 proto_item_set_len(kv_item, offset - kv_start);
3530 }
3531 return offset;
3532}
3533
3534/* Decode the return-parameters block (TTI_RPA) that answers an execute,
3535 * ahead of its closing status. With DML_ROWCOUNTS requested it ends with
3536 * the rows each iteration of an array DML affected. Returns the new
3537 * offset. */
3538static int dissect_tns_return_params(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, bool_Bool rowcounts)
3539{
3540 proto_tree *rpa_tree;
3541 proto_item *rpa_item;
3542 int rpa_start = offset, num = 0, len = 0, start;
3543
3544 rpa_tree = proto_tree_add_subtree(tree, tvb, offset, -1, ett_tns_rpa, &rpa_item, "Return Parameters");
3545
3546 /* al8o4l: a count of ub4 words */
3547 start = offset;
3548 offset += get_sb4_custom(tvb, offset, &num);
3549 proto_tree_add_uint(rpa_tree, hf_tns_data_rpa_num_al8o4, tvb, start, offset - start, num);
3550 for ( int i = 0; i < num && tvb_reported_length_remaining(tvb, offset) > 0; i++ )
3551 {
3552 int v = 0;
3553 start = offset;
3554 offset += get_sb4_custom(tvb, offset, &v);
3555 proto_tree_add_uint(rpa_tree, hf_tns_data_rpa_al8o4, tvb, start, offset - start, v);
3556 }
3557 /* al8txl: a byte count and the bytes */
3558 offset += get_sb4_custom(tvb, offset, &len);
3559 if ( len > 0 )
3560 {
3561 proto_tree_add_item(rpa_tree, hf_tns_data_rpa_al8txl, tvb, offset, len, ENC_NA0x00000000);
3562 offset += len;
3563 }
3564 /* key/value pairs: a changed session attribute is reported here */
3565 start = offset;
3566 offset += get_sb4_custom(tvb, offset, &num);
3567 proto_tree_add_uint(rpa_tree, hf_tns_data_rpa_num_kv, tvb, start, offset - start, num);
3568 offset = dissect_tns_kv_pairs(tvb, pinfo, rpa_tree, offset, num);
3569 /* registration: a byte count and the bytes */
3570 offset += get_sb4_custom(tvb, offset, &len);
3571 if ( len > 0 )
3572 {
3573 proto_tree_add_item(rpa_tree, hf_tns_data_rpa_registration, tvb, offset, len, ENC_NA0x00000000);
3574 offset += len;
3575 }
3576 /* per-iteration row counts, when the execute asked for them */
3577 if ( rowcounts )
3578 {
3579 start = offset;
3580 offset += get_sb4_custom(tvb, offset, &num);
3581 proto_tree_add_uint(rpa_tree, hf_tns_data_rpa_num_rowcounts, tvb, start, offset - start, num);
3582 for ( int i = 0; i < num && tvb_reported_length_remaining(tvb, offset) > 0; i++ )
3583 {
3584 uint64_t rows = 0;
3585 start = offset;
3586 offset += get_ub8_custom(tvb, offset, &rows);
3587 proto_tree_add_uint64(rpa_tree, hf_tns_data_rpa_dml_rowcount, tvb, start, offset - start, rows);
3588 }
3589 }
3590 proto_item_set_len(rpa_item, offset - rpa_start);
3591 return offset;
3592}
3593
3594/* From field version 23.1 ext 1 a call or piggyback header carries a ub8
3595 * token after its sequence number, which the reply echoes in a TOKEN
3596 * message. Returns the new offset. */
3597static int dissect_tns_call_token(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
3598{
3599 uint64_t token = 0;
3600 int start = offset;
3601
3602 if ( tns_field_version(pinfo) < TNS_FV_23_1_EXT_118 )
3603 return offset;
3604 offset += get_ub8_custom(tvb, offset, &token);
3605 proto_tree_add_uint64(tree, hf_tns_data_token, tvb, start, offset - start, token);
3606 return offset;
3607}
3608
3609/* The message properties of an Advanced Queuing message, as the enqueue
3610 * request writes them and a dequeue reply returns them: the priority,
3611 * delay and expiration, the correlation, the number of delivery
3612 * attempts, the exception queue, the state, the enqueue time and
3613 * transaction id, extensions as key/value pairs, and flags.
3614 * Returns the new offset. */
3615static int dissect_tns_aq_msg_props(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, bool_Bool reply)
3616{
3617 proto_tree *props_tree;
3618 proto_item *props_item;
3619 const char *text = NULL((void*)0);
3620 int start, props_start = offset, v = 0, num = 0;
3621
3622 props_tree = proto_tree_add_subtree(tree, tvb, offset, -1, ett_tns_aq_props, &props_item,
3623 "Message Properties");
3624 start = offset;
3625 offset += get_sb4_custom(tvb, offset, &v);
3626 proto_tree_add_uint(props_tree, hf_tns_data_aq_priority, tvb, start, offset - start, v);
3627 start = offset;
3628 offset += get_sb4_custom(tvb, offset, &v);
3629 proto_tree_add_uint(props_tree, hf_tns_data_aq_delay, tvb, start, offset - start, v);
3630 start = offset;
3631 offset += get_sb4_custom(tvb, offset, &v);
3632 proto_tree_add_int(props_tree, hf_tns_data_aq_expiration, tvb, start, offset - start, v);
3633 start = offset;
3634 offset += get_field_with_length(tvb, pinfo, offset, &text);
3635 if ( text )
3636 proto_tree_add_string(props_tree, hf_tns_data_aq_correlation, tvb, start, offset - start, text);
3637 start = offset;
3638 offset += get_sb4_custom(tvb, offset, &v);
3639 proto_tree_add_uint(props_tree, hf_tns_data_aq_attempts, tvb, start, offset - start, v);
3640 start = offset;
3641 offset += get_field_with_length(tvb, pinfo, offset, &text);
3642 if ( text )
3643 proto_tree_add_string(props_tree, hf_tns_data_aq_exception_queue, tvb, start, offset - start, text);
3644 start = offset;
3645 offset += get_sb4_custom(tvb, offset, &v);
3646 proto_tree_add_uint(props_tree, hf_tns_data_aq_state, tvb, start, offset - start, v);
3647 /* the enqueue time: a length and, in a reply, a date */
3648 start = offset;
3649 offset += get_sb4_custom(tvb, offset, &v);
3650 if ( reply && v > 0 )
3651 {
3652 int date_start = offset;
3653 offset += get_dalc_custom(tvb, pinfo, offset, NULL((void*)0));
3654 if ( offset - date_start > 1 )
3655 {
3656 const uint8_t *d = tvb_get_ptr(tvb, date_start + 1, offset - date_start - 1);
3657 const char *when = tns_format_date(pinfo, d, offset - date_start - 1);
3658 if ( when )
3659 proto_tree_add_string(props_tree, hf_tns_data_aq_enq_time, tvb, start, offset - start, when);
3660 }
3661 }
3662 offset += get_field_with_length(tvb, pinfo, offset, NULL((void*)0)); /* transaction id */
3663 offset += get_sb4_custom(tvb, offset, &num); /* extensions */
3664 if ( num > 0 )
3665 {
3666 offset += 1;
3667 offset = dissect_tns_kv_pairs(tvb, pinfo, props_tree, offset, num);
3668 }
3669 offset += get_sb4_custom(tvb, offset, &v); /* user properties */
3670 offset += get_sb4_custom(tvb, offset, &v); /* change SCN */
3671 offset += get_sb4_custom(tvb, offset, &v); /* dependency SCN */
3672 start = offset;
3673 offset += get_sb4_custom(tvb, offset, &v);
3674 proto_tree_add_uint(props_tree, hf_tns_data_aq_delivery_flags, tvb, start, offset - start, v);
3675 if ( tns_field_version(pinfo) >= TNS_FV_21_116 )
3676 offset += get_sb4_custom(tvb, offset, &v); /* shard */
3677 proto_item_set_len(props_item, offset - props_start);
3678 return offset;
3679}
3680
3681/* Decode an Advanced Queuing enqueue (121) or dequeue (122) call. Each
3682 * opens with a header of pointers and lengths - the queue name, the
3683 * options, the payload type's OID and, for an enqueue, the message
3684 * properties - and ends with the values those lengths describe.
3685 * Returns the new offset. */
3686static int dissect_tns_aq_call(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, uint32_t func)
3687{
3688 const char *text = NULL((void*)0);
3689 int start, v = 0, qname_len = 0, consumer_len = 0, correlation_len = 0;
3690 int condition_len = 0, toid_len = 0, raw_len = 0, num_recipients = 0;
3691 uint8_t msgid_ptr = 0, toid_ptr, raw_ptr = 0;
3692 unsigned fv = tns_field_version(pinfo);
3693
3694 offset += 1; /* queue name pointer */
3695 offset += get_sb4_custom(tvb, offset, &qname_len);
3696 if ( func == TTI_AQ_ENQUEUE121 )
3697 {
3698 offset = dissect_tns_aq_msg_props(tvb, pinfo, tree, offset, false0);
3699 offset += 1; /* recipients pointer */
3700 offset += get_sb4_custom(tvb, offset, &num_recipients);
3701 start = offset;
3702 offset += get_sb4_custom(tvb, offset, &v);
3703 proto_tree_add_uint(tree, hf_tns_data_aq_visibility, tvb, start, offset - start, v);
3704 offset += 1; /* relative message id */
3705 offset += get_sb4_custom(tvb, offset, &v);
3706 offset += get_sb4_custom(tvb, offset, &v); /* sequence deviation */
3707 toid_ptr = tvb_get_uint8(tvb, offset);
3708 offset += 1;
3709 offset += get_sb4_custom(tvb, offset, &toid_len);
3710 offset += get_sb4_custom(tvb, offset, &v); /* message version */
3711 offset += 1; /* payload pointer */
3712 raw_ptr = tvb_get_uint8(tvb, offset);
3713 offset += 1;
3714 offset += get_sb4_custom(tvb, offset, &raw_len);
3715 offset += 1; /* return message id */
3716 offset += get_sb4_custom(tvb, offset, &v);
3717 start = offset;
3718 offset += get_sb4_custom(tvb, offset, &v);
3719 proto_tree_add_uint(tree, hf_tns_data_aq_flags, tvb, start, offset - start, v);
3720 for ( int i = 0; i < 2; i++ ) /* two extension lists */
3721 {
3722 offset += 1;
3723 offset += get_sb4_custom(tvb, offset, &v);
3724 }
3725 for ( int i = 0; i < 2; i++ ) /* sequence numbers */
3726 {
3727 offset += 1;
3728 offset += get_sb4_custom(tvb, offset, &v);
3729 }
3730 offset += 1; /* output ack length */
3731 for ( int i = 0; i < 3; i++ ) /* correlation, sender name and address */
3732 {
3733 offset += 1;
3734 offset += get_sb4_custom(tvb, offset, &v);
3735 }
3736 offset += 2; /* sender charsets */
3737 if ( fv >= TNS_FV_20_114 )
3738 offset += 1; /* JSON payload pointer */
3739 }
3740 else
3741 {
3742 offset += 4; /* message properties and
3743 * recipient list pointers */
3744 offset += 1; /* consumer name pointer */
3745 offset += get_sb4_custom(tvb, offset, &consumer_len);
3746 start = offset;
3747 offset += get_sb4_custom(tvb, offset, &v);
3748 proto_tree_add_uint(tree, hf_tns_data_aq_deq_mode, tvb, start, offset - start, v);
3749 start = offset;
3750 offset += get_sb4_custom(tvb, offset, &v);
3751 proto_tree_add_uint(tree, hf_tns_data_aq_navigation, tvb, start, offset - start, v);
3752 start = offset;
3753 offset += get_sb4_custom(tvb, offset, &v);
3754 proto_tree_add_uint(tree, hf_tns_data_aq_visibility, tvb, start, offset - start, v);
3755 start = offset;
3756 offset += get_sb4_custom(tvb, offset, &v);
3757 proto_tree_add_int(tree, hf_tns_data_aq_wait, tvb, start, offset - start, v);
3758 msgid_ptr = tvb_get_uint8(tvb, offset);
3759 offset += 1;
3760 offset += get_sb4_custom(tvb, offset, &v);
3761 offset += 1; /* correlation pointer */
3762 offset += get_sb4_custom(tvb, offset, &correlation_len);
3763 toid_ptr = tvb_get_uint8(tvb, offset);
3764 offset += 1;
3765 offset += get_sb4_custom(tvb, offset, &toid_len);
3766 offset += get_sb4_custom(tvb, offset, &v); /* message version */
3767 offset += 2; /* payload, message id */
3768 offset += get_sb4_custom(tvb, offset, &v);
3769 start = offset;
3770 offset += get_sb4_custom(tvb, offset, &v);
3771 proto_tree_add_uint(tree, hf_tns_data_aq_flags, tvb, start, offset - start, v);
3772 offset += 1; /* condition pointer */
3773 offset += get_sb4_custom(tvb, offset, &condition_len);
3774 offset += 1; /* extensions pointer */
3775 offset += get_sb4_custom(tvb, offset, &v);
3776 if ( fv >= TNS_FV_20_114 )
3777 offset += 1; /* JSON payload pointer */
3778 if ( fv >= TNS_FV_21_116 )
3779 offset += get_sb4_custom(tvb, offset, &v); /* shard id */
3780 }
3781
3782 /* the values the header's lengths describe */
3783 if ( qname_len > 0 )
3784 {
3785 start = offset;
3786 offset += get_dalc_custom(tvb, pinfo, offset, &text);
3787 if ( text )
3788 {
3789 proto_tree_add_string(tree, hf_tns_data_aq_queue, tvb, start, offset - start, text);
3790 col_append_fstr(pinfo->cinfo, COL_INFO, " [%s]", text);
3791 }
3792 }
3793 if ( func == TTI_AQ_ENQUEUE121 && num_recipients > 0 )
3794 offset = dissect_tns_kv_pairs(tvb, pinfo, tree, offset, num_recipients);
3795 if ( consumer_len > 0 )
3796 {
3797 start = offset;
3798 offset += get_dalc_custom(tvb, pinfo, offset, &text);
3799 if ( text )
3800 proto_tree_add_string(tree, hf_tns_data_aq_consumer, tvb, start, offset - start, text);
3801 }
3802 if ( msgid_ptr )
3803 {
3804 proto_tree_add_item(tree, hf_tns_data_aq_msgid, tvb, offset, TNS_AQ_MSGID_LEN16, ENC_NA0x00000000);
3805 offset += TNS_AQ_MSGID_LEN16;
3806 }
3807 if ( correlation_len > 0 )
3808 {
3809 start = offset;
3810 offset += get_dalc_custom(tvb, pinfo, offset, &text);
3811 if ( text )
3812 proto_tree_add_string(tree, hf_tns_data_aq_correlation, tvb, start, offset - start, text);
3813 }
3814 if ( toid_ptr && toid_len > 0 )
3815 {
3816 proto_tree_add_item(tree, hf_tns_data_aq_toid, tvb, offset, toid_len, ENC_NA0x00000000);
3817 offset += toid_len;
3818 }
3819 if ( condition_len > 0 )
3820 {
3821 start = offset;
3822 offset += get_dalc_custom(tvb, pinfo, offset, &text);
3823 if ( text )
3824 proto_tree_add_string(tree, hf_tns_data_aq_condition, tvb, start, offset - start, text);
3825 }
3826 if ( func == TTI_AQ_ENQUEUE121 )
3827 {
3828 /* the payload: raw bytes of the length the header gave, else an
3829 * object or a JSON image in the object framing */
3830 if ( raw_ptr && raw_len > 0 )
3831 {
3832 proto_tree_add_item(tree, hf_tns_data_aq_payload, tvb, offset, raw_len, ENC_NA0x00000000);
3833 offset += raw_len;
3834 }
3835 else if ( tvb_reported_length_remaining(tvb, offset) > 0 )
3836 offset = dissect_tns_value(tvb, pinfo, tree, offset, TNS_DATATYPE_ADT109, 0,
3837 TNS_VALUE_BIND, 1, hf_tns_data_aq_payload, "Payload");
3838 }
3839 return offset;
3840}
3841
3842/* Decode an array Advanced Queuing call (145), which enqueues or
3843 * dequeues several messages at once. Its header says which operation and
3844 * how many messages; an array enqueue then carries a row header with the
3845 * queue name, the payload type's OID and the flags, and one row per
3846 * message, closing with a status byte, while an array dequeue repeats
3847 * the queue name and the dequeue options for each message it asks for.
3848 * Returns the new offset. */
3849static int dissect_tns_aq_array_call(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
3850{
3851 const char *text = NULL((void*)0);
3852 int start, v = 0, op = 0, num_iters = 0;
3853 bool_Bool enqueue;
3854
3855 offset += 1; /* input parameters */
3856 offset += get_sb4_custom(tvb, offset, &num_iters);
3857 offset += get_sb4_custom(tvb, offset, &v); /* array flags */
3858 offset += 2; /* output parameters */
3859 start = offset;
3860 offset += get_sb4_custom(tvb, offset, &op);
3861 proto_tree_add_uint(tree, hf_tns_data_aq_array_op, tvb, start, offset - start, op);
3862 enqueue = op == TNS_AQ_ARRAY_ENQ1;
3863 offset += 1; /* iterations pointer */
3864 if ( tns_field_version(pinfo) >= TNS_FV_21_116 )
3865 offset += get_sb4_custom(tvb, offset, &v); /* shard id */
3866 if ( enqueue )
3867 offset += get_sb4_custom(tvb, offset, &num_iters);
3868 proto_tree_add_uint(tree, hf_tns_data_aq_num_messages, tvb, offset, 0, num_iters);
3869
3870 if ( enqueue )
3871 {
3872 offset += get_sb4_custom(tvb, offset, &v); /* relative message id */
3873 offset += 1; /* row header */
3874 start = offset;
3875 offset += get_field_with_length(tvb, pinfo, offset, &text);
3876 if ( text )
3877 {
3878 proto_tree_add_string(tree, hf_tns_data_aq_queue, tvb, start, offset - start, text);
3879 col_append_fstr(pinfo->cinfo, COL_INFO, " [%s]", text);
3880 }
3881 proto_tree_add_item(tree, hf_tns_data_aq_toid, tvb, offset, TNS_AQ_TOID_LEN16, ENC_NA0x00000000);
3882 offset += TNS_AQ_TOID_LEN16;
3883 offset += get_sb4_custom(tvb, offset, &v); /* message version */
3884 offset += get_sb4_custom(tvb, offset, &v); /* flags */
3885 for ( int i = 0; i < num_iters && tvb_reported_length_remaining(tvb, offset) > 0; i++ )
3886 {
3887 int num_recipients = 0, payload_len = 0;
3888 offset += 1; /* row data */
3889 offset += get_sb4_custom(tvb, offset, &v); /* flags */
3890 offset = dissect_tns_aq_msg_props(tvb, pinfo, tree, offset, false0);
3891 offset += get_sb4_custom(tvb, offset, &num_recipients);
3892 if ( num_recipients > 0 )
3893 offset = dissect_tns_kv_pairs(tvb, pinfo, tree, offset, num_recipients);
3894 offset += get_sb4_custom(tvb, offset, &v); /* visibility */
3895 offset += get_sb4_custom(tvb, offset, &v); /* relative message id */
3896 offset += get_sb4_custom(tvb, offset, &v); /* sequence deviation */
3897 offset += get_sb4_custom(tvb, offset, &payload_len);
3898 if ( payload_len > 0 )
3899 {
3900 proto_tree_add_item(tree, hf_tns_data_aq_payload, tvb, offset, payload_len, ENC_NA0x00000000);
3901 offset += payload_len;
3902 }
3903 }
3904 offset += 1; /* the closing status */
3905 return offset;
3906 }
3907
3908 for ( int i = 0; i < num_iters && tvb_reported_length_remaining(tvb, offset) > 0; i++ )
3909 {
3910 start = offset;
3911 offset += get_field_with_length(tvb, pinfo, offset, &text);
3912 if ( text && i == 0 )
3913 {
3914 proto_tree_add_string(tree, hf_tns_data_aq_queue, tvb, start, offset - start, text);
3915 col_append_fstr(pinfo->cinfo, COL_INFO, " [%s]", text);
3916 }
3917 offset = dissect_tns_aq_msg_props(tvb, pinfo, tree, offset, false0);
3918 offset += get_sb4_custom(tvb, offset, &v); /* recipients */
3919 start = offset;
3920 offset += get_field_with_length(tvb, pinfo, offset, &text);
3921 if ( text )
3922 proto_tree_add_string(tree, hf_tns_data_aq_consumer, tvb, start, offset - start, text);
3923 start = offset;
3924 offset += get_sb4_custom(tvb, offset, &v);
3925 proto_tree_add_uint(tree, hf_tns_data_aq_deq_mode, tvb, start, offset - start, v);
3926 start = offset;
3927 offset += get_sb4_custom(tvb, offset, &v);
3928 proto_tree_add_uint(tree, hf_tns_data_aq_navigation, tvb, start, offset - start, v);
3929 start = offset;
3930 offset += get_sb4_custom(tvb, offset, &v);
3931 proto_tree_add_uint(tree, hf_tns_data_aq_visibility, tvb, start, offset - start, v);
3932 start = offset;
3933 offset += get_sb4_custom(tvb, offset, &v);
3934 proto_tree_add_int(tree, hf_tns_data_aq_wait, tvb, start, offset - start, v);
3935 offset += get_field_with_length(tvb, pinfo, offset, NULL((void*)0)); /* message id */
3936 start = offset;
3937 offset += get_field_with_length(tvb, pinfo, offset, &text);
3938 if ( text )
3939 proto_tree_add_string(tree, hf_tns_data_aq_correlation, tvb, start, offset - start, text);
3940 start = offset;
3941 offset += get_field_with_length(tvb, pinfo, offset, &text);
3942 if ( text )
3943 proto_tree_add_string(tree, hf_tns_data_aq_condition, tvb, start, offset - start, text);
3944 offset += get_sb4_custom(tvb, offset, &v); /* extensions */
3945 offset += get_sb4_custom(tvb, offset, &v); /* relative message id */
3946 offset += get_sb4_custom(tvb, offset, &v); /* sequence deviation */
3947 start = offset;
3948 offset += get_field_with_length(tvb, pinfo, offset, NULL((void*)0));
3949 if ( offset - start > 2 )
3950 proto_tree_add_item(tree, hf_tns_data_aq_toid, tvb, offset - TNS_AQ_TOID_LEN16,
3951 TNS_AQ_TOID_LEN16, ENC_NA0x00000000);
3952 }
3953 return offset;
3954}
3955
3956/* Decode a two-phase commit call: a transaction switch (103) - start,
3957 * detach - or a state change (104) - prepare, commit, abort, forget. The
3958 * header gives an operation, the lengths of a transaction context and of
3959 * the XID's parts, and for a switch the names; the context, the XID and
3960 * the rest follow. The XID is padded to 128 bytes. Returns the new
3961 * offset. */
3962static int dissect_tns_tpc_call(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, uint32_t func)
3963{
3964 int v = 0, ctx_len = 0, gtrid_len = 0, bqual_len = 0, xid_len = 0;
3965 int int_len = 0, ext_len = 0, start;
3966 uint8_t ctx_ptr, xid_ptr, int_ptr = 0, ext_ptr = 0;
3967
3968 start = offset;
3969 offset += get_sb4_custom(tvb, offset, &v);
3970 proto_tree_add_uint(tree, func == TTI_TPC_TXN_SWITCH103 ? hf_tns_data_tpc_switch_op : hf_tns_data_tpc_change_op,
3971 tvb, start, offset - start, v);
3972 col_append_fstr(pinfo->cinfo, COL_INFO, " [%s]", val_to_str_const(v,
3973 func == TTI_TPC_TXN_SWITCH103 ? tns_tpc_switch_ops : tns_tpc_change_ops, "unknown"));
3974 ctx_ptr = tvb_get_uint8(tvb, offset);
3975 offset += 1;
3976 offset += get_sb4_custom(tvb, offset, &ctx_len);
3977 start = offset;
3978 offset += get_sb4_custom(tvb, offset, &v);
3979 proto_tree_add_uint(tree, hf_tns_data_tpc_format_id, tvb, start, offset - start, v);
3980 offset += get_sb4_custom(tvb, offset, &gtrid_len);
3981 offset += get_sb4_custom(tvb, offset, &bqual_len);
3982 xid_ptr = tvb_get_uint8(tvb, offset);
3983 offset += 1;
3984 offset += get_sb4_custom(tvb, offset, &xid_len);
3985 if ( func == TTI_TPC_TXN_SWITCH103 )
3986 {
3987 start = offset;
3988 offset += get_sb4_custom(tvb, offset, &v);
3989 proto_tree_add_uint(tree, hf_tns_data_tpc_flags, tvb, start, offset - start, v);
3990 start = offset;
3991 offset += get_sb4_custom(tvb, offset, &v);
3992 proto_tree_add_uint(tree, hf_tns_data_tpc_timeout, tvb, start, offset - start, v);
3993 offset += 3; /* application value, return context and its length pointers */
3994 int_ptr = tvb_get_uint8(tvb, offset);
3995 offset += 1;
3996 offset += get_sb4_custom(tvb, offset, &int_len);
3997 ext_ptr = tvb_get_uint8(tvb, offset);
3998 offset += 1;
3999 offset += get_sb4_custom(tvb, offset, &ext_len);
4000 }
4001 else
4002 {
4003 start = offset;
4004 offset += get_sb4_custom(tvb, offset, &v);
4005 proto_tree_add_uint(tree, hf_tns_data_tpc_timeout, tvb, start, offset - start, v);
4006 start = offset;
4007 offset += get_sb4_custom(tvb, offset, &v);
4008 proto_tree_add_uint(tree, hf_tns_data_tpc_state, tvb, start, offset - start, v);
4009 offset += 1; /* out state pointer */
4010 start = offset;
4011 offset += get_sb4_custom(tvb, offset, &v);
4012 proto_tree_add_uint(tree, hf_tns_data_tpc_flags, tvb, start, offset - start, v);
4013 }
4014 if ( ctx_ptr && ctx_len > 0 )
4015 {
4016 proto_tree_add_item(tree, hf_tns_data_tpc_context, tvb, offset, ctx_len, ENC_NA0x00000000);
4017 offset += ctx_len;
4018 }
4019 if ( xid_ptr && xid_len > 0 )
4020 {
4021 if ( gtrid_len >= 0 && bqual_len >= 0 && gtrid_len + bqual_len <= xid_len )
4022 {
4023 proto_tree_add_item(tree, hf_tns_data_tpc_gtrid, tvb, offset, gtrid_len, ENC_NA0x00000000);
4024 proto_tree_add_item(tree, hf_tns_data_tpc_bqual, tvb, offset + gtrid_len, bqual_len, ENC_NA0x00000000);
4025 }
4026 offset += xid_len;
4027 }
4028 if ( func == TTI_TPC_TXN_SWITCH103 )
4029 {
4030 start = offset;
4031 offset += get_sb4_custom(tvb, offset, &v);
4032 proto_tree_add_uint(tree, hf_tns_data_tpc_app_value, tvb, start, offset - start, v);
4033 if ( int_ptr && int_len > 0 )
4034 {
4035 proto_tree_add_item(tree, hf_tns_data_tpc_internal_name, tvb, offset, int_len, ENC_UTF_80x00000002);
4036 offset += int_len;
4037 }
4038 if ( ext_ptr && ext_len > 0 )
4039 {
4040 proto_tree_add_item(tree, hf_tns_data_tpc_external_name, tvb, offset, ext_len, ENC_UTF_80x00000002);
4041 offset += ext_len;
4042 }
4043 }
4044 return offset;
4045}
4046
4047/* Decode the body of a piggyback other than close-cursors. Layouts
4048 * follow python-oracledb's _write_*_piggyback. Sets *walk when the body
4049 * was understood, so the call behind it can be decoded. Returns the new
4050 * offset. */
4051static int dissect_tns_piggyback_body(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, uint8_t piggyback_id, bool_Bool *walk)
4052{
4053 int v = 0, start;
4054 uint64_t u = 0;
4055
4056 switch ( piggyback_id )
4057 {
4058 case TTI_LOBOPS96:
4059 {
4060 /* close temporary LOBs: a FREE_TEMP | ARRAY LOB operation
4061 * whose locators, each with its own ub2 length prefix, follow
4062 * back to back - as many bytes as the total says. */
4063 int total = 0, op = 0;
4064 offset += 1; /* pointer */
4065 start = offset;
4066 offset += get_sb4_custom(tvb, offset, &total);
4067 proto_tree_add_uint(tree, hf_tns_data_lob_total_size, tvb, start, offset - start, total);
4068 offset += 1; /* dest locator pointer */
4069 offset += get_sb4_custom(tvb, offset, &v); /* dest locator length */
4070 offset += get_sb4_custom(tvb, offset, &v); /* source locator */
4071 offset += get_sb4_custom(tvb, offset, &v);
4072 offset += 3; /* offsets, charset */
4073 start = offset;
4074 offset += get_sb4_custom(tvb, offset, &op);
4075 proto_tree_add_uint(tree, hf_tns_data_lob_op, tvb, start, offset - start, op);
4076 offset += 1; /* scn */
4077 offset += get_sb4_custom(tvb, offset, &v); /* losbscn */
4078 offset += get_ub8_custom(tvb, offset, &u); /* lobscnl */
4079 offset += get_ub8_custom(tvb, offset, &u);
4080 offset += 1;
4081 for ( int i = 0; i < 3; i++ ) /* array LOB fields */
4082 {
4083 offset += 1;
4084 offset += get_sb4_custom(tvb, offset, &v);
4085 }
4086 if ( total < 0 || (unsigned)total > tvb_reported_length_remaining(tvb, offset) )
4087 {
4088 proto_tree_add_expert(tree, pinfo, &ei_tns_data_count_too_large, tvb, offset, 0);
4089 return offset;
4090 }
4091 for ( int end = offset + total; offset + 2 <= end; )
4092 {
4093 int len = 2 + tvb_get_ntohs(tvb, offset);
4094 if ( offset + len > end )
4095 len = end - offset;
4096 proto_tree_add_item(tree, hf_tns_data_lob_locator, tvb, offset, len, ENC_NA0x00000000);
4097 offset += len;
4098 }
4099 break;
4100 }
4101
4102 case TTI_SET_SCHEMA152:
4103 {
4104 const char *schema = NULL((void*)0);
4105 offset += 1; /* pointer */
4106 start = offset;
4107 offset += get_field_with_length(tvb, pinfo, offset, &schema);
4108 if ( schema )
4109 proto_tree_add_string(tree, hf_tns_data_pgy_schema, tvb, start, offset - start, schema);
4110 break;
4111 }
4112
4113 case TTI_APP_CONTEXT154:
4114 {
4115 /* Set or clear an application context namespace, as
4116 * DBMS_SESSION.SET_CONTEXT or CLEAR_CONTEXT would, without a
4117 * round trip of its own: a pointer and the namespace's ub4
4118 * length, a pointer and the ub4 number of attributes, a ub2
4119 * operation (1 set, 2 clear), a zero byte from field
4120 * version 12.1 on, the namespace, and then each attribute
4121 * and its value in the bytes_with_length form, followed by
4122 * a ub4 0. */
4123 const char *ns = NULL((void*)0);
4124 unsigned fv = tns_field_version(pinfo);
4125 int num = 0;
4126 uint32_t op;
4127
4128 offset += 1; /* pointer */
4129 offset += get_sb4_custom(tvb, offset, &v); /* namespace length */
4130 offset += 1; /* pointer */
4131 offset += get_sb4_custom(tvb, offset, &num);
4132 start = offset;
4133 offset += get_sb4_custom(tvb, offset, &v);
4134 op = (uint32_t)v;
4135 proto_tree_add_uint(tree, hf_tns_data_pgy_app_ctx_op, tvb, start, offset - start, op);
4136 /* Without a negotiated field version, the namespace's length
4137 * byte, never zero, tells whether the zero byte is there. */
4138 if ( fv ? fv >= TNS_FV_12_17 : tvb_get_uint8(tvb, offset) == 0 )
4139 offset += 1;
4140 start = offset;
4141 offset += get_dalc_custom(tvb, pinfo, offset, &ns);
4142 if ( ns )
4143 {
4144 proto_tree_add_string(tree, hf_tns_data_pgy_app_ctx_namespace, tvb, start, offset - start, ns);
4145 col_append_fstr(pinfo->cinfo, COL_INFO, " [%s %s]",
4146 val_to_str_const(op, tns_app_ctx_ops, "Change"), ns);
4147 }
4148 for ( int i = 0; i < num && tvb_reported_length_remaining(tvb, offset) > 0; i++ )
4149 {
4150 proto_tree *attr_tree;
4151 proto_item *attr_item;
4152 const char *attr = NULL((void*)0), *value = NULL((void*)0);
4153 int attr_start = offset;
4154
4155 attr_tree = proto_tree_add_subtree(tree, tvb, offset, -1, ett_tns_app_ctx, &attr_item, "Context Attribute");
4156 start = offset;
4157 offset += get_field_with_length(tvb, pinfo, offset, &attr);
4158 if ( attr )
4159 proto_tree_add_string(attr_tree, hf_tns_data_pgy_app_ctx_attr, tvb, start, offset - start, attr);
4160 start = offset;
4161 offset += get_field_with_length(tvb, pinfo, offset, &value);
4162 if ( value )
4163 proto_tree_add_string(attr_tree, hf_tns_data_pgy_app_ctx_value, tvb, start, offset - start, value);
4164 offset += get_sb4_custom(tvb, offset, &v);
4165 proto_item_append_text(attr_item, ": %s = %s", attr ? attr : "", value ? value : "");
4166 proto_item_set_len(attr_item, offset - attr_start);
4167 }
4168 break;
4169 }
4170
4171 case TTI_SESSION_STATE176:
4172 start = offset;
4173 offset += get_ub8_custom(tvb, offset, &u);
4174 proto_tree_add_uint64(tree, hf_tns_data_pgy_session_state, tvb, start, offset - start, u);
4175 break;
4176
4177 case TTI_PIPELINE_BEGIN199:
4178 start = offset;
4179 offset += get_sb4_custom(tvb, offset, &v);
4180 proto_tree_add_uint(tree, hf_tns_data_pgy_error_set_id, tvb, start, offset - start, v);
4181 proto_tree_add_item(tree, hf_tns_data_pgy_error_set_mode, tvb, offset, 1, ENC_NA0x00000000);
4182 offset += 1;
4183 proto_tree_add_item(tree, hf_tns_data_pgy_pipeline_mode, tvb, offset, 1, ENC_NA0x00000000);
4184 offset += 1;
4185 break;
4186
4187 case TTI_SET_END_TO_END_ATTR135:
4188 {
4189 /* End-to-end attributes: a flags word saying which changed,
4190 * then a (pointer, length) header for each attribute - some
4191 * never used - and finally the strings of those that have a
4192 * value, in the same order. */
4193 static int * const hfs[] = { &hf_tns_data_pgy_client_id, &hf_tns_data_pgy_module,
4194 &hf_tns_data_pgy_action, NULL((void*)0), &hf_tns_data_pgy_client_info, NULL((void*)0), NULL((void*)0),
4195 &hf_tns_data_pgy_dbop };
4196 int lens[array_length(hfs)(sizeof (hfs) / sizeof (hfs)[0])];
4197
4198 offset += 2; /* cidnam, cidser pointers */
4199 start = offset;
4200 offset += get_sb4_custom(tvb, offset, &v);
4201 proto_tree_add_uint(tree, hf_tns_data_pgy_e2e_flags, tvb, start, offset - start, v);
4202 for ( unsigned i = 0; i < array_length(hfs)(sizeof (hfs) / sizeof (hfs)[0]); i++ )
4203 {
4204 uint8_t ptr = tvb_get_uint8(tvb, offset);
4205 offset += 1;
4206 offset += get_sb4_custom(tvb, offset, &lens[i]);
4207 if ( !ptr || !hfs[i] )
4208 lens[i] = 0;
4209 if ( i == 3 ) /* cideci is followed by cidcct, cidecs */
4210 {
4211 offset += 1;
4212 offset += get_sb4_custom(tvb, offset, &v);
4213 }
4214 }
4215 for ( unsigned i = 0; i < array_length(hfs)(sizeof (hfs) / sizeof (hfs)[0]); i++ )
4216 {
4217 const char *str = NULL((void*)0);
4218 if ( lens[i] <= 0 )
4219 continue;
4220 start = offset;
4221 offset += get_dalc_custom(tvb, pinfo, offset, &str);
4222 if ( str )
4223 proto_tree_add_string(tree, *hfs[i], tvb, start, offset - start, str);
4224 }
4225 break;
4226 }
4227
4228 case TTI_END_USER_SEC_CTX205:
4229 {
4230 /* End-user security context: flags, then key/value pairs, each
4231 * a flags word and a key, a text and a value in the
4232 * bytes_with_length form. */
4233 int num = 0;
4234 start = offset;
4235 offset += get_sb4_custom(tvb, offset, &v);
4236 proto_tree_add_uint(tree, hf_tns_data_pgy_sec_flags, tvb, start, offset - start, v);
4237 offset += 1; /* pointer */
4238 offset += get_sb4_custom(tvb, offset, &num);
4239 for ( int i = 0; i < num && tvb_reported_length_remaining(tvb, offset) > 0; i++ )
4240 {
4241 const char *key = NULL((void*)0);
4242 offset += get_sb4_custom(tvb, offset, &v); /* flags */
4243 start = offset;
4244 offset += get_field_with_length(tvb, pinfo, offset, &key);
4245 if ( key )
4246 proto_tree_add_string(tree, hf_tns_data_pgy_sec_key, tvb, start, offset - start, key);
4247 offset += get_field_with_length(tvb, pinfo, offset, NULL((void*)0)); /* text */
4248 start = offset;
4249 offset += get_field_with_length(tvb, pinfo, offset, NULL((void*)0));
4250 proto_tree_add_item(tree, hf_tns_data_pgy_sec_value, tvb, start, offset - start, ENC_NA0x00000000);
4251 }
4252 break;
4253 }
4254
4255 default:
4256 /* An unknown body has an unknown length. */
4257 return offset;
4258 }
4259 *walk = true1;
4260 return offset;
4261}
4262
4263static void dissect_tns_data_descriptor(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tns_tree, uint32_t length)
4264{
4265 /* This is used by Oracle 12c for at least sending LOB/FILE data. */
4266 proto_tree *dd_tree, *row_tree;
4267 proto_item *ti;
4268 uint32_t data_len, row_count, row_size, total_row_size = 0;
4269 int orig_offset = offset;
4270
4271 /* We only get here after tcp_dissect_pdus(), length is guaranteed. */
4272 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"
, 4272, (int64_t)length, (int64_t)8))))
;
4273
4274 dd_tree = proto_tree_add_subtree(tns_tree, tvb, offset, -1, ett_tns_data, NULL((void*)0), "Data Descriptor");
4275
4276 /* No idea what this is. Usually 0x0003. */
4277 offset += 4;
4278 proto_tree_add_item_ret_uint(dd_tree, hf_tns_data_length, tvb,
4279 offset, 4, ENC_BIG_ENDIAN0x00000000, &data_len);
4280 offset += 4;
4281
4282 /* This next parameter looks like: number of big endian shorts that follow,
4283 * the sum of the shorts equals the file length above - each short maxes
4284 * out at 0x1f7c = 8060, presumably related to the page size / max table
4285 * row size in Microsoft SQL Server? Something about how many rows it
4286 * would take to store this in-table?
4287 */
4288 proto_tree_add_item_ret_uint(dd_tree, hf_tns_data_descriptor_row_count, tvb,
4289 offset, 4, ENC_BIG_ENDIAN0x00000000, &row_count);
4290 offset += 4;
4291 row_tree = proto_tree_add_subtree(dd_tree, tvb, offset, row_count * 2,
4292 ett_tns_rows, &ti, "Rows");
4293 for (uint32_t i = 0; i < row_count; i++) {
4294 proto_tree_add_item_ret_uint(row_tree, hf_tns_data_descriptor_row_size, tvb,
4295 offset, 2, ENC_BIG_ENDIAN0x00000000, &row_size);
4296 total_row_size += row_size;
4297 offset += 2;
4298 }
4299 proto_item_append_text(ti, " (%u bytes)", total_row_size);
4300 if (total_row_size != data_len) {
4301 expert_add_info(pinfo, ti, &ei_tns_data_descriptor_size_mismatch);
4302 }
4303
4304 offset = orig_offset + (length - TNS_HDR_LEN8);
4305
4306 call_data_dissector(tvb_new_subset_length(tvb, offset, data_len), pinfo,
4307 dd_tree);
4308}
4309
4310/* State carried from one TTC message to the next within a packet. */
4311typedef struct _tns_msg_ctx_t {
4312 /* The decoder ended exactly on its message's last byte. */
4313 bool_Bool walk;
4314 /* Which columns the next row sends, from a row header or a TTI_BVC:
4315 * a clear bit means the value repeats the previous row's. NULL when
4316 * every column is sent. */
4317 const uint8_t *bit_vector;
4318 unsigned bit_vector_len;
4319 /* After a TTI_IOV: the call it answers and each bind's direction, so
4320 * the TTI_RXD after it can be read as the OUT bind values. */
4321 const tns_call_t *out_call;
4322 const uint8_t *bind_dirs;
4323 /* The call inside a fast-authentication bundle carries no token,
4324 * whatever field version the connection ends up with. */
4325 bool_Bool no_token;
4326} tns_msg_ctx_t;
4327
4328static int dissect_tns_message(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *data_tree, bool_Bool is_request, unsigned data_func_id, tns_msg_ctx_t *ctx);
4329
4330static bool_Bool tns_is_oci(packet_info *pinfo);
4331
4332/* Whether a message that follows another in the same packet is one we
4333 * step into. A response is a run of messages back to back - a describe,
4334 * a row header, the rows, a status - and a request may put piggybacks in
4335 * front of its call. */
4336static bool_Bool tns_is_next_message(packet_info *pinfo, unsigned data_func_id, bool_Bool is_request)
4337{
4338 if ( is_request )
4339 return data_func_id == SQLNET_USER_OCI_FUNC3 || data_func_id == SQLNET_PIGGYBACK_FUNC17
4340 || data_func_id == SQLNET_SET_DATATYPES2;
4341
4342 switch ( data_func_id )
4343 {
4344 case SQLNET_RETURN_STATUS4:
4345 case SQLNET_SET_DATATYPES2:
4346 case SQLNET_FLUSH_BIND_DATA19:
4347 case SQLNET_FUNCCOMPLETE9:
4348 case SQLNET_WARNING15:
4349 case SQLNET_LOB_FILE_DF14:
4350 case SQLNET_BIT_VECTOR21:
4351 case SQLNET_SERVER_PIGGYBACK23:
4352 case SQLNET_IMPLICIT_RESULTS27:
4353 case SQLNET_TOKEN33:
4354 case SQLNET_END_OF_RESPONSE29:
4355 case SQLNET_ROW_TRANSF_HDR6:
4356 case SQLNET_ROW_TRANSF_DATA7:
4357 case SQLNET_RETURN_OPI_PARAM8:
4358 case SQLNET_IOVEC_4FAST_UPI11:
4359 case SQLNET_DESCRIBE_INFO16:
4360 return true1;
4361 case SQLNET_INVOKE_USER_CB13:
4362 /* a record of an OCI client's TTI_KOD reply */
4363 return tns_is_oci(pinfo);
4364 default:
4365 return false0;
4366 }
4367}
4368
4369static void dissect_tns_data(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tns_tree)
4370{
4371 proto_tree *data_tree;
4372 unsigned data_func_id;
4373 bool_Bool is_request;
4374 static int * const flags[] = {
4375 &hf_tns_data_flag_send,
4376 &hf_tns_data_flag_rc,
4377 &hf_tns_data_flag_c,
4378 &hf_tns_data_flag_reserved,
4379 &hf_tns_data_flag_more,
4380 &hf_tns_data_flag_eof,
4381 &hf_tns_data_flag_dic,
4382 &hf_tns_data_flag_rts,
4383 &hf_tns_data_flag_sntt,
4384 &hf_tns_data_flag_end_of_request,
4385 &hf_tns_data_flag_begin_pipeline,
4386 &hf_tns_data_flag_end_of_response,
4387 NULL((void*)0)
4388 };
4389
4390 is_request = pinfo->match_uint == pinfo->destport;
4391 data_tree = proto_tree_add_subtree(tns_tree, tvb, offset, -1, ett_tns_data, NULL((void*)0), "Data");
4392
4393 proto_tree_add_bitmask(data_tree, tvb, offset, hf_tns_data_flag, ett_tns_data_flag, flags, ENC_BIG_ENDIAN0x00000000);
4394 offset += 2;
4395 data_func_id = get_data_func_id(tvb, offset);
4396
4397 /* Once native network encryption is on, a data packet is ciphertext
4398 * followed by a padding and a key-fold byte; nothing in it can be
4399 * decoded without the session key. */
4400 if ( tns_is_encrypted(pinfo) && data_func_id != SQLNET_SNS0xdeadbeef )
4401 {
4402 col_append_str(pinfo->cinfo, COL_INFO, ", Encrypted Data");
4403 proto_tree_add_expert(data_tree, pinfo, &ei_tns_data_encrypted, tvb, offset, tvb_reported_length_remaining(tvb, offset));
4404 call_data_dissector(tvb_new_subset_remaining(tvb, offset), pinfo, data_tree);
4405 return;
4406 }
4407
4408 /* The field version the connection negotiated decides the shape of
4409 * several messages; show the one in force. */
4410 unsigned fv = tns_field_version(pinfo);
4411 if ( fv )
4412 proto_item_set_generated(proto_tree_add_uint(data_tree, hf_tns_data_field_version, tvb, 0, 0, fv));
4413
4414 /* Do this only if the Data message have a body. Otherwise, there are only Data flags. */
4415 int remaining = tvb_reported_length_remaining(tvb, offset);
4416 if ( remaining > 0 )
4417 {
4418 if (is_request) {
4419 if (!PINFO_FD_VISITED(pinfo)((pinfo)->fd->visited)) {
4420 tns_conv_info_t *tns_info = tns_get_conv_info(pinfo);
4421 if ((uint32_t)remaining == tns_info->pending_connect_data) {
4422 col_append_str(pinfo->cinfo, COL_INFO, ", Connect Data");
4423 proto_tree_add_item(data_tree, hf_tns_connect_data, tvb,
4424 offset, -1, ENC_ASCII0x00000000);
4425 p_add_proto_data(wmem_file_scope(), pinfo, proto_tns, 0,
4426 GUINT_TO_POINTER(tns_info->pending_connect_data)((gpointer) (gulong) (tns_info->pending_connect_data)));
4427 tns_info->pending_connect_data = 0;
4428 return;
4429 }
4430 } else {
4431 if (p_get_proto_data(wmem_file_scope(), pinfo, proto_tns, 0) != NULL((void*)0)) {
4432 col_append_str(pinfo->cinfo, COL_INFO, ", Connect Data");
4433 proto_tree_add_item(data_tree, hf_tns_connect_data, tvb,
4434 offset, -1, ENC_ASCII0x00000000);
4435 return;
4436 }
4437 }
4438 }
4439 col_append_fstr(pinfo->cinfo, COL_INFO, ", %s", val_to_str_const(data_func_id, tns_data_funcs, "unknown"));
4440
4441 if ( (data_func_id != SQLNET_SNS0xdeadbeef) && (try_val_to_str(data_func_id, tns_data_funcs) != NULL((void*)0)) )
4442 {
4443 proto_tree_add_item(data_tree, hf_tns_data_id, tvb, offset, 1, ENC_BIG_ENDIAN0x00000000);
4444 offset += 1;
4445 }
4446 }
4447
4448 /* Decode the first message, then step into each one after it for as
4449 * long as the previous decoder ended exactly on its last byte. */
4450 tns_msg_ctx_t ctx = { 0 };
4451 offset = dissect_tns_message(tvb, offset, pinfo, data_tree, is_request, data_func_id, &ctx);
4452 while ( ctx.walk && tvb_reported_length_remaining(tvb, offset) > 0 )
4453 {
4454 data_func_id = tvb_get_uint8(tvb, offset);
4455 if ( !tns_is_next_message(pinfo, data_func_id, is_request) )
4456 break;
4457 col_append_fstr(pinfo->cinfo, COL_INFO, ", %s", val_to_str_const(data_func_id, tns_data_funcs, "unknown"));
4458 proto_tree_add_item(data_tree, hf_tns_data_id, tvb, offset, 1, ENC_BIG_ENDIAN0x00000000);
4459 offset += 1;
4460 ctx.walk = false0;
4461 offset = dissect_tns_message(tvb, offset, pinfo, data_tree, is_request, data_func_id, &ctx);
4462 }
4463
4464 if ( tvb_reported_length_remaining(tvb, offset) > 0 )
4465 call_data_dissector(tvb_new_subset_remaining(tvb, offset), pinfo, data_tree);
4466}
4467
4468/* Whether the length byte in front of an OCI execute's SQL agrees with
4469 * the SQL length its preamble declares. A client in AL32UTF8, the
4470 * database's own character set, declares the SQL's byte length; one in
4471 * any other set declares three times it, a conversion buffer's worth.
4472 * The length byte is the byte length either way, or 0xFE for chunked
4473 * text. */
4474static bool_Bool tns_oci_sql_length_matches(uint8_t prefix, uint32_t declared)
4475{
4476 return prefix == 0xfe || prefix == declared || (uint32_t)prefix * 3 == declared;
4477}
4478
4479/* Whether a packet belongs to a conversation whose client speaks the OCI
4480 * dialect. Stored per packet on the first pass. */
4481static bool_Bool tns_is_oci(packet_info *pinfo)
4482{
4483 void *stored = p_get_proto_data(wmem_file_scope(), pinfo, proto_tns, TNS_PROTO_DATA_OCI4);
4484 if ( stored || PINFO_FD_VISITED(pinfo)((pinfo)->fd->visited) )
4485 return GPOINTER_TO_UINT(stored)((guint) (gulong) (stored)) == 2;
4486
4487 bool_Bool oci = tns_get_conv_info(pinfo)->oci_dialect;
4488 p_add_proto_data(wmem_file_scope(), pinfo, proto_tns, TNS_PROTO_DATA_OCI4, GUINT_TO_POINTER(oci ? 2 : 1)((gpointer) (gulong) (oci ? 2 : 1)));
4489 return oci;
4490}
4491
4492/* Whether an OCI client's session has been seen at the 12c band. Stored
4493 * per packet on the first pass. */
4494static bool_Bool tns_is_oci_12c(packet_info *pinfo)
4495{
4496 void *stored = p_get_proto_data(wmem_file_scope(), pinfo, proto_tns, TNS_PROTO_DATA_OCI_12C8);
4497 if ( stored || PINFO_FD_VISITED(pinfo)((pinfo)->fd->visited) )
4498 return GPOINTER_TO_UINT(stored)((guint) (gulong) (stored)) == 2;
4499
4500 bool_Bool band = tns_get_conv_info(pinfo)->oci_band_12c;
4501 p_add_proto_data(wmem_file_scope(), pinfo, proto_tns, TNS_PROTO_DATA_OCI_12C8, GUINT_TO_POINTER(band ? 2 : 1)((gpointer) (gulong) (band ? 2 : 1)));
4502 return band;
4503}
4504
4505/* A REF in a TTI_KOD message: a ub4 LE length, then the REF itself - a
4506 * ub2 LE length, three flag bytes, the 16-byte object id and 15 bytes
4507 * more. Adds the object id as hf. An id of 15 zero bytes and one more is
4508 * a system type's; *sys_type, when not NULL, gets that last byte, or 0.
4509 * Returns the offset past the REF. */
4510static int dissect_tns_kod_ref(tvbuff_t *tvb, proto_tree *tree, int offset, int hf, int *sys_type)
4511{
4512 uint32_t len = tvb_get_letohl(tvb, offset);
4513
4514 if ( sys_type )
4515 *sys_type = 0;
4516 tvb_ensure_bytes_exist(tvb, offset + 4, (int)MIN(len, INT_MAX)(((len) < (2147483647)) ? (len) : (2147483647)));
4517 if ( len < 21 )
4518 return offset + 4 + len;
4519 proto_tree_add_item(tree, hf, tvb, offset + 9, 16, ENC_NA0x00000000);
4520 if ( sys_type && tvb_skip_uint8(tvb, offset + 9, 15, 0) == (unsigned)(offset + 24) )
4521 {
4522 *sys_type = tvb_get_uint8(tvb, offset + 24);
4523 proto_item_set_generated(proto_tree_add_uint(tree, hf_tns_data_kod_system_type, tvb, offset + 24, 1, *sys_type));
4524 }
4525 return offset + 4 + len;
4526}
4527
4528/* A TEXT in a TTI_KOD reply: a ub4 LE count, then, unless it is zero, a
4529 * length byte and the text. Returns the offset past it. */
4530static int dissect_tns_kod_text(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, int hf, const char **out)
4531{
4532 uint8_t len;
4533
4534 *out = NULL((void*)0);
4535 if ( tvb_get_letohl(tvb, offset) == 0 )
4536 return offset + 4;
4537 len = tvb_get_uint8(tvb, offset + 4);
4538 proto_tree_add_item_ret_string(tree, hf, tvb, offset + 5, len, ENC_UTF_80x00000002, pinfo->pool, (const uint8_t **)out);
4539 return offset + 5 + len;
4540}
4541
4542/* The image of a type descriptor in a TTI_KOD record: a DALC, chunked in
4543 * single-byte lengths when long. The image is a pickled object - 85 01
4544 * fe and a ub4 BE length, then one value per attribute: a length byte,
4545 * fe and a ub4 BE length, or ff for NULL. An instance of SYS.KOTTD
4546 * describes a type, and its attributes 1 to 4 are the type's schema,
4547 * name, version and a ub2 BE typecode. Returns the offset past the
4548 * image. */
4549static int dissect_tns_kod_image(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, int sys_type)
4550{
4551 wmem_array_t *buf = wmem_array_new(pinfo->pool, 1);
4552 uint8_t first = tvb_get_uint8(tvb, offset);
4553 const char *schema = NULL((void*)0), *name = NULL((void*)0);
4554 const uint8_t *img;
4555 int start = offset, base = -1, len, pos;
4556
4557 if ( first == 0xfe )
4558 {
4559 offset += 1;
4560 for ( uint8_t n = tvb_get_uint8(tvb, offset++); n > 0; n = tvb_get_uint8(tvb, offset++) )
4561 {
4562 wmem_array_append(buf, tvb_get_ptr(tvb, offset, n), n);
4563 offset += n;
4564 }
4565 }
4566 else if ( first < TNS_DALC_ABSENT0xFD )
4567 {
4568 /* in place: an attribute's bytes can be pointed at */
4569 base = offset + 1;
4570 wmem_array_append(buf, tvb_get_ptr(tvb, base, first), first);
4571 offset = base + first;
4572 }
4573 else
4574 return offset + get_dalc_custom(tvb, pinfo, offset, NULL((void*)0));
4575
4576 img = (const uint8_t *)wmem_array_get_raw(buf);
4577 len = (int)wmem_array_get_count(buf);
4578 proto_tree_add_bytes_with_length(tree, hf_tns_data_kod_image, tvb, start, offset - start, img, len);
4579 if ( sys_type != TNS_KOD_KOTTD1 || len < 7 || img[0] != 0x85 || img[2] != 0xfe )
4580 return offset;
4581
4582 pos = 7;
4583 for ( int attr = 0; attr <= 4 && pos < len; attr++ )
4584 {
4585 uint32_t alen = img[pos++];
4586 int item_start = start, item_len = offset - start;
4587
4588 if ( alen == 0xff )
4589 continue;
4590 if ( alen == 0xfe )
4591 {
4592 if ( len - pos < 4 )
4593 break;
4594 alen = pntohu32(img + pos);
4595 pos += 4;
4596 }
4597 if ( alen > (uint32_t)(len - pos) )
4598 break;
4599 if ( base >= 0 )
4600 {
4601 item_start = base + pos;
4602 item_len = (int)alen;
4603 }
4604 switch ( attr )
4605 {
4606 case 1:
4607 schema = (const char *)get_utf_8_string(pinfo->pool, img + pos, (int)alen);
4608 proto_tree_add_string(tree, hf_tns_data_kod_schema, tvb, item_start, item_len, schema);
4609 break;
4610 case 2:
4611 name = (const char *)get_utf_8_string(pinfo->pool, img + pos, (int)alen);
4612 proto_tree_add_string(tree, hf_tns_data_kod_name, tvb, item_start, item_len, name);
4613 break;
4614 case 3:
4615 proto_tree_add_string(tree, hf_tns_data_kod_version, tvb, item_start, item_len,
4616 (const char *)get_utf_8_string(pinfo->pool, img + pos, (int)alen));
4617 break;
4618 case 4:
4619 if ( alen == 2 )
4620 proto_tree_add_uint(tree, hf_tns_data_kod_typecode, tvb, item_start, item_len, pntohu16(img + pos));
4621 break;
4622 default:
4623 break;
4624 }
4625 pos += (int)alen;
4626 }
4627 if ( name )
4628 col_append_fstr(pinfo->cinfo, COL_INFO, " [%s%s%s]", schema ? schema : "", schema ? "." : "", name);
4629 return offset;
4630}
4631
4632/* Read the error text after an OCI status block: a length byte for up to
4633 * 252 bytes, else 0xFE and chunks until a zero length. The chunk lengths
4634 * are single bytes from an 11g server and ub4 LE from an 18c one, and
4635 * which a server sends is not its field version but a capability not yet
4636 * identified. The text holds no zero bytes and a message never runs to
4637 * 64K, so the two zero high bytes of a ub4 LE length tell it from a ub1
4638 * length followed by text. Returns the bytes consumed; *out_str gets the
4639 * text, or NULL. */
4640static int tns_oci_error_text(tvbuff_t *tvb, packet_info *pinfo, int offset, const char **out_str)
4641{
4642 wmem_strbuf_t *strbuf;
4643 bool_Bool ub4_lengths;
4644 int o;
4645
4646 if ( tvb_get_uint8(tvb, offset) != 0xfe )
4647 return get_dalc_custom(tvb, pinfo, offset, out_str);
4648
4649 ub4_lengths = tvb_bytes_exist(tvb, offset + 1, 4) && tvb_get_letohs(tvb, offset + 3) == 0;
4650 strbuf = wmem_strbuf_new(pinfo->pool, "");
4651 o = offset + 1;
4652 while ( tvb_reported_length_remaining(tvb, o) > 0 )
4653 {
4654 int chunk_len;
4655 if ( ub4_lengths )
4656 {
4657 chunk_len = (int)MIN(tvb_get_letohl(tvb, o), INT_MAX)(((tvb_get_letohl(tvb, o)) < (2147483647)) ? (tvb_get_letohl
(tvb, o)) : (2147483647))
;
4658 o += 4;
4659 }
4660 else
4661 {
4662 chunk_len = tvb_get_uint8(tvb, o);
4663 o += 1;
4664 }
4665 if ( chunk_len == 0 )
4666 break;
4667 wmem_strbuf_append(strbuf, (const char *)tvb_get_string_enc(pinfo->pool, tvb, o, chunk_len, ENC_UTF_80x00000002|ENC_NA0x00000000));
4668 o += chunk_len;
4669 }
4670 *out_str = wmem_strbuf_get_str(strbuf);
4671 return o - offset;
4672}
4673
4674/* Decode a server message to an OCI client. Its integers are fixed-width
4675 * little-endian, so only the status messages, whose layout is known, are
4676 * decoded; the rest is left to the data dissector. Returns the new
4677 * offset. */
4678static int dissect_tns_oci_message(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *data_tree, unsigned data_func_id, tns_msg_ctx_t *ctx)
4679{
4680 switch ( data_func_id )
4681 {
4682 case SQLNET_INVOKE_USER_CB13:
4683 {
4684 /* A message of a TTI_KOD reply: a by-name reply's header,
4685 * then a record per type descriptor, then the status. A
4686 * TEXT is a ub4 count, a length byte and the text. The
4687 * header: a ub4 2, the schema (the connected user's, even
4688 * for a SYS type), a ub4 0, the name, a byte, the REF of the
4689 * type and 01 00, with four zero bytes more at the 12c band.
4690 * A record: the REF of the system type the descriptor is an
4691 * instance of, a byte, the REF of the type described, a
4692 * byte, a 24-byte descriptor behind a ub4 length (a bare 35
4693 * bytes at the 12c band), 00 01 00, the image's ub4 length,
4694 * 09 00, and the image. */
4695 tns_call_t *call = tns_answered_call(pinfo);
4696 proto_tree *kod_tree;
4697 proto_item *kod_item;
4698 const char *schema, *name;
4699 int start = offset - 1, sys_type;
4700 uint8_t kind;
4701
4702 if ( !call || call->func != TTI_KOD92 )
4703 return offset;
4704 kind = tvb_get_uint8(tvb, offset);
4705 kod_tree = proto_tree_add_subtree(data_tree, tvb, start, -1, ett_tns_kod, &kod_item,
4706 kind == TNS_KOD_HEADER2 ? "Object Type Header" : "Object Type Record");
4707 proto_tree_add_item(kod_tree, hf_tns_data_kod_kind, tvb, offset, 1, ENC_NA0x00000000);
4708 col_append_fstr(pinfo->cinfo, COL_INFO, " (%s)", val_to_str_const(kind, tns_kod_kinds, "unknown"));
4709 offset += 1;
4710 if ( kind == TNS_KOD_HEADER2 )
4711 {
4712 offset += 4;
4713 offset = dissect_tns_kod_text(tvb, pinfo, kod_tree, offset, hf_tns_data_kod_schema, &schema);
4714 offset += 4;
4715 offset = dissect_tns_kod_text(tvb, pinfo, kod_tree, offset, hf_tns_data_kod_name, &name);
4716 offset += 1;
4717 offset = dissect_tns_kod_ref(tvb, kod_tree, offset, hf_tns_data_kod_oid, NULL((void*)0));
4718 offset += tvb_bytes_exist(tvb, offset + 2, 1) && tvb_get_uint8(tvb, offset + 2) == 0 ? 6 : 2;
4719 if ( name )
4720 col_append_fstr(pinfo->cinfo, COL_INFO, " [%s%s%s]", schema ? schema : "", schema ? "." : "", name);
4721 }
4722 else if ( kind == TNS_KOD_RECORD1 )
4723 {
4724 offset = dissect_tns_kod_ref(tvb, kod_tree, offset, hf_tns_data_kod_type_oid, &sys_type);
4725 offset += 1;
4726 offset = dissect_tns_kod_ref(tvb, kod_tree, offset, hf_tns_data_kod_oid, NULL((void*)0));
4727 offset += 1;
4728 offset += tvb_get_letohl(tvb, offset) == 24 ? 4 + 24 : 35;
4729 offset += 3 + 4 + 2;
4730 offset = dissect_tns_kod_image(tvb, pinfo, kod_tree, offset, sys_type);
4731 }
4732 else
4733 return offset;
4734 proto_item_set_len(kod_item, offset - start);
4735 ctx->walk = true1;
4736 return offset;
4737 }
4738
4739 case SQLNET_RETURN_STATUS4:
4740 {
4741 /* The OCI status block: 136 bytes, or a compact 24 for a
4742 * query's execute status, the end of a fetch and a no-row
4743 * status. Offsets count from the message id byte; a field
4744 * this decoder skips is a constant or not understood. The
4745 * error message follows the full form. At the 12c band the
4746 * full form is 144 bytes: the error number again at 132 and
4747 * a ub8 row count, the one sqlplus reports for a DML. */
4748 proto_tree *oer_tree;
4749 proto_item *oer_item;
4750 int base = offset - 1, remaining = tvb_reported_length_remaining(tvb, base);
4751 bool_Bool full = remaining >= 136, wide = false0;
4752 uint32_t err_code;
4753
4754 if ( remaining < 24 )
4755 return offset;
4756 err_code = tvb_get_letohl(tvb, base + 12);
4757 if ( remaining >= 144 )
4758 wide = tns_is_oci_12c(pinfo)
4759 || (err_code != 0 && tvb_get_letohl(tvb, base + 132) == err_code)
4760 || (err_code == 0 && remaining == 144);
4761 oer_tree = proto_tree_add_subtree(data_tree, tvb, base, wide ? 144 : full ? 136 : 24, ett_tns_oer, &oer_item,
4762 wide ? "Oracle Error Return (OCI, 12c band)" : full ? "Oracle Error Return (OCI)"
4763 : "Oracle Error Return (OCI, compact)");
4764 proto_tree_add_item(oer_tree, hf_tns_data_oci_oer_status, tvb, base + 1, 1, ENC_NA0x00000000);
4765 proto_tree_add_item(oer_tree, hf_tns_data_oci_oer_seq, tvb, base + 5, 2, ENC_LITTLE_ENDIAN0x80000000);
4766 proto_tree_add_int(oer_tree, hf_tns_data_oer_rowcount, tvb, base + 8, 4, (int32_t)tvb_get_letohl(tvb, base + 8));
4767 proto_tree_add_int(oer_tree, hf_tns_data_oer_err_code, tvb, base + 12, 4, (int32_t)err_code);
4768 proto_tree_add_item(oer_tree, hf_tns_data_oci_oer_category, tvb, base + 18, 1, ENC_NA0x00000000);
4769 proto_tree_add_item(oer_tree, hf_tns_data_oci_oer_error_pos, tvb, base + 20, 1, ENC_NA0x00000000);
4770 proto_tree_add_item(oer_tree, hf_tns_data_oci_oer_command, tvb, base + 22, 1, ENC_NA0x00000000);
4771 if ( !full )
4772 return base + 24;
4773 /* the sequence number of the call this answers - the client's
4774 * own, not the counter at offset 5 */
4775 proto_tree_add_item(oer_tree, hf_tns_data_oci_oer_call_seq, tvb, base + 49, 2, ENC_LITTLE_ENDIAN0x80000000);
4776 offset = base + 136;
4777 if ( wide )
4778 {
4779 proto_tree_add_item(oer_tree, hf_tns_data_oer_err_num_ext, tvb, base + 132, 4, ENC_LITTLE_ENDIAN0x80000000);
4780 proto_tree_add_item(oer_tree, hf_tns_data_oer_rowcount_ext, tvb, base + 136, 8, ENC_LITTLE_ENDIAN0x80000000);
4781 offset = base + 144;
4782 }
4783 if ( err_code != 0 && tvb_reported_length_remaining(tvb, offset) > 0 )
4784 {
4785 const char *msg = NULL((void*)0);
4786 int msg_start = offset;
4787 offset += tns_oci_error_text(tvb, pinfo, offset, &msg);
4788 msg = tns_trim_message(pinfo, msg);
4789 if ( msg )
4790 {
4791 proto_tree_add_string(oer_tree, hf_tns_data_oer_message, tvb, msg_start, offset - msg_start, msg);
4792 col_append_fstr(pinfo->cinfo, COL_INFO, " [%s]", msg);
4793 }
4794 proto_item_set_len(oer_item, offset - base);
4795 }
4796 return offset;
4797 }
4798
4799 case SQLNET_FUNCCOMPLETE9:
4800 /* TTI_STA, answering a commit, a rollback or a logoff: a
4801 * ub4 LE call status and a ub2 LE end-to-end sequence */
4802 if ( !tvb_bytes_exist(tvb, offset, 6) )
4803 return offset;
4804 tns_add_call_status_flags(
4805 proto_tree_add_item(data_tree, hf_tns_data_sta_call_status, tvb, offset, 4, ENC_LITTLE_ENDIAN0x80000000),
4806 tvb, offset, 4, tvb_get_letohl(tvb, offset));
4807 proto_tree_add_item(data_tree, hf_tns_data_sta_seq, tvb, offset + 4, 2, ENC_LITTLE_ENDIAN0x80000000);
4808 return offset + 6;
4809
4810 default:
4811 return offset;
4812 }
4813}
4814
4815/* Decode the body of one TTC message, whose id byte has already been
4816 * consumed. Sets ctx->walk when the decoder ended exactly on the
4817 * message's last byte, so the caller can step into whatever follows it.
4818 * Returns the new offset. */
4819static int dissect_tns_message(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *data_tree, bool_Bool is_request, unsigned data_func_id, tns_msg_ctx_t *ctx)
4820{
4821 /* The thin decoders below would misread the fixed-width integers of
4822 * a server talking to an OCI client. */
4823 if ( !is_request && data_func_id != SQLNET_SNS0xdeadbeef && data_func_id != SQLNET_RETURN_OPI_PARAM8
4824 && tns_is_oci(pinfo) )
4825 return dissect_tns_oci_message(tvb, offset, pinfo, data_tree, data_func_id, ctx);
4826
4827 /* Handle data functions that have more than just ID */
4828 switch (data_func_id)
4829 {
4830 case SQLNET_SET_PROTOCOL1:
4831 {
4832 proto_tree *versions_tree;
4833 proto_item *ti;
4834 char sep;
4835 if ( is_request )
4836 {
4837 versions_tree = proto_tree_add_subtree(data_tree, tvb, offset, -1, ett_tns_acc_versions, &ti, "Accepted Versions");
4838 sep = ':';
4839 for (;;) {
4840 /*
4841 * Add each accepted version as a
4842 * separate item.
4843 */
4844 uint8_t vers;
4845
4846 vers = tvb_get_uint8(tvb, offset);
4847 if (vers == 0) {
4848 /*
4849 * A version of 0 terminates
4850 * the list.
4851 */
4852 break;
4853 }
4854 proto_item_append_text(ti, "%c %u", sep, vers);
4855 sep = ',';
4856 proto_tree_add_uint(versions_tree, hf_tns_data_setp_acc_version, tvb, offset, 1, vers);
4857 offset += 1;
4858 }
4859 offset += 1; /* skip the 0 terminator */
4860 proto_item_set_end(ti, tvb, offset);
4861 proto_tree_add_item(data_tree, hf_tns_data_setp_cli_plat, tvb, offset, -1, ENC_ASCII0x00000000);
4862
4863 return tvb_reported_length(tvb); /* skip call_data_dissector */
4864 }
4865 else
4866 {
4867 unsigned len;
4868 versions_tree = proto_tree_add_subtree(data_tree, tvb, offset, -1, ett_tns_acc_versions, &ti, "Versions");
4869 sep = ':';
4870 for (;;) {
4871 /*
4872 * Add each version as a separate item.
4873 */
4874 uint8_t vers;
4875
4876 vers = tvb_get_uint8(tvb, offset);
4877 if (vers == 0) {
4878 /*
4879 * A version of 0 terminates
4880 * the list.
4881 */
4882 break;
4883 }
4884 proto_item_append_text(ti, "%c %u", sep, vers);
4885 sep = ',';
4886 proto_tree_add_uint(versions_tree, hf_tns_data_setp_version, tvb, offset, 1, vers);
4887 offset += 1;
4888 }
4889 offset += 1; /* skip the 0 terminator */
4890 proto_item_set_end(ti, tvb, offset);
4891 proto_tree_add_item_ret_length(data_tree, hf_tns_data_setp_banner, tvb, offset, -1, ENC_ASCII0x00000000|ENC_NA0x00000000, &len);
4892 offset += len;
4893
4894 /* After the banner: the server's charset (LE), flags, a
4895 * count of 5-byte elements (LE), the "fdo" block (a BE
4896 * length) whose tail names the national charset, and the
4897 * server's compile and runtime capabilities, each behind a
4898 * length byte. Capability 7 is the highest TTC field
4899 * version the server offers. */
4900 if ( tvb_reported_length_remaining(tvb, offset) < 5 )
4901 break;
4902 proto_tree_add_item(data_tree, hf_tns_data_setp_charset, tvb, offset, 2, ENC_LITTLE_ENDIAN0x80000000);
4903 offset += 2;
4904 proto_tree_add_item(data_tree, hf_tns_data_setp_flags, tvb, offset, 1, ENC_NA0x00000000);
4905 offset += 1;
4906 unsigned num_elem = tvb_get_letohs(tvb, offset);
4907 offset += 2 + 5 * num_elem;
4908 unsigned fdo_len = tvb_get_ntohs(tvb, offset);
4909 offset += 2;
4910 if ( fdo_len >= 7 )
4911 {
4912 unsigned ix = 6 + tvb_get_uint8(tvb, offset + 5) + tvb_get_uint8(tvb, offset + 6);
4913 if ( ix + 5 <= fdo_len )
4914 proto_tree_add_item(data_tree, hf_tns_data_setp_ncharset, tvb, offset + ix + 3, 2, ENC_BIG_ENDIAN0x00000000);
4915 }
4916 offset += fdo_len;
4917 uint8_t caps_len = tvb_get_uint8(tvb, offset);
4918 proto_tree_add_item(data_tree, hf_tns_data_setp_compile_caps, tvb, offset, 1 + caps_len, ENC_NA0x00000000);
4919 if ( caps_len > TNS_CCAP_FIELD_VERSION7 )
4920 {
4921 proto_tree_add_item(data_tree, hf_tns_data_setp_field_version, tvb,
4922 offset + 1 + TNS_CCAP_FIELD_VERSION7, 1, ENC_NA0x00000000);
4923 if ( !PINFO_FD_VISITED(pinfo)((pinfo)->fd->visited) )
4924 tns_get_conv_info(pinfo)->server_field_version =
4925 tvb_get_uint8(tvb, offset + 1 + TNS_CCAP_FIELD_VERSION7);
4926 }
4927 offset += 1 + caps_len;
4928 caps_len = tvb_get_uint8(tvb, offset);
4929 proto_tree_add_item(data_tree, hf_tns_data_setp_runtime_caps, tvb, offset, 1 + caps_len, ENC_NA0x00000000);
4930 offset += 1 + caps_len;
4931 ctx->walk = true1;
4932 }
4933 break;
4934 }
4935
4936 case SQLNET_SET_DATATYPES2:
4937 {
4938 /* TTI_DTY: Data Type Negotiation, sent right after TTI_PRO
4939 * during the TTC handshake. The client tells the server its
4940 * capabilities and, for each native Oracle data type it
4941 * understands, the wire representation it wants. Layout
4942 * cross-referenced with python-oracledb.
4943 *
4944 * charset_in 2 bytes LE NLS_LANGUAGE charset id
4945 * charset_out 2 bytes LE NLS_NCHAR charset id
4946 * flag 1 byte capability flag (1 = std)
4947 * compile caps a length byte and the capabilities
4948 * runtime caps a length byte and the capabilities
4949 * type entries until a 0 type
4950 *
4951 * The entries are single bytes from an 11g client - (type,
4952 * conversion type, representation, 0), or just (type, 0) - and
4953 * big-endian 16-bit fields (type, conversion type,
4954 * representation, 0) from a 12c+ one; a table of 16-bit
4955 * entries opens with a zero byte. The single-byte table opens
4956 * with an identity map - (N, N, 1, 0) for each type N - that
4957 * is shown whole. */
4958 proto_tree *caphdr_tree, *ov_tree;
4959 proto_item *caphdr_item, *ov_item;
4960 uint8_t caps_len;
4961
4962 if ( !is_request )
4963 {
4964 /* The server's reply, from 12.1: 16-bit (type, conversion
4965 * type) pairs - with four more bytes when the conversion
4966 * type is not 0 - up to a 0 type. */
4967 if ( tns_field_version(pinfo) < TNS_FV_12_17 )
4968 break;
4969 while ( tvb_reported_length_remaining(tvb, offset) >= 2 )
4970 {
4971 uint16_t type = tvb_get_ntohs(tvb, offset);
4972 uint16_t conv;
4973 if ( type == 0 )
4974 {
4975 offset += 2;
4976 ctx->walk = true1;
4977 break;
4978 }
4979 conv = tvb_get_ntohs(tvb, offset + 2);
4980 proto_tree *e_tree = proto_tree_add_subtree_format(data_tree, tvb, offset, conv ? 8 : 4,
4981 ett_tns_setdt_override, NULL((void*)0), "Type %u (%s)",
4982 type, val_to_str_const(type, tns_data_types, "unknown"));
4983 proto_tree_add_item(e_tree, hf_tns_data_setdt_type, tvb, offset, 2, ENC_BIG_ENDIAN0x00000000);
4984 proto_tree_add_item(e_tree, hf_tns_data_setdt_conv_type, tvb, offset + 2, 2, ENC_BIG_ENDIAN0x00000000);
4985 if ( conv )
4986 proto_tree_add_item(e_tree, hf_tns_data_setdt_rep, tvb, offset + 4, 2, ENC_BIG_ENDIAN0x00000000);
4987 offset += conv ? 8 : 4;
4988 }
4989 break;
4990 }
4991
4992 proto_tree_add_item(data_tree, hf_tns_data_setdt_charset_in, tvb, offset, 2, ENC_LITTLE_ENDIAN0x80000000);
4993 offset += 2;
4994 proto_tree_add_item(data_tree, hf_tns_data_setdt_charset_out, tvb, offset, 2, ENC_LITTLE_ENDIAN0x80000000);
4995 offset += 2;
4996 proto_tree_add_item(data_tree, hf_tns_data_setdt_flag, tvb, offset, 1, ENC_BIG_ENDIAN0x00000000);
4997 offset += 1;
4998
4999 caps_len = tvb_get_uint8(tvb, offset);
5000 caphdr_item = proto_tree_add_item(data_tree, hf_tns_data_setdt_caphdr, tvb, offset, 1 + caps_len, ENC_NA0x00000000);
5001 caphdr_tree = proto_item_add_subtree(caphdr_item, ett_tns_setdt_caphdr);
5002 if ( caps_len >= 2 )
5003 {
5004 proto_tree_add_item(caphdr_tree, hf_tns_data_setdt_caphdr_version, tvb, offset, 3, ENC_BIG_ENDIAN0x00000000);
5005 proto_tree_add_item(caphdr_tree, hf_tns_data_setdt_caphdr_flags, tvb, offset + 3, caps_len - 2, ENC_NA0x00000000);
5006 }
5007 /* The header opens with the length of the client's compile
5008 * capabilities, and capability 7 is the TTC field version.
5009 * The client has already lowered it to the server's, so it
5010 * is the one the connection uses. */
5011 if ( caps_len > TNS_CCAP_FIELD_VERSION7 )
5012 {
5013 uint8_t fv = tvb_get_uint8(tvb, offset + 1 + TNS_CCAP_FIELD_VERSION7);
5014 proto_tree_add_item(caphdr_tree, hf_tns_data_setdt_field_version, tvb,
5015 offset + 1 + TNS_CCAP_FIELD_VERSION7, 1, ENC_NA0x00000000);
5016 if ( !PINFO_FD_VISITED(pinfo)((pinfo)->fd->visited) )
5017 tns_get_conv_info(pinfo)->field_version = fv;
5018 }
5019 offset += 1 + caps_len;
5020
5021 /* runtime capabilities */
5022 caps_len = tvb_get_uint8(tvb, offset);
5023 proto_tree_add_item(data_tree, hf_tns_data_setdt_tblhdr, tvb, offset, 1 + caps_len, ENC_NA0x00000000);
5024 offset += 1 + caps_len;
5025
5026 ov_item = proto_tree_add_item(data_tree, hf_tns_data_setdt_overrides, tvb, offset, -1, ENC_NA0x00000000);
5027 ov_tree = proto_item_add_subtree(ov_item, ett_tns_setdt_overrides);
5028 int ov_start = offset;
5029 if ( tvb_reported_length_remaining(tvb, offset) > 0 && tvb_get_uint8(tvb, offset) == 0 )
5030 {
5031 /* 16-bit entries */
5032 while ( tvb_reported_length_remaining(tvb, offset) >= 2 )
5033 {
5034 uint16_t type = tvb_get_ntohs(tvb, offset);
5035 if ( type == 0 )
5036 {
5037 offset += 2;
5038 break;
5039 }
5040 proto_tree *e_tree = proto_tree_add_subtree_format(ov_tree, tvb, offset, 8,
5041 ett_tns_setdt_override, NULL((void*)0), "Type %u (%s)",
5042 type, val_to_str_const(type, tns_data_types, "unknown"));
5043 proto_tree_add_item(e_tree, hf_tns_data_setdt_type, tvb, offset, 2, ENC_BIG_ENDIAN0x00000000);
5044 proto_tree_add_item(e_tree, hf_tns_data_setdt_conv_type, tvb, offset + 2, 2, ENC_BIG_ENDIAN0x00000000);
5045 proto_tree_add_item(e_tree, hf_tns_data_setdt_rep, tvb, offset + 4, 2, ENC_BIG_ENDIAN0x00000000);
5046 offset += 8;
5047 }
5048 proto_item_set_len(ov_item, offset - ov_start);
5049 /* in a fast-authentication bundle the session key request
5050 * follows */
5051 ctx->walk = true1;
5052 break;
5053 }
5054
5055 /* the identity run of the single-byte table */
5056 int id_start = offset;
5057 while ( tvb_bytes_exist(tvb, offset, 4) && tvb_get_uint8(tvb, offset) != 0
5058 && tvb_get_uint8(tvb, offset) == tvb_get_uint8(tvb, offset + 1)
5059 && tvb_get_uint8(tvb, offset + 2) == 1 && tvb_get_uint8(tvb, offset + 3) == 0 )
5060 offset += 4;
5061 if ( offset > id_start )
5062 proto_tree_add_item(data_tree, hf_tns_data_setdt_idmap, tvb, id_start, offset - id_start, ENC_NA0x00000000);
5063 ov_start = offset;
5064
5065 /* Walk type-override entries until the 0 terminator. Each
5066 * entry is (client_type, server_repr[, format]); a 0 in the
5067 * server_repr slot marks a short "client knows the id but
5068 * has no override" entry. */
5069 while ( tvb_reported_length_remaining(tvb, offset) > 0 )
5070 {
5071 uint8_t client_type = tvb_get_uint8(tvb, offset);
5072 if ( client_type == 0 )
5073 {
5074 proto_tree_add_item(ov_tree, hf_tns_data_setdt_override_client, tvb, offset, 1, ENC_BIG_ENDIAN0x00000000);
5075 offset += 1;
5076 break;
5077 }
5078 uint8_t repr = tvb_get_uint8(tvb, offset + 1);
5079 int entry_len = (repr == 0) ? 2 : 4;
5080 proto_tree *e_tree = proto_tree_add_subtree_format(ov_tree, tvb, offset, entry_len,
5081 ett_tns_setdt_override, NULL((void*)0), "Type %u (%s)",
5082 client_type, val_to_str_const(client_type, tns_data_types, "unknown"));
5083 proto_tree_add_item(e_tree, hf_tns_data_setdt_override_client, tvb, offset, 1, ENC_BIG_ENDIAN0x00000000);
5084 if ( entry_len == 4 )
5085 {
5086 proto_tree_add_item(e_tree, hf_tns_data_setdt_override_repr, tvb, offset + 1, 1, ENC_BIG_ENDIAN0x00000000);
5087 proto_tree_add_item(e_tree, hf_tns_data_setdt_override_format, tvb, offset + 2, 1, ENC_BIG_ENDIAN0x00000000);
5088 }
5089 offset += entry_len;
5090 }
5091 proto_item_set_len(ov_item, offset - ov_start);
5092 break;
5093 }
5094
5095 case SQLNET_RETURN_STATUS4:
5096 {
5097 /* TTI_OER: server-side end-of-call status block. Emitted at
5098 * the end of every response — success or failure. Layout
5099 * cross-referenced with python-oracledb's
5100 * _process_error_info, in the Oracle 11g shape (no extended
5101 * ub4 error number / ub8 rowcount that 12c+ adds).
5102 *
5103 * All multi-byte integers are stored in the ub4 variable-
5104 * length form (see get_sb4_custom): first byte holds the
5105 * value's width (0..4), followed by that many big-endian
5106 * data bytes. */
5107 proto_tree *oer_tree;
5108 proto_item *oer_item;
5109 int oer_start = offset;
5110 int v;
5111
5112 oer_tree = proto_tree_add_subtree(data_tree, tvb, offset, -1, ett_tns_oer, &oer_item, "Oracle Error Return");
5113
5114 /* call_status */
5115 offset += get_sb4_custom(tvb, offset, &v);
5116 tns_add_call_status_flags(
5117 proto_tree_add_int(oer_tree, hf_tns_data_oer_call_status, tvb, oer_start, offset - oer_start, v),
5118 tvb, oer_start, offset - oer_start, (uint32_t)v);
5119 /* end-to-end seq# (skipped) */
5120 offset += get_sb4_custom(tvb, offset, &v);
5121 /* rowcount: the rows the call applied, whether it went on
5122 * to fail or not */
5123 int rc_start = offset;
5124 uint64_t rows_done;
5125 offset += get_sb4_custom(tvb, offset, &v);
5126 proto_tree_add_int(oer_tree, hf_tns_data_oer_rowcount, tvb, rc_start, offset - rc_start, v);
5127 rows_done = (uint64_t)(uint32_t)v;
5128 /* err_code (ORA-NNNNN, 0 on success) */
5129 int ec_start = offset;
5130 int err_code = 0;
5131 offset += get_sb4_custom(tvb, offset, &err_code);
5132 proto_tree_add_int(oer_tree, hf_tns_data_oer_err_code, tvb, ec_start, offset - ec_start, err_code);
5133 /* array elem error #1, #2 (skipped) */
5134 offset += get_sb4_custom(tvb, offset, &v);
5135 offset += get_sb4_custom(tvb, offset, &v);
5136 /* cursor_id */
5137 int ci_start = offset;
5138 offset += get_sb4_custom(tvb, offset, &v);
5139 proto_tree_add_int(oer_tree, hf_tns_data_oer_cursor_id, tvb, ci_start, offset - ci_start, v);
5140 /* The status of an execute that opened a new cursor names it:
5141 * its bind types now belong to that cursor id. */
5142 if ( !PINFO_FD_VISITED(pinfo)((pinfo)->fd->visited) && v != 0 )
5143 {
5144 tns_conv_info_t *tns_info = tns_get_conv_info(pinfo);
5145 if ( tns_info->pending_binds )
5146 {
5147 wmem_map_insert(tns_info->cursor_binds, GUINT_TO_POINTER(v)((gpointer) (gulong) (v)), tns_info->pending_binds);
5148 tns_info->pending_binds = NULL((void*)0);
5149 }
5150 }
5151 /* error position (skipped) */
5152 offset += get_sb4_custom(tvb, offset, &v);
5153 /* 6 single-byte fields: sql_type, fatal, flags,
5154 * user_cursor_opts, upi_param, warn_flags. Five are
5155 * diagnostic; the last is not. Its bit 0x20 says the
5156 * statement created a PL/SQL object that compiled with
5157 * errors - the call succeeded, the error code is 0 and the
5158 * reply is otherwise indistinguishable from a clean one, so
5159 * this bit is the only sign the object is invalid. */
5160 offset += 5;
5161 tns_add_warn_flags(tvb, pinfo, oer_tree, offset);
5162 offset += 1;
5163 /* The rowid of the last row the statement touched: ub4
5164 * data object, ub2 relative file, a reserved byte, ub4
5165 * block, ub2 slot. A zero block means there is none - a
5166 * query, DDL, or a DML that touched no row. In a bigfile
5167 * tablespace the file is 1024 here where a fetched ROWID
5168 * says 0; both name the same row. */
5169 {
5170 int rid_start = offset, rba = 0, part = 0, block = 0, slot = 0;
5171 offset += get_sb4_custom(tvb, offset, &rba);
5172 offset += get_sb4_custom(tvb, offset, &part);
5173 offset += 1;
5174 offset += get_sb4_custom(tvb, offset, &block);
5175 offset += get_sb4_custom(tvb, offset, &slot);
5176 if ( block != 0 )
5177 proto_tree_add_string(oer_tree, hf_tns_data_oer_rowid, tvb, rid_start, offset - rid_start,
5178 tns_format_rowid(pinfo, (uint32_t)rba, (uint32_t)part, (uint32_t)block, (uint32_t)slot));
5179 }
5180 /* os error (skipped) */
5181 offset += get_sb4_custom(tvb, offset, &v);
5182 /* statement #, call # (1 byte each) */
5183 offset += 2;
5184 /* padding ub2 + successful iterations ub4 */
5185 offset += get_sb4_custom(tvb, offset, &v);
5186 offset += get_sb4_custom(tvb, offset, &v);
5187 /* oerrdd (logical rowid), a bytes_with_length — skipped */
5188 offset += get_field_with_length(tvb, pinfo, offset, NULL((void*)0));
5189
5190 /* Batch error arrays (array DML). The code and offset arrays
5191 * are each a ub4 count followed by one DALC packing that many
5192 * ub4 values back to back; the message array is a ub4 count,
5193 * an indicator byte, and then that many str_with_length
5194 * entries each with a 2-byte trailer. All three counts are
5195 * zero for an ordinary statement. */
5196 int n_codes = 0, n_offs = 0, n_msgs = 0;
5197 int nb_start = offset;
5198 offset += get_sb4_custom(tvb, offset, &n_codes);
5199 proto_tree_add_int(oer_tree, hf_tns_data_oer_n_batch_errcodes, tvb, nb_start, offset - nb_start, n_codes);
5200 if ( n_codes > 0 )
5201 offset += get_dalc_custom(tvb, pinfo, offset, NULL((void*)0));
5202 nb_start = offset;
5203 offset += get_sb4_custom(tvb, offset, &n_offs);
5204 proto_tree_add_int(oer_tree, hf_tns_data_oer_n_batch_offsets, tvb, nb_start, offset - nb_start, n_offs);
5205 if ( n_offs > 0 )
5206 offset += get_dalc_custom(tvb, pinfo, offset, NULL((void*)0));
5207 nb_start = offset;
5208 offset += get_sb4_custom(tvb, offset, &n_msgs);
5209 proto_tree_add_int(oer_tree, hf_tns_data_oer_n_batch_messages, tvb, nb_start, offset - nb_start, n_msgs);
5210 if ( n_msgs > 0 )
5211 {
5212 offset += 1;
5213 for ( int i = 0; i < n_msgs; i++ )
5214 {
5215 offset += get_field_with_length(tvb, pinfo, offset, NULL((void*)0));
5216 offset += 2;
5217 }
5218 }
5219
5220 /* From 12.1 the block goes on with the error number and row
5221 * count at their full widths (a ub4 and a ub8), and from 20.1
5222 * with the SQL type and a server checksum. The extended error
5223 * number is the one that says whether a message follows.
5224 * The first pair follows the negotiated field version, the
5225 * second the server's own release: a 21c or later server
5226 * sends it even to a session that settled on 12.1 or 19c. */
5227 unsigned fv = tns_field_version(pinfo);
5228 unsigned server_fv = tns_server_field_version(pinfo);
5229 if ( fv >= TNS_FV_12_17 )
5230 {
5231 uint64_t rows = 0;
5232 int start = offset;
5233 offset += get_sb4_custom(tvb, offset, &err_code);
5234 proto_tree_add_uint(oer_tree, hf_tns_data_oer_err_num_ext, tvb, start, offset - start, err_code);
5235 start = offset;
5236 offset += get_ub8_custom(tvb, offset, &rows);
5237 proto_tree_add_uint64(oer_tree, hf_tns_data_oer_rowcount_ext, tvb, start, offset - start, rows);
5238 rows_done = rows;
5239 }
5240 if ( fv >= TNS_FV_12_17 && (server_fv ? server_fv : fv) >= TNS_FV_20_114 )
5241 {
5242 int start = offset;
5243 offset += get_sb4_custom(tvb, offset, &v);
5244 proto_tree_add_uint(oer_tree, hf_tns_data_oer_sql_type, tvb, start, offset - start, v);
5245 start = offset;
5246 offset += get_sb4_custom(tvb, offset, &v);
5247 proto_tree_add_uint(oer_tree, hf_tns_data_oer_checksum, tvb, start, offset - start, v);
5248 }
5249
5250 /* Trailing message DALC — present (and meaningful) only when
5251 * err_code is non-zero. */
5252 if ( err_code != 0 && tvb_reported_length_remaining(tvb, offset) > 0 )
5253 {
5254 const char *msg = NULL((void*)0);
5255 int msg_start = offset;
5256 offset += get_dalc_custom(tvb, pinfo, offset, &msg);
5257 msg = tns_trim_message(pinfo, msg);
5258 if ( msg )
5259 {
5260 proto_tree_add_string(oer_tree, hf_tns_data_oer_message, tvb, msg_start, offset - msg_start, msg);
5261 col_append_fstr(pinfo->cinfo, COL_INFO, " [%s]", msg);
5262 }
5263 }
5264 /* A call that failed part-way through - an array DML whose
5265 * later iteration raised - still applied the rows before the
5266 * one that raised, and this is where it says how many. */
5267 if ( err_code != 0 && rows_done != 0 )
5268 col_append_fstr(pinfo->cinfo, COL_INFO, " [%" PRIu64"l" "u" " rows applied]", rows_done);
5269 proto_item_set_len(oer_item, offset - oer_start);
5270 /* With the field version known the block ends where it
5271 * should, so an end-of-response marker after it can be read. */
5272 ctx->walk = fv != 0;
5273 break;
5274 }
5275
5276 case SQLNET_FUNCCOMPLETE9:
5277 {
5278 /* TTI_STA: a bare status, with no error block. It answers a
5279 * commit, a rollback or a logoff: a ub4 call status and the
5280 * ub2 end-to-end sequence number. */
5281 int v = 0, start;
5282
5283 if ( is_request )
5284 break;
5285
5286 start = offset;
5287 offset += get_sb4_custom(tvb, offset, &v);
5288 tns_add_call_status_flags(
5289 proto_tree_add_uint(data_tree, hf_tns_data_sta_call_status, tvb, start, offset - start, v),
5290 tvb, start, offset - start, (uint32_t)v);
5291 start = offset;
5292 offset += get_sb4_custom(tvb, offset, &v);
5293 proto_tree_add_uint(data_tree, hf_tns_data_sta_seq, tvb, start, offset - start, v);
5294 ctx->walk = true1;
5295 break;
5296 }
5297
5298 case SQLNET_LOB_FILE_DF14:
5299 {
5300 /* LOB content: what a TTI_LOBOPS READ returns, ahead of the
5301 * return parameters. Raw bytes for a BLOB or BFILE, the LOB's
5302 * character set (usually UTF-16BE) for a CLOB. */
5303 int start = offset;
5304
5305 if ( is_request )
5306 break;
5307
5308 offset += get_dalc_custom(tvb, pinfo, offset, NULL((void*)0));
5309 if ( tvb_get_uint8(tvb, start) == 0xfe ) /* chunked: shown whole */
5310 proto_tree_add_item(data_tree, hf_tns_data_lob_data, tvb, start, offset - start, ENC_NA0x00000000);
5311 else if ( offset - start > 1 )
5312 proto_tree_add_item(data_tree, hf_tns_data_lob_data, tvb, start + 1, offset - start - 1, ENC_NA0x00000000);
5313
5314 /* A CLOB's content is text; the locator the read named says
5315 * how it is encoded. */
5316 const tns_call_t *call = tns_answered_call(pinfo);
5317 if ( call && call->func == TTI_LOBOPS96 && call->lob_flags_known
5318 && (call->lob_flags[0] & (TNS_LOB_LOC_FLAGS_CLOB0x02 | TNS_LOB_LOC_FLAGS_NCLOB0x04)) )
5319 {
5320 int len = 0;
5321 const uint8_t *data = tns_dalc_bytes(tvb, pinfo, start, &len);
5322 const uint8_t *text = NULL((void*)0);
5323
5324 if ( data && (call->lob_flags[0] & TNS_LOB_LOC_FLAGS_NCLOB0x04) )
5325 text = get_utf_16_string(pinfo->pool, data, len, ENC_BIG_ENDIAN0x00000000);
5326 else if ( data && (call->lob_flags[2] & TNS_LOB_LOC_FLAGS_VAR_LENGTH_CHARSET0x80) )
5327 text = get_utf_16_string(pinfo->pool, data, len,
5328 (call->lob_flags[3] & TNS_LOB_LOC_FLAGS_LITTLE_ENDIAN0x40) ? ENC_LITTLE_ENDIAN0x80000000 : ENC_BIG_ENDIAN0x00000000);
5329 else if ( data )
5330 text = get_utf_8_string(pinfo->pool, data, len);
5331 if ( text )
5332 proto_item_set_generated(proto_tree_add_string(data_tree, hf_tns_data_lob_text, tvb,
5333 start, offset - start, (const char *)text));
5334 }
5335 ctx->walk = true1;
5336 break;
5337 }
5338
5339 case SQLNET_WARNING15:
5340 {
5341 /* TTI_WRN: a warning that does not fail the call - PL/SQL
5342 * compiled with errors, say. A ub2 warning number, a ub2
5343 * message length and ub2 flags, then the message itself when
5344 * both are non-zero. */
5345 int code = 0, len = 0, v = 0, start;
5346
5347 if ( is_request )
5348 break;
5349
5350 start = offset;
5351 offset += get_sb4_custom(tvb, offset, &code);
5352 proto_tree_add_uint(data_tree, hf_tns_data_wrn_code, tvb, start, offset - start, code);
5353 start = offset;
5354 offset += get_sb4_custom(tvb, offset, &len);
5355 proto_tree_add_uint(data_tree, hf_tns_data_wrn_length, tvb, start, offset - start, len);
5356 start = offset;
5357 offset += get_sb4_custom(tvb, offset, &v);
5358 proto_tree_add_uint(data_tree, hf_tns_data_wrn_flags, tvb, start, offset - start, v);
5359 if ( code != 0 && len > 0 )
5360 {
5361 const char *msg = NULL((void*)0);
5362 start = offset;
5363 offset += get_dalc_custom(tvb, pinfo, offset, &msg);
5364 msg = tns_trim_message(pinfo, msg);
5365 if ( msg )
5366 {
5367 proto_tree_add_string(data_tree, hf_tns_data_wrn_message, tvb, start, offset - start, msg);
5368 col_append_fstr(pinfo->cinfo, COL_INFO, " [%s]", msg);
5369 }
5370 }
5371 ctx->walk = true1;
5372 break;
5373 }
5374
5375 case SQLNET_SERVER_PIGGYBACK23:
5376 {
5377 /* A piggyback from the server: state it pushes to the client
5378 * alongside a reply, selected by an opcode. Layouts follow
5379 * python-oracledb's _process_server_side_piggyback. */
5380 int v = 0, num = 0, start;
5381 uint8_t opcode;
5382
5383 if ( is_request )
5384 break;
5385
5386 proto_tree_add_item_ret_uint8(data_tree, hf_tns_data_spb_opcode, tvb, offset, 1, ENC_BIG_ENDIAN0x00000000, &opcode);
5387 col_append_fstr(pinfo->cinfo, COL_INFO, " (%s)",
5388 val_to_str_const(opcode, tns_spb_opcodes, "unknown"));
5389 offset += 1;
5390 switch ( opcode )
5391 {
5392 case TNS_SPB_QUERY_CACHE_INVALIDATION1:
5393 case TNS_SPB_TRACE_EVENT3:
5394 break;
5395 case TNS_SPB_LTXID7:
5396 offset += get_sb4_custom(tvb, offset, &v);
5397 if ( v > 0 )
5398 {
5399 start = offset;
5400 offset += get_dalc_custom(tvb, pinfo, offset, NULL((void*)0));
5401 proto_tree_add_item(data_tree, hf_tns_data_spb_ltxid, tvb, start + 1, offset - start - 1, ENC_NA0x00000000);
5402 }
5403 break;
5404 case TNS_SPB_OS_PID_MTS2:
5405 {
5406 const char *pid = NULL((void*)0);
5407 offset += get_sb4_custom(tvb, offset, &v);
5408 start = offset;
5409 offset += get_dalc_custom(tvb, pinfo, offset, &pid);
5410 if ( pid )
5411 proto_tree_add_string(data_tree, hf_tns_data_spb_os_pid, tvb, start, offset - start, pid);
5412 break;
5413 }
5414 case TNS_SPB_SYNC5:
5415 /* Session state the statement changed - a new current
5416 * schema, edition or NLS setting - as key/value pairs. */
5417 offset += get_sb4_custom(tvb, offset, &v); /* number of DTYs */
5418 offset += 1; /* length of DTYs */
5419 start = offset;
5420 offset += get_sb4_custom(tvb, offset, &num);
5421 proto_tree_add_uint(data_tree, hf_tns_data_spb_num_kv, tvb, start, offset - start, num);
5422 offset += 1; /* length */
5423 offset = dissect_tns_kv_pairs(tvb, pinfo, data_tree, offset, num);
5424 start = offset;
5425 offset += get_sb4_custom(tvb, offset, &v);
5426 proto_tree_add_uint(data_tree, hf_tns_data_spb_flags, tvb, start, offset - start, v);
5427 break;
5428 case TNS_SPB_EXT_SYNC9:
5429 offset += get_sb4_custom(tvb, offset, &v); /* number of DTYs */
5430 offset += 1; /* length of DTYs */
5431 break;
5432 case TNS_SPB_AC_REPLAY_CONTEXT8:
5433 offset += get_sb4_custom(tvb, offset, &v); /* number of DTYs */
5434 offset += 1; /* length of DTYs */
5435 offset += get_sb4_custom(tvb, offset, &v); /* flags */
5436 offset += get_sb4_custom(tvb, offset, &v); /* error code */
5437 offset += 1; /* queue */
5438 offset += get_field_with_length(tvb, pinfo, offset, NULL((void*)0)); /* replay context */
5439 break;
5440 case TNS_SPB_SESS_RET4:
5441 offset += get_sb4_custom(tvb, offset, &v); /* number of DTYs */
5442 offset += 1; /* length of DTYs */
5443 offset += get_sb4_custom(tvb, offset, &num);
5444 if ( num > 0 )
5445 {
5446 offset += 1;
5447 for ( int i = 0; i < num && tvb_reported_length_remaining(tvb, offset) > 0; i++ )
5448 {
5449 offset += get_sb4_custom(tvb, offset, &v); /* key */
5450 if ( v > 0 )
5451 offset += get_dalc_custom(tvb, pinfo, offset, NULL((void*)0));
5452 offset += get_sb4_custom(tvb, offset, &v); /* value */
5453 if ( v > 0 )
5454 offset += get_dalc_custom(tvb, pinfo, offset, NULL((void*)0));
5455 offset += get_sb4_custom(tvb, offset, &v); /* flags */
5456 }
5457 }
5458 start = offset;
5459 offset += get_sb4_custom(tvb, offset, &v);
5460 proto_tree_add_uint(data_tree, hf_tns_data_spb_flags, tvb, start, offset - start, v);
5461 start = offset;
5462 offset += get_sb4_custom(tvb, offset, &v);
5463 proto_tree_add_uint(data_tree, hf_tns_data_spb_session_id, tvb, start, offset - start, v);
5464 start = offset;
5465 offset += get_sb4_custom(tvb, offset, &v);
5466 proto_tree_add_uint(data_tree, hf_tns_data_spb_serial_num, tvb, start, offset - start, v);
5467 break;
5468 case TNS_SPB_SESS_SIGNATURE10:
5469 {
5470 uint64_t u = 0;
5471 offset += get_sb4_custom(tvb, offset, &v); /* number of DTYs */
5472 offset += 1; /* length of DTYs */
5473 offset += get_ub8_custom(tvb, offset, &u); /* signature flags */
5474 offset += get_ub8_custom(tvb, offset, &u); /* client signature */
5475 offset += get_ub8_custom(tvb, offset, &u); /* server signature */
5476 break;
5477 }
5478 default:
5479 /* Unknown opcode: its length is unknown too. */
5480 return offset;
5481 }
5482 ctx->walk = true1;
5483 break;
5484 }
5485
5486 case SQLNET_IMPLICIT_RESULTS27:
5487 {
5488 /* The result sets a PL/SQL block returned with
5489 * DBMS_SQL.RETURN_RESULT: a ub4 count, then per result a
5490 * length-prefixed opaque blob, the describe of its columns,
5491 * and the ub2 cursor id the client fetches it with. */
5492 int num = 0, start;
5493
5494 if ( is_request )
5495 break;
5496
5497 start = offset;
5498 offset += get_sb4_custom(tvb, offset, &num);
5499 proto_tree_add_uint(data_tree, hf_tns_data_irs_num_results, tvb, start, offset - start, num);
5500 for ( int i = 0; i < num && tvb_reported_length_remaining(tvb, offset) > 0; i++ )
5501 {
5502 proto_tree *rs_tree;
5503 proto_item *rs_item;
5504 int rs_start = offset, cursor = 0;
5505
5506 rs_tree = proto_tree_add_subtree_format(data_tree, tvb, offset, -1,
5507 ett_tns_irs, &rs_item, "Result Set %d", i + 1);
5508 offset += 1 + tvb_get_uint8(tvb, offset);
5509 offset = dissect_tns_describe_body(tvb, pinfo, rs_tree, offset, NULL((void*)0));
5510 start = offset;
5511 offset += get_sb4_custom(tvb, offset, &cursor);
5512 proto_tree_add_uint(rs_tree, hf_tns_cursor, tvb, start, offset - start, cursor);
5513 proto_item_append_text(rs_item, ": cursor %d", cursor);
5514 proto_item_set_len(rs_item, offset - rs_start);
5515 }
5516 ctx->walk = true1;
5517 break;
5518 }
5519
5520 case SQLNET_TOKEN33:
5521 {
5522 /* the token of the call this answers */
5523 uint64_t token = 0;
5524 int start = offset;
5525
5526 if ( is_request )
5527 break;
5528 offset += get_ub8_custom(tvb, offset, &token);
5529 proto_tree_add_uint64(data_tree, hf_tns_data_token, tvb, start, offset - start, token);
5530 ctx->walk = true1;
5531 break;
5532 }
5533
5534 case SQLNET_FLUSH_BIND_DATA19:
5535 /* Sent when a DML with a RETURNING clause fails: the client
5536 * drops the out-bind data it was collecting. There is no
5537 * body, and the error follows. */
5538 if ( !is_request )
5539 ctx->walk = true1;
5540 break;
5541
5542 case SQLNET_END_OF_RESPONSE29:
5543 /* Marks the end of a response for a client that negotiated
5544 * it; there is no body. */
5545 ctx->walk = true1;
5546 break;
5547
5548 case SQLNET_IOVEC_4FAST_UPI11:
5549 {
5550 /* TTI_IOV: the server's I/O vector for an executed anonymous
5551 * PL/SQL block that carried bind variables. It lists each
5552 * bind's direction (IN / OUT / IN OUT); when any bind is
5553 * OUT / IN OUT the returned values follow as a TTI_RXD row.
5554 * Layout cross-referenced with python-oracledb's
5555 * _process_io_vector, and
5556 * verified against XE 11g.
5557 *
5558 * All the leading counters are stored in the ub4 variable-
5559 * length form (see get_sb4_custom). The per-bind directions
5560 * are one raw byte each. The trailing RXD values need each
5561 * bind's declared type to decode, so they are read only when
5562 * the execute this answers was seen. */
5563 int num_requests = 0, num_iters = 0, v = 0, bv_len = 0, rid_len = 0;
5564
5565 if ( !is_request )
5566 {
5567 /* flag (ub1, skip) */
5568 offset += 1;
5569 offset += get_sb4_custom(tvb, offset, &num_requests);
5570 offset += get_sb4_custom(tvb, offset, &num_iters);
5571 int num_binds = num_iters * 256 + num_requests;
5572 proto_tree_add_uint(data_tree, hf_tns_data_iov_num_binds, tvb, offset, 0, num_binds);
5573 /* num iters this time (skip) */
5574 offset += get_sb4_custom(tvb, offset, &v);
5575 /* uac buffer length (skip) */
5576 offset += get_sb4_custom(tvb, offset, &v);
5577 /* fast-fetch bit-vector: length + bytes (skip) */
5578 offset += get_sb4_custom(tvb, offset, &bv_len);
5579 if ( bv_len > 0 )
5580 offset += bv_len;
5581 /* rowid: length + bytes (skip) */
5582 offset += get_sb4_custom(tvb, offset, &rid_len);
5583 if ( rid_len > 0 )
5584 offset += rid_len;
5585
5586 /* Per-bind direction bytes, in bind order. Bound by both
5587 * the reported count and the bytes actually present so a
5588 * malformed vector cannot run away. */
5589 proto_tree *iov_tree;
5590 proto_item *iov_item;
5591 int iov_start = offset;
5592 iov_tree = proto_tree_add_subtree(data_tree, tvb, offset, -1, ett_tns_iov, &iov_item, "Bind Directions");
5593 for ( int i = 0; i < num_binds && tvb_reported_length_remaining(tvb, offset) > 0; i++ )
5594 {
5595 proto_tree_add_item(iov_tree, hf_tns_data_iov_bind_dir, tvb, offset, 1, ENC_BIG_ENDIAN0x00000000);
5596 offset += 1;
5597 }
5598 proto_item_set_len(iov_item, offset - iov_start);
5599
5600 /* The OUT and IN OUT values follow as a TTI_RXD, typed by
5601 * the binds of the execute this answers - readable only
5602 * when that execute was seen and bound as many. */
5603 const tns_call_t *call = tns_answered_call(pinfo);
5604 if ( call && call->binds && call->num_binds == (uint32_t)num_binds
5605 && offset - iov_start == num_binds )
5606 {
5607 ctx->out_call = call;
5608 ctx->bind_dirs = tvb_memdup(pinfo->pool, tvb, iov_start, num_binds);
5609 ctx->walk = true1;
5610 /* Only this reply says which of a block's binds are
5611 * OUT; its re-executes need to know. */
5612 if ( !PINFO_FD_VISITED(pinfo)((pinfo)->fd->visited) && call->bind_rec && call->bind_rec->plsql )
5613 call->bind_rec->dirs = (uint8_t *)tvb_memdup(wmem_file_scope(), tvb, iov_start, num_binds);
5614 }
5615 }
5616 break;
5617 }
5618
5619 case SQLNET_DESCRIBE_INFO16:
5620 {
5621 /* TTI_DCB: describe (column metadata) for a SELECT result set,
5622 * in the Oracle 11g shape: a preamble, then the describe body.
5623 * The columns are remembered, once, so a later TTI_RXD can
5624 * split its row values. */
5625 tns_describe_t *desc = NULL((void*)0);
5626
5627 if ( is_request )
5628 break;
5629
5630 /* describe-info preamble (chunked bytes: cursor uuid + date) */
5631 offset += get_dalc_custom(tvb, pinfo, offset, NULL((void*)0));
5632 offset = dissect_tns_describe_body(tvb, pinfo, data_tree, offset,
5633 PINFO_FD_VISITED(pinfo)((pinfo)->fd->visited) ? NULL((void*)0) : &desc);
5634 if ( desc )
5635 tns_get_conv_info(pinfo)->last_describe = desc;
5636 ctx->walk = true1;
5637 break;
5638 }
5639
5640 case SQLNET_ROW_TRANSF_HDR6:
5641 {
5642 /* TTI_RXH: row transfer header, precedes the row data in a
5643 * SELECT response. All numeric fields use the ub4 variable-
5644 * length form. Layout cross-referenced with
5645 * python-oracledb's _process_row_header. */
5646 int v = 0, bv_len = 0, start;
5647
5648 if ( is_request )
5649 break;
5650
5651 /* flag (ub1, skip) */
5652 offset += 1;
5653 /* number of requests */
5654 start = offset;
5655 offset += get_sb4_custom(tvb, offset, &v);
5656 proto_tree_add_uint(data_tree, hf_tns_data_rxh_num_requests, tvb, start, offset - start, v);
5657 /* iteration number */
5658 start = offset;
5659 offset += get_sb4_custom(tvb, offset, &v);
5660 proto_tree_add_uint(data_tree, hf_tns_data_rxh_iter_num, tvb, start, offset - start, v);
5661 /* number of iterations */
5662 start = offset;
5663 offset += get_sb4_custom(tvb, offset, &v);
5664 proto_tree_add_uint(data_tree, hf_tns_data_rxh_num_iters, tvb, start, offset - start, v);
5665 /* buffer length (ub4, skip) */
5666 offset += get_sb4_custom(tvb, offset, &v);
5667 /* bit vector: length + [repeated length byte + vector bytes],
5668 * saying which columns the first row sends */
5669 offset += get_sb4_custom(tvb, offset, &bv_len);
5670 if ( bv_len > 0 )
5671 {
5672 offset += 1; /* repeated length byte */
5673 proto_tree_add_item(data_tree, hf_tns_data_bit_vector, tvb, offset, bv_len, ENC_NA0x00000000);
5674 ctx->bit_vector = tvb_memdup(pinfo->pool, tvb, offset, bv_len);
5675 ctx->bit_vector_len = bv_len;
5676 offset += bv_len; /* bit vector */
5677 }
5678 /* rxhrid (bytes_with_length, skip) */
5679 offset += get_field_with_length(tvb, pinfo, offset, NULL((void*)0));
5680 ctx->walk = true1;
5681 break;
5682 }
5683
5684 case SQLNET_BIT_VECTOR21:
5685 {
5686 /* TTI_BVC: which columns the next row sends. A row that
5687 * repeats values from the row before sends only the ones that
5688 * changed, and the clear bits name those it left out. A ub2
5689 * count of columns sent, then one bit per described column. */
5690 tns_describe_t *desc;
5691 int v = 0, start;
5692
5693 if ( is_request )
5694 break;
5695
5696 start = offset;
5697 offset += get_sb4_custom(tvb, offset, &v);
5698 proto_tree_add_uint(data_tree, hf_tns_data_bvc_num_cols_sent, tvb, start, offset - start, v);
5699 desc = tns_current_describe(pinfo);
5700 if ( !desc )
5701 break;
5702 unsigned bv_len = (desc->num_cols + 7) / 8;
5703 proto_tree_add_item(data_tree, hf_tns_data_bit_vector, tvb, offset, bv_len, ENC_NA0x00000000);
5704 ctx->bit_vector = tvb_memdup(pinfo->pool, tvb, offset, bv_len);
5705 ctx->bit_vector_len = bv_len;
5706 offset += bv_len;
5707 ctx->walk = true1;
5708 break;
5709 }
5710
5711 case SQLNET_ROW_TRANSF_DATA7:
5712 {
5713 /* TTI_RXD: row data for a SELECT result set — typically a
5714 * TTI_FETCH continuation, where the describe (TTI_DCB) arrived
5715 * in an earlier packet. Split each row into columns using the
5716 * types remembered from that describe (threaded through
5717 * conversation state); ordinary values are shown raw.
5718 *
5719 * The leading RXD token was already consumed above, so offset
5720 * sits on the first row's first value. A row that follows a
5721 * bit vector sends only the columns whose bit is set. */
5722 tns_describe_t *desc;
5723
5724 if ( is_request )
5725 break;
5726
5727 if ( !ctx->bind_dirs )
5728 {
5729 /* A PL/SQL block's re-execute is answered with no IOV:
5730 * each iteration's OUT values come as a TTI_RXD of their
5731 * own, read by the directions its first execute got. */
5732 const tns_call_t *rc = tns_answered_call(pinfo);
5733 if ( rc && (rc->func == TTI_REEXECUTE4 || rc->func == TTI_REEXECUTE_AND_FETCH78)
5734 && rc->binds && rc->bind_rec && rc->bind_rec->plsql && rc->bind_rec->dirs )
5735 {
5736 ctx->out_call = rc;
5737 ctx->bind_dirs = rc->bind_rec->dirs;
5738 }
5739 }
5740
5741 if ( ctx->bind_dirs )
5742 {
5743 /* The OUT and IN OUT bind values of a PL/SQL execute, in
5744 * bind order, each followed by its sb4 return code. Out of
5745 * a fetch, ROWID and UROWID come as strings and a LONG has
5746 * no trailing indicators. */
5747 proto_tree *ob_tree;
5748 proto_item *ob_item;
5749 int ob_start = offset;
5750
5751 ob_tree = proto_tree_add_subtree(data_tree, tvb, offset, -1,
5752 ett_tns_out_binds, &ob_item, "Out Binds");
5753 for ( uint32_t i = 0; i < ctx->out_call->num_binds
5754 && tvb_reported_length_remaining(tvb, offset) > 0; i++ )
5755 {
5756 if ( ctx->bind_dirs[i] == TNS_BIND_DIR_INPUT32 )
5757 continue;
5758 offset = dissect_tns_bind_value(tvb, pinfo, ob_tree, offset,
5759 &ctx->out_call->binds[i], i + 1, true1);
5760 }
5761 proto_item_set_len(ob_item, offset - ob_start);
5762 ctx->bind_dirs = NULL((void*)0);
5763 ctx->walk = true1;
5764 break;
5765 }
5766
5767 const tns_call_t *rcall = tns_answered_call(pinfo);
5768 if ( rcall && rcall->num_return > 0 && rcall->binds )
5769 {
5770 /* The values a DML RETURNING ... INTO returned: for each
5771 * return bind a ub4 row count - every row the statement
5772 * touched - then that many values, each followed by its
5773 * sb4 actual length. */
5774 proto_tree *rv_tree;
5775 proto_item *rv_item;
5776 int rv_start = offset, start;
5777
5778 rv_tree = proto_tree_add_subtree(data_tree, tvb, offset, -1,
5779 ett_tns_out_binds, &rv_item, "Returned Values");
5780 for ( uint32_t i = rcall->num_binds - rcall->num_return; i < rcall->num_binds
5781 && tvb_reported_length_remaining(tvb, offset) > 0; i++ )
5782 {
5783 int rows = 0;
5784 offset += get_sb4_custom(tvb, offset, &rows);
5785 for ( int j = 0; j < rows && tvb_reported_length_remaining(tvb, offset) > 0; j++ )
5786 {
5787 start = offset;
5788 offset = dissect_tns_value(tvb, pinfo, rv_tree, offset, rcall->binds[i].type,
5789 rcall->binds[i].csform, TNS_VALUE_OUT, i + 1, hf_tns_data_bind_value, "Bind");
5790 offset = dissect_tns_actual_length(tvb, pinfo, rv_tree, offset, start,
5791 rcall->binds[i].type);
5792 }
5793 }
5794 proto_item_set_len(rv_item, offset - rv_start);
5795 ctx->walk = true1;
5796 break;
5797 }
5798
5799 desc = tns_current_describe(pinfo);
5800
5801 if ( desc && desc->num_cols > 0 )
5802 {
5803 int rownum = 0, first_row = 1;
5804 while ( tvb_reported_length_remaining(tvb, offset) > 0 )
5805 {
5806 proto_tree *row_tree;
5807 proto_item *row_item;
5808 int r_start;
5809
5810 if ( !first_row )
5811 {
5812 if ( tvb_get_uint8(tvb, offset) != SQLNET_ROW_TRANSF_DATA7 )
5813 break;
5814 offset += 1; /* RXD token for subsequent rows */
5815 }
5816 first_row = 0;
5817
5818 r_start = offset;
5819 row_tree = proto_tree_add_subtree_format(data_tree, tvb, offset, -1,
5820 ett_tns_rxd_row, &row_item, "Row %d", ++rownum);
5821 for ( uint32_t c = 0; c < desc->num_cols
5822 && tvb_reported_length_remaining(tvb, offset) > 0; c++ )
5823 {
5824 const tns_column_t *col = &desc->cols[c];
5825 if ( ctx->bit_vector && c / 8 < ctx->bit_vector_len
5826 && !(ctx->bit_vector[c / 8] & (1 << (c % 8))) )
5827 {
5828 proto_tree_add_bytes_format(row_tree, hf_tns_data_col_value,
5829 tvb, offset, 0, NULL((void*)0), "Column %u (%s): same as previous row",
5830 c + 1, val_to_str_const(col->type, tns_data_types, "unknown"));
5831 continue;
5832 }
5833 /* A column the describe gives no data length is
5834 * NULL by definition (SELECT NULL, SELECT '')
5835 * and sends no bytes at all - not even an empty
5836 * DALC. LONG, LONG RAW and UROWID are the
5837 * exceptions: they always carry their value. */
5838 if ( col->data_len == 0 && col->type != TNS_DATATYPE_LONG8
5839 && col->type != TNS_DATATYPE_LONG_RAW24
5840 && col->type != TNS_DATATYPE_UROWID208 )
5841 {
5842 proto_tree_add_bytes_format(row_tree, hf_tns_data_col_value,
5843 tvb, offset, 0, NULL((void*)0), "Column %u (%s): NULL (no data length)",
5844 c + 1, val_to_str_const(col->type, tns_data_types, "unknown"));
5845 continue;
5846 }
5847 offset = dissect_tns_value(tvb, pinfo, row_tree, offset,
5848 col->type, col->csform, TNS_VALUE_FETCH, c + 1, hf_tns_data_col_value, "Column");
5849 }
5850 proto_item_set_len(row_item, offset - r_start);
5851 /* A bit vector covers one row only. */
5852 ctx->bit_vector = NULL((void*)0);
5853 }
5854 ctx->walk = true1;
5855 }
5856 break;
5857 }
5858
5859 case SQLNET_USER_OCI_FUNC3:
5860 {
5861 guint32 oci_id = 0;
5862 tns_call_t *call;
5863 int fun_start = offset - 1; /* the TTI_FUN byte */
5864 proto_tree_add_item_ret_uint(data_tree, hf_tns_data_oci_id, tvb, offset, 1, ENC_BIG_ENDIAN0x00000000, &oci_id);
5865 offset += 1;
5866 call = is_request ? tns_remember_call(pinfo, (uint8_t)oci_id) : NULL((void*)0);
5867 /* Name the specific OCI call in the Info column — otherwise every
5868 * function call reads only as the generic "User OCI Functions". */
5869 col_append_fstr(pinfo->cinfo, COL_INFO, " (%s)",
5870 val_to_str_ext_const(oci_id, &tns_data_oci_subfuncs_ext, "unknown"));
5871 proto_tree_add_item(data_tree, hf_tns_data_tseq, tvb, offset, 1, ENC_BIG_ENDIAN0x00000000);
5872 offset += 1;
5873 if ( !ctx->no_token )
5874 offset = dissect_tns_call_token(tvb, pinfo, data_tree, offset);
5875 if((oci_id == 115) || (oci_id == 118)){
5876 /* The two authentication calls: the session key request
5877 * (118) and the authentication itself (115). A pointer
5878 * and a ub4 user name length, the ub4 mode, a pointer, the
5879 * ub4 number of key/value pairs, two pointers, the user
5880 * name, and the pairs - each a key and a value with two
5881 * lengths and a ub4 flags word. The first call's pairs
5882 * carry the client's identity (program, machine, terminal,
5883 * process id, OS user), which is what the server records
5884 * for the session; the second's the proof, the driver name
5885 * and the session settings. */
5886 int user_len = 0, mode = 0, num = 0, start;
5887 proto_tree_add_item(data_tree, hf_tns_data_unused, tvb, offset, 1, ENC_NA0x00000000);
5888 offset += 1;
5889 offset += get_sb4_custom(tvb, offset, &user_len);
5890 start = offset;
5891 offset += get_sb4_custom(tvb, offset, &mode);
5892 proto_tree_add_bitmask_value(data_tree, tvb, start, hf_tns_data_auth_mode,
5893 ett_tns_auth_mode, tns_auth_modes, (uint64_t)(uint32_t)mode);
5894 offset += 1; /* pointer */
5895 start = offset;
5896 offset += get_sb4_custom(tvb, offset, &num);
5897 proto_tree_add_uint(data_tree, hf_tns_data_opi_num_of_params, tvb, start, offset - start, num);
5898 offset += 2; /* pointers */
5899 if ( user_len > 0 )
5900 {
5901 const char *user = NULL((void*)0);
5902 start = offset;
5903 offset += get_dalc_custom(tvb, pinfo, offset, &user);
5904 if ( user )
5905 {
5906 proto_tree_add_string(data_tree, hf_tns_data_auth_user, tvb, start, offset - start, user);
5907 col_append_fstr(pinfo->cinfo, COL_INFO, " [%s]", user);
5908 }
5909 }
5910 for ( int i = 0; i < num && tvb_reported_length_remaining(tvb, offset) > 0; i++ )
5911 {
5912 proto_tree *par_tree;
5913 proto_item *par_ti;
5914 const char *key = NULL((void*)0), *value = NULL((void*)0);
5915 int v = 0, par_start = offset;
5916
5917 par_tree = proto_tree_add_subtree_format(data_tree, tvb, offset, -1,
5918 ett_tns_opi_par, &par_ti, "Parameter %d", i + 1);
5919 start = offset;
5920 offset += get_field_with_length(tvb, pinfo, offset, &key);
5921 if ( key )
5922 proto_tree_add_string(par_tree, hf_tns_data_opi_param_name, tvb, start, offset - start, key);
5923 start = offset;
5924 offset += get_field_with_length(tvb, pinfo, offset, &value);
5925 if ( value )
5926 proto_tree_add_string(par_tree, hf_tns_data_opi_param_value, tvb, start, offset - start, value);
5927 offset += get_sb4_custom(tvb, offset, &v); /* flags */
5928 if ( key )
5929 proto_item_append_text(par_ti, ": %s = %s", key, value ? value : "");
5930 proto_item_set_len(par_ti, offset - par_start);
5931 }
5932 }
5933 else if ( oci_id == TTI_KOD92 && tvb_bytes_exist(tvb, fun_start + TNS_KOD_FRAME99, 4) )
5934 {
5935 /* An object-type describe, sent only by an OCI client: a
5936 * ub4 LE opcode and a frame of zeros, then by name a ub4
5937 * 2, the schema's length, a ub4 0, the name buffer's
5938 * length (three times the name's characters) and the
5939 * name behind a length byte; by REF the REF of the type
5940 * wanted. The bytes after them are not understood. */
5941 uint32_t opcode;
5942 int o = fun_start + TNS_KOD_FRAME99, sys_type;
5943
5944 if ( !PINFO_FD_VISITED(pinfo)((pinfo)->fd->visited) )
5945 tns_get_conv_info(pinfo)->oci_dialect = true1;
5946 proto_tree_add_item_ret_uint(data_tree, hf_tns_data_kod_opcode, tvb, fun_start + 3, 4, ENC_LITTLE_ENDIAN0x80000000, &opcode);
5947 if ( opcode == TNS_KOD_BY_NAME3 && tvb_bytes_exist(tvb, o, 17) && tvb_get_letohl(tvb, o + 4) == 0 )
5948 {
5949 const char *name;
5950 uint8_t len = tvb_get_uint8(tvb, o + 16);
5951 proto_tree_add_item_ret_string(data_tree, hf_tns_data_kod_name, tvb, o + 17, len, ENC_UTF_80x00000002, pinfo->pool, (const uint8_t **)&name);
5952 col_append_fstr(pinfo->cinfo, COL_INFO, " [%s]", name);
5953 }
5954 else if ( opcode == TNS_KOD_BY_REF4 )
5955 dissect_tns_kod_ref(tvb, data_tree, o, hf_tns_data_kod_oid, &sys_type);
5956 offset = tvb_reported_length(tvb);
5957 }
5958 else if ( oci_id == TTI_FETCH5 && tns_is_oci(pinfo) && tvb_bytes_exist(tvb, fun_start + 3, 8) )
5959 {
5960 /* An OCI client's fetch: the cursor id and the row count
5961 * as fixed-width little-endian ub4s, right after the
5962 * sequence number. The count is a hard limit - the
5963 * client sizes its fetch buffer to it. */
5964 proto_tree_add_item(data_tree, hf_tns_cursor, tvb, fun_start + 3, 4, ENC_LITTLE_ENDIAN0x80000000);
5965 proto_tree_add_item(data_tree, hf_tns_data_fetch_rows, tvb, fun_start + 7, 4, ENC_LITTLE_ENDIAN0x80000000);
5966 offset = fun_start + 11;
5967 }
5968 else if ( oci_id == TTI_FETCH5 )
5969 {
5970 /* TTI_FETCH: fetch more rows from an open cursor.
5971 * [TTI_FUN, TTI_FETCH, seq] then cursor id and the row
5972 * count, both ub4. */
5973 int v = 0, start;
5974
5975 start = offset;
5976 offset += get_sb4_custom(tvb, offset, &v);
5977 proto_tree_add_uint(data_tree, hf_tns_cursor, tvb, start, offset - start, v);
5978 start = offset;
5979 offset += get_sb4_custom(tvb, offset, &v);
5980 proto_tree_add_uint(data_tree, hf_tns_data_fetch_rows, tvb, start, offset - start, v);
5981 }
5982 else if ( oci_id == TTI_PIPELINE_END200 )
5983 {
5984 /* ends a pipeline begun by the pipeline-begin piggyback: a
5985 * ub4 id, unused */
5986 int v = 0;
5987 offset += get_sb4_custom(tvb, offset, &v);
5988 }
5989 else if ( oci_id == TTI_SESSION_RELEASE163 )
5990 {
5991 /* DRCP: hand the session back to the pool - a tag name
5992 * (a pointer and a length byte) and the release mode */
5993 int v = 0, start;
5994 uint8_t tag_ptr = tvb_get_uint8(tvb, offset);
5995 uint8_t tag_len = tvb_get_uint8(tvb, offset + 1);
5996 offset += 2;
5997 if ( tag_ptr && tag_len > 0 )
5998 {
5999 proto_tree_add_item(data_tree, hf_tns_data_release_tag, tvb, offset, tag_len, ENC_UTF_80x00000002);
6000 offset += tag_len;
6001 }
6002 start = offset;
6003 offset += get_sb4_custom(tvb, offset, &v);
6004 proto_tree_add_bitmask_value(data_tree, tvb, start, hf_tns_data_release_mode,
6005 ett_tns_release_mode, tns_release_modes, (uint64_t)(uint32_t)v);
6006 }
6007 else if ( oci_id == TTI_AQ_ARRAY145 )
6008 offset = dissect_tns_aq_array_call(tvb, pinfo, data_tree, offset);
6009 else if ( oci_id == TTI_AQ_ENQUEUE121 || oci_id == TTI_AQ_DEQUEUE122 )
6010 offset = dissect_tns_aq_call(tvb, pinfo, data_tree, offset, oci_id);
6011 else if ( oci_id == TTI_TPC_TXN_SWITCH103 || oci_id == TTI_TPC_TXN_CHANGE_STATE104 )
6012 offset = dissect_tns_tpc_call(tvb, pinfo, data_tree, offset, oci_id);
6013 else if ( oci_id == TTI_REEXECUTE4 || oci_id == TTI_REEXECUTE_AND_FETCH78 )
6014 {
6015 /* Re-execute of a cursor whose statement already ran and
6016 * whose bind types did not change: the cursor id, the
6017 * iteration count (the prefetch size for 78, the number
6018 * of executions for 4) and two options words, then one
6019 * TTI_RXD row of values per iteration with no bind
6020 * descriptors - the values are typed by the execute that
6021 * opened the cursor. */
6022 int v = 0, cursor = 0, start;
6023
6024 start = offset;
6025 offset += get_sb4_custom(tvb, offset, &cursor);
6026 proto_tree_add_uint(data_tree, hf_tns_cursor, tvb, start, offset - start, cursor);
6027 start = offset;
6028 offset += get_sb4_custom(tvb, offset, &v);
6029 proto_tree_add_uint(data_tree, oci_id == TTI_REEXECUTE_AND_FETCH78 ?
6030 hf_tns_data_all8_prefetch : hf_tns_data_reexec_iterations,
6031 tvb, start, offset - start, v);
6032 start = offset;
6033 offset += get_sb4_custom(tvb, offset, &v);
6034 proto_tree_add_bitmask_value(data_tree, tvb, start, hf_tns_data_all8_options,
6035 ett_tns_all8_options, tns_all8_options, (uint64_t)(uint32_t)v);
6036 start = offset;
6037 offset += get_sb4_custom(tvb, offset, &v);
6038 proto_tree_add_bitmask_value(data_tree, tvb, start, hf_tns_data_reexec_options2,
6039 ett_tns_reexec_options2, tns_reexec_options2, (uint64_t)(uint32_t)v);
6040
6041 tns_binds_t *binds = tns_lookup_cursor_binds(pinfo, cursor);
6042 if ( binds && tvb_reported_length_remaining(tvb, offset) > 0 )
6043 {
6044 proto_item *binds_item;
6045 proto_tree *binds_tree;
6046 int binds_start = offset;
6047
6048 binds_tree = proto_tree_add_subtree(data_tree, tvb, offset, -1,
6049 ett_tns_binds, &binds_item, "Binds");
6050 /* RETURNING ... INTO binds send no value, nor does a
6051 * block's OUT bind */
6052 offset = dissect_tns_bind_rows(tvb, pinfo, binds_tree, offset, binds->cols,
6053 binds->count - binds->num_return, binds->plsql,
6054 binds->plsql ? binds->dirs : NULL((void*)0));
6055 proto_item_set_len(binds_item, offset - binds_start);
6056 }
6057 if ( call && binds )
6058 {
6059 call->num_binds = binds->count;
6060 call->num_return = binds->num_return;
6061 call->binds = binds->cols;
6062 call->bind_rec = binds;
6063 }
6064 }
6065 else if ( oci_id == TTI_ALL894 && tvb_bytes_exist(tvb, fun_start + TNS_OCI_ALL8_IND11, 8)
6066 && tvb_get_ntoh64(tvb, fun_start + TNS_OCI_ALL8_IND11) == TNS_OCI_INDICATOR0xfeffffffffffffffUL )
6067 {
6068 /* An OCI client's execute (sqlplus and other thick
6069 * clients): a fixed preamble of 8-byte pointer indicators
6070 * FE FF FF FF FF FF FF FF with little-endian scalar slots
6071 * between them, and the ub1-length-prefixed SQL at the
6072 * end. Offsets count from the TTI_FUN byte. The scalar
6073 * slots are 8 bytes wide or 4, fixed for a connection;
6074 * the second indicator tells which - it sits at 27 in the
6075 * wide form and 23 in the narrow one, and the two cannot
6076 * both hold. The cursor id and SQL length precede every
6077 * slot and do not move; the bind count and the SQL do.
6078 * A session at the 12c band inserts 64 zero bytes ahead
6079 * of a narrow preamble's SQL, which moves from 176 to
6080 * 240; the byte before the SQL is its length, never
6081 * zero, so which one holds shows. */
6082 int base = fun_start, bind_count_off, sql_off;
6083 uint32_t cursor, sql_len_decl, bind_count;
6084 bool_Bool wide, band_12c = false0;
6085
6086 if ( tvb_bytes_exist(tvb, base + TNS_OCI_ALL8_IND2_WIDE27, 8)
6087 && tvb_get_ntoh64(tvb, base + TNS_OCI_ALL8_IND2_WIDE27) == TNS_OCI_INDICATOR0xfeffffffffffffffUL )
6088 wide = true1;
6089 else if ( tvb_bytes_exist(tvb, base + TNS_OCI_ALL8_IND2_NARROW23, 8)
6090 && tvb_get_ntoh64(tvb, base + TNS_OCI_ALL8_IND2_NARROW23) == TNS_OCI_INDICATOR0xfeffffffffffffffUL )
6091 wide = false0;
6092 else
6093 break;
6094 if ( !PINFO_FD_VISITED(pinfo)((pinfo)->fd->visited) )
6095 tns_get_conv_info(pinfo)->oci_dialect = true1;
6096
6097 cursor = tvb_get_letohl(tvb, base + TNS_OCI_ALL8_CURSOR7);
6098 /* the SQL length, as the client's character set has it */
6099 sql_len_decl = tvb_get_letohl(tvb, base + TNS_OCI_ALL8_SQLLEN319);
6100 bind_count_off = base + (wide ? 83 : 71);
6101 sql_off = base + (wide ? 196 : 176);
6102 if ( !wide && sql_len_decl > 0 && tvb_bytes_exist(tvb, base + 239, 1)
6103 && tvb_get_uint8(tvb, base + 175) == 0 )
6104 {
6105 uint8_t prefix = tvb_get_uint8(tvb, base + 239);
6106 if ( tns_oci_sql_length_matches(prefix, sql_len_decl) )
6107 {
6108 band_12c = true1;
6109 sql_off = base + 240;
6110 if ( !PINFO_FD_VISITED(pinfo)((pinfo)->fd->visited) )
6111 tns_get_conv_info(pinfo)->oci_band_12c = true1;
6112 }
6113 }
6114 proto_tree_add_string(data_tree, hf_tns_data_all8_oci_preamble, tvb, base, 0,
6115 wide ? "OCI, wide (8-byte slots)" : band_12c ? "OCI, narrow (4-byte slots), 12c band"
6116 : "OCI, narrow (4-byte slots)");
6117 proto_tree_add_uint(data_tree, hf_tns_cursor, tvb, base + TNS_OCI_ALL8_CURSOR7, 4, cursor);
6118 bind_count = tvb_get_letohl(tvb, bind_count_off);
6119 proto_tree_add_uint(data_tree, hf_tns_data_all8_bind_count, tvb, bind_count_off, 4, bind_count);
6120 if ( sql_len_decl > 0 && tvb_bytes_exist(tvb, sql_off - 1, 1) )
6121 {
6122 const char *sql = NULL((void*)0);
6123 int start = sql_off - 1;
6124 uint8_t prefix = tvb_get_uint8(tvb, start);
6125
6126 if ( tns_oci_sql_length_matches(prefix, sql_len_decl) )
6127 {
6128 offset = start + get_dalc_custom(tvb, pinfo, start, &sql);
6129 if ( sql )
6130 {
6131 /* sqlplus NUL-terminates its own queries; the
6132 * string ends there */
6133 proto_tree_add_string(data_tree, hf_tns_data_all8_sql, tvb, start, offset - start, sql);
6134 col_append_fstr(pinfo->cinfo, COL_INFO, " [%s]", sql);
6135 }
6136 }
6137 }
6138 }
6139 else if ( oci_id == TTI_ALL894 )
6140 {
6141 /* TTI_ALL8: the generic SQL execute — SELECT, DML and
6142 * PL/SQL all ride this call, in the Oracle 11g shape of a
6143 * thin client, whose integers use the ub4 variable-length
6144 * form. The bind (or define) descriptors and the value
6145 * rows follow the al8 array. */
6146 int v = 0, options = 0, cursor = 0, query_len = 0, all8_len = 0;
6147 int fetch = 0, bind_count = 0, define_count = 0, start;
6148 const uint8_t *sql = NULL((void*)0);
6149 uint8_t query_flag;
6150
6151 /* options (ub4) + flag breakdown */
6152 start = offset;
6153 offset += get_sb4_custom(tvb, offset, &options);
6154 proto_tree_add_bitmask_value(data_tree, tvb, start, hf_tns_data_all8_options,
6155 ett_tns_all8_options, tns_all8_options, (uint64_t)(uint32_t)options);
6156 /* An execute that asks for no work is a parse: the client
6157 * wants the statement checked, not run. The PARSE bit does
6158 * not say so - it rides along with EXECUTE on the first
6159 * execute of any statement, and a parse of a statement the
6160 * client already has cached sets no bit at all. */
6161 if ( !(options & (TNS_EXEC_OPTION_EXECUTE0x0020 | TNS_EXEC_OPTION_DEFINE0x0010
6162 | TNS_EXEC_OPTION_FETCH0x0040)) )
6163 {
6164 proto_item_set_generated(proto_tree_add_boolean(data_tree,
6165 hf_tns_data_all8_parse_only, tvb, start, offset - start, true1));
6166 col_append_str(pinfo->cinfo, COL_INFO, " [parse only]");
6167 }
6168 /* cursor id (ub4) */
6169 start = offset;
6170 offset += get_sb4_custom(tvb, offset, &cursor);
6171 proto_tree_add_uint(data_tree, hf_tns_cursor, tvb, start, offset - start, cursor);
6172 /* query present flag (ub1) */
6173 query_flag = tvb_get_uint8(tvb, offset);
6174 offset += 1;
6175 /* query length (ub4) */
6176 offset += get_sb4_custom(tvb, offset, &query_len);
6177 /* all8 present flag (ub1) */
6178 offset += 1;
6179 /* all8 length (ub4) */
6180 offset += get_sb4_custom(tvb, offset, &all8_len);
6181 /* two reserved bytes */
6182 offset += 2;
6183 /* long max value (ub4, skip) */
6184 offset += get_sb4_custom(tvb, offset, &v);
6185 /* fetch rows (ub4) */
6186 start = offset;
6187 offset += get_sb4_custom(tvb, offset, &fetch);
6188 proto_tree_add_uint(data_tree, hf_tns_data_all8_fetch_rows, tvb, start, offset - start, fetch);
6189 /* max value (ub4, skip) */
6190 offset += get_sb4_custom(tvb, offset, &v);
6191 /* bind indicator (ub1) */
6192 offset += 1;
6193 /* bind count (ub4) */
6194 start = offset;
6195 offset += get_sb4_custom(tvb, offset, &bind_count);
6196 proto_tree_add_uint(data_tree, hf_tns_data_all8_bind_count, tvb, start, offset - start, bind_count);
6197 /* The count comes off the wire and sizes an allocation
6198 * further down, so a count larger than the data left
6199 * cannot be real - report it and decode no binds. */
6200 if ( bind_count < 0 ||
6201 (unsigned)bind_count > tvb_reported_length_remaining(tvb, offset) )
6202 {
6203 proto_tree_add_expert(data_tree, pinfo, &ei_tns_data_count_too_large,
6204 tvb, start, offset - start);
6205 bind_count = 0;
6206 }
6207 /* five reserved bytes */
6208 offset += 5;
6209 /* define-columns present flag (ub1) */
6210 offset += 1;
6211 /* define-columns count (ub4) */
6212 start = offset;
6213 offset += get_sb4_custom(tvb, offset, &define_count);
6214 proto_tree_add_uint(data_tree, hf_tns_data_all8_define_count, tvb, start, offset - start, define_count);
6215 if ( define_count < 0 ||
6216 (unsigned)define_count > tvb_reported_length_remaining(tvb, offset) )
6217 {
6218 proto_tree_add_expert(data_tree, pinfo, &ei_tns_data_count_too_large,
6219 tvb, start, offset - start);
6220 define_count = 0;
6221 }
6222 /* registration id (low half), the al8objlist / al8objlen /
6223 * al8blv pointers, al8blvl, the al8dnam pointer, al8dnaml
6224 * and the registration id's high half */
6225 offset += get_sb4_custom(tvb, offset, &v);
6226 offset += 3;
6227 offset += get_sb4_custom(tvb, offset, &v);
6228 offset += 1;
6229 offset += get_sb4_custom(tvb, offset, &v);
6230 offset += get_sb4_custom(tvb, offset, &v);
6231 /* 12.1 adds the per-row DML count block (a pointer, the
6232 * execution count, a pointer), 12.2 the SQL signature and
6233 * SQL id fields, 12.2 ext 1 the chunk ids */
6234 unsigned fv = tns_field_version(pinfo);
6235 if ( fv >= TNS_FV_12_17 )
6236 {
6237 offset += 1;
6238 offset += get_sb4_custom(tvb, offset, &v);
6239 offset += 1;
6240 }
6241 if ( fv >= TNS_FV_12_28 )
6242 {
6243 offset += 1;
6244 offset += get_sb4_custom(tvb, offset, &v);
6245 offset += 1;
6246 offset += get_sb4_custom(tvb, offset, &v);
6247 offset += 1;
6248 }
6249 if ( fv >= TNS_FV_12_2_EXT19 )
6250 {
6251 offset += 1;
6252 offset += get_sb4_custom(tvb, offset, &v);
6253 }
6254 /* SQL text: a flat run of query_len bytes on 11g, length
6255 * prefixed (and chunked when long) from 12.1 */
6256 if ( query_flag && query_len > 0 && fv >= TNS_FV_12_17 )
6257 {
6258 const char *text = NULL((void*)0);
6259 start = offset;
6260 offset += get_dalc_custom(tvb, pinfo, offset, &text);
6261 if ( text )
6262 {
6263 sql = (const uint8_t *)text;
6264 proto_tree_add_string(data_tree, hf_tns_data_all8_sql, tvb, start, offset - start, text);
6265 col_append_fstr(pinfo->cinfo, COL_INFO, " [%s]", text);
6266 }
6267 }
6268 else if ( query_flag && query_len > 0 )
6269 {
6270 proto_tree_add_item_ret_string(data_tree, hf_tns_data_all8_sql, tvb,
6271 offset, query_len, ENC_UTF_80x00000002|ENC_NA0x00000000, pinfo->pool, &sql);
6272 col_append_fstr(pinfo->cinfo, COL_INFO, " [%s]", sql);
6273 offset += query_len;
6274 }
6275 /* al8i4 option array: all8_len ub4 elements. Slot 1 is
6276 * the execution count for DML but the number of rows to
6277 * prefetch for a query, and slot 7 says which - so read
6278 * the array before showing any of it. */
6279 {
6280 int al8i4[13] = {0}, al8i4_start[13] = {0}, al8i4_len[13] = {0};
6281 int i4_start = offset;
6282 proto_tree *i4_tree;
6283 proto_item *i4_item;
6284
6285 for ( int i = 0; i < all8_len && tvb_reported_length_remaining(tvb, offset) > 0; i++ )
6286 {
6287 start = offset;
6288 offset += get_sb4_custom(tvb, offset, &v);
6289 if ( i < (int)array_length(al8i4)(sizeof (al8i4) / sizeof (al8i4)[0]) )
6290 {
6291 al8i4[i] = v;
6292 al8i4_start[i] = start;
6293 al8i4_len[i] = offset - start;
6294 }
6295 }
6296 if ( all8_len >= (int)array_length(al8i4)(sizeof (al8i4) / sizeof (al8i4)[0]) )
6297 {
6298 i4_tree = proto_tree_add_subtree(data_tree, tvb, i4_start, offset - i4_start,
6299 ett_tns_all8_i4, &i4_item, "Execute Arguments (al8i4)");
6300 proto_tree_add_uint(i4_tree, al8i4[7] ? hf_tns_data_all8_prefetch : hf_tns_data_all8_iterations,
6301 tvb, al8i4_start[1], al8i4_len[1], al8i4[1]);
6302 proto_tree_add_boolean(i4_tree, hf_tns_data_all8_is_query,
6303 tvb, al8i4_start[7], al8i4_len[7], al8i4[7]);
6304 proto_tree_add_bitmask_value(i4_tree, tvb, al8i4_start[9], hf_tns_data_all8_exec_flags,
6305 ett_tns_all8_exec_flags, tns_all8_exec_flags, (uint64_t)(uint32_t)al8i4[9]);
6306 proto_tree_add_uint(i4_tree, hf_tns_data_all8_fetch_orientation,
6307 tvb, al8i4_start[10], al8i4_len[10], al8i4[10]);
6308 proto_tree_add_uint(i4_tree, hf_tns_data_all8_fetch_pos,
6309 tvb, al8i4_start[11], al8i4_len[11], al8i4[11]);
6310 if ( call )
6311 call->exec_flags = (uint32_t)al8i4[9];
6312 }
6313 }
6314
6315 /* Bind section: one bare OAC descriptor per bind column,
6316 * then one TTI_RXD row of values per iteration. A cached
6317 * re-execute may leave the descriptors out and rely on
6318 * the ones the cursor was opened with. Whether they are
6319 * there is decided by the wire, not by the SQL text: an
6320 * execute with no SQL often still carries them (every
6321 * executemany after the first), and they are absent
6322 * exactly when the bind area starts on a TTI_RXD, in
6323 * which case the types remembered for the cursor apply.
6324 *
6325 * An execute that opens a new cursor (cursor id 0) learns
6326 * its id only from the status that answers it, so its
6327 * bind types wait for that. */
6328 tns_conv_info_t *tns_info = NULL((void*)0);
6329 if ( !PINFO_FD_VISITED(pinfo)((pinfo)->fd->visited) )
6330 {
6331 tns_info = tns_get_conv_info(pinfo);
6332 if ( cursor == 0 )
6333 tns_info->pending_binds = NULL((void*)0);
6334 }
6335 if ( bind_count > 0 && tvb_reported_length_remaining(tvb, offset) > 0
6336 && tvb_get_uint8(tvb, offset) == SQLNET_ROW_TRANSF_DATA7 )
6337 {
6338 tns_binds_t *binds = cursor ? tns_lookup_cursor_binds(pinfo, cursor) : NULL((void*)0);
6339 if ( binds && binds->count == (uint32_t)bind_count )
6340 {
6341 if ( call )
6342 {
6343 call->num_binds = binds->count;
6344 call->num_return = binds->num_return;
6345 call->binds = binds->cols;
6346 call->bind_rec = binds;
6347 }
6348 proto_item *binds_item;
6349 proto_tree *binds_tree;
6350 int binds_start = offset;
6351
6352 binds_tree = proto_tree_add_subtree(data_tree, tvb, offset, -1,
6353 ett_tns_binds, &binds_item, "Binds");
6354 offset = dissect_tns_bind_rows(tvb, pinfo, binds_tree, offset, binds->cols,
6355 binds->count - binds->num_return, binds->plsql, NULL((void*)0));
6356 proto_item_set_len(binds_item, offset - binds_start);
6357 }
6358 }
6359 else if ( bind_count > 0 && tvb_reported_length_remaining(tvb, offset) > 0 )
6360 {
6361 proto_tree *binds_tree, *bind_tree;
6362 proto_item *binds_item, *bind_item;
6363 int binds_start = offset;
6364 tns_column_t *bcols;
6365
6366 bcols = wmem_alloc0_array(tns_info ? wmem_file_scope() : pinfo->pool, tns_column_t, bind_count)((tns_column_t*)wmem_alloc0((tns_info ? wmem_file_scope() : pinfo
->pool), (((((bind_count)) <= 0) || ((size_t)sizeof(tns_column_t
) > (9223372036854775807L / (size_t)((bind_count))))) ? 0 :
(sizeof(tns_column_t) * ((bind_count))))))
;
6367 binds_tree = proto_tree_add_subtree(data_tree, tvb, offset, -1,
6368 ett_tns_binds, &binds_item, "Binds");
6369
6370 for ( int i = 0; i < bind_count && tvb_reported_length_remaining(tvb, offset) > 0; i++ )
6371 {
6372 int b_start = offset;
6373 uint8_t btype = tvb_get_uint8(tvb, offset);
6374 bind_tree = proto_tree_add_subtree_format(binds_tree, tvb, offset, -1,
6375 ett_tns_bind, &bind_item, "Bind %d: %s", i + 1,
6376 val_to_str_const(btype, tns_data_types, "unknown"));
6377 offset = dissect_tns_oac(tvb, pinfo, bind_tree, offset, &bcols[i]);
6378 /* Below 12.1 the descriptor of a bind whose value
6379 * rides under a locator - a CLOB, BLOB, JSON or
6380 * VECTOR - carries a trailing byte the others
6381 * lack; 12.1 drops it, and from 12.2 every OAC
6382 * carries an oaccolid, which the OAC decoder
6383 * reads. */
6384 if ( (btype == TNS_DATATYPE_CLOB112 || btype == TNS_DATATYPE_BLOB113
6385 || btype == TNS_DATATYPE_JSON119 || btype == TNS_DATATYPE_VECTOR127)
6386 && tns_field_version(pinfo) < TNS_FV_12_17 )
6387 offset += 1;
6388 proto_item_set_len(bind_item, offset - b_start);
6389 }
6390
6391 /* A DML RETURNING ... INTO statement sends no values for
6392 * its return binds, the last ones. */
6393 unsigned num_return = sql ? tns_count_return_binds((const char *)sql) : 0;
6394 if ( num_return > (unsigned)bind_count )
6395 num_return = 0;
6396
6397 if ( call )
6398 {
6399 call->num_binds = bind_count;
6400 call->num_return = num_return;
6401 call->binds = bcols;
6402 }
6403
6404 /* Remember the types for later executes of the cursor
6405 * that leave the descriptors out. */
6406 if ( tns_info )
6407 {
6408 tns_binds_t *binds = wmem_new0(wmem_file_scope(), tns_binds_t)((tns_binds_t*)wmem_alloc0((wmem_file_scope()), sizeof(tns_binds_t
)))
;
6409 binds->count = bind_count;
6410 binds->num_return = num_return;
6411 binds->plsql = !(options & TNS_EXEC_OPTION_NOT_PLSQL0x8000);
6412 binds->cols = bcols;
6413 if ( call )
6414 call->bind_rec = binds;
6415 if ( cursor != 0 )
6416 wmem_map_insert(tns_info->cursor_binds, GUINT_TO_POINTER(cursor)((gpointer) (gulong) (cursor)), binds);
6417 else
6418 tns_info->pending_binds = binds;
6419 }
6420
6421 /* Value rows: a TTI_RXD token then one DALC value per bind
6422 * column (an ordinary execute sends one row, executemany
6423 * sends N), decoded and rendered by the bind's type. */
6424 offset = dissect_tns_bind_rows(tvb, pinfo, binds_tree, offset, bcols, bind_count - num_return,
6425 !(options & TNS_EXEC_OPTION_NOT_PLSQL0x8000), NULL((void*)0));
6426 proto_item_set_len(binds_item, offset - binds_start);
6427 }
6428
6429 /* Define section: a client that wants a column in some
6430 * other form than the describe gave - a CLOB as a string,
6431 * say - re-executes the cursor with the DEFINE option and
6432 * one OAC per column, in the bind OAC layout. It carries
6433 * no binds. */
6434 if ( define_count > 0 )
6435 {
6436 proto_tree *defs_tree, *def_tree;
6437 proto_item *defs_item, *def_item;
6438 int defs_start = offset;
6439 tns_column_t *dcols = NULL((void*)0);
6440
6441 if ( !PINFO_FD_VISITED(pinfo)((pinfo)->fd->visited) )
6442 dcols = wmem_alloc0_array(pinfo->pool, tns_column_t, define_count)((tns_column_t*)wmem_alloc0((pinfo->pool), (((((define_count
)) <= 0) || ((size_t)sizeof(tns_column_t) > (9223372036854775807L
/ (size_t)((define_count))))) ? 0 : (sizeof(tns_column_t) * (
(define_count))))))
;
6443 defs_tree = proto_tree_add_subtree(data_tree, tvb, offset, -1,
6444 ett_tns_defines, &defs_item, "Defines");
6445 for ( int i = 0; i < define_count && tvb_reported_length_remaining(tvb, offset) > 0; i++ )
6446 {
6447 int d_start = offset;
6448 uint8_t dtype = tvb_get_uint8(tvb, offset);
6449 def_tree = proto_tree_add_subtree_format(defs_tree, tvb, offset, -1,
6450 ett_tns_bind, &def_item, "Define %d: %s", i + 1,
6451 val_to_str_const(dtype, tns_data_types, "unknown"));
6452 offset = dissect_tns_oac(tvb, pinfo, def_tree, offset, dcols ? &dcols[i] : NULL((void*)0));
6453 proto_item_set_len(def_item, offset - d_start);
6454 }
6455 proto_item_set_len(defs_item, offset - defs_start);
6456
6457 /* The rows that answer a define come framed the way
6458 * it asked - a CLOB defined as LONG arrives inline,
6459 * with no locator - and so do the rows of every later
6460 * execute of the cursor. Rows are still split by the
6461 * describe's columns, so replace each column's type
6462 * with the one its define gives. */
6463 if ( tns_info && dcols && tns_info->last_describe
6464 && tns_info->last_describe->num_cols == (uint32_t)define_count )
6465 {
6466 tns_describe_t *desc = wmem_new0(wmem_file_scope(), tns_describe_t)((tns_describe_t*)wmem_alloc0((wmem_file_scope()), sizeof(tns_describe_t
)))
;
6467 desc->num_cols = define_count;
6468 desc->cols = (tns_column_t *)wmem_memdup(wmem_file_scope(),
6469 tns_info->last_describe->cols, define_count * sizeof(tns_column_t));
6470 for ( int i = 0; i < define_count; i++ )
6471 {
6472 desc->cols[i].type = dcols[i].type;
6473 desc->cols[i].csform = dcols[i].csform;
6474 }
6475 tns_info->last_describe = desc;
6476 }
6477 }
6478 }
6479 else if ( oci_id == TTI_LOBOPS96 )
6480 {
6481 /* TTI_LOBOPS: the LOB operation family (read, write, get
6482 * length, create/free temp, open/close, BFILE ops). One
6483 * common request layout selects behaviour by the operation
6484 * opcode:
6485 * ub1 source pointer | ub4 source locator length |
6486 * ub1 dest pointer | ub4 dest length |
6487 * ub4 short source offset | ub4 short dest offset |
6488 * ub1 charset pointer | ub1 short amount pointer |
6489 * ub1 null-LOB pointer | ub4 operation |
6490 * ub1 SCN array pointer | ub1 SCN array length |
6491 * ub8 source offset | ub8 dest offset |
6492 * ub1 amount pointer | 3 x ub2 array-LOB slots (fixed) |
6493 * [locator] | [ub4 charset, CREATE_TEMP] |
6494 * [0x0E and the data, WRITE] | [ub8 amount]
6495 * The locator is as long as the source locator length says;
6496 * a temporary LOB's carries its own ub2 length prefix, which
6497 * that length counts. */
6498 int v = 0, op = 0, loc_len = 0, start;
6499 uint8_t src_ptr, charset_ptr, amount_ptr;
6500 uint64_t u = 0;
6501
6502 src_ptr = tvb_get_uint8(tvb, offset);
6503 offset += 1; /* source pointer flag */
6504 offset += get_sb4_custom(tvb, offset, &loc_len); /* source locator length */
6505 offset += 1; /* dest pointer flag */
6506 offset += get_sb4_custom(tvb, offset, &v); /* dest length */
6507 offset += get_sb4_custom(tvb, offset, &v); /* short source offset */
6508 offset += get_sb4_custom(tvb, offset, &v); /* short dest offset */
6509 charset_ptr = tvb_get_uint8(tvb, offset);
6510 offset += 3; /* charset / amount / null-lob flags */
6511 /* operation opcode */
6512 start = offset;
6513 offset += get_sb4_custom(tvb, offset, &op);
6514 proto_tree_add_uint(data_tree, hf_tns_data_lob_op, tvb, start, offset - start, op);
6515 col_append_fstr(pinfo->cinfo, COL_INFO, " [%s]",
6516 val_to_str_const(op, tns_lob_ops, "unknown"));
6517 /* scn-array pointer flag + length */
6518 offset += 2;
6519 if ( op == TNS_LOB_OP_CREATE_TEMP0x00110 )
6520 {
6521 /* A CREATE_TEMP has no source and no destination
6522 * to offset into: the two offsets carry the charset
6523 * form of the LOB to create and its type. An NCLOB
6524 * is a CLOB told apart only by the form. */
6525 uint64_t csform = 0, type = 0;
6526 start = offset;
6527 offset += get_ub8_custom(tvb, offset, &csform);
6528 proto_tree_add_uint64(data_tree, hf_tns_data_lob_csform, tvb, start, offset - start, csform);
6529 start = offset;
6530 offset += get_ub8_custom(tvb, offset, &type);
6531 proto_tree_add_uint64(data_tree, hf_tns_data_lob_type, tvb, start, offset - start, type);
6532 if ( type == TNS_DATATYPE_BLOB113 )
6533 col_append_str(pinfo->cinfo, COL_INFO, " [BLOB]");
6534 else if ( type == TNS_DATATYPE_CLOB112 )
6535 col_append_str(pinfo->cinfo, COL_INFO, csform == 2 ? " [NCLOB]" : " [CLOB]");
6536 }
6537 else
6538 {
6539 /* source offset (ub8, 1-based into the LOB) */
6540 start = offset;
6541 offset += get_ub8_custom(tvb, offset, &u);
6542 proto_tree_add_uint64(data_tree, hf_tns_data_lob_offset, tvb, start, offset - start, u);
6543 /* dest offset (ub8, skip) */
6544 offset += get_ub8_custom(tvb, offset, &u);
6545 }
6546 amount_ptr = tvb_get_uint8(tvb, offset);
6547 offset += 1; /* amount pointer flag */
6548 offset += 6; /* array-LOB slots */
6549 int locator_start = offset;
6550 if ( src_ptr && loc_len > 0 )
6551 {
6552 int dir_off, dir_len, file_off, file_len;
6553
6554 proto_tree_add_item(data_tree, hf_tns_data_lob_locator, tvb, offset, loc_len, ENC_NA0x00000000);
6555 if ( tns_bfile_names(tvb, offset, loc_len, &dir_off, &dir_len, &file_off, &file_len) )
6556 {
6557 const char *dir, *file;
6558 proto_tree_add_item_ret_string(data_tree, hf_tns_data_lob_directory, tvb,
6559 dir_off, dir_len, ENC_UTF_80x00000002, pinfo->pool, (const uint8_t **)&dir);
6560 proto_tree_add_item_ret_string(data_tree, hf_tns_data_lob_file_name, tvb,
6561 file_off, file_len, ENC_UTF_80x00000002, pinfo->pool, (const uint8_t **)&file);
6562 col_append_fstr(pinfo->cinfo, COL_INFO, " [BFILENAME('%s', '%s')]", dir, file);
6563 }
6564 offset += loc_len;
6565 }
6566 if ( charset_ptr )
6567 {
6568 start = offset;
6569 offset += get_sb4_custom(tvb, offset, &v);
6570 proto_tree_add_uint(data_tree, hf_tns_data_lob_charset, tvb, start, offset - start, v);
6571 }
6572 if ( tvb_reported_length_remaining(tvb, offset) > 0
6573 && tvb_get_uint8(tvb, offset) == SQLNET_LOB_FILE_DF14 )
6574 {
6575 /* WRITE: a LOB_DATA marker, then the data */
6576 offset += 1;
6577 start = offset;
6578 offset += get_dalc_custom(tvb, pinfo, offset, NULL((void*)0));
6579 if ( tvb_get_uint8(tvb, start) == 0xfe ) /* chunked: shown whole */
6580 proto_tree_add_item(data_tree, hf_tns_data_lob_data, tvb, start, offset - start, ENC_NA0x00000000);
6581 else if ( offset - start > 1 )
6582 proto_tree_add_item(data_tree, hf_tns_data_lob_data, tvb, start + 1, offset - start - 1, ENC_NA0x00000000);
6583 }
6584 if ( amount_ptr )
6585 {
6586 start = offset;
6587 offset += get_ub8_custom(tvb, offset, &u);
6588 proto_tree_add_uint64(data_tree, hf_tns_data_lob_amount, tvb, start, offset - start, u);
6589 }
6590 if ( call )
6591 {
6592 call->lob_op = (uint32_t)op;
6593 call->lob_locator_len = src_ptr ? (uint32_t)loc_len : 0;
6594 call->lob_amount = amount_ptr != 0;
6595 if ( src_ptr && loc_len >= TNS_LOB_LOC_FLAG_40x07 + 1 )
6596 {
6597 tvb_memcpy(tvb, call->lob_flags, locator_start + TNS_LOB_LOC_FLAG_10x04, 4);
6598 call->lob_flags_known = true1;
6599 }
6600 }
6601 }
6602 break;
6603 }
6604 case SQLNET_RETURN_OPI_PARAM8:
6605 {
6606 uint8_t skip = 0, opi = 0;
6607
6608 if ( tvb_bytes_exist(tvb, offset, 11) )
6609 {
6610 /*
6611 * OPI_VERSION2 response has a following pattern:
6612 *
6613 * _ banner _ vsnum
6614 * / /
6615 * ..(.?)(Orac[le.+])(.?)(....).+$
6616 * |
6617 * \ banner length (if equal to 0 then next byte indicates the length).
6618 *
6619 * These differences (to skip 1 or 2 bytes) due to differences in the drivers.
6620 */
6621 /* Orac[le.+] */
6622 if ( tvb_get_ntohl(tvb, offset+2) == 0x4f726163 )
6623 {
6624 opi = OPI_VERSION21;
6625 skip = 1;
6626 }
6627
6628 else if ( tvb_get_ntohl(tvb, offset+3) == 0x4f726163 )
6629 {
6630 opi = OPI_VERSION21;
6631 skip = 2;
6632 }
6633
6634 /*
6635 * OPI_OSESSKEY response has a following pattern:
6636 *
6637 * _ pattern (v1|v2)
6638 * / _ params
6639 * / /
6640 * (....)(........)(.+).+$
6641 * ||
6642 * \ if these two bytes are equal to 0x0c00 then first byte is <Param Counts> (v1),
6643 * else next byte indicate it (v2).
6644 */
6645 /* ....AUTH (v1) */
6646 else if ( tvb_get_ntoh64(tvb, offset+3) == 0x0000000c41555448 )
6647 {
6648 opi = OPI_OSESSKEY2;
6649 skip = 1;
6650 }
6651 /* ..AUTH_V (v2) */
6652 else if ( tvb_get_ntoh64(tvb, offset+3) == 0x0c0c415554485f53 )
6653 {
6654 opi = OPI_OSESSKEY2;
6655 skip = 2;
6656 }
6657
6658 /*
6659 * OPI_OAUTH response has a following pattern:
6660 *
6661 * _ pattern (v1|v2)
6662 * / _ params
6663 * / /
6664 * (....)(........)(.+).+$
6665 * ||
6666 * \ if these two bytes are equal to 0x1300 then first byte is <Param Counts> (v1),
6667 * else next byte indicate it (v2).
6668 */
6669
6670 /* ....AUTH (v1) */
6671 else if ( tvb_get_ntoh64(tvb, offset+3) == 0x0000001341555448 )
6672 {
6673 opi = OPI_OAUTH3;
6674 skip = 1;
6675 }
6676 /* ..AUTH_V (v2) */
6677 else if ( tvb_get_ntoh64(tvb, offset+3) == 0x1313415554485f56 )
6678 {
6679 opi = OPI_OAUTH3;
6680 skip = 2;
6681 }
6682 }
6683
6684 if ( opi == OPI_VERSION21 )
6685 {
6686 proto_tree_add_item(data_tree, hf_tns_data_unused, tvb, offset, skip, ENC_NA0x00000000);
6687 offset += skip;
6688
6689 uint8_t len = tvb_get_uint8(tvb, offset);
6690
6691 proto_tree_add_item(data_tree, hf_tns_data_opi_version2_banner_len, tvb, offset, 1, ENC_BIG_ENDIAN0x00000000);
6692 offset += 1;
6693
6694 proto_tree_add_item(data_tree, hf_tns_data_opi_version2_banner, tvb, offset, len, ENC_ASCII0x00000000);
6695 offset += len + (skip == 1 ? 1 : 0);
6696
6697 proto_tree_add_item(data_tree, hf_tns_data_opi_version2_vsnum, tvb, offset, 4, (skip == 1) ? ENC_BIG_ENDIAN0x00000000 : ENC_LITTLE_ENDIAN0x80000000);
6698 offset += 4;
6699 }
6700 else if ( opi == OPI_OSESSKEY2 || opi == OPI_OAUTH3 )
6701 {
6702 proto_tree *params_tree;
6703 proto_item *params_ti;
6704 unsigned par, params;
6705
6706 if ( skip == 1 )
6707 {
6708 proto_tree_add_item_ret_uint(data_tree, hf_tns_data_opi_num_of_params, tvb, offset, 1, ENC_NA0x00000000, &params);
6709 offset += 1;
6710
6711 proto_tree_add_item(data_tree, hf_tns_data_unused, tvb, offset, 5, ENC_NA0x00000000);
6712 offset += 5;
6713 }
6714 else
6715 {
6716 proto_tree_add_item(data_tree, hf_tns_data_unused, tvb, offset, 1, ENC_NA0x00000000);
6717 offset += 1;
6718
6719 proto_tree_add_item_ret_uint(data_tree, hf_tns_data_opi_num_of_params, tvb, offset, 1, ENC_NA0x00000000, &params);
6720 offset += 1;
6721
6722 proto_tree_add_item(data_tree, hf_tns_data_unused, tvb, offset, 2, ENC_NA0x00000000);
6723 offset += 2;
6724 }
6725
6726 params_tree = proto_tree_add_subtree(data_tree, tvb, offset, -1, ett_tns_opi_params, &params_ti, "Parameters");
6727
6728 for ( par = 1; par <= params; par++ )
6729 {
6730 proto_tree *par_tree;
6731 proto_item *par_ti;
6732 unsigned len, offset_prev;
6733
6734 par_tree = proto_tree_add_subtree(params_tree, tvb, offset, -1, ett_tns_opi_par, &par_ti, "Parameter");
6735 proto_item_append_text(par_ti, " %u", par);
6736
6737 /* Name length */
6738 proto_tree_add_item_ret_uint(par_tree, hf_tns_data_opi_param_length, tvb, offset, 1, ENC_NA0x00000000, &len);
6739 offset += 1;
6740
6741 /* Name */
6742 if ( !(len == 0 || len == 2) ) /* Not empty (2 - SQLDeveloper specific sign). */
6743 {
6744 proto_tree_add_item(par_tree, hf_tns_data_opi_param_name, tvb, offset, len, ENC_ASCII0x00000000);
6745 offset += len;
6746 }
6747
6748 /* Value can be NULL. So, save offset to calculate unused data. */
6749 offset_prev = offset;
6750 offset += skip == 1 ? 4 : 2;
6751
6752 /* Value length */
6753 if ( opi == OPI_OSESSKEY2 )
6754 {
6755 len = get_strtype_custom(tvb, pinfo, par_tree, offset);
6756 }
6757 else /* OPI_OAUTH */
6758 {
6759 len = tvb_get_uint8(tvb, offset_prev) == 0 ? 0 : get_strtype_custom(tvb, pinfo, par_tree, offset);
6760 }
6761
6762 /*
6763 * Value
6764 * OPI_OSESSKEY: AUTH_VFR_DATA with length 0, 9, 0x39 comes without data.
6765 * OPI_OAUTH: AUTH_VFR_DATA with length 0, 0x39 comes without data.
6766 */
6767 if ( ((opi == OPI_OSESSKEY2) && !(len == 0 || len == 9 || len == 0x39))
6768 || ((opi == OPI_OAUTH3) && !(len == 0 || len == 0x39)) )
6769 {
6770 proto_tree_add_item(par_tree, hf_tns_data_unused, tvb, offset_prev, offset - offset_prev, ENC_NA0x00000000);
6771 offset += len;
6772
6773 offset_prev = offset; /* Save offset to calculate rest of unused data */
6774 }
6775 else
6776 {
6777 offset += 1;
6778 }
6779
6780 if ( opi == OPI_OSESSKEY2 )
6781 {
6782 /* SQL Developer specific fix */
6783 offset += tvb_get_uint8(tvb, offset) == 2 ? 5 : 3;
6784 }
6785 else /* OPI_OAUTH */
6786 {
6787 offset += len == 0 ? 1 : 3;
6788 }
6789
6790 if ( skip == 1 )
6791 {
6792 offset += 1 + ((len == 0 || len == 0x39) ? 3 : 4);
6793
6794 if ( opi == OPI_OAUTH3 )
6795 {
6796 offset += len == 0 ? 2 : 0;
6797 }
6798 }
6799
6800 proto_tree_add_item(par_tree, hf_tns_data_unused, tvb, offset_prev, offset - offset_prev, ENC_NA0x00000000);
6801 proto_item_set_end(par_ti, tvb, offset);
6802 }
6803 proto_item_set_end(params_ti, tvb, offset);
6804 }
6805 else if ( !is_request )
6806 {
6807 /* Not an authentication reply: an execute answers with
6808 * its return parameters. */
6809 tns_call_t *call = tns_answered_call(pinfo);
6810 if ( call && (call->func == TTI_ALL894 || call->func == TTI_REEXECUTE4
6811 || call->func == TTI_REEXECUTE_AND_FETCH78) )
6812 {
6813 offset = dissect_tns_return_params(tvb, pinfo, data_tree, offset,
6814 (call->exec_flags & TNS_EXEC_FLAGS_DML_ROWCOUNTS0x4000) != 0);
6815 ctx->walk = true1;
6816 }
6817 else if ( call && call->func == TTI_AQ_ENQUEUE121 )
6818 {
6819 /* the id the queue gave the message */
6820 int ext_len = 0;
6821 proto_tree_add_item(data_tree, hf_tns_data_aq_msgid, tvb, offset, TNS_AQ_MSGID_LEN16, ENC_NA0x00000000);
6822 offset += TNS_AQ_MSGID_LEN16;
6823 offset += get_sb4_custom(tvb, offset, &ext_len); /* extensions */
6824 ctx->walk = true1;
6825 }
6826 else if ( call && call->func == TTI_AQ_ARRAY145 )
6827 {
6828 /* one message per iteration: its properties when the
6829 * length before them is not zero, the recipients, the
6830 * payload, the message ids and the extensions */
6831 int num_iters = 0, len = 0, v = 0, msg_start;
6832
6833 offset += get_sb4_custom(tvb, offset, &num_iters);
6834 for ( int i = 0; i < num_iters && tvb_reported_length_remaining(tvb, offset) > 0; i++ )
6835 {
6836 offset += get_sb4_custom(tvb, offset, &len);
6837 if ( len > 0 )
6838 {
6839 offset += 1;
6840 offset = dissect_tns_aq_msg_props(tvb, pinfo, data_tree, offset, true1);
6841 }
6842 offset += get_sb4_custom(tvb, offset, &v); /* recipients */
6843 offset += get_sb4_custom(tvb, offset, &len);
6844 if ( len > 0 )
6845 offset = dissect_tns_value(tvb, pinfo, data_tree, offset, TNS_DATATYPE_ADT109,
6846 0, TNS_VALUE_OUT, i + 1, hf_tns_data_aq_payload, "Payload");
6847 /* the ids of this iteration's messages, one after
6848 * another */
6849 offset += get_sb4_custom(tvb, offset, &len);
6850 if ( len > 0 )
6851 {
6852 msg_start = offset;
6853 offset += get_dalc_custom(tvb, pinfo, offset, NULL((void*)0));
6854 if ( offset - msg_start > 1 )
6855 proto_tree_add_item(data_tree, hf_tns_data_aq_msgid, tvb,
6856 msg_start + 1, offset - msg_start - 1, ENC_NA0x00000000);
6857 }
6858 offset += get_sb4_custom(tvb, offset, &v); /* extensions */
6859 offset += get_sb4_custom(tvb, offset, &v); /* output ack */
6860 }
6861 ctx->walk = true1;
6862 }
6863 else if ( call && call->func == TTI_AQ_DEQUEUE122 )
6864 {
6865 /* a length, and when it is not zero the message: its
6866 * properties, recipients, payload and id */
6867 int len = 0;
6868 offset += get_sb4_custom(tvb, offset, &len);
6869 if ( len > 0 )
6870 {
6871 int v = 0;
6872 offset = dissect_tns_aq_msg_props(tvb, pinfo, data_tree, offset, true1);
6873 offset += get_sb4_custom(tvb, offset, &v); /* recipients */
6874 offset = dissect_tns_value(tvb, pinfo, data_tree, offset, TNS_DATATYPE_ADT109, 0,
6875 TNS_VALUE_OUT, 1, hf_tns_data_aq_payload, "Payload");
6876 proto_tree_add_item(data_tree, hf_tns_data_aq_msgid, tvb, offset, TNS_AQ_MSGID_LEN16, ENC_NA0x00000000);
6877 offset += TNS_AQ_MSGID_LEN16;
6878 }
6879 ctx->walk = true1;
6880 }
6881 else if ( call && call->func == TTI_TPC_TXN_SWITCH103 )
6882 {
6883 /* the application value and the transaction context
6884 * (a ub2 length and the bytes) */
6885 int v = 0, len = 0, start = offset;
6886 offset += get_sb4_custom(tvb, offset, &v);
6887 proto_tree_add_uint(data_tree, hf_tns_data_tpc_app_value, tvb, start, offset - start, v);
6888 offset += get_sb4_custom(tvb, offset, &len);
6889 if ( len > 0 )
6890 {
6891 proto_tree_add_item(data_tree, hf_tns_data_tpc_context, tvb, offset, len, ENC_NA0x00000000);
6892 offset += len;
6893 }
6894 ctx->walk = true1;
6895 }
6896 else if ( call && call->func == TTI_TPC_TXN_CHANGE_STATE104 )
6897 {
6898 int v = 0, start = offset;
6899 offset += get_sb4_custom(tvb, offset, &v);
6900 proto_tree_add_uint(data_tree, hf_tns_data_tpc_state, tvb, start, offset - start, v);
6901 ctx->walk = true1;
6902 }
6903 else if ( call && call->func == TTI_LOBOPS96 )
6904 {
6905 /* A LOB operation's reply: the locator as the server
6906 * now sees it - as long as the one sent, and changed
6907 * by a mutating call - then per operation the new
6908 * temporary LOB's charset, the amount, or a boolean. */
6909 uint64_t u = 0;
6910 int start;
6911
6912 if ( call->lob_locator_len > 0 )
6913 {
6914 proto_tree_add_item(data_tree, hf_tns_data_lob_locator, tvb, offset,
6915 call->lob_locator_len, ENC_NA0x00000000);
6916 offset += call->lob_locator_len;
6917 }
6918 if ( call->lob_op == TNS_LOB_OP_CREATE_TEMP0x00110 )
6919 {
6920 int v = 0;
6921 start = offset;
6922 offset += get_sb4_custom(tvb, offset, &v);
6923 proto_tree_add_uint(data_tree, hf_tns_data_lob_charset, tvb, start, offset - start, v);
6924 offset += 1; /* trailing flags */
6925 }
6926 else if ( call->lob_amount )
6927 {
6928 start = offset;
6929 offset += get_ub8_custom(tvb, offset, &u);
6930 proto_tree_add_uint64(data_tree, hf_tns_data_lob_amount, tvb, start, offset - start, u);
6931 }
6932 if ( call->lob_op == TNS_LOB_OP_IS_OPEN0x11000 || call->lob_op == TNS_LOB_OP_FILE_EXISTS0x00800
6933 || call->lob_op == TNS_LOB_OP_FILE_ISOPEN0x00400 )
6934 {
6935 proto_tree_add_item(data_tree, hf_tns_data_lob_flag, tvb, offset, 1, ENC_NA0x00000000);
6936 offset += 1;
6937 }
6938 ctx->walk = true1;
6939 }
6940 }
6941 break;
6942 }
6943
6944 case SQLNET_PIGGYBACK_FUNC17:
6945 {
6946 int cursors_len = 0;
6947 int cursors_start;
6948 uint8_t piggyback_id = tvb_get_uint8(tvb, offset);
6949 proto_tree_add_item(data_tree, hf_tns_data_piggyback_id, tvb, offset, 1, ENC_BIG_ENDIAN0x00000000);
6950 offset += 1;
6951 proto_tree_add_item(data_tree, hf_tns_data_tseq, tvb, offset, 1, ENC_BIG_ENDIAN0x00000000);
6952 offset += 1;
6953 offset = dissect_tns_call_token(tvb, pinfo, data_tree, offset);
6954 /* Only the close-cursors piggyback carries a cursor list:
6955 * a pointer byte, a ub4 count, then that many ub4 cursor
6956 * ids. The other piggybacks have bodies of their own. */
6957 if ( piggyback_id != TTI_CLOSE_CURSORS105 )
6958 {
6959 offset = dissect_tns_piggyback_body(tvb, pinfo, data_tree, offset, piggyback_id, &ctx->walk);
6960 break;
6961 }
6962 offset += 1; /* pointer */
6963 cursors_start = offset;
6964 offset += get_sb4_custom(tvb, offset, &cursors_len);
6965 /* The count comes off the wire and every cursor takes at
6966 * least one byte, so a count larger than the data left
6967 * cannot be real. Say so and stop, rather than looping on
6968 * a number somebody else chose. */
6969 if ( cursors_len < 0 ||
6970 (unsigned)cursors_len > tvb_reported_length_remaining(tvb, offset) )
6971 {
6972 proto_tree_add_expert(data_tree, pinfo, &ei_tns_data_piggyback_cursors,
6973 tvb, cursors_start, offset - cursors_start);
6974 break;
6975 }
6976 for(int i = 0; i < cursors_len; i++) {
6977 int cursor = 0;
6978 int len = get_sb4_custom(tvb, offset, &cursor);
6979 proto_tree_add_uint(data_tree, hf_tns_cursor, tvb, offset, len, cursor);
6980 offset += len;
6981 }
6982 /* The call this piggyback rides in front of follows it. */
6983 ctx->walk = true1;
6984 break;
6985 }
6986 case SQLNET_FAST_AUTH34:
6987 {
6988 /* A 23ai client cannot open a session with the three separate
6989 * handshake messages: from field version 23.1 ext 1 it sends
6990 * them in one packet behind this header - a version and two
6991 * flags - with the protocol message, three unused character
6992 * set fields, the field version the bundle is written at, the
6993 * data types message and the session key request following
6994 * one after another. The server answers with its three
6995 * replies in one packet too. */
6996 unsigned len;
6997
6998 if ( !is_request )
6999 break;
7000
7001 proto_tree_add_item(data_tree, hf_tns_data_fastauth_version, tvb, offset, 1, ENC_NA0x00000000);
7002 offset += 3; /* version and two flags */
7003 if ( tvb_get_uint8(tvb, offset) != SQLNET_SET_PROTOCOL1 )
7004 break;
7005 proto_tree_add_item(data_tree, hf_tns_data_id, tvb, offset, 1, ENC_BIG_ENDIAN0x00000000);
7006 offset += 1;
7007 proto_tree_add_item(data_tree, hf_tns_data_setp_acc_version, tvb, offset, 1, ENC_BIG_ENDIAN0x00000000);
7008 offset += 2; /* the version and the list's 0 terminator */
7009 proto_tree_add_item_ret_length(data_tree, hf_tns_data_setp_cli_plat, tvb, offset, -1,
7010 ENC_ASCII0x00000000|ENC_NA0x00000000, &len);
7011 offset += len;
7012 offset += 5; /* unused charset, charset flag and ncharset */
7013 proto_tree_add_item(data_tree, hf_tns_data_setdt_field_version, tvb, offset, 1, ENC_NA0x00000000);
7014 offset += 1;
7015 /* The data types message and the session key request follow,
7016 * and the walker steps into them. The call in the bundle
7017 * carries no token, whatever field version its data types
7018 * message negotiates. */
7019 ctx->no_token = true1;
7020 ctx->walk = true1;
7021 break;
7022 }
7023
7024 case SQLNET_SNS0xdeadbeef:
7025 {
7026 proto_tree_add_item(data_tree, hf_tns_data_id, tvb, offset, 4, ENC_BIG_ENDIAN0x00000000);
7027 offset += 4;
7028 proto_tree_add_item(data_tree, hf_tns_data_length, tvb, offset, 2, ENC_BIG_ENDIAN0x00000000);
7029 offset += 2;
7030
7031 if ( is_request )
7032 {
7033 proto_tree_add_item(data_tree, hf_tns_data_sns_cli_vers, tvb, offset, 4, ENC_BIG_ENDIAN0x00000000);
7034 }
7035 else
7036 {
7037 proto_tree_add_item(data_tree, hf_tns_data_sns_srv_vers, tvb, offset, 4, ENC_BIG_ENDIAN0x00000000);
7038 }
7039 offset += 4;
7040
7041 uint16_t num_services = tvb_get_ntohs(tvb, offset);
7042 proto_tree_add_item(data_tree, hf_tns_data_sns_srvcnt, tvb, offset, 2, ENC_BIG_ENDIAN0x00000000);
7043 /* With encryption picked, the client's next negotiation packet
7044 * - its Diffie-Hellman public key - is the last in the clear. */
7045 if ( is_request && !PINFO_FD_VISITED(pinfo)((pinfo)->fd->visited) )
7046 {
7047 tns_conv_info_t *tns_info = tns_get_conv_info(pinfo);
7048 if ( tns_info->ano_encryption && !tns_info->ano_active_after )
7049 tns_info->ano_active_after = pinfo->num;
7050 }
7051 offset += 2;
7052 proto_tree_add_item(data_tree, hf_tns_data_sns_error, tvb, offset, 1, ENC_NA0x00000000);
7053 offset += 1;
7054
7055 /* Each service: a type, a sub-packet count and an error, then
7056 * the sub-packets, each a length, a type and that many bytes
7057 * of payload - all big-endian. A service opens with its
7058 * version; in the encryption and integrity services the
7059 * sub-packet after it lists the algorithms a client offers,
7060 * or holds the one the server picked. */
7061 for ( unsigned i = 0; i < num_services && tvb_bytes_exist(tvb, offset, 8); i++ )
7062 {
7063 proto_tree *svc_tree;
7064 proto_item *svc_item;
7065 int svc_start = offset;
7066 uint16_t svc_type = tvb_get_ntohs(tvb, offset);
7067 uint16_t num_sub = tvb_get_ntohs(tvb, offset + 2);
7068
7069 svc_tree = proto_tree_add_subtree_format(data_tree, tvb, offset, -1, ett_tns_sns_service,
7070 &svc_item, "Service: %s", val_to_str_const(svc_type, tns_sns_services, "unknown"));
7071 proto_tree_add_item(svc_tree, hf_tns_data_sns_service, tvb, offset, 2, ENC_BIG_ENDIAN0x00000000);
7072 proto_tree_add_item(svc_tree, hf_tns_data_sns_subpackets, tvb, offset + 2, 2, ENC_BIG_ENDIAN0x00000000);
7073 proto_tree_add_item(svc_tree, hf_tns_data_sns_svc_error, tvb, offset + 4, 4, ENC_BIG_ENDIAN0x00000000);
7074 offset += 8;
7075 for ( unsigned j = 0; j < num_sub && tvb_bytes_exist(tvb, offset, 4); j++ )
7076 {
7077 uint16_t len = tvb_get_ntohs(tvb, offset);
7078 uint16_t sub_type = tvb_get_ntohs(tvb, offset + 2);
7079 proto_tree *sub_tree = proto_tree_add_subtree_format(svc_tree, tvb, offset, 4 + len,
7080 ett_tns_sns_subpacket, NULL((void*)0), "Sub-packet %u: %s, %u bytes", j + 1,
7081 val_to_str_const(sub_type, tns_sns_subpacket_types, "unknown"), len);
7082 proto_tree_add_item(sub_tree, hf_tns_data_sns_sub_type, tvb, offset + 2, 2, ENC_BIG_ENDIAN0x00000000);
7083 offset += 4;
7084 bool_Bool algs = j == 1 && (sub_type == TNS_ANO_SP_BYTES1 || sub_type == TNS_ANO_SP_UB12);
7085 if ( sub_type == TNS_ANO_SP_VERSION5 && len == 4 )
7086 proto_tree_add_item(sub_tree, hf_tns_data_sns_version, tvb, offset, 4, ENC_BIG_ENDIAN0x00000000);
7087 else if ( algs && svc_type == TNS_ANO_ENCRYPTION2 )
7088 {
7089 for ( unsigned k = 0; k < len; k++ )
7090 proto_tree_add_item(sub_tree, hf_tns_data_sns_encryption, tvb, offset + k, 1, ENC_NA0x00000000);
7091 /* the server's pick: anything but none turns
7092 * encryption on once the client has answered */
7093 if ( !is_request && !PINFO_FD_VISITED(pinfo)((pinfo)->fd->visited) && len == 1 && tvb_get_uint8(tvb, offset) != 0 )
7094 tns_get_conv_info(pinfo)->ano_encryption = true1;
7095 }
7096 else if ( algs && svc_type == TNS_ANO_DATA_INTEGRITY3 )
7097 for ( unsigned k = 0; k < len; k++ )
7098 proto_tree_add_item(sub_tree, hf_tns_data_sns_integrity, tvb, offset + k, 1, ENC_NA0x00000000);
7099 else if ( len > 0 )
7100 proto_tree_add_item(sub_tree, hf_tns_data_sns_sub_data, tvb, offset, len, ENC_NA0x00000000);
7101 offset += len;
7102 }
7103 proto_item_set_len(svc_item, offset - svc_start);
7104 }
7105 break;
7106 }
7107 }
7108
7109 return offset;
7110}
7111
7112static void dissect_tns_connect(tvbuff_t *tvb, int offset, packet_info *pinfo _U___attribute__((unused)), proto_tree *tns_tree)
7113{
7114 proto_tree *connect_tree;
7115 uint32_t cd_offset, cd_len;
7116 int tns_offset = offset-8;
7117 static int * const flags[] = {
7118 &hf_tns_ntp_flag_hangon,
7119 &hf_tns_ntp_flag_crel,
7120 &hf_tns_ntp_flag_tduio,
7121 &hf_tns_ntp_flag_srun,
7122 &hf_tns_ntp_flag_dtest,
7123 &hf_tns_ntp_flag_cbio,
7124 &hf_tns_ntp_flag_asio,
7125 &hf_tns_ntp_flag_pio,
7126 &hf_tns_ntp_flag_grant,
7127 &hf_tns_ntp_flag_handoff,
7128 &hf_tns_ntp_flag_sigio,
7129 &hf_tns_ntp_flag_sigpipe,
7130 &hf_tns_ntp_flag_sigurg,
7131 &hf_tns_ntp_flag_urgentio,
7132 &hf_tns_ntp_flag_fdio,
7133 &hf_tns_ntp_flag_testop,
7134 NULL((void*)0)
7135 };
7136
7137 connect_tree = proto_tree_add_subtree(tns_tree, tvb, offset, -1,
7138 ett_tns_connect, NULL((void*)0), "Connect");
7139
7140 proto_tree_add_item(connect_tree, hf_tns_version, tvb,
7141 offset, 2, ENC_BIG_ENDIAN0x00000000);
7142 offset += 2;
7143
7144 proto_tree_add_item(connect_tree, hf_tns_compat_version, tvb,
7145 offset, 2, ENC_BIG_ENDIAN0x00000000);
7146 offset += 2;
7147
7148 proto_tree_add_bitmask(connect_tree, tvb, offset, hf_tns_service_options, ett_tns_sopt_flag, tns_service_options, ENC_BIG_ENDIAN0x00000000);
7149 offset += 2;
7150
7151 proto_tree_add_item(connect_tree, hf_tns_sdu_size, tvb,
7152 offset, 2, ENC_BIG_ENDIAN0x00000000);
7153 offset += 2;
7154
7155 proto_tree_add_item(connect_tree, hf_tns_max_tdu_size, tvb,
7156 offset, 2, ENC_BIG_ENDIAN0x00000000);
7157 offset += 2;
7158
7159 proto_tree_add_bitmask(connect_tree, tvb, offset, hf_tns_nt_proto_characteristics, ett_tns_ntp_flag, flags, ENC_BIG_ENDIAN0x00000000);
7160 offset += 2;
7161
7162 proto_tree_add_item(connect_tree, hf_tns_line_turnaround, tvb,
7163 offset, 2, ENC_BIG_ENDIAN0x00000000);
7164 offset += 2;
7165
7166 proto_tree_add_item(connect_tree, hf_tns_value_of_one, tvb,
7167 offset, 2, ENC_NA0x00000000);
7168 offset += 2;
7169
7170 proto_tree_add_item_ret_uint(connect_tree, hf_tns_connect_data_length, tvb,
7171 offset, 2, ENC_BIG_ENDIAN0x00000000, &cd_len);
7172 offset += 2;
7173
7174 proto_tree_add_item_ret_uint(connect_tree, hf_tns_connect_data_offset, tvb,
7175 offset, 2, ENC_BIG_ENDIAN0x00000000, &cd_offset);
7176 offset += 2;
7177
7178 proto_tree_add_item(connect_tree, hf_tns_connect_data_max, tvb,
7179 offset, 4, ENC_BIG_ENDIAN0x00000000);
7180 offset += 4;
7181
7182 proto_tree_add_bitmask(connect_tree, tvb, offset, hf_tns_connect_flags0, ett_tns_conn_flag, tns_connect_flags, ENC_BIG_ENDIAN0x00000000);
7183 offset += 1;
7184
7185 proto_tree_add_bitmask(connect_tree, tvb, offset, hf_tns_connect_flags1, ett_tns_conn_flag, tns_connect_flags, ENC_BIG_ENDIAN0x00000000);
7186 offset += 1;
7187
7188 /*
7189 * XXX - sometimes it appears that this stuff isn't present
7190 * in the packet.
7191 */
7192 if ((uint32_t)(offset + 16) <= tns_offset+cd_offset)
7193 {
7194 proto_tree_add_item(connect_tree, hf_tns_trace_cf1, tvb,
7195 offset, 4, ENC_BIG_ENDIAN0x00000000);
7196 offset += 4;
7197
7198 proto_tree_add_item(connect_tree, hf_tns_trace_cf2, tvb,
7199 offset, 4, ENC_BIG_ENDIAN0x00000000);
7200 offset += 4;
7201
7202 proto_tree_add_item(connect_tree, hf_tns_trace_cid, tvb,
7203 offset, 8, ENC_BIG_ENDIAN0x00000000);
7204 /* offset += 8;*/
7205 }
7206
7207 if ( cd_len > 0)
7208 {
7209 /* A server reads at most 230 bytes of connect data from the
7210 * CONNECT, so a longer descriptor is not in it: the CONNECT
7211 * ends at the data offset, and the descriptor follows in a
7212 * Data packet of its own.
7213 */
7214 if (tvb_reported_length_remaining(tvb, tns_offset + cd_offset)) {
7215 proto_tree_add_item(connect_tree, hf_tns_connect_data, tvb,
7216 tns_offset+cd_offset, -1, ENC_ASCII0x00000000);
7217 } else {
7218 proto_tree_add_expert(connect_tree, pinfo, &ei_tns_connect_data_next_packet, tvb, 0, 0);
7219 if (!PINFO_FD_VISITED(pinfo)((pinfo)->fd->visited)) {
7220 tns_conv_info_t *tns_info = tns_get_conv_info(pinfo);
7221 tns_info->pending_connect_data = cd_len;
7222 }
7223 }
7224 }
7225}
7226
7227static void dissect_tns_accept(tvbuff_t *tvb, int offset, packet_info *pinfo _U___attribute__((unused)), proto_tree *tns_tree)
7228{
7229 proto_tree *accept_tree;
7230 uint32_t accept_offset, accept_len;
7231 uint16_t version;
7232 int tns_offset = offset-8;
7233
7234 accept_tree = proto_tree_add_subtree(tns_tree, tvb, offset, -1,
7235 ett_tns_accept, NULL((void*)0), "Accept");
7236
7237 proto_tree_add_item(accept_tree, hf_tns_version, tvb,
7238 offset, 2, ENC_BIG_ENDIAN0x00000000);
7239 offset += 2;
7240
7241 proto_tree_add_bitmask(accept_tree, tvb, offset, hf_tns_service_options, ett_tns_sopt_flag, tns_service_options, ENC_BIG_ENDIAN0x00000000);
7242 offset += 2;
7243
7244 proto_tree_add_item(accept_tree, hf_tns_sdu_size, tvb,
7245 offset, 2, ENC_BIG_ENDIAN0x00000000);
7246 offset += 2;
7247
7248 proto_tree_add_item(accept_tree, hf_tns_max_tdu_size, tvb,
7249 offset, 2, ENC_BIG_ENDIAN0x00000000);
7250 offset += 2;
7251
7252 proto_tree_add_item(accept_tree, hf_tns_value_of_one, tvb,
7253 offset, 2, ENC_NA0x00000000);
7254 offset += 2;
7255
7256 proto_tree_add_item_ret_uint(accept_tree, hf_tns_accept_data_length, tvb,
7257 offset, 2, ENC_BIG_ENDIAN0x00000000, &accept_len);
7258 offset += 2;
7259
7260 proto_tree_add_item_ret_uint(accept_tree, hf_tns_accept_data_offset, tvb,
7261 offset, 2, ENC_BIG_ENDIAN0x00000000, &accept_offset);
7262 offset += 2;
7263
7264 proto_tree_add_bitmask(accept_tree, tvb, offset, hf_tns_connect_flags0, ett_tns_conn_flag, tns_connect_flags, ENC_BIG_ENDIAN0x00000000);
7265 offset += 1;
7266
7267 proto_tree_add_bitmask(accept_tree, tvb, offset, hf_tns_connect_flags1, ett_tns_conn_flag, tns_connect_flags, ENC_BIG_ENDIAN0x00000000);
7268
7269 /* From version 315 the session data unit is offered again as 32
7270 * bits, 24 bytes into the ACCEPT, and from 318 a flags2 word follows
7271 * at 33 - both ahead of any connect data. */
7272 version = tvb_get_ntohs(tvb, tns_offset + 8);
7273 if ( version >= 315 && accept_offset >= 8 + 24 + 4 && tvb_bytes_exist(tvb, tns_offset + 8 + 24, 4) )
7274 proto_tree_add_item(accept_tree, hf_tns_accept_sdu, tvb, tns_offset + 8 + 24, 4, ENC_BIG_ENDIAN0x00000000);
7275 if ( version >= 318 && accept_offset >= 8 + 33 + 4 && tvb_bytes_exist(tvb, tns_offset + 8 + 33, 4) )
7276 proto_tree_add_bitmask(accept_tree, tvb, tns_offset + 8 + 33, hf_tns_accept_flags2,
7277 ett_tns_accept_flags2, tns_accept_flags2, ENC_BIG_ENDIAN0x00000000);
7278
7279 if ( accept_len > 0)
7280 {
7281 proto_tree_add_item(accept_tree, hf_tns_accept_data, tvb,
7282 tns_offset+accept_offset, -1, ENC_ASCII0x00000000);
7283 }
7284 return;
7285}
7286
7287
7288static void dissect_tns_refuse(tvbuff_t *tvb, int offset, packet_info *pinfo _U___attribute__((unused)), proto_tree *tns_tree)
7289{
7290 /* TODO
7291 * According to some reverse engineers, the refuse packet is also sent when the login fails.
7292 * Byte 54 shows if this is due to invalid ID (0x02) or password (0x03).
7293 * At now we do not have pcaps with such messages to check this statement.
7294 */
7295 proto_tree *refuse_tree;
7296
7297 refuse_tree = proto_tree_add_subtree(tns_tree, tvb, offset, -1,
7298 ett_tns_refuse, NULL((void*)0), "Refuse");
7299
7300 proto_tree_add_item(refuse_tree, hf_tns_refuse_reason_user, tvb,
7301 offset, 1, ENC_BIG_ENDIAN0x00000000);
7302 offset += 1;
7303
7304 proto_tree_add_item(refuse_tree, hf_tns_refuse_reason_system, tvb,
7305 offset, 1, ENC_BIG_ENDIAN0x00000000);
7306 offset += 1;
7307
7308 proto_tree_add_item(refuse_tree, hf_tns_refuse_data_length, tvb,
7309 offset, 2, ENC_BIG_ENDIAN0x00000000);
7310 offset += 2;
7311
7312 proto_tree_add_item(refuse_tree, hf_tns_refuse_data, tvb,
7313 offset, -1, ENC_ASCII0x00000000);
7314}
7315
7316
7317static void dissect_tns_abort(tvbuff_t *tvb, int offset, packet_info *pinfo _U___attribute__((unused)), proto_tree *tns_tree)
7318{
7319 proto_tree *abort_tree;
7320
7321 abort_tree = proto_tree_add_subtree(tns_tree, tvb, offset, -1,
7322 ett_tns_abort, NULL((void*)0), "Abort");
7323
7324 proto_tree_add_item(abort_tree, hf_tns_abort_reason_user, tvb,
7325 offset, 1, ENC_BIG_ENDIAN0x00000000);
7326 offset += 1;
7327
7328 proto_tree_add_item(abort_tree, hf_tns_abort_reason_system, tvb,
7329 offset, 1, ENC_BIG_ENDIAN0x00000000);
7330 offset += 1;
7331
7332 proto_tree_add_item(abort_tree, hf_tns_abort_data, tvb,
7333 offset, -1, ENC_ASCII0x00000000);
7334}
7335
7336
7337static void dissect_tns_marker(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tns_tree, int is_attention)
7338{
7339 proto_tree *marker_tree;
7340
7341 marker_tree = proto_tree_add_subtree(tns_tree, tvb, offset, -1,
7342 ett_tns_marker, NULL((void*)0), is_attention ? "Attention" : "Marker");
7343
7344 proto_tree_add_item(marker_tree, hf_tns_marker_type, tvb,
7345 offset, 1, ENC_BIG_ENDIAN0x00000000);
7346 offset += 1;
7347
7348 proto_tree_add_item(marker_tree, hf_tns_marker_data_byte, tvb,
7349 offset, 1, ENC_BIG_ENDIAN0x00000000);
7350 offset += 1;
7351
7352 /* The last byte selects break vs reset for a data marker. */
7353 if ( tvb_reported_length_remaining(tvb, offset) > 0 )
7354 {
7355 uint32_t func = tvb_get_uint8(tvb, offset);
7356 proto_tree_add_item(marker_tree, hf_tns_marker_function, tvb,
7357 offset, 1, ENC_BIG_ENDIAN0x00000000);
7358 col_append_fstr(pinfo->cinfo, COL_INFO, ", %s",
7359 val_to_str_const(func, tns_marker_functions, "Unknown"));
7360 }
7361}
7362
7363static void dissect_tns_redirect(tvbuff_t *tvb, int offset, packet_info *pinfo _U___attribute__((unused)), proto_tree *tns_tree)
7364{
7365 proto_tree *redirect_tree;
7366
7367 redirect_tree = proto_tree_add_subtree(tns_tree, tvb, offset, -1,
7368 ett_tns_redirect, NULL((void*)0), "Redirect");
7369
7370 proto_tree_add_item(redirect_tree, hf_tns_redirect_data_length, tvb,
7371 offset, 2, ENC_BIG_ENDIAN0x00000000);
7372 offset += 2;
7373
7374 proto_tree_add_item(redirect_tree, hf_tns_redirect_data, tvb,
7375 offset, -1, ENC_ASCII0x00000000);
7376}
7377
7378static void dissect_tns_control(tvbuff_t *tvb, int offset, packet_info *pinfo _U___attribute__((unused)), proto_tree *tns_tree)
7379{
7380 proto_tree *control_tree;
7381
7382 control_tree = proto_tree_add_subtree(tns_tree, tvb, offset, -1,
7383 ett_tns_control, NULL((void*)0), "Control");
7384
7385 proto_tree_add_item(control_tree, hf_tns_control_cmd, tvb,
7386 offset, 2, ENC_BIG_ENDIAN0x00000000);
7387 offset += 2;
7388
7389 proto_tree_add_item(control_tree, hf_tns_control_data, tvb,
7390 offset, -1, ENC_NA0x00000000);
7391}
7392
7393static unsigned
7394get_tns_pdu_len(packet_info *pinfo _U___attribute__((unused)), tvbuff_t *tvb, int offset, void *data _U___attribute__((unused)))
7395{
7396 /*
7397 * Get the 16-bit length of the TNS message, including header
7398 */
7399 unsigned length = tvb_get_ntohs(tvb, offset);
7400 offset += 4;
7401 uint8_t type = tvb_get_uint8(tvb, offset);
7402 /* Type 0xf (data descriptor, LOB/FILE data) has data which follows
7403 * immediately (no new PDU header) but is not counted in the PDU
7404 * length field either.
7405 */
7406 if (type == TNS_TYPE_DD15) {
7407 offset += 8;
7408 if (!tvb_bytes_exist(tvb, offset, 4)) {
7409 /* return 0 makes tcp_dissect_pdus() report
7410 * DESEGMENT_ONE_MORE_SEGMENT to the TCP dissector.
7411 */
7412 return 0;
7413 }
7414 unsigned dd_len = tvb_get_ntohl(tvb, offset);
7415 return length + dd_len;
7416 }
7417 return length;
7418}
7419
7420static unsigned
7421get_tns_pdu_len_nochksum(packet_info *pinfo _U___attribute__((unused)), tvbuff_t *tvb, int offset, void *data _U___attribute__((unused)))
7422{
7423 /*
7424 * Get the 32-bit length of the TNS message, including header
7425 */
7426 unsigned length = tvb_get_ntohl(tvb, offset);
7427 offset += 4;
7428 uint8_t type = tvb_get_uint8(tvb, offset);
7429 /* Type 0xf (data descriptor, LOB/FILE data) has data which follows
7430 * immediately (no new PDU header) but is not counted in the PDU
7431 * length field either.
7432 */
7433 if (type == TNS_TYPE_DD15) {
7434 offset += 8;
7435 if (!tvb_bytes_exist(tvb, offset, 4)) {
7436 /* return 0 makes tcp_dissect_pdus() report
7437 * DESEGMENT_ONE_MORE_SEGMENT to the TCP dissector.
7438 */
7439 return 0;
7440 }
7441 unsigned dd_len = tvb_get_ntohl(tvb, offset);
7442 return length + dd_len;
7443 }
7444
7445 return length;
7446}
7447
7448static int
7449dissect_tns(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
7450{
7451 uint32_t length;
7452 uint16_t chksum;
7453 uint8_t type;
7454
7455 /*
7456 * First, do a sanity check to make sure what we have
7457 * starts with a TNS PDU.
7458 */
7459 if (tvb_bytes_exist(tvb, 4, 1)) {
7460 /*
7461 * Well, we have the packet type; let's make sure
7462 * it's a known type.
7463 */
7464 type = tvb_get_uint8(tvb, 4);
7465 if (type < TNS_TYPE_CONNECT1 || type > TNS_TYPE_MAX19)
7466 return 0; /* it's not a known type */
7467 }
7468
7469 /*
7470 * In some messages (observed in Oracle12c) packet length has 4 bytes
7471 * instead of 2.
7472 *
7473 * If packet length has 2 bytes, length and checksum equals two unsigned
7474 * 16-bit numbers. Packet checksum is generally unused (equal zero),
7475 * but 10g client may set 2nd byte to 4.
7476 *
7477 * Else, Oracle 12c combine these two 16-bit numbers into one 32-bit.
7478 * This number represents the packet length. Checksum is omitted.
7479 */
7480 chksum = tvb_get_ntohs(tvb, 2);
7481
7482 length = (chksum == 0 || chksum == 4) ? 2 : 4;
7483
7484 tcp_dissect_pdus(tvb, pinfo, tree, tns_desegment, TNS_HDR_LEN8,
7485 (length == 2 ? get_tns_pdu_len : get_tns_pdu_len_nochksum),
7486 dissect_tns_pdu, data);
7487
7488 return tvb_captured_length(tvb);
7489}
7490
7491static int
7492dissect_tns_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U___attribute__((unused)))
7493{
7494 proto_tree *tns_tree, *ti;
7495 proto_item *hidden_item;
7496 unsigned offset = 0;
7497 uint32_t length;
7498 uint16_t chksum;
7499 uint8_t type;
7500
7501 col_set_str(pinfo->cinfo, COL_PROTOCOL, "TNS");
7502
7503 col_set_str(pinfo->cinfo, COL_INFO,
7504 (pinfo->match_uint == pinfo->destport) ? "Request" : "Response");
7505
7506 ti = proto_tree_add_item(tree, proto_tns, tvb, 0, -1, ENC_NA0x00000000);
7507 tns_tree = proto_item_add_subtree(ti, ett_tns);
7508
7509 if (pinfo->match_uint == pinfo->destport)
7510 {
7511 hidden_item = proto_tree_add_boolean(tns_tree, hf_tns_request,
7512 tvb, offset, 0, true1);
7513 }
7514 else
7515 {
7516 hidden_item = proto_tree_add_boolean(tns_tree, hf_tns_response,
7517 tvb, offset, 0, true1);
7518 }
7519 proto_item_set_hidden(hidden_item);
7520
7521 chksum = tvb_get_ntohs(tvb, offset+2);
7522 if (chksum == 0 || chksum == 4)
7523 {
7524 proto_tree_add_item_ret_uint(tns_tree, hf_tns_length, tvb, offset,
7525 2, ENC_BIG_ENDIAN0x00000000, &length);
7526 offset += 2;
7527 proto_tree_add_checksum(tns_tree, tvb, offset, hf_tns_packet_checksum,
7528 -1, NULL((void*)0), pinfo, 0, ENC_BIG_ENDIAN0x00000000, PROTO_CHECKSUM_NO_FLAGS0x00);
7529 offset += 2;
7530 }
7531 else
7532 {
7533 /* Oracle 12c uses checksum bytes as part of the packet length. */
7534 proto_tree_add_item_ret_uint(tns_tree, hf_tns_length, tvb, offset,
7535 4, ENC_BIG_ENDIAN0x00000000, &length);
7536 offset += 4;
7537 }
7538
7539 type = tvb_get_uint8(tvb, offset);
7540 proto_tree_add_uint(tns_tree, hf_tns_packet_type, tvb,
7541 offset, 1, type);
7542 offset += 1;
7543
7544 col_append_fstr(pinfo->cinfo, COL_INFO, ", %s (%u)",
7545 val_to_str_const(type, tns_type_vals, "Unknown"), type);
7546
7547 proto_tree_add_item(tns_tree, hf_tns_reserved_byte, tvb,
7548 offset, 1, ENC_NA0x00000000);
7549 offset += 1;
7550
7551 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);
7552 offset += 2;
7553
7554 switch (type)
7555 {
7556 case TNS_TYPE_CONNECT1:
7557 dissect_tns_connect(tvb,offset,pinfo,tns_tree);
7558 break;
7559 case TNS_TYPE_ACCEPT2:
7560 dissect_tns_accept(tvb,offset,pinfo,tns_tree);
7561 break;
7562 case TNS_TYPE_REFUSE4:
7563 dissect_tns_refuse(tvb,offset,pinfo,tns_tree);
7564 break;
7565 case TNS_TYPE_REDIRECT5:
7566 dissect_tns_redirect(tvb,offset,pinfo,tns_tree);
7567 break;
7568 case TNS_TYPE_ABORT9:
7569 dissect_tns_abort(tvb,offset,pinfo,tns_tree);
7570 break;
7571 case TNS_TYPE_MARKER12:
7572 dissect_tns_marker(tvb,offset,pinfo,tns_tree, 0);
7573 break;
7574 case TNS_TYPE_ATTENTION13:
7575 dissect_tns_marker(tvb,offset,pinfo,tns_tree, 1);
7576 break;
7577 case TNS_TYPE_CONTROL14:
7578 dissect_tns_control(tvb,offset,pinfo,tns_tree);
7579 break;
7580 case TNS_TYPE_DATA6:
7581 dissect_tns_data(tvb,offset,pinfo,tns_tree);
7582 break;
7583 case TNS_TYPE_DD15:
7584 dissect_tns_data_descriptor(tvb,offset,pinfo,tns_tree, length);
7585 break;
7586 default:
7587 call_data_dissector(tvb_new_subset_remaining(tvb, offset), pinfo,
7588 tns_tree);
7589 break;
7590 }
7591
7592 return tvb_captured_length(tvb);
7593}
7594
7595void proto_register_tns(void)
7596{
7597 static hf_register_info hf[] = {
7598 { &hf_tns_response, {
7599 "Response", "tns.response", FT_BOOLEAN, BASE_NONE,
7600 NULL((void*)0), 0x0, "true if TNS response", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
7601 { &hf_tns_request, {
7602 "Request", "tns.request", FT_BOOLEAN, BASE_NONE,
7603 NULL((void*)0), 0x0, "true if TNS request", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
7604 { &hf_tns_length, {
7605 "Packet Length", "tns.length", FT_UINT32, BASE_DEC,
7606 NULL((void*)0), 0x0, "Length of TNS packet", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
7607 { &hf_tns_packet_checksum, {
7608 "Packet Checksum", "tns.packet_checksum", FT_UINT16, BASE_HEX,
7609 NULL((void*)0), 0x0, "Checksum of Packet Data", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
7610 { &hf_tns_header_checksum, {
7611 "Header Checksum", "tns.header_checksum", FT_UINT16, BASE_HEX,
7612 NULL((void*)0), 0x0, "Checksum of Header Data", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
7613
7614 { &hf_tns_version, {
7615 "Version", "tns.version", FT_UINT16, BASE_DEC,
7616 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
7617 { &hf_tns_compat_version, {
7618 "Version (Compatible)", "tns.compat_version", FT_UINT16, BASE_DEC,
7619 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
7620
7621 { &hf_tns_service_options, {
7622 "Service Options", "tns.service_options", FT_UINT16, BASE_HEX,
7623 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
7624
7625 { &hf_tns_sopt_flag_bconn, {
7626 "Broken Connect Notify", "tns.so_flag.bconn", FT_BOOLEAN, 16,
7627 NULL((void*)0), 0x2000, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
7628 { &hf_tns_sopt_flag_pc, {
7629 "Packet Checksum", "tns.so_flag.pc", FT_BOOLEAN, 16,
7630 NULL((void*)0), 0x1000, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
7631 { &hf_tns_sopt_flag_hc, {
7632 "Header Checksum", "tns.so_flag.hc", FT_BOOLEAN, 16,
7633 NULL((void*)0), 0x0800, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
7634 { &hf_tns_sopt_flag_fd, {
7635 "Full Duplex", "tns.so_flag.fd", FT_BOOLEAN, 16,
7636 NULL((void*)0), 0x0400, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
7637 { &hf_tns_sopt_flag_hd, {
7638 "Half Duplex", "tns.so_flag.hd", FT_BOOLEAN, 16,
7639 NULL((void*)0), 0x0200, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
7640 { &hf_tns_sopt_flag_dc1, {
7641 "Don't Care", "tns.so_flag.dc1", FT_BOOLEAN, 16,
7642 NULL((void*)0), 0x0100, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
7643 { &hf_tns_sopt_flag_dc2, {
7644 "Don't Care", "tns.so_flag.dc2", FT_BOOLEAN, 16,
7645 NULL((void*)0), 0x0080, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
7646 { &hf_tns_sopt_flag_dio, {
7647 "Direct IO to Transport", "tns.so_flag.dio", FT_BOOLEAN, 16,
7648 NULL((void*)0), 0x0010, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
7649 { &hf_tns_sopt_flag_ap, {
7650 "Attention Processing", "tns.so_flag.ap", FT_BOOLEAN, 16,
7651 NULL((void*)0), 0x0008, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
7652 { &hf_tns_sopt_flag_ra, {
7653 "Can Receive Attention", "tns.so_flag.ra", FT_BOOLEAN, 16,
7654 NULL((void*)0), 0x0004, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
7655 { &hf_tns_sopt_flag_sa, {
7656 "Can Send Attention", "tns.so_flag.sa", FT_BOOLEAN, 16,
7657 NULL((void*)0), 0x0002, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
7658
7659
7660 { &hf_tns_sdu_size, {
7661 "Session Data Unit Size", "tns.sdu_size", FT_UINT16, BASE_DEC,
7662 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
7663 { &hf_tns_max_tdu_size, {
7664 "Maximum Transmission Data Unit Size", "tns.max_tdu_size", FT_UINT16, BASE_DEC,
7665 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
7666
7667 { &hf_tns_nt_proto_characteristics, {
7668 "NT Protocol Characteristics", "tns.nt_proto_characteristics", FT_UINT16, BASE_HEX,
7669 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
7670 { &hf_tns_ntp_flag_hangon, {
7671 "Hangon to listener connect", "tns.ntp_flag.hangon", FT_BOOLEAN, 16,
7672 NULL((void*)0), 0x8000, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
7673 { &hf_tns_ntp_flag_crel, {
7674 "Confirmed release", "tns.ntp_flag.crel", FT_BOOLEAN, 16,
7675 NULL((void*)0), 0x4000, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
7676 { &hf_tns_ntp_flag_tduio, {
7677 "TDU based IO", "tns.ntp_flag.tduio", FT_BOOLEAN, 16,
7678 NULL((void*)0), 0x2000, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
7679 { &hf_tns_ntp_flag_srun, {
7680 "Spawner running", "tns.ntp_flag.srun", FT_BOOLEAN, 16,
7681 NULL((void*)0), 0x1000, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
7682 { &hf_tns_ntp_flag_dtest, {
7683 "Data test", "tns.ntp_flag.dtest", FT_BOOLEAN, 16,
7684 NULL((void*)0), 0x0800, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
7685 { &hf_tns_ntp_flag_cbio, {
7686 "Callback IO supported", "tns.ntp_flag.cbio", FT_BOOLEAN, 16,
7687 NULL((void*)0), 0x0400, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
7688 { &hf_tns_ntp_flag_asio, {
7689 "ASync IO Supported", "tns.ntp_flag.asio", FT_BOOLEAN, 16,
7690 NULL((void*)0), 0x0200, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
7691 { &hf_tns_ntp_flag_pio, {
7692 "Packet oriented IO", "tns.ntp_flag.pio", FT_BOOLEAN, 16,
7693 NULL((void*)0), 0x0100, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
7694 { &hf_tns_ntp_flag_grant, {
7695 "Can grant connection to another", "tns.ntp_flag.grant", FT_BOOLEAN, 16,
7696 NULL((void*)0), 0x0080, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
7697 { &hf_tns_ntp_flag_handoff, {
7698 "Can handoff connection to another", "tns.ntp_flag.handoff", FT_BOOLEAN, 16,
7699 NULL((void*)0), 0x0040, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
7700 { &hf_tns_ntp_flag_sigio, {
7701 "Generate SIGIO signal", "tns.ntp_flag.sigio", FT_BOOLEAN, 16,
7702 NULL((void*)0), 0x0020, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
7703 { &hf_tns_ntp_flag_sigpipe, {
7704 "Generate SIGPIPE signal", "tns.ntp_flag.sigpipe", FT_BOOLEAN, 16,
7705 NULL((void*)0), 0x0010, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
7706 { &hf_tns_ntp_flag_sigurg, {
7707 "Generate SIGURG signal", "tns.ntp_flag.sigurg", FT_BOOLEAN, 16,
7708 NULL((void*)0), 0x0008, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
7709 { &hf_tns_ntp_flag_urgentio, {
7710 "Urgent IO supported", "tns.ntp_flag.urgentio", FT_BOOLEAN, 16,
7711 NULL((void*)0), 0x0004, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
7712 { &hf_tns_ntp_flag_fdio, {
7713 "Full duplex IO supported", "tns.ntp_flag.dfio", FT_BOOLEAN, 16,
7714 NULL((void*)0), 0x0002, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
7715 { &hf_tns_ntp_flag_testop, {
7716 "Test operation", "tns.ntp_flag.testop", FT_BOOLEAN, 16,
7717 NULL((void*)0), 0x0001, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
7718
7719
7720
7721
7722 { &hf_tns_line_turnaround, {
7723 "Line Turnaround Value", "tns.line_turnaround", FT_UINT16, BASE_DEC,
7724 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
7725 { &hf_tns_value_of_one, {
7726 "Value of 1 in Hardware", "tns.value_of_one", FT_BYTES, BASE_NONE,
7727 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
7728
7729 { &hf_tns_connect_data_length, {
7730 "Length of Connect Data", "tns.connect_data_length", FT_UINT16,
7731 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) }},
7732 { &hf_tns_connect_data_offset, {
7733 "Offset to Connect Data", "tns.connect_data_offset", FT_UINT16, BASE_DEC,
7734 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
7735 { &hf_tns_connect_data_max, {
7736 "Maximum Receivable Connect Data", "tns.connect_data_max", FT_UINT32, BASE_DEC,
7737 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
7738
7739 { &hf_tns_connect_flags0, {
7740 "Connect Flags 0", "tns.connect_flags0", FT_UINT8, BASE_HEX,
7741 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
7742 { &hf_tns_connect_flags1, {
7743 "Connect Flags 1", "tns.connect_flags1", FT_UINT8, BASE_HEX,
7744 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
7745
7746 { &hf_tns_conn_flag_nareq, {
7747 "NA services required", "tns.connect_flags.nareq", FT_BOOLEAN, 8,
7748 NULL((void*)0), 0x10, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
7749 { &hf_tns_conn_flag_nalink, {
7750 "NA services linked in", "tns.connect_flags.nalink", FT_BOOLEAN, 8,
7751 NULL((void*)0), 0x08, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
7752 { &hf_tns_conn_flag_enablena, {
7753 "NA services enabled", "tns.connect_flags.enablena", FT_BOOLEAN, 8,
7754 NULL((void*)0), 0x04, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
7755 { &hf_tns_conn_flag_ichg, {
7756 "Interchange is involved", "tns.connect_flags.ichg", FT_BOOLEAN, 8,
7757 NULL((void*)0), 0x02, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
7758 { &hf_tns_conn_flag_wantna, {
7759 "NA services wanted", "tns.connect_flags.wantna", FT_BOOLEAN, 8,
7760 NULL((void*)0), 0x01, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
7761
7762
7763 { &hf_tns_trace_cf1, {
7764 "Trace Cross Facility Item 1", "tns.trace_cf1", FT_UINT32, BASE_HEX,
7765 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
7766 { &hf_tns_trace_cf2, {
7767 "Trace Cross Facility Item 2", "tns.trace_cf2", FT_UINT32, BASE_HEX,
7768 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
7769 { &hf_tns_trace_cid, {
7770 "Trace Unique Connection ID", "tns.trace_cid", FT_UINT64, BASE_HEX,
7771 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
7772 { &hf_tns_connect_data, {
7773 "Connect Data", "tns.connect_data", FT_STRING, BASE_NONE,
7774 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
7775
7776 { &hf_tns_accept_data_length, {
7777 "Accept Data Length", "tns.accept_data_length", FT_UINT16,
7778 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) }},
7779 { &hf_tns_accept_data, {
7780 "Accept Data", "tns.accept_data", FT_STRING, BASE_NONE,
7781 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
7782 { &hf_tns_accept_sdu, {
7783 "Session Data Unit Size (32-bit)", "tns.accept_sdu", FT_UINT32, BASE_DEC,
7784 NULL((void*)0), 0x0, "The session data unit a version 315 or later ACCEPT offers, past the 16-bit field's reach", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
7785 { &hf_tns_accept_flags2, {
7786 "Flags 2", "tns.accept_flags2", FT_UINT32, BASE_HEX,
7787 NULL((void*)0), 0x0, "What a version 318 or later server offers the client", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
7788 { &hf_tns_accept_flags2_check_oob, {
7789 "Check Out-of-Band", "tns.accept_flags2.check_oob", FT_BOOLEAN, 32,
7790 NULL((void*)0), 0x00000001, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
7791 { &hf_tns_accept_flags2_end_of_response, {
7792 "End of Response", "tns.accept_flags2.end_of_response", FT_BOOLEAN, 32,
7793 NULL((void*)0), 0x02000000, "Replies end with an end-of-response marker, so the client can pipeline calls", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
7794 { &hf_tns_accept_flags2_fast_auth, {
7795 "Fast Authentication", "tns.accept_flags2.fast_auth", FT_BOOLEAN, 32,
7796 NULL((void*)0), 0x10000000, "The client may send its protocol, data types and session key in one bundle", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
7797 { &hf_tns_accept_data_offset, {
7798 "Offset to Accept Data", "tns.accept_data_offset", FT_UINT16, BASE_DEC,
7799 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
7800
7801 { &hf_tns_refuse_reason_user, {
7802 "Refuse Reason (User)", "tns.refuse_reason_user", FT_UINT8, BASE_HEX,
7803 NULL((void*)0), 0x0, "Refuse Reason from Application", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
7804 { &hf_tns_refuse_reason_system, {
7805 "Refuse Reason (System)", "tns.refuse_reason_system", FT_UINT8, BASE_HEX,
7806 NULL((void*)0), 0x0, "Refuse Reason from System", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
7807 { &hf_tns_refuse_data_length, {
7808 "Refuse Data Length", "tns.refuse_data_length", FT_UINT16,
7809 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) }},
7810 { &hf_tns_refuse_data, {
7811 "Refuse Data", "tns.refuse_data", FT_STRING, BASE_NONE,
7812 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
7813
7814 { &hf_tns_abort_reason_user, {
7815 "Abort Reason (User)", "tns.abort_reason_user", FT_UINT8, BASE_HEX,
7816 NULL((void*)0), 0x0, "Abort Reason from Application", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
7817 { &hf_tns_abort_reason_system, {
7818 "Abort Reason (User)", "tns.abort_reason_system", FT_UINT8, BASE_HEX,
7819 NULL((void*)0), 0x0, "Abort Reason from System", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
7820 { &hf_tns_abort_data, {
7821 "Abort Data", "tns.abort_data", FT_STRING, BASE_NONE,
7822 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
7823
7824 { &hf_tns_marker_type, {
7825 "Marker Type", "tns.marker.type", FT_UINT8, BASE_HEX,
7826 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) }},
7827 { &hf_tns_marker_data_byte, {
7828 "Marker Data Byte", "tns.marker.databyte", FT_UINT8, BASE_HEX,
7829 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
7830 { &hf_tns_marker_function, {
7831 "Marker Function", "tns.marker.function", FT_UINT8, BASE_DEC,
7832 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) }},
7833#if 0
7834 { &hf_tns_marker_data, {
7835 "Marker Data", "tns.marker.data", FT_UINT16, BASE_HEX,
7836 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
7837#endif
7838
7839 { &hf_tns_control_cmd, {
7840 "Control Command", "tns.control.cmd", FT_UINT16, BASE_HEX,
7841 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) }},
7842 { &hf_tns_control_data, {
7843 "Control Data", "tns.control.data", FT_BYTES, BASE_NONE,
7844 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
7845
7846 { &hf_tns_redirect_data_length, {
7847 "Redirect Data Length", "tns.redirect_data_length", FT_UINT16,
7848 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) }},
7849 { &hf_tns_redirect_data, {
7850 "Redirect Data", "tns.redirect_data", FT_STRING, BASE_NONE,
7851 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
7852
7853 { &hf_tns_data_flag, {
7854 "Data Flag", "tns.data_flag", FT_UINT16, BASE_HEX,
7855 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
7856 { &hf_tns_data_flag_send, {
7857 "Send Token", "tns.data_flag.send", FT_BOOLEAN, 16,
7858 NULL((void*)0), 0x1, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
7859 { &hf_tns_data_flag_rc, {
7860 "Request Confirmation", "tns.data_flag.rc", FT_BOOLEAN, 16,
7861 NULL((void*)0), 0x2, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
7862 { &hf_tns_data_flag_c, {
7863 "Confirmation", "tns.data_flag.c", FT_BOOLEAN, 16,
7864 NULL((void*)0), 0x4, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
7865 { &hf_tns_data_flag_reserved, {
7866 "Reserved", "tns.data_flag.reserved", FT_BOOLEAN, 16,
7867 NULL((void*)0), 0x8, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
7868 { &hf_tns_data_flag_more, {
7869 "More Data to Come", "tns.data_flag.more", FT_BOOLEAN, 16,
7870 NULL((void*)0), 0x0020, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
7871 { &hf_tns_data_flag_eof, {
7872 "End of File", "tns.data_flag.eof", FT_BOOLEAN, 16,
7873 NULL((void*)0), 0x0040, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
7874 { &hf_tns_data_flag_dic, {
7875 "Do Immediate Confirmation", "tns.data_flag.dic", FT_BOOLEAN, 16,
7876 NULL((void*)0), 0x0080, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
7877 { &hf_tns_data_flag_rts, {
7878 "Request To Send", "tns.data_flag.rts", FT_BOOLEAN, 16,
7879 NULL((void*)0), 0x0100, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
7880 { &hf_tns_data_flag_sntt, {
7881 "Send NT Trailer", "tns.data_flag.sntt", FT_BOOLEAN, 16,
7882 NULL((void*)0), 0x0200, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
7883 { &hf_tns_data_flag_end_of_request, {
7884 "End of Request", "tns.data_flag.end_of_request", FT_BOOLEAN, 16,
7885 NULL((void*)0), 0x0800, "The packet ends one of a pipeline's calls", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
7886 { &hf_tns_data_flag_begin_pipeline, {
7887 "Begin Pipeline", "tns.data_flag.begin_pipeline", FT_BOOLEAN, 16,
7888 NULL((void*)0), 0x1000, "The packet carries the first call of a pipeline", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
7889 { &hf_tns_data_flag_end_of_response, {
7890 "End of Response", "tns.data_flag.end_of_response", FT_BOOLEAN, 16,
7891 NULL((void*)0), 0x2000, "The packet ends a reply, which closes with an end-of-response marker", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
7892
7893 { &hf_tns_data_id, {
7894 "Data ID", "tns.data_id", FT_UINT32, BASE_HEX,
7895 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) }},
7896 { &hf_tns_data_length, {
7897 "Data Length", "tns.data_length", FT_UINT32,
7898 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) }},
7899
7900 { &hf_tns_data_oci_id, {
7901 "Call ID", "tns.data_oci.id", FT_UINT8, BASE_HEX|BASE_EXT_STRING0x00000200,
7902 &tns_data_oci_subfuncs_ext, 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
7903
7904 { &hf_tns_data_tseq, {
7905 "TSeq", "tns.data_tseq", FT_UINT8, BASE_HEX,
7906 NULL((void*)0), 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
7907
7908 { &hf_tns_data_token, {
7909 "Token", "tns.data.token", FT_UINT64, BASE_DEC,
7910 NULL((void*)0), 0x0, "Call token (23ai); the reply echoes it", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
7911 { &hf_tns_data_piggyback_id, {
7912 /* Also Call ID.
7913 Piggyback is a message what calls a small subset of functions
7914 declared in tns_data_oci_subfuncs. */
7915 "Call ID", "tns.data_piggyback.id", FT_UINT8, BASE_HEX|BASE_EXT_STRING0x00000200,
7916 &tns_data_oci_subfuncs_ext, 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
7917
7918 { &hf_tns_data_unused, {
7919 "Unused", "tns.data.unused", FT_BYTES, BASE_NONE,
7920 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
7921
7922 { &hf_tns_cursor, {
7923 "Cursor", "tns.data.cursor", FT_UINT32, BASE_DEC,
7924 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
7925
7926 { &hf_tns_data_setp_acc_version, {
7927 "Accepted Version", "tns.data_setp_req.acc_vers", FT_UINT8, BASE_DEC,
7928 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
7929 { &hf_tns_data_fastauth_version, {
7930 "Fast Authentication Version", "tns.data_fastauth.version", FT_UINT8, BASE_DEC,
7931 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
7932 { &hf_tns_data_setp_cli_plat, {
7933 "Client Platform", "tns.data_setp_req.cli_plat", FT_STRINGZ, BASE_NONE,
7934 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
7935 { &hf_tns_data_setp_version, {
7936 "Version", "tns.data_setp_resp.version", FT_UINT8, BASE_DEC,
7937 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
7938 { &hf_tns_data_setp_charset, {
7939 "Charset", "tns.data_setp_resp.charset", FT_UINT16, BASE_DEC,
7940 VALS(tns_charsets)((0 ? (const struct _value_string*)0 : ((tns_charsets)))), 0x0, "The database character set", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
7941 { &hf_tns_data_setp_flags, {
7942 "Server Flags", "tns.data_setp_resp.flags", FT_UINT8, BASE_HEX,
7943 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
7944 { &hf_tns_data_setp_ncharset, {
7945 "National Charset", "tns.data_setp_resp.ncharset", FT_UINT16, BASE_DEC,
7946 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) }},
7947 { &hf_tns_data_setp_compile_caps, {
7948 "Compile Capabilities", "tns.data_setp_resp.compile_caps", FT_BYTES, BASE_NONE,
7949 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
7950 { &hf_tns_data_setp_runtime_caps, {
7951 "Runtime Capabilities", "tns.data_setp_resp.runtime_caps", FT_BYTES, BASE_NONE,
7952 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
7953 { &hf_tns_data_setp_field_version, {
7954 "Field Version", "tns.data_setp_resp.field_version", FT_UINT8, BASE_DEC,
7955 VALS(tns_field_versions)((0 ? (const struct _value_string*)0 : ((tns_field_versions))
))
, 0x0, "The highest TTC field version the server offers", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
7956 { &hf_tns_data_setp_banner, {
7957 "Server Banner", "tns.data_setp_resp.banner", FT_STRINGZ, BASE_NONE,
7958 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
7959
7960 { &hf_tns_data_sns_cli_vers, {
7961 "Client Version", "tns.data_sns.cli_vers", FT_UINT32, BASE_CUSTOM,
7962 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) }},
7963 { &hf_tns_data_sns_srv_vers, {
7964 "Server Version", "tns.data_sns.srv_vers", FT_UINT32, BASE_CUSTOM,
7965 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) }},
7966 { &hf_tns_data_sns_srvcnt, {
7967 "Services", "tns.data_sns.srvcnt", FT_UINT16, BASE_DEC,
7968 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
7969 { &hf_tns_data_sns_error, {
7970 "Error", "tns.data_sns.error", FT_UINT8, BASE_DEC,
7971 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
7972 { &hf_tns_data_sns_service, {
7973 "Service", "tns.data_sns.service", FT_UINT16, BASE_DEC,
7974 VALS(tns_sns_services)((0 ? (const struct _value_string*)0 : ((tns_sns_services)))), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
7975 { &hf_tns_data_sns_subpackets, {
7976 "Sub-packets", "tns.data_sns.subpackets", FT_UINT16, BASE_DEC,
7977 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
7978 { &hf_tns_data_sns_svc_error, {
7979 "Service Error", "tns.data_sns.service_error", FT_UINT32, BASE_DEC,
7980 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
7981 { &hf_tns_data_sns_sub_type, {
7982 "Sub-packet Type", "tns.data_sns.sub_type", FT_UINT16, BASE_DEC,
7983 VALS(tns_sns_subpacket_types)((0 ? (const struct _value_string*)0 : ((tns_sns_subpacket_types
))))
, 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
7984 { &hf_tns_data_sns_version, {
7985 "Version", "tns.data_sns.version", FT_UINT32, BASE_HEX,
7986 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
7987 { &hf_tns_data_sns_sub_data, {
7988 "Sub-packet Data", "tns.data_sns.sub_data", FT_BYTES, BASE_NONE,
7989 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
7990 { &hf_tns_data_sns_encryption, {
7991 "Encryption Algorithm", "tns.data_sns.encryption", FT_UINT8, BASE_DEC,
7992 VALS(tns_sns_encryption_algs)((0 ? (const struct _value_string*)0 : ((tns_sns_encryption_algs
))))
, 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
7993 { &hf_tns_data_sns_integrity, {
7994 "Integrity Algorithm", "tns.data_sns.integrity", FT_UINT8, BASE_DEC,
7995 VALS(tns_sns_integrity_algs)((0 ? (const struct _value_string*)0 : ((tns_sns_integrity_algs
))))
, 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
7996
7997 { &hf_tns_data_setdt_charset_in, {
7998 "Charset In", "tns.data_setdt.charset_in", FT_UINT16, BASE_DEC,
7999 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) }},
8000 { &hf_tns_data_setdt_charset_out, {
8001 "Charset Out", "tns.data_setdt.charset_out", FT_UINT16, BASE_DEC,
8002 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) }},
8003 { &hf_tns_data_setdt_flag, {
8004 "Flag", "tns.data_setdt.flag", FT_UINT8, BASE_HEX,
8005 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8006 { &hf_tns_data_setdt_caphdr, {
8007 "Compile Capabilities", "tns.data_setdt.caphdr", FT_BYTES, BASE_NONE,
8008 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8009 { &hf_tns_data_setdt_caphdr_version, {
8010 "Version", "tns.data_setdt.caphdr.version", FT_UINT24, BASE_HEX,
8011 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8012 { &hf_tns_data_setdt_caphdr_flags, {
8013 "Flags", "tns.data_setdt.caphdr.flags", FT_BYTES, BASE_NONE,
8014 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8015 { &hf_tns_data_field_version, {
8016 "Field Version", "tns.data.field_version", FT_UINT8, BASE_DEC,
8017 VALS(tns_field_versions)((0 ? (const struct _value_string*)0 : ((tns_field_versions))
))
, 0x0, "TTC field version in force on the connection", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8018 { &hf_tns_data_setdt_field_version, {
8019 "Field Version", "tns.data_setdt.field_version", FT_UINT8, BASE_DEC,
8020 VALS(tns_field_versions)((0 ? (const struct _value_string*)0 : ((tns_field_versions))
))
, 0x0, "TTC field version the connection uses", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8021 { &hf_tns_data_setdt_tblhdr, {
8022 "Runtime Capabilities", "tns.data_setdt.tblhdr", FT_BYTES, BASE_NONE,
8023 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8024 { &hf_tns_data_setdt_type, {
8025 "Data Type", "tns.data_setdt.type", FT_UINT16, BASE_DEC,
8026 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) }},
8027 { &hf_tns_data_setdt_conv_type, {
8028 "Conversion Type", "tns.data_setdt.conv_type", FT_UINT16, BASE_DEC,
8029 VALS(tns_data_types)((0 ? (const struct _value_string*)0 : ((tns_data_types)))), 0x0, "The type the server sends it as", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8030 { &hf_tns_data_setdt_rep, {
8031 "Representation", "tns.data_setdt.rep", FT_UINT16, BASE_DEC,
8032 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8033 { &hf_tns_data_setdt_idmap, {
8034 "Identity Map", "tns.data_setdt.idmap", FT_BYTES, BASE_NONE,
8035 NULL((void*)0), 0x0, "245 entries: type N -> repr N (default mapping)", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8036 { &hf_tns_data_setdt_overrides, {
8037 "Type Overrides", "tns.data_setdt.overrides", FT_NONE, BASE_NONE,
8038 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8039 { &hf_tns_data_setdt_override_client, {
8040 "Client Type", "tns.data_setdt.override.client", FT_UINT8, BASE_DEC,
8041 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) }},
8042 { &hf_tns_data_setdt_override_repr, {
8043 "Server Repr", "tns.data_setdt.override.repr", FT_UINT8, BASE_DEC,
8044 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) }},
8045 { &hf_tns_data_setdt_override_format, {
8046 "Format", "tns.data_setdt.override.format", FT_UINT8, BASE_DEC,
8047 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8048
8049 { &hf_tns_data_rpa_num_al8o4, {
8050 "Number of al8o4 Words", "tns.data_rpa.num_al8o4", FT_UINT32, BASE_DEC,
8051 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8052 { &hf_tns_data_rpa_al8o4, {
8053 "al8o4", "tns.data_rpa.al8o4", FT_UINT32, BASE_HEX,
8054 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8055 { &hf_tns_data_rpa_al8txl, {
8056 "al8txl", "tns.data_rpa.al8txl", FT_BYTES, BASE_NONE,
8057 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8058 { &hf_tns_data_rpa_num_kv, {
8059 "Number of Key/Value Pairs", "tns.data_rpa.num_kv", FT_UINT32, BASE_DEC,
8060 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8061 { &hf_tns_data_rpa_registration, {
8062 "Registration", "tns.data_rpa.registration", FT_BYTES, BASE_NONE,
8063 NULL((void*)0), 0x0, "Query registration; the last 8 bytes are the query id", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8064 { &hf_tns_data_rpa_num_rowcounts, {
8065 "Number of Row Counts", "tns.data_rpa.num_rowcounts", FT_UINT32, BASE_DEC,
8066 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8067 { &hf_tns_data_rpa_dml_rowcount, {
8068 "DML Row Count", "tns.data_rpa.dml_rowcount", FT_UINT64, BASE_DEC,
8069 NULL((void*)0), 0x0, "Rows one iteration of an array DML affected", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8070 { &hf_tns_data_spb_opcode, {
8071 "Opcode", "tns.data_spb.opcode", FT_UINT8, BASE_DEC,
8072 VALS(tns_spb_opcodes)((0 ? (const struct _value_string*)0 : ((tns_spb_opcodes)))), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8073 { &hf_tns_data_spb_ltxid, {
8074 "Logical Transaction Id", "tns.data_spb.ltxid", FT_BYTES, BASE_NONE,
8075 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8076 { &hf_tns_data_spb_os_pid, {
8077 "OS PID", "tns.data_spb.os_pid", FT_STRING, BASE_NONE,
8078 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8079 { &hf_tns_data_spb_num_kv, {
8080 "Number of Key/Value Pairs", "tns.data_spb.num_kv", FT_UINT32, BASE_DEC,
8081 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8082 { &hf_tns_data_spb_flags, {
8083 "Flags", "tns.data_spb.flags", FT_UINT32, BASE_HEX,
8084 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8085 { &hf_tns_data_spb_session_id, {
8086 "Session Id", "tns.data_spb.session_id", FT_UINT32, BASE_DEC,
8087 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8088 { &hf_tns_data_spb_serial_num, {
8089 "Serial Number", "tns.data_spb.serial_num", FT_UINT16, BASE_DEC,
8090 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8091 { &hf_tns_data_kv_text, {
8092 "Text Value", "tns.data_kv.text", FT_STRING, BASE_NONE,
8093 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8094 { &hf_tns_data_kv_binary, {
8095 "Binary Value", "tns.data_kv.binary", FT_BYTES, BASE_NONE,
8096 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8097 { &hf_tns_data_kv_keyword, {
8098 "Keyword", "tns.data_kv.keyword", FT_UINT16, BASE_DEC,
8099 VALS(tns_kv_keywords)((0 ? (const struct _value_string*)0 : ((tns_kv_keywords)))), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8100 { &hf_tns_data_wrn_code, {
8101 "Warning Code", "tns.data_wrn.code", FT_UINT16, BASE_DEC,
8102 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8103 { &hf_tns_data_wrn_length, {
8104 "Message Length", "tns.data_wrn.length", FT_UINT16, BASE_DEC,
8105 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8106 { &hf_tns_data_wrn_flags, {
8107 "Flags", "tns.data_wrn.flags", FT_UINT16, BASE_HEX,
8108 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8109 { &hf_tns_data_wrn_message, {
8110 "Message", "tns.data_wrn.message", FT_STRING, BASE_NONE,
8111 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8112 { &hf_tns_data_oci_oer_status, {
8113 "Status", "tns.data_oer.oci_status", FT_UINT8, BASE_DEC,
8114 VALS(tns_oci_oer_status_vals)((0 ? (const struct _value_string*)0 : ((tns_oci_oer_status_vals
))))
, 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8115 { &hf_tns_data_oci_oer_seq, {
8116 "End-to-End Sequence", "tns.data_oer.seq", FT_UINT16, BASE_DEC,
8117 NULL((void*)0), 0x0, "A per-session counter the server advances with each reply", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8118 { &hf_tns_data_oci_oer_category, {
8119 "Statement Category", "tns.data_oer.category", FT_UINT8, BASE_DEC,
8120 NULL((void*)0), 0x0, "2 for a statement that produces rows or values, 1 for one that does not", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8121 { &hf_tns_data_oci_oer_error_pos, {
8122 "Error Position", "tns.data_oer.error_pos", FT_UINT8, BASE_DEC,
8123 NULL((void*)0), 0x0, "Offset into the SQL text of the parse error", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8124 { &hf_tns_data_oci_oer_command, {
8125 "Command Type", "tns.data_oer.command_type", FT_UINT8, BASE_DEC,
8126 VALS(tns_command_types)((0 ? (const struct _value_string*)0 : ((tns_command_types)))
)
, 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8127 { &hf_tns_data_oci_oer_call_seq, {
8128 "Call Sequence", "tns.data_oer.call_seq", FT_UINT16, BASE_DEC,
8129 NULL((void*)0), 0x0, "Sequence number of the call this status answers", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8130 { &hf_tns_data_auth_mode, {
8131 "Authentication Mode", "tns.data_auth.mode", FT_UINT32, BASE_HEX,
8132 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8133 { &hf_tns_data_auth_mode_logon, {
8134 "Logon", "tns.data_auth.mode.logon", FT_BOOLEAN, 32,
8135 NULL((void*)0), 0x00000001, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8136 { &hf_tns_data_auth_mode_change_password, {
8137 "Change Password", "tns.data_auth.mode.change_password", FT_BOOLEAN, 32,
8138 NULL((void*)0), 0x00000002, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8139 { &hf_tns_data_auth_mode_sysdba, {
8140 "SYSDBA", "tns.data_auth.mode.sysdba", FT_BOOLEAN, 32,
8141 NULL((void*)0), 0x00000020, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8142 { &hf_tns_data_auth_mode_sysoper, {
8143 "SYSOPER", "tns.data_auth.mode.sysoper", FT_BOOLEAN, 32,
8144 NULL((void*)0), 0x00000040, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8145 { &hf_tns_data_auth_mode_with_password, {
8146 "With Password", "tns.data_auth.mode.with_password", FT_BOOLEAN, 32,
8147 NULL((void*)0), 0x00000100, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8148 { &hf_tns_data_auth_user, {
8149 "User", "tns.data_auth.user", FT_STRING, BASE_NONE,
8150 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8151 { &hf_tns_data_sta_call_status, {
8152 "Call Status", "tns.data_sta.call_status", FT_UINT32, BASE_HEX,
8153 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8154 { &hf_tns_data_sta_seq, {
8155 "End-to-End Sequence", "tns.data_sta.seq", FT_UINT16, BASE_DEC,
8156 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8157 { &hf_tns_data_call_status_txn, {
8158 "Transaction in progress", "tns.data.call_status.txn_in_progress", FT_BOOLEAN, 32,
8159 NULL((void*)0), TNS_CALL_STATUS_TXN_IN_PROGRESS0x00000002, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8160 { &hf_tns_data_call_status_sess_release, {
8161 "Session release", "tns.data.call_status.sess_release", FT_BOOLEAN, 32,
8162 NULL((void*)0), TNS_CALL_STATUS_SESS_RELEASE0x00008000, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8163 { &hf_tns_data_oer_call_status, {
8164 "Call Status", "tns.data_oer.call_status", FT_INT32, BASE_DEC,
8165 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8166 { &hf_tns_data_oer_rowcount, {
8167 "Row Count", "tns.data_oer.rowcount", FT_INT32, BASE_DEC,
8168 NULL((void*)0), 0x0, "The rows the call applied - on an error, the rows it managed before failing (11g)", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8169 { &hf_tns_data_oer_err_code, {
8170 "Error Code", "tns.data_oer.err_code", FT_INT32, BASE_DEC,
8171 NULL((void*)0), 0x0, "ORA-NNNNN (0 = success)", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8172 { &hf_tns_data_oer_cursor_id, {
8173 "Cursor Id", "tns.data_oer.cursor_id", FT_INT32, BASE_DEC,
8174 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8175 { &hf_tns_data_oer_rowid, {
8176 "Last Rowid", "tns.data_oer.rowid", FT_STRING, BASE_NONE,
8177 NULL((void*)0), 0x0, "The rowid of the last row the statement touched", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8178 { &hf_tns_data_oer_n_batch_errcodes, {
8179 "Batch Error Codes", "tns.data_oer.n_batch_errcodes", FT_INT32, BASE_DEC,
8180 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8181 { &hf_tns_data_oer_n_batch_offsets, {
8182 "Batch Error Offsets", "tns.data_oer.n_batch_offsets", FT_INT32, BASE_DEC,
8183 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8184 { &hf_tns_data_oer_n_batch_messages, {
8185 "Batch Error Messages", "tns.data_oer.n_batch_messages", FT_INT32, BASE_DEC,
8186 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8187 { &hf_tns_data_oer_err_num_ext, {
8188 "Error Number", "tns.data_oer.err_num", FT_UINT32, BASE_DEC,
8189 NULL((void*)0), 0x0, "The error code at its full width (12.1 and later)", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8190 { &hf_tns_data_oer_rowcount_ext, {
8191 "Row Count (64 bit)", "tns.data_oer.rowcount64", FT_UINT64, BASE_DEC,
8192 NULL((void*)0), 0x0, "The rows the call applied, at full width (12.1 and later)", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8193 { &hf_tns_data_oer_sql_type, {
8194 "SQL Type", "tns.data_oer.sql_type", FT_UINT32, BASE_DEC,
8195 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8196 { &hf_tns_data_oer_checksum, {
8197 "Server Checksum", "tns.data_oer.checksum", FT_UINT32, BASE_HEX,
8198 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8199 { &hf_tns_data_oer_warn_flags, {
8200 "Warning Flags", "tns.data_oer.warn_flags", FT_UINT8, BASE_HEX,
8201 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8202 { &hf_tns_data_oer_warn_compile, {
8203 "Compiled with errors", "tns.data_oer.warn_flags.compilation_error", FT_BOOLEAN, 8,
8204 NULL((void*)0), TNS_WARN_COMPILATION_ERROR0x20, "A PL/SQL object was created in an invalid state", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8205 { &hf_tns_data_oer_message, {
8206 "Message", "tns.data_oer.message", FT_STRING, BASE_NONE,
8207 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8208
8209 { &hf_tns_data_opi_version2_banner_len, {
8210 "Banner Length", "tns.data_opi.vers2.banner_len", FT_UINT8, BASE_DEC,
8211 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8212 { &hf_tns_data_opi_version2_banner, {
8213 "Banner", "tns.data_opi.vers2.banner", FT_STRING, BASE_NONE,
8214 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8215 { &hf_tns_data_opi_version2_vsnum, {
8216 "Version", "tns.data_opi.vers2.version", FT_UINT32, BASE_CUSTOM,
8217 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) }},
8218
8219 { &hf_tns_data_opi_num_of_params, {
8220 "Number of parameters", "tns.data_opi.num_of_params", FT_UINT8, BASE_DEC,
8221 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8222 { &hf_tns_data_opi_param_length, {
8223 "Length", "tns.data_opi.param_length", FT_UINT8, BASE_DEC,
8224 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8225 { &hf_tns_data_opi_param_name, {
8226 "Name", "tns.data_opi.param_name", FT_STRING, BASE_NONE,
8227 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8228 { &hf_tns_data_opi_param_value, {
8229 "Value", "tns.data_opi.param_value", FT_STRING, BASE_NONE,
8230 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8231
8232 { &hf_tns_data_iov_num_binds, {
8233 "Number of Binds", "tns.data_iov.num_binds", FT_UINT32, BASE_DEC,
8234 NULL((void*)0), 0x0, "num_iters * 256 + num_requests", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8235 { &hf_tns_data_iov_bind_dir, {
8236 "Bind Direction", "tns.data_iov.bind_dir", FT_UINT8, BASE_DEC,
8237 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) }},
8238
8239 { &hf_tns_data_bind_actual_len, {
8240 "Actual Length", "tns.data_bind.actual_len", FT_INT32, BASE_DEC,
8241 NULL((void*)0), 0x0, "The returned value's length before it was cut to the declared size: 0 when it fitted, -1 when NULL", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8242 { &hf_tns_data_dcb_num_columns, {
8243 "Number of Columns", "tns.data_dcb.num_columns", FT_UINT32, BASE_DEC,
8244 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8245 { &hf_tns_data_col_type, {
8246 "Data Type", "tns.data_col.type", FT_UINT8, BASE_DEC,
8247 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) }},
8248 { &hf_tns_data_col_precision, {
8249 "Precision", "tns.data_col.precision", FT_UINT8, BASE_DEC,
8250 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8251 { &hf_tns_data_col_scale, {
8252 "Scale", "tns.data_col.scale", FT_INT32, BASE_DEC,
8253 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8254 { &hf_tns_data_col_max_length, {
8255 "Max Data Length", "tns.data_col.max_length", FT_UINT32, BASE_DEC,
8256 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8257 { &hf_tns_data_col_charset, {
8258 "Charset", "tns.data_col.charset", FT_UINT32, BASE_DEC,
8259 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) }},
8260 { &hf_tns_data_col_csform, {
8261 "Charset Form", "tns.data_col.csform", FT_UINT8, BASE_DEC,
8262 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) }},
8263 { &hf_tns_data_col_max_elements, {
8264 "Max Array Elements", "tns.data_col.max_elements", FT_UINT32, BASE_DEC,
8265 NULL((void*)0), 0x0, "Capacity of an array bind", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8266 { &hf_tns_data_bind_num_elements, {
8267 "Array Elements", "tns.data_bind.num_elements", FT_UINT32, BASE_DEC,
8268 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8269 { &hf_tns_data_col_max_size, {
8270 "Max Size", "tns.data_col.max_size", FT_UINT32, BASE_DEC,
8271 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8272 { &hf_tns_data_col_nulls_ok, {
8273 "Nulls Allowed", "tns.data_col.nulls_ok", FT_UINT8, BASE_DEC,
8274 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8275 { &hf_tns_data_col_name, {
8276 "Column Name", "tns.data_col.name", FT_STRING, BASE_NONE,
8277 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8278
8279 { &hf_tns_data_col_uds_flags, {
8280 "UDS Flags", "tns.data_col.uds_flags", FT_UINT32, BASE_HEX,
8281 NULL((void*)0), 0x0, "Marks a JSON column", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8282 { &hf_tns_data_col_domain_schema, {
8283 "Domain Schema", "tns.data_col.domain_schema", FT_STRING, BASE_NONE,
8284 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8285 { &hf_tns_data_col_domain_name, {
8286 "Domain Name", "tns.data_col.domain_name", FT_STRING, BASE_NONE,
8287 NULL((void*)0), 0x0, "The column's SQL domain", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8288 { &hf_tns_data_col_annotation, {
8289 "Annotation", "tns.data_col.annotation", FT_STRING, BASE_NONE,
8290 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8291 { &hf_tns_data_col_vector_dims, {
8292 "Vector Dimensions", "tns.data_col.vector_dims", FT_UINT32, BASE_DEC,
8293 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8294 { &hf_tns_data_col_vector_format, {
8295 "Vector Format", "tns.data_col.vector_format", FT_UINT8, BASE_DEC,
8296 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8297 { &hf_tns_data_rxh_num_requests, {
8298 "Number of Requests", "tns.data_rxh.num_requests", FT_UINT32, BASE_DEC,
8299 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8300 { &hf_tns_data_rxh_iter_num, {
8301 "Iteration Number", "tns.data_rxh.iter_num", FT_UINT32, BASE_DEC,
8302 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8303 { &hf_tns_data_bit_vector, {
8304 "Bit Vector", "tns.data.bit_vector", FT_BYTES, BASE_NONE,
8305 NULL((void*)0), 0x0, "Columns the next row sends; a clear bit repeats the previous row's value", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8306 { &hf_tns_data_bvc_num_cols_sent, {
8307 "Columns Sent", "tns.data_bvc.num_cols_sent", FT_UINT16, BASE_DEC,
8308 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8309 { &hf_tns_data_irs_num_results, {
8310 "Number of Result Sets", "tns.data_irs.num_results", FT_UINT32, BASE_DEC,
8311 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8312 { &hf_tns_data_rxh_num_iters, {
8313 "Number of Iterations", "tns.data_rxh.num_iters", FT_UINT32, BASE_DEC,
8314 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8315
8316 { &hf_tns_data_all8_options, {
8317 "Options", "tns.data_all8.options", FT_UINT32, BASE_HEX,
8318 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8319 { &hf_tns_data_all8_opt_parse, {
8320 "Parse", "tns.data_all8.options.parse", FT_BOOLEAN, 32,
8321 NULL((void*)0), 0x00000001, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8322 { &hf_tns_data_all8_opt_bind, {
8323 "Bind Values Present", "tns.data_all8.options.bind", FT_BOOLEAN, 32,
8324 NULL((void*)0), 0x00000008, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8325 { &hf_tns_data_all8_opt_define, {
8326 "Define Columns Present", "tns.data_all8.options.define", FT_BOOLEAN, 32,
8327 NULL((void*)0), 0x00000010, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8328 { &hf_tns_data_all8_opt_execute, {
8329 "Execute", "tns.data_all8.options.execute", FT_BOOLEAN, 32,
8330 NULL((void*)0), 0x00000020, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8331 { &hf_tns_data_all8_opt_commit, {
8332 "Autocommit", "tns.data_all8.options.commit", FT_BOOLEAN, 32,
8333 NULL((void*)0), 0x00000100, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8334 { &hf_tns_data_all8_opt_plsql, {
8335 "PL/SQL Binds", "tns.data_all8.options.plsql", FT_BOOLEAN, 32,
8336 NULL((void*)0), 0x00000400, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8337 { &hf_tns_data_all8_opt_fetch, {
8338 "Fetch", "tns.data_all8.options.fetch", FT_BOOLEAN, 32,
8339 NULL((void*)0), 0x00000040, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8340 { &hf_tns_data_all8_opt_not_plsql, {
8341 "Not PL/SQL", "tns.data_all8.options.not_plsql", FT_BOOLEAN, 32,
8342 NULL((void*)0), 0x00008000, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8343 { &hf_tns_data_all8_parse_only, {
8344 "Parse Only", "tns.data_all8.parse_only", FT_BOOLEAN, BASE_NONE,
8345 NULL((void*)0), 0x0, "The execute asks for no work: nothing to run, nothing to fetch", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8346 { &hf_tns_data_all8_opt_describe, {
8347 "Describe", "tns.data_all8.options.describe", FT_BOOLEAN, 32,
8348 NULL((void*)0), 0x00020000, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8349 { &hf_tns_data_all8_opt_batch_errors, {
8350 "Batch Errors", "tns.data_all8.options.batch_errors", FT_BOOLEAN, 32,
8351 NULL((void*)0), 0x00080000, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8352 { &hf_tns_data_all8_fetch_rows, {
8353 "Fetch Rows", "tns.data_all8.fetch_rows", FT_UINT32, BASE_DEC,
8354 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8355 { &hf_tns_data_all8_iterations, {
8356 "Execution Count", "tns.data_all8.iterations", FT_UINT32, BASE_DEC,
8357 NULL((void*)0), 0x0, "Number of times a DML statement runs (array DML)", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8358 { &hf_tns_data_all8_prefetch, {
8359 "Prefetch Rows", "tns.data_all8.prefetch", FT_UINT32, BASE_DEC,
8360 NULL((void*)0), 0x0, "Rows a query returns with the execute, before any fetch", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8361 { &hf_tns_data_all8_is_query, {
8362 "Query", "tns.data_all8.is_query", FT_BOOLEAN, BASE_NONE,
8363 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8364 { &hf_tns_data_all8_exec_flags, {
8365 "Execute Flags", "tns.data_all8.exec_flags", FT_UINT32, BASE_HEX,
8366 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8367 { &hf_tns_data_all8_xflag_scrollable, {
8368 "Scrollable", "tns.data_all8.exec_flags.scrollable", FT_BOOLEAN, 32,
8369 NULL((void*)0), 0x00000002, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8370 { &hf_tns_data_all8_xflag_no_cancel_on_eof, {
8371 "No Cancel on EOF", "tns.data_all8.exec_flags.no_cancel_on_eof", FT_BOOLEAN, 32,
8372 NULL((void*)0), 0x00000080, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8373 { &hf_tns_data_all8_xflag_dml_rowcounts, {
8374 "DML Row Counts", "tns.data_all8.exec_flags.dml_rowcounts", FT_BOOLEAN, 32,
8375 NULL((void*)0), 0x00004000, "Return the rows each iteration of an array DML affected", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8376 { &hf_tns_data_all8_xflag_implicit_rs, {
8377 "Implicit Result Sets", "tns.data_all8.exec_flags.implicit_resultset", FT_BOOLEAN, 32,
8378 NULL((void*)0), 0x00008000, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8379 { &hf_tns_data_all8_fetch_orientation, {
8380 "Fetch Orientation", "tns.data_all8.fetch_orientation", FT_UINT32, BASE_HEX,
8381 VALS(tns_fetch_orientations)((0 ? (const struct _value_string*)0 : ((tns_fetch_orientations
))))
, 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8382 { &hf_tns_data_all8_fetch_pos, {
8383 "Fetch Position", "tns.data_all8.fetch_pos", FT_UINT32, BASE_DEC,
8384 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8385 { &hf_tns_data_reexec_iterations, {
8386 "Execution Count", "tns.data_reexec.iterations", FT_UINT32, BASE_DEC,
8387 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8388 { &hf_tns_data_reexec_options2, {
8389 "Options 2", "tns.data_reexec.options2", FT_UINT32, BASE_HEX,
8390 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8391 { &hf_tns_data_reexec_opt2_commit, {
8392 "Autocommit", "tns.data_reexec.options2.commit", FT_BOOLEAN, 32,
8393 NULL((void*)0), 0x00000001, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8394 { &hf_tns_data_all8_oci_preamble, {
8395 "Preamble", "tns.data_all8.oci_preamble", FT_STRING, BASE_NONE,
8396 NULL((void*)0), 0x0, "The fixed execute preamble of an OCI client", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8397 { &hf_tns_data_all8_define_count, {
8398 "Define Count", "tns.data_all8.define_count", FT_UINT32, BASE_DEC,
8399 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8400 { &hf_tns_data_all8_bind_count, {
8401 "Bind Count", "tns.data_all8.bind_count", FT_UINT32, BASE_DEC,
8402 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8403 { &hf_tns_data_all8_sql, {
8404 "SQL Text", "tns.data_all8.sql", FT_STRING, BASE_NONE,
8405 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8406 { &hf_tns_data_bind_value, {
8407 "Bind Value", "tns.data_bind.value", FT_BYTES, BASE_NONE,
8408 NULL((void*)0), 0x0, "Raw type-encoded bind value", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8409 { &hf_tns_data_fetch_rows, {
8410 "Rows to Fetch", "tns.data_fetch.rows", FT_UINT32, BASE_DEC,
8411 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8412 { &hf_tns_data_kod_opcode, {
8413 "Describe Opcode", "tns.data_kod.opcode", FT_UINT32, BASE_DEC,
8414 VALS(tns_kod_opcodes)((0 ? (const struct _value_string*)0 : ((tns_kod_opcodes)))), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8415 { &hf_tns_data_kod_kind, {
8416 "Message Kind", "tns.data_kod.kind", FT_UINT8, BASE_DEC,
8417 VALS(tns_kod_kinds)((0 ? (const struct _value_string*)0 : ((tns_kod_kinds)))), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8418 { &hf_tns_data_kod_schema, {
8419 "Schema", "tns.data_kod.schema", FT_STRING, BASE_NONE,
8420 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8421 { &hf_tns_data_kod_name, {
8422 "Type Name", "tns.data_kod.name", FT_STRING, BASE_NONE,
8423 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8424 { &hf_tns_data_kod_oid, {
8425 "Object Id", "tns.data_kod.oid", FT_BYTES, BASE_NONE,
8426 NULL((void*)0), 0x0, "The id of the type described", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8427 { &hf_tns_data_kod_type_oid, {
8428 "Type Id", "tns.data_kod.type_oid", FT_BYTES, BASE_NONE,
8429 NULL((void*)0), 0x0, "The id of the system type the descriptor is an instance of", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8430 { &hf_tns_data_kod_system_type, {
8431 "System Type", "tns.data_kod.system_type", FT_UINT8, BASE_HEX,
8432 VALS(tns_kod_system_types)((0 ? (const struct _value_string*)0 : ((tns_kod_system_types
))))
, 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8433 { &hf_tns_data_kod_image, {
8434 "Descriptor Image", "tns.data_kod.image", FT_BYTES, BASE_NONE,
8435 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8436 { &hf_tns_data_kod_version, {
8437 "Type Version", "tns.data_kod.version", FT_STRING, BASE_NONE,
8438 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8439 { &hf_tns_data_kod_typecode, {
8440 "Typecode", "tns.data_kod.typecode", FT_UINT16, BASE_DEC,
8441 VALS(tns_kod_typecodes)((0 ? (const struct _value_string*)0 : ((tns_kod_typecodes)))
)
, 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8442 { &hf_tns_data_lob_op, {
8443 "LOB Operation", "tns.data_lob.op", FT_UINT32, BASE_HEX,
8444 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) }},
8445 { &hf_tns_data_lob_offset, {
8446 "Source Offset", "tns.data_lob.offset", FT_UINT64, BASE_DEC,
8447 NULL((void*)0), 0x0, "1-based offset into the LOB", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8448 { &hf_tns_data_lob_locator, {
8449 "Locator", "tns.data_lob.locator", FT_BYTES, BASE_NONE,
8450 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8451 { &hf_tns_data_lob_directory, {
8452 "Directory", "tns.data_lob.directory", FT_STRING, BASE_NONE,
8453 NULL((void*)0), 0x0, "The directory object a BFILE's locator names", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8454 { &hf_tns_data_lob_file_name, {
8455 "File Name", "tns.data_lob.file_name", FT_STRING, BASE_NONE,
8456 NULL((void*)0), 0x0, "The file a BFILE's locator names", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8457 { &hf_tns_data_lob_charset, {
8458 "Charset", "tns.data_lob.charset", FT_UINT32, BASE_DEC,
8459 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) }},
8460 { &hf_tns_data_lob_csform, {
8461 "Charset Form", "tns.data_lob.csform", FT_UINT64, BASE_DEC|BASE_VAL64_STRING0x00000400,
8462 VALS64(tns_csform_vals64)((0 ? (const struct _val64_string*)0 : ((tns_csform_vals64)))
)
, 0x0, "The charset form of a temporary LOB to create: 0 for a BLOB", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8463 { &hf_tns_data_lob_type, {
8464 "LOB Type", "tns.data_lob.type", FT_UINT64, BASE_DEC|BASE_VAL64_STRING0x00000400,
8465 VALS64(tns_lob_types64)((0 ? (const struct _val64_string*)0 : ((tns_lob_types64)))), 0x0, "The type of a temporary LOB to create", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8466 { &hf_tns_data_lob_data, {
8467 "Data", "tns.data_lob.data", FT_BYTES, BASE_NONE,
8468 NULL((void*)0), 0x0, "LOB content; UTF-16BE for a CLOB", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8469 { &hf_tns_data_lob_total_size, {
8470 "Total Locator Size", "tns.data_lob.total_size", FT_UINT32, BASE_DEC,
8471 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8472 { &hf_tns_data_pgy_schema, {
8473 "Current Schema", "tns.data_piggyback.schema", FT_STRING, BASE_NONE,
8474 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8475 { &hf_tns_data_pgy_app_ctx_op, {
8476 "Application Context Operation", "tns.data_piggyback.app_context_op", FT_UINT16, BASE_DEC,
8477 VALS(tns_app_ctx_ops)((0 ? (const struct _value_string*)0 : ((tns_app_ctx_ops)))), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8478 { &hf_tns_data_pgy_app_ctx_namespace, {
8479 "Application Context Namespace", "tns.data_piggyback.app_context_namespace", FT_STRING, BASE_NONE,
8480 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8481 { &hf_tns_data_pgy_app_ctx_attr, {
8482 "Attribute", "tns.data_piggyback.app_context_attr", FT_STRING, BASE_NONE,
8483 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8484 { &hf_tns_data_pgy_app_ctx_value, {
8485 "Value", "tns.data_piggyback.app_context_value", FT_STRING, BASE_NONE,
8486 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8487 { &hf_tns_data_pgy_session_state, {
8488 "Session State", "tns.data_piggyback.session_state", FT_UINT64, BASE_HEX,
8489 NULL((void*)0), 0x0, "Request boundary: the client begins or ends a request", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8490 { &hf_tns_data_pgy_e2e_flags, {
8491 "Changed Attributes", "tns.data_piggyback.e2e_flags", FT_UINT32, BASE_HEX,
8492 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8493 { &hf_tns_data_pgy_client_id, {
8494 "Client Identifier", "tns.data_piggyback.client_id", FT_STRING, BASE_NONE,
8495 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8496 { &hf_tns_data_pgy_module, {
8497 "Module", "tns.data_piggyback.module", FT_STRING, BASE_NONE,
8498 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8499 { &hf_tns_data_pgy_action, {
8500 "Action", "tns.data_piggyback.action", FT_STRING, BASE_NONE,
8501 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8502 { &hf_tns_data_pgy_client_info, {
8503 "Client Info", "tns.data_piggyback.client_info", FT_STRING, BASE_NONE,
8504 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8505 { &hf_tns_data_pgy_dbop, {
8506 "Database Operation", "tns.data_piggyback.dbop", FT_STRING, BASE_NONE,
8507 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8508 { &hf_tns_data_pgy_error_set_id, {
8509 "Error Set Id", "tns.data_piggyback.error_set_id", FT_UINT16, BASE_DEC,
8510 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8511 { &hf_tns_data_pgy_error_set_mode, {
8512 "Error Set Mode", "tns.data_piggyback.error_set_mode", FT_UINT8, BASE_DEC,
8513 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8514 { &hf_tns_data_pgy_pipeline_mode, {
8515 "Pipeline Mode", "tns.data_piggyback.pipeline_mode", FT_UINT8, BASE_DEC,
8516 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8517 { &hf_tns_data_pgy_sec_flags, {
8518 "Security Context Flags", "tns.data_piggyback.sec_flags", FT_UINT32, BASE_HEX,
8519 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8520 { &hf_tns_data_pgy_sec_key, {
8521 "Security Context Key", "tns.data_piggyback.sec_key", FT_STRING, BASE_NONE,
8522 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8523 { &hf_tns_data_pgy_sec_value, {
8524 "Security Context Value", "tns.data_piggyback.sec_value", FT_BYTES, BASE_NONE,
8525 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8526 { &hf_tns_data_lob_text, {
8527 "Text", "tns.data_lob.text", FT_STRING, BASE_NONE,
8528 NULL((void*)0), 0x0, "A CLOB's content, decoded as its locator says", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8529 { &hf_tns_data_release_tag, {
8530 "Tag", "tns.data_release.tag", FT_STRING, BASE_NONE,
8531 NULL((void*)0), 0x0, "Session tag for the pool", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8532 { &hf_tns_data_release_mode, {
8533 "Release Mode", "tns.data_release.mode", FT_UINT32, BASE_HEX,
8534 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8535 { &hf_tns_data_release_mode_deauth, {
8536 "Deauthenticate", "tns.data_release.mode.deauthenticate", FT_BOOLEAN, 32,
8537 NULL((void*)0), 0x00000002, "The session is being closed, not just returned", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8538 { &hf_tns_data_aq_queue, {
8539 "Queue", "tns.data_aq.queue", FT_STRING, BASE_NONE,
8540 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8541 { &hf_tns_data_aq_consumer, {
8542 "Consumer", "tns.data_aq.consumer", FT_STRING, BASE_NONE,
8543 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8544 { &hf_tns_data_aq_correlation, {
8545 "Correlation", "tns.data_aq.correlation", FT_STRING, BASE_NONE,
8546 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8547 { &hf_tns_data_aq_exception_queue, {
8548 "Exception Queue", "tns.data_aq.exception_queue", FT_STRING, BASE_NONE,
8549 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8550 { &hf_tns_data_aq_condition, {
8551 "Condition", "tns.data_aq.condition", FT_STRING, BASE_NONE,
8552 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8553 { &hf_tns_data_aq_msgid, {
8554 "Message Id", "tns.data_aq.msgid", FT_BYTES, BASE_NONE,
8555 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8556 { &hf_tns_data_aq_toid, {
8557 "Payload Type OID", "tns.data_aq.toid", FT_BYTES, BASE_NONE,
8558 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8559 { &hf_tns_data_aq_payload, {
8560 "Payload", "tns.data_aq.payload", FT_BYTES, BASE_NONE,
8561 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8562 { &hf_tns_data_aq_priority, {
8563 "Priority", "tns.data_aq.priority", FT_UINT32, BASE_DEC,
8564 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8565 { &hf_tns_data_aq_delay, {
8566 "Delay", "tns.data_aq.delay", FT_UINT32, BASE_DEC,
8567 NULL((void*)0), 0x0, "Seconds before the message becomes available", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8568 { &hf_tns_data_aq_expiration, {
8569 "Expiration", "tns.data_aq.expiration", FT_INT32, BASE_DEC,
8570 NULL((void*)0), 0x0, "Seconds the message stays available, -1 for ever", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8571 { &hf_tns_data_aq_attempts, {
8572 "Attempts", "tns.data_aq.attempts", FT_UINT32, BASE_DEC,
8573 NULL((void*)0), 0x0, "Delivery attempts so far", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8574 { &hf_tns_data_aq_state, {
8575 "State", "tns.data_aq.state", FT_UINT32, BASE_DEC,
8576 VALS(tns_aq_states)((0 ? (const struct _value_string*)0 : ((tns_aq_states)))), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8577 { &hf_tns_data_aq_enq_time, {
8578 "Enqueue Time", "tns.data_aq.enq_time", FT_STRING, BASE_NONE,
8579 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8580 { &hf_tns_data_aq_visibility, {
8581 "Visibility", "tns.data_aq.visibility", FT_UINT32, BASE_DEC,
8582 VALS(tns_aq_visibility)((0 ? (const struct _value_string*)0 : ((tns_aq_visibility)))
)
, 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8583 { &hf_tns_data_aq_deq_mode, {
8584 "Dequeue Mode", "tns.data_aq.deq_mode", FT_UINT32, BASE_DEC,
8585 VALS(tns_aq_deq_modes)((0 ? (const struct _value_string*)0 : ((tns_aq_deq_modes)))), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8586 { &hf_tns_data_aq_navigation, {
8587 "Navigation", "tns.data_aq.navigation", FT_UINT32, BASE_DEC,
8588 VALS(tns_aq_navigation)((0 ? (const struct _value_string*)0 : ((tns_aq_navigation)))
)
, 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8589 { &hf_tns_data_aq_wait, {
8590 "Wait", "tns.data_aq.wait", FT_INT32, BASE_DEC,
8591 NULL((void*)0), 0x0, "Seconds to wait for a message; -1 waits for ever", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8592 { &hf_tns_data_aq_flags, {
8593 "Flags", "tns.data_aq.flags", FT_UINT32, BASE_HEX,
8594 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8595 { &hf_tns_data_aq_delivery_flags, {
8596 "Delivery Flags", "tns.data_aq.delivery_flags", FT_UINT32, BASE_HEX,
8597 NULL((void*)0), 0x0, "0x02 marks a buffered message", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8598 { &hf_tns_data_aq_array_op, {
8599 "Array Operation", "tns.data_aq.array_op", FT_UINT32, BASE_DEC,
8600 VALS(tns_aq_array_ops)((0 ? (const struct _value_string*)0 : ((tns_aq_array_ops)))), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8601 { &hf_tns_data_aq_num_messages, {
8602 "Messages", "tns.data_aq.num_messages", FT_UINT32, BASE_DEC,
8603 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8604 { &hf_tns_data_tpc_switch_op, {
8605 "Operation", "tns.data_tpc.switch_op", FT_UINT32, BASE_HEX,
8606 VALS(tns_tpc_switch_ops)((0 ? (const struct _value_string*)0 : ((tns_tpc_switch_ops))
))
, 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8607 { &hf_tns_data_tpc_change_op, {
8608 "Operation", "tns.data_tpc.change_op", FT_UINT32, BASE_HEX,
8609 VALS(tns_tpc_change_ops)((0 ? (const struct _value_string*)0 : ((tns_tpc_change_ops))
))
, 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8610 { &hf_tns_data_tpc_format_id, {
8611 "XID Format Id", "tns.data_tpc.format_id", FT_UINT32, BASE_DEC,
8612 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8613 { &hf_tns_data_tpc_gtrid, {
8614 "Global Transaction Id", "tns.data_tpc.gtrid", FT_BYTES, BASE_NONE,
8615 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8616 { &hf_tns_data_tpc_bqual, {
8617 "Branch Qualifier", "tns.data_tpc.bqual", FT_BYTES, BASE_NONE,
8618 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8619 { &hf_tns_data_tpc_flags, {
8620 "Flags", "tns.data_tpc.flags", FT_UINT32, BASE_HEX,
8621 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8622 { &hf_tns_data_tpc_timeout, {
8623 "Timeout", "tns.data_tpc.timeout", FT_UINT32, BASE_DEC,
8624 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8625 { &hf_tns_data_tpc_state, {
8626 "State", "tns.data_tpc.state", FT_UINT32, BASE_DEC,
8627 VALS(tns_tpc_states)((0 ? (const struct _value_string*)0 : ((tns_tpc_states)))), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8628 { &hf_tns_data_tpc_context, {
8629 "Transaction Context", "tns.data_tpc.context", FT_BYTES, BASE_NONE,
8630 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8631 { &hf_tns_data_tpc_app_value, {
8632 "Application Value", "tns.data_tpc.app_value", FT_UINT32, BASE_DEC,
8633 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8634 { &hf_tns_data_tpc_internal_name, {
8635 "Internal Name", "tns.data_tpc.internal_name", FT_STRING, BASE_NONE,
8636 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8637 { &hf_tns_data_tpc_external_name, {
8638 "External Name", "tns.data_tpc.external_name", FT_STRING, BASE_NONE,
8639 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8640 { &hf_tns_data_lob_flag, {
8641 "Result", "tns.data_lob.flag", FT_BOOLEAN, BASE_NONE,
8642 NULL((void*)0), 0x0, "Whether the LOB is open, or the file exists", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8643 { &hf_tns_data_lob_amount, {
8644 "Amount", "tns.data_lob.amount", FT_UINT64, BASE_DEC,
8645 NULL((void*)0), 0x0, "Characters for a CLOB, bytes for a BLOB; the mode for OPEN", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8646 { &hf_tns_data_col_value, {
8647 "Column Value", "tns.data_col.value", FT_BYTES, BASE_NONE,
8648 NULL((void*)0), 0x0, "Raw type-encoded row column value", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8649
8650 { &hf_tns_data_lob_size, {
8651 "LOB Size", "tns.data_lob.size", FT_UINT64, BASE_DEC,
8652 NULL((void*)0), 0x0, "Characters for a CLOB, bytes for a BLOB", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8653 { &hf_tns_data_lob_chunk_size, {
8654 "LOB Chunk Size", "tns.data_lob.chunk_size", FT_UINT32, BASE_DEC,
8655 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8656 { &hf_tns_data_json_image, {
8657 "OSON Image", "tns.data_json.image", FT_BYTES, BASE_NONE,
8658 NULL((void*)0), 0x0, "Binary JSON (OSON) value", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8659 { &hf_tns_data_vector_image, {
8660 "Vector Image", "tns.data_vector.image", FT_BYTES, BASE_NONE,
8661 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8662 { &hf_tns_data_obj_toid, {
8663 "Type OID", "tns.data_obj.toid", FT_BYTES, BASE_NONE,
8664 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8665 { &hf_tns_data_obj_image, {
8666 "Object Image", "tns.data_obj.image", FT_BYTES, BASE_NONE,
8667 NULL((void*)0), 0x0, "Packed object attributes, or an XMLType document", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8668 { &hf_tns_data_descriptor_row_count, {
8669 "Row Count", "tns.data_descriptor.row_count", FT_UINT32, BASE_DEC,
8670 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8671 { &hf_tns_data_descriptor_row_size, {
8672 "Row Size", "tns.data_descriptor.row_size", FT_UINT32, BASE_DEC,
8673 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8674
8675 { &hf_tns_reserved_byte, {
8676 "Reserved Byte", "tns.reserved_byte", FT_BYTES, BASE_NONE,
8677 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
8678 { &hf_tns_packet_type, {
8679 "Packet Type", "tns.type", FT_UINT8, BASE_DEC,
8680 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) }}
8681
8682 };
8683
8684 static int *ett[] = {
8685 &ett_tns,
8686 &ett_tns_connect,
8687 &ett_tns_accept,
8688 &ett_tns_refuse,
8689 &ett_tns_abort,
8690 &ett_tns_redirect,
8691 &ett_tns_marker,
8692 &ett_tns_attention,
8693 &ett_tns_control,
8694 &ett_tns_data,
8695 &ett_tns_data_flag,
8696 &ett_tns_acc_versions,
8697 &ett_tns_opi_params,
8698 &ett_tns_opi_par,
8699 &ett_tns_sopt_flag,
8700 &ett_tns_ntp_flag,
8701 &ett_tns_conn_flag,
8702 &ett_tns_accept_flags2,
8703 &ett_tns_rows,
8704 &ett_tns_setdt_caphdr,
8705 &ett_tns_setdt_overrides,
8706 &ett_tns_setdt_override,
8707 &ett_tns_oer,
8708 &ett_tns_kod,
8709 &ett_tns_app_ctx,
8710 &ett_tns_call_status,
8711 &ett_tns_warn_flags,
8712 &ett_tns_auth_mode,
8713 &ett_tns_sns_service,
8714 &ett_tns_sns_subpacket,
8715 &ett_tns_release_mode,
8716 &ett_tns_aq_props,
8717 &ett_tns_rpa,
8718 &ett_tns_kv,
8719 &ett_tns_iov,
8720 &ett_tns_dcb_col,
8721 &ett_tns_all8_options,
8722 &ett_tns_all8_i4,
8723 &ett_tns_all8_exec_flags,
8724 &ett_tns_binds,
8725 &ett_tns_bind,
8726 &ett_tns_defines,
8727 &ett_tns_reexec_options2,
8728 &ett_tns_bind_row,
8729 &ett_tns_rxd_row,
8730 &ett_tns_value,
8731 &ett_tns_irs,
8732 &ett_tns_out_binds,
8733 &ett_sql
8734 };
8735
8736 static ei_register_info ei[] = {
8737 { &ei_tns_connect_data_next_packet, { "tns.connect_data.next_packet", PI_REQUEST_CODE0x04000000, PI_CHAT0x00200000, "Long Connect Data (over 230 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)}}
}},
8738 { &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)}}
}},
8739 { &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)}}
}},
8740 { &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)}}
}},
8741 { &ei_tns_data_value_truncated, { "tns.data_bind.truncated", PI_RESPONSE_CODE0x03000000, PI_WARN0x00600000, "The value was cut to the size the client declared", 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)}}
}},
8742 { &ei_tns_data_compilation_error, { "tns.data_oer.compilation_error", PI_RESPONSE_CODE0x03000000, PI_NOTE0x00400000, "The statement created a PL/SQL object that compiled with errors", 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)}}
}},
8743 { &ei_tns_data_encrypted, { "tns.data.encrypted", PI_DECRYPTION0x0c000000, PI_NOTE0x00400000, "Encrypted by native network encryption", 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)}}
}},
8744 };
8745
8746 module_t *tns_module;
8747 expert_module_t* expert_tns;
8748
8749 proto_tns = proto_register_protocol("Transparent Network Substrate Protocol", "TNS", "tns");
8750 proto_register_field_array(proto_tns, hf, array_length(hf)(sizeof (hf) / sizeof (hf)[0]));
8751 proto_register_subtree_array(ett, array_length(ett)(sizeof (ett) / sizeof (ett)[0]));
8752 expert_tns = expert_register_protocol(proto_tns);
8753 expert_register_field_array(expert_tns, ei, array_length(ei)(sizeof (ei) / sizeof (ei)[0]));
8754 tns_handle = register_dissector("tns", dissect_tns, proto_tns);
8755
8756 tns_module = prefs_register_protocol(proto_tns, NULL((void*)0));
8757 prefs_register_bool_preference(tns_module, "desegment_tns_messages",
8758 "Reassemble TNS messages spanning multiple TCP segments",
8759 "Whether the TNS dissector should reassemble messages spanning multiple TCP segments. "
8760 "To use this option, you must also enable \"Allow subdissectors to reassemble TCP streams\" in the TCP protocol settings.",
8761 &tns_desegment);
8762}
8763
8764void
8765proto_reg_handoff_tns(void)
8766{
8767 dissector_add_uint_with_preference("tcp.port", TCP_PORT_TNS1521, tns_handle);
8768}
8769
8770/*
8771 * Editor modelines - https://www.wireshark.org/tools/modelines.html
8772 *
8773 * Local variables:
8774 * c-basic-offset: 8
8775 * tab-width: 8
8776 * indent-tabs-mode: t
8777 * End:
8778 *
8779 * vi: set shiftwidth=8 tabstop=8 noexpandtab:
8780 * :indentSize=8:tabSize=8:noTabs=false:
8781 */