Bug Summary

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