| 1 | |
| 2 | * ppp-comp.h - Definitions for doing PPP packet compression.
|
| 3 | *
|
| 4 | * Copyright 1994-1998 Paul Mackerras.
|
| 5 | *
|
| 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
|
| 12 |
|
| 13 | #include <uapi/linux/ppp-comp.h>
|
| 14 |
|
| 15 |
|
| 16 | struct module;
|
| 17 |
|
| 18 | |
| 19 | * The following symbols control whether we include code for
|
| 20 | * various compression methods.
|
| 21 |
|
| 22 |
|
| 23 | #ifndef DO_BSD_COMPRESS
|
| 24 | #define DO_BSD_COMPRESS 1
|
| 25 | #endif
|
| 26 | #ifndef DO_DEFLATE
|
| 27 | #define DO_DEFLATE 1
|
| 28 | #endif
|
| 29 | #define DO_PREDICTOR_1 0
|
| 30 | #define DO_PREDICTOR_2 0
|
| 31 |
|
| 32 | |
| 33 | * Structure giving methods for compression/decompression.
|
| 34 |
|
| 35 |
|
| 36 | struct compressor {
|
| 37 | int compress_proto;
|
| 38 |
|
| 39 |
|
| 40 | void *(*comp_alloc) (unsigned char *options, int opt_len);
|
| 41 |
|
| 42 |
|
| 43 | void (*comp_free) (void *state);
|
| 44 |
|
| 45 |
|
| 46 | int (*comp_init) (void *state, unsigned char *options,
|
| 47 | int opt_len, int unit, int opthdr, int debug);
|
| 48 |
|
| 49 |
|
| 50 | void (*comp_reset) (void *state);
|
| 51 |
|
| 52 |
|
| 53 | int (*compress) (void *state, unsigned char *rptr,
|
| 54 | unsigned char *obuf, int isize, int osize);
|
| 55 |
|
| 56 |
|
| 57 | void (*comp_stat) (void *state, struct compstat *stats);
|
| 58 |
|
| 59 |
|
| 60 | void *(*decomp_alloc) (unsigned char *options, int opt_len);
|
| 61 |
|
| 62 |
|
| 63 | void (*decomp_free) (void *state);
|
| 64 |
|
| 65 |
|
| 66 | int (*decomp_init) (void *state, unsigned char *options,
|
| 67 | int opt_len, int unit, int opthdr, int mru,
|
| 68 | int debug);
|
| 69 |
|
| 70 |
|
| 71 | void (*decomp_reset) (void *state);
|
| 72 |
|
| 73 |
|
| 74 | int (*decompress) (void *state, unsigned char *ibuf, int isize,
|
| 75 | unsigned char *obuf, int osize);
|
| 76 |
|
| 77 |
|
| 78 | void (*incomp) (void *state, unsigned char *ibuf, int icnt);
|
| 79 |
|
| 80 |
|
| 81 | void (*decomp_stat) (void *state, struct compstat *stats);
|
| 82 |
|
| 83 |
|
| 84 | struct module *owner;
|
| 85 |
|
| 86 | unsigned int comp_extra;
|
| 87 | };
|
| 88 |
|
| 89 | |
| 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.
|
| 93 | *
|
| 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.
|
| 99 |
|
| 100 |
|
| 101 | #define DECOMP_ERROR -1
|
| 102 | #define DECOMP_FATALERROR -2
|
| 103 |
|
| 104 | extern int ppp_register_compressor(struct compressor *);
|
| 105 | extern void ppp_unregister_compressor(struct compressor *);
|
| 106 | #endif
|