mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-07 19:58:30 +00:00
Add gethostbyname and gethostbyaddr (#200)
gethostbyname, gethostbyaddr follow simple implementations: they internally call getaddrinfo and getnameinfo respectively, and fill out the minimum details. remaining functions are stubs.
This commit is contained in:
parent
014d4bdab2
commit
3fe7b95fd0
5 changed files with 241 additions and 0 deletions
27
libc/dns/ent.h
Normal file
27
libc/dns/ent.h
Normal file
|
@ -0,0 +1,27 @@
|
|||
#ifndef COSMOPOLITAN_LIBC_DNS_ENT_H_
|
||||
#define COSMOPOLITAN_LIBC_DNS_ENT_H_
|
||||
#include "libc/dns/dns.h"
|
||||
|
||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
COSMOPOLITAN_C_START_
|
||||
|
||||
extern int h_errno;
|
||||
|
||||
struct hostent {
|
||||
char *h_name; /* official name of host */
|
||||
char **h_aliases; /* alias list */
|
||||
int h_addrtype; /* host address type */
|
||||
int h_length; /* length of address */
|
||||
char **h_addr_list; /* list of addresses */
|
||||
};
|
||||
#define h_addr h_addr_list[0]
|
||||
|
||||
struct hostent *gethostent(void);
|
||||
struct hostent *gethostbyname(const char *);
|
||||
struct hostent *gethostbyaddr(const void *, socklen_t, int);
|
||||
void sethostent(int);
|
||||
void endhostent(void);
|
||||
|
||||
COSMOPOLITAN_C_END_
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
#endif /* COSMOPOLITAN_LIBC_DNS_ENT_H_ */
|
Loading…
Add table
Add a link
Reference in a new issue