1 |
1633 |
jcastillo |
#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 |
|
|
#define ERROR_EAS_DIDNT_FIT 275 /* Extended attributes didn't fit */
|
48 |
|
|
#define ERROR_EAS_NOT_SUPPORTED 282 /* Extended attributes not supported */
|
49 |
|
|
|
50 |
|
|
/* Error codes for the ERRSRV class */
|
51 |
|
|
|
52 |
|
|
#define ERRerror 1 /* Non specific error code */
|
53 |
|
|
#define ERRbadpw 2 /* Bad password */
|
54 |
|
|
#define ERRbadtype 3 /* reserved */
|
55 |
|
|
#define ERRaccess 4 /* No permissions to do the requested operation */
|
56 |
|
|
#define ERRinvnid 5 /* tid invalid */
|
57 |
|
|
#define ERRinvnetname 6 /* Invalid servername */
|
58 |
|
|
#define ERRinvdevice 7 /* Invalid device */
|
59 |
|
|
#define ERRqfull 49 /* Print queue full */
|
60 |
|
|
#define ERRqtoobig 50 /* Queued item too big */
|
61 |
|
|
#define ERRinvpfid 52 /* Invalid print file in smb_fid */
|
62 |
|
|
#define ERRsmbcmd 64 /* Unrecognised command */
|
63 |
|
|
#define ERRsrverror 65 /* smb server internal error */
|
64 |
|
|
#define ERRfilespecs 67 /* fid and pathname invalid combination */
|
65 |
|
|
#define ERRbadlink 68 /* reserved */
|
66 |
|
|
#define ERRbadpermits 69 /* Access specified for a file is not valid */
|
67 |
|
|
#define ERRbadpid 70 /* reserved */
|
68 |
|
|
#define ERRsetattrmode 71 /* attribute mode invalid */
|
69 |
|
|
#define ERRpaused 81 /* Message server paused */
|
70 |
|
|
#define ERRmsgoff 82 /* Not receiving messages */
|
71 |
|
|
#define ERRnoroom 83 /* No room for message */
|
72 |
|
|
#define ERRrmuns 87 /* too many remote usernames */
|
73 |
|
|
#define ERRtimeout 88 /* operation timed out */
|
74 |
|
|
#define ERRnoresource 89 /* No resources currently available for request. */
|
75 |
|
|
#define ERRtoomanyuids 90 /* too many userids */
|
76 |
|
|
#define ERRbaduid 91 /* bad userid */
|
77 |
|
|
#define ERRuseMPX 250 /* temporarily unable to use raw mode, use MPX mode */
|
78 |
|
|
#define ERRuseSTD 251 /* temporarily unable to use raw mode, use std.mode */
|
79 |
|
|
#define ERRcontMPX 252 /* resume MPX mode */
|
80 |
|
|
#define ERRbadPW /* reserved */
|
81 |
|
|
#define ERRnosupport 0xFFFF
|
82 |
|
|
|
83 |
|
|
/* Error codes for the ERRHRD class */
|
84 |
|
|
|
85 |
|
|
#define ERRnowrite 19 /* read only media */
|
86 |
|
|
#define ERRbadunit 20 /* Unknown device */
|
87 |
|
|
#define ERRnotready 21 /* Drive not ready */
|
88 |
|
|
#define ERRbadcmd 22 /* Unknown command */
|
89 |
|
|
#define ERRdata 23 /* Data (CRC) error */
|
90 |
|
|
#define ERRbadreq 24 /* Bad request structure length */
|
91 |
|
|
#define ERRseek 25
|
92 |
|
|
#define ERRbadmedia 26
|
93 |
|
|
#define ERRbadsector 27
|
94 |
|
|
#define ERRnopaper 28
|
95 |
|
|
#define ERRwrite 29 /* write fault */
|
96 |
|
|
#define ERRread 30 /* read fault */
|
97 |
|
|
#define ERRgeneral 31 /* General hardware failure */
|
98 |
|
|
#define ERRwrongdisk 34
|
99 |
|
|
#define ERRFCBunavail 35
|
100 |
|
|
#define ERRsharebufexc 36 /* share buffer exceeded */
|
101 |
|
|
#define ERRdiskfull 39
|
102 |
|
|
|
103 |
|
|
/* offsets into message for common items */
|
104 |
|
|
#define smb_com 8
|
105 |
|
|
#define smb_rcls 9
|
106 |
|
|
#define smb_reh 10
|
107 |
|
|
#define smb_err 11
|
108 |
|
|
#define smb_flg 13
|
109 |
|
|
#define smb_flg2 14
|
110 |
|
|
#define smb_reb 13
|
111 |
|
|
#define smb_tid 28
|
112 |
|
|
#define smb_pid 30
|
113 |
|
|
#define smb_uid 32
|
114 |
|
|
#define smb_mid 34
|
115 |
|
|
#define smb_wct 36
|
116 |
|
|
#define smb_vwv 37
|
117 |
|
|
#define smb_vwv0 37
|
118 |
|
|
#define smb_vwv1 39
|
119 |
|
|
#define smb_vwv2 41
|
120 |
|
|
#define smb_vwv3 43
|
121 |
|
|
#define smb_vwv4 45
|
122 |
|
|
#define smb_vwv5 47
|
123 |
|
|
#define smb_vwv6 49
|
124 |
|
|
#define smb_vwv7 51
|
125 |
|
|
#define smb_vwv8 53
|
126 |
|
|
#define smb_vwv9 55
|
127 |
|
|
#define smb_vwv10 57
|
128 |
|
|
#define smb_vwv11 59
|
129 |
|
|
#define smb_vwv12 61
|
130 |
|
|
#define smb_vwv13 63
|
131 |
|
|
#define smb_vwv14 65
|
132 |
|
|
|
133 |
|
|
/* these are the trans2 sub fields for primary requests */
|
134 |
|
|
#define smb_tpscnt smb_vwv0
|
135 |
|
|
#define smb_tdscnt smb_vwv1
|
136 |
|
|
#define smb_mprcnt smb_vwv2
|
137 |
|
|
#define smb_mdrcnt smb_vwv3
|
138 |
|
|
#define smb_msrcnt smb_vwv4
|
139 |
|
|
#define smb_flags smb_vwv5
|
140 |
|
|
#define smb_timeout smb_vwv6
|
141 |
|
|
#define smb_pscnt smb_vwv9
|
142 |
|
|
#define smb_psoff smb_vwv10
|
143 |
|
|
#define smb_dscnt smb_vwv11
|
144 |
|
|
#define smb_dsoff smb_vwv12
|
145 |
|
|
#define smb_suwcnt smb_vwv13
|
146 |
|
|
#define smb_setup smb_vwv14
|
147 |
|
|
#define smb_setup0 smb_setup
|
148 |
|
|
#define smb_setup1 (smb_setup+2)
|
149 |
|
|
#define smb_setup2 (smb_setup+4)
|
150 |
|
|
|
151 |
|
|
/* these are for the secondary requests */
|
152 |
|
|
#define smb_spscnt smb_vwv2
|
153 |
|
|
#define smb_spsoff smb_vwv3
|
154 |
|
|
#define smb_spsdisp smb_vwv4
|
155 |
|
|
#define smb_sdscnt smb_vwv5
|
156 |
|
|
#define smb_sdsoff smb_vwv6
|
157 |
|
|
#define smb_sdsdisp smb_vwv7
|
158 |
|
|
#define smb_sfid smb_vwv8
|
159 |
|
|
|
160 |
|
|
/* and these for responses */
|
161 |
|
|
#define smb_tprcnt smb_vwv0
|
162 |
|
|
#define smb_tdrcnt smb_vwv1
|
163 |
|
|
#define smb_prcnt smb_vwv3
|
164 |
|
|
#define smb_proff smb_vwv4
|
165 |
|
|
#define smb_prdisp smb_vwv5
|
166 |
|
|
#define smb_drcnt smb_vwv6
|
167 |
|
|
#define smb_droff smb_vwv7
|
168 |
|
|
#define smb_drdisp smb_vwv8
|
169 |
|
|
|
170 |
|
|
/* the complete */
|
171 |
|
|
#define SMBmkdir 0x00 /* create directory */
|
172 |
|
|
#define SMBrmdir 0x01 /* delete directory */
|
173 |
|
|
#define SMBopen 0x02 /* open file */
|
174 |
|
|
#define SMBcreate 0x03 /* create file */
|
175 |
|
|
#define SMBclose 0x04 /* close file */
|
176 |
|
|
#define SMBflush 0x05 /* flush file */
|
177 |
|
|
#define SMBunlink 0x06 /* delete file */
|
178 |
|
|
#define SMBmv 0x07 /* rename file */
|
179 |
|
|
#define SMBgetatr 0x08 /* get file attributes */
|
180 |
|
|
#define SMBsetatr 0x09 /* set file attributes */
|
181 |
|
|
#define SMBread 0x0A /* read from file */
|
182 |
|
|
#define SMBwrite 0x0B /* write to file */
|
183 |
|
|
#define SMBlock 0x0C /* lock byte range */
|
184 |
|
|
#define SMBunlock 0x0D /* unlock byte range */
|
185 |
|
|
#define SMBctemp 0x0E /* create temporary file */
|
186 |
|
|
#define SMBmknew 0x0F /* make new file */
|
187 |
|
|
#define SMBchkpth 0x10 /* check directory path */
|
188 |
|
|
#define SMBexit 0x11 /* process exit */
|
189 |
|
|
#define SMBlseek 0x12 /* seek */
|
190 |
|
|
#define SMBtcon 0x70 /* tree connect */
|
191 |
|
|
#define SMBtconX 0x75 /* tree connect and X*/
|
192 |
|
|
#define SMBtdis 0x71 /* tree disconnect */
|
193 |
|
|
#define SMBnegprot 0x72 /* negotiate protocol */
|
194 |
|
|
#define SMBdskattr 0x80 /* get disk attributes */
|
195 |
|
|
#define SMBsearch 0x81 /* search directory */
|
196 |
|
|
#define SMBsplopen 0xC0 /* open print spool file */
|
197 |
|
|
#define SMBsplwr 0xC1 /* write to print spool file */
|
198 |
|
|
#define SMBsplclose 0xC2 /* close print spool file */
|
199 |
|
|
#define SMBsplretq 0xC3 /* return print queue */
|
200 |
|
|
#define SMBsends 0xD0 /* send single block message */
|
201 |
|
|
#define SMBsendb 0xD1 /* send broadcast message */
|
202 |
|
|
#define SMBfwdname 0xD2 /* forward user name */
|
203 |
|
|
#define SMBcancelf 0xD3 /* cancel forward */
|
204 |
|
|
#define SMBgetmac 0xD4 /* get machine name */
|
205 |
|
|
#define SMBsendstrt 0xD5 /* send start of multi-block message */
|
206 |
|
|
#define SMBsendend 0xD6 /* send end of multi-block message */
|
207 |
|
|
#define SMBsendtxt 0xD7 /* send text of multi-block message */
|
208 |
|
|
|
209 |
|
|
/* Core+ protocol */
|
210 |
|
|
#define SMBlockread 0x13 /* Lock a range and read */
|
211 |
|
|
#define SMBwriteunlock 0x14 /* Unlock a range then write */
|
212 |
|
|
#define SMBreadbraw 0x1a /* read a block of data with no smb header */
|
213 |
|
|
#define SMBwritebraw 0x1d /* write a block of data with no smb header */
|
214 |
|
|
#define SMBwritec 0x20 /* secondary write request */
|
215 |
|
|
#define SMBwriteclose 0x2c /* write a file then close it */
|
216 |
|
|
|
217 |
|
|
/* dos extended protocol */
|
218 |
|
|
#define SMBreadBraw 0x1A /* read block raw */
|
219 |
|
|
#define SMBreadBmpx 0x1B /* read block multiplexed */
|
220 |
|
|
#define SMBreadBs 0x1C /* read block (secondary response) */
|
221 |
|
|
#define SMBwriteBraw 0x1D /* write block raw */
|
222 |
|
|
#define SMBwriteBmpx 0x1E /* write block multiplexed */
|
223 |
|
|
#define SMBwriteBs 0x1F /* write block (secondary request) */
|
224 |
|
|
#define SMBwriteC 0x20 /* write complete response */
|
225 |
|
|
#define SMBsetattrE 0x22 /* set file attributes expanded */
|
226 |
|
|
#define SMBgetattrE 0x23 /* get file attributes expanded */
|
227 |
|
|
#define SMBlockingX 0x24 /* lock/unlock byte ranges and X */
|
228 |
|
|
#define SMBtrans 0x25 /* transaction - name, bytes in/out */
|
229 |
|
|
#define SMBtranss 0x26 /* transaction (secondary request/response) */
|
230 |
|
|
#define SMBioctl 0x27 /* IOCTL */
|
231 |
|
|
#define SMBioctls 0x28 /* IOCTL (secondary request/response) */
|
232 |
|
|
#define SMBcopy 0x29 /* copy */
|
233 |
|
|
#define SMBmove 0x2A /* move */
|
234 |
|
|
#define SMBecho 0x2B /* echo */
|
235 |
|
|
#define SMBopenX 0x2D /* open and X */
|
236 |
|
|
#define SMBreadX 0x2E /* read and X */
|
237 |
|
|
#define SMBwriteX 0x2F /* write and X */
|
238 |
|
|
#define SMBsesssetupX 0x73 /* Session Set Up & X (including User Logon) */
|
239 |
|
|
#define SMBtconX 0x75 /* tree connect and X */
|
240 |
|
|
#define SMBffirst 0x82 /* find first */
|
241 |
|
|
#define SMBfunique 0x83 /* find unique */
|
242 |
|
|
#define SMBfclose 0x84 /* find close */
|
243 |
|
|
#define SMBinvalid 0xFE /* invalid command */
|
244 |
|
|
|
245 |
|
|
|
246 |
|
|
/* Extended 2.0 protocol */
|
247 |
|
|
#define SMBtrans2 0x32 /* TRANS2 protocol set */
|
248 |
|
|
#define SMBtranss2 0x33 /* TRANS2 protocol set, secondary command */
|
249 |
|
|
#define SMBfindclose 0x34 /* Terminate a TRANSACT2_FINDFIRST */
|
250 |
|
|
#define SMBfindnclose 0x35 /* Terminate a TRANSACT2_FINDNOTIFYFIRST */
|
251 |
|
|
#define SMBulogoffX 0x74 /* user logoff */
|
252 |
|
|
|
253 |
|
|
/* these are the TRANS2 sub commands */
|
254 |
|
|
#define TRANSACT2_OPEN 0
|
255 |
|
|
#define TRANSACT2_FINDFIRST 1
|
256 |
|
|
#define TRANSACT2_FINDNEXT 2
|
257 |
|
|
#define TRANSACT2_QFSINFO 3
|
258 |
|
|
#define TRANSACT2_SETFSINFO 4
|
259 |
|
|
#define TRANSACT2_QPATHINFO 5
|
260 |
|
|
#define TRANSACT2_SETPATHINFO 6
|
261 |
|
|
#define TRANSACT2_QFILEINFO 7
|
262 |
|
|
#define TRANSACT2_SETFILEINFO 8
|
263 |
|
|
#define TRANSACT2_FSCTL 9
|
264 |
|
|
#define TRANSACT2_IOCTL 10
|
265 |
|
|
#define TRANSACT2_FINDNOTIFYFIRST 11
|
266 |
|
|
#define TRANSACT2_FINDNOTIFYNEXT 12
|
267 |
|
|
#define TRANSACT2_MKDIR 13
|
268 |
|
|
|
269 |
|
|
|
270 |
|
|
/* Capabilities. See ftp://ftp.microsoft.com/developr/drg/cifs/cifs6.txt */
|
271 |
|
|
#define CAP_RAW_MODE 0x0001
|
272 |
|
|
#define CAP_MPX_MODE 0x0002
|
273 |
|
|
#define CAP_UNICODE 0x0004
|
274 |
|
|
#define CAP_LARGE_FILES 0x0008
|
275 |
|
|
#define CAP_NT_SMBS 0x0010
|
276 |
|
|
#define CAP_RPC_REMOTE_APIS 0x0020
|
277 |
|
|
#define CAP_STATUS32 0x0040
|
278 |
|
|
#define CAP_LEVEL_II_OPLOCKS 0x0080
|
279 |
|
|
#define CAP_LOCK_AND_READ 0x0100
|
280 |
|
|
#define CAP_NT_FIND 0x0200
|
281 |
|
|
#define CAP_DFS 0x1000
|
282 |
|
|
#define CAP_LARGE_READX 0x4000
|
283 |
|
|
|
284 |
|
|
#endif /* _SMBNO_H_ */
|