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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #ifndef __WINE_RPC_BINDING_H
22 #define __WINE_RPC_BINDING_H
24 #include "wine/rpcss_shared.h"
28 typedef struct _RpcAuthInfo
32 unsigned long AuthnLevel
;
33 unsigned long AuthnSvc
;
40 typedef struct _RpcConnection
42 struct _RpcConnection
* Next
;
43 struct _RpcBinding
* Used
;
47 struct protseq_ops
*ops
;
48 USHORT MaxTransmissionSize
;
49 /* The active interface bound to server. */
50 RPC_SYNTAX_IDENTIFIER ActiveInterface
;
57 RpcAuthInfo
*AuthInfo
;
62 RpcConnection
*(*alloc
)(void);
63 RPC_STATUS (*open_connection
)(RpcConnection
*conn
);
64 HANDLE (*get_connect_wait_handle
)(RpcConnection
*conn
);
65 RPC_STATUS (*handoff
)(RpcConnection
*old_conn
, RpcConnection
*new_conn
);
66 int (*read
)(RpcConnection
*conn
, void *buffer
, unsigned int len
);
67 int (*write
)(RpcConnection
*conn
, const void *buffer
, unsigned int len
);
68 int (*close
)(RpcConnection
*conn
);
71 /* don't know what MS's structure looks like */
72 typedef struct _RpcBinding
75 struct _RpcBinding
* Next
;
81 RPC_BLOCKING_FN BlockingFn
;
83 RpcConnection
* FromConn
;
86 RpcAuthInfo
*AuthInfo
;
89 LPSTR
RPCRT4_strndupA(LPCSTR src
, INT len
);
90 LPWSTR
RPCRT4_strndupW(LPWSTR src
, INT len
);
91 LPSTR
RPCRT4_strdupWtoA(LPWSTR src
);
92 LPWSTR
RPCRT4_strdupAtoW(LPSTR src
);
93 void RPCRT4_strfree(LPSTR src
);
95 #define RPCRT4_strdupA(x) RPCRT4_strndupA((x),-1)
96 #define RPCRT4_strdupW(x) RPCRT4_strndupW((x),-1)
98 ULONG
RpcAuthInfo_AddRef(RpcAuthInfo
*AuthInfo
);
99 ULONG
RpcAuthInfo_Release(RpcAuthInfo
*AuthInfo
);
101 RPC_STATUS
RPCRT4_CreateConnection(RpcConnection
** Connection
, BOOL server
, LPCSTR Protseq
, LPCSTR NetworkAddr
, LPCSTR Endpoint
, LPCSTR NetworkOptions
, RpcAuthInfo
* AuthInfo
, RpcBinding
* Binding
);
102 RPC_STATUS
RPCRT4_DestroyConnection(RpcConnection
* Connection
);
103 RPC_STATUS
RPCRT4_OpenConnection(RpcConnection
* Connection
);
104 RPC_STATUS
RPCRT4_CloseConnection(RpcConnection
* Connection
);
105 RPC_STATUS
RPCRT4_SpawnConnection(RpcConnection
** Connection
, RpcConnection
* OldConnection
);
107 RPC_STATUS
RPCRT4_CreateBindingA(RpcBinding
** Binding
, BOOL server
, LPSTR Protseq
);
108 RPC_STATUS
RPCRT4_CreateBindingW(RpcBinding
** Binding
, BOOL server
, LPWSTR Protseq
);
109 RPC_STATUS
RPCRT4_CompleteBindingA(RpcBinding
* Binding
, LPSTR NetworkAddr
, LPSTR Endpoint
, LPSTR NetworkOptions
);
110 RPC_STATUS
RPCRT4_CompleteBindingW(RpcBinding
* Binding
, LPWSTR NetworkAddr
, LPWSTR Endpoint
, LPWSTR NetworkOptions
);
111 RPC_STATUS
RPCRT4_ResolveBinding(RpcBinding
* Binding
, LPSTR Endpoint
);
112 RPC_STATUS
RPCRT4_SetBindingObject(RpcBinding
* Binding
, UUID
* ObjectUuid
);
113 RPC_STATUS
RPCRT4_MakeBinding(RpcBinding
** Binding
, RpcConnection
* Connection
);
114 RPC_STATUS
RPCRT4_ExportBinding(RpcBinding
** Binding
, RpcBinding
* OldBinding
);
115 RPC_STATUS
RPCRT4_DestroyBinding(RpcBinding
* Binding
);
116 RPC_STATUS
RPCRT4_OpenBinding(RpcBinding
* Binding
, RpcConnection
** Connection
, PRPC_SYNTAX_IDENTIFIER TransferSyntax
, PRPC_SYNTAX_IDENTIFIER InterfaceId
);
117 RPC_STATUS
RPCRT4_CloseBinding(RpcBinding
* Binding
, RpcConnection
* Connection
);
118 BOOL
RPCRT4_RPCSSOnDemandCall(PRPCSS_NP_MESSAGE msg
, char *vardata_payload
, PRPCSS_NP_REPLY reply
);
119 HANDLE
RPCRT4_GetMasterMutex(void);
120 HANDLE
RPCRT4_RpcssNPConnect(void);
122 static inline const char *rpcrt4_conn_get_name(RpcConnection
*Connection
)
124 return Connection
->ops
->name
;
127 static inline int rpcrt4_conn_read(RpcConnection
*Connection
,
128 void *buffer
, unsigned int len
)
130 return Connection
->ops
->read(Connection
, buffer
, len
);
133 static inline int rpcrt4_conn_write(RpcConnection
*Connection
,
134 const void *buffer
, unsigned int len
)
136 return Connection
->ops
->write(Connection
, buffer
, len
);
139 static inline int rpcrt4_conn_close(RpcConnection
*Connection
)
141 return Connection
->ops
->close(Connection
);
144 static inline HANDLE
rpcrt4_conn_get_wait_object(RpcConnection
*Connection
)
146 return Connection
->ops
->get_connect_wait_handle(Connection
);
149 static inline RPC_STATUS
rpcrt4_conn_handoff(RpcConnection
*old_conn
, RpcConnection
*new_conn
)
151 return old_conn
->ops
->handoff(old_conn
, new_conn
);