diff options
author | Peter Eisentraut <peter_e@gmx.net> | 2003-03-29 11:31:52 +0000 |
---|---|---|
committer | Peter Eisentraut <peter_e@gmx.net> | 2003-03-29 11:31:52 +0000 |
commit | 82a91eb54ed0c6561050a0ae01661ea6302445ba (patch) | |
tree | 8c22569ca08a298eeb613ba4ba417ce2df0b6a83 /src/include/getaddrinfo.h | |
parent | bf7ca0a7697551aba8e1d8a130c803d4f2c011d4 (diff) | |
download | postgresql-82a91eb54ed0c6561050a0ae01661ea6302445ba.tar.gz |
Simplify the socket handling code by supplying a replacement getaddrinfo()
function if the OS doesn't provide one.
Diffstat (limited to 'src/include/getaddrinfo.h')
-rw-r--r-- | src/include/getaddrinfo.h | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/src/include/getaddrinfo.h b/src/include/getaddrinfo.h new file mode 100644 index 0000000000..7933f93d70 --- /dev/null +++ b/src/include/getaddrinfo.h @@ -0,0 +1,43 @@ +/* $Header: /cvsroot/pgsql/src/include/getaddrinfo.h,v 1.1 2003/03/29 11:31:51 petere Exp $ */ + +#ifndef GETADDRINFO_H +#define GETADDRINFO_H + +#include "c.h" +#include <netdb.h> + + +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; +}; + + +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); + + +#define EAI_BADFLAGS -1 +#define EAI_NONAME -2 +#define EAI_AGAIN -3 +#define EAI_FAIL -4 +#define EAI_NODATA -5 +#define EAI_FAMILY -6 +#define EAI_SOCKTYPE -7 +#define EAI_SERVICE -8 +#define EAI_ADDRFAMILY -9 +#define EAI_MEMORY -10 +#define EAI_SYSTEM -11 + +#define AI_PASSIVE 0x0001 +#define AI_NUMERICHOST 0x0004 + +#endif /* GETADDRINFO_H */ |