HACK: pinfo->private_data points to smb_info again
[wireshark-wip.git] / epan / dissectors / packet-gdsdb.c
blob97b198dd99fd8cbfc9203ad4c64f8d4c1ebe401e
1 /* packet-gdsdb.c
2 * Routines for Firebird/Interbase dissection
3 * Copyright 2007, Moshe van der Sterre <moshevds@gmail.com>
5 * $Id$
7 * Wireshark - Network traffic analyzer
8 * By Gerald Combs <gerald@wireshark.org>
9 * Copyright 1998 Gerald Combs
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License
13 * as published by the Free Software Foundation; either version 2
14 * of the License, or (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
26 #include "config.h"
28 #include <glib.h>
30 #include <epan/packet.h>
32 #define TCP_PORT 3050
34 static int proto_gdsdb = -1;
35 static gint ett_gdsdb = -1;
36 static int hf_gdsdb_opcode = -1;
37 /* static gint ett_gdsdb_opcode = -1; */
39 /* gdsdb_dummy */
40 /* gdsdb_connect */
41 static int hf_gdsdb_connect_operation = -1;
42 static int hf_gdsdb_connect_version = -1;
43 static int hf_gdsdb_connect_client = -1;
44 static int hf_gdsdb_connect_filename = -1;
45 static int hf_gdsdb_connect_count = -1;
46 static int hf_gdsdb_connect_userid = -1;
47 static int hf_gdsdb_connect_pref = -1;
48 static gint ett_gdsdb_connect_pref = -1;
49 static int hf_gdsdb_connect_pref_version = -1;
50 static int hf_gdsdb_connect_pref_architecture = -1;
51 static int hf_gdsdb_connect_pref_mintype = -1;
52 static int hf_gdsdb_connect_pref_maxtype = -1;
53 static int hf_gdsdb_connect_pref_weight = -1;
54 /* gdsdb_accept */
55 static int hf_gdsdb_accept_version = -1;
56 static int hf_gdsdb_accept_architecture = -1;
57 /* gdsdb_request */
58 static int hf_gdsdb_request_type = -1;
59 static int hf_gdsdb_request_object = -1;
60 static int hf_gdsdb_request_partner = -1;
61 /* gdsdb_attach */
62 static int hf_gdsdb_attach_database = -1;
63 static int hf_gdsdb_attach_filename = -1;
64 static int hf_gdsdb_attach_dpb = -1;
65 /* gdsdb_compile */
66 static int hf_gdsdb_compile_database = -1;
67 static int hf_gdsdb_compile_blr = -1;
68 /* gdsdb_receive */
69 static int hf_gdsdb_receive_request = -1;
70 static int hf_gdsdb_receive_incarnation = -1;
71 static int hf_gdsdb_receive_transaction = -1;
72 static int hf_gdsdb_receive_msgnr = -1;
73 static int hf_gdsdb_receive_messages = -1;
74 static int hf_gdsdb_receive_direction = -1;
75 static int hf_gdsdb_receive_offset = -1;
76 /* gdsdb_send */
77 static int hf_gdsdb_send_request = -1;
78 static int hf_gdsdb_send_incarnation = -1;
79 static int hf_gdsdb_send_transaction = -1;
80 static int hf_gdsdb_send_msgnr = -1;
81 static int hf_gdsdb_send_messages = -1;
82 /* gdsdb_response */
83 static int hf_gdsdb_response_object = -1;
84 static int hf_gdsdb_response_blobid = -1;
85 static int hf_gdsdb_response_data = -1;
86 static int hf_gdsdb_response_status = -1;
87 /* gdsdb_transact */
88 static int hf_gdsdb_transact_database = -1;
89 static int hf_gdsdb_transact_transaction = -1;
90 #if 0
91 static int hf_gdsdb_transact_messages = -1;
92 #endif
93 /* gdsdb_transact_response */
94 static int hf_gdsdb_transactresponse_messages = -1;
95 /* gdsdb_open_blob2 */
96 static int hf_gdsdb_openblob2_bpb = -1;
97 /* gdsdb_open_blob */
98 static int hf_gdsdb_openblob_transaction = -1;
99 static int hf_gdsdb_openblob_id = -1;
100 #if 0
101 /* gdsdb_segment */
102 static int hf_gdsdb_segment_blob = -1;
103 static int hf_gdsdb_segment_length = -1;
104 static int hf_gdsdb_segment_segment = -1;
105 /* gdsdb_seek_blob */
106 static int hf_gdsdb_seekblob_blob = -1;
107 static int hf_gdsdb_seekblob_mode = -1;
108 /* gdsdb_reconnect */
109 static int hf_gdsdb_reconnect_database = -1;
110 #endif
111 /* gdsdb_info & gdsdb_service_start */
112 static int hf_gdsdb_info_object = -1;
113 static int hf_gdsdb_info_incarnation = -1;
114 static int hf_gdsdb_info_items = -1;
115 static int hf_gdsdb_info_buffer_length = -1;
116 #if 0
117 /* gdsdb_release */
118 static int hf_gdsdb_release_object = -1;
119 /* gdsdb_prepare2 */
120 static int hf_gdsdb_prepare2_transaction = -1;
121 /* gdsdb_event & gdsdb_cancel_events */
122 static int hf_gdsdb_event_database = -1;
123 static int hf_gdsdb_event_items = -1;
124 static int hf_gdsdb_event_ast = -1;
125 static int hf_gdsdb_event_arg = -1;
126 static int hf_gdsdb_event_rid = -1;
127 /* gdsdb_ddl */
128 static int hf_gdsdb_ddl_database = -1;
129 static int hf_gdsdb_ddl_transaction = -1;
130 static int hf_gdsdb_ddl_blr = -1;
131 /* gdsdb_slice */
132 static int hf_gdsdb_slice_transaction = -1;
133 static int hf_gdsdb_slice_id = -1;
134 static int hf_gdsdb_slice_sdl = -1;
135 static int hf_gdsdb_slice_parameters = -1;
136 /* gdsdb_slice_response */
137 static int hf_gdsdb_sliceresponse_length = -1;
138 /* gdsdb_execute */
139 static int hf_gdsdb_execute_statement = -1;
140 static int hf_gdsdb_execute_transaction = -1;
141 static int hf_gdsdb_execute_message_number = -1;
142 static int hf_gdsdb_execute_messages = -1;
143 /* gdsdb_execute2 */
144 static int hf_gdsdb_execute_outblr = -1;
145 static int hf_gdsdb_execute_outmsgnr = -1;
146 /* gdsdb_exec_immediate2 */
147 static int hf_gdsdb_prepare2_blr = -1;
148 static int hf_gdsdb_prepare2_number = -1;
149 static int hf_gdsdb_prepare2_messages = -1;
150 static int hf_gdsdb_prepare2_outblr = -1;
151 static int hf_gdsdb_prepare2_outmsgnr = -1;
152 #endif
153 /* gdsdb_prepare */
154 static int hf_gdsdb_prepare_transaction = -1;
155 static int hf_gdsdb_prepare_statement = -1;
156 static int hf_gdsdb_prepare_dialect = -1;
157 static int hf_gdsdb_prepare_querystr = -1;
158 static int hf_gdsdb_prepare_items = -1;
159 static int hf_gdsdb_prepare_bufferlength = -1;
160 #if 0
161 /* gdsdb_fetch */
162 static int hf_gdsdb_fetch_statement = -1;
163 static int hf_gdsdb_fetch_message_number = -1;
164 static int hf_gdsdb_fetch_messages = -1;
165 /* gdsdb_fetch_response */
166 static int hf_gdsdb_fetchresponse_status = -1;
167 static int hf_gdsdb_fetchresponse_messages = -1;
168 /* gdsdb_free_statement */
169 static int hf_gdsdb_free_statement = -1;
170 static int hf_gdsdb_free_option = -1;
171 /* gdsdb_insert */
172 static int hf_gdsdb_insert_statement = -1;
173 static int hf_gdsdb_insert_message_number = -1;
174 static int hf_gdsdb_insert_messages = -1;
175 /* gdsdb_cursor */
176 static int hf_gdsdb_cursor_statement = -1;
177 static int hf_gdsdb_cursor_type = -1;
178 /* gdsdb_sql_response */
179 static int hf_gdsdb_sqlresponse_messages = -1;
180 #endif
182 enum
184 op_void = 0,
185 op_connect = 1,
186 op_exit = 2,
187 op_accept = 3,
188 op_reject = 4,
189 op_protocol = 5,
190 op_disconnect = 6,
191 op_credit = 7,
192 op_continuation = 8,
193 op_response = 9,
194 op_open_file = 10,
195 op_create_file = 11,
196 op_close_file = 12,
197 op_read_page = 13,
198 op_write_page = 14,
199 op_lock = 15,
200 op_convert_lock = 16,
201 op_release_lock = 17,
202 op_blocking = 18,
203 op_attach = 19,
204 op_create = 20,
205 op_detach = 21,
206 op_compile = 22,
207 op_start = 23,
208 op_start_and_send = 24,
209 op_send = 25,
210 op_receive = 26,
211 op_unwind = 27,
212 op_release = 28,
213 op_transaction = 29,
214 op_commit = 30,
215 op_rollback = 31,
216 op_prepare = 32,
217 op_reconnect = 33,
218 op_create_blob = 34,
219 op_open_blob = 35,
220 op_get_segment = 36,
221 op_put_segment = 37,
222 op_cancel_blob = 38,
223 op_close_blob = 39,
224 op_info_database = 40,
225 op_info_request = 41,
226 op_info_transaction = 42,
227 op_info_blob = 43,
228 op_batch_segments = 44,
229 op_mgr_set_affinity = 45,
230 op_mgr_clear_affinity = 46,
231 op_mgr_report = 47,
232 op_que_events = 48,
233 op_cancel_events = 49,
234 op_commit_retaining = 50,
235 op_prepare2 = 51,
236 op_event = 52,
237 op_connect_request = 53,
238 op_aux_connect = 54,
239 op_ddl = 55,
240 op_open_blob2 = 56,
241 op_create_blob2 = 57,
242 op_get_slice = 58,
243 op_put_slice = 59,
244 op_slice = 60,
245 op_seek_blob = 61,
246 op_allocate_statement = 62,
247 op_execute = 63,
248 op_exec_immediate = 64,
249 op_fetch = 65,
250 op_fetch_response = 66,
251 op_free_statement = 67,
252 op_prepare_statement = 68,
253 op_set_cursor = 69,
254 op_info_sql = 70,
255 op_dummy = 71,
256 op_response_piggyback = 72,
257 op_start_and_receive = 73,
258 op_start_send_and_receive = 74,
259 op_exec_immediate2 = 75,
260 op_execute2 = 76,
261 op_insert = 77,
262 op_sql_response = 78,
263 op_transact = 79,
264 op_transact_response = 80,
265 op_drop_database = 81,
266 op_service_attach = 82,
267 op_service_detach = 83,
268 op_service_info = 84,
269 op_service_start = 85,
270 op_rollback_retaining = 86,
271 op_max
274 static const value_string gdsdb_opcode[] = {
275 { op_void, "Void" },
276 { op_connect, "Connect" },
277 { op_exit, "Exit" },
278 { op_accept, "Accept" },
279 { op_reject, "Reject" },
280 { op_protocol, "Protocol" },
281 { op_disconnect, "Disconnect" },
282 { op_credit, "Credit" },
283 { op_continuation, "Continuation" },
284 { op_response, "Response" },
285 { op_open_file, "Open file" },
286 { op_create_file, "Create file" },
287 { op_close_file, "Close file" },
288 { op_read_page, "Read page" },
289 { op_write_page, "Write page" },
290 { op_lock, "Lock" },
291 { op_convert_lock, "Convert lock" },
292 { op_release_lock, "Release lock" },
293 { op_blocking, "Blocking" },
294 { op_attach, "Attach" },
295 { op_create, "Create" },
296 { op_detach, "Detach" },
297 { op_compile, "Compile" },
298 { op_start, "Start" },
299 { op_start_and_send, "Start and send" },
300 { op_send, "Send" },
301 { op_receive, "Receive" },
302 { op_unwind, "Unwind" },
303 { op_release, "Release" },
304 { op_transaction, "Transaction" },
305 { op_commit, "Commit" },
306 { op_rollback, "Rollback" },
307 { op_prepare, "Prepare" },
308 { op_reconnect, "Reconnect" },
309 { op_create_blob, "Create blob" },
310 { op_open_blob, "Open blob" },
311 { op_get_segment, "Get segment" },
312 { op_put_segment, "Put segment" },
313 { op_cancel_blob, "Cancel blob" },
314 { op_close_blob, "Close blob" },
315 { op_info_database, "Info database" },
316 { op_info_request, "Info request" },
317 { op_info_transaction, "Info transaction" },
318 { op_info_blob, "Info blob" },
319 { op_batch_segments, "Batch segments" },
320 { op_mgr_set_affinity, "Mgr set affinity" },
321 { op_mgr_clear_affinity, "Mgr clear affinity" },
322 { op_mgr_report, "Mgr report" },
323 { op_que_events, "Que events" },
324 { op_cancel_events, "Cancel events" },
325 { op_commit_retaining, "Commit retaining" },
326 { op_prepare2, "Prepare 2" },
327 { op_event, "Event" },
328 { op_connect_request, "Connect request" },
329 { op_aux_connect, "Aux connect" },
330 { op_ddl, "DDl" },
331 { op_open_blob2, "Open blob 2" },
332 { op_create_blob2, "Create blob 2" },
333 { op_get_slice, "Get slice" },
334 { op_put_slice, "Put slice" },
335 { op_slice, "Slice" },
336 { op_seek_blob, "Seek blob" },
337 { op_allocate_statement, "Allocate statement" },
338 { op_execute, "Execute" },
339 { op_exec_immediate, "Exec immediate" },
340 { op_fetch, "Fetch" },
341 { op_fetch_response, "Fetch response" },
342 { op_free_statement, "Free statement" },
343 { op_prepare_statement, "Prepare statement" },
344 { op_set_cursor, "Set cursor" },
345 { op_info_sql, "Info sql" },
346 { op_dummy, "Dummy" },
347 { op_response_piggyback, "Response piggyback" },
348 { op_start_and_receive, "Start and receive" },
349 { op_start_send_and_receive, "Start send and receive" },
350 { op_exec_immediate2, "Exec immediate 2" },
351 { op_execute2, "Execute 2" },
352 { op_insert, "Insert" },
353 { op_sql_response, "Sql response" },
354 { op_transact, "Transact" },
355 { op_transact_response, "Transact response" },
356 { op_drop_database, "Drop database" },
357 { op_service_attach, "Service attach" },
358 { op_service_detach, "Service detach" },
359 { op_service_info, "Service info" },
360 { op_service_start, "Service start" },
361 { op_rollback_retaining, "Rollback retaining" },
362 { 0, NULL }
365 static const value_string gdsdb_architectures[] = {
366 { 1, "Generic" },
367 { 2, "Apollo" },
368 { 3, "Sun" },
369 { 4, "Vms" },
370 { 5, "Ultrix" },
371 { 6, "Alliant" },
372 { 7, "MS-Dos" },
373 { 8, "Sun 4" },
374 { 9, "Sun 386" },
375 { 10, "HP-UX" },
376 { 11, "HP MPE/xl" },
377 { 12, "Mac" },
378 { 13, "Mac aux" },
379 { 14, "rt" },
380 { 15, "mips Ultrix" },
381 { 16, "HP-UX 68k" },
382 { 17, "Xenix" },
383 { 18, "Aviion" },
384 { 19, "SGI" },
385 { 20, "Apollo_dn10k" },
386 { 21, "Cray" },
387 { 22, "Imp" },
388 { 23, "Delta" },
389 { 24, "SCO" },
390 { 25, "Next" },
391 { 26, "Next 386" },
392 { 27, "m88k" },
393 { 28, "UnixWare" },
394 { 29, "Intel 32" },
395 { 30, "Epson" },
396 { 31, "Decosf" },
397 { 32, "Ncr3000" },
398 { 33, "NT PPC" },
399 { 34, "DG x86" },
400 { 35, "SCO ev" },
401 { 36, "Linux" },
402 { 37, "FreeBSD" },
403 { 38, "NetBSD" },
404 { 39, "Darwin PPC" },
405 { 0, NULL }
408 static int
409 gdsdb_dummy(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_)
411 /* Don't tell them we match */
412 return 0;
415 static int
416 gdsdb_connect(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
418 int offset;
419 int length;
420 int count;
421 int i;
422 proto_item *ti;
423 proto_tree *pref_tree;
425 if (tvb_length(tvb) < 16) {
426 return 0;
428 col_append_str(pinfo->cinfo, COL_INFO, ": ");
429 col_append_str(pinfo->cinfo, COL_INFO,
430 tvb_format_text(tvb, 20,
431 tvb_get_ntohl(tvb, 16)));
432 if (tree) {
433 offset = 4;
434 proto_tree_add_item(tree, hf_gdsdb_connect_operation, tvb,
435 offset, 4, ENC_BIG_ENDIAN);
436 offset += 4;
437 proto_tree_add_item(tree, hf_gdsdb_connect_version, tvb,
438 offset, 4, ENC_BIG_ENDIAN);
439 offset += 4;
440 proto_tree_add_item(tree, hf_gdsdb_connect_client, tvb,
441 offset, 4, ENC_BIG_ENDIAN);
442 offset += 4;
443 proto_tree_add_item(tree, hf_gdsdb_connect_filename, tvb,
444 offset, 4, ENC_ASCII|ENC_NA);
445 length = tvb_get_ntohl(tvb, offset);
446 offset += length + 6;
447 proto_tree_add_item(tree, hf_gdsdb_connect_count, tvb,
448 offset, 4, ENC_BIG_ENDIAN);
449 count = tvb_get_ntohl(tvb, offset);
450 offset += 4;
451 proto_tree_add_item(tree, hf_gdsdb_connect_userid, tvb,
452 offset, 4, ENC_ASCII|ENC_NA);
453 length = tvb_get_ntohl(tvb, offset);
454 offset += length + 5;
455 for(i=0;i<count;i++){
456 ti = proto_tree_add_item(tree, hf_gdsdb_connect_pref,
457 tvb, offset, 20, ENC_NA);
458 pref_tree = proto_item_add_subtree(ti,
459 ett_gdsdb_connect_pref);
460 proto_tree_add_item(pref_tree,
461 hf_gdsdb_connect_pref_version,
462 tvb, offset, 4, ENC_BIG_ENDIAN);
463 offset += 4;
464 proto_tree_add_item(pref_tree,
465 hf_gdsdb_connect_pref_architecture,
466 tvb, offset, 4, ENC_BIG_ENDIAN);
467 offset += 4;
468 proto_tree_add_item(pref_tree,
469 hf_gdsdb_connect_pref_mintype,
470 tvb, offset, 4, ENC_BIG_ENDIAN);
471 offset += 4;
472 proto_tree_add_item(pref_tree,
473 hf_gdsdb_connect_pref_maxtype,
474 tvb, offset, 4, ENC_BIG_ENDIAN);
475 offset += 4;
476 proto_tree_add_item(pref_tree,
477 hf_gdsdb_connect_pref_weight,
478 tvb, offset, 4, ENC_BIG_ENDIAN);
479 offset += 4;
483 return tvb_length(tvb);
486 static int
487 gdsdb_accept(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
489 int offset;
491 if (tvb_length(tvb) < 16) {
492 return 0;
494 if (tree) {
495 offset = 4;
496 proto_tree_add_item(tree, hf_gdsdb_accept_version, tvb,
497 offset, 4, ENC_BIG_ENDIAN);
498 offset += 4;
499 proto_tree_add_item(tree, hf_gdsdb_accept_architecture, tvb,
500 offset, 4, ENC_BIG_ENDIAN);
501 /*offset += 4;*/
504 return tvb_length(tvb);
507 static int
508 gdsdb_request(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
510 int offset;
512 if (tvb_length(tvb) < 20) {
513 return 0;
515 if (tree) {
516 offset = 4;
517 proto_tree_add_item(tree, hf_gdsdb_request_type, tvb,
518 offset, 4, ENC_BIG_ENDIAN);
519 offset += 4;
520 proto_tree_add_item(tree, hf_gdsdb_request_object, tvb,
521 offset, 4, ENC_BIG_ENDIAN);
522 offset += 4;
523 proto_tree_add_item(tree, hf_gdsdb_request_partner, tvb,
524 offset, 8, ENC_BIG_ENDIAN);
527 return tvb_length(tvb);
530 static int
531 gdsdb_attach(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
533 int offset;
534 int length;
536 if (tvb_length(tvb) < 20) {
537 return 0;
540 col_append_str(pinfo->cinfo, COL_INFO, ": ");
541 col_append_str(pinfo->cinfo, COL_INFO,
542 tvb_format_text(tvb, 12,
543 tvb_get_ntohl(tvb, 8)));
545 if (tree) {
546 offset = 4;
547 proto_tree_add_item(tree, hf_gdsdb_attach_database, tvb,
548 offset, 4, ENC_BIG_ENDIAN);
549 offset += 4;
550 proto_tree_add_item(tree, hf_gdsdb_attach_filename, tvb,
551 offset, 4, ENC_ASCII|ENC_NA);
552 length = tvb_get_ntohl(tvb, offset);
553 offset += length + 6;
554 proto_tree_add_uint_format_value(tree,
555 hf_gdsdb_attach_dpb, tvb, offset, 4 + length,
556 length, "%i data bytes", length);
559 return tvb_length(tvb);
562 static int
563 gdsdb_compile(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
565 int offset;
567 if (tvb_length(tvb) < 20) {
568 return 0;
570 if (tree) {
571 offset = 4;
572 proto_tree_add_item(tree, hf_gdsdb_compile_database, tvb,
573 offset, 4, ENC_BIG_ENDIAN);
574 offset += 4;
575 proto_tree_add_item(tree, hf_gdsdb_compile_blr, tvb,
576 offset, 4, ENC_ASCII|ENC_NA);
579 return tvb_length(tvb);
582 static int
583 gdsdb_receive(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
585 int offset;
587 if (tvb_length(tvb) < 20) {
588 return 0;
590 if (tree) {
591 offset = 4;
592 proto_tree_add_item(tree, hf_gdsdb_receive_request, tvb,
593 offset, 4, ENC_BIG_ENDIAN);
594 offset += 4;
595 proto_tree_add_item(tree, hf_gdsdb_receive_incarnation, tvb,
596 offset, 4, ENC_BIG_ENDIAN);
597 offset += 4;
598 proto_tree_add_item(tree, hf_gdsdb_receive_transaction, tvb,
599 offset, 4, ENC_BIG_ENDIAN);
600 offset += 4;
601 proto_tree_add_item(tree, hf_gdsdb_receive_msgnr, tvb,
602 offset, 4, ENC_BIG_ENDIAN);
603 offset += 4;
604 proto_tree_add_item(tree, hf_gdsdb_receive_messages, tvb,
605 offset, 4, ENC_BIG_ENDIAN);
606 offset += 4;
607 while(tvb_bytes_exist(tvb, offset, 12)) {
608 proto_tree_add_item(tree, hf_gdsdb_receive_direction,
609 tvb, offset, 4, ENC_BIG_ENDIAN);
610 offset += 4;
611 proto_tree_add_item(tree, hf_gdsdb_receive_offset,
612 tvb, offset, 8, ENC_BIG_ENDIAN);
613 offset += 8;
617 return tvb_length(tvb);
620 static int
621 gdsdb_send(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
623 int offset;
625 if (tvb_length(tvb) < 20) {
626 return 0;
628 if (tree) {
629 offset = 4;
630 proto_tree_add_item(tree, hf_gdsdb_send_request, tvb,
631 offset, 4, ENC_BIG_ENDIAN);
632 offset += 4;
633 proto_tree_add_item(tree, hf_gdsdb_send_incarnation, tvb,
634 offset, 4, ENC_BIG_ENDIAN);
635 offset += 4;
636 proto_tree_add_item(tree, hf_gdsdb_send_transaction, tvb,
637 offset, 4, ENC_BIG_ENDIAN);
638 offset += 4;
639 proto_tree_add_item(tree, hf_gdsdb_send_msgnr, tvb,
640 offset, 4, ENC_BIG_ENDIAN);
641 offset += 4;
642 proto_tree_add_item(tree, hf_gdsdb_send_messages, tvb,
643 offset, 4, ENC_BIG_ENDIAN);
646 return tvb_length(tvb);
649 static int
650 gdsdb_response(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
652 int offset;
653 int length;
655 if (tvb_length(tvb) < 32) {
656 return 0;
658 if (tree) {
659 offset = 4;
660 proto_tree_add_item(tree, hf_gdsdb_response_object, tvb,
661 offset, 4, ENC_BIG_ENDIAN);
662 offset += 4;
663 proto_tree_add_item(tree, hf_gdsdb_response_blobid, tvb,
664 offset, 8, ENC_BIG_ENDIAN);
665 offset += 8;
666 proto_tree_add_item(tree, hf_gdsdb_response_data, tvb,
667 offset, 4, ENC_ASCII|ENC_NA);
668 length = tvb_get_ntohl(tvb, offset);
669 offset += length + 4;
670 proto_tree_add_item(tree, hf_gdsdb_response_status, tvb,
671 offset, tvb_length(tvb) - offset, ENC_NA);
674 return tvb_length(tvb);
678 static int
679 gdsdb_transact(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
681 int offset;
683 if (tvb_length(tvb) < 20) {
684 return 0;
686 if (tree) {
687 offset = 4;
688 proto_tree_add_item(tree, hf_gdsdb_transact_database, tvb,
689 offset, 4, ENC_BIG_ENDIAN);
690 offset += 4;
691 proto_tree_add_item(tree, hf_gdsdb_transact_transaction, tvb,
692 offset, 4, ENC_BIG_ENDIAN);
695 return tvb_length(tvb);
698 static int
699 gdsdb_transact_response(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
701 int offset;
703 if (tvb_length(tvb) < 8) {
704 return 0;
706 if (tree) {
707 offset = 4;
708 proto_tree_add_item(tree, hf_gdsdb_transactresponse_messages,
709 tvb, offset, 4, ENC_BIG_ENDIAN);
712 return tvb_length(tvb);
715 static int
716 gdsdb_open_blob2(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
718 int offset;
719 int length;
721 if (!tvb_bytes_exist(tvb, 0, 20)) {
722 return 0;
724 if (tree) {
725 offset = 4;
726 proto_tree_add_item(tree, hf_gdsdb_openblob2_bpb, tvb, offset,
727 4, ENC_ASCII|ENC_NA);
728 length = tvb_get_ntohl(tvb, offset);
729 offset += length + 6;
730 proto_tree_add_item(tree, hf_gdsdb_openblob_transaction, tvb,
731 offset, 4, ENC_BIG_ENDIAN);
732 offset += 4;
733 proto_tree_add_item(tree, hf_gdsdb_openblob_id, tvb, offset,
734 8, ENC_BIG_ENDIAN);
737 return tvb_length(tvb);
740 static int
741 gdsdb_open_blob(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
743 int offset;
745 if (tvb_length(tvb) < 16) {
746 return 0;
748 if (tree) {
749 offset = 4;
750 proto_tree_add_item(tree, hf_gdsdb_openblob_transaction, tvb,
751 offset, 4, ENC_BIG_ENDIAN);
752 offset += 4;
753 proto_tree_add_item(tree, hf_gdsdb_openblob_id, tvb, offset,
754 8, ENC_BIG_ENDIAN);
757 return tvb_length(tvb);
760 static int
761 gdsdb_segment(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
763 /* int offset; */
765 if (tvb_length(tvb) < 16) {
766 return 0;
768 if (tree) {
769 /* hf_gdsdb_segment_blob */
770 /* hf_gdsdb_segment_length */
771 /* hf_gdsdb_segment_segment */
774 return tvb_length(tvb);
777 static int
778 gdsdb_seek_blob(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
780 /* int offset; */
782 if (tvb_length(tvb) < 16) {
783 return 0;
785 if (tree) {
786 /* hf_gdsdb_seekblob_blob */
787 /* hf_gdsdb_seekblob_mode */
790 return tvb_length(tvb);
793 static int
794 gdsdb_reconnect(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
796 /* int offset; */
798 if (tvb_length(tvb) < 12) {
799 return 0;
801 if (tree) {
802 /* hf_gdsdb_reconnect_database */
805 return tvb_length(tvb);
808 static int
809 gdsdb_info(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
811 int offset;
812 int length;
813 guint opcode;
815 if (tvb_length(tvb) < 20) {
816 return 0;
819 opcode = tvb_get_ntohl(tvb, 0);
821 if (tree) {
822 offset = 4;
823 proto_tree_add_item(tree, hf_gdsdb_info_object, tvb, offset,
824 4, ENC_BIG_ENDIAN);
825 offset += 4;
826 proto_tree_add_item(tree, hf_gdsdb_info_incarnation, tvb,
827 offset, 4, ENC_BIG_ENDIAN);
828 offset += 4;
829 if(opcode == op_service_info) {
830 proto_tree_add_item(tree, hf_gdsdb_info_items, tvb,
831 offset, 4, ENC_ASCII|ENC_NA);
832 length = tvb_get_ntohl(tvb, offset);
833 offset += length + 6;
835 proto_tree_add_item(tree, hf_gdsdb_info_buffer_length, tvb,
836 offset, 4, ENC_BIG_ENDIAN);
839 return tvb_length(tvb);
842 static int
843 gdsdb_service_start(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
845 /* int offset; */
847 if (tvb_length(tvb) < 16) {
848 return 0;
850 if (tree) {
851 /* hf_gdsdb_info_object */
852 /* hf_gdsdb_info_incarnation */
853 /* hf_gdsdb_info_items */
854 /* hf_gdsdb_info_buffer_length */
857 return tvb_length(tvb);
860 static int
861 gdsdb_release(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
863 /* int offset; */
865 if (tvb_length(tvb) < 8) {
866 return 0;
868 if (tree) {
869 /* hf_gdsdb_release_object */
872 return tvb_length(tvb);
875 #if 0
876 static int
877 gdsdb_prepare2(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
879 /* int offset; */
881 if (tvb_length(tvb) < 12) {
882 return 0;
884 if (tree) {
885 /* hf_gdsdb_prepare2_transaction */
888 return tvb_length(tvb);
890 #endif
892 static int
893 gdsdb_event(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
895 /* int offset; */
897 if (tvb_length(tvb) < 24) {
898 return 0;
900 if (tree) {
901 /* hf_gdsdb_event_database */
902 /* hf_gdsdb_event_items */
903 /* hf_gdsdb_event_ast */
904 /* hf_gdsdb_event_arg */
905 /* hf_gdsdb_event_rid */
907 return tvb_length(tvb);
910 static int
911 gdsdb_cancel_events(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
913 /* int offset; */
915 if (tvb_length(tvb) < 12) {
916 return 0;
918 if (tree) {
919 /* hf_gdsdb_event_database */
922 return tvb_length(tvb);
925 static int
926 gdsdb_ddl(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
928 /* int offset; */
930 if (tvb_length(tvb) < 16) {
931 return 0;
933 if (tree) {
934 /* hf_gdsdb_ddl_database */
935 /* hf_gdsdb_ddl_transaction */
936 /* hf_gdsdb_ddl_blr */
939 return tvb_length(tvb);
942 static int
943 gdsdb_slice(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
945 /* int offset; */
947 if (tvb_length(tvb) < 24) {
948 return 0;
950 if (tree) {
951 /* hf_gdsdb_slice_transaction */
952 /* hf_gdsdb_slice_id */
953 /* hf_gdsdb_slice_sdl */
954 /* hf_gdsdb_slice_parameters */
957 return tvb_length(tvb);
960 static int
961 gdsdb_slice_response(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
963 /* int offset; */
965 if (tvb_length(tvb) < 8) {
966 return 0;
968 if (tree) {
969 /* hf_gdsdb_sliceresponse_length */
972 return tvb_length(tvb);
975 static int
976 gdsdb_execute(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
978 /* int offset; */
980 if (tvb_length(tvb) < 12) {
981 return 0;
983 if (tree) {
984 /* hf_gdsdb_execute_statement */
985 /* hf_gdsdb_execute_transaction */
986 /* hf_gdsdb_execute_message_number */
987 /* hf_gdsdb_execute_messages */
990 return tvb_length(tvb);
993 static int
994 gdsdb_exec_immediate2(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
996 /* int offset; */
998 if (tvb_length(tvb) < 44) {
999 return 0;
1001 if (tree) {
1002 /* hf_gdsdb_prepare2_blr */
1003 /* hf_gdsdb_prepare2_number */
1004 /* hf_gdsdb_prepare2_messages */
1005 /* hf_gdsdb_prepare2_outblr */
1006 /* hf_gdsdb_prepare2_outmsgnr */
1009 return tvb_length(tvb);
1012 static int
1013 gdsdb_prepare(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
1015 int offset;
1016 int length;
1018 if (tvb_length(tvb) < 32) {
1019 return 0;
1021 col_append_str(pinfo->cinfo, COL_INFO, ": ");
1022 col_append_str(pinfo->cinfo, COL_INFO,
1023 tvb_format_text(tvb, 20,
1024 tvb_get_ntohl(tvb, 16)));
1026 if(tree) {
1027 offset = 4;
1028 proto_tree_add_item(tree, hf_gdsdb_prepare_transaction, tvb,
1029 offset, 4, ENC_BIG_ENDIAN);
1030 offset += 4;
1031 proto_tree_add_item(tree, hf_gdsdb_prepare_statement, tvb,
1032 offset, 4, ENC_BIG_ENDIAN);
1033 offset += 4;
1034 proto_tree_add_item(tree, hf_gdsdb_prepare_dialect, tvb,
1035 offset, 4, ENC_BIG_ENDIAN);
1036 offset += 4;
1037 proto_tree_add_item(tree, hf_gdsdb_prepare_querystr, tvb,
1038 offset, 4, ENC_ASCII|ENC_NA);
1039 length = tvb_get_ntohl(tvb, offset);
1040 offset += length + 6;
1041 proto_tree_add_uint_format_value(tree,
1042 hf_gdsdb_prepare_items, tvb, offset, 4 + length,
1043 length, "%i data bytes", length);
1044 offset += tvb_get_ntohl(tvb, offset) + 6;
1045 proto_tree_add_item(tree, hf_gdsdb_prepare_bufferlength, tvb,
1046 offset, 2, ENC_BIG_ENDIAN);
1049 return tvb_length(tvb);
1052 static int
1053 gdsdb_fetch(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
1055 /* int offset; */
1057 if (tvb_length(tvb) < 16) {
1058 return 0;
1060 if (tree) {
1061 /* hf_gdsdb_fetch_statement */
1062 /* hf_gdsdb_fetch_message_number */
1063 /* hf_gdsdb_fetch_messages */
1066 return tvb_length(tvb);
1069 static int
1070 gdsdb_fetch_response(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
1072 /* int offset; */
1074 if (tvb_length(tvb) < 12) {
1075 return 0;
1077 if (tree) {
1078 /* hf_gdsdb_fetchresponse_status */
1079 /* hf_gdsdb_fetchresponse_messages */
1082 return tvb_length(tvb);
1085 static int
1086 gdsdb_free_statement(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
1088 /* int offset; */
1090 if (tvb_length(tvb) < 12) {
1091 return 0;
1093 if (tree) {
1094 /* hf_gdsdb_free_statement */
1095 /* hf_gdsdb_free_option */
1098 return tvb_length(tvb);
1101 static int
1102 gdsdb_insert(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
1104 /* int offset; */
1106 if (tvb_length(tvb) < 16) {
1107 return 0;
1109 if (tree) {
1110 /* hf_gdsdb_insert_statement */
1111 /* hf_gdsdb_insert_message_number */
1112 /* hf_gdsdb_insert_messages */
1115 return tvb_length(tvb);
1118 static int
1119 gdsdb_cursor(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
1121 /* int offset; */
1123 if (tvb_length(tvb) < 16) {
1124 return 0;
1126 if (tree) {
1127 /* hf_gdsdb_cursor_statement */
1128 /* hf_gdsdb_cursor_type */
1131 return tvb_length(tvb);
1134 static int
1135 gdsdb_sql_response(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
1137 /* int offset; */
1139 if (tvb_length(tvb) < 8) {
1140 return 0;
1142 if (tree) {
1143 /* hf_gdsdb_sqlresponse_messages */
1146 return tvb_length(tvb);
1149 static int (*gdsdb_handle_opcode[])(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) = {
1150 gdsdb_dummy, /* op_void */
1151 gdsdb_connect, /* op_connect */
1152 gdsdb_dummy, /* op_exit */
1153 gdsdb_accept, /* op_accept */
1154 gdsdb_dummy, /* op_reject */
1155 gdsdb_dummy, /* op_protocol */
1156 gdsdb_dummy, /* op_disconnect */
1157 gdsdb_dummy, /* op_credit */
1158 gdsdb_dummy, /* op_continuation */
1159 gdsdb_response, /* op_response */
1160 gdsdb_dummy, /* op_open_file */
1161 gdsdb_dummy, /* op_create_file */
1162 gdsdb_dummy, /* op_close_file */
1163 gdsdb_dummy, /* op_read_page */
1164 gdsdb_dummy, /* op_write_page */
1165 gdsdb_dummy, /* op_lock */
1166 gdsdb_dummy, /* op_convert_lock */
1167 gdsdb_dummy, /* op_release_lock */
1168 gdsdb_dummy, /* op_blocking */
1169 gdsdb_attach, /* op_attach */
1170 gdsdb_attach, /* op_create */
1171 gdsdb_release, /* op_detach */
1172 gdsdb_compile, /* op_compile */
1173 gdsdb_receive, /* op_start */
1174 gdsdb_send, /* op_start_and_send */
1175 gdsdb_send, /* op_send */
1176 gdsdb_receive, /* op_receive */
1177 gdsdb_release, /* op_unwind */
1178 gdsdb_release, /* op_release */
1179 gdsdb_reconnect, /* op_transaction */
1180 gdsdb_release, /* op_commit */
1181 gdsdb_release, /* op_rollback */
1182 gdsdb_release, /* op_prepare */
1183 gdsdb_reconnect, /* op_reconnect */
1184 gdsdb_open_blob2, /* op_create_blob */
1185 gdsdb_open_blob, /* op_open_blob */
1186 gdsdb_segment, /* op_get_segment */
1187 gdsdb_segment, /* op_put_segment */
1188 gdsdb_release, /* op_cancel_blob */
1189 gdsdb_release, /* op_close_blob */
1190 gdsdb_info, /* op_info_database */
1191 gdsdb_info, /* op_info_request */
1192 gdsdb_info, /* op_info_transaction */
1193 gdsdb_info, /* op_info_blob */
1194 gdsdb_segment, /* op_batch_segments */
1195 gdsdb_dummy, /* op_mgr_set_affinity */
1196 gdsdb_dummy, /* op_mgr_clear_affinity */
1197 gdsdb_dummy, /* op_mgr_report */
1198 gdsdb_event, /* op_que_events */
1199 gdsdb_cancel_events, /* op_cancel_events */
1200 gdsdb_release, /* op_commit_retaining */
1201 gdsdb_release, /* op_prepare */
1202 gdsdb_event, /* op_event */
1203 gdsdb_request, /* op_connect_request */
1204 gdsdb_request, /* op_aux_connect */
1205 gdsdb_ddl, /* op_ddl */
1206 gdsdb_open_blob2, /* op_open_blob2 */
1207 gdsdb_open_blob2, /* op_create_blob2 */
1208 gdsdb_slice, /* op_get_slice */
1209 gdsdb_slice, /* op_put_slice */
1210 gdsdb_slice_response, /* op_slice */
1211 gdsdb_seek_blob, /* op_seek_blob */
1212 gdsdb_release, /* op_allocate_statement */
1213 gdsdb_execute, /* op_execute */
1214 gdsdb_prepare, /* op_exec_immediate */
1215 gdsdb_fetch, /* op_fetch */
1216 gdsdb_fetch_response, /* op_fetch_response */
1217 gdsdb_free_statement, /* op_free_statement */
1218 gdsdb_prepare, /* op_prepare_statement */
1219 gdsdb_cursor, /* op_set_cursor */
1220 gdsdb_info, /* op_info_sql */
1221 gdsdb_dummy, /* op_dummy */
1222 gdsdb_response, /* op_response_piggyback */
1223 gdsdb_receive, /* op_start_and_receive */
1224 gdsdb_send, /* op_start_send_and_receive */
1225 gdsdb_exec_immediate2, /* op_exec_immediate2 */
1226 gdsdb_execute, /* op_execute2 */
1227 gdsdb_insert, /* op_insert */
1228 gdsdb_sql_response, /* op_sql_response */
1229 gdsdb_transact, /* op_transact */
1230 gdsdb_transact_response, /* op_transact_response */
1231 gdsdb_release, /* op_drop_database */
1232 gdsdb_attach, /* op_service_attach */
1233 gdsdb_release, /* op_service_detach */
1234 gdsdb_info, /* op_service_info */
1235 gdsdb_service_start, /* op_service_start */
1236 gdsdb_release /* op_rollback_retaining */
1239 static int
1240 dissect_gdsdb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
1242 proto_item *ti;
1243 proto_tree *gdsdb_tree;
1244 guint opcode;
1245 packet_info nopi;
1247 gdsdb_tree = NULL; /* So the opcode functions can check on if(tree) */
1248 nopi.cinfo = NULL;
1250 if (tvb_length(tvb) < 4)
1251 return 0;
1253 opcode = tvb_get_ntohl(tvb, 0);
1254 if(opcode >= op_max)
1255 return 0;
1256 if(!gdsdb_handle_opcode[opcode](tvb, &nopi, NULL))
1257 return 0;
1259 col_set_str(pinfo->cinfo, COL_PROTOCOL, "GDS DB");
1261 col_add_str(pinfo->cinfo, COL_INFO,
1262 val_to_str(opcode, gdsdb_opcode, "Unknown opcode %u"));
1264 if (tree) {
1265 ti = proto_tree_add_item(tree, proto_gdsdb, tvb, 0, -1,
1266 ENC_NA);
1267 gdsdb_tree = proto_item_add_subtree(ti, ett_gdsdb);
1268 proto_tree_add_item(gdsdb_tree, hf_gdsdb_opcode, tvb,
1269 0, 4, ENC_BIG_ENDIAN);
1272 /* opcode < op_max */
1273 return gdsdb_handle_opcode[opcode](tvb, pinfo, gdsdb_tree);
1276 void
1277 proto_register_gdsdb(void)
1279 static hf_register_info hf[] = {
1280 { &hf_gdsdb_opcode,
1281 { "Opcode", "gdsdb.opcode",
1282 FT_UINT32, BASE_DEC, VALS(gdsdb_opcode), 0x0,
1283 NULL, HFILL }
1285 /* gdsdb_dummy */
1286 /* gdsdb_connect */
1287 { &hf_gdsdb_connect_operation,
1288 { "Operation", "gdsdb.connect.operation",
1289 FT_UINT32, BASE_DEC, VALS(gdsdb_opcode), 0x0,
1290 NULL, HFILL }
1292 { &hf_gdsdb_connect_version,
1293 { "Version", "gdsdb.connect.version",
1294 FT_UINT32, BASE_DEC, NULL, 0x0,
1295 NULL, HFILL }
1297 { &hf_gdsdb_connect_client,
1298 { "Client Architecture", "gdsdb.connect.client",
1299 FT_UINT32, BASE_DEC, VALS(gdsdb_architectures), 0x0,
1300 NULL, HFILL }
1302 { &hf_gdsdb_connect_filename,
1303 { "Filename", "gdsdb.connect.filename",
1304 FT_UINT_STRING, BASE_NONE, NULL, 0x0,
1305 NULL, HFILL }
1307 { &hf_gdsdb_connect_count,
1308 { "Version option count", "gdsdb.connect.count",
1309 FT_UINT32, BASE_DEC, NULL, 0x0,
1310 NULL, HFILL }
1312 { &hf_gdsdb_connect_userid,
1313 { "User ID", "gdsdb.connect.userid",
1314 FT_UINT_STRING, BASE_NONE, NULL, 0x0,
1315 NULL, HFILL }
1317 { &hf_gdsdb_connect_pref,
1318 { "Preferred version", "gdsdb.connect.pref",
1319 FT_NONE, BASE_NONE, NULL, 0x0,
1320 NULL, HFILL }
1322 { &hf_gdsdb_connect_pref_version,
1323 { "Version", "gdsdb.connect.pref.version",
1324 FT_UINT32, BASE_DEC, NULL, 0x0,
1325 NULL, HFILL }
1327 { &hf_gdsdb_connect_pref_architecture,
1328 { "Architecture", "gdsdb.connect.pref.arch",
1329 FT_UINT32, BASE_DEC, VALS(gdsdb_architectures), 0x0,
1330 NULL, HFILL }
1332 { &hf_gdsdb_connect_pref_mintype,
1333 { "Minimum type", "gdsdb.connect.pref.mintype",
1334 FT_UINT32, BASE_DEC, NULL, 0x0,
1335 NULL, HFILL }
1337 { &hf_gdsdb_connect_pref_maxtype,
1338 { "Maximum type", "gdsdb.connect.pref.maxtype",
1339 FT_UINT32, BASE_DEC, NULL, 0x0,
1340 NULL, HFILL }
1342 { &hf_gdsdb_connect_pref_weight,
1343 { "Preference weight", "gdsdb.connect.pref.weight",
1344 FT_UINT32, BASE_DEC, NULL, 0x0,
1345 NULL, HFILL }
1347 /* gdsdb_accept */
1348 { &hf_gdsdb_accept_version,
1349 { "Version", "gdsdb.accept.version",
1350 FT_UINT32, BASE_DEC, NULL, 0x0,
1351 NULL, HFILL }
1353 { &hf_gdsdb_accept_architecture,
1354 { "Architecture", "gdsdb.accept.arch",
1355 FT_UINT32, BASE_DEC, VALS(gdsdb_architectures), 0x0,
1356 NULL, HFILL }
1358 /* gdsdb_request */
1359 { &hf_gdsdb_request_type,
1360 { "Type", "gdsdb.connect.type",
1361 FT_UINT32, BASE_DEC, NULL, 0x0,
1362 NULL, HFILL }
1364 { &hf_gdsdb_request_object,
1365 { "Object", "gdsdb.connect.object",
1366 FT_UINT32, BASE_DEC, NULL, 0x0,
1367 NULL, HFILL }
1369 { &hf_gdsdb_request_partner,
1370 { "Partner", "gdsdb.connect.partner",
1371 FT_UINT64, BASE_DEC, NULL, 0x0,
1372 NULL, HFILL }
1374 /* gdsdb_attach */
1375 { &hf_gdsdb_attach_database,
1376 { "Database", "gdsdb.attach.database",
1377 FT_UINT32, BASE_DEC, NULL, 0x0,
1378 NULL, HFILL }
1380 { &hf_gdsdb_attach_filename,
1381 { "Filename", "gdsdb.attach.filename",
1382 FT_UINT_STRING, BASE_NONE, NULL, 0x0,
1383 NULL, HFILL }
1385 { &hf_gdsdb_attach_dpb,
1386 { "Database parameter block", "gdsdb.attach.dpblength",
1387 FT_UINT32, BASE_DEC, NULL, 0x0,
1388 NULL, HFILL }
1390 /* gdsdb_compile */
1391 { &hf_gdsdb_compile_database,
1392 { "Database", "gdsdb.compile.filename",
1393 FT_UINT32, BASE_DEC, NULL, 0x0,
1394 NULL, HFILL }
1396 { &hf_gdsdb_compile_blr,
1397 { "BLR", "gdsdb.compile.blr",
1398 FT_UINT_STRING, BASE_NONE, NULL, 0x0,
1399 NULL, HFILL }
1401 /* gdsdb_receive */
1402 { &hf_gdsdb_receive_request,
1403 { "Request", "gdsdb.receive.request",
1404 FT_UINT32, BASE_DEC, NULL, 0x0,
1405 NULL, HFILL }
1407 { &hf_gdsdb_receive_incarnation,
1408 { "Incarnation", "gdsdb.receive.incarnation",
1409 FT_UINT32, BASE_DEC, NULL, 0x0,
1410 NULL, HFILL }
1412 { &hf_gdsdb_receive_transaction,
1413 { "Transaction", "gdsdb.receive.transaction",
1414 FT_UINT32, BASE_DEC, NULL, 0x0,
1415 NULL, HFILL }
1417 { &hf_gdsdb_receive_msgnr,
1418 { "Message number", "gdsdb.receive.msgnr",
1419 FT_UINT32, BASE_DEC, NULL, 0x0,
1420 NULL, HFILL }
1422 { &hf_gdsdb_receive_messages,
1423 { "Message Count", "gdsdb.receive.msgcount",
1424 FT_UINT32, BASE_DEC, NULL, 0x0,
1425 NULL, HFILL }
1427 { &hf_gdsdb_receive_direction,
1428 { "Scroll direction", "gdsdb.receive.direction",
1429 FT_UINT32, BASE_DEC, NULL, 0x0,
1430 NULL, HFILL }
1432 { &hf_gdsdb_receive_offset,
1433 { "Scroll offset", "gdsdb.receive.offset",
1434 FT_UINT32, BASE_DEC, NULL, 0x0,
1435 NULL, HFILL }
1437 /* gdsdb_send */
1438 { &hf_gdsdb_send_request,
1439 { "Send request", "gdsdb.send.request",
1440 FT_UINT32, BASE_DEC, NULL, 0x0,
1441 NULL, HFILL }
1443 { &hf_gdsdb_send_incarnation,
1444 { "Send request", "gdsdb.send.incarnation",
1445 FT_UINT32, BASE_DEC, NULL, 0x0,
1446 NULL, HFILL }
1448 { &hf_gdsdb_send_transaction,
1449 { "Send request", "gdsdb.send.transaction",
1450 FT_UINT32, BASE_DEC, NULL, 0x0,
1451 NULL, HFILL }
1453 { &hf_gdsdb_send_msgnr,
1454 { "Send request", "gdsdb.send.msgnr",
1455 FT_UINT32, BASE_DEC, NULL, 0x0,
1456 NULL, HFILL }
1458 { &hf_gdsdb_send_messages,
1459 { "Send request", "gdsdb.send.messages",
1460 FT_UINT32, BASE_DEC, NULL, 0x0,
1461 NULL, HFILL }
1463 /* gdsdb_response */
1464 { &hf_gdsdb_response_object,
1465 { "Response object", "gdsdb.response.object",
1466 FT_UINT32, BASE_HEX, NULL, 0x0,
1467 NULL, HFILL }
1469 { &hf_gdsdb_response_blobid,
1470 { "Blob ID", "gdsdb.response.blobid",
1471 FT_UINT64, BASE_HEX, NULL, 0x0,
1472 NULL, HFILL }
1474 { &hf_gdsdb_response_data,
1475 { "Data", "gdsdb.response.data",
1476 FT_UINT_STRING, BASE_NONE, NULL, 0x0,
1477 NULL, HFILL }
1479 { &hf_gdsdb_response_status,
1480 { "Status vector", "gdsdb.response.status",
1481 FT_NONE, BASE_NONE, NULL, 0x0,
1482 NULL, HFILL }
1484 /* gdsdb_transact */
1485 { &hf_gdsdb_transact_database,
1486 { "Database", "gdsdb.transact.database",
1487 FT_UINT32, BASE_DEC, NULL, 0x0,
1488 NULL, HFILL }
1490 { &hf_gdsdb_transact_transaction,
1491 { "Database", "gdsdb.transact.transaction",
1492 FT_UINT32, BASE_DEC, NULL, 0x0,
1493 NULL, HFILL }
1495 #if 0
1496 { &hf_gdsdb_transact_messages,
1497 { "Messages", "gdsdb.transact.messages",
1498 FT_UINT32, BASE_DEC, NULL, 0x0,
1499 NULL, HFILL }
1501 #endif
1502 /* gdsdb_transact_response */
1503 { &hf_gdsdb_transactresponse_messages,
1504 { "Messages", "gdsdb.transactresponse.messages",
1505 FT_UINT32, BASE_DEC, NULL, 0x0,
1506 NULL, HFILL }
1508 /* gdsdb_open_blob2 */
1509 { &hf_gdsdb_openblob2_bpb,
1510 { "Blob parameter block", "gdsdb.openblob2.bpb",
1511 FT_UINT_STRING, BASE_NONE, NULL, 0x0,
1512 NULL, HFILL }
1514 /* gdsdb_open_blob */
1515 { &hf_gdsdb_openblob_transaction,
1516 { "Transaction", "gdsdb.openblob2.transaction",
1517 FT_UINT32, BASE_DEC, NULL, 0x0,
1518 NULL, HFILL }
1520 { &hf_gdsdb_openblob_id,
1521 { "ID", "gdsdb.openblob.id",
1522 FT_UINT64, BASE_HEX, NULL, 0x0,
1523 NULL, HFILL }
1525 #if 0
1526 /* gdsdb_segment */
1527 { &hf_gdsdb_segment_blob,
1528 { "Blob", "gdsdb.segment.blob",
1529 FT_UINT32, BASE_DEC, NULL, 0x0,
1530 NULL, HFILL }
1532 { &hf_gdsdb_segment_length,
1533 { "Length", "gdsdb.segment.length",
1534 FT_UINT32, BASE_DEC, NULL, 0x0,
1535 NULL, HFILL }
1537 { &hf_gdsdb_segment_segment,
1538 { "Segment", "gdsdb.segment.segment",
1539 FT_UINT_STRING, BASE_NONE, NULL, 0x0,
1540 NULL, HFILL }
1542 /* gdsdb_seek_blob */
1543 { &hf_gdsdb_seekblob_blob,
1544 { "Blob", "gdsdb.seekblob.blob",
1545 FT_UINT32, BASE_DEC, NULL, 0x0,
1546 NULL, HFILL }
1548 { &hf_gdsdb_seekblob_mode,
1549 { "Mode", "gdsdb.seekblob.mode",
1550 FT_UINT32, BASE_DEC, NULL, 0x0,
1551 NULL, HFILL }
1553 /* gdsdb_reconnect */
1554 { &hf_gdsdb_reconnect_database,
1555 { "Database", "gdsdb.reconnect.database",
1556 FT_UINT32, BASE_DEC, NULL, 0x0,
1557 NULL, HFILL }
1559 #endif
1560 /* gdsdb_info & gdsdb_service_start */
1561 { &hf_gdsdb_info_object,
1562 { "Object", "gdsdb.info.object",
1563 FT_UINT32, BASE_DEC, NULL, 0x0,
1564 NULL, HFILL }
1566 { &hf_gdsdb_info_incarnation,
1567 { "Incarnation", "gdsdb.info.incarnation",
1568 FT_UINT32, BASE_DEC, NULL, 0x0,
1569 NULL, HFILL }
1571 { &hf_gdsdb_info_items,
1572 { "Items", "gdsdb.info.items",
1573 FT_UINT_STRING, BASE_NONE, NULL, 0x0,
1574 NULL, HFILL }
1576 { &hf_gdsdb_info_buffer_length,
1577 { "Buffer length", "gdsdb.info.bufferlength",
1578 FT_UINT32, BASE_DEC, NULL, 0x0,
1579 NULL, HFILL }
1581 #if 0
1582 /* gdsdb_release */
1583 { &hf_gdsdb_release_object,
1584 { "Object", "gdsdb.release.object",
1585 FT_UINT32, BASE_DEC, NULL, 0x0,
1586 NULL, HFILL }
1588 /* gdsdb_prepare2 */
1589 { &hf_gdsdb_prepare2_transaction,
1590 { "Transaction", "gdsdb.prepare2.transaction",
1591 FT_UINT32, BASE_DEC, NULL, 0x0,
1592 NULL, HFILL }
1594 /* gdsdb_event & gdsdb_cancel_events */
1595 { &hf_gdsdb_event_database,
1596 { "Database", "gdsdb.event.database",
1597 FT_UINT32, BASE_DEC, NULL, 0x0,
1598 NULL, HFILL }
1600 { &hf_gdsdb_event_items,
1601 { "Event description block", "gdsdb.event.items",
1602 FT_UINT_STRING, BASE_NONE, NULL, 0x0,
1603 NULL, HFILL }
1605 { &hf_gdsdb_event_ast,
1606 { "ast routine", "gdsdb.event.ast",
1607 FT_UINT32, BASE_DEC, NULL, 0x0,
1608 NULL, HFILL }
1610 { &hf_gdsdb_event_arg,
1611 { "Argument to ast routine", "gdsdb.event.arg",
1612 FT_UINT32, BASE_DEC, NULL, 0x0,
1613 NULL, HFILL }
1615 { &hf_gdsdb_event_rid,
1616 { "ID", "gdsdb.event.id",
1617 FT_UINT32, BASE_DEC, NULL, 0x0,
1618 NULL, HFILL }
1620 /* gdsdb_ddl */
1621 { &hf_gdsdb_ddl_database,
1622 { "Database", "gdsdb.ddl.database",
1623 FT_UINT32, BASE_DEC, NULL, 0x0,
1624 NULL, HFILL }
1626 { &hf_gdsdb_ddl_transaction,
1627 { "Transaction", "gdsdb.ddl.transaction",
1628 FT_UINT32, BASE_DEC, NULL, 0x0,
1629 NULL, HFILL }
1631 { &hf_gdsdb_ddl_blr,
1632 { "BLR", "gdsdb.ddl.blr",
1633 FT_UINT_STRING, BASE_NONE, NULL, 0x0,
1634 NULL, HFILL }
1636 /* gdsdb_slice */
1637 { &hf_gdsdb_slice_transaction,
1638 { "Transaction", "gdsdb.slice.transaction",
1639 FT_UINT32, BASE_DEC, NULL, 0x0,
1640 NULL, HFILL }
1642 { &hf_gdsdb_slice_id,
1643 { "ID", "gdsdb.slice.id",
1644 FT_UINT64, BASE_HEX, NULL, 0x0,
1645 NULL, HFILL }
1647 { &hf_gdsdb_slice_sdl,
1648 { "Slice description language", "gdsdb.slice.sdl",
1649 FT_UINT_STRING, BASE_NONE, NULL, 0x0,
1650 NULL, HFILL }
1652 { &hf_gdsdb_slice_parameters,
1653 { "Parameters", "gdsdb.slice.parameters",
1654 FT_UINT32, BASE_DEC, NULL, 0x0,
1655 NULL, HFILL }
1657 /* gdsdb_slice_response */
1658 { &hf_gdsdb_sliceresponse_length,
1659 { "Length", "gdsdb.sliceresponse.length",
1660 FT_UINT32, BASE_DEC, NULL, 0x0,
1661 NULL, HFILL }
1663 /* gdsdb_execute */
1664 { &hf_gdsdb_execute_statement,
1665 { "Statement", "gdsdb.execute.statement",
1666 FT_UINT32, BASE_DEC, NULL, 0x0,
1667 NULL, HFILL }
1669 { &hf_gdsdb_execute_transaction,
1670 { "Transaction", "gdsdb.execute.transaction",
1671 FT_UINT32, BASE_DEC, NULL, 0x0,
1672 NULL, HFILL }
1674 { &hf_gdsdb_execute_message_number,
1675 { "Message number", "gdsdb.execute.messagenumber",
1676 FT_UINT32, BASE_DEC, NULL, 0x0,
1677 NULL, HFILL }
1679 { &hf_gdsdb_execute_messages,
1680 { "Number of messages", "gdsdb.execute.messages",
1681 FT_UINT32, BASE_DEC, NULL, 0x0,
1682 NULL, HFILL }
1684 /* gdsdb_execute2 */
1685 { &hf_gdsdb_execute_outblr,
1686 { "Output BLR", "gdsdb.execute.outblr",
1687 FT_UINT32, BASE_DEC, NULL, 0x0,
1688 NULL, HFILL }
1690 { &hf_gdsdb_execute_outmsgnr,
1691 { "Output Message number", "gdsdb.execute.outmsgnr",
1692 FT_UINT32, BASE_DEC, NULL, 0x0,
1693 NULL, HFILL }
1695 /* gdsdb_exec_immediate2 */
1696 { &hf_gdsdb_prepare2_blr,
1697 { "BLR", "gdsdb.prepare.blr",
1698 FT_UINT32, BASE_DEC, NULL, 0x0,
1699 NULL, HFILL }
1701 { &hf_gdsdb_prepare2_number,
1702 { "Message number", "gdsdb.prepare2.messagenumber",
1703 FT_UINT32, BASE_DEC, NULL, 0x0,
1704 NULL, HFILL }
1706 { &hf_gdsdb_prepare2_messages,
1707 { "Number of messages", "gdsdb.prepare2.messages",
1708 FT_UINT32, BASE_DEC, NULL, 0x0,
1709 NULL, HFILL }
1711 { &hf_gdsdb_prepare2_outblr,
1712 { "Output BLR", "gdsdb.prepare2.outblr",
1713 FT_UINT32, BASE_DEC, NULL, 0x0,
1714 NULL, HFILL }
1716 { &hf_gdsdb_prepare2_outmsgnr,
1717 { "Output Message number", "gdsdb.prepare2.outmsgnr",
1718 FT_UINT32, BASE_DEC, NULL, 0x0,
1719 NULL, HFILL }
1721 #endif
1722 /* gdsdb_prepare */
1723 { &hf_gdsdb_prepare_transaction,
1724 { "Prepare, Transaction", "gdsdb.prepare.transaction",
1725 FT_UINT32, BASE_DEC, NULL, 0x0,
1726 NULL, HFILL }
1728 { &hf_gdsdb_prepare_statement,
1729 { "Prepare, Statement", "gdsdb.prepare.statement",
1730 FT_UINT32, BASE_DEC, NULL, 0x0,
1731 NULL, HFILL }
1733 { &hf_gdsdb_prepare_dialect,
1734 { "Prepare, Dialect", "gdsdb.prepare.dialect",
1735 FT_UINT32, BASE_DEC, NULL, 0x0,
1736 NULL, HFILL }
1738 { &hf_gdsdb_prepare_querystr,
1739 { "Prepare, Query", "gdsdb.prepare.querystr",
1740 FT_UINT_STRING, BASE_NONE, NULL, 0x0,
1741 NULL, HFILL }
1743 { &hf_gdsdb_prepare_items,
1744 { "Prepare, Information items", "gdsdb.prepare.items",
1745 FT_UINT32, BASE_DEC, NULL, 0x0,
1746 NULL, HFILL }
1748 { &hf_gdsdb_prepare_bufferlength,
1749 { "Prepare, Bufferlength", "gdsdb.prepare.bufferlen",
1750 FT_UINT32, BASE_DEC, NULL, 0x0,
1751 NULL, HFILL }
1753 #if 0
1754 /* gdsdb_fetch */
1755 { &hf_gdsdb_fetch_statement,
1756 { "Statement", "gdsdb.fetch.statement",
1757 FT_UINT32, BASE_DEC, NULL, 0x0,
1758 NULL, HFILL }
1760 { &hf_gdsdb_fetch_message_number,
1761 { "Message number", "gdsdb.fetch.messagenr",
1762 FT_UINT32, BASE_DEC, NULL, 0x0,
1763 NULL, HFILL }
1765 { &hf_gdsdb_fetch_messages,
1766 { "Number of messages", "gdsdb.fetch.messages",
1767 FT_UINT32, BASE_DEC, NULL, 0x0,
1768 NULL, HFILL }
1770 /* gdsdb_fetch_response */
1771 { &hf_gdsdb_fetchresponse_status,
1772 { "Status", "gdsdb.fetchresponse.status",
1773 FT_UINT32, BASE_DEC, NULL, 0x0,
1774 NULL, HFILL }
1776 { &hf_gdsdb_fetchresponse_messages,
1777 { "Number of messages", "gdsdb.fetchresponse.messages",
1778 FT_UINT32, BASE_DEC, NULL, 0x0,
1779 NULL, HFILL }
1781 /* gdsdb_free_statement */
1782 { &hf_gdsdb_free_statement,
1783 { "Statement", "gdsdb.fetchresponse.statement",
1784 FT_UINT32, BASE_DEC, NULL, 0x0,
1785 NULL, HFILL }
1787 { &hf_gdsdb_free_option,
1788 { "Option", "gdsdb.fetchresponse.option",
1789 FT_UINT32, BASE_DEC, NULL, 0x0,
1790 NULL, HFILL }
1792 /* gdsdb_insert */
1793 { &hf_gdsdb_insert_statement,
1794 { "Statement", "gdsdb.insert.statement",
1795 FT_UINT32, BASE_DEC, NULL, 0x0,
1796 NULL, HFILL }
1798 { &hf_gdsdb_insert_message_number,
1799 { "Message number", "gdsdb.insert.messagenr",
1800 FT_UINT32, BASE_DEC, NULL, 0x0,
1801 NULL, HFILL }
1803 { &hf_gdsdb_insert_messages,
1804 { "Number of messages", "gdsdb.insert.messages",
1805 FT_UINT32, BASE_DEC, NULL, 0x0,
1806 NULL, HFILL }
1808 /* gdsdb_cursor */
1809 { &hf_gdsdb_cursor_statement,
1810 { "Statement", "gdsdb.cursor.statement",
1811 FT_UINT32, BASE_DEC, NULL, 0x0,
1812 NULL, HFILL }
1814 { &hf_gdsdb_cursor_type,
1815 { "Type", "gdsdb.cursor.type",
1816 FT_UINT32, BASE_DEC, NULL, 0x0,
1817 NULL, HFILL }
1819 /* gdsdb_sql_response */
1820 { &hf_gdsdb_sqlresponse_messages,
1821 { "SQL Response, Message Count", "gdsdb.sqlresponse.msgcount",
1822 FT_UINT32, BASE_DEC, NULL, 0x0,
1823 NULL, HFILL }
1825 #endif
1828 static gint *ett[] = {
1829 &ett_gdsdb,
1830 /* &ett_gdsdb_opcode, */
1831 &ett_gdsdb_connect_pref
1834 proto_gdsdb = proto_register_protocol(
1835 "Firebird SQL Database Remote Protocol",
1836 "FB/IB GDS DB", "gdsdb");
1838 proto_register_field_array(proto_gdsdb, hf, array_length(hf));
1839 proto_register_subtree_array(ett, array_length(ett));
1842 void
1843 proto_reg_handoff_gdsdb(void)
1845 /* Main dissector */
1847 dissector_handle_t gdsdb_handle;
1849 gdsdb_handle = new_create_dissector_handle(dissect_gdsdb,
1850 proto_gdsdb);
1851 dissector_add_uint("tcp.port", TCP_PORT, gdsdb_handle);