afsifs-20050615
[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 /* upcalls */
41 #define RPC_NAMEI                       0x10
42 #define RPC_CHECK_ACCESS        0x11
43 #define RPC_CREATE                      0x12
44 #define RPC_STAT                        0x13
45 #define RPC_READ                        0x14
46 #define RPC_WRITE                       0x15
47 #define RPC_TRUNC                       0x16
48 #define RPC_SETINFO                     0x17
49 #define RPC_READDIR                     0x18
50 #define RPC_CLOSE                       0x19
51 #define RPC_UNLINK                      0x1A
52 #define RPC_IOCTL_WRITE         0x1B
53 #define RPC_IOCTL_READ          0x1C
54 #define RPC_RENAME                      0x1D
55 #define RPC_READ_BULK           0x1E
56 #define RPC_WRITE_BULK          0x1F
57
58 /* downcalls */
59 #define RPC_BREAK_CALLBACK      0x80
60
61 #define TRANSFER_CHUNK_SIZE             (1024*1024)
62 #define RPC_TIMEOUT_SHORT               0
63 #define RPC_TIMEOUT_LONG                1
64
65 /* internal data struct for both client and server */
66 struct rpc
67         {
68 #ifdef RPC_KERN
69         struct rpc *next;
70         int size;
71         KEVENT ev;
72         MDL *bulk_mdl;
73 #endif
74         char *bulk_out;
75         ULONG *bulk_out_len;
76         char *bulk_in;
77         ULONG bulk_in_len, bulk_in_max;
78         ULONG key;
79         char *out_buf, *out_pos;
80         char *in_buf, *in_pos;
81         int status;
82         };
83 typedef struct rpc rpc_t;
84
85
86 /* application interface into rpc library */
87 #ifdef RPC_KERN
88 rpc_call(ULONG in_len, char *in_buf, ULONG out_max, char *out_buf, ULONG *out_len);
89 rpc_set_context(void *context);
90 rpc_remove_context();
91 rpc_get_len(rpc_t *rpc);
92 rpc_send(char *out_buf, int out_len, int *out_written);
93 rpc_recv(char *in_buf, ULONG len);
94 rpc_shutdown();
95
96 #else
97
98 rpc_parse(rpc_t *rpc);
99 #endif
100
101
102 /* extended information */
103 struct readdir_data
104         {
105         LARGE_INTEGER cookie;
106         long offset;
107         LARGE_INTEGER creation, access, write, change, size;
108         ULONG attribs, name_length;                     /* chars */
109         CCHAR short_name_length;                        /* chars */
110         WCHAR short_name[14];
111         WCHAR name[];
112         };
113 typedef struct readdir_data readdir_data_t;