dafs-kill-xcpu-dump-vlru-stats-20080318
[openafs.git] / src / WINNT / afsrdr / ifs_rpc.h
1 /* copyright (c) 2005
2  * the regents of the university of michigan
3  * all rights reserved
4  * 
5  * permission is granted to use, copy, create derivative works and
6  * redistribute this software and such derivative works for any purpose,
7  * so long as the name of the university of michigan is not used in
8  * any advertising or publicity pertaining to the use or distribution
9  * of this software without specific, written prior authorization.  if
10  * the above copyright notice or any other identification of the
11  * university of michigan is included in any copy of any portion of
12  * this software, then the disclaimer below must also be included.
13  * 
14  * this software is provided as is, without representation from the
15  * university of michigan as to its fitness for any purpose, and without
16  * warranty by the university of michigan of any kind, either express 
17  * or implied, including without limitation the implied warranties of
18  * merchantability and fitness for a particular purpose.  the regents
19  * of the university of michigan shall not be liable for any damages,   
20  * including special, indirect, incidental, or consequential damages, 
21  * with respect to any claim arising out or in connection with the use
22  * of the software, even if it has been or is hereafter advised of the
23  * possibility of such damages.
24  */
25
26 /* versioning history
27  * 
28  * 03-jun 2005 (eric williams) entered into versioning
29  */
30
31 #ifdef RPC_KERN
32 #include <ntifs.h>
33 #include <stdlib.h>
34 #else
35 #include <osi.h>
36 #include <windows.h>
37 #include <winioctl.h>
38 #endif
39
40
41 /* maximum number of users, based on SID, that can access AFS at one time */
42 #define MAX_AFS_USERS                   256
43
44 /* maximum number of threads that can make simultaneous calls into afsrdr,
45    because we maintain a credential set for each thread in a single table. */
46 #define MAX_CRED_MAPS                   64
47
48 /* size if outgoing/incoming RPC buffer (for parameters only, not bulk data) */
49 #define RPC_BUF_SIZE                    2048
50
51 /* max. chunk size for RPC transfers */
52 #define TRANSFER_CHUNK_SIZE     (1024*1024)
53
54
55 /* upcalls */
56 #define RPC_NAMEI               0x10
57 #define RPC_CHECK_ACCESS        0x11
58 #define RPC_CREATE              0x12
59 #define RPC_STAT                0x13
60 #define RPC_READ                0x14
61 #define RPC_WRITE               0x15
62 #define RPC_TRUNC               0x16
63 #define RPC_SETINFO             0x17
64 #define RPC_READDIR             0x18
65 #define RPC_CLOSE               0x19
66 #define RPC_UNLINK              0x1A
67 #define RPC_IOCTL_WRITE         0x1B
68 #define RPC_IOCTL_READ          0x1C
69 #define RPC_RENAME              0x1D
70 #define RPC_FLUSH               0x1E
71
72
73 /* downcalls */
74 #define RPC_BREAK_CALLBACK      0x80
75 #define RPC_RELEASE_HOOKS       0x81
76
77
78 /* internal module flags */
79 #define RPC_TIMEOUT_SHORT       0
80 #define RPC_TIMEOUT_LONG        1
81
82
83 /* internal data struct for both client and server */
84 struct rpc
85         {
86 #ifdef RPC_KERN
87         struct rpc *next;
88         int size;
89         KEVENT ev;
90         MDL *bulk_mdl;
91 #endif
92         char *bulk_out;
93         ULONG *bulk_out_len;
94         char *bulk_in;
95         ULONG bulk_in_len, bulk_in_max;
96         ULONG key;
97         char *out_buf, *out_pos;
98         char *in_buf, *in_pos;
99         int status;
100         };
101 typedef struct rpc rpc_t;
102
103
104 /* application interface into rpc library */
105 #ifdef RPC_KERN
106 rpc_call(ULONG in_len, char *in_buf, ULONG out_max, char *out_buf, ULONG *out_len);
107 rpc_set_context(void *context);
108 rpc_remove_context();
109 rpc_get_len(rpc_t *rpc);
110 rpc_send(char *out_buf, int out_len, int *out_written);
111 rpc_recv(char *in_buf, ULONG len);
112 rpc_shutdown();
113
114 #else
115
116 rpc_parse(rpc_t *rpc);
117 #endif
118
119