eliminate GCC warning about initialization order
[reactos.git] / reactos / include / wine / rpcss_shared.h
1 /*
2 * RPCSS shared definitions
3 *
4 * Copyright (C) 2002 Greg Turner
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21 #ifndef __WINE_RPCSS_SHARED_H
22 #define __WINE_RPCSS_SHARED_H
23
24 #include <stdarg.h>
25 #include <windef.h>
26 #include <winbase.h>
27 #include <rpc.h>
28 #include <rpcdcep.h>
29
30 #define RPCSS_NP_PROTOCOL_VERSION 0x0000
31
32 #define RPCSS_STRINGIFY_MACRO(x) RPCSS_STRINGIFY_MACRO2(x)
33 #define RPCSS_STRINGIFY_MACRO2(x) #x
34
35 #define STRINGIFIED_RPCSS_NP_PROTOCOL_VERSION \
36 RPCSS_STRINGIFY_MACRO(RPCSS_NP_PROTOCOL_VERSION)
37
38 /* only local communications are supported so far on this pipe.
39 until this changes, we can just use a constant pipe-name */
40 #define NAME_RPCSS_NAMED_PIPE \
41 ("\\\\.\\pipe\\RpcssNP" STRINGIFIED_RPCSS_NP_PROTOCOL_VERSION)
42
43 /* mutex is local only... perhaps this ought to be part of the pipe
44 protocol for remote wine<->wine connections? */
45 #define RPCSS_MASTER_MUTEX_NAME \
46 ("RPCSSMasterMutex" STRINGIFIED_RPCSS_NP_PROTOCOL_VERSION)
47
48 /* payloads above 1K are fragmented into multiple messages */
49 #define VARDATA_PAYLOAD_BYTES 1024
50
51 /* ick -- maybe we should pass a handle to a mailslot or something? */
52 #define MAX_RPCSS_NP_REPLY_STRING_LEN 512
53
54 /* number of microseconds/10 to wait for master mutex before giving up */
55 #define MASTER_MUTEX_TIMEOUT 6000000
56
57 /* number of miliseconds to wait on the master mutex after it returns BUSY */
58 #define MASTER_MUTEX_WAITNAMEDPIPE_TIMEOUT 5000
59
60 /* a data payload; not a normal message */
61 #define RPCSS_NP_MESSAGE_TYPEID_VARDATAPAYLOADMSG 1
62 typedef struct _RPCSS_NP_MESSAGE_UNION_VARDATAPAYLOADMSG {
63 char payload[VARDATA_PAYLOAD_BYTES];
64 } RPCSS_NP_MESSAGE_UNION_VARDATAPAYLOADMSG;
65
66 /* RANMSG:
67 * Simply tells the server that another rpcss instance ran.
68 * The server should respond by resetting its timeout to the
69 * full lazy timeout.
70 */
71 #define RPCSS_NP_MESSAGE_TYPEID_RANMSG 2
72 typedef struct _RPCSS_NP_MESSAGE_UNION_RANMSG {
73 long timeout;
74 } RPCSS_NP_MESSAGE_UNION_RANMSG;
75
76 /* REGISTEREPMSG:
77 * Registers endpoints with the endpoint server.
78 * object_count and binding_count contain the number
79 * of object uuids and endpoints in the vardata payload,
80 * respectively.
81 */
82 #define RPCSS_NP_MESSAGE_TYPEID_REGISTEREPMSG 3
83 typedef struct _RPCSS_NP_MESSAGE_UNION_REGISTEREPMSG {
84 RPC_SYNTAX_IDENTIFIER iface;
85 int object_count;
86 int binding_count;
87 int no_replace;
88 } RPCSS_NP_MESSAGE_UNION_REGISTEREPMSG;
89
90 /* UNREGISTEREPMSG:
91 * Unregisters endpoints with the endpoint server.
92 * object_count and binding_count contain the number
93 * of object uuids and endpoints in the vardata payload,
94 * respectively.
95 */
96 #define RPCSS_NP_MESSAGE_TYPEID_UNREGISTEREPMSG 4
97 typedef struct _RPCSS_NP_MESSAGE_UNION_UNREGISTEREPMSG {
98 RPC_SYNTAX_IDENTIFIER iface;
99 int object_count;
100 int binding_count;
101 } RPCSS_NP_MESSAGE_UNION_UNREGISTEREPMSG;
102
103 /* RESOLVEEPMSG:
104 * Locates an endpoint registered with the endpoint server.
105 * Vardata contains a single protseq string. This is a bit
106 * silly: the protseq string is probably shorter than the
107 * reply (an endpoint string), which is truncated at
108 * MAX_RPCSS_NP_REPLY_STRING_LEN, at least for the moment.
109 * returns the empty string if the requested endpoint isn't
110 * registered.
111 */
112 #define RPCSS_NP_MESSAGE_TYPEID_RESOLVEEPMSG 5
113 typedef struct _RPCSS_NP_MESSAGE_UNION_RESOLVEEPMSG {
114 RPC_SYNTAX_IDENTIFIER iface;
115 UUID object;
116 } RPCSS_NP_MESSAGE_UNION_RESOLVEEPMSG;
117
118 typedef union {
119 RPCSS_NP_MESSAGE_UNION_RANMSG ranmsg;
120 RPCSS_NP_MESSAGE_UNION_VARDATAPAYLOADMSG vardatapayloadmsg;
121 RPCSS_NP_MESSAGE_UNION_REGISTEREPMSG registerepmsg;
122 RPCSS_NP_MESSAGE_UNION_UNREGISTEREPMSG unregisterepmsg;
123 RPCSS_NP_MESSAGE_UNION_RESOLVEEPMSG resolveepmsg;
124 } RPCSS_NP_MESSAGE_UNION;
125
126 /* vardata_payload_size specifies the number of bytes
127 * to be transferred over the pipe in VARDATAPAYLOAD
128 * messages (divide by VARDATA_PAYLOAD_BYTES to
129 * get the # of payloads)
130 */
131 typedef struct _RPCSS_NP_MESSAGE {
132 UINT32 message_type;
133 RPCSS_NP_MESSAGE_UNION message;
134 UINT32 vardata_payload_size;
135 } RPCSS_NP_MESSAGE, *PRPCSS_NP_MESSAGE;
136
137 typedef union {
138 /* some of these aren't used, but I guess we don't care */
139 UINT as_uint;
140 INT as_int;
141 void *as_pvoid;
142 HANDLE as_handle;
143 char as_string[MAX_RPCSS_NP_REPLY_STRING_LEN]; /* FIXME: yucky */
144 } RPCSS_NP_REPLY, *PRPCSS_NP_REPLY;
145
146 #endif /* __WINE_RPCSS_SHARED_H */