pion  5.0.6
include/pion/spdy/types.hpp
00001 // ---------------------------------------------------------------------
00002 // pion:  a Boost C++ framework for building lightweight HTTP interfaces
00003 // ---------------------------------------------------------------------
00004 // Copyright (C) 2007-2014 Splunk Inc.  (https://github.com/splunk/pion)
00005 //
00006 // Distributed under the Boost Software License, Version 1.0.
00007 // See http://www.boost.org/LICENSE_1_0.txt
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 {    // begin namespace pion
00018 namespace spdy {    // begin namespace spdy 
00019 
00020     
00021 #define MIN_SPDY_VERSION            3
00022     
00023 // The types of SPDY frames
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 
00048 typedef struct spdy_control_frame_info{
00049     bool control_bit;
00050     boost::uint16_t  version;
00051     boost::uint16_t  type;
00052     boost::uint8_t   flags;
00053     boost::uint32_t  length;  // Actually only 24 bits.
00054 } spdy_control_frame_info;
00055 
00056     
00060 typedef struct _spdy_header_info{
00061     boost::uint32_t stream_id;
00062     boost::uint8_t *header_block;
00063     boost::uint8_t  header_block_len;
00064     boost::uint16_t frame_type;
00065 } spdy_header_info;
00066 
00067 
00069 typedef struct _http_protocol_info_t{
00070     std::map<std::string, std::string> http_headers;
00071     boost::uint32_t     http_type;
00072     boost::uint32_t     stream_id;
00073     boost::uint32_t     data_offset;
00074     boost::uint32_t     data_size;
00075     bool                last_chunk;
00076     
00077     _http_protocol_info_t()
00078     : http_type(NON_SPDY),
00079     stream_id(0),
00080     data_offset(0),
00081     data_size(0),
00082     last_chunk(false){}
00083     
00084 } http_protocol_info;
00085     
00086 enum spdy_frame_type{
00087     spdy_data_frame = 1,
00088     spdy_control_frame = 2,
00089     spdy_invalid_frame = 3
00090 };
00091 
00092 
00093 }   // end namespace spdy
00094 }   // end namespace pion
00095 
00096 #endif
00097