down-before-busy-20040723
[openafs.git] / src / WINNT / afsd / smb3.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 __SMB3_H_ENV__
11 #define __SMB3_H_ENV__ 1
12
13 typedef struct smb_tran2Packet {
14         osi_queue_t q;                  /* queue of all packets */
15                 int com;                        /* Trans or Trans2 (0x25 or 0x32) */
16         int totalData;                  /* total # of expected data bytes */
17         int totalParms;                 /* total # of expected parm bytes */
18         int oldTotalParms;              /* initial estimate of parm bytes */
19         int curData;                    /* current # of received data bytes */
20         int curParms;                   /* current # of received parm bytes */
21         int maxReturnData;              /* max # of returned data bytes */
22         int maxReturnParms;             /* max # of returned parm bytes */
23         int opcode;                     /* subopcode we're handling */
24         long flags;                     /* flags */
25         smb_vc_t *vcp;                  /* virtual circuit we're dealing with */
26         unsigned short tid;             /* tid to match */
27         unsigned short mid;             /* mid to match */
28         unsigned short pid;             /* pid to remember */
29         unsigned short uid;             /* uid to remember */
30         unsigned short res[6];          /* contains PidHigh */
31         unsigned short *parmsp;         /* parms */
32         unsigned char *datap;           /* data bytes */
33 } smb_tran2Packet_t;
34
35 /* for flags field */
36 #define SMB_TRAN2PFLAG_ALLOC    1
37
38 typedef struct smb_tran2Dispatch {
39         long (*procp)(smb_vc_t *, smb_tran2Packet_t *, smb_packet_t *);
40         long flags;
41 } smb_tran2Dispatch_t;
42
43 typedef struct smb_tran2QFSInfo {
44         union {
45 #pragma pack(push, 2)
46                 struct {
47                         long FSID;                      /* file system ID */
48                         long sectorsPerAllocUnit;
49                         long totalAllocUnits;           /* on the disk */
50                         long availAllocUnits;           /* free blocks */
51                         unsigned short bytesPerSector;  /* bytes per sector */
52                 } allocInfo;
53 #pragma pack(pop)
54                 struct {
55                         long vsn;       /* volume serial number */
56                         char vnCount;   /* count of chars in label, incl null */
57                         char label[12]; /* pad out with nulls */
58                 } volumeInfo;
59                 struct {
60                         FILETIME vct;   /* volume creation time */
61                         long vsn;       /* volume serial number */
62                         long vnCount;   /* length of volume label in bytes */
63                         char res[2];    /* reserved */
64                         char label[10]; /* volume label */
65                 } FSvolumeInfo;
66                 struct {
67                         osi_hyper_t totalAllocUnits;    /* on the disk */
68                         osi_hyper_t availAllocUnits;    /* free blocks */
69                         long sectorsPerAllocUnit;
70                         long bytesPerSector;            /* bytes per sector */
71                 } FSsizeInfo;
72                 struct {
73                         long devType;   /* device type */
74                         long characteristics;
75                 } FSdeviceInfo;
76                 struct {
77                         long attributes;
78                         long maxCompLength;     /* max path component length */
79                         long FSnameLength;      /* length of file system name */
80                         char FSname[12];
81                 } FSattributeInfo;
82         } u;
83 } smb_tran2QFSInfo_t;
84
85 /* more than enough opcodes for today, anyway */
86 #define SMB_TRAN2_NOPCODES              20
87
88 extern smb_tran2Dispatch_t smb_tran2DispatchTable[SMB_TRAN2_NOPCODES];
89
90 #define SMB_RAP_NOPCODES        64
91
92 extern smb_tran2Dispatch_t smb_rapDispatchTable[SMB_RAP_NOPCODES];
93
94 extern long smb_ReceiveV3SessionSetupX(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp);
95
96 extern long smb_ReceiveV3TreeConnectX(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp);
97
98 extern long smb_ReceiveV3Trans(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp);
99
100 extern long smb_ReceiveV3Tran2A(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp);
101
102 extern long smb_ReceiveRAPNetShareEnum(smb_vc_t *vcp, smb_tran2Packet_t *p, smb_packet_t *op);
103
104 extern long smb_ReceiveRAPNetShareGetInfo(smb_vc_t *vcp, smb_tran2Packet_t *p, smb_packet_t *op);
105
106 extern long smb_ReceiveRAPNetWkstaGetInfo(smb_vc_t *vcp, smb_tran2Packet_t *p, smb_packet_t *op);
107
108 extern long smb_ReceiveRAPNetServerGetInfo(smb_vc_t *vcp, smb_tran2Packet_t *p, smb_packet_t *op);
109
110 extern long smb_ReceiveTran2Open(smb_vc_t *vcp, smb_tran2Packet_t *p,
111         smb_packet_t *outp);
112
113 extern long smb_ReceiveTran2FindFirst(smb_vc_t *vcp, smb_tran2Packet_t *p,
114         smb_packet_t *outp);
115
116 extern long smb_ReceiveTran2SearchDir(smb_vc_t *vcp, smb_tran2Packet_t *p,
117         smb_packet_t *outp);
118
119 extern long smb_ReceiveTran2FindNext(smb_vc_t *vcp, smb_tran2Packet_t *p,
120         smb_packet_t *outp);
121
122 extern long smb_ReceiveTran2QFSInfo(smb_vc_t *vcp, smb_tran2Packet_t *p,
123         smb_packet_t *outp);
124
125 extern long smb_ReceiveTran2SetFSInfo(smb_vc_t *vcp, smb_tran2Packet_t *p,
126         smb_packet_t *outp);
127
128 extern long smb_ReceiveTran2QPathInfo(smb_vc_t *vcp, smb_tran2Packet_t *p,
129         smb_packet_t *outp);
130
131 extern long smb_ReceiveTran2SetPathInfo(smb_vc_t *vcp, smb_tran2Packet_t *p,
132         smb_packet_t *outp);
133
134 extern long smb_ReceiveTran2QFileInfo(smb_vc_t *vcp, smb_tran2Packet_t *p,
135         smb_packet_t *outp);
136
137 extern long smb_ReceiveTran2SetFileInfo(smb_vc_t *vcp, smb_tran2Packet_t *p,
138         smb_packet_t *outp);
139
140 extern long smb_ReceiveTran2FSCTL(smb_vc_t *vcp, smb_tran2Packet_t *p,
141         smb_packet_t *outp);
142
143 extern long smb_ReceiveTran2IOCTL(smb_vc_t *vcp, smb_tran2Packet_t *p,
144         smb_packet_t *outp);
145
146 extern long smb_ReceiveTran2FindNotifyFirst(smb_vc_t *vcp, smb_tran2Packet_t *p,
147         smb_packet_t *outp);
148
149 extern long smb_ReceiveTran2FindNotifyNext(smb_vc_t *vcp, smb_tran2Packet_t *p,
150         smb_packet_t *outp);
151
152 extern long smb_ReceiveTran2MKDir(smb_vc_t *vcp, smb_tran2Packet_t *p,
153         smb_packet_t *outp);
154
155 extern long smb_ReceiveV3FindClose(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp);
156
157 extern long smb_ReceiveV3FindNotifyClose(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp);
158
159 extern long smb_ReceiveV3UserLogoffX(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp);
160
161 extern long smb_ReceiveV3OpenX(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp);
162
163 extern long smb_ReceiveV3LockingX(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp);
164
165 extern long smb_ReceiveV3GetAttributes(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp);
166
167 extern long smb_ReceiveV3ReadX(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp);
168
169 extern long smb_ReceiveV3SetAttributes(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp);
170
171 extern long smb_ReceiveNTCreateX(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp);
172
173 extern long smb_ReceiveNTTransact(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp);
174
175 extern void smb_NotifyChange(DWORD action, DWORD notifyFilter,
176         cm_scache_t *dscp, char *filename, char *otherFilename,
177         BOOL isDirectParent);
178
179 extern long smb_ReceiveNTCancel(smb_vc_t *vcp, smb_packet_t *inp, smb_packet_t *outp);
180
181 extern int smb_V3MatchMask(char *namep, char *maskp, int flags);
182
183 extern void smb3_Init();
184 extern cm_user_t *smb_FindCMUserByName(/*smb_vc_t *vcp,*/ char *usern, char *machine);
185
186 /* SMB auth related functions */
187 extern void smb_NegotiateExtendedSecurity(void ** secBlob, int * secBlobLength);
188
189 #ifdef DJGPP
190 #define DELETE (0x00010000)
191 #define READ_CONTROL (0x00020000)
192 #define SYNCHRONIZE (0x00100000)
193 #define FILE_WRITE_ATTRIBUTES ( 0x0100 )
194 #define FILE_GENERIC_READ (0x00120089)
195 #define FILE_GENERIC_WRITE (0x00120116)
196 #define FILE_GENERIC_EXECUTE (0x001200a0)
197 #endif /* DJGPP */
198
199 #endif /*  __SMB3_H_ENV__ */