| 1 | /*
|
|---|
| 2 | PostgreSQL Database Management System
|
|---|
| 3 | (formerly known as Postgres, then as Postgres95)
|
|---|
| 4 |
|
|---|
| 5 | Portions Copyright (c) 1996-2005, The PostgreSQL Global Development Group
|
|---|
| 6 |
|
|---|
| 7 | Portions Copyright (c) 1994, The Regents of the University of California
|
|---|
| 8 |
|
|---|
| 9 | Permission to use, copy, modify, and distribute this software and its
|
|---|
| 10 | documentation for any purpose, without fee, and without a written agreement
|
|---|
| 11 | is hereby granted, provided that the above copyright notice and this paragraph
|
|---|
| 12 | and the following two paragraphs appear in all copies.
|
|---|
| 13 |
|
|---|
| 14 | IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
|
|---|
| 15 | DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING
|
|---|
| 16 | LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION,
|
|---|
| 17 | EVEN IF THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF
|
|---|
| 18 | SUCH DAMAGE.
|
|---|
| 19 |
|
|---|
| 20 | THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
|
|---|
| 21 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
|---|
| 22 | AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
|
|---|
| 23 | ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATIONS
|
|---|
| 24 | TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
|---|
| 25 |
|
|---|
| 26 | */
|
|---|
| 27 |
|
|---|
| 28 | /*-------------------------------------------------------------------------
|
|---|
| 29 | *
|
|---|
| 30 | * getaddrinfo.h
|
|---|
| 31 | * Support getaddrinfo() on platforms that don't have it.
|
|---|
| 32 | *
|
|---|
| 33 | * Note: we use our own routines on platforms that don't HAVE_STRUCT_ADDRINFO,
|
|---|
| 34 | * whether or not the library routine getaddrinfo() can be found. This
|
|---|
| 35 | * policy is needed because on some platforms a manually installed libbind.a
|
|---|
| 36 | * may provide getaddrinfo(), yet the system headers may not provide the
|
|---|
| 37 | * struct definitions needed to call it. To avoid conflict with the libbind
|
|---|
| 38 | * definition in such cases, we rename our routines to pg_xxx() via macros.
|
|---|
| 39 | *
|
|---|
| 40 |
|
|---|
| 41 | in lib/replace we use rep_xxx()
|
|---|
| 42 |
|
|---|
| 43 | * This code will also work on platforms where struct addrinfo is defined
|
|---|
| 44 | * in the system headers but no getaddrinfo() can be located.
|
|---|
| 45 | *
|
|---|
| 46 | * Copyright (c) 2003-2007, PostgreSQL Global Development Group
|
|---|
| 47 | *
|
|---|
| 48 | *-------------------------------------------------------------------------
|
|---|
| 49 | */
|
|---|
| 50 | #ifndef GETADDRINFO_H
|
|---|
| 51 | #define GETADDRINFO_H
|
|---|
| 52 |
|
|---|
| 53 | #ifndef HAVE_GETADDRINFO
|
|---|
| 54 |
|
|---|
| 55 | /* Rename private copies per comments above */
|
|---|
| 56 | #ifdef getaddrinfo
|
|---|
| 57 | #undef getaddrinfo
|
|---|
| 58 | #endif
|
|---|
| 59 | #define getaddrinfo rep_getaddrinfo
|
|---|
| 60 | #define HAVE_GETADDRINFO
|
|---|
| 61 |
|
|---|
| 62 | #ifdef freeaddrinfo
|
|---|
| 63 | #undef freeaddrinfo
|
|---|
| 64 | #endif
|
|---|
| 65 | #define freeaddrinfo rep_freeaddrinfo
|
|---|
| 66 | #define HAVE_FREEADDRINFO
|
|---|
| 67 |
|
|---|
| 68 | #ifdef gai_strerror
|
|---|
| 69 | #undef gai_strerror
|
|---|
| 70 | #endif
|
|---|
| 71 | #define gai_strerror rep_gai_strerror
|
|---|
| 72 | #define HAVE_GAI_STRERROR
|
|---|
| 73 |
|
|---|
| 74 | #ifdef getnameinfo
|
|---|
| 75 | #undef getnameinfo
|
|---|
| 76 | #endif
|
|---|
| 77 | #define getnameinfo rep_getnameinfo
|
|---|
| 78 | #ifndef HAVE_GETNAMEINFO
|
|---|
| 79 | #define HAVE_GETNAMEINFO
|
|---|
| 80 | #endif
|
|---|
| 81 |
|
|---|
| 82 | extern int rep_getaddrinfo(const char *node, const char *service,
|
|---|
| 83 | const struct addrinfo * hints, struct addrinfo ** res);
|
|---|
| 84 | extern void rep_freeaddrinfo(struct addrinfo * res);
|
|---|
| 85 | extern const char *rep_gai_strerror(int errcode);
|
|---|
| 86 | extern int rep_getnameinfo(const struct sockaddr * sa, socklen_t salen,
|
|---|
| 87 | char *node, size_t nodelen,
|
|---|
| 88 | char *service, size_t servicelen, int flags);
|
|---|
| 89 | #endif /* HAVE_GETADDRINFO */
|
|---|
| 90 |
|
|---|
| 91 | #endif /* GETADDRINFO_H */
|
|---|