Lines Matching defs:client
60 ns_lwdclient_t *client;
88 client = isc_mem_get(lwresd->mctx, sizeof(ns_lwdclient_t));
89 if (client != NULL) {
90 ns_lwdclient_log(50, "created client %p, manager %p",
91 client, cm);
92 ns_lwdclient_initialize(client, cm);
120 client = ISC_LIST_HEAD(cm->idle);
121 while (client != NULL) {
122 ISC_LIST_UNLINK(cm->idle, client, link);
123 isc_mem_put(lwresd->mctx, client, sizeof(*client));
124 client = ISC_LIST_HEAD(cm->idle);
139 ns_lwdclient_t *client;
150 client = ISC_LIST_HEAD(cm->idle);
151 while (client != NULL) {
152 ns_lwdclient_log(50, "destroying client %p, manager %p",
153 client, cm);
154 ISC_LIST_UNLINK(cm->idle, client, link);
155 isc_mem_put(cm->mctx, client, sizeof(*client));
156 client = ISC_LIST_HEAD(cm->idle);
175 process_request(ns_lwdclient_t *client) {
179 lwres_buffer_init(&b, client->buffer, client->recvlength);
180 lwres_buffer_add(&b, client->recvlength);
182 result = lwres_lwpacket_parseheader(&b, &client->pkt);
188 ns_lwdclient_log(50, "opcode %08x", client->pkt.opcode);
190 switch (client->pkt.opcode) {
192 ns_lwdclient_processgabn(client, &b);
195 ns_lwdclient_processgnba(client, &b);
198 ns_lwdclient_processgrbn(client, &b);
201 ns_lwdclient_processnoop(client, &b);
204 ns_lwdclient_log(50, "unknown opcode %08x", client->pkt.opcode);
212 ns_lwdclient_log(50, "restarting client %p...", client);
213 ns_lwdclient_stateidle(client);
219 ns_lwdclient_t *client = ev->ev_arg;
220 ns_lwdclientmgr_t *cm = client->clientmgr;
223 INSIST(dev->region.base == client->buffer);
224 INSIST(NS_LWDCLIENT_ISRECV(client));
226 NS_LWDCLIENT_SETRECVDONE(client);
243 ns_lwdclient_stateidle(client);
248 client->recvlength = dev->n;
249 client->address = dev->address;
251 client->pktinfo = dev->pktinfo;
252 client->pktinfo_valid = ISC_TRUE;
254 client->pktinfo_valid = ISC_FALSE;
263 "client handler: %s",
266 process_request(client);
270 * This function will start a new recv() on a socket for this client manager.
274 ns_lwdclient_t *client;
292 client = ISC_LIST_HEAD(cm->idle);
293 if (client == NULL)
295 INSIST(NS_LWDCLIENT_ISIDLE(client));
300 r.base = client->buffer;
303 client);
313 * Remove the client from the idle list, and put it on the running
316 NS_LWDCLIENT_SETRECV(client);
317 ISC_LIST_UNLINK(cm->idle, client, link);
318 ISC_LIST_APPEND(cm->running, client, link);
326 ns_lwdclient_t *client;
338 client = ISC_LIST_HEAD(cm->idle);
339 while (client != NULL) {
340 ns_lwdclient_log(50, "destroying client %p, manager %p",
341 client, cm);
342 ISC_LIST_UNLINK(cm->idle, client, link);
343 isc_mem_put(cm->mctx, client, sizeof(*client));
344 client = ISC_LIST_HEAD(cm->idle);
353 * Run through the running client list and kill off any finds
356 client = ISC_LIST_HEAD(cm->running);
357 while (client != NULL) {
358 if (client->find != client->v4find
359 && client->find != client->v6find)
360 dns_adb_cancelfind(client->find);
361 if (client->v4find != NULL)
362 dns_adb_cancelfind(client->v4find);
363 if (client->v6find != NULL)
364 dns_adb_cancelfind(client->v6find);
365 client = ISC_LIST_NEXT(client, link);
374 * Do all the crap needed to move a client from the run queue to the idle
378 ns_lwdclient_stateidle(ns_lwdclient_t *client) {
382 cm = client->clientmgr;
384 INSIST(client->sendbuf == NULL);
385 INSIST(client->sendlength == 0);
386 INSIST(client->arg == NULL);
387 INSIST(client->v4find == NULL);
388 INSIST(client->v6find == NULL);
390 ISC_LIST_UNLINK(cm->running, client, link);
391 ISC_LIST_PREPEND(cm->idle, client, link);
393 NS_LWDCLIENT_SETIDLE(client);
400 "client handler: %s",
406 ns_lwdclient_t *client = ev->ev_arg;
407 ns_lwdclientmgr_t *cm = client->clientmgr;
413 INSIST(NS_LWDCLIENT_ISSEND(client));
414 INSIST(client->sendbuf == dev->region.base);
416 ns_lwdclient_log(50, "task %p for client %p got send-done event",
417 task, client);
419 if (client->sendbuf != client->buffer)
420 lwres_context_freemem(cm->lwctx, client->sendbuf,
421 client->sendlength);
422 client->sendbuf = NULL;
423 client->sendlength = 0;
425 ns_lwdclient_stateidle(client);
431 ns_lwdclient_sendreply(ns_lwdclient_t *client, isc_region_t *r) {
433 ns_lwdclientmgr_t *cm = client->clientmgr;
435 if (client->pktinfo_valid)
436 pktinfo = &client->pktinfo;
440 client, &client->address, pktinfo));
444 ns_lwdclient_initialize(ns_lwdclient_t *client, ns_lwdclientmgr_t *cmgr) {
445 client->clientmgr = cmgr;
446 ISC_LINK_INIT(client, link);
447 NS_LWDCLIENT_SETIDLE(client);
448 client->arg = NULL;
450 client->recvlength = 0;
452 client->sendbuf = NULL;
453 client->sendlength = 0;
455 client->find = NULL;
456 client->v4find = NULL;
457 client->v6find = NULL;
458 client->find_wanted = 0;
460 client->options = 0;
461 client->byaddr = NULL;
463 client->lookup = NULL;
465 client->pktinfo_valid = ISC_FALSE;
467 ISC_LIST_APPEND(cmgr->idle, client, link);