blob: 10ac4b1159768f0304d5b738c2b6828760353766 [file] [log] [blame]
William Lallemand82fe75c2012-10-23 10:25:10 +02001/*
2 * include/types/compression.h
3 * This file defines everything related to compression.
4 *
5 * Copyright 2012 Exceliance, David Du Colombier <dducolombier@exceliance.fr>
6 William Lallemand <wlallemand@exceliance.fr>
7 *
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation, version 2.1
11 * exclusively.
12 *
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 */
22
23#ifndef _TYPES_COMP_H
24#define _TYPES_COMP_H
25
26#include <zlib.h>
27
28struct comp {
29 struct comp_algo *algos;
30 struct comp_type *types;
Willy Tarreau70737d12012-10-27 00:34:28 +020031 unsigned int offload;
William Lallemand82fe75c2012-10-23 10:25:10 +020032};
33
34struct comp_algo {
35 char *name;
36 int name_len;
37 int (*init)(void *, int);
38 int (*add_data)(void *v, const char *in_data, int in_len, char *out_data, int out_len);
39 int (*flush)(void *v, struct buffer *out, int flag);
40 int (*reset)(void *v);
41 int (*end)(void *v);
42 struct comp_algo *next;
43};
44
45union comp_ctx {
46 z_stream strm; /* zlib */
47};
48
49struct comp_type {
50 char *name;
51 int name_len;
52 struct comp_type *next;
53};
54
55
56#endif /* _TYPES_COMP_H */
57
58/*
59 * Local variables:
60 * c-indent-level: 8
61 * c-basic-offset: 8
62 * End:
63 */
64