ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

rpc_binding.h
Go to the documentation of this file.
00001 /*
00002  * RPC binding API
00003  *
00004  * Copyright 2001 Ove Kåven, TransGaming Technologies
00005  *
00006  * This library is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU Lesser General Public
00008  * License as published by the Free Software Foundation; either
00009  * version 2.1 of the License, or (at your option) any later version.
00010  *
00011  * This library is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014  * Lesser General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU Lesser General Public
00017  * License along with this library; if not, write to the Free Software
00018  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
00019  */
00020 
00021 #ifndef __WINE_RPC_BINDING_H
00022 #define __WINE_RPC_BINDING_H
00023 
00024 #include "rpcndr.h"
00025 #include "security.h"
00026 #include "wine/list.h"
00027 #include "rpc_defs.h"
00028 
00029 
00030 enum secure_packet_direction
00031 {
00032   SECURE_PACKET_SEND,
00033   SECURE_PACKET_RECEIVE
00034 };
00035 
00036 typedef struct _RpcAuthInfo
00037 {
00038   LONG refs;
00039 
00040   ULONG AuthnLevel;
00041   ULONG AuthnSvc;
00042   CredHandle cred;
00043   TimeStamp exp;
00044   ULONG cbMaxToken;
00045   /* the auth identity pointer that the application passed us (freed by application) */
00046   RPC_AUTH_IDENTITY_HANDLE *identity;
00047   /* our copy of NT auth identity structure, if the authentication service
00048    * takes an NT auth identity */
00049   SEC_WINNT_AUTH_IDENTITY_W *nt_identity;
00050   LPWSTR server_principal_name;
00051 } RpcAuthInfo;
00052 
00053 typedef struct _RpcQualityOfService
00054 {
00055     LONG refs;
00056 
00057     RPC_SECURITY_QOS_V2_W *qos;
00058 } RpcQualityOfService;
00059 
00060 struct connection_ops;
00061 
00062 typedef struct _RpcConnection
00063 {
00064   BOOL server;
00065   LPSTR NetworkAddr;
00066   LPSTR Endpoint;
00067   LPWSTR NetworkOptions;
00068   const struct connection_ops *ops;
00069   USHORT MaxTransmissionSize;
00070 
00071   /* authentication */
00072   CtxtHandle ctx;
00073   TimeStamp exp;
00074   ULONG attr;
00075   RpcAuthInfo *AuthInfo;
00076   ULONG auth_context_id;
00077   ULONG encryption_auth_len;
00078   ULONG signature_auth_len;
00079   RpcQualityOfService *QOS;
00080 
00081   /* client-only */
00082   struct list conn_pool_entry;
00083   ULONG assoc_group_id; /* association group returned during binding */
00084   RPC_ASYNC_STATE *async_state;
00085   struct _RpcAssoc *assoc; /* association this connection is part of */
00086 
00087   /* server-only */
00088   /* The active interface bound to server. */
00089   RPC_SYNTAX_IDENTIFIER ActiveInterface;
00090   USHORT NextCallId;
00091   struct _RpcConnection* Next;
00092   struct _RpcBinding *server_binding;
00093 } RpcConnection;
00094 
00095 struct connection_ops {
00096   const char *name;
00097   unsigned char epm_protocols[2]; /* only floors 3 and 4. see http://www.opengroup.org/onlinepubs/9629399/apdxl.htm */
00098   RpcConnection *(*alloc)(void);
00099   RPC_STATUS (*open_connection_client)(RpcConnection *conn);
00100   RPC_STATUS (*handoff)(RpcConnection *old_conn, RpcConnection *new_conn);
00101   int (*read)(RpcConnection *conn, void *buffer, unsigned int len);
00102   int (*write)(RpcConnection *conn, const void *buffer, unsigned int len);
00103   int (*close)(RpcConnection *conn);
00104   void (*cancel_call)(RpcConnection *conn);
00105   int (*wait_for_incoming_data)(RpcConnection *conn);
00106   size_t (*get_top_of_tower)(unsigned char *tower_data, const char *networkaddr, const char *endpoint);
00107   RPC_STATUS (*parse_top_of_tower)(const unsigned char *tower_data, size_t tower_size, char **networkaddr, char **endpoint);
00108   RPC_STATUS (*receive_fragment)(RpcConnection *conn, RpcPktHdr **Header, void **Payload);
00109   BOOL (*is_authorized)(RpcConnection *conn);
00110   RPC_STATUS (*authorize)(RpcConnection *conn, BOOL first_time, unsigned char *in_buffer, unsigned int in_len, unsigned char *out_buffer, unsigned int *out_len);
00111   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);
00112   RPC_STATUS (*impersonate_client)(RpcConnection *conn);
00113   RPC_STATUS (*revert_to_self)(RpcConnection *conn);
00114   RPC_STATUS (*inquire_auth_client)(RpcConnection *, RPC_AUTHZ_HANDLE *, RPC_WSTR *, ULONG *, ULONG *, ULONG *, ULONG);
00115 };
00116 
00117 /* don't know what MS's structure looks like */
00118 typedef struct _RpcBinding
00119 {
00120   LONG refs;
00121   struct _RpcBinding* Next;
00122   BOOL server;
00123   UUID ObjectUuid;
00124   LPSTR Protseq;
00125   LPSTR NetworkAddr;
00126   LPSTR Endpoint;
00127   LPWSTR NetworkOptions;
00128   RPC_BLOCKING_FN BlockingFn;
00129   ULONG ServerTid;
00130   RpcConnection* FromConn;
00131   struct _RpcAssoc *Assoc;
00132 
00133   /* authentication */
00134   RpcAuthInfo *AuthInfo;
00135   RpcQualityOfService *QOS;
00136 } RpcBinding;
00137 
00138 LPSTR RPCRT4_strndupA(LPCSTR src, INT len) DECLSPEC_HIDDEN;
00139 LPWSTR RPCRT4_strndupW(LPCWSTR src, INT len) DECLSPEC_HIDDEN;
00140 LPSTR RPCRT4_strdupWtoA(LPCWSTR src) DECLSPEC_HIDDEN;
00141 LPWSTR RPCRT4_strdupAtoW(LPCSTR src) DECLSPEC_HIDDEN;
00142 void RPCRT4_strfree(LPSTR src) DECLSPEC_HIDDEN;
00143 
00144 #define RPCRT4_strdupA(x) RPCRT4_strndupA((x),-1)
00145 #define RPCRT4_strdupW(x) RPCRT4_strndupW((x),-1)
00146 
00147 RPC_STATUS RpcAuthInfo_Create(ULONG AuthnLevel, ULONG AuthnSvc, CredHandle cred, TimeStamp exp, ULONG cbMaxToken, RPC_AUTH_IDENTITY_HANDLE identity, RpcAuthInfo **ret) DECLSPEC_HIDDEN;
00148 ULONG RpcAuthInfo_AddRef(RpcAuthInfo *AuthInfo) DECLSPEC_HIDDEN;
00149 ULONG RpcAuthInfo_Release(RpcAuthInfo *AuthInfo) DECLSPEC_HIDDEN;
00150 BOOL RpcAuthInfo_IsEqual(const RpcAuthInfo *AuthInfo1, const RpcAuthInfo *AuthInfo2) DECLSPEC_HIDDEN;
00151 ULONG RpcQualityOfService_AddRef(RpcQualityOfService *qos) DECLSPEC_HIDDEN;
00152 ULONG RpcQualityOfService_Release(RpcQualityOfService *qos) DECLSPEC_HIDDEN;
00153 BOOL RpcQualityOfService_IsEqual(const RpcQualityOfService *qos1, const RpcQualityOfService *qos2) DECLSPEC_HIDDEN;
00154 
00155 RPC_STATUS RPCRT4_CreateConnection(RpcConnection** Connection, BOOL server, LPCSTR Protseq, LPCSTR NetworkAddr, LPCSTR Endpoint, LPCWSTR NetworkOptions, RpcAuthInfo* AuthInfo, RpcQualityOfService *QOS) DECLSPEC_HIDDEN;
00156 RPC_STATUS RPCRT4_DestroyConnection(RpcConnection* Connection) DECLSPEC_HIDDEN;
00157 RPC_STATUS RPCRT4_OpenClientConnection(RpcConnection* Connection) DECLSPEC_HIDDEN;
00158 RPC_STATUS RPCRT4_CloseConnection(RpcConnection* Connection) DECLSPEC_HIDDEN;
00159 
00160 RPC_STATUS RPCRT4_ResolveBinding(RpcBinding* Binding, LPCSTR Endpoint) DECLSPEC_HIDDEN;
00161 RPC_STATUS RPCRT4_SetBindingObject(RpcBinding* Binding, const UUID* ObjectUuid) DECLSPEC_HIDDEN;
00162 RPC_STATUS RPCRT4_MakeBinding(RpcBinding** Binding, RpcConnection* Connection) DECLSPEC_HIDDEN;
00163 void       RPCRT4_AddRefBinding(RpcBinding* Binding) DECLSPEC_HIDDEN;
00164 RPC_STATUS RPCRT4_ReleaseBinding(RpcBinding* Binding) DECLSPEC_HIDDEN;
00165 RPC_STATUS RPCRT4_OpenBinding(RpcBinding* Binding, RpcConnection** Connection,
00166                               const RPC_SYNTAX_IDENTIFIER *TransferSyntax, const RPC_SYNTAX_IDENTIFIER *InterfaceId) DECLSPEC_HIDDEN;
00167 RPC_STATUS RPCRT4_CloseBinding(RpcBinding* Binding, RpcConnection* Connection) DECLSPEC_HIDDEN;
00168 
00169 static inline const char *rpcrt4_conn_get_name(const RpcConnection *Connection)
00170 {
00171   return Connection->ops->name;
00172 }
00173 
00174 static inline int rpcrt4_conn_read(RpcConnection *Connection,
00175                      void *buffer, unsigned int len)
00176 {
00177   return Connection->ops->read(Connection, buffer, len);
00178 }
00179 
00180 static inline int rpcrt4_conn_write(RpcConnection *Connection,
00181                      const void *buffer, unsigned int len)
00182 {
00183   return Connection->ops->write(Connection, buffer, len);
00184 }
00185 
00186 static inline int rpcrt4_conn_close(RpcConnection *Connection)
00187 {
00188   return Connection->ops->close(Connection);
00189 }
00190 
00191 static inline void rpcrt4_conn_cancel_call(RpcConnection *Connection)
00192 {
00193   Connection->ops->cancel_call(Connection);
00194 }
00195 
00196 static inline RPC_STATUS rpcrt4_conn_handoff(RpcConnection *old_conn, RpcConnection *new_conn)
00197 {
00198   return old_conn->ops->handoff(old_conn, new_conn);
00199 }
00200 
00201 static inline BOOL rpcrt4_conn_is_authorized(RpcConnection *Connection)
00202 {
00203     return Connection->ops->is_authorized(Connection);
00204 }
00205 
00206 static inline RPC_STATUS rpcrt4_conn_authorize(
00207     RpcConnection *conn, BOOL first_time, unsigned char *in_buffer,
00208     unsigned int in_len, unsigned char *out_buffer, unsigned int *out_len)
00209 {
00210     return conn->ops->authorize(conn, first_time, in_buffer, in_len, out_buffer, out_len);
00211 }
00212 
00213 static inline RPC_STATUS rpcrt4_conn_secure_packet(
00214     RpcConnection *conn, enum secure_packet_direction dir,
00215     RpcPktHdr *hdr, unsigned int hdr_size, unsigned char *stub_data,
00216     unsigned int stub_data_size, RpcAuthVerifier *auth_hdr,
00217     unsigned char *auth_value, unsigned int auth_value_size)
00218 {
00219     return conn->ops->secure_packet(conn, dir, hdr, hdr_size, stub_data, stub_data_size, auth_hdr, auth_value, auth_value_size);
00220 }
00221 
00222 static inline RPC_STATUS rpcrt4_conn_impersonate_client(
00223     RpcConnection *conn)
00224 {
00225     return conn->ops->impersonate_client(conn);
00226 }
00227 
00228 static inline RPC_STATUS rpcrt4_conn_revert_to_self(
00229     RpcConnection *conn)
00230 {
00231     return conn->ops->revert_to_self(conn);
00232 }
00233 
00234 static inline RPC_STATUS rpcrt4_conn_inquire_auth_client(
00235     RpcConnection *conn, RPC_AUTHZ_HANDLE *privs, RPC_WSTR *server_princ_name,
00236     ULONG *authn_level, ULONG *authn_svc, ULONG *authz_svc, ULONG flags)
00237 {
00238     return conn->ops->inquire_auth_client(conn, privs, server_princ_name, authn_level, authn_svc, authz_svc, flags);
00239 }
00240 
00241 /* floors 3 and up */
00242 RPC_STATUS RpcTransport_GetTopOfTower(unsigned char *tower_data, size_t *tower_size, const char *protseq, const char *networkaddr, const char *endpoint) DECLSPEC_HIDDEN;
00243 RPC_STATUS RpcTransport_ParseTopOfTower(const unsigned char *tower_data, size_t tower_size, char **protseq, char **networkaddr, char **endpoint) DECLSPEC_HIDDEN;
00244 
00245 void RPCRT4_SetThreadCurrentConnection(RpcConnection *Connection) DECLSPEC_HIDDEN;
00246 void RPCRT4_SetThreadCurrentCallHandle(RpcBinding *Binding) DECLSPEC_HIDDEN;
00247 RpcBinding *RPCRT4_GetThreadCurrentCallHandle(void) DECLSPEC_HIDDEN;
00248 void RPCRT4_PushThreadContextHandle(NDR_SCONTEXT SContext) DECLSPEC_HIDDEN;
00249 void RPCRT4_RemoveThreadContextHandle(NDR_SCONTEXT SContext) DECLSPEC_HIDDEN;
00250 NDR_SCONTEXT RPCRT4_PopThreadContextHandle(void) DECLSPEC_HIDDEN;
00251 
00252 #endif

Generated on Wed May 23 2012 04:23:52 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.