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