5754708 [rkeene@sledge /home/rkeene/devel/cygwin-stuff/cyg-root/usr/include]$ cat -n netdb.h
  1 /* Original linux netdb.h merged with winsock.h types */
  2 
  3 /*-
  4  * Copyright (c) 1980, 1983, 1988, 1993
  5  *     The Regents of the University of California.  All rights reserved.
  6  *
  7  * Redistribution and use in source and binary forms, with or without
  8  * modification, are permitted provided that the following conditions
  9  * are met:
 10  * 1. Redistributions of source code must retain the above copyright
 11  *    notice, this list of conditions and the following disclaimer.
 12  * 2. Redistributions in binary form must reproduce the above copyright
 13  *    notice, this list of conditions and the following disclaimer in the
 14  *    documentation and/or other materials provided with the distribution.
 15  * 3. All advertising materials mentioning features or use of this software
 16  *    must display the following acknowledgement:
 17  *  This product includes software developed by the University of
 18  *  California, Berkeley and its contributors.
 19  * 4. Neither the name of the University nor the names of its contributors
 20  *    may be used to endorse or promote products derived from this software
 21  *    without specific prior written permission.
 22  *
 23  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
 24  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 25  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 26  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
 27  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 28  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 29  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 30  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 31  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 32  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 33  * SUCH DAMAGE.
 34  *
 35  *  @(#)netdb.h 8.1 (Berkeley) 6/2/93
 36  *      netdb.h,v 1.1.1.1 1995/02/18 05:34:07 hjl Exp
 37  * -
 38  * Portions Copyright (c) 1993 by Digital Equipment Corporation.
 39  *
 40  * Permission to use, copy, modify and distribute this software for any
 41  * purpose with or without fee is hereby granted, provided that the above
 42  * copyright notice and this permission notice appear in all copies, and that
 43  * the name of Digital Equipment Corporation not be used in advertising or
 44  * publicity pertaining to distribution of the document or software without
 45  * specific, written prior permission.
 46  *
 47  * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
 48  * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
 49  * OF MERCHANTABILITY AND FITNESS.   IN NO EVENT SHALL DIGITAL EQUIPMENT
 50  * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
 51  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
 52  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
 53  * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
 54  * SOFTWARE.
 55  * -
 56  * --Copyright--
 57  */
 58 
 59 #ifndef _NETDB_H_
 60 #define _NETDB_H_
 61 
 62 #ifdef __cplusplus
 63 extern "C" {
 64 #endif
 65 
 66 /*
 67  * Structures returned by network data base library.  All addresses are
 68  * supplied in host order, and returned in network order (suitable for
 69  * use in system calls).
 70  */
 71 
 72   /* Different from the linux versions - note the shorts.. */
 73 struct  hostent {
 74     const char  *h_name;    /* official name of host */
 75     char    **h_aliases;    /* alias list */
 76     short   h_addrtype; /* host address type */
 77     short   h_length;   /* length of address */
 78     char    **h_addr_list;  /* list of addresses from name server */
 79 #define h_addr  h_addr_list[0]  /* address, for backward compatiblity */
 80 };
 81 
 82 /*
 83  * Assumption here is that a network number
 84  * fits in an unsigned long -- probably a poor one.
 85  */
 86 
 87 struct  netent {
 88     char        *n_name;    /* official name of net */
 89     char        **n_aliases;    /* alias list */
 90     short       n_addrtype; /* net address type */
 91     unsigned long   n_net;      /* network # */
 92 };
 93 
 94 struct  servent {
 95     char    *s_name;    /* official service name */
 96     char    **s_aliases;    /* alias list */
 97     short   s_port;     /* port # */
 98     char    *s_proto;   /* protocol to use */
 99 };
100 
101 struct  protoent
102 {
103   char  *p_name;    /* official protocol name */
104   char  **p_aliases;    /* alias list */
105   short p_proto;    /* protocol # */
106 };
107 
108 struct rpcent {
109     char    *r_name;    /* name of server for this rpc program */
110     char    **r_aliases;    /* alias list */
111     int r_number;   /* rpc program number */
112 };
113 
114 /*
115  * Error return codes from gethostbyname() and gethostbyaddr()
116  * (left in extern int h_errno).
117  */
118 
119 #ifdef  __INSIDE_CYGWIN_NET__
120 extern int h_errno;
121 #else
122 extern __declspec(dllimport) int h_errno;
123 #endif
124 
125 #define NETDB_INTERNAL -1 /* see errno */
126 #define NETDB_SUCCESS   0 /* no problem */
127 #define HOST_NOT_FOUND  1 /* Authoritative Answer Host not found */
128 #define TRY_AGAIN   2 /* Non-Authoritive Host not found, or SERVERFAIL */
129 #define NO_RECOVERY 3 /* Non recoverable errors, FORMERR, REFUSED, NOTIMP */
130 #define NO_DATA     4 /* Valid name, no data record of requested type */
131 #define NO_ADDRESS  NO_DATA     /* no address, look for MX record */
132 
133 #ifndef __INSIDE_CYGWIN_NET__
134 void        endhostent (void);
135 void        endnetent (void);
136 void        endprotoent (void);
137 void        endservent (void);
138 void        endrpcent  (void);
139 struct hostent  *gethostbyaddr (const char *, int, int);
140 struct hostent  *gethostbyname (const char *);
141 struct hostent  *gethostent (void);
142 struct netent   *getnetbyaddr (long, int); /* u_long? */
143 struct netent   *getnetbyname (const char *);
144 struct netent   *getnetent (void);
145 struct protoent *getprotobyname (const char *);
146 struct protoent *getprotobynumber (int);
147 struct protoent *getprotoent (void);
148 struct servent  *getservbyname (const char *, const char *);
149 struct servent  *getservbyport (int, const char *);
150 struct servent  *getservent (void);
151 struct rpcent   *getrpcent (void);
152 struct rpcent   *getrpcbyname (const char *);
153 struct rpcent   *getrpcbynumber (int);
154 const char      *hstrerror (int);
155 void        herror (const char *);
156 void        sethostent (int);
157 void        setnetent (int);
158 void        setprotoent (int);
159 void        setservent (int);
160 void        setrpcent (int);
161 #endif
162 
163 #ifdef __cplusplus
164 };
165 #endif
166 
167 #endif /* !_NETDB_H_ */
5754709 [rkeene@sledge /home/rkeene/devel/cygwin-stuff/cyg-root/usr/include]$

Click here to go back to the directory listing.
Click here to download this file.
last modified: 2001-01-31 15:09:08