1301549Spfg/*-
2301549Spfg * Copyright (c) 2007 Alexander Motin <mav@freebsd.org>
3301549Spfg * All rights reserved.
4301549Spfg *
5301549Spfg * Redistribution and use in source and binary forms, with or without
6301549Spfg * modification, are permitted provided that the following conditions
7301549Spfg * are met:
8301549Spfg * 1. Redistributions of source code must retain the above copyright
9301549Spfg *    notice unmodified, this list of conditions, and the following
10301549Spfg *    disclaimer.
11301549Spfg * 2. Redistributions in binary form must reproduce the above copyright
12301549Spfg *    notice, this list of conditions and the following disclaimer in the
13301549Spfg *    documentation and/or other materials provided with the distribution.
14301549Spfg *
15301549Spfg * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16301549Spfg * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17301549Spfg * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18301549Spfg * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19301549Spfg * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20301549Spfg * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21301549Spfg * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22301549Spfg * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23301549Spfg * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24301549Spfg * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25301549Spfg * SUCH DAMAGE.
26301549Spfg *
27301549Spfg * $FreeBSD$
28301549Spfg */
29301549Spfg
30301549Spfg/*
31301549Spfg * MPPC decompression library.
32301549Spfg * Version 1.0
33301549Spfg *
34301549Spfg * Note that Hi/Fn (later acquired by Exar Corporation) held US patents
35301549Spfg * on some implementation-critical aspects of MPPC compression.
36301549Spfg * These patents lapsed due to non-payment of fees in 2007 and by 2015
37301549Spfg * expired altogether.
38301549Spfg */
39301549Spfg
40301549Spfg#ifndef _NET_MPPC_H_
41301549Spfg#define	_NET_MPPC_H_
42301549Spfg
43301549Spfg#define	MPPC_MANDATORY_COMPRESS_FLAGS 0
44301549Spfg#define	MPPC_MANDATORY_DECOMPRESS_FLAGS 0
45301549Spfg
46301549Spfg#define	MPPC_SAVE_HISTORY 1
47301549Spfg
48301549Spfg#define	MPPC_OK 5
49301549Spfg#define	MPPC_EXPANDED 8
50301549Spfg#define	MPPC_RESTART_HISTORY 16
51301549Spfg#define	MPPC_DEST_EXHAUSTED 32
52301549Spfg
53301549Spfgextern size_t MPPC_SizeOfCompressionHistory(void);
54301549Spfgextern size_t MPPC_SizeOfDecompressionHistory(void);
55301549Spfg
56301549Spfgextern void MPPC_InitCompressionHistory(char *history);
57301549Spfgextern void MPPC_InitDecompressionHistory(char *history);
58301549Spfg
59301549Spfgextern int MPPC_Compress(u_char **src, u_char **dst, u_long *srcCnt, u_long *dstCnt, char *history, int flags, int undef);
60301549Spfgextern int MPPC_Decompress(u_char **src, u_char **dst, u_long *srcCnt, u_long *dstCnt, char *history, int flags);
61301549Spfg
62301549Spfg#endif
63