Update contrib.
3 * Portions Copyright (c) 1997-2006 Nokia Corporation and/or its subsidiary(-ies).
12 * Copyright (c) 1982, 1986 Regents of the University of California.
13 * All rights reserved.
15 * Redistribution and use in source and binary forms are permitted
16 * provided that this notice is preserved and that due credit is given
17 * to the University of California at Berkeley. The name of the University
18 * may not be used to endorse or promote products derived from this
19 * software without specific prior written permission. This software
20 * is provided ``as is'' without express or implied warranty.
24 * Constants and structures defined by the internet system,
25 * Per RFC 790, September 1981.
39 #define IPPROTO_IP 0x100 /* dummy for IP */
40 #define IPPROTO_ICMP 1 /* control message protocol */
41 #define IPPROTO_IGMP 2 /* group control protocol */
42 #define IPPROTO_GGP 3 /* gateway^2 (deprecated) */
43 #define IPPROTO_ENCAP 4 /* IP in IP encapsulation */
44 #define IPPROTO_TCP 6 /* tcp */
45 #define IPPROTO_EGP 8 /* exterior gateway protocol */
46 #define IPPROTO_PUP 12 /* pup */
47 #define IPPROTO_UDP 17 /* user datagram protocol */
48 #define IPPROTO_IDP 22 /* xns idp */
49 #define IPPROTO_HELLO 63 /* "hello" routing protocol */
50 #define IPPROTO_ND 77 /* UNOFFICIAL net disk proto */
51 #define IPPROTO_EON 80 /* ISO clnp */
52 #define IPPROTO_RAW 255 /* raw IP packet */
53 #define IPPROTO_MAX 0x101
56 Port/socket numbers: network standard functions
59 #define IPPORT_DISCARD 9
60 #define IPPORT_SYSTAT 11
61 #define IPPORT_DAYTIME 13
62 #define IPPORT_NETSTAT 15
64 #define IPPORT_TELNET 23
65 #define IPPORT_SMTP 25
66 #define IPPORT_TIMESERVER 37
67 #define IPPORT_NAMESERVER 42
68 #define IPPORT_WHOIS 43
72 Port/socket numbers: host specific functions
74 #define IPPORT_TFTP 69
76 #define IPPORT_FINGER 79
77 #define IPPORT_TTYLINK 87
78 #define IPPORT_SUPDUP 95
83 #define IPPORT_EXECSERVER 512
84 #define IPPORT_LOGINSERVER 513
85 #define IPPORT_CMDSERVER 514
86 #define IPPORT_EFSSERVER 520
91 #define IPPORT_BIFFUDP 512
92 #define IPPORT_WHOSERVER 513
93 #define IPPORT_ROUTESERVER 520 /* 520+1 also used */
96 Ports < IPPORT_RESERVED are reserved for
97 privileged processes (e.g. root).
98 Ports > IPPORT_USERRESERVED are reserved
99 for servers, not necessarily privileged.
101 #define IPPORT_RESERVED 1024
102 #define IPPORT_USERRESERVED 5000
107 #define IMPLINK_IP 155
108 #define IMPLINK_LOWEXPER 156
109 #define IMPLINK_HIGHEXPER 158
113 This definition contains obsolete fields for compatibility
114 with SunOS 3.x and 4.2bsd. The presence of subnets renders
115 divisions into fixed fields misleading at best. New code
116 should use only the s_addr field.
122 struct { u_char s_b1, s_b2, s_b3, s_b4; } S_un_b;
123 struct { u_short s_w1, s_w2; } S_un_w;
130 #define s_addr S_un.S_addr /* should be used for all code */
135 #define s_host S_un.S_un_b.s_b2 /* OBSOLETE: host on imp */
140 #define s_net S_un.S_un_b.s_b1 /* OBSOLETE: network */
145 #define s_imp S_un.S_un_w.s_w2 /* OBSOLETE: imp */
150 #define s_impno S_un.S_un_b.s_b4 /* OBSOLETE: imp # */
155 #define s_lh S_un.S_un_b.s_b3 /* OBSOLETE: logical host */
159 Definitions of bits in internet address integers.
160 On subnets, the decomposition of addresses to host and net parts
161 is done according to subnet mask, not the masks here.
163 #define IN_CLASSA(i) (((long)(i) & 0x80000000) == 0)
164 #define IN_CLASSA_NET 0xff000000
165 #define IN_CLASSA_NSHIFT 24
166 #define IN_CLASSA_HOST 0x00ffffff
167 #define IN_CLASSA_MAX 128
169 #define IN_CLASSB(i) (((long)(i) & 0xc0000000) == 0x80000000)
170 #define IN_CLASSB_NET 0xffff0000
171 #define IN_CLASSB_NSHIFT 16
172 #define IN_CLASSB_HOST 0x0000ffff
173 #define IN_CLASSB_MAX 65536
175 #define IN_CLASSC(i) (((long)(i) & 0xe0000000) == 0xc0000000)
176 #define IN_CLASSC_NET 0xffffff00
177 #define IN_CLASSC_NSHIFT 8
178 #define IN_CLASSC_HOST 0x000000ff
179 #define IN_CLASSC_MAX 16777216L
181 #define IN_CLASSD(i) (((long)(i) & 0xf0000000) == 0xe0000000)
182 #define IN_CLASSD_NET 0xf0000000 /* These ones aren't really */
183 #define IN_CLASSD_NSHIFT 28 /* net and host fields, but */
184 #define IN_CLASSD_HOST 0x0fffffff /* routing needn't know. */
185 #define IN_MULTICAST(i) IN_CLASSD(i)
187 #define IN_EXPERIMENTAL(i) (((long)(i) & 0xe0000000) == 0xe0000000)
188 #define IN_BADCLASS(i) (((long)(i) & 0xf0000000) == 0xf0000000)
190 #define INADDR_ANY (u_long)0x00000000
191 #define INADDR_LOOPBACK (u_long)0x7F000001
192 #define INADDR_BROADCAST (u_long)0xffffffff /* must be masked */
194 #define INADDR_UNSPEC_GROUP (u_long)0xe0000000 /* 224.0.0.0 */
195 #define INADDR_ALLHOSTS_GROUP (u_long)0xe0000001 /* 224.0.0.1 */
196 #define INADDR_MAX_LOCAL_GROUP (u_long)0xe00000ff /* 224.0.0.255 */
198 #define INADDR_NONE INADDR_BROADCAST /* traditional, but misleading */
200 #define IN_LOOPBACKNET 127 /* official! */
203 Define a macro to stuff the loopback address into an Internet address
204 0x0100007F is htonl(INADDR_LOOPBACK) without the overhead of a function call.
206 #define IN_SET_LOOPBACK_ADDR(a) \
207 { (a)->sin_addr.s_addr = 0x0100007F; (a)->sin_family = AF_INET; }
210 Socket address, internet style.
215 struct in_addr sin_addr;
220 * Options for use with [gs]etsockopt at the IP level.
221 * NB. The negative option values below are not supported and must not
222 * be used in calls to the [gs]etsockopt() API as they will be ignored
225 #define SOL_IP 0x100 /* options for IP level */
227 #define IP_OPTIONS 0x306 /* set/get IP per-packet options */
228 #define IP_HDRINCL 0x308 /* int; header is included with data (raw) */
229 #define IP_TOS 0x309 /* int; IP type of service and precedence */
230 #define IP_TTL 0x310 /* int; IP time to live */
231 #define IP_RECVOPTS -1 /* bool; receive all IP options w/datagram */
232 #define IP_RECVRETOPTS -2 /* bool; receive IP options for response */
233 #define IP_RECVDSTADDR -3 /* bool; receive IP dst addr w/datagram */
234 #define IP_RETOPTS -4 /* ip_opts; set/get IP per-packet options */
235 #define IP_MULTICAST_IF -5 /* set/get IP multicast interface */
236 #define IP_MULTICAST_TTL -6 /* set/get IP multicast timetolive */
237 #define IP_MULTICAST_LOOP -7 /* set/get IP multicast loopback */
238 #define IP_ADD_MEMBERSHIP -8 /* add an IP group membership */
239 #define IP_DROP_MEMBERSHIP -9 /* drop an IP group membership */
241 #define IP_DEFAULT_MULTICAST_TTL 1 /* normally limit m'casts to 1 hop */
242 #define IP_DEFAULT_MULTICAST_LOOP 1 /* normally hear sends if a member */
245 Options for use with [gs]etsockopt at the TCP level.
247 #define SOL_TCP 0x106 /* options for TCP level */
249 #define TCP_SENDWINDOW 0x301 /* int: send window size in bytes */
250 #define TCP_RECVWINDOW 0x302 /* int: recv window size in bytes */
251 #define TCP_NODELAY 0x304 /* disable Nagle's algorithm */
252 #define TCP_KEEPALIVE 0x305 /* keep connections alive */
255 Argument structure for IP_ADD_MEMBERSHIP and IP_DROP_MEMBERSHIP.
260 struct in_addr imr_multiaddr; /* IP multicast address of group */
261 struct in_addr imr_interface; /* local IP address of interface */
265 EPOC32 is little-endian
269 IMPORT_C unsigned short htons(unsigned short hs);
274 IMPORT_C unsigned long htonl(unsigned long hl);
284 #endif /* _NETINET_IN_H */