X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Fnetdb.in.h;h=6951d3da493088544f5bf6c1850346447f1aad4a;hb=61c4bf636e62c93ea141536d90e5ef06f9b74ad5;hp=2edd98bd26724e4179af8984dd7ba67a5e61eceb;hpb=6078aa42b957125a74ba72092d932eb730c10caf;p=gnulib.git diff --git a/lib/netdb.in.h b/lib/netdb.in.h index 2edd98bd2..6951d3da4 100644 --- a/lib/netdb.in.h +++ b/lib/netdb.in.h @@ -1,5 +1,5 @@ /* Provide a netdb.h header file for systems lacking it (read: MinGW). - Copyright (C) 2008-2010 Free Software Foundation, Inc. + Copyright (C) 2008-2011 Free Software Foundation, Inc. Written by Simon Josefsson. This program is free software; you can redistribute it and/or modify @@ -22,11 +22,12 @@ #ifndef _GL_NETDB_H -#if @HAVE_NETDB_H@ - -# if __GNUC__ >= 3 +#if __GNUC__ >= 3 @PRAGMA_SYSTEM_HEADER@ -# endif +#endif +@PRAGMA_COLUMNS@ + +#if @HAVE_NETDB_H@ /* The include_next requires a split double-inclusion guard. */ # @INCLUDE_NEXT@ @NEXT_NETDB_H@ @@ -36,11 +37,16 @@ #ifndef _GL_NETDB_H #define _GL_NETDB_H -/* Get netdb.h definitions such as struct hostent for MinGW. */ +/* Get definitions such as 'socklen_t' on IRIX 6.5 and OSF/1 4.0 and + 'struct hostent' on MinGW. */ #include +/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ + /* The definition of _GL_ARG_NONNULL is copied here. */ +/* The definition of _GL_WARN_ON_USE is copied here. */ + /* Declarations for a platform that lacks , or where it is incomplete. */ @@ -48,6 +54,11 @@ # if !@HAVE_STRUCT_ADDRINFO@ +# ifdef __cplusplus +extern "C" { +# endif + +# if !GNULIB_defined_struct_addrinfo /* Structure to contain information about address of a service provider. */ struct addrinfo { @@ -60,6 +71,13 @@ struct addrinfo char *ai_canonname; /* Canonical name for service location. */ struct addrinfo *ai_next; /* Pointer to next in list. */ }; +# define GNULIB_defined_struct_addrinfo 1 +# endif + +# ifdef __cplusplus +} +# endif + # endif /* Possible values for `ai_flags' field in `addrinfo' structure. */ @@ -146,37 +164,67 @@ struct addrinfo socket addresses. For more details, see the POSIX:2001 specification . */ -extern int getaddrinfo (const char *restrict nodename, - const char *restrict servname, - const struct addrinfo *restrict hints, - struct addrinfo **restrict res) - _GL_ARG_NONNULL ((4)); +_GL_FUNCDECL_SYS (getaddrinfo, int, + (const char *restrict nodename, + const char *restrict servname, + const struct addrinfo *restrict hints, + struct addrinfo **restrict res) + _GL_ARG_NONNULL ((4))); # endif +_GL_CXXALIAS_SYS (getaddrinfo, int, + (const char *restrict nodename, + const char *restrict servname, + const struct addrinfo *restrict hints, + struct addrinfo **restrict res)); +_GL_CXXALIASWARN (getaddrinfo); # if !@HAVE_DECL_FREEADDRINFO@ /* Free `addrinfo' structure AI including associated storage. For more details, see the POSIX:2001 specification . */ -extern void freeaddrinfo (struct addrinfo *ai) _GL_ARG_NONNULL ((1)); +_GL_FUNCDECL_SYS (freeaddrinfo, void, (struct addrinfo *ai) + _GL_ARG_NONNULL ((1))); # endif +_GL_CXXALIAS_SYS (freeaddrinfo, void, (struct addrinfo *ai)); +_GL_CXXALIASWARN (freeaddrinfo); -# if !@HAVE_DECL_GAI_STRERROR@ +# if @REPLACE_GAI_STRERROR@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef gai_strerror +# define gai_strerror rpl_gai_strerror +# endif +_GL_FUNCDECL_RPL (gai_strerror, const char *, (int ecode)); +_GL_CXXALIAS_RPL (gai_strerror, const char *, (int ecode)); +# else +# if !@HAVE_DECL_GAI_STRERROR@ /* Convert error return from getaddrinfo() to a string. For more details, see the POSIX:2001 specification . */ -extern const char *gai_strerror (int ecode); +_GL_FUNCDECL_SYS (gai_strerror, const char *, (int ecode)); +# endif +_GL_CXXALIAS_SYS (gai_strerror, const char *, (int ecode)); # endif +_GL_CXXALIASWARN (gai_strerror); # if !@HAVE_DECL_GETNAMEINFO@ /* Convert socket address to printable node and service names. For more details, see the POSIX:2001 specification . */ -extern int getnameinfo(const struct sockaddr *restrict sa, socklen_t salen, - char *restrict node, socklen_t nodelen, - char *restrict service, socklen_t servicelen, - int flags) - _GL_ARG_NONNULL ((1)); +_GL_FUNCDECL_SYS (getnameinfo, int, + (const struct sockaddr *restrict sa, socklen_t salen, + char *restrict node, socklen_t nodelen, + char *restrict service, socklen_t servicelen, + int flags) + _GL_ARG_NONNULL ((1))); # endif +/* Need to cast, because on glibc systems, the seventh parameter is + unsigned int flags. */ +_GL_CXXALIAS_SYS_CAST (getnameinfo, int, + (const struct sockaddr *restrict sa, socklen_t salen, + char *restrict node, socklen_t nodelen, + char *restrict service, socklen_t servicelen, + int flags)); +_GL_CXXALIASWARN (getnameinfo); /* Possible flags for getnameinfo. */ # ifndef NI_NUMERICHOST @@ -186,7 +234,33 @@ extern int getnameinfo(const struct sockaddr *restrict sa, socklen_t salen, # define NI_NUMERICSERV 2 # endif -#endif /* @GNULIB_GETADDRINFO@ */ +#elif defined GNULIB_POSIXCHECK + +# undef getaddrinfo +# if HAVE_RAW_DECL_GETADDRINFO +_GL_WARN_ON_USE (getaddrinfo, "getaddrinfo is unportable - " + "use gnulib module getaddrinfo for portability"); +# endif + +# undef freeaddrinfo +# if HAVE_RAW_DECL_FREEADDRINFO +_GL_WARN_ON_USE (freeaddrinfo, "freeaddrinfo is unportable - " + "use gnulib module getaddrinfo for portability"); +# endif + +# undef gai_strerror +# if HAVE_RAW_DECL_GAI_STRERROR +_GL_WARN_ON_USE (gai_strerror, "gai_strerror is unportable - " + "use gnulib module getaddrinfo for portability"); +# endif + +# undef getnameinfo +# if HAVE_RAW_DECL_GETNAMEINFO +_GL_WARN_ON_USE (getnameinfo, "getnameinfo is unportable - " + "use gnulib module getaddrinfo for portability"); +# endif + +#endif #endif /* _GL_NETDB_H */ #endif /* _GL_NETDB_H */