Lines Matching +full:client +full:- +full:id
6 #include <dix-config.h>
25 #include "protocol-versions.h"
26 #include "client.h"
49 ProcXResQueryClientIds; used by ConstructClientId* -functions */
62 via a parameter, as they are called via already-existing
97 @return Returns a pointer to the allocated non-zeroed region
108 f->bytes = bytes; in AddFragment()
109 xorg_list_add(&f->l, frags->prev); in AddFragment()
114 /** @brief Sends all fragments in the list to the client. Does not
117 @param client The client to send the fragments to
121 WriteFragmentsToClient(ClientPtr client, struct xorg_list *frags) in WriteFragmentsToClient() argument
125 WriteToClient(client, it->bytes, (char*) it + sizeof(*it)); in WriteFragmentsToClient()
138 xorg_list_del(&it->l); in DestroyFragments()
148 ctx->numIds = 0; in InitConstructClientIdCtx()
149 ctx->resultBytes = 0; in InitConstructClientIdCtx()
150 xorg_list_init(&ctx->response); in InitConstructClientIdCtx()
151 memset(ctx->sentClientMasks, 0, sizeof(ctx->sentClientMasks)); in InitConstructClientIdCtx()
159 DestroyFragments(&ctx->response); in DestroyConstructClientIdCtx()
168 ctx->sendClient = sendClient; in InitConstructResourceBytesCtx()
169 ctx->numSizes = 0; in InitConstructResourceBytesCtx()
170 ctx->resultBytes = 0; in InitConstructResourceBytesCtx()
171 xorg_list_init(&ctx->response); in InitConstructResourceBytesCtx()
172 ctx->status = Success; in InitConstructResourceBytesCtx()
173 ctx->numSpecs = numSpecs; in InitConstructResourceBytesCtx()
174 ctx->specs = specs; in InitConstructResourceBytesCtx()
175 ctx->visitedResources = ht_create(sizeof(XID), 0, in InitConstructResourceBytesCtx()
179 if (!ctx->visitedResources) { in InitConstructResourceBytesCtx()
189 DestroyFragments(&ctx->response); in DestroyConstructResourceBytesCtx()
190 ht_destroy(ctx->visitedResources); in DestroyConstructResourceBytesCtx()
194 ProcXResQueryVersion(ClientPtr client) in ProcXResQueryVersion() argument
198 .sequenceNumber = client->sequence, in ProcXResQueryVersion()
206 if (client->swapped) { in ProcXResQueryVersion()
212 WriteToClient(client, sizeof(xXResQueryVersionReply), &rep); in ProcXResQueryVersion()
217 ProcXResQueryClients(ClientPtr client) in ProcXResQueryClients() argument
238 .sequenceNumber = client->sequence, in ProcXResQueryClients()
242 if (client->swapped) { in ProcXResQueryClients()
247 WriteToClient(client, sizeof(xXResQueryClientsReply), &rep); in ProcXResQueryClients()
253 scratch.resource_base = clients[current_clients[i]]->clientAsMask; in ProcXResQueryClients()
256 if (client->swapped) { in ProcXResQueryClients()
260 WriteToClient(client, sz_xXResClient, &scratch); in ProcXResQueryClients()
270 ResFindAllRes(void *value, XID id, RESTYPE type, void *cdata) in ResFindAllRes() argument
274 counts[(type & TypeMask) - 1]++; in ResFindAllRes()
296 ProcXResQueryClientResources(ClientPtr client) in ProcXResQueryClientResources() argument
305 clientID = CLIENT_ID(stuff->xid); in ProcXResQueryClientResources()
308 client->errorValue = stuff->xid; in ProcXResQueryClientResources()
325 .sequenceNumber = client->sequence, in ProcXResQueryClientResources()
329 if (client->swapped) { in ProcXResQueryClientResources()
335 WriteToClient(client, sizeof(xXResQueryClientResourcesReply), &rep); in ProcXResQueryClientResources()
347 if (client->swapped) { in ProcXResQueryClientResources()
351 WriteToClient(client, sz_xXResType, &scratch); in ProcXResQueryClientResources()
361 ResFindResourcePixmaps(void *value, XID id, RESTYPE type, void *cdata) in ResFindResourcePixmaps() argument
367 sizeFunc(value, id, &size); in ResFindResourcePixmaps()
372 ProcXResQueryClientPixmapBytes(ClientPtr client) in ProcXResQueryClientPixmapBytes() argument
381 clientID = CLIENT_ID(stuff->xid); in ProcXResQueryClientPixmapBytes()
384 client->errorValue = stuff->xid; in ProcXResQueryClientPixmapBytes()
395 .sequenceNumber = client->sequence, in ProcXResQueryClientPixmapBytes()
404 if (client->swapped) { in ProcXResQueryClientPixmapBytes()
410 WriteToClient(client, sizeof(xXResQueryClientPixmapBytesReply), &rep); in ProcXResQueryClientPixmapBytes()
415 /** @brief Finds out if a client's information need to be put into the
416 response; marks client having been handled, if that is the case.
418 @param client The client to send information about
421 @param ctx The context record that tells which clients and id types
423 @param sendMask Which id type are we now considering. One of X_XRes*Mask.
425 @return Returns TRUE if the client information needs to be on the
429 WillConstructMask(ClientPtr client, CARD32 mask, in WillConstructMask() argument
433 && !(ctx->sentClientMasks[client->index] & sendMask)) { in WillConstructMask()
434 ctx->sentClientMasks[client->index] |= sendMask; in WillConstructMask()
441 /** @brief Constructs a response about a single client, based on a certain
442 client id spec
444 @param sendClient Which client wishes to receive this answer. Used for
446 @param client Which client are we considering.
447 @param mask The client id spec mask indicating which information
448 we want about this client.
457 ConstructClientIdValue(ClientPtr sendClient, ClientPtr client, CARD32 mask, in ConstructClientIdValue() argument
462 rep.spec.client = client->clientAsMask; in ConstructClientIdValue()
463 if (client->swapped) { in ConstructClientIdValue()
464 swapl (&rep.spec.client); in ConstructClientIdValue()
467 if (WillConstructMask(client, mask, ctx, X_XResClientXIDMask)) { in ConstructClientIdValue()
468 void *ptr = AddFragment(&ctx->response, sizeof(rep)); in ConstructClientIdValue()
475 if (sendClient->swapped) { in ConstructClientIdValue()
477 /* swapl (&rep.length, n); - not required for rep.length = 0 */ in ConstructClientIdValue()
482 ctx->resultBytes += sizeof(rep); in ConstructClientIdValue()
483 ++ctx->numIds; in ConstructClientIdValue()
485 if (WillConstructMask(client, mask, ctx, X_XResLocalClientPIDMask)) { in ConstructClientIdValue()
486 pid_t pid = GetClientPid(client); in ConstructClientIdValue()
488 if (pid != -1) { in ConstructClientIdValue()
489 void *ptr = AddFragment(&ctx->response, in ConstructClientIdValue()
500 if (sendClient->swapped) { in ConstructClientIdValue()
505 if (sendClient->swapped) { in ConstructClientIdValue()
511 ctx->resultBytes += sizeof(rep) + sizeof(CARD32); in ConstructClientIdValue()
512 ++ctx->numIds; in ConstructClientIdValue()
520 /** @brief Constructs a response about all clients, based on a client id specs
522 @param client Which client which we are constructing the response for.
523 @param numSpecs Number of client id specs in specs
524 @param specs Client id specs
530 ConstructClientIds(ClientPtr client, in ConstructClientIds() argument
537 if (specs[specIdx].client == 0) { in ConstructClientIds()
541 if (!ConstructClientIdValue(client, clients[c], in ConstructClientIds()
548 int clientID = CLIENT_ID(specs[specIdx].client); in ConstructClientIds()
551 if (!ConstructClientIdValue(client, clients[clientID], in ConstructClientIds()
565 @param client Which client which we are constructing the response for.
571 ProcXResQueryClientIds (ClientPtr client) in ProcXResQueryClientIds() argument
583 stuff->numSpecs * sizeof(specs[0])); in ProcXResQueryClientIds()
585 rc = ConstructClientIds(client, stuff->numSpecs, specs, &ctx); in ProcXResQueryClientIds()
590 .sequenceNumber = client->sequence, in ProcXResQueryClientIds()
597 if (client->swapped) { in ProcXResQueryClientIds()
603 WriteToClient(client, sizeof(rep), &rep); in ProcXResQueryClientIds()
604 WriteFragmentsToClient(client, &ctx.response); in ProcXResQueryClientIds()
616 swapl(&spec->resource); in SwapXResResourceIdSpec()
617 swapl(&spec->type); in SwapXResResourceIdSpec()
624 SwapXResResourceIdSpec(&size->spec); in SwapXResResourceSizeSpec()
625 swapl(&size->bytes); in SwapXResResourceSizeSpec()
626 swapl(&size->refCount); in SwapXResResourceSizeSpec()
627 swapl(&size->useCount); in SwapXResResourceSizeSpec()
634 SwapXResResourceSizeSpec(&rep->size); in SwapXResResourceSizeValue()
635 swapl(&rep->numCrossReferences); in SwapXResResourceSizeValue()
642 struct xorg_list *it = response->next; in SwapXResQueryResourceBytes()
647 it = it->next; in SwapXResQueryResourceBytes()
648 for (c = 0; c < value->numCrossReferences; ++c) { in SwapXResQueryResourceBytes()
651 it = it->next; in SwapXResQueryResourceBytes()
665 @param[in] id The ID of the X resource
673 XID id, in AddSubResourceSizeSpec() argument
679 if (ctx->status == Success) { in AddSubResourceSizeSpec()
681 ht_find(ctx->visitedSubResources, &value); in AddSubResourceSizeSpec()
685 AddFragment(&ctx->response, sizeof(xXResResourceSizeSpec)); in AddSubResourceSizeSpec()
689 p = ht_add(ctx->visitedSubResources, &value); in AddSubResourceSizeSpec()
697 ctx->status = BadAlloc; in AddSubResourceSizeSpec()
701 sizeFunc(value, id, &size); in AddSubResourceSizeSpec()
703 crossRef->spec.resource = id; in AddSubResourceSizeSpec()
704 crossRef->spec.type = resourceTypeAtom(type); in AddSubResourceSizeSpec()
705 crossRef->bytes = size.resourceSize; in AddSubResourceSizeSpec()
706 crossRef->refCount = size.refCnt; in AddSubResourceSizeSpec()
707 crossRef->useCount = 1; in AddSubResourceSizeSpec()
709 ++ctx->sizeValue->numCrossReferences; in AddSubResourceSizeSpec()
711 ctx->resultBytes += sizeof(*crossRef); in AddSubResourceSizeSpec()
716 ++(*prevCrossRef)->useCount; in AddSubResourceSizeSpec()
730 @param[in] id The ID of the X resource
737 AddResourceSizeValue(void *ptr, XID id, RESTYPE type, void *cdata) in AddResourceSizeValue() argument
740 if (ctx->status == Success && in AddResourceSizeValue()
741 !ht_find(ctx->visitedResources, &id)) { in AddResourceSizeValue()
755 AddFragment(&ctx->response, sizeof(xXResResourceSizeValue)); in AddResourceSizeValue()
759 ok = ok && ht_add(ctx->visitedResources, &id); in AddResourceSizeValue()
769 ctx->status = BadAlloc; in AddResourceSizeValue()
774 sizeFunc(ptr, id, &size); in AddResourceSizeValue()
776 value->size.spec.resource = id; in AddResourceSizeValue()
777 value->size.spec.type = resourceTypeAtom(type); in AddResourceSizeValue()
778 value->size.bytes = size.resourceSize; in AddResourceSizeValue()
779 value->size.refCount = size.refCnt; in AddResourceSizeValue()
780 value->size.useCount = 1; in AddResourceSizeValue()
781 value->numCrossReferences = 0; in AddResourceSizeValue()
783 ctx->sizeValue = value; in AddResourceSizeValue()
784 ctx->visitedSubResources = ht; in AddResourceSizeValue()
786 ctx->visitedSubResources = NULL; in AddResourceSizeValue()
787 ctx->sizeValue = NULL; in AddResourceSizeValue()
789 ctx->resultBytes += sizeof(*value); in AddResourceSizeValue()
790 ++ctx->numSizes; in AddResourceSizeValue()
803 @param[in] id The resource ID
807 AddResourceSizeValueWithResType(void *ptr, XID id, void *cdata) in AddResourceSizeValueWithResType() argument
810 AddResourceSizeValue(ptr, id, ctx->resType, cdata); in AddResourceSizeValueWithResType()
819 @param[in] id The resource ID
825 AddResourceSizeValueByResource(void *ptr, XID id, RESTYPE type, void *cdata) in AddResourceSizeValueByResource() argument
828 xXResResourceIdSpec *spec = ctx->curSpec; in AddResourceSizeValueByResource()
830 if ((!spec->type || spec->type == type) && in AddResourceSizeValueByResource()
831 (!spec->resource || spec->resource == id)) { in AddResourceSizeValueByResource()
832 AddResourceSizeValue(ptr, id, type, ctx); in AddResourceSizeValueByResource()
836 /** @brief Add all resources of the client into the result buffer
838 resource by its ID. Those are handled by
843 @param[in] aboutClient Which client is being considered
844 @param[in/out] ctx The context that contains the resource id
852 for (specIdx = 0; specIdx < ctx->numSpecs; ++specIdx) { in ConstructClientResourceBytes()
853 xXResResourceIdSpec* spec = ctx->specs + specIdx; in ConstructClientResourceBytes()
854 if (spec->resource) { in ConstructClientResourceBytes()
856 } else if (spec->type) { in ConstructClientResourceBytes()
857 ctx->resType = spec->type; in ConstructClientResourceBytes()
858 FindClientResourcesByType(aboutClient, spec->type, in ConstructClientResourceBytes()
867 their ID in the resource id specification. The scan can
868 by limited to a client with the aboutClient parameter
872 @param[in] aboutClient Which client is being considered. This may be None
874 @param[in/out] ctx The context that contains the resource id
877 keep a pointer to the current resource id
885 for (specIdx = 0; specIdx < ctx->numSpecs; ++specIdx) { in ConstructResourceBytesByResource()
886 xXResResourceIdSpec *spec = ctx->specs + specIdx; in ConstructResourceBytesByResource()
887 if (spec->resource) { in ConstructResourceBytesByResource()
888 int cid = CLIENT_ID(spec->resource); in ConstructResourceBytesByResource()
891 ClientPtr client = clients[cid]; in ConstructResourceBytesByResource() local
892 if (client) { in ConstructResourceBytesByResource()
893 ctx->curSpec = spec; in ConstructResourceBytesByResource()
894 FindAllClientResources(client, in ConstructResourceBytesByResource()
903 /** @brief Build the resource size response for the given client
907 @param[in] aboutClient Which client to consider or None for all clients
917 ClientPtr client = NullClient; in ConstructResourceBytes() local
920 ctx->sendClient->errorValue = aboutClient; in ConstructResourceBytes()
924 client = clients[clientIdx]; in ConstructResourceBytes()
926 ConstructClientResourceBytes(client, ctx); in ConstructResourceBytes()
934 ClientPtr client = clients[clientIdx]; in ConstructResourceBytes() local
936 if (client) { in ConstructResourceBytes()
937 ConstructClientResourceBytes(client, ctx); in ConstructResourceBytes()
945 return ctx->status; in ConstructResourceBytes()
950 ProcXResQueryResourceBytes (ClientPtr client) in ProcXResQueryResourceBytes() argument
958 if (stuff->numSpecs > UINT32_MAX / sizeof(ctx.specs[0])) in ProcXResQueryResourceBytes()
961 stuff->numSpecs * sizeof(ctx.specs[0])); in ProcXResQueryResourceBytes()
963 if (!InitConstructResourceBytesCtx(&ctx, client, in ProcXResQueryResourceBytes()
964 stuff->numSpecs, in ProcXResQueryResourceBytes()
970 rc = ConstructResourceBytes(stuff->client, &ctx); in ProcXResQueryResourceBytes()
975 .sequenceNumber = client->sequence, in ProcXResQueryResourceBytes()
980 if (client->swapped) { in ProcXResQueryResourceBytes()
988 WriteToClient(client, sizeof(rep), &rep); in ProcXResQueryResourceBytes()
989 WriteFragmentsToClient(client, &ctx.response); in ProcXResQueryResourceBytes()
998 ProcResDispatch(ClientPtr client) in ProcResDispatch() argument
1001 switch (stuff->data) { in ProcResDispatch()
1003 return ProcXResQueryVersion(client); in ProcResDispatch()
1005 return ProcXResQueryClients(client); in ProcResDispatch()
1007 return ProcXResQueryClientResources(client); in ProcResDispatch()
1009 return ProcXResQueryClientPixmapBytes(client); in ProcResDispatch()
1011 return ProcXResQueryClientIds(client); in ProcResDispatch()
1013 return ProcXResQueryResourceBytes(client); in ProcResDispatch()
1021 SProcXResQueryVersion(ClientPtr client) in SProcXResQueryVersion() argument
1024 return ProcXResQueryVersion(client); in SProcXResQueryVersion()
1028 SProcXResQueryClientResources(ClientPtr client) in SProcXResQueryClientResources() argument
1032 swapl(&stuff->xid); in SProcXResQueryClientResources()
1033 return ProcXResQueryClientResources(client); in SProcXResQueryClientResources()
1037 SProcXResQueryClientPixmapBytes(ClientPtr client) in SProcXResQueryClientPixmapBytes() argument
1041 swapl(&stuff->xid); in SProcXResQueryClientPixmapBytes()
1042 return ProcXResQueryClientPixmapBytes(client); in SProcXResQueryClientPixmapBytes()
1046 SProcXResQueryClientIds (ClientPtr client) in SProcXResQueryClientIds() argument
1051 swapl(&stuff->numSpecs); in SProcXResQueryClientIds()
1052 return ProcXResQueryClientIds(client); in SProcXResQueryClientIds()
1059 SProcXResQueryResourceBytes (ClientPtr client) in SProcXResQueryResourceBytes() argument
1066 swapl(&stuff->numSpecs); in SProcXResQueryResourceBytes()
1068 stuff->numSpecs * sizeof(specs[0])); in SProcXResQueryResourceBytes()
1070 for (c = 0; c < stuff->numSpecs; ++c) { in SProcXResQueryResourceBytes()
1074 return ProcXResQueryResourceBytes(client); in SProcXResQueryResourceBytes()
1078 SProcResDispatch (ClientPtr client) in SProcResDispatch() argument
1081 swaps(&stuff->length); in SProcResDispatch()
1083 switch (stuff->data) { in SProcResDispatch()
1085 return SProcXResQueryVersion(client); in SProcResDispatch()
1087 return ProcXResQueryClients(client); in SProcResDispatch()
1089 return SProcXResQueryClientResources(client); in SProcResDispatch()
1091 return SProcXResQueryClientPixmapBytes(client); in SProcResDispatch()
1093 return SProcXResQueryClientIds(client); in SProcResDispatch()
1095 return SProcXResQueryResourceBytes(client); in SProcResDispatch()