os/ossrv/genericopenlibs/openenvcore/include/netdb.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
sl@0
     1
/* NETDB.H
sl@0
     2
 * Copyright (c) 1980, 1983, 1988, 1993
sl@0
     3
 *	The Regents of the University of California.  All rights reserved.
sl@0
     4
 *
sl@0
     5
 * Redistribution and use in source and binary forms, with or without
sl@0
     6
 * modification, are permitted provided that the following conditions
sl@0
     7
 * are met:
sl@0
     8
 * 1. Redistributions of source code must retain the above copyright
sl@0
     9
 *    notice, this list of conditions and the following disclaimer.
sl@0
    10
 * 2. Redistributions in binary form must reproduce the above copyright
sl@0
    11
 *    notice, this list of conditions and the following disclaimer in the
sl@0
    12
 *    documentation and/or other materials provided with the distribution.
sl@0
    13
 * 4. Neither the name of the University nor the names of its contributors
sl@0
    14
 *    may be used to endorse or promote products derived from this software
sl@0
    15
 *    without specific prior written permission.
sl@0
    16
 *
sl@0
    17
 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
sl@0
    18
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
sl@0
    19
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
sl@0
    20
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
sl@0
    21
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
sl@0
    22
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
sl@0
    23
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
sl@0
    24
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
sl@0
    25
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
sl@0
    26
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
sl@0
    27
 * SUCH DAMAGE.
sl@0
    28
 *
sl@0
    29
 * -
sl@0
    30
 * Portions Copyright (c) 1993 by Digital Equipment Corporation.
sl@0
    31
 *
sl@0
    32
 * Permission to use, copy, modify, and distribute this software for any
sl@0
    33
 * purpose with or without fee is hereby granted, provided that the above
sl@0
    34
 * copyright notice and this permission notice appear in all copies, and that
sl@0
    35
 * the name of Digital Equipment Corporation not be used in advertising or
sl@0
    36
 * publicity pertaining to distribution of the document or software without
sl@0
    37
 * specific, written prior permission.
sl@0
    38
 *
sl@0
    39
 * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
sl@0
    40
 * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
sl@0
    41
 * OF MERCHANTABILITY AND FITNESS.   IN NO EVENT SHALL DIGITAL EQUIPMENT
sl@0
    42
 * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
sl@0
    43
 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
sl@0
    44
 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
sl@0
    45
 * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
sl@0
    46
 * SOFTWARE.
sl@0
    47
 * -
sl@0
    48
 * Portions Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). All rights reserved.
sl@0
    49
 * --Copyright--
sl@0
    50
 */
sl@0
    51
sl@0
    52
/*
sl@0
    53
 *      @(#)netdb.h	8.1 (Berkeley) 6/2/93
sl@0
    54
 *      From: Id: netdb.h,v 8.9 1996/11/19 08:39:29 vixie Exp $
sl@0
    55
 * $FreeBSD: src/include/netdb.h,v 1.38.2.1 2005/07/22 20:17:30 ume Exp $
sl@0
    56
 */
sl@0
    57
sl@0
    58
#ifndef _NETDB_H_
sl@0
    59
#define _NETDB_H_
sl@0
    60
sl@0
    61
#ifdef __SYMBIAN32__
sl@0
    62
#ifdef __cplusplus
sl@0
    63
extern "C" {
sl@0
    64
#endif
sl@0
    65
#include <_ansi.h>
sl@0
    66
sl@0
    67
#include <sys/cdefs.h>
sl@0
    68
#endif
sl@0
    69
#include <sys/_types.h>
sl@0
    70
#include <sys/cdefs.h>
sl@0
    71
#ifdef __SYMBIAN32__
sl@0
    72
#include <arpa/inet.h>
sl@0
    73
#include <sys/errno.h>
sl@0
    74
#endif
sl@0
    75
sl@0
    76
#ifndef _SIZE_T_DECLARED
sl@0
    77
typedef	__size_t	size_t;
sl@0
    78
#define	_SIZE_T_DECLARED
sl@0
    79
#endif
sl@0
    80
sl@0
    81
#ifndef _SOCKLEN_T_DECLARED
sl@0
    82
typedef	__socklen_t	socklen_t;
sl@0
    83
#define	_SOCKLEN_T_DECLARED
sl@0
    84
#endif
sl@0
    85
sl@0
    86
#ifndef _UINT32_T_DECLARED
sl@0
    87
typedef	__uint32_t	uint32_t;
sl@0
    88
#define	_UINT32_T_DECLARED
sl@0
    89
#endif
sl@0
    90
sl@0
    91
#ifndef _PATH_HEQUIV
sl@0
    92
# define	_PATH_HEQUIV	"/etc/hosts.equiv"
sl@0
    93
#endif
sl@0
    94
#ifndef __SYMBIAN32__
sl@0
    95
#define	_PATH_HOSTS	"/etc/hosts"
sl@0
    96
#define	_PATH_NETWORKS	"/etc/networks"
sl@0
    97
#define	_PATH_PROTOCOLS	"/etc/protocols"
sl@0
    98
#define	_PATH_SERVICES	"/etc/services"
sl@0
    99
#define	h_errno (*__h_error())
sl@0
   100
#else
sl@0
   101
#define	_PATH_SERVICES	"\\resource\\openc\\services"
sl@0
   102
#define h_errno	errno
sl@0
   103
#endif
sl@0
   104
sl@0
   105
sl@0
   106
/*
sl@0
   107
 * Structures returned by network data base library.  All addresses are
sl@0
   108
 * supplied in host order, and returned in network order (suitable for
sl@0
   109
 * use in system calls).
sl@0
   110
 */
sl@0
   111
struct hostent {
sl@0
   112
	char	*h_name;	/* official name of host */
sl@0
   113
	char	**h_aliases;	/* alias list */
sl@0
   114
	int	h_addrtype;	/* host address type */
sl@0
   115
	int	h_length;	/* length of address */
sl@0
   116
	char	**h_addr_list;	/* list of addresses from name server */
sl@0
   117
#define	h_addr	h_addr_list[0]	/* address, for backward compatibility */
sl@0
   118
};
sl@0
   119
sl@0
   120
struct netent {
sl@0
   121
	char		*n_name;	/* official name of net */
sl@0
   122
	char		**n_aliases;	/* alias list */
sl@0
   123
	int		n_addrtype;	/* net address type */
sl@0
   124
	#ifdef __SYMBIAN32__
sl@0
   125
	unsigned long n_net;
sl@0
   126
	#else
sl@0
   127
	uint32_t	n_net;		/* network # */
sl@0
   128
        #endif
sl@0
   129
};
sl@0
   130
sl@0
   131
struct servent {
sl@0
   132
	char	*s_name;	/* official service name */
sl@0
   133
	char	**s_aliases;	/* alias list */
sl@0
   134
	int	s_port;		/* port # */
sl@0
   135
	char	*s_proto;	/* protocol to use */
sl@0
   136
};
sl@0
   137
sl@0
   138
struct protoent {
sl@0
   139
	char	*p_name;	/* official protocol name */
sl@0
   140
	char	**p_aliases;	/* alias list */
sl@0
   141
	int	p_proto;	/* protocol # */
sl@0
   142
};
sl@0
   143
sl@0
   144
struct addrinfo {
sl@0
   145
	int	ai_flags;	/* AI_PASSIVE, AI_CANONNAME, AI_NUMERICHOST */
sl@0
   146
	int	ai_family;	/* PF_xxx */
sl@0
   147
	int	ai_socktype;	/* SOCK_xxx */
sl@0
   148
	int	ai_protocol;	/* 0 or IPPROTO_xxx for IPv4 and IPv6 */
sl@0
   149
	socklen_t ai_addrlen;	/* length of ai_addr */
sl@0
   150
	char	*ai_canonname;	/* canonical name for hostname */
sl@0
   151
	struct	sockaddr *ai_addr;	/* binary address */
sl@0
   152
	struct	addrinfo *ai_next;	/* next structure in linked list */
sl@0
   153
};
sl@0
   154
sl@0
   155
/*
sl@0
   156
 * Error return codes from gethostbyname() and gethostbyaddr()
sl@0
   157
 * (left in h_errno).
sl@0
   158
 */
sl@0
   159
sl@0
   160
#define	NETDB_INTERNAL	-1	/* see errno */
sl@0
   161
#define	NETDB_SUCCESS	0	/* no problem */
sl@0
   162
#ifndef __SYMBIAN32__
sl@0
   163
#define	HOST_NOT_FOUND	1 /* Authoritative Answer Host not found */
sl@0
   164
#define	TRY_AGAIN	2 /* Non-Authoritative Host not found, or SERVERFAIL */
sl@0
   165
#define	NO_RECOVERY	3 /* Non recoverable errors, FORMERR, REFUSED, NOTIMP */
sl@0
   166
#else
sl@0
   167
#define	HOST_NOT_FOUND	ENOENT		/* Authoritative Answer Host not found */
sl@0
   168
#define	TRY_AGAIN	ETIMEDOUT	/* Non-Authoritative Host not found, or SERVERFAIL */
sl@0
   169
#define	NO_RECOVERY	ECOMM		/* Non recoverable errors, FORMERR, REFUSED, NOTIMP */
sl@0
   170
#endif
sl@0
   171
#define	NO_DATA		4 /* Valid name, no data record of requested type */
sl@0
   172
#define	NO_ADDRESS	NO_DATA		/* no address, look for MX record */
sl@0
   173
sl@0
   174
/*
sl@0
   175
 * Error return codes from getaddrinfo()
sl@0
   176
 */
sl@0
   177
#if 0
sl@0
   178
/* obsoleted */
sl@0
   179
#define	EAI_ADDRFAMILY	 1	/* address family for hostname not supported */
sl@0
   180
#endif
sl@0
   181
#define	EAI_AGAIN	 2	/* temporary failure in name resolution */
sl@0
   182
#define	EAI_BADFLAGS	 3	/* invalid value for ai_flags */
sl@0
   183
#define	EAI_FAIL	 4	/* non-recoverable failure in name resolution */
sl@0
   184
#define	EAI_FAMILY	 5	/* ai_family not supported */
sl@0
   185
#define	EAI_MEMORY	 6	/* memory allocation failure */
sl@0
   186
#if 0
sl@0
   187
/* obsoleted */
sl@0
   188
#define	EAI_NODATA	 7	/* no address associated with hostname */
sl@0
   189
#endif
sl@0
   190
#define	EAI_NONAME	 8	/* hostname nor servname provided, or not known */
sl@0
   191
#define	EAI_SERVICE	 9	/* servname not supported for ai_socktype */
sl@0
   192
#define	EAI_SOCKTYPE	10	/* ai_socktype not supported */
sl@0
   193
#define	EAI_SYSTEM	11	/* system error returned in errno */
sl@0
   194
#define	EAI_BADHINTS	12
sl@0
   195
#define	EAI_PROTOCOL	13
sl@0
   196
#define	EAI_MAX		14
sl@0
   197
sl@0
   198
/*
sl@0
   199
 * Flag values for getaddrinfo()
sl@0
   200
 */
sl@0
   201
#define	AI_PASSIVE	0x00000001 /* get address to use bind() */
sl@0
   202
#define	AI_CANONNAME	0x00000002 /* fill ai_canonname */
sl@0
   203
#define	AI_NUMERICHOST	0x00000004 /* prevent host name resolution */
sl@0
   204
#define	AI_NUMERICSERV	0x00000008 /* prevent service name resolution */
sl@0
   205
/* valid flags for addrinfo (not a standard def, apps should not use it) */
sl@0
   206
#define AI_MASK \
sl@0
   207
    (AI_PASSIVE | AI_CANONNAME | AI_NUMERICHOST | AI_NUMERICSERV | \
sl@0
   208
    AI_ADDRCONFIG)
sl@0
   209
sl@0
   210
#define	AI_ALL		0x00000100 /* IPv6 and IPv4-mapped (with AI_V4MAPPED) */
sl@0
   211
#define	AI_V4MAPPED_CFG	0x00000200 /* accept IPv4-mapped if kernel supports */
sl@0
   212
#define	AI_ADDRCONFIG	0x00000400 /* only if any address is assigned */
sl@0
   213
#define	AI_V4MAPPED	0x00000800 /* accept IPv4-mapped IPv6 address */
sl@0
   214
#ifdef __SYMBIAN32__
sl@0
   215
#define AI_V4CONVERTED 0x00001000
sl@0
   216
#endif
sl@0
   217
/* special recommended flags for getipnodebyname */
sl@0
   218
#define	AI_DEFAULT	(AI_V4MAPPED_CFG | AI_ADDRCONFIG)
sl@0
   219
sl@0
   220
/*
sl@0
   221
 * Constants for getnameinfo()
sl@0
   222
 */
sl@0
   223
#define	NI_MAXHOST	1025
sl@0
   224
#define	NI_MAXSERV	32
sl@0
   225
sl@0
   226
/*
sl@0
   227
 * Flag values for getnameinfo()
sl@0
   228
 */
sl@0
   229
#define	NI_NOFQDN	0x00000001
sl@0
   230
#define	NI_NUMERICHOST	0x00000002
sl@0
   231
#define	NI_NAMEREQD	0x00000004
sl@0
   232
#define	NI_NUMERICSERV	0x00000008
sl@0
   233
#define	NI_DGRAM	0x00000010
sl@0
   234
#if 0 /* obsolete */
sl@0
   235
#define NI_WITHSCOPEID	0x00000020
sl@0
   236
#endif
sl@0
   237
sl@0
   238
/*
sl@0
   239
 * Scope delimit character
sl@0
   240
 */
sl@0
   241
#define	SCOPE_DELIMITER	'%'
sl@0
   242
sl@0
   243
__BEGIN_DECLS
sl@0
   244
#ifndef __SYMBIAN32__
sl@0
   245
void		endhostent(void);
sl@0
   246
void		endnetent(void);
sl@0
   247
void		endnetgrent(void);
sl@0
   248
void		endprotoent(void);
sl@0
   249
#endif//__SYMBIAN32__
sl@0
   250
IMPORT_C void		endservent(void);
sl@0
   251
#ifndef __SYMBIAN32__
sl@0
   252
void		freehostent(struct hostent *);
sl@0
   253
#endif//__SYMBIAN32__
sl@0
   254
IMPORT_C struct hostent	*gethostbyaddr(const char *, int, int);
sl@0
   255
IMPORT_C struct hostent	*gethostbyname(const char *);
sl@0
   256
#ifndef __SYMBIAN32__
sl@0
   257
struct hostent	*gethostbyname2(const char *, int);
sl@0
   258
struct hostent	*gethostent(void);
sl@0
   259
struct hostent	*getipnodebyaddr(const void *, size_t, int, int *);
sl@0
   260
struct hostent	*getipnodebyname(const char *, int, int, int *);
sl@0
   261
struct netent	*getnetbyaddr(uint32_t, int);
sl@0
   262
struct netent	*getnetbyname(const char *);
sl@0
   263
struct netent	*getnetent(void);
sl@0
   264
int		getnetgrent(char **, char **, char **);
sl@0
   265
#endif//__SYMBIAN32__
sl@0
   266
IMPORT_C struct protoent	*getprotobyname(const char *);
sl@0
   267
IMPORT_C struct protoent	*getprotobynumber(int);
sl@0
   268
#ifndef __SYMBIAN32__
sl@0
   269
struct protoent	*getprotoent(void);
sl@0
   270
#endif//__SYMBIAN32__
sl@0
   271
IMPORT_C struct servent	*getservbyname(const char *, const char *);
sl@0
   272
IMPORT_C struct servent	*getservbyport(int, const char *);
sl@0
   273
IMPORT_C struct servent	*getservent(void);
sl@0
   274
#ifndef __SYMBIAN32__
sl@0
   275
void		herror(const char *);
sl@0
   276
__const char	*hstrerror(int);
sl@0
   277
int		innetgr(const char *, const char *, const char *, const char *);
sl@0
   278
void		sethostent(int);
sl@0
   279
/* void		sethostfile(const char *); */
sl@0
   280
void		setnetent(int);
sl@0
   281
void		setprotoent(int);
sl@0
   282
#endif//__SYMBIAN32__
sl@0
   283
IMPORT_C int		getaddrinfo(const char *, const char *,
sl@0
   284
			    const struct addrinfo *, struct addrinfo **);
sl@0
   285
IMPORT_C int		getnameinfo(const struct sockaddr *, socklen_t, char *,
sl@0
   286
			    size_t, char *, size_t, int);
sl@0
   287
IMPORT_C void		freeaddrinfo(struct addrinfo *);
sl@0
   288
IMPORT_C const char	*gai_strerror(int);
sl@0
   289
void		setnetgrent(const char *);
sl@0
   290
IMPORT_C void		setservent(int);
sl@0
   291
#ifdef __SYMBIAN32__
sl@0
   292
sl@0
   293
#ifdef __SYMBIAN_COMPILE_UNUSED__
sl@0
   294
int *__h_errno_location(void);
sl@0
   295
#endif
sl@0
   296
sl@0
   297
#endif
sl@0
   298
sl@0
   299
/*
sl@0
   300
 * PRIVATE functions specific to the FreeBSD implementation
sl@0
   301
 */
sl@0
   302
sl@0
   303
/* DO NOT USE THESE, THEY ARE SUBJECT TO CHANGE AND ARE NOT PORTABLE!!! */
sl@0
   304
int	* __h_error(void);
sl@0
   305
__END_DECLS
sl@0
   306
#ifdef __SYMBIAN32__
sl@0
   307
#ifdef __cplusplus
sl@0
   308
}
sl@0
   309
#endif
sl@0
   310
#endif
sl@0
   311
sl@0
   312
#endif /* !_NETDB_H_ */