9271bcb4ce0fc9f78c472177075826bfa21547d1
[openafs.git] / src / WINNT / afsd / smb.h
1 /*
2  * Copyright 2000, International Business Machines Corporation and others.
3  * All Rights Reserved.
4  * 
5  * This software has been released under the terms of the IBM Public
6  * License.  For details, see the LICENSE file in the top-level source
7  * directory or online at http://www.openafs.org/dl/license10.html
8  */
9
10 #ifndef __SMB_H_ENV__
11 #define __SMB_H_ENV__ 1
12
13 #ifdef DJGPP
14 #include "netbios95.h"
15 #endif /* DJGPP */
16
17 #include <ntsecapi.h>
18
19 /* basic core protocol SMB structure */
20 typedef struct smb {
21         unsigned char id[4];
22         unsigned char com;
23         unsigned char rcls;
24         unsigned char reh;
25         unsigned char errLow;
26         unsigned char errHigh;
27         unsigned char reb;
28         unsigned short flg2;
29         unsigned short res[6];
30         unsigned short tid;
31         unsigned short pid;
32         unsigned short uid;
33         unsigned short mid;
34         unsigned char wct;
35         unsigned char vdata[1];
36 } smb_t;
37
38 /* more defines */
39 #define SMB_NOPCODES            256     /* # of opcodes in the dispatch table */
40
41 /* threads per VC */
42 #define SMB_THREADSPERVC        4       /* threads per VC */
43
44 /* flags for functions */
45 #define SMB_FLAG_CREATE         1       /* create the structure if necessary */
46
47 /* max # of bytes we'll receive in an incoming SMB message */
48 /* the maximum is 2^18-1 for NBT and 2^25-1 for Raw transport messages */
49 /* we will use something smaller but large enough to be efficient */
50 #define SMB_PACKETSIZE  32768 /* was 8400 */
51 /* raw mode is considered obsolete and cannot be used with message signing */
52 #define SMB_MAXRAWSIZE  65536
53
54 /* Negotiate protocol constants */
55 /* Security */
56 #define NEGOTIATE_SECURITY_USER_LEVEL               0x01
57 #define NEGOTIATE_SECURITY_CHALLENGE_RESPONSE       0x02
58 #define NEGOTIATE_SECURITY_SIGNATURES_ENABLED       0x04
59 #define NEGOTIATE_SECURITY_SIGNATURES_REQUIRED      0x08
60
61 /* Capabilities */
62 #define NTNEGOTIATE_CAPABILITY_RAWMODE                          0x00000001L
63 #define NTNEGOTIATE_CAPABILITY_MPXMODE                          0x00000002L
64 #define NTNEGOTIATE_CAPABILITY_UNICODE                          0x00000004L
65 #define NTNEGOTIATE_CAPABILITY_LARGEFILES                       0x00000008L
66 #define NTNEGOTIATE_CAPABILITY_NTSMB                            0x00000010L
67 #define NTNEGOTIATE_CAPABILITY_RPCAPI                           0x00000020L
68 #define NTNEGOTIATE_CAPABILITY_NTSTATUS                         0x00000040L
69 #define NTNEGOTIATE_CAPABILITY_LEVEL_II_OPLOCKS         0x00000080L
70 #define NTNEGOTIATE_CAPABILITY_LOCK_AND_READ            0x00000100L
71 #define NTNEGOTIATE_CAPABILITY_NTFIND                           0x00000200L
72 #define NTNEGOTIATE_CAPABILITY_DFS                                      0x00001000L
73 #define NTNEGOTIATE_CAPABILITY_NT_INFO_PASSTHRU         0x00002000L
74 #define NTNEGOTIATE_CAPABILITY_BULK_TRANSFER            0x20000000L
75 #define NTNEGOTIATE_CAPABILITY_COMPRESSED                       0x40000000L
76 #define NTNEGOTIATE_CAPABILITY_EXTENDED_SECURITY        0x80000000L
77
78 /* a packet structure for receiving SMB messages; locked by smb_globalLock.
79  * Most of the work involved is in handling chained requests and responses.
80  *
81  * When handling input, inWctp points to the current request's wct field (and
82  * the other parameters and request data can be found from this field).  The
83  * opcode, unfortunately, isn't available there, so is instead copied to the
84  * packet's inCom field.  It is initially set to com, but each chained
85  * operation sets it, also.
86  * The function smb_AdvanceInput advances an input packet to the next request
87  * in the chain.  The inCom field is set to 0xFF when there are no more
88  * requests.  The inCount field is 0 if this is the first request, and
89  * otherwise counts which request it is.
90  *
91  * When handling output, we also have to chain all of the responses together.
92  * The function smb_GetResponsePacket will setup outWctp to point to the right
93  * place.
94  */
95 #define SMB_PACKETMAGIC 0x7436353       /* magic # for packets */
96 typedef struct smb_packet {
97         char data[SMB_PACKETSIZE];
98         struct smb_packet *nextp;       /* in free list, or whatever */
99         long magic;
100         cm_space_t *spacep;             /* use this for stripping last component */
101         NCB *ncbp;                      /* use this for sending */
102         struct smb_vc *vcp;
103         unsigned long resumeCode;
104         unsigned short inCount;
105         unsigned short fid;             /* for calls bundled with openAndX */
106         unsigned char *wctp;
107         unsigned char inCom;
108         unsigned char oddByte;
109         unsigned short ncb_length;
110         unsigned char flags;
111 #ifdef DJGPP
112         dos_ptr dos_pkt;
113         unsigned int dos_pkt_sel;
114 #endif /* DJGPP */
115 } smb_packet_t;
116
117 /* smb_packet flags */
118 #define SMB_PACKETFLAG_PROFILE_UPDATE_OK        1
119 #define SMB_PACKETFLAG_NOSEND                   2
120 #define SMB_PACKETFLAG_SUSPENDED                4
121
122 /* a structure for making Netbios calls; locked by smb_globalLock */
123 #define SMB_NCBMAGIC    0x2334344
124 typedef struct myncb {
125         NCB ncb;                        /* ncb to use */
126         struct myncb *nextp;            /* when on free list */
127         long magic;
128 #ifdef DJGPP
129         dos_ptr dos_ncb;
130         smb_packet_t *orig_pkt;
131         unsigned int dos_ncb_sel;
132 #endif /* DJGPP */
133 } smb_ncb_t;
134
135 /* structures representing environments from kernel / SMB network.
136  * Most have their own locks, but the tree connection fields and
137  * reference counts are locked by the smb_rctLock.  Those fields will
138  * be marked in comments.
139  */
140
141 /* one per virtual circuit */
142 typedef struct smb_vc {
143         struct smb_vc *nextp;           /* not used */
144     unsigned long refCount;                     /* the reference count */
145     long flags;                 /* the flags, if any; locked by mx */
146     osi_mutex_t mx;                     /* the mutex */
147         long vcID;                      /* VC id */
148     unsigned short lsn;         /* the NCB LSN associated with this */
149         unsigned short uidCounter;      /* session ID counter */
150     unsigned short tidCounter;  /* tree ID counter */
151     unsigned short fidCounter;  /* file handle ID counter */
152     struct smb_tid *tidsp;              /* the first child in the tid list */
153     struct smb_user *usersp;    /* the first child in the user session list */
154     struct smb_fid *fidsp;              /* the first child in the open file list */
155         struct smb_user *justLoggedOut; /* ready for profile upload? */
156         time_t logoffTime;      /* tick count when logged off */
157         /*struct cm_user *logonDLLUser; /* integrated logon user */
158         unsigned char errorCount;
159     char rname[17];
160         int lana;
161         char encKey[MSV1_0_CHALLENGE_LENGTH]; /* MSV1_0_CHALLENGE_LENGTH is 8 */
162     void * secCtx;              /* security context when negotiating SMB extended auth
163                                  * valid when SMB_VCFLAG_AUTH_IN_PROGRESS is set
164                                  */
165 } smb_vc_t;
166
167                                         /* have we negotiated ... */
168 #define SMB_VCFLAG_USEV3        1       /* ... version 3 of the protocol */
169 #define SMB_VCFLAG_USECORE      2       /* ... the core protocol */
170 #define SMB_VCFLAG_USENT        4       /* ... NT LM 0.12 or beyond */
171 #define SMB_VCFLAG_STATUS32     8       /* use 32-bit NT status codes */
172 #define SMB_VCFLAG_REMOTECONN   0x10    /* bad: remote conns not allowed */
173 #define SMB_VCFLAG_ALREADYDEAD  0x20    /* do not get tokens from this vc */
174 #define SMB_VCFLAG_SESSX_RCVD   0x40    /* we received at least one session setups on this vc */
175 #define SMB_VCFLAG_AUTH_IN_PROGRESS 0x80 /* a SMB NT extended authentication is in progress */
176
177 /* one per user session */
178 typedef struct smb_user {
179         struct smb_user *nextp;         /* next sibling */
180         unsigned long refCount;                 /* ref count */
181         long flags;                     /* flags; locked by mx */
182         osi_mutex_t mx;
183         long userID;                    /* the session identifier */
184         struct smb_vc *vcp;             /* back ptr to virtual circuit */
185   struct smb_username *unp;        /* user name struct */
186 } smb_user_t;
187
188 typedef struct smb_username {
189         struct smb_username *nextp;             /* next sibling */
190         unsigned long refCount;                 /* ref count */
191         long flags;                     /* flags; locked by mx */
192         osi_mutex_t mx;
193         struct cm_user *userp;          /* CM user structure */
194         char *name;                     /* user name */
195   char *machine;                  /* machine name */
196 } smb_username_t;
197
198 #define SMB_USERFLAG_DELETE     1       /* delete struct when ref count zero */
199
200 #define SMB_MAX_USERNAME_LENGTH 256
201
202 /* one per tree-connect */
203 typedef struct smb_tid {
204         struct smb_tid *nextp;          /* next sibling */
205         unsigned long refCount;
206         long flags;
207         osi_mutex_t mx;                 /* for non-tree-related stuff */
208         unsigned short tid;             /* the tid */
209         struct smb_vc *vcp;             /* back ptr */
210         struct cm_user *userp;          /* user logged in at the
211                                          * tree connect level (base) */
212         char *pathname;                 /* pathname derived from sharename */
213 } smb_tid_t;
214
215 #define SMB_TIDFLAG_DELETE      1       /* delete struct when ref count zero */
216 #define SMB_TIDFLAG_IPC 2 /* IPC$ */
217
218 /* one per process ID */
219 typedef struct smb_pid {
220         struct smb_pid *nextp;          /* next sibling */
221         unsigned long refCount;
222         long flags;
223         osi_mutex_t mx;                 /* for non-tree-related stuff */
224         unsigned short pid;             /* the pid */
225         struct smb_tid *tidp;           /* back ptr */
226 } smb_pid_t;
227
228 /* ioctl parameter, while being assembled and/or processed */
229 typedef struct smb_ioctl {
230         /* input side */
231         char *inDatap;                  /* ioctl func's current position
232                                          * in input parameter block */
233         char *inAllocp;                 /* allocated input parameter block */
234         long inCopied;                  /* # of input bytes copied in so far
235                                          * by write calls */
236         cm_space_t *prefix;             /* prefix for subst drives */
237         char *tidPathp;                 /* Pathname associated with Tree ID */
238
239         /* output side */
240         char *outDatap;                 /* output results assembled so far */
241         char *outAllocp;                /* output results assembled so far */
242         long outCopied;                 /* # of output bytes copied back so far
243                                          * by read calls */
244         
245         /* flags */
246         long flags;
247
248         /* fid pointer */
249         struct smb_fid *fidp;
250
251   /* uid pointer */
252   smb_user_t *uidp;
253
254 } smb_ioctl_t;
255
256 /* flags for smb_ioctl_t */
257 #define SMB_IOCTLFLAG_DATAIN    1       /* reading data from client to server */
258 #define SMB_IOCTLFLAG_LOGON     2       /* got tokens from integrated logon */
259
260 /* one per file ID; these are really file descriptors */
261 typedef struct smb_fid {
262         osi_queue_t q;
263         unsigned long refCount;
264         unsigned long flags;
265         osi_mutex_t mx;                 /* for non-tree-related stuff */
266         unsigned short fid;             /* the file ID */
267         struct smb_vc *vcp;             /* back ptr */
268         struct cm_scache *scp;          /* scache of open file */
269         long offset;                    /* our file pointer */
270         smb_ioctl_t *ioctlp;            /* ptr to ioctl structure */
271                                         /* Under NT, we may need to know the
272                                          * parent directory and pathname used
273                                          * to open the file, either to delete
274                                          * the file on close, or to do a
275                                          * change notification */
276         struct cm_scache *NTopen_dscp;  /* parent directory (NT) */
277         char *NTopen_pathp;             /* path used in open (NT) */
278         char *NTopen_wholepathp;        /* entire path, not just last name */
279         int curr_chunk;                 /* chunk being read */
280         int prev_chunk;                 /* previous chunk read */
281         int raw_writers;                /* pending async raw writes */
282         EVENT_HANDLE raw_write_event;   /* signal this when raw_writers zero */
283 } smb_fid_t;
284
285 #define SMB_FID_OPENREAD                1       /* open for reading */
286 #define SMB_FID_OPENWRITE               2       /* open for writing */
287 #define SMB_FID_DELETE                  4       /* delete struct on ref count 0 */
288 #define SMB_FID_IOCTL                   8       /* a file descriptor for the
289                                                  * magic ioctl file */
290 #define SMB_FID_OPENDELETE              0x10    /* open for deletion (NT) */
291 #define SMB_FID_DELONCLOSE              0x20    /* marked for deletion */
292 /*
293  * Now some special flags to work around a bug in NT Client
294  */
295 #define SMB_FID_LENGTHSETDONE           0x40    /* have done 0-length write */
296 #define SMB_FID_MTIMESETDONE            0x80    /* have set modtime via Tr2 */
297 #define SMB_FID_LOOKSLIKECOPY   (SMB_FID_LENGTHSETDONE | SMB_FID_MTIMESETDONE)
298 #define SMB_FID_NTOPEN                  0x100   /* have dscp and pathp */
299
300 /*
301  * SMB file attributes
302  */
303 #define SMB_ATTR_ARCHIVE  0x20
304 #define SMB_ATTR_COMPRESSED 0x800 /* file or dir is compressed */
305 #define SMB_ATTR_NORMAL 0x80 /* normal file. Only valid if used alone */
306 #define SMB_ATTR_HIDDEN 0x2 /* hidden file for the purpose of dir listings */
307 #define SMB_ATTR_READONLY 0x1
308 #define SMB_ATTR_TEMPORARY 0x100
309 #define SMB_ATTR_DIRECTORY 0x10
310 #define SMB_ATTR_SYSTEM 0x4
311
312 /* for tracking in-progress directory searches */
313 typedef struct smb_dirSearch {
314         osi_queue_t q;                  /* queue of all outstanding cookies */
315         osi_mutex_t mx;                 /* just in case the caller screws up */
316         unsigned long refCount;                 /* reference count */
317         long cookie;                    /* value returned to the caller */
318         struct cm_scache *scp;          /* vnode of the dir we're searching */
319         time_t lastTime;                /* last time we used this */
320         long flags;                     /* flags (see below);
321                                          * locked by smb_globalLock */
322         unsigned short attribute;       /* search attribute
323                                          * (used for extended protocol) */
324         char mask[256];                 /* search mask for V3 */
325 } smb_dirSearch_t;
326
327 #define SMB_DIRSEARCH_DELETE    1       /* delete struct when ref count zero */
328 #define SMB_DIRSEARCH_HITEOF    2       /* perhaps useful for advisory later */
329 #define SMB_DIRSEARCH_SMALLID   4       /* cookie can only be 8 bits, not 16 */
330 #define SMB_DIRSEARCH_BULKST    8       /* get bulk stat info */
331
332 /* type for patching directory listings */
333 typedef struct smb_dirListPatch {
334         osi_queue_t q;
335     char *dptr;         /* ptr to attr, time, data, sizel, sizeh */
336     long flags;     /* flags.  See below */
337         cm_fid_t fid;
338   cm_dirEntry_t *dep;   /* temp */
339 } smb_dirListPatch_t;
340
341 /* dirListPatch Flags */
342 #define SMB_DIRLISTPATCH_DOTFILE 1  
343 /* the file referenced is a dot file
344  * Note: will not be set if smb_hideDotFiles is false 
345  */
346
347 /* waiting lock list elements */
348 typedef struct smb_waitingLock {
349         osi_queue_t q;
350         smb_vc_t *vcp;
351         smb_packet_t *inp;
352         smb_packet_t *outp;
353         time_t timeRemaining;
354         void *lockp;
355 } smb_waitingLock_t;
356
357 extern smb_waitingLock_t *smb_allWaitingLocks;
358
359 typedef long (smb_proc_t)(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp);
360
361 typedef struct smb_dispatch {
362         smb_proc_t *procp;      /* proc to call */
363         int flags;              /* flags describing function */
364 } smb_dispatch_t;
365
366 #define SMB_DISPATCHFLAG_CHAINED        1       /* this is an _AND_X function */
367 #define SMB_DISPATCHFLAG_NORESPONSE     2       /* don't send the response
368                                                  * packet, typically because
369                                                  * the response was already
370                                                  * sent.
371                                                  */
372 #define SMB_MAX_PATH                    256     /* max path length */
373
374 /* prototypes */
375
376 extern void smb_Init(osi_log_t *logp, char *smbNamep, int useV3, int LANadapt,
377         int nThreads
378 #ifndef DJGPP
379         , void *aMBfunc
380 #endif
381   );
382
383 extern void smb_LargeSearchTimeFromUnixTime(FILETIME *largeTimep, time_t unixTime);
384
385 extern void smb_UnixTimeFromLargeSearchTime(time_t *unixTimep, FILETIME *largeTimep);
386
387 extern void smb_SearchTimeFromUnixTime(time_t *dosTimep, time_t unixTime);
388
389 extern void smb_UnixTimeFromSearchTime(time_t *unixTimep, time_t searchTime);
390
391 extern void smb_DosUTimeFromUnixTime(time_t *dosUTimep, time_t unixTime);
392
393 extern void smb_UnixTimeFromDosUTime(time_t *unixTimep, time_t dosUTime);
394
395 extern smb_vc_t *smb_FindVC(unsigned short lsn, int flags, int lana);
396
397 extern void smb_ReleaseVC(smb_vc_t *vcp);
398
399 extern smb_tid_t *smb_FindTID(smb_vc_t *vcp, unsigned short tid, int flags);
400
401 extern void smb_ReleaseTID(smb_tid_t *tidp);
402
403 extern smb_user_t *smb_FindUID(smb_vc_t *vcp, unsigned short uid, int flags);
404
405 extern smb_username_t *smb_FindUserByName(char *usern, char *machine, int flags);
406
407 extern smb_user_t *smb_FindUserByNameThisSession(smb_vc_t *vcp, char *usern); 
408
409 extern smb_username_t *smb_FindUserByName(char *usern, char *machine, int flags);
410
411 extern smb_user_t *smb_FindUserByNameThisSession(smb_vc_t *vcp, char *usern);
412
413 extern void smb_ReleaseUID(smb_user_t *uidp);
414
415 extern cm_user_t *smb_GetUser(smb_vc_t *vcp, smb_packet_t *inp);
416
417 extern long smb_LookupTIDPath(smb_vc_t *vcp, unsigned short tid, char ** tidPathp);
418
419 extern smb_fid_t *smb_FindFID(smb_vc_t *vcp, unsigned short fid, int flags);
420
421 extern void smb_ReleaseFID(smb_fid_t *fidp);
422
423 extern int smb_FindShare(smb_vc_t *vcp, smb_user_t *uidp, char *shareName, char **pathNamep);
424
425 extern int smb_FindShareCSCPolicy(char *shareName);
426
427 extern smb_dirSearch_t *smb_FindDirSearchNL(long cookie);
428
429 extern void smb_DeleteDirSearch(smb_dirSearch_t *dsp);
430
431 extern void smb_ReleaseDirSearch(smb_dirSearch_t *dsp);
432
433 extern smb_dirSearch_t *smb_FindDirSearch(long cookie);
434
435 extern smb_dirSearch_t *smb_NewDirSearch(int isV3);
436
437 extern smb_packet_t *smb_CopyPacket(smb_packet_t *packetp);
438
439 extern void smb_FreePacket(smb_packet_t *packetp);
440
441 extern unsigned char *smb_GetSMBData(smb_packet_t *smbp, int *nbytesp);
442
443 extern void smb_SetSMBDataLength(smb_packet_t *smbp, unsigned int dsize);
444
445 extern unsigned int smb_GetSMBParm(smb_packet_t *smbp, int parm);
446
447 extern unsigned int smb_GetSMBOffsetParm(smb_packet_t *smbp, int parm, int offset);
448
449 extern void smb_SetSMBParm(smb_packet_t *smbp, int slot, unsigned int parmValue);
450
451 extern void smb_SetSMBParmLong(smb_packet_t *smbp, int slot, unsigned int parmValue);
452
453 extern void smb_SetSMBParmDouble(smb_packet_t *smbp, int slot, char *parmValuep);
454
455 extern void smb_SetSMBParmByte(smb_packet_t *smbp, int slot, unsigned int parmValue);
456
457 extern void smb_StripLastComponent(char *outPathp, char **lastComponentp,
458         char *inPathp);
459
460 extern unsigned char *smb_ParseASCIIBlock(unsigned char *inp, char **chainpp);
461
462 extern unsigned char *smb_ParseVblBlock(unsigned char *inp, char **chainpp,
463         int *lengthp);
464
465 extern smb_packet_t *smb_GetResponsePacket(smb_vc_t *vcp, smb_packet_t *inp);
466
467 extern void smb_SendPacket(smb_vc_t *vcp, smb_packet_t *inp);
468
469 extern void smb_MapCoreError(long code, smb_vc_t *vcp, unsigned short *scodep,
470         unsigned char *classp);
471
472 extern void smb_MapNTError(long code, unsigned long *NTStatusp);
473
474 extern void smb_HoldVC(smb_vc_t *vcp);
475
476 /* some globals, too */
477 extern char *smb_localNamep;
478 extern int loggedOut;
479 extern time_t loggedOutTime;
480 extern char *loggedOutName;
481 extern smb_user_t *loggedOutUserp;
482
483 extern osi_log_t *smb_logp;
484
485 extern osi_rwlock_t smb_globalLock;
486
487 extern osi_rwlock_t smb_rctLock;
488
489 extern int smb_LogoffTokenTransfer;
490 extern time_t smb_LogoffTransferTimeout;
491
492 extern int smb_maxVCPerServer; /* max # of VCs per server */
493 extern int smb_maxMpxRequests; /* max # of mpx requests */
494
495 extern int smb_hideDotFiles;
496 extern unsigned int smb_IsDotFile(char *lastComp);
497
498 /* the following are used for smb auth */
499 extern int smb_authType; /* Type of SMB authentication to be used. One from below. */
500
501 #define SMB_AUTH_NONE 0
502 #define SMB_AUTH_NTLM 1
503 #define SMB_AUTH_EXTENDED 2
504
505 extern HANDLE smb_lsaHandle; /* LSA handle obtained during smb_init if using SMB auth */
506 extern ULONG smb_lsaSecPackage; /* LSA security package id. Set during smb_init */
507 extern char smb_ServerDomainName[];
508 extern int smb_ServerDomainNameLength;
509 extern char smb_ServerOS[];
510 extern int smb_ServerOSLength;
511 extern char smb_ServerLanManager[];
512 extern int smb_ServerLanManagerLength;
513 extern GUID smb_ServerGUID;
514 extern LSA_STRING smb_lsaLogonOrigin;
515
516 /* used for getting a challenge for SMB auth */
517 typedef struct _MSV1_0_LM20_CHALLENGE_REQUEST {  
518         MSV1_0_PROTOCOL_MESSAGE_TYPE MessageType;
519 } MSV1_0_LM20_CHALLENGE_REQUEST, *PMSV1_0_LM20_CHALLENGE_REQUEST;
520
521 typedef struct _MSV1_0_LM20_CHALLENGE_RESPONSE {  
522         MSV1_0_PROTOCOL_MESSAGE_TYPE MessageType;  
523         UCHAR ChallengeToClient[MSV1_0_CHALLENGE_LENGTH];
524 } MSV1_0_LM20_CHALLENGE_RESPONSE, *PMSV1_0_LM20_CHALLENGE_RESPONSE;
525 /**/
526
527 extern long smb_AuthenticateUserLM(smb_vc_t *vcp, char * accountName, char * primaryDomain, char * ciPwd, unsigned ciPwdLength, char * csPwd, unsigned csPwdLength);
528
529 extern long smb_GetNormalizedUsername(char * usern, const char * accountName, const char * domainName);
530
531 extern void smb_FormatResponsePacket(smb_vc_t *vcp, smb_packet_t *inp,
532         smb_packet_t *op);
533
534 extern char *myCrt_Dispatch(int i); 
535
536 extern char *myCrt_2Dispatch(int i);
537
538 extern char *myCrt_RapDispatch(int i);
539
540 extern unsigned int smb_Attributes(cm_scache_t *scp);
541
542 extern int smb_ChainFID(int fid, smb_packet_t *inp);
543
544 extern smb_fid_t *smb_FindFID(smb_vc_t *vcp, unsigned short fid, int flags);
545
546 extern void smb_ReleaseFID(smb_fid_t *fidp);
547
548 extern unsigned char *smb_ParseDataBlock(unsigned char *inp, char **chainpp, int *lengthp);
549
550 extern unsigned char *smb_ParseASCIIBlock(unsigned char *inp, char **chainpp);
551
552 extern unsigned char *smb_ParseVblBlock(unsigned char *inp, char **chainpp, int *lengthp);
553
554 extern int smb_SUser(cm_user_t *userp);
555
556 #ifndef DJGPP
557 extern long smb_ReadData(smb_fid_t *fidp, osi_hyper_t *offsetp, long count,
558         char *op, cm_user_t *userp, long *readp);
559 #else /* DJGPP */
560 extern long smb_ReadData(smb_fid_t *fidp, osi_hyper_t *offsetp, long count,
561         char *op, cm_user_t *userp, long *readp, int dosflag);
562 #endif /* !DJGPP */
563
564 extern long smb_Rename(smb_vc_t *vcp, smb_packet_t *inp, char *oldPathp, char *newPathp, int attrs);
565
566 extern long smb_Link(smb_vc_t *vcp, smb_packet_t *inp, char *oldPathp, char *newPathp);
567
568 extern BOOL smb_IsLegalFilename(char *filename);
569
570 extern char *smb_GetSharename(void);
571
572 /* include other include files */
573 #include "smb3.h"
574 #include "smb_ioctl.h"
575 #include "smb_iocons.h"
576
577 cm_user_t *smb_FindOrCreateUser(smb_vc_t *vcp, char *usern);
578
579 #ifdef NOTSERVICE
580 extern void smb_LogPacket(smb_packet_t *packet);
581 #endif /* NOTSERVICE */
582 #endif /* whole file */