xref: /dflybsd-src/sys/netgraph7/mppc/ng_mppc.h (revision 063536054b5ffd1aed4ef7b7eeff4251fc51ece3)
1*06353605SNuno Antunes /*
2*06353605SNuno Antunes  * ng_mppc.h
3*06353605SNuno Antunes  */
4*06353605SNuno Antunes 
5*06353605SNuno Antunes /*-
6*06353605SNuno Antunes  * Copyright (c) 1996-2000 Whistle Communications, Inc.
7*06353605SNuno Antunes  * All rights reserved.
8*06353605SNuno Antunes  *
9*06353605SNuno Antunes  * Subject to the following obligations and disclaimer of warranty, use and
10*06353605SNuno Antunes  * redistribution of this software, in source or object code forms, with or
11*06353605SNuno Antunes  * without modifications are expressly permitted by Whistle Communications;
12*06353605SNuno Antunes  * provided, however, that:
13*06353605SNuno Antunes  * 1. Any and all reproductions of the source or object code must include the
14*06353605SNuno Antunes  *    copyright notice above and the following disclaimer of warranties; and
15*06353605SNuno Antunes  * 2. No rights are granted, in any manner or form, to use Whistle
16*06353605SNuno Antunes  *    Communications, Inc. trademarks, including the mark "WHISTLE
17*06353605SNuno Antunes  *    COMMUNICATIONS" on advertising, endorsements, or otherwise except as
18*06353605SNuno Antunes  *    such appears in the above copyright notice or in the software.
19*06353605SNuno Antunes  *
20*06353605SNuno Antunes  * THIS SOFTWARE IS BEING PROVIDED BY WHISTLE COMMUNICATIONS "AS IS", AND
21*06353605SNuno Antunes  * TO THE MAXIMUM EXTENT PERMITTED BY LAW, WHISTLE COMMUNICATIONS MAKES NO
22*06353605SNuno Antunes  * REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS SOFTWARE,
23*06353605SNuno Antunes  * INCLUDING WITHOUT LIMITATION, ANY AND ALL IMPLIED WARRANTIES OF
24*06353605SNuno Antunes  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.
25*06353605SNuno Antunes  * WHISTLE COMMUNICATIONS DOES NOT WARRANT, GUARANTEE, OR MAKE ANY
26*06353605SNuno Antunes  * REPRESENTATIONS REGARDING THE USE OF, OR THE RESULTS OF THE USE OF THIS
27*06353605SNuno Antunes  * SOFTWARE IN TERMS OF ITS CORRECTNESS, ACCURACY, RELIABILITY OR OTHERWISE.
28*06353605SNuno Antunes  * IN NO EVENT SHALL WHISTLE COMMUNICATIONS BE LIABLE FOR ANY DAMAGES
29*06353605SNuno Antunes  * RESULTING FROM OR ARISING OUT OF ANY USE OF THIS SOFTWARE, INCLUDING
30*06353605SNuno Antunes  * WITHOUT LIMITATION, ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
31*06353605SNuno Antunes  * PUNITIVE, OR CONSEQUENTIAL DAMAGES, PROCUREMENT OF SUBSTITUTE GOODS OR
32*06353605SNuno Antunes  * SERVICES, LOSS OF USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY
33*06353605SNuno Antunes  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
34*06353605SNuno Antunes  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
35*06353605SNuno Antunes  * THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY
36*06353605SNuno Antunes  * OF SUCH DAMAGE.
37*06353605SNuno Antunes  *
38*06353605SNuno Antunes  * Author: Archie Cobbs <archie@freebsd.org>
39*06353605SNuno Antunes  *
40*06353605SNuno Antunes  * $Whistle: ng_mppc.h,v 1.3 2000/02/12 01:17:22 archie Exp $
41*06353605SNuno Antunes  * $FreeBSD: src/sys/netgraph/ng_mppc.h,v 1.5 2005/01/07 01:45:39 imp Exp $
42*06353605SNuno Antunes  * $DragonFly: src/sys/netgraph7/ng_mppc.h,v 1.2 2008/06/26 23:05:35 dillon Exp $
43*06353605SNuno Antunes  */
44*06353605SNuno Antunes 
45*06353605SNuno Antunes #ifndef _NETGRAPH_NG_MPPC_H_
46*06353605SNuno Antunes #define _NETGRAPH_NG_MPPC_H_
47*06353605SNuno Antunes 
48*06353605SNuno Antunes /* Node type name and magic cookie */
49*06353605SNuno Antunes #define NG_MPPC_NODE_TYPE	"mppc"
50*06353605SNuno Antunes #define NGM_MPPC_COOKIE		942886745
51*06353605SNuno Antunes 
52*06353605SNuno Antunes /* Hook names */
53*06353605SNuno Antunes #define NG_MPPC_HOOK_COMP	"comp"		/* compression hook */
54*06353605SNuno Antunes #define NG_MPPC_HOOK_DECOMP	"decomp"	/* decompression hook */
55*06353605SNuno Antunes 
56*06353605SNuno Antunes /* Length of MPPE key */
57*06353605SNuno Antunes #define MPPE_KEY_LEN		16
58*06353605SNuno Antunes 
59*06353605SNuno Antunes /* Max expansion due to MPPC header and compression algorithm */
60*06353605SNuno Antunes #define MPPC_MAX_BLOWUP(n)	((n) * 9 / 8 + 26)
61*06353605SNuno Antunes 
62*06353605SNuno Antunes /* MPPC/MPPE PPP negotiation bits */
63*06353605SNuno Antunes #define MPPC_BIT		0x00000001	/* mppc compression bits */
64*06353605SNuno Antunes #define MPPE_40			0x00000020	/* use 40 bit key */
65*06353605SNuno Antunes #define MPPE_56			0x00000080	/* use 56 bit key */
66*06353605SNuno Antunes #define MPPE_128		0x00000040	/* use 128 bit key */
67*06353605SNuno Antunes #define MPPE_BITS		0x000000e0	/* mppe encryption bits */
68*06353605SNuno Antunes #define MPPE_STATELESS		0x01000000	/* use stateless mode */
69*06353605SNuno Antunes #define MPPC_VALID_BITS		0x010000e1	/* possibly valid bits */
70*06353605SNuno Antunes 
71*06353605SNuno Antunes /* Config struct (per-direction) */
72*06353605SNuno Antunes struct ng_mppc_config {
73*06353605SNuno Antunes 	u_char		enable;			/* enable */
74*06353605SNuno Antunes 	u_int32_t	bits;			/* config bits */
75*06353605SNuno Antunes 	u_char		startkey[MPPE_KEY_LEN];	/* start key */
76*06353605SNuno Antunes };
77*06353605SNuno Antunes 
78*06353605SNuno Antunes /* Netgraph commands */
79*06353605SNuno Antunes enum {
80*06353605SNuno Antunes 	NGM_MPPC_CONFIG_COMP = 1,
81*06353605SNuno Antunes 	NGM_MPPC_CONFIG_DECOMP,
82*06353605SNuno Antunes 	NGM_MPPC_RESETREQ,			/* sent either way! */
83*06353605SNuno Antunes };
84*06353605SNuno Antunes 
85*06353605SNuno Antunes #endif /* _NETGRAPH_NG_MPPC_H_ */
86*06353605SNuno Antunes 
87