home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / oclsrc15.zip / OCL / Include / OIP.hpp < prev    next >
C/C++ Source or Header  |  1996-08-12  |  23KB  |  617 lines

  1. // OCL - OS/2 Class Library
  2. // (c) Cubus 1996
  3. // (c) 1982, 1985, 1986 Regents of the University of California.
  4. // (c) Raoul Gema 1996
  5. // All Rights Reserved
  6. // OIP.hpp
  7.  
  8. /*
  9.  * Redistribution and use in source and binary forms, with or without
  10.  * modification, are permitted provided that the following conditions
  11.  * are met:
  12.  * 1. Redistributions of source code must retain the above copyright
  13.  *    notice, this list of conditions and the following disclaimer.
  14.  * 2. Neither the name Cubus nor the name Team OCL may be used to
  15.  *    endorse or promote products derived from this software
  16.  *    without specific prior written permission.
  17.  * 3. See OCL.INF for a detailed copyright notice.
  18.  *
  19.  *              THIS SOFTWARE IS PROVIDED ``AS IS'' AND
  20.  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  21.  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  22.  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  23.  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  24.  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  25.  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  26.  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  27.  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  28.  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  29.  * SUCH DAMAGE.
  30. */  
  31.  
  32.  
  33. // $Header: W:/Projects/OCL/Include/rcs/OIP.hpp 1.50 1996/08/11 23:47:15 B.STEIN Release $
  34.  
  35.  
  36. #ifndef OIP_INCLUDED
  37.    #define OIP_INCLUDED
  38.  
  39.  
  40. #ifndef OMESSAGE_INCLUDED
  41.   #include <OMessage.hpp>
  42. #endif
  43.  
  44.  
  45.  
  46. #define INET
  47.  
  48. typedef int*  PINT;
  49. typedef int   DTYP1;
  50.  
  51. #ifndef __off_t
  52.   #define __off_t
  53.   typedef long off_t;
  54. #endif
  55.  
  56. typedef char *caddr_t;
  57. typedef long daddr_t;
  58.  
  59. #define NIL   ((char*) 0)
  60. #define PZERO 0
  61.  
  62. #define MAXHOSTNAMELEN 120
  63. #ifndef MAXPATHLEN
  64.    #define MAXPATHLEN CCHMAXPATH
  65. #endif
  66. #define MAXSOCKETS 2048
  67.  
  68.  
  69. #define SOCBASEERR              10000
  70.  
  71. // OS/2 SOCKET API definitions of regular Microsoft C 6.0 error constants
  72.  
  73. #define SOCEPERM                (SOCBASEERR+1)             // Not owner  
  74. #define SOCESRCH                (SOCBASEERR+3)             // No such process  
  75. #define SOCEINTR                (SOCBASEERR+4)             // Interrupted system call  
  76. #define SOCENXIO                (SOCBASEERR+6)             // No such device or address  
  77. #define SOCEBADF                (SOCBASEERR+9)             // Bad file number  
  78. #define SOCEACCES               (SOCBASEERR+13)            // Permission denied  
  79. #define SOCEFAULT               (SOCBASEERR+14)            // Bad address  
  80. #define SOCEINVAL               (SOCBASEERR+22)            // Invalid argument  
  81. #define SOCEMFILE               (SOCBASEERR+24)            // Too many open files  
  82. #define SOCEPIPE                (SOCBASEERR+32)            // Broken pipe  
  83.  
  84. #define SOCEOS2ERR              (SOCBASEERR+100)           // OS/2 Error  
  85.  
  86. // OS/2 SOCKET API definitions of regular BSD error constants
  87.  
  88. #define SOCEWOULDBLOCK          (SOCBASEERR+35)            // Operation would block  
  89. #define SOCEINPROGRESS          (SOCBASEERR+36)            // Operation now in progress  
  90. #define SOCEALREADY             (SOCBASEERR+37)            // Operation already in progress  
  91. #define SOCENOTSOCK             (SOCBASEERR+38)            // Socket operation on non-socket  
  92. #define SOCEDESTADDRREQ         (SOCBASEERR+39)            // Destination address required  
  93. #define SOCEMSGSIZE             (SOCBASEERR+40)            // Message too long  
  94. #define SOCEPROTOTYPE           (SOCBASEERR+41)            // Protocol wrong type for socket  
  95. #define SOCENOPROTOOPT          (SOCBASEERR+42)            // Protocol not available  
  96. #define SOCEPROTONOSUPPORT      (SOCBASEERR+43)            // Protocol not supported  
  97. #define SOCESOCKTNOSUPPORT      (SOCBASEERR+44)            // Socket type not supported  
  98. #define SOCEOPNOTSUPP           (SOCBASEERR+45)            // Operation not supported on socket  
  99. #define SOCEPFNOSUPPORT         (SOCBASEERR+46)            // Protocol family not supported  
  100. #define SOCEAFNOSUPPORT         (SOCBASEERR+47)            // Address family not supported by protocol family  
  101. #define SOCEADDRINUSE           (SOCBASEERR+48)            // Address already in use  
  102. #define SOCEADDRNOTAVAIL        (SOCBASEERR+49)            // Can't assign requested address  
  103. #define SOCENETDOWN             (SOCBASEERR+50)            // Network is down  
  104. #define SOCENETUNREACH          (SOCBASEERR+51)            // Network is unreachable  
  105. #define SOCENETRESET            (SOCBASEERR+52)            // Network dropped connection on reset  
  106. #define SOCECONNABORTED         (SOCBASEERR+53)            // Software caused connection abort  
  107. #define SOCECONNRESET           (SOCBASEERR+54)            // Connection reset by peer  
  108. #define SOCENOBUFS              (SOCBASEERR+55)            // No buffer space available  
  109. #define SOCEISCONN              (SOCBASEERR+56)            // Socket is already connected  
  110. #define SOCENOTCONN             (SOCBASEERR+57)            // Socket is not connected  
  111. #define SOCESHUTDOWN            (SOCBASEERR+58)            // Can't send after socket shutdown  
  112. #define SOCETOOMANYREFS         (SOCBASEERR+59)            // Too many references: can't splice  
  113. #define SOCETIMEDOUT            (SOCBASEERR+60)            // Connection timed out  
  114. #define SOCECONNREFUSED         (SOCBASEERR+61)            // Connection refused  
  115. #define SOCELOOP                (SOCBASEERR+62)            // Too many levels of symbolic links  
  116. #define SOCENAMETOOLONG         (SOCBASEERR+63)            // File name too long  
  117. #define SOCEHOSTDOWN            (SOCBASEERR+64)            // Host is down  
  118. #define SOCEHOSTUNREACH         (SOCBASEERR+65)            // No route to host  
  119. #define SOCENOTEMPTY            (SOCBASEERR+66)            // Directory not empty  
  120.  
  121. // OS/2 SOCKET API errors redefined as regular BSD error constants
  122.  
  123. #define EWOULDBLOCK             SOCEWOULDBLOCK
  124. #define EINPROGRESS             SOCEINPROGRESS
  125. #define EALREADY                SOCEALREADY
  126. #define ENOTSOCK                SOCENOTSOCK
  127. #define EDESTADDRREQ            SOCEDESTADDRREQ
  128. #define EMSGSIZE                SOCEMSGSIZE
  129. #define EPROTOTYPE              SOCEPROTOTYPE
  130. #define ENOPROTOOPT             SOCENOPROTOOPT
  131. #define EPROTONOSUPPORT         SOCEPROTONOSUPPORT
  132. #define ESOCKTNOSUPPORT         SOCESOCKTNOSUPPORT
  133. #define EOPNOTSUPP              SOCEOPNOTSUPP
  134. #define EPFNOSUPPORT            SOCEPFNOSUPPORT
  135. #define EAFNOSUPPORT            SOCEAFNOSUPPORT
  136. #define EADDRINUSE              SOCEADDRINUSE
  137. #define EADDRNOTAVAIL           SOCEADDRNOTAVAIL
  138. #define ENETDOWN                SOCENETDOWN
  139. #define ENETUNREACH             SOCENETUNREACH
  140. #define ENETRESET               SOCENETRESET
  141. #define ECONNABORTED            SOCECONNABORTED
  142. #define ECONNRESET              SOCECONNRESET
  143. #define ENOBUFS                 SOCENOBUFS
  144. #define EISCONN                 SOCEISCONN
  145. #define ENOTCONN                SOCENOTCONN
  146. #define ESHUTDOWN               SOCESHUTDOWN
  147. #define ETOOMANYREFS            SOCETOOMANYREFS
  148. #define ETIMEDOUT               SOCETIMEDOUT
  149. #define ECONNREFUSED            SOCECONNREFUSED
  150. #define ELOOP                   SOCELOOP
  151. #define ENAMETOOLONG            SOCENAMETOOLONG
  152. #define EHOSTDOWN               SOCEHOSTDOWN
  153. #define EHOSTUNREACH            SOCEHOSTUNREACH
  154. #define ENOTEMPTY               SOCENOTEMPTY
  155.  
  156. // Address families.
  157.  
  158. #define AF_UNSPEC       0     // unspecified
  159. #define AF_UNIX         1     // local to host (pipes, portals)
  160. #define AF_INET         2     // internetwork: UDP, TCP, etc.
  161. #define AF_IMPLINK      3     // arpanet imp addresses
  162. #define AF_PUP          4     // pup protocols: e.g. BSP
  163. #define AF_CHAOS        5     // mit CHAOS protocols
  164. #define AF_NS           6     // XEROX NS protocols
  165. #define AF_NBS          7     // nbs protocols
  166. #define AF_ECMA         8     // european computer manufacturers
  167. #define AF_DATAKIT      9     // datakit protocols
  168. #define AF_CCITT        10    // CCITT protocols, X.25 etc
  169. #define AF_SNA          11    // IBM SNA
  170. #define AF_DECnet       12    // DECnet
  171. #define AF_DLI          13    // Direct data link interface
  172. #define AF_LAT          14    // LAT
  173. #define AF_HYLINK       15    // NSC Hyperchannel
  174. #define AF_APPLETALK    16    // Apple Talk
  175. #define AF_NETBIO       17    // NetBIOS-style addresses
  176. #define AF_VOICEVIEW    18    // VoiceView
  177. #define AF_MAX          19
  178.  
  179. #define INVALID_SOCKET    (int)(~0)
  180. #define SOCKET_ERROR        (-1)
  181.  
  182. // Definitions related to sockets: types, address families, options.
  183.  
  184. // Types
  185.  
  186. #define SOCK_STREAM     1       // stream socket
  187. #define SOCK_DGRAM      2       // datagram socket
  188. #define SOCK_RAW        3       // raw-protocol interface 
  189. #define SOCK_RDM        4       // reliably-delivered message 
  190. #define SOCK_SEQPACKET  5       // sequenced packet stream
  191.  
  192. // Option flags per-socket.
  193.  
  194. #define SO_DEBUG        0x0001          // turn on debugging info recording
  195. #define SO_ACCEPTCONN   0x0002          // socket has had listen() 
  196. #define SO_REUSEADDR    0x0004          // allow local address reuse 
  197. #define SO_KEEPALIVE    0x0008          // keep connections alive 
  198. #define SO_DONTROUTE    0x0010          // just use interface addresses 
  199. #define SO_BROADCAST    0x0020          // permit sending of broadcast msgs 
  200. #define SO_USELOOPBACK  0x0040          // bypass hardware when possible 
  201. #define SO_LINGER       0x0080          // linger on close if data present 
  202. #define SO_OOBINLINE    0x0100          // leave received OOB data in line
  203.  
  204. // Additional options, not kept in so_options.
  205.  
  206. #define SO_SNDBUF       0x1001          // send buffer size  
  207. #define SO_RCVBUF       0x1002          // receive buffer size  
  208. #define SO_SNDLOWAT     0x1003          // send low-water mark  
  209. #define SO_RCVLOWAT     0x1004          // receive low-water mark  
  210. #define SO_SNDTIMEO     0x1005          // send timeout  
  211. #define SO_RCVTIMEO     0x1006          // receive timeout  
  212. #define SO_ERROR        0x1007          // get error status and clear  
  213. #define SO_TYPE         0x1008          // get socket type  
  214.  
  215. // Structure used for manipulating linger option.
  216.  
  217. struct linger
  218. {
  219.  DTYP1  l_onoff;    // option on/off
  220.  DTYP1  l_linger;   // linger time
  221. };
  222.  
  223. // Level number for (get/set)sockopt() to apply to socket itself.
  224.  
  225. #define SOL_SOCKET  0xffff       // options for socket level
  226.  
  227. // Structure used by kernel to store most
  228. // addresses.
  229.  
  230. struct sockaddr
  231. {
  232.  USHORT  sa_family;              // address family
  233.  CHAR    sa_data[14];            // up to 14 bytes of direct address
  234. };
  235. typedef sockaddr* psockaddr;
  236.  
  237. // Structure used by kernel to pass protocol
  238. // information in raw sockets.
  239.  
  240. struct sockproto
  241. {
  242.  USHORT  sp_family;              // address family
  243.  USHORT  sp_protocol;            // protocol
  244. };
  245.  
  246. // Protocol families, same as address families for now.
  247.  
  248. #define PF_UNSPEC       AF_UNSPEC
  249. #define PF_UNIX         AF_UNIX
  250. #define PF_INET         AF_INET
  251. #define PF_IMPLINK      AF_IMPLINK
  252. #define PF_PUP          AF_PUP
  253. #define PF_CHAOS        AF_CHAOS
  254. #define PF_NS           AF_NS
  255. #define PF_NBS          AF_NBS
  256. #define PF_ECMA         AF_ECMA
  257. #define PF_DATAKIT      AF_DATAKIT
  258. #define PF_CCITT        AF_CCITT
  259. #define PF_SNA          AF_SNA
  260. #define PF_DECnet       AF_DECnet
  261. #define PF_DLI          AF_DLI
  262. #define PF_LAT          AF_LAT
  263. #define PF_HYLINK       AF_HYLINK
  264. #define PF_APPLETALK    AF_APPLETALK
  265. #define PF_MAX          AF_MAX
  266.  
  267. // Maximum queue length specifiable by listen.
  268.  
  269. #define SOMAXCONN       5
  270.  
  271. struct iovec
  272. {
  273.  PSZ   iov_base;
  274.  int     iov_len;
  275. };
  276. typedef iovec* piovec;
  277.  
  278. struct uio
  279. {
  280.  piovec   uio_iov;
  281.  int      uio_iovcnt;
  282.  off_t    uio_offset;
  283.  int      uio_segflg;
  284.  int      uio_resid;
  285. };
  286. typedef uio*   pio;
  287.  
  288. // Message header for recvmsg and sendmsg calls.
  289.  
  290. struct msghdr
  291. {
  292.  PSZ      msg_name;               // optional address
  293.  int      msg_namelen;            // size of address 
  294.  piovec   msg_iov;                // scatter/gather array 
  295.  int      msg_iovlen;             // # elements in msg_iov
  296.  PSZ      msg_accrights;          // access rights sent/received
  297.  int      msg_accrightslen;
  298. };
  299. typedef msghdr*   pmsghdr;
  300.  
  301. enum uio_rw
  302. {
  303.  UIO_READ,
  304.  UIO_WRITE
  305. };
  306.  
  307. #define FREAD  1
  308. #define FWRITE 2
  309.  
  310. #define MSG_OOB         0x1        // process out-of-band data
  311. #define MSG_PEEK        0x2        // peek at incoming message
  312. #define MSG_DONTROUTE   0x4        // send without using routing tables
  313. #define MSG_MAXIOVLEN   16
  314.  
  315. // Definition for bswap
  316.  
  317. #define htonl(x)     (lswap(x))
  318. #define ntohl(x)     (lswap(x))
  319. #define htons(x)     (bswap(x))
  320. #define ntohs(x)     (bswap(x))
  321. #define bzero(x,y)   memset((x),'\0',(y))
  322. #define bcopy(x,y,z) memcpy((y),(x),(z))
  323. #define bcmp(x,y,z)  memcmp((y),(x),(z))
  324.  
  325. //
  326.  
  327. #define IPPROTO_IP              0               // dummy for IP
  328. #define IPPROTO_ICMP            1               // control message protocol 
  329. #define IPPROTO_GGP             3               // gateway^2 (deprecated) 
  330. #define IPPROTO_TCP             6               // tcp 
  331. #define IPPROTO_EGP             8               // exterior gateway protocol 
  332. #define IPPROTO_PUP             12              // pup 
  333. #define IPPROTO_UDP             17              // user datagram protocol
  334. #define IPPROTO_IDP             22              // xns idp
  335. #define IPPROTO_RAW             255             // raw IP packet
  336. #define IPPROTO_MAX             256
  337.  
  338.  
  339. // Ports < IPPORT_RESERVED are reserved for
  340. // privileged processes (e.g. root).
  341. // Ports > IPPORT_USERRESERVED are reserved
  342. // for servers, not necessarily privileged.
  343.  
  344. #define IPPORT_RESERVED         1024
  345. #define IPPORT_USERRESERVED     5000
  346.  
  347. // Link numbers
  348.  
  349. #define IMPLINK_IP              155
  350. #define IMPLINK_LOWEXPER        156
  351. #define IMPLINK_HIGHEXPER       158
  352.  
  353.  
  354. typedef struct
  355. {
  356.  union
  357.   {
  358.    struct { UCHAR s_b1, s_b2, s_b3, s_b4; } S_un_b;
  359.    struct { USHORT s_w1, s_w2; } Sun_w;
  360.    ULONG s_addr;
  361.   } S_un;
  362. } in_addr, *pin_addr;
  363.  
  364.  
  365. // Definitions of bits in internet address integers.
  366. // On subnets, the decomposition of addresses to host and net parts
  367. // is done according to subnet mask, not the masks here.
  368.  
  369. #define IN_CLASSA(i)            (((long)(i) & 0x80000000L) == 0)
  370. #define IN_CLASSA_NET           0xff000000L
  371. #define IN_CLASSA_NSHIFT        24
  372. #define IN_CLASSA_HOST          0x00ffffffL
  373. #define IN_CLASSA_MAX           128
  374.  
  375. #define IN_CLASSB(i)            (((long)(i) & 0xc0000000L) == 0x80000000L)
  376. #define IN_CLASSB_NET           0xffff0000L
  377. #define IN_CLASSB_NSHIFT        16
  378. #define IN_CLASSB_HOST          0x0000ffffL
  379. #define IN_CLASSB_MAX           65536L
  380.  
  381. #define IN_CLASSC(i)            (((long)(i) & 0xe0000000L) == 0xc0000000L)
  382. #define IN_CLASSC_NET           0xffffff00L
  383. #define IN_CLASSC_NSHIFT        8
  384. #define IN_CLASSC_HOST          0x000000ffL
  385.  
  386. #define IN_CLASSD(i)            (((long)(i) & 0xf0000000L) == 0xe0000000L)
  387. #define IN_MULTICAST(i)         IN_CLASSD(i)
  388.  
  389. #define IN_EXPERIMENTAL(i)      (((long)(i) & 0xe0000000L) == 0xe0000000L)
  390. #define IN_BADCLASS(i)          (((long)(i) & 0xf0000000L) == 0xf0000000L)
  391.  
  392. #define INADDR_ANY              (ULONG)0x00000000L
  393. #define INADDR_BROADCAST        (ULONG)0xffffffffL     // must be masked
  394. #ifndef KERNEL
  395. #define INADDR_NONE             0xffffffffL             // -1 return
  396. #endif
  397.  
  398. #define IN_LOOPBACKNET          127                     // official!
  399.  
  400.  
  401. struct sockaddr_in
  402. {
  403.  short    sin_family;
  404.  USHORT   sin_port;
  405.  in_addr  sin_addr;
  406.  char     sin_zero[8];
  407. };
  408. typedef sockaddr_in* psockaddr_in;
  409.  
  410. #define SOCADDR_BINDSIZE 16
  411.  
  412. // Options for use with [gs]etsockopt at the IP level.
  413.  
  414. #define IP_OPTIONS      1  // set/get IP per-packet options
  415.  
  416.  
  417. struct servent;
  418. typedef servent*  pservent;
  419.  
  420. #define _MAXALIASES     35
  421. #define _MAXADDRS       35
  422. #define _MAXLINELEN     1024
  423. #define _HOSTBUFSIZE    (BUFSIZ + 1)
  424.  
  425. // Structures returned by network
  426. // data base library.  All addresses
  427. // are supplied in host order, and
  428. // returned in network order (suitable
  429. // for use in system calls).
  430.  
  431. typedef struct
  432. {
  433.  PSZ                h_name;       // official name of host 
  434.  PSZ*               h_aliases;    // alias list 
  435.  DTYP1              h_addrtype;   // host address type 
  436.  DTYP1              h_length;     // length of address 
  437.  PSZ*               h_addr_list;  // list of addresses from name server
  438. } hostent, *phostent;
  439.  
  440.  
  441. // Assumption here is that a network number
  442. // fits in 32 bits -- probably a poor one.
  443.  
  444. struct netent
  445. {
  446.  PSZ    n_name;       // official name of net
  447.  PSZ*   n_aliases;    // alias list 
  448.  DTYP1  n_addrtype;   // net address type
  449.  ULONG  n_net;        // network #
  450. };
  451. typedef netent*  pnetent;
  452.  
  453. struct servent
  454. {
  455.  PSZ    s_name;       // official service name 
  456.  PSZ*   s_aliases;    // alias list 
  457.  DTYP1  s_port;       // port # 
  458.  PSZ    s_proto;      // protocol to use
  459. };
  460. typedef servent*  pservent;
  461.  
  462. struct protoent
  463. {
  464.  PSZ    p_name;       // official protocol name
  465.  PSZ*   p_aliases;    // alias list
  466.  DTYP1  p_proto;      // protocol #
  467. };
  468. typedef protoent*  pprotoent;
  469.  
  470. // After a successful call to gethostbyname_r()/gethostbyaddr_r(), the
  471. // structure hostent_data will contain the data to which pointers in
  472. // the hostent structure will point to.
  473.  
  474. struct hostent_data
  475. {
  476.  in_addr     host_addr;                     // host address pointer
  477.  PSZ         h_addr_ptrs[_MAXADDRS + 1];    // host address
  478.  char        hostaddr[_MAXADDRS];
  479.  char        hostbuf[_HOSTBUFSIZE + 1];     // host data
  480.  PSZ         host_aliases[_MAXALIASES];
  481.  PSZ         host_addrs[2];
  482.  FILE*       hostf;
  483.  int         stayopen;                      // AIX addon
  484.  ULONG       host_addresses[_MAXADDRS];     // As per defect 48367.
  485. };                                          // Actual Addresses.
  486. typedef hostent_data*   phostent_data;
  487.  
  488. struct servent_data     // should be considered opaque
  489. {
  490.  FILE*       serv_fp;
  491.  char        line[_MAXLINELEN];
  492.  PSZ         serv_aliases[_MAXALIASES];
  493.  int         _serv_stayopen;
  494. };
  495. typedef servent_data*   pservent_data;
  496.  
  497.  
  498. // Error return codes from gethostbyname() and gethostbyaddr()
  499. // (left in extern int h_errno).
  500.  
  501. extern int h_errno;
  502.  
  503. #define HOST_NOT_FOUND  1          // Authoritative Answer Host not found 
  504. #define TRY_AGAIN       2          // Non-Authoritive Host not found, or SERVERFAIL 
  505. #define NO_RECOVERY     3          // Non recoverable errors, FORMERR, REFUSED, NOTIMP 
  506. #define NO_DATA         4          // Valid name, no data record of requested type 
  507. #define NO_ADDRESS      NO_DATA    // no address, look for MX record 
  508.  
  509.  
  510. // API from TCP32DLL.DLL and SO32DLL.DLL
  511.  
  512. #ifdef __cplusplus
  513.   extern "C" {
  514. #endif
  515.  
  516. ULONG     APIENTRY   inet_addr(const PSZ);
  517. int       APIENTRY   accept(int, psockaddr, PINT);
  518. int       APIENTRY   bind(int, psockaddr, int);
  519. int       APIENTRY   connect(int, psockaddr, int);
  520. int       APIENTRY   getpeername(int, psockaddr, PINT);
  521. int       APIENTRY   getsockname(int, psockaddr, PINT);
  522. int       APIENTRY   getsockopt(int, int, int, PSZ, PINT);
  523. int       APIENTRY   listen(int, int);
  524. int       APIENTRY   recv(int, PSZ, int, int);
  525. int       APIENTRY   recvfrom(int, PSZ, int, int, psockaddr, PINT);
  526. int       APIENTRY   send(int, PSZ, int, int);
  527. int       APIENTRY   sendto(int, PSZ, int, int, psockaddr, int);
  528. int       APIENTRY   shutdown(int, int);
  529. int       APIENTRY   socket(int, int, int);
  530. #ifndef BSD_SELECT
  531.   int     APIENTRY   select(PINT, int, int, int, long);
  532. #endif
  533. int       APIENTRY   gethostid();
  534. int       APIENTRY   recvmsg(int, pmsghdr, int);
  535. int       APIENTRY   sendmsg(int, pmsghdr, int);
  536. int       APIENTRY   setsockopt(int, int, int, PSZ, int);
  537. int       APIENTRY   sock_init();
  538. int       APIENTRY   sock_errno();
  539. int       APIENTRY   psock_errno(PSZ);
  540. int       APIENTRY   soclose(int);
  541. int       APIENTRY   soabort(int);
  542. int       APIENTRY   so_cancel(int);
  543. int       APIENTRY   readv(int, piovec, int);
  544. int       APIENTRY   writev(int, piovec, int);
  545. int       APIENTRY   getinetversion(PSZ);
  546. ULONG     APIENTRY   lswap(ULONG);
  547. USHORT    APIENTRY   bswap(USHORT);
  548. in_addr   APIENTRY   inet_makeaddr(ULONG, ULONG);
  549. ULONG     APIENTRY   inet_network(PSZ);
  550. PSZ       APIENTRY   inet_ntoa(in_addr);
  551. ULONG     APIENTRY   inet_lnaof(in_addr);
  552. ULONG     APIENTRY   inet_netof(in_addr);
  553. int       APIENTRY   gethostbyname_r(PSZ, phostent, phostent_data);
  554. int       APIENTRY   gethostbyaddr_r(PSZ, int, int, phostent, phostent_data);
  555. int       APIENTRY   getservbyname_r(PSZ, PSZ, pservent, pservent_data);
  556. int       APIENTRY   gethostname(PSZ, int );
  557. phostent  APIENTRY   gethostbyname(PSZ);
  558. phostent  APIENTRY   _gethtbyname(PSZ);
  559. phostent  APIENTRY   gethostbyaddr(PSZ, int, int);
  560. phostent  APIENTRY   _gethtbyaddr(PSZ, int, int);
  561. pnetent   APIENTRY   getnetbyname(PSZ);
  562. pnetent   APIENTRY   getnetbyaddr(ULONG, int);
  563. pservent  APIENTRY   getservbyname( PSZ, PSZ);
  564. pservent  APIENTRY   getservbyport( int, PSZ);
  565. pservent  APIENTRY   getservent();
  566. pprotoent APIENTRY   getprotobyname(PSZ);
  567. pprotoent APIENTRY   getprotobynumber(int);
  568. void      APIENTRY   sethostent(int);
  569. phostent  APIENTRY   gethostent();
  570. void      APIENTRY   endhostent();
  571. void      APIENTRY   setnetent(int);
  572. pnetent   APIENTRY   getnetent();
  573. void      APIENTRY   endnetent();
  574. void      APIENTRY   setprotoent(int);
  575. pprotoent APIENTRY   getprotoent();
  576. void      APIENTRY   endprotoent();
  577. void      APIENTRY   setservent(int);
  578. pservent  APIENTRY   getservent();
  579. void      APIENTRY   endservent();
  580.  
  581.  
  582. #ifdef __cplusplus
  583.   }
  584. #endif
  585.  
  586.  
  587. #ifndef OSTRING_INCLUDED
  588.   #include <OString.hpp>
  589. #endif
  590.  
  591.  
  592. class __CPP_EXPORT__ OIP
  593. {
  594.  protected:
  595.     static
  596.       OString              transport;
  597.  
  598.     OIP                    () {}
  599.  
  600.     virtual
  601.       ~OIP                 () {} 
  602.  
  603.  public:
  604.  
  605.     static
  606.         OString            MSGFILE;
  607.  
  608.     static OString
  609.         &Version           (),
  610.         &Version           (OString& str),
  611.         &error             (ULONG x),
  612.         &apierror          (ULONG x, ULONG rc);
  613. };
  614.  
  615. #endif // OIP_INCLUDED
  616.  
  617.