mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-02-07 15:03:34 +00:00
Added necessary constants (DNS_TYPE_PTR, NI_NUMERICHOST etc.). Implementation of getnameinfo is similar to getaddrinfo, with internal functions: * ResolveDnsReverse: performs rDNS query and parses the PTR record * ResolveHostsReverse: reads /etc/hosts to map hostname to address Earlier, the HOSTS.txt would only need to be sorted at loading time, because the only kind of lookup was name -> address. Now since address -> name lookups are also possible, so the HostsTxt struct, the sorting method (and the related tests) was changed to reflect this.
15 lines
413 B
C
15 lines
413 B
C
#ifndef COSMOPOLITAN_LIBC_DNS_CONSTS_H_
|
|
#define COSMOPOLITAN_LIBC_DNS_CONSTS_H_
|
|
#include "libc/sock/sock.h"
|
|
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
|
|
|
#define DNS_TYPE_A 0x01
|
|
#define DNS_TYPE_PTR 0x0c
|
|
|
|
#define DNS_CLASS_IN 1
|
|
|
|
#define kMinSockaddr4Size \
|
|
(offsetof(struct sockaddr_in, sin_addr) + sizeof(struct in_addr))
|
|
|
|
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
|
#endif /* COSMOPOLITAN_LIBC_DNS_CONSTS_H_ */
|