ReactOS  0.4.13-dev-73-gcfe54aa
rpc_assoc.c
Go to the documentation of this file.
1 /*
2  * Associations
3  *
4  * Copyright 2007 Robert Shearman (for CodeWeavers)
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 
22 #include <stdarg.h>
23 #include <assert.h>
24 
25 #include "rpc.h"
26 #include "rpcndr.h"
27 #include "wine/winternl.h"
28 
29 #include "wine/unicode.h"
30 #include "wine/debug.h"
31 
32 #include "rpc_binding.h"
33 #include "rpc_assoc.h"
34 #include "rpc_message.h"
35 
37 
40 {
41  0, 0, &assoc_list_cs,
43  0, 0, { (DWORD_PTR)(__FILE__ ": assoc_list_cs") }
44 };
45 static CRITICAL_SECTION assoc_list_cs = { &assoc_list_cs_debug, -1, 0, 0, 0, 0 };
46 
49 
51 
52 typedef struct _RpcContextHandle
53 {
54  struct list entry;
55  void *user_context;
57  void *ctx_guard;
60  unsigned int refs;
62 
63 static void RpcContextHandle_Destroy(RpcContextHandle *context_handle);
64 
65 static RPC_STATUS RpcAssoc_Alloc(LPCSTR Protseq, LPCSTR NetworkAddr,
66  LPCSTR Endpoint, LPCWSTR NetworkOptions,
67  RpcAssoc **assoc_out)
68 {
69  RpcAssoc *assoc;
70  assoc = HeapAlloc(GetProcessHeap(), 0, sizeof(*assoc));
71  if (!assoc)
73  assoc->refs = 1;
77  assoc->cs.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": RpcAssoc.cs");
78  assoc->Protseq = RPCRT4_strdupA(Protseq);
79  assoc->NetworkAddr = RPCRT4_strdupA(NetworkAddr);
80  assoc->Endpoint = RPCRT4_strdupA(Endpoint);
81  assoc->NetworkOptions = NetworkOptions ? RPCRT4_strdupW(NetworkOptions) : NULL;
82  assoc->assoc_group_id = 0;
83  assoc->connection_cnt = 0;
84  UuidCreate(&assoc->http_uuid);
85  list_init(&assoc->entry);
86  *assoc_out = assoc;
87  return RPC_S_OK;
88 }
89 
91 {
92  if ((opts1 == NULL) && (opts2 == NULL))
93  return TRUE;
94  if ((opts1 == NULL) || (opts2 == NULL))
95  return FALSE;
96  return !strcmpW(opts1, opts2);
97 }
98 
100  LPCSTR Endpoint, LPCWSTR NetworkOptions,
101  RpcAssoc **assoc_out)
102 {
103  RpcAssoc *assoc;
105 
108  {
109  if (!strcmp(Protseq, assoc->Protseq) &&
110  !strcmp(NetworkAddr, assoc->NetworkAddr) &&
111  !strcmp(Endpoint, assoc->Endpoint) &&
112  compare_networkoptions(NetworkOptions, assoc->NetworkOptions))
113  {
114  assoc->refs++;
115  *assoc_out = assoc;
117  TRACE("using existing assoc %p\n", assoc);
118  return RPC_S_OK;
119  }
120  }
121 
122  status = RpcAssoc_Alloc(Protseq, NetworkAddr, Endpoint, NetworkOptions, &assoc);
123  if (status != RPC_S_OK)
124  {
126  return status;
127  }
129  *assoc_out = assoc;
130 
132 
133  TRACE("new assoc %p\n", assoc);
134 
135  return RPC_S_OK;
136 }
137 
139  LPCSTR Endpoint, LPCWSTR NetworkOptions,
140  ULONG assoc_gid,
141  RpcAssoc **assoc_out)
142 {
143  RpcAssoc *assoc;
145 
147  if (assoc_gid)
148  {
150  {
151  /* FIXME: NetworkAddr shouldn't be NULL */
152  if (assoc->assoc_group_id == assoc_gid &&
153  !strcmp(Protseq, assoc->Protseq) &&
154  (!NetworkAddr || !assoc->NetworkAddr || !strcmp(NetworkAddr, assoc->NetworkAddr)) &&
155  !strcmp(Endpoint, assoc->Endpoint) &&
156  ((!assoc->NetworkOptions == !NetworkOptions) &&
157  (!NetworkOptions || !strcmpW(NetworkOptions, assoc->NetworkOptions))))
158  {
159  assoc->refs++;
160  *assoc_out = assoc;
162  TRACE("using existing assoc %p\n", assoc);
163  return RPC_S_OK;
164  }
165  }
166  *assoc_out = NULL;
169  }
170 
171  status = RpcAssoc_Alloc(Protseq, NetworkAddr, Endpoint, NetworkOptions, &assoc);
172  if (status != RPC_S_OK)
173  {
175  return status;
176  }
179  *assoc_out = assoc;
180 
182 
183  TRACE("new assoc %p\n", assoc);
184 
185  return RPC_S_OK;
186 }
187 
189 {
190  ULONG refs;
191 
193  refs = --assoc->refs;
194  if (!refs)
195  list_remove(&assoc->entry);
197 
198  if (!refs)
199  {
200  RpcConnection *Connection, *cursor2;
201  RpcContextHandle *context_handle, *context_handle_cursor;
202 
203  TRACE("destroying assoc %p\n", assoc);
204 
205  LIST_FOR_EACH_ENTRY_SAFE(Connection, cursor2, &assoc->free_connection_pool, RpcConnection, conn_pool_entry)
206  {
207  list_remove(&Connection->conn_pool_entry);
208  RPCRT4_ReleaseConnection(Connection);
209  }
210 
211  LIST_FOR_EACH_ENTRY_SAFE(context_handle, context_handle_cursor, &assoc->context_handle_list, RpcContextHandle, entry)
212  RpcContextHandle_Destroy(context_handle);
213 
214  HeapFree(GetProcessHeap(), 0, assoc->NetworkOptions);
215  HeapFree(GetProcessHeap(), 0, assoc->Endpoint);
216  HeapFree(GetProcessHeap(), 0, assoc->NetworkAddr);
217  HeapFree(GetProcessHeap(), 0, assoc->Protseq);
218 
219  assoc->cs.DebugInfo->Spare[0] = 0;
220  DeleteCriticalSection(&assoc->cs);
221 
222  HeapFree(GetProcessHeap(), 0, assoc);
223  }
224 
225  return refs;
226 }
227 
228 #define ROUND_UP(value, alignment) (((value) + ((alignment) - 1)) & ~((alignment)-1))
229 
231  const RPC_SYNTAX_IDENTIFIER *InterfaceId,
232  const RPC_SYNTAX_IDENTIFIER *TransferSyntax)
233 {
234  RpcPktHdr *hdr;
235  RpcPktHdr *response_hdr;
238  unsigned char *auth_data = NULL;
239  ULONG auth_length;
240 
241  TRACE("sending bind request to server\n");
242 
245  assoc->assoc_group_id,
246  InterfaceId, TransferSyntax);
247 
248  status = RPCRT4_Send(conn, hdr, NULL, 0);
250  if (status != RPC_S_OK)
251  return status;
252 
253  status = RPCRT4_ReceiveWithAuth(conn, &response_hdr, &msg, &auth_data, &auth_length);
254  if (status != RPC_S_OK)
255  {
256  ERR("receive failed with error %d\n", status);
257  return status;
258  }
259 
260  switch (response_hdr->common.ptype)
261  {
262  case PKT_BIND_ACK:
263  {
264  RpcAddressString *server_address = msg.Buffer;
265  if ((msg.BufferLength >= FIELD_OFFSET(RpcAddressString, string[0])) ||
266  (msg.BufferLength >= ROUND_UP(FIELD_OFFSET(RpcAddressString, string[server_address->length]), 4)))
267  {
268  unsigned short remaining = msg.BufferLength -
269  ROUND_UP(FIELD_OFFSET(RpcAddressString, string[server_address->length]), 4);
270  RpcResultList *results = (RpcResultList*)((ULONG_PTR)server_address +
271  ROUND_UP(FIELD_OFFSET(RpcAddressString, string[server_address->length]), 4));
272  if ((results->num_results == 1) &&
273  (remaining >= FIELD_OFFSET(RpcResultList, results[results->num_results])))
274  {
275  switch (results->results[0].result)
276  {
277  case RESULT_ACCEPT:
278  /* respond to authorization request */
279  if (auth_length > sizeof(RpcAuthVerifier))
281  auth_data + sizeof(RpcAuthVerifier),
282  auth_length);
283  if (status == RPC_S_OK)
284  {
285  conn->assoc_group_id = response_hdr->bind_ack.assoc_gid;
286  conn->MaxTransmissionSize = response_hdr->bind_ack.max_tsize;
287  conn->ActiveInterface = *InterfaceId;
288  }
289  break;
291  switch (results->results[0].reason)
292  {
294  ERR("syntax %s, %d.%d not supported\n",
295  debugstr_guid(&InterfaceId->SyntaxGUID),
296  InterfaceId->SyntaxVersion.MajorVersion,
297  InterfaceId->SyntaxVersion.MinorVersion);
299  break;
301  ERR("transfer syntax not supported\n");
303  break;
304  case REASON_NONE:
305  default:
307  }
308  break;
310  default:
311  ERR("rejection result %d\n", results->results[0].result);
313  }
314  }
315  else
316  {
317  ERR("incorrect results size\n");
319  }
320  }
321  else
322  {
323  ERR("bind ack packet too small (%d)\n", msg.BufferLength);
325  }
326  break;
327  }
328  case PKT_BIND_NACK:
329  switch (response_hdr->bind_nack.reject_reason)
330  {
333  ERR("server too busy\n");
335  break;
337  ERR("protocol version not supported\n");
339  break;
341  ERR("unknown authentication service\n");
343  break;
345  ERR("invalid checksum\n");
347  break;
348  default:
349  ERR("rejected bind for reason %d\n", response_hdr->bind_nack.reject_reason);
351  }
352  break;
353  default:
354  ERR("wrong packet type received %d\n", response_hdr->common.ptype);
356  break;
357  }
358 
359  I_RpcFree(msg.Buffer);
360  RPCRT4_FreeHeader(response_hdr);
361  HeapFree(GetProcessHeap(), 0, auth_data);
362  return status;
363 }
364 
366  const RPC_SYNTAX_IDENTIFIER *InterfaceId,
367  const RPC_SYNTAX_IDENTIFIER *TransferSyntax, const RpcAuthInfo *AuthInfo,
368  const RpcQualityOfService *QOS)
369 {
370  RpcConnection *Connection;
371  EnterCriticalSection(&assoc->cs);
372  /* try to find a compatible connection from the connection pool */
373  LIST_FOR_EACH_ENTRY(Connection, &assoc->free_connection_pool, RpcConnection, conn_pool_entry)
374  {
375  if (!memcmp(&Connection->ActiveInterface, InterfaceId,
376  sizeof(RPC_SYNTAX_IDENTIFIER)) &&
377  RpcAuthInfo_IsEqual(Connection->AuthInfo, AuthInfo) &&
378  RpcQualityOfService_IsEqual(Connection->QOS, QOS))
379  {
380  list_remove(&Connection->conn_pool_entry);
381  LeaveCriticalSection(&assoc->cs);
382  TRACE("got connection from pool %p\n", Connection);
383  return Connection;
384  }
385  }
386 
387  LeaveCriticalSection(&assoc->cs);
388  return NULL;
389 }
390 
392  const RPC_SYNTAX_IDENTIFIER *InterfaceId,
393  const RPC_SYNTAX_IDENTIFIER *TransferSyntax, RpcAuthInfo *AuthInfo,
394  RpcQualityOfService *QOS, LPCWSTR CookieAuth,
395  RpcConnection **Connection, BOOL *from_cache)
396 {
397  RpcConnection *NewConnection;
399 
400  *Connection = RpcAssoc_GetIdleConnection(assoc, InterfaceId, TransferSyntax, AuthInfo, QOS);
401  if (*Connection) {
402  TRACE("return idle connection %p for association %p\n", *Connection, assoc);
403  if (from_cache) *from_cache = TRUE;
404  return RPC_S_OK;
405  }
406 
407  /* create a new connection */
408  status = RPCRT4_CreateConnection(&NewConnection, FALSE /* is this a server connection? */,
409  assoc->Protseq, assoc->NetworkAddr,
410  assoc->Endpoint, assoc->NetworkOptions,
411  AuthInfo, QOS, CookieAuth);
412  if (status != RPC_S_OK)
413  return status;
414 
415  NewConnection->assoc = assoc;
416  status = RPCRT4_OpenClientConnection(NewConnection);
417  if (status != RPC_S_OK)
418  {
419  RPCRT4_ReleaseConnection(NewConnection);
420  return status;
421  }
422 
423  status = RpcAssoc_BindConnection(assoc, NewConnection, InterfaceId, TransferSyntax);
424  if (status != RPC_S_OK)
425  {
426  RPCRT4_ReleaseConnection(NewConnection);
427  return status;
428  }
429 
431 
432  TRACE("return new connection %p for association %p\n", *Connection, assoc);
433  *Connection = NewConnection;
434  if (from_cache) *from_cache = FALSE;
435  return RPC_S_OK;
436 }
437 
439 {
440  assert(!Connection->server);
441  Connection->async_state = NULL;
442  EnterCriticalSection(&assoc->cs);
443  if (!assoc->assoc_group_id) assoc->assoc_group_id = Connection->assoc_group_id;
444  list_add_head(&assoc->free_connection_pool, &Connection->conn_pool_entry);
445  LeaveCriticalSection(&assoc->cs);
446 }
447 
449 {
451  return;
452 
453  TRACE("Last %p connection released\n", assoc);
454  assoc->assoc_group_id = 0;
455 }
456 
458  NDR_SCONTEXT *SContext)
459 {
460  RpcContextHandle *context_handle;
461 
462  context_handle = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*context_handle));
463  if (!context_handle)
464  return RPC_S_OUT_OF_MEMORY;
465 
466  context_handle->ctx_guard = CtxGuard;
467  RtlInitializeResource(&context_handle->rw_lock);
468  context_handle->refs = 1;
469 
470  /* lock here to mirror unmarshall, so we don't need to special-case the
471  * freeing of a non-marshalled context handle */
472  RtlAcquireResourceExclusive(&context_handle->rw_lock, TRUE);
473 
474  EnterCriticalSection(&assoc->cs);
475  list_add_tail(&assoc->context_handle_list, &context_handle->entry);
476  LeaveCriticalSection(&assoc->cs);
477 
478  *SContext = (NDR_SCONTEXT)context_handle;
479  return RPC_S_OK;
480 }
481 
483 {
484  RpcContextHandle *context_handle = (RpcContextHandle *)SContext;
485  return context_handle->ctx_guard == CtxGuard;
486 }
487 
489  void *CtxGuard, ULONG Flags, NDR_SCONTEXT *SContext)
490 {
491  RpcContextHandle *context_handle;
492 
493  EnterCriticalSection(&assoc->cs);
495  {
496  if (RpcContextHandle_IsGuardCorrect((NDR_SCONTEXT)context_handle, CtxGuard) &&
497  !memcmp(&context_handle->uuid, uuid, sizeof(*uuid)))
498  {
499  *SContext = (NDR_SCONTEXT)context_handle;
500  if (context_handle->refs++)
501  {
502  LeaveCriticalSection(&assoc->cs);
503  TRACE("found %p\n", context_handle);
504  RtlAcquireResourceExclusive(&context_handle->rw_lock, TRUE);
505  return RPC_S_OK;
506  }
507  }
508  }
509  LeaveCriticalSection(&assoc->cs);
510 
511  ERR("no context handle found for uuid %s, guard %p\n",
512  debugstr_guid(uuid), CtxGuard);
513  return ERROR_INVALID_HANDLE;
514 }
515 
517  NDR_SCONTEXT SContext,
518  void *CtxGuard,
519  NDR_RUNDOWN rundown_routine)
520 {
521  RpcContextHandle *context_handle = (RpcContextHandle *)SContext;
523 
524  if (!RpcContextHandle_IsGuardCorrect((NDR_SCONTEXT)context_handle, CtxGuard))
525  return ERROR_INVALID_HANDLE;
526 
527  EnterCriticalSection(&assoc->cs);
528  if (UuidIsNil(&context_handle->uuid, &status))
529  {
530  /* add a ref for the data being valid */
531  context_handle->refs++;
532  UuidCreate(&context_handle->uuid);
533  context_handle->rundown_routine = rundown_routine;
534  TRACE("allocated uuid %s for context handle %p\n",
535  debugstr_guid(&context_handle->uuid), context_handle);
536  }
537  LeaveCriticalSection(&assoc->cs);
538 
539  return RPC_S_OK;
540 }
541 
543 {
544  RpcContextHandle *context_handle = (RpcContextHandle *)SContext;
545  *uuid = context_handle->uuid;
546 }
547 
548 static void RpcContextHandle_Destroy(RpcContextHandle *context_handle)
549 {
550  TRACE("freeing %p\n", context_handle);
551 
552  if (context_handle->user_context && context_handle->rundown_routine)
553  {
554  TRACE("calling rundown routine %p with user context %p\n",
555  context_handle->rundown_routine, context_handle->user_context);
556  context_handle->rundown_routine(context_handle->user_context);
557  }
558 
559  RtlDeleteResource(&context_handle->rw_lock);
560 
561  HeapFree(GetProcessHeap(), 0, context_handle);
562 }
563 
564 unsigned int RpcServerAssoc_ReleaseContextHandle(RpcAssoc *assoc, NDR_SCONTEXT SContext, BOOL release_lock)
565 {
566  RpcContextHandle *context_handle = (RpcContextHandle *)SContext;
567  unsigned int refs;
568 
569  if (release_lock)
570  RtlReleaseResource(&context_handle->rw_lock);
571 
572  EnterCriticalSection(&assoc->cs);
573  refs = --context_handle->refs;
574  if (!refs)
575  list_remove(&context_handle->entry);
576  LeaveCriticalSection(&assoc->cs);
577 
578  if (!refs)
579  RpcContextHandle_Destroy(context_handle);
580 
581  return refs;
582 }
USHORT MaxTransmissionSize
Definition: rpc_binding.h:71
#define RPC_S_UNKNOWN_IF
Definition: winerror.h:1028
#define ROUND_UP(value, alignment)
Definition: rpc_assoc.c:228
void RpcContextHandle_GetUuid(NDR_SCONTEXT SContext, UUID *uuid)
Definition: rpc_assoc.c:542
ULONG RpcAssoc_Release(RpcAssoc *assoc)
Definition: rpc_assoc.c:188
#define RESULT_PROVIDER_REJECTION
Definition: rpc_defs.h:213
#define REASON_NONE
Definition: rpc_defs.h:215
struct list entry
Definition: rpc_assoc.h:29
#define TRUE
Definition: types.h:120
NTSYSAPI VOID NTAPI RtlDeleteResource(_In_ PRTL_RESOURCE Resource)
char hdr[14]
Definition: iptest.cpp:33
void RpcAssoc_ConnectionReleased(RpcAssoc *assoc)
Definition: rpc_assoc.c:448
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
#define DWORD_PTR
Definition: treelist.c:76
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
void WINAPI I_RpcFree(void *Object)
Definition: rpcrt4_main.c:725
unsigned short MajorVersion
Definition: rpcdcep.h:27
#define RPC_S_NO_CONTEXT_AVAILABLE
Definition: winerror.h:1073
static LONG last_assoc_group_id
Definition: rpc_assoc.c:50
RPC_STATUS RPCRT4_ClientConnectionAuth(RpcConnection *conn, BYTE *challenge, ULONG count)
Definition: rpc_message.c:992
#define RESULT_ACCEPT
Definition: rpc_defs.h:211
static struct list server_assoc_list
Definition: rpc_assoc.c:48
#define REJECT_LOCAL_LIMIT_EXCEEDED
Definition: rpc_defs.h:222
uint8_t entry
Definition: isohybrid.c:63
#define ERROR_INVALID_HANDLE
Definition: compat.h:88
VOID RPCRT4_FreeHeader(RpcPktHdr *Header)
Definition: rpc_message.c:403
__WINE_SERVER_LIST_INLINE void list_add_head(struct list *list, struct list *elem)
Definition: list.h:96
struct list context_handle_list
Definition: rpc_assoc.h:49
#define RPC_S_SERVER_UNAVAILABLE
Definition: winerror.h:1033
#define assert(x)
Definition: debug.h:53
#define REJECT_UNKNOWN_AUTHN_SERVICE
Definition: rpc_defs.h:228
unsigned short length
Definition: rpc_defs.h:91
RPC_STATUS RpcServerAssoc_AllocateContextHandle(RpcAssoc *assoc, void *CtxGuard, NDR_SCONTEXT *SContext)
Definition: rpc_assoc.c:457
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
RPC_STATUS RPCRT4_GetAssociation(LPCSTR Protseq, LPCSTR NetworkAddr, LPCSTR Endpoint, LPCWSTR NetworkOptions, RpcAssoc **assoc_out)
Definition: rpc_assoc.c:99
NTSYSAPI VOID NTAPI RtlReleaseResource(_In_ PRTL_RESOURCE Resource)
struct list conn_pool_entry
Definition: rpc_binding.h:85
#define RPC_S_ACCESS_DENIED
Definition: rpcnterr.h:29
uint32_t ULONG_PTR
Definition: typedefs.h:63
#define REJECT_TEMPORARY_CONGESTION
Definition: rpc_defs.h:221
void * user_context
Definition: rpc_assoc.c:55
__WINE_SERVER_LIST_INLINE void list_add_tail(struct list *list, struct list *elem)
Definition: list.h:102
int WINAPI UuidIsNil(UUID *Uuid, RPC_STATUS *Status)
Definition: rpcrt4_main.c:269
long RPC_STATUS
Definition: rpc.h:52
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
Definition: list.h:198
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
LPSTR Endpoint
Definition: rpc_assoc.h:34
RpcPktCommonHdr common
Definition: rpc_defs.h:152
LONG connection_cnt
Definition: rpc_assoc.h:46
#define RPC_S_OUT_OF_MEMORY
Definition: rpcnterr.h:24
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
static BOOL compare_networkoptions(LPCWSTR opts1, LPCWSTR opts2)
Definition: rpc_assoc.c:90
RPC_STATUS RpcServerAssoc_UpdateContextHandle(RpcAssoc *assoc, NDR_SCONTEXT SContext, void *CtxGuard, NDR_RUNDOWN rundown_routine)
Definition: rpc_assoc.c:516
unsigned int assoc_gid
Definition: rpc_defs.h:114
ULONG assoc_group_id
Definition: rpc_assoc.h:38
RpcPktBindAckHdr bind_ack
Definition: rpc_defs.h:157
#define RPC_S_CALL_FAILED_DNE
Definition: winerror.h:1038
RPC_VERSION SyntaxVersion
Definition: rpcdcep.h:33
VOID WINAPI InitializeCriticalSection(OUT LPCRITICAL_SECTION lpCriticalSection)
Definition: synch.c:697
smooth NULL
Definition: ftsmooth.c:416
ULONG assoc_group_id
Definition: rpc_binding.h:86
RpcPktBindNAckHdr bind_nack
Definition: rpc_defs.h:158
BOOL RpcAuthInfo_IsEqual(const RpcAuthInfo *AuthInfo1, const RpcAuthInfo *AuthInfo2)
Definition: rpc_binding.c:1206
unsigned short max_tsize
Definition: rpc_defs.h:112
const char * LPCSTR
Definition: xmlstorage.h:183
CRITICAL_SECTION cs
Definition: rpc_assoc.h:41
#define debugstr_guid
Definition: kernel32.h:35
#define RPC_S_PROTOCOL_ERROR
Definition: winerror.h:1039
void RPCRT4_ReleaseConnection(RpcConnection *Connection) DECLSPEC_HIDDEN
__WINE_SERVER_LIST_INLINE void list_remove(struct list *elem)
Definition: list.h:108
void RpcAssoc_ReleaseIdleConnection(RpcAssoc *assoc, RpcConnection *Connection)
Definition: rpc_assoc.c:438
WINE_DEFAULT_DEBUG_CHANNEL(rpc)
NTSYSAPI VOID NTAPI RtlInitializeResource(_In_ PRTL_RESOURCE Resource)
#define TRACE(s)
Definition: solgame.cpp:4
struct tagNDR_SCONTEXT * NDR_SCONTEXT
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
NDR_RUNDOWN rundown_routine
Definition: rpc_assoc.c:56
#define LIST_INIT(head)
Definition: queue.h:197
void WINAPI DeleteCriticalSection(PCRITICAL_SECTION)
RTL_RWLOCK rw_lock
Definition: rpc_assoc.c:59
#define REJECT_INVALID_CHECKSUM
Definition: rpc_defs.h:229
LPSTR NetworkAddr
Definition: rpc_assoc.h:33
LONG refs
Definition: rpc_assoc.h:30
RPC_STATUS RPCRT4_ReceiveWithAuth(RpcConnection *Connection, RpcPktHdr **Header, PRPC_MESSAGE pMsg, unsigned char **auth_data_out, ULONG *auth_length_out)
Definition: rpc_message.c:1376
struct _test_info results[8]
Definition: SetCursorPos.c:29
PCRITICAL_SECTION_DEBUG DebugInfo
Definition: winbase.h:859
RPC_STATUS RPCRT4_CreateConnection(RpcConnection **Connection, BOOL server, LPCSTR Protseq, LPCSTR NetworkAddr, LPCSTR Endpoint, LPCWSTR NetworkOptions, RpcAuthInfo *AuthInfo, RpcQualityOfService *QOS, LPCWSTR CookieAuth) DECLSPEC_HIDDEN
unsigned char ptype
Definition: rpc_defs.h:30
static RPC_STATUS RpcAssoc_Alloc(LPCSTR Protseq, LPCSTR NetworkAddr, LPCSTR Endpoint, LPCWSTR NetworkOptions, RpcAssoc **assoc_out)
Definition: rpc_assoc.c:65
static RpcConnection * RpcAssoc_GetIdleConnection(RpcAssoc *assoc, const RPC_SYNTAX_IDENTIFIER *InterfaceId, const RPC_SYNTAX_IDENTIFIER *TransferSyntax, const RpcAuthInfo *AuthInfo, const RpcQualityOfService *QOS)
Definition: rpc_assoc.c:365
RPC_ASYNC_STATE * async_state
Definition: rpc_binding.h:87
#define InterlockedDecrement
Definition: armddk.h:52
RpcPktHdr * RPCRT4_BuildBindHeader(ULONG DataRepresentation, unsigned short MaxTransmissionSize, unsigned short MaxReceiveSize, ULONG AssocGroupId, const RPC_SYNTAX_IDENTIFIER *AbstractId, const RPC_SYNTAX_IDENTIFIER *TransferId)
Definition: rpc_message.c:186
unsigned int refs
Definition: rpc_assoc.c:60
unsigned short MinorVersion
Definition: rpcdcep.h:28
#define RPC_S_UNKNOWN_AUTHN_SERVICE
Definition: winerror.h:1055
Definition: _list.h:228
LIST_ENTRY ProcessLocksList
Definition: winbase.h:848
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:391
#define RPC_S_SERVER_TOO_BUSY
Definition: winerror.h:1034
#define ERR(fmt,...)
Definition: debug.h:109
unsigned int RpcServerAssoc_ReleaseContextHandle(RpcAssoc *assoc, NDR_SCONTEXT SContext, BOOL release_lock)
Definition: rpc_assoc.c:564
#define NDR_LOCAL_DATA_REPRESENTATION
Definition: rpcndr.h:107
#define LIST_FOR_EACH_ENTRY_SAFE(cursor, cursor2, list, type, field)
Definition: list.h:204
#define InterlockedIncrement
Definition: armddk.h:53
RPC_STATUS WINAPI UuidCreate(UUID *Uuid)
Definition: rpcrt4_main.c:306
RPC_STATUS RpcServerAssoc_FindContextHandle(RpcAssoc *assoc, const UUID *uuid, void *CtxGuard, ULONG Flags, NDR_SCONTEXT *SContext)
Definition: rpc_assoc.c:488
void(__RPC_USER * NDR_RUNDOWN)(void *context)
Definition: rpcndr.h:153
RpcAuthInfo * AuthInfo
Definition: rpc_binding.h:77
#define RPCRT4_strdupA(x)
Definition: rpc_binding.h:151
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:254
RPC_STATUS RPCRT4_Send(RpcConnection *Connection, RpcPktHdr *Header, void *Buffer, unsigned int BufferLength)
Definition: rpc_message.c:1223
#define RPC_S_OUT_OF_RESOURCES
Definition: winerror.h:1032
#define RESULT_USER_REJECTION
Definition: rpc_defs.h:212
static struct list client_assoc_list
Definition: rpc_assoc.c:47
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
RPC_STATUS RPCRT4_OpenClientConnection(RpcConnection *Connection) DECLSPEC_HIDDEN
struct list entry
Definition: rpc_assoc.c:54
struct list free_connection_pool
Definition: rpc_assoc.h:45
LPWSTR NetworkOptions
Definition: rpc_assoc.h:35
#define msg(x)
Definition: auth_time.c:54
RPC_STATUS RpcServerAssoc_GetAssociation(LPCSTR Protseq, LPCSTR NetworkAddr, LPCSTR Endpoint, LPCWSTR NetworkOptions, ULONG assoc_gid, RpcAssoc **assoc_out)
Definition: rpc_assoc.c:138
#define REASON_ABSTRACT_SYNTAX_NOT_SUPPORTED
Definition: rpc_defs.h:216
WINE_UNICODE_INLINE int strcmpW(const WCHAR *str1, const WCHAR *str2)
Definition: unicode.h:229
BOOL RpcQualityOfService_IsEqual(const RpcQualityOfService *qos1, const RpcQualityOfService *qos2)
Definition: rpc_binding.c:1387
#define REASON_TRANSFER_SYNTAXES_NOT_SUPPORTED
Definition: rpc_defs.h:217
__WINE_SERVER_LIST_INLINE void list_init(struct list *list)
Definition: list.h:149
#define RPC_MAX_PACKET_SIZE
Definition: rpc_defs.h:184
Definition: msctf.idl:510
unsigned int ULONG
Definition: retypes.h:1
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
static RPC_STATUS RpcAssoc_BindConnection(const RpcAssoc *assoc, RpcConnection *conn, const RPC_SYNTAX_IDENTIFIER *InterfaceId, const RPC_SYNTAX_IDENTIFIER *TransferSyntax)
Definition: rpc_assoc.c:230
RpcQualityOfService * QOS
Definition: rpc_binding.h:81
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
unsigned short reject_reason
Definition: rpc_defs.h:126
struct _RpcContextHandle RpcContextHandle
static void RpcContextHandle_Destroy(RpcContextHandle *context_handle)
Definition: rpc_assoc.c:548
#define RPCRT4_strdupW(x)
Definition: rpc_binding.h:152
static SERVICE_STATUS status
Definition: service.c:31
struct _RpcAssoc * assoc
Definition: rpc_binding.h:88
#define REJECT_PROTOCOL_VERSION_NOT_SUPPORTED
Definition: rpc_defs.h:224
void * ctx_guard
Definition: rpc_assoc.c:57
#define HeapFree(x, y, z)
Definition: compat.h:394
BOOL RpcContextHandle_IsGuardCorrect(NDR_SCONTEXT SContext, void *CtxGuard)
Definition: rpc_assoc.c:482
#define RPC_S_OK
Definition: rpcnterr.h:22
UUID http_uuid
Definition: rpc_assoc.h:39
static CRITICAL_SECTION assoc_list_cs
Definition: rpc_assoc.c:38
DWORD_PTR Spare[8/sizeof(DWORD_PTR)]
Definition: winbase.h:852
RPC_SYNTAX_IDENTIFIER ActiveInterface
Definition: rpc_binding.h:92
LPSTR Protseq
Definition: rpc_assoc.h:32
Definition: ps.c:97
static CRITICAL_SECTION_DEBUG assoc_list_cs_debug
Definition: rpc_assoc.c:39
NTSYSAPI BOOLEAN NTAPI RtlAcquireResourceExclusive(_In_ PRTL_RESOURCE Resource, _In_ BOOLEAN Wait)