]> git.proxmox.com Git - mirror_edk2.git/commitdiff
StdLib/Include/netdb.h: Re-enable macros needed by socket applications and perform...
authordarylm503 <darylm503@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 26 Jan 2012 21:45:54 +0000 (21:45 +0000)
committerdarylm503 <darylm503@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 26 Jan 2012 21:45:54 +0000 (21:45 +0000)
Signed-off-by: darylm503
Reviewed-by: jcarsey
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12956 6f19259b-4bc3-4df7-8a09-765794883524

StdLib/Include/netdb.h

index e0d1a820823c0d66ae2de913622d3232dabda0dc..f50c8cea3187b617b8d8463d986268844d2243ca 100644 (file)
@@ -1,8 +1,16 @@
-/*     $NetBSD: netdb.h,v 1.55.2.1 2007/05/17 21:25:10 jdc Exp $       */\r
+/** @file\r
+\r
+    Copyright (c) 2012, Intel Corporation. All rights reserved.<BR>\r
+    This program and the accompanying materials\r
+    are licensed and made available under the terms and conditions of the BSD License\r
+    which accompanies this distribution.  The full text of the license may be found at\r
+    http://opensource.org/licenses/bsd-license.php\r
+\r
+    THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+    WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
 \r
-/*\r
  * Copyright (c) 1980, 1983, 1988, 1993\r
- *     The Regents of the University of California.  All rights reserved.\r
+ *  The Regents of the University of California.  All rights reserved.\r
  *\r
  * Redistribution and use in source and binary forms, with or without\r
  * modification, are permitted provided that the following conditions\r
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\r
  * SUCH DAMAGE.\r
  * -\r
- * --Copyright--\r
- */\r
-\r
-/*\r
- *      @(#)netdb.h    8.1 (Berkeley) 6/2/93\r
- *     Id: netdb.h,v 1.15.18.6 2006/10/02 01:23:09 marka Exp\r
+ *      @(#)netdb.h 8.1 (Berkeley) 6/2/93\r
+ *      netdb.h,v 1.15.18.6 2006/10/02 01:23:09 marka Exp\r
+ *      netdb.h,v 1.55.2.1 2007/05/17 21:25:10 jdc Exp\r
  */\r
-\r
 #ifndef _NETDB_H_\r
-#define        _NETDB_H_\r
+#define _NETDB_H_\r
 \r
 #include <machine/ansi.h>\r
 #include <machine/endian_machdep.h>\r
 #include <sys/featuretest.h>\r
 #include <inttypes.h>\r
 #include <paths.h>\r
-/*\r
- * Data types\r
- */\r
+\r
+/* Data types */\r
 #ifndef socklen_t\r
-typedef __socklen_t    socklen_t;\r
-#define        socklen_t       __socklen_t\r
+typedef __socklen_t socklen_t;\r
+#define socklen_t   __socklen_t\r
 #endif\r
 \r
 #ifdef _EFI_SIZE_T_\r
   typedef _EFI_SIZE_T_  size_t;\r
-  #undef _EFI_SIZE_T_\r
-  #undef _BSD_SIZE_T_\r
+  #undef  _EFI_SIZE_T_\r
+  #undef  _BSD_SIZE_T_\r
 #endif\r
 \r
 __BEGIN_DECLS\r
 extern int h_errno;\r
 __END_DECLS\r
 \r
-/*%\r
- * Structures returned by network data base library.  All addresses are\r
- * supplied in host order, and returned in network order (suitable for\r
- * use in system calls).\r
+/** Structures returned by network data base library.  All addresses are\r
+ *  supplied in host order, and returned in network order (suitable for\r
+ *  use in system calls).\r
  */\r
-struct hostent {\r
-       char    *h_name;        /*%< official name of host */\r
-       char    **h_aliases;    /*%< alias list */\r
-       int     h_addrtype;     /*%< host address type */\r
-       int     h_length;       /*%< length of address */\r
-       char    **h_addr_list;  /*%< list of addresses from name server */\r
-#define        h_addr  h_addr_list[0]  /*%< address, for backward compatiblity */\r
+struct  hostent {\r
+  char   *h_name;       /**< official name of host */\r
+  char  **h_aliases;    /**< alias list */\r
+  int     h_addrtype;   /**< host address type */\r
+  int     h_length;     /**< length of address */\r
+  char  **h_addr_list;  /**< list of addresses from name server */\r
 };\r
+#define h_addr  h_addr_list[0]  /**< address, for backward compatiblity */\r
 \r
-/*%\r
- * Assumption here is that a network number\r
- * fits in an unsigned long -- probably a poor one.\r
+/** Assumption here is that a network number\r
+ *  fits in an unsigned long -- probably a poor one.\r
  */\r
-struct netent {\r
-       char            *n_name;        /*%< official name of net */\r
-       char            **n_aliases;    /*%< alias list */\r
-       int             n_addrtype;     /*%< net address type */\r
-#if (defined(__sparc__) && defined(_LP64)) || \\r
-    (defined(__sh__) && defined(_LP64) && (_BYTE_ORDER == _BIG_ENDIAN))\r
-       int             __n_pad0;       /* ABI compatibility */\r
-#endif\r
-       uint32_t        n_net;          /*%< network # */\r
+struct  netent {\r
+  char     *n_name;     /**< official name of net */\r
+  char    **n_aliases;  /**< alias list */\r
+  int       n_addrtype; /**< net address type */\r
+  uint32_t  n_net;      /**< network # */\r
 #if defined(__alpha__) || (defined(__i386__) && defined(_LP64)) || \\r
     (defined(__sh__) && defined(_LP64) && (_BYTE_ORDER == _LITTLE_ENDIAN))\r
-       int             __n_pad0;       /* ABI compatibility */\r
+  int       __n_pad0;   /* ABI compatibility */\r
 #endif\r
 };\r
 \r
-struct servent {\r
-       char    *s_name;        /*%< official service name */\r
-       char    **s_aliases;    /*%< alias list */\r
-       int     s_port;         /*%< port # */\r
-       char    *s_proto;       /*%< protocol to use */\r
+struct  servent {\r
+  char   *s_name;     /**< official service name */\r
+  char  **s_aliases;  /**< alias list */\r
+  int     s_port;     /**< port # */\r
+  char   *s_proto;    /**< protocol to use */\r
 };\r
 \r
-struct protoent {\r
-       char    *p_name;        /*%< official protocol name */\r
-       char    **p_aliases;    /*%< alias list */\r
-       int     p_proto;        /*%< protocol # */\r
+struct  protoent {\r
+  char   *p_name;     /**< official protocol name */\r
+  char  **p_aliases;  /**< alias list */\r
+  int     p_proto;    /**< protocol # */\r
 };\r
 \r
-/*\r
- * Note: ai_addrlen used to be a size_t, per RFC 2553.\r
+/* Note: ai_addrlen used to be a size_t, per RFC 2553.\r
  * In XNS5.2, and subsequently in POSIX-2001 and\r
  * draft-ietf-ipngwg-rfc2553bis-02.txt it was changed to a socklen_t.\r
  * To accommodate for this while preserving binary compatibility with the\r
@@ -170,169 +166,104 @@ struct  protoent {
  * This should be deleted the next time the libc major number is\r
  * incremented.\r
  */\r
-#if (_POSIX_C_SOURCE - 0) >= 200112L || (_XOPEN_SOURCE - 0) >= 520 || \\r
-    defined(_NETBSD_SOURCE)\r
 struct addrinfo {\r
-       int             ai_flags;       /*%< AI_PASSIVE, AI_CANONNAME */\r
-       int             ai_family;      /*%< PF_xxx */\r
-       int             ai_socktype;    /*%< SOCK_xxx */\r
-       int             ai_protocol;    /*%< 0 or IPPROTO_xxx for IPv4 and IPv6 */\r
-#if defined(__sparc__) && defined(_LP64)\r
-       int             __ai_pad0;      /* ABI compatibility */\r
-#endif\r
-       socklen_t        ai_addrlen;    /*%< length of ai_addr */\r
+  int               ai_flags;     /**< AI_PASSIVE, AI_CANONNAME */\r
+  int               ai_family;    /**< PF_xxx */\r
+  int               ai_socktype;  /**< SOCK_xxx */\r
+  int               ai_protocol;  /**< 0 or IPPROTO_xxx for IPv4 and IPv6 */\r
+  socklen_t         ai_addrlen;   /**< length of ai_addr */\r
 #if defined(__alpha__) || (defined(__i386__) && defined(_LP64))\r
-       int             __ai_pad0;      /* ABI compatibility */\r
+  int               __ai_pad0;    /* ABI compatibility */\r
 #endif\r
-       char            *ai_canonname;  /*%< canonical name for hostname */\r
-       struct sockaddr *ai_addr;       /*%< binary address */\r
-       struct addrinfo *ai_next;       /*%< next structure in linked list */\r
+  char             *ai_canonname; /**< canonical name for hostname */\r
+  struct sockaddr  *ai_addr;      /**< binary address */\r
+  struct addrinfo  *ai_next;      /**< next structure in linked list */\r
 };\r
-#endif\r
 \r
-/*%\r
- * Error return codes from gethostbyname() and gethostbyaddr()\r
+/* Error return codes from gethostbyname() and gethostbyaddr()\r
  * (left in extern int h_errno).\r
- */\r
+*/\r
 \r
-#if defined(_NETBSD_SOURCE)\r
-#define        NETDB_INTERNAL  -1      /*%< see errno */\r
-#define        NETDB_SUCCESS   0       /*%< no problem */\r
-#endif\r
-#define        NO_ADDRESS      NO_DATA         /* no address, look for MX record */\r
-#define        HOST_NOT_FOUND  1 /*%< Authoritative Answer Host not found */\r
-#define        TRY_AGAIN       2 /*%< Non-Authoritive Host not found, or SERVERFAIL */\r
-#define        NO_RECOVERY     3 /*%< Non recoverable errors, FORMERR, REFUSED, NOTIMP */\r
-#define        NO_DATA         4 /*%< Valid name, no data record of requested type */\r
+#define NETDB_INTERNAL   -1         /**< see errno */\r
+#define NETDB_SUCCESS     0         /**< no problem */\r
+#define NO_ADDRESS        NO_DATA   /* no address, look for MX record */\r
+#define HOST_NOT_FOUND    1         /**< Authoritative Answer Host not found */\r
+#define TRY_AGAIN         2         /**< Non-Authoritive Host not found, or SERVERFAIL */\r
+#define NO_RECOVERY       3         /**< Non recoverable errors, FORMERR, REFUSED, NOTIMP */\r
+#define NO_DATA           4         /**< Valid name, no data record of requested type */\r
 \r
-/*\r
- * Error return codes from getaddrinfo()\r
- */\r
-#if 0  //  Not supported by UEFI\r
-#if (_POSIX_C_SOURCE - 0) >= 200112L || (_XOPEN_SOURCE - 0) >= 520 || \\r
-    defined(_NETBSD_SOURCE)\r
-#define        EAI_ADDRFAMILY   1      /*%< address family for hostname not supported */\r
-#define        EAI_AGAIN        2      /*%< temporary failure in name resolution */\r
-#define        EAI_BADFLAGS     3      /*%< invalid value for ai_flags */\r
-#define        EAI_FAIL         4      /*%< non-recoverable failure in name resolution */\r
-#define        EAI_FAMILY       5      /*%< ai_family not supported */\r
-#define        EAI_MEMORY       6      /*%< memory allocation failure */\r
-#define        EAI_NODATA       7      /*%< no address associated with hostname */\r
-#define        EAI_NONAME       8      /*%< hostname nor servname provided, or not known */\r
-#define        EAI_SERVICE      9      /*%< servname not supported for ai_socktype */\r
-#define        EAI_SOCKTYPE    10      /*%< ai_socktype not supported */\r
-#define        EAI_SYSTEM      11      /*%< system error returned in errno */\r
-#define        EAI_BADHINTS    12      /* invalid value for hints */\r
-#define        EAI_PROTOCOL    13      /* resolved protocol is unknown */\r
-#define        EAI_OVERFLOW    14      /* argument buffer overflow */\r
-#define        EAI_MAX         15\r
-#endif /* _POSIX_C_SOURCE >= 200112 || _XOPEN_SOURCE >= 520 || _NETBSD_SOURCE */\r
-#endif  // 0  Not supported by UEFI\r
+/* Error return codes from getaddrinfo() */\r
+#define EAI_ADDRFAMILY    1   /**< address family for hostname not supported */\r
+#define EAI_AGAIN         2   /**< temporary failure in name resolution */\r
+#define EAI_BADFLAGS      3   /**< invalid value for ai_flags */\r
+#define EAI_FAIL          4   /**< non-recoverable failure in name resolution */\r
+#define EAI_FAMILY        5   /**< ai_family not supported */\r
+#define EAI_MEMORY        6   /**< memory allocation failure */\r
+#define EAI_NODATA        7   /**< no address associated with hostname */\r
+#define EAI_NONAME        8   /**< hostname nor servname provided, or not known */\r
+#define EAI_SERVICE       9   /**< servname not supported for ai_socktype */\r
+#define EAI_SOCKTYPE      10  /**< ai_socktype not supported */\r
+#define EAI_SYSTEM        11  /**< system error returned in errno */\r
+#define EAI_BADHINTS      12  /**< invalid value for hints */\r
+#define EAI_PROTOCOL      13  /**< resolved protocol is unknown */\r
+#define EAI_OVERFLOW      14  /**< argument buffer overflow */\r
+#define EAI_MAX           15\r
 \r
-/*%\r
- * Flag values for getaddrinfo()\r
- */\r
-#if 0  //  Not supported by UEFI\r
-#if (_POSIX_C_SOURCE - 0) >= 200112L || (_XOPEN_SOURCE - 0) >= 520 || \\r
-    defined(_NETBSD_SOURCE)\r
-#define        AI_PASSIVE      0x00000001 /* get address to use bind() */\r
-#endif\r
-#endif  // 0  Not supported by UEFI\r
-\r
-#define AI_CANONNAME  0x00000002 /* fill ai_canonname */\r
+/* Flag values for getaddrinfo() */\r
+#define AI_PASSIVE      0x00000001  /* get address to use bind() */\r
+#define AI_CANONNAME    0x00000002  /* fill ai_canonname */\r
 \r
-#if 0  //  Not supported by UEFI\r
-#if (_POSIX_C_SOURCE - 0) >= 200112L || (_XOPEN_SOURCE - 0) >= 520 || \\r
-    defined(_NETBSD_SOURCE)\r
-#define        AI_NUMERICHOST  0x00000004 /* prevent host name resolution */\r
-#define        AI_NUMERICSERV  0x00000008 /* prevent service name resolution */\r
+#define AI_NUMERICHOST  0x00000004  /* prevent host name resolution */\r
+#define AI_NUMERICSERV  0x00000008  /* prevent service name resolution */\r
 /* valid flags for addrinfo (not a standard def, apps should not use it) */\r
-#define        AI_MASK \\r
-    (AI_PASSIVE | AI_CANONNAME | AI_NUMERICHOST | AI_NUMERICSERV)\r
-#endif\r
-#endif  // 0  Not supported by UEFI\r
+#define AI_MASK         (AI_PASSIVE | AI_CANONNAME | AI_NUMERICHOST | AI_NUMERICSERV)\r
 \r
-/*%\r
- * Constants for getnameinfo()\r
- */\r
-////#if defined(_NETBSD_SOURCE)\r
-#define        NI_MAXHOST      1025\r
-#define        NI_MAXSERV      32\r
-////#endif\r
+/* Constants for getnameinfo() */\r
+#define NI_MAXHOST      1025\r
+#define NI_MAXSERV      32\r
 \r
-/*%\r
- * Flag values for getnameinfo()\r
- */\r
-////#define    NI_NOFQDN       0x00000001\r
+/* Flag values for getnameinfo() */\r
+#define NI_NOFQDN       0x00000001\r
 #define NI_NUMERICHOST  0x00000002\r
-////#define    NI_NAMEREQD     0x00000004\r
+#define NI_NAMEREQD     0x00000004\r
 #define NI_NUMERICSERV  0x00000008\r
-////#define    NI_DGRAM        0x00000010\r
-////#define    NI_NUMERICSCOPE 0x00000040\r
+#define NI_DGRAM        0x00000010\r
+#define NI_NUMERICSCOPE 0x00000040\r
 \r
-#if 0  //  Not supported by UEFI\r
-#if (_POSIX_C_SOURCE - 0) >= 200112L || (_XOPEN_SOURCE - 0) >= 520 || \\r
-    defined(_NETBSD_SOURCE)\r
-/*%\r
- * Scope delimit character\r
- */\r
-#if defined(_NETBSD_SOURCE)\r
-#define        SCOPE_DELIMITER '%'\r
-#endif\r
-#endif /* (_POSIX_C_SOURCE - 0) >= 200112L || ... */\r
-#endif  // 0  Not supported by UEFI\r
+/** Scope delimit character */\r
+#define SCOPE_DELIMITER '%'\r
 \r
 __BEGIN_DECLS\r
-void           endhostent(void);\r
-void           endnetent(void);\r
-void           endprotoent(void);\r
-void           endservent(void);\r
-#if 0  //  Not supported by UEFI\r
-#if (_XOPEN_SOURCE - 0) >= 520 && (_XOPEN_SOURCE - 0) < 600 || \\r
-    defined(_NETBSD_SOURCE)\r
-#if 0 /* we do not ship this */\r
-void           freehostent(struct hostent *);\r
-#endif\r
-#endif\r
-#endif  // 0  Not supported by UEFI\r
-struct hostent *gethostbyaddr(const char *, socklen_t, int);\r
-struct hostent *gethostbyname(const char *);\r
-#if defined(_NETBSD_SOURCE)\r
-struct hostent *gethostbyname2(const char *, int);\r
-#endif\r
-struct hostent *gethostent(void);\r
-struct netent  *getnetbyaddr(uint32_t, int);\r
-struct netent  *getnetbyname(const char *);\r
-struct netent  *getnetent(void);\r
-struct protoent        *getprotobyname(const char *);\r
-struct protoent        *getprotobynumber(int);\r
-struct protoent        *getprotoent(void);\r
-struct servent *getservbyname(const char *, const char *);\r
-struct servent *getservbyport(int, const char *);\r
-struct servent *getservent(void);\r
-////#if defined(_NETBSD_SOURCE)\r
-////void               herror(const char *);\r
-////const char *hstrerror(int);\r
-////#endif\r
-void           sethostent(int);\r
-////#if defined(_NETBSD_SOURCE)\r
-/* void                sethostfile(const char *); */\r
-////#endif\r
-void           setnetent(int);\r
-void           setprotoent(int);\r
-#if (_POSIX_C_SOURCE - 0) >= 200112L || (_XOPEN_SOURCE - 0) >= 520 || \\r
-    defined(_NETBSD_SOURCE)\r
-void           setservent(int);\r
-int            getaddrinfo(const char * __restrict, const char * __restrict,\r
-                                const struct addrinfo * __restrict,\r
-                                struct addrinfo ** __restrict);\r
-int            getnameinfo(const struct sockaddr * __restrict, socklen_t,\r
-                                char * __restrict, socklen_t,\r
-                                char * __restrict, socklen_t, int);\r
-void           freeaddrinfo(struct addrinfo *);\r
-const char     *gai_strerror(int);\r
-#endif\r
-void           setservent(int);\r
+void              endhostent      (void);\r
+void              endnetent       (void);\r
+void              endprotoent     (void);\r
+void              endservent      (void);\r
+struct hostent   *gethostbyaddr   (const char *, socklen_t, int);\r
+struct hostent   *gethostbyname   (const char *);\r
+struct hostent   *gethostbyname2  (const char *, int);\r
+struct hostent   *gethostent      (void);\r
+struct netent    *getnetbyaddr    (uint32_t, int);\r
+struct netent    *getnetbyname    (const char *);\r
+struct netent    *getnetent       (void);\r
+struct protoent  *getprotobyname  (const char *);\r
+struct protoent  *getprotobynumber(int);\r
+struct protoent  *getprotoent     (void);\r
+struct servent   *getservbyname   (const char *, const char *);\r
+struct servent   *getservbyport   (int, const char *);\r
+struct servent   *getservent      (void);\r
+void              sethostent      (int);\r
+void              setnetent       (int);\r
+void              setprotoent     (int);\r
+void              setservent      (int);\r
+int               getaddrinfo     ( const char * __restrict, const char * __restrict,\r
+                                    const struct addrinfo * __restrict,\r
+                                    struct addrinfo ** __restrict);\r
+int               getnameinfo     ( const struct sockaddr * __restrict, socklen_t,\r
+                                    char * __restrict, socklen_t,\r
+                                    char * __restrict, socklen_t, int);\r
+void              freeaddrinfo    (struct addrinfo *);\r
+const char       *gai_strerror    (int);\r
+void              setservent      (int);\r
 \r
 __END_DECLS\r
 \r