~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Wine Cross Reference
wine/dlls/rpcrt4/rpc_binding.h

Version: ~ [ wine-1.1.40 ] ~ [ wine-1.1.39 ] ~ [ wine-1.1.38 ] ~ [ wine-1.1.37 ] ~ [ wine-1.1.36 ] ~ [ wine-1.1.35 ] ~ [ wine-1.1.34 ] ~ [ wine-1.1.33 ] ~ [ wine-1.1.32 ] ~ [ wine-1.1.31 ] ~ [ wine-1.1.30 ] ~ [ wine-1.1.29 ] ~ [ wine-1.1.28 ] ~ [ wine-1.1.27 ] ~ [ wine-1.1.26 ] ~ [ wine-1.1.25 ] ~ [ wine-1.1.24 ] ~ [ wine-1.1.23 ] ~ [ wine-1.1.22 ] ~ [ wine-1.1.21 ] ~ [ wine-1.1.20 ] ~ [ wine-1.1.19 ] ~ [ wine-1.1.18 ] ~ [ wine-1.1.17 ] ~ [ wine-1.1.16 ] ~ [ wine-1.1.15 ] ~ [ wine-1.1.14 ] ~ [ wine-1.1.13 ] ~ [ wine-1.1.12 ] ~ [ wine-1.1.11 ] ~ [ wine-1.1.10 ] ~ [ wine-1.1.9 ] ~ [ wine-1.1.8 ] ~ [ wine-1.1.7 ] ~ [ wine-1.0.1 ] ~ [ wine-1.1.6 ] ~ [ wine-1.1.5 ] ~ [ wine-1.1.4 ] ~ [ wine-1.1.3 ] ~ [ wine-1.1.2 ] ~ [ wine-1.1.1 ] ~ [ wine-1.1.0 ] ~ [ wine-1.0 ] ~

  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 
 30 enum secure_packet_direction
 31 {
 32   SECURE_PACKET_SEND,
 33   SECURE_PACKET_RECEIVE
 34 };
 35 
 36 typedef struct _RpcAuthInfo
 37 {
 38   LONG refs;
 39 
 40   ULONG AuthnLevel;
 41   ULONG AuthnSvc;
 42   CredHandle cred;
 43   TimeStamp exp;
 44   ULONG cbMaxToken;
 45   /* the auth identity pointer that the application passed us (freed by application) */
 46   RPC_AUTH_IDENTITY_HANDLE *identity;
 47   /* our copy of NT auth identity structure, if the authentication service
 48    * takes an NT auth identity */
 49   SEC_WINNT_AUTH_IDENTITY_W *nt_identity;
 50   LPWSTR server_principal_name;
 51 } RpcAuthInfo;
 52 
 53 typedef struct _RpcQualityOfService
 54 {
 55     LONG refs;
 56 
 57     RPC_SECURITY_QOS_V2_W *qos;
 58 } RpcQualityOfService;
 59 
 60 struct connection_ops;
 61 
 62 typedef struct _RpcConnection
 63 {
 64   BOOL server;
 65   LPSTR NetworkAddr;
 66   LPSTR Endpoint;
 67   LPWSTR NetworkOptions;
 68   const struct connection_ops *ops;
 69   USHORT MaxTransmissionSize;
 70 
 71   /* authentication */
 72   CtxtHandle ctx;
 73   TimeStamp exp;
 74   ULONG attr;
 75   RpcAuthInfo *AuthInfo;
 76   ULONG auth_context_id;
 77   ULONG encryption_auth_len;
 78   ULONG signature_auth_len;
 79   RpcQualityOfService *QOS;
 80 
 81   /* client-only */
 82   struct list conn_pool_entry;
 83   ULONG assoc_group_id; /* association group returned during binding */
 84   RPC_ASYNC_STATE *async_state;
 85   struct _RpcAssoc *assoc; /* association this connection is part of */
 86 
 87   /* server-only */
 88   /* The active interface bound to server. */
 89   RPC_SYNTAX_IDENTIFIER ActiveInterface;
 90   USHORT NextCallId;
 91   struct _RpcConnection* Next;
 92   struct _RpcBinding *server_binding;
 93 } RpcConnection;
 94 
 95 struct connection_ops {
 96   const char *name;
 97   unsigned char epm_protocols[2]; /* only floors 3 and 4. see http://www.opengroup.org/onlinepubs/9629399/apdxl.htm */
 98   RpcConnection *(*alloc)(void);
 99   RPC_STATUS (*open_connection_client)(RpcConnection *conn);
100   RPC_STATUS (*handoff)(RpcConnection *old_conn, RpcConnection *new_conn);
101   int (*read)(RpcConnection *conn, void *buffer, unsigned int len);
102   int (*write)(RpcConnection *conn, const void *buffer, unsigned int len);
103   int (*close)(RpcConnection *conn);
104   void (*cancel_call)(RpcConnection *conn);
105   int (*wait_for_incoming_data)(RpcConnection *conn);
106   size_t (*get_top_of_tower)(unsigned char *tower_data, const char *networkaddr, const char *endpoint);
107   RPC_STATUS (*parse_top_of_tower)(const unsigned char *tower_data, size_t tower_size, char **networkaddr, char **endpoint);
108   RPC_STATUS (*receive_fragment)(RpcConnection *conn, RpcPktHdr **Header, void **Payload);
109   BOOL (*is_authorized)(RpcConnection *conn);
110   RPC_STATUS (*authorize)(RpcConnection *conn, BOOL first_time, unsigned char *in_buffer, unsigned int in_len, unsigned char *out_buffer, unsigned int *out_len);
111   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);
112   RPC_STATUS (*impersonate_client)(RpcConnection *conn);
113   RPC_STATUS (*revert_to_self)(RpcConnection *conn);
114   RPC_STATUS (*inquire_auth_client)(RpcConnection *, RPC_AUTHZ_HANDLE *, RPC_WSTR *, ULONG *, ULONG *, ULONG *, ULONG);
115 };
116 
117 /* don't know what MS's structure looks like */
118 typedef struct _RpcBinding
119 {
120   LONG refs;
121   struct _RpcBinding* Next;
122   BOOL server;
123   UUID ObjectUuid;
124   LPSTR Protseq;
125   LPSTR NetworkAddr;
126   LPSTR Endpoint;
127   LPWSTR NetworkOptions;
128   RPC_BLOCKING_FN BlockingFn;
129   ULONG ServerTid;
130   RpcConnection* FromConn;
131   struct _RpcAssoc *Assoc;
132 
133   /* authentication */
134   RpcAuthInfo *AuthInfo;
135   RpcQualityOfService *QOS;
136 } RpcBinding;
137 
138 LPSTR RPCRT4_strndupA(LPCSTR src, INT len);
139 LPWSTR RPCRT4_strndupW(LPCWSTR src, INT len);
140 LPSTR RPCRT4_strdupWtoA(LPCWSTR src);
141 LPWSTR RPCRT4_strdupAtoW(LPCSTR src);
142 void RPCRT4_strfree(LPSTR src);
143 
144 #define RPCRT4_strdupA(x) RPCRT4_strndupA((x),-1)
145 #define RPCRT4_strdupW(x) RPCRT4_strndupW((x),-1)
146 
147 RPC_STATUS RpcAuthInfo_Create(ULONG AuthnLevel, ULONG AuthnSvc, CredHandle cred, TimeStamp exp, ULONG cbMaxToken, RPC_AUTH_IDENTITY_HANDLE identity, RpcAuthInfo **ret);
148 ULONG RpcAuthInfo_AddRef(RpcAuthInfo *AuthInfo);
149 ULONG RpcAuthInfo_Release(RpcAuthInfo *AuthInfo);
150 BOOL RpcAuthInfo_IsEqual(const RpcAuthInfo *AuthInfo1, const RpcAuthInfo *AuthInfo2);
151 ULONG RpcQualityOfService_AddRef(RpcQualityOfService *qos);
152 ULONG RpcQualityOfService_Release(RpcQualityOfService *qos);
153 BOOL RpcQualityOfService_IsEqual(const RpcQualityOfService *qos1, const RpcQualityOfService *qos2);
154 
155 RPC_STATUS RPCRT4_CreateConnection(RpcConnection** Connection, BOOL server, LPCSTR Protseq, LPCSTR NetworkAddr, LPCSTR Endpoint, LPCWSTR NetworkOptions, RpcAuthInfo* AuthInfo, RpcQualityOfService *QOS);
156 RPC_STATUS RPCRT4_DestroyConnection(RpcConnection* Connection);
157 RPC_STATUS RPCRT4_OpenClientConnection(RpcConnection* Connection);
158 RPC_STATUS RPCRT4_CloseConnection(RpcConnection* Connection);
159 
160 RPC_STATUS RPCRT4_ResolveBinding(RpcBinding* Binding, LPCSTR Endpoint);
161 RPC_STATUS RPCRT4_SetBindingObject(RpcBinding* Binding, const UUID* ObjectUuid);
162 RPC_STATUS RPCRT4_MakeBinding(RpcBinding** Binding, RpcConnection* Connection);
163 void       RPCRT4_AddRefBinding(RpcBinding* Binding);
164 RPC_STATUS RPCRT4_ReleaseBinding(RpcBinding* Binding);
165 RPC_STATUS RPCRT4_OpenBinding(RpcBinding* Binding, RpcConnection** Connection,
166                               const RPC_SYNTAX_IDENTIFIER *TransferSyntax, const RPC_SYNTAX_IDENTIFIER *InterfaceId);
167 RPC_STATUS RPCRT4_CloseBinding(RpcBinding* Binding, RpcConnection* Connection);
168 
169 static inline const char *rpcrt4_conn_get_name(const RpcConnection *Connection)
170 {
171   return Connection->ops->name;
172 }
173 
174 static inline int rpcrt4_conn_read(RpcConnection *Connection,
175                      void *buffer, unsigned int len)
176 {
177   return Connection->ops->read(Connection, buffer, len);
178 }
179 
180 static inline int rpcrt4_conn_write(RpcConnection *Connection,
181                      const void *buffer, unsigned int len)
182 {
183   return Connection->ops->write(Connection, buffer, len);
184 }
185 
186 static inline int rpcrt4_conn_close(RpcConnection *Connection)
187 {
188   return Connection->ops->close(Connection);
189 }
190 
191 static inline void rpcrt4_conn_cancel_call(RpcConnection *Connection)
192 {
193   Connection->ops->cancel_call(Connection);
194 }
195 
196 static inline RPC_STATUS rpcrt4_conn_handoff(RpcConnection *old_conn, RpcConnection *new_conn)
197 {
198   return old_conn->ops->handoff(old_conn, new_conn);
199 }
200 
201 static inline BOOL rpcrt4_conn_is_authorized(RpcConnection *Connection)
202 {
203     return Connection->ops->is_authorized(Connection);
204 }
205 
206 static inline RPC_STATUS rpcrt4_conn_authorize(
207     RpcConnection *conn, BOOL first_time, unsigned char *in_buffer,
208     unsigned int in_len, unsigned char *out_buffer, unsigned int *out_len)
209 {
210     return conn->ops->authorize(conn, first_time, in_buffer, in_len, out_buffer, out_len);
211 }
212 
213 static inline RPC_STATUS rpcrt4_conn_secure_packet(
214     RpcConnection *conn, enum secure_packet_direction dir,
215     RpcPktHdr *hdr, unsigned int hdr_size, unsigned char *stub_data,
216     unsigned int stub_data_size, RpcAuthVerifier *auth_hdr,
217     unsigned char *auth_value, unsigned int auth_value_size)
218 {
219     return conn->ops->secure_packet(conn, dir, hdr, hdr_size, stub_data, stub_data_size, auth_hdr, auth_value, auth_value_size);
220 }
221 
222 static inline RPC_STATUS rpcrt4_conn_impersonate_client(
223     RpcConnection *conn)
224 {
225     return conn->ops->impersonate_client(conn);
226 }
227 
228 static inline RPC_STATUS rpcrt4_conn_revert_to_self(
229     RpcConnection *conn)
230 {
231     return conn->ops->revert_to_self(conn);
232 }
233 
234 static inline RPC_STATUS rpcrt4_conn_inquire_auth_client(
235     RpcConnection *conn, RPC_AUTHZ_HANDLE *privs, RPC_WSTR *server_princ_name,
236     ULONG *authn_level, ULONG *authn_svc, ULONG *authz_svc, ULONG flags)
237 {
238     return conn->ops->inquire_auth_client(conn, privs, server_princ_name, authn_level, authn_svc, authz_svc, flags);
239 }
240 
241 /* floors 3 and up */
242 RPC_STATUS RpcTransport_GetTopOfTower(unsigned char *tower_data, size_t *tower_size, const char *protseq, const char *networkaddr, const char *endpoint);
243 RPC_STATUS RpcTransport_ParseTopOfTower(const unsigned char *tower_data, size_t tower_size, char **protseq, char **networkaddr, char **endpoint);
244 
245 void RPCRT4_SetThreadCurrentConnection(RpcConnection *Connection);
246 void RPCRT4_SetThreadCurrentCallHandle(RpcBinding *Binding);
247 RpcBinding *RPCRT4_GetThreadCurrentCallHandle(void);
248 void RPCRT4_PushThreadContextHandle(NDR_SCONTEXT SContext);
249 void RPCRT4_RemoveThreadContextHandle(NDR_SCONTEXT SContext);
250 NDR_SCONTEXT RPCRT4_PopThreadContextHandle(void);
251 
252 #endif
253 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.