xref: /freebsd/sys/net/mppc.h (revision 95ee2897e98f5d444f26ed2334cc7c439f9c16c6)
1*c3fb4252SPedro F. Giffuni /*-
2*c3fb4252SPedro F. Giffuni  * Copyright (c) 2007 Alexander Motin <mav@freebsd.org>
3*c3fb4252SPedro F. Giffuni  * All rights reserved.
4*c3fb4252SPedro F. Giffuni  *
5*c3fb4252SPedro F. Giffuni  * Redistribution and use in source and binary forms, with or without
6*c3fb4252SPedro F. Giffuni  * modification, are permitted provided that the following conditions
7*c3fb4252SPedro F. Giffuni  * are met:
8*c3fb4252SPedro F. Giffuni  * 1. Redistributions of source code must retain the above copyright
9*c3fb4252SPedro F. Giffuni  *    notice unmodified, this list of conditions, and the following
10*c3fb4252SPedro F. Giffuni  *    disclaimer.
11*c3fb4252SPedro F. Giffuni  * 2. Redistributions in binary form must reproduce the above copyright
12*c3fb4252SPedro F. Giffuni  *    notice, this list of conditions and the following disclaimer in the
13*c3fb4252SPedro F. Giffuni  *    documentation and/or other materials provided with the distribution.
14*c3fb4252SPedro F. Giffuni  *
15*c3fb4252SPedro F. Giffuni  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16*c3fb4252SPedro F. Giffuni  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17*c3fb4252SPedro F. Giffuni  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18*c3fb4252SPedro F. Giffuni  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19*c3fb4252SPedro F. Giffuni  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20*c3fb4252SPedro F. Giffuni  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21*c3fb4252SPedro F. Giffuni  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22*c3fb4252SPedro F. Giffuni  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23*c3fb4252SPedro F. Giffuni  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24*c3fb4252SPedro F. Giffuni  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25*c3fb4252SPedro F. Giffuni  * SUCH DAMAGE.
26*c3fb4252SPedro F. Giffuni  */
27*c3fb4252SPedro F. Giffuni 
28*c3fb4252SPedro F. Giffuni /*
29*c3fb4252SPedro F. Giffuni  * MPPC decompression library.
30*c3fb4252SPedro F. Giffuni  * Version 1.0
31*c3fb4252SPedro F. Giffuni  *
32*c3fb4252SPedro F. Giffuni  * Note that Hi/Fn (later acquired by Exar Corporation) held US patents
33*c3fb4252SPedro F. Giffuni  * on some implementation-critical aspects of MPPC compression.
34*c3fb4252SPedro F. Giffuni  * These patents lapsed due to non-payment of fees in 2007 and by 2015
35*c3fb4252SPedro F. Giffuni  * expired altogether.
36*c3fb4252SPedro F. Giffuni  */
37*c3fb4252SPedro F. Giffuni 
38*c3fb4252SPedro F. Giffuni #ifndef _NET_MPPC_H_
39*c3fb4252SPedro F. Giffuni #define	_NET_MPPC_H_
40*c3fb4252SPedro F. Giffuni 
41*c3fb4252SPedro F. Giffuni #define	MPPC_MANDATORY_COMPRESS_FLAGS 0
42*c3fb4252SPedro F. Giffuni #define	MPPC_MANDATORY_DECOMPRESS_FLAGS 0
43*c3fb4252SPedro F. Giffuni 
44*c3fb4252SPedro F. Giffuni #define	MPPC_SAVE_HISTORY 1
45*c3fb4252SPedro F. Giffuni 
46*c3fb4252SPedro F. Giffuni #define	MPPC_OK 5
47*c3fb4252SPedro F. Giffuni #define	MPPC_EXPANDED 8
48*c3fb4252SPedro F. Giffuni #define	MPPC_RESTART_HISTORY 16
49*c3fb4252SPedro F. Giffuni #define	MPPC_DEST_EXHAUSTED 32
50*c3fb4252SPedro F. Giffuni 
51*c3fb4252SPedro F. Giffuni extern size_t MPPC_SizeOfCompressionHistory(void);
52*c3fb4252SPedro F. Giffuni extern size_t MPPC_SizeOfDecompressionHistory(void);
53*c3fb4252SPedro F. Giffuni 
54*c3fb4252SPedro F. Giffuni extern void MPPC_InitCompressionHistory(char *history);
55*c3fb4252SPedro F. Giffuni extern void MPPC_InitDecompressionHistory(char *history);
56*c3fb4252SPedro F. Giffuni 
57*c3fb4252SPedro F. Giffuni extern int MPPC_Compress(u_char **src, u_char **dst, u_long *srcCnt, u_long *dstCnt, char *history, int flags, int undef);
58*c3fb4252SPedro F. Giffuni extern int MPPC_Decompress(u_char **src, u_char **dst, u_long *srcCnt, u_long *dstCnt, char *history, int flags);
59*c3fb4252SPedro F. Giffuni 
60*c3fb4252SPedro F. Giffuni #endif
61