home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1995 April / Internet Tools.iso / appletalk / netatalk / afs / afskrbsrc.sit.hqx / AFS Kerberos 1.0B0 / bsd / bsd-netinet-in.h < prev    next >
Encoding:
C/C++ Source or Header  |  1990-02-25  |  3.8 KB  |  143 lines

  1. /*
  2.  * Copyright (c) 1982, 1986 Regents of the University of California.
  3.  * All rights reserved.
  4.  *
  5.  * Redistribution and use in source and binary forms are permitted
  6.  * provided that the above copyright notice and this paragraph are
  7.  * duplicated in all such forms and that any documentation,
  8.  * advertising materials, and other materials related to such
  9.  * distribution and use acknowledge that the software was developed
  10.  * by the University of California, Berkeley.  The name of the
  11.  * University may not be used to endorse or promote products derived
  12.  * from this software without specific prior written permission.
  13.  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
  14.  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  15.  * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  16.  *
  17.  *    @(#)in.h    7.6 (Berkeley) 6/29/88
  18.  */
  19.  
  20. /*
  21.  * Constants and structures defined by the internet system,
  22.  * Per RFC 790, September 1981.
  23.  */
  24.  
  25. #ifndef _IN_
  26. #define _IN_
  27.  
  28. /*
  29.  * Protocols
  30.  */
  31. #define    IPPROTO_IP        0        /* dummy for IP */
  32. #define    IPPROTO_ICMP        1        /* control message protocol */
  33. #define    IPPROTO_GGP        3        /* gateway^2 (deprecated) */
  34. #define    IPPROTO_TCP        6        /* tcp */
  35. #define    IPPROTO_EGP        8        /* exterior gateway protocol */
  36. #define    IPPROTO_PUP        12        /* pup */
  37. #define    IPPROTO_UDP        17        /* user datagram protocol */
  38. #define    IPPROTO_IDP        22        /* xns idp */
  39.  
  40. #define    IPPROTO_RAW        255        /* raw IP packet */
  41. #define    IPPROTO_MAX        256
  42.  
  43.  
  44. /*
  45.  * Ports < IPPORT_RESERVED are reserved for
  46.  * privileged processes (e.g. root).
  47.  * Ports > IPPORT_USERRESERVED are reserved
  48.  * for servers, not necessarily privileged.
  49.  */
  50. #define    IPPORT_RESERVED        1024
  51. #define    IPPORT_USERRESERVED    5000
  52.  
  53. /*
  54.  * Link numbers
  55.  */
  56. #define    IMPLINK_IP        155
  57. #define    IMPLINK_LOWEXPER    156
  58. #define    IMPLINK_HIGHEXPER    158
  59.  
  60. /*
  61.  * Internet address (a structure for historical reasons)
  62.  */
  63. struct in_addr {
  64.     u_long s_addr;
  65. };
  66.  
  67. /*
  68.  * Definitions of bits in internet address integers.
  69.  * On subnets, the decomposition of addresses to host and net parts
  70.  * is done according to subnet mask, not the masks here.
  71.  */
  72. #define    IN_CLASSA(i)        (((long)(i) & 0x80000000) == 0)
  73. #define    IN_CLASSA_NET        0xff000000
  74. #define    IN_CLASSA_NSHIFT    24
  75. #define    IN_CLASSA_HOST        0x00ffffff
  76. #define    IN_CLASSA_MAX        128
  77.  
  78. #define    IN_CLASSB(i)        (((long)(i) & 0xc0000000) == 0x80000000)
  79. #define    IN_CLASSB_NET        0xffff0000
  80. #define    IN_CLASSB_NSHIFT    16
  81. #define    IN_CLASSB_HOST        0x0000ffff
  82. #define    IN_CLASSB_MAX        65536
  83.  
  84. #define    IN_CLASSC(i)        (((long)(i) & 0xe0000000) == 0xc0000000)
  85. #define    IN_CLASSC_NET        0xffffff00
  86. #define    IN_CLASSC_NSHIFT    8
  87. #define    IN_CLASSC_HOST        0x000000ff
  88.  
  89. #define    IN_CLASSD(i)        (((long)(i) & 0xf0000000) == 0xe0000000)
  90. #define    IN_MULTICAST(i)        IN_CLASSD(i)
  91.  
  92. #define    IN_EXPERIMENTAL(i)    (((long)(i) & 0xe0000000) == 0xe0000000)
  93. #define    IN_BADCLASS(i)        (((long)(i) & 0xf0000000) == 0xf0000000)
  94.  
  95. #define    INADDR_ANY        (u_long)0x00000000
  96. #define INADDR_LOOPBACK        (u_long)0x7F000001
  97. #define    INADDR_BROADCAST    (u_long)0xffffffff    /* must be masked */
  98. #ifndef KERNEL
  99. #define    INADDR_NONE        0xffffffff        /* -1 return */
  100. #endif
  101.  
  102. #define    IN_LOOPBACKNET        127            /* official! */
  103.  
  104. /*
  105.  * Socket address, internet style.
  106.  */
  107. struct sockaddr_in {
  108.     short    sin_family;
  109.     u_short    sin_port;
  110.     struct    in_addr sin_addr;
  111.     char    sin_zero[8];
  112. };
  113.  
  114. /*
  115.  * Options for use with [gs]etsockopt at the IP level.
  116.  */
  117. #define    IP_OPTIONS    1        /* set/get IP per-packet options */
  118.  
  119. #ifdef KERNEL
  120. extern    struct domain inetdomain;
  121. extern    struct protosw inetsw[];
  122. struct    in_addr in_makeaddr();
  123. u_long    in_netof(), in_lnaof();
  124. #endif
  125.  
  126. #if !defined(vax) && !defined(ntohl) && !defined(lint)
  127. /*
  128.  * Macros for number representation conversion.
  129.  */
  130. #define    ntohl(x)    (x)
  131. #define    ntohs(x)    (x)
  132. #define    htonl(x)    (x)
  133. #define    htons(x)    (x)
  134. #endif
  135.  
  136. #if !defined(ntohl) && (defined(vax) || defined(lint))
  137. u_short    ntohs(), htons();
  138. u_long    ntohl(), htonl();
  139. #endif
  140.  
  141.  
  142. #endif /* _IN_ */
  143.