Revert "TODO epan/dissectors/asn1/kerberos/packet-kerberos-template.c new GSS flags"
[wireshark-sm.git] / epan / dissectors / packet-drda.c
blob5872739abea26bb5af01d1dbe693f49efeae96d3
1 /* packet-drda.c
2 * Routines for Distributed Relational Database Architecture packet dissection
4 * metatech <metatech@flashmail.com>
6 * Wireshark - Network traffic analyzer
7 * By Gerald Combs <gerald@wireshark.org>
8 * Copyright 1998 Gerald Combs
10 * SPDX-License-Identifier: GPL-2.0-or-later
13 /* DRDA in a nutshell
15 * DRDA stands for Distributed Relational Database Architecture.
16 * It is a protocol between database client and database server published by
17 * the Open Group (www.opengroup.org) DDM (Distributed Data Management) is an
18 * data management interface which allows to exchange structured data between
19 * systems. DRDA is specific to relational databases and uses a subset of DDM
20 * to transport its data. The IBM DB2 product uses the DRDA protocol from
21 * version V8. Unless negotiated differently during the handshake, the fields
22 * of the DDM commands and reply messages are in EBCDIC.
24 * Documentation:
26 * DRDA Version 2, Volume 3: Distributed Data Management (DDM)
27 * Architecture, Open Group.
29 * https://pubs.opengroup.org/onlinepubs/009608699/toc.pdf
31 * DRDA Version 3, Volume 3: Distributed Data Management (DDM)
32 * Architecture Open Group.
33 * Version 3 is no longer available.
35 * DRDA Version 4, Volume 3: Distributed Data Management (DDM)
36 * Architecture, Open Group.
38 * https://pubs.opengroup.org/onlinepubs/9699939199/toc.pdf
40 * DRDA Version 5, Volume 3: Distributed Data Management (DDM)
41 * Architecture, Open Group.
43 * https://publications.opengroup.org/c114
45 * Reference for Remote DRDA Requesters and Servers, IBM.
47 * https://www-304.ibm.com/support/docview.wss?uid=pub1sc18985301
48 * (now dead)
49 * https://publibfp.boulder.ibm.com/epubs/pdf/dsnudh10.pdf
51 * Microsoft has some references that can be useful as well:
53 * https://learn.microsoft.com/en-us/dotnet/api/microsoft.hostintegration.drda.common?view=his-dotnet
56 #include "config.h"
58 #include <epan/packet.h>
59 #include <epan/prefs.h>
60 #include <epan/expert.h>
61 #include <epan/iana_charsets.h>
62 #include <epan/proto_data.h>
63 #include <epan/tfs.h>
64 #include "packet-tcp.h"
66 void proto_register_drda(void);
67 void proto_reg_handoff_drda(void);
69 static int proto_drda;
70 static int hf_drda_ddm_length;
71 static int hf_drda_ddm_magic;
72 static int hf_drda_ddm_format;
73 static int hf_drda_ddm_fmt_reserved;
74 static int hf_drda_ddm_fmt_chained;
75 static int hf_drda_ddm_fmt_errcont;
76 static int hf_drda_ddm_fmt_samecorr;
77 static int hf_drda_ddm_fmt_dsstyp;
78 static int hf_drda_ddm_rc;
79 static int hf_drda_ddm_length2;
80 static int hf_drda_ddm_codepoint;
81 static int hf_drda_param_length;
82 static int hf_drda_param_codepoint;
83 static int hf_drda_param_data;
84 static int hf_drda_param_data_ebcdic;
85 static int hf_drda_null_ind;
86 static int hf_drda_typdefnam;
87 static int hf_drda_clob_length;
88 static int hf_drda_sqlstatement;
89 static int hf_drda_sqlcagrp;
90 static int hf_drda_sqlcode;
91 static int hf_drda_sqlstate;
92 static int hf_drda_sqlerrproc;
93 static int hf_drda_sqlcaxgrp;
94 static int hf_drda_sqlerrd1;
95 static int hf_drda_sqlerrd2;
96 static int hf_drda_sqlerrd3;
97 static int hf_drda_sqlerrd4;
98 static int hf_drda_sqlerrd5;
99 static int hf_drda_sqlerrd6;
100 static int hf_drda_sqlwarn0;
101 static int hf_drda_sqlwarn1;
102 static int hf_drda_sqlwarn2;
103 static int hf_drda_sqlwarn3;
104 static int hf_drda_sqlwarn4;
105 static int hf_drda_sqlwarn5;
106 static int hf_drda_sqlwarn6;
107 static int hf_drda_sqlwarn7;
108 static int hf_drda_sqlwarn8;
109 static int hf_drda_sqlwarn9;
110 static int hf_drda_sqlwarna;
111 static int hf_drda_sqlerrmsg;
112 static int hf_drda_sqldhgrp;
113 static int hf_drda_sqldhold;
114 static int hf_drda_sqldreturn;
115 static int hf_drda_sqldscroll;
116 static int hf_drda_sqldsensitive;
117 static int hf_drda_sqldfcode;
118 static int hf_drda_sqldkeytype;
119 static int hf_drda_sqldoptlck;
120 static int hf_drda_sqldschema;
121 static int hf_drda_sqldmodule;
122 static int hf_drda_sqldagrp;
123 static int hf_drda_sqlprecision;
124 static int hf_drda_sqlscale;
125 static int hf_drda_sqllength;
126 static int hf_drda_sqllength32;
127 static int hf_drda_sqltype;
128 static int hf_drda_sqlarrextent;
129 static int hf_drda_sqldoptgrp;
130 static int hf_drda_sqlunnamed;
131 static int hf_drda_sqlname;
132 static int hf_drda_sqllabel;
133 static int hf_drda_sqlcomments;
134 static int hf_drda_sqludtgrp;
135 static int hf_drda_sqludtxtype;
136 static int hf_drda_sqludtschema;
137 static int hf_drda_sqludtname;
138 static int hf_drda_sqludtmodule;
139 static int hf_drda_sqldxgrp;
140 static int hf_drda_sqlxkeymem;
141 static int hf_drda_sqlxupdateable;
142 static int hf_drda_sqlxgenerated;
143 static int hf_drda_sqlxparmmode;
144 static int hf_drda_sqlxoptlck;
145 static int hf_drda_sqlxhidden;
146 static int hf_drda_sqlxcorname;
147 static int hf_drda_sqlxbasename;
148 static int hf_drda_sqlxschema;
149 static int hf_drda_sqlxname;
150 static int hf_drda_sqlxmodule;
151 static int hf_drda_sqldiaggrp;
152 static int hf_drda_sqlnum;
153 static int hf_drda_rlsconv;
154 static int hf_drda_secmec;
155 static int hf_drda_sectkn;
156 static int hf_drda_svrcod;
157 static int hf_drda_secchkcd;
158 static int hf_drda_ccsid;
159 static int hf_drda_mgrlvln;
160 static int hf_drda_monitor;
161 static int hf_drda_monitor_etime;
162 static int hf_drda_monitor_reserved;
163 static int hf_drda_etime;
164 static int hf_drda_respktsz;
165 static int hf_drda_rdbinttkn;
166 static int hf_drda_rdbcmtok;
167 static int hf_drda_rdbcolid;
168 static int hf_drda_rdbcolid_ebcdic;
169 static int hf_drda_pkgid;
170 static int hf_drda_pkgid_ebcdic;
171 static int hf_drda_pkgsn;
172 static int hf_drda_pkgcnstkn;
173 static int hf_drda_rtnsetstt;
174 static int hf_drda_rdbnam;
175 static int hf_drda_rdbnam_ebcdic;
176 static int hf_drda_outexp;
177 static int hf_drda_qryblksz;
178 static int hf_drda_uowdsp;
179 static int hf_drda_rdbalwupd;
180 static int hf_drda_sqlcsrhld;
181 static int hf_drda_qryextdtasz;
182 static int hf_drda_smldtasz;
183 static int hf_drda_meddtasz;
184 static int hf_drda_trgdftrt;
185 static int hf_drda_rtnsqlda;
186 static int hf_drda_qryattupd;
187 static int hf_drda_qryrowset;
188 static int hf_drda_qryinsid;
189 static int hf_drda_qryclsimp;
190 static int hf_drda_qryblkfct;
191 static int hf_drda_maxrslcnt;
192 static int hf_drda_maxblkext;
193 static int hf_drda_rslsetflg;
194 static int hf_drda_rslsetflg_unused;
195 static int hf_drda_rslsetflg_dsconly;
196 static int hf_drda_rslsetflg_extended;
197 static int hf_drda_rslsetflg_reserved;
198 static int hf_drda_typsqlda;
199 static int hf_drda_outovropt;
200 static int hf_drda_dyndtafmt;
201 static int hf_drda_pktobj;
203 static int ett_drda;
204 static int ett_drda_ddm;
205 static int ett_drda_ddm_format;
206 static int ett_drda_param;
207 static int ett_drda_monitor;
208 static int ett_drda_rslsetflg;
209 static int ett_drda_sqlcagrp;
210 static int ett_drda_sqlcaxgrp;
211 static int ett_drda_sqldhgrp;
212 static int ett_drda_sqldagrp;
213 static int ett_drda_sqldoptgrp;
214 static int ett_drda_sqludtgrp;
215 static int ett_drda_sqldxgrp;
216 static int ett_drda_sqldiaggrp;
218 static expert_field ei_drda_opcode_invalid_length;
219 static expert_field ei_drda_undecoded;
221 static dissector_handle_t drda_tcp_handle;
223 static dissector_table_t drda_opcode_table;
225 #define typdefnam_vals_ENUM_VAL_T_LIST(XXX) \
226 XXX(TYPDEFNAM_370, 1, "QTDSQL370", "System/390 SQL type definition") \
227 XXX(TYPDEFNAM_400, 2, "QTDSQL400", "AS/400 SQL type definition") \
228 XXX(TYPDEFNAM_X86, 3, "QTDSQLX86", "Intel 80x86 SQL type definition") \
229 XXX(TYPDEFNAM_ASC, 4, "QTDSQLASC", "General ASCII Big Endian SQL type definition") \
230 XXX(TYPDEFNAM_VAX, 5, "QTDSQLVAX", "DEC VAX SQL type definition")
232 typedef ENUM_VAL_T_ENUM(typdefnam_vals) enum_typdefnam_t;
234 ENUM_VAL_T_ARRAY_STATIC(typdefnam_vals);
236 /* Preferences */
237 static bool drda_desegment = true;
238 static unsigned drda_default_sqlam = 7;
239 static int drda_default_typdefnam = TYPDEFNAM_X86;
240 static int drda_default_ccsidsbc = IANA_CS_UTF_8;
241 static int drda_default_ccsidmbc = IANA_CS_UTF_8;
243 #define DRDA_MAGIC 0xD0
245 #define DRDA_CP_DATA 0x0000
246 #define DRDA_CP_CODPNT 0x000C
247 #define DRDA_CP_FDODSC 0x0010
248 #define DRDA_CP_TYPDEFNAM 0x002F
249 #define DRDA_CP_TYPDEFOVR 0x0035
250 #define DRDA_CP_CODPNTDR 0x0064
251 #define DRDA_CP_EXCSAT 0x1041
252 #define DRDA_CP_SYNCCTL 0x1055
253 #define DRDA_CP_SYNCRSY 0x1069
254 #define DRDA_CP_ACCSEC 0x106D
255 #define DRDA_CP_SECCHK 0x106E
256 #define DRDA_CP_SYNCLOG 0x106F
257 #define DRDA_CP_RSCTYP 0x111F
258 #define DRDA_CP_RSNCOD 0x1127
259 #define DRDA_CP_RSCNAM 0x112D
260 #define DRDA_CP_PRDID 0x112E
261 #define DRDA_CP_PRCCNVCD 0x113F
262 #define DRDA_CP_VRSNAM 0x1144
263 #define DRDA_CP_SRVCLSNM 0x1147
264 #define DRDA_CP_SVRCOD 0x1149
265 #define DRDA_CP_SYNERRCD 0x114A
266 #define DRDA_CP_SRVDGN 0x1153
267 #define DRDA_CP_SRVRLSLV 0x115A
268 #define DRDA_CP_SPVNAM 0x115D
269 #define DRDA_CP_EXTNAM 0x115E
270 #define DRDA_CP_SRVNAM 0x116D
271 #define DRDA_CP_SECMGRNM 0x1196
272 #define DRDA_CP_DEPERRCD 0x119B
273 #define DRDA_CP_CCSIDSBC 0x119C
274 #define DRDA_CP_CCSIDDBC 0x119D
275 #define DRDA_CP_CCSIDMBC 0x119E
276 #define DRDA_CP_RLSCONV 0x119F
277 #define DRDA_CP_USRID 0x11A0
278 #define DRDA_CP_PASSWORD 0x11A1
279 #define DRDA_CP_SECMEC 0x11A2
280 #define DRDA_CP_SECCHKCD 0x11A4
281 #define DRDA_CP_SVCERRNO 0x11B4
282 #define DRDA_CP_SECTKN 0x11DC
283 #define DRDA_CP_NEWPASSWORD 0x11DE
284 #define DRDA_CP_MGRLVLRM 0x1210
285 #define DRDA_CP_MGRDEPRM 0x1218
286 #define DRDA_CP_SECCHKRM 0x1219
287 #define DRDA_CP_CMDATHRM 0x121C
288 #define DRDA_CP_AGNPRMRM 0x1232
289 #define DRDA_CP_RSCLMTRM 0x1233
290 #define DRDA_CP_PRCCNVRM 0x1245
291 #define DRDA_CP_CMDCMPRM 0x124B
292 #define DRDA_CP_SYNTAXRM 0x124C
293 #define DRDA_CP_CMDNSPRM 0x1250
294 #define DRDA_CP_PRMNSPRM 0x1251
295 #define DRDA_CP_VALNSPRM 0x1252
296 #define DRDA_CP_OBJNSPRM 0x1253
297 #define DRDA_CP_CMDCHKRM 0x1254
298 #define DRDA_CP_TRGNSPRM 0x125F
299 #define DRDA_CP_AGENT 0x1403
300 #define DRDA_CP_MGRLVLLS 0x1404
301 #define DRDA_CP_SUPERVISOR 0x143C
302 #define DRDA_CP_SECMGR 0x1440
303 #define DRDA_CP_EXCSATRD 0x1443
304 #define DRDA_CP_CMNAPPC 0x1444
305 #define DRDA_CP_DICTIONARY 0x1458
306 #define DRDA_CP_MGRLVLN 0x1473
307 #define DRDA_CP_CMNTCPIP 0x1474
308 #define DRDA_CP_FDODTA 0x147A
309 #define DRDA_CP_CMNSYNCPT 0x147C
310 #define DRDA_CP_ACCSECRD 0x14AC
311 #define DRDA_CP_SYNCPTMGR 0x14C0
312 #define DRDA_CP_RSYNCMGR 0x14C1
313 #define DRDA_CP_CCSIDMGR 0x14CC
314 #define DRDA_CP_SNDPKT 0x1805
315 #define DRDA_CP_MONITOR 0x1900
316 #define DRDA_CP_ETIME 0x1901
317 #define DRDA_CP_RESPKTSZ 0x1908
318 #define DRDA_CP_CCSIDXML 0x1913
319 #define DRDA_CP_MONITORRD 0x1C00
320 #define DRDA_CP_XAMGR 0x1C01
321 #define DRDA_CP_PKTOBJ 0x1C04
322 #define DRDA_CP_UNICODEMGR 0x1C08
323 #define DRDA_CP_ACCRDB 0x2001
324 #define DRDA_CP_BGNBND 0x2002
325 #define DRDA_CP_BNDSQLSTT 0x2004
326 #define DRDA_CP_CLSQRY 0x2005
327 #define DRDA_CP_CNTQRY 0x2006
328 #define DRDA_CP_DRPPKG 0x2007
329 #define DRDA_CP_DSCSQLSTT 0x2008
330 #define DRDA_CP_ENDBND 0x2009
331 #define DRDA_CP_EXCSQLIMM 0x200A
332 #define DRDA_CP_EXCSQLSTT 0x200B
333 #define DRDA_CP_OPNQRY 0x200C
334 #define DRDA_CP_PRPSQLSTT 0x200D
335 #define DRDA_CP_RDBCMM 0x200E
336 #define DRDA_CP_RDBRLLBCK 0x200F
337 #define DRDA_CP_REBIND 0x2010
338 #define DRDA_CP_DSCRDBTBL 0x2012
339 #define DRDA_CP_EXCSQLSET 0x2014
340 #define DRDA_CP_DSCERRCD 0x2101
341 #define DRDA_CP_QRYPRCTYP 0x2102
342 #define DRDA_CP_RDBINTTKN 0x2103
343 #define DRDA_CP_PRDDTA 0x2104
344 #define DRDA_CP_RDBCMTOK 0x2105
345 #define DRDA_CP_RDBCOLID 0x2108
346 #define DRDA_CP_PKGID 0x2109
347 #define DRDA_CP_PKGNAM 0x210A
348 #define DRDA_CP_PKGSN 0x210C
349 #define DRDA_CP_PKGCNSTKN 0x210D
350 #define DRDA_CP_RTNSETSTT 0x210E
351 #define DRDA_CP_RDBACCCL 0x210F
352 #define DRDA_CP_RDBNAM 0x2110
353 #define DRDA_CP_OUTEXP 0x2111
354 #define DRDA_CP_PKGNAMCT 0x2112
355 #define DRDA_CP_PKGNAMCSN 0x2113
356 #define DRDA_CP_QRYBLKSZ 0x2114
357 #define DRDA_CP_UOWDSP 0x2115
358 #define DRDA_CP_RTNSQLDA 0x2116
359 #define DRDA_CP_RDBALWUPD 0x211A
360 #define DRDA_CP_SQLCSRHLD 0x211F
361 #define DRDA_CP_STTSTRDEL 0x2120
362 #define DRDA_CP_STTDECDEL 0x2121
363 #define DRDA_CP_PKGDFTCST 0x2125
364 #define DRDA_CP_QRYBLKCTL 0x2132
365 #define DRDA_CP_QRYEXTDTASZ 0x2134
366 #define DRDA_CP_CRRTKN 0x2135
367 #define DRDA_CP_SMLDTASZ 0x2136
368 #define DRDA_CP_MEDDTASZ 0x2137
369 #define DRDA_CP_PRCNAM 0x2138
370 #define DRDA_CP_PKGSNLST 0x2139
371 #define DRDA_CP_NBRROW 0x213A
372 #define DRDA_CP_TRGDFTRT 0x213B
373 #define DRDA_CP_QRYRELSCR 0x213C
374 #define DRDA_CP_QRYROWNBR 0x213D
375 #define DRDA_CP_QRYRFRTBL 0x213E
376 #define DRDA_CP_MAXRSLCNT 0x2140
377 #define DRDA_CP_MAXBLKEXT 0x2141
378 #define DRDA_CP_RSLSETFLG 0x2142
379 #define DRDA_CP_TYPSQLDA 0x2146
380 #define DRDA_CP_OUTOVROPT 0x2147
381 #define DRDA_CP_RTNEXTDTA 0x2148
382 #define DRDA_CP_QRYATTSCR 0x2149
383 #define DRDA_CP_DYNDTAFMT 0x214B
384 #define DRDA_CP_QRYATTUPD 0x2150
385 #define DRDA_CP_QRYSCRORN 0x2152
386 #define DRDA_CP_QRYROWSNS 0x2153
387 #define DRDA_CP_QRYBLKRST 0x2154
388 #define DRDA_CP_QRYRTNDTA 0x2155
389 #define DRDA_CP_QRYROWSET 0x2156
390 #define DRDA_CP_QRYATTSNS 0x2157
391 #define DRDA_CP_QRYINSID 0x215B
392 #define DRDA_CP_QRYCLSIMP 0x215D
393 #define DRDA_CP_QRYCLSRLS 0x215E
394 #define DRDA_CP_QRYBLKFCT 0x215F
395 #define DRDA_CP_DIAGLVL 0x2160
396 #define DRDA_CP_ACCRDBRM 0x2201
397 #define DRDA_CP_QRYNOPRM 0x2202
398 #define DRDA_CP_RDBNACRM 0x2204
399 #define DRDA_CP_OPNQRYRM 0x2205
400 #define DRDA_CP_PKGBNARM 0x2206
401 #define DRDA_CP_RDBACCRM 0x2207
402 #define DRDA_CP_BGNBNDRM 0x2208
403 #define DRDA_CP_PKGBPARM 0x2209
404 #define DRDA_CP_DSCINVRM 0x220A
405 #define DRDA_CP_ENDQRYRM 0x220B
406 #define DRDA_CP_ENDUOWRM 0x220C
407 #define DRDA_CP_ABNUOWRM 0x220D
408 #define DRDA_CP_DTAMCHRM 0x220E
409 #define DRDA_CP_QRYPOPRM 0x220F
410 #define DRDA_CP_RDBNFNRM 0x2211
411 #define DRDA_CP_OPNQFLRM 0x2212
412 #define DRDA_CP_SQLERRRM 0x2213
413 #define DRDA_CP_RDBUPDRM 0x2218
414 #define DRDA_CP_RSLSETRM 0x2219
415 #define DRDA_CP_RDBAFLRM 0x221A
416 #define DRDA_CP_CMDVLTRM 0x221D
417 #define DRDA_CP_CMMRQSRM 0x2225
418 #define DRDA_CP_RDBATHRM 0x22CB
419 #define DRDA_CP_SQLAM 0x2407
420 #define DRDA_CP_SQLCARD 0x2408
421 #define DRDA_CP_SQLCINRD 0x240B
422 #define DRDA_CP_SQLRSLRD 0x240E
423 #define DRDA_CP_RDB 0x240F
424 #define DRDA_CP_FRCFIXROW 0x2410
425 #define DRDA_CP_SQLDARD 0x2411
426 #define DRDA_CP_SQLDTA 0x2412
427 #define DRDA_CP_SQLDTARD 0x2413
428 #define DRDA_CP_SQLSTT 0x2414
429 #define DRDA_CP_OUTOVR 0x2415
430 #define DRDA_CP_LMTBLKPRC 0x2417
431 #define DRDA_CP_FIXROWPRC 0x2418
432 #define DRDA_CP_SQLSTTVRB 0x2419
433 #define DRDA_CP_QRYDSC 0x241A
434 #define DRDA_CP_QRYDTA 0x241B
435 #define DRDA_CP_CSTSYSDFT 0x2432
436 #define DRDA_CP_CSTBITS 0x2433
437 #define DRDA_CP_CSTSBCS 0x2434
438 #define DRDA_CP_CSTMBCS 0x2435
439 #define DRDA_CP_ISOLVLCHG 0x2441
440 #define DRDA_CP_ISOLVLCS 0x2442
441 #define DRDA_CP_ISOLVLALL 0x2443
442 #define DRDA_CP_ISOLVLRR 0x2444
443 #define DRDA_CP_ISOLVLNC 0x2445
444 #define DRDA_CP_SRVLST 0x244E
445 #define DRDA_CP_SQLATTR 0x2450
447 #define DRDA_DSSFMT_SAME_CORR 0x10
448 #define DRDA_DSSFMT_CONTINUE 0x20
449 #define DRDA_DSSFMT_CHAINED 0x40
450 #define DRDA_DSSFMT_RESERVED 0x80
452 #define DRDA_DSSFMT_RQSDSS 0x01
453 #define DRDA_DSSFMT_RPYDSS 0x02
454 #define DRDA_DSSFMT_OBJDSS 0x03
455 #define DRDA_DSSFMT_CMNDSS 0x04
456 #define DRDA_DSSFMT_NORPYDSS 0x05
458 #define DRDA_TEXT_DDM "DDM"
459 #define DRDA_TEXT_PARAM "Parameter"
461 static const value_string drda_opcode_vals[] = {
462 { DRDA_CP_DATA, "Data" },
463 { DRDA_CP_CODPNT, "Code Point" },
464 { DRDA_CP_FDODSC, "FD:OCA Data Descriptor" },
465 { DRDA_CP_TYPDEFNAM, "Data Type Definition Name" },
466 { DRDA_CP_TYPDEFOVR, "TYPDEF Overrides" },
467 { DRDA_CP_CODPNTDR, "Code Point Data Representation" },
468 { DRDA_CP_EXCSAT, "Exchange Server Attributes" },
469 { DRDA_CP_SYNCCTL, "Sync Point Control Request" },
470 { DRDA_CP_SYNCRSY, "Sync Point Resync Command" },
471 { DRDA_CP_ACCSEC, "Access Security" },
472 { DRDA_CP_SECCHK, "Security Check" },
473 { DRDA_CP_SYNCLOG, "Sync Point Log" },
474 { DRDA_CP_RSCTYP, "Resource Type Information" },
475 { DRDA_CP_RSNCOD, "Reason Code Information" },
476 { DRDA_CP_RSCNAM, "Resource Name Information" },
477 { DRDA_CP_PRDID, "Product-Specific Identifier" },
478 { DRDA_CP_PRCCNVCD, "Conversation Protocol Error Code" },
479 { DRDA_CP_VRSNAM, "Version Name" },
480 { DRDA_CP_SRVCLSNM, "Server Class Name" },
481 { DRDA_CP_SVRCOD, "Severity Code" },
482 { DRDA_CP_SYNERRCD, "Syntax Error Code" },
483 { DRDA_CP_SRVDGN, "Server Diagnostic Information" },
484 { DRDA_CP_SRVRLSLV, "Server Product Release Level" },
485 { DRDA_CP_SPVNAM, "Supervisor Name" },
486 { DRDA_CP_EXTNAM, "External Name" },
487 { DRDA_CP_SRVNAM, "Server Name" },
488 { DRDA_CP_SECMGRNM, "Security Manager Name" },
489 { DRDA_CP_DEPERRCD, "Manager Dependency Error Code" },
490 { DRDA_CP_CCSIDSBC, "CCSID for Single-Byte Characters" },
491 { DRDA_CP_CCSIDDBC, "CCSID for Double-byte Characters" },
492 { DRDA_CP_CCSIDMBC, "CCSID for Mixed-byte Characters" },
493 { DRDA_CP_RLSCONV, "Release Conversation" },
494 { DRDA_CP_USRID, "User ID at the Target System" },
495 { DRDA_CP_PASSWORD, "Password" },
496 { DRDA_CP_SECMEC, "Security Mechanism" },
497 { DRDA_CP_SECCHKCD, "Security Check Code" },
498 { DRDA_CP_SVCERRNO, "Security Service ErrorNumber" },
499 { DRDA_CP_SECTKN, "Security Token" },
500 { DRDA_CP_NEWPASSWORD, "New Password" },
501 { DRDA_CP_MGRLVLRM, "Manager-Level Conflict" },
502 { DRDA_CP_MGRDEPRM, "Manager Dependency Error" },
503 { DRDA_CP_SECCHKRM, "Security Check" },
504 { DRDA_CP_CMDATHRM, "Not Authorized to Command" },
505 { DRDA_CP_AGNPRMRM, "Permanent Agent Error" },
506 { DRDA_CP_RSCLMTRM, "Resource Limits Reached" },
507 { DRDA_CP_PRCCNVRM, "Conversational Protocol Error" },
508 { DRDA_CP_CMDCMPRM, "Command Processing Completed" },
509 { DRDA_CP_SYNTAXRM, "Data Stream Syntax Error" },
510 { DRDA_CP_CMDNSPRM, "Command Not Supported" },
511 { DRDA_CP_PRMNSPRM, "Parameter Not Supported" },
512 { DRDA_CP_VALNSPRM, "Parameter Value Not Supported" },
513 { DRDA_CP_OBJNSPRM, "Object Not Supported" },
514 { DRDA_CP_CMDCHKRM, "Command Check" },
515 { DRDA_CP_TRGNSPRM, "Target Not Supported" },
516 { DRDA_CP_AGENT, "Agent" },
517 { DRDA_CP_MGRLVLLS, "Manager-Level List" },
518 { DRDA_CP_SUPERVISOR, "Supervisor" },
519 { DRDA_CP_SECMGR, "Security Manager" },
520 { DRDA_CP_EXCSATRD, "Server Attributes Reply Data" },
521 { DRDA_CP_CMNAPPC, "LU 6.2 Conversational Communications Manager" },
522 { DRDA_CP_DICTIONARY, "Dictionary" },
523 { DRDA_CP_MGRLVLN, "Manager-Level Number Attribute" },
524 { DRDA_CP_CMNTCPIP, "TCP/IP CommunicationManager" },
525 { DRDA_CP_FDODTA, "FD:OCA Data" },
526 { DRDA_CP_CMNSYNCPT,
527 "SNA LU 6.2 Sync Point Conversational Communications Manager" },
528 { DRDA_CP_ACCSECRD, "Access Security Reply Data" },
529 { DRDA_CP_SYNCPTMGR, "Sync Point Manager" },
530 { DRDA_CP_RSYNCMGR, "ResynchronizationManager" },
531 { DRDA_CP_CCSIDMGR, "CCSID Manager" },
532 { DRDA_CP_SNDPKT, "Send Packet" },
533 { DRDA_CP_MONITOR, "Monitor Events" },
534 { DRDA_CP_ETIME, "Elapsed Time" },
535 { DRDA_CP_RESPKTSZ, "Response Packet Size" },
536 { DRDA_CP_CCSIDXML, "CCSID for External Encoded XML Strings" },
537 { DRDA_CP_MONITORRD, "Monitor Reply Data" },
538 { DRDA_CP_XAMGR, "XAManager" },
539 { DRDA_CP_PKTOBJ, "Packet Object" },
540 { DRDA_CP_UNICODEMGR, "Unicode Manager" },
541 { DRDA_CP_ACCRDB, "Access RDB" },
542 { DRDA_CP_BGNBND, "Begin Binding a Package to an RDB" },
543 { DRDA_CP_BNDSQLSTT, "Bind SQL Statement to an RDB Package" },
544 { DRDA_CP_CLSQRY, "Close Query" },
545 { DRDA_CP_CNTQRY, "Continue Query" },
546 { DRDA_CP_DRPPKG, "Drop RDB Package" },
547 { DRDA_CP_DSCSQLSTT, "Describe SQL Statement" },
548 { DRDA_CP_ENDBND, "End Binding a Package to an RDB" },
549 { DRDA_CP_EXCSQLIMM, "Execute Immediate SQL Statement" },
550 { DRDA_CP_EXCSQLSTT, "Execute SQL Statement" },
551 { DRDA_CP_OPNQRY, "Open Query" },
552 { DRDA_CP_PRPSQLSTT, "Prepare SQL Statement" },
553 { DRDA_CP_RDBCMM, "RDB Commit Unit of Work" },
554 { DRDA_CP_RDBRLLBCK, "RDB Rollback Unit of Work" },
555 { DRDA_CP_REBIND, "Rebind an Existing RDB Package" },
556 { DRDA_CP_DSCRDBTBL, "Describe RDB Table" },
557 { DRDA_CP_EXCSQLSET, "Set SQL Environment" },
558 { DRDA_CP_DSCERRCD, "Description Error Code" },
559 { DRDA_CP_QRYPRCTYP, "Query Protocol Type" },
560 { DRDA_CP_RDBINTTKN, "RDB Interrupt Token" },
561 { DRDA_CP_PRDDTA, "Product-Specific Data" },
562 { DRDA_CP_RDBCMTOK, "RDB Commit Allowed" },
563 { DRDA_CP_RDBCOLID, "RDB Collection Identifier" },
564 { DRDA_CP_PKGID, "RDB Package Identifier" },
565 { DRDA_CP_PKGNAM, "RDB Package Name" },
566 { DRDA_CP_PKGSN, "RDB Package Section Number" },
567 { DRDA_CP_PKGCNSTKN, "RDB Package Consistency Token" },
568 { DRDA_CP_RTNSETSTT, "Return SET Statement" },
569 { DRDA_CP_RDBACCCL, "RDB Access Manager Class" },
570 { DRDA_CP_RDBNAM, "Relational Database Name" },
571 { DRDA_CP_OUTEXP, "Output Expected" },
572 { DRDA_CP_PKGNAMCT, "RDB Package Name and Consistency Token" },
573 { DRDA_CP_PKGNAMCSN,
574 "RDB Package Name, Consistency Token, and Section Number" },
575 { DRDA_CP_QRYBLKSZ, "Query Block Size" },
576 { DRDA_CP_UOWDSP, "Unit of Work Disposition" },
577 { DRDA_CP_RTNSQLDA, "Maximum Result Set Count" },
578 { DRDA_CP_RDBALWUPD, "RDB Allow Updates" },
579 { DRDA_CP_SQLCSRHLD, "Hold Cursor Position" },
580 { DRDA_CP_STTSTRDEL, "Statement String Delimiter" },
581 { DRDA_CP_STTDECDEL, "Statement Decimal Delimiter" },
582 { DRDA_CP_PKGDFTCST, "Package Default Character Subtype" },
583 { DRDA_CP_QRYBLKCTL, "Query Block Protocol Control" },
584 { DRDA_CP_QRYEXTDTASZ, "Query Externalized Data Size" },
585 { DRDA_CP_CRRTKN, "Correlation Token" },
586 { DRDA_CP_SMLDTASZ, "Maximum Size of Small Data" },
587 { DRDA_CP_MEDDTASZ, "Maximum Size of Medium Data" },
588 { DRDA_CP_PRCNAM, "Procedure Name" },
589 { DRDA_CP_PKGSNLST, "RDB Result Set Reply Message" },
590 { DRDA_CP_NBRROW, "Number of Fetch or Insert Rows" },
591 { DRDA_CP_TRGDFTRT, "Target Default Value Return" },
592 { DRDA_CP_QRYRELSCR, "Query Relative Scrolling Action" },
593 { DRDA_CP_QRYROWNBR, "Query Row Number" },
594 { DRDA_CP_QRYRFRTBL, "Query Refresh Answer Set Table" },
595 { DRDA_CP_MAXRSLCNT, "Maximum Result Set Count" },
596 { DRDA_CP_MAXBLKEXT, "Maximum Number of Extra Blocks" },
597 { DRDA_CP_RSLSETFLG, "Result Set Flags" },
598 { DRDA_CP_TYPSQLDA, "Type of SQL Descriptor Area" },
599 { DRDA_CP_OUTOVROPT, "Output Override Option" },
600 { DRDA_CP_RTNEXTDTA, "Return of EXTDTA Option" },
601 { DRDA_CP_QRYATTSCR, "Query Attribute for Scrollability" },
602 { DRDA_CP_DYNDTAFMT, "Dynamic Data Format" },
603 { DRDA_CP_QRYATTUPD, "Query Attribute for Updatability" },
604 { DRDA_CP_QRYSCRORN, "Query Scroll Orientation" },
605 { DRDA_CP_QRYROWSNS, "Query Row Sensitivity" },
606 { DRDA_CP_QRYBLKRST, "Query Block Reset" },
607 { DRDA_CP_QRYRTNDTA, "Query Returns Datat" },
608 { DRDA_CP_QRYROWSET, "Query Rowset Size" },
609 { DRDA_CP_QRYATTSNS, "Query Attribute for Sensitivity" },
610 { DRDA_CP_QRYINSID, "Query Instance Identifier" },
611 { DRDA_CP_QRYCLSIMP, "Query Close Implicit" },
612 { DRDA_CP_QRYCLSRLS, "Query Close Lock Release" },
613 { DRDA_CP_QRYBLKFCT, "Query Blocking Factor" },
614 { DRDA_CP_DIAGLVL, "SQL Error Diagnostic Level" },
615 { DRDA_CP_ACCRDBRM, "Access to RDB Completed" },
616 { DRDA_CP_QRYNOPRM, "Query Not Open" },
617 { DRDA_CP_RDBNACRM, "RDB Not Accessed" },
618 { DRDA_CP_OPNQRYRM, "Open Query Complete" },
619 { DRDA_CP_PKGBNARM, "RDB Package Binding Not Active" },
620 { DRDA_CP_RDBACCRM, "RDB Currently Accessed" },
621 { DRDA_CP_BGNBNDRM, "Begin Bind Error" },
622 { DRDA_CP_PKGBPARM, "RDB Package Binding Process Active" },
623 { DRDA_CP_DSCINVRM, "Invalid Description" },
624 { DRDA_CP_ENDQRYRM, "End of Query" },
625 { DRDA_CP_ENDUOWRM, "End Unit of Work Condition" },
626 { DRDA_CP_ABNUOWRM, "Abnormal End Unit ofWork Condition" },
627 { DRDA_CP_DTAMCHRM, "Data Descriptor Mismatch" },
628 { DRDA_CP_QRYPOPRM, "Query Previously Opened" },
629 { DRDA_CP_RDBNFNRM, "RDB Not Found" },
630 { DRDA_CP_OPNQFLRM, "Open Query Failure" },
631 { DRDA_CP_SQLERRRM, "SQL Error Condition" },
632 { DRDA_CP_RDBUPDRM, "RDB Update Reply Message" },
633 { DRDA_CP_RSLSETRM, "RDB Result Set Reply Message" },
634 { DRDA_CP_RDBAFLRM, "RDB Access Failed Reply Message" },
635 { DRDA_CP_CMDVLTRM, "Command Violation" },
636 { DRDA_CP_CMMRQSRM, "Commitment Request" },
637 { DRDA_CP_RDBATHRM, "Not Authorized to RDB" },
638 { DRDA_CP_SQLAM, "SQL Application Manager" },
639 { DRDA_CP_SQLCARD, "SQL Communications Area Reply Data" },
640 { DRDA_CP_SQLCINRD, "SQL Result Set Column Information Reply Data" },
641 { DRDA_CP_SQLRSLRD, "SQL Result Set Reply Data" },
642 { DRDA_CP_RDB, "Relational Database" },
643 { DRDA_CP_FRCFIXROW, "Force Fixed Row Query Protocol" },
644 { DRDA_CP_SQLDARD, "SQLDA Reply Data" },
645 { DRDA_CP_SQLDTA, "SQL Program Variable Data" },
646 { DRDA_CP_SQLDTARD, "SQL Data Reply Data" },
647 { DRDA_CP_SQLSTT, "SQL Statement" },
648 { DRDA_CP_OUTOVR, "Output Override Descriptor" },
649 { DRDA_CP_LMTBLKPRC, "Limited Block Protocol" },
650 { DRDA_CP_FIXROWPRC, "Fixed Row Query Protocol" },
651 { DRDA_CP_SQLSTTVRB, "SQL Statement Variable Descriptions" },
652 { DRDA_CP_QRYDSC, "Query Answer Set Description" },
653 { DRDA_CP_QRYDTA, "Query Answer Set Data" },
654 { DRDA_CP_CSTSYSDFT, "Character Subtype System Default" },
655 { DRDA_CP_CSTBITS, "Character Subtype Bits" },
656 { DRDA_CP_CSTSBCS, "Character Subtype SBCS" },
657 { DRDA_CP_CSTMBCS, "Character Subtype MBCS" },
658 { DRDA_CP_ISOLVLCHG, "Isolation Level Change" },
659 { DRDA_CP_ISOLVLCS, "Isolation Level Cursor Stability" },
660 { DRDA_CP_ISOLVLALL, "Isolation Level All" },
661 { DRDA_CP_ISOLVLRR, "Isolation Level Repeatable Read" },
662 { DRDA_CP_ISOLVLNC, "Isolation Level No Commit" },
663 { DRDA_CP_SRVLST, "Server List" },
664 { DRDA_CP_SQLATTR, "SQL Statement Attributes" },
665 { 0, NULL }
667 static value_string_ext drda_opcode_vals_ext = VALUE_STRING_EXT_INIT(drda_opcode_vals);
669 static const value_string drda_opcode_abbr[] = {
670 { DRDA_CP_DATA, "DATA" },
671 { DRDA_CP_CODPNT, "CODPNT" },
672 { DRDA_CP_FDODSC, "FDODSC" },
673 { DRDA_CP_TYPDEFNAM, "TYPDEFNAM" },
674 { DRDA_CP_TYPDEFOVR, "TYPDEFOVR" },
675 { DRDA_CP_CODPNTDR, "CODPNTDR" },
676 { DRDA_CP_EXCSAT, "EXCSAT" },
677 { DRDA_CP_SYNCCTL, "SYNCCTL" },
678 { DRDA_CP_SYNCRSY, "SYNCRSY" },
679 { DRDA_CP_ACCSEC, "ACCSEC" },
680 { DRDA_CP_SECCHK, "SECCHK" },
681 { DRDA_CP_SYNCLOG, "SYNCLOG" },
682 { DRDA_CP_RSCTYP, "RSCTYP" },
683 { DRDA_CP_RSNCOD, "RSNCOD" },
684 { DRDA_CP_RSCNAM, "RSCNAM" },
685 { DRDA_CP_PRDID, "PRDID" },
686 { DRDA_CP_PRCCNVCD, "PRCCNVCD" },
687 { DRDA_CP_VRSNAM, "VRSNAM" },
688 { DRDA_CP_SRVCLSNM, "SRVCLSNM" },
689 { DRDA_CP_SVRCOD, "SVRCOD" },
690 { DRDA_CP_SYNERRCD, "SYNERRCD" },
691 { DRDA_CP_SRVDGN, "SRVDGN" },
692 { DRDA_CP_SRVRLSLV, "SRVRLSLV" },
693 { DRDA_CP_SPVNAM, "SPVNAM" },
694 { DRDA_CP_EXTNAM, "EXTNAM" },
695 { DRDA_CP_SRVNAM, "SRVNAM" },
696 { DRDA_CP_SECMGRNM, "SECMGRNM" },
697 { DRDA_CP_DEPERRCD, "DEPERRCD" },
698 { DRDA_CP_CCSIDSBC, "CCSIDSBC" },
699 { DRDA_CP_CCSIDDBC, "CCSIDDBC" },
700 { DRDA_CP_CCSIDMBC, "CCSIDMBC" },
701 { DRDA_CP_RLSCONV, "RLSCONV" },
702 { DRDA_CP_USRID, "USRID" },
703 { DRDA_CP_PASSWORD, "PASSWORD" },
704 { DRDA_CP_SECMEC, "SECMEC" },
705 { DRDA_CP_SECCHKCD, "SECCHKCD" },
706 { DRDA_CP_SVCERRNO, "SVCERRNO" },
707 { DRDA_CP_SECTKN, "SECTKN" },
708 { DRDA_CP_NEWPASSWORD, "NEWPASSWORD" },
709 { DRDA_CP_MGRLVLRM, "MGRLVLRM" },
710 { DRDA_CP_MGRDEPRM, "MGRDEPRM" },
711 { DRDA_CP_SECCHKRM, "SECCHKRM" },
712 { DRDA_CP_CMDATHRM, "CMDATHRM" },
713 { DRDA_CP_AGNPRMRM, "AGNPRMRM" },
714 { DRDA_CP_RSCLMTRM, "RSCLMTRM" },
715 { DRDA_CP_PRCCNVRM, "PRCCNVRM" },
716 { DRDA_CP_CMDCMPRM, "CMDCMPRM" },
717 { DRDA_CP_SYNTAXRM, "SYNTAXRM" },
718 { DRDA_CP_CMDNSPRM, "CMDNSPRM" },
719 { DRDA_CP_PRMNSPRM, "PRMNSPRM" },
720 { DRDA_CP_VALNSPRM, "VALNSPRM" },
721 { DRDA_CP_OBJNSPRM, "OBJNSPRM" },
722 { DRDA_CP_CMDCHKRM, "CMDCHKRM" },
723 { DRDA_CP_TRGNSPRM, "TRGNSPRM" },
724 { DRDA_CP_AGENT, "AGENT" },
725 { DRDA_CP_MGRLVLLS, "MGRLVLLS" },
726 { DRDA_CP_SUPERVISOR, "SUPERVISOR" },
727 { DRDA_CP_SECMGR, "SECMGR" },
728 { DRDA_CP_EXCSATRD, "EXCSATRD" },
729 { DRDA_CP_CMNAPPC, "CMNAPPC" },
730 { DRDA_CP_DICTIONARY, "DICTIONARY" },
731 { DRDA_CP_MGRLVLN, "MGRLVLN" },
732 { DRDA_CP_CMNTCPIP, "CMNTCPIP" },
733 { DRDA_CP_FDODTA, "FDODTA" },
734 { DRDA_CP_CMNSYNCPT, "CMNSYNCPT" },
735 { DRDA_CP_ACCSECRD, "ACCSECRD" },
736 { DRDA_CP_SYNCPTMGR, "SYNCPTMGR" },
737 { DRDA_CP_RSYNCMGR, "RSYNCMGR" },
738 { DRDA_CP_CCSIDMGR, "CCSIDMGR" },
739 { DRDA_CP_SNDPKT, "SNDPKT" },
740 { DRDA_CP_MONITOR, "MONITOR" },
741 { DRDA_CP_ETIME, "ETIME" },
742 { DRDA_CP_RESPKTSZ, "RESPKTSZ" },
743 { DRDA_CP_CCSIDXML, "CCSIDXML" },
744 { DRDA_CP_MONITORRD, "MONITORRD" },
745 { DRDA_CP_XAMGR, "XAMGR" },
746 { DRDA_CP_PKTOBJ, "PKTOBJ" },
747 { DRDA_CP_UNICODEMGR, "UNICODEMGR" },
748 { DRDA_CP_ACCRDB, "ACCRDB" },
749 { DRDA_CP_BGNBND, "BGNBND" },
750 { DRDA_CP_BNDSQLSTT, "BNDSQLSTT" },
751 { DRDA_CP_CLSQRY, "CLSQRY" },
752 { DRDA_CP_CNTQRY, "CNTQRY" },
753 { DRDA_CP_DRPPKG, "DRPPKG" },
754 { DRDA_CP_DSCSQLSTT, "DSCSQLSTT" },
755 { DRDA_CP_ENDBND, "ENDBND" },
756 { DRDA_CP_EXCSQLIMM, "EXCSQLIMM" },
757 { DRDA_CP_EXCSQLSTT, "EXCSQLSTT" },
758 { DRDA_CP_OPNQRY, "OPNQRY" },
759 { DRDA_CP_PRPSQLSTT, "PRPSQLSTT" },
760 { DRDA_CP_RDBCMM, "RDBCMM" },
761 { DRDA_CP_RDBRLLBCK, "RDBRLLBCK" },
762 { DRDA_CP_REBIND, "REBIND" },
763 { DRDA_CP_DSCRDBTBL, "DSCRDBTBL" },
764 { DRDA_CP_EXCSQLSET, "EXCSQLSET" },
765 { DRDA_CP_DSCERRCD, "DSCERRCD" },
766 { DRDA_CP_QRYPRCTYP, "QRYPRCTYP" },
767 { DRDA_CP_RDBINTTKN, "RDBINTTKN" },
768 { DRDA_CP_PRDDTA, "PRDDTA" },
769 { DRDA_CP_RDBCMTOK, "RDBCMTOK" },
770 { DRDA_CP_RDBCOLID, "RDBCOLID" },
771 { DRDA_CP_PKGID, "PKGID" },
772 { DRDA_CP_PKGNAM, "PKGNAM" },
773 { DRDA_CP_PKGSN, "PKGSN" },
774 { DRDA_CP_PKGCNSTKN, "PKGCNSTKN" },
775 { DRDA_CP_RTNSETSTT, "RTNSETSTT" },
776 { DRDA_CP_RDBACCCL, "RDBACCCL" },
777 { DRDA_CP_RDBNAM, "RDBNAM" },
778 { DRDA_CP_OUTEXP, "OUTEXP" },
779 { DRDA_CP_PKGNAMCT, "PKGNAMCT" },
780 { DRDA_CP_PKGNAMCSN, "PKGNAMCSN" },
781 { DRDA_CP_QRYBLKSZ, "QRYBLKSZ" },
782 { DRDA_CP_UOWDSP, "UOWDSP" },
783 { DRDA_CP_RTNSQLDA, "RTNSQLDA" },
784 { DRDA_CP_RDBALWUPD, "RDBALWUPD" },
785 { DRDA_CP_SQLCSRHLD, "SQLCSRHLD" },
786 { DRDA_CP_STTSTRDEL, "STTSTRDEL" },
787 { DRDA_CP_STTDECDEL, "STTDECDEL" },
788 { DRDA_CP_PKGDFTCST, "PKGDFTCST" },
789 { DRDA_CP_QRYBLKCTL, "QRYBLKCTL" },
790 { DRDA_CP_QRYEXTDTASZ, "QRYEXTDTASZ" },
791 { DRDA_CP_CRRTKN, "CRRTKN" },
792 { DRDA_CP_SMLDTASZ, "SMLDTASZ" },
793 { DRDA_CP_MEDDTASZ, "MEDDTASZ" },
794 { DRDA_CP_PRCNAM, "PRCNAM" },
795 { DRDA_CP_PKGSNLST, "PKGSNLST" },
796 { DRDA_CP_NBRROW, "NBRROW" },
797 { DRDA_CP_TRGDFTRT, "TRGDFTRT" },
798 { DRDA_CP_QRYRELSCR, "QRYRELSCR" },
799 { DRDA_CP_QRYROWNBR, "QRYROWNBR" },
800 { DRDA_CP_QRYRFRTBL, "QRYRFRTBL" },
801 { DRDA_CP_MAXRSLCNT, "MAXRSLCNT" },
802 { DRDA_CP_MAXBLKEXT, "MAXBLKEXT" },
803 { DRDA_CP_RSLSETFLG, "RSLSETFLG" },
804 { DRDA_CP_TYPSQLDA, "TYPSQLDA" },
805 { DRDA_CP_OUTOVROPT, "OUTOVROPT" },
806 { DRDA_CP_RTNEXTDTA, "RTNEXTDTA" },
807 { DRDA_CP_QRYATTSCR, "QRYATTSCR" },
808 { DRDA_CP_DYNDTAFMT, "DYNDTAFMT" },
809 { DRDA_CP_QRYATTUPD, "QRYATTUPD" },
810 { DRDA_CP_QRYSCRORN, "QRYSCRORN" },
811 { DRDA_CP_QRYROWSNS, "QRYROWSNS" },
812 { DRDA_CP_QRYBLKRST, "QRYBLKRST" },
813 { DRDA_CP_QRYRTNDTA, "QRYRTNDTA" },
814 { DRDA_CP_QRYROWSET, "QRYROWSET" },
815 { DRDA_CP_QRYATTSNS, "QRYATTSNS" },
816 { DRDA_CP_QRYINSID, "QRYINSID" },
817 { DRDA_CP_QRYCLSIMP, "QRYCLSIMP" },
818 { DRDA_CP_QRYCLSRLS, "QRYCLSRLS" },
819 { DRDA_CP_QRYBLKFCT, "QRYBLKFCT" },
820 { DRDA_CP_DIAGLVL, "DIAGLVL" },
821 { DRDA_CP_ACCRDBRM, "ACCRDBRM" },
822 { DRDA_CP_QRYNOPRM, "QRYNOPRM" },
823 { DRDA_CP_RDBNACRM, "RDBNACRM" },
824 { DRDA_CP_OPNQRYRM, "OPNQRYRM" },
825 { DRDA_CP_PKGBNARM, "PKGBNARM" },
826 { DRDA_CP_RDBACCRM, "RDBACCRM" },
827 { DRDA_CP_BGNBNDRM, "BGNBNDRM" },
828 { DRDA_CP_PKGBPARM, "PKGBPARM" },
829 { DRDA_CP_DSCINVRM, "DSCINVRM" },
830 { DRDA_CP_ENDQRYRM, "ENDQRYRM" },
831 { DRDA_CP_ENDUOWRM, "ENDUOWRM" },
832 { DRDA_CP_ABNUOWRM, "ABNUOWRM" },
833 { DRDA_CP_DTAMCHRM, "DTAMCHRM" },
834 { DRDA_CP_QRYPOPRM, "QRYPOPRM" },
835 { DRDA_CP_RDBNFNRM, "RDBNFNRM" },
836 { DRDA_CP_OPNQFLRM, "OPNQFLRM" },
837 { DRDA_CP_SQLERRRM, "SQLERRRM" },
838 { DRDA_CP_RDBUPDRM, "RDBUPDRM" },
839 { DRDA_CP_RSLSETRM, "RSLSETRM" },
840 { DRDA_CP_RDBAFLRM, "RDBAFLRM" },
841 { DRDA_CP_CMDVLTRM, "CMDVLTRM" },
842 { DRDA_CP_CMMRQSRM, "CMMRQSRM" },
843 { DRDA_CP_RDBATHRM, "RDBATHRM" },
844 { DRDA_CP_SQLAM, "SQLAM" },
845 { DRDA_CP_SQLCARD, "SQLCARD" },
846 { DRDA_CP_SQLCINRD, "SQLCINRD" },
847 { DRDA_CP_SQLRSLRD, "SQLRSLRD" },
848 { DRDA_CP_RDB, "RDB" },
849 { DRDA_CP_FRCFIXROW, "FRCFIXROW" },
850 { DRDA_CP_SQLDARD, "SQLDARD" },
851 { DRDA_CP_SQLDTA, "SQLDTA" },
852 { DRDA_CP_SQLDTARD, "SQLDTARD" },
853 { DRDA_CP_SQLSTT, "SQLSTT" },
854 { DRDA_CP_OUTOVR, "OUTOVR" },
855 { DRDA_CP_LMTBLKPRC, "LMTBLKPRC" },
856 { DRDA_CP_FIXROWPRC, "FIXROWPRC" },
857 { DRDA_CP_SQLSTTVRB, "SQLSTTVRB" },
858 { DRDA_CP_QRYDSC, "QRYDSC" },
859 { DRDA_CP_QRYDTA, "QRYDTA" },
860 { DRDA_CP_CSTSYSDFT, "CSTSYSDFT" },
861 { DRDA_CP_CSTBITS, "CSTBITS" },
862 { DRDA_CP_CSTSBCS, "CSTSBCS" },
863 { DRDA_CP_CSTMBCS, "CSTMBCS" },
864 { DRDA_CP_ISOLVLCHG, "ISOLVLCHG" },
865 { DRDA_CP_ISOLVLCS, "ISOLVLCS" },
866 { DRDA_CP_ISOLVLALL, "ISOLVLALL" },
867 { DRDA_CP_ISOLVLRR, "ISOLVLRR" },
868 { DRDA_CP_ISOLVLNC, "ISOLVLNC" },
869 { DRDA_CP_SRVLST, "SRVLST" },
870 { DRDA_CP_SQLATTR, "SQLATTR" },
871 { 0, NULL }
873 static value_string_ext drda_opcode_abbr_ext = VALUE_STRING_EXT_INIT(drda_opcode_abbr);
875 static const value_string drda_dsstyp_abbr[] = {
876 { DRDA_DSSFMT_RQSDSS, "RQSDSS" },
877 { DRDA_DSSFMT_RPYDSS, "RPYDSS" },
878 { DRDA_DSSFMT_OBJDSS, "OBJDSS" },
879 { DRDA_DSSFMT_CMNDSS, "CMNDSS" },
880 { DRDA_DSSFMT_NORPYDSS, "NORPYDSS" },
881 { 0, NULL }
884 static const value_string drda_boolean_vals[] = {
885 { 0xF0, "FALSE" }, /* \xf0 - EBCDIC '0' */
886 { 0xF1, "TRUE" }, /* \xf1 - EBCDIC '1' */
887 { 0, NULL }
890 static const value_string drda_max_vals[] =
892 { -1, "Unlimited"},
893 { 0, NULL }
896 static const range_string drda_null_ind_rvals[] =
898 { 0x00, 0x00, "Complete data value follows" },
899 { 0x01, 0x7F, "Truncation has occurred (should not occur in DRDA)" },
900 { 0x80, 0xFD, "Reserved; no data value follows" },
901 { 0xFE, 0xFE, "Undefined result; no data value follows" },
902 { 0xFF, 0xFF, "NULL; no data value follows" },
903 { 0, 0, NULL },
906 typedef struct _drda_encoding_t {
907 enum_typdefnam_t typdefnam;
908 unsigned sbc;
909 unsigned mbc;
910 } drda_encoding_t;
912 typedef struct _drda_flow_t {
913 wmem_tree_t* encoding_tree;
914 wmem_tree_t* sqlam_tree;
915 } drda_flow_t;
917 typedef struct _drda_conv_info_t {
918 drda_flow_t *client; /* AKA source system */
919 drda_flow_t *server; /* AKA target system */
921 address srv_addr;
922 port_type srv_ptype;
923 unsigned srv_port;
924 } drda_conv_info_t;
926 typedef struct _drda_pdu_info_t {
927 unsigned sqlam;
928 enum_typdefnam_t typdefnam;
929 unsigned sbc;
930 unsigned mbc;
931 } drda_pdu_info_t;
933 static drda_flow_t*
934 drda_new_flow(wmem_allocator_t *alloc, packet_info *pinfo)
936 drda_flow_t *new_flow = wmem_new(alloc, drda_flow_t);
938 new_flow->encoding_tree = wmem_tree_new(alloc);
939 new_flow->sqlam_tree = wmem_tree_new(alloc);
940 wmem_tree_insert32(new_flow->sqlam_tree, pinfo->num, GUINT_TO_POINTER(drda_default_sqlam));
942 return new_flow;
945 static void
946 drda_update_flow_encoding(packet_info *pinfo, drda_flow_t *flow, const drda_pdu_info_t *pdu_info)
948 drda_encoding_t *encoding = wmem_tree_lookup32_le(flow->encoding_tree, pinfo->num);
949 if (encoding) {
950 if (encoding->typdefnam == pdu_info->typdefnam && encoding->sbc == pdu_info->sbc && encoding->mbc == pdu_info->mbc) {
951 return;
954 encoding = wmem_new(wmem_file_scope(), drda_encoding_t);
955 encoding->mbc = pdu_info->mbc;
956 encoding->sbc = pdu_info->sbc;
957 encoding->typdefnam = pdu_info->typdefnam;
958 wmem_tree_insert32(flow->encoding_tree, pinfo->num, encoding);
961 static drda_conv_info_t*
962 drda_get_conv_info(packet_info *pinfo)
964 conversation_t *conv = find_or_create_conversation(pinfo);
965 drda_conv_info_t *conv_info = conversation_get_proto_data(conv, proto_drda);
967 if (conv_info == NULL) {
968 conv_info = wmem_new0(wmem_file_scope(), drda_conv_info_t);
970 conv_info->client = drda_new_flow(wmem_file_scope(), pinfo);
971 conv_info->server = drda_new_flow(wmem_file_scope(), pinfo);
973 conversation_add_proto_data(conv, proto_drda, conv_info);
975 return conv_info;
978 static drda_pdu_info_t*
979 drda_get_pdu_info(packet_info *pinfo, uint32_t correl, bool is_server)
981 drda_pdu_info_t *pdu_info;
983 /* "When the TYPDEFNAM object is specified as a command/reply data object,
984 * the value specified applies to the following command data objects and
985 * reply data objects for that command, respectively. When TYPDEFNAM is
986 * repeatable, the value of one TYPDEFNAM object is applicable only to
987 * those objects (command data or reply data) that are sent before another
988 * TYPDEFNAM object is sent. The value of TYPDEFNAM that a command
989 * specifies is in effect only for that command. This rule applies to all
990 * commands, unless specified otherwise." Similar for TYPDEFOVR.
992 * This means that encoding values are initialized to those set for the
993 * given direction for entire conversation by ACCRDB[RM] for each
994 * frame, or for each time the correlation ID changes (representing
995 * a different command; shared correlation IDs in a frame (after
996 * desegmentation, if needed) are data objects for the same command.)
998 pdu_info = p_get_proto_data(pinfo->pool, pinfo, proto_drda, correl);
1000 if (!pdu_info) {
1001 pdu_info = wmem_new(pinfo->pool, drda_pdu_info_t);
1002 drda_conv_info_t *conv_info = drda_get_conv_info(pinfo);
1003 drda_flow_t *flow = is_server ? conv_info->server : conv_info->client;
1004 pdu_info->sqlam = GPOINTER_TO_UINT(wmem_tree_lookup32_le(flow->sqlam_tree, pinfo->num));
1005 drda_encoding_t *encoding = wmem_tree_lookup32_le(flow->encoding_tree, pinfo->num);
1006 if (encoding) {
1007 pdu_info->typdefnam = encoding->typdefnam;
1008 pdu_info->sbc = encoding->sbc;
1009 pdu_info->mbc = encoding->mbc;
1010 } else {
1011 pdu_info->typdefnam = drda_default_typdefnam;
1012 pdu_info->sbc = mibenum_charset_to_encoding((unsigned)drda_default_ccsidsbc);
1013 pdu_info->mbc = mibenum_charset_to_encoding((unsigned)drda_default_ccsidmbc);
1016 p_set_proto_data(pinfo->pool, pinfo, proto_drda, correl, pdu_info);
1020 return pdu_info;
1023 static void
1024 drda_set_server(drda_conv_info_t *conv_info, address *addr, port_type ptype, uint32_t port)
1026 copy_address_wmem(wmem_file_scope(), &conv_info->srv_addr, addr);
1027 conv_info->srv_ptype = ptype;
1028 conv_info->srv_port = port;
1031 static bool
1032 drda_packet_from_server(packet_info *pinfo, uint32_t command, uint8_t dsstyp)
1034 drda_conv_info_t *conv_info = drda_get_conv_info(pinfo);
1035 if (conv_info->srv_addr.type != AT_NONE) {
1036 return (conv_info->srv_ptype == pinfo->ptype) &&
1037 (conv_info->srv_port == pinfo->srcport) &&
1038 addresses_equal(&conv_info->srv_addr, &pinfo->src);
1040 switch (command) {
1041 case DRDA_CP_EXCSAT:
1042 case DRDA_CP_ACCRDB:
1043 /* Client */
1044 drda_set_server(conv_info, &pinfo->dst, pinfo->ptype, pinfo->destport);
1045 return false;
1047 case DRDA_CP_EXCSATRD:
1048 case DRDA_CP_ACCRDBRM:
1049 /* Server (EXCSATRD is OBJDSS, which itself is inconclusive.) */
1050 drda_set_server(conv_info, &pinfo->src, pinfo->ptype, pinfo->srcport);
1051 return true;
1054 /* The above commands are the ones that matter the most for determining
1055 * direction.
1057 switch (dsstyp) {
1058 case DRDA_DSSFMT_RQSDSS:
1059 case DRDA_DSSFMT_NORPYDSS:
1060 drda_set_server(conv_info, &pinfo->dst, pinfo->ptype, pinfo->destport);
1061 return false;
1063 case DRDA_DSSFMT_RPYDSS:
1064 drda_set_server(conv_info, &pinfo->src, pinfo->ptype, pinfo->srcport);
1065 return true;
1067 default:
1068 /* We will be using the default values from the prefs anyway, since
1069 * this means we won't have received ACCRDB[RM] yet.
1071 break;
1074 return false;
1077 static int
1078 dissect_fdoca_integer(proto_tree *tree, int hf_index, tvbuff_t *tvb, int offset,int length, const drda_pdu_info_t *pdu_info, uint32_t *value)
1080 unsigned endian;
1081 switch (pdu_info->typdefnam) {
1082 case TYPDEFNAM_370:
1083 case TYPDEFNAM_400:
1084 case TYPDEFNAM_ASC:
1085 endian = ENC_BIG_ENDIAN;
1086 break;
1087 case TYPDEFNAM_X86:
1088 case TYPDEFNAM_VAX:
1089 default:
1090 endian = ENC_LITTLE_ENDIAN;
1091 break;
1093 proto_tree_add_item_ret_int(tree, hf_index, tvb, offset, length, endian, value);
1094 return offset + length;
1097 static int
1098 dissect_fdoca_integer64(proto_tree *tree, int hf_index, tvbuff_t *tvb, int offset,int length, const drda_pdu_info_t *pdu_info, uint64_t *value)
1100 unsigned endian;
1101 switch (pdu_info->typdefnam) {
1102 case TYPDEFNAM_370:
1103 case TYPDEFNAM_400:
1104 case TYPDEFNAM_ASC:
1105 endian = ENC_BIG_ENDIAN;
1106 break;
1107 case TYPDEFNAM_X86:
1108 case TYPDEFNAM_VAX:
1109 default:
1110 endian = ENC_LITTLE_ENDIAN;
1111 break;
1113 proto_tree_add_item_ret_int64(tree, hf_index, tvb, offset, length, endian, value);
1114 return offset + length;
1117 static int
1118 dissect_fdoca_fcs(proto_tree *tree, int hf_index, tvbuff_t *tvb, int offset, int length, const drda_pdu_info_t *pdu_info)
1120 proto_tree_add_item(tree, hf_index, tvb, offset, length, pdu_info->sbc);
1121 return offset + length;
1124 static int
1125 dissect_fdoca_vcs(proto_tree *tree, int hf_index, tvbuff_t *tvb, int offset, const drda_pdu_info_t *pdu_info)
1127 uint32_t item_len;
1128 proto_tree_add_item_ret_uint(tree, hf_drda_param_length, tvb, offset, 2, ENC_BIG_ENDIAN, &item_len);
1129 offset += 2;
1130 proto_tree_add_item(tree, hf_index, tvb, offset, item_len, pdu_info->sbc);
1131 return offset + (int)item_len;
1134 static int
1135 dissect_fdoca_vcm(proto_tree *tree, int hf_index, tvbuff_t *tvb, int offset, const drda_pdu_info_t *pdu_info)
1137 uint32_t item_len;
1138 proto_tree_add_item_ret_uint(tree, hf_drda_param_length, tvb, offset, 2, ENC_BIG_ENDIAN, &item_len);
1139 offset += 2;
1140 proto_tree_add_item(tree, hf_index, tvb, offset, item_len, pdu_info->mbc);
1141 return offset + (int)item_len;
1144 static int
1145 dissect_fdoca_nocs(proto_tree *tree, int hf_index, tvbuff_t *tvb, int offset, const drda_pdu_info_t *pdu_info)
1147 uint32_t null_ind, item_length;
1148 proto_tree_add_item_ret_uint(tree, hf_drda_null_ind, tvb, offset, 1, ENC_NA, &null_ind);
1149 offset++;
1150 if ((int8_t)null_ind >= 0) {
1151 proto_tree_add_item_ret_uint(tree, hf_drda_clob_length, tvb, offset, 4, ENC_BIG_ENDIAN, &item_length);
1152 offset += 4;
1153 proto_tree_add_item(tree, hf_index, tvb, offset, item_length, pdu_info->sbc);
1154 offset += item_length;
1156 return offset;
1159 static int
1160 dissect_fdoca_nocm(proto_tree *tree, int hf_index, tvbuff_t *tvb, int offset, const drda_pdu_info_t *pdu_info)
1162 uint32_t null_ind, item_length;
1163 proto_tree_add_item_ret_uint(tree, hf_drda_null_ind, tvb, offset, 1, ENC_NA, &null_ind);
1164 offset++;
1165 if ((int8_t)null_ind >= 0) {
1166 proto_tree_add_item_ret_uint(tree, hf_drda_clob_length, tvb, offset, 4, ENC_BIG_ENDIAN, &item_length);
1167 offset += 4;
1168 proto_tree_add_item(tree, hf_index, tvb, offset, item_length, pdu_info->mbc);
1169 offset += item_length;
1171 return offset;
1174 static int
1175 dissect_drda_typdefnam(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
1177 drda_pdu_info_t *pdu_info = (drda_pdu_info_t*)data;
1178 const uint8_t *typdefnam;
1180 proto_tree_add_item_ret_string(tree, hf_drda_typdefnam, tvb, 0, tvb_reported_length(tvb), ENC_UTF_8, pinfo->pool, &typdefnam);
1181 for (int i = 0; typdefnam_vals[i].name != NULL; i++) {
1182 if (strcmp(typdefnam_vals[i].name, typdefnam) == 0) {
1183 pdu_info->typdefnam = typdefnam_vals[i].value;
1184 break;
1187 proto_tree_add_item_ret_string(tree, hf_drda_typdefnam, tvb, 0, tvb_reported_length(tvb), ENC_EBCDIC_CP500, pinfo->pool, &typdefnam);
1188 for (int i = 0; typdefnam_vals[i].name != NULL; i++) {
1189 if (strcmp(typdefnam_vals[i].name, typdefnam) == 0) {
1190 pdu_info->typdefnam = typdefnam_vals[i].value;
1191 break;
1194 return tvb_reported_length(tvb);
1197 static int
1198 dissect_drda_sqlstt(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void *data _U_)
1200 drda_pdu_info_t *pdu_info = (drda_pdu_info_t*)data;
1202 int offset = 0;
1204 uint32_t sqlstt_length;
1206 /* If SECMGR is Level 6 and higher, it's possible to select a SECMEC
1207 * that means that the security-sensitive DDM/FD:OCA objects are encrypted.
1208 * They are SQLDTA, SQLDTARD, SQLSTT, SQLDARD, SQLATTR, SQLCINRD,
1209 * SQLRSLRD, SQLSTTVRB, QRYDTA, EXTDTA, and SECTKNOVR.
1210 * XXX: We don't handle the encryption, and we don't handle looking at
1211 * the SECMEC to see if they are encrypted.
1214 /* From the DRDA Specification Volume 1, 1.1 The DRDA Reference
1215 * (Version 4 and later):
1216 * Greater than 32,767 Byte SQL Statements
1217 * "Existing early descriptor character fields are mapped to a Variable
1218 * Character Mixed or a Variable Character SBCS which allow a maximum of
1219 * 32,767 bytes. SQL Statements described by the SQL Statement Group use
1220 * these character fields. To allow SQL Statements to extend beyond the 32K
1221 * limit, SQL statements are changed to map to nullable Large Character
1222 * Objects Mixed and nullable Large Character Objects SBCS to allow for
1223 * very large SQL Statements."
1225 * In other words, it changed from a pair of non nullable LONG VARCHARs
1226 * to a pair of nullable CLOBs, meaning that each string gained a
1227 * null indicator byte and the length field grew from 2 to 4 bytes.
1229 * This requires SQLAM Level 7 on both client & server, as sent in the
1230 * MGRLVLLS in the EXCSATRD.
1232 * We can cheat a bit because we can tell which one it is by
1233 * inspection (assuming valid data), so we don't have to check
1234 * pdu_info->sqlam
1237 sqlstt_length = tvb_get_ntohs(tvb, offset);
1238 if (sqlstt_length == 0) {
1239 sqlstt_length = tvb_get_ntohs(tvb, offset + 2);
1241 if (sqlstt_length + 4 == tvb_reported_length(tvb)) {
1242 /* pdu_info->sqlam < 7 */
1243 offset = dissect_fdoca_vcm(tree, hf_drda_sqlstatement, tvb, offset, pdu_info);
1244 offset = dissect_fdoca_vcs(tree, hf_drda_sqlstatement, tvb, offset, pdu_info);
1245 } else {
1246 offset = dissect_fdoca_nocm(tree, hf_drda_sqlstatement, tvb, offset, pdu_info);
1247 offset = dissect_fdoca_nocs(tree, hf_drda_sqlstatement, tvb, offset, pdu_info);
1249 return offset;
1252 static int
1253 dissect_drda_sqldiaggrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
1255 proto_item *ti;
1256 proto_tree *subtree;
1257 int offset = 0;
1259 uint32_t null_ind;
1261 ti = proto_tree_add_item(tree, hf_drda_sqldiaggrp, tvb, offset, 1, ENC_NA);
1262 subtree = proto_item_add_subtree(ti, ett_drda_sqldiaggrp);
1263 proto_tree_add_item_ret_uint(subtree, hf_drda_null_ind, tvb, offset, 1, ENC_NA, &null_ind);
1264 offset++;
1265 if ((int8_t)null_ind >= 0) {
1266 proto_tree_add_expert(subtree, pinfo, &ei_drda_undecoded, tvb, offset, 2);
1268 proto_item_set_end(ti, tvb, offset);
1269 return offset;
1272 static const value_string drda_udtxtype_vals[] = {
1274 { 0, "Not a UDT" },
1275 { 1, "Distinct type" },
1276 { 2, "Structured type" },
1277 { 3, "Reference type" },
1278 { 0, NULL },
1281 static int
1282 dissect_drda_sqludtgrp(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void *data)
1284 proto_item *ti;
1285 proto_tree *subtree;
1286 int offset = 0;
1288 drda_pdu_info_t *pdu_info = (drda_pdu_info_t*)data;
1289 uint32_t null_ind;
1291 ti = proto_tree_add_item(tree, hf_drda_sqludtgrp, tvb, offset, 1, ENC_NA);
1292 subtree = proto_item_add_subtree(ti, ett_drda_sqludtgrp);
1293 proto_tree_add_item_ret_uint(subtree, hf_drda_null_ind, tvb, offset, 1, ENC_NA, &null_ind);
1294 offset++;
1295 if ((int8_t)null_ind >= 0) {
1296 if (pdu_info->sqlam > 6) {
1297 offset = dissect_fdoca_integer(subtree, hf_drda_sqludtxtype, tvb, offset, 4, pdu_info, NULL);
1298 offset = dissect_fdoca_vcs(subtree, hf_drda_rdbnam, tvb, offset, pdu_info);
1299 offset = dissect_fdoca_vcm(subtree, hf_drda_sqludtschema, tvb, offset, pdu_info);
1300 offset = dissect_fdoca_vcs(subtree, hf_drda_sqludtschema, tvb, offset, pdu_info);
1302 offset = dissect_fdoca_vcm(subtree, hf_drda_sqludtname, tvb, offset, pdu_info);
1303 offset = dissect_fdoca_vcs(subtree, hf_drda_sqludtname, tvb, offset, pdu_info);
1304 if (pdu_info->sqlam >= 10) {
1305 offset = dissect_fdoca_vcm(subtree, hf_drda_sqludtmodule, tvb, offset, pdu_info);
1306 offset = dissect_fdoca_vcs(subtree, hf_drda_sqludtmodule, tvb, offset, pdu_info);
1309 proto_item_set_end(ti, tvb, offset);
1310 return offset;
1313 static const value_string drda_keymem_vals[] = {
1314 { 0, "Not a member of the primary key or of a unique index" },
1315 { 1, "Member of the primary key or of a unique index" },
1316 { 0, NULL }
1319 static const value_string drda_updateable_vals[] = {
1320 { 0, "Not updateable" },
1321 { 1, "Updateable" },
1322 { 0, NULL }
1325 static const value_string drda_generated_vals[] = {
1326 { 0, "None of the other values of this field apply" },
1327 { 1, "Data for this column is always generated using an expression" },
1328 { 2, "Data for this identity column is always generated" },
1329 { 3, "Data for this ROWID column is always generated" },
1330 { 4, "Data for this identity column is generated by default" },
1331 { 5, "Data for this ROWID column is generated by default" },
1332 { 6, "Data for this row change timestamp column is always generated" },
1333 { 7, "Data for this row change timestamp column is generated by default" },
1334 { 0, NULL }
1337 static const value_string drda_parmmode_vals[] = {
1338 { 0, "Not for use with a CALL statement" },
1339 { 1, "Input-only parameter" },
1340 { 2, "Input and output parameter" },
1341 { 4, "Output-only parameter" },
1342 { 0, NULL }
1345 static const value_string drda_xoptlck_vals[] = {
1346 { 0, "Column not injected because of optimistic locking" },
1347 { 1, "Row change token column was injected because optimistic locking was requested" },
1348 { 2, "RID column was injected because optimistic locking was requested" },
1349 { 0, NULL }
1352 static const value_string drda_hidden_vals[] = {
1353 { 0, "Not a hidden column" },
1354 { 1, "Hidden column" },
1355 { 0, NULL }
1358 static int
1359 dissect_drda_sqldxgrp(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void *data)
1361 proto_item *ti;
1362 proto_tree *subtree;
1363 int offset = 0;
1365 drda_pdu_info_t *pdu_info = (drda_pdu_info_t*)data;
1366 uint32_t null_ind;
1368 ti = proto_tree_add_item(tree, hf_drda_sqldxgrp, tvb, offset, 1, ENC_NA);
1369 subtree = proto_item_add_subtree(ti, ett_drda_sqldxgrp);
1370 proto_tree_add_item_ret_uint(subtree, hf_drda_null_ind, tvb, offset, 1, ENC_NA, &null_ind);
1371 offset++;
1372 if ((int8_t)null_ind >= 0) {
1373 offset = dissect_fdoca_integer(subtree, hf_drda_sqlxkeymem, tvb, offset, 2, pdu_info, NULL);
1374 offset = dissect_fdoca_integer(subtree, hf_drda_sqlxupdateable, tvb, offset, 2, pdu_info, NULL);
1375 offset = dissect_fdoca_integer(subtree, hf_drda_sqlxgenerated, tvb, offset, 2, pdu_info, NULL);
1376 offset = dissect_fdoca_integer(subtree, hf_drda_sqlxparmmode, tvb, offset, 2, pdu_info, NULL);
1377 if (pdu_info->sqlam >= 9) {
1378 offset = dissect_fdoca_integer(subtree, hf_drda_sqlxoptlck, tvb, offset, 2, pdu_info, NULL);
1379 offset = dissect_fdoca_integer(subtree, hf_drda_sqlxhidden, tvb, offset, 2, pdu_info, NULL);
1381 offset = dissect_fdoca_vcs(subtree, hf_drda_rdbnam, tvb, offset, pdu_info);
1382 offset = dissect_fdoca_vcm(subtree, hf_drda_sqlxcorname, tvb, offset, pdu_info);
1383 offset = dissect_fdoca_vcs(subtree, hf_drda_sqlxcorname, tvb, offset, pdu_info);
1384 offset = dissect_fdoca_vcm(subtree, hf_drda_sqlxbasename, tvb, offset, pdu_info);
1385 offset = dissect_fdoca_vcs(subtree, hf_drda_sqlxbasename, tvb, offset, pdu_info);
1386 offset = dissect_fdoca_vcm(subtree, hf_drda_sqlxschema, tvb, offset, pdu_info);
1387 offset = dissect_fdoca_vcs(subtree, hf_drda_sqlxschema, tvb, offset, pdu_info);
1388 offset = dissect_fdoca_vcm(subtree, hf_drda_sqlxname, tvb, offset, pdu_info);
1389 offset = dissect_fdoca_vcs(subtree, hf_drda_sqlxname, tvb, offset, pdu_info);
1390 if (pdu_info->sqlam >= 10) {
1391 offset = dissect_fdoca_vcm(subtree, hf_drda_sqlxmodule, tvb, offset, pdu_info);
1392 offset = dissect_fdoca_vcs(subtree, hf_drda_sqlxmodule, tvb, offset, pdu_info);
1395 proto_item_set_end(ti, tvb, offset);
1396 return offset;
1399 /* Appendix D of C112. Note that some strings have multiple codes that
1400 * map to them.
1402 static const value_string drda_fcode_vals[] = {
1404 { 1, "ALLOCATE CURSOR" },
1405 { 2, "ALLOCATE DESCRIPTOR" },
1406 { 3, "ALTER DOMAIN" },
1407 { 4, "ALTER TABLE" },
1408 { 6, "CREATE ASSERTION" },
1409 { 7, "CALL" },
1410 { 8, "CREATE CHARACTER SET" },
1411 { 9, "CLOSE CURSOR" },
1412 { 11, "CREATE COLLATION" },
1413 { 12, "COMMIT WORK" },
1414 { 13, "CONNECT" },
1415 { 15, "DEALLOCATE DESCRIPTOR" },
1416 { 16, "DEALLOCATE PREPARE" },
1417 { 17, "ALTER ROUTINE" },
1418 { 18, "DELETE CURSOR" },
1419 { 19, "DELETE WHERE" },
1420 { 20, "DESCRIBE" },
1421 { 21, "SELECT" },
1422 { 22, "DISCONNECT" },
1423 { 23, "CREATE DOMAIN" },
1424 { 24, "DROP ASSERTION" },
1425 { 25, "DROP CHARACTER SET" },
1426 { 26, "DROP COLLATION" },
1427 { 27, "DROP DOMAIN" },
1428 { 29, "DROP ROLE" },
1429 { 30, "DROP ROUTINE" },
1430 { 31, "DROP SCHEMA" },
1431 { 32, "DROP TABLE" },
1432 { 33, "DROP TRANSLATION" },
1433 { 34, "DROP TRIGGER" },
1434 { 35, "DROP TYPE" },
1435 { 36, "DROP VIEW" },
1436 { 37, "DYNAMIC CLOSE" },
1437 { 38, "DYNAMIC DELETE CURSOR" },
1438 { 39, "DYNAMIC FETCH" },
1439 { 40, "DYNAMIC OPEN" },
1440 { 41, "SELECT" },
1441 { 42, "DYNAMIC UPDATE CURSOR" },
1442 { 43, "EXECUTE IMMEDIATE" },
1443 { 44, "EXECUTE" },
1444 { 45, "FETCH" },
1445 { 47, "GET DESCRIPTOR" },
1446 { 48, "GRANT" },
1447 { 49, "GRANT ROLE" },
1448 { 50, "INSERT" },
1449 { 53, "OPEN" },
1450 { 54, "DYNAMIC DELETE CURSOR" },
1451 { 55, "DYNAMIC UPDATE CURSOR" },
1452 { 56, "PREPARE" },
1453 { 57, "RELEASE SAVEPOINT" },
1454 { 58, "RETURN" },
1455 { 59, "REVOKE" },
1456 { 60, "ALTER TYPE" },
1457 { 66, "SET CATALOG" },
1458 { 69, "SET CURRENT_PATH" },
1459 { 70, "SET DESCRIPTOR" },
1460 { 72, "SET NAMES" },
1461 { 74, "SET SCHEMA" },
1462 { 85, "SELECT CURSOR" },
1463 { 98, "FREE LOCATOR" },
1464 { 99, "HOLD LOCATOR" },
1465 {101, "DECLARE CURSOR" },
1466 {115, "DROP ORDERING" },
1467 {116, "DROP TRANSFORM" },
1468 {118, "SET TRANSFORM GROUP" },
1469 { 0, NULL }
1472 static const value_string drda_hold_vals[] = {
1474 { 0, "No cursor exists, or cursor defined without WITH HOLD clause" },
1475 { 1, "Cursor defined using WITH HOLD clause" },
1476 {-1, "Unknown if cursor was defined using WITH HOLD clause" },
1477 { 0, NULL }
1480 static const value_string drda_return_vals[] = {
1482 { 0, "Statement is not a query" },
1483 { 1, "Cursor defined using the WITH RETURN CLIENT clause" },
1484 { 2, "Cursor defined using the WITH RETURN CALLER clause" },
1485 {-1, "Unknown if cursor is intended to be used as a result set that will be returned from a procedure" },
1486 { 0, NULL }
1489 static const value_string drda_scroll_vals[] = {
1491 { 0, "No cursor exists, or not scrollable" },
1492 { 1, "Cursor defined using SCROLL clause" },
1493 {-1, "Cursor exists, but scrollability unknown" },
1494 { 0, NULL }
1497 static const value_string drda_sensitive_vals[] = {
1499 { 0, "No cursor exists" },
1500 { 1, "Cursor defined as SENSITIVE DYNAMIC" },
1501 { 2, "Cursor defined as SENSITIVE STATIC" },
1502 { 3, "Cursor defined as INSENSITIVE" },
1503 { 4, "Cursor defined with PARTIAL SENSITIVITY and STATIC size and ordering" },
1504 { 5, "Cursor defined with PARTIAL SENSITIVITY and DYNAMIC size and ordering" },
1505 {-1, "Cursor exists, but sensitivity unknown" },
1506 { 0, NULL }
1509 static const value_string drda_keytype_vals[] = {
1511 { 0, "Statement is not a query, or no columns are members of a key" },
1512 { 1, "Select list includes all columns of the primary key of the base table referenced by the query" },
1513 { 2, "Table reference by the query does not have a primary key, but the select list includes a set of columns that are defined as the preferred candidate key" },
1514 { 0, NULL }
1517 static const value_string drda_doptlck_vals[] = {
1519 { 0, "Optimistic locking columns not injected" },
1520 { 1, "Optimistic locking columns injected, but might not have the granularity to guarantee no false negatives" },
1521 { 2, "Optimistic locking columns injected, guaranteeing no false negatives" },
1522 { 0, NULL }
1525 static int
1526 dissect_drda_sqldhgrp(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void *data)
1528 proto_item *sqldhgrp_ti;
1529 proto_tree *sqldhgrp_tree;
1530 int offset = 0, len;
1532 uint32_t null_ind;
1534 drda_pdu_info_t *pdu_info = (drda_pdu_info_t*)data;
1536 sqldhgrp_ti = proto_tree_add_item(tree, hf_drda_sqldhgrp, tvb, offset, 1, ENC_NA);
1537 sqldhgrp_tree = proto_item_add_subtree(sqldhgrp_ti, ett_drda_sqldhgrp);
1538 proto_tree_add_item_ret_uint(sqldhgrp_tree, hf_drda_null_ind, tvb, offset, 1, ENC_NA, &null_ind);
1539 offset++;
1540 if ((int8_t)null_ind >= 0) {
1541 len = 2;
1542 offset = dissect_fdoca_integer(sqldhgrp_tree, hf_drda_sqldhold, tvb, offset, len, pdu_info, NULL);
1543 offset = dissect_fdoca_integer(sqldhgrp_tree, hf_drda_sqldreturn, tvb, offset, len, pdu_info, NULL);
1544 offset = dissect_fdoca_integer(sqldhgrp_tree, hf_drda_sqldscroll, tvb, offset, len, pdu_info, NULL);
1545 offset = dissect_fdoca_integer(sqldhgrp_tree, hf_drda_sqldsensitive, tvb, offset, len, pdu_info, NULL);
1546 offset = dissect_fdoca_integer(sqldhgrp_tree, hf_drda_sqldfcode, tvb, offset, len, pdu_info, NULL);
1547 offset = dissect_fdoca_integer(sqldhgrp_tree, hf_drda_sqldkeytype, tvb, offset, len, pdu_info, NULL);
1548 if (pdu_info->sqlam >= 9) {
1549 offset = dissect_fdoca_integer(sqldhgrp_tree, hf_drda_sqldoptlck, tvb, offset, len, pdu_info, NULL);
1551 offset = dissect_fdoca_vcs(sqldhgrp_tree, hf_drda_rdbnam, tvb, offset, pdu_info);
1552 offset = dissect_fdoca_vcm(sqldhgrp_tree, hf_drda_sqldschema, tvb, offset, pdu_info);
1553 offset = dissect_fdoca_vcs(sqldhgrp_tree, hf_drda_sqldschema, tvb, offset, pdu_info);
1554 if (pdu_info->sqlam >= 10) {
1555 offset = dissect_fdoca_vcm(sqldhgrp_tree, hf_drda_sqldmodule, tvb, offset, pdu_info);
1556 offset = dissect_fdoca_vcs(sqldhgrp_tree, hf_drda_sqldmodule, tvb, offset, pdu_info);
1559 proto_item_set_end(sqldhgrp_ti, tvb, offset);
1561 return offset;
1564 static const value_string drda_unnamed_vals[] = {
1566 { 0, "Column name not generated by the RDB" },
1567 { 1, "Column name generated by the RDB" },
1568 { 0, NULL }
1571 static int
1572 dissect_drda_sqldoptgrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
1574 proto_item *sqldoptgrp_ti, *expert_ti;
1575 proto_tree *subtree;
1576 int offset = 0;
1578 uint32_t null_ind;
1580 drda_pdu_info_t *pdu_info = (drda_pdu_info_t*)data;
1582 sqldoptgrp_ti = proto_tree_add_item(tree, hf_drda_sqldoptgrp, tvb, offset, 1, ENC_NA);
1583 subtree = proto_item_add_subtree(sqldoptgrp_ti, ett_drda_sqldoptgrp);
1584 proto_tree_add_item_ret_uint(subtree, hf_drda_null_ind, tvb, offset, 1, ENC_NA, &null_ind);
1585 offset++;
1586 if ((int8_t)null_ind >= 0) {
1587 offset = dissect_fdoca_integer(subtree, hf_drda_sqlunnamed, tvb, offset, 2, pdu_info, NULL);
1588 offset = dissect_fdoca_vcm(subtree, hf_drda_sqlname, tvb, offset, pdu_info);
1589 offset = dissect_fdoca_vcs(subtree, hf_drda_sqlname, tvb, offset, pdu_info);
1590 offset = dissect_fdoca_vcm(subtree, hf_drda_sqllabel, tvb, offset, pdu_info);
1591 offset = dissect_fdoca_vcs(subtree, hf_drda_sqllabel, tvb, offset, pdu_info);
1592 offset = dissect_fdoca_vcm(subtree, hf_drda_sqlcomments, tvb, offset, pdu_info);
1593 offset = dissect_fdoca_vcs(subtree, hf_drda_sqlcomments, tvb, offset, pdu_info);
1595 offset += dissect_drda_sqludtgrp(tvb_new_subset_remaining(tvb, offset), pinfo, subtree, data);
1596 offset += dissect_drda_sqldxgrp(tvb_new_subset_remaining(tvb, offset), pinfo, subtree, data);
1597 if (pdu_info->sqlam >= 10) {
1598 expert_ti = proto_tree_add_item_ret_uint(subtree, hf_drda_null_ind, tvb, offset, 1, ENC_NA, &null_ind);
1599 offset++;
1600 if ((int8_t)null_ind >= 0) {
1601 expert_add_info(pinfo, expert_ti, &ei_drda_undecoded);
1602 /* XXX: What is this? It's not in Version 5 of the spec. */
1606 proto_item_set_end(sqldoptgrp_ti, tvb, offset);
1607 return offset;
1610 static const value_string drda_sqltype_vals[] = {
1612 { 384, "DATE" },
1613 { 385, "DATE (NULLABLE)" },
1614 { 388, "TIME" },
1615 { 389, "TIME (NULLABLE)" },
1616 { 392, "TIMESTAMP" },
1617 { 393, "TIMESTAMP (NULLABLE)" },
1618 { 396, "DATALINK" },
1619 { 397, "DATALINK (NULLABLE)" },
1620 { 404, "BLOB" },
1621 { 405, "BLOB (NULLABLE)" },
1622 { 408, "CLOB" },
1623 { 409, "CLOB (NULLABLE)" },
1624 { 412, "DBCLOB" },
1625 { 413, "DBCLOB (NULLABLE)" },
1626 { 448, "VARCHAR" },
1627 { 449, "VARCHAR (NULLABLE)" },
1628 { 452, "CHAR" },
1629 { 453, "CHAR (NULLABLE)" },
1630 { 456, "LONG VARCHAR" },
1631 { 457, "LONG VARCHAR (NULLABLE)" },
1632 { 460, "NULL-TERMINATED CHAR" },
1633 { 461, "NULL-TERMINATED CHAR (NULLABLE)" },
1634 { 464, "VARGRAPHIC" },
1635 { 465, "VARGRAPHIC (NULLABLE)" },
1636 { 468, "GRAPHIC" },
1637 { 469, "GRAPHIC (NULLABLE)" },
1638 { 472, "LONG VARGRAPHIC" },
1639 { 473, "LONG VARGRAPHIC (NULLABLE)" },
1640 { 476, "PASCAL L STRING" },
1641 { 477, "PASCAL L STRING (NULLABLE)" },
1642 { 480, "FLOAT" },
1643 { 481, "FLOAT (NULLABLE)" },
1644 { 484, "FIXED DECIMAL" },
1645 { 485, "FIXED DECIMAL (NULLABLE)" },
1646 { 488, "ZONED DECIMAL" },
1647 { 489, "ZONED DECIMAL (NULLABLE)" },
1648 { 492, "BIGINT" },
1649 { 493, "BIGINT (NULLABLE)" },
1650 { 496, "INTEGER" },
1651 { 497, "INTEGER (NULLABLE)" },
1652 { 500, "SMALLINT" },
1653 { 501, "SMALLINT (NULLABLE)" },
1654 { 504, "NUMERIC CHAR" },
1655 { 505, "NUMERIC CHAR (NULLABLE)" },
1656 { 904, "ROWID" },
1657 { 905, "ROWID (NULLABLE)" },
1658 { 908, "VARBINARY" },
1659 { 909, "VARBINARY (NULLABLE)" },
1660 { 912, "BINARY" },
1661 { 913, "BINARY (NULLABLE)" },
1662 { 960, "BLOB LOCATOR" },
1663 { 961, "BLOB LOCATOR (NULLABLE)" },
1664 { 964, "CLOB LOCATOR" },
1665 { 965, "CLOB LOCATOR (NULLABLE)" },
1666 { 968, "DBCLOB LOCATOR" },
1667 { 969, "DBCLOB LOCATOR (NULLABLE)" },
1668 { 972, "RESULT SET LOCATOR" },
1669 { 973, "RESULT SET LOCATOR (NULLABLE)" },
1670 { 988, "XML" },
1671 { 989, "XML (NULLABLE)" },
1672 { 996, "DECFLOAT" },
1673 { 997, "DECFLOAT (NULLABLE)" },
1674 {2436, "BOOLEAN" },
1675 {2437, "BOOLEAN (NULLABLE)" },
1676 {2444, "CURSOR TYPE" },
1677 {2445, "CURSOR TYPE (NULLABLE)" },
1678 {2448, "TIMESTAMP WITH TIME ZONE" },
1679 {2449, "TIMESTAMP WITH TIME ZONE (NULLABLE)" },
1680 { 0, NULL }
1683 static int
1684 dissect_drda_sqldagrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
1686 proto_item *sqldagrp_ti;
1687 proto_tree *subtree;
1688 int offset = 0;
1690 //uint32_t null_ind;
1692 drda_pdu_info_t *pdu_info = (drda_pdu_info_t*)data;
1694 sqldagrp_ti = proto_tree_add_item(tree, hf_drda_sqldagrp, tvb, offset, 1, ENC_NA);
1695 subtree = proto_item_add_subtree(sqldagrp_ti, ett_drda_sqldagrp);
1697 offset = dissect_fdoca_integer(subtree, hf_drda_sqlprecision, tvb, offset, 2, pdu_info, NULL);
1698 offset = dissect_fdoca_integer(subtree, hf_drda_sqlscale, tvb, offset, 2, pdu_info, NULL);
1699 if (pdu_info->sqlam >= 6) {
1700 offset = dissect_fdoca_integer64(subtree, hf_drda_sqllength, tvb, offset, 8, pdu_info, NULL);
1701 } else {
1702 offset = dissect_fdoca_integer(subtree, hf_drda_sqllength32, tvb, offset, 4, pdu_info, NULL);
1704 offset = dissect_fdoca_integer(subtree, hf_drda_sqltype, tvb, offset, 2, pdu_info, NULL);
1705 proto_tree_add_item(subtree, hf_drda_ccsid, tvb, offset, 2, ENC_BIG_ENDIAN);
1706 offset += 2;
1707 if (pdu_info->sqlam >= 9) {
1708 offset = dissect_fdoca_integer64(subtree, hf_drda_sqlarrextent, tvb, offset, 8, pdu_info, NULL);
1710 if (pdu_info->sqlam >= 10) {
1711 proto_tree_add_expert(subtree, pinfo, &ei_drda_undecoded, tvb, offset, 2);
1712 /* XXX: What is this? It's not in Version 5 of the spec. */
1713 offset += 2;
1717 if (pdu_info->sqlam >= 7) {
1718 offset += dissect_drda_sqldoptgrp(tvb_new_subset_remaining(tvb, offset), pinfo, subtree, data);
1719 } else {
1720 offset = dissect_fdoca_vcm(subtree, hf_drda_sqlname, tvb, offset, pdu_info);
1721 offset = dissect_fdoca_vcs(subtree, hf_drda_sqlname, tvb, offset, pdu_info);
1722 offset = dissect_fdoca_vcm(subtree, hf_drda_sqllabel, tvb, offset, pdu_info);
1723 offset = dissect_fdoca_vcs(subtree, hf_drda_sqllabel, tvb, offset, pdu_info);
1724 offset = dissect_fdoca_vcm(subtree, hf_drda_sqlcomments, tvb, offset, pdu_info);
1725 offset = dissect_fdoca_vcs(subtree, hf_drda_sqlcomments, tvb, offset, pdu_info);
1726 if (pdu_info->sqlam == 6) {
1727 offset += dissect_drda_sqludtgrp(tvb_new_subset_remaining(tvb, offset), pinfo, subtree, data);
1730 proto_item_set_end(sqldagrp_ti, tvb, offset);
1731 return offset;
1734 static int
1735 dissect_drda_sqlcard(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
1737 /* For a description of these fields (at least on DB2), see:
1738 * https://www.ibm.com/docs/en/db2-for-zos/12?topic=sqlca-description-fields
1741 proto_item *ti, *sqlcard_ti;
1742 proto_tree *subtree, *sqlcard_tree;
1743 int offset = 0, len = 4;
1745 uint32_t null_ind, length;
1747 drda_pdu_info_t *pdu_info = (drda_pdu_info_t*)data;
1749 sqlcard_ti = proto_tree_add_item(tree, hf_drda_sqlcagrp, tvb, offset, 1, ENC_NA);
1750 sqlcard_tree = proto_item_add_subtree(sqlcard_ti, ett_drda_sqlcagrp);
1751 proto_tree_add_item_ret_uint(sqlcard_tree, hf_drda_null_ind, tvb, offset, 1, ENC_NA, &null_ind);
1752 offset++;
1753 if ((int8_t)null_ind >= 0) {
1754 len = 4;
1755 offset = dissect_fdoca_integer(sqlcard_tree, hf_drda_sqlcode, tvb, offset, len, pdu_info, NULL);
1756 len = 5;
1757 offset = dissect_fdoca_fcs(sqlcard_tree, hf_drda_sqlstate, tvb, offset, len, pdu_info);
1758 len = 8;
1759 offset = dissect_fdoca_fcs(sqlcard_tree, hf_drda_sqlerrproc, tvb, offset, len, pdu_info);
1761 /* SQLCAXGRP (nullable) */
1762 proto_tree_add_item_ret_uint(sqlcard_tree, hf_drda_null_ind, tvb, offset, 1, ENC_NA, &null_ind);
1763 offset++;
1764 if ((int8_t)null_ind >= 0) {
1765 ti = proto_tree_add_item(sqlcard_tree, hf_drda_sqlcaxgrp, tvb, offset, 35, ENC_NA);
1766 subtree = proto_item_add_subtree(ti, ett_drda_sqlcaxgrp);
1767 /* Earlier than SQLAM Level 7, the RDBName follows here, and is
1768 * a fixed string field of length 18. At SQLAM Level 7 and
1769 * higher, the SQLRDBNAME is a variable character field and
1770 * comes later, after the SQLWARN fields.
1772 if (pdu_info->sqlam < 7) {
1773 offset = dissect_fdoca_fcs(subtree, hf_drda_rdbnam, tvb, offset, 18, pdu_info);
1775 len = 4;
1776 offset = dissect_fdoca_integer(subtree, hf_drda_sqlerrd1, tvb, offset, len, pdu_info, NULL);
1777 offset = dissect_fdoca_integer(subtree, hf_drda_sqlerrd2, tvb, offset, len, pdu_info, NULL);
1778 offset = dissect_fdoca_integer(subtree, hf_drda_sqlerrd3, tvb, offset, len, pdu_info, NULL);
1779 offset = dissect_fdoca_integer(subtree, hf_drda_sqlerrd4, tvb, offset, len, pdu_info, NULL);
1780 offset = dissect_fdoca_integer(subtree, hf_drda_sqlerrd5, tvb, offset, len, pdu_info, NULL);
1781 offset = dissect_fdoca_integer(subtree, hf_drda_sqlerrd6, tvb, offset, len, pdu_info, NULL);
1782 len = 1;
1783 offset = dissect_fdoca_fcs(subtree, hf_drda_sqlwarn0, tvb, offset, len, pdu_info);
1784 offset = dissect_fdoca_fcs(subtree, hf_drda_sqlwarn1, tvb, offset, len, pdu_info);
1785 offset = dissect_fdoca_fcs(subtree, hf_drda_sqlwarn2, tvb, offset, len, pdu_info);
1786 offset = dissect_fdoca_fcs(subtree, hf_drda_sqlwarn3, tvb, offset, len, pdu_info);
1787 offset = dissect_fdoca_fcs(subtree, hf_drda_sqlwarn4, tvb, offset, len, pdu_info);
1788 offset = dissect_fdoca_fcs(subtree, hf_drda_sqlwarn5, tvb, offset, len, pdu_info);
1789 offset = dissect_fdoca_fcs(subtree, hf_drda_sqlwarn6, tvb, offset, len, pdu_info);
1790 offset = dissect_fdoca_fcs(subtree, hf_drda_sqlwarn7, tvb, offset, len, pdu_info);
1791 offset = dissect_fdoca_fcs(subtree, hf_drda_sqlwarn8, tvb, offset, len, pdu_info);
1792 offset = dissect_fdoca_fcs(subtree, hf_drda_sqlwarn9, tvb, offset, len, pdu_info);
1793 offset = dissect_fdoca_fcs(subtree, hf_drda_sqlwarna, tvb, offset, len, pdu_info);
1794 if (pdu_info->sqlam >= 7) {
1795 offset = dissect_fdoca_vcs(subtree, hf_drda_rdbnam, tvb, offset, pdu_info);
1797 /* SQLERRMSG_m, a variable character string using the mixed
1798 * character CCSID. On DB2, contains one or more tokens,
1799 * separated by X'FF', that are substituted for variables
1800 * in the descriptions of error conditions.
1802 proto_tree_add_item_ret_uint(subtree, hf_drda_param_length, tvb, offset, 2, ENC_BIG_ENDIAN, &length);
1803 offset += 2;
1804 int end_offset;
1805 while ((end_offset = tvb_find_uint8(tvb, offset, length, 0xFF)) != -1) {
1806 proto_tree_add_item(subtree, hf_drda_sqlerrmsg, tvb, offset, end_offset - offset, pdu_info->mbc);
1807 length -= (end_offset + 1 - offset);
1808 offset = end_offset + 1;
1810 proto_tree_add_item(subtree, hf_drda_sqlerrmsg, tvb, offset, length, pdu_info->mbc);
1811 offset += length;
1813 /* SQLERRMSG_s - same but using the single byte CCSID. Only one
1814 * of these should have nonzero length.
1816 proto_tree_add_item_ret_uint(subtree, hf_drda_param_length, tvb, offset, 2, ENC_BIG_ENDIAN, &length);
1817 offset += 2;
1818 while ((end_offset = tvb_find_uint8(tvb, offset, length, 0xFF)) != -1) {
1819 proto_tree_add_item(subtree, hf_drda_sqlerrmsg, tvb, offset, end_offset - offset, pdu_info->sbc);
1820 length -= (end_offset + 1 - offset);
1821 offset = end_offset + 1;
1823 proto_tree_add_item(subtree, hf_drda_sqlerrmsg, tvb, offset, length, pdu_info->sbc);
1824 offset += length;
1825 proto_item_set_end(ti, tvb, offset);
1828 if (pdu_info->sqlam >= 7) {
1829 offset += dissect_drda_sqldiaggrp(tvb_new_subset_remaining(tvb, offset), pinfo, sqlcard_tree, data);
1831 } else {
1832 /* DRDA, Version 4, Volume 1: 5.6.4.6 SQLCAGRP:
1833 * "A null SQLCA indicates everything is fine: SQLSTATE='00000'"
1835 ti = proto_tree_add_int(sqlcard_tree, hf_drda_sqlcode, tvb, offset, 0, 0);
1836 proto_item_set_generated(ti);
1837 ti = proto_tree_add_string(sqlcard_tree, hf_drda_sqlstate, tvb, offset, 0, "00000");
1838 proto_item_set_generated(ti);
1840 proto_item_set_end(sqlcard_ti, tvb, offset);
1842 return offset;
1845 static int
1846 dissect_drda_sqldard(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void *data)
1848 int offset = 0;
1849 drda_pdu_info_t *pdu_info = (drda_pdu_info_t*)data;
1851 uint32_t numrows;
1853 offset = dissect_drda_sqlcard(tvb, pinfo, tree, data);
1855 if (pdu_info->sqlam >= 7) {
1856 offset += dissect_drda_sqldhgrp(tvb_new_subset_remaining(tvb, offset), pinfo, tree, data);
1858 offset = dissect_fdoca_integer(tree, hf_drda_sqlnum, tvb, offset, 2, pdu_info, &numrows);
1859 for (uint32_t i = 0; i < numrows; ++i) {
1860 offset += dissect_drda_sqldagrp(tvb_new_subset_remaining(tvb, offset), pinfo, tree, data);
1862 return offset;
1865 static int
1866 dissect_drda_undecoded(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
1868 proto_tree_add_expert(tree, pinfo, &ei_drda_undecoded, tvb, 0, -1);
1869 return tvb_captured_length(tvb);
1872 static const value_string drda_rlsconv_vals[] = {
1873 { 0xF0, "NO" }, /* EBCDIC '0' */
1874 { 0xF1, "TERMINATE" }, /* EBCDIC '1' */
1875 { 0xF2, "REUSE" }, /* EBCDIC '2' */
1876 { 0xF3, "NO_KDO - Presence of keep dynamic sections" }, /* EBCDIC '3' */
1877 { 0, NULL }
1880 static int
1881 dissect_drda_rlsconv(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void *data _U_)
1883 proto_tree_add_item(tree, hf_drda_rlsconv, tvb, 0, 1, ENC_NA);
1884 return 1;
1887 static const value_string drda_secmec_vals[] = {
1888 { 1, "DCESEC - Distributed Computing Environment" },
1889 { 3, "USRIDPWD - User ID and Password" },
1890 { 4, "UDRIDONL - User ID Only" },
1891 { 5, "USRIDNWPWD - User ID, Password, and New Password" },
1892 { 6, "USRSBSPWD - User ID with Substitute Password" },
1893 { 7, "USRENCPWD - User ID with Encrypted Password" },
1894 { 8, "USRSSBPWD - User ID with Strong Password Substitute" },
1895 { 9, "EUSRIDPWD - Encrypted User ID and Password" },
1896 {10, "EUSRIDNWPWD - Encrypted User ID, Password, New Password" },
1897 {11, "KERSEC - Kerberos Security" },
1898 {12, "EUSRIDDTA - Encrypted User ID and Security-Sensitive Data" },
1899 {13, "EUSRPWDDTA - Encrypted User ID, Password, and Security-Sensitive Data" },
1900 {14, "EUSRNPWDDTA - Encrypted User ID, Password, New Password, and Security-Sensitive Data" },
1901 {15, "PLGIN - Plug-in Security" },
1902 {16, "EUSRIDONL - Encrypted User ID Only" },
1903 { 0, NULL }
1906 static int
1907 dissect_drda_secmec(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void *data _U_)
1909 /* REPEATABLE */
1910 int offset = 0;
1911 while (tvb_reported_length_remaining(tvb, offset) >= 2) {
1912 proto_tree_add_item(tree, hf_drda_secmec, tvb, offset, 2, ENC_BIG_ENDIAN);
1913 offset += 2;
1915 return offset;
1918 static const value_string drda_svrcod_vals[] = {
1919 { 0, "INFO - Information Only" },
1920 { 4, "WARNING - Warning" },
1921 { 8, "ERROR - Error" },
1922 { 16, "SEVERE - Severe Error" },
1923 { 32, "ACCDMG - Access Damage" },
1924 { 64, "PRMDMG - Permanent Damage" },
1925 {128, "SESDMG - Session Damage" },
1926 { 0, NULL }
1929 static int
1930 dissect_drda_sectkn(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void *data _U_)
1932 proto_tree_add_item(tree, hf_drda_sectkn, tvb, 0, tvb_reported_length(tvb), ENC_NA);
1933 return tvb_reported_length(tvb);
1936 static int
1937 dissect_drda_svrcod(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void *data _U_)
1939 proto_tree_add_item(tree, hf_drda_svrcod, tvb, 0, 2, ENC_BIG_ENDIAN);
1940 return 2;
1943 static const value_string drda_secchkcd_vals[] = {
1944 {0x00, "The security information is correct and acceptable." },
1945 {0x01, "SECMEC value not supported." },
1946 {0x02, "DCE information status issued." },
1947 {0x03, "DCE retryable error." },
1948 {0x04, "DCE non-retryable error." },
1949 {0x05, "GSSAPI informational status issued." },
1950 {0x06, "GSSAPI retryable error." },
1951 {0x07, "GSSAPI non-retryable error." },
1952 {0x08, "Local Security Service informational status issued." },
1953 {0x09, "Local Security Service retryable error." },
1954 {0x0A, "Local Security Service non-retryable error." },
1955 {0x0B, "SECTKN missing when it is required or it is invalid." },
1956 {0x0E, "Password expired." },
1957 {0x0F, "Password invalid." },
1958 {0x10, "Password missing." },
1959 {0x12, "User ID missing." },
1960 {0x13, "User ID invalid." },
1961 {0x14, "User ID revoked." },
1962 {0x15, "New Password invalid." },
1963 {0x16, "Authentication failed because of connectivity restrictions enforced by the security plug-in." },
1964 {0x17, "Invalid GSS-API server credential." },
1965 {0x18, "GSS-API server credential expired on the database server." },
1966 {0x19, "Continue - require more security context information for authentication." },
1967 { 0, NULL }
1970 static int
1971 dissect_drda_secchkcd(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void *data _U_)
1973 proto_tree_add_item(tree, hf_drda_secchkcd, tvb, 0, 1, ENC_BIG_ENDIAN);
1974 return 1;
1977 /* A few common CCSIDs, many more are at:
1978 * https://www.ibm.com/docs/en/i/7.3?topic=information-ccsid-values-defined-i
1979 * https://web.archive.org/web/20160304082631/http://www-01.ibm.com/software/globalization/g11n-res.html
1981 static const value_string drda_ccsid_vals[] = {
1982 { 0, "Use default value" },
1983 { 37, "IBM037" }, /* EBCDIC US Latin-1 */
1984 { 367, "US-ASCII" },
1985 { 500, "IBM500" }, /* EBCDIC International Latin-1 */
1986 { 819, "ISO-8859-1" },
1987 { 850, "IBM850" }, /* DOS Latin-1 */
1988 { 1200, "UTF-16" }, /* UTF-16BE; UTF-16LE is 1202 */
1989 { 1202, "UTF-16LE" },
1990 { 1208, "UTF-8" },
1991 { 65535, "Requested CCSID unsupported" },
1992 { 0, NULL }
1995 static unsigned
1996 ccsid_to_encoding(uint32_t ccsid)
1998 switch (ccsid) {
2000 case 0:
2001 case 500:
2002 case 65535:
2003 return ENC_EBCDIC_CP500;
2004 case 37:
2005 return ENC_EBCDIC_CP037;
2006 case 367:
2007 return ENC_ASCII;
2008 case 819:
2009 return ENC_ISO_8859_1;
2010 case 850:
2011 return ENC_ASCII; /* XXX: CP 850 not yet supported; CP 437 is closer, but ASCII safer */
2012 case 1200:
2013 return ENC_UTF_16|ENC_BIG_ENDIAN;
2014 case 1202:
2015 return ENC_UTF_16|ENC_LITTLE_ENDIAN;
2016 case 1208:
2017 return ENC_UTF_8;
2018 default:
2019 return ENC_UTF_8;
2023 static int
2024 dissect_drda_ccsid(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void *data)
2026 drda_pdu_info_t *pdu_info = (drda_pdu_info_t*)data;
2027 uint32_t ccsid;
2029 proto_tree_add_item_ret_uint(tree, hf_drda_ccsid, tvb, 0, 2, ENC_BIG_ENDIAN, &ccsid);
2030 switch (pinfo->match_uint) {
2031 case DRDA_CP_CCSIDSBC:
2032 pdu_info->sbc = ccsid_to_encoding(ccsid);
2033 break;
2034 case DRDA_CP_CCSIDMBC:
2035 pdu_info->mbc = ccsid_to_encoding(ccsid);
2036 break;
2037 default:
2038 break;
2040 return 2;
2043 static int
2044 dissect_drda_monitor(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void *data _U_)
2046 static int * const monitor_fields[] = {
2047 &hf_drda_monitor_etime,
2048 &hf_drda_monitor_reserved,
2049 NULL
2052 proto_tree_add_bitmask(tree, tvb, 0, hf_drda_monitor, ett_drda_monitor,
2053 monitor_fields, ENC_BIG_ENDIAN);
2054 return 4;
2057 static int
2058 dissect_drda_etime(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void *data _U_)
2060 proto_tree_add_item(tree, hf_drda_etime, tvb, 0, 8, ENC_TIME_USECS);
2061 return 8;
2064 static int
2065 dissect_drda_respktsz(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void *data _U_)
2067 proto_tree_add_item(tree, hf_drda_respktsz, tvb, 0, 4, ENC_BIG_ENDIAN);
2068 return 4;
2071 static int
2072 dissect_drda_rdbinttkn(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void *data _U_)
2074 /* The contents of the token are unarchitected and can differe for each
2075 * target SQLAM.
2077 proto_tree_add_item(tree, hf_drda_rdbinttkn, tvb, 0, tvb_reported_length(tvb), ENC_NA);
2078 return tvb_reported_length(tvb);
2081 static int
2082 dissect_drda_rdbcmtok(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void *data _U_)
2084 proto_tree_add_item(tree, hf_drda_rdbcmtok, tvb, 0, 1, ENC_NA);
2085 return 1;
2088 static int
2089 dissect_drda_pkgnam(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
2091 proto_item *ti_length;
2092 int offset = 0;
2093 uint32_t length;
2095 /* The PKGNAMCSN can have one of the following two formats depending on the
2096 * length of the RDBNAM, RDBCOLID, and PKGID contained therein:
2097 * * RDBNAM, RDBCOLID, and PKGID all have a length of 18.
2098 * [Possibly right padded with blank spaces.]
2099 * This format of the PKGNAMCSN is identical to the sole format used prior
2100 * to DDM Level 7 where the length is fixed at 58. The use of the SCLDTALEN
2101 * is disallowed with this format.
2102 * * At least one of RDBNAM, RDBCOLID, and PKGID has a length > 18.
2103 * This format of the PKGNAMCSN mandates the SCLDTALEN to precede each of
2104 * the RDBNAM, RDBCOLID, and PKGID. With this format, the PKGNAMCSN has a
2105 * minimum length of 65 and a maximum length of 775.
2107 if (tvb_reported_length(tvb) == 54) {
2108 /* 58 - 4 bytes for the code point and length already removed. */
2109 proto_tree_add_item(tree, hf_drda_rdbnam, tvb, offset, 18, ENC_UTF_8);
2110 proto_tree_add_item(tree, hf_drda_rdbnam_ebcdic, tvb, offset, 18, ENC_EBCDIC_CP500);
2111 offset += 18;
2112 proto_tree_add_item(tree, hf_drda_rdbcolid, tvb, offset, 18, ENC_UTF_8);
2113 proto_tree_add_item(tree, hf_drda_rdbcolid_ebcdic, tvb, offset, 18, ENC_EBCDIC_CP500);
2114 offset += 18;
2115 proto_tree_add_item(tree, hf_drda_pkgid, tvb, offset, 18, ENC_UTF_8);
2116 proto_tree_add_item(tree, hf_drda_pkgid_ebcdic, tvb, offset, 18, ENC_EBCDIC_CP500);
2117 offset += 18;
2118 } else if (tvb_reported_length(tvb) > 64) {
2119 ti_length = proto_tree_add_item_ret_uint(tree, hf_drda_param_length, tvb, offset, 2, ENC_BIG_ENDIAN, &length);
2120 if (length < 18 || length > 255) {
2121 expert_add_info_format(pinfo, ti_length, &ei_drda_opcode_invalid_length, "Invalid length detected (%u): should be 18-255 bytes long", length);
2123 offset += 2;
2124 proto_tree_add_item(tree, hf_drda_rdbnam, tvb, offset, length, ENC_UTF_8);
2125 proto_tree_add_item(tree, hf_drda_rdbnam_ebcdic, tvb, offset, length, ENC_EBCDIC_CP500);
2126 offset += length;
2127 ti_length = proto_tree_add_item_ret_uint(tree, hf_drda_param_length, tvb, offset, 2, ENC_BIG_ENDIAN, &length);
2128 if (length < 18 || length > 255) {
2129 expert_add_info_format(pinfo, ti_length, &ei_drda_opcode_invalid_length, "Invalid length detected (%u): should be 18-255 bytes long", length);
2131 offset += 2;
2132 proto_tree_add_item(tree, hf_drda_rdbcolid, tvb, offset, length, ENC_UTF_8);
2133 proto_tree_add_item(tree, hf_drda_rdbcolid_ebcdic, tvb, offset, length, ENC_EBCDIC_CP500);
2134 offset += length;
2135 ti_length = proto_tree_add_item_ret_uint(tree, hf_drda_param_length, tvb, offset, 2, ENC_BIG_ENDIAN, &length);
2136 if (length < 18 || length > 255) {
2137 expert_add_info_format(pinfo, ti_length, &ei_drda_opcode_invalid_length, "Invalid length detected (%u): should be 18-255 bytes long", length);
2139 offset += 2;
2140 proto_tree_add_item(tree, hf_drda_pkgid, tvb, offset, length, ENC_UTF_8);
2141 proto_tree_add_item(tree, hf_drda_pkgid_ebcdic, tvb, offset, length, ENC_EBCDIC_CP500);
2142 offset += length;
2143 } else {
2144 proto_tree_add_expert_format(tree, pinfo, &ei_drda_opcode_invalid_length, tvb, 0, tvb_reported_length(tvb), "Invalid length; RDBNAM, RDBCOLID, and PKGID should all be length 18 or larger.");
2147 return offset;
2150 static int
2151 dissect_drda_rtnsetstt(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void *data _U_)
2153 proto_tree_add_item(tree, hf_drda_rtnsetstt, tvb, 0, 1, ENC_NA);
2154 return 1;
2157 static int
2158 dissect_drda_outexp(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void *data _U_)
2160 proto_tree_add_item(tree, hf_drda_outexp, tvb, 0, 1, ENC_NA);
2161 return 1;
2164 static int
2165 dissect_drda_pkgnamct(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
2167 int offset;
2169 offset = dissect_drda_pkgnam(tvb_new_subset_length(tvb, 0, tvb_reported_length_remaining(tvb, 8)), pinfo, tree, data);
2171 proto_tree_add_item(tree, hf_drda_pkgcnstkn, tvb, offset, 8, ENC_UTF_8);
2172 offset += 8;
2174 return offset;
2177 static int
2178 dissect_drda_pkgnamcsn(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
2180 int offset;
2182 offset = dissect_drda_pkgnamct(tvb_new_subset_length(tvb, 0, tvb_reported_length_remaining(tvb, 2)), pinfo, tree, data);
2184 proto_tree_add_item(tree, hf_drda_pkgsn, tvb, offset, 2, ENC_BIG_ENDIAN);
2185 offset += 2;
2187 return offset;
2190 static int
2191 dissect_drda_qryblksz(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void *data _U_)
2193 proto_tree_add_item(tree, hf_drda_qryblksz, tvb, 0, 4, ENC_BIG_ENDIAN);
2194 return 4;
2197 static const value_string drda_uowdsp_vals[] =
2199 { 1, "Committed"},
2200 { 2, "Rolled back"},
2201 { 0, NULL }
2204 static int
2205 dissect_drda_uowdsp(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void *data _U_)
2207 proto_tree_add_item(tree, hf_drda_uowdsp, tvb, 0, 1, ENC_NA);
2208 return 1;
2211 static int
2212 dissect_drda_rdbalwupd(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void *data _U_)
2214 proto_tree_add_item(tree, hf_drda_rdbalwupd, tvb, 0, 1, ENC_NA);
2215 return 1;
2218 static int
2219 dissect_drda_sqlcsrhld(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void *data _U_)
2221 proto_tree_add_item(tree, hf_drda_sqlcsrhld, tvb, 0, 1, ENC_NA);
2222 return 1;
2225 static const val64_string drda_qryextdtasz_vals[] =
2227 { -1, "Not limited by this parameter"},
2228 { 0, NULL }
2231 static int
2232 dissect_drda_qryextdtasz(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void *data _U_)
2234 proto_tree_add_item(tree, hf_drda_qryextdtasz, tvb, 0, 8, ENC_BIG_ENDIAN);
2235 return 8;
2238 static int
2239 dissect_drda_smldtasz(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void *data _U_)
2241 proto_tree_add_item(tree, hf_drda_smldtasz, tvb, 0, 8, ENC_BIG_ENDIAN);
2242 return 8;
2245 static int
2246 dissect_drda_meddtasz(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void *data _U_)
2248 proto_tree_add_item(tree, hf_drda_meddtasz, tvb, 0, 8, ENC_BIG_ENDIAN);
2249 return 8;
2252 static int
2253 dissect_drda_trgdftrt(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void *data _U_)
2255 proto_tree_add_item(tree, hf_drda_trgdftrt, tvb, 0, 1, ENC_BIG_ENDIAN);
2256 return 1;
2259 static int
2260 dissect_drda_rtnsqlda(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void *data _U_)
2262 proto_tree_add_item(tree, hf_drda_rtnsqlda, tvb, 0, 1, ENC_BIG_ENDIAN);
2263 return 1;
2266 static const value_string drda_qryattupd_vals[] = {
2267 { 0, "QRYUNK - Unknown or undefined for this cursor" },
2268 { 1, "QRYRDO - The cursor is read-only" },
2269 { 2, "QRYDEL - The cursor allows read and delete" },
2270 { 4, "QRYUPD - The cursor allows read, delete, and update" },
2271 { 0, NULL }
2274 static int
2275 dissect_drda_qryattupd(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void *data _U_)
2277 proto_tree_add_item(tree, hf_drda_qryattupd, tvb, 0, 1, ENC_BIG_ENDIAN);
2278 return 1;
2281 static int
2282 dissect_drda_qryrowset(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void *data _U_)
2284 proto_tree_add_item(tree, hf_drda_qryrowset, tvb, 0, 4, ENC_BIG_ENDIAN);
2285 return 4;
2288 static int
2289 dissect_drda_qryinsid(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void *data _U_)
2291 /* Query Instance Identifier (QRYINSID) uniquely identifies the instance of
2292 * a query. Its contents are implementation-specific and are unarchitected
2293 * by DDM.
2295 proto_tree_add_item(tree, hf_drda_qryinsid, tvb, 0, tvb_reported_length(tvb), ENC_NA);
2296 return tvb_reported_length(tvb);
2299 static const value_string drda_qryclsimp_vals[] = {
2300 { 0, "Target server determines whether to implicitly close the cursor or not upon SQLSTATE 02000 based on the cursor type" },
2301 { 1, "Target server must implicitly close the cursor upon SQLSTATE 02000" },
2302 { 2, "Target server must not implicitly close the cursor upon SQLSTATE 02000" },
2303 { 0, NULL }
2306 static int
2307 dissect_drda_qryclsimp(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void *data _U_)
2309 proto_tree_add_item(tree, hf_drda_qryclsimp, tvb, 0, 1, ENC_BIG_ENDIAN);
2310 return 1;
2313 static int
2314 dissect_drda_qryblkfct(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void *data _U_)
2316 proto_tree_add_item(tree, hf_drda_qryblkfct, tvb, 0, 4, ENC_BIG_ENDIAN);
2317 return 4;
2320 static int
2321 dissect_drda_maxrslcnt(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void *data _U_)
2323 proto_tree_add_item(tree, hf_drda_maxrslcnt, tvb, 0, 2, ENC_BIG_ENDIAN);
2324 return 2;
2327 static int
2328 dissect_drda_maxblkext(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void *data _U_)
2330 proto_tree_add_item(tree, hf_drda_maxblkext, tvb, 0, 2, ENC_BIG_ENDIAN);
2331 return 2;
2334 static const value_string drda_rslsetflg_extended_vals[] =
2336 { 0, "Standard SQLDA" },
2337 { 1, "Extended SQLDA" },
2338 { 2, "Light SQLDA" },
2339 { 0, NULL }
2342 static int
2343 dissect_drda_rslsetflg(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void *data _U_)
2345 static int * const rslsetflg_fields[] = {
2346 &hf_drda_rslsetflg_unused,
2347 &hf_drda_rslsetflg_dsconly,
2348 &hf_drda_rslsetflg_extended,
2349 &hf_drda_rslsetflg_reserved,
2350 NULL
2353 proto_tree_add_bitmask(tree, tvb, 0, hf_drda_rslsetflg, ett_drda_rslsetflg,
2354 rslsetflg_fields, ENC_BIG_ENDIAN);
2355 return 4;
2358 static const value_string drda_typsqlda_vals[] = {
2359 { 0, "Standard output SQLDA" },
2360 { 1, "Standard input SQLDA" },
2361 { 2, "Light output SQLDA" },
2362 { 3, "Light input SQLDA" },
2363 { 4, "Extended output SQLDA" },
2364 { 5, "Extended input SQLDA" },
2365 { 0, NULL }
2368 static int
2369 dissect_drda_typsqlda(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void *data _U_)
2371 proto_tree_add_item(tree, hf_drda_typsqlda, tvb, 0, 1, ENC_BIG_ENDIAN);
2372 return 1;
2375 static const value_string drda_outovropt_vals[] = {
2376 { 1, "OUTOVRFRS - Output Override Allowed on First CNTQRY" },
2377 { 2, "OUTOVRANY - Output Override Allowed on Any CNTQRY" },
2378 { 3, "OUTOVRNON - Output Override Not Allowed, and MINLVL is 8" },
2379 { 0, NULL }
2382 static int
2383 dissect_drda_outovropt(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void *data _U_)
2385 proto_tree_add_item(tree, hf_drda_outovropt, tvb, 0, 1, ENC_BIG_ENDIAN);
2386 return 1;
2389 static int
2390 dissect_drda_dyndtafmt(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void *data _U_)
2392 proto_tree_add_item(tree, hf_drda_dyndtafmt, tvb, 0, 1, ENC_BIG_ENDIAN);
2393 return 1;
2396 static int
2397 dissect_drda_pktobj(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void *data _U_)
2399 proto_tree_add_item(tree, hf_drda_pktobj, tvb, 0, tvb_reported_length(tvb), ENC_NA);
2400 return tvb_reported_length(tvb);
2403 static int
2404 dissect_drda_mgrlvlls(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void *data)
2406 proto_tree *drda_tree_sub;
2407 proto_item *ti;
2409 drda_pdu_info_t *pdu_info = (drda_pdu_info_t*)data;
2411 int offset = 0;
2412 uint32_t mgrlvln;
2413 uint16_t iParameterCP;
2414 int iLengthParam = 4;
2416 while (tvb_reported_length_remaining(tvb, offset) >= 2)
2418 iParameterCP = tvb_get_ntohs(tvb, offset);
2419 drda_tree_sub = proto_tree_add_subtree(tree, tvb, offset, iLengthParam,
2420 ett_drda_param, &ti, DRDA_TEXT_PARAM);
2421 proto_item_append_text(ti, " (%s)", val_to_str_ext(iParameterCP, &drda_opcode_vals_ext, "Unknown (0x%02x)"));
2422 proto_tree_add_item(drda_tree_sub, hf_drda_param_codepoint, tvb, offset, 2, ENC_BIG_ENDIAN);
2423 switch (iParameterCP) {
2425 case DRDA_CP_CCSIDMGR:
2426 case DRDA_CP_UNICODEMGR:
2427 /* The default CCSID for DRDA is 500 (EBCDIC Latin-1).
2428 * These two code points are used to propose (in an EXCSAT
2429 * command's MGRLVLLS parameter) and accept (in an EXCSATRD
2430 * command's MGRLVLLS parameter) a CSSID to be used for all
2431 * character data for DDM parameters. (*Not*, note, for the
2432 * FD:OCA (SQL statements and the like), which are governed
2433 * by TYPDEFNAM and TYPDEFOVR as contained in ACCRDB and ACCRDBRM
2434 * - note that they can be different in the two directions.)
2436 * A 0 reply in an EXCSATRD means rejection of the request, and
2437 * EBCDIC code page 500 (Latin-1) must be used. A 0xFFFF reply
2438 * in an EXCSATRD means "I do support CCSIDMGR, but not the code
2439 * page you requested, try again."
2441 * UNICODEMGR and CCSIDMGR are mutually exclusive.
2442 * UNICODEMGR should only use 1208 (UTF-8) or 0. CCSIDMGR must
2443 * support 500 (EBCDIC Latin-1), 819 (ISO 8859-1), and 850
2444 * (IBM PC-DOS ASCII Latin-1), and can support others.
2445 * If the server replies with a 0 to UNICODEMGR, the client can
2446 * try again with a CCSIDMGR.
2448 proto_tree_add_item(drda_tree_sub, hf_drda_ccsid, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
2449 break;
2451 case DRDA_CP_SQLAM:
2452 proto_tree_add_item_ret_uint(drda_tree_sub, hf_drda_mgrlvln, tvb, offset + 2, 2, ENC_BIG_ENDIAN, &mgrlvln);
2453 pdu_info->sqlam = mgrlvln;
2454 break;
2456 default:
2457 proto_tree_add_item(drda_tree_sub, hf_drda_mgrlvln, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
2459 offset += iLengthParam;
2462 return tvb_captured_length(tvb);
2465 static int
2466 dissect_drda_collection(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void *data)
2468 proto_tree *drda_tree_sub;
2469 proto_item *ti;
2470 int offset = 0;
2472 uint16_t iParameterCP;
2473 int iLengthParam;
2475 /* All objects in DDM are modeled as either scalars or collections.
2476 * A collection has the length before each element.
2477 * There are also lists of repeatable scalars, which don't have
2478 * the length.
2481 while (tvb_reported_length_remaining(tvb, offset) >= 2)
2483 iLengthParam = tvb_get_ntohs(tvb, offset + 0);
2484 if (tvb_reported_length_remaining(tvb, offset) >= iLengthParam)
2486 iParameterCP = tvb_get_ntohs(tvb, offset + 2);
2487 drda_tree_sub = proto_tree_add_subtree(tree, tvb, offset, iLengthParam,
2488 ett_drda_param, &ti, DRDA_TEXT_PARAM);
2489 proto_item_append_text(ti, " (%s)", val_to_str_ext(iParameterCP, &drda_opcode_vals_ext, "Unknown (0x%02x)"));
2490 proto_tree_add_item(drda_tree_sub, hf_drda_param_length, tvb, offset, 2, ENC_BIG_ENDIAN);
2491 proto_tree_add_item(drda_tree_sub, hf_drda_param_codepoint, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
2492 if (!dissector_try_uint_with_data(drda_opcode_table, iParameterCP, tvb_new_subset_length(tvb, offset + 4, iLengthParam - 4), pinfo, drda_tree_sub, false, data)) {
2493 proto_tree_add_item(drda_tree_sub, hf_drda_param_data, tvb, offset + 4, iLengthParam - 4, ENC_UTF_8);
2494 proto_tree_add_item(drda_tree_sub, hf_drda_param_data_ebcdic, tvb, offset + 4, iLengthParam - 4, ENC_EBCDIC_CP500);
2497 offset += iLengthParam;
2500 return tvb_captured_length(tvb);
2503 static int
2504 dissect_drda_codpntdr(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void* data _U_)
2506 proto_item *ti;
2507 uint32_t codpnt;
2509 ti = proto_tree_add_item_ret_uint(tree, hf_drda_param_codepoint, tvb, 0, 2, ENC_BIG_ENDIAN, &codpnt);
2510 proto_item_append_text(ti, " - %s", val_to_str_ext(codpnt, &drda_opcode_vals_ext, "Unknown (0x%02x)"));
2511 return 2;
2514 static int
2515 dissect_drda_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
2517 proto_tree *drda_tree;
2518 proto_tree *drdaroot_tree;
2519 proto_tree *drda_tree_sub;
2520 proto_item *ti, *ddm_ti, *ti_length;
2521 int offset = 0;
2523 drda_conv_info_t *conv_info;
2524 drda_flow_t *flow;
2525 drda_pdu_info_t *pdu_info;
2526 uint64_t flags;
2527 uint32_t iLength, iCommand, correl;
2529 uint16_t iParameterCP;
2530 uint8_t dsstyp;
2531 bool is_server = false;
2532 int iLengthParam;
2534 static int * const format_flags[] = {
2535 &hf_drda_ddm_fmt_reserved,
2536 &hf_drda_ddm_fmt_chained,
2537 &hf_drda_ddm_fmt_errcont,
2538 &hf_drda_ddm_fmt_samecorr,
2539 &hf_drda_ddm_fmt_dsstyp,
2540 NULL
2543 ti = proto_tree_add_item(tree, proto_drda, tvb, 0, -1, ENC_NA);
2544 drdaroot_tree = proto_item_add_subtree(ti, ett_drda);
2546 drda_tree = proto_tree_add_subtree(drdaroot_tree, tvb, 0, 10, ett_drda_ddm, &ddm_ti, DRDA_TEXT_DDM);
2548 ti_length = proto_tree_add_item_ret_uint(drda_tree, hf_drda_ddm_length, tvb, 0, 2, ENC_BIG_ENDIAN, &iLength);
2549 if (iLength < 10) {
2550 expert_add_info_format(pinfo, ti_length, &ei_drda_opcode_invalid_length, "Invalid length detected (%u): should be at least 10 bytes long", iLength);
2551 return 2;
2554 proto_tree_add_item(drda_tree, hf_drda_ddm_magic, tvb, 2, 1, ENC_BIG_ENDIAN);
2556 proto_tree_add_bitmask_ret_uint64(drda_tree, tvb, 3, hf_drda_ddm_format, ett_drda_ddm_format, format_flags, ENC_BIG_ENDIAN, &flags);
2557 dsstyp = flags & 0xF;
2559 proto_tree_add_item_ret_uint(drda_tree, hf_drda_ddm_rc, tvb, 4, 2, ENC_BIG_ENDIAN, &correl);
2560 proto_tree_add_item(drda_tree, hf_drda_ddm_length2, tvb, 6, 2, ENC_BIG_ENDIAN);
2562 proto_tree_add_item_ret_uint(drda_tree, hf_drda_ddm_codepoint, tvb, 8, 2, ENC_BIG_ENDIAN, &iCommand);
2563 is_server = drda_packet_from_server(pinfo, iCommand, dsstyp);
2564 proto_item_append_text(ti, " (%s)", val_to_str_ext(iCommand, &drda_opcode_vals_ext, "Unknown (0x%02x)"));
2565 proto_item_append_text(ddm_ti, " (%s)", val_to_str_ext(iCommand, &drda_opcode_abbr_ext, "Unknown (0x%02x)"));
2566 col_append_sep_str(pinfo->cinfo, COL_INFO, " | ", val_to_str_ext(iCommand, &drda_opcode_abbr_ext, "Unknown (0x%02x)"));
2567 col_set_fence(pinfo->cinfo, COL_INFO);
2569 pdu_info = drda_get_pdu_info(pinfo, correl, is_server);
2571 /* There are a few command objects treated differently, like SNDPKT */
2572 if (!dissector_try_uint_with_data(drda_opcode_table, iCommand, tvb_new_subset_length(tvb, 10, iLength - 10), pinfo, drda_tree, false, pdu_info)) {
2573 /* The number of attributes is variable */
2574 offset = 10;
2575 while (tvb_reported_length_remaining(tvb, offset) >= 2)
2577 iLengthParam = tvb_get_ntohs(tvb, offset + 0);
2578 if (iLengthParam == 0 || iLengthParam == 1)
2579 iLengthParam = iLength - 10;
2580 if (tvb_reported_length_remaining(tvb, offset) >= iLengthParam)
2582 iParameterCP = tvb_get_ntohs(tvb, offset + 2);
2583 drda_tree_sub = proto_tree_add_subtree(drdaroot_tree, tvb, offset, iLengthParam,
2584 ett_drda_param, &ti, DRDA_TEXT_PARAM);
2585 proto_item_append_text(ti, " (%s)", val_to_str_ext(iParameterCP, &drda_opcode_vals_ext, "Unknown (0x%02x)"));
2586 proto_tree_add_item(drda_tree_sub, hf_drda_param_length, tvb, offset, 2, ENC_BIG_ENDIAN);
2587 proto_tree_add_item(drda_tree_sub, hf_drda_param_codepoint, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
2588 if (!dissector_try_uint_with_data(drda_opcode_table, iParameterCP, tvb_new_subset_length(tvb, offset + 4, iLengthParam - 4), pinfo, drda_tree_sub, false, pdu_info)) {
2589 proto_tree_add_item(drda_tree_sub, hf_drda_param_data, tvb, offset + 4, iLengthParam - 4, ENC_UTF_8);
2590 proto_tree_add_item(drda_tree_sub, hf_drda_param_data_ebcdic, tvb, offset + 4, iLengthParam - 4, ENC_EBCDIC_CP500);
2593 offset += iLengthParam;
2596 conv_info = drda_get_conv_info(pinfo);
2597 if (iCommand == DRDA_CP_EXCSATRD) {
2598 /* EXCSATRD should be from the server, it confirms the negotiated
2599 * values for the MGRLVLLS that both directions will use. */
2600 flow = conv_info->server;
2601 if (GPOINTER_TO_UINT(wmem_tree_lookup32_le(flow->sqlam_tree, pinfo->num)) != pdu_info->sqlam) {
2602 wmem_tree_insert32(flow->sqlam_tree, pinfo->num, GUINT_TO_POINTER(pdu_info->sqlam));
2604 flow = conv_info->client;
2605 if (GPOINTER_TO_UINT(wmem_tree_lookup32_le(flow->sqlam_tree, pinfo->num)) != pdu_info->sqlam) {
2606 wmem_tree_insert32(flow->sqlam_tree, pinfo->num, GUINT_TO_POINTER(pdu_info->sqlam));
2608 } else if (iCommand == DRDA_CP_ACCRDB || iCommand == DRDA_CP_ACCRDBRM) {
2609 /* The parameters configured by ACCRDB and ACCRDBRM, OTOH, are
2610 * separate per-direction. */
2611 flow = (iCommand == DRDA_CP_ACCRDB) ? conv_info->client : conv_info->server;
2612 drda_update_flow_encoding(pinfo, flow, pdu_info);
2615 return tvb_captured_length(tvb);
2618 static unsigned
2619 get_drda_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset, void *data _U_)
2621 return (tvb_get_ntohs(tvb, offset));
2624 static int
2625 dissect_drda_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
2627 col_set_str(pinfo->cinfo, COL_PROTOCOL, "DRDA");
2628 col_clear(pinfo->cinfo, COL_INFO);
2630 /* There may be multiple DRDA commands in one frame */
2631 tcp_dissect_pdus(tvb, pinfo, tree, drda_desegment, 10, get_drda_pdu_len, dissect_drda_pdu, data);
2632 return tvb_captured_length(tvb);
2636 static bool
2637 dissect_drda_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
2639 conversation_t * conversation;
2640 if (tvb_captured_length(tvb) >= 10)
2642 /* The first header is 6 bytes long, so the length in the second header should 6 bytes less */
2643 uint16_t cOuterLength, cInnerLength;
2644 cOuterLength = tvb_get_ntohs(tvb, 0);
2645 cInnerLength = tvb_get_ntohs(tvb, 6);
2646 if ((tvb_get_uint8(tvb, 2) == DRDA_MAGIC) && ((cOuterLength - cInnerLength) == 6))
2648 /* Register this dissector for this conversation */
2649 conversation = find_or_create_conversation(pinfo);
2650 conversation_set_dissector(conversation, drda_tcp_handle);
2652 /* Dissect the packet */
2653 dissect_drda_tcp(tvb, pinfo, tree, data);
2654 return true;
2657 return false;
2660 void
2661 proto_register_drda(void)
2663 static hf_register_info hf[] = {
2664 { &hf_drda_ddm_length,
2665 { "Length", "drda.ddm.length",
2666 FT_UINT16, BASE_DEC, NULL, 0x0,
2667 "DDM length", HFILL }},
2669 { &hf_drda_ddm_magic,
2670 { "Magic", "drda.ddm.ddmid",
2671 FT_UINT8, BASE_HEX, NULL, 0x0,
2672 "DDM magic", HFILL }},
2674 { &hf_drda_ddm_format,
2675 { "Format", "drda.ddm.format",
2676 FT_UINT8, BASE_HEX, NULL, 0x0,
2677 "DDM format", HFILL }},
2679 { &hf_drda_ddm_fmt_reserved,
2680 { "Reserved", "drda.ddm.fmt.bit0",
2681 FT_BOOLEAN, 8, TFS(&tfs_set_notset), DRDA_DSSFMT_RESERVED,
2682 "DSSFMT reserved", HFILL }},
2684 { &hf_drda_ddm_fmt_chained,
2685 { "Chained", "drda.ddm.fmt.bit1",
2686 FT_BOOLEAN, 8, TFS(&tfs_set_notset), DRDA_DSSFMT_CHAINED,
2687 "DSSFMT chained", HFILL }},
2689 { &hf_drda_ddm_fmt_errcont,
2690 { "Continue", "drda.ddm.fmt.bit2",
2691 FT_BOOLEAN, 8, TFS(&tfs_set_notset), DRDA_DSSFMT_CONTINUE,
2692 "DSSFMT continue on error", HFILL }},
2694 { &hf_drda_ddm_fmt_samecorr,
2695 { "Same correlation", "drda.ddm.fmt.bit3",
2696 FT_BOOLEAN, 8, TFS(&tfs_set_notset), DRDA_DSSFMT_SAME_CORR,
2697 "DSSFMT same correlation", HFILL }},
2699 { &hf_drda_ddm_fmt_dsstyp,
2700 { "DSS type", "drda.ddm.fmt.dsstyp",
2701 FT_UINT8, BASE_DEC, VALS(drda_dsstyp_abbr), 0x0F,
2702 "DSSFMT type", HFILL }},
2704 { &hf_drda_ddm_rc,
2705 { "CorrelId", "drda.ddm.rqscrr",
2706 FT_UINT16, BASE_DEC, NULL, 0x0,
2707 "DDM correlation identifier", HFILL }},
2709 { &hf_drda_ddm_length2,
2710 { "Length2", "drda.ddm.length2",
2711 FT_UINT16, BASE_DEC, NULL, 0x0,
2712 "DDM length2", HFILL }},
2714 { &hf_drda_ddm_codepoint,
2715 { "Code point", "drda.ddm.codepoint",
2716 FT_UINT16, BASE_HEX|BASE_EXT_STRING, &drda_opcode_abbr_ext, 0x0,
2717 "DDM code point", HFILL }},
2719 { &hf_drda_param_length,
2720 { "Length", "drda.param.length",
2721 FT_UINT16, BASE_DEC, NULL, 0x0,
2722 "Param length", HFILL }},
2724 { &hf_drda_param_codepoint,
2725 { "Code point", "drda.param.codepoint",
2726 FT_UINT16, BASE_HEX|BASE_EXT_STRING, &drda_opcode_abbr_ext, 0x0,
2727 "Param code point", HFILL }},
2729 { &hf_drda_param_data,
2730 { "Data (ASCII)", "drda.param.data",
2731 FT_STRING, BASE_NONE, NULL, 0x0,
2732 "Param data left as ASCII for display", HFILL }},
2734 { &hf_drda_param_data_ebcdic,
2735 { "Data (EBCDIC)", "drda.param.data.ebcdic",
2736 FT_STRING, BASE_NONE, NULL, 0x0,
2737 "Param data converted from EBCDIC to ASCII for display", HFILL }},
2739 /* The DRDA spec really treats the NULL indicator as a FT_INT8, but
2740 * range_strings with negative values are a little annoying.
2742 { &hf_drda_null_ind,
2743 { "SQL NULL Indicator", "drda.null_ind",
2744 FT_UINT8, BASE_HEX|BASE_RANGE_STRING, RVALS(drda_null_ind_rvals),
2745 0x0, NULL, HFILL }},
2747 { &hf_drda_typdefnam,
2748 { "Data Type Definition Name", "drda.typdefnam",
2749 FT_STRING, BASE_NONE, NULL, 0x0,
2750 NULL, HFILL }},
2752 { &hf_drda_clob_length,
2753 { "CLOB Length", "drda.clob.length",
2754 FT_UINT32, BASE_DEC, NULL, 0x0,
2755 NULL, HFILL }},
2757 { &hf_drda_sqlstatement,
2758 { "SQL statement", "drda.sqlstatement",
2759 FT_STRING, BASE_NONE, NULL, 0x0,
2760 NULL, HFILL }},
2762 { &hf_drda_sqlcagrp,
2763 { "SQL Communications Area Group Description", "drda.sqlcagrp",
2764 FT_NONE, BASE_NONE, NULL, 0x0,
2765 NULL, HFILL }},
2767 { &hf_drda_sqlcode,
2768 { "SQL code", "drda.sqlcode",
2769 FT_INT32, BASE_DEC, NULL, 0x0,
2770 NULL, HFILL }},
2772 { &hf_drda_sqlstate,
2773 { "SQL state", "drda.sqlstate",
2774 FT_STRING, BASE_NONE, NULL, 0x0,
2775 NULL, HFILL }},
2777 { &hf_drda_sqlerrproc,
2778 { "SQLERRPROC", "drda.sqlerrproc",
2779 FT_STRING, BASE_NONE, NULL, 0x0,
2780 NULL, HFILL }},
2782 { &hf_drda_sqlcaxgrp,
2783 { "SQL Communications Area Exceptions Group", "drda.sqlcaxgrp",
2784 FT_NONE, BASE_NONE, NULL, 0x0,
2785 NULL, HFILL }},
2787 { &hf_drda_sqlerrd1,
2788 { "SQLERRD1", "drda.sqlerrd1",
2789 FT_INT32, BASE_DEC, NULL, 0x0,
2790 NULL, HFILL }},
2792 { &hf_drda_sqlerrd2,
2793 { "SQLERRD2", "drda.sqlerrd2",
2794 FT_INT32, BASE_DEC, NULL, 0x0,
2795 NULL, HFILL }},
2797 { &hf_drda_sqlerrd3,
2798 { "SQLERRD3", "drda.sqlerrd3",
2799 FT_INT32, BASE_DEC, NULL, 0x0,
2800 NULL, HFILL }},
2802 { &hf_drda_sqlerrd4,
2803 { "SQLERRD4", "drda.sqlerrd4",
2804 FT_INT32, BASE_DEC, NULL, 0x0,
2805 NULL, HFILL }},
2807 { &hf_drda_sqlerrd5,
2808 { "SQLERRD5", "drda.sqlerrd5",
2809 FT_INT32, BASE_DEC, NULL, 0x0,
2810 NULL, HFILL }},
2812 { &hf_drda_sqlerrd6,
2813 { "SQLERRD6", "drda.sqlerrd6",
2814 FT_INT32, BASE_DEC, NULL, 0x0,
2815 NULL, HFILL }},
2817 { &hf_drda_sqlwarn0,
2818 { "SQLWARN0", "drda.sqlwarn0",
2819 FT_STRING, BASE_NONE, NULL, 0x0,
2820 NULL, HFILL }},
2822 { &hf_drda_sqlwarn1,
2823 { "SQLWARN1", "drda.sqlwarn1",
2824 FT_STRING, BASE_NONE, NULL, 0x0,
2825 NULL, HFILL }},
2827 { &hf_drda_sqlwarn2,
2828 { "SQLWARN2", "drda.sqlwarn2",
2829 FT_STRING, BASE_NONE, NULL, 0x0,
2830 NULL, HFILL }},
2832 { &hf_drda_sqlwarn3,
2833 { "SQLWARN3", "drda.sqlwarn3",
2834 FT_STRING, BASE_NONE, NULL, 0x0,
2835 NULL, HFILL }},
2837 { &hf_drda_sqlwarn4,
2838 { "SQLWARN4", "drda.sqlwarn4",
2839 FT_STRING, BASE_NONE, NULL, 0x0,
2840 NULL, HFILL }},
2842 { &hf_drda_sqlwarn5,
2843 { "SQLWARN5", "drda.sqlwarn5",
2844 FT_STRING, BASE_NONE, NULL, 0x0,
2845 NULL, HFILL }},
2847 { &hf_drda_sqlwarn6,
2848 { "SQLWARN6", "drda.sqlwarn6",
2849 FT_STRING, BASE_NONE, NULL, 0x0,
2850 NULL, HFILL }},
2852 { &hf_drda_sqlwarn7,
2853 { "SQLWARN7", "drda.sqlwarn7",
2854 FT_STRING, BASE_NONE, NULL, 0x0,
2855 NULL, HFILL }},
2857 { &hf_drda_sqlwarn8,
2858 { "SQLWARN8", "drda.sqlwarn8",
2859 FT_STRING, BASE_NONE, NULL, 0x0,
2860 NULL, HFILL }},
2862 { &hf_drda_sqlwarn9,
2863 { "SQLWARN9", "drda.sqlwarn9",
2864 FT_STRING, BASE_NONE, NULL, 0x0,
2865 NULL, HFILL }},
2867 { &hf_drda_sqlwarna,
2868 { "SQLWARNA", "drda.sqlwarna",
2869 FT_STRING, BASE_NONE, NULL, 0x0,
2870 NULL, HFILL }},
2872 { &hf_drda_sqlerrmsg,
2873 { "SQL Error Message Token", "drda.sqlerrmsg",
2874 FT_STRING, BASE_NONE, NULL, 0x0,
2875 NULL, HFILL }},
2877 { &hf_drda_sqldhgrp,
2878 { "SQL Descriptor Header Group Description", "drda.sqldhgrp",
2879 FT_NONE, BASE_NONE, NULL, 0x0,
2880 NULL, HFILL }},
2882 { &hf_drda_sqldhold,
2883 { "SQLDHOLD", "drda.sqldhold",
2884 FT_INT16, BASE_DEC, VALS(drda_hold_vals), 0x0,
2885 NULL, HFILL }},
2887 { &hf_drda_sqldreturn,
2888 { "SQLDRETURN", "drda.sqldreturn",
2889 FT_INT16, BASE_DEC, VALS(drda_return_vals), 0x0,
2890 NULL, HFILL }},
2892 { &hf_drda_sqldscroll,
2893 { "SQLDSCROLL", "drda.sqldscroll",
2894 FT_INT16, BASE_DEC, VALS(drda_scroll_vals), 0x0,
2895 NULL, HFILL }},
2897 { &hf_drda_sqldsensitive,
2898 { "SQLDSENSITIVE", "drda.sqldsensitive",
2899 FT_INT16, BASE_DEC, VALS(drda_sensitive_vals), 0x0,
2900 NULL, HFILL }},
2902 { &hf_drda_sqldfcode,
2903 { "SQLDFCODE", "drda.sqldfcode",
2904 FT_INT16, BASE_DEC, VALS(drda_fcode_vals), 0x0,
2905 NULL, HFILL }},
2907 { &hf_drda_sqldkeytype,
2908 { "SQLDKEYTYPE", "drda.sqldkeytype",
2909 FT_INT16, BASE_DEC, VALS(drda_keytype_vals), 0x0,
2910 NULL, HFILL }},
2912 { &hf_drda_sqldoptlck,
2913 { "SQLDOPTLCK", "drda.sqldoptlck",
2914 FT_INT16, BASE_DEC, VALS(drda_doptlck_vals), 0x0,
2915 NULL, HFILL }},
2917 { &hf_drda_sqldschema,
2918 { "SQLDSCHEMA", "drda.sqldschema",
2919 FT_STRING, BASE_NONE, NULL, 0x0,
2920 NULL, HFILL }},
2922 { &hf_drda_sqldmodule,
2923 { "SQLDMODULE", "drda.sqldmodule",
2924 FT_STRING, BASE_NONE, NULL, 0x0,
2925 NULL, HFILL }},
2927 { &hf_drda_sqldagrp,
2928 { "SQL Descriptor Area Group Description", "drda.sqldagrp",
2929 FT_NONE, BASE_NONE, NULL, 0x0,
2930 NULL, HFILL }},
2932 { &hf_drda_sqlprecision,
2933 { "SQLPRECISION", "drda.sqlprecision",
2934 FT_INT16, BASE_DEC, NULL, 0x0,
2935 NULL, HFILL }},
2937 { &hf_drda_sqlscale,
2938 { "SQLSCALE", "drda.sqlscale",
2939 FT_INT16, BASE_DEC, NULL, 0x0,
2940 NULL, HFILL }},
2942 { &hf_drda_sqllength,
2943 { "SQLLENGTH", "drda.sqllength",
2944 FT_INT64, BASE_DEC, NULL, 0x0,
2945 NULL, HFILL }},
2947 { &hf_drda_sqllength32,
2948 { "SQLLENGTH", "drda.sqllength",
2949 FT_INT32, BASE_DEC, NULL, 0x0,
2950 NULL, HFILL }},
2952 { &hf_drda_sqltype,
2953 { "SQLTYPE", "drda.sqltype",
2954 FT_INT16, BASE_DEC, VALS(drda_sqltype_vals), 0x0,
2955 NULL, HFILL }},
2957 { &hf_drda_sqlarrextent,
2958 { "SQLARREXTENT", "drda.sqlarrextent",
2959 FT_INT64, BASE_DEC, NULL, 0x0,
2960 NULL, HFILL }},
2962 { &hf_drda_sqldoptgrp,
2963 { "SQL Descriptor Optional Group Description", "drda.sqldoptgrp",
2964 FT_NONE, BASE_NONE, NULL, 0x0,
2965 NULL, HFILL }},
2967 { &hf_drda_sqlunnamed,
2968 { "SQLUNNAMED", "drda.sqlunnamed",
2969 FT_INT16, BASE_DEC, VALS(drda_unnamed_vals), 0x0,
2970 NULL, HFILL }},
2972 { &hf_drda_sqlname,
2973 { "SQLNAME", "drda.sqlname",
2974 FT_STRING, BASE_NONE, NULL, 0x0,
2975 NULL, HFILL }},
2977 { &hf_drda_sqllabel,
2978 { "SQLLABEL", "drda.sqllabel",
2979 FT_STRING, BASE_NONE, NULL, 0x0,
2980 NULL, HFILL }},
2982 { &hf_drda_sqlcomments,
2983 { "SQLCOMMENTS", "drda.sqlcomments",
2984 FT_STRING, BASE_NONE, NULL, 0x0,
2985 NULL, HFILL }},
2987 { &hf_drda_sqludtgrp,
2988 { "SQL Descriptor User-Defined Type Group Description",
2989 "drda.sqludtgrp",
2990 FT_NONE, BASE_NONE, NULL, 0x0,
2991 NULL, HFILL }},
2993 { &hf_drda_sqludtxtype,
2994 { "SQLUDTXTYPE", "drda.sqludtxtype",
2995 FT_INT32, BASE_DEC, VALS(drda_udtxtype_vals), 0x0,
2996 NULL, HFILL }},
2998 { &hf_drda_sqludtschema,
2999 { "SQLUDTSCHEMA", "drda.sqludtschema",
3000 FT_STRING, BASE_NONE, NULL, 0x0,
3001 NULL, HFILL }},
3003 { &hf_drda_sqludtname,
3004 { "SQLUDTNAME", "drda.sqludtname",
3005 FT_STRING, BASE_NONE, NULL, 0x0,
3006 NULL, HFILL }},
3008 { &hf_drda_sqludtmodule,
3009 { "SQLUDTMODULE", "drda.sqludtmodule",
3010 FT_STRING, BASE_NONE, NULL, 0x0,
3011 NULL, HFILL }},
3013 { &hf_drda_sqldxgrp,
3014 { "SQL Descriptor Extended Type Group Description", "drda.sqldxgrp",
3015 FT_NONE, BASE_NONE, NULL, 0x0,
3016 NULL, HFILL }},
3018 { &hf_drda_sqlxkeymem,
3019 { "SQLXKEYMEM", "drda.sqlxkeymem",
3020 FT_INT16, BASE_DEC, VALS(drda_keymem_vals), 0x0,
3021 NULL, HFILL }},
3023 { &hf_drda_sqlxupdateable,
3024 { "SQLXUPDATEABLE", "drda.sqlxupdateable",
3025 FT_INT16, BASE_DEC, VALS(drda_updateable_vals), 0x0,
3026 NULL, HFILL }},
3028 { &hf_drda_sqlxgenerated,
3029 { "SQLXGENERATED", "drda.sqlxgenerated",
3030 FT_INT16, BASE_DEC, VALS(drda_generated_vals), 0x0,
3031 NULL, HFILL }},
3033 { &hf_drda_sqlxparmmode,
3034 { "SQLXPARMMODE", "drda.sqlxparmmode",
3035 FT_INT16, BASE_DEC, VALS(drda_parmmode_vals), 0x0,
3036 NULL, HFILL }},
3038 { &hf_drda_sqlxoptlck,
3039 { "SQLXOPTLCK", "drda.sqlxoptlck",
3040 FT_INT16, BASE_DEC, VALS(drda_xoptlck_vals), 0x0,
3041 NULL, HFILL }},
3043 { &hf_drda_sqlxhidden,
3044 { "SQLXHIDDEN", "drda.sqlxhidden",
3045 FT_INT16, BASE_DEC, VALS(drda_hidden_vals), 0x0,
3046 NULL, HFILL }},
3048 { &hf_drda_sqlxcorname,
3049 { "SQLXCORNAME", "drda.sqlxcorname",
3050 FT_STRING, BASE_NONE, NULL, 0x0,
3051 NULL, HFILL }},
3053 { &hf_drda_sqlxbasename,
3054 { "SQLXBASENAME", "drda.sqlxbasename",
3055 FT_STRING, BASE_NONE, NULL, 0x0,
3056 NULL, HFILL }},
3058 { &hf_drda_sqlxschema,
3059 { "SQLXSCHEMA", "drda.sqlxschema",
3060 FT_STRING, BASE_NONE, NULL, 0x0,
3061 NULL, HFILL }},
3063 { &hf_drda_sqlxname,
3064 { "SQLXNAME", "drda.sqlxname",
3065 FT_STRING, BASE_NONE, NULL, 0x0,
3066 NULL, HFILL }},
3068 { &hf_drda_sqlxmodule,
3069 { "SQLXMODULE", "drda.sqlxmodule",
3070 FT_STRING, BASE_NONE, NULL, 0x0,
3071 NULL, HFILL }},
3073 { &hf_drda_sqldiaggrp,
3074 { "SQL Diagnostics Group Description", "drda.sqldiaggrp",
3075 FT_NONE, BASE_NONE, NULL, 0x0,
3076 NULL, HFILL }},
3078 { &hf_drda_sqlnum,
3079 { "SQLNUM", "drda.sqlnum",
3080 FT_INT16, BASE_DEC, NULL, 0x0,
3081 NULL, HFILL }},
3083 { &hf_drda_rlsconv,
3084 { "Release Conversation", "drda.rlsconv", FT_UINT8, BASE_NONE,
3085 VALS(drda_rlsconv_vals), 0x0,
3086 NULL, HFILL }},
3088 { &hf_drda_secmec,
3089 { "Security Mechanism", "drda.secmec", FT_UINT16, BASE_DEC,
3090 VALS(drda_secmec_vals), 0x0,
3091 NULL, HFILL }},
3093 { &hf_drda_sectkn,
3094 { "Security Token", "drda.sectkn", FT_BYTES, BASE_NONE,
3095 NULL, 0x0,
3096 NULL, HFILL }},
3098 { &hf_drda_svrcod,
3099 { "Severity Code", "drda.svrcod", FT_UINT16, BASE_DEC,
3100 VALS(drda_svrcod_vals), 0x0,
3101 NULL, HFILL }},
3103 { &hf_drda_secchkcd,
3104 { "Security Check Code", "drda.secchkcd", FT_UINT8, BASE_HEX,
3105 VALS(drda_secchkcd_vals), 0x0,
3106 NULL, HFILL }},
3108 { &hf_drda_ccsid,
3109 { "CCSID", "drda.ccsid", FT_UINT16, BASE_DEC,
3110 VALS(drda_ccsid_vals), 0x0,
3111 "Coded Character Set Identifier", HFILL }},
3113 { &hf_drda_mgrlvln,
3114 { "Manager-level Number", "drda.mgrlvln", FT_UINT16, BASE_DEC,
3115 NULL, 0x0,
3116 NULL, HFILL }},
3118 { &hf_drda_monitor,
3119 { "Monitor", "drda.monitor", FT_UINT32, BASE_HEX,
3120 NULL, 0x0,
3121 NULL, HFILL }},
3123 { &hf_drda_monitor_etime,
3124 { "Elapsed Time", "drda.monitor.etime", FT_BOOLEAN, 32,
3125 NULL, 0x80000000,
3126 NULL, HFILL }},
3128 { &hf_drda_monitor_reserved,
3129 { "Reserved", "drda.monitor.reserved", FT_UINT32, BASE_HEX,
3130 NULL, 0x7FFFFFFF,
3131 NULL, HFILL }},
3133 { &hf_drda_etime,
3134 { "Elapsed Time", "drda.etime", FT_RELATIVE_TIME, BASE_NONE,
3135 NULL, 0x0,
3136 NULL, HFILL }},
3138 { &hf_drda_respktsz,
3139 { "Response Packet Size", "drda.respktsz", FT_UINT32, BASE_DEC,
3140 NULL, 0x0,
3141 NULL, HFILL }},
3143 { &hf_drda_rdbinttkn,
3144 { "RDB Interrupt Token", "drda.rdbinttkn", FT_BYTES, BASE_NONE,
3145 NULL, 0x0,
3146 NULL, HFILL }},
3148 { &hf_drda_rdbcmtok,
3149 { "RDB Commit Allowed", "drda.rdbcmtok", FT_UINT8, BASE_NONE,
3150 VALS(drda_boolean_vals), 0x0,
3151 NULL, HFILL }},
3153 /* This one is a 0x00 0x01 boolean, not a EBCDIC 0xf0 0xf1 boolean */
3154 { &hf_drda_rtnsetstt,
3155 { "Return SET Statement", "drda.rtnsetstt", FT_BOOLEAN, BASE_NONE,
3156 NULL, 0x0,
3157 NULL, HFILL }},
3159 { &hf_drda_outexp,
3160 { "Output Expected", "drda.outexp", FT_UINT8, BASE_NONE,
3161 VALS(drda_boolean_vals), 0x0,
3162 NULL, HFILL }},
3164 { &hf_drda_rdbnam,
3165 { "Relational Database Name (ASCII)", "drda.rdbnam", FT_STRING,
3166 BASE_NONE, NULL, 0x0,
3167 "RDBNAM assuming ASCII/UTF-8", HFILL }},
3169 { &hf_drda_rdbnam_ebcdic,
3170 { "Relational Database Name (EBCDIC)", "drda.rdbnam.ebcdic", FT_STRING,
3171 BASE_NONE, NULL, 0x0,
3172 "RBDNAM assuming EBCDIC", HFILL }},
3174 { &hf_drda_rdbcolid,
3175 { "RDB Collection Identifier (ASCII)", "drda.rdbcoldid", FT_STRING,
3176 BASE_NONE, NULL, 0x0,
3177 "RDBCOLID assuming ASCII/UTF-8", HFILL }},
3179 { &hf_drda_rdbcolid_ebcdic,
3180 { "RDB Collection Identifier (EBCDIC)", "drda.rdbcolid.ebcdic",
3181 FT_STRING, BASE_NONE, NULL, 0x0,
3182 "RBDCOLID assuming EBCDIC", HFILL }},
3184 { &hf_drda_pkgid,
3185 { "RDB Package Identifier (ASCII)", "drda.pkgid", FT_STRING, BASE_NONE,
3186 NULL, 0x0,
3187 "PKGID assuming ASCII/UTF-8", HFILL }},
3189 { &hf_drda_pkgid_ebcdic,
3190 { "RDB Package Identifier (EBCDIC)", "drda.pkgid.ebcdic", FT_STRING,
3191 BASE_NONE, NULL, 0x0,
3192 "PKGID assuming EBCDIC", HFILL }},
3194 { &hf_drda_pkgsn,
3195 { "RDB Package Section Number", "drda.pkgsn", FT_INT16,
3196 BASE_DEC, NULL, 0x0,
3197 NULL, HFILL }},
3199 { &hf_drda_pkgcnstkn,
3200 { "RDB Package Consistency Token", "drda.pkgcnstkn", FT_BYTES,
3201 BASE_NONE|BASE_SHOW_ASCII_PRINTABLE, NULL, 0x0,
3202 NULL, HFILL }},
3204 { &hf_drda_qryblksz,
3205 { "Query Block Size", "drda.qryblksz", FT_UINT32, BASE_DEC,
3206 NULL, 0x0,
3207 NULL, HFILL }},
3209 { &hf_drda_uowdsp,
3210 { "Unit of Work Disposition", "drda.uowdsp", FT_UINT8, BASE_HEX,
3211 VALS(drda_uowdsp_vals), 0x0,
3212 NULL, HFILL }},
3214 { &hf_drda_rdbalwupd,
3215 { "RDB Allow Updates", "drda.rdbalwupd", FT_UINT8, BASE_HEX,
3216 VALS(drda_boolean_vals), 0x0,
3217 NULL, HFILL }},
3219 { &hf_drda_sqlcsrhld,
3220 { "Hold Cursor Position", "drda.sqlcsrhld", FT_UINT8, BASE_HEX,
3221 VALS(drda_boolean_vals), 0x0,
3222 NULL, HFILL }},
3224 { &hf_drda_qryextdtasz,
3225 { "Query Externalized Data Size", "drda.qryextdtasz", FT_INT64,
3226 BASE_DEC|BASE_VAL64_STRING|BASE_SPECIAL_VALS,
3227 VALS64(drda_qryextdtasz_vals), 0x0,
3228 NULL, HFILL }},
3230 { &hf_drda_smldtasz,
3231 { "Maximum Size of Small Data", "drda.smldtasz", FT_INT64, BASE_DEC,
3232 NULL, 0x0,
3233 NULL, HFILL }},
3235 { &hf_drda_meddtasz,
3236 { "Maximum Size of Medium Data", "drda.meddtasz", FT_INT64, BASE_DEC,
3237 NULL, 0x0,
3238 NULL, HFILL }},
3240 { &hf_drda_trgdftrt,
3241 { "Target Default Value Return", "drda.trgdftrt", FT_UINT8, BASE_HEX,
3242 VALS(drda_boolean_vals), 0x0,
3243 NULL, HFILL }},
3245 { &hf_drda_rtnsqlda,
3246 { "Return the SQLDA", "drda.rtnsqlda", FT_UINT8, BASE_HEX,
3247 VALS(drda_boolean_vals), 0x0,
3248 NULL, HFILL }},
3250 { &hf_drda_qryattupd,
3251 { "Query Attribute for Updatability", "drda.qryattupd", FT_INT8,
3252 BASE_DEC, VALS(drda_qryattupd_vals), 0x0,
3253 NULL, HFILL }},
3255 { &hf_drda_qryrowset,
3256 { "Query Rowset Size", "drda.qryrowset", FT_INT32, BASE_DEC,
3257 NULL, 0x0,
3258 NULL, HFILL }},
3260 { &hf_drda_qryinsid,
3261 { "Query Instance Identifier", "drda.qryinsid", FT_BYTES, BASE_NONE,
3262 NULL, 0x0,
3263 NULL, HFILL }},
3265 { &hf_drda_qryclsimp,
3266 { "Query Close Implicit", "drda.qryclsimp", FT_INT8, BASE_DEC,
3267 VALS(drda_qryclsimp_vals), 0x0,
3268 NULL, HFILL }},
3270 { &hf_drda_qryblkfct,
3271 { "Query Blocking Factor", "drda.qryblkfct", FT_INT32, BASE_DEC,
3272 NULL, 0x0,
3273 NULL, HFILL }},
3275 { &hf_drda_maxrslcnt,
3276 { "Maximum Result Set Count", "drda.maxrslcnt", FT_INT32,
3277 BASE_DEC|BASE_SPECIAL_VALS, VALS(drda_max_vals), 0x0,
3278 NULL, HFILL }},
3280 { &hf_drda_maxblkext,
3281 { "Maximum Number of Extra Blocks", "drda.maxblkext", FT_INT32,
3282 BASE_DEC|BASE_SPECIAL_VALS, VALS(drda_max_vals), 0x0,
3283 NULL, HFILL }},
3285 { &hf_drda_rslsetflg,
3286 { "Result Set Flags", "drda.rslsetflg", FT_UINT8, BASE_HEX,
3287 NULL, 0x0,
3288 NULL, HFILL }},
3290 { &hf_drda_rslsetflg_unused,
3291 { "Unused", "drda.rslsetflg.unused", FT_UINT8, BASE_HEX,
3292 NULL, 0xE0,
3293 "Flags are no longer used and value should be zero", HFILL }},
3295 { &hf_drda_rslsetflg_dsconly,
3296 { "Description Only", "drda.rslsetflg.dsconly", FT_BOOLEAN, 8,
3297 NULL, 0x10,
3298 "Requires the target SQLAM to return an FD:OCA description but not any answer set data", HFILL }},
3300 { &hf_drda_rslsetflg_extended,
3301 { "Extended", "drda.rslsetflg.extended", FT_UINT8, BASE_HEX,
3302 VALS(drda_rslsetflg_extended_vals), 0x0C,
3303 "Identifies the type of FD:OCA SQLDA descriptor returned", HFILL }},
3305 { &hf_drda_rslsetflg_reserved,
3306 { "Reserved", "drda.rslsetflg.reserved", FT_UINT8, BASE_HEX,
3307 NULL, 0x03,
3308 NULL, HFILL }},
3310 { &hf_drda_typsqlda,
3311 { "Type of SQL Descriptor Area", "drda.typsqlda", FT_INT8, BASE_DEC,
3312 VALS(drda_typsqlda_vals), 0x0,
3313 NULL, HFILL }},
3315 { &hf_drda_outovropt,
3316 { "Output Override Option", "drda.outovropt", FT_INT8, BASE_DEC,
3317 VALS(drda_outovropt_vals), 0x0,
3318 NULL, HFILL }},
3320 { &hf_drda_dyndtafmt,
3321 { "Dynamic Data Format", "drda.dyndtafmt", FT_UINT8, BASE_HEX,
3322 VALS(drda_boolean_vals), 0x0,
3323 NULL, HFILL }},
3325 { &hf_drda_pktobj,
3326 { "Packet Object", "drda.pktobj", FT_BYTES, BASE_NONE,
3327 NULL, 0x0,
3328 NULL, HFILL }},
3331 static int *ett[] = {
3332 &ett_drda,
3333 &ett_drda_ddm,
3334 &ett_drda_ddm_format,
3335 &ett_drda_param,
3336 &ett_drda_monitor,
3337 &ett_drda_rslsetflg,
3338 &ett_drda_sqlcagrp,
3339 &ett_drda_sqlcaxgrp,
3340 &ett_drda_sqldhgrp,
3341 &ett_drda_sqldagrp,
3342 &ett_drda_sqldoptgrp,
3343 &ett_drda_sqludtgrp,
3344 &ett_drda_sqldxgrp,
3345 &ett_drda_sqldiaggrp,
3348 static ei_register_info ei[] = {
3349 { &ei_drda_opcode_invalid_length, { "drda.opcode.invalid_length", PI_MALFORMED, PI_ERROR, "Invalid length detected", EXPFILL }},
3350 { &ei_drda_undecoded, { "drda.undecoded", PI_UNDECODED, PI_NOTE, "[Not decoded yet]", EXPFILL }},
3353 module_t *drda_module;
3354 expert_module_t* expert_drda;
3356 proto_drda = proto_register_protocol("DRDA", "DRDA", "drda");
3357 proto_register_field_array(proto_drda, hf, array_length(hf));
3358 proto_register_subtree_array(ett, array_length(ett));
3359 expert_drda = expert_register_protocol(proto_drda);
3360 expert_register_field_array(expert_drda, ei, array_length(ei));
3362 drda_opcode_table = register_dissector_table("drda.opcode", "DRDA opcode",
3363 proto_drda, FT_UINT16, BASE_HEX);
3365 drda_module = prefs_register_protocol(proto_drda, NULL);
3366 prefs_register_bool_preference(drda_module, "desegment",
3367 "Reassemble DRDA messages spanning multiple TCP segments",
3368 "Whether the DRDA dissector should reassemble messages spanning"
3369 " multiple TCP segments."
3370 " To use this option, you must also enable"
3371 " \"Allow subdissectors to reassemble TCP streams\""
3372 " in the TCP protocol settings.",
3373 &drda_desegment);
3375 prefs_register_uint_preference(drda_module, "sqlam",
3376 "Default SQLAM Level",
3377 "Default SQL Application Manager Level in the absence"
3378 " of EXSATRD command. (Currently the only difference"
3379 " in handling is between values < 7 and >= 7.)",
3380 10, &drda_default_sqlam);
3382 prefs_register_enum_preference(drda_module, "typdefnam",
3383 "Default TYPDEFNAM",
3384 "Data Type Definition to use in the absence of"
3385 " ACCRDB and ACCRDBRM commands.",
3386 &drda_default_typdefnam,
3387 typdefnam_vals, false);
3389 prefs_register_enum_preference(drda_module, "ccsidsbc",
3390 "Default Single-byte encoding for FD:OCA data",
3391 "Single-byte encoding to use for FD:OCA character data"
3392 " in the absence of CCSIDSBC TYPDEFOVR parameter.",
3393 &drda_default_ccsidsbc,
3394 ws_supported_mibenum_vals_character_sets_ev_array,
3395 false);
3397 prefs_register_enum_preference(drda_module, "ccsidmbc",
3398 "Default Mixed-byte encoding for FD:OCA data",
3399 "Mixed-byte encoding to use for FD:OCA character data"
3400 " in the absence of CCSIDMBC TYPDEFOVR parameter.",
3401 &drda_default_ccsidmbc,
3402 ws_supported_mibenum_vals_character_sets_ev_array,
3403 false);
3405 drda_tcp_handle = register_dissector("drda", dissect_drda_tcp, proto_drda);
3408 void
3409 proto_reg_handoff_drda(void)
3411 heur_dissector_add("tcp", dissect_drda_heur, "DRDA over TCP", "drda_tcp", proto_drda, HEURISTIC_ENABLE);
3413 dissector_handle_t ccsid_handle;
3414 dissector_handle_t codpntdr_handle;
3415 dissector_handle_t collection_handle;
3416 dissector_handle_t sqlstt_handle;
3417 dissector_handle_t undecoded_handle;
3419 ccsid_handle = create_dissector_handle(dissect_drda_ccsid, proto_drda);
3420 codpntdr_handle = create_dissector_handle(dissect_drda_codpntdr, proto_drda);
3421 collection_handle = create_dissector_handle(dissect_drda_collection, proto_drda);
3422 sqlstt_handle = create_dissector_handle(dissect_drda_sqlstt, proto_drda);
3423 undecoded_handle = create_dissector_handle(dissect_drda_undecoded, proto_drda);
3425 dissector_add_uint("drda.opcode", DRDA_CP_TYPDEFNAM, create_dissector_handle(dissect_drda_typdefnam, proto_drda));
3426 dissector_add_uint("drda.opcode", DRDA_CP_MGRLVLLS, create_dissector_handle(dissect_drda_mgrlvlls, proto_drda));
3427 dissector_add_uint("drda.opcode", DRDA_CP_TYPDEFOVR, collection_handle);
3428 dissector_add_uint("drda.opcode", DRDA_CP_PKGSNLST, collection_handle);
3429 dissector_add_uint("drda.opcode", DRDA_CP_RLSCONV, create_dissector_handle(dissect_drda_rlsconv, proto_drda));
3430 dissector_add_uint("drda.opcode", DRDA_CP_SECMEC, create_dissector_handle(dissect_drda_secmec, proto_drda));
3431 dissector_add_uint("drda.opcode", DRDA_CP_SECTKN, create_dissector_handle(dissect_drda_sectkn, proto_drda));
3432 dissector_add_uint("drda.opcode", DRDA_CP_SVRCOD, create_dissector_handle(dissect_drda_svrcod, proto_drda));
3433 dissector_add_uint("drda.opcode", DRDA_CP_SECCHKCD, create_dissector_handle(dissect_drda_secchkcd, proto_drda));
3434 dissector_add_uint("drda.opcode", DRDA_CP_CCSIDSBC, ccsid_handle);
3435 dissector_add_uint("drda.opcode", DRDA_CP_CCSIDDBC, ccsid_handle);
3436 dissector_add_uint("drda.opcode", DRDA_CP_CCSIDMBC, ccsid_handle);
3437 dissector_add_uint("drda.opcode", DRDA_CP_CCSIDXML, ccsid_handle);
3439 dissector_add_uint("drda.opcode", DRDA_CP_RDBACCCL, codpntdr_handle);
3440 dissector_add_uint("drda.opcode", DRDA_CP_QRYPRCTYP, codpntdr_handle);
3441 dissector_add_uint("drda.opcode", DRDA_CP_PKGDFTCST, codpntdr_handle);
3442 dissector_add_uint("drda.opcode", 0x2460, codpntdr_handle); /* Not in DRDA, Version 5 */
3444 dissector_add_uint("drda.opcode", DRDA_CP_MONITOR, create_dissector_handle(dissect_drda_monitor, proto_drda));
3445 dissector_add_uint("drda.opcode", DRDA_CP_ETIME, create_dissector_handle(dissect_drda_etime, proto_drda));
3446 dissector_add_uint("drda.opcode", DRDA_CP_RESPKTSZ, create_dissector_handle(dissect_drda_respktsz, proto_drda));
3447 dissector_add_uint("drda.opcode", DRDA_CP_RDBINTTKN, create_dissector_handle(dissect_drda_rdbinttkn, proto_drda));
3448 dissector_add_uint("drda.opcode", DRDA_CP_RDBCMTOK, create_dissector_handle(dissect_drda_rdbcmtok, proto_drda));
3449 dissector_add_uint("drda.opcode", DRDA_CP_RTNSETSTT, create_dissector_handle(dissect_drda_rtnsetstt, proto_drda));
3450 dissector_add_uint("drda.opcode", DRDA_CP_OUTEXP, create_dissector_handle(dissect_drda_outexp, proto_drda));
3451 dissector_add_uint("drda.opcode", DRDA_CP_PKGNAM, create_dissector_handle(dissect_drda_pkgnam, proto_drda));
3452 dissector_add_uint("drda.opcode", DRDA_CP_PKGNAMCT, create_dissector_handle(dissect_drda_pkgnamct, proto_drda));
3453 dissector_add_uint("drda.opcode", DRDA_CP_PKGNAMCSN, create_dissector_handle(dissect_drda_pkgnamcsn, proto_drda));
3454 dissector_add_uint("drda.opcode", DRDA_CP_UOWDSP, create_dissector_handle(dissect_drda_uowdsp, proto_drda));
3455 dissector_add_uint("drda.opcode", DRDA_CP_RDBALWUPD, create_dissector_handle(dissect_drda_rdbalwupd, proto_drda));
3456 dissector_add_uint("drda.opcode", DRDA_CP_QRYBLKSZ, create_dissector_handle(dissect_drda_qryblksz, proto_drda));
3457 dissector_add_uint("drda.opcode", DRDA_CP_RTNSQLDA, create_dissector_handle(dissect_drda_rtnsqlda, proto_drda));
3458 dissector_add_uint("drda.opcode", DRDA_CP_SQLCSRHLD, create_dissector_handle(dissect_drda_sqlcsrhld, proto_drda));
3459 dissector_add_uint("drda.opcode", DRDA_CP_QRYEXTDTASZ, create_dissector_handle(dissect_drda_qryextdtasz, proto_drda));
3460 dissector_add_uint("drda.opcode", DRDA_CP_SMLDTASZ, create_dissector_handle(dissect_drda_smldtasz, proto_drda));
3461 dissector_add_uint("drda.opcode", DRDA_CP_MEDDTASZ, create_dissector_handle(dissect_drda_meddtasz, proto_drda));
3462 dissector_add_uint("drda.opcode", DRDA_CP_TRGDFTRT, create_dissector_handle(dissect_drda_trgdftrt, proto_drda));
3463 dissector_add_uint("drda.opcode", DRDA_CP_QRYATTUPD, create_dissector_handle(dissect_drda_qryattupd, proto_drda));
3464 dissector_add_uint("drda.opcode", DRDA_CP_QRYROWSET, create_dissector_handle(dissect_drda_qryrowset, proto_drda));
3465 dissector_add_uint("drda.opcode", DRDA_CP_QRYINSID, create_dissector_handle(dissect_drda_qryinsid, proto_drda));
3466 dissector_add_uint("drda.opcode", DRDA_CP_QRYCLSIMP, create_dissector_handle(dissect_drda_qryclsimp, proto_drda));
3467 dissector_add_uint("drda.opcode", DRDA_CP_QRYBLKFCT, create_dissector_handle(dissect_drda_qryblkfct, proto_drda));
3468 dissector_add_uint("drda.opcode", DRDA_CP_MAXRSLCNT, create_dissector_handle(dissect_drda_maxrslcnt, proto_drda));
3469 dissector_add_uint("drda.opcode", DRDA_CP_MAXBLKEXT, create_dissector_handle(dissect_drda_maxblkext, proto_drda));
3470 dissector_add_uint("drda.opcode", DRDA_CP_RSLSETFLG, create_dissector_handle(dissect_drda_rslsetflg, proto_drda));
3471 dissector_add_uint("drda.opcode", DRDA_CP_TYPSQLDA, create_dissector_handle(dissect_drda_typsqlda, proto_drda));
3472 dissector_add_uint("drda.opcode", DRDA_CP_OUTOVROPT, create_dissector_handle(dissect_drda_outovropt, proto_drda));
3473 dissector_add_uint("drda.opcode", DRDA_CP_DYNDTAFMT, create_dissector_handle(dissect_drda_dyndtafmt, proto_drda));
3475 dissector_add_uint("drda.opcode", DRDA_CP_PKTOBJ, create_dissector_handle(dissect_drda_pktobj, proto_drda));
3476 dissector_add_uint("drda.opcode", DRDA_CP_SQLSTT, sqlstt_handle);
3477 dissector_add_uint("drda.opcode", DRDA_CP_SQLATTR, sqlstt_handle);
3478 dissector_add_uint("drda.opcode", DRDA_CP_SQLCARD, create_dissector_handle(dissect_drda_sqlcard, proto_drda));
3479 dissector_add_uint("drda.opcode", DRDA_CP_SQLDARD, create_dissector_handle(dissect_drda_sqldard, proto_drda));
3480 dissector_add_uint("drda.opcode", DRDA_CP_FDODSC, undecoded_handle);
3481 dissector_add_uint("drda.opcode", DRDA_CP_FDODTA, undecoded_handle);
3482 dissector_add_uint("drda.opcode", DRDA_CP_QRYDSC, undecoded_handle);
3483 dissector_add_uint("drda.opcode", DRDA_CP_QRYDTA, undecoded_handle);
3487 * Editor modelines - https://www.wireshark.org/tools/modelines.html
3489 * Local variables:
3490 * c-basic-offset: 4
3491 * tab-width: 8
3492 * indent-tabs-mode: nil
3493 * End:
3495 * vi: set shiftwidth=4 tabstop=8 expandtab:
3496 * :indentSize=4:tabSize=8:noTabs=true: