"Fossies" - the Fresh Open Source Software Archive 
As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style:
standard) with prefixed line numbers and
code folding option.
Alternatively you can here
view or
download the uninterpreted source code file.
1 /* mod_ntlm file: $Id: smblib-common.h,v 1.3 2003/02/21 01:55:14 casz Exp $ */
2
3 #ifndef SMBLIB_COMMON_H
4 #define SMBLIB_COMMON_H
5
6 /* UNIX SMBlib NetBIOS implementation
7 *
8 * Version 1.0 SMBlib Common Defines
9 *
10 * Copyright (C) Richard Sharpe 1996
11 *
12 */
13
14 /*
15 * This program is free software; you can redistribute it and/or modify it
16 * under the terms of the GNU General Public License as published by the
17 * Free Software Foundation; either version 2 of the License, or (at your
18 * option) any later version. This program is distributed in the hope
19 * that it will be useful, but WITHOUT ANY WARRANTY; without even the
20 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
21 * PURPOSE. See the GNU General Public License for more details. You
22 * should have received a copy of the GNU General Public License along
23 * with this program; if not, write to the Free Software Foundation, Inc.,
24 * 675 Mass Ave, Cambridge, MA 02139, USA. */
25
26 /* To get the error class we want the first 8 bits */
27 /* Because we just grab 4bytes from the SMB header, we have to re-order */
28 /* here, but it makes the NtStatus part easier in future */
29
30 #define SMBlib_Error_Class(p) (p & 0x000000FF)
31
32 /* To get the error code, we want the bottom 16 bits */
33
34 #define SMBlib_Error_Code(p) (((unsigned int)p & 0xFFFF0000) >>16)
35
36 /* Error CLASS codes and etc ... */
37
38 #define SMBC_SUCCESS 0
39 #define SMBC_ERRDOS 0x01
40 #define SMBC_ERRSRV 0x02
41 #define SMBC_ERRHRD 0x03
42 #define SMBC_ERRCMD 0xFF
43
44 /* Success error codes */
45
46 #define SMBS_BUFFERED 0x54
47 #define SMBS_LOGGED 0x55
48 #define SMBS_DISPLAYED 0x56
49
50 /* ERRDOS Error codes */
51
52 #define SMBD_badfunc 0x01
53 #define SMBD_badfile 0x02
54 #define SMBD_badpath 0x03
55 #define SMBD_nofids 0x04
56 #define SMBD_noaccess 0x05
57 #define SMBD_badfid 0x06
58 #define SMBD_badmcb 0x07
59 #define SMBD_nomem 0x08
60 #define SMBD_badmem 0x09
61 #define SMBD_badenv 0x0A
62 #define SMBD_badformat 0x0B
63 #define SMBD_badaccess 0x0C
64 #define SMBD_baddata 0x0D
65 #define SMBD_reserved 0x0E
66 #define SMBD_baddrive 0x0F
67 #define SMBD_remcd 0x10
68 #define SMBD_diffdevice 0x11
69 #define SMBD_nofiles 0x12
70 #define SMBD_badshare 0x20
71 #define SMBD_errlock 0x21
72 #define SMBD_filexists 0x50
73
74 /* Server errors ... */
75
76 #define SMBV_error 0x01 /* Generic error */
77 #define SMBV_badpw 0x02
78 #define SMBV_badtype 0x03
79 #define SMBV_access 0x04
80 #define SMBV_invnid 0x05
81 #define SMBV_invnetname 0x06
82 #define SMBV_invdevice 0x07
83 #define SMBV_qfull 0x31
84 #define SMBV_qtoobig 0x32
85 #define SMBV_qeof 0x33
86 #define SMBV_invpfid 0x34
87 #define SMBV_paused 0x51
88 #define SMBV_msgoff 0x52
89 #define SMBV_noroom 0x53
90 #define SMBV_rmuns 0x57
91 #define SMBV_nosupport 0xFFFF
92
93 /* Hardware error codes ... */
94
95 #define SMBH_nowrite 0x13
96 #define SMBH_badunit 0x14
97 #define SMBH_notready 0x15
98 #define SMBH_badcmd 0x16
99 #define SMBH_data 0x17
100 #define SMBH_badreq 0x18
101 #define SMBH_seek 0x19
102 #define SMBH_badmedia 0x1A
103 #define SMBH_badsector 0x1B
104 #define SMBH_nopaper 0x1C
105 #define SMBH_write 0x1D
106 #define SMBH_read 0x1E
107 #define SMBH_general 0x1F
108 #define SMBH_badshare 0x20
109
110 /* Access mode defines ... */
111
112 #define SMB_AMODE_WTRU 0x4000
113 #define SMB_AMODE_NOCACHE 0x1000
114 #define SMB_AMODE_COMPAT 0x0000
115 #define SMB_AMODE_DENYRWX 0x0010
116 #define SMB_AMODE_DENYW 0x0020
117 #define SMB_AMODE_DENYRX 0x0030
118 #define SMB_AMODE_DENYNONE 0x0040
119 #define SMB_AMODE_OPENR 0x0000
120 #define SMB_AMODE_OPENW 0x0001
121 #define SMB_AMODE_OPENRW 0x0002
122 #define SMB_AMODE_OPENX 0x0003
123 #define SMB_AMODE_FCBOPEN 0x00FF
124 #define SMB_AMODE_LOCUNKN 0x0000
125 #define SMB_AMODE_LOCMSEQ 0x0100
126 #define SMB_AMODE_LOCMRAN 0x0200
127 #define SMB_AMODE_LOCRAL 0x0300
128
129 /* File attribute encoding ... */
130
131 #define SMB_FA_ORD 0x00
132 #define SMB_FA_ROF 0x01
133 #define SMB_FA_HID 0x02
134 #define SMB_FA_SYS 0x04
135 #define SMB_FA_VOL 0x08
136 #define SMB_FA_DIR 0x10
137 #define SMB_FA_ARC 0x20
138
139 /* Define the protocol types ... */
140
141 #define SMB_P_Unknown -1 /* Hmmm, is this smart? */
142 #define SMB_P_Core 0
143 #define SMB_P_CorePlus 1
144 #define SMB_P_DOSLanMan1 2
145 #define SMB_P_LanMan1 3
146 #define SMB_P_DOSLanMan2 4
147 #define SMB_P_LanMan2 5
148 #define SMB_P_DOSLanMan2_1 6
149 #define SMB_P_LanMan2_1 7
150 #define SMB_P_NT1 8
151
152 /* SMBlib return codes */
153 /* We want something that indicates whether or not the return code was a
154 * */
155 /* remote error, a local error in SMBlib or returned from lower layer ...
156 * */
157 /* Wonder if this will work ...
158 * */
159 /* SMBlibE_Remote = 1 indicates remote error
160 * */
161 /* SMBlibE_ values < 0 indicate local error with more info available
162 * */
163 /* SMBlibE_ values >1 indicate local from SMBlib code errors?
164 * */
165
166 #define SMBlibE_Success 0
167 #define SMBlibE_Remote 1 /* Remote error, get more info from con
168 * */
169 #define SMBlibE_BAD -1
170 #define SMBlibE_LowerLayer 2 /* Lower layer error
171 * */
172 #define SMBlibE_NotImpl 3 /* Function not yet implemented
173 * */
174 #define SMBlibE_ProtLow 4 /* Protocol negotiated does not support
175 * req */
176 #define SMBlibE_NoSpace 5 /* No space to allocate a structure
177 * */
178 #define SMBlibE_BadParam 6 /* Bad parameters
179 * */
180 #define SMBlibE_NegNoProt 7 /* None of our protocols was liked
181 * */
182 #define SMBlibE_SendFailed 8 /* Sending an SMB failed
183 * */
184 #define SMBlibE_RecvFailed 9 /* Receiving an SMB failed
185 * */
186 #define SMBlibE_GuestOnly 10 /* Logged in as guest
187 * */
188 #define SMBlibE_CallFailed 11 /* Call remote end failed
189 * */
190 #define SMBlibE_ProtUnknown 12 /* Protocol unknown
191 * */
192 #define SMBlibE_NoSuchMsg 13 /* Keep this up to date
193 * */
194
195 typedef struct { /* A structure for a Dirent */
196
197 unsigned char resume_key[21]; /* Don't touch this */
198 unsigned char file_attributes; /* Attributes of file */
199 unsigned int date_time; /* date and time of last mod */
200 unsigned int size;
201 char filename[13]; /* The name of the file */
202
203 } SMB_CP_dirent;
204
205 #endif