1 /* 2 * Constants and structures defined by the internet system, 3 * Per RFC 790, September 1981. 4 */ 5 6 /* 7 * Protocols 8 */ 9 #define IPPROTO_IP 0 /* dummy for IP */ 10 #define IPPROTO_ICMP 1 /* control message protocol */ 11 #define IPPROTO_GGP 2 /* gateway^2 (deprecated) */ 12 #define IPPROTO_TCP 6 /* tcp */ 13 #define IPPROTO_EGP 8 /* exterior gateway protocol */ 14 #define IPPROTO_PUP 12 /* pup */ 15 #define IPPROTO_UDP 17 /* user datagram protocol */ 16 #define IPPROTO_HMP 20 /* host monitoring protocol */ 17 #define IPPROTO_IDP 22 /* xns idp */ 18 #define IPPROTO_RDP 27 /* reliabe datagram protocol */ 19 20 #define IPPROTO_MAX 256 21 22 23 /* 24 * historical and inaccurate. See protocol .h files if you care 25 * about reserved ports. 26 */ 27 #define IPPORT_RESERVED 1024 28 29 /* 30 * Link numbers 31 */ 32 #define IMPLINK_IP 155 33 #define IMPLINK_LOWEXPER 156 34 #define IMPLINK_HIGHEXPER 158 35 36 #ifdef when_convince_berk 37 /* 38 * Internet layers for getsockopt()/setsockopt() 39 * (gaps left in case we forgot something) 40 */ 41 42 #define SOL_INPROTO 2 /* tcp/udp/hmp/rdp */ 43 #define SOL_INRAW 4 /* ip */ 44 #define SOL_INETHER 6 /* ARP, etc. */ 45 #define SOL_INIFADDR 8 /* interface addrs */ 46 #endif 47 48 /* 49 * Internet address (a structure for historical reasons) 50 */ 51 struct in_addr { 52 u_long s_addr; 53 }; 54 55 #define INADDR_ANY ((u_long) 0x00000000) 56 #define INADDR_BROADCAST ((u_long) 0xffffffff) /* must be masked */ 57 58 /* 59 * Socket address, internet style. 60 */ 61 struct sockaddr_in { 62 short sin_family; 63 u_short sin_port; 64 struct in_addr sin_addr; 65 char sin_zero[8]; 66 }; 67 68 /* 69 * Options for use with [gs]etsockopt at the IP level. 70 */ 71 #define IP_OPTIONS 1 /* set/get IP per-packet options */ 72 73 #if !defined(vax) 74 /* 75 * Macros for number representation conversion. 76 */ 77 #define ntohl(x) (x) 78 #define ntohs(x) (x) 79 #define htonl(x) (x) 80 #define htons(x) (x) 81 #endif 82 83 #ifdef KERNEL 84 extern struct domain inetdomain; 85 extern struct protosw inetsw[]; 86 struct in_addr in_makeaddr(); 87 /* 88 * Treat a sockaddr as a sockaddr_in, and retrieve the IP address 89 * associated with it. 90 */ 91 #define satoipa(x) (((struct sockaddr_in *) (x)) ->sin_addr) 92 93 #endif 94