ReactOS  0.4.13-dev-92-gf251225
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 
36 typedef 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 */
51 } RpcAuthInfo;
52 
53 typedef struct _RpcQualityOfService
54 {
56 
59 
60 struct connection_ops;
61 
62 typedef 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);
104  RPC_STATUS (*handoff)(RpcConnection *old_conn, RpcConnection *new_conn);
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 */
124 typedef struct _RpcBinding
125 {
127  struct _RpcBinding* Next;
134  RPC_BLOCKING_FN BlockingFn;
137  struct _RpcAssoc *Assoc;
138 
139  /* authentication */
143 } RpcBinding;
144 
150 
151 #define RPCRT4_strdupA(x) RPCRT4_strndupA((x),-1)
152 #define RPCRT4_strdupW(x) RPCRT4_strndupW((x),-1)
153 
157 BOOL RpcAuthInfo_IsEqual(const RpcAuthInfo *AuthInfo1, const RpcAuthInfo *AuthInfo2) DECLSPEC_HIDDEN;
161 
169 RPC_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 
183 static inline const char *rpcrt4_conn_get_name(const RpcConnection *Connection)
184 {
185  return Connection->ops->name;
186 }
187 
188 static inline int rpcrt4_conn_read(RpcConnection *Connection,
189  void *buffer, unsigned int len)
190 {
191  return Connection->ops->read(Connection, buffer, len);
192 }
193 
194 static 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 
200 static inline int rpcrt4_conn_close(RpcConnection *Connection)
201 {
202  return Connection->ops->close(Connection);
203 }
204 
205 static inline void rpcrt4_conn_close_read(RpcConnection *connection)
206 {
207  connection->ops->close_read(connection);
208 }
209 
210 static inline void rpcrt4_conn_cancel_call(RpcConnection *Connection)
211 {
212  Connection->ops->cancel_call(Connection);
213 }
214 
215 static inline RPC_STATUS rpcrt4_conn_handoff(RpcConnection *old_conn, RpcConnection *new_conn)
216 {
217  return old_conn->ops->handoff(old_conn, new_conn);
218 }
219 
220 static inline BOOL rpcrt4_conn_is_authorized(RpcConnection *Connection)
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 */
261 RPC_STATUS RpcTransport_GetTopOfTower(unsigned char *tower_data, size_t *tower_size, const char *protseq, const char *networkaddr, const char *endpoint) DECLSPEC_HIDDEN;
262 RPC_STATUS RpcTransport_ParseTopOfTower(const unsigned char *tower_data, size_t tower_size, char **protseq, char **networkaddr, char **endpoint) DECLSPEC_HIDDEN;
263 
270 
271 #endif
USHORT MaxTransmissionSize
Definition: rpc_binding.h:71
ULONG ServerTid
Definition: rpc_binding.h:135
static int rpcrt4_conn_write(RpcConnection *Connection, const void *buffer, unsigned int len)
Definition: rpc_binding.h:194
struct list protseq_entry
Definition: rpc_binding.h:94
BOOL RpcAuthInfo_IsEqual(const RpcAuthInfo *AuthInfo1, const RpcAuthInfo *AuthInfo2) DECLSPEC_HIDDEN
Definition: rpc_binding.c:1206
struct _RpcAssoc * Assoc
Definition: rpc_binding.h:137
static int rpcrt4_conn_close(RpcConnection *Connection)
Definition: rpc_binding.h:200
static BOOL rpcrt4_conn_is_authorized(RpcConnection *Connection)
Definition: rpc_binding.h:220
LPSTR RPCRT4_strdupWtoA(LPCWSTR src) DECLSPEC_HIDDEN
Definition: rpc_binding.c:59
RPC_STATUS(* revert_to_self)(RpcConnection *conn)
Definition: rpc_binding.h:119
LPSTR RPCRT4_strndupA(LPCSTR src, INT len) DECLSPEC_HIDDEN
Definition: rpc_binding.c:46
char hdr[14]
Definition: iptest.cpp:33
ULONG signature_auth_len
Definition: rpc_binding.h:80
static const char * rpcrt4_conn_get_name(const RpcConnection *Connection)
Definition: rpc_binding.h:183
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
static rfbScreenInfoPtr server
Definition: vnc.c:74
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:273
struct _RpcBinding RpcBinding
LPSTR Protseq
Definition: rpc_binding.h:130
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
static RPC_STATUS rpcrt4_conn_impersonate_client(RpcConnection *conn)
Definition: rpc_binding.h:241
RPC_STATUS RPCRT4_SetBindingObject(RpcBinding *Binding, const UUID *ObjectUuid) DECLSPEC_HIDDEN
Definition: rpc_binding.c:225
RPC_STATUS(* handoff)(RpcConnection *old_conn, RpcConnection *new_conn)
Definition: rpc_binding.h:104
RPC_STATUS RPCRT4_ReleaseBinding(RpcBinding *Binding) DECLSPEC_HIDDEN
Definition: rpc_binding.c:255
GLuint buffer
Definition: glext.h:5915
USHORT NextCallId
Definition: rpc_binding.h:93
TimeStamp exp
Definition: rpc_binding.h:75
RPC_STATUS(* open_connection_client)(RpcConnection *conn)
Definition: rpc_binding.h:103
void(* close_read)(RpcConnection *conn)
Definition: rpc_binding.h:108
LPWSTR server_principal_name
Definition: rpc_binding.h:50
unsigned short * RPC_WSTR
Definition: rpcdce.h:46
struct _RpcQualityOfService RpcQualityOfService
char * LPSTR
Definition: xmlstorage.h:182
#define BOOL
Definition: nt_native.h:43
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
int32_t INT
Definition: typedefs.h:56
const struct connection_ops * ops
Definition: rpc_binding.h:70
ULONG RpcAuthInfo_AddRef(RpcAuthInfo *AuthInfo) DECLSPEC_HIDDEN
Definition: rpc_binding.c:1180
ULONG cbMaxToken
Definition: rpc_binding.h:44
ULONG RpcQualityOfService_Release(RpcQualityOfService *qos) DECLSPEC_HIDDEN
Definition: rpc_binding.c:1362
int(* read)(RpcConnection *conn, void *buffer, unsigned int len)
Definition: rpc_binding.h:105
static HANDLE PIO_APC_ROUTINE PVOID PIO_STATUS_BLOCK ULONG PVOID ULONG PVOID out_buffer
Definition: file.c:100
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
int(* wait_for_incoming_data)(RpcConnection *conn)
Definition: rpc_binding.h:111
struct list conn_pool_entry
Definition: rpc_binding.h:85
RPC_STATUS(* receive_fragment)(RpcConnection *conn, RpcPktHdr **Header, void **Payload)
Definition: rpc_binding.h:114
void RPCRT4_PushThreadContextHandle(NDR_SCONTEXT SContext) DECLSPEC_HIDDEN
Definition: rpcrt4_main.c:981
static unsigned char * in_buffer
Definition: iccvid.c:87
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
RpcConnection * RPCRT4_GrabConnection(RpcConnection *conn) DECLSPEC_HIDDEN
long RPC_STATUS
Definition: rpc.h:52
BOOL(* is_authorized)(RpcConnection *conn)
Definition: rpc_binding.h:115
LPSTR Endpoint
Definition: rpc_assoc.h:34
int(* write)(RpcConnection *conn, const void *buffer, unsigned int len)
Definition: rpc_binding.h:106
Definition: Header.h:8
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
LPWSTR NetworkOptions
Definition: rpc_binding.h:133
static void rpcrt4_conn_close_read(RpcConnection *connection)
Definition: rpc_binding.h:205
RPC_STATUS RpcTransport_GetTopOfTower(unsigned char *tower_data, size_t *tower_size, const char *protseq, const char *networkaddr, const char *endpoint) DECLSPEC_HIDDEN
CredHandle cred
Definition: rpc_binding.h:42
ULONG assoc_group_id
Definition: rpc_binding.h:86
RpcQualityOfService * QOS
Definition: rpc_binding.h:141
static RPC_STATUS rpcrt4_conn_revert_to_self(RpcConnection *conn)
Definition: rpc_binding.h:247
unsigned int dir
Definition: maze.c:112
const char * LPCSTR
Definition: xmlstorage.h:183
struct _RpcServerProtseq * protseq
Definition: rpc_binding.h:95
LPSTR Endpoint
Definition: rpc_binding.h:132
RPC_STATUS(* parse_top_of_tower)(const unsigned char *tower_data, size_t tower_size, char **networkaddr, char **endpoint)
Definition: rpc_binding.h:113
ULONG AuthnLevel
Definition: rpc_binding.h:40
static int rpcrt4_conn_read(RpcConnection *Connection, void *buffer, unsigned int len)
Definition: rpc_binding.h:188
ULONG RpcAuthInfo_Release(RpcAuthInfo *AuthInfo) DECLSPEC_HIDDEN
Definition: rpc_binding.c:1185
secure_packet_direction
Definition: rpc_binding.h:30
__kernel_size_t size_t
Definition: linux.h:237
RPC_STATUS RPCRT4_IsServerListening(const char *protseq, const char *endpoint) DECLSPEC_HIDDEN
void RPCRT4_ReleaseConnection(RpcConnection *Connection) DECLSPEC_HIDDEN
struct _RpcBinding * Next
Definition: rpc_binding.h:127
BOOL RpcQualityOfService_IsEqual(const RpcQualityOfService *qos1, const RpcQualityOfService *qos2) DECLSPEC_HIDDEN
Definition: rpc_binding.c:1387
void rpcrt4_conn_release_and_wait(RpcConnection *connection) DECLSPEC_HIDDEN
RPC_STATUS RPCRT4_CloseBinding(RpcBinding *Binding, RpcConnection *Connection) DECLSPEC_HIDDEN
Definition: rpc_binding.c:294
LPWSTR NetworkOptions
Definition: rpc_binding.h:69
NDR_SCONTEXT RPCRT4_PopThreadContextHandle(void) DECLSPEC_HIDDEN
Definition: rpcrt4_main.c:1017
ULONG encryption_auth_len
Definition: rpc_binding.h:79
struct endpoint endpoint
Definition: nis.h:15
RPC_STATUS RpcTransport_ParseTopOfTower(const unsigned char *tower_data, size_t tower_size, char **protseq, char **networkaddr, char **endpoint) DECLSPEC_HIDDEN
LPSTR NetworkAddr
Definition: rpc_assoc.h:33
LPSTR NetworkAddr
Definition: rpc_binding.h:67
LPWSTR RPCRT4_strdupAtoW(LPCSTR src) DECLSPEC_HIDDEN
Definition: rpc_binding.c:70
void RPCRT4_AddRefBinding(RpcBinding *Binding) DECLSPEC_HIDDEN
Definition: rpc_binding.c:250
int(* close)(RpcConnection *conn)
Definition: rpc_binding.h:107
GLbitfield flags
Definition: glext.h:7161
RPC_STATUS RPCRT4_CreateConnection(RpcConnection **Connection, BOOL server, LPCSTR Protseq, LPCSTR NetworkAddr, LPCSTR Endpoint, LPCWSTR NetworkOptions, RpcAuthInfo *AuthInfo, RpcQualityOfService *QOS, LPCWSTR CookieAuth) DECLSPEC_HIDDEN
HANDLE wait_release
Definition: rpc_binding.h:66
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:1114
int ret
RPC_ASYNC_STATE * async_state
Definition: rpc_binding.h:87
RPC_STATUS(* is_server_listening)(const char *endpoint)
Definition: rpc_binding.h:110
void RPCRT4_RemoveThreadContextHandle(NDR_SCONTEXT SContext) DECLSPEC_HIDDEN
Definition: rpcrt4_main.c:996
RPC_BLOCKING_FN BlockingFn
Definition: rpc_binding.h:134
RPC_STATUS RPCRT4_ResolveBinding(RpcBinding *Binding, LPCSTR Endpoint) DECLSPEC_HIDDEN
Definition: rpc_binding.c:205
LPWSTR CookieAuth
Definition: rpc_binding.h:82
GLenum GLsizei len
Definition: glext.h:6722
Definition: _list.h:228
size_t(* get_top_of_tower)(unsigned char *tower_data, const char *networkaddr, const char *endpoint)
Definition: rpc_binding.h:112
GLenum src
Definition: glext.h:6340
LPWSTR CookieAuth
Definition: rpc_binding.h:142
RPC_SECURITY_QOS_V2_W * qos
Definition: rpc_binding.h:57
const char * name
Definition: rpc_binding.h:100
struct _RpcAuthInfo RpcAuthInfo
struct _RpcBinding * server_binding
Definition: rpc_binding.h:96
CtxtHandle ctx
Definition: rpc_binding.h:74
RPC_AUTH_IDENTITY_HANDLE * identity
Definition: rpc_binding.h:46
unsigned char epm_protocols[2]
Definition: rpc_binding.h:101
TimeStamp exp
Definition: rpc_binding.h:43
void RPCRT4_SetThreadCurrentConnection(RpcConnection *Connection) DECLSPEC_HIDDEN
Definition: rpcrt4_main.c:955
Definition: nis.h:10
SEC_WINNT_AUTH_IDENTITY_W * nt_identity
Definition: rpc_binding.h:49
#define DECLSPEC_HIDDEN
Definition: precomp.h:8
UUID ObjectUuid
Definition: rpc_binding.h:129
void(* cancel_call)(RpcConnection *conn)
Definition: rpc_binding.h:109
unsigned short USHORT
Definition: pedump.c:61
struct _RpcConnection RpcConnection
RPC_STATUS(* impersonate_client)(RpcConnection *conn)
Definition: rpc_binding.h:118
RpcAuthInfo * AuthInfo
Definition: rpc_binding.h:77
DWORD exp
Definition: msg.c:15681
RpcConnection * FromConn
Definition: rpc_binding.h:136
RPC_STATUS RPCRT4_OpenClientConnection(RpcConnection *Connection) DECLSPEC_HIDDEN
LPSTR NetworkAddr
Definition: rpc_binding.h:131
LPWSTR NetworkOptions
Definition: rpc_assoc.h:35
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
void RPCRT4_strfree(LPSTR src) DECLSPEC_HIDDEN
Definition: rpc_binding.c:105
RPC_STATUS RPCRT4_CloseConnection(RpcConnection *Connection) DECLSPEC_HIDDEN
unsigned int ULONG
Definition: retypes.h:1
static void rpcrt4_conn_cancel_call(RpcConnection *Connection)
Definition: rpc_binding.h:210
void RPCRT4_SetThreadCurrentCallHandle(RpcBinding *Binding) DECLSPEC_HIDDEN
Definition: rpcrt4_main.c:965
ULONG RpcQualityOfService_AddRef(RpcQualityOfService *qos) DECLSPEC_HIDDEN
Definition: rpc_binding.c:1357
LPWSTR RPCRT4_strndupW(LPCWSTR src, INT len) DECLSPEC_HIDDEN
Definition: rpc_binding.c:92
RpcQualityOfService * QOS
Definition: rpc_binding.h:81
RPC_STATUS(* inquire_auth_client)(RpcConnection *, RPC_AUTHZ_HANDLE *, RPC_WSTR *, ULONG *, ULONG *, ULONG *, ULONG)
Definition: rpc_binding.h:120
ULONG auth_context_id
Definition: rpc_binding.h:78
WCHAR * LPWSTR
Definition: xmlstorage.h:184
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
static RPC_STATUS rpcrt4_conn_handoff(RpcConnection *old_conn, RpcConnection *new_conn)
Definition: rpc_binding.h:215
RpcAuthInfo * AuthInfo
Definition: rpc_binding.h:140
struct _RpcAssoc * assoc
Definition: rpc_binding.h:88
RPC_STATUS RPCRT4_MakeBinding(RpcBinding **Binding, RpcConnection *Connection) DECLSPEC_HIDDEN
Definition: rpc_binding.c:233
RpcBinding * RPCRT4_GetThreadCurrentCallHandle(void) DECLSPEC_HIDDEN
Definition: rpcrt4_main.c:973
RPC_SYNTAX_IDENTIFIER ActiveInterface
Definition: rpc_binding.h:92
LPSTR Protseq
Definition: rpc_assoc.h:32
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31
ULONG AuthnSvc
Definition: rpc_binding.h:41