William Lallemand | 82fe75c | 2012-10-23 10:25:10 +0200 | [diff] [blame] | 1 | /* |
| 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 | |
| 28 | struct comp { |
| 29 | struct comp_algo *algos; |
| 30 | struct comp_type *types; |
| 31 | }; |
| 32 | |
| 33 | struct comp_algo { |
| 34 | char *name; |
| 35 | int name_len; |
| 36 | int (*init)(void *, int); |
| 37 | int (*add_data)(void *v, const char *in_data, int in_len, char *out_data, int out_len); |
| 38 | int (*flush)(void *v, struct buffer *out, int flag); |
| 39 | int (*reset)(void *v); |
| 40 | int (*end)(void *v); |
| 41 | struct comp_algo *next; |
| 42 | }; |
| 43 | |
| 44 | union comp_ctx { |
| 45 | z_stream strm; /* zlib */ |
| 46 | }; |
| 47 | |
| 48 | struct comp_type { |
| 49 | char *name; |
| 50 | int name_len; |
| 51 | struct comp_type *next; |
| 52 | }; |
| 53 | |
| 54 | |
| 55 | #endif /* _TYPES_COMP_H */ |
| 56 | |
| 57 | /* |
| 58 | * Local variables: |
| 59 | * c-indent-level: 8 |
| 60 | * c-basic-offset: 8 |
| 61 | * End: |
| 62 | */ |
| 63 | |