1.1 --- a/epoc32/include/libc/netdb.h Tue Nov 24 13:55:44 2009 +0000
1.2 +++ b/epoc32/include/libc/netdb.h Tue Mar 16 16:12:26 2010 +0000
1.3 @@ -1,1 +1,196 @@
1.4 -netdb.h
1.5 +/* NETDB.H
1.6 + *
1.7 + * Portions copyright (c) 1993-1999 Symbian Ltd. All rights reserved.
1.8 + */
1.9 +
1.10 +/*-
1.11 + * Copyright (c) 1980, 1983, 1988, 1993
1.12 + * The Regents of the University of California. All rights reserved.
1.13 + *
1.14 + * Redistribution and use in source and binary forms, with or without
1.15 + * modification, are permitted provided that the following conditions
1.16 + * are met:
1.17 + * 1. Redistributions of source code must retain the above copyright
1.18 + * notice, this list of conditions and the following disclaimer.
1.19 + * 2. Redistributions in binary form must reproduce the above copyright
1.20 + * notice, this list of conditions and the following disclaimer in the
1.21 + * documentation and/or other materials provided with the distribution.
1.22 + * 3. All advertising materials mentioning features or use of this software
1.23 + * must display the following acknowledgement:
1.24 + * This product includes software developed by the University of
1.25 + * California, Berkeley and its contributors.
1.26 + * 4. Neither the name of the University nor the names of its contributors
1.27 + * may be used to endorse or promote products derived from this software
1.28 + * without specific prior written permission.
1.29 + *
1.30 + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
1.31 + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1.32 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1.33 + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
1.34 + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1.35 + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
1.36 + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
1.37 + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
1.38 + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
1.39 + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
1.40 + * SUCH DAMAGE.
1.41 + *
1.42 + * Portions Copyright (c) 1993 by Digital Equipment Corporation.
1.43 + *
1.44 + * Permission to use, copy, modify, and distribute this software for any
1.45 + * purpose with or without fee is hereby granted, provided that the above
1.46 + * copyright notice and this permission notice appear in all copies, and that
1.47 + * the name of Digital Equipment Corporation not be used in advertising or
1.48 + * publicity pertaining to distribution of the document or software without
1.49 + * specific, written prior permission.
1.50 + *
1.51 + * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
1.52 + * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
1.53 + * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT
1.54 + * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
1.55 + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
1.56 + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
1.57 + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
1.58 + * SOFTWARE.
1.59 + * -
1.60 + * --Copyright--
1.61 + */
1.62 +
1.63 +/** @file
1.64 +@publishedAll
1.65 +@released
1.66 +*/
1.67 +
1.68 +#ifndef _NETDB_H_
1.69 +#define _NETDB_H_
1.70 +
1.71 +#ifdef __cplusplus
1.72 +extern "C" {
1.73 +#endif
1.74 +
1.75 +#include <_ansi.h>
1.76 +#include <sys/errno.h>
1.77 +
1.78 +#define _PATH_HEQUIV "/etc/hosts.equiv"
1.79 +#define _PATH_HOSTS "/etc/hosts"
1.80 +#define _PATH_NETWORKS "/etc/networks"
1.81 +#define _PATH_PROTOCOLS "/etc/protocols"
1.82 +#define _PATH_SERVICES "/etc/services"
1.83 +
1.84 +#define h_errno errno
1.85 +
1.86 +/**
1.87 +Structures returned by network data base library. All addresses are
1.88 +supplied in host order, and returned in network order (suitable for
1.89 +use in system calls).
1.90 +*/
1.91 +struct hostent {
1.92 + char *h_name; /* official name of host */
1.93 + char **h_aliases; /* alias list */
1.94 + int h_addrtype; /* host address type */
1.95 + int h_length; /* length of address */
1.96 + char **h_addr_list; /* list of addresses from name server */
1.97 +#define h_addr h_addr_list[0] /* address, for backward compatibility */
1.98 +};
1.99 +
1.100 +/**
1.101 +Assumption here is that a network number
1.102 +fits in an unsigned long -- probably a poor one.
1.103 +*/
1.104 +struct netent {
1.105 + char *n_name; /* official name of net */
1.106 + char **n_aliases; /* alias list */
1.107 + int n_addrtype; /* net address type */
1.108 + unsigned long n_net; /* network # */
1.109 +};
1.110 +
1.111 +struct servent {
1.112 + char *s_name; /* official service name */
1.113 + char **s_aliases; /* alias list */
1.114 + int s_port; /* port # */
1.115 + char *s_proto; /* protocol to use */
1.116 +};
1.117 +
1.118 +struct protoent {
1.119 + char *p_name; /* official protocol name */
1.120 + char **p_aliases; /* alias list */
1.121 + int p_proto; /* protocol # */
1.122 +};
1.123 +
1.124 +/**
1.125 +Error return codes from gethostbyname() and gethostbyaddr()
1.126 +*/
1.127 +#define NETDB_INTERNAL -1 /* see errno */
1.128 +#define NETDB_SUCCESS 0 /* no problem */
1.129 +#define HOST_NOT_FOUND ENOENT /* Authoritative Answer Host not found */
1.130 +#define TRY_AGAIN ETIMEDOUT /* Non-Authoritative Host not found, or SERVERFAIL */
1.131 +#define NO_RECOVERY ECOMM /* Non recoverable errors, FORMERR, REFUSED, NOTIMP */
1.132 +#define NO_DATA 4 /* Valid name, no data record of requested type */
1.133 +#define NO_ADDRESS NO_DATA /* no address, look for MX record */
1.134 +
1.135 +#if 0
1.136 +/* not supported on EPOC32 */
1.137 +/**
1.138 +@internalComponent
1.139 +*/
1.140 +void sethostent (int);
1.141 +/**
1.142 +@internalComponent
1.143 +*/
1.144 +struct hostent *gethostent (void);
1.145 +/**
1.146 +@internalComponent
1.147 +*/
1.148 +void endhostent (void);
1.149 +/**
1.150 +@internalComponent
1.151 +*/
1.152 +void setnetent (int);
1.153 +/**
1.154 +@internalComponent
1.155 +*/
1.156 +struct netent *getnetent (void);
1.157 +/**
1.158 +@internalComponent
1.159 +*/
1.160 +void endnetent (void);
1.161 +/**
1.162 +@internalComponent
1.163 +*/
1.164 +void setprotoent (int);
1.165 +/**
1.166 +@internalComponent
1.167 +*/
1.168 +struct protoent *getprotoent (void);
1.169 +/**
1.170 +@internalComponent
1.171 +*/
1.172 +void endprotoent (void);
1.173 +/**
1.174 +@internalComponent
1.175 +*/
1.176 +void setservent (int);
1.177 +/**
1.178 +@internalComponent
1.179 +*/
1.180 +struct servent *getservent (void);
1.181 +/**
1.182 +@internalComponent
1.183 +*/
1.184 +void endservent (void);
1.185 +#endif
1.186 +
1.187 +IMPORT_C struct hostent *gethostbyaddr (const char *, int, int);
1.188 +IMPORT_C struct hostent *gethostbyname (const char *);
1.189 +struct servent *getservbyname (const char *, const char *);
1.190 +struct servent *getservbyport (int, const char *);
1.191 +struct netent *getnetbyaddr (unsigned long, int);
1.192 +struct netent *getnetbyname (const char *);
1.193 +struct protoent *getprotobyname (const char *);
1.194 +struct protoent *getprotobynumber (int);
1.195 +
1.196 +#ifdef __cplusplus
1.197 +}
1.198 +#endif
1.199 +
1.200 +#endif /* !_NETDB_H_ */