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