summaryrefslogtreecommitdiff
path: root/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop_ppp.h
blob: 0f158c5ad77a050fd8020fce844a4821f9c2d67e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License, Version 1.0 only
 * (the "License").  You may not use this file except in compliance
 * with the License.
 *
 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
 * or http://www.opensolaris.org/os/licensing.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
 * If applicable, add the following below this CDDL HEADER, with the
 * fields enclosed by brackets "[]" replaced with your own identifying
 * information: Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 */
/*
 * Copyright (c) 2001 by Sun Microsystems, Inc.
 * All rights reserved.
 */

#ifndef	_SNOOP_PPP_H
#define	_SNOOP_PPP_H

#pragma ident	"%Z%%M%	%I%	%E% SMI"

/*
 *  Control Protocol (LCP, IPCP, etc.) message code numbers.
 */
#define	CODE_VENDOR	0	/* Vendor Specif Code */
#define	CODE_CONFREQ	1	/* Configuration Request */
#define	CODE_CONFACK	2	/* Configuration Ack */
#define	CODE_CONFNAK	3	/* Configuration Nak */
#define	CODE_CONFREJ	4	/* Configuration Reject */
#define	CODE_TERMREQ	5	/* Termination Request */
#define	CODE_TERMACK	6	/* Termination Ack */
#define	CODE_CODEREJ	7	/* Code Reject */
/*
 * LCP specific codes.
 */
#define	CODE_PROTREJ	8	/* Protocol Reject */
#define	CODE_ECHOREQ	9	/* Echo Request */
#define	CODE_ECHOREP	10	/* Echo Reply */
#define	CODE_DISCREQ	11	/* Discard Request */
#define	CODE_IDENT	12	/* Identification */
#define	CODE_TIMEREMAIN	13	/* Time Remaining */
/*
 * CCP and ECP specific codes.
 */
#define	CODE_RESETREQ	14
#define	CODE_RESETACK	15

/*
 * CHAP codes.
 */
#define	CODE_CHALLENGE	1
#define	CODE_RESPONSE	2
#define	CODE_SUCCESS	3
#define	CODE_FAILURE	4

/*
 * PAP codes.
 */
#define	CODE_AUTHREQ	1
#define	CODE_AUTHACK	2
#define	CODE_AUTHNAK	3

/*
 * Option types for various control protocols.
 */
#define	OPT_LCP_VENDOR		0
#define	OPT_LCP_MRU		1
#define	OPT_LCP_ASYNCMAP	2
#define	OPT_LCP_AUTHTYPE	3
#define	OPT_LCP_QUALITY		4
#define	OPT_LCP_MAGICNUMBER	5
#define	OPT_LCP_PCOMPRESSION	7
#define	OPT_LCP_ACCOMPRESSION	8
#define	OPT_LCP_FCSALTERN	9
#define	OPT_LCP_SELFDESCPAD	10
#define	OPT_LCP_NUMBERED	11
#define	OPT_LCP_MULTILINKPROC	12
#define	OPT_LCP_CALLBACK	13
#define	OPT_LCP_CONNECTTIME	14
#define	OPT_LCP_COMPOUNDFRAMES	15
#define	OPT_LCP_DATAENCAP	16
#define	OPT_LCP_MRRU		17
#define	OPT_LCP_SSNHF		18
#define	OPT_LCP_EPDISC		19
#define	OPT_LCP_DCEIDENT	21
#define	OPT_LCP_MLPLUSPROC	22
#define	OPT_LCP_LINKDISC	23
#define	OPT_LCP_AUTH		24
#define	OPT_LCP_COBS		25
#define	OPT_LCP_PFXELISION	26
#define	OPT_LCP_MPHDRFMT	27
#define	OPT_LCP_I18N		28
#define	OPT_LCP_SDL		29
#define	OPT_LCP_MUXING		30

#define	OPT_IPCP_ADDRS		1
#define	OPT_IPCP_COMPRESSTYPE	2
#define	OPT_IPCP_ADDR		3
#define	OPT_IPCP_MOBILEIPV4	4
#define	OPT_IPCP_DNS1		129
#define	OPT_IPCP_NBNS1		130
#define	OPT_IPCP_DNS2		131
#define	OPT_IPCP_NBNS2		132
#define	OPT_IPCP_SUBNET		144

#define	OPT_IPV6CP_IFACEID	1
#define	OPT_IPV6CP_COMPRESSTYPE	2

#define	OPT_CCP_PROPRIETARY	0
#define	OPT_CCP_PREDICTOR1	1
#define	OPT_CCP_PREDICTOR2	2
#define	OPT_CCP_PUDDLEJUMP	3
#define	OPT_CCP_HPPPC		16
#define	OPT_CCP_STACLZS		17
#define	OPT_CCP_MPPC		18
#define	OPT_CCP_GANDALFFZA	19
#define	OPT_CCP_V42BIS		20
#define	OPT_CCP_BSDCOMP		21
#define	OPT_CCP_LZSDCP		23
#define	OPT_CCP_MAGNALINK	24
#define	OPT_CCP_DEFLATE		26

#define	OPT_ECP_PROPRIETARY	0
#define	OPT_ECP_DESE		1
#define	OPT_ECP_3DESE		2
#define	OPT_ECP_DESEBIS		3

#define	OPT_MUXCP_DEFAULTPID	1

/*
 * ppp_protoinfo_t's contain properties of PPP protocols which
 * interpret_ppp() needs in order to properly decode the protocol data.
 */
typedef struct ppp_protoinfo {
	uint16_t proto;			/* protocol number */
	char *name;			/* protocol name */
	int (*interpret_proto)();	/* interpret function */
	char *prefix;			/* string printed on detail lines */
	char *description;		/* string printed in detail header */
} ppp_protoinfo_t;


/*
 * cp_optinfo contains information on control protocol options.
 */
typedef void optformat_func_t(uchar_t *, uint8_t);
typedef struct cp_optinfo {
	uint8_t	opt_type;
	char *opt_name;
	uint8_t opt_minsize; /* min size of option, including type and len */
	optformat_func_t *opt_formatdata;
} cp_optinfo_t;


/*
 * Packet format for PPP control and authentication protocols.
 */
typedef struct ppp_pkt {
	uint8_t code;
	uint8_t id;
	uint16_t length;
} ppp_pkt_t;

/*
 * Structure of an LQR packet.
 */
typedef struct lqr_pkt {
	uint32_t lqr_magic;
	uint32_t lqr_lastoutlqrs;
	uint32_t lqr_lastoutpackets;
	uint32_t lqr_lastoutoctets;
	uint32_t lqr_peerinlqrs;
	uint32_t lqr_peerinpackets;
	uint32_t lqr_peerindiscards;
	uint32_t lqr_peerinerrors;
	uint32_t lqr_peerinoctets;
	uint32_t lqr_peeroutlqrs;
	uint32_t lqr_peeroutpackets;
	uint32_t lqr_peeroutoctets;
} lqr_pkt_t;

#endif /* _SNOOP_PPP_H */