FreeTDS API

Loading...
Searching...
No Matches
proto.h
1/* FreeTDS - Library of routines accessing Sybase and Microsoft databases
2 * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Brian Bruns
3 * Copyright (C) 2010, 2011 Frediano Ziglio
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details.
14 *
15 * You should have received a copy of the GNU Library General Public
16 * License along with this library; if not, write to the
17 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 * Boston, MA 02111-1307, USA.
19 */
20
21/*
22 * This file contains defines and structures strictly related to TDS protocol
23 */
24
25 typedef struct tdsnumeric
26{
27 unsigned char precision;
28 unsigned char scale;
29 unsigned char array[33];
30} TDS_NUMERIC;
31
32 typedef struct tdsoldmoney
33{
34 TDS_INT mnyhigh;
35 TDS_UINT mnylow;
36} TDS_OLD_MONEY;
37
38 typedef union tdsmoney
39{
40 TDS_OLD_MONEY tdsoldmoney;
41 TDS_INT8 mny;
42} TDS_MONEY;
43
44 typedef struct tdsmoney4
45{
46 TDS_INT mny4;
47} TDS_MONEY4;
48
49 typedef struct tdsdatetime
50{
51 TDS_INT dtdays;
52 TDS_INT dttime;
53} TDS_DATETIME;
54
55 typedef struct tdsdatetime4
56{
57 TDS_USMALLINT days;
58 TDS_USMALLINT minutes;
59} TDS_DATETIME4;
60
61 typedef struct tdsunique
62{
63 TDS_UINT Data1;
64 TDS_USMALLINT Data2;
65 TDS_USMALLINT Data3;
66 TDS_UCHAR Data4[8];
67} TDS_UNIQUE;
68
69 typedef TDS_INT TDS_DATE;
70 typedef TDS_INT TDS_TIME;
71
72 typedef TDS_UINT8 TDS_BIGTIME;
73 typedef TDS_UINT8 TDS_BIGDATETIME;
74
75#define TDS5_PARAMFMT2_TOKEN 32 /* 0x20 */
76#define TDS_LANGUAGE_TOKEN 33 /* 0x21 TDS 5.0 only */
77#define TDS_ORDERBY2_TOKEN 34 /* 0x22 */
78#define TDS_ROWFMT2_TOKEN 97 /* 0x61 TDS 5.0 only */
79#define TDS_MSG_TOKEN 101 /* 0x65 TDS 5.0 only */
80#define TDS_LOGOUT_TOKEN 113 /* 0x71 TDS 5.0 only? ct_close() */
81#define TDS_RETURNSTATUS_TOKEN 121 /* 0x79 */
82#define TDS_PROCID_TOKEN 124 /* 0x7C TDS 4.2 only - TDS_PROCID */
83#define TDS7_RESULT_TOKEN 129 /* 0x81 TDS 7.0 only */
84#define TDS7_COMPUTE_RESULT_TOKEN 136 /* 0x88 TDS 7.0 only */
85#define TDS_COLNAME_TOKEN 160 /* 0xA0 TDS 4.2 only */
86#define TDS_COLFMT_TOKEN 161 /* 0xA1 TDS 4.2 only - TDS_COLFMT */
87#define TDS_DYNAMIC2_TOKEN 163 /* 0xA3 */
88#define TDS_TABNAME_TOKEN 164 /* 0xA4 */
89#define TDS_COLINFO_TOKEN 165 /* 0xA5 */
90#define TDS_OPTIONCMD_TOKEN 166 /* 0xA6 */
91#define TDS_COMPUTE_NAMES_TOKEN 167 /* 0xA7 */
92#define TDS_COMPUTE_RESULT_TOKEN 168 /* 0xA8 */
93#define TDS_ORDERBY_TOKEN 169 /* 0xA9 TDS_ORDER */
94#define TDS_ERROR_TOKEN 170 /* 0xAA */
95#define TDS_INFO_TOKEN 171 /* 0xAB */
96#define TDS_PARAM_TOKEN 172 /* 0xAC RETURNVALUE? */
97#define TDS_LOGINACK_TOKEN 173 /* 0xAD */
98#define TDS_CONTROL_FEATUREEXTACK_TOKEN \
99 174 /* 0xAE TDS_CONTROL/TDS_FEATUREEXTACK */
100#define TDS_ROW_TOKEN 209 /* 0xD1 */
101#define TDS_NBC_ROW_TOKEN 210 /* 0xD2 as of TDS 7.3.B */
102#define TDS_CMP_ROW_TOKEN 211 /* 0xD3 */
103#define TDS5_PARAMS_TOKEN 215 /* 0xD7 TDS 5.0 only */
104#define TDS_CAPABILITY_TOKEN 226 /* 0xE2 */
105#define TDS_ENVCHANGE_TOKEN 227 /* 0xE3 */
106#define TDS_SESSIONSTATE_TOKEN 228 /* 0xE4 TDS 7.4 */
107#define TDS_EED_TOKEN 229 /* 0xE5 */
108#define TDS_DBRPC_TOKEN 230 /* 0xE6 TDS 5.0 only */
109#define TDS5_DYNAMIC_TOKEN 231 /* 0xE7 TDS 5.0 only */
110#define TDS5_PARAMFMT_TOKEN 236 /* 0xEC TDS 5.0 only */
111#define TDS_AUTH_TOKEN 237 /* 0xED TDS 7.0 only */
112#define TDS_RESULT_TOKEN 238 /* 0xEE */
113#define TDS_DONE_TOKEN 253 /* 0xFD TDS_DONE */
114#define TDS_DONEPROC_TOKEN 254 /* 0xFE TDS_DONEPROC */
115#define TDS_DONEINPROC_TOKEN 255 /* 0xFF TDS_DONEINPROC */
116
117/* CURSOR support: TDS 5.0 only*/
118#define TDS_CURCLOSE_TOKEN 128 /* 0x80 TDS 5.0 only */
119#define TDS_CURDELETE_TOKEN 129 /* 0x81 TDS 5.0 only */
120#define TDS_CURFETCH_TOKEN 130 /* 0x82 TDS 5.0 only */
121#define TDS_CURINFO_TOKEN 131 /* 0x83 TDS 5.0 only */
122#define TDS_CUROPEN_TOKEN 132 /* 0x84 TDS 5.0 only */
123#define TDS_CURDECLARE_TOKEN 134 /* 0x86 TDS 5.0 only */
124
125
126/* environment type field */
127#define TDS_ENV_DATABASE 1
128#define TDS_ENV_LANG 2
129#define TDS_ENV_CHARSET 3
130#define TDS_ENV_PACKSIZE 4
131#define TDS_ENV_LCID 5
132#define TDS_ENV_SQLCOLLATION 7
133#define TDS_ENV_BEGINTRANS 8
134#define TDS_ENV_COMMITTRANS 9
135#define TDS_ENV_ROLLBACKTRANS 10
136#define TDS_ENV_ROUTING 20
137
138/* Microsoft internal stored procedure id's */
139#define TDS_SP_CURSOR 1
140#define TDS_SP_CURSOROPEN 2
141#define TDS_SP_CURSORPREPARE 3
142#define TDS_SP_CURSOREXECUTE 4
143#define TDS_SP_CURSORPREPEXEC 5
144#define TDS_SP_CURSORUNPREPARE 6
145#define TDS_SP_CURSORFETCH 7
146#define TDS_SP_CURSOROPTION 8
147#define TDS_SP_CURSORCLOSE 9
148#define TDS_SP_EXECUTESQL 10
149#define TDS_SP_PREPARE 11
150#define TDS_SP_EXECUTE 12
151#define TDS_SP_PREPEXEC 13
152#define TDS_SP_PREPEXECRPC 14
153#define TDS_SP_UNPREPARE 15
154
158 enum {
159 TDS_DONE_FINAL = 0x00
160 , TDS_DONE_MORE_RESULTS = 0x01
161 , TDS_DONE_ERROR = 0x02
162 , TDS_DONE_INXACT = 0x04
163 , TDS_DONE_PROC = 0x08
164 , TDS_DONE_COUNT = 0x10
165 , TDS_DONE_CANCELLED = 0x20
166 , TDS_DONE_EVENT = 0x40 /* part of an event notification. */
167 , TDS_DONE_SRVERROR = 0x100
169 /* after the above flags, a TDS_DONE packet has a field describing the state of the transaction */
170 , TDS_DONE_NO_TRAN = 0 /* No transaction in effect */
171 , TDS_DONE_TRAN_SUCCEED = 1 /* Transaction completed successfully */
172 , TDS_DONE_TRAN_PROGRESS= 2 /* Transaction in progress */
173 , TDS_DONE_STMT_ABORT = 3 /* A statement aborted */
174 , TDS_DONE_TRAN_ABORT = 4 /* Transaction aborted */
175};
176
177/*
178 * <rant> Sybase does an awful job of this stuff, non null ints of size 1 2
179 * and 4 have there own codes but nullable ints are lumped into INTN
180 * sheesh! </rant>
181 */
182 typedef enum
183{
184 SYBCHAR = 47, /* 0x2F */
185 SYBVARCHAR = 39, /* 0x27 */
186 SYBINTN = 38, /* 0x26 */
187 SYBINT1 = 48, /* 0x30 */
188 SYBINT2 = 52, /* 0x34 */
189 SYBINT4 = 56, /* 0x38 */
190 SYBFLT8 = 62, /* 0x3E */
191 SYBDATETIME = 61, /* 0x3D */
192 SYBBIT = 50, /* 0x32 */
193 SYBTEXT = 35, /* 0x23 */
194 SYBNTEXT = 99, /* 0x63 */
195 SYBIMAGE = 34, /* 0x22 */
196 SYBMONEY4 = 122, /* 0x7A */
197 SYBMONEY = 60, /* 0x3C */
198 SYBDATETIME4 = 58, /* 0x3A */
199 SYBREAL = 59, /* 0x3B */
200 SYBBINARY = 45, /* 0x2D */
201 SYBVOID = 31, /* 0x1F */
202 SYBVARBINARY = 37, /* 0x25 */
203 SYBBITN = 104, /* 0x68 */
204 SYBNUMERIC = 108, /* 0x6C */
205 SYBDECIMAL = 106, /* 0x6A */
206 SYBFLTN = 109, /* 0x6D */
207 SYBMONEYN = 110, /* 0x6E */
208 SYBDATETIMN = 111, /* 0x6F */
209
210/*
211 * MS only types
212 */
213 SYBINT8 = 127, /* 0x7F */
214 XSYBCHAR = 175, /* 0xAF */
215 XSYBVARCHAR = 167, /* 0xA7 */
216 XSYBNVARCHAR = 231, /* 0xE7 */
217 XSYBNCHAR = 239, /* 0xEF */
218 XSYBVARBINARY = 165, /* 0xA5 */
219 XSYBBINARY = 173, /* 0xAD */
220 SYBUNIQUE = 36, /* 0x24 */
221 SYBVARIANT = 98, /* 0x62 */
222 SYBMSUDT = 240, /* 0xF0 */
223 SYBMSXML = 241, /* 0xF1 */
224 SYBMSDATE = 40, /* 0x28 */
225 SYBMSTIME = 41, /* 0x29 */
226 SYBMSDATETIME2 = 42, /* 0x2a */
227 SYBMSDATETIMEOFFSET = 43,/* 0x2b */
228 SYBMSTABLE = 243, /* 0xF3 */
229
230/*
231 * Sybase only types
232 */
233 SYBNVARCHAR = 103, /* 0x67 */
234 SYBLONGBINARY = 225, /* 0xE1 */
235 SYBUINT1 = 64, /* 0x40 */
236 SYBUINT2 = 65, /* 0x41 */
237 SYBUINT4 = 66, /* 0x42 */
238 SYBUINT8 = 67, /* 0x43 */
239 SYBBLOB = 36, /* 0x24 */
240 SYBBOUNDARY = 104, /* 0x68 */
241 SYBDATE = 49, /* 0x31 */
242 SYBDATEN = 123, /* 0x7B */
243 SYB5INT8 = 191, /* 0xBF */
244 SYBINTERVAL = 46, /* 0x2E */
245 SYBLONGCHAR = 175, /* 0xAF */
246 SYBSENSITIVITY = 103, /* 0x67 */
247 SYBSINT1 = 176, /* 0xB0 */
248 SYBTIME = 51, /* 0x33 */
249 SYBTIMEN = 147, /* 0x93 */
250 SYBUINTN = 68, /* 0x44 */
251 SYBUNITEXT = 174, /* 0xAE */
252 SYBXML = 163, /* 0xA3 */
253 SYB5BIGDATETIME = 187, /* 0xBB */
254 SYB5BIGTIME = 188, /* 0xBC */
255
256} TDS_SERVER_TYPE;
257
258 typedef enum
259{
260 USER_CHAR_TYPE = 1, /* 0x01 */
261 USER_VARCHAR_TYPE = 2, /* 0x02 */
262 USER_SYSNAME_TYPE = 18, /* 0x12 */
263 USER_NCHAR_TYPE = 24, /* 0x18 */
264 USER_NVARCHAR_TYPE = 25, /* 0x19 */
265 USER_UNICHAR_TYPE = 34, /* 0x22 */
266 USER_UNIVARCHAR_TYPE = 35, /* 0x23 */
267 USER_UNITEXT_TYPE = 36, /* 0x24 */
268} TDS_USER_TYPE;
269
270/* compute operator */
271#define SYBAOPCNT 75 /* 0x4B */
272#define SYBAOPCNTU 76 /* 0x4C, obsolete */
273#define SYBAOPSUM 77 /* 0x4D */
274#define SYBAOPSUMU 78 /* 0x4E, obsolete */
275#define SYBAOPAVG 79 /* 0x4F */
276#define SYBAOPAVGU 80 /* 0x50, obsolete */
277#define SYBAOPMIN 81 /* 0x51 */
278#define SYBAOPMAX 82 /* 0x52 */
279
280/* mssql2k compute operator */
281#define SYBAOPCNT_BIG 9 /* 0x09 */
282#define SYBAOPSTDEV 48 /* 0x30 */
283#define SYBAOPSTDEVP 49 /* 0x31 */
284#define SYBAOPVAR 50 /* 0x32 */
285#define SYBAOPVARP 51 /* 0x33 */
286#define SYBAOPCHECKSUM_AGG 114 /* 0x72 */
287
291 typedef enum
292{
293 TDS_OPT_SET = 1
294 , TDS_OPT_DEFAULT = 2
295 , TDS_OPT_LIST = 3
296 , TDS_OPT_INFO = 4
297} TDS_OPTION_CMD;
298
299 typedef enum
300{
301 TDS_OPT_DATEFIRST = 1 /* 0x01 */
302 , TDS_OPT_TEXTSIZE = 2 /* 0x02 */
303 , TDS_OPT_STAT_TIME = 3 /* 0x03 */
304 , TDS_OPT_STAT_IO = 4 /* 0x04 */
305 , TDS_OPT_ROWCOUNT = 5 /* 0x05 */
306 , TDS_OPT_NATLANG = 6 /* 0x06 */
307 , TDS_OPT_DATEFORMAT = 7 /* 0x07 */
308 , TDS_OPT_ISOLATION = 8 /* 0x08 */
309 , TDS_OPT_AUTHON = 9 /* 0x09 */
310 , TDS_OPT_CHARSET = 10 /* 0x0a */
311 , TDS_OPT_SHOWPLAN = 13 /* 0x0d */
312 , TDS_OPT_NOEXEC = 14 /* 0x0e */
313 , TDS_OPT_ARITHIGNOREON = 15 /* 0x0f */
314 , TDS_OPT_ARITHABORTON = 17 /* 0x11 */
315 , TDS_OPT_PARSEONLY = 18 /* 0x12 */
316 , TDS_OPT_GETDATA = 20 /* 0x14 */
317 , TDS_OPT_NOCOUNT = 21 /* 0x15 */
318 , TDS_OPT_FORCEPLAN = 23 /* 0x17 */
319 , TDS_OPT_FORMATONLY = 24 /* 0x18 */
320 , TDS_OPT_CHAINXACTS = 25 /* 0x19 */
321 , TDS_OPT_CURCLOSEONXACT = 26 /* 0x1a */
322 , TDS_OPT_FIPSFLAG = 27 /* 0x1b */
323 , TDS_OPT_RESTREES = 28 /* 0x1c */
324 , TDS_OPT_IDENTITYON = 29 /* 0x1d */
325 , TDS_OPT_CURREAD = 30 /* 0x1e */
326 , TDS_OPT_CURWRITE = 31 /* 0x1f */
327 , TDS_OPT_IDENTITYOFF = 32 /* 0x20 */
328 , TDS_OPT_AUTHOFF = 33 /* 0x21 */
329 , TDS_OPT_ANSINULL = 34 /* 0x22 */
330 , TDS_OPT_QUOTED_IDENT = 35 /* 0x23 */
331 , TDS_OPT_ARITHIGNOREOFF = 36 /* 0x24 */
332 , TDS_OPT_ARITHABORTOFF = 37 /* 0x25 */
333 , TDS_OPT_TRUNCABORT = 38 /* 0x26 */
334} TDS_OPTION;
335
336 enum {
337 TDS_OPT_ARITHOVERFLOW = 0x01,
338 TDS_OPT_NUMERICTRUNC = 0x02
339};
340
341 enum TDS_OPT_DATEFIRST_CHOICE
342{
343 TDS_OPT_MONDAY = 1, TDS_OPT_TUESDAY = 2, TDS_OPT_WEDNESDAY = 3, TDS_OPT_THURSDAY = 4, TDS_OPT_FRIDAY = 5, TDS_OPT_SATURDAY =
344 6, TDS_OPT_SUNDAY = 7
345};
346
347 enum TDS_OPT_DATEFORMAT_CHOICE
348{
349 TDS_OPT_FMTMDY = 1, TDS_OPT_FMTDMY = 2, TDS_OPT_FMTYMD = 3, TDS_OPT_FMTYDM = 4, TDS_OPT_FMTMYD = 5, TDS_OPT_FMTDYM = 6
350};
351 enum TDS_OPT_ISOLATION_CHOICE
352{
353 TDS_OPT_LEVEL0 = 0,
354 TDS_OPT_LEVEL1 = 1,
355 TDS_OPT_LEVEL2 = 2,
356 TDS_OPT_LEVEL3 = 3
357};
358
359
360 typedef enum tds_packet_type
361{
362 TDS_QUERY = 1,
363 TDS_LOGIN = 2,
364 TDS_RPC = 3,
365 TDS_REPLY = 4,
366 TDS_CANCEL = 6,
367 TDS_BULK = 7,
368 TDS7_TRANS = 14, /* transaction management */
369 TDS_NORMAL = 15,
370 TDS7_LOGIN = 16,
371 TDS7_AUTH = 17,
372 TDS71_PRELOGIN = 18,
373 TDS72_SMP = 0x53
374} TDS_PACKET_TYPE;
375
379 typedef struct
380{
381 TDS_USMALLINT locale_id; /* master..syslanguages.lcid */
382 TDS_USMALLINT flags;
383 TDS_UCHAR charset_id; /* or zero */
384} TDS71_COLLATION;
385
389 typedef struct
390{
391 TDS_UCHAR type;
392 TDS_UCHAR status;
393 TDS_USMALLINT length;
394 TDS_USMALLINT spid;
395 TDS_UCHAR packet_id;
396 TDS_UCHAR window;
397} TDS_HEADER;
398
399 enum {
400 TDS_STATUS_EOM = 1,
401 TDS_STATUS_RESETCONNECTION = 8,
402};
403
407 typedef struct
408{
409 TDS_UCHAR signature; /* TDS72_SMP */
410 TDS_UCHAR type;
411 TDS_USMALLINT sid;
412 TDS_UINT size;
413 TDS_UINT seq;
414 TDS_UINT wnd;
415} TDS72_SMP_HEADER;
416
417 enum {
418 TDS_SMP_SYN = 1,
419 TDS_SMP_ACK = 2,
420 TDS_SMP_FIN = 4,
421 TDS_SMP_DATA = 8,
422};
423
424/* SF stands for "sort flag" */
425#define TDS_SF_BIN (TDS_USMALLINT) 0x100
426#define TDS_SF_WIDTH_INSENSITIVE (TDS_USMALLINT) 0x080
427#define TDS_SF_KATATYPE_INSENSITIVE (TDS_USMALLINT) 0x040
428#define TDS_SF_ACCENT_SENSITIVE (TDS_USMALLINT) 0x020
429#define TDS_SF_CASE_INSENSITIVE (TDS_USMALLINT) 0x010
430
431/* UT stands for user type */
432#define TDS_UT_TIMESTAMP 80
433
434
435/* mssql login options flags */
436 enum option_flag1_values {
437 TDS_BYTE_ORDER_X86 = 0,
438 TDS_CHARSET_ASCII = 0,
439 TDS_DUMPLOAD_ON = 0,
440 TDS_FLOAT_IEEE_754 = 0,
441 TDS_INIT_DB_WARN = 0,
442 TDS_SET_LANG_OFF = 0,
443 TDS_USE_DB_SILENT = 0,
444 TDS_BYTE_ORDER_68000 = 0x01,
445 TDS_CHARSET_EBDDIC = 0x02,
446 TDS_FLOAT_VAX = 0x04,
447 TDS_FLOAT_ND5000 = 0x08,
448 TDS_DUMPLOAD_OFF = 0x10, /* prevent BCP */
449 TDS_USE_DB_NOTIFY = 0x20,
450 TDS_INIT_DB_FATAL = 0x40,
451 TDS_SET_LANG_ON = 0x80
452};
453
454 enum option_flag2_values {
455 TDS_INIT_LANG_WARN = 0,
456 TDS_INTEGRATED_SECURTY_OFF = 0,
457 TDS_ODBC_OFF = 0,
458 TDS_USER_NORMAL = 0, /* SQL Server login */
459 TDS_INIT_LANG_REQUIRED = 0x01,
460 TDS_ODBC_ON = 0x02,
461 TDS_TRANSACTION_BOUNDARY71 = 0x04, /* removed in TDS 7.2 */
462 TDS_CACHE_CONNECT71 = 0x08, /* removed in TDS 7.2 */
463 TDS_USER_SERVER = 0x10, /* reserved */
464 TDS_USER_REMUSER = 0x20, /* DQ login */
465 TDS_USER_SQLREPL = 0x40, /* replication login */
466 TDS_INTEGRATED_SECURITY_ON = 0x80
467};
468
469 enum option_flag3_values {
470 TDS_RESTRICTED_COLLATION = 0,
471 TDS_CHANGE_PASSWORD = 0x01, /* TDS 7.2 */
472 TDS_SEND_YUKON_BINARY_XML = 0x02, /* TDS 7.2 */
473 TDS_REQUEST_USER_INSTANCE = 0x04, /* TDS 7.2 */
474 TDS_UNKNOWN_COLLATION_HANDLING = 0x08, /* TDS 7.3 */
475 TDS_EXTENSION = 0x10, /* TDS 7.4 */
476};
477
478 enum type_flags {
479 TDS_OLEDB_ON = 0x10,
480 TDS_READONLY_INTENT = 0x20,
481};
482
483/* Sybase dynamic types */
484 enum dynamic_types {
485 TDS_DYN_PREPARE = 0x01,
486 TDS_DYN_EXEC = 0x02,
487 TDS_DYN_DEALLOC = 0x04,
488 TDS_DYN_EXEC_IMMED = 0x08,
489 TDS_DYN_PROCNAME = 0x10,
490 TDS_DYN_ACK = 0x20,
491 TDS_DYN_DESCIN = 0x40,
492 TDS_DYN_DESCOUT = 0x80,
493};
494
495/* http://jtds.sourceforge.net/apiCursors.html */
496/* Cursor scroll option, must be one of 0x01 - 0x10, OR'd with other bits */
497 enum {
498 TDS_CUR_TYPE_KEYSET = 0x0001, /* default */
499 TDS_CUR_TYPE_DYNAMIC = 0x0002,
500 TDS_CUR_TYPE_FORWARD = 0x0004,
501 TDS_CUR_TYPE_STATIC = 0x0008,
502 TDS_CUR_TYPE_FASTFORWARDONLY = 0x0010,
503 TDS_CUR_TYPE_PARAMETERIZED = 0x1000,
504 TDS_CUR_TYPE_AUTO_FETCH = 0x2000
505};
506
507 enum {
508 TDS_CUR_CONCUR_READ_ONLY = 1,
509 TDS_CUR_CONCUR_SCROLL_LOCKS = 2,
510 TDS_CUR_CONCUR_OPTIMISTIC = 4, /* default */
511 TDS_CUR_CONCUR_OPTIMISTIC_VALUES = 8
512};
513
514/* TDS 4/5 login*/
515#define TDS_MAXNAME 30 /* maximum login name lenghts */
516#define TDS_PROGNLEN 10 /* maximum program lenght */
517#define TDS_PKTLEN 6 /* maximum packet lenght in login */
518
519/* TDS 5 login security flags */
520 enum {
521 TDS5_SEC_LOG_ENCRYPT = 1,
522 TDS5_SEC_LOG_CHALLENGE = 2,
523 TDS5_SEC_LOG_LABELS = 4,
524 TDS5_SEC_LOG_APPDEFINED = 8,
525 TDS5_SEC_LOG_SECSESS = 16,
526 TDS5_SEC_LOG_ENCRYPT2 = 32,
527 TDS5_SEC_LOG_ENCRYPT3 = 128,
528};
529
531 enum {
532 TDS5_MSG_SEC_ENCRYPT = 1,
533 TDS5_MSG_SEC_LOGPWD = 2,
534 TDS5_MSG_SEC_REMPWD = 3,
535 TDS5_MSG_SEC_CHALLENGE = 4,
536 TDS5_MSG_SEC_RESPONSE = 5,
537 TDS5_MSG_SEC_GETLABEL = 6,
538 TDS5_MSG_SEC_LABEL = 7,
539 TDS5_MSG_SQL_TBLNAME = 8,
540 TDS5_MSG_GW_RESERVED = 9,
541 TDS5_MSG_OMNI_CAPABILITIES = 10,
542 TDS5_MSG_SEC_OPAQUE = 11,
543 TDS5_MSG_HAFAILOVER = 12,
544 TDS5_MSG_EMPTY = 13,
547 TDS5_MSG_SEC_ENCRYPT2 = 14,
548 TDS5_MSG_SEC_LOGPWD2 = 15,
549 TDS5_MSG_SEC_SUP_CIPHER = 16,
550 TDS5_MSG_MIG_REQ = 17,
552 TDS5_MSG_MIG_SYNC = 18,
553 TDS5_MSG_MIG_CONT = 19,
554 TDS5_MSG_MIG_IGN = 20,
555 TDS5_MSG_MIG_FAIL = 21,
557 TDS5_MSG_SEC_REMPWD2 = 22,
558 TDS5_MSG_MIG_RESUME = 23,
559 TDS5_MSG_SEC_ENCRYPT3 = 30,
560 TDS5_MSG_SEC_LOGPWD3 = 31,
561 TDS5_MSG_SEC_REMPWD3 = 32,
562 TDS5_MSG_DR_MAP = 33,
563};
564
575 enum {
576 TDS5_SEC_SECSESS = 1,
577 TDS5_SEC_FORWARD = 2,
578 TDS5_SEC_SIGN = 3,
579 TDS5_SEC_OTHER = 4,
580};
581
585 enum {
586 TDS5_SEC_NETWORK_AUTHENTICATION = 0x1,
587 TDS5_SEC_MUTUAL_AUTHENTICATION = 0x2,
588 TDS5_SEC_DELEGATION = 0x4,
589 TDS5_SEC_INTEGRITY = 0x8,
590 TDS5_SEC_CONFIDENTIALITY = 0x10,
591 TDS5_SEC_DETECT_REPLAY = 0x20,
592 TDS5_SEC_DETECT_SEQUENCE = 0x40,
593 TDS5_SEC_DATA_ORIGIN = 0x80,
594 TDS5_SEC_CHANNEL_BINDING = 0x100,
595};
596
597 enum {
598 TDS5_SEC_VERSION = 50,
599};
600
601/* MS encryption byte (pre login) */
602 enum {
603 TDS7_ENCRYPT_OFF,
604 TDS7_ENCRYPT_ON,
605 TDS7_ENCRYPT_NOT_SUP,
606 TDS7_ENCRYPT_REQ,
607};
tdsnumeric
Definition proto.h:26
tdsoldmoney
Definition proto.h:33
tdsmoney
Definition proto.h:39
tdsmoney4
Definition proto.h:45
tdsdatetime
Definition proto.h:50
tdsdatetime4
Definition proto.h:56
tdsunique
Definition proto.h:62
TDS71_COLLATION
TDS 7.1 collation information.
Definition proto.h:380
TDS_HEADER
TDS packet header.
Definition proto.h:390
TDS72_SMP_HEADER
TDS 7.2 SMP packet header.
Definition proto.h:408