William Lallemand | 82fe75c | 2012-10-23 10:25:10 +0200 | [diff] [blame] | 1 | /* |
| 2 | * include/proto/compression.h |
| 3 | * This file defines function prototypes for compression. |
| 4 | * |
| 5 | * Copyright 2012 (C) 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 _PROTO_COMP_H |
| 24 | #define _PROTO_COMP_H |
| 25 | |
| 26 | #include <types/compression.h> |
| 27 | |
| 28 | int comp_append_type(struct comp *comp, const char *type); |
| 29 | int comp_append_algo(struct comp *comp, const char *algo); |
| 30 | |
| 31 | int http_emit_chunk_size(char *out, unsigned int chksz, int add_crlf); |
| 32 | int http_compression_buffer_init(struct session *s, struct buffer *in, struct buffer *out); |
| 33 | int http_compression_buffer_add_data(struct session *s, struct buffer *in, struct buffer *out); |
| 34 | int http_compression_buffer_end(struct session *s, struct buffer **in, struct buffer **out, int end); |
| 35 | |
William Lallemand | 1c2d622 | 2012-10-30 15:52:53 +0100 | [diff] [blame] | 36 | int identity_init(struct comp_ctx *comp_ctx, int level); |
| 37 | int identity_add_data(struct comp_ctx *comp_ctx, const char *in_data, int in_len, char *out_data, int out_len); |
| 38 | int identity_flush(struct comp_ctx *comp_ctx, struct buffer *out, int flag); |
| 39 | int identity_reset(struct comp_ctx *comp_ctx); |
| 40 | int identity_end(struct comp_ctx *comp_ctx); |
William Lallemand | 82fe75c | 2012-10-23 10:25:10 +0200 | [diff] [blame] | 41 | |
| 42 | |
| 43 | #ifdef USE_ZLIB |
| 44 | |
William Lallemand | 1c2d622 | 2012-10-30 15:52:53 +0100 | [diff] [blame] | 45 | int deflate_init(struct comp_ctx *comp_ctx, int level); |
| 46 | int deflate_add_data(struct comp_ctx *comp_ctx, const char *in_data, int in_len, char *out_data, int out_len); |
| 47 | int deflate_flush(struct comp_ctx *comp_ctx, struct buffer *out, int flag); |
| 48 | int deflate_reset(struct comp_ctx *comp_ctx); |
| 49 | int deflate_end(struct comp_ctx *comp_ctx); |
William Lallemand | 82fe75c | 2012-10-23 10:25:10 +0200 | [diff] [blame] | 50 | |
William Lallemand | 1c2d622 | 2012-10-30 15:52:53 +0100 | [diff] [blame] | 51 | int gzip_init(struct comp_ctx *comp_ctx, int level); |
| 52 | int gzip_add_data(struct comp_ctx *comp_ctx, const char *in_data, int in_len, char *out_data, int out_len); |
| 53 | int gzip_flush(struct comp_ctx *comp_ctx, struct buffer *out, int flag); |
| 54 | int gzip_reset(struct comp_ctx *comp_ctx); |
| 55 | int gzip_end(struct comp_ctx *comp_ctx); |
William Lallemand | 82fe75c | 2012-10-23 10:25:10 +0200 | [diff] [blame] | 56 | |
| 57 | #endif /* USE_ZLIB */ |
| 58 | |
| 59 | #endif /* _PROTO_COMP_H */ |
| 60 | |
| 61 | /* |
| 62 | * Local variables: |
| 63 | * c-indent-level: 8 |
| 64 | * c-basic-offset: 8 |
| 65 | * End: |
| 66 | */ |