00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #ifndef __PION_SPDYTYPES_HEADER__
00011 #define __PION_SPDYTYPES_HEADER__
00012
00013 #include <map>
00014 #include <pion/config.hpp>
00015
00016
00017 namespace pion {
00018 namespace spdy {
00019
00020
00021 #define MIN_SPDY_VERSION 3
00022
00023
00024 #define SPDY_DATA 0
00025 #define SPDY_SYN_STREAM 1
00026 #define SPDY_SYN_REPLY 2
00027 #define SPDY_RST_STREAM 3
00028 #define SPDY_SETTINGS 4
00029 #define SPDY_PING 6
00030 #define SPDY_GOAWAY 7
00031 #define SPDY_HEADERS 8
00032 #define SPDY_WINDOW_UPDATE 9
00033 #define SPDY_CREDENTIAL 10
00034 #define SPDY_INVALID 11
00035
00036 #define SPDY_FLAG_FIN 0x01
00037 #define SPDY_FLAG_UNIDIRECTIONAL 0x02
00038
00039 #define SIZE_OF_BYTE 8
00040
00041 #define NON_SPDY 0
00042 #define HTTP_REQUEST 1
00043 #define HTTP_RESPONSE 2
00044 #define HTTP_DATA 3
00045 #define SPDY_CONTROL 4
00046
00047
00049 typedef struct _value_string {
00050 boost::uint32_t value;
00051 std::string str;
00052 } value_string;
00053
00054
00056 static const value_string rst_stream_status_names[] = {
00057 { 1, "PROTOCOL_ERROR" },
00058 { 2, "INVALID_STREAM" },
00059 { 3, "REFUSED_STREAM" },
00060 { 4, "UNSUPPORTED_VERSION" },
00061 { 5, "CANCEL" },
00062 { 6, "INTERNAL_ERROR" },
00063 { 7, "FLOW_CONTROL_ERROR" },
00064 { 8, "STREAM_IN_USE" },
00065 { 9, "STREAM_ALREADY_CLOSED" },
00066 { 10, "INVALID_CREDENTIALS" },
00067 { 11, "FRAME_TOO_LARGE" },
00068 { 12, "INVALID" },
00069 };
00070
00071
00073 typedef struct spdy_control_frame_info{
00074 bool control_bit;
00075 boost::uint16_t version;
00076 boost::uint16_t type;
00077 boost::uint8_t flags;
00078 boost::uint32_t length;
00079 } spdy_control_frame_info;
00080
00081
00085 typedef struct _spdy_header_info{
00086 boost::uint32_t stream_id;
00087 boost::uint8_t *header_block;
00088 boost::uint8_t header_block_len;
00089 boost::uint16_t frame_type;
00090 } spdy_header_info;
00091
00092
00094 typedef struct _http_protocol_info_t{
00095 std::map<std::string, std::string> http_headers;
00096 boost::uint32_t http_type;
00097 boost::uint32_t stream_id;
00098 boost::uint32_t data_offset;
00099 boost::uint32_t data_size;
00100 bool last_chunk;
00101
00102 _http_protocol_info_t()
00103 : http_type(NON_SPDY),
00104 stream_id(0),
00105 data_offset(0),
00106 data_size(0),
00107 last_chunk(false){}
00108
00109 } http_protocol_info;
00110
00111 enum spdy_frame_type{
00112 spdy_data_frame = 1,
00113 spdy_control_frame = 2,
00114 spdy_invalid_frame = 3
00115 };
00116
00117
00118 }
00119 }
00120
00121 #endif
00122