Switch to SHA1 function in APR libraries
[httpd-crcsyncproxy.git] / crccache / mod_crccache_client.h
blob6ff883f7fe897d429b4b3021dfa319b2219d6b41
1 /*
2 * mod_crccache_client.h
4 * Created on: 15/03/2009
5 * Author: awulms
6 */
8 #ifndef MOD_CRCCACHE_CLIENT_H
9 #define MOD_CRCCACHE_CLIENT_H
11 #include "cache/cache.h"
12 #include <zlib.h>
13 #include <ap_config.h>
14 #include <http_config.h>
15 #include <apr_optional.h>
16 #include <apr_sha1.h>
18 extern module AP_MODULE_DECLARE_DATA crccache_client_module;
20 const char* cache_create_key( request_rec*r );
22 APR_DECLARE_OPTIONAL_FN(apr_status_t,
23 ap_cache_generate_key,
24 (request_rec *r, apr_pool_t*p, char**key ));
26 extern APR_OPTIONAL_FN_TYPE(ap_cache_generate_key) *cache_generate_key;
29 // hashes per file
30 #define FULL_BLOCK_COUNT 40
32 typedef enum decoding_state {
33 DECODING_NEW_SECTION,
34 DECODING_COMPRESSED,
35 DECODING_LITERAL_BODY,
36 DECODING_LITERAL_SIZE,
37 DECODING_HASH,
38 DECODING_BLOCK_HEADER,
39 DECODING_BLOCK
40 } decoding_state;
42 typedef enum {
43 DECOMPRESSION_INITIALIZED,
44 DECOMPRESSION_ENDED
45 } decompression_state_t;
47 typedef struct crccache_client_ctx_t {
48 apr_bucket_brigade *bb;
49 size_t block_size;
50 size_t tail_block_size;
51 apr_bucket * cached_bucket;// original data so we can fill in the matched blocks
53 decoding_state state;
54 decompression_state_t decompression_state;
55 z_stream *decompression_stream;
56 int headers_checked;
57 struct apr_sha1_ctx_t sha1_ctx;
58 unsigned char sha1_value_rx[APR_SHA1_DIGESTSIZE];
59 unsigned rx_count;
60 unsigned literal_size;
61 unsigned char * partial_literal;// original data so we can fill in the matched blocks
62 } crccache_client_ctx;
64 struct cache_enable {
65 apr_uri_t url;
66 const char *type;
67 apr_size_t pathlen;
70 struct cache_disable {
71 apr_uri_t url;
72 apr_size_t pathlen;
75 /* static information about the local cache */
76 typedef struct {
77 // from mod cache
78 apr_array_header_t *cacheenable; /* URLs to cache */
79 apr_array_header_t *cachedisable; /* URLs not to cache */
81 // from mod diskcache
82 const char* cache_root;
83 apr_size_t cache_root_len;
84 int dirlevels; /* Number of levels of subdirectories */
85 int dirlength; /* Length of subdirectory names */
86 apr_off_t minfs; /* minimum file size for cached files */
87 apr_off_t maxfs; /* maximum file size for cached files */
88 } crccache_client_conf;
90 #endif /*MOD_CRCCACHE_CLIENT_H*/