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