3 * Portions copyright (c) 1997-1999 Symbian Ltd. All rights reserved.
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 * Definitions for internet protocol version 4.
25 * Per RFC 791, September 1981.
31 #include <libc\netinet\net_types.h>
32 #include <libc\netinet\in.h>
41 Structure of an internet header, naked of options.
43 We declare ip_len and ip_off to be short, rather than u_short
44 pragmatically since otherwise unsigned comparisons can result
45 against negative integers quite easily, and fail in subtle ways.
48 #ifdef _BIT_FIELDS_LTOH
49 u_char ip_hl:4, /* header length */
52 u_char ip_v:4, /* version */
53 ip_hl:4; /* header length */
55 u_char ip_tos; /* type of service */
56 short ip_len; /* total length */
57 u_short ip_id; /* identification */
58 short ip_off; /* fragment offset field */
59 #define IP_DF 0x4000 /* dont fragment flag */
60 #define IP_MF 0x2000 /* more fragments flag */
61 u_char ip_ttl; /* time to live */
62 u_char ip_p; /* protocol */
63 u_short ip_sum; /* checksum */
64 struct in_addr ip_src, ip_dst; /* source and dest address */
67 #define IP_MAXPACKET 65535 /* maximum packet size */
70 Definitions for IP type of service (ip_tos)
72 #define IPTOS_LOWDELAY 0x10
73 #define IPTOS_THROUGHPUT 0x08
74 #define IPTOS_RELIABILITY 0x04
77 Definitions for IP precedence (also in ip_tos) (hopefully unused)
79 #define IPTOS_PREC_NETCONTROL 0xe0
80 #define IPTOS_PREC_INTERNETCONTROL 0xc0
81 #define IPTOS_PREC_CRITIC_ECP 0xa0
82 #define IPTOS_PREC_FLASHOVERRIDE 0x80
83 #define IPTOS_PREC_FLASH 0x60
84 #define IPTOS_PREC_IMMEDIATE 0x40
85 #define IPTOS_PREC_PRIORITY 0x20
86 #define IPTOS_PREC_ROUTINE 0x00
89 Definitions for options.
91 #define IPOPT_COPIED(o) ((o)&0x80)
92 #define IPOPT_CLASS(o) ((o)&0x60)
93 #define IPOPT_NUMBER(o) ((o)&0x1f)
95 #define IPOPT_CONTROL 0x00
96 #define IPOPT_RESERVED1 0x20
97 #define IPOPT_DEBMEAS 0x40
98 #define IPOPT_RESERVED2 0x60
100 #define IPOPT_EOL 0 /* end of option list */
101 #define IPOPT_NOP 1 /* no operation */
103 #define IPOPT_RR 7 /* record packet route */
104 #define IPOPT_TS 68 /* timestamp */
105 #define IPOPT_SECURITY 130 /* provide s,c,h,tcc */
106 #define IPOPT_LSRR 131 /* loose source route */
107 #define IPOPT_SATID 136 /* satnet id */
108 #define IPOPT_SSRR 137 /* strict source route */
111 Offsets to fields in options other than EOL and NOP.
113 #define IPOPT_OPTVAL 0 /* option ID */
114 #define IPOPT_OLEN 1 /* option length */
115 #define IPOPT_OFFSET 2 /* offset within option */
116 #define IPOPT_MINOFF 4 /* min value of above */
119 Time stamp option structure.
121 struct ip_timestamp {
122 u_char ipt_code; /* IPOPT_TS */
123 u_char ipt_len; /* size of structure (variable) */
124 u_char ipt_ptr; /* index of current entry */
125 #ifdef _BIT_FIELDS_LTOH
126 u_char ipt_flg:4, /* flags, see below */
127 ipt_oflw:4; /* overflow counter */
129 u_char ipt_oflw:4, /* overflow counter */
130 ipt_flg:4; /* flags, see below */
132 union ipt_timestamp {
135 struct in_addr ipt_addr;
142 flag bits for ipt_flg
144 #define IPOPT_TS_TSONLY 0 /* timestamps only */
145 #define IPOPT_TS_TSANDADDR 1 /* timestamps and addresses */
146 #define IPOPT_TS_PRESPEC 2 /* specified modules only */
149 bits for security (not byte swapped)
151 #define IPOPT_SECUR_UNCLASS 0x0000
152 #define IPOPT_SECUR_CONFID 0xf135
153 #define IPOPT_SECUR_EFTO 0x789a
154 #define IPOPT_SECUR_MMMM 0xbc4d
155 #define IPOPT_SECUR_RESTR 0xaf13
156 #define IPOPT_SECUR_SECRET 0xd788
157 #define IPOPT_SECUR_TOPSECRET 0x6bc5
160 Internet implementation parameters.
162 #define MAXTTL 255 /* maximum time to live (seconds) */
163 #define IPFRAGTTL 60 /* time to live for frags, slowhz */
164 #define IPTTLDEC 1 /* subtracted when forwarding */
166 #define IP_MSS 576 /* default maximum segment size */
172 #endif /* _NETINET_IP_H */