epoc32/include/libc/netdb.h
author William Roberts <williamr@symbian.org>
Tue, 16 Mar 2010 16:12:26 +0000
branchSymbian2
changeset 2 2fe1408b6811
parent 0 061f57f2323e
child 4 837f303aceeb
permissions -rw-r--r--
Final list of Symbian^2 public API header files
williamr@2
     1
/* NETDB.H
williamr@2
     2
 * 
williamr@2
     3
 * Portions copyright (c) 1993-1999 Symbian Ltd.  All rights reserved.
williamr@2
     4
 */
williamr@2
     5
williamr@2
     6
/*-
williamr@2
     7
 * Copyright (c) 1980, 1983, 1988, 1993
williamr@2
     8
 *	The Regents of the University of California.  All rights reserved.
williamr@2
     9
 *
williamr@2
    10
 * Redistribution and use in source and binary forms, with or without
williamr@2
    11
 * modification, are permitted provided that the following conditions
williamr@2
    12
 * are met:
williamr@2
    13
 * 1. Redistributions of source code must retain the above copyright
williamr@2
    14
 *    notice, this list of conditions and the following disclaimer.
williamr@2
    15
 * 2. Redistributions in binary form must reproduce the above copyright
williamr@2
    16
 *    notice, this list of conditions and the following disclaimer in the
williamr@2
    17
 *    documentation and/or other materials provided with the distribution.
williamr@2
    18
 * 3. All advertising materials mentioning features or use of this software
williamr@2
    19
 *    must display the following acknowledgement:
williamr@2
    20
 *	This product includes software developed by the University of
williamr@2
    21
 *	California, Berkeley and its contributors.
williamr@2
    22
 * 4. Neither the name of the University nor the names of its contributors
williamr@2
    23
 *    may be used to endorse or promote products derived from this software
williamr@2
    24
 *    without specific prior written permission.
williamr@2
    25
 *
williamr@2
    26
 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
williamr@2
    27
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
williamr@2
    28
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
williamr@2
    29
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
williamr@2
    30
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
williamr@2
    31
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
williamr@2
    32
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
williamr@2
    33
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
williamr@2
    34
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
williamr@2
    35
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
williamr@2
    36
 * SUCH DAMAGE.
williamr@2
    37
 *
williamr@2
    38
 * Portions Copyright (c) 1993 by Digital Equipment Corporation.
williamr@2
    39
 *
williamr@2
    40
 * Permission to use, copy, modify, and distribute this software for any
williamr@2
    41
 * purpose with or without fee is hereby granted, provided that the above
williamr@2
    42
 * copyright notice and this permission notice appear in all copies, and that
williamr@2
    43
 * the name of Digital Equipment Corporation not be used in advertising or
williamr@2
    44
 * publicity pertaining to distribution of the document or software without
williamr@2
    45
 * specific, written prior permission.
williamr@2
    46
 *
williamr@2
    47
 * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
williamr@2
    48
 * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
williamr@2
    49
 * OF MERCHANTABILITY AND FITNESS.   IN NO EVENT SHALL DIGITAL EQUIPMENT
williamr@2
    50
 * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
williamr@2
    51
 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
williamr@2
    52
 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
williamr@2
    53
 * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
williamr@2
    54
 * SOFTWARE.
williamr@2
    55
 * -
williamr@2
    56
 * --Copyright--
williamr@2
    57
 */
williamr@2
    58
williamr@2
    59
/** @file
williamr@2
    60
@publishedAll
williamr@2
    61
@released
williamr@2
    62
*/
williamr@2
    63
williamr@2
    64
#ifndef _NETDB_H_
williamr@2
    65
#define _NETDB_H_
williamr@2
    66
williamr@2
    67
#ifdef __cplusplus
williamr@2
    68
extern "C" {
williamr@2
    69
#endif
williamr@2
    70
williamr@2
    71
#include <_ansi.h>
williamr@2
    72
#include <sys/errno.h>
williamr@2
    73
williamr@2
    74
#define	_PATH_HEQUIV	"/etc/hosts.equiv"
williamr@2
    75
#define	_PATH_HOSTS	"/etc/hosts"
williamr@2
    76
#define	_PATH_NETWORKS	"/etc/networks"
williamr@2
    77
#define	_PATH_PROTOCOLS	"/etc/protocols"
williamr@2
    78
#define	_PATH_SERVICES	"/etc/services"
williamr@2
    79
williamr@2
    80
#define h_errno	errno
williamr@2
    81
williamr@2
    82
/**
williamr@2
    83
Structures returned by network data base library.  All addresses are
williamr@2
    84
supplied in host order, and returned in network order (suitable for
williamr@2
    85
use in system calls).
williamr@2
    86
*/
williamr@2
    87
struct	hostent {
williamr@2
    88
	char	*h_name;	/* official name of host */
williamr@2
    89
	char	**h_aliases;	/* alias list */
williamr@2
    90
	int	h_addrtype;	/* host address type */
williamr@2
    91
	int	h_length;	/* length of address */
williamr@2
    92
	char	**h_addr_list;	/* list of addresses from name server */
williamr@2
    93
#define	h_addr	h_addr_list[0]	/* address, for backward compatibility */
williamr@2
    94
};
williamr@2
    95
williamr@2
    96
/**
williamr@2
    97
Assumption here is that a network number
williamr@2
    98
fits in an unsigned long -- probably a poor one.
williamr@2
    99
*/
williamr@2
   100
struct	netent {
williamr@2
   101
	char		*n_name;	/* official name of net */
williamr@2
   102
	char		**n_aliases;	/* alias list */
williamr@2
   103
	int		n_addrtype;	/* net address type */
williamr@2
   104
	unsigned long	n_net;		/* network # */
williamr@2
   105
};
williamr@2
   106
williamr@2
   107
struct	servent {
williamr@2
   108
	char	*s_name;	/* official service name */
williamr@2
   109
	char	**s_aliases;	/* alias list */
williamr@2
   110
	int	s_port;		/* port # */
williamr@2
   111
	char	*s_proto;	/* protocol to use */
williamr@2
   112
};
williamr@2
   113
williamr@2
   114
struct	protoent {
williamr@2
   115
	char	*p_name;	/* official protocol name */
williamr@2
   116
	char	**p_aliases;	/* alias list */
williamr@2
   117
	int	p_proto;	/* protocol # */
williamr@2
   118
};
williamr@2
   119
williamr@2
   120
/**
williamr@2
   121
Error return codes from gethostbyname() and gethostbyaddr()
williamr@2
   122
*/
williamr@2
   123
#define	NETDB_INTERNAL	-1	/* see errno */
williamr@2
   124
#define	NETDB_SUCCESS	0	/* no problem */
williamr@2
   125
#define	HOST_NOT_FOUND	ENOENT		/* Authoritative Answer Host not found */
williamr@2
   126
#define	TRY_AGAIN	ETIMEDOUT	/* Non-Authoritative Host not found, or SERVERFAIL */
williamr@2
   127
#define	NO_RECOVERY	ECOMM		/* Non recoverable errors, FORMERR, REFUSED, NOTIMP */
williamr@2
   128
#define	NO_DATA		4		/* Valid name, no data record of requested type */
williamr@2
   129
#define	NO_ADDRESS	NO_DATA		/* no address, look for MX record */
williamr@2
   130
williamr@2
   131
#if 0
williamr@2
   132
/* not supported on EPOC32 */
williamr@2
   133
/**
williamr@2
   134
@internalComponent
williamr@2
   135
*/
williamr@2
   136
void		sethostent (int);
williamr@2
   137
/**
williamr@2
   138
@internalComponent
williamr@2
   139
*/
williamr@2
   140
struct hostent	*gethostent (void);
williamr@2
   141
/**
williamr@2
   142
@internalComponent
williamr@2
   143
*/
williamr@2
   144
void		endhostent (void);
williamr@2
   145
/**
williamr@2
   146
@internalComponent
williamr@2
   147
*/
williamr@2
   148
void		setnetent (int);
williamr@2
   149
/**
williamr@2
   150
@internalComponent
williamr@2
   151
*/
williamr@2
   152
struct netent	*getnetent (void);
williamr@2
   153
/**
williamr@2
   154
@internalComponent
williamr@2
   155
*/
williamr@2
   156
void		endnetent (void);
williamr@2
   157
/**
williamr@2
   158
@internalComponent
williamr@2
   159
*/
williamr@2
   160
void		setprotoent (int);
williamr@2
   161
/**
williamr@2
   162
@internalComponent
williamr@2
   163
*/
williamr@2
   164
struct protoent	*getprotoent (void);
williamr@2
   165
/**
williamr@2
   166
@internalComponent
williamr@2
   167
*/
williamr@2
   168
void		endprotoent (void);
williamr@2
   169
/**
williamr@2
   170
@internalComponent
williamr@2
   171
*/
williamr@2
   172
void		setservent (int);
williamr@2
   173
/**
williamr@2
   174
@internalComponent
williamr@2
   175
*/
williamr@2
   176
struct servent	*getservent (void);
williamr@2
   177
/**
williamr@2
   178
@internalComponent
williamr@2
   179
*/
williamr@2
   180
void		endservent (void);
williamr@2
   181
#endif
williamr@2
   182
williamr@2
   183
IMPORT_C struct hostent	*gethostbyaddr (const char *, int, int);
williamr@2
   184
IMPORT_C struct hostent	*gethostbyname (const char *);
williamr@2
   185
struct servent	*getservbyname (const char *, const char *);
williamr@2
   186
struct servent	*getservbyport (int, const char *);
williamr@2
   187
struct netent	*getnetbyaddr (unsigned long, int);
williamr@2
   188
struct netent	*getnetbyname (const char *);
williamr@2
   189
struct protoent	*getprotobyname (const char *);
williamr@2
   190
struct protoent	*getprotobynumber (int);
williamr@2
   191
williamr@2
   192
#ifdef __cplusplus
williamr@2
   193
}
williamr@2
   194
#endif
williamr@2
   195
williamr@2
   196
#endif /* !_NETDB_H_ */