| 1 | /*- |
| 2 | * Copyright (c) 1980, 1983, 1988 Regents of the University of California. |
| 3 | * All rights reserved. |
| 4 | * |
| 5 | * %sccs.include.redist.c% |
| 6 | * |
| 7 | * @(#)netdb.h 5.16 (Berkeley) %G% |
| 8 | */ |
| 9 | |
| 10 | #ifndef _NETDB_H_ |
| 11 | #define _NETDB_H_ |
| 12 | |
| 13 | #define _PATH_HEQUIV "/etc/hosts.equiv" |
| 14 | #define _PATH_HOSTS "/etc/hosts" |
| 15 | #define _PATH_NETWORKS "/etc/networks" |
| 16 | #define _PATH_PROTOCOLS "/etc/protocols" |
| 17 | #define _PATH_SERVICES "/etc/services" |
| 18 | |
| 19 | /* |
| 20 | * Structures returned by network data base library. All addresses are |
| 21 | * supplied in host order, and returned in network order (suitable for |
| 22 | * use in system calls). |
| 23 | */ |
| 24 | struct hostent { |
| 25 | char *h_name; /* official name of host */ |
| 26 | char **h_aliases; /* alias list */ |
| 27 | int h_addrtype; /* host address type */ |
| 28 | int h_length; /* length of address */ |
| 29 | char *h_addr; /* address */ |
| 30 | }; |
| 31 | |
| 32 | /* |
| 33 | * Assumption here is that a network number |
| 34 | * fits in 32 bits -- probably a poor one. |
| 35 | */ |
| 36 | struct netent { |
| 37 | char *n_name; /* official name of net */ |
| 38 | char **n_aliases; /* alias list */ |
| 39 | int n_addrtype; /* net address type */ |
| 40 | unsigned long n_net; /* network # */ |
| 41 | }; |
| 42 | |
| 43 | struct servent { |
| 44 | char *s_name; /* official service name */ |
| 45 | char **s_aliases; /* alias list */ |
| 46 | int s_port; /* port # */ |
| 47 | char *s_proto; /* protocol to use */ |
| 48 | }; |
| 49 | |
| 50 | struct protoent { |
| 51 | char *p_name; /* official protocol name */ |
| 52 | char **p_aliases; /* alias list */ |
| 53 | int p_proto; /* protocol # */ |
| 54 | }; |
| 55 | |
| 56 | /* |
| 57 | * Error return codes from gethostbyname() and gethostbyaddr() |
| 58 | * (left in extern int h_errno). |
| 59 | */ |
| 60 | |
| 61 | #define HOST_NOT_FOUND 1 /* Authoritative Answer Host not found */ |
| 62 | #define TRY_AGAIN 2 /* Non-Authoritive Host not found, or SERVERFAIL */ |
| 63 | #define NO_RECOVERY 3 /* Non recoverable errors, FORMERR, REFUSED, NOTIMP */ |
| 64 | #define NO_DATA 4 /* Valid name, no data record of requested type */ |
| 65 | #define NO_ADDRESS NO_DATA /* no address, look for MX record */ |
| 66 | |
| 67 | #include <sys/cdefs.h> |
| 68 | |
| 69 | __BEGIN_DECLS |
| 70 | void endhostent __P((void)); |
| 71 | void endnetent __P((void)); |
| 72 | void endprotoent __P((void)); |
| 73 | void endservent __P((void)); |
| 74 | struct hostent *gethostbyaddr __P((const char *, int, int)); |
| 75 | struct hostent *gethostbyname __P((const char *)); |
| 76 | struct hostent *gethostent __P((void)); |
| 77 | struct netent *getnetbyaddr __P((long, int)); /* u_long? */ |
| 78 | struct netent *getnetbyname __P((const char *)); |
| 79 | struct netent *getnetent __P((void)); |
| 80 | struct protoent *getprotobyname __P((const char *)); |
| 81 | struct protoent *getprotobynumber __P((int)); |
| 82 | struct protoent *getprotoent __P((void)); |
| 83 | struct servent *getservbyname __P((const char *, const char *)); |
| 84 | struct servent *getservbyport __P((int, const char *)); |
| 85 | struct servent *getservent __P((void)); |
| 86 | void herror __P((const char *)); |
| 87 | void sethostent __P((int)); |
| 88 | /* void sethostfile __P((const char *)); */ |
| 89 | void setnetent __P((int)); |
| 90 | void setprotoent __P((int)); |
| 91 | void setservent __P((int)); |
| 92 | __END_DECLS |
| 93 | |
| 94 | #endif /* !_NETDB_H_ */ |