X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-http;a=blobdiff_plain;f=php_http_encoding_api.h;h=88540334050f19cd82b8e2d8768b513d9da7a935;hp=4c01360b5df6f42f365ca28bc41f48c9f4da08b4;hb=c7b95b4b19bbde93d3f142c5653ad5b68229cfcd;hpb=7b88d9022c90eb12e5fe195af8644935141c9d68 diff --git a/php_http_encoding_api.h b/php_http_encoding_api.h index 4c01360..8854033 100644 --- a/php_http_encoding_api.h +++ b/php_http_encoding_api.h @@ -6,7 +6,7 @@ | modification, are permitted provided that the conditions mentioned | | in the accompanying LICENSE file are met. | +--------------------------------------------------------------------+ - | Copyright (c) 2004-2005, Michael Wallner | + | Copyright (c) 2004-2006, Michael Wallner | +--------------------------------------------------------------------+ */ @@ -27,19 +27,20 @@ extern PHP_MINIT_FUNCTION(http_encoding); extern PHP_RINIT_FUNCTION(http_encoding); extern PHP_RSHUTDOWN_FUNCTION(http_encoding); -/* 100% compression should be fairly good */ -#define HTTP_ENCODING_MAXTRY 100 -/* safe padding */ -#define HTTP_ENCODING_SAFPAD 28 -/* add 1% extra space in case we need to encode widely differing (binary) data */ -#define HTTP_ENCODING_BUFLEN(l) (l + (l / 100) + HTTP_ENCODING_SAFPAD) - -typedef enum { +typedef enum _http_encoding_type_t { HTTP_ENCODING_NONE, HTTP_ENCODING_GZIP, HTTP_ENCODING_DEFLATE, } http_encoding_type; +#define HTTP_INFLATE_ROUNDS 100 + +#define HTTP_DEFLATE_BUFFER_SIZE_GUESS(S) \ + (((size_t) ((double) S * (double) 1.015)) + 10 + 8 + 4 + 1) + +#define HTTP_DEFLATE_BUFFER_SIZE 0x8000 +#define HTTP_INFLATE_BUFFER_SIZE 0x1000 + #define HTTP_DEFLATE_LEVEL_DEF 0x00000000 #define HTTP_DEFLATE_LEVEL_MIN 0x00000001 #define HTTP_DEFLATE_LEVEL_MAX 0x00000002 @@ -52,13 +53,18 @@ typedef enum { #define HTTP_DEFLATE_STRATEGY_RLE 0x00000300 #define HTTP_DEFLATE_STRATEGY_FIXED 0x00000400 +#ifndef Z_FIXED +/* Z_FIXED does not exist prior 1.2.2.2 */ +# define Z_FIXED 0 +#endif + #define HTTP_INFLATE_TYPE_ZLIB 0x00000000 #define HTTP_INFLATE_TYPE_GZIP 0x00000000 #define HTTP_INFLATE_TYPE_RAW 0x00000001 #define HTTP_ENCODING_STREAM_PERSISTENT 0x01000000 -typedef struct { +typedef struct _http_encoding_stream_t { z_stream stream; int flags; void *storage; @@ -96,10 +102,11 @@ PHP_HTTP_API void _http_encoding_inflate_stream_dtor(http_encoding_stream *s TSR PHP_HTTP_API void _http_encoding_inflate_stream_free(http_encoding_stream **s TSRMLS_DC); #define http_ob_deflatehandler(o, ol, h, hl, m) _http_ob_deflatehandler((o), (ol), (h), (hl), (m) TSRMLS_CC) -void _http_ob_deflatehandler(char *, uint, char **, uint *, int TSRMLS_DC); +extern void _http_ob_deflatehandler(char *, uint, char **, uint *, int TSRMLS_DC); #define http_ob_inflatehandler(o, ol, h, hl, m) _http_ob_inflatehandler((o), (ol), (h), (hl), (m) TSRMLS_CC) -void _http_ob_inflatehandler(char *, uint, char **, uint *, int TSRMLS_DC); +extern void _http_ob_inflatehandler(char *, uint, char **, uint *, int TSRMLS_DC); + #endif /* HTTP_HAVE_ZLIB */ #endif