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 this notice is preserved and that due credit is given
   7:  * to the University of California at Berkeley. The name of the University
   8:  * may not be used to endorse or promote products derived from this
   9:  * software without specific prior written permission. This software
  10:  * is provided ``as is'' without express or implied warranty.
  11:  *
  12:  *	@(#)in.h	7.5.3 (2.11BSD GTE) 1995/10/09
  13:  */
  14: 
  15: /*
  16:  * Constants and structures defined by the internet system,
  17:  * Per RFC 790, September 1981.
  18:  */
  19: 
  20: /*
  21:  * Protocols
  22:  */
  23: #define IPPROTO_IP      0       /* dummy for IP */
  24: #define IPPROTO_ICMP        1       /* control message protocol */
  25: #define IPPROTO_GGP     3       /* gateway^2 (deprecated) */
  26: #define IPPROTO_TCP     6       /* tcp */
  27: #define IPPROTO_EGP     8       /* exterior gateway protocol */
  28: #define IPPROTO_PUP     12      /* pup */
  29: #define IPPROTO_UDP     17      /* user datagram protocol */
  30: #define IPPROTO_IDP     22      /* xns idp */
  31: 
  32: #define IPPROTO_RAW     255     /* raw IP packet */
  33: #define IPPROTO_MAX     256
  34: 
  35: 
  36: /*
  37:  * Ports < IPPORT_RESERVED are reserved for
  38:  * privileged processes (e.g. root).
  39:  * Ports > IPPORT_USERRESERVED are reserved
  40:  * for servers, not necessarily privileged.
  41:  */
  42: #define IPPORT_RESERVED     1024
  43: #define IPPORT_USERRESERVED 5000
  44: 
  45: /*
  46:  * Link numbers
  47:  */
  48: #define IMPLINK_IP      155
  49: #define IMPLINK_LOWEXPER    156
  50: #define IMPLINK_HIGHEXPER   158
  51: 
  52: /*
  53:  * Internet address (a structure for historical reasons)
  54:  */
  55: struct in_addr {
  56:     u_long s_addr;
  57: };
  58: 
  59: /*
  60:  * Definitions of bits in internet address integers.
  61:  * On subnets, the decomposition of addresses to host and net parts
  62:  * is done according to subnet mask, not the masks here.
  63:  */
  64: #define IN_CLASSA(i)        (((long)(i) & 0x80000000L) == 0)
  65: #define IN_CLASSA_NET       0xff000000L
  66: #define IN_CLASSA_NSHIFT    24
  67: #define IN_CLASSA_HOST      0x00ffffffL
  68: #define IN_CLASSA_MAX       128
  69: 
  70: #define IN_CLASSB(i)        (((long)(i) & 0xc0000000L) == 0x80000000L)
  71: #define IN_CLASSB_NET       0xffff0000L
  72: #define IN_CLASSB_NSHIFT    16
  73: #define IN_CLASSB_HOST      0x0000ffffL
  74: #define IN_CLASSB_MAX       65536
  75: 
  76: #define IN_CLASSC(i)        (((long)(i) & 0xe0000000L) == 0xc0000000L)
  77: #define IN_CLASSC_NET       0xffffff00L
  78: #define IN_CLASSC_NSHIFT    8
  79: #define IN_CLASSC_HOST      0x000000ffL
  80: 
  81: #define IN_CLASSD(i)        (((long)(i) & 0xf0000000L) == 0xe0000000L)
  82: #define IN_MULTICAST(i)     IN_CLASSD(i)
  83: 
  84: #define IN_EXPERIMENTAL(i)  (((long)(i) & 0xe0000000L) == 0xe0000000L)
  85: #define IN_BADCLASS(i)      (((long)(i) & 0xf0000000L) == 0xf0000000L)
  86: 
  87: #define INADDR_ANY      0x00000000L
  88: #define INADDR_BROADCAST    0xffffffffL /* must be masked */
  89: #ifndef KERNEL
  90: #define INADDR_NONE     0xffffffffL /* -1 return */
  91: #endif
  92: 
  93: #define IN_LOOPBACKNET      127     /* official! */
  94: 
  95: /*
  96:  * Socket address, internet style.
  97:  */
  98: struct sockaddr_in {
  99:     short   sin_family;
 100:     u_short sin_port;
 101:     struct  in_addr sin_addr;
 102:     char    sin_zero[8];
 103: };
 104: 
 105: /*
 106:  * Options for use with [gs]etsockopt at the IP level.
 107:  */
 108: #define IP_OPTIONS  1       /* set/get IP per-packet options */
 109: 
 110: /*
 111:  * Definitions for inet sysctl operations.
 112:  *
 113:  * Third level is protocol number.
 114:  * Fourth level is desired variable within that protocol.
 115:  */
 116: #define IPPROTO_MAXID   (IPPROTO_IDP + 1)   /* don't list to IPPROTO_MAX */
 117: 
 118: #ifndef KERNEL
 119: #define CTL_IPPROTO_NAMES { \
 120:     { "ip", CTLTYPE_NODE }, \
 121:     { "icmp", CTLTYPE_NODE }, \
 122:     { "igmp", CTLTYPE_NODE }, \
 123:     { 0, 0 }, \
 124:     { 0, 0 }, \
 125:     { 0, 0 }, \
 126:     { "tcp", CTLTYPE_NODE }, \
 127:     { 0, 0 }, \
 128:     { 0, 0 }, \
 129:     { 0, 0 }, \
 130:     { 0, 0 }, \
 131:     { 0, 0 }, \
 132:     { 0, 0 }, \
 133:     { 0, 0 }, \
 134:     { 0, 0 }, \
 135:     { 0, 0 }, \
 136:     { 0, 0 }, \
 137:     { "udp", CTLTYPE_NODE }, \
 138:     { 0, 0 }, \
 139:     { 0, 0 }, \
 140:     { 0, 0 }, \
 141:     { 0, 0 }, \
 142:     { "idp", CTLTYPE_NODE }, \
 143: }
 144: #endif /* KERNEL */
 145: 
 146: /*
 147:  * Names for IP sysctl objects
 148:  */
 149: #define IPCTL_FORWARDING    1   /* act as router */
 150: #define IPCTL_SENDREDIRECTS 2   /* may send redirects when forwarding */
 151: #define IPCTL_DEFTTL        3   /* default TTL */
 152: #ifdef notyet
 153: #define IPCTL_DEFMTU        4   /* default MTU */
 154: #endif
 155: #define IPCTL_FORWSRCRT     5   /* forward source-routed dgrams */
 156: #define IPCTL_MAXID     6
 157: 
 158: #ifndef KERNEL
 159: #define IPCTL_NAMES { \
 160:     { 0, 0 }, \
 161:     { "forwarding", CTLTYPE_INT }, \
 162:     { "redirect", CTLTYPE_INT }, \
 163:     { "ttl", CTLTYPE_INT }, \
 164:     { "mtu", CTLTYPE_INT }, \
 165:     { "forwsrcrt", CTLTYPE_INT }, \
 166: }
 167: #endif /* KERNEL */
 168: 
 169: /*
 170:  * Macros for number representation conversion.
 171:  */
 172: u_short ntohs(), htons();
 173: u_long  ntohl(), htonl();
 174: 
 175: #ifdef SUPERVISOR
 176: extern  struct domain inetdomain;
 177: extern  struct protosw inetsw[];
 178: struct  in_addr in_makeaddr();
 179: u_long  in_netof(), in_lnaof();
 180: #endif

Defined struct's

in_addr defined in line 55; used 464 times
sockaddr_in defined in line 98; used 760 times

Defined macros

CTL_IPPROTO_NAMES defined in line 119; used 1 times
IMPLINK_HIGHEXPER defined in line 50; used 1 times
IMPLINK_LOWEXPER defined in line 49; used 1 times
INADDR_ANY defined in line 87; used 74 times
IN_BADCLASS defined in line 85; used 3 times
IN_CLASSA_MAX defined in line 68; never used
IN_CLASSB_MAX defined in line 74; never used
IN_CLASSD defined in line 81; used 1 times
  • in line 82
IN_EXPERIMENTAL defined in line 84; used 1 times
IN_LOOPBACKNET defined in line 93; used 1 times
IN_MULTICAST defined in line 82; used 1 times
IPCTL_DEFMTU defined in line 153; never used
IPCTL_DEFTTL defined in line 151; never used
IPCTL_FORWARDING defined in line 149; never used
IPCTL_FORWSRCRT defined in line 155; never used
IPCTL_MAXID defined in line 156; used 1 times
IPCTL_NAMES defined in line 159; used 1 times
IPCTL_SENDREDIRECTS defined in line 150; never used
IPPORT_USERRESERVED defined in line 43; used 1 times
IPPROTO_EGP defined in line 27; used 1 times
IPPROTO_GGP defined in line 25; used 1 times
IPPROTO_MAX defined in line 33; used 2 times
IPPROTO_MAXID defined in line 116; used 1 times
IPPROTO_PUP defined in line 28; used 1 times

Usage of this include

in.h used 184 times
Last modified: 1995-10-10
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 1223
Valid CSS Valid XHTML 1.0 Strict