# pion::spdy::parser Class Reference

`#include <parser.hpp>`

List of all members.

## Classes

class | error_category_t
| class-specific error category More...

## Public Types

enum | error_value_t { ERROR_INVALID_SPDY_FRAME = 1, ERROR_INVALID_SPDY_VERSION, ERROR_DECOMPRESSION, ERROR_PROTOCOL_ERROR, ERROR_INTERNAL_SPDY_ERROR, ERROR_MISSING_HEADER_DATA }
| class-specific error code values

## Public Member Functions

| parser ()
| constructs a new parser object (default constructor)
| ~parser ()
| destructor
boost::tribool | parse (http_protocol_info &http_headers, boost::system::error_code &ec, decompressor_ptr &decompressor, const char *packet_ptr, boost::uint32_t &length_packet, boost::uint32_t current_stream_count)
const char * | get_spdy_data_content ()
| Get the pointer to the first character to the spdy data contect.
const char * | get_spdy_read_pointer ()
| Get the pointer to the first character to the spdy data contect.

## Static Public Member Functions

static spdy_frame_type | get_spdy_frame_type (const char *ptr)
static bool | is_spdy_control_frame (const char *ptr)
static boost::uint32_t | get_control_frame_stream_id (const char *ptr)

## Protected Member Functions

void | set_read_ptr (const char *ptr)
| resets the read pointer
bool | populate_frame (boost::system::error_code &ec, spdy_control_frame_info &frame, boost::uint32_t &length_packet, boost::uint32_t &stream_id, http_protocol_info &http_headers)
void | parse_header_payload (boost::system::error_code &ec, decompressor_ptr &decompressor, const spdy_control_frame_info &frame, http_protocol_info &http_headers, boost::uint32_t current_stream_count)
void | parse_spdy_data (boost::system::error_code &ec, const spdy_control_frame_info &frame, boost::uint32_t stream_id, http_protocol_info &http_info)
void | parse_spdy_settings_frame (boost::system::error_code &ec, const spdy_control_frame_info &frame)
void | parse_spdy_rst_stream (boost::system::error_code &ec, const spdy_control_frame_info &frame)
void | parse_spdy_ping_frame (boost::system::error_code &ec, const spdy_control_frame_info &frame)
void | parse_spdy_goaway_frame (boost::system::error_code &ec, const spdy_control_frame_info &frame)
void | parse_spdy_window_update_frame (boost::system::error_code &ec, const spdy_control_frame_info &frame)
boost::tribool | parse_spdy_frame (boost::system::error_code &ec, decompressor_ptr &decompressor, http_protocol_info &http_headers, boost::uint32_t &length_packet, boost::uint32_t current_stream_count)

## Static Protected Member Functions

static void | create_error_category (void)
| creates the unique parser error_category_t
static error_category_t & | get_error_category (void)
| returns an instance of parser::error_category_t
static void | set_error (boost::system::error_code &ec, error_value_t ev)

## Detailed Description

parser : parsers and reads the SPDY frames

Definition at line 32 of file parser.hpp.

## Member Function Documentation

boost::uint32_t pion::spdy::parser::get_control_frame_stream_id | ( | const char * | ptr | ) | `[static]`

get the stream id for the spdy control frame

Returns:
  true if it is a control frame else returns false

Definition at line 113 of file spdy_parser.cpp.

References pion::algorithm::to_uint32().

spdy_frame_type pion::spdy::parser::get_spdy_frame_type | ( | const char * | ptr | ) | `[static]`

checks if the frame is spdy frame or not

Returns:
  true if it is a frame else returns false

Definition at line 87 of file spdy_parser.cpp.

bool pion::spdy::parser::is_spdy_control_frame | ( | const char * | ptr | ) | `[static]`

checks if the frame is spdy control frame or not

Returns:
  true if it is a control frame else returns false

Definition at line 51 of file spdy_parser.cpp.

References pion::algorithm::to_uint16().

boost::tribool pion::spdy::parser::parse | ( | http_protocol_info & | http_headers,
|  | boost::system::error_code & | ec,
|  | decompressor_ptr & | decompressor,
|  | const char * | packet_ptr,
|  | boost::uint32_t & | length_packet,
|  | boost::uint32_t | current_stream_count |
| ) |  |  |

parse a SPDY packet

Returns:
  boost::tribool result of parsing: false = SPDY frame has an error, true = finished parsing SPDY frame, indeterminate = not yet finished parsing SPDY frame

Definition at line 37 of file spdy_parser.cpp.

References parse_spdy_frame(), and set_read_ptr().

void pion::spdy::parser::parse_header_payload | ( | boost::system::error_code & | ec,
|  | decompressor_ptr & | decompressor,
|  | const spdy_control_frame_info & | frame,
|  | http_protocol_info & | http_headers,
|  | boost::uint32_t | current_stream_count |
| ) |  |  | `[protected]`

parses an the header payload for SPDY

Definition at line 328 of file spdy_parser.cpp.

References set_error(), pion::algorithm::to_uint16(), and pion::algorithm::to_uint32().

Referenced by parse_spdy_frame().

void pion::spdy::parser::parse_spdy_data | ( | boost::system::error_code & | ec,
|  | const spdy_control_frame_info & | frame,
|  | boost::uint32_t | stream_id,
|  | http_protocol_info & | http_info |
| ) |  |  | `[protected]`

parses the data for SPDY

Definition at line 446 of file spdy_parser.cpp.

Referenced by parse_spdy_frame().

boost::tribool pion::spdy::parser::parse_spdy_frame | ( | boost::system::error_code & | ec,
|  | decompressor_ptr & | decompressor,
|  | http_protocol_info & | http_headers,
|  | boost::uint32_t & | length_packet,
|  | boost::uint32_t | current_stream_count |
| ) |  |  | `[protected]`

parse a SPDY frame (protected implementation)

Returns:
  boost::tribool result of parsing: false = SPDY frame has an error, true = finished parsing SPDY frame, indeterminate = not yet finished parsing SPDY frame

There was an error; No need to further parse.

Definition at line 122 of file spdy_parser.cpp.

References parse_header_payload(), parse_spdy_data(), parse_spdy_goaway_frame(), parse_spdy_ping_frame(), parse_spdy_rst_stream(), parse_spdy_settings_frame(), parse_spdy_window_update_frame(), populate_frame(), and set_error().

Referenced by parse().

void pion::spdy::parser::parse_spdy_goaway_frame | ( | boost::system::error_code & | ec,
|  | const spdy_control_frame_info & | frame |
| ) |  |  | `[protected]`

parses an the GoAway Frame for SPDY

Definition at line 518 of file spdy_parser.cpp.

References set_error(), and pion::algorithm::to_uint32().

Referenced by parse_spdy_frame().

void pion::spdy::parser::parse_spdy_ping_frame | ( | boost::system::error_code & | ec,
|  | const spdy_control_frame_info & | frame |
| ) |  |  | `[protected]`

parses an the Ping Frame for SPDY

Definition at line 492 of file spdy_parser.cpp.

References pion::algorithm::to_uint32().

Referenced by parse_spdy_frame().

void pion::spdy::parser::parse_spdy_rst_stream | ( | boost::system::error_code & | ec,
|  | const spdy_control_frame_info & | frame |
| ) |  |  | `[protected]`

parses an the RST stream for SPDY

Definition at line 457 of file spdy_parser.cpp.

References pion::algorithm::to_uint32().

Referenced by parse_spdy_frame().

void pion::spdy::parser::parse_spdy_settings_frame | ( | boost::system::error_code & | ec,
|  | const spdy_control_frame_info & | frame |
| ) |  |  | `[protected]`

parses an the Settings Frame for SPDY

Definition at line 512 of file spdy_parser.cpp.

Referenced by parse_spdy_frame().

void pion::spdy::parser::parse_spdy_window_update_frame | ( | boost::system::error_code & | ec,
|  | const spdy_control_frame_info & | frame |
| ) |  |  | `[protected]`

parses an the WindowUpdate Frame for SPDY

Definition at line 558 of file spdy_parser.cpp.

Referenced by parse_spdy_frame().

bool pion::spdy::parser::populate_frame | ( | boost::system::error_code & | ec,
|  | spdy_control_frame_info & | frame,
|  | boost::uint32_t & | length_packet,
|  | boost::uint32_t & | stream_id,
|  | http_protocol_info & | http_headers |
| ) |  |  | `[protected]`

populates the frame for every spdy packet Returns false if there was an error else returns true

Definition at line 244 of file spdy_parser.cpp.

References set_error(), pion::algorithm::to_uint16(), and pion::algorithm::to_uint32().

Referenced by parse_spdy_frame().

static void pion::spdy::parser::set_error | ( | boost::system::error_code & | ec,
|  | error_value_t | ev |
| ) |  |  | `[inline, static, protected]`

sets an error code

Parameters:

  | ec | error code variable to define
  | ev | error value to raise

Definition at line 145 of file parser.hpp.

Referenced by parse_header_payload(), parse_spdy_frame(), parse_spdy_goaway_frame(), and populate_frame().

The documentation for this class was generated from the following files:

- include/pion/spdy/parser.hpp
- src/spdy_parser.cpp