Added abs_time_t structure to the server protocol, and added a dump
[wine] / 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 "basetsd.h"
25 #include "windef.h"
26
27 #include "rpcdcep.h"
28
29 #define RPCSS_NP_PROTOCOL_VERSION 0x0000
30
31 #define RPCSS_STRINGIFY_MACRO(x) RPCSS_STRINGIFY_MACRO2(x)
32 #define RPCSS_STRINGIFY_MACRO2(x) #x
33
34 #define STRINGIFIED_RPCSS_NP_PROTOCOL_VERSION \
35   RPCSS_STRINGIFY_MACRO(RPCSS_NP_PROTOCOL_VERSION)
36
37 /* only local communications are supported so far on this pipe.
38    until this changes, we can just use a constant pipe-name */
39 #define NAME_RPCSS_NAMED_PIPE \
40   ("\\\\.\\pipe\\RpcssNP" STRINGIFIED_RPCSS_NP_PROTOCOL_VERSION)
41
42 /* mutex is local only... perhaps this ought to be part of the pipe
43    protocol for remote wine<->wine connections? */
44 #define RPCSS_MASTER_MUTEX_NAME \
45   ("RPCSSMasterMutex" STRINGIFIED_RPCSS_NP_PROTOCOL_VERSION)
46
47 /* payloads above 1K are fragmented into multiple messages */
48 #define VARDATA_PAYLOAD_BYTES 1024 
49
50 /* ick -- maybe we should pass a handle to a mailslot or something? */
51 #define MAX_RPCSS_NP_REPLY_STRING_LEN 512
52
53 /* number of microseconds/10 to wait for master mutex before giving up */
54 #define MASTER_MUTEX_TIMEOUT 6000000
55
56 /* number of miliseconds to wait on the master mutex after it returns BUSY */
57 #define MASTER_MUTEX_WAITNAMEDPIPE_TIMEOUT 5000
58
59 /* a data payload; not a normal message */
60 #define RPCSS_NP_MESSAGE_TYPEID_VARDATAPAYLOADMSG 1
61 typedef struct _RPCSS_NP_MESSAGE_UNION_VARDATAPAYLOADMSG {
62   char payload[VARDATA_PAYLOAD_BYTES];
63 } RPCSS_NP_MESSAGE_UNION_VARDATAPAYLOADMSG;
64
65 /* RANMSG: 
66  *   Simply tells the server that another rpcss instance ran.
67  *   The server should respond by resetting its timeout to the
68  *   full lazy timeout.
69  */
70 #define RPCSS_NP_MESSAGE_TYPEID_RANMSG 2
71 typedef struct _RPCSS_NP_MESSAGE_UNION_RANMSG {
72   long timeout;
73 } RPCSS_NP_MESSAGE_UNION_RANMSG;
74
75 /* REGISTEREPMSG:
76  *   Registers endpoints with the endpoint server.
77  *   object_count and binding_count contain the number
78  *   of object uuids and endpoints in the vardata payload,
79  *   respectively.
80  */
81 #define RPCSS_NP_MESSAGE_TYPEID_REGISTEREPMSG 3
82 typedef struct _RPCSS_NP_MESSAGE_UNION_REGISTEREPMSG {
83   RPC_SYNTAX_IDENTIFIER iface;
84   int object_count;
85   int binding_count;
86   int no_replace;
87 } RPCSS_NP_MESSAGE_UNION_REGISTEREPMSG;
88
89 /* UNREGISTEREPMSG:
90  *   Unregisters endpoints with the endpoint server.
91  *   object_count and binding_count contain the number
92  *   of object uuids and endpoints in the vardata payload,
93  *   respectively.
94  */
95 #define RPCSS_NP_MESSAGE_TYPEID_UNREGISTEREPMSG 4
96 typedef struct _RPCSS_NP_MESSAGE_UNION_UNREGISTEREPMSG {
97   RPC_SYNTAX_IDENTIFIER iface;
98   int object_count;
99   int binding_count;
100 } RPCSS_NP_MESSAGE_UNION_UNREGISTEREPMSG;
101
102 /* RESOLVEEPMSG:
103  *   Locates an endpoint registered with the endpoint server.
104  *   Vardata contains a single protseq string.  This is a bit
105  *   silly: the protseq string is probably shorter than the
106  *   reply (an endpoint string), which is truncated at
107  *   MAX_RPCSS_NP_REPLY_STRING_LEN, at least for the moment.
108  *   returns the empty string if the requested endpoint isn't
109  *   registered.
110  */
111 #define RPCSS_NP_MESSAGE_TYPEID_RESOLVEEPMSG 5
112 typedef struct _RPCSS_NP_MESSAGE_UNION_RESOLVEEPMSG {
113   RPC_SYNTAX_IDENTIFIER iface;
114   UUID object;
115 } RPCSS_NP_MESSAGE_UNION_RESOLVEEPMSG;
116
117 typedef union {
118   RPCSS_NP_MESSAGE_UNION_RANMSG ranmsg;
119   RPCSS_NP_MESSAGE_UNION_VARDATAPAYLOADMSG vardatapayloadmsg;
120   RPCSS_NP_MESSAGE_UNION_REGISTEREPMSG registerepmsg;
121   RPCSS_NP_MESSAGE_UNION_UNREGISTEREPMSG unregisterepmsg;
122   RPCSS_NP_MESSAGE_UNION_RESOLVEEPMSG resolveepmsg;
123 } RPCSS_NP_MESSAGE_UNION;
124
125 /* vardata_payload_size specifies the number of bytes
126  * to be transferred over the pipe in VARDATAPAYLOAD
127  * messages (divide by VARDATA_PAYLOAD_BYTES to 
128  * get the # of payloads) 
129  */
130 typedef struct _RPCSS_NP_MESSAGE {
131   UINT32 message_type;
132   RPCSS_NP_MESSAGE_UNION message;
133   UINT32 vardata_payload_size;
134 } RPCSS_NP_MESSAGE, *PRPCSS_NP_MESSAGE;
135
136 typedef union {
137   /* some of these aren't used, but I guess we don't care */
138   UINT as_uint;
139   INT  as_int;
140   void   *as_pvoid;
141   HANDLE as_handle;
142   char as_string[MAX_RPCSS_NP_REPLY_STRING_LEN]; /* FIXME: yucky */
143 } RPCSS_NP_REPLY, *PRPCSS_NP_REPLY;
144
145 #endif /* __WINE_RPCSS_SHARED_H */