implemented protocol decoding
[httpd-crcsyncproxy.git] / crccache / crccache.h
blobda3575ef7ad08039b267778b55e7c9fc5349bced
1 /*
2 * crccache.h
4 * Created on: 21/02/2009
5 * Author: tcollett
6 */
8 #ifndef CRCCACHE_H_
9 #define CRCCACHE_H_
11 const char * CRCCACHE_ENCODING = "crccache";
12 // hashes per file, 20x5 gives us 100 bytes, acceptable overhead
13 #define BLOCK_COUNT 20
14 const int HASH_SIZE=30; // bits per has, 30 bits is 5 bytes base 64
15 const int HASH_BASE64_SIZE_TX=5; //HASH_SIZE/6;
16 const int HASH_BASE64_SIZE_ACTUAL=8; // decoded/coded in blocks of 4 into three bytes
17 const int HASH_BASE64_SIZE_PADDING=3; // decoded/coded in blocks of 4 into three bytes
19 const int HASH_HEADER_SIZE=100;//BLOCK_COUNT*HASH_BASE64_SIZE;
22 const unsigned char ENCODING_LITERAL='L';
23 const unsigned char ENCODING_BLOCK='B';
25 const int ENCODING_LITERAL_HEADER_SIZE = 1+4;// 1 byte indicator + 4 bytes length
26 const int ENCODING_BLOCK_HEADER_SIZE = 1+1;// 1 byte indicator + 1 byte block
28 unsigned decode_30bithash(const char * source);
29 char * encode_30bithash(unsigned hash, char * target);
33 #endif /* CRCCACHE_H_ */