[rshell]
[reactos.git] / dll / win32 / rpcrt4 / rpc_server.h
1 /*
2 * RPC server API
3 *
4 * Copyright 2001 Ove Kåven, TransGaming Technologies
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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 */
20
21 #ifndef __WINE_RPC_SERVER_H
22 #define __WINE_RPC_SERVER_H
23
24 #include "rpc_binding.h"
25
26 struct protseq_ops;
27
28 typedef struct _RpcServerProtseq
29 {
30 const struct protseq_ops *ops; /* RO */
31 struct list entry; /* CS ::server_cs */
32 LPSTR Protseq; /* RO */
33 UINT MaxCalls; /* RO */
34 /* list of listening connections */
35 RpcConnection* conn; /* CS cs */
36 CRITICAL_SECTION cs;
37
38 /* is the server currently listening? */
39 BOOL is_listening; /* CS ::listen_cs */
40 /* mutex for ensuring only one thread can change state at a time */
41 HANDLE mgr_mutex;
42 /* set when server thread has finished opening connections */
43 HANDLE server_ready_event;
44 } RpcServerProtseq;
45
46 struct protseq_ops
47 {
48 const char *name;
49 RpcServerProtseq *(*alloc)(void);
50 void (*signal_state_changed)(RpcServerProtseq *protseq);
51 /* previous array is passed in to allow reuse of memory */
52 void *(*get_wait_array)(RpcServerProtseq *protseq, void *prev_array, unsigned int *count);
53 void (*free_wait_array)(RpcServerProtseq *protseq, void *array);
54 /* returns -1 for failure, 0 for server state changed and 1 to indicate a
55 * new connection was established */
56 int (*wait_for_new_connection)(RpcServerProtseq *protseq, unsigned int count, void *wait_array);
57 /* opens the endpoint and optionally begins listening */
58 RPC_STATUS (*open_endpoint)(RpcServerProtseq *protseq, const char *endpoint);
59 };
60
61 typedef struct _RpcServerInterface
62 {
63 struct list entry;
64 RPC_SERVER_INTERFACE* If;
65 UUID MgrTypeUuid;
66 RPC_MGR_EPV* MgrEpv;
67 UINT Flags;
68 UINT MaxCalls;
69 UINT MaxRpcSize;
70 RPC_IF_CALLBACK_FN* IfCallbackFn;
71 LONG CurrentCalls; /* number of calls currently executing */
72 /* set when unregistering interface to let the caller of
73 * RpcServerUnregisterIf* know that all calls have finished */
74 HANDLE CallsCompletedEvent;
75 BOOL Delete; /* delete when the last call finishes */
76 } RpcServerInterface;
77
78 void RPCRT4_new_client(RpcConnection* conn) DECLSPEC_HIDDEN;
79 const struct protseq_ops *rpcrt4_get_protseq_ops(const char *protseq) DECLSPEC_HIDDEN;
80
81 void RPCRT4_destroy_all_protseqs(void) DECLSPEC_HIDDEN;
82 void RPCRT4_ServerFreeAllRegisteredAuthInfo(void) DECLSPEC_HIDDEN;
83
84 #endif /* __WINE_RPC_SERVER_H */