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