10 #ifndef __PION_SPDYPARSER_HEADER__ 11 #define __PION_SPDYPARSER_HEADER__ 14 #include <boost/shared_ptr.hpp> 15 #include <boost/logic/tribool.hpp> 16 #include <boost/system/error_code.hpp> 17 #include <boost/thread/once.hpp> 18 #include <pion/config.hpp> 19 #include <pion/logger.hpp> 20 #include <pion/spdy/types.hpp> 21 #include <pion/spdy/decompressor.hpp> 23 #ifndef BOOST_SYSTEM_NOEXCEPT 24 #define BOOST_SYSTEM_NOEXCEPT BOOST_NOEXCEPT 42 ERROR_INVALID_SPDY_FRAME = 1,
43 ERROR_INVALID_SPDY_VERSION,
46 ERROR_INTERNAL_SPDY_ERROR,
47 ERROR_MISSING_HEADER_DATA
52 :
public boost::system::error_category
55 const char *name()
const BOOST_SYSTEM_NOEXCEPT {
return "SPDYParser"; }
56 std::string message(
int ev)
const {
58 case ERROR_INVALID_SPDY_FRAME:
59 return "invalid spdy frame";
60 case ERROR_INVALID_SPDY_VERSION:
61 return "invalid spdy version";
62 case ERROR_DECOMPRESSION:
63 return "error in decompression";
64 case ERROR_MISSING_HEADER_DATA:
65 return "missing header data";
68 return "SPDYParser error";
87 boost::system::error_code& ec,
89 const char *packet_ptr,
90 boost::uint32_t& length_packet,
91 boost::uint32_t current_stream_count);
104 static spdy_frame_type get_spdy_frame_type(
const char *ptr);
111 static bool is_spdy_control_frame(
const char *ptr);
118 static boost::uint32_t get_control_frame_stream_id(
const char *ptr);
124 inline void set_read_ptr(
const char *ptr) { m_read_ptr = m_current_data_chunk_ptr = ptr; }
128 bool populate_frame(boost::system::error_code& ec,
130 boost::uint32_t& length_packet,
131 boost::uint32_t& stream_id,
135 static void create_error_category(
void);
140 return *m_error_category_ptr;
150 ec = boost::system::error_code(static_cast<int>(ev), get_error_category());
157 void parse_header_payload(boost::system::error_code& ec,
158 const decompressor_ptr& decompressor,
161 boost::uint32_t current_stream_count);
167 void parse_spdy_data(boost::system::error_code& ec,
169 boost::uint32_t stream_id,
176 void parse_spdy_settings_frame(boost::system::error_code& ec,
183 void parse_spdy_rst_stream(boost::system::error_code& ec,
190 void parse_spdy_ping_frame(boost::system::error_code& ec,
197 void parse_spdy_goaway_frame(boost::system::error_code& ec,
204 void parse_spdy_window_update_frame(boost::system::error_code& ec,
215 boost::tribool parse_spdy_frame(boost::system::error_code& ec,
216 const decompressor_ptr& decompressor,
218 boost::uint32_t& length_packet,
219 boost::uint32_t current_stream_count);
224 const char * m_read_ptr;
227 const char * m_uncompressed_ptr;
230 const char * m_current_data_chunk_ptr;
233 const char * m_last_data_chunk_ptr;
242 static boost::once_flag m_instance_flag;
246 typedef boost::shared_ptr<parser> parser_ptr;
static void create_error_category(void)
creates the unique parser error_category_t
void set_read_ptr(const char *ptr)
resets the read pointer
static error_category_t & get_error_category(void)
returns an instance of parser::error_category_t
const char * get_spdy_data_content()
Get the pointer to the first character to the spdy data contect.
This structure contains the HTTP Protocol information.
class-specific error category
error_value_t
class-specific error code values
static void set_error(boost::system::error_code &ec, error_value_t ev)
This structure will be tied to each SPDY frame.
const char * get_spdy_read_pointer()
Get the pointer to the first character to the spdy data contect.