2 * INET An implementation of the TCP/IP protocol suite for the LINUX 3 * operating system. INET is implemented using the BSD Socket 4 * interface as the means of communication with the user level. 6 * Definitions of the Internet Protocol. 8 * Version: @(#)in.h 1.0.1 04/21/93 10 * Authors: Original taken from the GNU Project <netinet/in.h> file. 11 * Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG> 13 * This program is free software; you can redistribute it and/or 14 * modify it under the terms of the GNU General Public License 15 * as published by the Free Software Foundation; either version 16 * 2 of the License, or (at your option) any later version. 21 #include <linux/types.h> 23 /* Standard well-defined IP protocols. */ 25 IPPROTO_IP
=0,/* Dummy protocol for TCP */ 26 IPPROTO_ICMP
=1,/* Internet Control Message Protocol */ 27 IPPROTO_IGMP
=2,/* Internet Group Management Protocol */ 28 IPPROTO_IPIP
=4,/* IPIP tunnels (older KA9Q tunnels use 94) */ 29 IPPROTO_TCP
=6,/* Transmission Control Protocol */ 30 IPPROTO_EGP
=8,/* Exterior Gateway Protocol */ 31 IPPROTO_PUP
=12,/* PUP protocol */ 32 IPPROTO_UDP
=17,/* User Datagram Protocol */ 33 IPPROTO_IDP
=22,/* XNS IDP protocol */ 34 IPPROTO_RSVP
=46,/* RSVP protocol */ 35 IPPROTO_GRE
=47,/* Cisco GRE tunnels (rfc 1701,1702) */ 37 IPPROTO_IPV6
=41,/* IPv6-in-IPv4 tunnelling */ 39 IPPROTO_PIM
=103,/* Protocol Independent Multicast */ 41 IPPROTO_ESP
=50,/* Encapsulation Security Payload protocol */ 42 IPPROTO_AH
=51,/* Authentication Header protocol */ 43 IPPROTO_COMP
=108,/* Compression Header protocol */ 45 IPPROTO_RAW
=255,/* Raw IP packets */ 50 /* Internet address. */ 59 #define IP_ROUTER_ALERT 5 63 #define IP_PKTOPTIONS 9 64 #define IP_MTU_DISCOVER 10 69 #define IP_FREEBIND 15 71 /* BSD compatibility */ 72 #define IP_RECVRETOPTS IP_RETOPTS 74 /* IP_MTU_DISCOVER values */ 75 #define IP_PMTUDISC_DONT 0/* Never send DF frames */ 76 #define IP_PMTUDISC_WANT 1/* Use per route hints */ 77 #define IP_PMTUDISC_DO 2/* Always DF */ 79 #define IP_MULTICAST_IF 32 80 #define IP_MULTICAST_TTL 33 81 #define IP_MULTICAST_LOOP 34 82 #define IP_ADD_MEMBERSHIP 35 83 #define IP_DROP_MEMBERSHIP 36 85 /* These need to appear somewhere around here */ 86 #define IP_DEFAULT_MULTICAST_TTL 1 87 #define IP_DEFAULT_MULTICAST_LOOP 1 89 /* Request struct for multicast socket ops */ 93 struct in_addr imr_multiaddr
;/* IP multicast address of group */ 94 struct in_addr imr_interface
;/* local IP address of interface */ 99 struct in_addr imr_multiaddr
;/* IP multicast address of group */ 100 struct in_addr imr_address
;/* local IP address of interface */ 101 int imr_ifindex
;/* Interface index */ 107 struct in_addr ipi_spec_dst
; 108 struct in_addr ipi_addr
; 111 /* Structure describing an Internet (IP) socket address. */ 112 #define __SOCK_SIZE__ 16/* sizeof(struct sockaddr) */ 114 sa_family_t sin_family
;/* Address family */ 115 unsigned short int sin_port
;/* Port number */ 116 struct in_addr sin_addr
;/* Internet address */ 118 /* Pad to size of `struct sockaddr'. */ 119 unsigned char __pad
[__SOCK_SIZE__
-sizeof(short int) - 120 sizeof(unsigned short int) -sizeof(struct in_addr
)]; 122 #define sin_zero __pad/* for BSD UNIX comp. -FvK */ 126 * Definitions of the bits in an Internet address integer. 127 * On subnets, host and network parts are found according 128 * to the subnet mask, not these masks. 130 #define IN_CLASSA(a) ((((long int) (a)) & 0x80000000) == 0) 131 #define IN_CLASSA_NET 0xff000000 132 #define IN_CLASSA_NSHIFT 24 133 #define IN_CLASSA_HOST (0xffffffff & ~IN_CLASSA_NET) 134 #define IN_CLASSA_MAX 128 136 #define IN_CLASSB(a) ((((long int) (a)) & 0xc0000000) == 0x80000000) 137 #define IN_CLASSB_NET 0xffff0000 138 #define IN_CLASSB_NSHIFT 16 139 #define IN_CLASSB_HOST (0xffffffff & ~IN_CLASSB_NET) 140 #define IN_CLASSB_MAX 65536 142 #define IN_CLASSC(a) ((((long int) (a)) & 0xe0000000) == 0xc0000000) 143 #define IN_CLASSC_NET 0xffffff00 144 #define IN_CLASSC_NSHIFT 8 145 #define IN_CLASSC_HOST (0xffffffff & ~IN_CLASSC_NET) 147 #define IN_CLASSD(a) ((((long int) (a)) & 0xf0000000) == 0xe0000000) 148 #define IN_MULTICAST(a) IN_CLASSD(a) 149 #define IN_MULTICAST_NET 0xF0000000 151 #define IN_EXPERIMENTAL(a) ((((long int) (a)) & 0xf0000000) == 0xf0000000) 152 #define IN_BADCLASS(a) IN_EXPERIMENTAL((a)) 154 /* Address to accept any incoming messages. */ 155 #define INADDR_ANY ((unsigned long int) 0x00000000) 157 /* Address to send to all hosts. */ 158 #define INADDR_BROADCAST ((unsigned long int) 0xffffffff) 160 /* Address indicating an error return. */ 161 #define INADDR_NONE ((unsigned long int) 0xffffffff) 163 /* Network number for local host loopback. */ 164 #define IN_LOOPBACKNET 127 166 /* Address to loopback in software to local host. */ 167 #define INADDR_LOOPBACK 0x7f000001/* 127.0.0.1 */ 168 #define IN_LOOPBACK(a) ((((long int) (a)) & 0xff000000) == 0x7f000000) 170 /* Defines for Multicast INADDR */ 171 #define INADDR_UNSPEC_GROUP 0xe0000000U/* 224.0.0.0 */ 172 #define INADDR_ALLHOSTS_GROUP 0xe0000001U/* 224.0.0.1 */ 173 #define INADDR_ALLRTRS_GROUP 0xe0000002U/* 224.0.0.2 */ 174 #define INADDR_MAX_LOCAL_GROUP 0xe00000ffU/* 224.0.0.255 */ 177 /* <asm/byteorder.h> contains the htonl type stuff.. */ 178 #include <asm/byteorder.h> 181 /* Some random defines to make it easier in the kernel.. */ 182 #define LOOPBACK(x) (((x) & htonl(0xff000000)) == htonl(0x7f000000)) 183 #define MULTICAST(x) (((x) & htonl(0xf0000000)) == htonl(0xe0000000)) 184 #define BADCLASS(x) (((x) & htonl(0xf0000000)) == htonl(0xf0000000)) 185 #define ZERONET(x) (((x) & htonl(0xff000000)) == htonl(0x00000000)) 186 #define LOCAL_MCAST(x) (((x) & htonl(0xFFFFFF00)) == htonl(0xE0000000)) 190 #endif/* _LINUX_IN_H */