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