OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef NET_SPDY_SPDY_FRAMER_H_ | 5 #ifndef NET_SPDY_SPDY_FRAMER_H_ |
6 #define NET_SPDY_SPDY_FRAMER_H_ | 6 #define NET_SPDY_SPDY_FRAMER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <list> | 9 #include <list> |
10 #include <map> | 10 #include <map> |
11 #include <string> | 11 #include <string> |
12 #include <utility> | 12 #include <utility> |
13 | 13 |
14 #include "base/basictypes.h" | 14 #include "base/basictypes.h" |
15 #include "base/gtest_prod_util.h" | 15 #include "base/gtest_prod_util.h" |
16 #include "base/memory/scoped_ptr.h" | 16 #include "base/memory/scoped_ptr.h" |
17 #include "net/base/net_api.h" | 17 #include "net/base/net_export.h" |
18 #include "net/base/sys_byteorder.h" | 18 #include "net/base/sys_byteorder.h" |
19 #include "net/spdy/spdy_protocol.h" | 19 #include "net/spdy/spdy_protocol.h" |
20 | 20 |
21 typedef struct z_stream_s z_stream; // Forward declaration for zlib. | 21 typedef struct z_stream_s z_stream; // Forward declaration for zlib. |
22 | 22 |
23 namespace net { | 23 namespace net { |
24 class HttpProxyClientSocketPoolTest; | 24 class HttpProxyClientSocketPoolTest; |
25 class HttpNetworkLayer; | 25 class HttpNetworkLayer; |
26 class HttpNetworkTransactionTest; | 26 class HttpNetworkTransactionTest; |
27 class SpdyHttpStreamTest; | 27 class SpdyHttpStreamTest; |
(...skipping 19 matching lines...) Expand all Loading... |
47 // SYN_STREAM or SYN_REPLY frame. | 47 // SYN_STREAM or SYN_REPLY frame. |
48 typedef std::map<std::string, std::string> SpdyHeaderBlock; | 48 typedef std::map<std::string, std::string> SpdyHeaderBlock; |
49 | 49 |
50 // A datastructure for holding a set of ID/value pairs for a SETTINGS frame. | 50 // A datastructure for holding a set of ID/value pairs for a SETTINGS frame. |
51 typedef std::pair<spdy::SettingsFlagsAndId, uint32> SpdySetting; | 51 typedef std::pair<spdy::SettingsFlagsAndId, uint32> SpdySetting; |
52 typedef std::list<SpdySetting> SpdySettings; | 52 typedef std::list<SpdySetting> SpdySettings; |
53 | 53 |
54 // SpdyFramerVisitorInterface is a set of callbacks for the SpdyFramer. | 54 // SpdyFramerVisitorInterface is a set of callbacks for the SpdyFramer. |
55 // Implement this interface to receive event callbacks as frames are | 55 // Implement this interface to receive event callbacks as frames are |
56 // decoded from the framer. | 56 // decoded from the framer. |
57 class NET_TEST SpdyFramerVisitorInterface { | 57 class NET_EXPORT_PRIVATE SpdyFramerVisitorInterface { |
58 public: | 58 public: |
59 virtual ~SpdyFramerVisitorInterface() {} | 59 virtual ~SpdyFramerVisitorInterface() {} |
60 | 60 |
61 // Called if an error is detected in the SpdyFrame protocol. | 61 // Called if an error is detected in the SpdyFrame protocol. |
62 virtual void OnError(SpdyFramer* framer) = 0; | 62 virtual void OnError(SpdyFramer* framer) = 0; |
63 | 63 |
64 // Called when a Control Frame is received. | 64 // Called when a Control Frame is received. |
65 virtual void OnControl(const SpdyControlFrame* frame) = 0; | 65 virtual void OnControl(const SpdyControlFrame* frame) = 0; |
66 | 66 |
67 // Called when data is received. | 67 // Called when data is received. |
68 // |stream_id| The stream receiving data. | 68 // |stream_id| The stream receiving data. |
69 // |data| A buffer containing the data received. | 69 // |data| A buffer containing the data received. |
70 // |len| The length of the data buffer. | 70 // |len| The length of the data buffer. |
71 // When the other side has finished sending data on this stream, | 71 // When the other side has finished sending data on this stream, |
72 // this method will be called with a zero-length buffer. | 72 // this method will be called with a zero-length buffer. |
73 virtual void OnStreamFrameData(SpdyStreamId stream_id, | 73 virtual void OnStreamFrameData(SpdyStreamId stream_id, |
74 const char* data, | 74 const char* data, |
75 size_t len) = 0; | 75 size_t len) = 0; |
76 }; | 76 }; |
77 | 77 |
78 class NET_TEST SpdyFramer { | 78 class NET_EXPORT_PRIVATE SpdyFramer { |
79 public: | 79 public: |
80 // SPDY states. | 80 // SPDY states. |
81 // TODO(mbelshe): Can we move these into the implementation | 81 // TODO(mbelshe): Can we move these into the implementation |
82 // and avoid exposing through the header. (Needed for test) | 82 // and avoid exposing through the header. (Needed for test) |
83 enum SpdyState { | 83 enum SpdyState { |
84 SPDY_ERROR, | 84 SPDY_ERROR, |
85 SPDY_DONE, | 85 SPDY_DONE, |
86 SPDY_RESET, | 86 SPDY_RESET, |
87 SPDY_AUTO_RESET, | 87 SPDY_AUTO_RESET, |
88 SPDY_READING_COMMON_HEADER, | 88 SPDY_READING_COMMON_HEADER, |
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
356 | 356 |
357 SpdyFramerVisitorInterface* visitor_; | 357 SpdyFramerVisitorInterface* visitor_; |
358 | 358 |
359 static bool compression_default_; | 359 static bool compression_default_; |
360 static int spdy_version_; | 360 static int spdy_version_; |
361 }; | 361 }; |
362 | 362 |
363 } // namespace spdy | 363 } // namespace spdy |
364 | 364 |
365 #endif // NET_SPDY_SPDY_FRAMER_H_ | 365 #endif // NET_SPDY_SPDY_FRAMER_H_ |
OLD | NEW |