pion  5.0.6
decompressor.hpp
1 // ---------------------------------------------------------------------
2 // pion: a Boost C++ framework for building lightweight HTTP interfaces
3 // ---------------------------------------------------------------------
4 // Copyright (C) 2007-2014 Splunk Inc. (https://github.com/splunk/pion)
5 //
6 // Distributed under the Boost Software License, Version 1.0.
7 // See http://www.boost.org/LICENSE_1_0.txt
8 //
9 
10 #ifndef __PION_SPDYDECOMPRESSOR_HEADER__
11 #define __PION_SPDYDECOMPRESSOR_HEADER__
12 
13 
14 #include <boost/noncopyable.hpp>
15 #include <boost/shared_ptr.hpp>
16 #include <pion/config.hpp>
17 #include <pion/spdy/types.hpp>
18 #include <zlib.h>
19 
20 
21 namespace pion { // begin namespace pion
22 namespace spdy { // begin namespace spdy
23 
24 
28 
29 class PION_API decompressor
30 {
31 public:
32 
34  enum data_size_t {
36  MAX_UNCOMPRESSED_DATA_BUF_SIZE = 16384
37  };
38 
40  decompressor();
41 
43  ~decompressor();
44 
50  char* decompress(const char *compressed_data_ptr,
51  boost::uint32_t stream_id,
52  const spdy_control_frame_info& frame,
53  boost::uint32_t header_block_length);
54 
55 
56 protected:
57 
63  bool spdy_decompress_header(const char *compressed_data_ptr,
64  z_streamp decomp,
65  boost::uint32_t length,
66  boost::uint32_t& uncomp_length);
67 
68 
69 private:
70 
72  z_streamp m_request_zstream;
73 
75  z_streamp m_response_zstream;
76 
78  boost::uint32_t m_dictionary_id;
79 
81  boost::uint8_t m_uncompressed_header[MAX_UNCOMPRESSED_DATA_BUF_SIZE];
82 
83  // SPDY Dictionary used for zlib decompression
84  static const char SPDY_ZLIB_DICTIONARY[];
85 };
86 
88 typedef boost::shared_ptr<decompressor> decompressor_ptr;
89 
90 } // end namespace spdy
91 } // end namespace pion
92 
93 #endif
94 
data_size_t
data size constants
This structure will be tied to each SPDY frame.
Definition: types.hpp:48