Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * (C) 2001-2012 Marmalade. All Rights Reserved.
- *
- * This document is protected by copyright, and contains information
- * proprietary to Marmalade.
- *
- * This file consists of source code released by Marmalade under
- * the terms of the accompanying End User License Agreement (EULA).
- * Please do not use this program/source code before you have read the
- * EULA and have agreed to be bound by its terms.
- */
- #ifndef IW_NETDB_H
- #define IW_NETDB_H
- #include <sys/types.h>
- #include <sys/socket.h>
- #define NETDB_INTERNAL -1 /* see errno */
- #define NETDB_SUCCESS 0 /* no problem */
- #define HOST_NOT_FOUND 1 /* Authoritative Answer Host not found */
- #define TRY_AGAIN 2 /* Non-Authoritative Host not found, or SERVERFAIL */
- #define NO_RECOVERY 3 /* Non recoverable errors, FORMERR, REFUSED, NOTIMP */
- #define NO_DATA 4 /* Valid name, no data record of requested type */
- #define NO_ADDRESS NO_DATA /* no address, look for MX record */
- #define AI_PASSIVE 0x0001 /* Socket address is intended for `bind'. */
- #define AI_CANONNAME 0x0002 /* Request for canonical name. */
- #define AI_NUMERICHOST 0x0004 /* Don't use name resolution. */
- #define NI_NUMERICHOST 1 /* Don't try to look up hostname. */
- #define NI_NUMERICSERV 2 /* Don't convert port number to name. */
- #define NI_NOFQDN 4 /* Only return nodename portion. */
- #define NI_NAMEREQD 8 /* Don't return numeric addresses. */
- #define NI_DGRAM 16 /* Look up UDP service rather than TCP. */
- #define NI_MAXHOST 1025
- #define NI_MAXSERV 32
- #define EAI_BADFLAGS -1 /* Invalid value for `ai_flags' field. */
- #define EAI_NONAME -2 /* NAME or SERVICE is unknown. */
- #define EAI_AGAIN -3 /* Temporary failure in name resolution. */
- #define EAI_FAIL -4 /* Non-recoverable failure in name res. */
- #define EAI_FAMILY -6 /* `ai_family' not supported. */
- #define EAI_SOCKTYPE -7 /* `ai_socktype' not supported. */
- #define EAI_SERVICE -8 /* SERVICE not supported for `ai_socktype'. */
- #define EAI_MEMORY -10 /* Memory allocation failure. */
- #define EAI_SYSTEM -11 /* System error returned in `errno'. */
- #define EAI_OVERFLOW -12 /* Argument buffer overflow. */
- 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 servent
- {
- char *s_name; /* official service name */
- char **s_aliases; /* alias list */
- int s_port; /* port number */
- char *s_proto; /* protocol to use */
- };
- struct protoent
- {
- char *p_name; /* Official protocol name. */
- char **p_aliases; /* Alias list. */
- int p_proto; /* Protocol number. */
- };
- struct addrinfo
- {
- int ai_flags;
- int ai_family;
- int ai_socktype;
- int ai_protocol;
- size_t ai_addrlen;
- struct sockaddr *ai_addr;
- char *ai_canonname;
- struct addrinfo *ai_next;
- };
- S3E_BEGIN_C_DECL
- struct hostent *gethostbyname(const char *name);
- struct hostent *gethostbyaddr(const void *addr, socklen_t len, int type);
- int gethostbyname_r(const char *name, struct hostent *ret, char *buf, size_t buflen, struct hostent **result, int *h_errnop);
- struct protoent *getprotoent(void);
- struct protoent *getprotobyname(const char *name);
- struct protoent *getprotobynumber(int proto);
- void setprotoent(int stayopen);
- void endprotoent(void);
- struct servent *getservent(void);
- struct servent *getservbyname(const char *name, const char *proto);
- struct servent *getservbyport(int port, const char *proto);
- void setservent(int stayopen);
- void endservent(void);
- int getaddrinfo(const char *node, const char *service, const struct addrinfo *hints, struct addrinfo **res);
- void freeaddrinfo(struct addrinfo *res);
- const char *gai_strerror(int errcode);
- int getnameinfo(const struct sockaddr *sa, socklen_t salen, char *host, size_t hostlen, char *serv, size_t servlen, int flags);
- #define H_ERRNO_NAME iw_h_errno
- extern int H_ERRNO_NAME;
- #define h_errno H_ERRNO_NAME
- S3E_END_C_DECL
- #endif /* !IW_NETDB_H */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement