home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 29 Fixes_o / 29-Fixes_o.zip / prgcsd.exe / SOCKET.H < prev    next >
Text File  |  1992-10-09  |  9KB  |  223 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) 1982, 1985, 1986 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.  *      @(#)socket.h    7.2 (Berkeley) 12/30/87
  25.  */
  26. #ifndef __32BIT__
  27. #define _Packed
  28. #define _Seg16
  29. #define _Far16
  30. #define _Cdecl
  31. #endif
  32.  
  33. /*
  34.  * Definitions related to sockets: types, address families, options.
  35.  */
  36.  
  37. /*
  38.  * Types
  39.  */
  40. #define SOCK_STREAM     1               /* stream socket */
  41. #define SOCK_DGRAM      2               /* datagram socket */
  42. #define SOCK_RAW        3               /* raw-protocol interface */
  43. #define SOCK_RDM        4               /* reliably-delivered message */
  44. #define SOCK_SEQPACKET  5               /* sequenced packet stream */
  45.  
  46. /*
  47.  * Option flags per-socket.
  48.  */
  49. #define SO_DEBUG        0x0001          /* turn on debugging info recording */
  50. #define SO_ACCEPTCONN   0x0002          /* socket has had listen() */
  51. #define SO_REUSEADDR    0x0004          /* allow local address reuse */
  52. #define SO_KEEPALIVE    0x0008          /* keep connections alive */
  53. #define SO_DONTROUTE    0x0010          /* just use interface addresses */
  54. #define SO_BROADCAST    0x0020          /* permit sending of broadcast msgs */
  55. #define SO_USELOOPBACK  0x0040          /* bypass hardware when possible */
  56. #define SO_LINGER       0x0080          /* linger on close if data present */
  57. #define SO_OOBINLINE    0x0100          /* leave received OOB data in line */
  58.  
  59. /*
  60.  * Additional options, not kept in so_options.
  61.  */
  62. #define SO_SNDBUF       0x1001          /* send buffer size */
  63. #define SO_RCVBUF       0x1002          /* receive buffer size */
  64. #define SO_SNDLOWAT     0x1003          /* send low-water mark */
  65. #define SO_RCVLOWAT     0x1004          /* receive low-water mark */
  66. #define SO_SNDTIMEO     0x1005          /* send timeout */
  67. #define SO_RCVTIMEO     0x1006          /* receive timeout */
  68. #define SO_ERROR        0x1007          /* get error status and clear */
  69. #define SO_TYPE         0x1008          /* get socket type */
  70.  
  71. #if 0
  72. #include "..\netinet\in.h"
  73. #endif
  74. /*
  75.  * Structure used for manipulating linger option.
  76.  */
  77. struct  linger {
  78.         short     l_onoff;                /* option on/off */
  79.         short     l_linger;               /* linger time */
  80. };
  81.  
  82. /*
  83.  * Level number for (get/set)sockopt() to apply to socket itself.
  84.  */
  85. #define SOL_SOCKET      0xffff          /* options for socket level */
  86.  
  87. /*
  88.  * Address families.
  89.  */
  90. #define AF_UNSPEC       0               /* unspecified */
  91. #define AF_UNIX         1               /* local to host (pipes, portals) */
  92. #define AF_INET         2               /* internetwork: UDP, TCP, etc. */
  93. #define AF_IMPLINK      3               /* arpanet imp addresses */
  94. #define AF_PUP          4               /* pup protocols: e.g. BSP */
  95. #define AF_CHAOS        5               /* mit CHAOS protocols */
  96. #define AF_NS           6               /* XEROX NS protocols */
  97. #define AF_NBS          7               /* nbs protocols */
  98. #define AF_ECMA         8               /* european computer manufacturers */
  99. #define AF_DATAKIT      9               /* datakit protocols */
  100. #define AF_CCITT        10              /* CCITT protocols, X.25 etc */
  101. #define AF_SNA          11              /* IBM SNA */
  102. #define AF_DECnet       12              /* DECnet */
  103. #define AF_DLI          13              /* Direct data link interface */
  104. #define AF_LAT          14              /* LAT */
  105. #define AF_HYLINK       15              /* NSC Hyperchannel */
  106. #define AF_APPLETALK    16              /* Apple Talk */
  107.  
  108. #define AF_MAX          17
  109.  
  110. /*
  111.  * Structure used by kernel to store most
  112.  * addresses.
  113.  */
  114. struct sockaddr {
  115.         u_short sa_family;              /* address family */
  116.         char    sa_data[14];            /* up to 14 bytes of direct address */
  117. };
  118. #if 0
  119. struct in_addr {
  120.         u_long s_addr;
  121. };
  122. struct sockaddr_in {
  123.         short   sin_family;
  124.         u_short sin_port;
  125.         struct  in_addr sin_addr;
  126.         char    sin_zero[8];
  127. };
  128. #endif
  129.  
  130. /*
  131.  * Structure used by kernel to pass protocol
  132.  * information in raw sockets.
  133.  */
  134. struct sockproto {
  135.         u_short sp_family;              /* address family */
  136.         u_short sp_protocol;            /* protocol */
  137. };
  138.  
  139. /*
  140.  * Protocol families, same as address families for now.
  141.  */
  142. #define PF_UNSPEC       AF_UNSPEC
  143. #define PF_UNIX         AF_UNIX
  144. #define PF_INET         AF_INET
  145. #define PF_IMPLINK      AF_IMPLINK
  146. #define PF_PUP          AF_PUP
  147. #define PF_CHAOS        AF_CHAOS
  148. #define PF_NS           AF_NS
  149. #define PF_NBS          AF_NBS
  150. #define PF_ECMA         AF_ECMA
  151. #define PF_DATAKIT      AF_DATAKIT
  152. #define PF_CCITT        AF_CCITT
  153. #define PF_SNA          AF_SNA
  154. #define PF_DECnet       AF_DECnet
  155. #define PF_DLI          AF_DLI
  156. #define PF_LAT          AF_LAT
  157. #define PF_HYLINK       AF_HYLINK
  158. #define PF_APPLETALK    AF_APPLETALK
  159.  
  160. #define PF_MAX          AF_MAX
  161.  
  162. /*
  163.  * Maximum queue length specifiable by listen.
  164.  */
  165. #define SOMAXCONN       5
  166.  
  167. /*
  168.  * Message header for recvmsg and sendmsg calls.
  169.  */
  170. _Packed struct msghdr {
  171.         char * _Seg16 msg_name;               /* optional address */
  172.         short   msg_namelen;            /* size of address */
  173.         struct  iovec * _Seg16 msg_iov;         /* scatter/gather array */
  174.         short   msg_iovlen;             /* # elements in msg_iov */
  175.         char * _Seg16 msg_accrights;          /* access rights sent/received */
  176.         short   msg_accrightslen;
  177. };
  178.  
  179. struct iovec {
  180.         char * _Seg16 iov_base;
  181.         short   iov_len;
  182. };
  183.  
  184. _Packed struct uio {
  185.         struct  iovec * _Seg16 uio_iov;
  186.         short   uio_iovcnt;
  187.         off_t   uio_offset;
  188.         short   uio_segflg;
  189.         short   uio_resid;
  190. };
  191. enum    uio_rw { UIO_READ, UIO_WRITE };
  192. #define FREAD  1
  193. #define FWRITE 2
  194.  
  195. #define MSG_OOB         0x1             /* process out-of-band data */
  196. #define MSG_PEEK        0x2             /* peek at incoming message */
  197. #define MSG_DONTROUTE   0x4             /* send without using routing tables */
  198.  
  199. #define MSG_MAXIOVLEN   16
  200.  
  201. short _Far16 _Cdecl accept( short, void * _Seg16 , short * _Seg16  );
  202. short _Far16 _Cdecl bind( short, void * _Seg16 , short );
  203. short _Far16 _Cdecl connect( short, void * _Seg16 , short );
  204. short _Far16 _Cdecl getpeername( short, void * _Seg16 , short * _Seg16  );
  205. short _Far16 _Cdecl getsockname( short, void * _Seg16 , short * _Seg16  );
  206. short _Far16 _Cdecl getsockopt( short, short, short, char * _Seg16 , short * _Seg16  );
  207. short _Far16 _Cdecl listen( short, short );
  208. short _Far16 _Cdecl recvmsg( short, struct msghdr * _Seg16 , short);
  209. short _Far16 _Cdecl recv( short, char * _Seg16 , short, short );
  210. short _Far16 _Cdecl recvfrom(short, char * _Seg16 , short, short, void * _Seg16 , short * _Seg16  );
  211. #ifndef BSD_SELECT
  212. short _Far16 _Cdecl select( short * _Seg16 , short, short, short, long );
  213. #endif
  214. short _Far16 _Cdecl sendmsg( short, struct msghdr * _Seg16 , short);
  215. short _Far16 _Cdecl send( short, char * _Seg16 , short, short );
  216. short _Far16 _Cdecl sendto( short, char * _Seg16 , short, short, void * _Seg16 , short );
  217. short _Far16 _Cdecl setsockopt( short, short, short, char * _Seg16 , short );
  218. short _Far16 _Cdecl shutdown( short, short );
  219. short _Far16 _Cdecl sock_cancel( short );
  220. short _Far16 _Cdecl sock_init( void );
  221. short _Far16 _Cdecl socket( short, short, short );
  222. short _Far16 _Cdecl soclose( short );
  223.