* ppp-comp.h - Definitions for doing PPP packet compression.
*
* Copyright 1994-1998 Paul Mackerras.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* version 2 as published by the Free Software Foundation.
*/
#ifndef _NET_PPP_COMP_H
#define _NET_PPP_COMP_H
#include <uapi/linux/ppp-comp.h>
struct module;
* The following symbols control whether we include code for
* various compression methods.
*/
#ifndef DO_BSD_COMPRESS
#define DO_BSD_COMPRESS 1
#endif
#ifndef DO_DEFLATE
#define DO_DEFLATE 1
#endif
#define DO_PREDICTOR_1 0
#define DO_PREDICTOR_2 0
* Structure giving methods for compression/decompression.
*/
struct compressor {
int compress_proto;
void *(*comp_alloc) (unsigned char *options, int opt_len);
void (*comp_free) (void *state);
int (*comp_init) (void *state, unsigned char *options,
int opt_len, int unit, int opthdr, int debug);
void (*comp_reset) (void *state);
int (*compress) (void *state, unsigned char *rptr,
unsigned char *obuf, int isize, int osize);
void (*comp_stat) (void *state, struct compstat *stats);
void *(*decomp_alloc) (unsigned char *options, int opt_len);
void (*decomp_free) (void *state);
int (*decomp_init) (void *state, unsigned char *options,
int opt_len, int unit, int opthdr, int mru,
int debug);
void (*decomp_reset) (void *state);
int (*decompress) (void *state, unsigned char *ibuf, int isize,
unsigned char *obuf, int osize);
void (*incomp) (void *state, unsigned char *ibuf, int icnt);
void (*decomp_stat) (void *state, struct compstat *stats);
struct module *owner;
unsigned int comp_extra;
};
* The return value from decompress routine is the length of the
* decompressed packet if successful, otherwise DECOMP_ERROR
* or DECOMP_FATALERROR if an error occurred.
*
* We need to make this distinction so that we can disable certain
* useful functionality, namely sending a CCP reset-request as a result
* of an error detected after decompression. This is to avoid infringing
* a patent held by Motorola.
* Don't you just lurve software patents.
*/
#define DECOMP_ERROR -1
#define DECOMP_FATALERROR -2
extern int ppp_register_compressor(struct compressor *);
extern void ppp_unregister_compressor(struct compressor *);
#endif