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