2 |
- |
1 |
#ifndef __NETDB_H__
|
|
|
2 |
#define __NETDB_H__
|
|
|
3 |
|
|
|
4 |
#ifndef _BSD_EXTENSION
|
|
|
5 |
This header file is an extension to ANSI/POSIX
|
|
|
6 |
#endif
|
|
|
7 |
|
|
|
8 |
#pragma lib "/$M/lib/ape/libbsd.a"
|
|
|
9 |
|
|
|
10 |
/*-
|
|
|
11 |
* Copyright (c) 1980, 1983, 1988 Regents of the University of California.
|
|
|
12 |
* All rights reserved.
|
|
|
13 |
*
|
|
|
14 |
* Redistribution and use in source and binary forms are permitted
|
|
|
15 |
* provided that: (1) source distributions retain this entire copyright
|
|
|
16 |
* notice and comment, and (2) distributions including binaries display
|
|
|
17 |
* the following acknowledgement: ``This product includes software
|
|
|
18 |
* developed by the University of California, Berkeley and its contributors''
|
|
|
19 |
* in the documentation or other materials provided with the distribution
|
|
|
20 |
* and in all advertising materials mentioning features or use of this
|
|
|
21 |
* software. Neither the name of the University nor the names of its
|
|
|
22 |
* contributors may be used to endorse or promote products derived
|
|
|
23 |
* from this software without specific prior written permission.
|
|
|
24 |
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
|
|
|
25 |
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
|
|
26 |
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
27 |
*
|
|
|
28 |
* @(#)netdb.h 5.11 (Berkeley) 5/21/90
|
|
|
29 |
*/
|
|
|
30 |
|
|
|
31 |
#ifdef __cplusplus
|
|
|
32 |
extern "C" {
|
|
|
33 |
#endif
|
|
|
34 |
|
|
|
35 |
/*
|
|
|
36 |
* Structures returned by network data base library. All addresses are
|
|
|
37 |
* supplied in host order, and returned in network order (suitable for
|
|
|
38 |
* use in system calls).
|
|
|
39 |
*/
|
|
|
40 |
struct hostent {
|
|
|
41 |
char *h_name; /* official name of host */
|
|
|
42 |
char **h_aliases; /* alias list */
|
|
|
43 |
int h_addrtype; /* host address type */
|
|
|
44 |
int h_length; /* length of address */
|
|
|
45 |
char **h_addr_list; /* list of addresses from name server */
|
|
|
46 |
#define h_addr h_addr_list[0] /* address, for backward compatiblity */
|
|
|
47 |
};
|
|
|
48 |
|
|
|
49 |
/*
|
|
|
50 |
* Assumption here is that a network number
|
|
|
51 |
* fits in 32 bits -- probably a poor one.
|
|
|
52 |
*/
|
|
|
53 |
struct netent {
|
|
|
54 |
char *n_name; /* official name of net */
|
|
|
55 |
char **n_aliases; /* alias list */
|
|
|
56 |
int n_addrtype; /* net address type */
|
|
|
57 |
unsigned long n_net; /* network # */
|
|
|
58 |
};
|
|
|
59 |
|
|
|
60 |
struct servent {
|
|
|
61 |
char *s_name; /* official service name */
|
|
|
62 |
char **s_aliases; /* alias list */
|
|
|
63 |
int s_port; /* port # */
|
|
|
64 |
char *s_proto; /* protocol to use */
|
|
|
65 |
};
|
|
|
66 |
|
|
|
67 |
struct protoent {
|
|
|
68 |
char *p_name; /* official protocol name */
|
|
|
69 |
char **p_aliases; /* alias list */
|
|
|
70 |
int p_proto; /* protocol # */
|
|
|
71 |
};
|
|
|
72 |
|
|
|
73 |
/* from 4.0 RPCSRC */
|
|
|
74 |
struct rpcent {
|
|
|
75 |
char *r_name; /* name of server for this rpc program */
|
|
|
76 |
char **r_aliases; /* alias list */
|
|
|
77 |
int r_number; /* rpc program number */
|
|
|
78 |
};
|
|
|
79 |
|
|
|
80 |
extern struct hostent *gethostbyname(const char *),
|
|
|
81 |
*gethostbyaddr(const void *, int, int),
|
|
|
82 |
*gethostent(void);
|
|
|
83 |
extern struct netent *getnetbyname(const char *),
|
|
|
84 |
*getnetbyaddr(long, int),
|
|
|
85 |
*getnetent(void);
|
|
|
86 |
extern struct servent *getservbyname(const char *, const char *),
|
|
|
87 |
*getservbyport(int, const char *),
|
|
|
88 |
*getservent(void);
|
|
|
89 |
extern struct protoent *getprotobyname(const char *),
|
|
|
90 |
*getprotobynumber(int),
|
|
|
91 |
*getprotoent(void);
|
|
|
92 |
extern struct rpcent *getrpcbyname(const char *),
|
|
|
93 |
*getrpcbynumber(int),
|
|
|
94 |
*getrpcent(void);
|
|
|
95 |
extern void sethostent(int), endhostent(void),
|
|
|
96 |
setnetent(int), endnetent(void),
|
|
|
97 |
setservent(int), endservent(void),
|
|
|
98 |
setprotoent(int), endprotoent(void),
|
|
|
99 |
setrpcent(int), endrpcent(void);
|
|
|
100 |
|
|
|
101 |
/*
|
|
|
102 |
* Error return codes from gethostbyname() and gethostbyaddr()
|
|
|
103 |
* (left in extern int h_errno).
|
|
|
104 |
*/
|
|
|
105 |
extern int h_errno;
|
|
|
106 |
extern void herror(const char *);
|
|
|
107 |
extern char *hstrerror(int);
|
|
|
108 |
|
|
|
109 |
#define HOST_NOT_FOUND 1 /* Authoritative Answer Host not found */
|
|
|
110 |
#define TRY_AGAIN 2 /* Non-Authoritive Host not found, or SERVERFAIL */
|
|
|
111 |
#define NO_RECOVERY 3 /* Non recoverable errors, FORMERR, REFUSED, NOTIMP */
|
|
|
112 |
#define NO_DATA 4 /* Valid name, no data record of requested type */
|
|
|
113 |
#define NO_ADDRESS NO_DATA /* no address, look for MX record */
|
|
|
114 |
|
|
|
115 |
#define __HOST_SVC_NOT_AVAIL 99 /* libc internal use only */
|
|
|
116 |
|
|
|
117 |
#ifdef __cplusplus
|
|
|
118 |
}
|
|
|
119 |
#endif
|
|
|
120 |
|
|
|
121 |
#endif /* !__NETDB_H__ */
|