netdb.h
上传用户:luoyougen
上传日期:2008-05-12
资源大小:23136k
文件大小:5k
源码类别:

VxWorks

开发平台:

C/C++

  1. /* netdb.h - server entries and the like for routed/rip */
  2. /*-
  3.  * Copyright (c) 1980, 1983, 1988, 1993
  4.  * The Regents of the University of California.  All rights reserved.
  5.  *
  6.  * Redistribution and use in source and binary forms, with or without
  7.  * modification, are permitted provided that the following conditions
  8.  * are met:
  9.  * 1. Redistributions of source code must retain the above copyright
  10.  *    notice, this list of conditions and the following disclaimer.
  11.  * 2. Redistributions in binary form must reproduce the above copyright
  12.  *    notice, this list of conditions and the following disclaimer in the
  13.  *    documentation and/or other materials provided with the distribution.
  14.  * 3. All advertising materials mentioning features or use of this software
  15.  *    must display the following acknowledgement:
  16.  * This product includes software developed by the University of
  17.  * California, Berkeley and its contributors.
  18.  * 4. Neither the name of the University nor the names of its contributors
  19.  *    may be used to endorse or promote products derived from this software
  20.  *    without specific prior written permission.
  21.  *
  22.  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  23.  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  24.  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  25.  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  26.  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  27.  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  28.  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  29.  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  30.  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  31.  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  32.  * SUCH DAMAGE.
  33.  *
  34.  *      @(#)netdb.h 8.1 (Berkeley) 6/2/93
  35.  * $Id: netdb.h,v 4.9.1.2 1993/05/17 09:59:01 vixie Exp $
  36.  * -
  37.  * Portions Copyright (c) 1993 by Digital Equipment Corporation.
  38.  * 
  39.  * Permission to use, copy, modify, and distribute this software for any
  40.  * purpose with or without fee is hereby granted, provided that the above
  41.  * copyright notice and this permission notice appear in all copies, and that
  42.  * the name of Digital Equipment Corporation not be used in advertising or
  43.  * publicity pertaining to distribution of the document or software without
  44.  * specific, written prior permission.
  45.  * 
  46.  * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
  47.  * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
  48.  * OF MERCHANTABILITY AND FITNESS.   IN NO EVENT SHALL DIGITAL EQUIPMENT
  49.  * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
  50.  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
  51.  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
  52.  * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  53.  * SOFTWARE.
  54.  * -
  55.  * --Copyright--
  56.  */
  57. /*
  58. modification history
  59. --------------------
  60. 01d,19aug97,jag  Added the field h_ttl to the structure hostent.
  61. 01c,29apr97,jag  fixed include define and added C++ linkage.  Changed field
  62.                  names of struc netnet to avoid conflict with i960 macros.
  63. 01b,24feb97,jag  changed comment.
  64. 01a,26nov96,gnn  created from BSD4.4 routed
  65. */
  66. #ifndef __INCnetdbh
  67. #define __INCnetdbh
  68. #ifdef __cplusplus
  69. extern "C" {
  70. #endif
  71. #if ((CPU_FAMILY==I960) && (defined __GNUC__))
  72. #pragma align 1                 /* tell gcc960 not to optimize alignments */
  73. #endif  /* CPU_FAMILY==I960 */
  74. /*
  75.  * Structures returned by network data base library.  All addresses are
  76.  * supplied in host order, and returned in network order (suitable for
  77.  * use in system calls).
  78.  */
  79. struct hostent {
  80. char *h_name; /* official name of host */
  81. char **h_aliases; /* alias list */
  82. int h_addrtype; /* host address type */
  83. int h_length; /* length of address */
  84. char **h_addr_list; /* list of addresses from name server */
  85. #define h_addr h_addr_list[0] /* address, for backward compatiblity */
  86.         unsigned int h_ttl; /* Time to Live in Seconds for this entry */
  87. };
  88. /*
  89.  * Assumption here is that a network number
  90.  * fits in an unsigned long -- probably a poor one.
  91.  */
  92. struct netent {
  93. char        *  nName; /* official name of net */
  94. char        ** nAliases; /* alias list */
  95. int   nAddrtype; /* net address type */
  96. unsigned long   nNet; /* network # */
  97. };
  98. struct servent {
  99. char *s_name; /* official service name */
  100. char **s_aliases; /* alias list */
  101. int s_port; /* port # */
  102. char *s_proto; /* protocol to use */
  103. };
  104. struct protoent {
  105. char *p_name; /* official protocol name */
  106. char **p_aliases; /* alias list */
  107. int p_proto; /* protocol # */
  108. };
  109. #if ((CPU_FAMILY==I960) && (defined __GNUC__))
  110. #pragma align 0                 /* turn off alignment requirement */
  111. #endif  /* CPU_FAMILY==I960 */
  112. /*
  113.  * Error return codes from res_query.c
  114.  */
  115. #define HOST_NOT_FOUND 1 /* Authoritative Answer Host not found */
  116. #define TRY_AGAIN 2 /* Non-Authoritive Host not found, or SERVERFAIL */
  117. #define NO_RECOVERY 3 /* Non recoverable errors, FORMERR, REFUSED, NOTIMP */
  118. #define NO_DATA 4 /* Valid name, no data record of requested type */
  119. #define NO_ADDRESS NO_DATA /* no address, look for MX record */
  120. #ifdef __cplusplus
  121. }
  122. #endif
  123. #endif /* __INCnetdbh */