home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / sockpli.zip / SOCKET.COP < prev    next >
Text File  |  1995-06-27  |  15KB  |  464 lines

  1.  %dcl #_SOCKET_32H char ext;
  2.  %if #_SOCKET_32H = '' %then
  3.   %do;
  4.     %dcl #_SOCKET_32H char ext;
  5.     %#_SOCKET_32H = 'Y';
  6.  
  7.  /*
  8.    * Copyright (c) 1982, 1985, 1986 Regents of the University of Califor
  9.  nia.
  10.    * All rights reserved.
  11.    *
  12.    * Redistribution and use in source and binary forms are permitted
  13.    * provided that this notice is preserved and that due credit is given
  14.    * to the University of California at Berkeley. The name of the Univer
  15.  sity
  16.    * may not be used to endorse or promote products derived from this
  17.    * software without specific prior written permission. This software
  18.    * is provided ``as is'' without express or implied warranty.
  19.    *
  20.    *      @(#)socket.h    7.2 (Berkeley) 12/30/87
  21.    */
  22.  
  23.  /*
  24.    * Definitions related to sockets: types, address families, options.
  25.    */
  26.  
  27.  /*
  28.    * Types
  29.    */
  30.     dcl SOCK_STREAM fixed bin(31) value(1);
  31.  /* stream socket */
  32.     dcl SOCK_DGRAM fixed bin(31) value(2);
  33.  /* datagram socket */
  34.     dcl SOCK_RAW fixed bin(31) value(3);
  35.  /* raw-protocol interface */
  36.     dcl SOCK_RDM fixed bin(31) value(4);
  37.  /* reliably-delivered message */
  38.     dcl SOCK_SEQPACKET fixed bin(31) value(5);
  39.  /* sequenced packet stream */
  40.  
  41.  /*
  42.    * Option flags per-socket.
  43.    */
  44.     dcl SO_DEBUG fixed bin(15) value('0001'xn);
  45.  /* turn on debugging info recording */
  46.     dcl SO_ACCEPTCONN fixed bin(15) value('0002'xn);
  47.  /* socket has had listen() */
  48.     dcl SO_REUSEADDR fixed bin(15) value('0004'xn);
  49.  /* allow local address reuse */
  50.     dcl SO_KEEPALIVE fixed bin(15) value('0008'xn);
  51.  /* keep connections alive */
  52.     dcl SO_DONTROUTE fixed bin(15) value('0010'xn);
  53.  /* just use interface addresses */
  54.     dcl SO_BROADCAST fixed bin(15) value('0020'xn);
  55.  /* permit sending of broadcast msgs */
  56.     dcl SO_USELOOPBACK fixed bin(15) value('0040'xn);
  57.  /* bypass hardware when possible */
  58.     dcl SO_LINGER fixed bin(15) value('0080'xn);
  59.  /* linger on close if data present */
  60.     dcl SO_OOBINLINE fixed bin(15) value('0100'xn);
  61.  /* leave received OOB data in line */
  62.  
  63.  /*
  64.    * Additional options, not kept in so_options.
  65.    */
  66.     dcl SO_SNDBUF fixed bin(15) value('1001'xn);
  67.  /* send buffer size */
  68.     dcl SO_RCVBUF fixed bin(15) value('1002'xn);
  69.  /* receive buffer size */
  70.     dcl SO_SNDLOWAT fixed bin(15) value('1003'xn);
  71.  /* send low-water mark */
  72.     dcl SO_RCVLOWAT fixed bin(15) value('1004'xn);
  73.  /* receive low-water mark */
  74.     dcl SO_SNDTIMEO fixed bin(15) value('1005'xn);
  75.  /* send timeout */
  76.     dcl SO_RCVTIMEO fixed bin(15) value('1006'xn);
  77.  /* receive timeout */
  78.     dcl SO_ERROR fixed bin(15) value('1007'xn);
  79.  /* get error status and clear */
  80.     dcl SO_TYPE fixed bin(15) value('1008'xn);
  81.  /* get socket type */
  82.  
  83.  /*
  84.    * Structure used for manipulating linger option.
  85.    */
  86.  define structure
  87.    1 linger,
  88.        2 l_onoff fixed bin(31),/* option on/off */
  89.        2 l_linger fixed bin(31);/* linger time */
  90.  
  91.  
  92.  /*
  93.    * Level number for (get/set)sockopt() to apply to socket itself.
  94.    */
  95.     dcl SOL_SOCKET fixed bin(15) value(-1);
  96.  /* options for socket level */
  97.  
  98.  /*
  99.    * Address families.
  100.    */
  101.     dcl AF_UNSPEC fixed bin(31) value(0);
  102.  /* unspecified */
  103.     dcl AF_UNIX fixed bin(31) value(1);
  104.  /* local to host (pipes, portals) */
  105.     dcl AF_INET fixed bin(31) value(2);
  106.  /* internetwork: UDP, TCP, etc. */
  107.     dcl AF_IMPLINK fixed bin(31) value(3);
  108.  /* arpanet imp addresses */
  109.     dcl AF_PUP fixed bin(31) value(4);
  110.  /* pup protocols: e.g. BSP */
  111.     dcl AF_CHAOS fixed bin(31) value(5);
  112.  /* mit CHAOS protocols */
  113.     dcl AF_NS fixed bin(31) value(6);
  114.  /* XEROX NS protocols */
  115.     dcl AF_NBS fixed bin(31) value(7);
  116.  /* nbs protocols */
  117.     dcl AF_ECMA fixed bin(31) value(8);
  118.  /* european computer manufacturers */
  119.     dcl AF_DATAKIT fixed bin(31) value(9);
  120.  /* datakit protocols */
  121.     dcl AF_CCITT fixed bin(31) value(10);
  122.  /* CCITT protocols, X.25 etc */
  123.     dcl AF_SNA fixed bin(31) value(11);
  124.  /* IBM SNA */
  125.     dcl AF_DECnet fixed bin(31) value(12);
  126.  /* DECnet */
  127.     dcl AF_DLI fixed bin(31) value(13);
  128.  /* Direct data link interface */
  129.     dcl AF_LAT fixed bin(31) value(14);
  130.  /* LAT */
  131.     dcl AF_HYLINK fixed bin(31) value(15);
  132.  /* NSC Hyperchannel */
  133.     dcl AF_APPLETALK fixed bin(31) value(16);
  134.  /* Apple Talk */
  135.  
  136.     dcl AF_MAX fixed bin(31) value(17);
  137.  
  138.  /*
  139.    * Structure used by kernel to store most
  140.    * addresses.
  141.    */
  142.  define structure
  143.    1 sockaddr,
  144.        2 sa_family unsigned fixed bin(16) ,/* address family */
  145.        2 sa_data char(14-1) varyingz;/* up to 14 bytes of direct address
  146.   */
  147.  
  148.  
  149.  /*
  150.    * Structure used by kernel to pass protocol
  151.    * information in raw sockets.
  152.    */
  153.  define structure
  154.    1 sockproto,
  155.        2 sp_family unsigned fixed bin(16) ,/* address family */
  156.        2 sp_protocol unsigned fixed bin(16) ;/* protocol */
  157.  
  158.  
  159.  /*
  160.    * Protocol families, same as address families for now.
  161.    */
  162.  %dcl PF_UNSPEC char ext;
  163.  %PF_UNSPEC='AF_UNSPEC';
  164.     %dcl @PF_UNSPEC char ext;
  165.     %@PF_UNSPEC='@AF_UNSPEC';
  166.  %dcl PF_UNIX char ext;
  167.  %PF_UNIX='AF_UNIX';
  168.     %dcl @PF_UNIX char ext;
  169.     %@PF_UNIX='@AF_UNIX';
  170.  %dcl PF_INET char ext;
  171.  %PF_INET='AF_INET';
  172.     %dcl @PF_INET char ext;
  173.     %@PF_INET='@AF_INET';
  174.  %dcl PF_IMPLINK char ext;
  175.  %PF_IMPLINK='AF_IMPLINK';
  176.     %dcl @PF_IMPLINK char ext;
  177.     %@PF_IMPLINK='@AF_IMPLINK';
  178.  %dcl PF_PUP char ext;
  179.  %PF_PUP='AF_PUP';
  180.     %dcl @PF_PUP char ext;
  181.     %@PF_PUP='@AF_PUP';
  182.  %dcl PF_CHAOS char ext;
  183.  %PF_CHAOS='AF_CHAOS';
  184.     %dcl @PF_CHAOS char ext;
  185.     %@PF_CHAOS='@AF_CHAOS';
  186.  %dcl PF_NS char ext;
  187.  %PF_NS='AF_NS';
  188.     %dcl @PF_NS char ext;
  189.     %@PF_NS='@AF_NS';
  190.  %dcl PF_NBS char ext;
  191.  %PF_NBS='AF_NBS';
  192.     %dcl @PF_NBS char ext;
  193.     %@PF_NBS='@AF_NBS';
  194.  %dcl PF_ECMA char ext;
  195.  %PF_ECMA='AF_ECMA';
  196.     %dcl @PF_ECMA char ext;
  197.     %@PF_ECMA='@AF_ECMA';
  198.  %dcl PF_DATAKIT char ext;
  199.  %PF_DATAKIT='AF_DATAKIT';
  200.     %dcl @PF_DATAKIT char ext;
  201.     %@PF_DATAKIT='@AF_DATAKIT';
  202.  %dcl PF_CCITT char ext;
  203.  %PF_CCITT='AF_CCITT';
  204.     %dcl @PF_CCITT char ext;
  205.     %@PF_CCITT='@AF_CCITT';
  206.  %dcl PF_SNA char ext;
  207.  %PF_SNA='AF_SNA';
  208.     %dcl @PF_SNA char ext;
  209.     %@PF_SNA='@AF_SNA';
  210.  %dcl PF_DECnet char ext;
  211.  %PF_DECnet='AF_DECnet';
  212.     %dcl @PF_DECnet char ext;
  213.     %@PF_DECnet='@AF_DECnet';
  214.  %dcl PF_DLI char ext;
  215.  %PF_DLI='AF_DLI';
  216.     %dcl @PF_DLI char ext;
  217.     %@PF_DLI='@AF_DLI';
  218.  %dcl PF_LAT char ext;
  219.  %PF_LAT='AF_LAT';
  220.     %dcl @PF_LAT char ext;
  221.     %@PF_LAT='@AF_LAT';
  222.  %dcl PF_HYLINK char ext;
  223.  %PF_HYLINK='AF_HYLINK';
  224.     %dcl @PF_HYLINK char ext;
  225.     %@PF_HYLINK='@AF_HYLINK';
  226.  %dcl PF_APPLETALK char ext;
  227.  %PF_APPLETALK='AF_APPLETALK';
  228.     %dcl @PF_APPLETALK char ext;
  229.     %@PF_APPLETALK='@AF_APPLETALK';
  230.  
  231.  %dcl PF_MAX char ext;
  232.  %PF_MAX='AF_MAX';
  233.     %dcl @PF_MAX char ext;
  234.     %@PF_MAX='@AF_MAX';
  235.  
  236.  /*
  237.    * Maximum queue length specifiable by listen.
  238.    */
  239.     dcl SOMAXCONN fixed bin(31) value(5);
  240.  
  241.     %dcl #_off_t char ext;
  242.     %if #_off_t = '' %then
  243.      %do;
  244.        define alias off_t fixed bin(31);
  245.        define alias @off_t pointer;
  246.        %dcl #_off_t char ext;
  247.        %#_off_t = 'Y';
  248.      %end;
  249.  
  250.  define structure
  251.    1 iovec,
  252.        2 iov_base pointer,
  253.        2 iov_len fixed bin(31);
  254.  
  255.  /*
  256.    * Message header for recvmsg and sendmsg calls.
  257.    */
  258.  define structure
  259.    1 msghdr,
  260.        2 msg_name pointer,/* optional address */
  261.        2 msg_namelen fixed bin(31),/* size of address */
  262.        2 msg_iov handle iovec,/* scatter/gather array */
  263.        2 msg_iovlen fixed bin(31),/* # elements in msg_iov */
  264.        2 msg_accrights pointer,/* access rights sent/received */
  265.        2 msg_accrightslen fixed bin(31);
  266.  
  267.  define structure
  268.    1 uio,
  269.        2 uio_iov handle iovec,
  270.        2 uio_iovcnt fixed bin(31),
  271.        2 uio_offset type off_t,
  272.        2 uio_segflg fixed bin(31),
  273.        2 uio_resid fixed bin(31);
  274.  
  275.     define
  276.        ordinal
  277.          uio_rw
  278.             ( UIO_READ,
  279.             UIO_WRITE
  280.             );
  281.     dcl FREAD fixed bin(31) value(1);
  282.     dcl FWRITE fixed bin(31) value(2);
  283.  
  284.     dcl MSG_OOB fixed bin(15) value('1'xn);
  285.  /* process out-of-band data */
  286.     dcl MSG_PEEK fixed bin(15) value('2'xn);
  287.  /* peek at incoming message */
  288.     dcl MSG_DONTROUTE fixed bin(15) value('4'xn);
  289.  /* send without using routing tables */
  290.  
  291.     dcl MSG_MAXIOVLEN fixed bin(31) value(16);
  292.  
  293.     dcl accept entry (
  294.            fixed bin(31),
  295.            pointer,
  296.            pointer)
  297.              returns( fixed bin(31) byvalue )
  298.               options(linkage(system) byvalue nodescriptor) external;
  299.     dcl bind entry (
  300.            fixed bin(31),
  301.            pointer,
  302.            fixed bin (31))
  303.              returns( fixed bin(31) byvalue )
  304.               options(linkage(system) byvalue nodescriptor) external;
  305.     dcl connect entry (
  306.            fixed bin(31),
  307.            pointer,
  308.            fixed bin (31))
  309.              returns( fixed bin(31) byvalue )
  310.               options(linkage(system) byvalue nodescriptor) external;
  311.     dcl gethostid entry (
  312.                 )
  313.              returns( fixed bin(31) byvalue )
  314.               options(linkage(system) byvalue nodescriptor) external;
  315.     dcl getpeername entry (
  316.            fixed bin(31),
  317.            pointer,
  318.            pointer)
  319.              returns( fixed bin(31) byvalue )
  320.               options(linkage(system) byvalue nodescriptor) external;
  321.     dcl getsockname entry (
  322.            fixed bin(31),
  323.            pointer,
  324.            pointer)
  325.              returns( fixed bin(31) byvalue )
  326.               options(linkage(system) byvalue nodescriptor) external;
  327.     dcl getsockopt entry (
  328.            fixed bin(31),
  329.            fixed bin(31),
  330.            fixed bin(31),
  331.            pointer,
  332.            pointer)
  333.              returns( fixed bin(31) byvalue )
  334.               options(linkage(system) byvalue nodescriptor) external;
  335.     dcl ioctl entry (
  336.            fixed bin(31),
  337.            fixed bin(31),
  338.            pointer,
  339.            fixed bin(31))
  340.              returns( fixed bin(31) byvalue )
  341.               options(linkage(system) byvalue nodescriptor) external;
  342.     dcl listen entry (
  343.            fixed bin(31),
  344.            fixed bin(31))
  345.              returns( fixed bin(31) byvalue )
  346.               options(linkage(system) byvalue nodescriptor) external;
  347.     dcl recvmsg entry (
  348.            fixed bin(31),
  349.            handle msghdr,
  350.            fixed bin(31))
  351.              returns( fixed bin(31) byvalue )
  352.               options(linkage(system) byvalue nodescriptor) external;
  353.     dcl recv entry (
  354.            fixed bin(31),
  355.            pointer,
  356.            fixed bin(31),
  357.            fixed bin(31))
  358.              returns( fixed bin(31) byvalue )
  359.               options(linkage(system) byvalue nodescriptor) external;
  360.     dcl recvfrom entry (
  361.            fixed bin(31),
  362.            pointer,
  363.            fixed bin(31),
  364.            fixed bin(31),
  365.            pointer,
  366.            pointer)
  367.              returns( fixed bin(31) byvalue )
  368.               options(linkage(system) byvalue nodescriptor) external;
  369.     %dcl BSD_SELECT char ext;
  370.     %if BSD_SELECT = '' %then
  371.      %do;
  372.        dcl select entry (
  373.               pointer,
  374.               fixed bin(31),
  375.               fixed bin(31),
  376.               fixed bin(31),
  377.               fixed bin(31))
  378.                 returns( fixed bin(31) byvalue )
  379.                  options(linkage(system) byvalue nodescriptor) external;
  380.      %end;
  381.     dcl send entry (
  382.            fixed bin(31),
  383.            pointer,
  384.            fixed bin(31),
  385.            fixed bin(31))
  386.              returns( fixed bin(31) byvalue )
  387.               options(linkage(system) byvalue nodescriptor) external;
  388.     dcl sendmsg entry (
  389.            fixed bin(31),
  390.            handle msghdr,
  391.            fixed bin(31))
  392.              returns( fixed bin(31) byvalue )
  393.               options(linkage(system) byvalue nodescriptor) external;
  394.     dcl sendto entry (
  395.            fixed bin(31),
  396.            pointer,
  397.            fixed bin(31),
  398.            fixed bin(31),
  399.            pointer,
  400.            fixed bin(31))
  401.              returns( fixed bin(31) byvalue )
  402.               options(linkage(system) byvalue nodescriptor) external;
  403.     dcl setsockopt entry (
  404.            fixed bin(31),
  405.            fixed bin(31),
  406.            fixed bin(31),
  407.            pointer,
  408.            fixed bin(31))
  409.              returns( fixed bin(31) byvalue )
  410.               options(linkage(system) byvalue nodescriptor) external;
  411.     dcl sock_init entry (
  412.                 )
  413.              returns( fixed bin(31) byvalue )
  414.               options(linkage(system) byvalue nodescriptor) external;
  415.     dcl sock_errno entry (
  416.                 )
  417.              returns( fixed bin(31) byvalue )
  418.               options(linkage(system) byvalue nodescriptor) external;
  419.     dcl psock_errno entry (
  420.            pointer )
  421.               options(linkage(system) byvalue nodescriptor) external;
  422.     dcl socket entry (
  423.            fixed bin(31),
  424.            fixed bin(31),
  425.            fixed bin(31))
  426.              returns( fixed bin(31) byvalue )
  427.               options(linkage(system) byvalue nodescriptor) external;
  428.     dcl soclose entry (
  429.            fixed bin(31) )
  430.              returns( fixed bin(31) byvalue )
  431.               options(linkage(system) byvalue nodescriptor) external;
  432.     dcl soabort entry (
  433.            fixed bin(31) )
  434.              returns( fixed bin(31) byvalue )
  435.               options(linkage(system) byvalue nodescriptor) external;
  436.     dcl so_cancel entry (
  437.            fixed bin(31) )
  438.              returns( fixed bin(31) byvalue )
  439.               options(linkage(system) byvalue nodescriptor) external;
  440.     dcl readv entry (
  441.            fixed bin(31),
  442.            handle iovec,
  443.            fixed bin(31))
  444.              returns( fixed bin(31) byvalue )
  445.               options(linkage(system) byvalue nodescriptor) external;
  446.     dcl writev entry (
  447.            fixed bin(31),
  448.            handle iovec,
  449.            fixed bin(31))
  450.              returns( fixed bin(31) byvalue )
  451.               options(linkage(system) byvalue nodescriptor) external;
  452.     dcl shutdown entry (
  453.            fixed bin(31),
  454.            fixed bin(31))
  455.              returns( fixed bin(31) byvalue )
  456.               options(linkage(system) byvalue nodescriptor) external;
  457.     dcl getinetversion entry (
  458.            pointer )
  459.              returns( fixed bin(31) byvalue )
  460.               options(linkage(system) byvalue nodescriptor) external;
  461.  
  462.   %end;
  463.  /* __SOCKET_32H */
  464.