1/*-------------------------------------------------------------------------
2 *
3 * ip.h
4 * Definitions for IPv6-aware network access.
5 *
6 * These definitions are used by both frontend and backend code.
7 *
8 * Copyright (c) 2003-2019, PostgreSQL Global Development Group
9 *
10 * src/include/common/ip.h
11 *
12 *-------------------------------------------------------------------------
13 */
14#ifndef IP_H
15#define IP_H
16
17#include "getaddrinfo.h" /* pgrminclude ignore */
18#include "libpq/pqcomm.h" /* pgrminclude ignore */
19
20
21#ifdef HAVE_UNIX_SOCKETS
22#define IS_AF_UNIX(fam) ((fam) == AF_UNIX)
23#else
24#define IS_AF_UNIX(fam) (0)
25#endif
26
27extern int pg_getaddrinfo_all(const char *hostname, const char *servname,
28 const struct addrinfo *hintp,
29 struct addrinfo **result);
30extern void pg_freeaddrinfo_all(int hint_ai_family, struct addrinfo *ai);
31
32extern int pg_getnameinfo_all(const struct sockaddr_storage *addr, int salen,
33 char *node, int nodelen,
34 char *service, int servicelen,
35 int flags);
36
37#endif /* IP_H */
38