Lines Matching refs:client
51 ns_lwdclient_t *client;
83 client = isc_mem_get(lwresd->mctx, sizeof(ns_lwdclient_t));
84 if (client != NULL) {
85 ns_lwdclient_log(50, "created client %p, manager %p",
86 client, cm);
87 ns_lwdclient_initialize(client, cm);
117 client = ISC_LIST_HEAD(cm->idle);
118 while (client != NULL) {
119 ISC_LIST_UNLINK(cm->idle, client, link);
120 isc_mem_put(lwresd->mctx, client, sizeof(*client));
121 client = ISC_LIST_HEAD(cm->idle);
139 ns_lwdclient_t *client;
153 client = ISC_LIST_HEAD(cm->idle);
154 while (client != NULL) {
155 ns_lwdclient_log(50, "destroying client %p, manager %p",
156 client, cm);
157 ISC_LIST_UNLINK(cm->idle, client, link);
158 isc_mem_put(cm->mctx, client, sizeof(*client));
159 client = ISC_LIST_HEAD(cm->idle);
184 process_request(ns_lwdclient_t *client) {
188 lwres_buffer_init(&b, client->buffer, client->recvlength);
189 lwres_buffer_add(&b, client->recvlength);
191 result = lwres_lwpacket_parseheader(&b, &client->pkt);
197 ns_lwdclient_log(50, "opcode %08x", client->pkt.opcode);
199 switch (client->pkt.opcode) {
201 ns_lwdclient_processgabn(client, &b);
204 ns_lwdclient_processgnba(client, &b);
207 ns_lwdclient_processgrbn(client, &b);
210 ns_lwdclient_processnoop(client, &b);
213 ns_lwdclient_log(50, "unknown opcode %08x", client->pkt.opcode);
221 ns_lwdclient_log(50, "restarting client %p...", client);
222 ns_lwdclient_stateidle(client);
228 ns_lwdclient_t *client = ev->ev_arg;
229 ns_lwdclientmgr_t *cm = client->clientmgr;
232 INSIST(dev->region.base == client->buffer);
233 INSIST(NS_LWDCLIENT_ISRECV(client));
235 NS_LWDCLIENT_SETRECVDONE(client);
254 ns_lwdclient_stateidle(client);
259 client->recvlength = dev->n;
260 client->address = dev->address;
262 client->pktinfo = dev->pktinfo;
263 client->pktinfo_valid = ISC_TRUE;
265 client->pktinfo_valid = ISC_FALSE;
274 "client handler: %s",
277 process_request(client);
281 * This function will start a new recv() on a socket for this client manager.
285 ns_lwdclient_t *client;
309 client = ISC_LIST_HEAD(cm->idle);
310 if (client == NULL) {
315 INSIST(NS_LWDCLIENT_ISIDLE(client));
327 r.base = client->buffer;
330 client);
337 * Remove the client from the idle list, and put it on the running
340 NS_LWDCLIENT_SETRECV(client);
341 ISC_LIST_UNLINK(cm->idle, client, link);
342 ISC_LIST_APPEND(cm->running, client, link);
356 ns_lwdclient_t *client;
369 client = ISC_LIST_HEAD(cm->idle);
370 while (client != NULL) {
371 ns_lwdclient_log(50, "destroying client %p, manager %p",
372 client, cm);
373 ISC_LIST_UNLINK(cm->idle, client, link);
374 isc_mem_put(cm->mctx, client, sizeof(*client));
375 client = ISC_LIST_HEAD(cm->idle);
385 * Run through the running client list and kill off any finds
389 client = ISC_LIST_HEAD(cm->running);
390 while (client != NULL) {
391 if (client->find != client->v4find
392 && client->find != client->v6find)
393 dns_adb_cancelfind(client->find);
394 if (client->v4find != NULL)
395 dns_adb_cancelfind(client->v4find);
396 if (client->v6find != NULL)
397 dns_adb_cancelfind(client->v6find);
398 client = ISC_LIST_NEXT(client, link);
409 * Do all the crap needed to move a client from the run queue to the idle
413 ns_lwdclient_stateidle(ns_lwdclient_t *client) {
417 cm = client->clientmgr;
419 INSIST(client->sendbuf == NULL);
420 INSIST(client->sendlength == 0);
421 INSIST(client->arg == NULL);
422 INSIST(client->v4find == NULL);
423 INSIST(client->v6find == NULL);
426 ISC_LIST_UNLINK(cm->running, client, link);
427 ISC_LIST_PREPEND(cm->idle, client, link);
430 NS_LWDCLIENT_SETIDLE(client);
437 "client handler: %s",
443 ns_lwdclient_t *client = ev->ev_arg;
444 ns_lwdclientmgr_t *cm = client->clientmgr;
450 INSIST(NS_LWDCLIENT_ISSEND(client));
451 INSIST(client->sendbuf == dev->region.base);
453 ns_lwdclient_log(50, "task %p for client %p got send-done event",
454 task, client);
456 if (client->sendbuf != client->buffer)
457 lwres_context_freemem(cm->lwctx, client->sendbuf,
458 client->sendlength);
459 client->sendbuf = NULL;
460 client->sendlength = 0;
462 ns_lwdclient_stateidle(client);
468 ns_lwdclient_sendreply(ns_lwdclient_t *client, isc_region_t *r) {
470 ns_lwdclientmgr_t *cm = client->clientmgr;
472 if (client->pktinfo_valid)
473 pktinfo = &client->pktinfo;
477 client, &client->address, pktinfo));
481 ns_lwdclient_initialize(ns_lwdclient_t *client, ns_lwdclientmgr_t *cmgr) {
482 client->clientmgr = cmgr;
483 ISC_LINK_INIT(client, link);
484 NS_LWDCLIENT_SETIDLE(client);
485 client->arg = NULL;
487 client->recvlength = 0;
489 client->sendbuf = NULL;
490 client->sendlength = 0;
492 client->find = NULL;
493 client->v4find = NULL;
494 client->v6find = NULL;
495 client->find_wanted = 0;
497 client->options = 0;
498 client->byaddr = NULL;
500 client->lookup = NULL;
502 client->pktinfo_valid = ISC_FALSE;
505 ISC_LIST_APPEND(cmgr->idle, client, link);