ReactOS 0.4.16-dev-226-g79f2289
rpc_binding.h
Go to the documentation of this file.
1/*
2 * RPC binding 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_BINDING_H
22#define __WINE_RPC_BINDING_H
23
24#include "rpcndr.h"
25#include "security.h"
26#include "wine/list.h"
27#include "rpc_defs.h"
28
29
31{
34};
35
36typedef struct _RpcAuthInfo
37{
39
45 /* the auth identity pointer that the application passed us (freed by application) */
47 /* our copy of NT auth identity structure, if the authentication service
48 * takes an NT auth identity */
52
54{
56
59
60struct connection_ops;
61
62typedef struct _RpcConnection
63{
70 const struct connection_ops *ops;
72
73 /* authentication */
83
84 /* client-only */
86 ULONG assoc_group_id; /* association group returned during binding */
88 struct _RpcAssoc *assoc; /* association this connection is part of */
89
90 /* server-only */
91 /* The active interface bound to server. */
98
100 const char *name;
101 unsigned char epm_protocols[2]; /* only floors 3 and 4. see http://www.opengroup.org/onlinepubs/9629399/apdxl.htm */
102 RpcConnection *(*alloc)(void);
105 int (*read)(RpcConnection *conn, void *buffer, unsigned int len);
106 int (*write)(RpcConnection *conn, const void *buffer, unsigned int len);
112 size_t (*get_top_of_tower)(unsigned char *tower_data, const char *networkaddr, const char *endpoint);
113 RPC_STATUS (*parse_top_of_tower)(const unsigned char *tower_data, size_t tower_size, char **networkaddr, char **endpoint);
116 RPC_STATUS (*authorize)(RpcConnection *conn, BOOL first_time, unsigned char *in_buffer, unsigned int in_len, unsigned char *out_buffer, unsigned int *out_len);
117 RPC_STATUS (*secure_packet)(RpcConnection *Connection, enum secure_packet_direction dir, RpcPktHdr *hdr, unsigned int hdr_size, unsigned char *stub_data, unsigned int stub_data_size, RpcAuthVerifier *auth_hdr, unsigned char *auth_value, unsigned int auth_value_size);
121};
122
123/* don't know what MS's structure looks like */
124typedef struct _RpcBinding
125{
134 RPC_BLOCKING_FN BlockingFn;
138
139 /* authentication */
144
150
151#define RPCRT4_strdupA(x) RPCRT4_strndupA((x),-1)
152#define RPCRT4_strdupW(x) RPCRT4_strndupW((x),-1)
153
157BOOL RpcAuthInfo_IsEqual(const RpcAuthInfo *AuthInfo1, const RpcAuthInfo *AuthInfo2) DECLSPEC_HIDDEN;
161
169RPC_STATUS RPCRT4_IsServerListening(const char *protseq, const char *endpoint) DECLSPEC_HIDDEN;
170
177 const RPC_SYNTAX_IDENTIFIER *TransferSyntax, const RPC_SYNTAX_IDENTIFIER *InterfaceId,
178 BOOL *from_cache) DECLSPEC_HIDDEN;
180
182
183static inline const char *rpcrt4_conn_get_name(const RpcConnection *Connection)
184{
185 return Connection->ops->name;
186}
187
188static inline int rpcrt4_conn_read(RpcConnection *Connection,
189 void *buffer, unsigned int len)
190{
191 return Connection->ops->read(Connection, buffer, len);
192}
193
194static inline int rpcrt4_conn_write(RpcConnection *Connection,
195 const void *buffer, unsigned int len)
196{
197 return Connection->ops->write(Connection, buffer, len);
198}
199
200static inline int rpcrt4_conn_close(RpcConnection *Connection)
201{
202 return Connection->ops->close(Connection);
203}
204
205static inline void rpcrt4_conn_close_read(RpcConnection *connection)
206{
207 connection->ops->close_read(connection);
208}
209
210static inline void rpcrt4_conn_cancel_call(RpcConnection *Connection)
211{
212 Connection->ops->cancel_call(Connection);
213}
214
216{
217 return old_conn->ops->handoff(old_conn, new_conn);
218}
219
221{
222 return Connection->ops->is_authorized(Connection);
223}
224
226 RpcConnection *conn, BOOL first_time, unsigned char *in_buffer,
227 unsigned int in_len, unsigned char *out_buffer, unsigned int *out_len)
228{
229 return conn->ops->authorize(conn, first_time, in_buffer, in_len, out_buffer, out_len);
230}
231
234 RpcPktHdr *hdr, unsigned int hdr_size, unsigned char *stub_data,
235 unsigned int stub_data_size, RpcAuthVerifier *auth_hdr,
236 unsigned char *auth_value, unsigned int auth_value_size)
237{
238 return conn->ops->secure_packet(conn, dir, hdr, hdr_size, stub_data, stub_data_size, auth_hdr, auth_value, auth_value_size);
239}
240
242 RpcConnection *conn)
243{
244 return conn->ops->impersonate_client(conn);
245}
246
248 RpcConnection *conn)
249{
250 return conn->ops->revert_to_self(conn);
251}
252
254 RpcConnection *conn, RPC_AUTHZ_HANDLE *privs, RPC_WSTR *server_princ_name,
255 ULONG *authn_level, ULONG *authn_svc, ULONG *authz_svc, ULONG flags)
256{
257 return conn->ops->inquire_auth_client(conn, privs, server_princ_name, authn_level, authn_svc, authz_svc, flags);
258}
259
260/* floors 3 and up */
261RPC_STATUS RpcTransport_GetTopOfTower(unsigned char *tower_data, size_t *tower_size, const char *protseq, const char *networkaddr, const char *endpoint) DECLSPEC_HIDDEN;
262RPC_STATUS RpcTransport_ParseTopOfTower(const unsigned char *tower_data, size_t tower_size, char **protseq, char **networkaddr, char **endpoint) DECLSPEC_HIDDEN;
263
270
271#endif
unsigned int dir
Definition: maze.c:112
Definition: Header.h:9
Definition: list.h:37
#define DECLSPEC_HIDDEN
Definition: precomp.h:8
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31
__kernel_size_t size_t
Definition: linux.h:237
unsigned int BOOL
Definition: ntddk_ex.h:94
GLenum src
Definition: glext.h:6340
GLuint buffer
Definition: glext.h:5915
GLbitfield flags
Definition: glext.h:7161
GLenum GLsizei len
Definition: glext.h:6722
static unsigned char * in_buffer
Definition: iccvid.c:87
char hdr[14]
Definition: iptest.cpp:33
static HANDLE PIO_APC_ROUTINE PVOID PIO_STATUS_BLOCK ULONG PVOID ULONG PVOID out_buffer
Definition: file.c:100
DWORD exp
Definition: msg.c:16058
#define BOOL
Definition: nt_native.h:43
long LONG
Definition: pedump.c:60
unsigned short USHORT
Definition: pedump.c:61
RPC_STATUS RPCRT4_ResolveBinding(RpcBinding *Binding, LPCSTR Endpoint) DECLSPEC_HIDDEN
Definition: rpc_binding.c:204
static const char * rpcrt4_conn_get_name(const RpcConnection *Connection)
Definition: rpc_binding.h:183
static RPC_STATUS rpcrt4_conn_secure_packet(RpcConnection *conn, enum secure_packet_direction dir, RpcPktHdr *hdr, unsigned int hdr_size, unsigned char *stub_data, unsigned int stub_data_size, RpcAuthVerifier *auth_hdr, unsigned char *auth_value, unsigned int auth_value_size)
Definition: rpc_binding.h:232
LPSTR RPCRT4_strdupWtoA(LPCWSTR src) DECLSPEC_HIDDEN
Definition: rpc_binding.c:58
static RPC_STATUS rpcrt4_conn_handoff(RpcConnection *old_conn, RpcConnection *new_conn)
Definition: rpc_binding.h:215
RPC_STATUS RpcTransport_ParseTopOfTower(const unsigned char *tower_data, size_t tower_size, char **protseq, char **networkaddr, char **endpoint) DECLSPEC_HIDDEN
static void rpcrt4_conn_close_read(RpcConnection *connection)
Definition: rpc_binding.h:205
RPC_STATUS RPCRT4_IsServerListening(const char *protseq, const char *endpoint) DECLSPEC_HIDDEN
RpcConnection * RPCRT4_GrabConnection(RpcConnection *conn) DECLSPEC_HIDDEN
void RPCRT4_AddRefBinding(RpcBinding *Binding) DECLSPEC_HIDDEN
Definition: rpc_binding.c:249
void rpcrt4_conn_release_and_wait(RpcConnection *connection) DECLSPEC_HIDDEN
static int rpcrt4_conn_read(RpcConnection *Connection, void *buffer, unsigned int len)
Definition: rpc_binding.h:188
struct _RpcQualityOfService RpcQualityOfService
ULONG RpcQualityOfService_AddRef(RpcQualityOfService *qos) DECLSPEC_HIDDEN
Definition: rpc_binding.c:1360
static int rpcrt4_conn_write(RpcConnection *Connection, const void *buffer, unsigned int len)
Definition: rpc_binding.h:194
NDR_SCONTEXT RPCRT4_PopThreadContextHandle(void) DECLSPEC_HIDDEN
Definition: rpcrt4_main.c:1016
LPWSTR RPCRT4_strndupW(LPCWSTR src, INT len) DECLSPEC_HIDDEN
Definition: rpc_binding.c:91
RPC_STATUS RPCRT4_CloseBinding(RpcBinding *Binding, RpcConnection *Connection) DECLSPEC_HIDDEN
Definition: rpc_binding.c:293
RPC_STATUS RPCRT4_MakeBinding(RpcBinding **Binding, RpcConnection *Connection) DECLSPEC_HIDDEN
Definition: rpc_binding.c:232
RPC_STATUS RpcAuthInfo_Create(ULONG AuthnLevel, ULONG AuthnSvc, CredHandle cred, TimeStamp exp, ULONG cbMaxToken, RPC_AUTH_IDENTITY_HANDLE identity, RpcAuthInfo **ret) DECLSPEC_HIDDEN
Definition: rpc_binding.c:1117
struct _RpcBinding RpcBinding
ULONG RpcAuthInfo_Release(RpcAuthInfo *AuthInfo) DECLSPEC_HIDDEN
Definition: rpc_binding.c:1188
RpcBinding * RPCRT4_GetThreadCurrentCallHandle(void) DECLSPEC_HIDDEN
Definition: rpcrt4_main.c:972
LPSTR RPCRT4_strndupA(LPCSTR src, INT len) DECLSPEC_HIDDEN
Definition: rpc_binding.c:45
static RPC_STATUS rpcrt4_conn_impersonate_client(RpcConnection *conn)
Definition: rpc_binding.h:241
ULONG RpcAuthInfo_AddRef(RpcAuthInfo *AuthInfo) DECLSPEC_HIDDEN
Definition: rpc_binding.c:1183
struct _RpcAuthInfo RpcAuthInfo
BOOL RpcQualityOfService_IsEqual(const RpcQualityOfService *qos1, const RpcQualityOfService *qos2) DECLSPEC_HIDDEN
Definition: rpc_binding.c:1390
static RPC_STATUS rpcrt4_conn_revert_to_self(RpcConnection *conn)
Definition: rpc_binding.h:247
ULONG RpcQualityOfService_Release(RpcQualityOfService *qos) DECLSPEC_HIDDEN
Definition: rpc_binding.c:1365
RPC_STATUS RPCRT4_OpenBinding(RpcBinding *Binding, RpcConnection **Connection, const RPC_SYNTAX_IDENTIFIER *TransferSyntax, const RPC_SYNTAX_IDENTIFIER *InterfaceId, BOOL *from_cache) DECLSPEC_HIDDEN
Definition: rpc_binding.c:272
BOOL RpcAuthInfo_IsEqual(const RpcAuthInfo *AuthInfo1, const RpcAuthInfo *AuthInfo2) DECLSPEC_HIDDEN
Definition: rpc_binding.c:1209
static RPC_STATUS rpcrt4_conn_inquire_auth_client(RpcConnection *conn, RPC_AUTHZ_HANDLE *privs, RPC_WSTR *server_princ_name, ULONG *authn_level, ULONG *authn_svc, ULONG *authz_svc, ULONG flags)
Definition: rpc_binding.h:253
RPC_STATUS RPCRT4_OpenClientConnection(RpcConnection *Connection) DECLSPEC_HIDDEN
LPWSTR RPCRT4_strdupAtoW(LPCSTR src) DECLSPEC_HIDDEN
Definition: rpc_binding.c:69
secure_packet_direction
Definition: rpc_binding.h:31
@ SECURE_PACKET_SEND
Definition: rpc_binding.h:32
@ SECURE_PACKET_RECEIVE
Definition: rpc_binding.h:33
void RPCRT4_ReleaseConnection(RpcConnection *Connection) DECLSPEC_HIDDEN
struct _RpcConnection RpcConnection
static RPC_STATUS rpcrt4_conn_authorize(RpcConnection *conn, BOOL first_time, unsigned char *in_buffer, unsigned int in_len, unsigned char *out_buffer, unsigned int *out_len)
Definition: rpc_binding.h:225
void RPCRT4_SetThreadCurrentCallHandle(RpcBinding *Binding) DECLSPEC_HIDDEN
Definition: rpcrt4_main.c:964
RPC_STATUS RPCRT4_CloseConnection(RpcConnection *Connection) DECLSPEC_HIDDEN
void RPCRT4_strfree(LPSTR src) DECLSPEC_HIDDEN
Definition: rpc_binding.c:104
RPC_STATUS RPCRT4_ReleaseBinding(RpcBinding *Binding) DECLSPEC_HIDDEN
Definition: rpc_binding.c:254
static BOOL rpcrt4_conn_is_authorized(RpcConnection *Connection)
Definition: rpc_binding.h:220
void RPCRT4_RemoveThreadContextHandle(NDR_SCONTEXT SContext) DECLSPEC_HIDDEN
Definition: rpcrt4_main.c:995
static void rpcrt4_conn_cancel_call(RpcConnection *Connection)
Definition: rpc_binding.h:210
static int rpcrt4_conn_close(RpcConnection *Connection)
Definition: rpc_binding.h:200
RPC_STATUS RPCRT4_SetBindingObject(RpcBinding *Binding, const UUID *ObjectUuid) DECLSPEC_HIDDEN
Definition: rpc_binding.c:224
RPC_STATUS RpcTransport_GetTopOfTower(unsigned char *tower_data, size_t *tower_size, const char *protseq, const char *networkaddr, const char *endpoint) DECLSPEC_HIDDEN
RPC_STATUS RPCRT4_CreateConnection(RpcConnection **Connection, BOOL server, LPCSTR Protseq, LPCSTR NetworkAddr, LPCSTR Endpoint, LPCWSTR NetworkOptions, RpcAuthInfo *AuthInfo, RpcQualityOfService *QOS, LPCWSTR CookieAuth) DECLSPEC_HIDDEN
void RPCRT4_PushThreadContextHandle(NDR_SCONTEXT SContext) DECLSPEC_HIDDEN
Definition: rpcrt4_main.c:980
void RPCRT4_SetThreadCurrentConnection(RpcConnection *Connection) DECLSPEC_HIDDEN
Definition: rpcrt4_main.c:954
unsigned short * RPC_WSTR
Definition: rpcdce.h:46
long RPC_STATUS
Definition: rpc.h:52
LPSTR Protseq
Definition: rpc_assoc.h:32
LPWSTR NetworkOptions
Definition: rpc_assoc.h:35
LPSTR Endpoint
Definition: rpc_assoc.h:34
LPSTR NetworkAddr
Definition: rpc_assoc.h:33
RPC_AUTH_IDENTITY_HANDLE * identity
Definition: rpc_binding.h:46
ULONG AuthnLevel
Definition: rpc_binding.h:40
ULONG AuthnSvc
Definition: rpc_binding.h:41
TimeStamp exp
Definition: rpc_binding.h:43
CredHandle cred
Definition: rpc_binding.h:42
SEC_WINNT_AUTH_IDENTITY_W * nt_identity
Definition: rpc_binding.h:49
ULONG cbMaxToken
Definition: rpc_binding.h:44
LPWSTR server_principal_name
Definition: rpc_binding.h:50
RPC_BLOCKING_FN BlockingFn
Definition: rpc_binding.h:134
struct _RpcBinding * Next
Definition: rpc_binding.h:127
LPSTR NetworkAddr
Definition: rpc_binding.h:131
LPWSTR NetworkOptions
Definition: rpc_binding.h:133
LPWSTR CookieAuth
Definition: rpc_binding.h:142
RpcConnection * FromConn
Definition: rpc_binding.h:136
ULONG ServerTid
Definition: rpc_binding.h:135
RpcAuthInfo * AuthInfo
Definition: rpc_binding.h:140
LPSTR Endpoint
Definition: rpc_binding.h:132
LPSTR Protseq
Definition: rpc_binding.h:130
struct _RpcAssoc * Assoc
Definition: rpc_binding.h:137
UUID ObjectUuid
Definition: rpc_binding.h:129
RpcQualityOfService * QOS
Definition: rpc_binding.h:141
LPSTR NetworkAddr
Definition: rpc_binding.h:67
struct _RpcAssoc * assoc
Definition: rpc_binding.h:88
struct list conn_pool_entry
Definition: rpc_binding.h:85
TimeStamp exp
Definition: rpc_binding.h:75
RpcAuthInfo * AuthInfo
Definition: rpc_binding.h:77
USHORT NextCallId
Definition: rpc_binding.h:93
LPWSTR NetworkOptions
Definition: rpc_binding.h:69
RPC_SYNTAX_IDENTIFIER ActiveInterface
Definition: rpc_binding.h:92
struct _RpcBinding * server_binding
Definition: rpc_binding.h:96
USHORT MaxTransmissionSize
Definition: rpc_binding.h:71
ULONG assoc_group_id
Definition: rpc_binding.h:86
ULONG signature_auth_len
Definition: rpc_binding.h:80
HANDLE wait_release
Definition: rpc_binding.h:66
RPC_ASYNC_STATE * async_state
Definition: rpc_binding.h:87
const struct connection_ops * ops
Definition: rpc_binding.h:70
RpcQualityOfService * QOS
Definition: rpc_binding.h:81
struct list protseq_entry
Definition: rpc_binding.h:94
struct _RpcServerProtseq * protseq
Definition: rpc_binding.h:95
ULONG encryption_auth_len
Definition: rpc_binding.h:79
LPWSTR CookieAuth
Definition: rpc_binding.h:82
CtxtHandle ctx
Definition: rpc_binding.h:74
ULONG auth_context_id
Definition: rpc_binding.h:78
RPC_SECURITY_QOS_V2_W * qos
Definition: rpc_binding.h:57
size_t(* get_top_of_tower)(unsigned char *tower_data, const char *networkaddr, const char *endpoint)
Definition: rpc_binding.h:112
int(* read)(RpcConnection *conn, void *buffer, unsigned int len)
Definition: rpc_binding.h:105
unsigned char epm_protocols[2]
Definition: rpc_binding.h:101
RPC_STATUS(* secure_packet)(RpcConnection *Connection, enum secure_packet_direction dir, RpcPktHdr *hdr, unsigned int hdr_size, unsigned char *stub_data, unsigned int stub_data_size, RpcAuthVerifier *auth_hdr, unsigned char *auth_value, unsigned int auth_value_size)
Definition: rpc_binding.h:117
RPC_STATUS(* authorize)(RpcConnection *conn, BOOL first_time, unsigned char *in_buffer, unsigned int in_len, unsigned char *out_buffer, unsigned int *out_len)
Definition: rpc_binding.h:116
int(* write)(RpcConnection *conn, const void *buffer, unsigned int len)
Definition: rpc_binding.h:106
RPC_STATUS(* revert_to_self)(RpcConnection *conn)
Definition: rpc_binding.h:119
RPC_STATUS(* inquire_auth_client)(RpcConnection *, RPC_AUTHZ_HANDLE *, RPC_WSTR *, ULONG *, ULONG *, ULONG *, ULONG)
Definition: rpc_binding.h:120
RPC_STATUS(* parse_top_of_tower)(const unsigned char *tower_data, size_t tower_size, char **networkaddr, char **endpoint)
Definition: rpc_binding.h:113
RPC_STATUS(* open_connection_client)(RpcConnection *conn)
Definition: rpc_binding.h:103
RPC_STATUS(* receive_fragment)(RpcConnection *conn, RpcPktHdr **Header, void **Payload)
Definition: rpc_binding.h:114
int(* wait_for_incoming_data)(RpcConnection *conn)
Definition: rpc_binding.h:111
RPC_STATUS(* impersonate_client)(RpcConnection *conn)
Definition: rpc_binding.h:118
int(* close)(RpcConnection *conn)
Definition: rpc_binding.h:107
BOOL(* is_authorized)(RpcConnection *conn)
Definition: rpc_binding.h:115
RPC_STATUS(* handoff)(RpcConnection *old_conn, RpcConnection *new_conn)
Definition: rpc_binding.h:104
void(* close_read)(RpcConnection *conn)
Definition: rpc_binding.h:108
const char * name
Definition: rpc_binding.h:100
RPC_STATUS(* is_server_listening)(const char *endpoint)
Definition: rpc_binding.h:110
void(* cancel_call)(RpcConnection *conn)
Definition: rpc_binding.h:109
Definition: nis.h:10
int32_t INT
Definition: typedefs.h:58
uint32_t ULONG
Definition: typedefs.h:59
static rfbScreenInfoPtr server
Definition: vnc.c:74
int ret
const char * LPCSTR
Definition: xmlstorage.h:183
char * LPSTR
Definition: xmlstorage.h:182
WCHAR * LPWSTR
Definition: xmlstorage.h:184
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185