1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/ossrv/genericopenlibs/openenvcore/include/netdb.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,312 @@
1.4 +/* NETDB.H
1.5 + * Copyright (c) 1980, 1983, 1988, 1993
1.6 + * The Regents of the University of California. All rights reserved.
1.7 + *
1.8 + * Redistribution and use in source and binary forms, with or without
1.9 + * modification, are permitted provided that the following conditions
1.10 + * are met:
1.11 + * 1. Redistributions of source code must retain the above copyright
1.12 + * notice, this list of conditions and the following disclaimer.
1.13 + * 2. Redistributions in binary form must reproduce the above copyright
1.14 + * notice, this list of conditions and the following disclaimer in the
1.15 + * documentation and/or other materials provided with the distribution.
1.16 + * 4. Neither the name of the University nor the names of its contributors
1.17 + * may be used to endorse or promote products derived from this software
1.18 + * without specific prior written permission.
1.19 + *
1.20 + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
1.21 + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1.22 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1.23 + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
1.24 + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1.25 + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
1.26 + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
1.27 + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
1.28 + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
1.29 + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
1.30 + * SUCH DAMAGE.
1.31 + *
1.32 + * -
1.33 + * Portions Copyright (c) 1993 by Digital Equipment Corporation.
1.34 + *
1.35 + * Permission to use, copy, modify, and distribute this software for any
1.36 + * purpose with or without fee is hereby granted, provided that the above
1.37 + * copyright notice and this permission notice appear in all copies, and that
1.38 + * the name of Digital Equipment Corporation not be used in advertising or
1.39 + * publicity pertaining to distribution of the document or software without
1.40 + * specific, written prior permission.
1.41 + *
1.42 + * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
1.43 + * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
1.44 + * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT
1.45 + * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
1.46 + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
1.47 + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
1.48 + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
1.49 + * SOFTWARE.
1.50 + * -
1.51 + * Portions Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). All rights reserved.
1.52 + * --Copyright--
1.53 + */
1.54 +
1.55 +/*
1.56 + * @(#)netdb.h 8.1 (Berkeley) 6/2/93
1.57 + * From: Id: netdb.h,v 8.9 1996/11/19 08:39:29 vixie Exp $
1.58 + * $FreeBSD: src/include/netdb.h,v 1.38.2.1 2005/07/22 20:17:30 ume Exp $
1.59 + */
1.60 +
1.61 +#ifndef _NETDB_H_
1.62 +#define _NETDB_H_
1.63 +
1.64 +#ifdef __SYMBIAN32__
1.65 +#ifdef __cplusplus
1.66 +extern "C" {
1.67 +#endif
1.68 +#include <_ansi.h>
1.69 +
1.70 +#include <sys/cdefs.h>
1.71 +#endif
1.72 +#include <sys/_types.h>
1.73 +#include <sys/cdefs.h>
1.74 +#ifdef __SYMBIAN32__
1.75 +#include <arpa/inet.h>
1.76 +#include <sys/errno.h>
1.77 +#endif
1.78 +
1.79 +#ifndef _SIZE_T_DECLARED
1.80 +typedef __size_t size_t;
1.81 +#define _SIZE_T_DECLARED
1.82 +#endif
1.83 +
1.84 +#ifndef _SOCKLEN_T_DECLARED
1.85 +typedef __socklen_t socklen_t;
1.86 +#define _SOCKLEN_T_DECLARED
1.87 +#endif
1.88 +
1.89 +#ifndef _UINT32_T_DECLARED
1.90 +typedef __uint32_t uint32_t;
1.91 +#define _UINT32_T_DECLARED
1.92 +#endif
1.93 +
1.94 +#ifndef _PATH_HEQUIV
1.95 +# define _PATH_HEQUIV "/etc/hosts.equiv"
1.96 +#endif
1.97 +#ifndef __SYMBIAN32__
1.98 +#define _PATH_HOSTS "/etc/hosts"
1.99 +#define _PATH_NETWORKS "/etc/networks"
1.100 +#define _PATH_PROTOCOLS "/etc/protocols"
1.101 +#define _PATH_SERVICES "/etc/services"
1.102 +#define h_errno (*__h_error())
1.103 +#else
1.104 +#define _PATH_SERVICES "\\resource\\openc\\services"
1.105 +#define h_errno errno
1.106 +#endif
1.107 +
1.108 +
1.109 +/*
1.110 + * Structures returned by network data base library. All addresses are
1.111 + * supplied in host order, and returned in network order (suitable for
1.112 + * use in system calls).
1.113 + */
1.114 +struct hostent {
1.115 + char *h_name; /* official name of host */
1.116 + char **h_aliases; /* alias list */
1.117 + int h_addrtype; /* host address type */
1.118 + int h_length; /* length of address */
1.119 + char **h_addr_list; /* list of addresses from name server */
1.120 +#define h_addr h_addr_list[0] /* address, for backward compatibility */
1.121 +};
1.122 +
1.123 +struct netent {
1.124 + char *n_name; /* official name of net */
1.125 + char **n_aliases; /* alias list */
1.126 + int n_addrtype; /* net address type */
1.127 + #ifdef __SYMBIAN32__
1.128 + unsigned long n_net;
1.129 + #else
1.130 + uint32_t n_net; /* network # */
1.131 + #endif
1.132 +};
1.133 +
1.134 +struct servent {
1.135 + char *s_name; /* official service name */
1.136 + char **s_aliases; /* alias list */
1.137 + int s_port; /* port # */
1.138 + char *s_proto; /* protocol to use */
1.139 +};
1.140 +
1.141 +struct protoent {
1.142 + char *p_name; /* official protocol name */
1.143 + char **p_aliases; /* alias list */
1.144 + int p_proto; /* protocol # */
1.145 +};
1.146 +
1.147 +struct addrinfo {
1.148 + int ai_flags; /* AI_PASSIVE, AI_CANONNAME, AI_NUMERICHOST */
1.149 + int ai_family; /* PF_xxx */
1.150 + int ai_socktype; /* SOCK_xxx */
1.151 + int ai_protocol; /* 0 or IPPROTO_xxx for IPv4 and IPv6 */
1.152 + socklen_t ai_addrlen; /* length of ai_addr */
1.153 + char *ai_canonname; /* canonical name for hostname */
1.154 + struct sockaddr *ai_addr; /* binary address */
1.155 + struct addrinfo *ai_next; /* next structure in linked list */
1.156 +};
1.157 +
1.158 +/*
1.159 + * Error return codes from gethostbyname() and gethostbyaddr()
1.160 + * (left in h_errno).
1.161 + */
1.162 +
1.163 +#define NETDB_INTERNAL -1 /* see errno */
1.164 +#define NETDB_SUCCESS 0 /* no problem */
1.165 +#ifndef __SYMBIAN32__
1.166 +#define HOST_NOT_FOUND 1 /* Authoritative Answer Host not found */
1.167 +#define TRY_AGAIN 2 /* Non-Authoritative Host not found, or SERVERFAIL */
1.168 +#define NO_RECOVERY 3 /* Non recoverable errors, FORMERR, REFUSED, NOTIMP */
1.169 +#else
1.170 +#define HOST_NOT_FOUND ENOENT /* Authoritative Answer Host not found */
1.171 +#define TRY_AGAIN ETIMEDOUT /* Non-Authoritative Host not found, or SERVERFAIL */
1.172 +#define NO_RECOVERY ECOMM /* Non recoverable errors, FORMERR, REFUSED, NOTIMP */
1.173 +#endif
1.174 +#define NO_DATA 4 /* Valid name, no data record of requested type */
1.175 +#define NO_ADDRESS NO_DATA /* no address, look for MX record */
1.176 +
1.177 +/*
1.178 + * Error return codes from getaddrinfo()
1.179 + */
1.180 +#if 0
1.181 +/* obsoleted */
1.182 +#define EAI_ADDRFAMILY 1 /* address family for hostname not supported */
1.183 +#endif
1.184 +#define EAI_AGAIN 2 /* temporary failure in name resolution */
1.185 +#define EAI_BADFLAGS 3 /* invalid value for ai_flags */
1.186 +#define EAI_FAIL 4 /* non-recoverable failure in name resolution */
1.187 +#define EAI_FAMILY 5 /* ai_family not supported */
1.188 +#define EAI_MEMORY 6 /* memory allocation failure */
1.189 +#if 0
1.190 +/* obsoleted */
1.191 +#define EAI_NODATA 7 /* no address associated with hostname */
1.192 +#endif
1.193 +#define EAI_NONAME 8 /* hostname nor servname provided, or not known */
1.194 +#define EAI_SERVICE 9 /* servname not supported for ai_socktype */
1.195 +#define EAI_SOCKTYPE 10 /* ai_socktype not supported */
1.196 +#define EAI_SYSTEM 11 /* system error returned in errno */
1.197 +#define EAI_BADHINTS 12
1.198 +#define EAI_PROTOCOL 13
1.199 +#define EAI_MAX 14
1.200 +
1.201 +/*
1.202 + * Flag values for getaddrinfo()
1.203 + */
1.204 +#define AI_PASSIVE 0x00000001 /* get address to use bind() */
1.205 +#define AI_CANONNAME 0x00000002 /* fill ai_canonname */
1.206 +#define AI_NUMERICHOST 0x00000004 /* prevent host name resolution */
1.207 +#define AI_NUMERICSERV 0x00000008 /* prevent service name resolution */
1.208 +/* valid flags for addrinfo (not a standard def, apps should not use it) */
1.209 +#define AI_MASK \
1.210 + (AI_PASSIVE | AI_CANONNAME | AI_NUMERICHOST | AI_NUMERICSERV | \
1.211 + AI_ADDRCONFIG)
1.212 +
1.213 +#define AI_ALL 0x00000100 /* IPv6 and IPv4-mapped (with AI_V4MAPPED) */
1.214 +#define AI_V4MAPPED_CFG 0x00000200 /* accept IPv4-mapped if kernel supports */
1.215 +#define AI_ADDRCONFIG 0x00000400 /* only if any address is assigned */
1.216 +#define AI_V4MAPPED 0x00000800 /* accept IPv4-mapped IPv6 address */
1.217 +#ifdef __SYMBIAN32__
1.218 +#define AI_V4CONVERTED 0x00001000
1.219 +#endif
1.220 +/* special recommended flags for getipnodebyname */
1.221 +#define AI_DEFAULT (AI_V4MAPPED_CFG | AI_ADDRCONFIG)
1.222 +
1.223 +/*
1.224 + * Constants for getnameinfo()
1.225 + */
1.226 +#define NI_MAXHOST 1025
1.227 +#define NI_MAXSERV 32
1.228 +
1.229 +/*
1.230 + * Flag values for getnameinfo()
1.231 + */
1.232 +#define NI_NOFQDN 0x00000001
1.233 +#define NI_NUMERICHOST 0x00000002
1.234 +#define NI_NAMEREQD 0x00000004
1.235 +#define NI_NUMERICSERV 0x00000008
1.236 +#define NI_DGRAM 0x00000010
1.237 +#if 0 /* obsolete */
1.238 +#define NI_WITHSCOPEID 0x00000020
1.239 +#endif
1.240 +
1.241 +/*
1.242 + * Scope delimit character
1.243 + */
1.244 +#define SCOPE_DELIMITER '%'
1.245 +
1.246 +__BEGIN_DECLS
1.247 +#ifndef __SYMBIAN32__
1.248 +void endhostent(void);
1.249 +void endnetent(void);
1.250 +void endnetgrent(void);
1.251 +void endprotoent(void);
1.252 +#endif//__SYMBIAN32__
1.253 +IMPORT_C void endservent(void);
1.254 +#ifndef __SYMBIAN32__
1.255 +void freehostent(struct hostent *);
1.256 +#endif//__SYMBIAN32__
1.257 +IMPORT_C struct hostent *gethostbyaddr(const char *, int, int);
1.258 +IMPORT_C struct hostent *gethostbyname(const char *);
1.259 +#ifndef __SYMBIAN32__
1.260 +struct hostent *gethostbyname2(const char *, int);
1.261 +struct hostent *gethostent(void);
1.262 +struct hostent *getipnodebyaddr(const void *, size_t, int, int *);
1.263 +struct hostent *getipnodebyname(const char *, int, int, int *);
1.264 +struct netent *getnetbyaddr(uint32_t, int);
1.265 +struct netent *getnetbyname(const char *);
1.266 +struct netent *getnetent(void);
1.267 +int getnetgrent(char **, char **, char **);
1.268 +#endif//__SYMBIAN32__
1.269 +IMPORT_C struct protoent *getprotobyname(const char *);
1.270 +IMPORT_C struct protoent *getprotobynumber(int);
1.271 +#ifndef __SYMBIAN32__
1.272 +struct protoent *getprotoent(void);
1.273 +#endif//__SYMBIAN32__
1.274 +IMPORT_C struct servent *getservbyname(const char *, const char *);
1.275 +IMPORT_C struct servent *getservbyport(int, const char *);
1.276 +IMPORT_C struct servent *getservent(void);
1.277 +#ifndef __SYMBIAN32__
1.278 +void herror(const char *);
1.279 +__const char *hstrerror(int);
1.280 +int innetgr(const char *, const char *, const char *, const char *);
1.281 +void sethostent(int);
1.282 +/* void sethostfile(const char *); */
1.283 +void setnetent(int);
1.284 +void setprotoent(int);
1.285 +#endif//__SYMBIAN32__
1.286 +IMPORT_C int getaddrinfo(const char *, const char *,
1.287 + const struct addrinfo *, struct addrinfo **);
1.288 +IMPORT_C int getnameinfo(const struct sockaddr *, socklen_t, char *,
1.289 + size_t, char *, size_t, int);
1.290 +IMPORT_C void freeaddrinfo(struct addrinfo *);
1.291 +IMPORT_C const char *gai_strerror(int);
1.292 +void setnetgrent(const char *);
1.293 +IMPORT_C void setservent(int);
1.294 +#ifdef __SYMBIAN32__
1.295 +
1.296 +#ifdef __SYMBIAN_COMPILE_UNUSED__
1.297 +int *__h_errno_location(void);
1.298 +#endif
1.299 +
1.300 +#endif
1.301 +
1.302 +/*
1.303 + * PRIVATE functions specific to the FreeBSD implementation
1.304 + */
1.305 +
1.306 +/* DO NOT USE THESE, THEY ARE SUBJECT TO CHANGE AND ARE NOT PORTABLE!!! */
1.307 +int * __h_error(void);
1.308 +__END_DECLS
1.309 +#ifdef __SYMBIAN32__
1.310 +#ifdef __cplusplus
1.311 +}
1.312 +#endif
1.313 +#endif
1.314 +
1.315 +#endif /* !_NETDB_H_ */