blob: a2e80b801de9422beb966a1b08d8d5e9f9c5768f [file] [log] [blame]
William Lallemand82fe75c2012-10-23 10:25:10 +02001/*
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
William Lallemand072a2bf2012-11-20 17:01:01 +010028extern unsigned int compress_min_idle;
29
William Lallemand82fe75c2012-10-23 10:25:10 +020030int comp_append_type(struct comp *comp, const char *type);
31int comp_append_algo(struct comp *comp, const char *algo);
32
33int http_emit_chunk_size(char *out, unsigned int chksz, int add_crlf);
34int http_compression_buffer_init(struct session *s, struct buffer *in, struct buffer *out);
35int http_compression_buffer_add_data(struct session *s, struct buffer *in, struct buffer *out);
36int http_compression_buffer_end(struct session *s, struct buffer **in, struct buffer **out, int end);
37
William Lallemand8b52bb32012-11-16 18:06:41 +010038int identity_init(struct comp_ctx **comp_ctx, int level);
William Lallemandbf3ae612012-11-19 12:35:37 +010039int identity_add_data(struct comp_ctx *comp_ctx, const char *in_data, int in_len, struct buffer *out);
William Lallemand1c2d6222012-10-30 15:52:53 +010040int identity_flush(struct comp_ctx *comp_ctx, struct buffer *out, int flag);
41int identity_reset(struct comp_ctx *comp_ctx);
William Lallemand8b52bb32012-11-16 18:06:41 +010042int identity_end(struct comp_ctx **comp_ctx);
William Lallemand82fe75c2012-10-23 10:25:10 +020043
44
William Lallemand072a2bf2012-11-20 17:01:01 +010045
William Lallemand82fe75c2012-10-23 10:25:10 +020046#ifdef USE_ZLIB
William Lallemande3a7d992012-11-20 11:25:20 +010047extern long zlib_used_memory;
48
William Lallemand8b52bb32012-11-16 18:06:41 +010049int deflate_init(struct comp_ctx **comp_ctx, int level);
William Lallemandbf3ae612012-11-19 12:35:37 +010050int deflate_add_data(struct comp_ctx *comp_ctx, const char *in_data, int in_len, struct buffer *out);
William Lallemand1c2d6222012-10-30 15:52:53 +010051int deflate_flush(struct comp_ctx *comp_ctx, struct buffer *out, int flag);
52int deflate_reset(struct comp_ctx *comp_ctx);
William Lallemand8b52bb32012-11-16 18:06:41 +010053int deflate_end(struct comp_ctx **comp_ctx);
William Lallemand82fe75c2012-10-23 10:25:10 +020054
William Lallemand8b52bb32012-11-16 18:06:41 +010055int gzip_init(struct comp_ctx **comp_ctx, int level);
William Lallemand82fe75c2012-10-23 10:25:10 +020056#endif /* USE_ZLIB */
57
58#endif /* _PROTO_COMP_H */
59
60/*
61 * Local variables:
62 * c-indent-level: 8
63 * c-basic-offset: 8
64 * End:
65 */