rpc_server.h 2.99 KB
Newer Older
1 2 3
/*
 * RPC server API
 *
4
 * Copyright 2001 Ove Kåven, TransGaming Technologies
5 6 7 8 9 10 11 12 13 14 15 16 17
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * 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 22 23 24
 */

#ifndef __WINE_RPC_SERVER_H
#define __WINE_RPC_SERVER_H

#include "rpc_binding.h"
25
#include "wine/list.h"
26

27 28
struct protseq_ops;

29 30
typedef struct _RpcServerProtseq
{
31 32 33
  const struct protseq_ops *ops; /* RO */
  struct list entry; /* CS ::server_cs */
  LPSTR Protseq; /* RO */
34
  UINT MaxCalls; /* RO */
35 36 37
  /* list of listening connections */
  RpcConnection* conn; /* CS cs */
  CRITICAL_SECTION cs;
38 39

  /* is the server currently listening? */
40
  BOOL is_listening; /* CS ::listen_cs */
41 42 43 44
  /* mutex for ensuring only one thread can change state at a time */
  HANDLE mgr_mutex;
  /* set when server thread has finished opening connections */
  HANDLE server_ready_event;
45 46
} RpcServerProtseq;

47 48 49 50 51 52 53 54 55 56 57
struct protseq_ops
{
    const char *name;
    RpcServerProtseq *(*alloc)(void);
    void (*signal_state_changed)(RpcServerProtseq *protseq);
    /* previous array is passed in to allow reuse of memory */
    void *(*get_wait_array)(RpcServerProtseq *protseq, void *prev_array, unsigned int *count);
    void (*free_wait_array)(RpcServerProtseq *protseq, void *array);
    /* returns -1 for failure, 0 for server state changed and 1 to indicate a
     * new connection was established */
    int (*wait_for_new_connection)(RpcServerProtseq *protseq, unsigned int count, void *wait_array);
58
    /* opens the endpoint and optionally begins listening */
59
    RPC_STATUS (*open_endpoint)(RpcServerProtseq *protseq, const char *endpoint);
60 61
};

62 63
typedef struct _RpcServerInterface
{
64
  struct list entry;
65 66 67 68 69 70 71
  RPC_SERVER_INTERFACE* If;
  UUID MgrTypeUuid;
  RPC_MGR_EPV* MgrEpv;
  UINT Flags;
  UINT MaxCalls;
  UINT MaxRpcSize;
  RPC_IF_CALLBACK_FN* IfCallbackFn;
72 73 74 75
  LONG CurrentCalls; /* number of calls currently executing */
  /* set when unregistering interface to let the caller of
   * RpcServerUnregisterIf* know that all calls have finished */
  HANDLE CallsCompletedEvent;
76
  BOOL Delete; /* delete when the last call finishes */
77 78
} RpcServerInterface;

79 80
void RPCRT4_new_client(RpcConnection* conn) DECLSPEC_HIDDEN;
const struct protseq_ops *rpcrt4_get_protseq_ops(const char *protseq) DECLSPEC_HIDDEN;
81

82 83
void RPCRT4_destroy_all_protseqs(void) DECLSPEC_HIDDEN;
void RPCRT4_ServerFreeAllRegisteredAuthInfo(void) DECLSPEC_HIDDEN;
84

85
#endif  /* __WINE_RPC_SERVER_H */