Subversion Repositories shark

Rev

Rev 422 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
422 giacomo 1
#ifndef _SMBNO_H_
2
#define _SMBNO_H_
3
 
4
/* these define the attribute byte as seen by DOS */
5
#define aRONLY  (1L<<0)
6
#define aHIDDEN (1L<<1)
7
#define aSYSTEM (1L<<2)
8
#define aVOLID  (1L<<3)
9
#define aDIR    (1L<<4)
10
#define aARCH   (1L<<5)
11
 
12
/* error classes */
13
#define SUCCESS 0  /* The request was successful. */
14
#define ERRDOS 0x01 /*  Error is from the core DOS operating system set. */
15
#define ERRSRV 0x02 /* Error is generated by the server network file manager.*/
16
#define ERRHRD 0x03  /* Error is an hardware error. */
17
#define ERRCMD 0xFF  /* Command was not in the "SMB" format. */
18
 
19
/* SMB X/Open error codes for the ERRdos error class */
20
 
21
#define ERRbadfunc 1            /* Invalid function (or system call) */
22
#define ERRbadfile 2            /* File not found (pathname error) */
23
#define ERRbadpath 3            /* Directory not found */
24
#define ERRnofids 4             /* Too many open files */
25
#define ERRnoaccess 5           /* Access denied */
26
#define ERRbadfid 6             /* Invalid fid */
27
#define ERRbadmcb 7             /* Memory control blocks destroyed */
28
#define ERRnomem 8              /* Out of memory */
29
#define ERRbadmem 9             /* Invalid memory block address */
30
#define ERRbadenv 10            /* Invalid environment */
31
#define ERRbadformat 11         /* Invalid format */
32
#define ERRbadaccess 12         /* Invalid open mode */
33
#define ERRbaddata 13           /* Invalid data (only from ioctl call) */
34
#define ERRres 14               /* reserved */
35
#define ERRbaddrive 15          /* Invalid drive */
36
#define ERRremcd 16             /* Attempt to delete current directory */
37
#define ERRdiffdevice 17        /* rename/move across different filesystems */
38
#define ERRnofiles 18           /* no more files found in file search */
39
#define ERRbadshare 32          /* Share mode on file conflict with open mode */
40
#define ERRlock 33              /* Lock request conflicts with existing lock */
41
#define ERRfilexists 80         /* File in operation already exists */
42
#define ERRbadpipe 230          /* Named pipe invalid */
43
#define ERRpipebusy 231         /* All instances of pipe are busy */
44
#define ERRpipeclosing 232      /* named pipe close in progress */
45
#define ERRnotconnected 233     /* No process on other end of named pipe */
46
#define ERRmoredata 234         /* More data to be returned */
47
 
48
#define ERROR_INVALID_PARAMETER  87
49
#define ERROR_DISK_FULL         112
50
#define ERROR_INVALID_NAME      123
51
#define ERROR_DIR_NOT_EMPTY     145
52
#define ERROR_NOT_LOCKED        158
53
#define ERROR_ALREADY_EXISTS    183  /* see also 80 ? */
54
#define ERROR_EAS_DIDNT_FIT     275 /* Extended attributes didn't fit */
55
#define ERROR_EAS_NOT_SUPPORTED 282 /* Extended attributes not supported */
56
 
57
/* Error codes for the ERRSRV class */
58
 
59
#define ERRerror 1              /* Non specific error code */
60
#define ERRbadpw 2              /* Bad password */
61
#define ERRbadtype 3            /* reserved */
62
#define ERRaccess 4          /* No permissions to do the requested operation */
63
#define ERRinvnid 5             /* tid invalid */
64
#define ERRinvnetname 6         /* Invalid servername */
65
#define ERRinvdevice 7          /* Invalid device */
66
#define ERRqfull 49             /* Print queue full */
67
#define ERRqtoobig 50           /* Queued item too big */
68
#define ERRinvpfid 52           /* Invalid print file in smb_fid */
69
#define ERRsmbcmd 64            /* Unrecognised command */
70
#define ERRsrverror 65          /* smb server internal error */
71
#define ERRfilespecs 67         /* fid and pathname invalid combination */
72
#define ERRbadlink 68           /* reserved */
73
#define ERRbadpermits 69        /* Access specified for a file is not valid */
74
#define ERRbadpid 70            /* reserved */
75
#define ERRsetattrmode 71       /* attribute mode invalid */
76
#define ERRpaused 81            /* Message server paused */
77
#define ERRmsgoff 82            /* Not receiving messages */
78
#define ERRnoroom 83            /* No room for message */
79
#define ERRrmuns 87             /* too many remote usernames */
80
#define ERRtimeout 88           /* operation timed out */
81
#define ERRnoresource  89   /* No resources currently available for request. */
82
#define ERRtoomanyuids 90       /* too many userids */
83
#define ERRbaduid 91            /* bad userid */
84
#define ERRuseMPX 250    /* temporarily unable to use raw mode, use MPX mode */
85
#define ERRuseSTD 251    /* temporarily unable to use raw mode, use std.mode */
86
#define ERRcontMPX 252          /* resume MPX mode */
87
#define ERRbadPW                /* reserved */
88
#define ERRnosupport 0xFFFF
89
 
90
/* Error codes for the ERRHRD class */
91
 
92
#define ERRnowrite 19           /* read only media */
93
#define ERRbadunit 20           /* Unknown device */
94
#define ERRnotready 21          /* Drive not ready */
95
#define ERRbadcmd 22            /* Unknown command */
96
#define ERRdata 23              /* Data (CRC) error */
97
#define ERRbadreq 24            /* Bad request structure length */
98
#define ERRseek 25
99
#define ERRbadmedia 26
100
#define ERRbadsector 27
101
#define ERRnopaper 28
102
#define ERRwrite 29             /* write fault */
103
#define ERRread 30              /* read fault */
104
#define ERRgeneral 31           /* General hardware failure */
105
#define ERRwrongdisk 34
106
#define ERRFCBunavail 35
107
#define ERRsharebufexc 36       /* share buffer exceeded */
108
#define ERRdiskfull 39
109
 
110
/*
111
 * Access modes when opening a file
112
 */
113
#define SMB_ACCMASK     0x0003
114
#define SMB_O_RDONLY    0x0000
115
#define SMB_O_WRONLY    0x0001
116
#define SMB_O_RDWR      0x0002
117
 
118
/* offsets into message for common items */
119
#define smb_com 8
120
#define smb_rcls 9
121
#define smb_reh 10
122
#define smb_err 11
123
#define smb_flg 13
124
#define smb_flg2 14
125
#define smb_reb 13
126
#define smb_tid 28
127
#define smb_pid 30
128
#define smb_uid 32
129
#define smb_mid 34
130
#define smb_wct 36
131
#define smb_vwv 37
132
#define smb_vwv0 37
133
#define smb_vwv1 39
134
#define smb_vwv2 41
135
#define smb_vwv3 43
136
#define smb_vwv4 45
137
#define smb_vwv5 47
138
#define smb_vwv6 49
139
#define smb_vwv7 51
140
#define smb_vwv8 53
141
#define smb_vwv9 55
142
#define smb_vwv10 57
143
#define smb_vwv11 59
144
#define smb_vwv12 61
145
#define smb_vwv13 63
146
#define smb_vwv14 65
147
 
148
/* these are the trans2 sub fields for primary requests */
149
#define smb_tpscnt smb_vwv0
150
#define smb_tdscnt smb_vwv1
151
#define smb_mprcnt smb_vwv2
152
#define smb_mdrcnt smb_vwv3
153
#define smb_msrcnt smb_vwv4
154
#define smb_flags smb_vwv5
155
#define smb_timeout smb_vwv6
156
#define smb_pscnt smb_vwv9
157
#define smb_psoff smb_vwv10
158
#define smb_dscnt smb_vwv11
159
#define smb_dsoff smb_vwv12
160
#define smb_suwcnt smb_vwv13
161
#define smb_setup smb_vwv14
162
#define smb_setup0 smb_setup
163
#define smb_setup1 (smb_setup+2)
164
#define smb_setup2 (smb_setup+4)
165
 
166
/* these are for the secondary requests */
167
#define smb_spscnt smb_vwv2
168
#define smb_spsoff smb_vwv3
169
#define smb_spsdisp smb_vwv4
170
#define smb_sdscnt smb_vwv5
171
#define smb_sdsoff smb_vwv6
172
#define smb_sdsdisp smb_vwv7
173
#define smb_sfid smb_vwv8
174
 
175
/* and these for responses */
176
#define smb_tprcnt smb_vwv0
177
#define smb_tdrcnt smb_vwv1
178
#define smb_prcnt smb_vwv3
179
#define smb_proff smb_vwv4
180
#define smb_prdisp smb_vwv5
181
#define smb_drcnt smb_vwv6
182
#define smb_droff smb_vwv7
183
#define smb_drdisp smb_vwv8
184
 
185
/* the complete */
186
#define SMBmkdir      0x00   /* create directory */
187
#define SMBrmdir      0x01   /* delete directory */
188
#define SMBopen       0x02   /* open file */
189
#define SMBcreate     0x03   /* create file */
190
#define SMBclose      0x04   /* close file */
191
#define SMBflush      0x05   /* flush file */
192
#define SMBunlink     0x06   /* delete file */
193
#define SMBmv         0x07   /* rename file */
194
#define SMBgetatr     0x08   /* get file attributes */
195
#define SMBsetatr     0x09   /* set file attributes */
196
#define SMBread       0x0A   /* read from file */
197
#define SMBwrite      0x0B   /* write to file */
198
#define SMBlock       0x0C   /* lock byte range */
199
#define SMBunlock     0x0D   /* unlock byte range */
200
#define SMBctemp      0x0E   /* create temporary file */
201
#define SMBmknew      0x0F   /* make new file */
202
#define SMBchkpth     0x10   /* check directory path */
203
#define SMBexit       0x11   /* process exit */
204
#define SMBlseek      0x12   /* seek */
205
#define SMBtcon       0x70   /* tree connect */
206
#define SMBtconX      0x75   /* tree connect and X*/
207
#define SMBtdis       0x71   /* tree disconnect */
208
#define SMBnegprot    0x72   /* negotiate protocol */
209
#define SMBdskattr    0x80   /* get disk attributes */
210
#define SMBsearch     0x81   /* search directory */
211
#define SMBsplopen    0xC0   /* open print spool file */
212
#define SMBsplwr      0xC1   /* write to print spool file */
213
#define SMBsplclose   0xC2   /* close print spool file */
214
#define SMBsplretq    0xC3   /* return print queue */
215
#define SMBsends      0xD0   /* send single block message */
216
#define SMBsendb      0xD1   /* send broadcast message */
217
#define SMBfwdname    0xD2   /* forward user name */
218
#define SMBcancelf    0xD3   /* cancel forward */
219
#define SMBgetmac     0xD4   /* get machine name */
220
#define SMBsendstrt   0xD5   /* send start of multi-block message */
221
#define SMBsendend    0xD6   /* send end of multi-block message */
222
#define SMBsendtxt    0xD7   /* send text of multi-block message */
223
 
224
/* Core+ protocol */
225
#define SMBlockread       0x13   /* Lock a range and read */
226
#define SMBwriteunlock 0x14 /* Unlock a range then write */
227
#define SMBreadbraw   0x1a  /* read a block of data with no smb header */
228
#define SMBwritebraw  0x1d  /* write a block of data with no smb header */
229
#define SMBwritec     0x20  /* secondary write request */
230
#define SMBwriteclose 0x2c  /* write a file then close it */
231
 
232
/* dos extended protocol */
233
#define SMBreadBraw      0x1A   /* read block raw */
234
#define SMBreadBmpx      0x1B   /* read block multiplexed */
235
#define SMBreadBs        0x1C   /* read block (secondary response) */
236
#define SMBwriteBraw     0x1D   /* write block raw */
237
#define SMBwriteBmpx     0x1E   /* write block multiplexed */
238
#define SMBwriteBs       0x1F   /* write block (secondary request) */
239
#define SMBwriteC        0x20   /* write complete response */
240
#define SMBsetattrE      0x22   /* set file attributes expanded */
241
#define SMBgetattrE      0x23   /* get file attributes expanded */
242
#define SMBlockingX      0x24   /* lock/unlock byte ranges and X */
243
#define SMBtrans         0x25   /* transaction - name, bytes in/out */
244
#define SMBtranss        0x26   /* transaction (secondary request/response) */
245
#define SMBioctl         0x27   /* IOCTL */
246
#define SMBioctls        0x28   /* IOCTL  (secondary request/response) */
247
#define SMBcopy          0x29   /* copy */
248
#define SMBmove          0x2A   /* move */
249
#define SMBecho          0x2B   /* echo */
250
#define SMBopenX         0x2D   /* open and X */
251
#define SMBreadX         0x2E   /* read and X */
252
#define SMBwriteX        0x2F   /* write and X */
253
#define SMBsesssetupX    0x73   /* Session Set Up & X (including User Logon) */
254
#define SMBtconX         0x75   /* tree connect and X */
255
#define SMBffirst        0x82   /* find first */
256
#define SMBfunique       0x83   /* find unique */
257
#define SMBfclose        0x84   /* find close */
258
#define SMBinvalid       0xFE   /* invalid command */
259
 
260
 
261
/* Extended 2.0 protocol */
262
#define SMBtrans2        0x32   /* TRANS2 protocol set */
263
#define SMBtranss2       0x33   /* TRANS2 protocol set, secondary command */
264
#define SMBfindclose     0x34   /* Terminate a TRANSACT2_FINDFIRST */
265
#define SMBfindnclose    0x35   /* Terminate a TRANSACT2_FINDNOTIFYFIRST */
266
#define SMBulogoffX      0x74   /* user logoff */
267
 
268
/* these are the TRANS2 sub commands */
269
#define TRANSACT2_OPEN          0
270
#define TRANSACT2_FINDFIRST     1
271
#define TRANSACT2_FINDNEXT      2
272
#define TRANSACT2_QFSINFO       3
273
#define TRANSACT2_SETFSINFO     4
274
#define TRANSACT2_QPATHINFO     5
275
#define TRANSACT2_SETPATHINFO   6
276
#define TRANSACT2_QFILEINFO     7
277
#define TRANSACT2_SETFILEINFO   8
278
#define TRANSACT2_FSCTL         9
279
#define TRANSACT2_IOCTL           10
280
#define TRANSACT2_FINDNOTIFYFIRST 11
281
#define TRANSACT2_FINDNOTIFYNEXT  12
282
#define TRANSACT2_MKDIR           13
283
 
284
/* Information Levels -  Shared? */
285
#define SMB_INFO_STANDARD               1
286
#define SMB_INFO_QUERY_EA_SIZE          2
287
#define SMB_INFO_QUERY_EAS_FROM_LIST    3
288
#define SMB_INFO_QUERY_ALL_EAS          4
289
#define SMB_INFO_IS_NAME_VALID          6
290
 
291
/* Information Levels -  TRANSACT2_FINDFIRST */
292
#define SMB_FIND_FILE_DIRECTORY_INFO            0x101
293
#define SMB_FIND_FILE_FULL_DIRECTORY_INFO       0x102
294
#define SMB_FIND_FILE_NAMES_INFO                0x103
295
#define SMB_FIND_FILE_BOTH_DIRECTORY_INFO       0x104
296
 
297
/* Information Levels -  TRANSACT2_QPATHINFO */
298
#define SMB_QUERY_FILE_BASIC_INFO       0x101
299
#define SMB_QUERY_FILE_STANDARD_INFO    0x102
300
#define SMB_QUERY_FILE_EA_INFO          0x103
301
#define SMB_QUERY_FILE_NAME_INFO        0x104
302
#define SMB_QUERY_FILE_ALL_INFO         0x107
303
#define SMB_QUERY_FILE_ALT_NAME_INFO    0x108
304
#define SMB_QUERY_FILE_STREAM_INFO      0x109
305
#define SMB_QUERY_FILE_COMPRESSION_INFO 0x10b
306
 
307
/* Information Levels - TRANSACT2_SETFILEINFO */
308
#define SMB_SET_FILE_BASIC_INFO         0x101
309
#define SMB_SET_FILE_DISPOSITION_INFO   0x102
310
#define SMB_SET_FILE_ALLOCATION_INFO    0x103
311
#define SMB_SET_FILE_END_OF_FILE_INFO   0x104
312
 
313
/* smb_flg field flags */
314
#define SMB_FLAGS_SUPPORT_LOCKREAD      0x01
315
#define SMB_FLAGS_CLIENT_BUF_AVAIL      0x02
316
#define SMB_FLAGS_RESERVED              0x04
317
#define SMB_FLAGS_CASELESS_PATHNAMES    0x08
318
#define SMB_FLAGS_CANONICAL_PATHNAMES   0x10
319
#define SMB_FLAGS_REQUEST_OPLOCK        0x20
320
#define SMB_FLAGS_REQUEST_BATCH_OPLOCK  0x40
321
#define SMB_FLAGS_REPLY                 0x80
322
 
323
/* smb_flg2 field flags (samba-2.2.0/source/include/smb.h) */
324
#define SMB_FLAGS2_LONG_PATH_COMPONENTS         0x0001
325
#define SMB_FLAGS2_EXTENDED_ATTRIBUTES          0x0002
326
#define SMB_FLAGS2_DFS_PATHNAMES                0x1000
327
#define SMB_FLAGS2_READ_PERMIT_NO_EXECUTE       0x2000
328
#define SMB_FLAGS2_32_BIT_ERROR_CODES           0x4000 
329
#define SMB_FLAGS2_UNICODE_STRINGS              0x8000
330
 
331
 
332
/*
333
 * UNIX stuff  (from samba trans2.h)
334
 */
335
#define MIN_UNIX_INFO_LEVEL             0x200
336
#define MAX_UNIX_INFO_LEVEL             0x2FF
337
#define SMB_FIND_FILE_UNIX              0x202
338
#define SMB_QUERY_FILE_UNIX_BASIC       0x200
339
#define SMB_QUERY_FILE_UNIX_LINK        0x201
340
#define SMB_QUERY_FILE_UNIX_HLINK       0x202
341
#define SMB_SET_FILE_UNIX_BASIC         0x200
342
#define SMB_SET_FILE_UNIX_LINK          0x201
343
#define SMB_SET_FILE_UNIX_HLINK         0x203
344
#define SMB_QUERY_CIFS_UNIX_INFO        0x200
345
 
346
/* values which means "don't change it" */
347
#define SMB_MODE_NO_CHANGE              0xFFFFFFFF
348
#define SMB_UID_NO_CHANGE               0xFFFFFFFF
349
#define SMB_GID_NO_CHANGE               0xFFFFFFFF
350
#define SMB_TIME_NO_CHANGE              0xFFFFFFFFFFFFFFFFULL
351
#define SMB_SIZE_NO_CHANGE              0xFFFFFFFFFFFFFFFFULL
352
 
353
/* UNIX filetype mappings. */
354
#define UNIX_TYPE_FILE          0
355
#define UNIX_TYPE_DIR           1
356
#define UNIX_TYPE_SYMLINK       2
357
#define UNIX_TYPE_CHARDEV       3
358
#define UNIX_TYPE_BLKDEV        4
359
#define UNIX_TYPE_FIFO          5
360
#define UNIX_TYPE_SOCKET        6
361
#define UNIX_TYPE_UNKNOWN       0xFFFFFFFF
362
 
363
#endif /* _SMBNO_H_ */