home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 29 Fixes_o / 29-Fixes_o.zip / prgcsd.exe / NETDB.H < prev    next >
Text File  |  1993-02-24  |  5KB  |  112 lines

  1. /********************************************************copyrite.xmc***/
  2. /*                                                                     */
  3. /*   Licensed Materials - Property of IBM                              */
  4. /*                                                                     */
  5. /*   This module is "Restricted Materials of IBM":                     */
  6. /*      Program Number:   5798RXW                                      */
  7. /*      Program Name:     IBM TCP/IP Version 1.2 for OS/2              */
  8. /*   (C) Copyright IBM Corporation. 1990, 1991.                        */
  9. /*                                                                     */
  10. /*   See IBM Copyright Instructions.                                   */
  11. /*                                                                     */
  12. /********************************************************copyrite.xmc***/
  13. /*
  14.  * Copyright (c) 1980,1983,1988 Regents of the University of California.
  15.  * All rights reserved.
  16.  *
  17.  * Redistribution and use in source and binary forms are permitted
  18.  * provided that this notice is preserved and that due credit is given
  19.  * to the University of California at Berkeley. The name of the University
  20.  * may not be used to endorse or promote products derived from this
  21.  * software without specific prior written permission. This software
  22.  * is provided ``as is'' without express or implied warranty.
  23.  *
  24.  *      @(#)netdb.h     5.9 (Berkeley) 4/5/88
  25.  */
  26.  
  27. /*
  28.  * Structures returned by network
  29.  * data base library.  All addresses
  30.  * are supplied in host order, and
  31.  * returned in network order (suitable
  32.  * for use in system calls).
  33.  */
  34. #ifndef INCL_NETDB
  35. #define INCL_NETDB
  36. #ifndef __32BIT__
  37. #define _Packed
  38. #define _Seg16
  39. #define _Far16
  40. #define _Cdecl
  41. #endif
  42.  
  43. struct  hostent {
  44.         char    * _Seg16 h_name;        /* official name of host */
  45.         char    * _Seg16 * _Seg16 h_aliases;    /* alias list */
  46.         short   h_addrtype;     /* host address type */
  47.         short   h_length;       /* length of address */
  48.         char    * _Seg16 * _Seg16 h_addr_list;  /* list of addresses from name server */
  49. #define h_addr  h_addr_list[0]  /* address, for backward compatiblity */
  50. };
  51.  
  52. /*
  53.  * Assumption here is that a network number
  54.  * fits in 32 bits -- probably a poor one.
  55.  */
  56. typedef _Packed struct  netent {
  57.         char            * _Seg16 n_name;        /* official name of net */
  58.         char            * _Seg16 * _Seg16 n_aliases;    /* alias list */
  59.         short           n_addrtype;     /* net address type */
  60.         unsigned long   n_net;          /* network # */
  61. } NETENT;
  62.  
  63. typedef _Packed struct  servent {
  64.         char    * _Seg16 s_name;        /* official service name */
  65.         char    * _Seg16 * _Seg16 s_aliases;    /* alias list */
  66.         short   s_port;         /* port # */
  67.         char    * _Seg16 s_proto;       /* protocol to use */
  68. } SERVENT;
  69.  
  70. typedef _Packed struct  protoent {
  71.         char    * _Seg16 p_name;        /* official protocol name */
  72.         char    * _Seg16 * _Seg16 p_aliases;    /* alias list */
  73.         short   p_proto;        /* protocol # */
  74. } PROTOENT;
  75.  
  76. struct hostent * _Seg16 _Far16 _Cdecl gethostbyname( char * _Seg16 );
  77. struct hostent * _Seg16 _Far16 _Cdecl gethostbyaddr( char * _Seg16, short, short);
  78. struct hostent * _Seg16 _Far16 _Cdecl gethostent( void );
  79. void _Far16 _Cdecl endhostent(void);
  80. NETENT * _Seg16 _Far16 _Cdecl getnetbyname( char * _Seg16);
  81. NETENT * _Seg16 _Far16 _Cdecl getnetbyaddr( unsigned long, short );
  82. NETENT * _Seg16 _Far16 _Cdecl getnetent( void );
  83. void _Far16 _Cdecl endnetent(void);
  84. SERVENT * _Seg16 _Far16 _Cdecl getservbyname( char *, char * );
  85. SERVENT * _Seg16 _Far16 _Cdecl getservbyport( short, char * );
  86. SERVENT * _Seg16 _Far16 _Cdecl getservent( void );
  87. void _Far16 _Cdecl endservent(void);
  88. PROTOENT * _Seg16 _Far16 _Cdecl getprotobyname( char * );
  89. PROTOENT * _Seg16 _Far16 _Cdecl getprotoent( void );
  90. void _Far16 _Cdecl endprotoent(void);
  91. short _Far16 _Cdecl sethostent( short);
  92. short _Far16 _Cdecl setnetent( short );
  93. short _Far16 _Cdecl setprotoent( short );
  94. short _Far16 _Cdecl setservent( short );
  95.  
  96. /*
  97.  * Error return codes from gethostbyname() and gethostbyaddr()
  98.  * (left in extern int h_errno).
  99.  */
  100.  
  101. #ifdef __32BIT__
  102. #define h_errno _h_errno
  103. #endif
  104. extern short h_errno;
  105.  
  106. #define HOST_NOT_FOUND  1 /* Authoritative Answer Host not found */
  107. #define TRY_AGAIN       2 /* Non-Authoritive Host not found, or SERVERFAIL */
  108. #define NO_RECOVERY     3 /* Non recoverable errors, FORMERR, REFUSED, NOTIMP */
  109. #define NO_DATA         4 /* Valid name, no data record of requested type */
  110. #define NO_ADDRESS      NO_DATA         /* no address, look for MX record */
  111. #endif
  112.