home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1999 March B / SCO_CASTOR4RRT.iso / update701 / root.18 / usr / include / netdb.h / netdb.h
Encoding:
C/C++ Source or Header  |  1998-08-18  |  9.3 KB  |  274 lines

  1. /*
  2.  * This file was automatically generated by vpp on Tue Aug 18 19:28:28 1998
  3.  * based on version template file: ./netdb.vh
  4.  */
  5. /*
  6.  * Copyright (c) 1998 The Santa Cruz Operation, Inc.. All Rights Reserved. 
  7.  *                                                                         
  8.  *        THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF THE               
  9.  *                   SANTA CRUZ OPERATION INC.                             
  10.  *                                                                         
  11.  *   The copyright notice above does not evidence any actual or intended   
  12.  *   publication of such source code.                                      
  13.  */
  14.  
  15. #ident "@(#)netdb.vh    1.4"
  16.  
  17. /*
  18.  *    Copyright (c) 1982, 1986, 1988
  19.  *    The Regents of the University of California
  20.  *    All Rights Reserved.
  21.  *    Portions of this document are derived from
  22.  *    software developed by the University of
  23.  *    California, Berkeley, and its contributors.
  24.  */
  25.  
  26. /*
  27.  * +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  28.  *         PROPRIETARY NOTICE (Combined)
  29.  * 
  30.  * This source code is unpublished proprietary information
  31.  * constituting, or derived under license from AT&T's UNIX(r) System V.
  32.  * In addition, portions of such source code were derived from Berkeley
  33.  * 4.3 BSD under license from the Regents of the University of
  34.  * California.
  35.  * Portions Copyright (c) 1993 by Digital Equipment Corporation.
  36.  *
  37.  *         Copyright Notice 
  38.  * 
  39.  * Notice of copyright on this source code product does not indicate 
  40.  * publication.
  41.  * 
  42.  *     (c) 1986,1987,1988.1989  Sun Microsystems, Inc
  43.  *     (c) 1983,1984,1985,1986,1987,1988,1989,1990  AT&T.
  44.  *    (c) 1990,1991  UNIX System Laboratories, Inc.
  45.  *               All rights reserved.
  46.  *  
  47.  */
  48.  
  49. /*
  50.  * Structures returned by network data base library.
  51.  * All addresses are supplied in host order, and
  52.  * returned in network order (suitable for use in system calls).
  53.  */
  54.  
  55. #ifndef _NETDB_H
  56. #define _NETDB_H
  57.  
  58. #include <sys/bitypes.h>
  59. #include <sys/cdefs.h>
  60. #include <sys/convsa.h>
  61. #include <netinet/in.h>
  62.  
  63. __BEGIN_DECLS
  64.  
  65. /* XPG4 Version 2 typedefs */
  66. #ifndef _SIZE_T
  67. #define _SIZE_T
  68. typedef unsigned int size_t;
  69. #endif
  70.  
  71. struct    hostent {
  72.     char    *h_name;    /* official name of host */
  73.     char    **h_aliases;    /* alias list */
  74.     int        h_addrtype;    /* host address type */
  75.     int        h_length;    /* length of address */
  76.     char    **h_addr_list;    /* list of addresses from name server */
  77. #define    h_addr    h_addr_list[0]    /* address, for backward compatiblity */
  78. };
  79.  
  80. /*
  81.  * Assumption here is that a network number
  82.  * fits in 32 bits -- probably a poor one.
  83.  */
  84. struct    netent {
  85.     char        *n_name;    /* official name of net */
  86.     char        **n_aliases;    /* alias list */
  87.     int            n_addrtype;    /* net address type */
  88.     in_addr_t        n_net;        /* network #  = XPG4 V2 type */
  89. };
  90.  
  91. struct    servent {
  92.     char    *s_name;    /* official service name */
  93.     char    **s_aliases;    /* alias list */
  94.     int        s_port;        /* port # */
  95.     char    *s_proto;    /* protocol to use */
  96. };
  97.  
  98. struct    protoent {
  99.     char    *p_name;    /* official protocol name */
  100.     char    **p_aliases;    /* alias list */
  101.     int        p_proto;    /* protocol # */
  102. };
  103.  
  104. #if !(defined(_XOPEN_SOURCE) && _XOPEN_SOURCE_EXTENDED - 0 >= 1)
  105. /*
  106.  * Flag values for getaddrinfo()
  107.  */
  108. #define AI_PASSIVE    0x01    /* socket address is intended for bind() */
  109. #define AI_CANONNAME    0x02    /* request for canonical name */
  110.  
  111. /*
  112.  * Error values for getaddrinfo()
  113.  */
  114. #define EAI_BADFLAGS    1    /* invalid value for ai_flags */
  115. #define    EAI_NONAME    2    /* neither name nor service provided/found */
  116. #define EAI_AGAIN    3    /* temporary failure in name resolution */
  117. #define EAI_FAIL    4    /* non-recoverable failure in name resoln */
  118. #define EAI_NODATA    5    /* no address associated with name */
  119. #define EAI_FAMILY    6    /* ai_family not supported */
  120. #define EAI_SOCKTYPE    7    /* ai_socktype not supported */
  121. #define EAI_SERVICE    8    /* service not supported for ai_socktype */
  122. #define EAI_ADDRFAMILY    9    /* address family for name not supported */
  123. #define EAI_MEMORY    10    /* memory allocation failure */
  124. #define EAI_SYSTEM    11    /* system error */
  125.  
  126. /*
  127.  * Structure used by getaddrinfo()
  128.  */
  129. struct addrinfo {
  130.     int        ai_flags;    /* input flags */
  131.     int        ai_family;    /* protofamily for socket */
  132.     int        ai_socktype;    /* socket type */
  133.     int        ai_protocol;    /* protocol for socket */
  134.     int        ai_addrlen;    /* length of socket address */
  135.     struct sockaddr *ai_addr;    /* socket address */
  136.     char        *ai_canonname;    /* canonical name for service locn */
  137.     struct addrinfo *ai_next;    /* pointer to next in list */
  138. };
  139.  
  140. /*
  141.  * Size hints for getnameinfo()
  142.  */
  143. #define NI_MAXHOST    1025        /* Maximum host name including nul */
  144. #define NI_MAXSERV    32        /* Maximum service name incl. nul */
  145.  
  146. /*
  147.  * Flags used as 7th argument to getnameinfo()
  148.  */
  149. #define NI_NOFQDN    0x0001        /* Return only hostname */
  150. #define NI_NUMERICHOST    0x0002        /* Return numeric host address */
  151. #define NI_NUMERICSERV    0x0004        /* Return numeric service port no. */
  152. #define NI_DGRAM    0x0008        /* Assume udp instead of tcp */
  153. #define NI_NAMEREQD    0x0010        /* Fail if no textual hostname */
  154.  
  155. #endif /* !(defined(_XOPEN_SOURCE) && _XOPEN_SOURCE_EXTENDED - 0 >= 1) */
  156.  
  157. #ifdef _REENTRANT
  158.  
  159. #define h_errno        (*_h_errno())
  160.  
  161. #else /* ! _REENTRANT */
  162.  
  163. extern int    h_errno;    
  164.  
  165. #endif /* _REENTRANT */
  166.  
  167. #if !(defined(_XOPEN_SOURCE) && _XOPEN_SOURCE_EXTENDED - 0 >= 1)
  168. #define    MAXHOSTNAMELEN 256
  169. #endif /* !(defined(_XOPEN_SOURCE) && _XOPEN_SOURCE_EXTENDED - 0 >= 1) */
  170.  
  171. /*
  172.  * Error return codes from gethostbyname() and gethostbyaddr()
  173.  * (when using the resolver)
  174.  */
  175.  
  176. #if !(defined(_XOPEN_SOURCE) && _XOPEN_SOURCE_EXTENDED - 0 >= 1)
  177. #define    NETDB_INTERNAL    -1    /* see errno */
  178. #define    NETDB_SUCCESS    0    /* no problem */
  179. #endif /* !(defined(_XOPEN_SOURCE) && _XOPEN_SOURCE_EXTENDED - 0 >= 1) */
  180. #define    HOST_NOT_FOUND    1 /* Authoritative Answer Host not found */
  181. #define    TRY_AGAIN    2 /* Non-Authoritive Host not found, or SERVERFAIL */
  182. #define    NO_RECOVERY    3 /* Non recoverable errors, FORMERR, REFUSED, NOTIMP */
  183. #define    NO_DATA        4 /* Valid name, no data record of requested type */
  184. #define    NO_ADDRESS    NO_DATA        /* no address, look for MX record */
  185. #define NO_ERRORMEM    99 /* No memory could be allocated for error variable.*/
  186.  
  187. void        endhostent __P((void));
  188. void        endnetent __P((void));
  189. void        endprotoent __P((void));
  190. void        endservent __P((void));
  191. struct hostent    *gethostbyaddr __P((const void *, size_t, int));
  192. struct hostent    *gethostbyname __P((const char *));
  193. #if !(defined(_XOPEN_SOURCE) && _XOPEN_SOURCE_EXTENDED - 0 >= 1)
  194. struct hostent    *gethostbyname2 __P((const char *, int));
  195. #endif /* !(defined(_XOPEN_SOURCE) && _XOPEN_SOURCE_EXTENDED - 0 >= 1) */
  196. struct hostent    *gethostent __P((void));
  197. struct netent    *getnetbyaddr __P((in_addr_t, int));
  198. struct netent    *getnetbyname __P((const char *));
  199. struct netent    *getnetent __P((void));
  200. struct protoent    *getprotobyname __P((const char *));
  201. struct protoent    *getprotobynumber __P((int));
  202. struct protoent    *getprotoent __P((void));
  203. struct servent    *getservbyname __P((const char *, const char *));
  204. struct servent    *getservbyport __P((int, const char *));
  205. struct servent    *getservent __P((void));
  206. #if !(defined(_XOPEN_SOURCE) && _XOPEN_SOURCE_EXTENDED - 0 >= 1)
  207. const char    *hstrerror __P((int));
  208. #endif /* !(defined(_XOPEN_SOURCE) && _XOPEN_SOURCE_EXTENDED - 0 >= 1) */
  209. void        sethostent __P((int));
  210. void        setnetent __P((int));
  211. void        setprotoent __P((int));
  212. void        setservent __P((int));
  213.  
  214. #if !(defined(_XOPEN_SOURCE) && _XOPEN_SOURCE_EXTENDED -0 >= 1)
  215. extern int         rcmd __P((char **, unsigned short, char *, char *, char *,
  216.               int *));
  217. extern int         rexec __P((char **, int, char *, char *, char *, int *));
  218. extern int         rresvport __P((int *));
  219. extern int         ruserok __P((char *, int, char *, char *));
  220. extern int         set_h_errno __P((int));
  221. extern int         get_h_errno __P((void));
  222. extern const int    *_h_errno __P((void));
  223. extern int         ifignore __P((const char *, const char *));
  224. extern int         getnetgrent __P((char **, char **, char **));
  225. extern int         setnetgrent __P((char *));
  226. extern int         endnetgrent __P((void));
  227. extern int         innetgr __P((char *, char *, char *, char *));
  228.  
  229. extern void    freeaddrinfo __P((struct addrinfo *));
  230. extern char    *gai_strerror __P((int));
  231.  
  232.  
  233.  
  234. extern int _xgetaddrinfo __P((int, const char *, const char *, const struct addrinfo *, struct addrinfo **));
  235. extern int _xgetnameinfo __P((int, const struct sockaddr *, size_t, char *, size_t, char *, size_t, int));
  236.  
  237. #ifdef _EFTSAFE
  238.  
  239. #define getaddrinfo(__a1, __a2, __a3, __a4) _xgetaddrinfo(__NETLIB_VERSION__, __a1, __a2, __a3, __a4)
  240. #define getnameinfo(__a1, __a2, __a3, __a4, __a5, __a6, __a7) _xgetnameinfo(__NETLIB_VERSION__, __a1, __a2, __a3, __a4, __a5, __a6, __a7)
  241.  
  242. #else /* !_EFTSAFE */
  243.  
  244. #pragma weak _xgetaddrinfo
  245. #pragma weak _xgetnameinfo
  246.  
  247. static int getaddrinfo(const char *__a1, const char *__a2, const struct addrinfo *__a3, struct addrinfo **__a4)
  248. {
  249.     return _xgetaddrinfo(__NETLIB_VERSION__, __a1, __a2, __a3, __a4);
  250. }
  251.  
  252. static int getnameinfo(const struct sockaddr *__a1, size_t __a2, char *__a3, size_t __a4, char *__a5, size_t __a6, int __a7)
  253. {
  254.     return _xgetnameinfo(__NETLIB_VERSION__, __a1, __a2, __a3, __a4, __a5, __a6, __a7);
  255. }
  256.  
  257. #endif /* !_EFTSAFE */
  258.  
  259.  
  260. /*
  261.  * Do not use the following functions, they are internal non-standard
  262.  * functions, they may change or be removed at any time.
  263.  */
  264. extern struct hostent *
  265.         __parse_hostent(char *, struct hostent *, int, int, int);
  266. extern struct servent *
  267.         __parse_servent(char *, struct servent *, int);
  268.  
  269. #endif /* !(defined(_XOPEN_SOURCE) && _XOPEN_SOURCE_EXTENDED -0 >= 1)*/
  270.  
  271. __END_DECLS
  272.  
  273. #endif /*!_NETDB_H*/
  274.