Merge tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost
[cris-mirror.git] / include / linux / ppp-comp.h
blob4ea1d377e1ad9d567ab22bd277652724742798d1
1 /*
2 * ppp-comp.h - Definitions for doing PPP packet compression.
4 * Copyright 1994-1998 Paul Mackerras.
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * version 2 as published by the Free Software Foundation.
9 */
10 #ifndef _NET_PPP_COMP_H
11 #define _NET_PPP_COMP_H
13 #include <uapi/linux/ppp-comp.h>
16 struct module;
19 * The following symbols control whether we include code for
20 * various compression methods.
23 #ifndef DO_BSD_COMPRESS
24 #define DO_BSD_COMPRESS 1 /* by default, include BSD-Compress */
25 #endif
26 #ifndef DO_DEFLATE
27 #define DO_DEFLATE 1 /* by default, include Deflate */
28 #endif
29 #define DO_PREDICTOR_1 0
30 #define DO_PREDICTOR_2 0
33 * Structure giving methods for compression/decompression.
36 struct compressor {
37 int compress_proto; /* CCP compression protocol number */
39 /* Allocate space for a compressor (transmit side) */
40 void *(*comp_alloc) (unsigned char *options, int opt_len);
42 /* Free space used by a compressor */
43 void (*comp_free) (void *state);
45 /* Initialize a compressor */
46 int (*comp_init) (void *state, unsigned char *options,
47 int opt_len, int unit, int opthdr, int debug);
49 /* Reset a compressor */
50 void (*comp_reset) (void *state);
52 /* Compress a packet */
53 int (*compress) (void *state, unsigned char *rptr,
54 unsigned char *obuf, int isize, int osize);
56 /* Return compression statistics */
57 void (*comp_stat) (void *state, struct compstat *stats);
59 /* Allocate space for a decompressor (receive side) */
60 void *(*decomp_alloc) (unsigned char *options, int opt_len);
62 /* Free space used by a decompressor */
63 void (*decomp_free) (void *state);
65 /* Initialize a decompressor */
66 int (*decomp_init) (void *state, unsigned char *options,
67 int opt_len, int unit, int opthdr, int mru,
68 int debug);
70 /* Reset a decompressor */
71 void (*decomp_reset) (void *state);
73 /* Decompress a packet. */
74 int (*decompress) (void *state, unsigned char *ibuf, int isize,
75 unsigned char *obuf, int osize);
77 /* Update state for an incompressible packet received */
78 void (*incomp) (void *state, unsigned char *ibuf, int icnt);
80 /* Return decompression statistics */
81 void (*decomp_stat) (void *state, struct compstat *stats);
83 /* Used in locking compressor modules */
84 struct module *owner;
85 /* Extra skb space needed by the compressor algorithm */
86 unsigned int comp_extra;
90 * The return value from decompress routine is the length of the
91 * decompressed packet if successful, otherwise DECOMP_ERROR
92 * or DECOMP_FATALERROR if an error occurred.
94 * We need to make this distinction so that we can disable certain
95 * useful functionality, namely sending a CCP reset-request as a result
96 * of an error detected after decompression. This is to avoid infringing
97 * a patent held by Motorola.
98 * Don't you just lurve software patents.
101 #define DECOMP_ERROR -1 /* error detected before decomp. */
102 #define DECOMP_FATALERROR -2 /* error detected after decomp. */
104 extern int ppp_register_compressor(struct compressor *);
105 extern void ppp_unregister_compressor(struct compressor *);
106 #endif /* _NET_PPP_COMP_H */