Lines Matching refs:client

62 	ns_lwdclient_t *client;
90 client = isc_mem_get(lwresd->mctx, sizeof(ns_lwdclient_t));
91 if (client != NULL) {
92 ns_lwdclient_log(50, "created client %p, manager %p",
93 client, cm);
94 ns_lwdclient_initialize(client, cm);
122 client = ISC_LIST_HEAD(cm->idle);
123 while (client != NULL) {
124 ISC_LIST_UNLINK(cm->idle, client, link);
125 isc_mem_put(lwresd->mctx, client, sizeof(*client));
126 client = ISC_LIST_HEAD(cm->idle);
141 ns_lwdclient_t *client;
152 client = ISC_LIST_HEAD(cm->idle);
153 while (client != NULL) {
154 ns_lwdclient_log(50, "destroying client %p, manager %p",
155 client, cm);
156 ISC_LIST_UNLINK(cm->idle, client, link);
157 isc_mem_put(cm->mctx, client, sizeof(*client));
158 client = ISC_LIST_HEAD(cm->idle);
177 process_request(ns_lwdclient_t *client) {
181 lwres_buffer_init(&b, client->buffer, client->recvlength);
182 lwres_buffer_add(&b, client->recvlength);
184 result = lwres_lwpacket_parseheader(&b, &client->pkt);
190 ns_lwdclient_log(50, "opcode %08x", client->pkt.opcode);
192 switch (client->pkt.opcode) {
194 ns_lwdclient_processgabn(client, &b);
197 ns_lwdclient_processgnba(client, &b);
200 ns_lwdclient_processgrbn(client, &b);
203 ns_lwdclient_processnoop(client, &b);
206 ns_lwdclient_log(50, "unknown opcode %08x", client->pkt.opcode);
214 ns_lwdclient_log(50, "restarting client %p...", client);
215 ns_lwdclient_stateidle(client);
221 ns_lwdclient_t *client = ev->ev_arg;
222 ns_lwdclientmgr_t *cm = client->clientmgr;
225 INSIST(dev->region.base == client->buffer);
226 INSIST(NS_LWDCLIENT_ISRECV(client));
228 NS_LWDCLIENT_SETRECVDONE(client);
245 ns_lwdclient_stateidle(client);
250 client->recvlength = dev->n;
251 client->address = dev->address;
253 client->pktinfo = dev->pktinfo;
254 client->pktinfo_valid = ISC_TRUE;
256 client->pktinfo_valid = ISC_FALSE;
265 "client handler: %s",
268 process_request(client);
272 * This function will start a new recv() on a socket for this client manager.
276 ns_lwdclient_t *client;
294 client = ISC_LIST_HEAD(cm->idle);
295 if (client == NULL)
297 INSIST(NS_LWDCLIENT_ISIDLE(client));
302 r.base = client->buffer;
305 client);
315 * Remove the client from the idle list, and put it on the running
318 NS_LWDCLIENT_SETRECV(client);
319 ISC_LIST_UNLINK(cm->idle, client, link);
320 ISC_LIST_APPEND(cm->running, client, link);
328 ns_lwdclient_t *client;
340 client = ISC_LIST_HEAD(cm->idle);
341 while (client != NULL) {
342 ns_lwdclient_log(50, "destroying client %p, manager %p",
343 client, cm);
344 ISC_LIST_UNLINK(cm->idle, client, link);
345 isc_mem_put(cm->mctx, client, sizeof(*client));
346 client = ISC_LIST_HEAD(cm->idle);
355 * Run through the running client list and kill off any finds
358 client = ISC_LIST_HEAD(cm->running);
359 while (client != NULL) {
360 if (client->find != client->v4find
361 && client->find != client->v6find)
362 dns_adb_cancelfind(client->find);
363 if (client->v4find != NULL)
364 dns_adb_cancelfind(client->v4find);
365 if (client->v6find != NULL)
366 dns_adb_cancelfind(client->v6find);
367 client = ISC_LIST_NEXT(client, link);
376 * Do all the crap needed to move a client from the run queue to the idle
380 ns_lwdclient_stateidle(ns_lwdclient_t *client) {
384 cm = client->clientmgr;
386 INSIST(client->sendbuf == NULL);
387 INSIST(client->sendlength == 0);
388 INSIST(client->arg == NULL);
389 INSIST(client->v4find == NULL);
390 INSIST(client->v6find == NULL);
392 ISC_LIST_UNLINK(cm->running, client, link);
393 ISC_LIST_PREPEND(cm->idle, client, link);
395 NS_LWDCLIENT_SETIDLE(client);
402 "client handler: %s",
408 ns_lwdclient_t *client = ev->ev_arg;
409 ns_lwdclientmgr_t *cm = client->clientmgr;
415 INSIST(NS_LWDCLIENT_ISSEND(client));
416 INSIST(client->sendbuf == dev->region.base);
418 ns_lwdclient_log(50, "task %p for client %p got send-done event",
419 task, client);
421 if (client->sendbuf != client->buffer)
422 lwres_context_freemem(cm->lwctx, client->sendbuf,
423 client->sendlength);
424 client->sendbuf = NULL;
425 client->sendlength = 0;
427 ns_lwdclient_stateidle(client);
433 ns_lwdclient_sendreply(ns_lwdclient_t *client, isc_region_t *r) {
435 ns_lwdclientmgr_t *cm = client->clientmgr;
437 if (client->pktinfo_valid)
438 pktinfo = &client->pktinfo;
442 client, &client->address, pktinfo));
446 ns_lwdclient_initialize(ns_lwdclient_t *client, ns_lwdclientmgr_t *cmgr) {
447 client->clientmgr = cmgr;
448 ISC_LINK_INIT(client, link);
449 NS_LWDCLIENT_SETIDLE(client);
450 client->arg = NULL;
452 client->recvlength = 0;
454 client->sendbuf = NULL;
455 client->sendlength = 0;
457 client->find = NULL;
458 client->v4find = NULL;
459 client->v6find = NULL;
460 client->find_wanted = 0;
462 client->options = 0;
463 client->byaddr = NULL;
465 client->lookup = NULL;
467 client->pktinfo_valid = ISC_FALSE;
469 ISC_LIST_APPEND(cmgr->idle, client, link);