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