hce-node application  1.4.3
HCE Hierarchical Cluster Engine node application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
cf_packet_compression.h
Go to the documentation of this file.
1 /*
2  * Copyright 2013 Aerospike. All rights reserved.
3  */
4 
5 /*
6  * Function to decompress the given data
7  * Expected arguments
8  * 1. Type of compression
9  * 1 for zlib
10  * 2. Length of buffer to be decompressed - mandatory
11  * 3. Pointer to buffer to be decompressed - mandatory
12  * 4. Length of buffer to hold decompressed data - mandatory
13  * 5. Pointer to buffer to hold decompressed data - mandatory
14  */
15 int
16 cf_decompress(int argc, uint8_t **argv);
17 
18 /*
19  * Function to get back decompressed packet from CL_PROTO_TYPE_CL_MSG_COMPRESSED packet
20  * Packet : Header - Original size of message - Compressed message
21  * Input : buf - Pointer to CL_PROTO_TYPE_CL_MSG_COMPRESSED packet. - Input
22  * decompressed_packet - Pointer holding address of decompressed packet. - Output
23  */
24 int
25 cf_packet_decompression(uint8_t *buf, uint8_t *decompressed_packet);
26 
27 /*
28  * Function to compress the given data
29  * Expected arguments
30  * 1. Type of compression
31  * 1 for zlib
32  * 2. Length of buffer to be compressed - mandatory
33  * 3. Pointer to buffer to be compressed - mandatory
34  * 4. Length of buffer to hold compressed data - mandatory
35  * 5. Pointer to buffer to hold compressed data - mandatory
36  * 6. Compression level - Optional, default Z_DEFAULT_COMPRESSION
37  * Z_NO_COMPRESSION 0
38  * Z_BEST_SPEED 1
39  * Z_BEST_COMPRESSION 9
40  * Z_DEFAULT_COMPRESSION (-1)
41  */
42 int
43 cf_compress(int argc, uint8_t *argv[]);
44 
45 /*
46  * Function to create packet to send compressed data.
47  * Packet : Header - Original size of message - Compressed message.
48  * Input : buf - Pointer to data to be compressed. - Input
49  * buf_sz - Size of the data to be compressed. - Input
50  * compressed_packet : Pointer holding address of compressed packet. - Output
51  * compressed_packet_sz : Size of the compressed packet. - Output
52  */
53 int
54 cf_packet_compression(uint8_t *buf, size_t buf_sz, uint8_t **compressed_packet, size_t *compressed_packet_sz);