]> git.ipfire.org Git - thirdparty/squid.git/blob - lib/smblib/smblib-priv.h
SourceFormat Enforcement
[thirdparty/squid.git] / lib / smblib / smblib-priv.h
1 /*
2 * Copyright (C) 1996-2017 The Squid Software Foundation and contributors
3 *
4 * Squid software is distributed under GPLv2+ license and includes
5 * contributions from numerous individuals and organizations.
6 * Please see the COPYING and CONTRIBUTORS files for details.
7 */
8
9 /* UNIX SMBlib NetBIOS implementation
10
11 Version 1.0
12 SMBlib private Defines
13
14 Copyright (C) Richard Sharpe 1996
15 */
16
17 /*
18 This program is free software; you can redistribute it and/or modify
19 it under the terms of the GNU General Public License as published by
20 the Free Software Foundation; either version 2 of the License, or
21 (at your option) any later version.
22
23 This program is distributed in the hope that it will be useful,
24 but WITHOUT ANY WARRANTY; without even the implied warranty of
25 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26 GNU General Public License for more details.
27
28 You should have received a copy of the GNU General Public License
29 along with this program; if not, write to the Free Software
30 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
31 */
32
33 #ifndef _SMBLIB_PRIV_H_
34 #define _SMBLIB_PRIV_H_
35
36 #include "smblib/smblib-common.h"
37 #include "smblib/std-defines.h"
38 #include <sys/types.h>
39 #include <unistd.h>
40
41 typedef unsigned short uint16;
42 typedef unsigned int uint32;
43
44 #include "rfcnb/byteorder.h" /* Hmmm ... hot good */
45
46 #ifndef max
47 #define max(a,b) (a < b ? b : a)
48 #endif
49
50 #define SMB_DEF_IDF 0x424D53FF /* "\377SMB" */
51
52 /* Core protocol commands */
53
54 #define SMBmkdir 0x00 /* create directory */
55 #define SMBrmdir 0x01 /* delete directory */
56 #define SMBopen 0x02 /* open file */
57 #define SMBcreate 0x03 /* create file */
58 #define SMBclose 0x04 /* close file */
59 #define SMBflush 0x05 /* flush file */
60 #define SMBunlink 0x06 /* delete file */
61 #define SMBmv 0x07 /* rename file */
62 #define SMBgetatr 0x08 /* get file attributes */
63 #define SMBsetatr 0x09 /* set file attributes */
64 #define SMBread 0x0A /* read from file */
65 #define SMBwrite 0x0B /* write to file */
66 #define SMBlock 0x0C /* lock byte range */
67 #define SMBunlock 0x0D /* unlock byte range */
68 #define SMBctemp 0x0E /* create temporary file */
69 #define SMBmknew 0x0F /* make new file */
70 #define SMBchkpth 0x10 /* check directory path */
71 #define SMBexit 0x11 /* process exit */
72 #define SMBlseek 0x12 /* seek */
73 #define SMBtcon 0x70 /* tree connect */
74 #define SMBtdis 0x71 /* tree disconnect */
75 #define SMBnegprot 0x72 /* negotiate protocol */
76 #define SMBdskattr 0x80 /* get disk attributes */
77 #define SMBsearch 0x81 /* search directory */
78 #define SMBsplopen 0xC0 /* open print spool file */
79 #define SMBsplwr 0xC1 /* write to print spool file */
80 #define SMBsplclose 0xC2 /* close print spool file */
81 #define SMBsplretq 0xC3 /* return print queue */
82 #define SMBsends 0xD0 /* send single block message */
83 #define SMBsendb 0xD1 /* send broadcast message */
84 #define SMBfwdname 0xD2 /* forward user name */
85 #define SMBcancelf 0xD3 /* cancel forward */
86 #define SMBgetmac 0xD4 /* get machine name */
87 #define SMBsendstrt 0xD5 /* send start of multi-block message */
88 #define SMBsendend 0xD6 /* send end of multi-block message */
89 #define SMBsendtxt 0xD7 /* send text of multi-block message */
90
91 /* CorePlus protocol */
92
93 #define SMBlockread 0x13 /* Lock a range and read it */
94 #define SMBwriteunlock 0x14 /* Unlock a range and then write */
95 #define SMBreadbraw 0x1a /* read a block of data without smb header ohead*/
96 #define SMBwritebraw 0x1d /* write a block of data without smb header ohead*/
97 #define SMBwritec 0x20 /* secondary write request */
98 #define SMBwriteclose 0x2c /* write a file and then close it */
99
100 /* DOS Extended Protocol */
101
102 #define SMBreadBraw 0x1A /* read block raw */
103 #define SMBreadBmpx 0x1B /* read block multiplexed */
104 #define SMBreadBs 0x1C /* read block (secondary response) */
105 #define SMBwriteBraw 0x1D /* write block raw */
106 #define SMBwriteBmpx 0x1E /* write block multiplexed */
107 #define SMBwriteBs 0x1F /* write block (secondary request) */
108 #define SMBwriteC 0x20 /* write complete response */
109 #define SMBsetattrE 0x22 /* set file attributes expanded */
110 #define SMBgetattrE 0x23 /* get file attributes expanded */
111 #define SMBlockingX 0x24 /* lock/unlock byte ranges and X */
112 #define SMBtrans 0x25 /* transaction - name, bytes in/out */
113 #define SMBtranss 0x26 /* transaction (secondary request/response) */
114 #define SMBioctl 0x27 /* IOCTL */
115 #define SMBioctls 0x28 /* IOCTL (secondary request/response) */
116 #define SMBcopy 0x29 /* copy */
117 #define SMBmove 0x2A /* move */
118 #define SMBecho 0x2B /* echo */
119 #define SMBopenX 0x2D /* open and X */
120 #define SMBreadX 0x2E /* read and X */
121 #define SMBwriteX 0x2F /* write and X */
122 #define SMBsesssetupX 0x73 /* Session Set Up & X (including User Logon) */
123 #define SMBtconX 0x75 /* tree connect and X */
124 #define SMBffirst 0x82 /* find first */
125 #define SMBfunique 0x83 /* find unique */
126 #define SMBfclose 0x84 /* find close */
127 #define SMBinvalid 0xFE /* invalid command */
128
129 /* Any more ? */
130
131 #define SMBdatablockID 0x01 /* A data block identifier */
132 #define SMBdialectID 0x02 /* A dialect id */
133 #define SMBpathnameID 0x03 /* A pathname ID */
134 #define SMBasciiID 0x04 /* An ascii string ID */
135 #define SMBvariableblockID 0x05 /* A variable block ID */
136
137 /* some other defines we need */
138
139 /* Flags defines ... */
140
141 #define SMB_FLG2_NON_DOS 0x01 /* We know non dos names */
142 #define SMB_FLG2_EXT_ATR 0x02 /* We know about Extended Attributes */
143 #define SMB_FLG2_LNG_NAM 0x04 /* Long names ? */
144
145 typedef unsigned short WORD;
146 typedef unsigned short UWORD;
147 typedef unsigned int ULONG;
148 typedef unsigned char BYTE;
149 typedef unsigned char UCHAR;
150
151 /* Some macros to allow access to actual packet data so that we */
152 /* can change the underlying representation of packets. */
153 /* */
154 /* The current formats vying for attention are a fragment */
155 /* approach where the SMB header is a fragment linked to the */
156 /* data portion with the transport protocol (rfcnb or whatever) */
157 /* being linked on the front. */
158 /* */
159 /* The other approach is where the whole packet is one array */
160 /* of bytes with space allowed on the front for the packet */
161 /* headers. */
162
163 #define SMB_Hdr(p) (char *)(p -> data)
164
165 /* SMB Hdr def for File Sharing Protocol? From MS and Intel, */
166 /* Intel PN 138446 Doc Version 2.0, Nov 7, 1988. This def also */
167 /* applies to LANMAN1.0 as well as the Core Protocol */
168 /* The spec states that wct and bcc must be present, even if 0 */
169
170 /* We define these as offsets into a char SMB[] array for the */
171 /* sake of portability */
172
173 /* NOTE!. Some of the lenght defines, SMB_<protreq>_len do not include */
174 /* the data that follows in the SMB packet, so the code will have to */
175 /* take that into account. */
176
177 #define SMB_hdr_idf_offset 0 /* 0xFF,'SMB' 0-3 */
178 #define SMB_hdr_com_offset 4 /* BYTE 4 */
179 #define SMB_hdr_rcls_offset 5 /* BYTE 5 */
180 #define SMB_hdr_reh_offset 6 /* BYTE 6 */
181 #define SMB_hdr_err_offset 7 /* WORD 7 */
182 #define SMB_hdr_reb_offset 9 /* BYTE 9 */
183 #define SMB_hdr_flg_offset 9 /* same as reb ...*/
184 #define SMB_hdr_res_offset 10 /* 7 WORDs 10 */
185 #define SMB_hdr_res0_offset 10 /* WORD 10 */
186 #define SMB_hdr_flg2_offset 10 /* WORD */
187 #define SMB_hdr_res1_offset 12 /* WORD 12 */
188 #define SMB_hdr_res2_offset 14
189 #define SMB_hdr_res3_offset 16
190 #define SMB_hdr_res4_offset 18
191 #define SMB_hdr_res5_offset 20
192 #define SMB_hdr_res6_offset 22
193 #define SMB_hdr_tid_offset 24
194 #define SMB_hdr_pid_offset 26
195 #define SMB_hdr_uid_offset 28
196 #define SMB_hdr_mid_offset 30
197 #define SMB_hdr_wct_offset 32
198
199 #define SMB_hdr_len 33 /* 33 byte header? */
200
201 #define SMB_hdr_axc_offset 33 /* AndX Command */
202 #define SMB_hdr_axr_offset 34 /* AndX Reserved */
203 #define SMB_hdr_axo_offset 35 /* Offset from start to WCT of AndX cmd */
204
205 /* Format of the Negotiate Protocol SMB */
206
207 #define SMB_negp_bcc_offset 33
208 #define SMB_negp_buf_offset 35 /* Where the buffer starts */
209 #define SMB_negp_len 35 /* plus the data */
210
211 /* Format of the Negotiate Response SMB, for CoreProtocol, LM1.2 and */
212 /* NT LM 0.12. wct will be 1 for CoreProtocol, 13 for LM 1.2, and 17 */
213 /* for NT LM 0.12 */
214
215 #define SMB_negrCP_idx_offset 33 /* Response to the neg req */
216 #define SMB_negrCP_bcc_offset 35
217 #define SMB_negrLM_idx_offset 33 /* dialect index */
218 #define SMB_negrLM_sec_offset 35 /* Security mode */
219 #define SMB_sec_user_mask 0x01 /* 0 = share, 1 = user */
220 #define SMB_sec_encrypt_mask 0x02 /* pick out encrypt */
221 #define SMB_negrLM_mbs_offset 37 /* max buffer size */
222 #define SMB_negrLM_mmc_offset 39 /* max mpx count */
223 #define SMB_negrLM_mnv_offset 41 /* max number of VCs */
224 #define SMB_negrLM_rm_offset 43 /* raw mode support bit vec*/
225 #define SMB_read_raw_mask 0x01
226 #define SMB_write_raw_mask 0x02
227 #define SMB_negrLM_sk_offset 45 /* session key, 32 bits */
228 #define SMB_negrLM_st_offset 49 /* Current server time */
229 #define SMB_negrLM_sd_offset 51 /* Current server date */
230 #define SMB_negrLM_stz_offset 53 /* Server Time Zone */
231 #define SMB_negrLM_ekl_offset 55 /* encryption key length */
232 #define SMB_negrLM_res_offset 57 /* reserved */
233 #define SMB_negrLM_bcc_offset 59 /* bcc */
234 #define SMB_negrLM_len 61 /* 61 bytes ? */
235 #define SMB_negrLM_buf_offset 61 /* Where the fun begins */
236
237 #define SMB_negrNTLM_idx_offset 33 /* Selected protocol */
238 #define SMB_negrNTLM_sec_offset 35 /* Security more */
239 #define SMB_negrNTLM_mmc_offset 36 /* Different format above */
240 #define SMB_negrNTLM_mnv_offset 38 /* Max VCs */
241 #define SMB_negrNTLM_mbs_offset 40 /* MBS now a long */
242 #define SMB_negrNTLM_mrs_offset 44 /* Max raw size */
243 #define SMB_negrNTLM_sk_offset 48 /* Session Key */
244 #define SMB_negrNTLM_cap_offset 52 /* Capabilities */
245 #define SMB_negrNTLM_stl_offset 56 /* Server time low */
246 #define SMB_negrNTLM_sth_offset 60 /* Server time high */
247 #define SMB_negrNTLM_stz_offset 64 /* Server time zone */
248 #define SMB_negrNTLM_ekl_offset 66 /* Encrypt key len */
249 #define SMB_negrNTLM_bcc_offset 67 /* Bcc */
250 #define SMB_negrNTLM_len 69
251 #define SMB_negrNTLM_buf_offset 69
252
253 /* Offsets related to Tree Connect */
254
255 #define SMB_tcon_bcc_offset 33
256 #define SMB_tcon_buf_offset 35 /* where the data is for tcon */
257 #define SMB_tcon_len 35 /* plus the data */
258
259 #define SMB_tconr_mbs_offset 33 /* max buffer size */
260 #define SMB_tconr_tid_offset 35 /* returned tree id */
261 #define SMB_tconr_bcc_offset 37
262 #define SMB_tconr_len 39
263
264 #define SMB_tconx_axc_offset 33 /* And X Command */
265 #define SMB_tconx_axr_offset 34 /* reserved */
266 #define SMB_tconx_axo_offset 35 /* Next command offset */
267 #define SMB_tconx_flg_offset 37 /* Flags, bit0=1 means disc TID */
268 #define SMB_tconx_pwl_offset 39 /* Password length */
269 #define SMB_tconx_bcc_offset 41 /* bcc */
270 #define SMB_tconx_buf_offset 43 /* buffer */
271 #define SMB_tconx_len 43 /* up to data ... */
272
273 #define SMB_tconxr_axc_offset 33 /* Where the AndX Command is */
274 #define SMB_tconxr_axr_offset 34 /* Reserved */
275 #define SMB_tconxr_axo_offset 35 /* AndX offset location */
276
277 /* Offsets related to tree_disconnect */
278
279 #define SMB_tdis_bcc_offset 33 /* bcc */
280 #define SMB_tdis_len 35 /* total len */
281
282 #define SMB_tdisr_bcc_offset 33 /* bcc */
283 #define SMB_tdisr_len 35
284
285 /* Offsets related to Open Request */
286
287 #define SMB_open_mod_offset 33 /* Mode to open with */
288 #define SMB_open_atr_offset 35 /* Attributes of file */
289 #define SMB_open_bcc_offset 37 /* bcc */
290 #define SMB_open_buf_offset 39 /* File name */
291 #define SMB_open_len 39 /* Plus the file name */
292
293 #define SMB_openx_axc_offset 33 /* Next command */
294 #define SMB_openx_axr_offset 34 /* Reserved */
295 #define SMB_openx_axo_offset 35 /* offset of next wct */
296 #define SMB_openx_flg_offset 37 /* Flags, bit0 = need more info */
297 /* bit1 = exclusive oplock */
298 /* bit2 = batch oplock */
299 #define SMB_openx_mod_offset 39 /* mode to open with */
300 #define SMB_openx_atr_offset 41 /* search attributes */
301 #define SMB_openx_fat_offset 43 /* File attributes */
302 #define SMB_openx_tim_offset 45 /* time and date of creat */
303 #define SMB_openx_ofn_offset 49 /* Open function */
304 #define SMB_openx_als_offset 51 /* Space to allocate on */
305 #define SMB_openx_res_offset 55 /* reserved */
306 #define SMB_openx_bcc_offset 63 /* bcc */
307 #define SMB_openx_buf_offset 65 /* Where file name goes */
308 #define SMB_openx_len 65
309
310 #define SMB_openr_fid_offset 33 /* FID returned */
311 #define SMB_openr_atr_offset 35 /* Attributes opened with */
312 #define SMB_openr_tim_offset 37 /* Last mod time of file */
313 #define SMB_openr_fsz_offset 41 /* File size 4 bytes */
314 #define SMB_openr_acc_offset 45 /* Access allowed */
315 #define SMB_openr_bcc_offset 47
316 #define SMB_openr_len 49
317
318 #define SMB_openxr_axc_offset 33 /* And X command */
319 #define SMB_openxr_axr_offset 34 /* reserved */
320 #define SMB_openxr_axo_offset 35 /* offset to next command */
321 #define SMB_openxr_fid_offset 37 /* FID returned */
322 #define SMB_openxr_fat_offset 39 /* File attributes returned*/
323 #define SMB_openxr_tim_offset 41 /* File creation date etc */
324 #define SMB_openxr_fsz_offset 45 /* Size of file */
325 #define SMB_openxr_acc_offset 49 /* Access granted */
326
327 #define SMB_clos_fid_offset 33 /* FID to close */
328 #define SMB_clos_tim_offset 35 /* Last mod time */
329 #define SMB_clos_bcc_offset 39 /* bcc */
330 #define SMB_clos_len 41
331
332 /* Offsets related to Write requests */
333
334 #define SMB_write_fid_offset 33 /* FID to write */
335 #define SMB_write_cnt_offset 35 /* bytes to write */
336 #define SMB_write_ofs_offset 37 /* location to write to */
337 #define SMB_write_clf_offset 41 /* advisory count left */
338 #define SMB_write_bcc_offset 43 /* bcc = data bytes + 3 */
339 #define SMB_write_buf_offset 45 /* Data=0x01, len, data */
340 #define SMB_write_len 45 /* plus the data ... */
341
342 #define SMB_writr_cnt_offset 33 /* Count of bytes written */
343 #define SMB_writr_bcc_offset 35 /* bcc */
344 #define SMB_writr_len 37
345
346 /* Offsets related to read requests */
347
348 #define SMB_read_fid_offset 33 /* FID of file to read */
349 #define SMB_read_cnt_offset 35 /* count of words to read */
350 #define SMB_read_ofs_offset 37 /* Where to read from */
351 #define SMB_read_clf_offset 41 /* Advisory count to go */
352 #define SMB_read_bcc_offset 43
353 #define SMB_read_len 45
354
355 #define SMB_readr_cnt_offset 33 /* Count of bytes returned */
356 #define SMB_readr_res_offset 35 /* 4 shorts reserved, 8 bytes */
357 #define SMB_readr_bcc_offset 43 /* bcc */
358 #define SMB_readr_bff_offset 45 /* buffer format char = 0x01 */
359 #define SMB_readr_len_offset 46 /* buffer len */
360 #define SMB_readr_len 45 /* length of the readr before data */
361
362 /* Offsets for Create file */
363
364 #define SMB_creat_atr_offset 33 /* Attributes of new file ... */
365 #define SMB_creat_tim_offset 35 /* Time of creation */
366 #define SMB_creat_dat_offset 37 /* 4004BCE :-) */
367 #define SMB_creat_bcc_offset 39 /* bcc */
368 #define SMB_creat_buf_offset 41
369 #define SMB_creat_len 41 /* Before the data */
370
371 #define SMB_creatr_fid_offset 33 /* FID of created file */
372
373 /* Offsets for Delete file */
374
375 #define SMB_delet_sat_offset 33 /* search attribites */
376 #define SMB_delet_bcc_offset 35 /* bcc */
377 #define SMB_delet_buf_offset 37
378 #define SMB_delet_len 37
379
380 /* Offsets for SESSION_SETUP_ANDX for both LM and NT LM protocols */
381
382 #define SMB_ssetpLM_mbs_offset 37 /* Max buffer Size, allow for AndX */
383 #define SMB_ssetpLM_mmc_offset 39 /* max multiplex count */
384 #define SMB_ssetpLM_vcn_offset 41 /* VC number if new VC */
385 #define SMB_ssetpLM_snk_offset 43 /* Session Key */
386 #define SMB_ssetpLM_pwl_offset 47 /* password length */
387 #define SMB_ssetpLM_res_offset 49 /* reserved */
388 #define SMB_ssetpLM_bcc_offset 53 /* bcc */
389 #define SMB_ssetpLM_len 55 /* before data ... */
390 #define SMB_ssetpLM_buf_offset 55
391
392 #define SMB_ssetpNTLM_mbs_offset 37 /* Max Buffer Size for NT LM 0.12 */
393 /* and above */
394 #define SMB_ssetpNTLM_mmc_offset 39 /* Max Multiplex count */
395 #define SMB_ssetpNTLM_vcn_offset 41 /* VC Number */
396 #define SMB_ssetpNTLM_snk_offset 43 /* Session key */
397 #define SMB_ssetpNTLM_cipl_offset 47 /* Case Insensitive PW Len */
398 #define SMB_ssetpNTLM_cspl_offset 49 /* Unicode pw len */
399 #define SMB_ssetpNTLM_res_offset 51 /* reserved */
400 #define SMB_ssetpNTLM_cap_offset 55 /* server capabilities */
401 #define SMB_ssetpNTLM_bcc_offset 59 /* bcc */
402 #define SMB_ssetpNTLM_len 61 /* before data */
403 #define SMB_ssetpNTLM_buf_offset 61
404
405 #define SMB_ssetpr_axo_offset 35 /* Offset of next response ... */
406 #define SMB_ssetpr_act_offset 37 /* action, bit 0 = 1 => guest */
407 #define SMB_ssetpr_bcc_offset 39 /* bcc */
408 #define SMB_ssetpr_buf_offset 41 /* Native OS etc */
409
410 /* Offsets for SMB create directory */
411
412 #define SMB_creatdir_bcc_offset 33 /* only a bcc here */
413 #define SMB_creatdir_buf_offset 35 /* Where things start */
414 #define SMB_creatdir_len 35
415
416 /* Offsets for SMB delete directory */
417
418 #define SMB_deletdir_bcc_offset 33 /* only a bcc here */
419 #define SMB_deletdir_buf_offset 35 /* where things start */
420 #define SMB_deletdir_len 35
421
422 /* Offsets for SMB check directory */
423
424 #define SMB_checkdir_bcc_offset 33 /* Only a bcc here */
425 #define SMB_checkdir_buf_offset 35 /* where things start */
426 #define SMB_checkdir_len 35
427
428 /* Offsets for SMB search */
429
430 #define SMB_search_mdc_offset 33 /* Max Dir ents to return */
431 #define SMB_search_atr_offset 35 /* Search attributes */
432 #define SMB_search_bcc_offset 37 /* bcc */
433 #define SMB_search_buf_offset 39 /* where the action is */
434 #define SMB_search_len 39
435
436 #define SMB_searchr_dec_offset 33 /* Dir ents returned */
437 #define SMB_searchr_bcc_offset 35 /* bcc */
438 #define SMB_searchr_buf_offset 37 /* Where the action starts */
439 #define SMB_searchr_len 37 /* before the dir ents */
440
441 #define SMB_searchr_dirent_len 43 /* 53 bytes */
442
443 /* Defines for SMB transact and transact2 calls */
444
445 #define SMB_trans_tpc_offset 33 /* Total param count */
446 #define SMB_trans_tdc_offset 35 /* total Data count */
447 #define SMB_trans_mpc_offset 37 /* Max params bytes to return */
448 #define SMB_trans_mdc_offset 39 /* Max data bytes to return */
449 #define SMB_trans_msc_offset 41 /* Max setup words to return */
450 #define SMB_trans_rs1_offset 42 /* Reserved byte */
451 #define SMB_trans_flg_offset 43 /* flags */
452 #define SMB_trans_tmo_offset 45 /* Timeout, long */
453 #define SMB_trans_rs2_offset 49 /* Next reserved */
454 #define SMB_trans_pbc_offset 51 /* Param Byte count in buf */
455 #define SMB_trans_pbo_offset 53 /* Offset to param bytes */
456 #define SMB_trans_dbc_offset 55 /* Data byte count in buf */
457 #define SMB_trans_dbo_offset 57 /* Data byte offset */
458 #define SMB_trans_suc_offset 59 /* Setup count - byte */
459 #define SMB_trans_rs3_offset 60 /* Reserved to pad ... */
460 #define SMB_trans_len 61 /* Up to setup, still need bcc */
461
462 #define SMB_transr_tpc_offset 33 /* Total param bytes returned */
463 #define SMB_transr_tdc_offset 35
464 #define SMB_transr_rs1_offset 37
465 #define SMB_transr_pbc_offset 39
466 #define SMB_transr_pbo_offset 41
467 #define SMB_transr_pdi_offset 43 /* parameter displacement */
468 #define SMB_transr_dbc_offset 45
469 #define SMB_transr_dbo_offset 47
470 #define SMB_transr_ddi_offset 49
471 #define SMB_transr_suc_offset 51
472 #define SMB_transr_rs2_offset 52
473 #define SMB_transr_len 53
474
475 /* Bit masks for SMB Capabilities ... */
476
477 #define SMB_cap_raw_mode 0x0001
478 #define SMB_cap_mpx_mode 0x0002
479 #define SMB_cap_unicode 0x0004
480 #define SMB_cap_large_files 0x0008
481 #define SMB_cap_nt_smbs 0x0010
482 #define SMB_rpc_remote_apis 0x0020
483 #define SMB_cap_nt_status 0x0040
484 #define SMB_cap_level_II_oplocks 0x0080
485 #define SMB_cap_lock_and_read 0x0100
486 #define SMB_cap_nt_find 0x0200
487
488 /* SMB LANMAN api call defines */
489
490 #define SMB_LMapi_SetUserInfo 0x0072
491 #define SMB_LMapi_UserPasswordSet 0x0073
492
493 /* Structures and defines we use in the client interface */
494
495 /* The protocols we might support. Perhaps a bit ambitious, as only RFCNB */
496 /* has any support so far 0(sometimes called NBT) */
497
498 typedef enum {SMB_RFCNB, SMB_IPXNB, SMB_NETBEUI, SMB_X25} SMB_Transport_Types;
499
500 typedef enum {SMB_Con_FShare, SMB_Con_PShare, SMB_Con_IPC} SMB_Con_Types;
501
502 typedef enum {SMB_State_NoState, SMB_State_Stopped, SMB_State_Started} SMB_State_Types;
503
504 /* The following two arrays need to be in step! */
505 /* We must make it possible for callers to specify these ... */
506
507 extern int SMB_Types[];
508
509 typedef struct SMB_Status {
510
511 union {
512 struct {
513 unsigned char ErrorClass;
514 unsigned char Reserved;
515 unsigned short Error;
516 } DosError;
517 unsigned int NtStatus;
518 } status;
519 } SMB_Status;
520
521 #define SMBLIB_DEFAULT_DOMAIN "SMBlib_dom"
522 #define SMBLIB_DEFAULT_OSNAME "UNIX of some type"
523 #define SMBLIB_DEFAULT_LMTYPE "SMBlib LM2.1 minus a bit"
524 #define SMBLIB_MAX_XMIT 65535
525
526 #define SMB_Sec_Mode_Share 0
527 #define SMB_Sec_Mode_User 1
528
529 typedef struct SMB_File_Def SMB_File;
530
531 struct SMB_File_Def {
532
533 SMB_Tree_Handle tree;
534 char filename[256]; /* We should malloc this ... */
535 UWORD fid;
536 unsigned int lastmod;
537 unsigned int size; /* Could blow up if 64bit files supported */
538 UWORD access;
539 off_t fileloc;
540
541 };
542
543 /* global Variables for the library */
544
545 extern SMB_State_Types SMBlib_State;
546
547 #ifndef SMBLIB_ERRNO
548 extern int SMBlib_errno;
549 extern int SMBlib_SMB_Error; /* last Error */
550 #endif
551
552 void SMB_Get_My_Name(char *name, int len);
553
554 #endif /* _SMBLIB_PRIV_H_ */
555