xref: /titanic_50/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop_ppp.h (revision 7c478bd95313f5f23a4c958a745db2134aa03244)
1*7c478bd9Sstevel@tonic-gate /*
2*7c478bd9Sstevel@tonic-gate  * CDDL HEADER START
3*7c478bd9Sstevel@tonic-gate  *
4*7c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*7c478bd9Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
6*7c478bd9Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
7*7c478bd9Sstevel@tonic-gate  * with the License.
8*7c478bd9Sstevel@tonic-gate  *
9*7c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*7c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
11*7c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
12*7c478bd9Sstevel@tonic-gate  * and limitations under the License.
13*7c478bd9Sstevel@tonic-gate  *
14*7c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
15*7c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*7c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
17*7c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
18*7c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
19*7c478bd9Sstevel@tonic-gate  *
20*7c478bd9Sstevel@tonic-gate  * CDDL HEADER END
21*7c478bd9Sstevel@tonic-gate  */
22*7c478bd9Sstevel@tonic-gate /*
23*7c478bd9Sstevel@tonic-gate  * Copyright (c) 2001 by Sun Microsystems, Inc.
24*7c478bd9Sstevel@tonic-gate  * All rights reserved.
25*7c478bd9Sstevel@tonic-gate  */
26*7c478bd9Sstevel@tonic-gate 
27*7c478bd9Sstevel@tonic-gate #ifndef	_SNOOP_PPP_H
28*7c478bd9Sstevel@tonic-gate #define	_SNOOP_PPP_H
29*7c478bd9Sstevel@tonic-gate 
30*7c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
31*7c478bd9Sstevel@tonic-gate 
32*7c478bd9Sstevel@tonic-gate /*
33*7c478bd9Sstevel@tonic-gate  *  Control Protocol (LCP, IPCP, etc.) message code numbers.
34*7c478bd9Sstevel@tonic-gate  */
35*7c478bd9Sstevel@tonic-gate #define	CODE_VENDOR	0	/* Vendor Specif Code */
36*7c478bd9Sstevel@tonic-gate #define	CODE_CONFREQ	1	/* Configuration Request */
37*7c478bd9Sstevel@tonic-gate #define	CODE_CONFACK	2	/* Configuration Ack */
38*7c478bd9Sstevel@tonic-gate #define	CODE_CONFNAK	3	/* Configuration Nak */
39*7c478bd9Sstevel@tonic-gate #define	CODE_CONFREJ	4	/* Configuration Reject */
40*7c478bd9Sstevel@tonic-gate #define	CODE_TERMREQ	5	/* Termination Request */
41*7c478bd9Sstevel@tonic-gate #define	CODE_TERMACK	6	/* Termination Ack */
42*7c478bd9Sstevel@tonic-gate #define	CODE_CODEREJ	7	/* Code Reject */
43*7c478bd9Sstevel@tonic-gate /*
44*7c478bd9Sstevel@tonic-gate  * LCP specific codes.
45*7c478bd9Sstevel@tonic-gate  */
46*7c478bd9Sstevel@tonic-gate #define	CODE_PROTREJ	8	/* Protocol Reject */
47*7c478bd9Sstevel@tonic-gate #define	CODE_ECHOREQ	9	/* Echo Request */
48*7c478bd9Sstevel@tonic-gate #define	CODE_ECHOREP	10	/* Echo Reply */
49*7c478bd9Sstevel@tonic-gate #define	CODE_DISCREQ	11	/* Discard Request */
50*7c478bd9Sstevel@tonic-gate #define	CODE_IDENT	12	/* Identification */
51*7c478bd9Sstevel@tonic-gate #define	CODE_TIMEREMAIN	13	/* Time Remaining */
52*7c478bd9Sstevel@tonic-gate /*
53*7c478bd9Sstevel@tonic-gate  * CCP and ECP specific codes.
54*7c478bd9Sstevel@tonic-gate  */
55*7c478bd9Sstevel@tonic-gate #define	CODE_RESETREQ	14
56*7c478bd9Sstevel@tonic-gate #define	CODE_RESETACK	15
57*7c478bd9Sstevel@tonic-gate 
58*7c478bd9Sstevel@tonic-gate /*
59*7c478bd9Sstevel@tonic-gate  * CHAP codes.
60*7c478bd9Sstevel@tonic-gate  */
61*7c478bd9Sstevel@tonic-gate #define	CODE_CHALLENGE	1
62*7c478bd9Sstevel@tonic-gate #define	CODE_RESPONSE	2
63*7c478bd9Sstevel@tonic-gate #define	CODE_SUCCESS	3
64*7c478bd9Sstevel@tonic-gate #define	CODE_FAILURE	4
65*7c478bd9Sstevel@tonic-gate 
66*7c478bd9Sstevel@tonic-gate /*
67*7c478bd9Sstevel@tonic-gate  * PAP codes.
68*7c478bd9Sstevel@tonic-gate  */
69*7c478bd9Sstevel@tonic-gate #define	CODE_AUTHREQ	1
70*7c478bd9Sstevel@tonic-gate #define	CODE_AUTHACK	2
71*7c478bd9Sstevel@tonic-gate #define	CODE_AUTHNAK	3
72*7c478bd9Sstevel@tonic-gate 
73*7c478bd9Sstevel@tonic-gate /*
74*7c478bd9Sstevel@tonic-gate  * Option types for various control protocols.
75*7c478bd9Sstevel@tonic-gate  */
76*7c478bd9Sstevel@tonic-gate #define	OPT_LCP_VENDOR		0
77*7c478bd9Sstevel@tonic-gate #define	OPT_LCP_MRU		1
78*7c478bd9Sstevel@tonic-gate #define	OPT_LCP_ASYNCMAP	2
79*7c478bd9Sstevel@tonic-gate #define	OPT_LCP_AUTHTYPE	3
80*7c478bd9Sstevel@tonic-gate #define	OPT_LCP_QUALITY		4
81*7c478bd9Sstevel@tonic-gate #define	OPT_LCP_MAGICNUMBER	5
82*7c478bd9Sstevel@tonic-gate #define	OPT_LCP_PCOMPRESSION	7
83*7c478bd9Sstevel@tonic-gate #define	OPT_LCP_ACCOMPRESSION	8
84*7c478bd9Sstevel@tonic-gate #define	OPT_LCP_FCSALTERN	9
85*7c478bd9Sstevel@tonic-gate #define	OPT_LCP_SELFDESCPAD	10
86*7c478bd9Sstevel@tonic-gate #define	OPT_LCP_NUMBERED	11
87*7c478bd9Sstevel@tonic-gate #define	OPT_LCP_MULTILINKPROC	12
88*7c478bd9Sstevel@tonic-gate #define	OPT_LCP_CALLBACK	13
89*7c478bd9Sstevel@tonic-gate #define	OPT_LCP_CONNECTTIME	14
90*7c478bd9Sstevel@tonic-gate #define	OPT_LCP_COMPOUNDFRAMES	15
91*7c478bd9Sstevel@tonic-gate #define	OPT_LCP_DATAENCAP	16
92*7c478bd9Sstevel@tonic-gate #define	OPT_LCP_MRRU		17
93*7c478bd9Sstevel@tonic-gate #define	OPT_LCP_SSNHF		18
94*7c478bd9Sstevel@tonic-gate #define	OPT_LCP_EPDISC		19
95*7c478bd9Sstevel@tonic-gate #define	OPT_LCP_DCEIDENT	21
96*7c478bd9Sstevel@tonic-gate #define	OPT_LCP_MLPLUSPROC	22
97*7c478bd9Sstevel@tonic-gate #define	OPT_LCP_LINKDISC	23
98*7c478bd9Sstevel@tonic-gate #define	OPT_LCP_AUTH		24
99*7c478bd9Sstevel@tonic-gate #define	OPT_LCP_COBS		25
100*7c478bd9Sstevel@tonic-gate #define	OPT_LCP_PFXELISION	26
101*7c478bd9Sstevel@tonic-gate #define	OPT_LCP_MPHDRFMT	27
102*7c478bd9Sstevel@tonic-gate #define	OPT_LCP_I18N		28
103*7c478bd9Sstevel@tonic-gate #define	OPT_LCP_SDL		29
104*7c478bd9Sstevel@tonic-gate #define	OPT_LCP_MUXING		30
105*7c478bd9Sstevel@tonic-gate 
106*7c478bd9Sstevel@tonic-gate #define	OPT_IPCP_ADDRS		1
107*7c478bd9Sstevel@tonic-gate #define	OPT_IPCP_COMPRESSTYPE	2
108*7c478bd9Sstevel@tonic-gate #define	OPT_IPCP_ADDR		3
109*7c478bd9Sstevel@tonic-gate #define	OPT_IPCP_MOBILEIPV4	4
110*7c478bd9Sstevel@tonic-gate #define	OPT_IPCP_DNS1		129
111*7c478bd9Sstevel@tonic-gate #define	OPT_IPCP_NBNS1		130
112*7c478bd9Sstevel@tonic-gate #define	OPT_IPCP_DNS2		131
113*7c478bd9Sstevel@tonic-gate #define	OPT_IPCP_NBNS2		132
114*7c478bd9Sstevel@tonic-gate #define	OPT_IPCP_SUBNET		144
115*7c478bd9Sstevel@tonic-gate 
116*7c478bd9Sstevel@tonic-gate #define	OPT_IPV6CP_IFACEID	1
117*7c478bd9Sstevel@tonic-gate #define	OPT_IPV6CP_COMPRESSTYPE	2
118*7c478bd9Sstevel@tonic-gate 
119*7c478bd9Sstevel@tonic-gate #define	OPT_CCP_PROPRIETARY	0
120*7c478bd9Sstevel@tonic-gate #define	OPT_CCP_PREDICTOR1	1
121*7c478bd9Sstevel@tonic-gate #define	OPT_CCP_PREDICTOR2	2
122*7c478bd9Sstevel@tonic-gate #define	OPT_CCP_PUDDLEJUMP	3
123*7c478bd9Sstevel@tonic-gate #define	OPT_CCP_HPPPC		16
124*7c478bd9Sstevel@tonic-gate #define	OPT_CCP_STACLZS		17
125*7c478bd9Sstevel@tonic-gate #define	OPT_CCP_MPPC		18
126*7c478bd9Sstevel@tonic-gate #define	OPT_CCP_GANDALFFZA	19
127*7c478bd9Sstevel@tonic-gate #define	OPT_CCP_V42BIS		20
128*7c478bd9Sstevel@tonic-gate #define	OPT_CCP_BSDCOMP		21
129*7c478bd9Sstevel@tonic-gate #define	OPT_CCP_LZSDCP		23
130*7c478bd9Sstevel@tonic-gate #define	OPT_CCP_MAGNALINK	24
131*7c478bd9Sstevel@tonic-gate #define	OPT_CCP_DEFLATE		26
132*7c478bd9Sstevel@tonic-gate 
133*7c478bd9Sstevel@tonic-gate #define	OPT_ECP_PROPRIETARY	0
134*7c478bd9Sstevel@tonic-gate #define	OPT_ECP_DESE		1
135*7c478bd9Sstevel@tonic-gate #define	OPT_ECP_3DESE		2
136*7c478bd9Sstevel@tonic-gate #define	OPT_ECP_DESEBIS		3
137*7c478bd9Sstevel@tonic-gate 
138*7c478bd9Sstevel@tonic-gate #define	OPT_MUXCP_DEFAULTPID	1
139*7c478bd9Sstevel@tonic-gate 
140*7c478bd9Sstevel@tonic-gate /*
141*7c478bd9Sstevel@tonic-gate  * ppp_protoinfo_t's contain properties of PPP protocols which
142*7c478bd9Sstevel@tonic-gate  * interpret_ppp() needs in order to properly decode the protocol data.
143*7c478bd9Sstevel@tonic-gate  */
144*7c478bd9Sstevel@tonic-gate typedef struct ppp_protoinfo {
145*7c478bd9Sstevel@tonic-gate 	uint16_t proto;			/* protocol number */
146*7c478bd9Sstevel@tonic-gate 	char *name;			/* protocol name */
147*7c478bd9Sstevel@tonic-gate 	int (*interpret_proto)();	/* interpret function */
148*7c478bd9Sstevel@tonic-gate 	char *prefix;			/* string printed on detail lines */
149*7c478bd9Sstevel@tonic-gate 	char *description;		/* string printed in detail header */
150*7c478bd9Sstevel@tonic-gate } ppp_protoinfo_t;
151*7c478bd9Sstevel@tonic-gate 
152*7c478bd9Sstevel@tonic-gate 
153*7c478bd9Sstevel@tonic-gate /*
154*7c478bd9Sstevel@tonic-gate  * cp_optinfo contains information on control protocol options.
155*7c478bd9Sstevel@tonic-gate  */
156*7c478bd9Sstevel@tonic-gate typedef void optformat_func_t(uchar_t *, uint8_t);
157*7c478bd9Sstevel@tonic-gate typedef struct cp_optinfo {
158*7c478bd9Sstevel@tonic-gate 	uint8_t	opt_type;
159*7c478bd9Sstevel@tonic-gate 	char *opt_name;
160*7c478bd9Sstevel@tonic-gate 	uint8_t opt_minsize; /* min size of option, including type and len */
161*7c478bd9Sstevel@tonic-gate 	optformat_func_t *opt_formatdata;
162*7c478bd9Sstevel@tonic-gate } cp_optinfo_t;
163*7c478bd9Sstevel@tonic-gate 
164*7c478bd9Sstevel@tonic-gate 
165*7c478bd9Sstevel@tonic-gate /*
166*7c478bd9Sstevel@tonic-gate  * Packet format for PPP control and authentication protocols.
167*7c478bd9Sstevel@tonic-gate  */
168*7c478bd9Sstevel@tonic-gate typedef struct ppp_pkt {
169*7c478bd9Sstevel@tonic-gate 	uint8_t code;
170*7c478bd9Sstevel@tonic-gate 	uint8_t id;
171*7c478bd9Sstevel@tonic-gate 	uint16_t length;
172*7c478bd9Sstevel@tonic-gate } ppp_pkt_t;
173*7c478bd9Sstevel@tonic-gate 
174*7c478bd9Sstevel@tonic-gate /*
175*7c478bd9Sstevel@tonic-gate  * Structure of an LQR packet.
176*7c478bd9Sstevel@tonic-gate  */
177*7c478bd9Sstevel@tonic-gate typedef struct lqr_pkt {
178*7c478bd9Sstevel@tonic-gate 	uint32_t lqr_magic;
179*7c478bd9Sstevel@tonic-gate 	uint32_t lqr_lastoutlqrs;
180*7c478bd9Sstevel@tonic-gate 	uint32_t lqr_lastoutpackets;
181*7c478bd9Sstevel@tonic-gate 	uint32_t lqr_lastoutoctets;
182*7c478bd9Sstevel@tonic-gate 	uint32_t lqr_peerinlqrs;
183*7c478bd9Sstevel@tonic-gate 	uint32_t lqr_peerinpackets;
184*7c478bd9Sstevel@tonic-gate 	uint32_t lqr_peerindiscards;
185*7c478bd9Sstevel@tonic-gate 	uint32_t lqr_peerinerrors;
186*7c478bd9Sstevel@tonic-gate 	uint32_t lqr_peerinoctets;
187*7c478bd9Sstevel@tonic-gate 	uint32_t lqr_peeroutlqrs;
188*7c478bd9Sstevel@tonic-gate 	uint32_t lqr_peeroutpackets;
189*7c478bd9Sstevel@tonic-gate 	uint32_t lqr_peeroutoctets;
190*7c478bd9Sstevel@tonic-gate } lqr_pkt_t;
191*7c478bd9Sstevel@tonic-gate 
192*7c478bd9Sstevel@tonic-gate #endif /* _SNOOP_PPP_H */
193