Path: blob/main/system/lib/libc/musl/include/netdb.h
6172 views
#ifndef _NETDB_H1#define _NETDB_H23#ifdef __cplusplus4extern "C" {5#endif67#include <features.h>8#include <netinet/in.h>910#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)11#define __NEED_size_t12#include <bits/alltypes.h>13#endif1415struct addrinfo {16int ai_flags;17int ai_family;18int ai_socktype;19int ai_protocol;20socklen_t ai_addrlen;21struct sockaddr *ai_addr;22char *ai_canonname;23struct addrinfo *ai_next;24};2526#define AI_PASSIVE 0x0127#define AI_CANONNAME 0x0228#define AI_NUMERICHOST 0x0429#define AI_V4MAPPED 0x0830#define AI_ALL 0x1031#define AI_ADDRCONFIG 0x2032#define AI_NUMERICSERV 0x400333435#define NI_NUMERICHOST 0x0136#define NI_NUMERICSERV 0x0237#define NI_NOFQDN 0x0438#define NI_NAMEREQD 0x0839#define NI_DGRAM 0x1040#define NI_NUMERICSCOPE 0x1004142#define EAI_BADFLAGS -143#define EAI_NONAME -244#define EAI_AGAIN -345#define EAI_FAIL -446#define EAI_NODATA -547#define EAI_FAMILY -648#define EAI_SOCKTYPE -749#define EAI_SERVICE -850#define EAI_MEMORY -1051#define EAI_SYSTEM -1152#define EAI_OVERFLOW -125354int getaddrinfo (const char *__restrict, const char *__restrict, const struct addrinfo *__restrict, struct addrinfo **__restrict);55void freeaddrinfo (struct addrinfo *);56int getnameinfo (const struct sockaddr *__restrict, socklen_t, char *__restrict, socklen_t, char *__restrict, socklen_t, int);57const char *gai_strerror(int);585960/* Legacy functions follow (marked OBsolete in SUS) */6162struct netent {63char *n_name;64char **n_aliases;65int n_addrtype;66uint32_t n_net;67};6869struct hostent {70char *h_name;71char **h_aliases;72int h_addrtype;73int h_length;74char **h_addr_list;75};76#define h_addr h_addr_list[0]7778struct servent {79char *s_name;80char **s_aliases;81int s_port;82char *s_proto;83};8485struct protoent {86char *p_name;87char **p_aliases;88int p_proto;89};9091void sethostent (int);92void endhostent (void);93struct hostent *gethostent (void);9495void setnetent (int);96void endnetent (void);97struct netent *getnetent (void);98struct netent *getnetbyaddr (uint32_t, int);99struct netent *getnetbyname (const char *);100101void setservent (int);102void endservent (void);103struct servent *getservent (void);104struct servent *getservbyname (const char *, const char *);105struct servent *getservbyport (int, const char *);106107void setprotoent (int);108void endprotoent (void);109struct protoent *getprotoent (void);110struct protoent *getprotobyname (const char *);111struct protoent *getprotobynumber (int);112113#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) || defined(_POSIX_SOURCE) \114|| (defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE+0 < 200809L) \115|| (defined(_XOPEN_SOURCE) && _XOPEN_SOURCE+0 < 700)116struct hostent *gethostbyname (const char *);117struct hostent *gethostbyaddr (const void *, socklen_t, int);118#ifdef __GNUC__119__attribute__((const))120#endif121int *__h_errno_location(void);122#define h_errno (*__h_errno_location())123#define HOST_NOT_FOUND 1124#define TRY_AGAIN 2125#define NO_RECOVERY 3126#define NO_DATA 4127#define NO_ADDRESS NO_DATA128#endif129130#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)131void herror(const char *);132const char *hstrerror(int);133int gethostbyname_r(const char *, struct hostent *, char *, size_t, struct hostent **, int *);134int gethostbyname2_r(const char *, int, struct hostent *, char *, size_t, struct hostent **, int *);135struct hostent *gethostbyname2(const char *, int);136int gethostbyaddr_r(const void *, socklen_t, int, struct hostent *, char *, size_t, struct hostent **, int *);137int getservbyport_r(int, const char *, struct servent *, char *, size_t, struct servent **);138int getservbyname_r(const char *, const char *, struct servent *, char *, size_t, struct servent **);139#define EAI_NODATA -5140#define EAI_ADDRFAMILY -9141#define EAI_INPROGRESS -100142#define EAI_CANCELED -101143#define EAI_NOTCANCELED -102144#define EAI_ALLDONE -103145#define EAI_INTR -104146#define EAI_IDN_ENCODE -105147#define NI_MAXHOST 255148#define NI_MAXSERV 32149#endif150151152#ifdef __cplusplus153}154#endif155156#endif157158159