sl@0: /* NETDB.H sl@0: * Copyright (c) 1980, 1983, 1988, 1993 sl@0: * The Regents of the University of California. All rights reserved. sl@0: * sl@0: * Redistribution and use in source and binary forms, with or without sl@0: * modification, are permitted provided that the following conditions sl@0: * are met: sl@0: * 1. Redistributions of source code must retain the above copyright sl@0: * notice, this list of conditions and the following disclaimer. sl@0: * 2. Redistributions in binary form must reproduce the above copyright sl@0: * notice, this list of conditions and the following disclaimer in the sl@0: * documentation and/or other materials provided with the distribution. sl@0: * 4. Neither the name of the University nor the names of its contributors sl@0: * may be used to endorse or promote products derived from this software sl@0: * without specific prior written permission. sl@0: * sl@0: * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND sl@0: * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE sl@0: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE sl@0: * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE sl@0: * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL sl@0: * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS sl@0: * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) sl@0: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT sl@0: * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY sl@0: * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF sl@0: * SUCH DAMAGE. sl@0: * sl@0: * - sl@0: * Portions Copyright (c) 1993 by Digital Equipment Corporation. sl@0: * sl@0: * Permission to use, copy, modify, and distribute this software for any sl@0: * purpose with or without fee is hereby granted, provided that the above sl@0: * copyright notice and this permission notice appear in all copies, and that sl@0: * the name of Digital Equipment Corporation not be used in advertising or sl@0: * publicity pertaining to distribution of the document or software without sl@0: * specific, written prior permission. sl@0: * sl@0: * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL sl@0: * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES sl@0: * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT sl@0: * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL sl@0: * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR sl@0: * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS sl@0: * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS sl@0: * SOFTWARE. sl@0: * - sl@0: * Portions Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. sl@0: * --Copyright-- sl@0: */ sl@0: sl@0: /* sl@0: * @(#)netdb.h 8.1 (Berkeley) 6/2/93 sl@0: * From: Id: netdb.h,v 8.9 1996/11/19 08:39:29 vixie Exp $ sl@0: * $FreeBSD: src/include/netdb.h,v 1.38.2.1 2005/07/22 20:17:30 ume Exp $ sl@0: */ sl@0: sl@0: #ifndef _NETDB_H_ sl@0: #define _NETDB_H_ sl@0: sl@0: #ifdef __SYMBIAN32__ sl@0: #ifdef __cplusplus sl@0: extern "C" { sl@0: #endif sl@0: #include <_ansi.h> sl@0: sl@0: #include sl@0: #endif sl@0: #include sl@0: #include sl@0: #ifdef __SYMBIAN32__ sl@0: #include sl@0: #include sl@0: #endif sl@0: sl@0: #ifndef _SIZE_T_DECLARED sl@0: typedef __size_t size_t; sl@0: #define _SIZE_T_DECLARED sl@0: #endif sl@0: sl@0: #ifndef _SOCKLEN_T_DECLARED sl@0: typedef __socklen_t socklen_t; sl@0: #define _SOCKLEN_T_DECLARED sl@0: #endif sl@0: sl@0: #ifndef _UINT32_T_DECLARED sl@0: typedef __uint32_t uint32_t; sl@0: #define _UINT32_T_DECLARED sl@0: #endif sl@0: sl@0: #ifndef _PATH_HEQUIV sl@0: # define _PATH_HEQUIV "/etc/hosts.equiv" sl@0: #endif sl@0: #ifndef __SYMBIAN32__ sl@0: #define _PATH_HOSTS "/etc/hosts" sl@0: #define _PATH_NETWORKS "/etc/networks" sl@0: #define _PATH_PROTOCOLS "/etc/protocols" sl@0: #define _PATH_SERVICES "/etc/services" sl@0: #define h_errno (*__h_error()) sl@0: #else sl@0: #define _PATH_SERVICES "\\resource\\openc\\services" sl@0: #define h_errno errno sl@0: #endif sl@0: sl@0: sl@0: /* sl@0: * Structures returned by network data base library. All addresses are sl@0: * supplied in host order, and returned in network order (suitable for sl@0: * use in system calls). sl@0: */ sl@0: struct hostent { sl@0: char *h_name; /* official name of host */ sl@0: char **h_aliases; /* alias list */ sl@0: int h_addrtype; /* host address type */ sl@0: int h_length; /* length of address */ sl@0: char **h_addr_list; /* list of addresses from name server */ sl@0: #define h_addr h_addr_list[0] /* address, for backward compatibility */ sl@0: }; sl@0: sl@0: struct netent { sl@0: char *n_name; /* official name of net */ sl@0: char **n_aliases; /* alias list */ sl@0: int n_addrtype; /* net address type */ sl@0: #ifdef __SYMBIAN32__ sl@0: unsigned long n_net; sl@0: #else sl@0: uint32_t n_net; /* network # */ sl@0: #endif sl@0: }; sl@0: sl@0: struct servent { sl@0: char *s_name; /* official service name */ sl@0: char **s_aliases; /* alias list */ sl@0: int s_port; /* port # */ sl@0: char *s_proto; /* protocol to use */ sl@0: }; sl@0: sl@0: struct protoent { sl@0: char *p_name; /* official protocol name */ sl@0: char **p_aliases; /* alias list */ sl@0: int p_proto; /* protocol # */ sl@0: }; sl@0: sl@0: struct addrinfo { sl@0: int ai_flags; /* AI_PASSIVE, AI_CANONNAME, AI_NUMERICHOST */ sl@0: int ai_family; /* PF_xxx */ sl@0: int ai_socktype; /* SOCK_xxx */ sl@0: int ai_protocol; /* 0 or IPPROTO_xxx for IPv4 and IPv6 */ sl@0: socklen_t ai_addrlen; /* length of ai_addr */ sl@0: char *ai_canonname; /* canonical name for hostname */ sl@0: struct sockaddr *ai_addr; /* binary address */ sl@0: struct addrinfo *ai_next; /* next structure in linked list */ sl@0: }; sl@0: sl@0: /* sl@0: * Error return codes from gethostbyname() and gethostbyaddr() sl@0: * (left in h_errno). sl@0: */ sl@0: sl@0: #define NETDB_INTERNAL -1 /* see errno */ sl@0: #define NETDB_SUCCESS 0 /* no problem */ sl@0: #ifndef __SYMBIAN32__ sl@0: #define HOST_NOT_FOUND 1 /* Authoritative Answer Host not found */ sl@0: #define TRY_AGAIN 2 /* Non-Authoritative Host not found, or SERVERFAIL */ sl@0: #define NO_RECOVERY 3 /* Non recoverable errors, FORMERR, REFUSED, NOTIMP */ sl@0: #else sl@0: #define HOST_NOT_FOUND ENOENT /* Authoritative Answer Host not found */ sl@0: #define TRY_AGAIN ETIMEDOUT /* Non-Authoritative Host not found, or SERVERFAIL */ sl@0: #define NO_RECOVERY ECOMM /* Non recoverable errors, FORMERR, REFUSED, NOTIMP */ sl@0: #endif sl@0: #define NO_DATA 4 /* Valid name, no data record of requested type */ sl@0: #define NO_ADDRESS NO_DATA /* no address, look for MX record */ sl@0: sl@0: /* sl@0: * Error return codes from getaddrinfo() sl@0: */ sl@0: #if 0 sl@0: /* obsoleted */ sl@0: #define EAI_ADDRFAMILY 1 /* address family for hostname not supported */ sl@0: #endif sl@0: #define EAI_AGAIN 2 /* temporary failure in name resolution */ sl@0: #define EAI_BADFLAGS 3 /* invalid value for ai_flags */ sl@0: #define EAI_FAIL 4 /* non-recoverable failure in name resolution */ sl@0: #define EAI_FAMILY 5 /* ai_family not supported */ sl@0: #define EAI_MEMORY 6 /* memory allocation failure */ sl@0: #if 0 sl@0: /* obsoleted */ sl@0: #define EAI_NODATA 7 /* no address associated with hostname */ sl@0: #endif sl@0: #define EAI_NONAME 8 /* hostname nor servname provided, or not known */ sl@0: #define EAI_SERVICE 9 /* servname not supported for ai_socktype */ sl@0: #define EAI_SOCKTYPE 10 /* ai_socktype not supported */ sl@0: #define EAI_SYSTEM 11 /* system error returned in errno */ sl@0: #define EAI_BADHINTS 12 sl@0: #define EAI_PROTOCOL 13 sl@0: #define EAI_MAX 14 sl@0: sl@0: /* sl@0: * Flag values for getaddrinfo() sl@0: */ sl@0: #define AI_PASSIVE 0x00000001 /* get address to use bind() */ sl@0: #define AI_CANONNAME 0x00000002 /* fill ai_canonname */ sl@0: #define AI_NUMERICHOST 0x00000004 /* prevent host name resolution */ sl@0: #define AI_NUMERICSERV 0x00000008 /* prevent service name resolution */ sl@0: /* valid flags for addrinfo (not a standard def, apps should not use it) */ sl@0: #define AI_MASK \ sl@0: (AI_PASSIVE | AI_CANONNAME | AI_NUMERICHOST | AI_NUMERICSERV | \ sl@0: AI_ADDRCONFIG) sl@0: sl@0: #define AI_ALL 0x00000100 /* IPv6 and IPv4-mapped (with AI_V4MAPPED) */ sl@0: #define AI_V4MAPPED_CFG 0x00000200 /* accept IPv4-mapped if kernel supports */ sl@0: #define AI_ADDRCONFIG 0x00000400 /* only if any address is assigned */ sl@0: #define AI_V4MAPPED 0x00000800 /* accept IPv4-mapped IPv6 address */ sl@0: #ifdef __SYMBIAN32__ sl@0: #define AI_V4CONVERTED 0x00001000 sl@0: #endif sl@0: /* special recommended flags for getipnodebyname */ sl@0: #define AI_DEFAULT (AI_V4MAPPED_CFG | AI_ADDRCONFIG) sl@0: sl@0: /* sl@0: * Constants for getnameinfo() sl@0: */ sl@0: #define NI_MAXHOST 1025 sl@0: #define NI_MAXSERV 32 sl@0: sl@0: /* sl@0: * Flag values for getnameinfo() sl@0: */ sl@0: #define NI_NOFQDN 0x00000001 sl@0: #define NI_NUMERICHOST 0x00000002 sl@0: #define NI_NAMEREQD 0x00000004 sl@0: #define NI_NUMERICSERV 0x00000008 sl@0: #define NI_DGRAM 0x00000010 sl@0: #if 0 /* obsolete */ sl@0: #define NI_WITHSCOPEID 0x00000020 sl@0: #endif sl@0: sl@0: /* sl@0: * Scope delimit character sl@0: */ sl@0: #define SCOPE_DELIMITER '%' sl@0: sl@0: __BEGIN_DECLS sl@0: #ifndef __SYMBIAN32__ sl@0: void endhostent(void); sl@0: void endnetent(void); sl@0: void endnetgrent(void); sl@0: void endprotoent(void); sl@0: #endif//__SYMBIAN32__ sl@0: IMPORT_C void endservent(void); sl@0: #ifndef __SYMBIAN32__ sl@0: void freehostent(struct hostent *); sl@0: #endif//__SYMBIAN32__ sl@0: IMPORT_C struct hostent *gethostbyaddr(const char *, int, int); sl@0: IMPORT_C struct hostent *gethostbyname(const char *); sl@0: #ifndef __SYMBIAN32__ sl@0: struct hostent *gethostbyname2(const char *, int); sl@0: struct hostent *gethostent(void); sl@0: struct hostent *getipnodebyaddr(const void *, size_t, int, int *); sl@0: struct hostent *getipnodebyname(const char *, int, int, int *); sl@0: struct netent *getnetbyaddr(uint32_t, int); sl@0: struct netent *getnetbyname(const char *); sl@0: struct netent *getnetent(void); sl@0: int getnetgrent(char **, char **, char **); sl@0: #endif//__SYMBIAN32__ sl@0: IMPORT_C struct protoent *getprotobyname(const char *); sl@0: IMPORT_C struct protoent *getprotobynumber(int); sl@0: #ifndef __SYMBIAN32__ sl@0: struct protoent *getprotoent(void); sl@0: #endif//__SYMBIAN32__ sl@0: IMPORT_C struct servent *getservbyname(const char *, const char *); sl@0: IMPORT_C struct servent *getservbyport(int, const char *); sl@0: IMPORT_C struct servent *getservent(void); sl@0: #ifndef __SYMBIAN32__ sl@0: void herror(const char *); sl@0: __const char *hstrerror(int); sl@0: int innetgr(const char *, const char *, const char *, const char *); sl@0: void sethostent(int); sl@0: /* void sethostfile(const char *); */ sl@0: void setnetent(int); sl@0: void setprotoent(int); sl@0: #endif//__SYMBIAN32__ sl@0: IMPORT_C int getaddrinfo(const char *, const char *, sl@0: const struct addrinfo *, struct addrinfo **); sl@0: IMPORT_C int getnameinfo(const struct sockaddr *, socklen_t, char *, sl@0: size_t, char *, size_t, int); sl@0: IMPORT_C void freeaddrinfo(struct addrinfo *); sl@0: IMPORT_C const char *gai_strerror(int); sl@0: void setnetgrent(const char *); sl@0: IMPORT_C void setservent(int); sl@0: #ifdef __SYMBIAN32__ sl@0: sl@0: #ifdef __SYMBIAN_COMPILE_UNUSED__ sl@0: int *__h_errno_location(void); sl@0: #endif sl@0: sl@0: #endif sl@0: sl@0: /* sl@0: * PRIVATE functions specific to the FreeBSD implementation sl@0: */ sl@0: sl@0: /* DO NOT USE THESE, THEY ARE SUBJECT TO CHANGE AND ARE NOT PORTABLE!!! */ sl@0: int * __h_error(void); sl@0: __END_DECLS sl@0: #ifdef __SYMBIAN32__ sl@0: #ifdef __cplusplus sl@0: } sl@0: #endif sl@0: #endif sl@0: sl@0: #endif /* !_NETDB_H_ */