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++;
532 context_handle->rundown_routine = rundown_routine;
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;
USHORT MaxTransmissionSize
#define ROUND_UP(value, alignment)
void RpcContextHandle_GetUuid(NDR_SCONTEXT SContext, UUID *uuid)
ULONG RpcAssoc_Release(RpcAssoc *assoc)
#define RESULT_PROVIDER_REJECTION
NTSYSAPI VOID NTAPI RtlDeleteResource(_In_ PRTL_RESOURCE Resource)
void RpcAssoc_ConnectionReleased(RpcAssoc *assoc)
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
void WINAPI I_RpcFree(void *Object)
unsigned short MajorVersion
#define RPC_S_NO_CONTEXT_AVAILABLE
static LONG last_assoc_group_id
RPC_STATUS RPCRT4_ClientConnectionAuth(RpcConnection *conn, BYTE *challenge, ULONG count)
static struct list server_assoc_list
#define REJECT_LOCAL_LIMIT_EXCEEDED
#define ERROR_INVALID_HANDLE
VOID RPCRT4_FreeHeader(RpcPktHdr *Header)
__WINE_SERVER_LIST_INLINE void list_add_head(struct list *list, struct list *elem)
struct list context_handle_list
#define RPC_S_SERVER_UNAVAILABLE
#define REJECT_UNKNOWN_AUTHN_SERVICE
RPC_STATUS RpcServerAssoc_AllocateContextHandle(RpcAssoc *assoc, void *CtxGuard, NDR_SCONTEXT *SContext)
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
RPC_STATUS RPCRT4_GetAssociation(LPCSTR Protseq, LPCSTR NetworkAddr, LPCSTR Endpoint, LPCWSTR NetworkOptions, RpcAssoc **assoc_out)
NTSYSAPI VOID NTAPI RtlReleaseResource(_In_ PRTL_RESOURCE Resource)
struct list conn_pool_entry
#define RPC_S_ACCESS_DENIED
#define REJECT_TEMPORARY_CONGESTION
__WINE_SERVER_LIST_INLINE void list_add_tail(struct list *list, struct list *elem)
int WINAPI UuidIsNil(UUID *Uuid, RPC_STATUS *Status)
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
#define RPC_S_OUT_OF_MEMORY
static BOOL compare_networkoptions(LPCWSTR opts1, LPCWSTR opts2)
RPC_STATUS RpcServerAssoc_UpdateContextHandle(RpcAssoc *assoc, NDR_SCONTEXT SContext, void *CtxGuard, NDR_RUNDOWN rundown_routine)
RpcPktBindAckHdr bind_ack
#define RPC_S_CALL_FAILED_DNE
RPC_VERSION SyntaxVersion
VOID WINAPI InitializeCriticalSection(OUT LPCRITICAL_SECTION lpCriticalSection)
RpcPktBindNAckHdr bind_nack
BOOL RpcAuthInfo_IsEqual(const RpcAuthInfo *AuthInfo1, const RpcAuthInfo *AuthInfo2)
struct _NDR_SCONTEXT * NDR_SCONTEXT
#define RPC_S_PROTOCOL_ERROR
void RPCRT4_ReleaseConnection(RpcConnection *Connection) DECLSPEC_HIDDEN
__WINE_SERVER_LIST_INLINE void list_remove(struct list *elem)
void RpcAssoc_ReleaseIdleConnection(RpcAssoc *assoc, RpcConnection *Connection)
WINE_DEFAULT_DEBUG_CHANNEL(rpc)
NTSYSAPI VOID NTAPI RtlInitializeResource(_In_ PRTL_RESOURCE Resource)
_Must_inspect_result_ _In_ ULONG Flags
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
NDR_RUNDOWN rundown_routine
void WINAPI DeleteCriticalSection(PCRITICAL_SECTION)
#define REJECT_INVALID_CHECKSUM
RPC_STATUS RPCRT4_ReceiveWithAuth(RpcConnection *Connection, RpcPktHdr **Header, PRPC_MESSAGE pMsg, unsigned char **auth_data_out, ULONG *auth_length_out)
static struct _test_info results[8]
PCRITICAL_SECTION_DEBUG DebugInfo
RPC_STATUS RPCRT4_CreateConnection(RpcConnection **Connection, BOOL server, LPCSTR Protseq, LPCSTR NetworkAddr, LPCSTR Endpoint, LPCWSTR NetworkOptions, RpcAuthInfo *AuthInfo, RpcQualityOfService *QOS, LPCWSTR CookieAuth) DECLSPEC_HIDDEN
static RPC_STATUS RpcAssoc_Alloc(LPCSTR Protseq, LPCSTR NetworkAddr, LPCSTR Endpoint, LPCWSTR NetworkOptions, RpcAssoc **assoc_out)
static RpcConnection * RpcAssoc_GetIdleConnection(RpcAssoc *assoc, const RPC_SYNTAX_IDENTIFIER *InterfaceId, const RPC_SYNTAX_IDENTIFIER *TransferSyntax, const RpcAuthInfo *AuthInfo, const RpcQualityOfService *QOS)
RPC_ASYNC_STATE * async_state
#define InterlockedDecrement
RpcPktHdr * RPCRT4_BuildBindHeader(ULONG DataRepresentation, unsigned short MaxTransmissionSize, unsigned short MaxReceiveSize, ULONG AssocGroupId, const RPC_SYNTAX_IDENTIFIER *AbstractId, const RPC_SYNTAX_IDENTIFIER *TransferId)
unsigned short MinorVersion
#define RPC_S_UNKNOWN_AUTHN_SERVICE
LIST_ENTRY ProcessLocksList
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)
#define RPC_S_SERVER_TOO_BUSY
unsigned int RpcServerAssoc_ReleaseContextHandle(RpcAssoc *assoc, NDR_SCONTEXT SContext, BOOL release_lock)
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
#define NDR_LOCAL_DATA_REPRESENTATION
#define LIST_FOR_EACH_ENTRY_SAFE(cursor, cursor2, list, type, field)
#define InterlockedIncrement
RPC_STATUS WINAPI UuidCreate(UUID *Uuid)
RPC_STATUS RpcServerAssoc_FindContextHandle(RpcAssoc *assoc, const UUID *uuid, void *CtxGuard, ULONG Flags, NDR_SCONTEXT *SContext)
void(__RPC_USER * NDR_RUNDOWN)(void *context)
#define RPCRT4_strdupA(x)
#define FIELD_OFFSET(t, f)
RPC_STATUS RPCRT4_Send(RpcConnection *Connection, RpcPktHdr *Header, void *Buffer, unsigned int BufferLength)
#define RPC_S_OUT_OF_RESOURCES
#define RESULT_USER_REJECTION
static struct list client_assoc_list
RPC_STATUS RPCRT4_OpenClientConnection(RpcConnection *Connection) DECLSPEC_HIDDEN
struct list free_connection_pool
RPC_STATUS RpcServerAssoc_GetAssociation(LPCSTR Protseq, LPCSTR NetworkAddr, LPCSTR Endpoint, LPCWSTR NetworkOptions, ULONG assoc_gid, RpcAssoc **assoc_out)
#define REASON_ABSTRACT_SYNTAX_NOT_SUPPORTED
BOOL RpcQualityOfService_IsEqual(const RpcQualityOfService *qos1, const RpcQualityOfService *qos2)
#define REASON_TRANSFER_SYNTAXES_NOT_SUPPORTED
__WINE_SERVER_LIST_INLINE void list_init(struct list *list)
#define RPC_MAX_PACKET_SIZE
int strcmp(const char *String1, const char *String2)
static RPC_STATUS RpcAssoc_BindConnection(const RpcAssoc *assoc, RpcConnection *conn, const RPC_SYNTAX_IDENTIFIER *InterfaceId, const RPC_SYNTAX_IDENTIFIER *TransferSyntax)
RpcQualityOfService * QOS
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
unsigned short reject_reason
struct _RpcContextHandle RpcContextHandle
static void RpcContextHandle_Destroy(RpcContextHandle *context_handle)
#define RPCRT4_strdupW(x)
static SERVICE_STATUS status
#define REJECT_PROTOCOL_VERSION_NOT_SUPPORTED
#define HeapFree(x, y, z)
BOOL RpcContextHandle_IsGuardCorrect(NDR_SCONTEXT SContext, void *CtxGuard)
static CRITICAL_SECTION assoc_list_cs
DWORD_PTR Spare[8/sizeof(DWORD_PTR)]
RPC_SYNTAX_IDENTIFIER ActiveInterface
static CRITICAL_SECTION_DEBUG assoc_list_cs_debug
NTSYSAPI BOOLEAN NTAPI RtlAcquireResourceExclusive(_In_ PRTL_RESOURCE Resource, _In_ BOOLEAN Wait)