796316b6af5e9dc5aa71daa08a3447fbbccae6e4
[obnox/wireshark/wip.git] / epan / dissectors / packet-gdsdb.c
1 /* packet-gdsdb.c
2  * Routines for Firebird/Interbase dissection
3  * Copyright 2007, Moshe van der Sterre <moshevds@gmail.com>
4  *
5  * $Id$
6  *
7  * Wireshark - Network traffic analyzer
8  * By Gerald Combs <gerald@wireshark.org>
9  * Copyright 1998 Gerald Combs
10  *
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.
15  *
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.
20  *
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.
24  */
25
26 #ifdef HAVE_CONFIG_H
27 # include "config.h"
28 #endif
29
30 #include <stdlib.h>
31
32 #include <glib.h>
33
34 #include <epan/packet.h>
35
36 #define TCP_PORT        3050
37
38 static int proto_gdsdb = -1;
39 static gint ett_gdsdb = -1;
40 static int hf_gdsdb_opcode = -1;
41 static gint ett_gdsdb_opcode = -1;
42
43 /* gdsdb_dummy */
44 /* gdsdb_connect */
45 static int hf_gdsdb_connect_operation = -1;
46 static int hf_gdsdb_connect_version = -1;
47 static int hf_gdsdb_connect_client = -1;
48 static int hf_gdsdb_connect_filename = -1;
49 static int hf_gdsdb_connect_count = -1;
50 static int hf_gdsdb_connect_userid = -1;
51 static int hf_gdsdb_connect_pref = -1;
52 static gint ett_gdsdb_connect_pref = -1;
53 static int hf_gdsdb_connect_pref_version = -1;
54 static int hf_gdsdb_connect_pref_architecture = -1;
55 static int hf_gdsdb_connect_pref_mintype = -1;
56 static int hf_gdsdb_connect_pref_maxtype = -1;
57 static int hf_gdsdb_connect_pref_weight = -1;
58 /* gdsdb_accept */
59 static int hf_gdsdb_accept_version = -1;
60 static int hf_gdsdb_accept_architecture = -1;
61 /* gdsdb_request */
62 static int hf_gdsdb_request_type = -1;
63 static int hf_gdsdb_request_object = -1;
64 static int hf_gdsdb_request_partner = -1;
65 /* gdsdb_attach */
66 static int hf_gdsdb_attach_database = -1;
67 static int hf_gdsdb_attach_filename = -1;
68 static int hf_gdsdb_attach_dpb = -1;
69 /* gdsdb_compile */
70 static int hf_gdsdb_compile_database = -1;
71 static int hf_gdsdb_compile_blr = -1;
72 /* gdsdb_receive */
73 static int hf_gdsdb_receive_request = -1;
74 static int hf_gdsdb_receive_incarnation = -1;
75 static int hf_gdsdb_receive_transaction = -1;
76 static int hf_gdsdb_receive_msgnr = -1;
77 static int hf_gdsdb_receive_messages = -1;
78 static int hf_gdsdb_receive_direction = -1;
79 static int hf_gdsdb_receive_offset = -1;
80 /* gdsdb_send */
81 static int hf_gdsdb_send_request = -1;
82 static int hf_gdsdb_send_incarnation = -1;
83 static int hf_gdsdb_send_transaction = -1;
84 static int hf_gdsdb_send_msgnr = -1;
85 static int hf_gdsdb_send_messages = -1;
86 /* gdsdb_response */
87 static int hf_gdsdb_response_object = -1;
88 static int hf_gdsdb_response_blobid = -1;
89 static int hf_gdsdb_response_data = -1;
90 static int hf_gdsdb_response_status = -1;
91 /* gdsdb_transact */
92 static int hf_gdsdb_transact_database = -1;
93 static int hf_gdsdb_transact_transaction = -1;
94 static int hf_gdsdb_transact_messages = -1;
95 /* gdsdb_transact_response */
96 static int hf_gdsdb_transactresponse_messages = -1;
97 /* gdsdb_open_blob2 */
98 static int hf_gdsdb_openblob2_bpb = -1;
99 /* gdsdb_open_blob */
100 static int hf_gdsdb_openblob_transaction = -1;
101 static int hf_gdsdb_openblob_id = -1;
102 /* gdsdb_segment */
103 static int hf_gdsdb_segment_blob = -1;
104 static int hf_gdsdb_segment_length = -1;
105 static int hf_gdsdb_segment_segment = -1;
106 /* gdsdb_seek_blob */
107 static int hf_gdsdb_seekblob_blob = -1;
108 static int hf_gdsdb_seekblob_mode = -1;
109 /* gdsdb_reconnect */
110 static int hf_gdsdb_reconnect_database = -1;
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 /* gdsdb_release */
117 static int hf_gdsdb_release_object = -1;
118 /* gdsdb_prepare2 */
119 static int hf_gdsdb_prepare2_transaction = -1;
120 /* gdsdb_event & gdsdb_cancel_events */
121 static int hf_gdsdb_event_database = -1;
122 static int hf_gdsdb_event_items = -1;
123 static int hf_gdsdb_event_ast = -1;
124 static int hf_gdsdb_event_arg = -1;
125 static int hf_gdsdb_event_rid = -1;
126 /* gdsdb_ddl */
127 static int hf_gdsdb_ddl_database = -1;
128 static int hf_gdsdb_ddl_transaction = -1;
129 static int hf_gdsdb_ddl_blr = -1;
130 /* gdsdb_slice */
131 static int hf_gdsdb_slice_transaction = -1;
132 static int hf_gdsdb_slice_id = -1;
133 static int hf_gdsdb_slice_sdl = -1;
134 static int hf_gdsdb_slice_parameters = -1;
135 /* gdsdb_slice_response */
136 static int hf_gdsdb_sliceresponse_length = -1;
137 /* gdsdb_execute */
138 static int hf_gdsdb_execute_statement = -1;
139 static int hf_gdsdb_execute_transaction = -1;
140 static int hf_gdsdb_execute_message_number = -1;
141 static int hf_gdsdb_execute_messages = -1;
142 /* gdsdb_execute2 */
143 static int hf_gdsdb_execute_outblr = -1;
144 static int hf_gdsdb_execute_outmsgnr = -1;
145 /* gdsdb_exec_immediate2 */
146 static int hf_gdsdb_prepare2_blr = -1;
147 static int hf_gdsdb_prepare2_number = -1;
148 static int hf_gdsdb_prepare2_messages = -1;
149 static int hf_gdsdb_prepare2_outblr = -1;
150 static int hf_gdsdb_prepare2_outmsgnr = -1;
151 /* gdsdb_prepare */
152 static int hf_gdsdb_prepare_transaction = -1;
153 static int hf_gdsdb_prepare_statement = -1;
154 static int hf_gdsdb_prepare_dialect = -1;
155 static int hf_gdsdb_prepare_querystr = -1;
156 static int hf_gdsdb_prepare_items = -1;
157 static int hf_gdsdb_prepare_bufferlength = -1;
158 /* gdsdb_fetch */
159 static int hf_gdsdb_fetch_statement = -1;
160 static int hf_gdsdb_fetch_message_number = -1;
161 static int hf_gdsdb_fetch_messages = -1;
162 /* gdsdb_fetch_response */
163 static int hf_gdsdb_fetchresponse_status = -1;
164 static int hf_gdsdb_fetchresponse_messages = -1;
165 /* gdsdb_free_statement */
166 static int hf_gdsdb_free_statement = -1;
167 static int hf_gdsdb_free_option = -1;
168 /* gdsdb_insert */
169 static int hf_gdsdb_insert_statement = -1;
170 static int hf_gdsdb_insert_message_number = -1;
171 static int hf_gdsdb_insert_messages = -1;
172 /* gdsdb_cursor */
173 static int hf_gdsdb_cursor_statement = -1;
174 static int hf_gdsdb_cursor_type = -1;
175 /* gdsdb_sql_response */
176 static int hf_gdsdb_sqlresponse_messages = -1;
177
178 enum
179 {
180         op_void                   = 0,
181         op_connect                = 1,
182         op_exit                   = 2,
183         op_accept                 = 3,
184         op_reject                 = 4,
185         op_protocol               = 5,
186         op_disconnect             = 6,
187         op_credit                 = 7,
188         op_continuation           = 8,
189         op_response               = 9,
190         op_open_file              = 10,
191         op_create_file            = 11,
192         op_close_file             = 12,
193         op_read_page              = 13,
194         op_write_page             = 14,
195         op_lock                   = 15,
196         op_convert_lock           = 16,
197         op_release_lock           = 17,
198         op_blocking               = 18,
199         op_attach                 = 19,
200         op_create                 = 20,
201         op_detach                 = 21,
202         op_compile                = 22,
203         op_start                  = 23,
204         op_start_and_send         = 24,
205         op_send                   = 25,
206         op_receive                = 26,
207         op_unwind                 = 27,
208         op_release                = 28,
209         op_transaction            = 29,
210         op_commit                 = 30,
211         op_rollback               = 31,
212         op_prepare                = 32,
213         op_reconnect              = 33,
214         op_create_blob            = 34,
215         op_open_blob              = 35,
216         op_get_segment            = 36,
217         op_put_segment            = 37,
218         op_cancel_blob            = 38,
219         op_close_blob             = 39,
220         op_info_database          = 40,
221         op_info_request           = 41,
222         op_info_transaction       = 42,
223         op_info_blob              = 43,
224         op_batch_segments         = 44,
225         op_mgr_set_affinity       = 45,
226         op_mgr_clear_affinity     = 46,
227         op_mgr_report             = 47,
228         op_que_events             = 48,
229         op_cancel_events          = 49,
230         op_commit_retaining       = 50,
231         op_prepare2               = 51,
232         op_event                  = 52,
233         op_connect_request        = 53,
234         op_aux_connect            = 54,
235         op_ddl                    = 55,
236         op_open_blob2             = 56,
237         op_create_blob2           = 57,
238         op_get_slice              = 58,
239         op_put_slice              = 59,
240         op_slice                  = 60,
241         op_seek_blob              = 61,
242         op_allocate_statement     = 62,
243         op_execute                = 63,
244         op_exec_immediate         = 64,
245         op_fetch                  = 65,
246         op_fetch_response         = 66,
247         op_free_statement         = 67,
248         op_prepare_statement      = 68,
249         op_set_cursor             = 69,
250         op_info_sql               = 70,
251         op_dummy                  = 71,
252         op_response_piggyback     = 72,
253         op_start_and_receive      = 73,
254         op_start_send_and_receive = 74,
255         op_exec_immediate2        = 75,
256         op_execute2               = 76,
257         op_insert                 = 77,
258         op_sql_response           = 78,
259         op_transact               = 79,
260         op_transact_response      = 80,
261         op_drop_database          = 81,
262         op_service_attach         = 82,
263         op_service_detach         = 83,
264         op_service_info           = 84,
265         op_service_start          = 85,
266         op_rollback_retaining     = 86,
267         op_max
268 };
269
270 static const value_string gdsdb_opcode[] = {
271         { op_void, "Void" },
272         { op_connect, "Connect" },
273         { op_exit, "Exit" },
274         { op_accept, "Accept" },
275         { op_reject, "Reject" },
276         { op_protocol, "Protocol" },
277         { op_disconnect, "Disconnect" },
278         { op_credit, "Credit" },
279         { op_continuation, "Continuation" },
280         { op_response, "Response" },
281         { op_open_file, "Open file" },
282         { op_create_file, "Create file" },
283         { op_close_file, "Close file" },
284         { op_read_page, "Read page" },
285         { op_write_page, "Write page" },
286         { op_lock, "Lock" },
287         { op_convert_lock, "Convert lock" },
288         { op_release_lock, "Release lock" },
289         { op_blocking, "Blocking" },
290         { op_attach, "Attach" },
291         { op_create, "Create" },
292         { op_detach, "Detach" },
293         { op_compile, "Compile" },
294         { op_start, "Start" },
295         { op_start_and_send, "Start and send" },
296         { op_send, "Send" },
297         { op_receive, "Receive" },
298         { op_unwind, "Unwind" },
299         { op_release, "Release" },
300         { op_transaction, "Transaction" },
301         { op_commit, "Commit" },
302         { op_rollback, "Rollback" },
303         { op_prepare, "Prepare" },
304         { op_reconnect, "Reconnect" },
305         { op_create_blob, "Create blob" },
306         { op_open_blob, "Open blob" },
307         { op_get_segment, "Get segment" },
308         { op_put_segment, "Put segment" },
309         { op_cancel_blob, "Cancel blob" },
310         { op_close_blob, "Close blob" },
311         { op_info_database, "Info database" },
312         { op_info_request, "Info request" },
313         { op_transaction, "Info transaction" },
314         { op_info_blob, "Info blob" },
315         { op_batch_segments, "Batch segments" },
316         { op_mgr_set_affinity, "Mgr set affinity" },
317         { op_mgr_clear_affinity, "Mgr clear affinity" },
318         { op_mgr_report, "Mgr report" },
319         { op_que_events, "Que events" },
320         { op_cancel_events, "Cancel events" },
321         { op_commit_retaining, "Commit retaining" },
322         { op_prepare2, "Prepare 2" },
323         { op_event, "Event" },
324         { op_connect_request, "Connect request" },
325         { op_aux_connect, "Aux connect" },
326         { op_ddl, "DDl" },
327         { op_open_blob2, "Open blob 2" },
328         { op_create_blob2, "Create blob 2" },
329         { op_get_slice, "Get slice" },
330         { op_put_slice, "Put slice" },
331         { op_slice, "Slice" },
332         { op_seek_blob, "Seek blob" },
333         { op_allocate_statement, "Allocate statement" },
334         { op_execute, "Execute" },
335         { op_exec_immediate, "Exec immediate" },
336         { op_fetch, "Fetch" },
337         { op_fetch_response, "Fetch response" },
338         { op_free_statement, "Free statement" },
339         { op_prepare_statement, "Prepare statement" },
340         { op_set_cursor, "Set cursor" },
341         { op_info_sql, "Info sql" },
342         { op_dummy, "Dummy" },
343         { op_response_piggyback, "Response piggyback" },
344         { op_start_and_receive, "Start and receive" },
345         { op_start_send_and_receive, "Start send and receive" },
346         { op_exec_immediate2, "Exec immediate 2" },
347         { op_execute2, "Execute 2" },
348         { op_insert, "Insert" },
349         { op_sql_response, "Sql response" },
350         { op_transact_response, "Transact" },
351         { op_transact_response, "Transact response" },
352         { op_drop_database, "Drop database" },
353         { op_service_attach, "Service attach" },
354         { op_service_detach, "Service detach" },
355         { op_service_info, "Service info" },
356         { op_service_start, "Service start" },
357         { op_rollback_retaining, "Rollback retaining" },
358         { 0, NULL }
359 };
360
361 static const value_string gdsdb_architectures[] = {
362         { 1, "Generic" },
363         { 2, "Apollo" },
364         { 3, "Sun" },
365         { 4, "Vms" },
366         { 5, "Ultrix" },
367         { 6, "Alliant" },
368         { 7, "MS-Dos" },
369         { 8, "Sun 4" },
370         { 9, "Sun 386" },
371         { 10, "HP-UX" },
372         { 11, "HP MPE/xl" },
373         { 12, "Mac" },
374         { 13, "Mac aux" },
375         { 14, "rt" },
376         { 15, "mips Ultrix" },
377         { 16, "HP-UX 68k" },
378         { 17, "Xenix" },
379         { 18, "Aviion" },
380         { 19, "SGI" },
381         { 20, "Apollo_dn10k" },
382         { 21, "Cray" },
383         { 22, "Imp" },
384         { 23, "Delta" },
385         { 24, "SCO" },
386         { 25, "Next" },
387         { 26, "Next 386" },
388         { 27, "m88k" },
389         { 28, "UnixWare" },
390         { 29, "Intel 32" },
391         { 30, "Epson" },
392         { 31, "Decosf" },
393         { 32, "Ncr3000" },
394         { 33, "NT PPC" },
395         { 34, "DG x86" },
396         { 35, "SCO ev" },
397         { 36, "Linux" },
398         { 37, "FreeBSD"  },
399         { 38, "NetBSD" },
400         { 39, "Darwin PPC" },
401         { 0, NULL }
402 };
403
404 static int
405 gdsdb_dummy(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_)
406 {
407         /* Don't tell them we match */
408         return 0;
409 }
410
411 static int
412 gdsdb_connect(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
413 {
414         int offset;
415         int length;
416         int count;
417         int i;
418         proto_item *ti;
419         proto_tree *pref_tree;
420
421         if (tvb_length(tvb) < 16) {
422                 return 0;
423         }
424         if (check_col(pinfo->cinfo, COL_INFO)){
425                 col_append_str(pinfo->cinfo, COL_INFO, ": ");
426                 col_append_str(pinfo->cinfo, COL_INFO,
427                         tvb_format_text(tvb, 20,
428                                 tvb_get_ntohl(tvb, 16)));
429         }
430         if (tree) {
431                 offset = 4;
432                 proto_tree_add_item(tree, hf_gdsdb_connect_operation, tvb,
433                                                         offset, 4, ENC_BIG_ENDIAN);
434                 offset += 4;
435                 proto_tree_add_item(tree, hf_gdsdb_connect_version, tvb,
436                                                         offset, 4, ENC_BIG_ENDIAN);
437                 offset += 4;
438                 proto_tree_add_item(tree, hf_gdsdb_connect_client, tvb,
439                                                         offset, 4, ENC_BIG_ENDIAN);
440                 offset += 4;
441                 proto_tree_add_item(tree, hf_gdsdb_connect_filename, tvb,
442                                                         offset, 4, ENC_ASCII|ENC_BIG_ENDIAN);
443                 length = tvb_get_ntohl(tvb, offset);
444                 offset += length + 6;
445                 proto_tree_add_item(tree, hf_gdsdb_connect_count, tvb,
446                                                         offset, 4, ENC_BIG_ENDIAN);
447                 count = tvb_get_ntohl(tvb, offset);
448                 offset += 4;
449                 proto_tree_add_item(tree, hf_gdsdb_connect_userid, tvb,
450                                                         offset, 4, ENC_ASCII|ENC_BIG_ENDIAN);
451                 length = tvb_get_ntohl(tvb, offset);
452                 offset += length + 5;
453                 for(i=0;i<count;i++){
454                         ti = proto_tree_add_item(tree, hf_gdsdb_connect_pref,
455                                                 tvb, offset, 20, ENC_NA);
456                         pref_tree = proto_item_add_subtree(ti,
457                                                  ett_gdsdb_connect_pref);
458                         proto_tree_add_item(pref_tree,
459                                         hf_gdsdb_connect_pref_version,
460                                                 tvb, offset, 4, ENC_BIG_ENDIAN);
461                         offset += 4;
462                         proto_tree_add_item(pref_tree,
463                                         hf_gdsdb_connect_pref_architecture,
464                                                 tvb, offset, 4, ENC_BIG_ENDIAN);
465                         offset += 4;
466                         proto_tree_add_item(pref_tree,
467                                         hf_gdsdb_connect_pref_mintype,
468                                                 tvb, offset, 4, ENC_BIG_ENDIAN);
469                         offset += 4;
470                         proto_tree_add_item(pref_tree,
471                                         hf_gdsdb_connect_pref_maxtype,
472                                                 tvb, offset, 4, ENC_BIG_ENDIAN);
473                         offset += 4;
474                         proto_tree_add_item(pref_tree,
475                                         hf_gdsdb_connect_pref_weight,
476                                                 tvb, offset, 4, ENC_BIG_ENDIAN);
477                         offset += 4;
478                 }
479         }
480
481         return tvb_length(tvb);
482 }
483
484 static int
485 gdsdb_accept(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
486 {
487         int offset;
488
489         if (tvb_length(tvb) < 16) {
490                 return 0;
491         }
492         if (tree) {
493                 offset = 4;
494                 proto_tree_add_item(tree, hf_gdsdb_accept_version, tvb,
495                                                         offset, 4, ENC_BIG_ENDIAN);
496                 offset += 4;
497                 proto_tree_add_item(tree, hf_gdsdb_accept_architecture, tvb,
498                                                         offset, 4, ENC_BIG_ENDIAN);
499                 offset += 4;
500         }
501
502         return tvb_length(tvb);
503 }
504
505 static int
506 gdsdb_request(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
507 {
508         int offset;
509
510         if (tvb_length(tvb) < 20) {
511                 return 0;
512         }
513         if (tree) {
514                 offset = 4;
515                 proto_tree_add_item(tree, hf_gdsdb_request_type, tvb,
516                                                 offset, 4, ENC_BIG_ENDIAN);
517                 offset += 4;
518                 proto_tree_add_item(tree, hf_gdsdb_request_object, tvb,
519                                                 offset, 4, ENC_BIG_ENDIAN);
520                 offset += 4;
521                 proto_tree_add_item(tree, hf_gdsdb_request_partner, tvb,
522                                                 offset, 8, ENC_BIG_ENDIAN);
523         }
524
525         return tvb_length(tvb);
526 }
527
528 static int
529 gdsdb_attach(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
530 {
531         int offset;
532         int length;
533
534         if (tvb_length(tvb) < 20) {
535                 return 0;
536         }
537         if (check_col(pinfo->cinfo, COL_INFO)){
538                 col_append_str(pinfo->cinfo, COL_INFO, ": ");
539                 col_append_str(pinfo->cinfo, COL_INFO,
540                         tvb_format_text(tvb, 12,
541                                 tvb_get_ntohl(tvb, 8)));
542         }
543         if (tree) {
544                 offset = 4;
545                 proto_tree_add_item(tree, hf_gdsdb_attach_database, tvb,
546                                                         offset, 4, ENC_BIG_ENDIAN);
547                 offset += 4;
548                 proto_tree_add_item(tree, hf_gdsdb_attach_filename, tvb,
549                                                         offset, 4, ENC_ASCII|ENC_BIG_ENDIAN);
550                 length = tvb_get_ntohl(tvb, offset);
551                 offset += length + 6;
552                 proto_tree_add_uint_format_value(tree,
553                                 hf_gdsdb_attach_dpb, tvb, offset, 4 + length,
554                                         length, "%i data bytes", length);
555         }
556
557         return tvb_length(tvb);
558 }
559
560 static int
561 gdsdb_compile(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
562 {
563         int offset;
564
565         if (tvb_length(tvb) < 20) {
566                 return 0;
567         }
568         if (tree) {
569                 offset = 4;
570                 proto_tree_add_item(tree, hf_gdsdb_compile_database, tvb,
571                                                         offset, 4, ENC_BIG_ENDIAN);
572                 offset += 4;
573                 proto_tree_add_item(tree, hf_gdsdb_compile_blr, tvb,
574                                                         offset, 4, ENC_ASCII|ENC_BIG_ENDIAN);
575         }
576
577         return tvb_length(tvb);
578 }
579
580 static int
581 gdsdb_receive(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
582 {
583         int offset;
584
585         if (tvb_length(tvb) < 20) {
586                 return 0;
587         }
588         if (tree) {
589                 offset = 4;
590                 proto_tree_add_item(tree, hf_gdsdb_receive_request, tvb,
591                                                         offset, 4, ENC_BIG_ENDIAN);
592                 offset += 4;
593                 proto_tree_add_item(tree, hf_gdsdb_receive_incarnation, tvb,
594                                                         offset, 4, ENC_BIG_ENDIAN);
595                 offset += 4;
596                 proto_tree_add_item(tree, hf_gdsdb_receive_transaction, tvb,
597                                                         offset, 4, ENC_BIG_ENDIAN);
598                 offset += 4;
599                 proto_tree_add_item(tree, hf_gdsdb_receive_msgnr, tvb,
600                                                         offset, 4, ENC_BIG_ENDIAN);
601                 offset += 4;
602                 proto_tree_add_item(tree, hf_gdsdb_receive_messages, tvb,
603                                                         offset, 4, ENC_BIG_ENDIAN);
604                 offset += 4;
605                 while(tvb_bytes_exist(tvb, offset, 12)) {
606                         proto_tree_add_item(tree, hf_gdsdb_receive_direction,
607                                                 tvb, offset, 4, ENC_BIG_ENDIAN);
608                         offset += 4;
609                         proto_tree_add_item(tree, hf_gdsdb_receive_offset,
610                                                  tvb, offset, 8, ENC_BIG_ENDIAN);
611                         offset += 8;
612                 }
613         }
614
615         return tvb_length(tvb);
616 }
617
618 static int
619 gdsdb_send(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
620 {
621         int offset;
622
623         if (tvb_length(tvb) < 20) {
624                 return 0;
625         }
626         if (tree) {
627                 offset = 4;
628                 proto_tree_add_item(tree, hf_gdsdb_send_request, tvb,
629                                                         offset, 4, ENC_BIG_ENDIAN);
630                 offset += 4;
631                 proto_tree_add_item(tree, hf_gdsdb_send_incarnation, tvb,
632                                                         offset, 4, ENC_BIG_ENDIAN);
633                 offset += 4;
634                 proto_tree_add_item(tree, hf_gdsdb_send_transaction, tvb,
635                                                         offset, 4, ENC_BIG_ENDIAN);
636                 offset += 4;
637                 proto_tree_add_item(tree, hf_gdsdb_send_msgnr, tvb,
638                                                         offset, 4, ENC_BIG_ENDIAN);
639                 offset += 4;
640                 proto_tree_add_item(tree, hf_gdsdb_send_messages, tvb,
641                                                         offset, 4, ENC_BIG_ENDIAN);
642         }
643
644         return tvb_length(tvb);
645 }
646
647 static int
648 gdsdb_response(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
649 {
650         int offset;
651         int length;
652
653         if (tvb_length(tvb) < 32) {
654                 return 0;
655         }
656         if (tree) {
657                 offset = 4;
658                 proto_tree_add_item(tree, hf_gdsdb_response_object, tvb,
659                                                         offset, 4, ENC_BIG_ENDIAN);
660                 offset += 4;
661                 proto_tree_add_item(tree, hf_gdsdb_response_blobid, tvb,
662                                                         offset, 8, ENC_BIG_ENDIAN);
663                 offset += 8;
664                 proto_tree_add_item(tree, hf_gdsdb_response_data, tvb,
665                                                         offset, 4, ENC_ASCII|ENC_BIG_ENDIAN);
666                 length = tvb_get_ntohl(tvb, offset);
667                 offset += length + 4;
668                 proto_tree_add_item(tree, hf_gdsdb_response_status, tvb,
669                                 offset, tvb_length(tvb) - offset, ENC_NA);
670         }
671
672         return tvb_length(tvb);
673
674 }
675
676 static int
677 gdsdb_transact(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
678 {
679         int offset;
680
681         if (tvb_length(tvb) < 20) {
682                 return 0;
683         }
684         if (tree) {
685                 offset = 4;
686                 proto_tree_add_item(tree, hf_gdsdb_transact_database, tvb,
687                                                         offset, 4, ENC_BIG_ENDIAN);
688                 offset += 4;
689                 proto_tree_add_item(tree, hf_gdsdb_transact_transaction, tvb,
690                                                         offset, 4, ENC_BIG_ENDIAN);
691         }
692
693         return tvb_length(tvb);
694 }
695
696 static int
697 gdsdb_transact_response(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
698 {
699
700         int offset;
701
702         if (tvb_length(tvb) < 8) {
703                 return 0;
704         }
705         if (tree) {
706                 offset = 4;
707                 proto_tree_add_item(tree, hf_gdsdb_transactresponse_messages,
708                                                 tvb, offset, 4, ENC_BIG_ENDIAN);
709         }
710
711         return tvb_length(tvb);
712 }
713
714 static int
715 gdsdb_open_blob2(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
716 {
717         int offset;
718         int length;
719
720         if (!tvb_bytes_exist(tvb, 0, 20)) {
721                 return 0;
722         }
723         if (tree) {
724                 offset = 4;
725                 proto_tree_add_item(tree, hf_gdsdb_openblob2_bpb, tvb, offset,
726                                                                 4, ENC_ASCII|ENC_BIG_ENDIAN);
727                 length = tvb_get_ntohl(tvb, offset);
728                 offset += length + 6;
729                 proto_tree_add_item(tree, hf_gdsdb_openblob_transaction, tvb,
730                                                         offset, 4, ENC_BIG_ENDIAN);
731                 offset += 4;
732                 proto_tree_add_item(tree, hf_gdsdb_openblob_id, tvb, offset,
733                                                                 8, ENC_BIG_ENDIAN);
734         }
735
736         return tvb_length(tvb);
737 }
738
739 static int
740 gdsdb_open_blob(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
741 {
742         int offset;
743
744         if (tvb_length(tvb) < 16) {
745                 return 0;
746         }
747         if (tree) {
748                 offset = 4;
749                 proto_tree_add_item(tree, hf_gdsdb_openblob_transaction, tvb,
750                                                         offset, 4, ENC_BIG_ENDIAN);
751                 offset += 4;
752                 proto_tree_add_item(tree, hf_gdsdb_openblob_id, tvb, offset,
753                                                                 8, ENC_BIG_ENDIAN);
754         }
755
756         return tvb_length(tvb);
757 }
758
759 static int
760 gdsdb_segment(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
761 {
762         /* int offset; */
763
764         if (tvb_length(tvb) < 16) {
765                 return 0;
766         }
767         if (tree) {
768 /* hf_gdsdb_segment_blob */
769 /* hf_gdsdb_segment_length */
770 /* hf_gdsdb_segment_segment */
771         }
772
773         return tvb_length(tvb);
774 }
775
776 static int
777 gdsdb_seek_blob(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
778 {
779         /* int offset; */
780
781         if (tvb_length(tvb) < 16) {
782                 return 0;
783         }
784         if (tree) {
785 /* hf_gdsdb_seekblob_blob */
786 /* hf_gdsdb_seekblob_mode */
787         }
788
789         return tvb_length(tvb);
790 }
791
792 static int
793 gdsdb_reconnect(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
794 {
795         /* int offset; */
796
797         if (tvb_length(tvb) < 12) {
798                 return 0;
799         }
800         if (tree) {
801 /* hf_gdsdb_reconnect_database */
802         }
803
804         return tvb_length(tvb);
805 }
806
807 static int
808 gdsdb_info(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
809 {
810         int offset;
811         int length;
812         guint opcode;
813
814         if (tvb_length(tvb) < 20) {
815                 return 0;
816         }
817
818         opcode = tvb_get_ntohl(tvb, 0);
819
820         if (tree) {
821                 offset = 4;
822                 proto_tree_add_item(tree, hf_gdsdb_info_object, tvb, offset,
823                                                                 4, ENC_BIG_ENDIAN);
824                 offset += 4;
825                 proto_tree_add_item(tree, hf_gdsdb_info_incarnation, tvb,
826                                                         offset, 4, ENC_BIG_ENDIAN);
827                 offset += 4;
828                 if(opcode == op_service_info) {
829                         proto_tree_add_item(tree, hf_gdsdb_info_items, tvb,
830                                                         offset, 4, ENC_ASCII|ENC_BIG_ENDIAN);
831                         length = tvb_get_ntohl(tvb, offset);
832                         offset += length + 6;
833                 }
834                 proto_tree_add_item(tree, hf_gdsdb_info_buffer_length, tvb,
835                                                         offset, 4, ENC_BIG_ENDIAN);
836         }
837
838         return tvb_length(tvb);
839 }
840
841 static int
842 gdsdb_service_start(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
843 {
844         /* int offset; */
845
846         if (tvb_length(tvb) < 16) {
847                 return 0;
848         }
849         if (tree) {
850 /* hf_gdsdb_info_object */
851 /* hf_gdsdb_info_incarnation */
852 /* hf_gdsdb_info_items */
853 /* hf_gdsdb_info_buffer_length */
854         }
855
856         return tvb_length(tvb);
857 }
858
859 static int
860 gdsdb_release(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
861 {
862         /* int offset; */
863
864         if (tvb_length(tvb) < 8) {
865                 return 0;
866         }
867         if (tree) {
868 /* hf_gdsdb_release_object */
869         }
870
871         return tvb_length(tvb);
872 }
873
874 #if 0
875 static int
876 gdsdb_prepare2(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
877 {
878         /* int offset; */
879
880         if (tvb_length(tvb) < 12) {
881                 return 0;
882         }
883         if (tree) {
884 /* hf_gdsdb_prepare2_transaction */
885         }
886
887         return tvb_length(tvb);
888 }
889 #endif
890
891 static int
892 gdsdb_event(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
893 {
894          /* int offset; */
895
896         if (tvb_length(tvb) < 24) {
897                 return 0;
898         }
899         if (tree) {
900 /* hf_gdsdb_event_database */
901 /* hf_gdsdb_event_items */
902 /* hf_gdsdb_event_ast */
903 /* hf_gdsdb_event_arg */
904 /* hf_gdsdb_event_rid */
905         }
906         return tvb_length(tvb);
907 }
908
909 static int
910 gdsdb_cancel_events(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
911 {
912         /* int offset; */
913
914         if (tvb_length(tvb) < 12) {
915                 return 0;
916         }
917         if (tree) {
918 /* hf_gdsdb_event_database */
919         }
920
921         return tvb_length(tvb);
922 }
923
924 static int
925 gdsdb_ddl(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
926 {
927         /* int offset; */
928
929         if (tvb_length(tvb) < 16) {
930                 return 0;
931         }
932         if (tree) {
933 /* hf_gdsdb_ddl_database */
934 /* hf_gdsdb_ddl_transaction */
935 /* hf_gdsdb_ddl_blr */
936         }
937
938         return tvb_length(tvb);
939 }
940
941 static int
942 gdsdb_slice(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
943 {
944         /* int offset; */
945
946         if (tvb_length(tvb) < 24) {
947                 return 0;
948         }
949         if (tree) {
950 /* hf_gdsdb_slice_transaction */
951 /* hf_gdsdb_slice_id */
952 /* hf_gdsdb_slice_sdl */
953 /* hf_gdsdb_slice_parameters */
954         }
955
956         return tvb_length(tvb);
957 }
958
959 static int
960 gdsdb_slice_response(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
961 {
962         /* int offset; */
963
964         if (tvb_length(tvb) < 8) {
965                 return 0;
966         }
967         if (tree) {
968 /* hf_gdsdb_sliceresponse_length */
969         }
970
971         return tvb_length(tvb);
972 }
973
974 static int
975 gdsdb_execute(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
976 {
977         /* int offset; */
978
979         if (tvb_length(tvb) < 12) {
980                 return 0;
981         }
982         if (tree) {
983 /* hf_gdsdb_execute_statement */
984 /* hf_gdsdb_execute_transaction */
985 /* hf_gdsdb_execute_message_number */
986 /* hf_gdsdb_execute_messages */
987         }
988
989         return tvb_length(tvb);
990 }
991
992 static int
993 gdsdb_exec_immediate2(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
994 {
995         /* int offset; */
996
997         if (tvb_length(tvb) < 44) {
998                 return 0;
999         }
1000         if (tree) {
1001 /* hf_gdsdb_prepare2_blr */
1002 /* hf_gdsdb_prepare2_number */
1003 /* hf_gdsdb_prepare2_messages */
1004 /* hf_gdsdb_prepare2_outblr */
1005 /* hf_gdsdb_prepare2_outmsgnr */
1006         }
1007
1008         return tvb_length(tvb);
1009 }
1010
1011 static int
1012 gdsdb_prepare(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
1013 {
1014         int offset;
1015         int length;
1016
1017         if (tvb_length(tvb) < 32) {
1018                 return 0;
1019         }
1020         if (check_col(pinfo->cinfo, COL_INFO)){
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)));
1025         }
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_BIG_ENDIAN);
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);
1047         }
1048
1049         return tvb_length(tvb);
1050 }
1051
1052 static int
1053 gdsdb_fetch(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
1054 {
1055         /* int offset; */
1056
1057         if (tvb_length(tvb) < 16) {
1058                 return 0;
1059         }
1060         if (tree) {
1061 /* hf_gdsdb_fetch_statement */
1062 /* hf_gdsdb_fetch_message_number */
1063 /* hf_gdsdb_fetch_messages */
1064         }
1065
1066         return tvb_length(tvb);
1067 }
1068
1069 static int
1070 gdsdb_fetch_response(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
1071 {
1072         /* int offset; */
1073
1074         if (tvb_length(tvb) < 12) {
1075                 return 0;
1076         }
1077         if (tree) {
1078 /* hf_gdsdb_fetchresponse_status */
1079 /* hf_gdsdb_fetchresponse_messages */
1080         }
1081
1082         return tvb_length(tvb);
1083 }
1084
1085 static int
1086 gdsdb_free_statement(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
1087 {
1088         /* int offset; */
1089
1090         if (tvb_length(tvb) < 12) {
1091                 return 0;
1092         }
1093         if (tree) {
1094 /* hf_gdsdb_free_statement */
1095 /* hf_gdsdb_free_option */
1096         }
1097
1098         return tvb_length(tvb);
1099 }
1100
1101 static int
1102 gdsdb_insert(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
1103 {
1104         /* int offset; */
1105
1106         if (tvb_length(tvb) < 16) {
1107                 return 0;
1108         }
1109         if (tree) {
1110 /* hf_gdsdb_insert_statement */
1111 /* hf_gdsdb_insert_message_number */
1112 /* hf_gdsdb_insert_messages */
1113         }
1114
1115         return tvb_length(tvb);
1116 }
1117
1118 static int
1119 gdsdb_cursor(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
1120 {
1121         /* int offset; */
1122
1123         if (tvb_length(tvb) < 16) {
1124                 return 0;
1125         }
1126         if (tree) {
1127 /* hf_gdsdb_cursor_statement */
1128 /* hf_gdsdb_cursor_type */
1129         }
1130
1131         return tvb_length(tvb);
1132 }
1133
1134 static int
1135 gdsdb_sql_response(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
1136 {
1137         /* int offset; */
1138
1139         if (tvb_length(tvb) < 8) {
1140                 return 0;
1141         }
1142         if (tree) {
1143 /* hf_gdsdb_sqlresponse_messages */
1144         }
1145
1146         return tvb_length(tvb);
1147 }
1148
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 */
1237 };
1238
1239 static int
1240 dissect_gdsdb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
1241 {
1242         proto_item *ti;
1243         proto_tree *gdsdb_tree;
1244         guint opcode;
1245         packet_info nopi;
1246
1247         gdsdb_tree = NULL; /* So the opcode functions can check on if(tree) */
1248         nopi.cinfo = NULL;
1249
1250         if (tvb_length(tvb) < 4)
1251                 return 0;
1252
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;
1258
1259         col_set_str(pinfo->cinfo, COL_PROTOCOL, "GDS DB");
1260
1261         if (check_col(pinfo->cinfo, COL_INFO))
1262                 col_add_str(pinfo->cinfo, COL_INFO,
1263                                 val_to_str(opcode, gdsdb_opcode, "Unknown opcode %u"));
1264
1265         if (tree) {
1266                 ti = proto_tree_add_item(tree, proto_gdsdb, tvb, 0, -1,
1267                                                                    ENC_NA);
1268                 gdsdb_tree = proto_item_add_subtree(ti, ett_gdsdb);
1269                 proto_tree_add_item(gdsdb_tree, hf_gdsdb_opcode, tvb,
1270                                                         0, 4, ENC_BIG_ENDIAN);
1271         }
1272
1273         /* opcode < op_max */
1274         return gdsdb_handle_opcode[opcode](tvb, pinfo, gdsdb_tree);
1275 }
1276
1277 void
1278 proto_register_gdsdb(void)
1279 {
1280         static hf_register_info hf[] = {
1281                 { &hf_gdsdb_opcode,
1282                         { "Opcode", "gdsdb.opcode",
1283                         FT_UINT32, BASE_DEC, VALS(gdsdb_opcode), 0x0,
1284                         NULL, HFILL }
1285                 },
1286                 /* gdsdb_dummy */
1287                 /* gdsdb_connect */
1288                 { &hf_gdsdb_connect_operation,
1289                         { "Operation", "gdsdb.connect.operation",
1290                         FT_UINT32, BASE_DEC, VALS(gdsdb_opcode), 0x0,
1291                         NULL, HFILL }
1292                 },
1293                 { &hf_gdsdb_connect_version,
1294                         { "Version", "gdsdb.connect.version",
1295                         FT_UINT32, BASE_DEC, NULL, 0x0,
1296                         NULL, HFILL }
1297                 },
1298                 { &hf_gdsdb_connect_client,
1299                         { "Client Architecture", "gdsdb.connect.client",
1300                         FT_UINT32, BASE_DEC, VALS(gdsdb_architectures), 0x0,
1301                         NULL, HFILL }
1302                 },
1303                 { &hf_gdsdb_connect_filename,
1304                         { "Filename", "gdsdb.connect.filename",
1305                         FT_UINT_STRING, BASE_NONE, NULL, 0x0,
1306                         NULL, HFILL }
1307                 },
1308                 { &hf_gdsdb_connect_count,
1309                         { "Version option count", "gdsdb.connect.count",
1310                         FT_UINT32, BASE_DEC, NULL, 0x0,
1311                         NULL, HFILL }
1312                 },
1313                 { &hf_gdsdb_connect_userid,
1314                         { "User ID", "gdsdb.connect.userid",
1315                         FT_UINT_STRING, BASE_NONE, NULL, 0x0,
1316                         NULL, HFILL }
1317                 },
1318                 { &hf_gdsdb_connect_pref,
1319                         { "Preferred version", "gdsdb.connect.pref",
1320                         FT_NONE, BASE_NONE, NULL, 0x0,
1321                         NULL, HFILL }
1322                 },
1323                 { &hf_gdsdb_connect_pref_version,
1324                         { "Version", "gdsdb.connect.pref.version",
1325                         FT_UINT32, BASE_DEC, NULL, 0x0,
1326                         NULL, HFILL }
1327                 },
1328                 { &hf_gdsdb_connect_pref_architecture,
1329                         { "Architecture", "gdsdb.connect.pref.arch",
1330                         FT_UINT32, BASE_DEC, VALS(gdsdb_architectures), 0x0,
1331                         NULL, HFILL }
1332                 },
1333                 { &hf_gdsdb_connect_pref_mintype,
1334                         { "Minimum type", "gdsdb.connect.pref.mintype",
1335                         FT_UINT32, BASE_DEC, NULL, 0x0,
1336                         NULL, HFILL }
1337                 },
1338                 { &hf_gdsdb_connect_pref_maxtype,
1339                         { "Maximum type", "gdsdb.connect.pref.maxtype",
1340                         FT_UINT32, BASE_DEC, NULL, 0x0,
1341                         NULL, HFILL }
1342                 },
1343                 { &hf_gdsdb_connect_pref_weight,
1344                         { "Preference weight", "gdsdb.connect.pref.weight",
1345                         FT_UINT32, BASE_DEC, NULL, 0x0,
1346                         NULL, HFILL }
1347                 },
1348                 /* gdsdb_accept */
1349                 { &hf_gdsdb_accept_version,
1350                         { "Version", "gdsdb.accept.version",
1351                         FT_UINT32, BASE_DEC, NULL, 0x0,
1352                         NULL, HFILL }
1353                 },
1354                 { &hf_gdsdb_accept_architecture,
1355                         { "Architecture", "gdsdb.accept.arch",
1356                         FT_UINT32, BASE_DEC, VALS(gdsdb_architectures), 0x0,
1357                         NULL, HFILL }
1358                 },
1359                 /* gdsdb_request */
1360                 { &hf_gdsdb_request_type,
1361                         { "Type", "gdsdb.connect.type",
1362                         FT_UINT32, BASE_DEC, NULL, 0x0,
1363                         NULL, HFILL }
1364                 },
1365                 { &hf_gdsdb_request_object,
1366                         { "Object", "gdsdb.connect.object",
1367                         FT_UINT32, BASE_DEC, NULL, 0x0,
1368                         NULL, HFILL }
1369                 },
1370                 { &hf_gdsdb_request_partner,
1371                         { "Partner", "gdsdb.connect.partner",
1372                         FT_UINT64, BASE_DEC, NULL, 0x0,
1373                         NULL, HFILL }
1374                 },
1375                 /* gdsdb_attach */
1376                 { &hf_gdsdb_attach_database,
1377                         { "Database", "gdsdb.attach.database",
1378                         FT_UINT32, BASE_DEC, NULL, 0x0,
1379                         NULL, HFILL }
1380                 },
1381                 { &hf_gdsdb_attach_filename,
1382                         { "Filename", "gdsdb.attach.filename",
1383                         FT_UINT_STRING, BASE_NONE, NULL, 0x0,
1384                         NULL, HFILL }
1385                 },
1386                 { &hf_gdsdb_attach_dpb,
1387                         { "Database parameter block", "gdsdb.attach.dpblength",
1388                         FT_UINT32, BASE_DEC, NULL, 0x0,
1389                         NULL, HFILL }
1390                 },
1391                 /* gdsdb_compile */
1392                 { &hf_gdsdb_compile_database,
1393                         { "Database", "gdsdb.compile.filename",
1394                         FT_UINT32, BASE_DEC, NULL, 0x0,
1395                         NULL, HFILL }
1396                 },
1397                 { &hf_gdsdb_compile_blr,
1398                         { "BLR", "gdsdb.compile.blr",
1399                         FT_UINT_STRING, BASE_NONE, NULL, 0x0,
1400                         NULL, HFILL }
1401                 },
1402                 /* gdsdb_receive */
1403                 { &hf_gdsdb_receive_request,
1404                         { "Request", "gdsdb.receive.request",
1405                         FT_UINT32, BASE_DEC, NULL, 0x0,
1406                         NULL, HFILL }
1407                 },
1408                 { &hf_gdsdb_receive_incarnation,
1409                         { "Incarnation", "gdsdb.receive.incarnation",
1410                         FT_UINT32, BASE_DEC, NULL, 0x0,
1411                         NULL, HFILL }
1412                 },
1413                 { &hf_gdsdb_receive_transaction,
1414                         { "Transaction", "gdsdb.receive.transaction",
1415                         FT_UINT32, BASE_DEC, NULL, 0x0,
1416                         NULL, HFILL }
1417                 },
1418                 { &hf_gdsdb_receive_msgnr,
1419                         { "Message number", "gdsdb.receive.msgnr",
1420                         FT_UINT32, BASE_DEC, NULL, 0x0,
1421                         NULL, HFILL }
1422                 },
1423                 { &hf_gdsdb_receive_messages,
1424                         { "Message Count", "gdsdb.receive.msgcount",
1425                         FT_UINT32, BASE_DEC, NULL, 0x0,
1426                         NULL, HFILL }
1427                 },
1428                 { &hf_gdsdb_receive_direction,
1429                         { "Scroll direction", "gdsdb.receive.direction",
1430                         FT_UINT32, BASE_DEC, NULL, 0x0,
1431                         NULL, HFILL }
1432                 },
1433                 { &hf_gdsdb_receive_offset,
1434                         { "Scroll offset", "gdsdb.receive.offset",
1435                         FT_UINT32, BASE_DEC, NULL, 0x0,
1436                         NULL, HFILL }
1437                 },
1438                 /* gdsdb_send */
1439                 { &hf_gdsdb_send_request,
1440                         { "Send request", "gdsdb.send.request",
1441                         FT_UINT32, BASE_DEC, NULL, 0x0,
1442                         NULL, HFILL }
1443                 },
1444                 { &hf_gdsdb_send_incarnation,
1445                         { "Send request", "gdsdb.send.incarnation",
1446                         FT_UINT32, BASE_DEC, NULL, 0x0,
1447                         NULL, HFILL }
1448                 },
1449                 { &hf_gdsdb_send_transaction,
1450                         { "Send request", "gdsdb.send.transaction",
1451                         FT_UINT32, BASE_DEC, NULL, 0x0,
1452                         NULL, HFILL }
1453                 },
1454                 { &hf_gdsdb_send_msgnr,
1455                         { "Send request", "gdsdb.send.msgnr",
1456                         FT_UINT32, BASE_DEC, NULL, 0x0,
1457                         NULL, HFILL }
1458                 },
1459                 { &hf_gdsdb_send_messages,
1460                         { "Send request", "gdsdb.send.messages",
1461                         FT_UINT32, BASE_DEC, NULL, 0x0,
1462                         NULL, HFILL }
1463                 },
1464                 /* gdsdb_response */
1465                 { &hf_gdsdb_response_object,
1466                         { "Response object", "gdsdb.response.object",
1467                         FT_UINT32, BASE_HEX, NULL, 0x0,
1468                         NULL, HFILL }
1469                 },
1470                 { &hf_gdsdb_response_blobid,
1471                         { "Blob ID", "gdsdb.response.blobid",
1472                         FT_UINT64, BASE_HEX, NULL, 0x0,
1473                         NULL, HFILL }
1474                 },
1475                 { &hf_gdsdb_response_data,
1476                         { "Data", "gdsdb.response.data",
1477                         FT_UINT_STRING, BASE_NONE, NULL, 0x0,
1478                         NULL, HFILL }
1479                 },
1480                 { &hf_gdsdb_response_status,
1481                         { "Status vector", "gdsdb.response.status",
1482                         FT_NONE, BASE_NONE, NULL, 0x0,
1483                         NULL, HFILL }
1484                 },
1485                 /* gdsdb_transact */
1486                 { &hf_gdsdb_transact_database,
1487                         { "Database", "gdsdb.transact.database",
1488                         FT_UINT32, BASE_DEC, NULL, 0x0,
1489                         NULL, HFILL }
1490                 },
1491                 { &hf_gdsdb_transact_transaction,
1492                         { "Database", "gdsdb.transact.transaction",
1493                         FT_UINT32, BASE_DEC, NULL, 0x0,
1494                         NULL, HFILL }
1495                 },
1496                 { &hf_gdsdb_transact_messages,
1497                         { "Messages", "gdsdb.transact.messages",
1498                         FT_UINT32, BASE_DEC, NULL, 0x0,
1499                         NULL, HFILL }
1500                 },
1501                 /* gdsdb_transact_response */
1502                 { &hf_gdsdb_transactresponse_messages,
1503                         { "Messages", "gdsdb.transactresponse.messages",
1504                         FT_UINT32, BASE_DEC, NULL, 0x0,
1505                         NULL, HFILL }
1506                 },
1507                 /* gdsdb_open_blob2 */
1508                 { &hf_gdsdb_openblob2_bpb,
1509                         { "Blob parameter block", "gdsdb.openblob2.bpb",
1510                         FT_UINT_STRING, BASE_NONE, NULL, 0x0,
1511                         NULL, HFILL }
1512                 },
1513                 /* gdsdb_open_blob */
1514                 { &hf_gdsdb_openblob_transaction,
1515                         { "Transaction", "gdsdb.openblob2.transaction",
1516                         FT_UINT32, BASE_DEC, NULL, 0x0,
1517                         NULL, HFILL }
1518                 },
1519                 { &hf_gdsdb_openblob_id,
1520                         { "ID", "gdsdb.openblob.id",
1521                         FT_UINT64, BASE_HEX, NULL, 0x0,
1522                         NULL, HFILL }
1523                 },
1524                 /* gdsdb_segment */
1525                 { &hf_gdsdb_segment_blob,
1526                         { "Blob", "gdsdb.segment.blob",
1527                         FT_UINT32, BASE_DEC, NULL, 0x0,
1528                         NULL, HFILL }
1529                 },
1530                 { &hf_gdsdb_segment_length,
1531                         { "Length", "gdsdb.segment.length",
1532                         FT_UINT32, BASE_DEC, NULL, 0x0,
1533                         NULL, HFILL }
1534                 },
1535                 { &hf_gdsdb_segment_segment,
1536                         { "Segment", "gdsdb.segment.segment",
1537                         FT_UINT_STRING, BASE_NONE, NULL, 0x0,
1538                         NULL, HFILL }
1539                 },
1540                 /* gdsdb_seek_blob */
1541                 { &hf_gdsdb_seekblob_blob,
1542                         { "Blob", "gdsdb.seekblob.blob",
1543                         FT_UINT32, BASE_DEC, NULL, 0x0,
1544                         NULL, HFILL }
1545                 },
1546                 { &hf_gdsdb_seekblob_mode,
1547                         { "Mode", "gdsdb.seekblob.mode",
1548                         FT_UINT32, BASE_DEC, NULL, 0x0,
1549                         NULL, HFILL }
1550                 },
1551                 /* gdsdb_reconnect */
1552                 { &hf_gdsdb_reconnect_database,
1553                         { "Database", "gdsdb.reconnect.database",
1554                         FT_UINT32, BASE_DEC, NULL, 0x0,
1555                         NULL, HFILL }
1556                 },
1557                 /* gdsdb_info & gdsdb_service_start */
1558                 { &hf_gdsdb_info_object,
1559                         { "Object", "gdsdb.info.object",
1560                         FT_UINT32, BASE_DEC, NULL, 0x0,
1561                         NULL, HFILL }
1562                 },
1563                 { &hf_gdsdb_info_incarnation,
1564                         { "Incarnation", "gdsdb.info.object",
1565                         FT_UINT32, BASE_DEC, NULL, 0x0,
1566                         NULL, HFILL }
1567                 },
1568                 { &hf_gdsdb_info_items,
1569                         { "Items", "gdsdb.info.items",
1570                         FT_UINT_STRING, BASE_NONE, NULL, 0x0,
1571                         NULL, HFILL }
1572                 },
1573                 { &hf_gdsdb_info_buffer_length,
1574                         { "Buffer length", "gdsdb.info.bufferlength",
1575                         FT_UINT32, BASE_DEC, NULL, 0x0,
1576                         NULL, HFILL }
1577                 },
1578                 /* gdsdb_release */
1579                 { &hf_gdsdb_release_object,
1580                         { "Object", "gdsdb.release.object",
1581                         FT_UINT32, BASE_DEC, NULL, 0x0,
1582                         NULL, HFILL }
1583                 },
1584                 /* gdsdb_prepare2 */
1585                 { &hf_gdsdb_prepare2_transaction,
1586                         { "Transaction", "gdsdb.prepare2.transaction",
1587                         FT_UINT32, BASE_DEC, NULL, 0x0,
1588                         NULL, HFILL }
1589                 },
1590                 /* gdsdb_event & gdsdb_cancel_events */
1591                 { &hf_gdsdb_event_database,
1592                         { "Database", "gdsdb.event.database",
1593                         FT_UINT32, BASE_DEC, NULL, 0x0,
1594                         NULL, HFILL }
1595                 },
1596                 { &hf_gdsdb_event_items,
1597                         { "Event description block", "gdsdb.event.items",
1598                         FT_UINT_STRING, BASE_NONE, NULL, 0x0,
1599                         NULL, HFILL }
1600                 },
1601                 { &hf_gdsdb_event_ast,
1602                         { "ast routine", "gdsdb.event.ast",
1603                         FT_UINT32, BASE_DEC, NULL, 0x0,
1604                         NULL, HFILL }
1605                 },
1606                 { &hf_gdsdb_event_arg,
1607                         { "Argument to ast routine", "gdsdb.event.arg",
1608                         FT_UINT32, BASE_DEC, NULL, 0x0,
1609                         NULL, HFILL }
1610                 },
1611                 { &hf_gdsdb_event_rid,
1612                         { "ID", "gdsdb.event.id",
1613                         FT_UINT32, BASE_DEC, NULL, 0x0,
1614                         NULL, HFILL }
1615                 },
1616                 /* gdsdb_ddl */
1617                 { &hf_gdsdb_ddl_database,
1618                         { "Database", "gdsdb.ddl.database",
1619                         FT_UINT32, BASE_DEC, NULL, 0x0,
1620                         NULL, HFILL }
1621                 },
1622                 { &hf_gdsdb_ddl_transaction,
1623                         { "Transaction", "gdsdb.ddl.transaction",
1624                         FT_UINT32, BASE_DEC, NULL, 0x0,
1625                         NULL, HFILL }
1626                 },
1627                 { &hf_gdsdb_ddl_blr,
1628                         { "BLR", "gdsdb.ddl.blr",
1629                         FT_UINT_STRING, BASE_NONE, NULL, 0x0,
1630                         NULL, HFILL }
1631                 },
1632                 /* gdsdb_slice */
1633                 { &hf_gdsdb_slice_transaction,
1634                         { "Transaction", "gdsdb.slice.transaction",
1635                         FT_UINT32, BASE_DEC, NULL, 0x0,
1636                         NULL, HFILL }
1637                 },
1638                 { &hf_gdsdb_slice_id,
1639                         { "ID", "gdsdb.slice.id",
1640                         FT_UINT64, BASE_HEX, NULL, 0x0,
1641                         NULL, HFILL }
1642                 },
1643                 { &hf_gdsdb_slice_sdl,
1644                         { "Slice description language", "gdsdb.slice.sdl",
1645                         FT_UINT_STRING, BASE_NONE, NULL, 0x0,
1646                         NULL, HFILL }
1647                 },
1648                 { &hf_gdsdb_slice_parameters,
1649                         { "Parameters", "gdsdb.slice.parameters",
1650                         FT_UINT32, BASE_DEC, NULL, 0x0,
1651                         NULL, HFILL }
1652                 },
1653                 /* gdsdb_slice_response */
1654                 { &hf_gdsdb_sliceresponse_length,
1655                         { "Length", "gdsdb.sliceresponse.length",
1656                         FT_UINT32, BASE_DEC, NULL, 0x0,
1657                         NULL, HFILL }
1658                 },
1659                 /* gdsdb_execute */
1660                 { &hf_gdsdb_execute_statement,
1661                         { "Statement", "gdsdb.execute.statement",
1662                         FT_UINT32, BASE_DEC, NULL, 0x0,
1663                         NULL, HFILL }
1664                 },
1665                 { &hf_gdsdb_execute_transaction,
1666                         { "Transaction", "gdsdb.execute.transaction",
1667                         FT_UINT32, BASE_DEC, NULL, 0x0,
1668                         NULL, HFILL }
1669                 },
1670                 { &hf_gdsdb_execute_message_number,
1671                         { "Message number", "gdsdb.execute.messagenumber",
1672                         FT_UINT32, BASE_DEC, NULL, 0x0,
1673                         NULL, HFILL }
1674                 },
1675                 { &hf_gdsdb_execute_messages,
1676                         { "Number of messages", "gdsdb.execute.messages",
1677                         FT_UINT32, BASE_DEC, NULL, 0x0,
1678                         NULL, HFILL }
1679                 },
1680                 /* gdsdb_execute2 */
1681                 { &hf_gdsdb_execute_outblr,
1682                         { "Output BLR", "gdsdb.execute.outblr",
1683                         FT_UINT32, BASE_DEC, NULL, 0x0,
1684                         NULL, HFILL }
1685                 },
1686                 { &hf_gdsdb_execute_outmsgnr,
1687                         { "Output Message number", "gdsdb.execute.outmsgnr",
1688                         FT_UINT32, BASE_DEC, NULL, 0x0,
1689                         NULL, HFILL }
1690                 },
1691                 /* gdsdb_exec_immediate2 */
1692                 { &hf_gdsdb_prepare2_blr,
1693                         { "BLR", "gdsdb.prepare.blr",
1694                         FT_UINT32, BASE_DEC, NULL, 0x0,
1695                         NULL, HFILL }
1696                 },
1697                 { &hf_gdsdb_prepare2_number,
1698                         { "Message number", "gdsdb.prepare2.messagenumber",
1699                         FT_UINT32, BASE_DEC, NULL, 0x0,
1700                         NULL, HFILL }
1701                 },
1702                 { &hf_gdsdb_prepare2_messages,
1703                         { "Number of messages", "gdsdb.prepare2.messages",
1704                         FT_UINT32, BASE_DEC, NULL, 0x0,
1705                         NULL, HFILL }
1706                 },
1707                 { &hf_gdsdb_prepare2_outblr,
1708                         { "Output BLR", "gdsdb.prepare2.outblr",
1709                         FT_UINT32, BASE_DEC, NULL, 0x0,
1710                         NULL, HFILL }
1711                 },
1712                 { &hf_gdsdb_prepare2_outmsgnr,
1713                         { "Output Message number", "gdsdb.prepare2.outmsgnr",
1714                         FT_UINT32, BASE_DEC, NULL, 0x0,
1715                         NULL, HFILL }
1716                 },
1717                 /* gdsdb_prepare */
1718                 { &hf_gdsdb_prepare_transaction,
1719                         { "Prepare, Transaction", "gdsdb.prepare.transaction",
1720                         FT_UINT32, BASE_DEC, NULL, 0x0,
1721                         NULL, HFILL }
1722                 },
1723                 { &hf_gdsdb_prepare_statement,
1724                         { "Prepare, Statement", "gdsdb.prepare.statement",
1725                         FT_UINT32, BASE_DEC, NULL, 0x0,
1726                         NULL, HFILL }
1727                 },
1728                 { &hf_gdsdb_prepare_dialect,
1729                         { "Prepare, Dialect", "gdsdb.prepare.dialect",
1730                         FT_UINT32, BASE_DEC, NULL, 0x0,
1731                         NULL, HFILL }
1732                 },
1733                 { &hf_gdsdb_prepare_querystr,
1734                         { "Prepare, Query", "gdsdb.prepare.querystr",
1735                         FT_UINT_STRING, BASE_NONE, NULL, 0x0,
1736                         NULL, HFILL }
1737                 },
1738                 { &hf_gdsdb_prepare_items,
1739                         { "Prepare, Information items", "gdsdb.prepare.items",
1740                         FT_UINT32, BASE_DEC, NULL, 0x0,
1741                         NULL, HFILL }
1742                 },
1743                 { &hf_gdsdb_prepare_bufferlength,
1744                         { "Prepare, Bufferlength", "gdsdb.prepare.bufferlen",
1745                         FT_UINT32, BASE_DEC, NULL, 0x0,
1746                         NULL, HFILL }
1747                 },
1748                 /* gdsdb_fetch */
1749                 { &hf_gdsdb_fetch_statement,
1750                         { "Statement", "gdsdb.fetch.statement",
1751                         FT_UINT32, BASE_DEC, NULL, 0x0,
1752                         NULL, HFILL }
1753                 },
1754                 { &hf_gdsdb_fetch_message_number,
1755                         { "Message number", "gdsdb.fetch.messagenr",
1756                         FT_UINT32, BASE_DEC, NULL, 0x0,
1757                         NULL, HFILL }
1758                 },
1759                 { &hf_gdsdb_fetch_messages,
1760                         { "Number of messages", "gdsdb.fetch.messages",
1761                         FT_UINT32, BASE_DEC, NULL, 0x0,
1762                         NULL, HFILL }
1763                 },
1764                 /* gdsdb_fetch_response */
1765                 { &hf_gdsdb_fetchresponse_status,
1766                         { "Status", "gdsdb.fetchresponse.status",
1767                         FT_UINT32, BASE_DEC, NULL, 0x0,
1768                         NULL, HFILL }
1769                 },
1770                 { &hf_gdsdb_fetchresponse_messages,
1771                         { "Number of messages", "gdsdb.fetchresponse.messages",
1772                         FT_UINT32, BASE_DEC, NULL, 0x0,
1773                         NULL, HFILL }
1774                 },
1775                 /* gdsdb_free_statement */
1776                 { &hf_gdsdb_free_statement,
1777                         { "Statement", "gdsdb.fetchresponse.statement",
1778                         FT_UINT32, BASE_DEC, NULL, 0x0,
1779                         NULL, HFILL }
1780                 },
1781                 { &hf_gdsdb_free_option,
1782                         { "Option", "gdsdb.fetchresponse.option",
1783                         FT_UINT32, BASE_DEC, NULL, 0x0,
1784                         NULL, HFILL }
1785                 },
1786                 /* gdsdb_insert */
1787                 { &hf_gdsdb_insert_statement,
1788                         { "Statement", "gdsdb.insert.statement",
1789                         FT_UINT32, BASE_DEC, NULL, 0x0,
1790                         NULL, HFILL }
1791                 },
1792                 { &hf_gdsdb_insert_message_number,
1793                         { "Message number", "gdsdb.insert.messagenr",
1794                         FT_UINT32, BASE_DEC, NULL, 0x0,
1795                         NULL, HFILL }
1796                 },
1797                 { &hf_gdsdb_insert_messages,
1798                         { "Number of messages", "gdsdb.insert.messages",
1799                         FT_UINT32, BASE_DEC, NULL, 0x0,
1800                         NULL, HFILL }
1801                 },
1802                 /* gdsdb_cursor */
1803                 { &hf_gdsdb_cursor_statement,
1804                         { "Statement", "gdsdb.cursor.statement",
1805                         FT_UINT32, BASE_DEC, NULL, 0x0,
1806                         NULL, HFILL }
1807                 },
1808                 { &hf_gdsdb_cursor_type,
1809                         { "Type", "gdsdb.cursor.type",
1810                         FT_UINT32, BASE_DEC, NULL, 0x0,
1811                         NULL, HFILL }
1812                 },
1813                 /* gdsdb_sql_response */
1814                 { &hf_gdsdb_sqlresponse_messages,
1815                         { "SQL Response, Message Count", "gdsdb.sqlresponse.msgcount",
1816                         FT_UINT32, BASE_DEC, NULL, 0x0,
1817                         NULL, HFILL }
1818                 }
1819         };
1820
1821         static gint *ett[] = {
1822                 &ett_gdsdb,
1823                 &ett_gdsdb_opcode,
1824                 &ett_gdsdb_connect_pref
1825         };
1826
1827         proto_gdsdb = proto_register_protocol(
1828                 "Firebird SQL Database Remote Protocol",
1829                 "FB/IB GDS DB", "gdsdb");
1830
1831         proto_register_field_array(proto_gdsdb, hf, array_length(hf));
1832         proto_register_subtree_array(ett, array_length(ett));
1833 }
1834
1835 void
1836 proto_reg_handoff_gdsdb(void)
1837 {
1838         /* Main dissector */
1839
1840         dissector_handle_t gdsdb_handle;
1841
1842         gdsdb_handle = new_create_dissector_handle(dissect_gdsdb,
1843                                                                  proto_gdsdb);
1844         dissector_add_uint("tcp.port", TCP_PORT, gdsdb_handle);
1845 }