ReactOS 0.4.16-dev-1946-g52006dd
rpc_binding.h File Reference
#include "rpcndr.h"
#include "security.h"
#include "wine/list.h"
#include "rpc_defs.h"
Include dependency graph for rpc_binding.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _RpcAuthInfo
 
struct  _RpcQualityOfService
 
struct  _RpcConnection
 
struct  connection_ops
 
struct  _RpcBinding
 

Typedefs

typedef struct _RpcAuthInfo RpcAuthInfo
 
typedef struct _RpcQualityOfService RpcQualityOfService
 
typedef struct _RpcConnection RpcConnection
 
typedef struct _RpcBinding RpcBinding
 

Enumerations

enum  secure_packet_direction { SECURE_PACKET_SEND , SECURE_PACKET_RECEIVE }
 

Functions

LPWSTR RPCRT4_strndupW (LPCWSTR src, INT len)
 
LPSTR RPCRT4_strdupWtoA (LPCWSTR src)
 
LPWSTR RPCRT4_strdupAtoW (LPCSTR src)
 
RPC_STATUS RpcAuthInfo_Create (ULONG AuthnLevel, ULONG AuthnSvc, CredHandle cred, TimeStamp exp, ULONG cbMaxToken, RPC_AUTH_IDENTITY_HANDLE identity, RpcAuthInfo **ret)
 
ULONG RpcAuthInfo_AddRef (RpcAuthInfo *AuthInfo)
 
ULONG RpcAuthInfo_Release (RpcAuthInfo *AuthInfo)
 
BOOL RpcAuthInfo_IsEqual (const RpcAuthInfo *AuthInfo1, const RpcAuthInfo *AuthInfo2)
 
ULONG RpcQualityOfService_AddRef (RpcQualityOfService *qos)
 
ULONG RpcQualityOfService_Release (RpcQualityOfService *qos)
 
BOOL RpcQualityOfService_IsEqual (const RpcQualityOfService *qos1, const RpcQualityOfService *qos2)
 
RPC_STATUS RPCRT4_CreateConnection (RpcConnection **Connection, BOOL server, LPCSTR Protseq, LPCSTR NetworkAddr, LPCSTR Endpoint, LPCWSTR NetworkOptions, RpcAuthInfo *AuthInfo, RpcQualityOfService *QOS, LPCWSTR CookieAuth)
 
RpcConnectionRPCRT4_GrabConnection (RpcConnection *conn)
 
void RPCRT4_ReleaseConnection (RpcConnection *Connection)
 
RPC_STATUS RPCRT4_OpenClientConnection (RpcConnection *Connection)
 
RPC_STATUS RPCRT4_CloseConnection (RpcConnection *Connection)
 
RPC_STATUS RPCRT4_IsServerListening (const char *protseq, const char *endpoint)
 
RPC_STATUS RPCRT4_ResolveBinding (RpcBinding *Binding, LPCSTR Endpoint)
 
RPC_STATUS RPCRT4_SetBindingObject (RpcBinding *Binding, const UUID *ObjectUuid)
 
RPC_STATUS RPCRT4_MakeBinding (RpcBinding **Binding, RpcConnection *Connection)
 
void RPCRT4_AddRefBinding (RpcBinding *Binding)
 
RPC_STATUS RPCRT4_ReleaseBinding (RpcBinding *Binding)
 
RPC_STATUS RPCRT4_OpenBinding (RpcBinding *Binding, RpcConnection **Connection, const RPC_SYNTAX_IDENTIFIER *TransferSyntax, const RPC_SYNTAX_IDENTIFIER *InterfaceId, BOOL *from_cache)
 
RPC_STATUS RPCRT4_CloseBinding (RpcBinding *Binding, RpcConnection *Connection)
 
void rpcrt4_conn_release_and_wait (RpcConnection *connection)
 
static const charrpcrt4_conn_get_name (const RpcConnection *Connection)
 
static int rpcrt4_conn_read (RpcConnection *Connection, void *buffer, unsigned int len)
 
static int rpcrt4_conn_write (RpcConnection *Connection, const void *buffer, unsigned int len)
 
static int rpcrt4_conn_close (RpcConnection *Connection)
 
static void rpcrt4_conn_close_read (RpcConnection *connection)
 
static void rpcrt4_conn_cancel_call (RpcConnection *Connection)
 
static RPC_STATUS rpcrt4_conn_handoff (RpcConnection *old_conn, RpcConnection *new_conn)
 
static BOOL rpcrt4_conn_is_authorized (RpcConnection *Connection)
 
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)
 
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)
 
static RPC_STATUS rpcrt4_conn_impersonate_client (RpcConnection *conn)
 
static RPC_STATUS rpcrt4_conn_revert_to_self (RpcConnection *conn)
 
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)
 
RPC_STATUS RpcTransport_GetTopOfTower (unsigned char *tower_data, size_t *tower_size, const char *protseq, const char *networkaddr, const char *endpoint)
 
RPC_STATUS RpcTransport_ParseTopOfTower (const unsigned char *tower_data, size_t tower_size, char **protseq, char **networkaddr, char **endpoint)
 
void RPCRT4_SetThreadCurrentConnection (RpcConnection *Connection)
 
void RPCRT4_SetThreadCurrentCallHandle (RpcBinding *Binding)
 
RpcBindingRPCRT4_GetThreadCurrentCallHandle (void)
 
void RPCRT4_PushThreadContextHandle (NDR_SCONTEXT SContext)
 
void RPCRT4_RemoveThreadContextHandle (NDR_SCONTEXT SContext)
 
NDR_SCONTEXT RPCRT4_PopThreadContextHandle (void)
 

Typedef Documentation

◆ RpcAuthInfo

◆ RpcBinding

◆ RpcConnection

◆ RpcQualityOfService

Enumeration Type Documentation

◆ secure_packet_direction

Enumerator
SECURE_PACKET_SEND 
SECURE_PACKET_RECEIVE 

Definition at line 30 of file rpc_binding.h.

31{
34};
@ SECURE_PACKET_SEND
Definition: rpc_binding.h:32
@ SECURE_PACKET_RECEIVE
Definition: rpc_binding.h:33

Function Documentation

◆ RpcAuthInfo_AddRef()

ULONG RpcAuthInfo_AddRef ( RpcAuthInfo AuthInfo)

Definition at line 1165 of file rpc_binding.c.

1166{
1167 return InterlockedIncrement(&AuthInfo->refs);
1168}
#define InterlockedIncrement
Definition: armddk.h:53

Referenced by RpcBindingCopy(), and RPCRT4_CreateConnection().

◆ RpcAuthInfo_Create()

RPC_STATUS RpcAuthInfo_Create ( ULONG  AuthnLevel,
ULONG  AuthnSvc,
CredHandle  cred,
TimeStamp  exp,
ULONG  cbMaxToken,
RPC_AUTH_IDENTITY_HANDLE  identity,
RpcAuthInfo **  ret 
)

Definition at line 1099 of file rpc_binding.c.

1104{
1105 RpcAuthInfo *AuthInfo = malloc(sizeof(*AuthInfo));
1106 if (!AuthInfo)
1107 return RPC_S_OUT_OF_MEMORY;
1108
1109 AuthInfo->refs = 1;
1110 AuthInfo->AuthnLevel = AuthnLevel;
1111 AuthInfo->AuthnSvc = AuthnSvc;
1112 AuthInfo->cred = cred;
1113 AuthInfo->exp = exp;
1114 AuthInfo->cbMaxToken = cbMaxToken;
1115 AuthInfo->identity = identity;
1116 AuthInfo->server_principal_name = NULL;
1117
1118 /* duplicate the SEC_WINNT_AUTH_IDENTITY structure, if applicable, to
1119 * enable better matching in RpcAuthInfo_IsEqual */
1120 if (identity && has_nt_auth_identity(AuthnSvc))
1121 {
1122 const SEC_WINNT_AUTH_IDENTITY_W *nt_identity = identity;
1123 AuthInfo->nt_identity = malloc(sizeof(*AuthInfo->nt_identity));
1124 if (!AuthInfo->nt_identity)
1125 {
1126 free(AuthInfo);
1127 return RPC_S_OUT_OF_MEMORY;
1128 }
1129
1131 if (nt_identity->Flags & SEC_WINNT_AUTH_IDENTITY_UNICODE)
1132 AuthInfo->nt_identity->User = RPCRT4_strndupW(nt_identity->User, nt_identity->UserLength);
1133 else
1134 AuthInfo->nt_identity->User = RPCRT4_strndupAtoW((const char *)nt_identity->User, nt_identity->UserLength);
1135 AuthInfo->nt_identity->UserLength = nt_identity->UserLength;
1136 if (nt_identity->Flags & SEC_WINNT_AUTH_IDENTITY_UNICODE)
1137 AuthInfo->nt_identity->Domain = RPCRT4_strndupW(nt_identity->Domain, nt_identity->DomainLength);
1138 else
1139 AuthInfo->nt_identity->Domain = RPCRT4_strndupAtoW((const char *)nt_identity->Domain, nt_identity->DomainLength);
1140 AuthInfo->nt_identity->DomainLength = nt_identity->DomainLength;
1141 if (nt_identity->Flags & SEC_WINNT_AUTH_IDENTITY_UNICODE)
1142 AuthInfo->nt_identity->Password = RPCRT4_strndupW(nt_identity->Password, nt_identity->PasswordLength);
1143 else
1144 AuthInfo->nt_identity->Password = RPCRT4_strndupAtoW((const char *)nt_identity->Password, nt_identity->PasswordLength);
1145 AuthInfo->nt_identity->PasswordLength = nt_identity->PasswordLength;
1146
1147 if ((nt_identity->User && !AuthInfo->nt_identity->User) ||
1148 (nt_identity->Domain && !AuthInfo->nt_identity->Domain) ||
1149 (nt_identity->Password && !AuthInfo->nt_identity->Password))
1150 {
1151 free(AuthInfo->nt_identity->User);
1152 free(AuthInfo->nt_identity->Domain);
1153 free(AuthInfo->nt_identity->Password);
1154 free(AuthInfo->nt_identity);
1155 free(AuthInfo);
1156 return RPC_S_OUT_OF_MEMORY;
1157 }
1158 }
1159 else
1160 AuthInfo->nt_identity = NULL;
1161 *ret = AuthInfo;
1162 return RPC_S_OK;
1163}
#define free
Definition: debug_ros.c:5
#define malloc
Definition: debug_ros.c:4
#define NULL
Definition: types.h:112
return ret
Definition: mutex.c:146
DWORD exp
Definition: msg.c:16058
static BOOL has_nt_auth_identity(ULONG AuthnLevel)
Definition: rpc_binding.c:1086
LPWSTR RPCRT4_strndupW(LPCWSTR src, INT slen)
Definition: rpc_binding.c:79
static LPWSTR RPCRT4_strndupAtoW(LPCSTR src, INT slen)
Definition: rpc_binding.c:68
#define SEC_WINNT_AUTH_IDENTITY_UNICODE
Definition: rpcdce.h:310
#define RPC_S_OUT_OF_MEMORY
Definition: rpcnterr.h:24
#define RPC_S_OK
Definition: rpcnterr.h:22
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
unsigned short * Domain
Definition: rpcdce.h:225
unsigned short * User
Definition: rpcdce.h:223
unsigned short * Password
Definition: rpcdce.h:227

Referenced by RpcBindingSetAuthInfoExA(), RpcBindingSetAuthInfoExW(), and RPCRT4_ServerConnectionAuth().

◆ RpcAuthInfo_IsEqual()

BOOL RpcAuthInfo_IsEqual ( const RpcAuthInfo AuthInfo1,
const RpcAuthInfo AuthInfo2 
)

Definition at line 1191 of file rpc_binding.c.

1192{
1193 if (AuthInfo1 == AuthInfo2)
1194 return TRUE;
1195
1196 if (!AuthInfo1 || !AuthInfo2)
1197 return FALSE;
1198
1199 if ((AuthInfo1->AuthnLevel != AuthInfo2->AuthnLevel) ||
1200 (AuthInfo1->AuthnSvc != AuthInfo2->AuthnSvc))
1201 return FALSE;
1202
1203 if (AuthInfo1->identity == AuthInfo2->identity)
1204 return TRUE;
1205
1206 if (!AuthInfo1->identity || !AuthInfo2->identity)
1207 return FALSE;
1208
1209 if (has_nt_auth_identity(AuthInfo1->AuthnSvc))
1210 {
1211 const SEC_WINNT_AUTH_IDENTITY_W *identity1 = AuthInfo1->nt_identity;
1212 const SEC_WINNT_AUTH_IDENTITY_W *identity2 = AuthInfo2->nt_identity;
1213 /* compare user names */
1214 if (identity1->UserLength != identity2->UserLength ||
1215 memcmp(identity1->User, identity2->User, identity1->UserLength))
1216 return FALSE;
1217 /* compare domain names */
1218 if (identity1->DomainLength != identity2->DomainLength ||
1219 memcmp(identity1->Domain, identity2->Domain, identity1->DomainLength))
1220 return FALSE;
1221 /* compare passwords */
1222 if (identity1->PasswordLength != identity2->PasswordLength ||
1223 memcmp(identity1->Password, identity2->Password, identity1->PasswordLength))
1224 return FALSE;
1225 }
1226 else
1227 return FALSE;
1228
1229 return TRUE;
1230}
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117

Referenced by RpcAssoc_GetIdleConnection().

◆ RpcAuthInfo_Release()

ULONG RpcAuthInfo_Release ( RpcAuthInfo AuthInfo)

Definition at line 1170 of file rpc_binding.c.

1171{
1172 ULONG refs = InterlockedDecrement(&AuthInfo->refs);
1173
1174 if (!refs)
1175 {
1176 FreeCredentialsHandle(&AuthInfo->cred);
1177 if (AuthInfo->nt_identity)
1178 {
1179 free(AuthInfo->nt_identity->User);
1180 free(AuthInfo->nt_identity->Domain);
1181 free(AuthInfo->nt_identity->Password);
1182 free(AuthInfo->nt_identity);
1183 }
1184 free(AuthInfo->server_principal_name);
1185 free(AuthInfo);
1186 }
1187
1188 return refs;
1189}
#define InterlockedDecrement
Definition: armddk.h:52
uint32_t ULONG
Definition: typedefs.h:59
SECURITY_STATUS WINAPI FreeCredentialsHandle(PCredHandle phCredential)
Definition: wrapper.c:151

Referenced by get_epm_handle_client(), RpcBindingSetAuthInfoExA(), RpcBindingSetAuthInfoExW(), RPCRT4_ReleaseBinding(), RPCRT4_ReleaseConnection(), and RPCRT4_ServerConnectionAuth().

◆ RpcQualityOfService_AddRef()

ULONG RpcQualityOfService_AddRef ( RpcQualityOfService qos)

Definition at line 1342 of file rpc_binding.c.

1343{
1344 return InterlockedIncrement(&qos->refs);
1345}

Referenced by RpcBindingCopy(), and RPCRT4_CreateConnection().

◆ RpcQualityOfService_IsEqual()

BOOL RpcQualityOfService_IsEqual ( const RpcQualityOfService qos1,
const RpcQualityOfService qos2 
)

Definition at line 1372 of file rpc_binding.c.

1373{
1374 if (qos1 == qos2)
1375 return TRUE;
1376
1377 if (!qos1 || !qos2)
1378 return FALSE;
1379
1380 TRACE("qos1 = { %ld %ld %ld %ld }, qos2 = { %ld %ld %ld %ld }\n",
1381 qos1->qos->Capabilities, qos1->qos->IdentityTracking,
1383 qos2->qos->Capabilities, qos2->qos->IdentityTracking,
1385
1386 if ((qos1->qos->Capabilities != qos2->qos->Capabilities) ||
1387 (qos1->qos->IdentityTracking != qos2->qos->IdentityTracking) ||
1388 (qos1->qos->ImpersonationType != qos2->qos->ImpersonationType) ||
1390 return FALSE;
1391
1393 {
1394 const RPC_HTTP_TRANSPORT_CREDENTIALS_W *http_credentials1 = qos1->qos->u.HttpCredentials;
1395 const RPC_HTTP_TRANSPORT_CREDENTIALS_W *http_credentials2 = qos2->qos->u.HttpCredentials;
1396
1397 if (http_credentials1->Flags != http_credentials2->Flags)
1398 return FALSE;
1399
1400 if (http_credentials1->AuthenticationTarget != http_credentials2->AuthenticationTarget)
1401 return FALSE;
1402
1403 if (http_credentials1->NumberOfAuthnSchemes != http_credentials2->NumberOfAuthnSchemes)
1404 return FALSE;
1405
1406 if ((!http_credentials1->AuthnSchemes && http_credentials2->AuthnSchemes) ||
1407 (http_credentials1->AuthnSchemes && !http_credentials2->AuthnSchemes))
1408 return FALSE;
1409
1410 if (memcmp(http_credentials1->AuthnSchemes, http_credentials2->AuthnSchemes,
1411 http_credentials1->NumberOfAuthnSchemes * sizeof(http_credentials1->AuthnSchemes[0])))
1412 return FALSE;
1413
1414 /* server certificate subject not currently used */
1415
1416 if (http_credentials1->TransportCredentials != http_credentials2->TransportCredentials)
1417 {
1418 const SEC_WINNT_AUTH_IDENTITY_W *identity1 = http_credentials1->TransportCredentials;
1419 const SEC_WINNT_AUTH_IDENTITY_W *identity2 = http_credentials2->TransportCredentials;
1420
1421 if (!identity1 || !identity2)
1422 return FALSE;
1423
1424 /* compare user names */
1425 if (identity1->UserLength != identity2->UserLength ||
1426 memcmp(identity1->User, identity2->User, identity1->UserLength))
1427 return FALSE;
1428 /* compare domain names */
1429 if (identity1->DomainLength != identity2->DomainLength ||
1430 memcmp(identity1->Domain, identity2->Domain, identity1->DomainLength))
1431 return FALSE;
1432 /* compare passwords */
1433 if (identity1->PasswordLength != identity2->PasswordLength ||
1434 memcmp(identity1->Password, identity2->Password, identity1->PasswordLength))
1435 return FALSE;
1436 }
1437 }
1438
1439 return TRUE;
1440}
#define RPC_C_AUTHN_INFO_TYPE_HTTP
Definition: rpcdce.h:195
#define TRACE(s)
Definition: solgame.cpp:4
SEC_WINNT_AUTH_IDENTITY_W * TransportCredentials
Definition: rpcdce.h:245
union _RPC_SECURITY_QOS_V2_W::@3414 u
RPC_HTTP_TRANSPORT_CREDENTIALS_W * HttpCredentials
Definition: rpcdce.h:279
ULONG AdditionalSecurityInfoType
Definition: rpcdce.h:276
RPC_SECURITY_QOS_V2_W * qos
Definition: rpc_binding.h:57

Referenced by RpcAssoc_GetIdleConnection().

◆ RpcQualityOfService_Release()

ULONG RpcQualityOfService_Release ( RpcQualityOfService qos)

Definition at line 1347 of file rpc_binding.c.

1348{
1349 ULONG refs = InterlockedDecrement(&qos->refs);
1350
1351 if (!refs)
1352 {
1354 {
1356 {
1361 }
1364 free(qos->qos->u.HttpCredentials);
1365 }
1366 free(qos->qos);
1367 free(qos);
1368 }
1369 return refs;
1370}
unsigned short * ServerCertificateSubject
Definition: rpcdce.h:250

Referenced by RpcBindingSetAuthInfoExA(), RpcBindingSetAuthInfoExW(), RPCRT4_ReleaseBinding(), and RPCRT4_ReleaseConnection().

◆ RPCRT4_AddRefBinding()

void RPCRT4_AddRefBinding ( RpcBinding Binding)

Definition at line 232 of file rpc_binding.c.

233{
235}

Referenced by I_RpcNegotiateTransferSyntax().

◆ RPCRT4_CloseBinding()

RPC_STATUS RPCRT4_CloseBinding ( RpcBinding Binding,
RpcConnection Connection 
)

Definition at line 276 of file rpc_binding.c.

277{
278 TRACE("(Binding == ^%p)\n", Binding);
279 if (!Connection) return RPC_S_OK;
280 if (Binding->server) {
281 /* don't destroy a connection that is cached in the binding */
282 if (Binding->FromConn != Connection)
283 RPCRT4_ReleaseConnection(Connection);
284 }
285 else {
286 RpcAssoc_ReleaseIdleConnection(Binding->Assoc, Connection);
287 }
288 return RPC_S_OK;
289}
void RpcAssoc_ReleaseIdleConnection(RpcAssoc *assoc, RpcConnection *Connection)
Definition: rpc_assoc.c:437
void RPCRT4_ReleaseConnection(RpcConnection *Connection)

Referenced by I_RpcFreeBuffer().

◆ RPCRT4_CloseConnection()

RPC_STATUS RPCRT4_CloseConnection ( RpcConnection Connection)

Definition at line 3590 of file rpc_transport.c.

3591{
3592 TRACE("(Connection == ^%p)\n", Connection);
3593 if (SecIsValidHandle(&Connection->ctx))
3594 {
3595 DeleteSecurityContext(&Connection->ctx);
3596 SecInvalidateHandle(&Connection->ctx);
3597 }
3598 rpcrt4_conn_close(Connection);
3599 return RPC_S_OK;
3600}
#define SecIsValidHandle(x)
Definition: sspi.h:63
#define SecInvalidateHandle(x)
Definition: sspi.h:58
static int rpcrt4_conn_close(RpcConnection *Connection)
Definition: rpc_binding.h:196
CtxtHandle ctx
Definition: rpc_binding.h:74
SECURITY_STATUS WINAPI DeleteSecurityContext(PCtxtHandle phContext)
Definition: wrapper.c:450

Referenced by RPCRT4_ReleaseConnection(), and RPCRT4_server_thread().

◆ rpcrt4_conn_authorize()

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 
)
inlinestatic

Definition at line 221 of file rpc_binding.h.

224{
225 return conn->ops->authorize(conn, first_time, in_buffer, in_len, out_buffer, out_len);
226}
static unsigned char * in_buffer
Definition: iccvid.c:87
static HANDLE PIO_APC_ROUTINE PVOID PIO_STATUS_BLOCK ULONG PVOID ULONG PVOID out_buffer
Definition: file.c:100
const struct connection_ops * ops
Definition: rpc_binding.h:70

Referenced by RPCRT4_ClientConnectionAuth(), RPCRT4_Send(), and RPCRT4_ServerConnectionAuth().

◆ rpcrt4_conn_cancel_call()

static void rpcrt4_conn_cancel_call ( RpcConnection Connection)
inlinestatic

Definition at line 206 of file rpc_binding.h.

207{
208 Connection->ops->cancel_call(Connection);
209}

Referenced by rpc_cancel_thread().

◆ rpcrt4_conn_close()

static int rpcrt4_conn_close ( RpcConnection Connection)
inlinestatic

Definition at line 196 of file rpc_binding.h.

197{
198 return Connection->ops->close(Connection);
199}

Referenced by RPCRT4_CloseConnection().

◆ rpcrt4_conn_close_read()

static void rpcrt4_conn_close_read ( RpcConnection connection)
inlinestatic

Definition at line 201 of file rpc_binding.h.

202{
203 connection->ops->close_read(connection);
204}

Referenced by RPCRT4_server_thread().

◆ rpcrt4_conn_get_name()

static const char * rpcrt4_conn_get_name ( const RpcConnection Connection)
inlinestatic

Definition at line 179 of file rpc_binding.h.

180{
181 return Connection->ops->name;
182}

Referenced by process_bind_packet_no_send(), RPCRT4_MakeBinding(), and rpcrt4_spawn_connection().

◆ rpcrt4_conn_handoff()

static RPC_STATUS rpcrt4_conn_handoff ( RpcConnection old_conn,
RpcConnection new_conn 
)
inlinestatic

Definition at line 211 of file rpc_binding.h.

212{
213 return old_conn->ops->handoff(old_conn, new_conn);
214}

Referenced by rpcrt4_spawn_connection().

◆ rpcrt4_conn_impersonate_client()

static RPC_STATUS rpcrt4_conn_impersonate_client ( RpcConnection conn)
inlinestatic

Definition at line 237 of file rpc_binding.h.

239{
240 return conn->ops->impersonate_client(conn);
241}

Referenced by RpcImpersonateClient().

◆ rpcrt4_conn_inquire_auth_client()

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 
)
inlinestatic

Definition at line 249 of file rpc_binding.h.

252{
253 return conn->ops->inquire_auth_client(conn, privs, server_princ_name, authn_level, authn_svc, authz_svc, flags);
254}
GLbitfield flags
Definition: glext.h:7161

Referenced by RpcBindingInqAuthClientExW().

◆ rpcrt4_conn_is_authorized()

static BOOL rpcrt4_conn_is_authorized ( RpcConnection Connection)
inlinestatic

Definition at line 216 of file rpc_binding.h.

217{
218 return Connection->ops->is_authorized(Connection);
219}

Referenced by RPCRT4_ReceiveWithAuth(), and RPCRT4_Send().

◆ rpcrt4_conn_read()

static int rpcrt4_conn_read ( RpcConnection Connection,
void buffer,
unsigned int  len 
)
inlinestatic

Definition at line 184 of file rpc_binding.h.

186{
187 return Connection->ops->read(Connection, buffer, len);
188}
GLuint buffer
Definition: glext.h:5915
GLenum GLsizei len
Definition: glext.h:6722

Referenced by RPCRT4_default_receive_fragment().

◆ rpcrt4_conn_release_and_wait()

void rpcrt4_conn_release_and_wait ( RpcConnection connection)

Definition at line 3666 of file rpc_transport.c.

3667{
3668 HANDLE event = NULL;
3669
3670 if (connection->ref > 1)
3671 event = connection->wait_release = CreateEventW(NULL, TRUE, FALSE, NULL);
3672
3673 RPCRT4_ReleaseConnection(connection);
3674
3675 if(event)
3676 {
3679 }
3680}
#define CloseHandle
Definition: compat.h:739
#define INFINITE
Definition: serial.h:102
struct _cl_event * event
Definition: glext.h:7739
void RPCRT4_ReleaseConnection(RpcConnection *connection)
HANDLE wait_release
Definition: rpc_binding.h:66
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
HANDLE WINAPI DECLSPEC_HOTPATCH CreateEventW(IN LPSECURITY_ATTRIBUTES lpEventAttributes OPTIONAL, IN BOOL bManualReset, IN BOOL bInitialState, IN LPCWSTR lpName OPTIONAL)
Definition: synch.c:651

Referenced by RPCRT4_server_thread().

◆ rpcrt4_conn_revert_to_self()

static RPC_STATUS rpcrt4_conn_revert_to_self ( RpcConnection conn)
inlinestatic

Definition at line 243 of file rpc_binding.h.

245{
246 return conn->ops->revert_to_self(conn);
247}

Referenced by RpcRevertToSelfEx().

◆ rpcrt4_conn_secure_packet()

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 
)
inlinestatic

Definition at line 228 of file rpc_binding.h.

233{
234 return conn->ops->secure_packet(conn, dir, hdr, hdr_size, stub_data, stub_data_size, auth_hdr, auth_value, auth_value_size);
235}
unsigned int dir
Definition: maze.c:112
char hdr[14]
Definition: iptest.cpp:33

Referenced by RPCRT4_ReceiveWithAuth(), and RPCRT4_SendWithAuth().

◆ rpcrt4_conn_write()

static int rpcrt4_conn_write ( RpcConnection Connection,
const void buffer,
unsigned int  len 
)
inlinestatic

Definition at line 190 of file rpc_binding.h.

192{
193 return Connection->ops->write(Connection, buffer, len);
194}

Referenced by RPCRT4_SendWithAuth().

◆ RPCRT4_CreateConnection()

RPC_STATUS RPCRT4_CreateConnection ( RpcConnection **  Connection,
BOOL  server,
LPCSTR  Protseq,
LPCSTR  NetworkAddr,
LPCSTR  Endpoint,
LPCWSTR  NetworkOptions,
RpcAuthInfo AuthInfo,
RpcQualityOfService QOS,
LPCWSTR  CookieAuth 
)

Definition at line 3602 of file rpc_transport.c.

3605{
3606 static LONG next_id;
3607 const struct connection_ops *ops;
3608 RpcConnection* NewConnection;
3609
3610 ops = rpcrt4_get_conn_protseq_ops(Protseq);
3611 if (!ops)
3612 {
3613 FIXME("not supported for protseq %s\n", Protseq);
3615 }
3616
3617 NewConnection = ops->alloc();
3618 NewConnection->ref = 1;
3619 NewConnection->server = server;
3620 NewConnection->ops = ops;
3621 NewConnection->NetworkAddr = strdup(NetworkAddr);
3622 NewConnection->Endpoint = strdup(Endpoint);
3623 NewConnection->NetworkOptions = wcsdup(NetworkOptions);
3624 NewConnection->CookieAuth = wcsdup(CookieAuth);
3626 NewConnection->NextCallId = 1;
3627
3628 SecInvalidateHandle(&NewConnection->ctx);
3629 if (AuthInfo) RpcAuthInfo_AddRef(AuthInfo);
3630 NewConnection->AuthInfo = AuthInfo;
3631 NewConnection->auth_context_id = InterlockedIncrement( &next_id );
3633 NewConnection->QOS = QOS;
3634
3635 list_init(&NewConnection->conn_pool_entry);
3636 list_init(&NewConnection->protseq_entry);
3637
3638 TRACE("connection: %p\n", NewConnection);
3639 *Connection = NewConnection;
3640
3641 return RPC_S_OK;
3642}
static void list_init(struct list_entry *head)
Definition: list.h:51
#define FIXME(fmt,...)
Definition: precomp.h:53
long LONG
Definition: pedump.c:60
ULONG RpcAuthInfo_AddRef(RpcAuthInfo *AuthInfo)
Definition: rpc_binding.c:1165
ULONG RpcQualityOfService_AddRef(RpcQualityOfService *qos)
Definition: rpc_binding.c:1342
#define RPC_MAX_PACKET_SIZE
Definition: rpc_defs.h:184
static const struct connection_ops * rpcrt4_get_conn_protseq_ops(const char *protseq)
_Check_return_ _CRTIMP char *__cdecl strdup(_In_opt_z_ const char *_Src)
_Check_return_ _CRTIMP wchar_t *__cdecl wcsdup(_In_z_ const wchar_t *_Str)
LPSTR NetworkAddr
Definition: rpc_binding.h:67
struct list conn_pool_entry
Definition: rpc_binding.h:85
RpcAuthInfo * AuthInfo
Definition: rpc_binding.h:77
USHORT NextCallId
Definition: rpc_binding.h:93
LPWSTR NetworkOptions
Definition: rpc_binding.h:69
USHORT MaxTransmissionSize
Definition: rpc_binding.h:71
RpcQualityOfService * QOS
Definition: rpc_binding.h:81
struct list protseq_entry
Definition: rpc_binding.h:94
LPWSTR CookieAuth
Definition: rpc_binding.h:82
ULONG auth_context_id
Definition: rpc_binding.h:78
RpcConnection *(* alloc)(void)
Definition: rpc_binding.h:102
static rfbScreenInfoPtr server
Definition: vnc.c:74
#define RPC_S_PROTSEQ_NOT_SUPPORTED
Definition: winerror.h:1370
struct _QualityOfService QOS

Referenced by RpcAssoc_GetClientConnection(), rpcrt4_protseq_ncacn_ip_tcp_open_endpoint(), rpcrt4_protseq_ncacn_np_open_endpoint(), rpcrt4_protseq_ncalrpc_open_endpoint(), and rpcrt4_spawn_connection().

◆ RPCRT4_GetThreadCurrentCallHandle()

RpcBinding * RPCRT4_GetThreadCurrentCallHandle ( void  )

Definition at line 1003 of file rpcrt4_main.c.

1004{
1005 struct threaddata *tdata = get_or_create_threaddata();
1006 if (!tdata) return NULL;
1007
1008 return tdata->server_binding;
1009}
static struct threaddata * get_or_create_threaddata(void)
Definition: rpcrt4_main.c:963
RpcBinding * server_binding
Definition: rpcrt4_main.c:94

Referenced by I_RpcBindingInqLocalClientPID(), and I_RpcGetCurrentCallHandle().

◆ RPCRT4_GrabConnection()

RpcConnection * RPCRT4_GrabConnection ( RpcConnection conn)

Definition at line 3682 of file rpc_transport.c.

3683{
3684 LONG ref = InterlockedIncrement(&connection->ref);
3685 TRACE("%p ref=%lu\n", connection, ref);
3686 return connection;
3687}
Definition: send.c:48

Referenced by RPCRT4_io_thread(), and RPCRT4_server_thread().

◆ RPCRT4_IsServerListening()

RPC_STATUS RPCRT4_IsServerListening ( const char protseq,
const char endpoint 
)

Definition at line 3732 of file rpc_transport.c.

3733{
3734 const struct connection_ops *ops;
3735
3736 ops = rpcrt4_get_conn_protseq_ops(protseq);
3737 if (!ops)
3738 {
3739 FIXME("not supported for protseq %s\n", protseq);
3740 return RPC_S_INVALID_BINDING;
3741 }
3742
3743 return ops->is_server_listening(endpoint);
3744}
RPC_STATUS(* is_server_listening)(const char *endpoint)
Definition: rpc_binding.h:110
Definition: nis.h:10
#define RPC_S_INVALID_BINDING
Definition: winerror.h:1369

Referenced by RpcMgmtIsServerListening().

◆ RPCRT4_MakeBinding()

RPC_STATUS RPCRT4_MakeBinding ( RpcBinding **  Binding,
RpcConnection Connection 
)

Definition at line 215 of file rpc_binding.c.

216{
217 RpcBinding* NewBinding;
218 TRACE("(RpcBinding == ^%p, Connection == ^%p)\n", Binding, Connection);
219
220 RPCRT4_AllocBinding(&NewBinding, Connection->server);
221 NewBinding->Protseq = strdup(rpcrt4_conn_get_name(Connection));
222 NewBinding->NetworkAddr = strdup(Connection->NetworkAddr);
223 NewBinding->Endpoint = strdup(Connection->Endpoint);
224 NewBinding->FromConn = Connection;
225
226 TRACE("binding: %p\n", NewBinding);
227 *Binding = NewBinding;
228
229 return RPC_S_OK;
230}
static RPC_STATUS RPCRT4_AllocBinding(RpcBinding **Binding, BOOL server)
Definition: rpc_binding.c:92
static const char * rpcrt4_conn_get_name(const RpcConnection *Connection)
Definition: rpc_binding.h:179
LPSTR NetworkAddr
Definition: rpc_binding.h:132
RpcConnection * FromConn
Definition: rpc_binding.h:137
LPSTR Endpoint
Definition: rpc_binding.h:133
LPSTR Protseq
Definition: rpc_binding.h:131

Referenced by process_bind_packet_no_send(), and RpcServerInqBindings().

◆ RPCRT4_OpenBinding()

RPC_STATUS RPCRT4_OpenBinding ( RpcBinding Binding,
RpcConnection **  Connection,
const RPC_SYNTAX_IDENTIFIER TransferSyntax,
const RPC_SYNTAX_IDENTIFIER InterfaceId,
BOOL from_cache 
)

Definition at line 255 of file rpc_binding.c.

258{
259 TRACE("(Binding == ^%p)\n", Binding);
260
261 if (!Binding->server) {
262 return RpcAssoc_GetClientConnection(Binding->Assoc, InterfaceId,
263 TransferSyntax, Binding->AuthInfo, Binding->QOS, Binding->CookieAuth, Connection, from_cache);
264 } else {
265 /* we already have a connection with acceptable binding, so use it */
266 if (Binding->FromConn) {
267 *Connection = Binding->FromConn;
268 return RPC_S_OK;
269 } else {
270 ERR("no connection in binding\n");
272 }
273 }
274}
#define ERR(fmt,...)
Definition: precomp.h:57
RPC_STATUS RpcAssoc_GetClientConnection(RpcAssoc *assoc, const RPC_SYNTAX_IDENTIFIER *InterfaceId, const RPC_SYNTAX_IDENTIFIER *TransferSyntax, RpcAuthInfo *AuthInfo, RpcQualityOfService *QOS, LPCWSTR CookieAuth, RpcConnection **Connection, BOOL *from_cache)
Definition: rpc_assoc.c:390
#define RPC_S_INTERNAL_ERROR
Definition: winerror.h:1431

Referenced by I_RpcNegotiateTransferSyntax(), and I_RpcSend().

◆ RPCRT4_OpenClientConnection()

RPC_STATUS RPCRT4_OpenClientConnection ( RpcConnection Connection)

Definition at line 3582 of file rpc_transport.c.

3583{
3584 TRACE("(Connection == ^%p)\n", Connection);
3585
3586 assert(!Connection->server);
3587 return Connection->ops->open_connection_client(Connection);
3588}
#define assert(x)
Definition: debug.h:53

Referenced by RpcAssoc_GetClientConnection().

◆ RPCRT4_PopThreadContextHandle()

NDR_SCONTEXT RPCRT4_PopThreadContextHandle ( void  )

Definition at line 1047 of file rpcrt4_main.c.

1048{
1049 struct threaddata *tdata = get_or_create_threaddata();
1052
1053 if (!tdata) return NULL;
1054
1056 if (!context_handle_list) return NULL;
1058
1061 return context_handle;
1062}
NDR_SCONTEXT context_handle
Definition: rpcrt4_main.c:85
struct context_handle_list * next
Definition: rpcrt4_main.c:84
struct context_handle_list * context_handle_list
Definition: rpcrt4_main.c:95

Referenced by process_request_packet().

◆ RPCRT4_PushThreadContextHandle()

void RPCRT4_PushThreadContextHandle ( NDR_SCONTEXT  SContext)

Definition at line 1011 of file rpcrt4_main.c.

1012{
1013 struct threaddata *tdata = get_or_create_threaddata();
1015
1016 if (!tdata) return;
1017
1019 if (!context_handle_list) return;
1020
1024}

Referenced by NDRSContextUnmarshall2().

◆ RPCRT4_ReleaseBinding()

RPC_STATUS RPCRT4_ReleaseBinding ( RpcBinding Binding)

Definition at line 237 of file rpc_binding.c.

238{
239 if (InterlockedDecrement(&Binding->refs))
240 return RPC_S_OK;
241
242 TRACE("binding: %p\n", Binding);
243 if (Binding->Assoc) RpcAssoc_Release(Binding->Assoc);
244 free(Binding->Endpoint);
245 free(Binding->NetworkAddr);
246 free(Binding->Protseq);
247 free(Binding->NetworkOptions);
248 free(Binding->CookieAuth);
249 if (Binding->AuthInfo) RpcAuthInfo_Release(Binding->AuthInfo);
251 free(Binding);
252 return RPC_S_OK;
253}
ULONG RpcAssoc_Release(RpcAssoc *assoc)
Definition: rpc_assoc.c:187
ULONG RpcAuthInfo_Release(RpcAuthInfo *AuthInfo)
Definition: rpc_binding.c:1170
ULONG RpcQualityOfService_Release(RpcQualityOfService *qos)
Definition: rpc_binding.c:1347

Referenced by I_RpcFreeBuffer(), RpcBindingFree(), RpcBindingFromStringBindingA(), RpcBindingFromStringBindingW(), and RPCRT4_ReleaseConnection().

◆ RPCRT4_ReleaseConnection()

void RPCRT4_ReleaseConnection ( RpcConnection Connection)

Definition at line 3689 of file rpc_transport.c.

3690{
3691 LONG ref;
3692
3693 /* protseq stores a list of active connections, but does not own references to them.
3694 * It may need to grab a connection from the list, which could lead to a race if
3695 * connection is being released, but not yet removed from the list. We handle that
3696 * by synchronizing on CS here. */
3697 if (connection->protseq)
3698 {
3699 EnterCriticalSection(&connection->protseq->cs);
3700 ref = InterlockedDecrement(&connection->ref);
3701 if (!ref)
3702 list_remove(&connection->protseq_entry);
3703 LeaveCriticalSection(&connection->protseq->cs);
3704 }
3705 else
3706 {
3707 ref = InterlockedDecrement(&connection->ref);
3708 }
3709
3710 TRACE("%p ref=%lu\n", connection, ref);
3711
3712 if (!ref)
3713 {
3714 RPCRT4_CloseConnection(connection);
3715 free(connection->Endpoint);
3716 free(connection->NetworkAddr);
3717 free(connection->NetworkOptions);
3718 free(connection->CookieAuth);
3719 if (connection->AuthInfo) RpcAuthInfo_Release(connection->AuthInfo);
3720 if (connection->QOS) RpcQualityOfService_Release(connection->QOS);
3721
3722 /* server-only */
3723 if (connection->server_binding) RPCRT4_ReleaseBinding(connection->server_binding);
3724 else if (connection->assoc) RpcAssoc_ConnectionReleased(connection->assoc);
3725
3726 if (connection->wait_release) SetEvent(connection->wait_release);
3727
3728 free(connection);
3729 }
3730}
static void list_remove(struct list_entry *entry)
Definition: list.h:90
void RpcAssoc_ConnectionReleased(RpcAssoc *assoc)
Definition: rpc_assoc.c:447
RPC_STATUS RPCRT4_ReleaseBinding(RpcBinding *Binding)
Definition: rpc_binding.c:237
RPC_STATUS RPCRT4_CloseConnection(RpcConnection *Connection)
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
Definition: synch.c:733
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)

Referenced by I_RpcReceive(), I_RpcSend(), RpcAssoc_GetClientConnection(), RpcAssoc_Release(), RPCRT4_CloseBinding(), rpcrt4_conn_release_and_wait(), RPCRT4_io_thread(), RPCRT4_new_client(), rpcrt4_protseq_ncacn_ip_tcp_open_endpoint(), and RPCRT4_worker_thread().

◆ RPCRT4_RemoveThreadContextHandle()

void RPCRT4_RemoveThreadContextHandle ( NDR_SCONTEXT  SContext)

Definition at line 1026 of file rpcrt4_main.c.

1027{
1028 struct threaddata *tdata = get_or_create_threaddata();
1029 struct context_handle_list *current, *prev;
1030
1031 if (!tdata) return;
1032
1033 for (current = tdata->context_handle_list, prev = NULL; current; prev = current, current = current->next)
1034 {
1035 if (current->context_handle == SContext)
1036 {
1037 if (prev)
1038 prev->next = current->next;
1039 else
1040 tdata->context_handle_list = current->next;
1041 free(current);
1042 return;
1043 }
1044 }
1045}
struct task_struct * current
Definition: linux.c:32

Referenced by NDRSContextMarshall2().

◆ RPCRT4_ResolveBinding()

RPC_STATUS RPCRT4_ResolveBinding ( RpcBinding Binding,
LPCSTR  Endpoint 
)

Definition at line 187 of file rpc_binding.c.

188{
190
191 TRACE("(RpcBinding == ^%p, EndPoint == \"%s\"\n", Binding, Endpoint);
192
193 free(Binding->Endpoint);
194 Binding->Endpoint = strdup(Endpoint);
195
196 if (Binding->Assoc) RpcAssoc_Release(Binding->Assoc);
197 Binding->Assoc = NULL;
198 status = RPCRT4_GetAssociation(Binding->Protseq, Binding->NetworkAddr,
199 Binding->Endpoint, Binding->NetworkOptions,
200 &Binding->Assoc);
201 if (status != RPC_S_OK)
202 return status;
203
204 return RPC_S_OK;
205}
RPC_STATUS RPCRT4_GetAssociation(LPCSTR Protseq, LPCSTR NetworkAddr, LPCSTR Endpoint, LPCWSTR NetworkOptions, RpcAssoc **assoc_out)
Definition: rpc_assoc.c:98
long RPC_STATUS
Definition: rpc.h:48
Definition: ps.c:97

Referenced by get_epm_handle_client(), and RpcEpResolveBinding().

◆ RPCRT4_SetBindingObject()

RPC_STATUS RPCRT4_SetBindingObject ( RpcBinding Binding,
const UUID ObjectUuid 
)

Definition at line 207 of file rpc_binding.c.

208{
209 TRACE("(*RpcBinding == ^%p, UUID == %s)\n", Binding, debugstr_guid(ObjectUuid));
210 if (ObjectUuid) Binding->ObjectUuid = *ObjectUuid;
211 else UuidCreateNil(&Binding->ObjectUuid);
212 return RPC_S_OK;
213}
#define debugstr_guid
Definition: kernel32.h:35
RPC_STATUS WINAPI UuidCreateNil(UUID *Uuid)
Definition: rpcrt4_main.c:309

Referenced by process_request_packet(), RpcBindingFromStringBindingA(), RpcBindingFromStringBindingW(), and RpcBindingSetObject().

◆ RPCRT4_SetThreadCurrentCallHandle()

void RPCRT4_SetThreadCurrentCallHandle ( RpcBinding Binding)

Definition at line 995 of file rpcrt4_main.c.

996{
997 struct threaddata *tdata = get_or_create_threaddata();
998 if (!tdata) return;
999
1000 tdata->server_binding = Binding;
1001}

Referenced by process_request_packet().

◆ RPCRT4_SetThreadCurrentConnection()

void RPCRT4_SetThreadCurrentConnection ( RpcConnection Connection)

Definition at line 985 of file rpcrt4_main.c.

986{
987 struct threaddata *tdata = get_or_create_threaddata();
988 if (!tdata) return;
989
990 EnterCriticalSection(&tdata->cs);
991 tdata->connection = Connection;
992 LeaveCriticalSection(&tdata->cs);
993}
RpcConnection * connection
Definition: rpcrt4_main.c:93
CRITICAL_SECTION cs
Definition: rpcrt4_main.c:91

Referenced by RPCRT4_ReceiveWithAuth(), and RPCRT4_SendWithAuth().

◆ RPCRT4_strdupAtoW()

LPWSTR RPCRT4_strdupAtoW ( LPCSTR  src)

Definition at line 57 of file rpc_binding.c.

58{
59 DWORD len;
60 LPWSTR s;
61 if (!src) return NULL;
62 len = MultiByteToWideChar(CP_ACP, 0, src, -1, NULL, 0);
63 s = malloc(len * sizeof(WCHAR));
65 return s;
66}
#define CP_ACP
Definition: compat.h:109
#define MultiByteToWideChar
Definition: compat.h:110
unsigned long DWORD
Definition: ntddk_ex.h:95
GLdouble s
Definition: gl.h:2039
GLenum src
Definition: glext.h:6340
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by RpcBindingSetAuthInfoExA(), RpcBindingToStringBindingW(), RpcQualityOfService_Create(), RPCRT4_CompleteBindingA(), RpcServerRegisterAuthInfoA(), and UuidToStringW().

◆ RPCRT4_strdupWtoA()

◆ RPCRT4_strndupW()

LPWSTR RPCRT4_strndupW ( LPCWSTR  src,
INT  len 
)

Definition at line 79 of file rpc_binding.c.

80{
81 DWORD len;
82 LPWSTR s;
83 if (!src) return NULL;
84 if (slen == -1) slen = lstrlenW(src);
85 len = slen;
86 s = malloc((len + 1) * sizeof(WCHAR));
87 memcpy(s, src, len*sizeof(WCHAR));
88 s[len] = 0;
89 return s;
90}
#define lstrlenW
Definition: compat.h:750
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878

Referenced by RpcAuthInfo_Create(), RpcQualityOfService_Create(), and rpcrt4_http_internet_connect().

◆ RpcTransport_GetTopOfTower()

RPC_STATUS RpcTransport_GetTopOfTower ( unsigned char tower_data,
size_t tower_size,
const char protseq,
const char networkaddr,
const char endpoint 
)

Definition at line 3746 of file rpc_transport.c.

3751{
3752 twr_empty_floor_t *protocol_floor;
3754
3755 *tower_size = 0;
3756
3757 if (!protseq_ops)
3759
3760 if (!tower_data)
3761 {
3762 *tower_size = sizeof(*protocol_floor);
3763 *tower_size += protseq_ops->get_top_of_tower(NULL, networkaddr, endpoint);
3764 return RPC_S_OK;
3765 }
3766
3767 protocol_floor = (twr_empty_floor_t *)tower_data;
3768 protocol_floor->count_lhs = sizeof(protocol_floor->protid);
3769 protocol_floor->protid = protseq_ops->epm_protocols[0];
3770 protocol_floor->count_rhs = 0;
3771
3772 tower_data += sizeof(*protocol_floor);
3773
3774 *tower_size = protseq_ops->get_top_of_tower(tower_data, networkaddr, endpoint);
3775 if (!*tower_size)
3776 return EPT_S_NOT_REGISTERED;
3777
3778 *tower_size += sizeof(*protocol_floor);
3779
3780 return RPC_S_OK;
3781}
u_int16 count_lhs
Definition: epm_towers.h:81
u_int16 count_rhs
Definition: epm_towers.h:83
#define EPT_S_NOT_REGISTERED
Definition: winerror.h:1418
#define RPC_S_INVALID_RPC_PROTSEQ
Definition: winerror.h:1371

Referenced by TowerConstruct().

◆ RpcTransport_ParseTopOfTower()

RPC_STATUS RpcTransport_ParseTopOfTower ( const unsigned char tower_data,
size_t  tower_size,
char **  protseq,
char **  networkaddr,
char **  endpoint 
)

Definition at line 3783 of file rpc_transport.c.

3788{
3789 const twr_empty_floor_t *protocol_floor;
3790 const twr_empty_floor_t *floor4;
3791 const struct connection_ops *protseq_ops = NULL;
3793 unsigned int i;
3794
3795 if (tower_size < sizeof(*protocol_floor))
3796 return EPT_S_NOT_REGISTERED;
3797
3798 protocol_floor = (const twr_empty_floor_t *)tower_data;
3799 tower_data += sizeof(*protocol_floor);
3800 tower_size -= sizeof(*protocol_floor);
3801 if ((protocol_floor->count_lhs != sizeof(protocol_floor->protid)) ||
3802 (protocol_floor->count_rhs > tower_size))
3803 return EPT_S_NOT_REGISTERED;
3804 tower_data += protocol_floor->count_rhs;
3805 tower_size -= protocol_floor->count_rhs;
3806
3807 floor4 = (const twr_empty_floor_t *)tower_data;
3808 if ((tower_size < sizeof(*floor4)) ||
3809 (floor4->count_lhs != sizeof(floor4->protid)))
3810 return EPT_S_NOT_REGISTERED;
3811
3812 for(i = 0; i < ARRAY_SIZE(conn_protseq_list); i++)
3813 if ((protocol_floor->protid == conn_protseq_list[i].epm_protocols[0]) &&
3814 (floor4->protid == conn_protseq_list[i].epm_protocols[1]))
3815 {
3817 break;
3818 }
3819
3820 if (!protseq_ops)
3821 return EPT_S_NOT_REGISTERED;
3822
3823 status = protseq_ops->parse_top_of_tower(tower_data, tower_size, networkaddr, endpoint);
3824
3825 if ((status == RPC_S_OK) && protseq)
3826 {
3827 *protseq = I_RpcAllocate(strlen(protseq_ops->name) + 1);
3828 strcpy(*protseq, protseq_ops->name);
3829 }
3830
3831 return status;
3832}
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define ARRAY_SIZE(A)
Definition: main.h:20
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
static const struct connection_ops conn_protseq_list[]
void *WINAPI I_RpcAllocate(unsigned int Size)
Definition: rpcrt4_main.c:747
strcpy
Definition: string.h:131
const char * name
Definition: rpc_server.h:50

Referenced by TowerExplode().