1 /*-------------------------------------------------------------------------
4 * Definitions for IPv6-aware network access.
6 * These definitions are used by both frontend and backend code. Be careful
7 * what you include here!
9 * Copyright (c) 2003-2009, PostgreSQL Global Development Group
13 *-------------------------------------------------------------------------
18 #include "getaddrinfo.h"
19 #include "libpq/pqcomm.h"
22 extern int pg_getaddrinfo_all(const char *hostname
, const char *servname
,
23 const struct addrinfo
* hintp
,
24 struct addrinfo
** result
);
25 extern void pg_freeaddrinfo_all(int hint_ai_family
, struct addrinfo
* ai
);
27 extern int pg_getnameinfo_all(const struct sockaddr_storage
* addr
, int salen
,
28 char *node
, int nodelen
,
29 char *service
, int servicelen
,
32 extern int pg_range_sockaddr(const struct sockaddr_storage
* addr
,
33 const struct sockaddr_storage
* netaddr
,
34 const struct sockaddr_storage
* netmask
);
36 extern int pg_sockaddr_cidr_mask(struct sockaddr_storage
* mask
,
37 char *numbits
, int family
);
40 extern void pg_promote_v4_to_v6_addr(struct sockaddr_storage
* addr
);
41 extern void pg_promote_v4_to_v6_mask(struct sockaddr_storage
* addr
);
44 #ifdef HAVE_UNIX_SOCKETS
45 #define IS_AF_UNIX(fam) ((fam) == AF_UNIX)
47 #define IS_AF_UNIX(fam) (0)