1: /*	in.h	6.4	85/03/18	*/
   2: 
   3: /*
   4:  * Constants and structures defined by the internet system,
   5:  * Per RFC 790, September 1981.
   6:  */
   7: 
   8: /*
   9:  * Protocols
  10:  */
  11: #define IPPROTO_ICMP        1       /* control message protocol */
  12: #define IPPROTO_GGP     2       /* gateway^2 (deprecated) */
  13: #define IPPROTO_TCP     6       /* tcp */
  14: #define IPPROTO_EGP     8       /* exterior gateway protocol */
  15: #define IPPROTO_PUP     12      /* pup */
  16: #define IPPROTO_UDP     17      /* user datagram protocol */
  17: 
  18: #define IPPROTO_RAW     255     /* raw IP packet */
  19: #define IPPROTO_MAX     256
  20: 
  21: 
  22: /*
  23:  * Ports < IPPORT_RESERVED are reserved for
  24:  * privileged processes (e.g. root).
  25:  */
  26: #define IPPORT_RESERVED     1024
  27: 
  28: /*
  29:  * Link numbers
  30:  */
  31: #define IMPLINK_IP      155
  32: #define IMPLINK_LOWEXPER    156
  33: #define IMPLINK_HIGHEXPER   158
  34: 
  35: /*
  36:  * Internet address (a structure for historical reasons)
  37:  */
  38: struct in_addr {
  39:     u_long s_addr;
  40: };
  41: 
  42: /*
  43:  * Definitions of bits in internet address integers.
  44:  */
  45: #define IN_CLASSA(i)        ((((long)(i))&0x80000000)==0)
  46: #define IN_CLASSA_NET       0xff000000
  47: #define IN_CLASSA_NSHIFT    24
  48: #define IN_CLASSA_HOST      0x00ffffff
  49: #define IN_CLASSA_MAX       128
  50: 
  51: #define IN_CLASSB(i)        ((((long)(i))&0xc0000000)==0x80000000)
  52: #define IN_CLASSB_NET       0xffff0000
  53: #define IN_CLASSB_NSHIFT    16
  54: #define IN_CLASSB_HOST      0x0000ffff
  55: #define IN_CLASSB_MAX       65536
  56: 
  57: #define IN_CLASSC(i)        ((((long)(i))&0xc0000000)==0xc0000000)
  58: #define IN_CLASSC_NET       0xffffff00
  59: #define IN_CLASSC_NSHIFT    8
  60: #define IN_CLASSC_HOST      0x000000ff
  61: 
  62: #define INADDR_ANY      0x00000000
  63: #define INADDR_BROADCAST    0xffffffff
  64: 
  65: /*
  66:  * Macros for subnetworks.  A subnet is distinguished by
  67:  * 	(1) the network number is a `local' network number, and
  68:  *	(2) the most significant bit of the host part is set.
  69:  * Such addresses include one additional byte in the network number,
  70:  * and use one less byte in the host part (i.e., a subnet of a Class A
  71:  * network uses the rules for Class B net/host number extraction,
  72:  * a Class B subnet is dealt with as if it were a Class C net).
  73:  * Subnets of Class C nets are not supported.
  74:  */
  75: #define SUBNETSHIFT     8  /* used to get main net number from subnet */
  76: 
  77: #define IN_SUBNETA(i)       ((((long)(i))&0x80800000)==0x00800000)
  78: #define IN_CLASSA_SUBNET    0xffff0000
  79: #define IN_CLASSA_SUBNSHIFT (IN_CLASSA_NSHIFT - SUBNETSHIFT)
  80: #define IN_CLASSA_SUBHOST   0x0000ffff
  81: 
  82: #define IN_SUBNETB(i)       ((((long)(i))&0xc0008000)==0x80008000)
  83: #define IN_CLASSB_SUBNET    0xffffff00
  84: #define IN_CLASSB_SUBNSHIFT (IN_CLASSB_NSHIFT - SUBNETSHIFT)
  85: #define IN_CLASSA_SUBHOST   0x0000ffff
  86: #define IN_CLASSB_SUBHOST   0x000000ff
  87: 
  88: /*
  89:  * Socket address, internet style.
  90:  */
  91: struct sockaddr_in {
  92:     short   sin_family;
  93:     u_short sin_port;
  94:     struct  in_addr sin_addr;
  95:     char    sin_zero[8];
  96: };
  97: 
  98: #if !defined(vax)
  99: /*
 100:  * Macros for number representation conversion.
 101:  */
 102: #define ntohl(x)    (x)
 103: #define ntohs(x)    (x)
 104: #define htonl(x)    (x)
 105: #define htons(x)    (x)
 106: #endif
 107: 
 108: #ifdef KERNEL
 109: extern  struct domain inetdomain;
 110: extern  struct protosw inetsw[];
 111: struct  in_addr in_makeaddr();
 112: #endif

Defined struct's

in_addr defined in line 38; used 4 times
sockaddr_in defined in line 91; never used

Defined macros

IMPLINK_HIGHEXPER defined in line 33; never used
IMPLINK_IP defined in line 31; never used
IMPLINK_LOWEXPER defined in line 32; never used
INADDR_ANY defined in line 62; never used
INADDR_BROADCAST defined in line 63; never used
IN_CLASSA defined in line 45; never used
IN_CLASSA_HOST defined in line 48; never used
IN_CLASSA_MAX defined in line 49; never used
IN_CLASSA_NET defined in line 46; never used
IN_CLASSA_NSHIFT defined in line 47; used 1 times
  • in line 79
IN_CLASSA_SUBHOST defined in line 85; never used
IN_CLASSA_SUBNET defined in line 78; never used
IN_CLASSA_SUBNSHIFT defined in line 79; never used
IN_CLASSB defined in line 51; never used
IN_CLASSB_HOST defined in line 54; never used
IN_CLASSB_MAX defined in line 55; never used
IN_CLASSB_NET defined in line 52; never used
IN_CLASSB_NSHIFT defined in line 53; used 1 times
  • in line 84
IN_CLASSB_SUBHOST defined in line 86; never used
IN_CLASSB_SUBNET defined in line 83; never used
IN_CLASSB_SUBNSHIFT defined in line 84; never used
IN_CLASSC defined in line 57; never used
IN_CLASSC_HOST defined in line 60; never used
IN_CLASSC_NET defined in line 58; never used
IN_CLASSC_NSHIFT defined in line 59; never used
IN_SUBNETA defined in line 77; never used
IN_SUBNETB defined in line 82; never used
IPPORT_RESERVED defined in line 26; never used
IPPROTO_EGP defined in line 14; never used
IPPROTO_GGP defined in line 12; never used
IPPROTO_ICMP defined in line 11; never used
IPPROTO_MAX defined in line 19; never used
IPPROTO_PUP defined in line 15; never used
IPPROTO_RAW defined in line 18; never used
IPPROTO_TCP defined in line 13; never used
IPPROTO_UDP defined in line 16; never used
SUBNETSHIFT defined in line 75; used 2 times
htonl defined in line 104; never used
htons defined in line 105; never used
ntohl defined in line 102; never used
ntohs defined in line 103; never used
Last modified: 1986-03-21
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 392
Valid CSS Valid XHTML 1.0 Strict