epoc32/include/libc/netdb.h
branchSymbian2
changeset 2 2fe1408b6811
parent 0 061f57f2323e
child 4 837f303aceeb
equal deleted inserted replaced
1:666f914201fb 2:2fe1408b6811
     1 netdb.h
     1 /* NETDB.H
       
     2  * 
       
     3  * Portions copyright (c) 1993-1999 Symbian Ltd.  All rights reserved.
       
     4  */
       
     5 
       
     6 /*-
       
     7  * Copyright (c) 1980, 1983, 1988, 1993
       
     8  *	The Regents of the University of California.  All rights reserved.
       
     9  *
       
    10  * Redistribution and use in source and binary forms, with or without
       
    11  * modification, are permitted provided that the following conditions
       
    12  * are met:
       
    13  * 1. Redistributions of source code must retain the above copyright
       
    14  *    notice, this list of conditions and the following disclaimer.
       
    15  * 2. Redistributions in binary form must reproduce the above copyright
       
    16  *    notice, this list of conditions and the following disclaimer in the
       
    17  *    documentation and/or other materials provided with the distribution.
       
    18  * 3. All advertising materials mentioning features or use of this software
       
    19  *    must display the following acknowledgement:
       
    20  *	This product includes software developed by the University of
       
    21  *	California, Berkeley and its contributors.
       
    22  * 4. Neither the name of the University nor the names of its contributors
       
    23  *    may be used to endorse or promote products derived from this software
       
    24  *    without specific prior written permission.
       
    25  *
       
    26  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
       
    27  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
       
    28  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
       
    29  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
       
    30  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
       
    31  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
       
    32  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
       
    33  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
       
    34  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
       
    35  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
       
    36  * SUCH DAMAGE.
       
    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 /** @file
       
    60 @publishedAll
       
    61 @released
       
    62 */
       
    63 
       
    64 #ifndef _NETDB_H_
       
    65 #define _NETDB_H_
       
    66 
       
    67 #ifdef __cplusplus
       
    68 extern "C" {
       
    69 #endif
       
    70 
       
    71 #include <_ansi.h>
       
    72 #include <sys/errno.h>
       
    73 
       
    74 #define	_PATH_HEQUIV	"/etc/hosts.equiv"
       
    75 #define	_PATH_HOSTS	"/etc/hosts"
       
    76 #define	_PATH_NETWORKS	"/etc/networks"
       
    77 #define	_PATH_PROTOCOLS	"/etc/protocols"
       
    78 #define	_PATH_SERVICES	"/etc/services"
       
    79 
       
    80 #define h_errno	errno
       
    81 
       
    82 /**
       
    83 Structures returned by network data base library.  All addresses are
       
    84 supplied in host order, and returned in network order (suitable for
       
    85 use in system calls).
       
    86 */
       
    87 struct	hostent {
       
    88 	char	*h_name;	/* official name of host */
       
    89 	char	**h_aliases;	/* alias list */
       
    90 	int	h_addrtype;	/* host address type */
       
    91 	int	h_length;	/* length of address */
       
    92 	char	**h_addr_list;	/* list of addresses from name server */
       
    93 #define	h_addr	h_addr_list[0]	/* address, for backward compatibility */
       
    94 };
       
    95 
       
    96 /**
       
    97 Assumption here is that a network number
       
    98 fits in an unsigned long -- probably a poor one.
       
    99 */
       
   100 struct	netent {
       
   101 	char		*n_name;	/* official name of net */
       
   102 	char		**n_aliases;	/* alias list */
       
   103 	int		n_addrtype;	/* net address type */
       
   104 	unsigned long	n_net;		/* network # */
       
   105 };
       
   106 
       
   107 struct	servent {
       
   108 	char	*s_name;	/* official service name */
       
   109 	char	**s_aliases;	/* alias list */
       
   110 	int	s_port;		/* port # */
       
   111 	char	*s_proto;	/* protocol to use */
       
   112 };
       
   113 
       
   114 struct	protoent {
       
   115 	char	*p_name;	/* official protocol name */
       
   116 	char	**p_aliases;	/* alias list */
       
   117 	int	p_proto;	/* protocol # */
       
   118 };
       
   119 
       
   120 /**
       
   121 Error return codes from gethostbyname() and gethostbyaddr()
       
   122 */
       
   123 #define	NETDB_INTERNAL	-1	/* see errno */
       
   124 #define	NETDB_SUCCESS	0	/* no problem */
       
   125 #define	HOST_NOT_FOUND	ENOENT		/* Authoritative Answer Host not found */
       
   126 #define	TRY_AGAIN	ETIMEDOUT	/* Non-Authoritative Host not found, or SERVERFAIL */
       
   127 #define	NO_RECOVERY	ECOMM		/* Non recoverable errors, FORMERR, REFUSED, NOTIMP */
       
   128 #define	NO_DATA		4		/* Valid name, no data record of requested type */
       
   129 #define	NO_ADDRESS	NO_DATA		/* no address, look for MX record */
       
   130 
       
   131 #if 0
       
   132 /* not supported on EPOC32 */
       
   133 /**
       
   134 @internalComponent
       
   135 */
       
   136 void		sethostent (int);
       
   137 /**
       
   138 @internalComponent
       
   139 */
       
   140 struct hostent	*gethostent (void);
       
   141 /**
       
   142 @internalComponent
       
   143 */
       
   144 void		endhostent (void);
       
   145 /**
       
   146 @internalComponent
       
   147 */
       
   148 void		setnetent (int);
       
   149 /**
       
   150 @internalComponent
       
   151 */
       
   152 struct netent	*getnetent (void);
       
   153 /**
       
   154 @internalComponent
       
   155 */
       
   156 void		endnetent (void);
       
   157 /**
       
   158 @internalComponent
       
   159 */
       
   160 void		setprotoent (int);
       
   161 /**
       
   162 @internalComponent
       
   163 */
       
   164 struct protoent	*getprotoent (void);
       
   165 /**
       
   166 @internalComponent
       
   167 */
       
   168 void		endprotoent (void);
       
   169 /**
       
   170 @internalComponent
       
   171 */
       
   172 void		setservent (int);
       
   173 /**
       
   174 @internalComponent
       
   175 */
       
   176 struct servent	*getservent (void);
       
   177 /**
       
   178 @internalComponent
       
   179 */
       
   180 void		endservent (void);
       
   181 #endif
       
   182 
       
   183 IMPORT_C struct hostent	*gethostbyaddr (const char *, int, int);
       
   184 IMPORT_C struct hostent	*gethostbyname (const char *);
       
   185 struct servent	*getservbyname (const char *, const char *);
       
   186 struct servent	*getservbyport (int, const char *);
       
   187 struct netent	*getnetbyaddr (unsigned long, int);
       
   188 struct netent	*getnetbyname (const char *);
       
   189 struct protoent	*getprotobyname (const char *);
       
   190 struct protoent	*getprotobynumber (int);
       
   191 
       
   192 #ifdef __cplusplus
       
   193 }
       
   194 #endif
       
   195 
       
   196 #endif /* !_NETDB_H_ */