Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef IP_H
00016 #define IP_H
00017
00018 #include "getaddrinfo.h"
00019 #include "libpq/pqcomm.h"
00020
00021
00022 #ifdef HAVE_UNIX_SOCKETS
00023 #define IS_AF_UNIX(fam) ((fam) == AF_UNIX)
00024 #else
00025 #define IS_AF_UNIX(fam) (0)
00026 #endif
00027
00028 typedef void (*PgIfAddrCallback) (struct sockaddr * addr,
00029 struct sockaddr * netmask,
00030 void *cb_data);
00031
00032 extern int pg_getaddrinfo_all(const char *hostname, const char *servname,
00033 const struct addrinfo * hintp,
00034 struct addrinfo ** result);
00035 extern void pg_freeaddrinfo_all(int hint_ai_family, struct addrinfo * ai);
00036
00037 extern int pg_getnameinfo_all(const struct sockaddr_storage * addr, int salen,
00038 char *node, int nodelen,
00039 char *service, int servicelen,
00040 int flags);
00041
00042 extern int pg_range_sockaddr(const struct sockaddr_storage * addr,
00043 const struct sockaddr_storage * netaddr,
00044 const struct sockaddr_storage * netmask);
00045
00046 extern int pg_sockaddr_cidr_mask(struct sockaddr_storage * mask,
00047 char *numbits, int family);
00048
00049 #ifdef HAVE_IPV6
00050 extern void pg_promote_v4_to_v6_addr(struct sockaddr_storage * addr);
00051 extern void pg_promote_v4_to_v6_mask(struct sockaddr_storage * addr);
00052 #endif
00053
00054 extern int pg_foreach_ifaddr(PgIfAddrCallback callback, void *cb_data);
00055
00056 #endif