home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 4 / DATAFILE_PDCD4.iso / utilities / utilss / sockets / include / sys / h / socket < prev    next >
Encoding:
Text File  |  1995-01-11  |  5.9 KB  |  171 lines

  1. /*
  2.  * $Header: /ax/networking:include/sys/socket.h:networking  1.1  $
  3.  * $Source: /ax/networking:include/sys/socket.h: $
  4.  *
  5.  * Copyright (c) 1988 Acorn Computers Ltd., Cambridge, England
  6.  *
  7.  * $Log:    socket.h,v $
  8.  * Revision 1.1  95/01/11  10:19:47  kwelton
  9.  * Initial revision
  10.  * 
  11.  * Revision 1.3  88/06/17  20:21:11  beta
  12.  * Acorn Unix initial beta version
  13.  * 
  14.  */
  15. /* @(#)socket.h 1.2 87/05/15 3.2/4.3NFSSRC */
  16. /*
  17.  * Copyright (c) 1982,1985, 1986 Regents of the University of California.
  18.  * All rights reserved.  The Berkeley software License Agreement
  19.  * specifies the terms and conditions for redistribution.
  20.  *
  21.  *      @(#)socket.h    7.1 (Berkeley) 6/4/86
  22.  */
  23.  
  24. #ifndef __sys_socket_h
  25. #define __sys_socket_h
  26.  
  27. /*
  28.  * Definitions related to sockets: types, address families, options.
  29.  */
  30.  
  31. /*
  32.  * Types
  33.  */
  34. #define SOCK_STREAM     1               /* stream socket */
  35. #define SOCK_DGRAM      2               /* datagram socket */
  36. #define SOCK_RAW        3               /* raw-protocol interface */
  37. #define SOCK_RDM        4               /* reliably-delivered message */
  38. #define SOCK_SEQPACKET  5               /* sequenced packet stream */
  39.  
  40. /*
  41.  * Option flags per-socket.
  42.  */
  43. #define SO_DEBUG        0x0001          /* turn on debugging info recording */
  44. #define SO_ACCEPTCONN   0x0002          /* socket has had listen() */
  45. #define SO_REUSEADDR    0x0004          /* allow local address reuse */
  46. #define SO_KEEPALIVE    0x0008          /* keep connections alive */
  47. #define SO_DONTROUTE    0x0010          /* just use interface addresses */
  48. #define SO_BROADCAST    0x0020          /* permit sending of broadcast msgs */
  49. #define SO_USELOOPBACK  0x0040          /* bypass hardware when possible */
  50. #define SO_LINGER       0x0080          /* linger on close if data present */
  51. #define SO_OOBINLINE    0x0100          /* leave received OOB data in line */
  52. #define SO_NOCHKSUM     0x0200          /* omit checksums */
  53.  
  54. /*
  55.  * Additional options, not kept in so_options.
  56.  */
  57. #define SO_SNDBUF       0x1001          /* send buffer size */
  58. #define SO_RCVBUF       0x1002          /* receive buffer size */
  59. #define SO_SNDLOWAT     0x1003          /* send low-water mark */
  60. #define SO_RCVLOWAT     0x1004          /* receive low-water mark */
  61. #define SO_SNDTIMEO     0x1005          /* send timeout */
  62. #define SO_RCVTIMEO     0x1006          /* receive timeout */
  63. #define SO_ERROR        0x1007          /* get error status and clear */
  64. #define SO_TYPE         0x1008          /* get socket type */
  65.  
  66. /*
  67.  * Structure used for manipulating linger option.
  68.  */
  69. struct  linger {
  70.         int     l_onoff;                /* option on/off */
  71.         int     l_linger;               /* linger time */
  72. };
  73.  
  74. /*
  75.  * Level number for (get/set)sockopt() to apply to socket itself.
  76.  */
  77. #define SOL_SOCKET      0xffff          /* options for socket level */
  78.  
  79. /*
  80.  * Address families.
  81.  */
  82. #define AF_UNSPEC       0               /* unspecified */
  83. #define AF_UNIX         1               /* local to UNIX host (pipes, portals) */
  84. #define AF_RISCOS       AF_UNIX         /* local to RISC OS host */
  85. #define AF_INET         2               /* internetwork: UDP, TCP, etc. */
  86. #define AF_IMPLINK      3               /* arpanet imp addresses */
  87. #define AF_PUP          4               /* pup protocols: e.g. BSP */
  88. #define AF_CHAOS        5               /* mit CHAOS protocols */
  89. #define AF_NS           6               /* XEROX NS protocols */
  90. #define AF_NBS          7               /* nbs protocols */
  91. #define AF_ECMA         8               /* european computer manufacturers */
  92. #define AF_DATAKIT      9               /* datakit protocols */
  93. #define AF_CCITT        10              /* CCITT protocols, X.25 etc */
  94. #define AF_SNA          11              /* IBM SNA */
  95. #define AF_DECnet       12              /* DECnet */
  96. #define AF_DLI          13              /* Direct data link interface */
  97. #define AF_LAT          14              /* LAT */
  98. #define AF_HYLINK       15              /* NSC Hyperchannel */
  99. #define AF_APPLETALK    16              /* Apple Talk */
  100.  
  101. #define AF_MAX          17
  102.  
  103. /*
  104.  * Structure used by kernel to store most
  105.  * addresses.
  106.  */
  107. struct sockaddr {
  108.         u_short sa_family;              /* address family */
  109.         char    sa_data[14];            /* up to 14 bytes of direct address */
  110. };
  111.  
  112. /*
  113.  * Structure used by kernel to pass protocol
  114.  * information in raw sockets.
  115.  */
  116. struct sockproto {
  117.         u_short sp_family;              /* address family */
  118.         u_short sp_protocol;            /* protocol */
  119. };
  120.  
  121. /*
  122.  * Protocol families, same as address families for now.
  123.  */
  124. #define PF_UNSPEC       AF_UNSPEC
  125. #define PF_UNIX         AF_UNIX
  126. #define PF_RISCOS       AF_UNIX
  127. #define PF_INET         AF_INET
  128. #define PF_IMPLINK      AF_IMPLINK
  129. #define PF_PUP          AF_PUP
  130. #define PF_CHAOS        AF_CHAOS
  131. #define PF_NS           AF_NS
  132. #define PF_NBS          AF_NBS
  133. #define PF_ECMA         AF_ECMA
  134. #define PF_DATAKIT      AF_DATAKIT
  135. #define PF_CCITT        AF_CCITT
  136. #define PF_SNA          AF_SNA
  137. #define PF_DECnet       AF_DECnet
  138. #define PF_DLI          AF_DLI
  139. #define PF_LAT          AF_LAT
  140. #define PF_HYLINK       AF_HYLINK
  141. #define PF_APPLETALK    AF_APPLETALK
  142.  
  143. #define PF_MAX          AF_MAX
  144.  
  145. /*
  146.  * Maximum queue length specifiable by listen.
  147.  */
  148. #define SOMAXCONN       5
  149.  
  150. /*
  151.  * Message header for recvmsg and sendmsg calls.
  152.  */
  153. struct msghdr {
  154.         caddr_t msg_name;               /* optional address */
  155.         int     msg_namelen;            /* size of address */
  156.         struct  iovec *msg_iov;         /* scatter/gather array */
  157.         int     msg_iovlen;             /* # elements in msg_iov */
  158.         caddr_t msg_accrights;          /* access rights sent/received */
  159.         int     msg_accrightslen;
  160. };
  161.  
  162. #define MSG_OOB         0x1             /* process out-of-band data */
  163. #define MSG_PEEK        0x2             /* peek at incoming message */
  164. #define MSG_DONTROUTE   0x4             /* send without using routing tables */
  165.  
  166. #define MSG_MAXIOVLEN   16
  167.  
  168. #endif  /* __sys_socket_h */
  169.  
  170. /* EOF socket.h */
  171.