1: /* 2: * Copyright (c) 1980,1983,1988 Regents of the University of California. 3: * All rights reserved. 4: * 5: * Redistribution and use in source and binary forms are permitted 6: * provided that this notice is preserved and that due credit is given 7: * to the University of California at Berkeley. The name of the University 8: * may not be used to endorse or promote products derived from this 9: * software without specific prior written permission. This software 10: * is provided ``as is'' without express or implied warranty. 11: * 12: * @(#)netdb.h 5.9.3 (2.11BSD) 99/5/25 13: */ 14: 15: extern int h_errno; 16: 17: /* 18: * Structures returned by network 19: * data base library. All addresses 20: * are supplied in host order, and 21: * returned in network order (suitable 22: * for 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_list; /* list of addresses from name server */ 30: #define h_addr h_addr_list[0] /* address, for backward compatiblity */ 31: }; 32: 33: /* 34: * Assumption here is that a network number 35: * fits in 32 bits -- probably a poor one. 36: */ 37: struct netent { 38: char *n_name; /* official name of net */ 39: char **n_aliases; /* alias list */ 40: int n_addrtype; /* net address type */ 41: unsigned long n_net; /* network # */ 42: }; 43: 44: struct servent { 45: char *s_name; /* official service name */ 46: char **s_aliases; /* alias list */ 47: int s_port; /* port # */ 48: char *s_proto; /* protocol to use */ 49: }; 50: 51: struct protoent { 52: char *p_name; /* official protocol name */ 53: char **p_aliases; /* alias list */ 54: int p_proto; /* protocol # */ 55: }; 56: 57: struct hostent *gethostbyname(), *gethostbyaddr(), *gethostent(); 58: struct netent *getnetbyname(), *getnetbyaddr(), *getnetent(); 59: struct servent *getservbyname(), *getservbyport(), *getservent(); 60: struct protoent *getprotobyname(), *getprotobynumber(), *getprotoent(); 61: 62: /* 63: * Error return codes from gethostbyname() and gethostbyaddr() 64: * (left in extern int h_errno). 65: */ 66: 67: #define HOST_NOT_FOUND 1 /* Authoritative Answer Host not found */ 68: #define TRY_AGAIN 2 /* Non-Authoritive Host not found, or SERVERFAIL */ 69: #define NO_RECOVERY 3 /* Non recoverable errors, FORMERR, REFUSED, NOTIMP */ 70: #define NO_DATA 4 /* Valid name, no data record of requested type */ 71: #define NO_ADDRESS NO_DATA /* no address, look for MX record */