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