before overlay
[unix-history] / usr / src / sys / netinet / ip.h
CommitLineData
53a5409e 1/* ip.h 1.7 81/11/14 */
6e8b2eca 2
dad64fdf
BJ
3/*
4 * Definitions for internet protocol version 4.
5 * Per RFC 791, September 1981.
6 */
7#define IPVERSION 4
8
9/*
10 * Structure of an internet header, naked of options.
11 *
53a5409e
BJ
12 * We declare ip_len and ip_off to be short, rather than u_short
13 * pragmatically since otherwise unsigned comparisons can result
14 * against negative integers quite easily, and fail in subtle ways.
dad64fdf 15 */
6e8b2eca
BJ
16struct ip {
17 u_char ip_hl:4, /* header length */
18 ip_v:4; /* version */
19 u_char ip_tos; /* type of service */
82422b42 20 short ip_len; /* total length */
6e8b2eca 21 u_short ip_id; /* identification */
82422b42 22 short ip_off; /* fragment offset field */
dad64fdf
BJ
23#define IP_DF 0x4000 /* dont fragment flag */
24#define IP_MF 0x2000 /* more fragments flag */
6e8b2eca
BJ
25 u_char ip_ttl; /* time to live */
26 u_char ip_p; /* protocol */
27 u_short ip_sum; /* checksum */
53a5409e 28 struct ip_addr ip_src,ip_dst; /* source and dest address */
0fcb2ae6
BJ
29};
30
6e8b2eca 31/*
dad64fdf
BJ
32 * Definitions for options.
33 */
34#define IPOPT_COPIED(o) ((o)&0x80)
35#define IPOPT_CLASS(o) ((o)&0x40)
36#define IPOPT_NUMBER(o) ((o)&0x3f)
37
38#define IPOPT_CONTROL 0x00
39#define IPOPT_RESERVED1 0x10
40#define IPOPT_DEBMEAS 0x20
41#define IPOPT_RESERVED2 0x30
42
43#define IPOPT_EOL 0 /* end of option list */
44#define IPOPT_NOP 1 /* no operation */
45
46#define IPOPT_RR 7 /* record packet route */
47#define IPOPT_TS 68 /* timestamp */
48#define IPOPT_SECURITY 130 /* provide s,c,h,tcc */
49#define IPOPT_LSRR 131 /* loose source route */
50#define IPOPT_SATID 136 /* satnet id */
51#define IPOPT_SSRR 137 /* strict source route */
52
53/*
54 * Time stamp option structure.
55 */
56struct ip_timestamp {
57 u_char ipt_code; /* IPOPT_TS */
58 u_char ipt_len; /* size of structure (variable) */
59 u_char ipt_ptr; /* index of current entry */
60 u_char ipt_flg:4, /* flags, see below */
61 ipt_oflw:4; /* overflow counter */
62 union {
63 n_long ipt_time[1];
64 struct ipt_ta {
d52566dd 65 struct ip_addr ipt_addr;
dad64fdf
BJ
66 n_long ipt_time;
67 } ipt_ta[1];
68 }
69};
70
71/* flag bits for ipt_flg */
72#define IPOPT_TS_TSONLY 0 /* timestamps only */
73#define IPOPT_TS_TSANDADDR 1 /* timestamps and addresses */
74#define IPOPT_TS_PRESPEC 2 /* specified modules only */
75
76/* bits for security (not byte swapped) */
77#define IPOPT_SECUR_UNCLASS 0x0000
78#define IPOPT_SECUR_CONFID 0xf135
79#define IPOPT_SECUR_EFTO 0x789a
80#define IPOPT_SECUR_MMMM 0xbc4d
81#define IPOPT_SECUR_RESTR 0xaf13
82#define IPOPT_SECUR_SECRET 0xd788
83#define IPOPT_SECUR_TOPSECRET 0x6bc5
84
dad64fdf
BJ
85/*
86 * Internet implementation parameters.
87 */
6e8b2eca 88#define MAXTTL 255 /* maximum time to live (seconds) */
dad64fdf 89#define IPFRAGTTL 15 /* time to live for frag chains */