Lines Matching refs:adst
466 struct adstore *adst = (struct adstore *)opaque; in lws_async_dns_store() local
472 if (ttl < adst->smallest_ttl || !adst->ctr) in lws_async_dns_store()
473 adst->smallest_ttl = ttl; in lws_async_dns_store()
475 if (adst->prev) in lws_async_dns_store()
476 adst->prev->ai_next = adst->pos; in lws_async_dns_store()
477 adst->prev = adst->pos; in lws_async_dns_store()
479 adst->pos->ai_flags = 0; in lws_async_dns_store()
480 adst->pos->ai_family = type == LWS_ADNS_RECORD_AAAA ? in lws_async_dns_store()
482 adst->pos->ai_socktype = SOCK_STREAM; in lws_async_dns_store()
483 adst->pos->ai_protocol = IPPROTO_UDP; /* no meaning */ in lws_async_dns_store()
484 adst->pos->ai_addrlen = type == LWS_ADNS_RECORD_AAAA ? in lws_async_dns_store()
487 adst->pos->ai_canonname = (char *)adst->name; in lws_async_dns_store()
488 adst->pos->ai_addr = (struct sockaddr *)&adst->pos[1]; in lws_async_dns_store()
489 adst->pos->ai_next = NULL; in lws_async_dns_store()
493 struct sockaddr_in6 *in6 = (struct sockaddr_in6 *)&adst->pos[1]; in lws_async_dns_store()
497 in6->sin6_family = (sa_family_t)adst->pos->ai_family; in lws_async_dns_store()
499 adst->flags |= 2; in lws_async_dns_store()
503 struct sockaddr_in *in = (struct sockaddr_in *)&adst->pos[1]; in lws_async_dns_store()
507 in->sin_family = (sa_family_t)adst->pos->ai_family; in lws_async_dns_store()
509 adst->flags |= 1; in lws_async_dns_store()
512 adst->pos = (struct addrinfo *)((uint8_t *)adst->pos + in lws_async_dns_store()
519 lwsl_info("%s: %d: %s: %s\n", __func__, adst->ctr, in lws_async_dns_store()
520 adst->name, buf); in lws_async_dns_store()
522 adst->ctr++; in lws_async_dns_store()
536 struct adstore adst; in lws_adns_parse_udp() local
615 c->name = adst.name = ((const char *)c) + est - n; in lws_adns_parse_udp()
624 adst.pos = (struct addrinfo *)&c[1]; in lws_adns_parse_udp()
625 adst.prev = NULL; in lws_adns_parse_udp()
626 adst.ctr = 0; in lws_adns_parse_udp()
627 adst.smallest_ttl = 3600; in lws_adns_parse_udp()
628 adst.flags = 0; in lws_adns_parse_udp()
636 lws_adns_iterate(q, pkt, (int)len, nmcname, lws_async_dns_store, &adst) < 0) { in lws_adns_parse_udp()
650 if (adst.prev) /* so we know where to continue the addrinfo list */ in lws_adns_parse_udp()
652 q->last = &adst.prev->ai_next; in lws_adns_parse_udp()
676 c->flags = adst.flags; in lws_adns_parse_udp()
680 (adst.smallest_ttl * LWS_US_PER_SEC)); in lws_adns_parse_udp()