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

  1.  %dcl #_IN_32H char ext;
  2.  %if #_IN_32H = '' %then
  3.   %do;
  4.     %dcl #_IN_32H char ext;
  5.     %#_IN_32H = 'Y';
  6.  /************************************************************/
  7.  /* Copyright (c) 1982, 1986 Regents of the University of    */
  8.  /* California                                               */
  9.  /*                                                          */
  10.  /* All rights reserved.                                     */
  11.  /*                                                          */
  12.  /* Redistribution and use in source and binary forms are    */
  13.  /* permitted provided that this notice is preserved and     */
  14.  /* that due credit is given to the University of California */
  15.  /* at Berkeley. The name of the University may not be used  */
  16.  /* to endorse or promote products derived from this software*/
  17.  /* without specific prior written permission. This software */
  18.  /* is provided 'as is' without express or implied warranty. */
  19.  /*                                                          */
  20.  /*       @(#)in.h        7.5 (Berkeley) 2/22/88             */
  21.  /*                                                          */
  22.  /************************************************************/
  23.  
  24.  /*----------------------------------------------------------*/
  25.  /* Constants and structures defined by the internet system, */
  26.  /* Per RFC 790, September 1981.                             */
  27.  /*----------------------------------------------------------*/
  28.  
  29.  /*----------------------------------------------------------*/
  30.  /* Protocols                                                */
  31.  /*----------------------------------------------------------*/
  32.     dcl IPPROTO_IP           /* dummy for IP                 */
  33.                              fixed bin(31) value(0);
  34.  /*                          -----------------------         */
  35.     dcl IPPROTO_ICMP         /* control message protocol     */
  36.                              fixed bin(31) value(1);
  37.  /*                          -----------------------         */
  38.     dcl IPPROTO_GGP          /* gateway^2 (deprecated)       */
  39.                              fixed bin(31) value(3);
  40.  /*                          -----------------------         */
  41.     dcl IPPROTO_TCP          /* tcp                          */
  42.                              fixed bin(31) value(6);
  43.  /*                          -----------------------         */
  44.     dcl IPPROTO_EGP          /* exterior gateway protocol    */
  45.                              fixed bin(31) value(8);
  46.  /*                          -----------------------         */
  47.     dcl IPPROTO_PUP          /* pup                          */
  48.                              fixed bin(31) value(12);
  49.  /*                          ------------------------        */
  50.     dcl IPPROTO_UDP          /* user datagram protocol       */
  51.                              fixed bin(31) value(17);
  52.  /*                          ------------------------        */
  53.     dcl IPPROTO_IDP          /* xns idp                      */
  54.                              fixed bin(31) value(22);
  55.  /*                          ------------------------        */
  56.     dcl IPPROTO_RAW          /* raw IP packet */
  57.                              fixed bin(31) value(255);
  58.  /*                          -------------------------       */
  59.     dcl IPPROTO_MAX
  60.                              fixed bin(31) value(256);
  61.  /*                          -------------------------       */
  62.  
  63.  
  64.  /*----------------------------------------------------------*/
  65.  /* Ports < IPPORT_RESERVED are reserved for                 */
  66.  /* privileged processes (e.g. root).                        */
  67.  /* Ports > IPPORT_USERRESERVED are reserved                 */
  68.  /* for servers, not necessarily privileged.                 */
  69.  /*----------------------------------------------------------*/
  70.  
  71.     dcl IPPORT_RESERVED fixed bin(31) value(1024);
  72.     dcl IPPORT_USERRESERVED fixed bin(31) value(5000);
  73.  
  74.  /*----------------------------------------------------------*/
  75.  /* Link numbers                                             */
  76.  /*----------------------------------------------------------*/
  77.  
  78.     dcl IMPLINK_IP fixed bin(31) value(155);
  79.     dcl IMPLINK_LOWEXPER fixed bin(31) value(156);
  80.     dcl IMPLINK_HIGHEXPER fixed bin(31) value(158);
  81.  
  82.  /*----------------------------------------------------------*/
  83.  /* Internet address (a structure for historical reasons)    */
  84.  /*----------------------------------------------------------*/
  85.  
  86.  define structure
  87.    1 in_addr,
  88.      2 s_addr
  89.                                   fixed bin(31);
  90.  /*                               --------------             */
  91.  
  92.  /*----------------------------------------------------------*/
  93.  /* Definitions of bits in internet address integers. On sub-*/
  94.  /* nets, the decomposition of addresses to host and net     */
  95.  /* parts is done according to subnet mask not the masks here*/
  96.  /*----------------------------------------------------------*/
  97.  
  98.  %DCL IN_CLASSA ENTRY;
  99.  %IN_CLASSA: PROC(I);
  100.   DCL I CHAR;
  101.     ANS ('(UNSPEC('││I││') & ''80000000''X) = 0');
  102.  %END;
  103.  
  104.     dcl IN_CLASSA_NET fixed bin(31) value('ff000000'xn);
  105.     dcl IN_CLASSA_NSHIFT fixed bin(31) value(24);
  106.     dcl IN_CLASSA_HOST fixed bin(31) value('00ffffff'xn);
  107.     dcl IN_CLASSA_MAX fixed bin(31) value(128);
  108.  
  109.  %DCL IN_CLASSB ENTRY;
  110.  %IN_CLASSB: PROC(I);
  111.   DCL I CHAR;
  112.     ANS ('(UNSPEC('││I││') & ''C0000000''X) = ''80000000''X');
  113.  %END;
  114.  
  115.     dcl IN_CLASSB_NET fixed bin(31) value('ffff0000'xn);
  116.     dcl IN_CLASSB_NSHIFT fixed bin(31) value(16);
  117.     dcl IN_CLASSB_HOST fixed bin(31) value('0000ffff'xn);
  118.     dcl IN_CLASSB_MAX fixed bin(31) value(65536);
  119.  
  120.  %DCL IN_CLASSC ENTRY;
  121.  %IN_CLASSC: PROC(I);
  122.   DCL I CHAR;
  123.     ANS ('(UNSPEC('││I││') & ''E0000000''X) = ''C0000000''X');
  124.  %END;
  125.  
  126.     dcl IN_CLASSC_NET fixed bin(31) value('ffffff00'xn);
  127.     dcl IN_CLASSC_NSHIFT fixed bin(31) value(8);
  128.     dcl IN_CLASSC_HOST fixed bin(31) value('000000ff'xn);
  129.  
  130.  %DCL IN_CLASSD ENTRY;
  131.  %IN_CLASSD: PROC(I);
  132.   DCL I CHAR;
  133.     ANS ('(UNSPEC('││I││') & ''F0000000''X) = ''E0000000''X');
  134.  %END;
  135.  
  136.  %DCL IN_MULTICAST ENTRY;
  137.  %IN_MULTICAST: PROC(I);
  138.   DCL I CHAR;
  139.     ANS (I);
  140.  %END;
  141.  
  142.  %DCL IN_EXPERIMENTAL ENTRY;
  143.  %IN_EXPERIMENTAL: PROC(I);
  144.   DCL I CHAR;
  145.     ANS ('(UNSPEC('││I││') & ''E0000000''X) = ''E0000000''X');
  146.  %END;
  147.  
  148.  %DCL IN_BADCLASS ENTRY;
  149.  %IN_BADCLASS: PROC(I);
  150.   DCL I CHAR;
  151.     ANS ('(UNSPEC('││I││') & ''F0000000''X) = ''F0000000''X');
  152.  %END;
  153.  
  154.  dcl INADDR_ANY fixed bin(31) value(0);
  155.  dcl INADDR_BROADCAST fixed bin(31) value(-1);
  156.  
  157.  /* must be masked */
  158.  
  159.     %dcl KERNEL char ext;
  160.     %if KERNEL = '' %then
  161.      %do;
  162.        dcl INADDR_NONE fixed bin(31) value(-1);
  163.  /* -1 return */
  164.      %end;
  165.  
  166.     dcl IN_LOOPBACKNET fixed bin(31) value(127);
  167.  /* official! */
  168.  
  169.  /*----------------------------------------------------------*/
  170.  /* Socket address, internet style.                          */
  171.  /*----------------------------------------------------------*/
  172.  
  173.  define structure
  174.    1 sockaddr_in,
  175.      2 sin_family
  176.                                   fixed bin(15),
  177.  /*                               --------------             */
  178.      2 sin_port
  179.                                   unsigned fixed bin(16),
  180.  /*                               -----------------------    */
  181.      2 sin_addr
  182.                                   type in_addr,
  183.  /*                               -------------              */
  184.      2 sin_zero
  185.                                   char(8);
  186.  /*                               --------                   */
  187.  
  188.  /*----------------------------------------------------------*/
  189.  /* Options for use with [gs]etsockopt at the IP level.      */
  190.  /*----------------------------------------------------------*/
  191.  
  192.     dcl IP_OPTIONS fixed bin(31) value(1);
  193.  
  194.  /*----------------------------------------------------------*/
  195.  /* set/get IP per-packet options                            */
  196.  /*----------------------------------------------------------*/
  197.  
  198.     dcl inet_addr entry (
  199.            pointer )
  200.              returns( unsigned fixed bin(31) byvalue )
  201.               options(linkage(system) byvalue nodescriptor) external;
  202.  
  203.     dcl inet_makeaddr entry ( unsigned fixed bin(31),
  204.            unsigned fixed bin (31) )
  205.              returns( fixed bin(31) byvalue )
  206.               options(linkage(system) byvalue nodescriptor) external;
  207.  
  208.     dcl inet_network entry (
  209.            pointer )
  210.              returns( unsigned fixed bin(31) byvalue )
  211.               options(linkage(system) byvalue nodescriptor) external;
  212.     dcl inet_ntoa entry (
  213.            type in_addr )
  214.             returns(ptr byvalue)
  215.              options(linkage(system) byvalue nodescriptor) external;
  216.     dcl inet_lnaof entry (
  217.            type in_addr )
  218.              returns( unsigned fixed bin(31) byvalue )
  219.               options(linkage(system) byvalue nodescriptor) external;
  220.     dcl inet_netof entry (
  221.            type in_addr )
  222.              returns( unsigned fixed bin(31) byvalue )
  223.               options(linkage(system) byvalue nodescriptor) external;
  224.  
  225.  %end;
  226.