1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
|
/* packet-gdsdb.c
* Routines for Firebird/Interbase dissection
* Copyright 2007, Moshe van der Sterre <moshevds@gmail.com>
*
* Firebird home: http://www.firebirdsql.org
* Source: http://sourceforge.net/projects/firebird/
*
* Wireshark - Network traffic analyzer
* By Gerald Combs <gerald@wireshark.org>
* Copyright 1998 Gerald Combs
*
* SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "config.h"
#include <epan/packet.h>
#include <epan/expert.h>
void proto_register_gdsdb(void);
void proto_reg_handoff_gdsdb(void);
static dissector_handle_t gdsdb_handle;
#define TCP_PORT 3050
static int proto_gdsdb;
static int ett_gdsdb;
static int hf_gdsdb_opcode;
/* static int ett_gdsdb_opcode; */
/* gdsdb_dummy */
/* gdsdb_connect */
static int hf_gdsdb_connect_operation;
static int hf_gdsdb_connect_version;
static int hf_gdsdb_connect_client;
static int hf_gdsdb_connect_filename;
static int hf_gdsdb_connect_count;
static int hf_gdsdb_connect_userid;
static int hf_gdsdb_connect_pref;
static int ett_gdsdb_connect_pref;
static int hf_gdsdb_connect_pref_version;
static int hf_gdsdb_connect_pref_architecture;
static int hf_gdsdb_connect_pref_mintype;
static int hf_gdsdb_connect_pref_maxtype;
static int hf_gdsdb_connect_pref_weight;
/* gdsdb_accept */
static int hf_gdsdb_accept_version;
static int hf_gdsdb_accept_architecture;
static int hf_gdsdb_accept_proto_min_type;
/* gdsdb_request */
static int hf_gdsdb_request_type;
static int hf_gdsdb_request_object;
static int hf_gdsdb_request_partner;
/* gdsdb_attach */
static int hf_gdsdb_attach_database_object_id;
static int hf_gdsdb_attach_database_path;
static int hf_gdsdb_attach_database_param_buf;
/* gdsdb_compile */
static int hf_gdsdb_compile_database;
static int hf_gdsdb_compile_blr;
/* gdsdb_receive */
static int hf_gdsdb_receive_request;
static int hf_gdsdb_receive_incarnation;
static int hf_gdsdb_receive_transaction;
static int hf_gdsdb_receive_msgnr;
static int hf_gdsdb_receive_messages;
static int hf_gdsdb_receive_direction;
static int hf_gdsdb_receive_offset;
/* gdsdb_send */
static int hf_gdsdb_send_request;
static int hf_gdsdb_send_incarnation;
static int hf_gdsdb_send_transaction;
static int hf_gdsdb_send_msgnr;
static int hf_gdsdb_send_messages;
/* gdsdb_response */
static int hf_gdsdb_response_object;
static int hf_gdsdb_response_blobid;
static int hf_gdsdb_response_datasize;
static int hf_gdsdb_response_data;
/* gdsdb_status_vector */
static int hf_gdsdb_status_vector_arg;
static int hf_gdsdb_status_vector_error_code;
static int hf_gdsdb_status_vector_number;
static int hf_gdsdb_status_vector_string;
static int hf_gdsdb_status_vector_sql_state;
/* gdsdb_transact */
static int hf_gdsdb_transact_database;
static int hf_gdsdb_transact_transaction;
#if 0
static int hf_gdsdb_transact_messages;
#endif
/* gdsdb_transact_response */
static int hf_gdsdb_transactresponse_messages;
/* gdsdb_open_blob2 */
static int hf_gdsdb_openblob2_bpb;
/* gdsdb_open_blob */
static int hf_gdsdb_openblob_transaction;
static int hf_gdsdb_openblob_id;
#if 0
/* gdsdb_segment */
static int hf_gdsdb_segment_blob;
static int hf_gdsdb_segment_length;
static int hf_gdsdb_segment_segment;
/* gdsdb_seek_blob */
static int hf_gdsdb_seekblob_blob;
static int hf_gdsdb_seekblob_mode;
#endif
/* gdsdb_reconnect */
static int hf_gdsdb_reconnect_handle;
static int hf_gdsdb_reconnect_database_size;
static int hf_gdsdb_reconnect_database;
/* gdsdb_info & gdsdb_service_start */
static int hf_gdsdb_info_object;
static int hf_gdsdb_info_incarnation;
static int hf_gdsdb_info_items;
static int hf_gdsdb_info_recv_items;
static int hf_gdsdb_info_buffer_length;
/* gdsdb_release */
static int hf_gdsdb_release_object;
#if 0
/* gdsdb_prepare2 */
static int hf_gdsdb_prepare2_transaction;
/* gdsdb_event & gdsdb_cancel_events */
static int hf_gdsdb_event_database;
static int hf_gdsdb_event_items;
static int hf_gdsdb_event_ast;
static int hf_gdsdb_event_arg;
static int hf_gdsdb_event_rid;
/* gdsdb_ddl */
static int hf_gdsdb_ddl_database;
static int hf_gdsdb_ddl_transaction;
static int hf_gdsdb_ddl_blr;
/* gdsdb_slice */
static int hf_gdsdb_slice_transaction;
static int hf_gdsdb_slice_id;
static int hf_gdsdb_slice_sdl;
static int hf_gdsdb_slice_parameters;
/* gdsdb_slice_response */
static int hf_gdsdb_sliceresponse_length;
#endif
/* gdsdb_execute */
static int hf_gdsdb_execute_statement;
static int hf_gdsdb_execute_transaction;
static int hf_gdsdb_execute_message_number;
static int hf_gdsdb_execute_messages;
#if 0
/* gdsdb_execute2 */
static int hf_gdsdb_execute_outblr;
static int hf_gdsdb_execute_outmsgnr;
/* gdsdb_exec_immediate2 */
static int hf_gdsdb_prepare2_blr;
static int hf_gdsdb_prepare2_number;
static int hf_gdsdb_prepare2_messages;
static int hf_gdsdb_prepare2_outblr;
static int hf_gdsdb_prepare2_outmsgnr;
#endif
/* gdsdb_prepare */
static int hf_gdsdb_prepare_transaction;
static int hf_gdsdb_prepare_statement;
static int hf_gdsdb_prepare_dialect;
static int hf_gdsdb_prepare_querystr;
static int hf_gdsdb_prepare_bufferlength;
#if 0
/* gdsdb_fetch */
static int hf_gdsdb_fetch_statement;
static int hf_gdsdb_fetch_message_number;
static int hf_gdsdb_fetch_messages;
/* gdsdb_fetch_response */
static int hf_gdsdb_fetchresponse_status;
static int hf_gdsdb_fetchresponse_messages;
#endif
/* gdsdb_free_statement */
static int hf_gdsdb_free_statement;
static int hf_gdsdb_free_option;
#if 0
/* gdsdb_insert */
static int hf_gdsdb_insert_statement;
static int hf_gdsdb_insert_message_number;
static int hf_gdsdb_insert_messages;
/* gdsdb_cursor */
static int hf_gdsdb_cursor_statement;
static int hf_gdsdb_cursor_type;
/* gdsdb_sql_response */
static int hf_gdsdb_sqlresponse_messages;
#endif
static expert_field ei_gdsdb_invalid_length;
enum
{
op_void = 0,
op_connect = 1,
op_exit = 2,
op_accept = 3,
op_reject = 4,
op_protocol = 5,
op_disconnect = 6,
op_credit = 7,
op_continuation = 8,
op_response = 9,
op_open_file = 10,
op_create_file = 11,
op_close_file = 12,
op_read_page = 13,
op_write_page = 14,
op_lock = 15,
op_convert_lock = 16,
op_release_lock = 17,
op_blocking = 18,
op_attach = 19,
op_create = 20,
op_detach = 21,
op_compile = 22,
op_start = 23,
op_start_and_send = 24,
op_send = 25,
op_receive = 26,
op_unwind = 27,
op_release = 28,
op_transaction = 29,
op_commit = 30,
op_rollback = 31,
op_prepare = 32,
op_reconnect = 33,
op_create_blob = 34,
op_open_blob = 35,
op_get_segment = 36,
op_put_segment = 37,
op_cancel_blob = 38,
op_close_blob = 39,
op_info_database = 40,
op_info_request = 41,
op_info_transaction = 42,
op_info_blob = 43,
op_batch_segments = 44,
op_mgr_set_affinity = 45,
op_mgr_clear_affinity = 46,
op_mgr_report = 47,
op_que_events = 48,
op_cancel_events = 49,
op_commit_retaining = 50,
op_prepare2 = 51,
op_event = 52,
op_connect_request = 53,
op_aux_connect = 54,
op_ddl = 55,
op_open_blob2 = 56,
op_create_blob2 = 57,
op_get_slice = 58,
op_put_slice = 59,
op_slice = 60,
op_seek_blob = 61,
op_allocate_statement = 62,
op_execute = 63,
op_exec_immediate = 64,
op_fetch = 65,
op_fetch_response = 66,
op_free_statement = 67,
op_prepare_statement = 68,
op_set_cursor = 69,
op_info_sql = 70,
op_dummy = 71,
op_response_piggyback = 72,
op_start_and_receive = 73,
op_start_send_and_receive = 74,
op_exec_immediate2 = 75,
op_execute2 = 76,
op_insert = 77,
op_sql_response = 78,
op_transact = 79,
op_transact_response = 80,
op_drop_database = 81,
op_service_attach = 82,
op_service_detach = 83,
op_service_info = 84,
op_service_start = 85,
op_rollback_retaining = 86,
op_update_account_info = 87,
op_authenticate_user = 88,
op_partial = 89,
op_trusted_auth = 90,
op_cancel = 91,
op_max
};
static const value_string gdsdb_opcode[] = {
{ op_void, "Void" },
{ op_connect, "Connect" },
{ op_exit, "Exit" },
{ op_accept, "Accept" },
{ op_reject, "Reject" },
{ op_protocol, "Protocol" },
{ op_disconnect, "Disconnect" },
{ op_credit, "Credit" },
{ op_continuation, "Continuation" },
{ op_response, "Response" },
{ op_open_file, "Open file" },
{ op_create_file, "Create file" },
{ op_close_file, "Close file" },
{ op_read_page, "Read page" },
{ op_write_page, "Write page" },
{ op_lock, "Lock" },
{ op_convert_lock, "Convert lock" },
{ op_release_lock, "Release lock" },
{ op_blocking, "Blocking" },
{ op_attach, "Attach" },
{ op_create, "Create" },
{ op_detach, "Detach" },
{ op_compile, "Compile" },
{ op_start, "Start" },
{ op_start_and_send, "Start and send" },
{ op_send, "Send" },
{ op_receive, "Receive" },
{ op_unwind, "Unwind" },
{ op_release, "Release" },
{ op_transaction, "Transaction" },
{ op_commit, "Commit" },
{ op_rollback, "Rollback" },
{ op_prepare, "Prepare" },
{ op_reconnect, "Reconnect" },
{ op_create_blob, "Create blob" },
{ op_open_blob, "Open blob" },
{ op_get_segment, "Get segment" },
{ op_put_segment, "Put segment" },
{ op_cancel_blob, "Cancel blob" },
{ op_close_blob, "Close blob" },
{ op_info_database, "Info database" },
{ op_info_request, "Info request" },
{ op_info_transaction, "Info transaction" },
{ op_info_blob, "Info blob" },
{ op_batch_segments, "Batch segments" },
{ op_mgr_set_affinity, "Mgr set affinity" },
{ op_mgr_clear_affinity, "Mgr clear affinity" },
{ op_mgr_report, "Mgr report" },
{ op_que_events, "Que events" },
{ op_cancel_events, "Cancel events" },
{ op_commit_retaining, "Commit retaining" },
{ op_prepare2, "Prepare 2" },
{ op_event, "Event" },
{ op_connect_request, "Connect request" },
{ op_aux_connect, "Aux connect" },
{ op_ddl, "DDl" },
{ op_open_blob2, "Open blob 2" },
{ op_create_blob2, "Create blob 2" },
{ op_get_slice, "Get slice" },
{ op_put_slice, "Put slice" },
{ op_slice, "Slice" },
{ op_seek_blob, "Seek blob" },
{ op_allocate_statement, "Allocate statement" },
{ op_execute, "Execute" },
{ op_exec_immediate, "Exec immediate" },
{ op_fetch, "Fetch" },
{ op_fetch_response, "Fetch response" },
{ op_free_statement, "Free statement" },
{ op_prepare_statement, "Prepare statement" },
{ op_set_cursor, "Set cursor" },
{ op_info_sql, "Info sql" },
{ op_dummy, "Dummy" },
{ op_response_piggyback, "Response piggyback" },
{ op_start_and_receive, "Start and receive" },
{ op_start_send_and_receive, "Start send and receive" },
{ op_exec_immediate2, "Exec immediate 2" },
{ op_execute2, "Execute 2" },
{ op_insert, "Insert" },
{ op_sql_response, "Sql response" },
{ op_transact, "Transact" },
{ op_transact_response, "Transact response" },
{ op_drop_database, "Drop database" },
{ op_service_attach, "Service attach" },
{ op_service_detach, "Service detach" },
{ op_service_info, "Service info" },
{ op_service_start, "Service start" },
{ op_rollback_retaining, "Rollback retaining" },
{ op_update_account_info, "update_account_info" },
{ op_authenticate_user, "authenticate_user" },
{ op_partial, "partial" },
{ op_trusted_auth, "trusted_auth" },
{ op_cancel, "cancel" },
{ 0, NULL }
};
static const value_string gdsdb_architectures[] = {
{ 1, "Generic" },
{ 2, "Apollo" },
{ 3, "Sun" },
{ 4, "Vms" },
{ 5, "Ultrix" },
{ 6, "Alliant" },
{ 7, "MS-Dos" },
{ 8, "Sun 4" },
{ 9, "Sun 386" },
{ 10, "HP-UX" },
{ 11, "HP MPE/xl" },
{ 12, "Mac" },
{ 13, "Mac aux" },
{ 14, "rt" },
{ 15, "mips Ultrix" },
{ 16, "HP-UX 68k" },
{ 17, "Xenix" },
{ 18, "Aviion" },
{ 19, "SGI" },
{ 20, "Apollo_dn10k" },
{ 21, "Cray" },
{ 22, "Imp" },
{ 23, "Delta" },
{ 24, "SCO" },
{ 25, "Next" },
{ 26, "Next 386" },
{ 27, "m88k" },
{ 28, "UnixWare" },
{ 29, "Intel 32" },
{ 30, "Epson" },
{ 31, "Decosf" },
{ 32, "Ncr3000" },
{ 33, "NT PPC" },
{ 34, "DG x86" },
{ 35, "SCO ev" },
{ 36, "Linux" },
{ 37, "FreeBSD" },
{ 38, "NetBSD" },
{ 39, "Darwin PPC" },
{ 0, NULL }
};
enum
{
arg_end = 0,
arg_gds = 1,
arg_string = 2,
arg_cstring = 3,
arg_number = 4,
arg_interpreted = 5,
arg_vms = 6,
arg_unix = 7,
arg_domain = 8,
arg_dos = 9,
arg_mpexl = 10,
arg_mpexl_ipc = 11,
arg_next_mach = 15,
arg_netware = 16,
arg_win32 = 17,
arg_warning = 18,
arg_sql_state = 19
};
static const value_string gdsdb_arg_types[] = {
{ arg_end, "end of argument list" },
{ arg_gds, "generic DSRI" },
{ arg_string, "string argument" },
{ arg_cstring, "count & string argument" },
{ arg_number, "numeric argument" },
{ arg_interpreted, "interpreted status code" },
{ arg_vms, "VAX/VMS status code" },
{ arg_unix, "UNIX error code" },
{ arg_domain, "Apollo/Domain error code" },
{ arg_dos, "MSDOS/OS2 error code" },
{ arg_mpexl, "HP MPE/XL error code" },
{ arg_mpexl_ipc, "HP MPE/XL IPC error code" },
{ arg_next_mach, "NeXT/Mach error code" },
{ arg_netware, "NetWare error code" },
{ arg_win32, "Win32 error code" },
{ arg_warning, "warning argument" },
{ arg_sql_state, "SQLSTATE" },
{ 0, NULL }
};
static int dword_align(int length)
{
return (length + (4-(length&3)));
}
static int add_uint_string(proto_tree *tree, int hf_string, tvbuff_t *tvb, int offset)
{
proto_item* ti;
int length;
ti = proto_tree_add_item(tree, hf_string, tvb,
offset, 4, ENC_ASCII|ENC_BIG_ENDIAN);
length = dword_align(tvb_get_ntohl(tvb, offset))+4;
proto_item_set_len(ti, length);
int ret_offset = offset + length;
if (length < 4 || ret_offset < offset) {
expert_add_info_format(NULL, ti, &ei_gdsdb_invalid_length, "Invalid length: %d", length);
return tvb_reported_length(tvb);
}
return ret_offset;
}
static int add_byte_array(proto_tree *tree, int hf_len, int hf_byte, tvbuff_t *tvb, int offset)
{
proto_item* ti;
uint32_t length;
proto_tree_add_item_ret_uint(tree, hf_len, tvb,
offset, 4, ENC_BIG_ENDIAN, &length);
offset += 4;
if (length > 0)
{
ti = proto_tree_add_item(tree, hf_byte, tvb,
offset, length, ENC_NA);
length = dword_align(length);
proto_item_set_len(ti, length);
}
return offset + length;
}
static int
gdsdb_dummy(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree _U_, int offset _U_)
{
/* Ignore data */
return tvb_reported_length(tvb);
}
static int
gdsdb_connect(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
{
int count, file_size, total_length = 16;
int i, length = tvb_reported_length_remaining(tvb, offset);
proto_item *ti;
proto_tree *pref_tree;
/* Calculate if we need more data */
if (length < total_length)
return -1;
file_size = tvb_get_ntohl(tvb, offset+12);
total_length += 4+dword_align(file_size);
if (length < total_length+4)
return -1;
count = tvb_get_ntohl(tvb, offset+total_length-4);
total_length += (4+(count*20));
if (length < total_length)
return -1;
proto_tree_add_item(tree, hf_gdsdb_connect_operation, tvb,
offset, 4, ENC_BIG_ENDIAN);
offset += 4;
proto_tree_add_item(tree, hf_gdsdb_connect_version, tvb,
offset, 4, ENC_BIG_ENDIAN);
offset += 4;
proto_tree_add_item(tree, hf_gdsdb_connect_client, tvb,
offset, 4, ENC_BIG_ENDIAN);
offset += 4;
offset = add_uint_string(tree, hf_gdsdb_connect_filename, tvb, offset);
proto_tree_add_item(tree, hf_gdsdb_connect_count, tvb,
offset, 4, ENC_BIG_ENDIAN);
offset += 4;
col_append_fstr(pinfo->cinfo, COL_INFO, ": %s", tvb_format_text(pinfo->pool, tvb, offset+4, tvb_get_ntohl(tvb, offset)));
offset = add_uint_string(tree, hf_gdsdb_connect_userid, tvb, offset);
for(i=0;i<count;i++){
ti = proto_tree_add_item(tree, hf_gdsdb_connect_pref, tvb, offset, 20, ENC_NA);
pref_tree = proto_item_add_subtree(ti, ett_gdsdb_connect_pref);
proto_tree_add_item(pref_tree, hf_gdsdb_connect_pref_version,
tvb, offset, 4, ENC_BIG_ENDIAN);
offset += 4;
proto_tree_add_item(pref_tree, hf_gdsdb_connect_pref_architecture,
tvb, offset, 4, ENC_BIG_ENDIAN);
offset += 4;
proto_tree_add_item(pref_tree, hf_gdsdb_connect_pref_mintype,
tvb, offset, 4, ENC_BIG_ENDIAN);
offset += 4;
proto_tree_add_item(pref_tree, hf_gdsdb_connect_pref_maxtype,
tvb, offset, 4, ENC_BIG_ENDIAN);
offset += 4;
proto_tree_add_item(pref_tree, hf_gdsdb_connect_pref_weight,
tvb, offset, 4, ENC_BIG_ENDIAN);
offset += 4;
}
return offset;
}
static int
gdsdb_accept(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset)
{
/* Calculate if we need more data */
if (tvb_reported_length_remaining(tvb, offset) < 12) {
return -1;
}
proto_tree_add_item(tree, hf_gdsdb_accept_version, tvb,
offset, 4, ENC_BIG_ENDIAN);
offset += 4;
proto_tree_add_item(tree, hf_gdsdb_accept_architecture, tvb,
offset, 4, ENC_BIG_ENDIAN);
offset += 4;
proto_tree_add_item(tree, hf_gdsdb_accept_proto_min_type, tvb,
offset, 4, ENC_BIG_ENDIAN);
offset += 4;
return offset;
}
static int
gdsdb_request(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset)
{
/* Calculate if we need more data */
if (tvb_reported_length_remaining(tvb, offset) < 16) {
return -1;
}
proto_tree_add_item(tree, hf_gdsdb_request_type, tvb, offset, 4, ENC_BIG_ENDIAN);
offset += 4;
proto_tree_add_item(tree, hf_gdsdb_request_object, tvb, offset, 4, ENC_BIG_ENDIAN);
offset += 4;
proto_tree_add_item(tree, hf_gdsdb_request_partner, tvb, offset, 8, ENC_BIG_ENDIAN);
offset += 8;
return offset;
}
static int
gdsdb_attach(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
{
int total_length = 12;
int size, length = tvb_reported_length_remaining(tvb, offset);
/* Calculate if we need more data */
if (length < total_length) {
return -1;
}
size = tvb_get_ntohl(tvb, offset+4);
total_length += dword_align(size);
if (length < total_length)
return -1;
size = tvb_get_ntohl(tvb, offset+total_length-4);
total_length += dword_align(size);
if (length < total_length)
return -1;
proto_tree_add_item(tree, hf_gdsdb_attach_database_object_id, tvb, offset, 4, ENC_BIG_ENDIAN);
offset += 4;
col_append_fstr(pinfo->cinfo, COL_INFO, ": %s", tvb_format_text(pinfo->pool, tvb, offset+4, tvb_get_ntohl(tvb, offset)));
offset = add_uint_string(tree, hf_gdsdb_attach_database_path, tvb, offset);
offset = add_uint_string(tree, hf_gdsdb_attach_database_param_buf, tvb, offset);
return offset;
}
static int
gdsdb_compile(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset)
{
int total_length = 8;
int size, length = tvb_reported_length_remaining(tvb, offset);
/* Calculate if we need more data */
if (length < total_length) {
return -1;
}
size = tvb_get_ntohl(tvb, offset+4);
total_length += dword_align(size);
if (length < total_length)
return -1;
proto_tree_add_item(tree, hf_gdsdb_compile_database, tvb, offset, 4, ENC_BIG_ENDIAN);
offset += 4;
offset = add_uint_string(tree, hf_gdsdb_compile_blr, tvb, offset);
return offset;
}
static int
gdsdb_receive(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset)
{
/* Calculate if we need more data */
if (tvb_reported_length_remaining(tvb, offset) < 20) {
return -1;
}
proto_tree_add_item(tree, hf_gdsdb_receive_request, tvb,
offset, 4, ENC_BIG_ENDIAN);
offset += 4;
proto_tree_add_item(tree, hf_gdsdb_receive_incarnation, tvb,
offset, 4, ENC_BIG_ENDIAN);
offset += 4;
proto_tree_add_item(tree, hf_gdsdb_receive_transaction, tvb,
offset, 4, ENC_BIG_ENDIAN);
offset += 4;
proto_tree_add_item(tree, hf_gdsdb_receive_msgnr, tvb,
offset, 4, ENC_BIG_ENDIAN);
offset += 4;
proto_tree_add_item(tree, hf_gdsdb_receive_messages, tvb,
offset, 4, ENC_BIG_ENDIAN);
offset += 4;
while (tvb_reported_length_remaining(tvb, offset) >= 12) {
proto_tree_add_item(tree, hf_gdsdb_receive_direction,
tvb, offset, 4, ENC_BIG_ENDIAN);
offset += 4;
proto_tree_add_item(tree, hf_gdsdb_receive_offset,
tvb, offset, 8, ENC_BIG_ENDIAN);
offset += 8;
}
return offset;
}
static int
gdsdb_send(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset)
{
/* Calculate if we need more data */
if (tvb_reported_length_remaining(tvb, offset) < 20) {
return -1;
}
proto_tree_add_item(tree, hf_gdsdb_send_request, tvb,
offset, 4, ENC_BIG_ENDIAN);
offset += 4;
proto_tree_add_item(tree, hf_gdsdb_send_incarnation, tvb,
offset, 4, ENC_BIG_ENDIAN);
offset += 4;
proto_tree_add_item(tree, hf_gdsdb_send_transaction, tvb,
offset, 4, ENC_BIG_ENDIAN);
offset += 4;
proto_tree_add_item(tree, hf_gdsdb_send_msgnr, tvb,
offset, 4, ENC_BIG_ENDIAN);
offset += 4;
proto_tree_add_item(tree, hf_gdsdb_send_messages, tvb,
offset, 4, ENC_BIG_ENDIAN);
offset += 4;
return offset;
}
static int
gdsdb_status_vector(proto_tree *tree, tvbuff_t *tvb, int offset)
{
uint32_t arg;
while (tvb_reported_length_remaining(tvb, offset) >= 4)
{
proto_tree_add_item_ret_uint(tree, hf_gdsdb_status_vector_arg, tvb,
offset, 4, ENC_BIG_ENDIAN, &arg);
offset += 4;
if (arg == 0)
break;
switch(arg)
{
case arg_gds:
default:
proto_tree_add_item(tree, hf_gdsdb_status_vector_error_code, tvb,
offset, 4, ENC_BIG_ENDIAN);
offset += 4;
break;
case arg_number:
proto_tree_add_item(tree, hf_gdsdb_status_vector_number, tvb,
offset, 4, ENC_BIG_ENDIAN);
offset += 4;
break;
case arg_string:
case arg_interpreted:
offset = add_uint_string(tree, hf_gdsdb_status_vector_string, tvb, offset);
break;
case arg_sql_state:
offset = add_uint_string(tree, hf_gdsdb_status_vector_sql_state, tvb, offset);
break;
}
}
return offset;
}
static int
gdsdb_response(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset)
{
int total_length = 16;
int length = tvb_reported_length_remaining(tvb, offset);
uint32_t size_length;
/* Calculate if we need more data */
if (length < total_length) {
return -1;
}
total_length += dword_align(tvb_get_ntohl(tvb, offset+12));
if (length < total_length) {
return -1;
}
proto_tree_add_item(tree, hf_gdsdb_response_object, tvb,
offset, 4, ENC_BIG_ENDIAN);
offset += 4;
proto_tree_add_item(tree, hf_gdsdb_response_blobid, tvb,
offset, 8, ENC_BIG_ENDIAN);
offset += 8;
proto_tree_add_item_ret_uint(tree, hf_gdsdb_response_datasize, tvb,
offset, 4, ENC_BIG_ENDIAN, &size_length);
offset += 4;
if (size_length > 0)
proto_tree_add_item(tree, hf_gdsdb_response_data, tvb, offset, size_length, ENC_NA);
offset += size_length;
return gdsdb_status_vector(tree, tvb, offset);
}
static int
gdsdb_transact(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset)
{
/* Calculate if we need more data */
if (tvb_reported_length_remaining(tvb, offset) < 8) {
return -1;
}
proto_tree_add_item(tree, hf_gdsdb_transact_database, tvb,
offset, 4, ENC_BIG_ENDIAN);
offset += 4;
proto_tree_add_item(tree, hf_gdsdb_transact_transaction, tvb,
offset, 4, ENC_BIG_ENDIAN);
offset += 4;
return offset;
}
static int
gdsdb_transact_response(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset)
{
/* Calculate if we need more data */
if (tvb_reported_length_remaining(tvb, offset) < 4) {
return -1;
}
proto_tree_add_item(tree, hf_gdsdb_transactresponse_messages,
tvb, offset, 4, ENC_BIG_ENDIAN);
offset += 4;
return offset;
}
static int
gdsdb_open_blob2(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset)
{
int total_length = 12;
int length = tvb_reported_length_remaining(tvb, offset);
/* Calculate if we need more data */
if (length < total_length) {
return -1;
}
total_length += dword_align(tvb_get_ntohl(tvb, offset));
if (length < total_length) {
return -1;
}
offset = add_uint_string(tree, hf_gdsdb_openblob2_bpb, tvb, offset);
proto_tree_add_item(tree, hf_gdsdb_openblob_transaction, tvb,
offset, 4, ENC_BIG_ENDIAN);
offset += 4;
proto_tree_add_item(tree, hf_gdsdb_openblob_id, tvb, offset,
8, ENC_BIG_ENDIAN);
offset += 8;
return offset;
}
static int
gdsdb_open_blob(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset)
{
/* Calculate if we need more data */
if (tvb_reported_length_remaining(tvb, offset) < 8) {
return -1;
}
proto_tree_add_item(tree, hf_gdsdb_openblob_transaction, tvb,
offset, 4, ENC_BIG_ENDIAN);
offset += 4;
proto_tree_add_item(tree, hf_gdsdb_openblob_id, tvb, offset,
8, ENC_BIG_ENDIAN);
offset += 8;
return offset;
}
static int
gdsdb_segment(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset)
{
/* Calculate if we need more data */
if (tvb_reported_length_remaining(tvb, offset) < 12)
return -1;
if (tree) {
/* hf_gdsdb_segment_blob */
/* hf_gdsdb_segment_length */
/* add_uint_string(hf_gdsdb_segment_segment )*/
}
return tvb_reported_length(tvb);
}
static int
gdsdb_seek_blob(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset)
{
/* Calculate if we need more data */
if (tvb_reported_length_remaining(tvb, offset) < 12)
return -1;
if (tree) {
/* hf_gdsdb_seekblob_blob */
/* hf_gdsdb_seekblob_mode */
}
return tvb_reported_length(tvb);
}
static int
gdsdb_reconnect(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset)
{
int total_length = 8;
int length = tvb_reported_length_remaining(tvb, offset);
/* Calculate if we need more data */
if (length < total_length) {
return -1;
}
total_length += dword_align(tvb_get_ntohl(tvb, offset+4));
if (length < total_length) {
return -1;
}
proto_tree_add_item(tree, hf_gdsdb_reconnect_handle, tvb, offset,
4, ENC_BIG_ENDIAN);
offset += 4;
offset = add_byte_array(tree, hf_gdsdb_reconnect_database_size, hf_gdsdb_reconnect_database, tvb, offset);
return offset;
}
static int
gdsdb_info(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset)
{
unsigned opcode;
int total_length = 16;
int length = tvb_reported_length_remaining(tvb, offset);
/* Calculate if we need more data */
if (length < total_length) {
return -1;
}
opcode = tvb_get_ntohl(tvb, offset-4);
total_length += dword_align(tvb_get_ntohl(tvb, offset+8));
if (length < total_length) {
return -1;
}
if(opcode == op_service_info) {
total_length += dword_align(tvb_get_ntohl(tvb, offset+total_length-8));
if (length < total_length) {
return -1;
}
}
proto_tree_add_item(tree, hf_gdsdb_info_object, tvb, offset,
4, ENC_BIG_ENDIAN);
offset += 4;
proto_tree_add_item(tree, hf_gdsdb_info_incarnation, tvb,
offset, 4, ENC_BIG_ENDIAN);
offset += 4;
offset = add_uint_string(tree, hf_gdsdb_info_items, tvb, offset);
if(opcode == op_service_info) {
offset = add_uint_string(tree, hf_gdsdb_info_recv_items, tvb, offset);
}
proto_tree_add_item(tree, hf_gdsdb_info_buffer_length, tvb,
offset, 4, ENC_BIG_ENDIAN);
offset += 4;
return offset;
}
static int
gdsdb_service_start(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset)
{
/* Calculate if we need more data */
if (tvb_reported_length_remaining(tvb, offset) < 16)
return -1;
if (tree) {
/* hf_gdsdb_info_object */
/* hf_gdsdb_info_incarnation */
/* hf_gdsdb_info_items */
/* hf_gdsdb_info_buffer_length */
}
return tvb_reported_length(tvb);
}
static int
gdsdb_release(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset)
{
/* Calculate if we need more data */
if (tvb_reported_length_remaining(tvb, offset) < 4)
return -1;
proto_tree_add_item(tree, hf_gdsdb_release_object, tvb, offset,
4, ENC_BIG_ENDIAN);
/* offset += 4; */
/* Unsure dissection is complete, so don't allow other commands to
follow by returning offset*/
return tvb_reported_length(tvb);
}
#if 0
static int
gdsdb_prepare2(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset)
{
/* Calculate if we need more data */
if (tvb_reported_length_remaining(tvb, offset) < 8)
return -1;
if (tree) {
/* hf_gdsdb_prepare2_transaction */
}
return tvb_reported_length(tvb);
}
#endif
static int
gdsdb_event(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset)
{
/* Calculate if we need more data */
if (tvb_reported_length_remaining(tvb, offset) < 20)
return -1;
if (tree) {
/* hf_gdsdb_event_database */
/* add_uint_string(hf_gdsdb_event_items) */
/* hf_gdsdb_event_ast */
/* hf_gdsdb_event_arg */
/* hf_gdsdb_event_rid */
}
return tvb_reported_length(tvb);
}
static int
gdsdb_cancel_events(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset)
{
/* Calculate if we need more data */
if (tvb_reported_length_remaining(tvb, offset) < 8)
return -1;
if (tree) {
/* hf_gdsdb_event_database */
}
return tvb_reported_length(tvb);
}
static int
gdsdb_ddl(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset)
{
/* Calculate if we need more data */
if (tvb_reported_length_remaining(tvb, offset) < 12)
return -1;
if (tree) {
/* hf_gdsdb_ddl_database */
/* hf_gdsdb_ddl_transaction */
/* add_uint_string(hf_gdsdb_ddl_blr) */
}
return tvb_reported_length(tvb);
}
static int
gdsdb_slice(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset)
{
/* Calculate if we need more data */
if (tvb_reported_length_remaining(tvb, offset) < 20)
return -1;
if (tree) {
/* hf_gdsdb_slice_transaction */
/* hf_gdsdb_slice_id */
/* add_uint_string(hf_gdsdb_slice_sdl) */
/* hf_gdsdb_slice_parameters */
}
return tvb_reported_length(tvb);
}
static int
gdsdb_slice_response(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset)
{
/* Calculate if we need more data */
if (tvb_reported_length_remaining(tvb, offset) < 4)
return -1;
if (tree) {
/* hf_gdsdb_sliceresponse_length */
}
return tvb_reported_length(tvb);
}
static int
gdsdb_execute(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset)
{
/* Calculate if we need more data */
if (tvb_reported_length_remaining(tvb, offset) < 16)
return -1;
proto_tree_add_item(tree, hf_gdsdb_execute_statement, tvb,
offset, 4, ENC_BIG_ENDIAN);
offset += 4;
proto_tree_add_item(tree, hf_gdsdb_execute_transaction, tvb,
offset, 4, ENC_BIG_ENDIAN);
offset += 4;
proto_tree_add_item(tree, hf_gdsdb_execute_message_number, tvb,
offset, 4, ENC_BIG_ENDIAN);
offset += 4;
proto_tree_add_item(tree, hf_gdsdb_execute_messages, tvb,
offset, 4, ENC_BIG_ENDIAN);
/* offset += 4; */
/* Unsure dissection is complete, so don't allow other commands to
follow by returning offset*/
return tvb_reported_length(tvb);
}
static int
gdsdb_exec_immediate2(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset)
{
/* Calculate if we need more data */
if (tvb_reported_length_remaining(tvb, offset) < 40)
return -1;
if (tree) {
/* hf_gdsdb_prepare2_blr */
/* hf_gdsdb_prepare2_number */
/* hf_gdsdb_prepare2_messages */
/* hf_gdsdb_prepare2_outblr */
/* hf_gdsdb_prepare2_outmsgnr */
}
return tvb_reported_length(tvb);
}
static int
gdsdb_prepare(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
{
int total_length = 20;
int length = tvb_reported_length_remaining(tvb, offset);
/* Calculate if we need more data */
if (length < total_length) {
return -1;
}
total_length += dword_align(tvb_get_ntohl(tvb, offset+12));
if (length < total_length) {
return -1;
}
proto_tree_add_item(tree, hf_gdsdb_prepare_transaction, tvb,
offset, 4, ENC_BIG_ENDIAN);
offset += 4;
proto_tree_add_item(tree, hf_gdsdb_prepare_statement, tvb,
offset, 4, ENC_BIG_ENDIAN);
offset += 4;
proto_tree_add_item(tree, hf_gdsdb_prepare_dialect, tvb,
offset, 4, ENC_BIG_ENDIAN);
offset += 4;
col_append_fstr(pinfo->cinfo, COL_INFO, ": %s", tvb_format_text(pinfo->pool, tvb, offset+4, tvb_get_ntohl(tvb, offset)));
offset = add_uint_string(tree, hf_gdsdb_prepare_querystr, tvb, offset);
proto_tree_add_item(tree, hf_gdsdb_prepare_bufferlength, tvb,
offset, 4, ENC_BIG_ENDIAN);
offset += 4;
return offset;
}
static int
gdsdb_fetch(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset)
{
/* Calculate if we need more data */
if (tvb_reported_length_remaining(tvb, offset) < 12) {
return -1;
}
if (tree) {
/* hf_gdsdb_fetch_statement */
/* hf_gdsdb_fetch_message_number */
/* hf_gdsdb_fetch_messages */
}
return tvb_reported_length(tvb);
}
static int
gdsdb_fetch_response(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset)
{
/* Calculate if we need more data */
if (tvb_reported_length_remaining(tvb, offset) < 8) {
return -1;
}
if (tree) {
/* hf_gdsdb_fetchresponse_status */
/* hf_gdsdb_fetchresponse_messages */
}
return tvb_reported_length(tvb);
}
static int
gdsdb_free_statement(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset)
{
/* Calculate if we need more data */
if (tvb_reported_length_remaining(tvb, offset) < 8) {
return -1;
}
proto_tree_add_item(tree, hf_gdsdb_free_statement, tvb,
offset, 4, ENC_BIG_ENDIAN);
offset += 4;
proto_tree_add_item(tree, hf_gdsdb_free_option, tvb,
offset, 4, ENC_BIG_ENDIAN);
offset += 4;
return offset;
}
static int
gdsdb_insert(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset)
{
/* Calculate if we need more data */
if (tvb_reported_length_remaining(tvb, offset) < 12) {
return -1;
}
if (tree) {
/* hf_gdsdb_insert_statement */
/* hf_gdsdb_insert_message_number */
/* hf_gdsdb_insert_messages */
}
return tvb_reported_length(tvb);
}
static int
gdsdb_cursor(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset)
{
/* Calculate if we need more data */
if (tvb_reported_length_remaining(tvb, offset) < 12) {
return -1;
}
if (tree) {
/* hf_gdsdb_cursor_statement */
/* hf_gdsdb_cursor_type */
}
return tvb_reported_length(tvb);
}
static int
gdsdb_sql_response(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset)
{
/* Calculate if we need more data */
if (tvb_reported_length_remaining(tvb, offset) < 4) {
return -1;
}
if (tree) {
/* hf_gdsdb_sqlresponse_messages */
}
return tvb_reported_length(tvb);
}
static int (*gdsdb_handle_opcode[])(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset) = {
gdsdb_dummy, /* op_void */
gdsdb_connect, /* op_connect */
gdsdb_dummy, /* op_exit */
gdsdb_accept, /* op_accept */
gdsdb_dummy, /* op_reject */
gdsdb_dummy, /* op_protocol */
gdsdb_dummy, /* op_disconnect */
gdsdb_dummy, /* op_credit */
gdsdb_dummy, /* op_continuation */
gdsdb_response, /* op_response */
gdsdb_dummy, /* op_open_file */
gdsdb_dummy, /* op_create_file */
gdsdb_dummy, /* op_close_file */
gdsdb_dummy, /* op_read_page */
gdsdb_dummy, /* op_write_page */
gdsdb_dummy, /* op_lock */
gdsdb_dummy, /* op_convert_lock */
gdsdb_dummy, /* op_release_lock */
gdsdb_dummy, /* op_blocking */
gdsdb_attach, /* op_attach */
gdsdb_attach, /* op_create */
gdsdb_release, /* op_detach */
gdsdb_compile, /* op_compile */
gdsdb_receive, /* op_start */
gdsdb_send, /* op_start_and_send */
gdsdb_send, /* op_send */
gdsdb_receive, /* op_receive */
gdsdb_release, /* op_unwind */
gdsdb_release, /* op_release */
gdsdb_reconnect, /* op_transaction */
gdsdb_release, /* op_commit */
gdsdb_release, /* op_rollback */
gdsdb_release, /* op_prepare */
gdsdb_reconnect, /* op_reconnect */
gdsdb_open_blob2, /* op_create_blob */
gdsdb_open_blob, /* op_open_blob */
gdsdb_segment, /* op_get_segment */
gdsdb_segment, /* op_put_segment */
gdsdb_release, /* op_cancel_blob */
gdsdb_release, /* op_close_blob */
gdsdb_info, /* op_info_database */
gdsdb_info, /* op_info_request */
gdsdb_info, /* op_info_transaction */
gdsdb_info, /* op_info_blob */
gdsdb_segment, /* op_batch_segments */
gdsdb_dummy, /* op_mgr_set_affinity */
gdsdb_dummy, /* op_mgr_clear_affinity */
gdsdb_dummy, /* op_mgr_report */
gdsdb_event, /* op_que_events */
gdsdb_cancel_events, /* op_cancel_events */
gdsdb_release, /* op_commit_retaining */
gdsdb_release, /* op_prepare */
gdsdb_event, /* op_event */
gdsdb_request, /* op_connect_request */
gdsdb_request, /* op_aux_connect */
gdsdb_ddl, /* op_ddl */
gdsdb_open_blob2, /* op_open_blob2 */
gdsdb_open_blob2, /* op_create_blob2 */
gdsdb_slice, /* op_get_slice */
gdsdb_slice, /* op_put_slice */
gdsdb_slice_response, /* op_slice */
gdsdb_seek_blob, /* op_seek_blob */
gdsdb_release, /* op_allocate_statement */
gdsdb_execute, /* op_execute */
gdsdb_prepare, /* op_exec_immediate */
gdsdb_fetch, /* op_fetch */
gdsdb_fetch_response, /* op_fetch_response */
gdsdb_free_statement, /* op_free_statement */
gdsdb_prepare, /* op_prepare_statement */
gdsdb_cursor, /* op_set_cursor */
gdsdb_info, /* op_info_sql */
gdsdb_dummy, /* op_dummy */
gdsdb_response, /* op_response_piggyback */
gdsdb_receive, /* op_start_and_receive */
gdsdb_send, /* op_start_send_and_receive */
gdsdb_exec_immediate2, /* op_exec_immediate2 */
gdsdb_execute, /* op_execute2 */
gdsdb_insert, /* op_insert */
gdsdb_sql_response, /* op_sql_response */
gdsdb_transact, /* op_transact */
gdsdb_transact_response, /* op_transact_response */
gdsdb_release, /* op_drop_database */
gdsdb_attach, /* op_service_attach */
gdsdb_release, /* op_service_detach */
gdsdb_info, /* op_service_info */
gdsdb_service_start, /* op_service_start */
gdsdb_release, /* op_rollback_retaining */
gdsdb_dummy, /* op_update_account_info */
gdsdb_dummy, /* op_authenticate_user */
gdsdb_dummy, /* op_partial */
gdsdb_dummy, /* op_trusted_auth */
gdsdb_dummy /* op_cancel */
};
static int
dissect_gdsdb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
{
proto_item *ti;
proto_tree *gdsdb_tree;
unsigned opcode;
int offset = 0;
if (tvb_reported_length(tvb) < 4)
return 0;
/* Ensure at least the first opcode is valid */
opcode = tvb_get_ntohl(tvb, offset);
if(opcode >= op_max)
return 0;
col_set_str(pinfo->cinfo, COL_PROTOCOL, "GDS DB");
col_clear(pinfo->cinfo, COL_INFO);
while (tvb_reported_length_remaining(tvb, offset) >= 4)
{
opcode = tvb_get_ntohl(tvb, offset);
if(opcode >= op_max)
return 0;
col_append_sep_str(pinfo->cinfo, COL_INFO, ", ",
val_to_str(opcode, gdsdb_opcode, "Unknown opcode %u"));
ti = proto_tree_add_item(tree, proto_gdsdb, tvb, offset, -1, ENC_NA);
gdsdb_tree = proto_item_add_subtree(ti, ett_gdsdb);
proto_tree_add_item(gdsdb_tree, hf_gdsdb_opcode, tvb,
offset, 4, ENC_BIG_ENDIAN);
/* opcode < op_max */
int old_offset = offset;
offset = gdsdb_handle_opcode[opcode](tvb, pinfo, gdsdb_tree, offset+4);
if (offset <= old_offset) {
expert_add_info(NULL, ti, &ei_gdsdb_invalid_length);
return tvb_reported_length_remaining(tvb, old_offset);
}
if (offset < 0)
{
/* But at this moment we don't know how much we will need */
pinfo->desegment_len = DESEGMENT_ONE_MORE_SEGMENT;
return -1; /* need more data */
}
}
return offset;
}
void
proto_register_gdsdb(void)
{
static hf_register_info hf[] = {
{ &hf_gdsdb_opcode,
{ "Opcode", "gdsdb.opcode",
FT_UINT32, BASE_DEC, VALS(gdsdb_opcode), 0x0,
NULL, HFILL }
},
/* gdsdb_dummy */
/* gdsdb_connect */
{ &hf_gdsdb_connect_operation,
{ "Operation", "gdsdb.connect.operation",
FT_UINT32, BASE_DEC, VALS(gdsdb_opcode), 0x0,
NULL, HFILL }
},
{ &hf_gdsdb_connect_version,
{ "Version", "gdsdb.connect.version",
FT_UINT32, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
{ &hf_gdsdb_connect_client,
{ "Client Architecture", "gdsdb.connect.client",
FT_UINT32, BASE_DEC, VALS(gdsdb_architectures), 0x0,
NULL, HFILL }
},
{ &hf_gdsdb_connect_filename,
{ "Filename", "gdsdb.connect.filename",
FT_UINT_STRING, BASE_NONE, NULL, 0x0,
NULL, HFILL }
},
{ &hf_gdsdb_connect_count,
{ "Version option count", "gdsdb.connect.count",
FT_UINT32, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
{ &hf_gdsdb_connect_userid,
{ "User ID", "gdsdb.connect.userid",
FT_UINT_STRING, BASE_NONE, NULL, 0x0,
NULL, HFILL }
},
{ &hf_gdsdb_connect_pref,
{ "Preferred version", "gdsdb.connect.pref",
FT_NONE, BASE_NONE, NULL, 0x0,
NULL, HFILL }
},
{ &hf_gdsdb_connect_pref_version,
{ "Version", "gdsdb.connect.pref.version",
FT_INT32, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
{ &hf_gdsdb_connect_pref_architecture,
{ "Architecture", "gdsdb.connect.pref.arch",
FT_UINT32, BASE_DEC, VALS(gdsdb_architectures), 0x0,
NULL, HFILL }
},
{ &hf_gdsdb_connect_pref_mintype,
{ "Minimum type", "gdsdb.connect.pref.mintype",
FT_UINT32, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
{ &hf_gdsdb_connect_pref_maxtype,
{ "Maximum type", "gdsdb.connect.pref.maxtype",
FT_UINT32, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
{ &hf_gdsdb_connect_pref_weight,
{ "Preference weight", "gdsdb.connect.pref.weight",
FT_UINT32, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
/* gdsdb_accept */
{ &hf_gdsdb_accept_version,
{ "Version", "gdsdb.accept.version",
FT_UINT32, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
{ &hf_gdsdb_accept_architecture,
{ "Architecture", "gdsdb.accept.arch",
FT_UINT32, BASE_DEC, VALS(gdsdb_architectures), 0x0,
NULL, HFILL }
},
{ &hf_gdsdb_accept_proto_min_type,
{ "Protocol Minimum Type", "gdsdb.accept.proto_min_type",
FT_UINT32, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
/* gdsdb_request */
{ &hf_gdsdb_request_type,
{ "Type", "gdsdb.connect.type",
FT_UINT32, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
{ &hf_gdsdb_request_object,
{ "Object", "gdsdb.connect.object",
FT_UINT32, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
{ &hf_gdsdb_request_partner,
{ "Partner", "gdsdb.connect.partner",
FT_UINT64, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
/* gdsdb_attach */
{ &hf_gdsdb_attach_database_object_id,
{ "Database ObjectID", "gdsdb.attach.database_object_id",
FT_UINT32, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
{ &hf_gdsdb_attach_database_path,
{ "Database Path", "gdsdb.attach.database_path",
FT_UINT_STRING, BASE_NONE, NULL, 0x0,
NULL, HFILL }
},
{ &hf_gdsdb_attach_database_param_buf,
{ "Database Parameter Buffers", "gdsdb.attach.database_param_buf",
FT_UINT_STRING, BASE_NONE, NULL, 0x0,
NULL, HFILL }
},
/* gdsdb_compile */
{ &hf_gdsdb_compile_database,
{ "Database", "gdsdb.compile.filename",
FT_UINT32, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
{ &hf_gdsdb_compile_blr,
{ "BLR", "gdsdb.compile.blr",
FT_UINT_STRING, BASE_NONE, NULL, 0x0,
NULL, HFILL }
},
/* gdsdb_receive */
{ &hf_gdsdb_receive_request,
{ "Request", "gdsdb.receive.request",
FT_UINT32, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
{ &hf_gdsdb_receive_incarnation,
{ "Incarnation", "gdsdb.receive.incarnation",
FT_UINT32, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
{ &hf_gdsdb_receive_transaction,
{ "Transaction", "gdsdb.receive.transaction",
FT_UINT32, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
{ &hf_gdsdb_receive_msgnr,
{ "Message number", "gdsdb.receive.msgnr",
FT_UINT32, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
{ &hf_gdsdb_receive_messages,
{ "Message Count", "gdsdb.receive.msgcount",
FT_UINT32, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
{ &hf_gdsdb_receive_direction,
{ "Scroll direction", "gdsdb.receive.direction",
FT_UINT32, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
{ &hf_gdsdb_receive_offset,
{ "Scroll offset", "gdsdb.receive.offset",
FT_UINT64, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
/* gdsdb_send */
{ &hf_gdsdb_send_request,
{ "Send request", "gdsdb.send.request",
FT_UINT32, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
{ &hf_gdsdb_send_incarnation,
{ "Send request", "gdsdb.send.incarnation",
FT_UINT32, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
{ &hf_gdsdb_send_transaction,
{ "Send request", "gdsdb.send.transaction",
FT_UINT32, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
{ &hf_gdsdb_send_msgnr,
{ "Send request", "gdsdb.send.msgnr",
FT_UINT32, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
{ &hf_gdsdb_send_messages,
{ "Send request", "gdsdb.send.messages",
FT_UINT32, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
/* gdsdb_response */
{ &hf_gdsdb_response_object,
{ "Response object", "gdsdb.response.object",
FT_UINT32, BASE_HEX, NULL, 0x0,
NULL, HFILL }
},
{ &hf_gdsdb_response_blobid,
{ "Blob ID", "gdsdb.response.blobid",
FT_UINT64, BASE_HEX, NULL, 0x0,
NULL, HFILL }
},
{ &hf_gdsdb_response_datasize,
{ "Data size", "gdsdb.response.datasize",
FT_UINT32, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
{ &hf_gdsdb_response_data,
{ "Data", "gdsdb.response.data",
FT_BYTES, BASE_NONE, NULL, 0x0,
NULL, HFILL }
},
/* gdsdb_status_vector */
{ &hf_gdsdb_status_vector_arg,
{ "Argument", "gdsdb.status_vector.arg",
FT_UINT32, BASE_DEC, VALS(gdsdb_arg_types), 0x0,
NULL, HFILL }
},
{ &hf_gdsdb_status_vector_error_code,
{ "Error code", "gdsdb.status_vector.error_code",
FT_UINT32, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
{ &hf_gdsdb_status_vector_number,
{ "Number", "gdsdb.status_vector.number",
FT_UINT32, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
{ &hf_gdsdb_status_vector_string,
{ "String", "gdsdb.status_vector.string",
FT_UINT_STRING, BASE_NONE, NULL, 0x0,
NULL, HFILL }
},
{ &hf_gdsdb_status_vector_sql_state,
{ "SQL State", "gdsdb.status_vector.sql_state",
FT_UINT_STRING, BASE_NONE, NULL, 0x0,
NULL, HFILL }
},
/* gdsdb_transact */
{ &hf_gdsdb_transact_database,
{ "Database", "gdsdb.transact.database",
FT_UINT32, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
{ &hf_gdsdb_transact_transaction,
{ "Database", "gdsdb.transact.transaction",
FT_UINT32, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
#if 0
{ &hf_gdsdb_transact_messages,
{ "Messages", "gdsdb.transact.messages",
FT_UINT32, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
#endif
/* gdsdb_transact_response */
{ &hf_gdsdb_transactresponse_messages,
{ "Messages", "gdsdb.transactresponse.messages",
FT_UINT32, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
/* gdsdb_open_blob2 */
{ &hf_gdsdb_openblob2_bpb,
{ "Blob parameter block", "gdsdb.openblob2.bpb",
FT_UINT_STRING, BASE_NONE, NULL, 0x0,
NULL, HFILL }
},
/* gdsdb_open_blob */
{ &hf_gdsdb_openblob_transaction,
{ "Transaction", "gdsdb.openblob2.transaction",
FT_UINT32, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
{ &hf_gdsdb_openblob_id,
{ "ID", "gdsdb.openblob.id",
FT_UINT64, BASE_HEX, NULL, 0x0,
NULL, HFILL }
},
#if 0
/* gdsdb_segment */
{ &hf_gdsdb_segment_blob,
{ "Blob", "gdsdb.segment.blob",
FT_UINT32, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
{ &hf_gdsdb_segment_length,
{ "Length", "gdsdb.segment.length",
FT_UINT32, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
{ &hf_gdsdb_segment_segment,
{ "Segment", "gdsdb.segment.segment",
FT_UINT_STRING, BASE_NONE, NULL, 0x0,
NULL, HFILL }
},
/* gdsdb_seek_blob */
{ &hf_gdsdb_seekblob_blob,
{ "Blob", "gdsdb.seekblob.blob",
FT_UINT32, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
{ &hf_gdsdb_seekblob_mode,
{ "Mode", "gdsdb.seekblob.mode",
FT_UINT32, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
#endif
/* gdsdb_reconnect */
{ &hf_gdsdb_reconnect_handle,
{ "Handle", "gdsdb.reconnect.handle",
FT_UINT32, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
{ &hf_gdsdb_reconnect_database_size,
{ "Database size", "gdsdb.reconnect.database_size",
FT_UINT32, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
{ &hf_gdsdb_reconnect_database,
{ "Database", "gdsdb.reconnect.database",
FT_BYTES, BASE_NONE, NULL, 0x0,
NULL, HFILL }
},
/* gdsdb_info & gdsdb_service_start */
{ &hf_gdsdb_info_object,
{ "Object", "gdsdb.info.object",
FT_UINT32, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
{ &hf_gdsdb_info_incarnation,
{ "Incarnation", "gdsdb.info.incarnation",
FT_UINT32, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
{ &hf_gdsdb_info_items,
{ "Items", "gdsdb.info.items",
FT_UINT_STRING, BASE_NONE, NULL, 0x0,
NULL, HFILL }
},
{ &hf_gdsdb_info_recv_items,
{ "Items", "gdsdb.info.recv_items",
FT_UINT_STRING, BASE_NONE, NULL, 0x0,
NULL, HFILL }
},
{ &hf_gdsdb_info_buffer_length,
{ "Buffer length", "gdsdb.info.bufferlength",
FT_UINT32, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
/* gdsdb_release */
{ &hf_gdsdb_release_object,
{ "Object", "gdsdb.release.object",
FT_UINT32, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
#if 0
/* gdsdb_prepare2 */
{ &hf_gdsdb_prepare2_transaction,
{ "Transaction", "gdsdb.prepare2.transaction",
FT_UINT32, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
/* gdsdb_event & gdsdb_cancel_events */
{ &hf_gdsdb_event_database,
{ "Database", "gdsdb.event.database",
FT_UINT32, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
{ &hf_gdsdb_event_items,
{ "Event description block", "gdsdb.event.items",
FT_UINT_STRING, BASE_NONE, NULL, 0x0,
NULL, HFILL }
},
{ &hf_gdsdb_event_ast,
{ "ast routine", "gdsdb.event.ast",
FT_UINT32, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
{ &hf_gdsdb_event_arg,
{ "Argument to ast routine", "gdsdb.event.arg",
FT_UINT32, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
{ &hf_gdsdb_event_rid,
{ "ID", "gdsdb.event.id",
FT_UINT32, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
/* gdsdb_ddl */
{ &hf_gdsdb_ddl_database,
{ "Database", "gdsdb.ddl.database",
FT_UINT32, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
{ &hf_gdsdb_ddl_transaction,
{ "Transaction", "gdsdb.ddl.transaction",
FT_UINT32, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
{ &hf_gdsdb_ddl_blr,
{ "BLR", "gdsdb.ddl.blr",
FT_UINT_STRING, BASE_NONE, NULL, 0x0,
NULL, HFILL }
},
/* gdsdb_slice */
{ &hf_gdsdb_slice_transaction,
{ "Transaction", "gdsdb.slice.transaction",
FT_UINT32, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
{ &hf_gdsdb_slice_id,
{ "ID", "gdsdb.slice.id",
FT_UINT64, BASE_HEX, NULL, 0x0,
NULL, HFILL }
},
{ &hf_gdsdb_slice_sdl,
{ "Slice description language", "gdsdb.slice.sdl",
FT_UINT_STRING, BASE_NONE, NULL, 0x0,
NULL, HFILL }
},
{ &hf_gdsdb_slice_parameters,
{ "Parameters", "gdsdb.slice.parameters",
FT_UINT32, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
/* gdsdb_slice_response */
{ &hf_gdsdb_sliceresponse_length,
{ "Length", "gdsdb.sliceresponse.length",
FT_UINT32, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
#endif
/* gdsdb_execute */
{ &hf_gdsdb_execute_statement,
{ "Statement", "gdsdb.execute.statement",
FT_UINT32, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
{ &hf_gdsdb_execute_transaction,
{ "Transaction", "gdsdb.execute.transaction",
FT_UINT32, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
{ &hf_gdsdb_execute_message_number,
{ "Message number", "gdsdb.execute.messagenumber",
FT_UINT32, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
{ &hf_gdsdb_execute_messages,
{ "Number of messages", "gdsdb.execute.messages",
FT_UINT32, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
#if 0
/* gdsdb_execute2 */
{ &hf_gdsdb_execute_outblr,
{ "Output BLR", "gdsdb.execute.outblr",
FT_UINT32, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
{ &hf_gdsdb_execute_outmsgnr,
{ "Output Message number", "gdsdb.execute.outmsgnr",
FT_UINT32, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
/* gdsdb_exec_immediate2 */
{ &hf_gdsdb_prepare2_blr,
{ "BLR", "gdsdb.prepare.blr",
FT_UINT32, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
{ &hf_gdsdb_prepare2_number,
{ "Message number", "gdsdb.prepare2.messagenumber",
FT_UINT32, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
{ &hf_gdsdb_prepare2_messages,
{ "Number of messages", "gdsdb.prepare2.messages",
FT_UINT32, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
{ &hf_gdsdb_prepare2_outblr,
{ "Output BLR", "gdsdb.prepare2.outblr",
FT_UINT32, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
{ &hf_gdsdb_prepare2_outmsgnr,
{ "Output Message number", "gdsdb.prepare2.outmsgnr",
FT_UINT32, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
#endif
/* gdsdb_prepare */
{ &hf_gdsdb_prepare_transaction,
{ "Prepare, Transaction", "gdsdb.prepare.transaction",
FT_UINT32, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
{ &hf_gdsdb_prepare_statement,
{ "Prepare, Statement", "gdsdb.prepare.statement",
FT_UINT32, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
{ &hf_gdsdb_prepare_dialect,
{ "Prepare, Dialect", "gdsdb.prepare.dialect",
FT_UINT32, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
{ &hf_gdsdb_prepare_querystr,
{ "Prepare, Query", "gdsdb.prepare.querystr",
FT_UINT_STRING, BASE_NONE, NULL, 0x0,
NULL, HFILL }
},
{ &hf_gdsdb_prepare_bufferlength,
{ "Prepare, Bufferlength", "gdsdb.prepare.bufferlen",
FT_UINT32, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
#if 0
/* gdsdb_fetch */
{ &hf_gdsdb_fetch_statement,
{ "Statement", "gdsdb.fetch.statement",
FT_UINT32, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
{ &hf_gdsdb_fetch_message_number,
{ "Message number", "gdsdb.fetch.messagenr",
FT_UINT32, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
{ &hf_gdsdb_fetch_messages,
{ "Number of messages", "gdsdb.fetch.messages",
FT_UINT32, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
/* gdsdb_fetch_response */
{ &hf_gdsdb_fetchresponse_status,
{ "Status", "gdsdb.fetchresponse.status",
FT_UINT32, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
{ &hf_gdsdb_fetchresponse_messages,
{ "Number of messages", "gdsdb.fetchresponse.messages",
FT_UINT32, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
#endif
/* gdsdb_free_statement */
{ &hf_gdsdb_free_statement,
{ "Statement", "gdsdb.fetchresponse.statement",
FT_UINT32, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
{ &hf_gdsdb_free_option,
{ "Option", "gdsdb.fetchresponse.option",
FT_UINT32, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
#if 0
/* gdsdb_insert */
{ &hf_gdsdb_insert_statement,
{ "Statement", "gdsdb.insert.statement",
FT_UINT32, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
{ &hf_gdsdb_insert_message_number,
{ "Message number", "gdsdb.insert.messagenr",
FT_UINT32, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
{ &hf_gdsdb_insert_messages,
{ "Number of messages", "gdsdb.insert.messages",
FT_UINT32, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
/* gdsdb_cursor */
{ &hf_gdsdb_cursor_statement,
{ "Statement", "gdsdb.cursor.statement",
FT_UINT32, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
{ &hf_gdsdb_cursor_type,
{ "Type", "gdsdb.cursor.type",
FT_UINT32, BASE_DEC, NULL, 0x0,
NULL, HFILL }
},
/* gdsdb_sql_response */
{ &hf_gdsdb_sqlresponse_messages,
{ "SQL Response, Message Count", "gdsdb.sqlresponse.msgcount",
FT_UINT32, BASE_DEC, NULL, 0x0,
NULL, HFILL }
}
#endif
};
static int *ett[] = {
&ett_gdsdb,
/* &ett_gdsdb_opcode, */
&ett_gdsdb_connect_pref
};
/* Expert info */
static ei_register_info ei[] = {
{ &ei_gdsdb_invalid_length, { "gdsdb.invalid_length", PI_MALFORMED, PI_ERROR,
"Invalid length", EXPFILL }},
};
proto_gdsdb = proto_register_protocol("Firebird SQL Database Remote Protocol", "FB/IB GDS DB", "gdsdb");
proto_register_field_array(proto_gdsdb, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
expert_module_t *expert_gdsdb = expert_register_protocol(proto_gdsdb);
expert_register_field_array(expert_gdsdb, ei, array_length(ei));
gdsdb_handle = register_dissector("gdsdb", dissect_gdsdb, proto_gdsdb);
}
void
proto_reg_handoff_gdsdb(void)
{
dissector_add_uint_with_preference("tcp.port", TCP_PORT, gdsdb_handle);
}
/*
* Editor modelines - https://www.wireshark.org/tools/modelines.html
*
* Local variables:
* c-basic-offset: 8
* tab-width: 8
* indent-tabs-mode: t
* End:
*
* vi: set shiftwidth=8 tabstop=8 noexpandtab:
* :indentSize=8:tabSize=8:noTabs=false:
*/
|