4 * Copyright 2001 Ove Kåven, TransGaming Technologies
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.
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.
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
21 #ifndef __WINE_RPC_BINDING_H
22 #define __WINE_RPC_BINDING_H
24 #include "wine/rpcss_shared.h"
28 typedef struct _RpcConnection
30 struct _RpcConnection* Next;
31 struct _RpcBinding* Used;
35 struct protseq_ops *ops;
38 USHORT MaxTransmissionSize;
39 /* The active interface bound to server. */
40 RPC_SYNTAX_IDENTIFIER ActiveInterface;
45 RPC_STATUS (*open_connection)(RpcConnection *conn);
46 HANDLE (*get_connect_wait_handle)(RpcConnection *conn);
47 int (*read)(RpcConnection *conn, void *buffer, unsigned int len);
48 int (*write)(RpcConnection *conn, const void *buffer, unsigned int len);
49 int (*close)(RpcConnection *conn);
52 /* don't know what MS's structure looks like */
53 typedef struct _RpcBinding
56 struct _RpcBinding* Next;
62 RPC_BLOCKING_FN BlockingFn;
64 RpcConnection* FromConn;
67 LPSTR RPCRT4_strndupA(LPCSTR src, INT len);
68 LPWSTR RPCRT4_strndupW(LPWSTR src, INT len);
69 LPSTR RPCRT4_strdupWtoA(LPWSTR src);
70 LPWSTR RPCRT4_strdupAtoW(LPSTR src);
71 void RPCRT4_strfree(LPSTR src);
73 #define RPCRT4_strdupA(x) RPCRT4_strndupA((x),-1)
74 #define RPCRT4_strdupW(x) RPCRT4_strndupW((x),-1)
76 RPC_STATUS RPCRT4_CreateConnection(RpcConnection** Connection, BOOL server, LPCSTR Protseq, LPCSTR NetworkAddr, LPCSTR Endpoint, LPCSTR NetworkOptions, RpcBinding* Binding);
77 RPC_STATUS RPCRT4_DestroyConnection(RpcConnection* Connection);
78 RPC_STATUS RPCRT4_OpenConnection(RpcConnection* Connection);
79 RPC_STATUS RPCRT4_CloseConnection(RpcConnection* Connection);
80 RPC_STATUS RPCRT4_SpawnConnection(RpcConnection** Connection, RpcConnection* OldConnection);
82 RPC_STATUS RPCRT4_CreateBindingA(RpcBinding** Binding, BOOL server, LPSTR Protseq);
83 RPC_STATUS RPCRT4_CreateBindingW(RpcBinding** Binding, BOOL server, LPWSTR Protseq);
84 RPC_STATUS RPCRT4_CompleteBindingA(RpcBinding* Binding, LPSTR NetworkAddr, LPSTR Endpoint, LPSTR NetworkOptions);
85 RPC_STATUS RPCRT4_CompleteBindingW(RpcBinding* Binding, LPWSTR NetworkAddr, LPWSTR Endpoint, LPWSTR NetworkOptions);
86 RPC_STATUS RPCRT4_ResolveBinding(RpcBinding* Binding, LPSTR Endpoint);
87 RPC_STATUS RPCRT4_SetBindingObject(RpcBinding* Binding, UUID* ObjectUuid);
88 RPC_STATUS RPCRT4_MakeBinding(RpcBinding** Binding, RpcConnection* Connection);
89 RPC_STATUS RPCRT4_ExportBinding(RpcBinding** Binding, RpcBinding* OldBinding);
90 RPC_STATUS RPCRT4_DestroyBinding(RpcBinding* Binding);
91 RPC_STATUS RPCRT4_OpenBinding(RpcBinding* Binding, RpcConnection** Connection, PRPC_SYNTAX_IDENTIFIER TransferSyntax, PRPC_SYNTAX_IDENTIFIER InterfaceId);
92 RPC_STATUS RPCRT4_CloseBinding(RpcBinding* Binding, RpcConnection* Connection);
93 BOOL RPCRT4_RPCSSOnDemandCall(PRPCSS_NP_MESSAGE msg, char *vardata_payload, PRPCSS_NP_REPLY reply);
94 HANDLE RPCRT4_GetMasterMutex(void);
95 HANDLE RPCRT4_RpcssNPConnect(void);
97 static inline const char *rpcrt4_conn_get_name(RpcConnection *Connection)
99 return Connection->ops->name;
102 static inline int rpcrt4_conn_read(RpcConnection *Connection,
103 void *buffer, unsigned int len)
105 return Connection->ops->read(Connection, buffer, len);
108 static inline int rpcrt4_conn_write(RpcConnection *Connection,
109 const void *buffer, unsigned int len)
111 return Connection->ops->write(Connection, buffer, len);
114 static inline int rpcrt4_conn_close(RpcConnection *Connection)
116 return Connection->ops->close(Connection);
119 static inline HANDLE rpcrt4_conn_get_wait_object(RpcConnection *Connection)
121 return Connection->ops->get_connect_wait_handle(Connection);