4 #include "nss_gns_query.h"
7 int gns_resolve_name(int af, const char *name, struct userdata *u)
15 if (-1 == asprintf(&cmd, "%s -t AAAA -u %s\n", "gnunet-gns -r", name))
20 if (-1 == asprintf(&cmd, "%s %s\n", "gnunet-gns -r -u", name))
28 while (fgets( line, sizeof(line), p ) != NULL)
31 if (u->count >= MAX_ENTRIES)
34 if (line[strlen(line)-1] == '\n')
36 line[strlen(line)-1] = '\0';
39 inet_pton(af, line, &(u->data.ipv4[u->count++]));
40 u->data_len += sizeof(ipv4_address_t);
42 else if ((af == AF_INET6))
44 inet_pton(af, line, &(u->data.ipv6[u->count++]));
45 u->data_len += sizeof(ipv6_address_t);