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

  1. /* -*-C-*-
  2.  *
  3.  * $Header: /ax/networking:include/netinet/in.h:networking  1.1  $
  4.  * $Source: /ax/networking:include/netinet/in.h: $
  5.  *
  6.  * Copyright (c) 1995 Acorn Computers Ltd., Cambridge, England
  7.  *
  8.  * $Log:    in.h,v $
  9.  * Revision 1.1  95/01/11  10:16:50  kwelton
  10.  * Initial revision
  11.  * 
  12.  */
  13. /*
  14.  *
  15.  * Constants and structures defined by the internet system,
  16.  * Per RFC 790, September 1981.
  17.  */
  18.  
  19. #ifndef __netinet_in_h
  20. #define __netinet_in_h
  21.  
  22. /*
  23.  * Protocols
  24.  */
  25. #define IPPROTO_IP              0               /* dummy for IP */
  26. #define IPPROTO_ICMP            1               /* control message protocol */
  27. #define IPPROTO_GGP             3               /* gateway^2 (deprecated) */
  28. #define IPPROTO_TCP             6               /* tcp */
  29. #define IPPROTO_EGP             8               /* exterior gateway protocol */
  30. #define IPPROTO_PUP             12              /* pup */
  31. #define IPPROTO_UDP             17              /* user datagram protocol */
  32. #define IPPROTO_IDP             22              /* xns idp */
  33.  
  34. #define IPPROTO_RAW             255             /* raw IP packet */
  35. #define IPPROTO_MAX             256
  36.  
  37.  
  38. /*
  39.  * Ports < IPPORT_RESERVED are reserved for
  40.  * privileged processes (e.g. root).
  41.  * Ports > IPPORT_USERRESERVED are reserved
  42.  * for servers, not necessarily privileged.
  43.  */
  44. #define IPPORT_RESERVED         1024
  45. #define IPPORT_USERRESERVED     5000
  46.  
  47. /*
  48.  * Link numbers
  49.  */
  50. #define IMPLINK_IP              155
  51. #define IMPLINK_LOWEXPER        156
  52. #define IMPLINK_HIGHEXPER       158
  53.  
  54. /*
  55.  * Internet address (a structure for historical reasons)
  56.  */
  57. struct in_addr {
  58.         u_long s_addr;
  59. };
  60.  
  61. /*
  62.  * Definitions of bits in internet address integers.
  63.  * On subnets, the decomposition of addresses to host and net parts
  64.  * is done according to subnet mask, not the masks here.
  65.  */
  66. #define IN_CLASSA(i)            (((long)(i) & 0x80000000) == 0)
  67. #define IN_CLASSA_NET           0xff000000
  68. #define IN_CLASSA_NSHIFT        24
  69. #define IN_CLASSA_HOST          0x00ffffff
  70. #define IN_CLASSA_MAX           128
  71.  
  72. #define IN_CLASSB(i)            (((long)(i) & 0xc0000000) == 0x80000000)
  73. #define IN_CLASSB_NET           0xffff0000
  74. #define IN_CLASSB_NSHIFT        16
  75. #define IN_CLASSB_HOST          0x0000ffff
  76. #define IN_CLASSB_MAX           65536
  77.  
  78. #define IN_CLASSC(i)            (((long)(i) & 0xe0000000) == 0xc0000000)
  79. #define IN_CLASSC_NET           0xffffff00
  80. #define IN_CLASSC_NSHIFT        8
  81. #define IN_CLASSC_HOST          0x000000ff
  82.  
  83. #define IN_CLASSD(i)            (((long)(i) & 0xf0000000) == 0xe0000000)
  84. #define IN_MULTICAST(i)         IN_CLASSD(i)
  85.  
  86. #define IN_EXPERIMENTAL(i)      (((long)(i) & 0xe0000000) == 0xe0000000)
  87. #define IN_BADCLASS(i)          (((long)(i) & 0xf0000000) == 0xf0000000)
  88.  
  89. #define INADDR_ANY              (u_long)0x00000000
  90. #define INADDR_BROADCAST        (u_long)0xffffffff      /* must be masked */
  91. #ifndef KERNEL
  92. #define INADDR_NONE             0xffffffff              /* -1 return */
  93. #endif
  94.  
  95. #define IN_LOOPBACKNET          127                     /* official! */
  96.  
  97. /*
  98.  * Socket address, internet style.
  99.  */
  100. struct sockaddr_in {
  101.         short   sin_family;
  102.         u_short sin_port;
  103.         struct  in_addr sin_addr;
  104.         char    sin_zero[8];
  105. };
  106.  
  107. /*
  108.  * Options for use with [gs]etsockopt at the IP level.
  109.  */
  110. #define IP_OPTIONS      1               /* set/get IP per-packet options */
  111.  
  112. #ifdef KERNEL
  113. extern  struct domain inetdomain;
  114. extern  struct protosw inetsw[];
  115. struct  in_addr in_makeaddr();
  116. u_long  in_netof(), in_lnaof();
  117. #endif
  118.  
  119. #endif /* !defined(__netinet_in_h) */
  120.  
  121. /* EOF in.h */
  122.