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