1 /* $Copyright: 2 * 3 * Copyright 1998-2000 by the Massachusetts Institute of Technology. 4 * 5 * All rights reserved. 6 * 7 * Permission to use, copy, modify, and distribute this software and its 8 * documentation for any purpose and without fee is hereby granted, 9 * provided that the above copyright notice appear in all copies and that 10 * both that copyright notice and this permission notice appear in 11 * supporting documentation, and that the name of M.I.T. not be used in 12 * advertising or publicity pertaining to distribution of the software 13 * without specific, written prior permission. Furthermore if you modify 14 * this software you must label your software as modified software and not 15 * distribute it in such a fashion that it might be confused with the 16 * original MIT software. M.I.T. makes no representations about the 17 * suitability of this software for any purpose. It is provided "as is" 18 * without express or implied warranty. 19 * 20 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED 21 * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF 22 * MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. 23 * 24 * Individual source code files are copyright MIT, Cygnus Support, 25 * OpenVision, Oracle, Sun Soft, FundsXpress, and others. 26 * 27 * Project Athena, Athena, Athena MUSE, Discuss, Hesiod, Kerberos, Moira, 28 * and Zephyr are trademarks of the Massachusetts Institute of Technology 29 * (MIT). No commercial use of these trademarks may be made without prior 30 * written permission of MIT. 31 * 32 * "Commercial use" means use of a name in a product or other for-profit 33 * manner. It does NOT prevent a commercial firm from referring to the MIT 34 * trademarks in order to convey information (although in doing so, 35 * recognition of their trademark status should be given). 36 * $ 37 */ 38 39 /* $Header: /cvs/src/sasl/mac/CommonKClient/mac_kclient3/Headers/KerberosSupport/netdb.h,v 1.2 2001/12/04 02:05:57 rjs3 Exp $ */ 40 41 /* MIT Sockets Library 42 * netdb.h 43 * macdev@mit.edu 44 */ 45 46 #ifndef _NETDB_H 47 #define _NETDB_H 48 49 #include <stdlib.h> 50 51 #ifdef __cplusplus 52 extern "C" { 53 #endif 54 55 struct hostent 56 { 57 char *h_name; /* official (cannonical) name of host */ 58 char **h_aliases; /* pointer to array of pointers of alias names */ 59 int h_addrtype; /* host address type: AF_INET or AF_INET6 */ 60 int h_length; /* length of address: 4 or 16 */ 61 char **h_addr_list; /* pointer to array of pointers with IPv4 or IPv6 addresses */ 62 }; 63 64 #define h_addr h_addr_list[0] /* first address in list */ 65 66 struct servent 67 { 68 char *s_name; /* official service name */ 69 char **s_aliases; /* alias list */ 70 int s_port; /* port number, network-byte order */ 71 char *s_proto; /* protocol to use */ 72 }; 73 74 #if defined(__CFM68K__) && !defined(__USING_STATIC_LIBS__) 75 # pragma import on 76 #endif 77 78 #if !TARGET_RT_MAC_CFM 79 # pragma d0_pointers on 80 #endif 81 82 struct hostent *gethostbyname(const char *hostname); 83 struct hostent *gethostbyaddr(const char *addr, size_t len, int family); 84 85 /* Gets the local host's hostname. If namelen isn't long enough, it puts in as much of 86 the name as possible, without a terminating null. This is done so it is compatible 87 with the unix version. This is, admittedly, the wrong way to write a code, but my 88 excuse is compatibility. It should really dynamically allocate space. Oh well. 89 It also assert()'s if you don't pass it a reasonably sized buffer. */ 90 int gethostname(char *name, size_t namelen); 91 92 /* Opens the service database if needed and gets the next service entry. 93 Returns NULL if you have read them all. On error, returns NULL and 94 calls SetMITLibError(). */ 95 struct servent *getservent (void); 96 97 /* Closes the service database. On error, calls SetMITLibError(). */ 98 void endservent (void); 99 100 struct servent *getservbyname (const char *servname, const char *protname); 101 struct servent *getservbyport (int port, const char *protname); 102 103 #if !TARGET_RT_MAC_CFM 104 # pragma d0_pointers reset 105 #endif 106 107 #if defined(__CFM68K__) && !defined(__USING_STATIC_LIBS__) 108 # pragma import reset 109 #endif 110 111 #ifdef __cplusplus 112 } 113 #endif 114 115 #endif /* _NETDB_H */