pion  5.0.6
types.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_SPDYTYPES_HEADER__
11 #define __PION_SPDYTYPES_HEADER__
12 
13 #include <map>
14 #include <pion/config.hpp>
15 
16 
17 namespace pion { // begin namespace pion
18 namespace spdy { // begin namespace spdy
19 
20 
21 #define MIN_SPDY_VERSION 3
22 
23 // The types of SPDY frames
24 #define SPDY_DATA 0
25 #define SPDY_SYN_STREAM 1
26 #define SPDY_SYN_REPLY 2
27 #define SPDY_RST_STREAM 3
28 #define SPDY_SETTINGS 4
29 #define SPDY_PING 6
30 #define SPDY_GOAWAY 7
31 #define SPDY_HEADERS 8
32 #define SPDY_WINDOW_UPDATE 9
33 #define SPDY_CREDENTIAL 10
34 #define SPDY_INVALID 11
35 
36 #define SPDY_FLAG_FIN 0x01
37 #define SPDY_FLAG_UNIDIRECTIONAL 0x02
38 
39 #define SIZE_OF_BYTE 8
40 
41 #define NON_SPDY 0
42 #define HTTP_REQUEST 1
43 #define HTTP_RESPONSE 2
44 #define HTTP_DATA 3
45 #define SPDY_CONTROL 4
46 
48 typedef struct spdy_control_frame_info{
49  bool control_bit;
50  boost::uint16_t version;
51  boost::uint16_t type;
52  boost::uint8_t flags;
53  boost::uint32_t length; // Actually only 24 bits.
55 
56 
60 typedef struct _spdy_header_info{
61  boost::uint32_t stream_id;
62  boost::uint8_t *header_block;
63  boost::uint8_t header_block_len;
64  boost::uint16_t frame_type;
66 
67 
69 typedef struct _http_protocol_info_t{
70  std::map<std::string, std::string> http_headers;
71  boost::uint32_t http_type;
72  boost::uint32_t stream_id;
73  boost::uint32_t data_offset;
74  boost::uint32_t data_size;
75  bool last_chunk;
76 
78  : http_type(NON_SPDY),
79  stream_id(0),
80  data_offset(0),
81  data_size(0),
82  last_chunk(false){}
83 
85 
86 enum spdy_frame_type{
87  spdy_data_frame = 1,
88  spdy_control_frame = 2,
89  spdy_invalid_frame = 3
90 };
91 
92 
93 } // end namespace spdy
94 } // end namespace pion
95 
96 #endif
97 
This structure contains the HTTP Protocol information.
Definition: types.hpp:69
This structure will be tied to each SPDY frame.
Definition: types.hpp:48