27#include "wine/winternl.h"
42 0, 0, { (
DWORD_PTR)(__FILE__
": assoc_list_cs") }
91 if ((opts1 ==
NULL) && (opts2 ==
NULL))
93 if ((opts1 ==
NULL) || (opts2 ==
NULL))
95 return !
wcscmp(opts1, opts2);
116 TRACE(
"using existing assoc %p\n", assoc);
132 TRACE(
"new assoc %p\n", assoc);
161 TRACE(
"using existing assoc %p\n", assoc);
182 TRACE(
"new assoc %p\n", assoc);
192 refs = --assoc->
refs;
202 TRACE(
"destroying assoc %p\n", assoc);
227#define ROUND_UP(value, alignment) (((value) + ((alignment) - 1)) & ~((alignment)-1))
237 unsigned char *auth_data =
NULL;
240 TRACE(
"sending bind request to server\n");
245 InterfaceId, TransferSyntax);
255 ERR(
"receive failed with error %d\n",
status);
267 unsigned short remaining =
msg.BufferLength -
271 if ((
results->num_results == 1) &&
274 switch (
results->results[0].result)
290 switch (
results->results[0].reason)
293 ERR(
"syntax %s, %d.%d not supported\n",
300 ERR(
"transfer syntax not supported\n");
310 ERR(
"rejection result %d\n",
results->results[0].result);
316 ERR(
"incorrect results size\n");
322 ERR(
"bind ack packet too small (%d)\n",
msg.BufferLength);
332 ERR(
"server too busy\n");
336 ERR(
"protocol version not supported\n");
340 ERR(
"unknown authentication service\n");
344 ERR(
"invalid checksum\n");
353 ERR(
"wrong packet type received %d\n", response_hdr->
common.
ptype);
381 TRACE(
"got connection from pool %p\n", Connection);
401 TRACE(
"return idle connection %p for association %p\n", *Connection, assoc);
402 if (from_cache) *from_cache =
TRUE;
410 AuthInfo,
QOS, CookieAuth);
414 NewConnection->
assoc = assoc;
431 TRACE(
"return new connection %p for association %p\n", *Connection, assoc);
432 *Connection = NewConnection;
433 if (from_cache) *from_cache =
FALSE;
452 TRACE(
"Last %p connection released\n", assoc);
467 context_handle->
refs = 1;
484 return context_handle->
ctx_guard == CtxGuard;
499 if (context_handle->refs++)
502 TRACE(
"found %p\n", context_handle);
510 ERR(
"no context handle found for uuid %s, guard %p\n",
530 context_handle->
refs++;
533 TRACE(
"allocated uuid %s for context handle %p\n",
549 TRACE(
"freeing %p\n", context_handle);
553 TRACE(
"calling rundown routine %p with user context %p\n",
572 refs = --context_handle->
refs;
static struct _test_info results[8]
int strcmp(const char *String1, const char *String2)
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
#define InterlockedIncrement
#define InterlockedDecrement
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
static void list_remove(struct list_entry *entry)
static void list_add_tail(struct list_entry *head, struct list_entry *entry)
static void list_add_head(struct list_entry *head, struct list_entry *entry)
static void list_init(struct list_entry *head)
#define HeapFree(x, y, z)
#define ERROR_INVALID_HANDLE
NTSYSAPI VOID NTAPI RtlInitializeResource(_In_ PRTL_RESOURCE Resource)
NTSYSAPI BOOLEAN NTAPI RtlAcquireResourceExclusive(_In_ PRTL_RESOURCE Resource, _In_ BOOLEAN Wait)
NTSYSAPI VOID NTAPI RtlDeleteResource(_In_ PRTL_RESOURCE Resource)
NTSYSAPI VOID NTAPI RtlReleaseResource(_In_ PRTL_RESOURCE Resource)
struct _RpcContextHandle RpcContextHandle
RPC_STATUS RpcServerAssoc_FindContextHandle(RpcAssoc *assoc, const UUID *uuid, void *CtxGuard, ULONG Flags, NDR_SCONTEXT *SContext)
RPC_STATUS RPCRT4_GetAssociation(LPCSTR Protseq, LPCSTR NetworkAddr, LPCSTR Endpoint, LPCWSTR NetworkOptions, RpcAssoc **assoc_out)
void RpcAssoc_ConnectionReleased(RpcAssoc *assoc)
static LONG last_assoc_group_id
#define ROUND_UP(value, alignment)
void RpcAssoc_ReleaseIdleConnection(RpcAssoc *assoc, RpcConnection *Connection)
static CRITICAL_SECTION_DEBUG assoc_list_cs_debug
void RpcContextHandle_GetUuid(NDR_SCONTEXT SContext, UUID *uuid)
RPC_STATUS RpcServerAssoc_UpdateContextHandle(RpcAssoc *assoc, NDR_SCONTEXT SContext, void *CtxGuard, NDR_RUNDOWN rundown_routine)
static void RpcContextHandle_Destroy(RpcContextHandle *context_handle)
static RpcConnection * RpcAssoc_GetIdleConnection(RpcAssoc *assoc, const RPC_SYNTAX_IDENTIFIER *InterfaceId, const RPC_SYNTAX_IDENTIFIER *TransferSyntax, const RpcAuthInfo *AuthInfo, const RpcQualityOfService *QOS)
BOOL RpcContextHandle_IsGuardCorrect(NDR_SCONTEXT SContext, void *CtxGuard)
static BOOL compare_networkoptions(LPCWSTR opts1, LPCWSTR opts2)
static struct list server_assoc_list
static RPC_STATUS RpcAssoc_Alloc(LPCSTR Protseq, LPCSTR NetworkAddr, LPCSTR Endpoint, LPCWSTR NetworkOptions, RpcAssoc **assoc_out)
unsigned int RpcServerAssoc_ReleaseContextHandle(RpcAssoc *assoc, NDR_SCONTEXT SContext, BOOL release_lock)
ULONG RpcAssoc_Release(RpcAssoc *assoc)
static RPC_STATUS RpcAssoc_BindConnection(const RpcAssoc *assoc, RpcConnection *conn, const RPC_SYNTAX_IDENTIFIER *InterfaceId, const RPC_SYNTAX_IDENTIFIER *TransferSyntax)
RPC_STATUS RpcServerAssoc_GetAssociation(LPCSTR Protseq, LPCSTR NetworkAddr, LPCSTR Endpoint, LPCWSTR NetworkOptions, ULONG assoc_gid, RpcAssoc **assoc_out)
RPC_STATUS RpcServerAssoc_AllocateContextHandle(RpcAssoc *assoc, void *CtxGuard, NDR_SCONTEXT *SContext)
static struct list client_assoc_list
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)
static CRITICAL_SECTION assoc_list_cs
BOOL RpcAuthInfo_IsEqual(const RpcAuthInfo *AuthInfo1, const RpcAuthInfo *AuthInfo2)
BOOL RpcQualityOfService_IsEqual(const RpcQualityOfService *qos1, const RpcQualityOfService *qos2)
#define RPCRT4_strdupA(x)
RPC_STATUS RPCRT4_OpenClientConnection(RpcConnection *Connection) DECLSPEC_HIDDEN
void RPCRT4_ReleaseConnection(RpcConnection *Connection) DECLSPEC_HIDDEN
#define RPCRT4_strdupW(x)
RPC_STATUS RPCRT4_CreateConnection(RpcConnection **Connection, BOOL server, LPCSTR Protseq, LPCSTR NetworkAddr, LPCSTR Endpoint, LPCWSTR NetworkOptions, RpcAuthInfo *AuthInfo, RpcQualityOfService *QOS, LPCWSTR CookieAuth) DECLSPEC_HIDDEN
#define REASON_ABSTRACT_SYNTAX_NOT_SUPPORTED
#define REJECT_PROTOCOL_VERSION_NOT_SUPPORTED
#define REJECT_INVALID_CHECKSUM
#define REJECT_LOCAL_LIMIT_EXCEEDED
#define REASON_TRANSFER_SYNTAXES_NOT_SUPPORTED
#define REJECT_UNKNOWN_AUTHN_SERVICE
#define RESULT_PROVIDER_REJECTION
#define RPC_MAX_PACKET_SIZE
#define REJECT_TEMPORARY_CONGESTION
#define RESULT_USER_REJECTION
RPC_STATUS RPCRT4_ReceiveWithAuth(RpcConnection *Connection, RpcPktHdr **Header, PRPC_MESSAGE pMsg, unsigned char **auth_data_out, ULONG *auth_length_out)
VOID RPCRT4_FreeHeader(RpcPktHdr *Header)
RpcPktHdr * RPCRT4_BuildBindHeader(ULONG DataRepresentation, unsigned short MaxTransmissionSize, unsigned short MaxReceiveSize, ULONG AssocGroupId, const RPC_SYNTAX_IDENTIFIER *AbstractId, const RPC_SYNTAX_IDENTIFIER *TransferId)
RPC_STATUS RPCRT4_Send(RpcConnection *Connection, RpcPktHdr *Header, void *Buffer, unsigned int BufferLength)
RPC_STATUS RPCRT4_ClientConnectionAuth(RpcConnection *conn, BYTE *challenge, ULONG count)
#define NDR_LOCAL_DATA_REPRESENTATION
struct _NDR_SCONTEXT * NDR_SCONTEXT
void(__RPC_USER * NDR_RUNDOWN)(void *context)
#define RPC_S_OUT_OF_MEMORY
#define RPC_S_ACCESS_DENIED
int WINAPI UuidIsNil(UUID *Uuid, RPC_STATUS *Status)
void WINAPI I_RpcFree(void *Object)
RPC_STATUS WINAPI UuidCreate(UUID *Uuid)
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
#define LIST_FOR_EACH_ENTRY_SAFE(cursor, cursor2, list, type, field)
unsigned short reject_reason
DWORD_PTR Spare[8/sizeof(DWORD_PTR)]
LIST_ENTRY ProcessLocksList
PCRITICAL_SECTION_DEBUG DebugInfo
RPC_VERSION SyntaxVersion
unsigned short MajorVersion
unsigned short MinorVersion
struct list free_connection_pool
struct list context_handle_list
struct list conn_pool_entry
RPC_SYNTAX_IDENTIFIER ActiveInterface
USHORT MaxTransmissionSize
RPC_ASYNC_STATE * async_state
RpcQualityOfService * QOS
NDR_RUNDOWN rundown_routine
VOID WINAPI InitializeCriticalSection(OUT LPCRITICAL_SECTION lpCriticalSection)
#define FIELD_OFFSET(t, f)
RpcPktBindAckHdr bind_ack
RpcPktBindNAckHdr bind_nack
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
void WINAPI DeleteCriticalSection(PCRITICAL_SECTION)
#define RPC_S_SERVER_TOO_BUSY
#define RPC_S_OUT_OF_RESOURCES
#define RPC_S_CALL_FAILED_DNE
#define RPC_S_PROTOCOL_ERROR
#define RPC_S_NO_CONTEXT_AVAILABLE
#define RPC_S_UNKNOWN_AUTHN_SERVICE
#define RPC_S_SERVER_UNAVAILABLE
_Must_inspect_result_ _In_ ULONG Flags