libctru/libctru/include/netdb.h

79 lines
1.8 KiB
C
Raw Normal View History

2014-11-20 22:36:50 +01:00
#pragma once
#include <netinet/in.h>
#define HOST_NOT_FOUND 1
#define NO_DATA 2
#define NO_ADDRESS NO_DATA
#define NO_RECOVERY 3
#define TRY_AGAIN 4
struct hostent {
2014-11-20 22:36:50 +01:00
char *h_name;
char **h_aliases;
int h_addrtype;
int h_length;
char **h_addr_list;
char *h_addr;
};
2016-01-13 18:20:33 +01:00
#define AI_PASSIVE 0x01
#define AI_CANONNAME 0x02
#define AI_NUMERICHOST 0x04
#define AI_NUMERICSERV 0x00 /* probably 0x08 but services names are never resolved */
// doesn't apply to 3ds
#define AI_ADDRCONFIG 0x00
2016-01-13 18:18:16 +01:00
#define NI_MAXHOST 1025
#define NI_MAXSERV 32
#define NI_NOFQDN 0x01
#define NI_NUMERICHOST 0x02
#define NI_NAMEREQD 0x04
#define NI_NUMERICSERV 0x00 /* probably 0x08 but services names are never resolved */
#define NI_DGRAM 0x00 /* probably 0x10 but services names are never resolved */
#define EAI_FAMILY (-303)
#define EAI_MEMORY (-304)
#define EAI_NONAME (-305)
#define EAI_SOCKTYPE (-307)
2016-01-13 18:20:33 +01:00
struct addrinfo {
int ai_flags;
int ai_family;
int ai_socktype;
int ai_protocol;
socklen_t ai_addrlen;
char *ai_canonname;
struct sockaddr *ai_addr;
struct addrinfo *ai_next;
};
2016-01-13 18:18:16 +01:00
#ifdef __cplusplus
extern "C" {
#endif
2014-11-20 22:36:50 +01:00
extern int h_errno;
struct hostent* gethostbyname(const char *name);
2015-08-19 00:15:21 +02:00
struct hostent* gethostbyaddr(const void *addr, socklen_t len, int type);
2015-01-24 21:14:06 +01:00
void herror(const char *s);
const char* hstrerror(int err);
2016-01-13 18:18:16 +01:00
int getnameinfo(const struct sockaddr *sa, socklen_t salen,
char *host, socklen_t hostlen,
char *serv, socklen_t servlen, int flags);
2016-01-13 18:20:33 +01:00
int getaddrinfo(const char *node, const char *service,
const struct addrinfo *hints,
struct addrinfo **res);
void freeaddrinfo(struct addrinfo *ai);
2016-01-13 23:20:46 +01:00
const char *gai_strerror(int ecode);
#ifdef __cplusplus
2014-11-20 22:36:50 +01:00
}
#endif