Bug Summary

File:builds/wireshark/wireshark/epan/dissectors/packet-tns.c
Warning:line 610, 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-09-11-100419-3660-1 -x c /builds/wireshark/wireshark/epan/dissectors/packet-tns.c
1/* packet-tns.c
2 * Routines for Oracle TNS packet dissection
3 *
4 * Wireshark - Network traffic analyzer
5 * By Gerald Combs <gerald@wireshark.org>
6 * Copyright 1998 Gerald Combs
7 *
8 * Copied from packet-tftp.c
9 *
10 * SPDX-License-Identifier: GPL-2.0-or-later
11 */
12
13#include "config.h"
14
15#include <epan/packet.h>
16#include "packet-tcp.h"
17
18#include <epan/prefs.h>
19#include <epan/expert.h>
20#include <epan/conversation.h>
21#include <epan/proto_data.h>
22#include <epan/unit_strings.h>
23
24#include <wsutil/array.h>
25
26void proto_register_tns(void);
27
28#define TNS_HDR_LEN8 8
29
30/* Packet Types */
31#define TNS_TYPE_CONNECT1 1
32#define TNS_TYPE_ACCEPT2 2
33#define TNS_TYPE_ACK3 3
34#define TNS_TYPE_REFUSE4 4
35#define TNS_TYPE_REDIRECT5 5
36#define TNS_TYPE_DATA6 6
37#define TNS_TYPE_NULL7 7
38#define TNS_TYPE_ABORT9 9
39#define TNS_TYPE_RESEND11 11
40#define TNS_TYPE_MARKER12 12
41#define TNS_TYPE_ATTENTION13 13
42#define TNS_TYPE_CONTROL14 14
43#define TNS_TYPE_DD15 15
44#define TNS_TYPE_MAX19 19
45
46/* Data Packet Functions */
47#define SQLNET_SET_PROTOCOL1 1
48#define SQLNET_SET_DATATYPES2 2
49#define SQLNET_USER_OCI_FUNC3 3
50#define SQLNET_RETURN_STATUS4 4
51#define SQLNET_ACCESS_USR_ADDR5 5
52#define SQLNET_ROW_TRANSF_HDR6 6
53#define SQLNET_ROW_TRANSF_DATA7 7
54#define SQLNET_RETURN_OPI_PARAM8 8
55#define SQLNET_FUNCCOMPLETE9 9
56#define SQLNET_NERROR_RET_DEF10 10
57#define SQLNET_IOVEC_4FAST_UPI11 11
58#define SQLNET_LONG_4FAST_UPI12 12
59#define SQLNET_INVOKE_USER_CB13 13
60#define SQLNET_LOB_FILE_DF14 14
61#define SQLNET_WARNING15 15
62#define SQLNET_DESCRIBE_INFO16 16
63#define SQLNET_PIGGYBACK_FUNC17 17
64#define SQLNET_SIG_4UCS18 18
65#define SQLNET_FLUSH_BIND_DATA19 19
66#define SQLNET_SNS0xdeadbeef 0xdeadbeef
67#define SQLNET_XTRN_PROCSERV_R132 32
68#define SQLNET_XTRN_PROCSERV_R268 68
69
70/* Return OPI Parameter's Type */
71#define OPI_VERSION21 1
72#define OPI_OSESSKEY2 2
73#define OPI_OAUTH3 3
74
75/* desegmentation of TNS over TCP */
76static bool_Bool tns_desegment = true1;
77
78static dissector_handle_t tns_handle;
79
80static int proto_tns;
81static int hf_tns_request;
82static int hf_tns_response;
83static int hf_tns_length;
84static int hf_tns_packet_checksum;
85static int hf_tns_header_checksum;
86static int hf_tns_packet_type;
87static int hf_tns_reserved_byte;
88static int hf_tns_version;
89static int hf_tns_compat_version;
90
91static int hf_tns_service_options;
92static int hf_tns_sopt_flag_bconn;
93static int hf_tns_sopt_flag_pc;
94static int hf_tns_sopt_flag_hc;
95static int hf_tns_sopt_flag_fd;
96static int hf_tns_sopt_flag_hd;
97static int hf_tns_sopt_flag_dc1;
98static int hf_tns_sopt_flag_dc2;
99static int hf_tns_sopt_flag_dio;
100static int hf_tns_sopt_flag_ap;
101static int hf_tns_sopt_flag_ra;
102static int hf_tns_sopt_flag_sa;
103
104static int hf_tns_sdu_size;
105static int hf_tns_max_tdu_size;
106
107static int hf_tns_nt_proto_characteristics;
108static int hf_tns_ntp_flag_hangon;
109static int hf_tns_ntp_flag_crel;
110static int hf_tns_ntp_flag_tduio;
111static int hf_tns_ntp_flag_srun;
112static int hf_tns_ntp_flag_dtest;
113static int hf_tns_ntp_flag_cbio;
114static int hf_tns_ntp_flag_asio;
115static int hf_tns_ntp_flag_pio;
116static int hf_tns_ntp_flag_grant;
117static int hf_tns_ntp_flag_handoff;
118static int hf_tns_ntp_flag_sigio;
119static int hf_tns_ntp_flag_sigpipe;
120static int hf_tns_ntp_flag_sigurg;
121static int hf_tns_ntp_flag_urgentio;
122static int hf_tns_ntp_flag_fdio;
123static int hf_tns_ntp_flag_testop;
124
125static int hf_tns_line_turnaround;
126static int hf_tns_value_of_one;
127static int hf_tns_connect_data_length;
128static int hf_tns_connect_data_offset;
129static int hf_tns_connect_data_max;
130
131static int hf_tns_connect_flags0;
132static int hf_tns_connect_flags1;
133static int hf_tns_conn_flag_nareq;
134static int hf_tns_conn_flag_nalink;
135static int hf_tns_conn_flag_enablena;
136static int hf_tns_conn_flag_ichg;
137static int hf_tns_conn_flag_wantna;
138
139static int hf_tns_connect_data;
140static int hf_tns_trace_cf1;
141static int hf_tns_trace_cf2;
142static int hf_tns_trace_cid;
143
144static int hf_tns_accept_data_length;
145static int hf_tns_accept_data_offset;
146static int hf_tns_accept_data;
147
148static int hf_tns_refuse_reason_user;
149static int hf_tns_refuse_reason_system;
150static int hf_tns_refuse_data_length;
151static int hf_tns_refuse_data;
152
153static int hf_tns_abort_reason_user;
154static int hf_tns_abort_reason_system;
155static int hf_tns_abort_data;
156
157static int hf_tns_marker_type;
158static int hf_tns_marker_data_byte;
159/* static int hf_tns_marker_data; */
160
161static int hf_tns_redirect_data_length;
162static int hf_tns_redirect_data;
163
164static int hf_tns_control_cmd;
165static int hf_tns_control_data;
166
167static int hf_tns_data_flag;
168static int hf_tns_data_flag_send;
169static int hf_tns_data_flag_rc;
170static int hf_tns_data_flag_c;
171static int hf_tns_data_flag_reserved;
172static int hf_tns_data_flag_more;
173static int hf_tns_data_flag_eof;
174static int hf_tns_data_flag_dic;
175static int hf_tns_data_flag_rts;
176static int hf_tns_data_flag_sntt;
177
178static int hf_tns_data_id;
179static int hf_tns_data_length;
180static int hf_tns_data_oci_id;
181static int hf_tns_data_tseq;
182static int hf_tns_data_piggyback_id;
183static int hf_tns_data_unused;
184
185static int hf_tns_cursor;
186
187static int hf_tns_data_opi_version2_banner_len;
188static int hf_tns_data_opi_version2_banner;
189static int hf_tns_data_opi_version2_vsnum;
190
191static int hf_tns_data_opi_num_of_params;
192static int hf_tns_data_opi_param_length;
193static int hf_tns_data_opi_param_name;
194static int hf_tns_data_opi_param_value;
195
196static int hf_tns_data_setp_acc_version;
197static int hf_tns_data_setp_cli_plat;
198static int hf_tns_data_setp_version;
199static int hf_tns_data_setp_banner;
200
201static int hf_tns_data_sns_cli_vers;
202static int hf_tns_data_sns_srv_vers;
203static int hf_tns_data_sns_srvcnt;
204
205static int hf_tns_data_setdt_charset_in;
206static int hf_tns_data_setdt_charset_out;
207static int hf_tns_data_setdt_flag;
208static int hf_tns_data_setdt_caphdr;
209static int hf_tns_data_setdt_caphdr_version;
210static int hf_tns_data_setdt_caphdr_flags;
211static int hf_tns_data_setdt_tblhdr;
212static int hf_tns_data_setdt_idmap;
213static int hf_tns_data_setdt_overrides;
214static int hf_tns_data_setdt_override_client;
215static int hf_tns_data_setdt_override_repr;
216static int hf_tns_data_setdt_override_format;
217
218static int hf_tns_data_oer_call_status;
219static int hf_tns_data_oer_rowcount;
220static int hf_tns_data_oer_err_code;
221static int hf_tns_data_oer_cursor_id;
222static int hf_tns_data_oer_n_batch_errcodes;
223static int hf_tns_data_oer_n_batch_offsets;
224static int hf_tns_data_oer_n_batch_messages;
225static int hf_tns_data_oer_message;
226
227static int hf_tns_data_descriptor_row_count;
228static int hf_tns_data_descriptor_row_size;
229
230static int ett_tns;
231static int ett_tns_connect;
232static int ett_tns_accept;
233static int ett_tns_refuse;
234static int ett_tns_abort;
235static int ett_tns_redirect;
236static int ett_tns_marker;
237static int ett_tns_attention;
238static int ett_tns_control;
239static int ett_tns_data;
240static int ett_tns_data_flag;
241static int ett_tns_acc_versions;
242static int ett_tns_opi_params;
243static int ett_tns_opi_par;
244static int ett_tns_sopt_flag;
245static int ett_tns_ntp_flag;
246static int ett_tns_conn_flag;
247static int ett_tns_rows;
248static int ett_tns_setdt_caphdr;
249static int ett_tns_setdt_overrides;
250static int ett_tns_setdt_override;
251static int ett_tns_oer;
252static int ett_sql;
253
254static expert_field ei_tns_connect_data_next_packet;
255static expert_field ei_tns_data_descriptor_size_mismatch;
256static expert_field ei_tns_data_piggyback_cursors;
257
258#define TCP_PORT_TNS1521 1521 /* Not IANA registered */
259
260static int * const tns_connect_flags[] = {
261 &hf_tns_conn_flag_nareq,
262 &hf_tns_conn_flag_nalink,
263 &hf_tns_conn_flag_enablena,
264 &hf_tns_conn_flag_ichg,
265 &hf_tns_conn_flag_wantna,
266 NULL((void*)0)
267};
268
269static int * const tns_service_options[] = {
270 &hf_tns_sopt_flag_bconn,
271 &hf_tns_sopt_flag_pc,
272 &hf_tns_sopt_flag_hc,
273 &hf_tns_sopt_flag_fd,
274 &hf_tns_sopt_flag_hd,
275 &hf_tns_sopt_flag_dc1,
276 &hf_tns_sopt_flag_dc2,
277 &hf_tns_sopt_flag_dio,
278 &hf_tns_sopt_flag_ap,
279 &hf_tns_sopt_flag_ra,
280 &hf_tns_sopt_flag_sa,
281 NULL((void*)0)
282};
283
284static const value_string tns_type_vals[] = {
285 {TNS_TYPE_CONNECT1, "Connect" },
286 {TNS_TYPE_ACCEPT2, "Accept" },
287 {TNS_TYPE_ACK3, "Acknowledge" },
288 {TNS_TYPE_REFUSE4, "Refuse" },
289 {TNS_TYPE_REDIRECT5, "Redirect" },
290 {TNS_TYPE_DATA6, "Data" },
291 {TNS_TYPE_NULL7, "Null" },
292 {TNS_TYPE_ABORT9, "Abort" },
293 {TNS_TYPE_RESEND11, "Resend"},
294 {TNS_TYPE_MARKER12, "Marker"},
295 {TNS_TYPE_ATTENTION13, "Attention"},
296 {TNS_TYPE_CONTROL14, "Control"},
297 {TNS_TYPE_DD15, "Data Descriptor"},
298 {0, NULL((void*)0)}
299};
300
301static const value_string tns_data_funcs[] = {
302 {SQLNET_SET_PROTOCOL1, "Set Protocol"},
303 {SQLNET_SET_DATATYPES2, "Set Datatypes"},
304 {SQLNET_USER_OCI_FUNC3, "User OCI Functions"},
305 {SQLNET_RETURN_STATUS4, "Return Status"},
306 {SQLNET_ACCESS_USR_ADDR5, "Access User Address Space"},
307 {SQLNET_ROW_TRANSF_HDR6, "Row Transfer Header"},
308 {SQLNET_ROW_TRANSF_DATA7, "Row Transfer Data"},
309 {SQLNET_RETURN_OPI_PARAM8, "Return OPI Parameter"},
310 {SQLNET_FUNCCOMPLETE9, "Function Complete"},
311 {SQLNET_NERROR_RET_DEF10, "N Error return definitions follow"},
312 {SQLNET_IOVEC_4FAST_UPI11, "Sending I/O Vec only for fast UPI"},
313 {SQLNET_LONG_4FAST_UPI12, "Sending long for fast UPI"},
314 {SQLNET_INVOKE_USER_CB13, "Invoke user callback"},
315 {SQLNET_LOB_FILE_DF14, "LOB/FILE data follows"},
316 {SQLNET_WARNING15, "Warning messages - may be a set of them"},
317 {SQLNET_DESCRIBE_INFO16, "Describe Information"},
318 {SQLNET_PIGGYBACK_FUNC17, "Piggy back function follow"},
319 {SQLNET_SIG_4UCS18, "Signals special action for untrusted callout support"},
320 {SQLNET_FLUSH_BIND_DATA19, "Flush Out Bind data in DML/w RETURN when error"},
321 {SQLNET_XTRN_PROCSERV_R132, "External Procedures and Services Registrations"},
322 {SQLNET_XTRN_PROCSERV_R268, "External Procedures and Services Registrations"},
323 {SQLNET_SNS0xdeadbeef, "Secure Network Services"},
324 {0, NULL((void*)0)}
325};
326
327/* Oracle TNS native data-type ids. Used by the Set Datatypes
328 * negotiation to label override entries with human names. */
329static const value_string tns_data_types[] = {
330 {1, "VARCHAR"},
331 {2, "NUMBER"},
332 {3, "INTEGER"},
333 {4, "FLOAT"},
334 {5, "STRING"},
335 {6, "VARNUM"},
336 {7, "DECIMAL"},
337 {8, "LONG"},
338 {9, "VCS"},
339 {11, "RID"},
340 {12, "DATE"},
341 {15, "VBI"},
342 {23, "RAW"},
343 {24, "LONG RAW"},
344 {96, "CHAR"},
345 {100, "BINARY_FLOAT"},
346 {101, "BINARY_DOUBLE"},
347 {102, "REFCURSOR"},
348 {104, "ROWID"},
349 {109, "ADT"},
350 {111, "REF"},
351 {112, "CLOB"},
352 {113, "BLOB"},
353 {114, "BFILE"},
354 {116, "RSET"},
355 {180, "TIMESTAMP"},
356 {181, "TIMESTAMP WITH TIME ZONE"},
357 {182, "INTERVAL YEAR TO MONTH"},
358 {183, "INTERVAL DAY TO SECOND"},
359 {208, "UROWID"},
360 {231, "TIMESTAMP WITH LOCAL TIME ZONE"},
361 {0, NULL((void*)0)}
362};
363
364/* Oracle NLS character-set ids - the well-known subset, enough to name
365 * the charsets seen in a Set Datatypes negotiation. */
366static const value_string tns_charsets[] = {
367 {31, "WE8ISO8859P1"},
368 {32, "EE8ISO8859P2"},
369 {35, "CL8ISO8859P5"},
370 {170, "EE8MSWIN1250"},
371 {171, "CL8MSWIN1251"},
372 {178, "WE8MSWIN1252"},
373 {830, "JA16EUC"},
374 {852, "ZHS16GBK"},
375 {865, "ZHT16BIG5"},
376 {867, "ZHT16MSWIN950"},
377 {871, "US7ASCII"},
378 {873, "AL32UTF8"},
379 {2000, "AL16UTF16"},
380 {0, NULL((void*)0)}
381};
382
383static const value_string tns_data_oci_subfuncs[] = {
384 {1, "Logon to Oracle"},
385 {2, "Open Cursor"},
386 {3, "Parse a Row"},
387 {4, "Execute a Row"},
388 {5, "Fetch a Row"},
389 {8, "Close Cursor"},
390 {9, "Logoff of Oracle"},
391 {10, "Describe a select list column"},
392 {11, "Define where the column goes"},
393 {12, "Auto commit on"},
394 {13, "Auto commit off"},
395 {14, "Commit"},
396 {15, "Rollback"},
397 {16, "Set fatal error options"},
398 {17, "Resume current operation"},
399 {18, "Get Oracle version-date string"},
400 {19, "Until we get rid of OASQL"},
401 {20, "Cancel the current operation"},
402 {21, "Get error message"},
403 {22, "Exit Oracle command"},
404 {23, "Special function"},
405 {24, "Abort"},
406 {25, "Dequeue by RowID"},
407 {26, "Fetch a long column value"},
408 {27, "Create Access Module"},
409 {28, "Save Access Module Statement"},
410 {29, "Save Access Module"},
411 {30, "Parse Access Module Statement"},
412 {31, "How many items?"},
413 {32, "Initialize Oracle"},
414 {33, "Change User ID"},
415 {34, "Bind by reference positional"},
416 {35, "Get n'th Bind Variable"},
417 {36, "Get n'th Into Variable"},
418 {37, "Bind by reference"},
419 {38, "Bind by reference numeric"},
420 {39, "Parse and Execute"},
421 {40, "Parse for syntax (only)"},
422 {41, "Parse for syntax and SQL Dictionary lookup"},
423 {42, "Continue serving after EOF"},
424 {43, "Array describe"},
425 {44, "Init sys pars command table"},
426 {45, "Finalize sys pars command table"},
427 {46, "Put sys par in command table"},
428 {47, "Get sys pars from command table"},
429 {48, "Start Oracle (V6)"},
430 {49, "Shutdown Oracle (V6)"},
431 {50, "Run Independent Process (V6)"},
432 {51, "Test RAM (V6)"},
433 {52, "Archive operation (V6)"},
434 {53, "Media Recovery - start (V6)"},
435 {54, "Media Recovery - record tablespace to recover (V6)"},
436 {55, "Media Recovery - get starting log seq # (V6)"},
437 {56, "Media Recovery - recover using offline log (V6)"},
438 {57, "Media Recovery - cancel media recovery (V6)"},
439 {58, "Logon to Oracle (V6)"},
440 {59, "Get Oracle version-date string in new format"},
441 {60, "Initialize Oracle"},
442 {61, "Reserved for MAC; close all cursors"},
443 {62, "Bundled execution call"},
444 {65, "For direct loader: functions"},
445 {66, "For direct loader: buffer transfer"},
446 {67, "Distrib. trans. mgr. RPC"},
447 {68, "Describe indexes for distributed query"},
448 {69, "Session operations"},
449 {70, "Execute using synchronized system commit numbers"},
450 {71, "Fast UPI calls to OPIAL7"},
451 {72, "Long Fetch (V7)"},
452 {73, "Call OPIEXE from OPIALL: no two-task access"},
453 {74, "Parse Call (V7) to deal with various flavours"},
454 {76, "RPC call from PL/SQL"},
455 {77, "Do a KGL operation"},
456 {78, "Execute and Fetch"},
457 {79, "X/Open XA operation"},
458 {80, "New KGL operation call"},
459 {81, "2nd Half of Logon"},
460 {82, "1st Half of Logon"},
461 {83, "Do Streaming Operation"},
462 {84, "Open Session (71 interface)"},
463 {85, "X/Open XA operations (71 interface)"},
464 {86, "Debugging operations"},
465 {87, "Special debugging operations"},
466 {88, "XA Start"},
467 {89, "XA Switch and Commit"},
468 {90, "Direct copy from db buffers to client address"},
469 {91, "OKOD Call (In Oracle <= 7 this used to be Connect"},
470 {93, "RPI Callback with ctxdef"},
471 {94, "Bundled execution call (V7)"},
472 {95, "Do Streaming Operation without begintxn"},
473 {96, "LOB and FILE related calls"},
474 {97, "File Create call"},
475 {98, "Describe query (V8) call"},
476 {99, "Connect (non-blocking attach host)"},
477 {100, "Open a recursive cursor"},
478 {101, "Bundled KPR Execution"},
479 {102, "Bundled PL/SQL execution"},
480 {103, "Transaction start, attach, detach"},
481 {104, "Transaction commit, rollback, recover"},
482 {105, "Cursor close all"},
483 {106, "Failover into piggyback"},
484 {107, "Session switching piggyback (V8)"},
485 {108, "Do Dummy Defines"},
486 {109, "Init sys pars (V8)"},
487 {110, "Finalize sys pars (V8)"},
488 {111, "Put sys par in par space (V8)"},
489 {112, "Terminate sys pars (V8)"},
490 {114, "Init Untrusted Callbacks"},
491 {115, "Generic authentication call"},
492 {116, "FailOver Get Instance call"},
493 {117, "Oracle Transaction service Commit remote sites"},
494 {118, "Get the session key"},
495 {119, "Describe any (V8)"},
496 {120, "Cancel All"},
497 {121, "AQ Enqueue"},
498 {122, "AQ Dequeue"},
499 {123, "Object transfer"},
500 {124, "RFS Call"},
501 {125, "Kernel programmatic notification"},
502 {126, "Listen"},
503 {127, "Oracle Transaction service Commit remote sites (V >= 8.1.3)"},
504 {128, "Dir Path Prepare"},
505 {129, "Dir Path Load Stream"},
506 {130, "Dir Path Misc. Ops"},
507 {131, "Memory Stats"},
508 {132, "AQ Properties Status"},
509 {134, "Remote Fetch Archive Log FAL"},
510 {135, "Client ID propagation"},
511 {136, "DR Server CNX Process"},
512 {138, "SPFILE parameter put"},
513 {139, "KPFC exchange"},
514 {140, "Object Transfer (V8.2)"},
515 {141, "Push Transaction"},
516 {142, "Pop Transaction"},
517 {143, "KFN Operation"},
518 {144, "Dir Path Unload Stream"},
519 {145, "AQ batch enqueue dequeue"},
520 {146, "File Transfer"},
521 {147, "Ping"},
522 {148, "TSM"},
523 {150, "Begin TSM"},
524 {151, "End TSM"},
525 {152, "Set schema"},
526 {153, "Fetch from suspended result set"},
527 {154, "Key/Value pair"},
528 {155, "XS Create session Operation"},
529 {156, "XS Session Roundtrip Operation"},
530 {157, "XS Piggyback Operation"},
531 {158, "KSRPC Execution"},
532 {159, "Streams combined capture apply"},
533 {160, "AQ replay information"},
534 {161, "SSCR"},
535 {162, "Session Get"},
536 {163, "Session RLS"},
537 {165, "Workload replay data"},
538 {166, "Replay statistic data"},
539 {167, "Query Cache Stats"},
540 {168, "Query Cache IDs"},
541 {169, "RPC Test Stream"},
542 {170, "Replay PL/SQL RPC"},
543 {171, "XStream Out"},
544 {172, "Golden Gate RPC"},
545 {0, NULL((void*)0)}
546};
547static 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) }
;
548
549static const value_string tns_marker_types[] = {
550 {0, "Data Marker - 0 Data Bytes"},
551 {1, "Data Marker - 1 Data Bytes"},
552 {2, "Attention Marker"},
553 {0, NULL((void*)0)}
554};
555
556static const value_string tns_control_cmds[] = {
557 {1, "Oracle Trace Command"},
558 {0, NULL((void*)0)}
559};
560
561typedef struct _tns_conv_info_t {
562 uint32_t pending_connect_data;
563} tns_conv_info_t;
564
565void proto_reg_handoff_tns(void);
566static int dissect_tns_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U___attribute__((unused)));
567
568static tns_conv_info_t*
569tns_get_conv_info(packet_info *pinfo)
570{
571 conversation_t *conversation = find_or_create_conversation(pinfo);
572
573 tns_conv_info_t *tns_info = (tns_conv_info_t *)conversation_get_proto_data(conversation, proto_tns);
574 if (!tns_info) {
575 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
)))
;
576 conversation_add_proto_data(conversation, proto_tns, tns_info);
577 }
578 return tns_info;
579}
580
581static unsigned get_data_func_id(tvbuff_t *tvb, int offset)
582{
583 /* Determine Data Function id */
584 uint8_t first_byte;
585
586 first_byte =
587 tvb_reported_length_remaining(tvb, offset) > 0 ? tvb_get_uint8(tvb, offset) : 0;
588
589 if ( tvb_bytes_exist(tvb, offset, 4) && first_byte == 0xDE &&
590 tvb_get_uint24(tvb, offset+1, ENC_BIG_ENDIAN0x00000000) == 0xADBEEF )
591 {
592 return SQLNET_SNS0xdeadbeef;
593 }
594 else
595 {
596 return (unsigned)first_byte;
597 }
598}
599
600static int get_strtype_custom(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
601{
602 int ret = 1; // 1st byte contains 254 or length if smaller than 64
603 int len = 0;
604
605 wmem_strbuf_t *strbuf = wmem_strbuf_new(pinfo->pool, "");
606
607 len = tvb_get_uint8(tvb, offset);
608 if (len == 254) {
609 int actual_len = 0;
610 len = 0;
Value stored to 'len' is never read
611 do { // walk over the chunks
612 len = tvb_get_uint8(tvb, offset + ret);
613 ret++; // 1st byte with the chunk size
614 wmem_strbuf_append(strbuf, (const char *)tvb_get_string_enc(pinfo->pool, tvb, offset + ret, len, ENC_ASCII0x00000000|ENC_NA0x00000000));
615 ret += len; // length of the string's chunk
616 actual_len += len;
617 } while (len == 64);
618 ret++; // has to be null-terminated
619 len = actual_len;
620 }
621 else {
622 ret += len;
623 wmem_strbuf_append(strbuf, (const char *)tvb_get_string_enc(pinfo->pool, tvb, offset + 1, len, ENC_ASCII0x00000000|ENC_NA0x00000000));
624 }
625
626 proto_tree_add_uint(tree, hf_tns_data_opi_param_length, tvb, offset, 1, len);
627 proto_tree_add_string(tree, hf_tns_data_opi_param_value, tvb, offset+1, ret-1, wmem_strbuf_get_str(strbuf));
628
629 return ret;
630}
631
632static int get_sb4_custom(tvbuff_t *tvb, int offset, int *result)
633{
634 uint8_t first_byte = tvb_get_uint8(tvb, offset); // Contains length of a value
635 switch(first_byte)
636 {
637 case 0:
638 *result = 0;
639 break;
640 case 1:
641 *result = tvb_get_uint8(tvb, offset+1);
642 break;
643 case 2:
644 *result = tvb_get_ntohs(tvb, offset+1);
645 break;
646 case 3:
647 *result = tvb_get_ntoh24(tvb, offset+1);
648 break;
649 case 4:
650 *result = tvb_get_ntohl(tvb, offset+1);
651 break;
652 default:
653 /* The width byte comes straight off the wire, so a value
654 * outside 0..4 is malformed input rather than a bug in the
655 * dissector - asserting here would blame Wireshark for a
656 * packet somebody else wrote. Yield zero and step over just
657 * the width byte. */
658 *result = 0;
659 return 1;
660 }
661 return first_byte + 1;
662}
663
664/* Decode a DALC (Data-Length-And-Content) blob. The leading byte is a
665 * length only in the middle of its range:
666 *
667 * 0x00 empty
668 * 0x01..0xFD that many data bytes follow
669 * 0xFE chunked: (len, bytes) pairs until a 0-length chunk
670 * 0xFF null - a marker only, no data follows
671 *
672 * The null marker consumes just itself. Reading it as a length would
673 * claim 255 bytes that are not there and misalign every field after
674 * it, so it has to be spelled out rather than left to the default.
675 *
676 * The chunk lengths in the 0xFE form are single bytes here, which is
677 * the 11g shape this dissector decodes throughout; 12.2 and later
678 * prefix each chunk with a variable-length ub4 instead. Telling the
679 * two apart needs the field version negotiated during the handshake,
680 * which is not threaded through yet.
681 *
682 * Returns the number of bytes consumed from the tvb and, when content
683 * is non-empty, a UTF-8 string allocated from pinfo->pool. */
684static int get_dalc_custom(tvbuff_t *tvb, packet_info *pinfo, int offset, const char **out_str)
685{
686 uint8_t first = tvb_get_uint8(tvb, offset);
687 if ( first == 0 || first == 255 )
688 {
689 if ( out_str )
690 *out_str = NULL((void*)0);
691 return 1;
692 }
693 if ( first != 254 )
694 {
695 if ( out_str )
696 *out_str = (const char *)tvb_get_string_enc(pinfo->pool, tvb, offset + 1, first, ENC_UTF_80x00000002|ENC_NA0x00000000);
697 return 1 + first;
698 }
699
700 /* Chunked form: walk (len, bytes)+ until a zero-length chunk. */
701 wmem_strbuf_t *strbuf = wmem_strbuf_new(pinfo->pool, "");
702 int o = offset + 1;
703 while ( tvb_reported_length_remaining(tvb, o) > 0 )
704 {
705 uint8_t chunk_len = tvb_get_uint8(tvb, o);
706 o += 1;
707 if ( chunk_len == 0 )
708 break;
709 wmem_strbuf_append(strbuf, (const char *)tvb_get_string_enc(pinfo->pool, tvb, o, chunk_len, ENC_UTF_80x00000002|ENC_NA0x00000000));
710 o += chunk_len;
711 }
712 if ( out_str )
713 *out_str = wmem_strbuf_get_str(strbuf);
714 return o - offset;
715}
716
717/* Decode a bytes_with_length / str_with_length field: a ub4 count, and
718 * a DALC carrying the value only when that count is non-zero. The count
719 * is not simply a byte to step over - an empty field is the count
720 * alone, so reading a DALC anyway consumes whatever follows it.
721 * Returns bytes consumed; *out_str (when non-NULL) gets the string, or
722 * NULL when the field is empty. */
723static int get_field_with_length(tvbuff_t *tvb, packet_info *pinfo, int offset, const char **out_str)
724{
725 int count = 0;
726 int used = get_sb4_custom(tvb, offset, &count);
727 if ( out_str )
728 *out_str = NULL((void*)0);
729 if ( count > 0 )
730 used += get_dalc_custom(tvb, pinfo, offset + used, out_str);
731 return used;
732}
733
734static void vsnum_to_vstext_basecustom(char *result, uint32_t vsnum)
735{
736 /*
737 * Translate hex value to human readable version value, described at
738 * http://docs.oracle.com/cd/B28359_01/server.111/b28310/dba004.htm
739 */
740 snprintf(result, ITEM_LABEL_LENGTH240, "%d.%d.%d.%d.%d",
741 vsnum >> 24,
742 (vsnum >> 20) & 0xf,
743 (vsnum >> 12) & 0xf,
744 (vsnum >> 8) & 0xf,
745 vsnum & 0xff);
746}
747
748static void dissect_tns_data_descriptor(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tns_tree, uint32_t length)
749{
750 /* This is used by Oracle 12c for at least sending LOB/FILE data. */
751 proto_tree *dd_tree, *row_tree;
752 proto_item *ti;
753 uint32_t data_len, row_count, row_size, total_row_size = 0;
754 int orig_offset = offset;
755
756 /* We only get here after tcp_dissect_pdus(), length is guaranteed. */
757 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"
, 757, (int64_t)length, (int64_t)8))))
;
758
759 dd_tree = proto_tree_add_subtree(tns_tree, tvb, offset, -1, ett_tns_data, NULL((void*)0), "Data Descriptor");
760
761 /* No idea what this is. Usually 0x0003. */
762 offset += 4;
763 proto_tree_add_item_ret_uint(dd_tree, hf_tns_data_length, tvb,
764 offset, 4, ENC_BIG_ENDIAN0x00000000, &data_len);
765 offset += 4;
766
767 /* This next parameter looks like: number of big endian shorts that follow,
768 * the sum of the shorts equals the file length above - each short maxes
769 * out at 0x1f7c = 8060, presumably related to the page size / max table
770 * row size in Microsoft SQL Server? Something about how many rows it
771 * would take to store this in-table?
772 */
773 proto_tree_add_item_ret_uint(dd_tree, hf_tns_data_descriptor_row_count, tvb,
774 offset, 4, ENC_BIG_ENDIAN0x00000000, &row_count);
775 offset += 4;
776 row_tree = proto_tree_add_subtree(dd_tree, tvb, offset, row_count * 2,
777 ett_tns_rows, &ti, "Rows");
778 for (uint32_t i = 0; i < row_count; i++) {
779 proto_tree_add_item_ret_uint(row_tree, hf_tns_data_descriptor_row_size, tvb,
780 offset, 2, ENC_BIG_ENDIAN0x00000000, &row_size);
781 total_row_size += row_size;
782 offset += 2;
783 }
784 proto_item_append_text(ti, " (%u bytes)", total_row_size);
785 if (total_row_size != data_len) {
786 expert_add_info(pinfo, ti, &ei_tns_data_descriptor_size_mismatch);
787 }
788
789 offset = orig_offset + (length - TNS_HDR_LEN8);
790
791 call_data_dissector(tvb_new_subset_length(tvb, offset, data_len), pinfo,
792 dd_tree);
793}
794
795static void dissect_tns_data(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tns_tree)
796{
797 proto_tree *data_tree;
798 unsigned data_func_id;
799 bool_Bool is_request;
800 static int * const flags[] = {
801 &hf_tns_data_flag_send,
802 &hf_tns_data_flag_rc,
803 &hf_tns_data_flag_c,
804 &hf_tns_data_flag_reserved,
805 &hf_tns_data_flag_more,
806 &hf_tns_data_flag_eof,
807 &hf_tns_data_flag_dic,
808 &hf_tns_data_flag_rts,
809 &hf_tns_data_flag_sntt,
810 NULL((void*)0)
811 };
812
813 is_request = pinfo->match_uint == pinfo->destport;
814 data_tree = proto_tree_add_subtree(tns_tree, tvb, offset, -1, ett_tns_data, NULL((void*)0), "Data");
815
816 proto_tree_add_bitmask(data_tree, tvb, offset, hf_tns_data_flag, ett_tns_data_flag, flags, ENC_BIG_ENDIAN0x00000000);
817 offset += 2;
818 data_func_id = get_data_func_id(tvb, offset);
819
820 /* Do this only if the Data message have a body. Otherwise, there are only Data flags. */
821 int remaining = tvb_reported_length_remaining(tvb, offset);
822 if ( remaining > 0 )
823 {
824 if (is_request) {
825 if (!PINFO_FD_VISITED(pinfo)((pinfo)->fd->visited)) {
826 tns_conv_info_t *tns_info = tns_get_conv_info(pinfo);
827 if ((uint32_t)remaining == tns_info->pending_connect_data) {
828 col_append_str(pinfo->cinfo, COL_INFO, ", Connect Data");
829 proto_tree_add_item(data_tree, hf_tns_connect_data, tvb,
830 offset, -1, ENC_ASCII0x00000000);
831 p_add_proto_data(wmem_file_scope(), pinfo, proto_tns, 0,
832 GUINT_TO_POINTER(tns_info->pending_connect_data)((gpointer) (gulong) (tns_info->pending_connect_data)));
833 tns_info->pending_connect_data = 0;
834 return;
835 }
836 } else {
837 if (p_get_proto_data(wmem_file_scope(), pinfo, proto_tns, 0) != NULL((void*)0)) {
838 col_append_str(pinfo->cinfo, COL_INFO, ", Connect Data");
839 proto_tree_add_item(data_tree, hf_tns_connect_data, tvb,
840 offset, -1, ENC_ASCII0x00000000);
841 return;
842 }
843 }
844 }
845 col_append_fstr(pinfo->cinfo, COL_INFO, ", %s", val_to_str_const(data_func_id, tns_data_funcs, "unknown"));
846
847 if ( (data_func_id != SQLNET_SNS0xdeadbeef) && (try_val_to_str(data_func_id, tns_data_funcs) != NULL((void*)0)) )
848 {
849 proto_tree_add_item(data_tree, hf_tns_data_id, tvb, offset, 1, ENC_BIG_ENDIAN0x00000000);
850 offset += 1;
851 }
852 }
853
854 /* Handle data functions that have more than just ID */
855 switch (data_func_id)
856 {
857 case SQLNET_SET_PROTOCOL1:
858 {
859 proto_tree *versions_tree;
860 proto_item *ti;
861 char sep;
862 if ( is_request )
863 {
864 versions_tree = proto_tree_add_subtree(data_tree, tvb, offset, -1, ett_tns_acc_versions, &ti, "Accepted Versions");
865 sep = ':';
866 for (;;) {
867 /*
868 * Add each accepted version as a
869 * separate item.
870 */
871 uint8_t vers;
872
873 vers = tvb_get_uint8(tvb, offset);
874 if (vers == 0) {
875 /*
876 * A version of 0 terminates
877 * the list.
878 */
879 break;
880 }
881 proto_item_append_text(ti, "%c %u", sep, vers);
882 sep = ',';
883 proto_tree_add_uint(versions_tree, hf_tns_data_setp_acc_version, tvb, offset, 1, vers);
884 offset += 1;
885 }
886 offset += 1; /* skip the 0 terminator */
887 proto_item_set_end(ti, tvb, offset);
888 proto_tree_add_item(data_tree, hf_tns_data_setp_cli_plat, tvb, offset, -1, ENC_ASCII0x00000000);
889
890 return; /* skip call_data_dissector */
891 }
892 else
893 {
894 unsigned len;
895 versions_tree = proto_tree_add_subtree(data_tree, tvb, offset, -1, ett_tns_acc_versions, &ti, "Versions");
896 sep = ':';
897 for (;;) {
898 /*
899 * Add each version as a separate item.
900 */
901 uint8_t vers;
902
903 vers = tvb_get_uint8(tvb, offset);
904 if (vers == 0) {
905 /*
906 * A version of 0 terminates
907 * the list.
908 */
909 break;
910 }
911 proto_item_append_text(ti, "%c %u", sep, vers);
912 sep = ',';
913 proto_tree_add_uint(versions_tree, hf_tns_data_setp_version, tvb, offset, 1, vers);
914 offset += 1;
915 }
916 offset += 1; /* skip the 0 terminator */
917 proto_item_set_end(ti, tvb, offset);
918 proto_tree_add_item_ret_length(data_tree, hf_tns_data_setp_banner, tvb, offset, -1, ENC_ASCII0x00000000|ENC_NA0x00000000, &len);
919 offset += len;
920 }
921 break;
922 }
923
924 case SQLNET_SET_DATATYPES2:
925 {
926 /* TTI_DTY: Data Type Negotiation, sent right after TTI_PRO
927 * during the TTC handshake. The body is a fixed-shape blob
928 * the client uses to tell the server which native Oracle
929 * data types it understands and what wire representation it
930 * wants for each. Layout cross-referenced with
931 * python-oracledb.
932 *
933 * charset_in 2 bytes LE NLS_LANGUAGE charset id
934 * charset_out 2 bytes LE NLS_NCHAR charset id
935 * flag 1 byte capability flag (1 = std)
936 * capability header 39 bytes version triple + flag bytes
937 * table header 8 bytes group/sub counts
938 * identity map 980 bytes 245 x (type, type, 1, 0)
939 * type overrides var entries, terminated by 0
940 */
941 proto_tree *caphdr_tree, *ov_tree;
942 proto_item *caphdr_item, *ov_item;
943
944 if ( !is_request )
945 break;
946
947 proto_tree_add_item(data_tree, hf_tns_data_setdt_charset_in, tvb, offset, 2, ENC_LITTLE_ENDIAN0x80000000);
948 offset += 2;
949 proto_tree_add_item(data_tree, hf_tns_data_setdt_charset_out, tvb, offset, 2, ENC_LITTLE_ENDIAN0x80000000);
950 offset += 2;
951 proto_tree_add_item(data_tree, hf_tns_data_setdt_flag, tvb, offset, 1, ENC_BIG_ENDIAN0x00000000);
952 offset += 1;
953
954 caphdr_item = proto_tree_add_item(data_tree, hf_tns_data_setdt_caphdr, tvb, offset, 39, ENC_NA0x00000000);
955 caphdr_tree = proto_item_add_subtree(caphdr_item, ett_tns_setdt_caphdr);
956 proto_tree_add_item(caphdr_tree, hf_tns_data_setdt_caphdr_version, tvb, offset, 3, ENC_BIG_ENDIAN0x00000000);
957 proto_tree_add_item(caphdr_tree, hf_tns_data_setdt_caphdr_flags, tvb, offset + 3, 36, ENC_NA0x00000000);
958 offset += 39;
959
960 proto_tree_add_item(data_tree, hf_tns_data_setdt_tblhdr, tvb, offset, 8, ENC_NA0x00000000);
961 offset += 8;
962 proto_tree_add_item(data_tree, hf_tns_data_setdt_idmap, tvb, offset, 980, ENC_NA0x00000000);
963 offset += 980;
964
965 /* Walk type-override entries until the 0 terminator. Each
966 * entry is (client_type, server_repr[, format]); a 0 in the
967 * server_repr slot marks a short "client knows the id but
968 * has no override" entry. */
969 ov_item = proto_tree_add_item(data_tree, hf_tns_data_setdt_overrides, tvb, offset, -1, ENC_NA0x00000000);
970 ov_tree = proto_item_add_subtree(ov_item, ett_tns_setdt_overrides);
971 int ov_start = offset;
972 while ( tvb_reported_length_remaining(tvb, offset) > 0 )
973 {
974 uint8_t client_type = tvb_get_uint8(tvb, offset);
975 if ( client_type == 0 )
976 {
977 proto_tree_add_item(ov_tree, hf_tns_data_setdt_override_client, tvb, offset, 1, ENC_BIG_ENDIAN0x00000000);
978 offset += 1;
979 break;
980 }
981 uint8_t repr = tvb_get_uint8(tvb, offset + 1);
982 int entry_len = (repr == 0) ? 2 : 4;
983 proto_tree *e_tree = proto_tree_add_subtree_format(ov_tree, tvb, offset, entry_len,
984 ett_tns_setdt_override, NULL((void*)0), "Type %u (%s)",
985 client_type, val_to_str_const(client_type, tns_data_types, "unknown"));
986 proto_tree_add_item(e_tree, hf_tns_data_setdt_override_client, tvb, offset, 1, ENC_BIG_ENDIAN0x00000000);
987 if ( entry_len == 4 )
988 {
989 proto_tree_add_item(e_tree, hf_tns_data_setdt_override_repr, tvb, offset + 1, 1, ENC_BIG_ENDIAN0x00000000);
990 proto_tree_add_item(e_tree, hf_tns_data_setdt_override_format, tvb, offset + 2, 1, ENC_BIG_ENDIAN0x00000000);
991 }
992 offset += entry_len;
993 }
994 proto_item_set_len(ov_item, offset - ov_start);
995 break;
996 }
997
998 case SQLNET_RETURN_STATUS4:
999 {
1000 /* TTI_OER: server-side end-of-call status block. Emitted at
1001 * the end of every response — success or failure. Layout
1002 * cross-referenced with python-oracledb's
1003 * _process_error_info, in the Oracle 11g shape (no extended
1004 * ub4 error number / ub8 rowcount that 12c+ adds).
1005 *
1006 * All multi-byte integers are stored in the ub4 variable-
1007 * length form (see get_sb4_custom): first byte holds the
1008 * value's width (0..4), followed by that many big-endian
1009 * data bytes. */
1010 proto_tree *oer_tree;
1011 proto_item *oer_item;
1012 int oer_start = offset;
1013 int v;
1014
1015 oer_tree = proto_tree_add_subtree(data_tree, tvb, offset, -1, ett_tns_oer, &oer_item, "Oracle Error Return");
1016
1017 /* call_status */
1018 offset += get_sb4_custom(tvb, offset, &v);
1019 proto_tree_add_int(oer_tree, hf_tns_data_oer_call_status, tvb, oer_start, offset - oer_start, v);
1020 /* end-to-end seq# (skipped) */
1021 offset += get_sb4_custom(tvb, offset, &v);
1022 /* rowcount (DML affected rows on 11g) */
1023 int rc_start = offset;
1024 offset += get_sb4_custom(tvb, offset, &v);
1025 proto_tree_add_int(oer_tree, hf_tns_data_oer_rowcount, tvb, rc_start, offset - rc_start, v);
1026 /* err_code (ORA-NNNNN, 0 on success) */
1027 int ec_start = offset;
1028 int err_code = 0;
1029 offset += get_sb4_custom(tvb, offset, &err_code);
1030 proto_tree_add_int(oer_tree, hf_tns_data_oer_err_code, tvb, ec_start, offset - ec_start, err_code);
1031 /* array elem error #1, #2 (skipped) */
1032 offset += get_sb4_custom(tvb, offset, &v);
1033 offset += get_sb4_custom(tvb, offset, &v);
1034 /* cursor_id */
1035 int ci_start = offset;
1036 offset += get_sb4_custom(tvb, offset, &v);
1037 proto_tree_add_int(oer_tree, hf_tns_data_oer_cursor_id, tvb, ci_start, offset - ci_start, v);
1038 /* error position (skipped) */
1039 offset += get_sb4_custom(tvb, offset, &v);
1040 /* 6 single-byte fields: sql_type, fatal, flags, user_cursor_opts, upi_param, warn_flags */
1041 offset += 6;
1042 /* rowid: ub4 rba, ub2 part_id, 1 byte reserved, ub4 block, ub2 slot */
1043 offset += get_sb4_custom(tvb, offset, &v);
1044 offset += get_sb4_custom(tvb, offset, &v);
1045 offset += 1;
1046 offset += get_sb4_custom(tvb, offset, &v);
1047 offset += get_sb4_custom(tvb, offset, &v);
1048 /* os error (skipped) */
1049 offset += get_sb4_custom(tvb, offset, &v);
1050 /* statement #, call # (1 byte each) */
1051 offset += 2;
1052 /* padding ub2 + successful iterations ub4 */
1053 offset += get_sb4_custom(tvb, offset, &v);
1054 offset += get_sb4_custom(tvb, offset, &v);
1055 /* oerrdd (logical rowid), a bytes_with_length — skipped */
1056 offset += get_field_with_length(tvb, pinfo, offset, NULL((void*)0));
1057
1058 /* Batch error arrays (array DML). The code and offset arrays
1059 * are each a ub4 count followed by one DALC packing that many
1060 * ub4 values back to back; the message array is a ub4 count,
1061 * an indicator byte, and then that many str_with_length
1062 * entries each with a 2-byte trailer. All three counts are
1063 * zero for an ordinary statement. */
1064 int n_codes = 0, n_offs = 0, n_msgs = 0;
1065 int nb_start = offset;
1066 offset += get_sb4_custom(tvb, offset, &n_codes);
1067 proto_tree_add_int(oer_tree, hf_tns_data_oer_n_batch_errcodes, tvb, nb_start, offset - nb_start, n_codes);
1068 if ( n_codes > 0 )
1069 offset += get_dalc_custom(tvb, pinfo, offset, NULL((void*)0));
1070 nb_start = offset;
1071 offset += get_sb4_custom(tvb, offset, &n_offs);
1072 proto_tree_add_int(oer_tree, hf_tns_data_oer_n_batch_offsets, tvb, nb_start, offset - nb_start, n_offs);
1073 if ( n_offs > 0 )
1074 offset += get_dalc_custom(tvb, pinfo, offset, NULL((void*)0));
1075 nb_start = offset;
1076 offset += get_sb4_custom(tvb, offset, &n_msgs);
1077 proto_tree_add_int(oer_tree, hf_tns_data_oer_n_batch_messages, tvb, nb_start, offset - nb_start, n_msgs);
1078 if ( n_msgs > 0 )
1079 {
1080 offset += 1;
1081 for ( int i = 0; i < n_msgs; i++ )
1082 {
1083 offset += get_field_with_length(tvb, pinfo, offset, NULL((void*)0));
1084 offset += 2;
1085 }
1086 }
1087
1088 /* Trailing message DALC — present (and meaningful) only when
1089 * err_code is non-zero. */
1090 if ( err_code != 0 && tvb_reported_length_remaining(tvb, offset) > 0 )
1091 {
1092 const char *msg = NULL((void*)0);
1093 int msg_start = offset;
1094 offset += get_dalc_custom(tvb, pinfo, offset, &msg);
1095 if ( msg )
1096 {
1097 proto_tree_add_string(oer_tree, hf_tns_data_oer_message, tvb, msg_start, offset - msg_start, msg);
1098 col_append_fstr(pinfo->cinfo, COL_INFO, " [%s]", msg);
1099 }
1100 }
1101 proto_item_set_len(oer_item, offset - oer_start);
1102 break;
1103 }
1104
1105 case SQLNET_USER_OCI_FUNC3:
1106 {
1107 guint32 oci_id = 0;
1108 proto_tree_add_item_ret_uint(data_tree, hf_tns_data_oci_id, tvb, offset, 1, ENC_BIG_ENDIAN0x00000000, &oci_id);
1109 offset += 1;
1110 proto_tree_add_item(data_tree, hf_tns_data_tseq, tvb, offset, 1, ENC_BIG_ENDIAN0x00000000);
1111 offset += 1;
1112 if((oci_id == 115) || (oci_id == 118)){
1113 proto_tree_add_item(data_tree, hf_tns_data_unused, tvb, offset, 1, ENC_NA0x00000000);
1114 offset += 1;
1115 int user_len = 0;
1116 offset += get_sb4_custom(tvb, offset, &user_len);
1117 }
1118 break;
1119 }
1120 case SQLNET_RETURN_OPI_PARAM8:
1121 {
1122 uint8_t skip = 0, opi = 0;
1123
1124 if ( tvb_bytes_exist(tvb, offset, 11) )
1125 {
1126 /*
1127 * OPI_VERSION2 response has a following pattern:
1128 *
1129 * _ banner _ vsnum
1130 * / /
1131 * ..(.?)(Orac[le.+])(.?)(....).+$
1132 * |
1133 * \ banner length (if equal to 0 then next byte indicates the length).
1134 *
1135 * These differences (to skip 1 or 2 bytes) due to differences in the drivers.
1136 */
1137 /* Orac[le.+] */
1138 if ( tvb_get_ntohl(tvb, offset+2) == 0x4f726163 )
1139 {
1140 opi = OPI_VERSION21;
1141 skip = 1;
1142 }
1143
1144 else if ( tvb_get_ntohl(tvb, offset+3) == 0x4f726163 )
1145 {
1146 opi = OPI_VERSION21;
1147 skip = 2;
1148 }
1149
1150 /*
1151 * OPI_OSESSKEY response has a following pattern:
1152 *
1153 * _ pattern (v1|v2)
1154 * / _ params
1155 * / /
1156 * (....)(........)(.+).+$
1157 * ||
1158 * \ if these two bytes are equal to 0x0c00 then first byte is <Param Counts> (v1),
1159 * else next byte indicate it (v2).
1160 */
1161 /* ....AUTH (v1) */
1162 else if ( tvb_get_ntoh64(tvb, offset+3) == 0x0000000c41555448 )
1163 {
1164 opi = OPI_OSESSKEY2;
1165 skip = 1;
1166 }
1167 /* ..AUTH_V (v2) */
1168 else if ( tvb_get_ntoh64(tvb, offset+3) == 0x0c0c415554485f53 )
1169 {
1170 opi = OPI_OSESSKEY2;
1171 skip = 2;
1172 }
1173
1174 /*
1175 * OPI_OAUTH response has a following pattern:
1176 *
1177 * _ pattern (v1|v2)
1178 * / _ params
1179 * / /
1180 * (....)(........)(.+).+$
1181 * ||
1182 * \ if these two bytes are equal to 0x1300 then first byte is <Param Counts> (v1),
1183 * else next byte indicate it (v2).
1184 */
1185
1186 /* ....AUTH (v1) */
1187 else if ( tvb_get_ntoh64(tvb, offset+3) == 0x0000001341555448 )
1188 {
1189 opi = OPI_OAUTH3;
1190 skip = 1;
1191 }
1192 /* ..AUTH_V (v2) */
1193 else if ( tvb_get_ntoh64(tvb, offset+3) == 0x1313415554485f56 )
1194 {
1195 opi = OPI_OAUTH3;
1196 skip = 2;
1197 }
1198 }
1199
1200 if ( opi == OPI_VERSION21 )
1201 {
1202 proto_tree_add_item(data_tree, hf_tns_data_unused, tvb, offset, skip, ENC_NA0x00000000);
1203 offset += skip;
1204
1205 uint8_t len = tvb_get_uint8(tvb, offset);
1206
1207 proto_tree_add_item(data_tree, hf_tns_data_opi_version2_banner_len, tvb, offset, 1, ENC_BIG_ENDIAN0x00000000);
1208 offset += 1;
1209
1210 proto_tree_add_item(data_tree, hf_tns_data_opi_version2_banner, tvb, offset, len, ENC_ASCII0x00000000);
1211 offset += len + (skip == 1 ? 1 : 0);
1212
1213 proto_tree_add_item(data_tree, hf_tns_data_opi_version2_vsnum, tvb, offset, 4, (skip == 1) ? ENC_BIG_ENDIAN0x00000000 : ENC_LITTLE_ENDIAN0x80000000);
1214 offset += 4;
1215 }
1216 else if ( opi == OPI_OSESSKEY2 || opi == OPI_OAUTH3 )
1217 {
1218 proto_tree *params_tree;
1219 proto_item *params_ti;
1220 unsigned par, params;
1221
1222 if ( skip == 1 )
1223 {
1224 proto_tree_add_item_ret_uint(data_tree, hf_tns_data_opi_num_of_params, tvb, offset, 1, ENC_NA0x00000000, &params);
1225 offset += 1;
1226
1227 proto_tree_add_item(data_tree, hf_tns_data_unused, tvb, offset, 5, ENC_NA0x00000000);
1228 offset += 5;
1229 }
1230 else
1231 {
1232 proto_tree_add_item(data_tree, hf_tns_data_unused, tvb, offset, 1, ENC_NA0x00000000);
1233 offset += 1;
1234
1235 proto_tree_add_item_ret_uint(data_tree, hf_tns_data_opi_num_of_params, tvb, offset, 1, ENC_NA0x00000000, &params);
1236 offset += 1;
1237
1238 proto_tree_add_item(data_tree, hf_tns_data_unused, tvb, offset, 2, ENC_NA0x00000000);
1239 offset += 2;
1240 }
1241
1242 params_tree = proto_tree_add_subtree(data_tree, tvb, offset, -1, ett_tns_opi_params, &params_ti, "Parameters");
1243
1244 for ( par = 1; par <= params; par++ )
1245 {
1246 proto_tree *par_tree;
1247 proto_item *par_ti;
1248 unsigned len, offset_prev;
1249
1250 par_tree = proto_tree_add_subtree(params_tree, tvb, offset, -1, ett_tns_opi_par, &par_ti, "Parameter");
1251 proto_item_append_text(par_ti, " %u", par);
1252
1253 /* Name length */
1254 proto_tree_add_item_ret_uint(par_tree, hf_tns_data_opi_param_length, tvb, offset, 1, ENC_NA0x00000000, &len);
1255 offset += 1;
1256
1257 /* Name */
1258 if ( !(len == 0 || len == 2) ) /* Not empty (2 - SQLDeveloper specific sign). */
1259 {
1260 proto_tree_add_item(par_tree, hf_tns_data_opi_param_name, tvb, offset, len, ENC_ASCII0x00000000);
1261 offset += len;
1262 }
1263
1264 /* Value can be NULL. So, save offset to calculate unused data. */
1265 offset_prev = offset;
1266 offset += skip == 1 ? 4 : 2;
1267
1268 /* Value length */
1269 if ( opi == OPI_OSESSKEY2 )
1270 {
1271 len = get_strtype_custom(tvb, pinfo, par_tree, offset);
1272 }
1273 else /* OPI_OAUTH */
1274 {
1275 len = tvb_get_uint8(tvb, offset_prev) == 0 ? 0 : get_strtype_custom(tvb, pinfo, par_tree, offset);
1276 }
1277
1278 /*
1279 * Value
1280 * OPI_OSESSKEY: AUTH_VFR_DATA with length 0, 9, 0x39 comes without data.
1281 * OPI_OAUTH: AUTH_VFR_DATA with length 0, 0x39 comes without data.
1282 */
1283 if ( ((opi == OPI_OSESSKEY2) && !(len == 0 || len == 9 || len == 0x39))
1284 || ((opi == OPI_OAUTH3) && !(len == 0 || len == 0x39)) )
1285 {
1286 proto_tree_add_item(par_tree, hf_tns_data_unused, tvb, offset_prev, offset - offset_prev, ENC_NA0x00000000);
1287 offset += len;
1288
1289 offset_prev = offset; /* Save offset to calculate rest of unused data */
1290 }
1291 else
1292 {
1293 offset += 1;
1294 }
1295
1296 if ( opi == OPI_OSESSKEY2 )
1297 {
1298 /* SQL Developer specific fix */
1299 offset += tvb_get_uint8(tvb, offset) == 2 ? 5 : 3;
1300 }
1301 else /* OPI_OAUTH */
1302 {
1303 offset += len == 0 ? 1 : 3;
1304 }
1305
1306 if ( skip == 1 )
1307 {
1308 offset += 1 + ((len == 0 || len == 0x39) ? 3 : 4);
1309
1310 if ( opi == OPI_OAUTH3 )
1311 {
1312 offset += len == 0 ? 2 : 0;
1313 }
1314 }
1315
1316 proto_tree_add_item(par_tree, hf_tns_data_unused, tvb, offset_prev, offset - offset_prev, ENC_NA0x00000000);
1317 proto_item_set_end(par_ti, tvb, offset);
1318 }
1319 proto_item_set_end(params_ti, tvb, offset);
1320 }
1321 break;
1322 }
1323
1324 case SQLNET_PIGGYBACK_FUNC17:
1325 {
1326 int cursors_len = 0;
1327 int cursors_start;
1328 proto_tree_add_item(data_tree, hf_tns_data_piggyback_id, tvb, offset, 1, ENC_BIG_ENDIAN0x00000000);
1329 offset += 1;
1330 proto_tree_add_item(data_tree, hf_tns_data_tseq, tvb, offset, 1, ENC_BIG_ENDIAN0x00000000);
1331 offset += 1;
1332 cursors_start = offset;
1333 offset += get_sb4_custom(tvb, offset, &cursors_len);
1334 /* The count comes off the wire and every cursor takes at
1335 * least one byte, so a count larger than the data left
1336 * cannot be real. Say so and stop, rather than looping on
1337 * a number somebody else chose. */
1338 if ( cursors_len < 0 ||
1339 (unsigned)cursors_len > tvb_reported_length_remaining(tvb, offset) )
1340 {
1341 proto_tree_add_expert(data_tree, pinfo, &ei_tns_data_piggyback_cursors,
1342 tvb, cursors_start, offset - cursors_start);
1343 break;
1344 }
1345 for(int i = 0; i < cursors_len; i++) {
1346 int cursor = 0;
1347 int new_offset = get_sb4_custom(tvb, offset, &cursor);
1348 proto_tree_add_uint(data_tree, hf_tns_cursor, tvb, offset, new_offset - offset, cursor);
1349 offset = new_offset;
1350 }
1351 break;
1352 }
1353 case SQLNET_SNS0xdeadbeef:
1354 {
1355 proto_tree_add_item(data_tree, hf_tns_data_id, tvb, offset, 4, ENC_BIG_ENDIAN0x00000000);
1356 offset += 4;
1357 proto_tree_add_item(data_tree, hf_tns_data_length, tvb, offset, 2, ENC_BIG_ENDIAN0x00000000);
1358 offset += 2;
1359
1360 if ( is_request )
1361 {
1362 proto_tree_add_item(data_tree, hf_tns_data_sns_cli_vers, tvb, offset, 4, ENC_BIG_ENDIAN0x00000000);
1363 }
1364 else
1365 {
1366 proto_tree_add_item(data_tree, hf_tns_data_sns_srv_vers, tvb, offset, 4, ENC_BIG_ENDIAN0x00000000);
1367 }
1368 offset += 4;
1369
1370 proto_tree_add_item(data_tree, hf_tns_data_sns_srvcnt, tvb, offset, 2, ENC_BIG_ENDIAN0x00000000);
1371
1372 /* move back, to include data_id into data_dissector */
1373 offset -= 10;
1374 break;
1375 }
1376 }
1377
1378 call_data_dissector(tvb_new_subset_remaining(tvb, offset), pinfo, data_tree);
1379}
1380
1381static void dissect_tns_connect(tvbuff_t *tvb, int offset, packet_info *pinfo _U___attribute__((unused)), proto_tree *tns_tree)
1382{
1383 proto_tree *connect_tree;
1384 uint32_t cd_offset, cd_len;
1385 int tns_offset = offset-8;
1386 static int * const flags[] = {
1387 &hf_tns_ntp_flag_hangon,
1388 &hf_tns_ntp_flag_crel,
1389 &hf_tns_ntp_flag_tduio,
1390 &hf_tns_ntp_flag_srun,
1391 &hf_tns_ntp_flag_dtest,
1392 &hf_tns_ntp_flag_cbio,
1393 &hf_tns_ntp_flag_asio,
1394 &hf_tns_ntp_flag_pio,
1395 &hf_tns_ntp_flag_grant,
1396 &hf_tns_ntp_flag_handoff,
1397 &hf_tns_ntp_flag_sigio,
1398 &hf_tns_ntp_flag_sigpipe,
1399 &hf_tns_ntp_flag_sigurg,
1400 &hf_tns_ntp_flag_urgentio,
1401 &hf_tns_ntp_flag_fdio,
1402 &hf_tns_ntp_flag_testop,
1403 NULL((void*)0)
1404 };
1405
1406 connect_tree = proto_tree_add_subtree(tns_tree, tvb, offset, -1,
1407 ett_tns_connect, NULL((void*)0), "Connect");
1408
1409 proto_tree_add_item(connect_tree, hf_tns_version, tvb,
1410 offset, 2, ENC_BIG_ENDIAN0x00000000);
1411 offset += 2;
1412
1413 proto_tree_add_item(connect_tree, hf_tns_compat_version, tvb,
1414 offset, 2, ENC_BIG_ENDIAN0x00000000);
1415 offset += 2;
1416
1417 proto_tree_add_bitmask(connect_tree, tvb, offset, hf_tns_service_options, ett_tns_sopt_flag, tns_service_options, ENC_BIG_ENDIAN0x00000000);
1418 offset += 2;
1419
1420 proto_tree_add_item(connect_tree, hf_tns_sdu_size, tvb,
1421 offset, 2, ENC_BIG_ENDIAN0x00000000);
1422 offset += 2;
1423
1424 proto_tree_add_item(connect_tree, hf_tns_max_tdu_size, tvb,
1425 offset, 2, ENC_BIG_ENDIAN0x00000000);
1426 offset += 2;
1427
1428 proto_tree_add_bitmask(connect_tree, tvb, offset, hf_tns_nt_proto_characteristics, ett_tns_ntp_flag, flags, ENC_BIG_ENDIAN0x00000000);
1429 offset += 2;
1430
1431 proto_tree_add_item(connect_tree, hf_tns_line_turnaround, tvb,
1432 offset, 2, ENC_BIG_ENDIAN0x00000000);
1433 offset += 2;
1434
1435 proto_tree_add_item(connect_tree, hf_tns_value_of_one, tvb,
1436 offset, 2, ENC_NA0x00000000);
1437 offset += 2;
1438
1439 proto_tree_add_item_ret_uint(connect_tree, hf_tns_connect_data_length, tvb,
1440 offset, 2, ENC_BIG_ENDIAN0x00000000, &cd_len);
1441 offset += 2;
1442
1443 proto_tree_add_item_ret_uint(connect_tree, hf_tns_connect_data_offset, tvb,
1444 offset, 2, ENC_BIG_ENDIAN0x00000000, &cd_offset);
1445 offset += 2;
1446
1447 proto_tree_add_item(connect_tree, hf_tns_connect_data_max, tvb,
1448 offset, 4, ENC_BIG_ENDIAN0x00000000);
1449 offset += 4;
1450
1451 proto_tree_add_bitmask(connect_tree, tvb, offset, hf_tns_connect_flags0, ett_tns_conn_flag, tns_connect_flags, ENC_BIG_ENDIAN0x00000000);
1452 offset += 1;
1453
1454 proto_tree_add_bitmask(connect_tree, tvb, offset, hf_tns_connect_flags1, ett_tns_conn_flag, tns_connect_flags, ENC_BIG_ENDIAN0x00000000);
1455 offset += 1;
1456
1457 /*
1458 * XXX - sometimes it appears that this stuff isn't present
1459 * in the packet.
1460 */
1461 if ((uint32_t)(offset + 16) <= tns_offset+cd_offset)
1462 {
1463 proto_tree_add_item(connect_tree, hf_tns_trace_cf1, tvb,
1464 offset, 4, ENC_BIG_ENDIAN0x00000000);
1465 offset += 4;
1466
1467 proto_tree_add_item(connect_tree, hf_tns_trace_cf2, tvb,
1468 offset, 4, ENC_BIG_ENDIAN0x00000000);
1469 offset += 4;
1470
1471 proto_tree_add_item(connect_tree, hf_tns_trace_cid, tvb,
1472 offset, 8, ENC_BIG_ENDIAN0x00000000);
1473 /* offset += 8;*/
1474 }
1475
1476 if ( cd_len > 0)
1477 {
1478 /* Long Connect Data (> 221 bytes?) is not in the Connect PDU
1479 * but sent in an immediately following Data PDU.
1480 */
1481 if (tvb_reported_length_remaining(tvb, tns_offset + cd_offset)) {
1482 proto_tree_add_item(connect_tree, hf_tns_connect_data, tvb,
1483 tns_offset+cd_offset, -1, ENC_ASCII0x00000000);
1484 } else {
1485 proto_tree_add_expert(connect_tree, pinfo, &ei_tns_connect_data_next_packet, tvb, 0, 0);
1486 if (!PINFO_FD_VISITED(pinfo)((pinfo)->fd->visited)) {
1487 tns_conv_info_t *tns_info = tns_get_conv_info(pinfo);
1488 tns_info->pending_connect_data = cd_len;
1489 }
1490 }
1491 }
1492}
1493
1494static void dissect_tns_accept(tvbuff_t *tvb, int offset, packet_info *pinfo _U___attribute__((unused)), proto_tree *tns_tree)
1495{
1496 proto_tree *accept_tree;
1497 uint32_t accept_offset, accept_len;
1498 int tns_offset = offset-8;
1499
1500 accept_tree = proto_tree_add_subtree(tns_tree, tvb, offset, -1,
1501 ett_tns_accept, NULL((void*)0), "Accept");
1502
1503 proto_tree_add_item(accept_tree, hf_tns_version, tvb,
1504 offset, 2, ENC_BIG_ENDIAN0x00000000);
1505 offset += 2;
1506
1507 proto_tree_add_bitmask(accept_tree, tvb, offset, hf_tns_service_options, ett_tns_sopt_flag, tns_service_options, ENC_BIG_ENDIAN0x00000000);
1508 offset += 2;
1509
1510 proto_tree_add_item(accept_tree, hf_tns_sdu_size, tvb,
1511 offset, 2, ENC_BIG_ENDIAN0x00000000);
1512 offset += 2;
1513
1514 proto_tree_add_item(accept_tree, hf_tns_max_tdu_size, tvb,
1515 offset, 2, ENC_BIG_ENDIAN0x00000000);
1516 offset += 2;
1517
1518 proto_tree_add_item(accept_tree, hf_tns_value_of_one, tvb,
1519 offset, 2, ENC_NA0x00000000);
1520 offset += 2;
1521
1522 proto_tree_add_item_ret_uint(accept_tree, hf_tns_accept_data_length, tvb,
1523 offset, 2, ENC_BIG_ENDIAN0x00000000, &accept_len);
1524 offset += 2;
1525
1526 proto_tree_add_item_ret_uint(accept_tree, hf_tns_accept_data_offset, tvb,
1527 offset, 2, ENC_BIG_ENDIAN0x00000000, &accept_offset);
1528 offset += 2;
1529
1530 proto_tree_add_bitmask(accept_tree, tvb, offset, hf_tns_connect_flags0, ett_tns_conn_flag, tns_connect_flags, ENC_BIG_ENDIAN0x00000000);
1531 offset += 1;
1532
1533 proto_tree_add_bitmask(accept_tree, tvb, offset, hf_tns_connect_flags1, ett_tns_conn_flag, tns_connect_flags, ENC_BIG_ENDIAN0x00000000);
1534 /* offset += 1; */
1535
1536 if ( accept_len > 0)
1537 {
1538 proto_tree_add_item(accept_tree, hf_tns_accept_data, tvb,
1539 tns_offset+accept_offset, -1, ENC_ASCII0x00000000);
1540 }
1541 return;
1542}
1543
1544
1545static void dissect_tns_refuse(tvbuff_t *tvb, int offset, packet_info *pinfo _U___attribute__((unused)), proto_tree *tns_tree)
1546{
1547 /* TODO
1548 * According to some reverse engineers, the refuse packet is also sent when the login fails.
1549 * Byte 54 shows if this is due to invalid ID (0x02) or password (0x03).
1550 * At now we do not have pcaps with such messages to check this statement.
1551 */
1552 proto_tree *refuse_tree;
1553
1554 refuse_tree = proto_tree_add_subtree(tns_tree, tvb, offset, -1,
1555 ett_tns_refuse, NULL((void*)0), "Refuse");
1556
1557 proto_tree_add_item(refuse_tree, hf_tns_refuse_reason_user, tvb,
1558 offset, 1, ENC_BIG_ENDIAN0x00000000);
1559 offset += 1;
1560
1561 proto_tree_add_item(refuse_tree, hf_tns_refuse_reason_system, tvb,
1562 offset, 1, ENC_BIG_ENDIAN0x00000000);
1563 offset += 1;
1564
1565 proto_tree_add_item(refuse_tree, hf_tns_refuse_data_length, tvb,
1566 offset, 2, ENC_BIG_ENDIAN0x00000000);
1567 offset += 2;
1568
1569 proto_tree_add_item(refuse_tree, hf_tns_refuse_data, tvb,
1570 offset, -1, ENC_ASCII0x00000000);
1571}
1572
1573
1574static void dissect_tns_abort(tvbuff_t *tvb, int offset, packet_info *pinfo _U___attribute__((unused)), proto_tree *tns_tree)
1575{
1576 proto_tree *abort_tree;
1577
1578 abort_tree = proto_tree_add_subtree(tns_tree, tvb, offset, -1,
1579 ett_tns_abort, NULL((void*)0), "Abort");
1580
1581 proto_tree_add_item(abort_tree, hf_tns_abort_reason_user, tvb,
1582 offset, 1, ENC_BIG_ENDIAN0x00000000);
1583 offset += 1;
1584
1585 proto_tree_add_item(abort_tree, hf_tns_abort_reason_system, tvb,
1586 offset, 1, ENC_BIG_ENDIAN0x00000000);
1587 offset += 1;
1588
1589 proto_tree_add_item(abort_tree, hf_tns_abort_data, tvb,
1590 offset, -1, ENC_ASCII0x00000000);
1591}
1592
1593
1594static void dissect_tns_marker(tvbuff_t *tvb, int offset, packet_info *pinfo _U___attribute__((unused)), proto_tree *tns_tree, int is_attention)
1595{
1596 proto_tree *marker_tree;
1597
1598 if ( is_attention )
1599 {
1600 marker_tree = proto_tree_add_subtree(tns_tree, tvb, offset, -1,
1601 ett_tns_marker, NULL((void*)0), "Marker");
1602 }
1603 else
1604 {
1605 marker_tree = proto_tree_add_subtree(tns_tree, tvb, offset, -1,
1606 ett_tns_marker, NULL((void*)0), "Attention");
1607 }
1608
1609 proto_tree_add_item(marker_tree, hf_tns_marker_type, tvb,
1610 offset, 1, ENC_BIG_ENDIAN0x00000000);
1611 offset += 1;
1612
1613 proto_tree_add_item(marker_tree, hf_tns_marker_data_byte, tvb,
1614 offset, 1, ENC_BIG_ENDIAN0x00000000);
1615 offset += 1;
1616
1617 proto_tree_add_item(marker_tree, hf_tns_marker_data_byte, tvb,
1618 offset, 1, ENC_BIG_ENDIAN0x00000000);
1619 /*offset += 1;*/
1620}
1621
1622static void dissect_tns_redirect(tvbuff_t *tvb, int offset, packet_info *pinfo _U___attribute__((unused)), proto_tree *tns_tree)
1623{
1624 proto_tree *redirect_tree;
1625
1626 redirect_tree = proto_tree_add_subtree(tns_tree, tvb, offset, -1,
1627 ett_tns_redirect, NULL((void*)0), "Redirect");
1628
1629 proto_tree_add_item(redirect_tree, hf_tns_redirect_data_length, tvb,
1630 offset, 2, ENC_BIG_ENDIAN0x00000000);
1631 offset += 2;
1632
1633 proto_tree_add_item(redirect_tree, hf_tns_redirect_data, tvb,
1634 offset, -1, ENC_ASCII0x00000000);
1635}
1636
1637static void dissect_tns_control(tvbuff_t *tvb, int offset, packet_info *pinfo _U___attribute__((unused)), proto_tree *tns_tree)
1638{
1639 proto_tree *control_tree;
1640
1641 control_tree = proto_tree_add_subtree(tns_tree, tvb, offset, -1,
1642 ett_tns_control, NULL((void*)0), "Control");
1643
1644 proto_tree_add_item(control_tree, hf_tns_control_cmd, tvb,
1645 offset, 2, ENC_BIG_ENDIAN0x00000000);
1646 offset += 2;
1647
1648 proto_tree_add_item(control_tree, hf_tns_control_data, tvb,
1649 offset, -1, ENC_NA0x00000000);
1650}
1651
1652static unsigned
1653get_tns_pdu_len(packet_info *pinfo _U___attribute__((unused)), tvbuff_t *tvb, int offset, void *data _U___attribute__((unused)))
1654{
1655 /*
1656 * Get the 16-bit length of the TNS message, including header
1657 */
1658 unsigned length = tvb_get_ntohs(tvb, offset);
1659 offset += 4;
1660 uint8_t type = tvb_get_uint8(tvb, offset);
1661 /* Type 0xf (data descriptor, LOB/FILE data) has data which follows
1662 * immediately (no new PDU header) but is not counted in the PDU
1663 * length field either.
1664 */
1665 if (type == TNS_TYPE_DD15) {
1666 offset += 8;
1667 if (!tvb_bytes_exist(tvb, offset, 4)) {
1668 /* return 0 makes tcp_dissect_pdus() report
1669 * DESEGMENT_ONE_MORE_SEGMENT to the TCP dissector.
1670 */
1671 return 0;
1672 }
1673 unsigned dd_len = tvb_get_ntohl(tvb, offset);
1674 return length + dd_len;
1675 }
1676 return length;
1677}
1678
1679static unsigned
1680get_tns_pdu_len_nochksum(packet_info *pinfo _U___attribute__((unused)), tvbuff_t *tvb, int offset, void *data _U___attribute__((unused)))
1681{
1682 /*
1683 * Get the 32-bit length of the TNS message, including header
1684 */
1685 unsigned length = tvb_get_ntohl(tvb, offset);
1686 offset += 4;
1687 uint8_t type = tvb_get_uint8(tvb, offset);
1688 /* Type 0xf (data descriptor, LOB/FILE data) has data which follows
1689 * immediately (no new PDU header) but is not counted in the PDU
1690 * length field either.
1691 */
1692 if (type == TNS_TYPE_DD15) {
1693 offset += 8;
1694 if (!tvb_bytes_exist(tvb, offset, 4)) {
1695 /* return 0 makes tcp_dissect_pdus() report
1696 * DESEGMENT_ONE_MORE_SEGMENT to the TCP dissector.
1697 */
1698 return 0;
1699 }
1700 unsigned dd_len = tvb_get_ntohl(tvb, offset);
1701 return length + dd_len;
1702 }
1703
1704 return length;
1705}
1706
1707static int
1708dissect_tns(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
1709{
1710 uint32_t length;
1711 uint16_t chksum;
1712 uint8_t type;
1713
1714 /*
1715 * First, do a sanity check to make sure what we have
1716 * starts with a TNS PDU.
1717 */
1718 if (tvb_bytes_exist(tvb, 4, 1)) {
1719 /*
1720 * Well, we have the packet type; let's make sure
1721 * it's a known type.
1722 */
1723 type = tvb_get_uint8(tvb, 4);
1724 if (type < TNS_TYPE_CONNECT1 || type > TNS_TYPE_MAX19)
1725 return 0; /* it's not a known type */
1726 }
1727
1728 /*
1729 * In some messages (observed in Oracle12c) packet length has 4 bytes
1730 * instead of 2.
1731 *
1732 * If packet length has 2 bytes, length and checksum equals two unsigned
1733 * 16-bit numbers. Packet checksum is generally unused (equal zero),
1734 * but 10g client may set 2nd byte to 4.
1735 *
1736 * Else, Oracle 12c combine these two 16-bit numbers into one 32-bit.
1737 * This number represents the packet length. Checksum is omitted.
1738 */
1739 chksum = tvb_get_ntohs(tvb, 2);
1740
1741 length = (chksum == 0 || chksum == 4) ? 2 : 4;
1742
1743 tcp_dissect_pdus(tvb, pinfo, tree, tns_desegment, TNS_HDR_LEN8,
1744 (length == 2 ? get_tns_pdu_len : get_tns_pdu_len_nochksum),
1745 dissect_tns_pdu, data);
1746
1747 return tvb_captured_length(tvb);
1748}
1749
1750static int
1751dissect_tns_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U___attribute__((unused)))
1752{
1753 proto_tree *tns_tree, *ti;
1754 proto_item *hidden_item;
1755 unsigned offset = 0;
1756 uint32_t length;
1757 uint16_t chksum;
1758 uint8_t type;
1759
1760 col_set_str(pinfo->cinfo, COL_PROTOCOL, "TNS");
1761
1762 col_set_str(pinfo->cinfo, COL_INFO,
1763 (pinfo->match_uint == pinfo->destport) ? "Request" : "Response");
1764
1765 ti = proto_tree_add_item(tree, proto_tns, tvb, 0, -1, ENC_NA0x00000000);
1766 tns_tree = proto_item_add_subtree(ti, ett_tns);
1767
1768 if (pinfo->match_uint == pinfo->destport)
1769 {
1770 hidden_item = proto_tree_add_boolean(tns_tree, hf_tns_request,
1771 tvb, offset, 0, true1);
1772 }
1773 else
1774 {
1775 hidden_item = proto_tree_add_boolean(tns_tree, hf_tns_response,
1776 tvb, offset, 0, true1);
1777 }
1778 proto_item_set_hidden(hidden_item);
1779
1780 chksum = tvb_get_ntohs(tvb, offset+2);
1781 if (chksum == 0 || chksum == 4)
1782 {
1783 proto_tree_add_item_ret_uint(tns_tree, hf_tns_length, tvb, offset,
1784 2, ENC_BIG_ENDIAN0x00000000, &length);
1785 offset += 2;
1786 proto_tree_add_checksum(tns_tree, tvb, offset, hf_tns_packet_checksum,
1787 -1, NULL((void*)0), pinfo, 0, ENC_BIG_ENDIAN0x00000000, PROTO_CHECKSUM_NO_FLAGS0x00);
1788 offset += 2;
1789 }
1790 else
1791 {
1792 /* Oracle 12c uses checksum bytes as part of the packet length. */
1793 proto_tree_add_item_ret_uint(tns_tree, hf_tns_length, tvb, offset,
1794 4, ENC_BIG_ENDIAN0x00000000, &length);
1795 offset += 4;
1796 }
1797
1798 type = tvb_get_uint8(tvb, offset);
1799 proto_tree_add_uint(tns_tree, hf_tns_packet_type, tvb,
1800 offset, 1, type);
1801 offset += 1;
1802
1803 col_append_fstr(pinfo->cinfo, COL_INFO, ", %s (%u)",
1804 val_to_str_const(type, tns_type_vals, "Unknown"), type);
1805
1806 proto_tree_add_item(tns_tree, hf_tns_reserved_byte, tvb,
1807 offset, 1, ENC_NA0x00000000);
1808 offset += 1;
1809
1810 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);
1811 offset += 2;
1812
1813 switch (type)
1814 {
1815 case TNS_TYPE_CONNECT1:
1816 dissect_tns_connect(tvb,offset,pinfo,tns_tree);
1817 break;
1818 case TNS_TYPE_ACCEPT2:
1819 dissect_tns_accept(tvb,offset,pinfo,tns_tree);
1820 break;
1821 case TNS_TYPE_REFUSE4:
1822 dissect_tns_refuse(tvb,offset,pinfo,tns_tree);
1823 break;
1824 case TNS_TYPE_REDIRECT5:
1825 dissect_tns_redirect(tvb,offset,pinfo,tns_tree);
1826 break;
1827 case TNS_TYPE_ABORT9:
1828 dissect_tns_abort(tvb,offset,pinfo,tns_tree);
1829 break;
1830 case TNS_TYPE_MARKER12:
1831 dissect_tns_marker(tvb,offset,pinfo,tns_tree, 0);
1832 break;
1833 case TNS_TYPE_ATTENTION13:
1834 dissect_tns_marker(tvb,offset,pinfo,tns_tree, 1);
1835 break;
1836 case TNS_TYPE_CONTROL14:
1837 dissect_tns_control(tvb,offset,pinfo,tns_tree);
1838 break;
1839 case TNS_TYPE_DATA6:
1840 dissect_tns_data(tvb,offset,pinfo,tns_tree);
1841 break;
1842 case TNS_TYPE_DD15:
1843 dissect_tns_data_descriptor(tvb,offset,pinfo,tns_tree, length);
1844 break;
1845 default:
1846 call_data_dissector(tvb_new_subset_remaining(tvb, offset), pinfo,
1847 tns_tree);
1848 break;
1849 }
1850
1851 return tvb_captured_length(tvb);
1852}
1853
1854void proto_register_tns(void)
1855{
1856 static hf_register_info hf[] = {
1857 { &hf_tns_response, {
1858 "Response", "tns.response", FT_BOOLEAN, BASE_NONE,
1859 NULL((void*)0), 0x0, "true if TNS response", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
1860 { &hf_tns_request, {
1861 "Request", "tns.request", FT_BOOLEAN, BASE_NONE,
1862 NULL((void*)0), 0x0, "true if TNS request", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
1863 { &hf_tns_length, {
1864 "Packet Length", "tns.length", FT_UINT32, BASE_DEC,
1865 NULL((void*)0), 0x0, "Length of TNS packet", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
1866 { &hf_tns_packet_checksum, {
1867 "Packet Checksum", "tns.packet_checksum", FT_UINT16, BASE_HEX,
1868 NULL((void*)0), 0x0, "Checksum of Packet Data", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
1869 { &hf_tns_header_checksum, {
1870 "Header Checksum", "tns.header_checksum", FT_UINT16, BASE_HEX,
1871 NULL((void*)0), 0x0, "Checksum of Header Data", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
1872
1873 { &hf_tns_version, {
1874 "Version", "tns.version", FT_UINT16, BASE_DEC,
1875 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
1876 { &hf_tns_compat_version, {
1877 "Version (Compatible)", "tns.compat_version", FT_UINT16, BASE_DEC,
1878 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
1879
1880 { &hf_tns_service_options, {
1881 "Service Options", "tns.service_options", FT_UINT16, BASE_HEX,
1882 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
1883
1884 { &hf_tns_sopt_flag_bconn, {
1885 "Broken Connect Notify", "tns.so_flag.bconn", FT_BOOLEAN, 16,
1886 NULL((void*)0), 0x2000, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
1887 { &hf_tns_sopt_flag_pc, {
1888 "Packet Checksum", "tns.so_flag.pc", FT_BOOLEAN, 16,
1889 NULL((void*)0), 0x1000, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
1890 { &hf_tns_sopt_flag_hc, {
1891 "Header Checksum", "tns.so_flag.hc", FT_BOOLEAN, 16,
1892 NULL((void*)0), 0x0800, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
1893 { &hf_tns_sopt_flag_fd, {
1894 "Full Duplex", "tns.so_flag.fd", FT_BOOLEAN, 16,
1895 NULL((void*)0), 0x0400, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
1896 { &hf_tns_sopt_flag_hd, {
1897 "Half Duplex", "tns.so_flag.hd", FT_BOOLEAN, 16,
1898 NULL((void*)0), 0x0200, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
1899 { &hf_tns_sopt_flag_dc1, {
1900 "Don't Care", "tns.so_flag.dc1", FT_BOOLEAN, 16,
1901 NULL((void*)0), 0x0100, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
1902 { &hf_tns_sopt_flag_dc2, {
1903 "Don't Care", "tns.so_flag.dc2", FT_BOOLEAN, 16,
1904 NULL((void*)0), 0x0080, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
1905 { &hf_tns_sopt_flag_dio, {
1906 "Direct IO to Transport", "tns.so_flag.dio", FT_BOOLEAN, 16,
1907 NULL((void*)0), 0x0010, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
1908 { &hf_tns_sopt_flag_ap, {
1909 "Attention Processing", "tns.so_flag.ap", FT_BOOLEAN, 16,
1910 NULL((void*)0), 0x0008, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
1911 { &hf_tns_sopt_flag_ra, {
1912 "Can Receive Attention", "tns.so_flag.ra", FT_BOOLEAN, 16,
1913 NULL((void*)0), 0x0004, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
1914 { &hf_tns_sopt_flag_sa, {
1915 "Can Send Attention", "tns.so_flag.sa", FT_BOOLEAN, 16,
1916 NULL((void*)0), 0x0002, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
1917
1918
1919 { &hf_tns_sdu_size, {
1920 "Session Data Unit Size", "tns.sdu_size", FT_UINT16, BASE_DEC,
1921 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
1922 { &hf_tns_max_tdu_size, {
1923 "Maximum Transmission Data Unit Size", "tns.max_tdu_size", FT_UINT16, BASE_DEC,
1924 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
1925
1926 { &hf_tns_nt_proto_characteristics, {
1927 "NT Protocol Characteristics", "tns.nt_proto_characteristics", FT_UINT16, BASE_HEX,
1928 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
1929 { &hf_tns_ntp_flag_hangon, {
1930 "Hangon to listener connect", "tns.ntp_flag.hangon", FT_BOOLEAN, 16,
1931 NULL((void*)0), 0x8000, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
1932 { &hf_tns_ntp_flag_crel, {
1933 "Confirmed release", "tns.ntp_flag.crel", FT_BOOLEAN, 16,
1934 NULL((void*)0), 0x4000, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
1935 { &hf_tns_ntp_flag_tduio, {
1936 "TDU based IO", "tns.ntp_flag.tduio", FT_BOOLEAN, 16,
1937 NULL((void*)0), 0x2000, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
1938 { &hf_tns_ntp_flag_srun, {
1939 "Spawner running", "tns.ntp_flag.srun", FT_BOOLEAN, 16,
1940 NULL((void*)0), 0x1000, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
1941 { &hf_tns_ntp_flag_dtest, {
1942 "Data test", "tns.ntp_flag.dtest", FT_BOOLEAN, 16,
1943 NULL((void*)0), 0x0800, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
1944 { &hf_tns_ntp_flag_cbio, {
1945 "Callback IO supported", "tns.ntp_flag.cbio", FT_BOOLEAN, 16,
1946 NULL((void*)0), 0x0400, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
1947 { &hf_tns_ntp_flag_asio, {
1948 "ASync IO Supported", "tns.ntp_flag.asio", FT_BOOLEAN, 16,
1949 NULL((void*)0), 0x0200, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
1950 { &hf_tns_ntp_flag_pio, {
1951 "Packet oriented IO", "tns.ntp_flag.pio", FT_BOOLEAN, 16,
1952 NULL((void*)0), 0x0100, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
1953 { &hf_tns_ntp_flag_grant, {
1954 "Can grant connection to another", "tns.ntp_flag.grant", FT_BOOLEAN, 16,
1955 NULL((void*)0), 0x0080, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
1956 { &hf_tns_ntp_flag_handoff, {
1957 "Can handoff connection to another", "tns.ntp_flag.handoff", FT_BOOLEAN, 16,
1958 NULL((void*)0), 0x0040, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
1959 { &hf_tns_ntp_flag_sigio, {
1960 "Generate SIGIO signal", "tns.ntp_flag.sigio", FT_BOOLEAN, 16,
1961 NULL((void*)0), 0x0020, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
1962 { &hf_tns_ntp_flag_sigpipe, {
1963 "Generate SIGPIPE signal", "tns.ntp_flag.sigpipe", FT_BOOLEAN, 16,
1964 NULL((void*)0), 0x0010, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
1965 { &hf_tns_ntp_flag_sigurg, {
1966 "Generate SIGURG signal", "tns.ntp_flag.sigurg", FT_BOOLEAN, 16,
1967 NULL((void*)0), 0x0008, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
1968 { &hf_tns_ntp_flag_urgentio, {
1969 "Urgent IO supported", "tns.ntp_flag.urgentio", FT_BOOLEAN, 16,
1970 NULL((void*)0), 0x0004, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
1971 { &hf_tns_ntp_flag_fdio, {
1972 "Full duplex IO supported", "tns.ntp_flag.dfio", FT_BOOLEAN, 16,
1973 NULL((void*)0), 0x0002, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
1974 { &hf_tns_ntp_flag_testop, {
1975 "Test operation", "tns.ntp_flag.testop", FT_BOOLEAN, 16,
1976 NULL((void*)0), 0x0001, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
1977
1978
1979
1980
1981 { &hf_tns_line_turnaround, {
1982 "Line Turnaround Value", "tns.line_turnaround", FT_UINT16, BASE_DEC,
1983 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
1984 { &hf_tns_value_of_one, {
1985 "Value of 1 in Hardware", "tns.value_of_one", FT_BYTES, BASE_NONE,
1986 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
1987
1988 { &hf_tns_connect_data_length, {
1989 "Length of Connect Data", "tns.connect_data_length", FT_UINT16,
1990 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) }},
1991 { &hf_tns_connect_data_offset, {
1992 "Offset to Connect Data", "tns.connect_data_offset", FT_UINT16, BASE_DEC,
1993 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
1994 { &hf_tns_connect_data_max, {
1995 "Maximum Receivable Connect Data", "tns.connect_data_max", FT_UINT32, BASE_DEC,
1996 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
1997
1998 { &hf_tns_connect_flags0, {
1999 "Connect Flags 0", "tns.connect_flags0", FT_UINT8, BASE_HEX,
2000 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2001 { &hf_tns_connect_flags1, {
2002 "Connect Flags 1", "tns.connect_flags1", FT_UINT8, BASE_HEX,
2003 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2004
2005 { &hf_tns_conn_flag_nareq, {
2006 "NA services required", "tns.connect_flags.nareq", FT_BOOLEAN, 8,
2007 NULL((void*)0), 0x10, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2008 { &hf_tns_conn_flag_nalink, {
2009 "NA services linked in", "tns.connect_flags.nalink", FT_BOOLEAN, 8,
2010 NULL((void*)0), 0x08, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2011 { &hf_tns_conn_flag_enablena, {
2012 "NA services enabled", "tns.connect_flags.enablena", FT_BOOLEAN, 8,
2013 NULL((void*)0), 0x04, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2014 { &hf_tns_conn_flag_ichg, {
2015 "Interchange is involved", "tns.connect_flags.ichg", FT_BOOLEAN, 8,
2016 NULL((void*)0), 0x02, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2017 { &hf_tns_conn_flag_wantna, {
2018 "NA services wanted", "tns.connect_flags.wantna", FT_BOOLEAN, 8,
2019 NULL((void*)0), 0x01, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2020
2021
2022 { &hf_tns_trace_cf1, {
2023 "Trace Cross Facility Item 1", "tns.trace_cf1", FT_UINT32, BASE_HEX,
2024 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2025 { &hf_tns_trace_cf2, {
2026 "Trace Cross Facility Item 2", "tns.trace_cf2", FT_UINT32, BASE_HEX,
2027 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2028 { &hf_tns_trace_cid, {
2029 "Trace Unique Connection ID", "tns.trace_cid", FT_UINT64, BASE_HEX,
2030 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2031 { &hf_tns_connect_data, {
2032 "Connect Data", "tns.connect_data", FT_STRING, BASE_NONE,
2033 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2034
2035 { &hf_tns_accept_data_length, {
2036 "Accept Data Length", "tns.accept_data_length", FT_UINT16,
2037 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) }},
2038 { &hf_tns_accept_data, {
2039 "Accept Data", "tns.accept_data", FT_STRING, BASE_NONE,
2040 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2041 { &hf_tns_accept_data_offset, {
2042 "Offset to Accept Data", "tns.accept_data_offset", FT_UINT16, BASE_DEC,
2043 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2044
2045 { &hf_tns_refuse_reason_user, {
2046 "Refuse Reason (User)", "tns.refuse_reason_user", FT_UINT8, BASE_HEX,
2047 NULL((void*)0), 0x0, "Refuse Reason from Application", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2048 { &hf_tns_refuse_reason_system, {
2049 "Refuse Reason (System)", "tns.refuse_reason_system", FT_UINT8, BASE_HEX,
2050 NULL((void*)0), 0x0, "Refuse Reason from System", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2051 { &hf_tns_refuse_data_length, {
2052 "Refuse Data Length", "tns.refuse_data_length", FT_UINT16,
2053 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) }},
2054 { &hf_tns_refuse_data, {
2055 "Refuse Data", "tns.refuse_data", FT_STRING, BASE_NONE,
2056 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2057
2058 { &hf_tns_abort_reason_user, {
2059 "Abort Reason (User)", "tns.abort_reason_user", FT_UINT8, BASE_HEX,
2060 NULL((void*)0), 0x0, "Abort Reason from Application", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2061 { &hf_tns_abort_reason_system, {
2062 "Abort Reason (User)", "tns.abort_reason_system", FT_UINT8, BASE_HEX,
2063 NULL((void*)0), 0x0, "Abort Reason from System", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2064 { &hf_tns_abort_data, {
2065 "Abort Data", "tns.abort_data", FT_STRING, BASE_NONE,
2066 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2067
2068 { &hf_tns_marker_type, {
2069 "Marker Type", "tns.marker.type", FT_UINT8, BASE_HEX,
2070 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) }},
2071 { &hf_tns_marker_data_byte, {
2072 "Marker Data Byte", "tns.marker.databyte", FT_UINT8, BASE_HEX,
2073 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2074#if 0
2075 { &hf_tns_marker_data, {
2076 "Marker Data", "tns.marker.data", FT_UINT16, BASE_HEX,
2077 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2078#endif
2079
2080 { &hf_tns_control_cmd, {
2081 "Control Command", "tns.control.cmd", FT_UINT16, BASE_HEX,
2082 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) }},
2083 { &hf_tns_control_data, {
2084 "Control Data", "tns.control.data", FT_BYTES, BASE_NONE,
2085 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2086
2087 { &hf_tns_redirect_data_length, {
2088 "Redirect Data Length", "tns.redirect_data_length", FT_UINT16,
2089 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) }},
2090 { &hf_tns_redirect_data, {
2091 "Redirect Data", "tns.redirect_data", FT_STRING, BASE_NONE,
2092 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2093
2094 { &hf_tns_data_flag, {
2095 "Data Flag", "tns.data_flag", FT_UINT16, BASE_HEX,
2096 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2097 { &hf_tns_data_flag_send, {
2098 "Send Token", "tns.data_flag.send", FT_BOOLEAN, 16,
2099 NULL((void*)0), 0x1, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2100 { &hf_tns_data_flag_rc, {
2101 "Request Confirmation", "tns.data_flag.rc", FT_BOOLEAN, 16,
2102 NULL((void*)0), 0x2, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2103 { &hf_tns_data_flag_c, {
2104 "Confirmation", "tns.data_flag.c", FT_BOOLEAN, 16,
2105 NULL((void*)0), 0x4, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2106 { &hf_tns_data_flag_reserved, {
2107 "Reserved", "tns.data_flag.reserved", FT_BOOLEAN, 16,
2108 NULL((void*)0), 0x8, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2109 { &hf_tns_data_flag_more, {
2110 "More Data to Come", "tns.data_flag.more", FT_BOOLEAN, 16,
2111 NULL((void*)0), 0x0020, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2112 { &hf_tns_data_flag_eof, {
2113 "End of File", "tns.data_flag.eof", FT_BOOLEAN, 16,
2114 NULL((void*)0), 0x0040, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2115 { &hf_tns_data_flag_dic, {
2116 "Do Immediate Confirmation", "tns.data_flag.dic", FT_BOOLEAN, 16,
2117 NULL((void*)0), 0x0080, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2118 { &hf_tns_data_flag_rts, {
2119 "Request To Send", "tns.data_flag.rts", FT_BOOLEAN, 16,
2120 NULL((void*)0), 0x0100, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2121 { &hf_tns_data_flag_sntt, {
2122 "Send NT Trailer", "tns.data_flag.sntt", FT_BOOLEAN, 16,
2123 NULL((void*)0), 0x0200, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2124
2125 { &hf_tns_data_id, {
2126 "Data ID", "tns.data_id", FT_UINT32, BASE_HEX,
2127 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) }},
2128 { &hf_tns_data_length, {
2129 "Data Length", "tns.data_length", FT_UINT32,
2130 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) }},
2131
2132 { &hf_tns_data_oci_id, {
2133 "Call ID", "tns.data_oci.id", FT_UINT8, BASE_HEX|BASE_EXT_STRING0x00000200,
2134 &tns_data_oci_subfuncs_ext, 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2135
2136 { &hf_tns_data_tseq, {
2137 "TSeq", "tns.data_tseq", FT_UINT8, BASE_HEX,
2138 NULL((void*)0), 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2139
2140 { &hf_tns_data_piggyback_id, {
2141 /* Also Call ID.
2142 Piggyback is a message what calls a small subset of functions
2143 declared in tns_data_oci_subfuncs. */
2144 "Call ID", "tns.data_piggyback.id", FT_UINT8, BASE_HEX|BASE_EXT_STRING0x00000200,
2145 &tns_data_oci_subfuncs_ext, 0x00, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2146
2147 { &hf_tns_data_unused, {
2148 "Unused", "tns.data.unused", FT_BYTES, BASE_NONE,
2149 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2150
2151 { &hf_tns_cursor, {
2152 "Cursor", "tns.data.cursor", FT_UINT32, BASE_DEC,
2153 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2154
2155 { &hf_tns_data_setp_acc_version, {
2156 "Accepted Version", "tns.data_setp_req.acc_vers", FT_UINT8, BASE_DEC,
2157 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2158 { &hf_tns_data_setp_cli_plat, {
2159 "Client Platform", "tns.data_setp_req.cli_plat", FT_STRINGZ, BASE_NONE,
2160 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2161 { &hf_tns_data_setp_version, {
2162 "Version", "tns.data_setp_resp.version", FT_UINT8, BASE_DEC,
2163 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2164 { &hf_tns_data_setp_banner, {
2165 "Server Banner", "tns.data_setp_resp.banner", FT_STRINGZ, BASE_NONE,
2166 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2167
2168 { &hf_tns_data_sns_cli_vers, {
2169 "Client Version", "tns.data_sns.cli_vers", FT_UINT32, BASE_CUSTOM,
2170 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) }},
2171 { &hf_tns_data_sns_srv_vers, {
2172 "Server Version", "tns.data_sns.srv_vers", FT_UINT32, BASE_CUSTOM,
2173 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) }},
2174 { &hf_tns_data_sns_srvcnt, {
2175 "Services", "tns.data_sns.srvcnt", FT_UINT16, BASE_DEC,
2176 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2177
2178 { &hf_tns_data_setdt_charset_in, {
2179 "Charset In", "tns.data_setdt.charset_in", FT_UINT16, BASE_DEC,
2180 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) }},
2181 { &hf_tns_data_setdt_charset_out, {
2182 "Charset Out", "tns.data_setdt.charset_out", FT_UINT16, BASE_DEC,
2183 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) }},
2184 { &hf_tns_data_setdt_flag, {
2185 "Flag", "tns.data_setdt.flag", FT_UINT8, BASE_HEX,
2186 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2187 { &hf_tns_data_setdt_caphdr, {
2188 "Capability Header", "tns.data_setdt.caphdr", FT_BYTES, BASE_NONE,
2189 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2190 { &hf_tns_data_setdt_caphdr_version, {
2191 "Version", "tns.data_setdt.caphdr.version", FT_UINT24, BASE_HEX,
2192 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2193 { &hf_tns_data_setdt_caphdr_flags, {
2194 "Flags", "tns.data_setdt.caphdr.flags", FT_BYTES, BASE_NONE,
2195 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2196 { &hf_tns_data_setdt_tblhdr, {
2197 "Table Header", "tns.data_setdt.tblhdr", FT_BYTES, BASE_NONE,
2198 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2199 { &hf_tns_data_setdt_idmap, {
2200 "Identity Map", "tns.data_setdt.idmap", FT_BYTES, BASE_NONE,
2201 NULL((void*)0), 0x0, "245 entries: type N -> repr N (default mapping)", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2202 { &hf_tns_data_setdt_overrides, {
2203 "Type Overrides", "tns.data_setdt.overrides", FT_NONE, BASE_NONE,
2204 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2205 { &hf_tns_data_setdt_override_client, {
2206 "Client Type", "tns.data_setdt.override.client", FT_UINT8, BASE_DEC,
2207 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) }},
2208 { &hf_tns_data_setdt_override_repr, {
2209 "Server Repr", "tns.data_setdt.override.repr", FT_UINT8, BASE_DEC,
2210 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) }},
2211 { &hf_tns_data_setdt_override_format, {
2212 "Format", "tns.data_setdt.override.format", FT_UINT8, BASE_DEC,
2213 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2214
2215 { &hf_tns_data_oer_call_status, {
2216 "Call Status", "tns.data_oer.call_status", FT_INT32, BASE_DEC,
2217 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2218 { &hf_tns_data_oer_rowcount, {
2219 "Row Count", "tns.data_oer.rowcount", FT_INT32, BASE_DEC,
2220 NULL((void*)0), 0x0, "DML affected rows (11g)", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2221 { &hf_tns_data_oer_err_code, {
2222 "Error Code", "tns.data_oer.err_code", FT_INT32, BASE_DEC,
2223 NULL((void*)0), 0x0, "ORA-NNNNN (0 = success)", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2224 { &hf_tns_data_oer_cursor_id, {
2225 "Cursor Id", "tns.data_oer.cursor_id", FT_INT32, BASE_DEC,
2226 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2227 { &hf_tns_data_oer_n_batch_errcodes, {
2228 "Batch Error Codes", "tns.data_oer.n_batch_errcodes", FT_INT32, BASE_DEC,
2229 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2230 { &hf_tns_data_oer_n_batch_offsets, {
2231 "Batch Error Offsets", "tns.data_oer.n_batch_offsets", FT_INT32, BASE_DEC,
2232 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2233 { &hf_tns_data_oer_n_batch_messages, {
2234 "Batch Error Messages", "tns.data_oer.n_batch_messages", FT_INT32, BASE_DEC,
2235 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2236 { &hf_tns_data_oer_message, {
2237 "Message", "tns.data_oer.message", FT_STRING, BASE_NONE,
2238 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2239
2240 { &hf_tns_data_opi_version2_banner_len, {
2241 "Banner Length", "tns.data_opi.vers2.banner_len", FT_UINT8, BASE_DEC,
2242 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2243 { &hf_tns_data_opi_version2_banner, {
2244 "Banner", "tns.data_opi.vers2.banner", FT_STRING, BASE_NONE,
2245 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2246 { &hf_tns_data_opi_version2_vsnum, {
2247 "Version", "tns.data_opi.vers2.version", FT_UINT32, BASE_CUSTOM,
2248 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) }},
2249
2250 { &hf_tns_data_opi_num_of_params, {
2251 "Number of parameters", "tns.data_opi.num_of_params", FT_UINT8, BASE_DEC,
2252 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2253 { &hf_tns_data_opi_param_length, {
2254 "Length", "tns.data_opi.param_length", FT_UINT8, BASE_DEC,
2255 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2256 { &hf_tns_data_opi_param_name, {
2257 "Name", "tns.data_opi.param_name", FT_STRING, BASE_NONE,
2258 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2259 { &hf_tns_data_opi_param_value, {
2260 "Value", "tns.data_opi.param_value", FT_STRING, BASE_NONE,
2261 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2262
2263 { &hf_tns_data_descriptor_row_count, {
2264 "Row Count", "tns.data_descriptor.row_count", FT_UINT32, BASE_DEC,
2265 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2266 { &hf_tns_data_descriptor_row_size, {
2267 "Row Size", "tns.data_descriptor.row_size", FT_UINT32, BASE_DEC,
2268 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2269
2270 { &hf_tns_reserved_byte, {
2271 "Reserved Byte", "tns.reserved_byte", FT_BYTES, BASE_NONE,
2272 NULL((void*)0), 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2273 { &hf_tns_packet_type, {
2274 "Packet Type", "tns.type", FT_UINT8, BASE_DEC,
2275 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) }}
2276
2277 };
2278
2279 static int *ett[] = {
2280 &ett_tns,
2281 &ett_tns_connect,
2282 &ett_tns_accept,
2283 &ett_tns_refuse,
2284 &ett_tns_abort,
2285 &ett_tns_redirect,
2286 &ett_tns_marker,
2287 &ett_tns_attention,
2288 &ett_tns_control,
2289 &ett_tns_data,
2290 &ett_tns_data_flag,
2291 &ett_tns_acc_versions,
2292 &ett_tns_opi_params,
2293 &ett_tns_opi_par,
2294 &ett_tns_sopt_flag,
2295 &ett_tns_ntp_flag,
2296 &ett_tns_conn_flag,
2297 &ett_tns_rows,
2298 &ett_tns_setdt_caphdr,
2299 &ett_tns_setdt_overrides,
2300 &ett_tns_setdt_override,
2301 &ett_tns_oer,
2302 &ett_sql
2303 };
2304
2305 static ei_register_info ei[] = {
2306 { &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)}}
}},
2307 { &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)}}
}},
2308 { &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)}}
}},
2309 };
2310
2311 module_t *tns_module;
2312 expert_module_t* expert_tns;
2313
2314 proto_tns = proto_register_protocol("Transparent Network Substrate Protocol", "TNS", "tns");
2315 proto_register_field_array(proto_tns, hf, array_length(hf)(sizeof (hf) / sizeof (hf)[0]));
2316 proto_register_subtree_array(ett, array_length(ett)(sizeof (ett) / sizeof (ett)[0]));
2317 expert_tns = expert_register_protocol(proto_tns);
2318 expert_register_field_array(expert_tns, ei, array_length(ei)(sizeof (ei) / sizeof (ei)[0]));
2319 tns_handle = register_dissector("tns", dissect_tns, proto_tns);
2320
2321 tns_module = prefs_register_protocol(proto_tns, NULL((void*)0));
2322 prefs_register_bool_preference(tns_module, "desegment_tns_messages",
2323 "Reassemble TNS messages spanning multiple TCP segments",
2324 "Whether the TNS dissector should reassemble messages spanning multiple TCP segments. "
2325 "To use this option, you must also enable \"Allow subdissectors to reassemble TCP streams\" in the TCP protocol settings.",
2326 &tns_desegment);
2327}
2328
2329void
2330proto_reg_handoff_tns(void)
2331{
2332 dissector_add_uint_with_preference("tcp.port", TCP_PORT_TNS1521, tns_handle);
2333}
2334
2335/*
2336 * Editor modelines - https://www.wireshark.org/tools/modelines.html
2337 *
2338 * Local variables:
2339 * c-basic-offset: 8
2340 * tab-width: 8
2341 * indent-tabs-mode: t
2342 * End:
2343 *
2344 * vi: set shiftwidth=8 tabstop=8 noexpandtab:
2345 * :indentSize=8:tabSize=8:noTabs=false:
2346 */