- finish work on encoding api
[m6w6/ext-http] / php_http_encoding_api.h
index 4c01360b5df6f42f365ca28bc41f48c9f4da08b4..a50fc49485c9acf20fbf05a63fa5aa93bee8b044 100644 (file)
@@ -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 {
        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
@@ -96,10 +97,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