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