windows-cell-name-length-consistency-20080806
[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
75
76 /* 
77  * The cm_IoctlQueryOptions structure is designed to be extendible.
78  * None of the fields are required but when specified 
79  * by the client and understood by the server will be 
80  * used to more precisely specify the desired data.
81  *
82  * size must be set to the size of the structure 
83  * sent by the client including any variable length
84  * data appended to the end of the static structure.
85  *
86  * field_flags are used to determine which fields have
87  * been filled in and should be used.
88  *
89  * variable length data can be specified with fields
90  * that include offsets to data appended to the 
91  * structure.
92  *
93  * when adding new fields you must:
94  *  - add the field
95  *  - define a CM_IOCTL_QOPTS_FIELD_xxx bit flag
96  *  - define a CM_IOCTL_QOPTS_HAVE_xxx macro
97  *
98  * It is critical that flags be consistent across all
99  * implementations of the pioctl interface for a given
100  * platform.  This should be considered a public 
101  * interface used by third party application developers.
102  */
103
104 typedef struct cm_IoctlQueryOptions {
105     afs_uint32  size; 
106     afs_uint32  field_flags;
107     afs_uint32  literal;
108     cm_fid_t    fid;
109 } cm_ioctlQueryOptions_t;
110
111 /* field flags -  */
112 #define CM_IOCTL_QOPTS_FIELD_LITERAL 1
113 #define CM_IOCTL_QOPTS_FIELD_FID     2
114
115 #define CM_IOCTL_QOPTS_HAVE_LITERAL(p) (p->size >= 12 && (p->field_flags & CM_IOCTL_QOPTS_FIELD_LITERAL))
116 #define CM_IOCTL_QOPTS_HAVE_FID(p)     (p->size >= 28 && (p->field_flags & CM_IOCTL_QOPTS_FIELD_FID))
117
118 #define MAXNUMSYSNAMES    16      /* max that current constants allow */
119 #define   MAXSYSNAME      128     /* max sysname (i.e. @sys) size */
120 extern clientchar_t  *cm_sysName;
121 extern unsigned int   cm_sysNameCount;
122 extern clientchar_t  *cm_sysNameList[MAXNUMSYSNAMES];
123
124 /* Paths that are passed into pioctl calls can be specified using
125    UTF-8.  These strings are prefixed with UTF8_PREFIX defined below.
126    The sequence ESC '%' 'G' is used by ISO-2022 to designate UTF-8
127    strings. */
128 #define UTF8_PREFIX "\33%G"
129
130 extern const char utf8_prefix[];
131 extern const int  utf8_prefix_size;
132
133 /* flags for rxstats pioctl */
134
135 #define AFSCALL_RXSTATS_MASK    0x7     /* Valid flag bits */
136 #define AFSCALL_RXSTATS_ENABLE  0x1     /* Enable RX stats */
137 #define AFSCALL_RXSTATS_DISABLE 0x2     /* Disable RX stats */
138 #define AFSCALL_RXSTATS_CLEAR   0x4     /* Clear RX stats */
139
140 #ifndef __CM_IOCTL_INTERFACES_ONLY__
141
142 extern void cm_InitIoctl(void);
143
144 extern void cm_ResetACLCache(cm_user_t *userp);
145
146 extern cm_ioctlQueryOptions_t *
147 cm_IoctlGetQueryOptions(struct cm_ioctl *ioctlp, struct cm_user *userp);
148
149 extern void
150 cm_IoctlSkipQueryOptions(struct cm_ioctl *ioctlp, struct cm_user *userp);
151
152 extern void
153 cm_NormalizeAfsPath(clientchar_t *outpathp, long outlen, clientchar_t *inpathp);
154
155 extern void cm_SkipIoctlPath(cm_ioctl_t *ioctlp);
156
157 extern clientchar_t * cm_ParseIoctlStringAlloc(cm_ioctl_t *ioctlp, const char * ext_instrp);
158
159 extern int cm_UnparseIoctlString(cm_ioctl_t *ioctlp, char * ext_outp, const clientchar_t * cstr, int cchlen);
160
161 extern afs_int32 cm_IoctlGetACL(cm_ioctl_t *ioctlp, cm_user_t *userp, cm_scache_t *scp, cm_req_t *reqp);
162
163 extern afs_int32 cm_IoctlGetFileCellName(cm_ioctl_t *ioctlp, cm_user_t *userp, cm_scache_t *scp, cm_req_t *reqp);
164
165 extern afs_int32 cm_IoctlSetACL(cm_ioctl_t *ioctlp, cm_user_t *userp, cm_scache_t *scp, cm_req_t *reqp);
166
167 extern afs_int32 cm_IoctlFlushAllVolumes(cm_ioctl_t *ioctlp, cm_user_t *userp, cm_req_t *reqp);
168
169 extern afs_int32 cm_IoctlFlushVolume(cm_ioctl_t *ioctlp, cm_user_t *userp, cm_scache_t *scp, cm_req_t *reqp);
170
171 extern afs_int32 cm_IoctlFlushFile(cm_ioctl_t *ioctlp, cm_user_t *userp, cm_scache_t *scp, cm_req_t *reqp);
172
173 extern afs_int32 cm_IoctlSetVolumeStatus(cm_ioctl_t *ioctlp, cm_user_t *userp, cm_scache_t *scp, cm_req_t *reqp);
174
175 extern afs_int32 cm_IoctlGetVolumeStatus(cm_ioctl_t *ioctlp, cm_user_t *userp, cm_scache_t *scp, cm_req_t *reqp);
176
177 extern afs_int32 cm_IoctlGetFid(cm_ioctl_t *ioctlp, cm_user_t *userp, cm_scache_t *scp, cm_req_t *reqp);
178
179 extern afs_int32 cm_IoctlGetOwner(cm_ioctl_t *ioctlp, cm_user_t *userp, cm_scache_t *scp, cm_req_t *reqp);
180
181 extern afs_int32 cm_IoctlWhereIs(cm_ioctl_t *ioctlp, cm_user_t *userp, cm_scache_t *scp, cm_req_t *reqp);
182
183 extern afs_int32 cm_IoctlStatMountPoint(cm_ioctl_t *ioctlp, cm_user_t *userp, cm_scache_t *scp, cm_req_t *reqp);
184
185 extern afs_int32 cm_IoctlDeleteMountPoint(cm_ioctl_t *ioctlp, cm_user_t *userp, cm_scache_t *scp, cm_req_t *reqp);
186
187 extern afs_int32 cm_IoctlCheckServers(cm_ioctl_t *ioctlp, cm_user_t *userp);
188
189 extern afs_int32 cm_IoctlGag(cm_ioctl_t *ioctlp, cm_user_t *userp);
190
191 extern afs_int32 cm_IoctlCheckVolumes(cm_ioctl_t *ioctlp, cm_user_t *userp);
192
193 extern afs_int32 cm_IoctlSetCacheSize(cm_ioctl_t *ioctlp, cm_user_t *userp);
194
195 extern afs_int32 cm_IoctlGetCacheParms(cm_ioctl_t *ioctlp, cm_user_t *userp);
196
197 extern afs_int32 cm_IoctlGetCell(cm_ioctl_t *ioctlp, cm_user_t *userp);
198
199 extern afs_int32 cm_IoctlNewCell(cm_ioctl_t *ioctlp, cm_user_t *userp);
200
201 extern afs_int32 cm_IoctlGetWsCell(cm_ioctl_t *ioctlp, cm_user_t *userp);
202
203 extern afs_int32 cm_IoctlSysName(cm_ioctl_t *ioctlp, cm_user_t *userp);
204
205 extern afs_int32 cm_IoctlGetCellStatus(cm_ioctl_t *ioctlp, cm_user_t *userp);
206
207 extern afs_int32 cm_IoctlSetCellStatus(cm_ioctl_t *ioctlp, cm_user_t *userp);
208
209 extern afs_int32 cm_IoctlSetSPrefs(cm_ioctl_t *ioctlp, cm_user_t *userp);
210
211 extern afs_int32 cm_IoctlGetSPrefs(cm_ioctl_t *ioctlp, cm_user_t *userp);
212
213 extern afs_int32 cm_IoctlStoreBehind(cm_ioctl_t *ioctlp, cm_user_t *userp);
214
215 extern afs_int32 cm_IoctlCreateMountPoint(cm_ioctl_t *ioctlp, cm_user_t *userp, cm_scache_t *dscp, cm_req_t *reqp, clientchar_t *leaf);
216
217 extern afs_int32 cm_CleanFile(cm_scache_t *scp, cm_user_t *userp, cm_req_t *reqp);
218
219 extern afs_int32 cm_FlushFile(cm_scache_t *scp, cm_user_t *userp, cm_req_t *reqp);
220
221 extern afs_int32 cm_FlushVolume(cm_user_t *, cm_req_t *reqp, afs_uint32 cell, afs_uint32 volume);
222
223 extern afs_int32 cm_FlushParent(cm_scache_t *scp, cm_user_t *userp, cm_req_t *reqp);
224
225 extern afs_int32 cm_IoctlTraceControl(cm_ioctl_t *ioctlp, cm_user_t *userp);
226
227 extern afs_int32 cm_IoctlSetToken(cm_ioctl_t *ioctlp, cm_user_t *userp);
228
229 extern afs_int32 cm_IoctlGetTokenIter(cm_ioctl_t *ioctlp, cm_user_t *userp);
230
231 extern afs_int32 cm_IoctlGetToken(cm_ioctl_t *ioctlp, cm_user_t *userp);
232
233 extern afs_int32 cm_IoctlDelToken(cm_ioctl_t *ioctlp, cm_user_t *userp);
234
235 extern afs_int32 cm_IoctlDelAllToken(cm_ioctl_t *ioctlp, cm_user_t *userp);
236
237 extern afs_int32 cm_IoctlSymlink(cm_ioctl_t *ioctlp, cm_user_t *userp, cm_scache_t *dscp, cm_req_t *reqp, clientchar_t *leaf);
238
239 extern afs_int32 cm_IoctlIslink(cm_ioctl_t *ioctlp, cm_user_t *userp, cm_scache_t *scp, cm_req_t *reqp);
240
241 extern afs_int32 cm_IoctlListlink(cm_ioctl_t *ioctlp, cm_user_t *userp, cm_scache_t *scp, cm_req_t *reqp);
242
243 extern afs_int32 cm_IoctlDeletelink(cm_ioctl_t *ioctlp, cm_user_t *userp, cm_scache_t *dscp, cm_req_t *reqp);
244
245 extern afs_int32 cm_IoctlMakeSubmount(cm_ioctl_t *ioctlp, cm_user_t *userp);
246
247 extern afs_int32 cm_IoctlGetRxkcrypt(cm_ioctl_t *ioctlp, cm_user_t *userp);
248
249 extern afs_int32 cm_IoctlSetRxkcrypt(cm_ioctl_t *ioctlp, cm_user_t *userp);
250
251 extern afs_int32 cm_IoctlShutdown(cm_ioctl_t *ioctlp, cm_user_t *userp);
252
253 extern afs_int32 cm_IoctlFreemountAddCell(cm_ioctl_t *ioctlp, cm_user_t *userp);
254
255 extern afs_int32 cm_IoctlFreemountRemoveCell(cm_ioctl_t *ioctlp, cm_user_t *userp);
256
257 extern afs_int32 cm_IoctlMemoryDump(cm_ioctl_t *ioctlp, cm_user_t *userp);
258
259 extern afs_int32 cm_IoctlRxStatProcess(cm_ioctl_t *ioctlp, cm_user_t *userp);
260
261 extern afs_int32 cm_IoctlRxStatPeer(cm_ioctl_t *ioctlp, cm_user_t *userp);
262
263 extern afs_int32 cm_IoctlUUIDControl(struct cm_ioctl * ioctlp, struct cm_user *userp);
264
265 extern afs_int32 cm_IoctlPathAvailability(struct cm_ioctl * ioctlp, struct cm_user *userp, struct cm_scache *scp, struct cm_req *reqp);
266
267 extern afs_int32 cm_IoctlGetFileType(cm_ioctl_t *ioctlp, cm_user_t *userp, struct cm_scache *scp, struct cm_req *reqp);
268
269 extern afs_int32 cm_IoctlVolStatTest(struct cm_ioctl *ioctlp, struct cm_user *userp, cm_req_t *reqp);
270
271 extern afs_int32 cm_IoctlUnicodeControl(struct cm_ioctl *ioctlp, struct cm_user * userp);
272
273 extern void TranslateExtendedChars(char *str);
274
275 #endif /* __CM_IOCTL_INTERFACES_ONLY__ */
276
277 #endif /*  __CM_IOCTL_H_ENV__ */