d44c14ee26a168e151d638b888423d8904ceb6e1
[openafs.git] / src / WINNT / afsd / cm_ioctl.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 __CM_IOCTL_H_ENV__
11 #define __CM_IOCTL_H_ENV__ 1
12
13 #ifndef __CM_IOCTL_INTERFACES_ONLY__
14 #include "cm_user.h"
15 #else
16 typedef struct cm_fid {
17         unsigned long cell;
18         unsigned long volume;
19         unsigned long vnode;
20         unsigned long unique;
21 } cm_fid_t;
22 #endif /* __CM_IOCTL_INTERFACES_ONLY__ */
23
24 /* the following four structures are used for fs get/set serverprefs command*/
25 #define         CM_SPREF_VLONLY         0x01
26 typedef struct cm_SPref {
27         struct in_addr host;
28         unsigned short rank;
29 } cm_SPref_t;
30
31 typedef struct cm_SPrefRequest {             
32         unsigned short offset;
33         unsigned short num_servers;
34         unsigned short flags;
35 } cm_SPrefRequest_t;
36
37 typedef struct cm_SPrefInfo {
38         unsigned short next_offset;
39         unsigned short num_servers;
40         struct cm_SPref servers[1];/* we overrun this array intentionally...*/
41 } cm_SPrefInfo_t;
42
43 typedef struct cm_SSetPref {
44         unsigned short flags;
45         unsigned short num_servers;
46         struct cm_SPref servers[1];/* we overrun this array intentionally...*/
47 } cm_SSetPref_t;
48
49 #define CM_IOCTLCACHEPARMS              16
50 typedef struct cm_cacheParms {
51         afs_uint64 parms[CM_IOCTLCACHEPARMS];
52 } cm_cacheParms_t;
53
54 typedef struct cm_ioctl {
55     /* input side */
56     char *inDatap;                      /* ioctl func's current position
57                                          * in input parameter block */
58     char *inAllocp;                     /* allocated input parameter block */
59     afs_uint32 inCopied;                /* # of input bytes copied in so far
60                                          * by write calls */
61     /* output side */
62     char *outDatap;                     /* output results assembled so far */
63     char *outAllocp;                    /* output results assembled so far */
64     afs_uint32 outCopied;               /* # of output bytes copied back so far
65         
66     /* flags */
67     afs_uint32 flags;
68 } cm_ioctl_t;
69
70 /* flags for smb_ioctl_t */
71 #define CM_IOCTLFLAG_DATAIN     1       /* reading data from client to server */
72 #define CM_IOCTLFLAG_LOGON      2       /* got tokens from integrated logon */
73 #define CM_IOCTLFLAG_USEUTF8    4       /* this request is using UTF-8 strings */
74 #define CM_IOCTLFLAG_DATAOUT    8       /* sending data from server to client */
75
76
77 /* 
78  * The cm_IoctlQueryOptions structure is designed to be extendible.
79  * None of the fields are required but when specified 
80  * by the client and understood by the server will be 
81  * used to more precisely specify the desired data.
82  *
83  * size must be set to the size of the structure 
84  * sent by the client including any variable length
85  * data appended to the end of the static structure.
86  *
87  * field_flags are used to determine which fields have
88  * been filled in and should be used.
89  *
90  * variable length data can be specified with fields
91  * that include offsets to data appended to the 
92  * structure.
93  *
94  * when adding new fields you must:
95  *  - add the field
96  *  - define a CM_IOCTL_QOPTS_FIELD_xxx bit flag
97  *  - define a CM_IOCTL_QOPTS_HAVE_xxx macro
98  *
99  * It is critical that flags be consistent across all
100  * implementations of the pioctl interface for a given
101  * platform.  This should be considered a public 
102  * interface used by third party application developers.
103  */
104
105 typedef struct cm_IoctlQueryOptions {
106     afs_uint32  size; 
107     afs_uint32  field_flags;
108     afs_uint32  literal;
109     cm_fid_t    fid;
110 } cm_ioctlQueryOptions_t;
111
112 /* field flags -  */
113 #define CM_IOCTL_QOPTS_FIELD_LITERAL 1
114 #define CM_IOCTL_QOPTS_FIELD_FID     2
115
116 #define CM_IOCTL_QOPTS_HAVE_LITERAL(p) (p->size >= 12 && (p->field_flags & CM_IOCTL_QOPTS_FIELD_LITERAL))
117 #define CM_IOCTL_QOPTS_HAVE_FID(p)     (p->size >= 28 && (p->field_flags & CM_IOCTL_QOPTS_FIELD_FID))
118
119 #define MAXNUMSYSNAMES    16      /* max that current constants allow */
120 #define   MAXSYSNAME      128     /* max sysname (i.e. @sys) size */
121 extern clientchar_t  *cm_sysName;
122 extern unsigned int   cm_sysNameCount;
123 extern clientchar_t  *cm_sysNameList[MAXNUMSYSNAMES];
124
125 /* Paths that are passed into pioctl calls can be specified using
126    UTF-8.  These strings are prefixed with UTF8_PREFIX defined below.
127    The sequence ESC '%' 'G' is used by ISO-2022 to designate UTF-8
128    strings. */
129 #define UTF8_PREFIX "\33%G"
130
131 extern const char utf8_prefix[];
132 extern const int  utf8_prefix_size;
133
134 /* flags for rxstats pioctl */
135
136 #define AFSCALL_RXSTATS_MASK    0x7     /* Valid flag bits */
137 #define AFSCALL_RXSTATS_ENABLE  0x1     /* Enable RX stats */
138 #define AFSCALL_RXSTATS_DISABLE 0x2     /* Disable RX stats */
139 #define AFSCALL_RXSTATS_CLEAR   0x4     /* Clear RX stats */
140
141 /* pioctl flags */
142
143 #define AFSCALL_FLAG_LOCAL_SYSTEM 0x1
144
145 #ifndef __CM_IOCTL_INTERFACES_ONLY__
146
147 extern void cm_InitIoctl(void);
148
149 extern cm_ioctlQueryOptions_t *
150 cm_IoctlGetQueryOptions(struct cm_ioctl *ioctlp, struct cm_user *userp);
151
152 extern void
153 cm_IoctlSkipQueryOptions(struct cm_ioctl *ioctlp, struct cm_user *userp);
154
155 extern void
156 cm_NormalizeAfsPath(clientchar_t *outpathp, long outlen, clientchar_t *inpathp);
157
158 extern void cm_SkipIoctlPath(cm_ioctl_t *ioctlp);
159
160 extern clientchar_t * cm_ParseIoctlStringAlloc(cm_ioctl_t *ioctlp, const char * ext_instrp);
161
162 extern int cm_UnparseIoctlString(cm_ioctl_t *ioctlp, char * ext_outp, const clientchar_t * cstr, int cchlen);
163
164 extern afs_int32 cm_IoctlGetACL(cm_ioctl_t *ioctlp, cm_user_t *userp, cm_scache_t *scp, cm_req_t *reqp);
165
166 extern afs_int32 cm_IoctlGetFileCellName(cm_ioctl_t *ioctlp, cm_user_t *userp, cm_scache_t *scp, cm_req_t *reqp);
167
168 extern afs_int32 cm_IoctlSetACL(cm_ioctl_t *ioctlp, cm_user_t *userp, cm_scache_t *scp, cm_req_t *reqp);
169
170 extern afs_int32 cm_IoctlFlushAllVolumes(cm_ioctl_t *ioctlp, cm_user_t *userp, cm_req_t *reqp);
171
172 extern afs_int32 cm_IoctlFlushVolume(cm_ioctl_t *ioctlp, cm_user_t *userp, cm_scache_t *scp, cm_req_t *reqp);
173
174 extern afs_int32 cm_IoctlFlushFile(cm_ioctl_t *ioctlp, cm_user_t *userp, cm_scache_t *scp, cm_req_t *reqp);
175
176 extern afs_int32 cm_IoctlSetVolumeStatus(cm_ioctl_t *ioctlp, cm_user_t *userp, cm_scache_t *scp, cm_req_t *reqp);
177
178 extern afs_int32 cm_IoctlGetVolumeStatus(cm_ioctl_t *ioctlp, cm_user_t *userp, cm_scache_t *scp, cm_req_t *reqp);
179
180 extern afs_int32 cm_IoctlGetFid(cm_ioctl_t *ioctlp, cm_user_t *userp, cm_scache_t *scp, cm_req_t *reqp);
181
182 extern afs_int32 cm_IoctlGetOwner(cm_ioctl_t *ioctlp, cm_user_t *userp, cm_scache_t *scp, cm_req_t *reqp);
183
184 extern afs_int32 cm_IoctlSetOwner(cm_ioctl_t *ioctlp, cm_user_t *userp, cm_scache_t *scp, cm_req_t *reqp);
185
186 extern afs_int32 cm_IoctlSetGroup(cm_ioctl_t *ioctlp, cm_user_t *userp, cm_scache_t *scp, cm_req_t *reqp);
187
188 extern afs_int32 cm_IoctlWhereIs(cm_ioctl_t *ioctlp, cm_user_t *userp, cm_scache_t *scp, cm_req_t *reqp);
189
190 extern afs_int32 cm_IoctlStatMountPoint(cm_ioctl_t *ioctlp, cm_user_t *userp, cm_scache_t *scp, cm_req_t *reqp);
191
192 extern afs_int32 cm_IoctlDeleteMountPoint(cm_ioctl_t *ioctlp, cm_user_t *userp, cm_scache_t *scp, cm_req_t *reqp);
193
194 extern afs_int32 cm_IoctlCheckServers(cm_ioctl_t *ioctlp, cm_user_t *userp);
195
196 extern afs_int32 cm_IoctlGag(cm_ioctl_t *ioctlp, cm_user_t *userp);
197
198 extern afs_int32 cm_IoctlCheckVolumes(cm_ioctl_t *ioctlp, cm_user_t *userp);
199
200 extern afs_int32 cm_IoctlSetCacheSize(cm_ioctl_t *ioctlp, cm_user_t *userp);
201
202 extern afs_int32 cm_IoctlGetCacheParms(cm_ioctl_t *ioctlp, cm_user_t *userp);
203
204 extern afs_int32 cm_IoctlGetCell(cm_ioctl_t *ioctlp, cm_user_t *userp);
205
206 extern afs_int32 cm_IoctlNewCell(cm_ioctl_t *ioctlp, cm_user_t *userp);
207
208 extern afs_int32 cm_IoctlNewCell2(cm_ioctl_t *ioctlp, cm_user_t *userp);
209
210 extern afs_int32 cm_IoctlGetWsCell(cm_ioctl_t *ioctlp, cm_user_t *userp);
211
212 extern afs_int32 cm_IoctlSysName(cm_ioctl_t *ioctlp, cm_user_t *userp);
213
214 extern afs_int32 cm_IoctlGetCellStatus(cm_ioctl_t *ioctlp, cm_user_t *userp);
215
216 extern afs_int32 cm_IoctlSetCellStatus(cm_ioctl_t *ioctlp, cm_user_t *userp);
217
218 extern afs_int32 cm_IoctlSetSPrefs(cm_ioctl_t *ioctlp, cm_user_t *userp);
219
220 extern afs_int32 cm_IoctlGetSPrefs(cm_ioctl_t *ioctlp, cm_user_t *userp);
221
222 extern afs_int32 cm_IoctlStoreBehind(cm_ioctl_t *ioctlp, cm_user_t *userp);
223
224 extern afs_int32 cm_IoctlCreateMountPoint(cm_ioctl_t *ioctlp, cm_user_t *userp, cm_scache_t *dscp, cm_req_t *reqp, clientchar_t *leaf);
225
226 extern afs_int32 cm_CleanFile(cm_scache_t *scp, cm_user_t *userp, cm_req_t *reqp);
227
228 extern afs_int32 cm_FlushFile(cm_scache_t *scp, cm_user_t *userp, cm_req_t *reqp);
229
230 extern afs_int32 cm_FlushVolume(cm_user_t *, cm_req_t *reqp, afs_uint32 cell, afs_uint32 volume);
231
232 extern afs_int32 cm_FlushParent(cm_scache_t *scp, cm_user_t *userp, cm_req_t *reqp);
233
234 extern afs_int32 cm_IoctlTraceControl(cm_ioctl_t *ioctlp, cm_user_t *userp);
235
236 extern afs_int32 cm_IoctlSetToken(cm_ioctl_t *ioctlp, cm_user_t *userp);
237
238 extern afs_int32 cm_IoctlGetTokenIter(cm_ioctl_t *ioctlp, cm_user_t *userp);
239
240 extern afs_int32 cm_IoctlGetToken(cm_ioctl_t *ioctlp, cm_user_t *userp);
241
242 extern afs_int32 cm_IoctlDelToken(cm_ioctl_t *ioctlp, cm_user_t *userp);
243
244 extern afs_int32 cm_IoctlDelAllToken(cm_ioctl_t *ioctlp, cm_user_t *userp);
245
246 extern afs_int32 cm_IoctlSymlink(cm_ioctl_t *ioctlp, cm_user_t *userp, cm_scache_t *dscp, cm_req_t *reqp, clientchar_t *leaf);
247
248 extern afs_int32 cm_IoctlIslink(cm_ioctl_t *ioctlp, cm_user_t *userp, cm_scache_t *scp, cm_req_t *reqp);
249
250 extern afs_int32 cm_IoctlListlink(cm_ioctl_t *ioctlp, cm_user_t *userp, cm_scache_t *scp, cm_req_t *reqp);
251
252 extern afs_int32 cm_IoctlDeletelink(cm_ioctl_t *ioctlp, cm_user_t *userp, cm_scache_t *dscp, cm_req_t *reqp);
253
254 extern afs_int32 cm_IoctlMakeSubmount(cm_ioctl_t *ioctlp, cm_user_t *userp);
255
256 extern afs_int32 cm_IoctlGetRxkcrypt(cm_ioctl_t *ioctlp, cm_user_t *userp);
257
258 extern afs_int32 cm_IoctlSetRxkcrypt(cm_ioctl_t *ioctlp, cm_user_t *userp);
259
260 extern afs_int32 cm_IoctlShutdown(cm_ioctl_t *ioctlp, cm_user_t *userp);
261
262 extern afs_int32 cm_IoctlFreemountAddCell(cm_ioctl_t *ioctlp, cm_user_t *userp);
263
264 extern afs_int32 cm_IoctlFreemountRemoveCell(cm_ioctl_t *ioctlp, cm_user_t *userp);
265
266 extern afs_int32 cm_IoctlMemoryDump(cm_ioctl_t *ioctlp, cm_user_t *userp);
267
268 extern afs_int32 cm_IoctlRxStatProcess(cm_ioctl_t *ioctlp, cm_user_t *userp);
269
270 extern afs_int32 cm_IoctlRxStatPeer(cm_ioctl_t *ioctlp, cm_user_t *userp);
271
272 extern afs_int32 cm_IoctlUUIDControl(struct cm_ioctl * ioctlp, struct cm_user *userp);
273
274 extern afs_int32 cm_IoctlPathAvailability(struct cm_ioctl * ioctlp, struct cm_user *userp, struct cm_scache *scp, struct cm_req *reqp);
275
276 extern afs_int32 cm_IoctlGetFileType(cm_ioctl_t *ioctlp, cm_user_t *userp, struct cm_scache *scp, struct cm_req *reqp);
277
278 extern afs_int32 cm_IoctlVolStatTest(struct cm_ioctl *ioctlp, struct cm_user *userp, cm_req_t *reqp);
279
280 extern afs_int32 cm_IoctlUnicodeControl(struct cm_ioctl *ioctlp, struct cm_user * userp);
281
282 extern void TranslateExtendedChars(char *str);
283
284 #endif /* __CM_IOCTL_INTERFACES_ONLY__ */
285
286 #endif /*  __CM_IOCTL_H_ENV__ */