| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_TOOLS_FLIP_SERVER_SPDY_INTERFACE_H_ | 5 #ifndef NET_TOOLS_FLIP_SERVER_SPDY_INTERFACE_H_ |
| 6 #define NET_TOOLS_FLIP_SERVER_SPDY_INTERFACE_H_ | 6 #define NET_TOOLS_FLIP_SERVER_SPDY_INTERFACE_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 | 27 |
| 28 class FlipAcceptor; | 28 class FlipAcceptor; |
| 29 class MemoryCache; | 29 class MemoryCache; |
| 30 | 30 |
| 31 class SpdySM : public BufferedSpdyFramerVisitorInterface, public SMInterface { | 31 class SpdySM : public BufferedSpdyFramerVisitorInterface, public SMInterface { |
| 32 public: | 32 public: |
| 33 SpdySM(SMConnection* connection, | 33 SpdySM(SMConnection* connection, |
| 34 SMInterface* sm_http_interface, | 34 SMInterface* sm_http_interface, |
| 35 EpollServer* epoll_server, | 35 EpollServer* epoll_server, |
| 36 MemoryCache* memory_cache, | 36 MemoryCache* memory_cache, |
| 37 FlipAcceptor* acceptor, | 37 FlipAcceptor* acceptor); |
| 38 SpdyMajorVersion spdy_version); | |
| 39 ~SpdySM() override; | 38 ~SpdySM() override; |
| 40 | 39 |
| 41 void InitSMInterface(SMInterface* sm_http_interface, | 40 void InitSMInterface(SMInterface* sm_http_interface, |
| 42 int32_t server_idx) override {} | 41 int32_t server_idx) override {} |
| 43 | 42 |
| 44 void InitSMConnection(SMConnectionPoolInterface* connection_pool, | 43 void InitSMConnection(SMConnectionPoolInterface* connection_pool, |
| 45 SMInterface* sm_interface, | 44 SMInterface* sm_interface, |
| 46 EpollServer* epoll_server, | 45 EpollServer* epoll_server, |
| 47 int fd, | 46 int fd, |
| 48 std::string server_ip, | 47 std::string server_ip, |
| 49 std::string server_port, | 48 std::string server_port, |
| 50 std::string remote_ip, | 49 std::string remote_ip, |
| 51 bool use_ssl) override; | 50 bool use_ssl) override; |
| 52 | 51 |
| 53 // Create new SPDY framer after reusing SpdySM and negotiating new version | 52 // Create new SPDY framer after reusing SpdySM and negotiating new version |
| 54 void CreateFramer(SpdyMajorVersion spdy_version); | 53 void CreateFramer(); |
| 55 | 54 |
| 56 private: | 55 private: |
| 57 void set_is_request() override {} | 56 void set_is_request() override {} |
| 58 SMInterface* NewConnectionInterface(); | 57 SMInterface* NewConnectionInterface(); |
| 59 // virtual for tests | 58 // virtual for tests |
| 60 virtual SMInterface* FindOrMakeNewSMConnectionInterface( | 59 virtual SMInterface* FindOrMakeNewSMConnectionInterface( |
| 61 const std::string& server_ip, | 60 const std::string& server_ip, |
| 62 const std::string& server_port); | 61 const std::string& server_port); |
| 63 int SpdyHandleNewStream(SpdyStreamId stream_id, | 62 int SpdyHandleNewStream(SpdyStreamId stream_id, |
| 64 SpdyPriority priority, | 63 SpdyPriority priority, |
| 65 const SpdyHeaderBlock& headers, | 64 const SpdyHeaderBlock& headers, |
| 66 std::string& http_data, | 65 std::string& http_data, |
| 67 bool* is_https_scheme); | 66 bool* is_https_scheme); |
| 68 | 67 |
| 69 // BufferedSpdyFramerVisitorInterface: | 68 // BufferedSpdyFramerVisitorInterface: |
| 70 void OnError(SpdyFramer::SpdyError error_code) override {} | 69 void OnError(SpdyFramer::SpdyError error_code) override {} |
| 71 void OnStreamError(SpdyStreamId stream_id, | 70 void OnStreamError(SpdyStreamId stream_id, |
| 72 const std::string& description) override {} | 71 const std::string& description) override {} |
| 73 // Called after all the header data for SYN_STREAM control frame is received. | |
| 74 void OnSynStream(SpdyStreamId stream_id, | |
| 75 SpdyStreamId associated_stream_id, | |
| 76 SpdyPriority priority, | |
| 77 bool fin, | |
| 78 bool unidirectional, | |
| 79 const SpdyHeaderBlock& headers) override; | |
| 80 | |
| 81 // Called after all the header data for SYN_REPLY control frame is received. | |
| 82 void OnSynReply(SpdyStreamId stream_id, | |
| 83 bool fin, | |
| 84 const SpdyHeaderBlock& headers) override; | |
| 85 | 72 |
| 86 // Called after all the header data for HEADERS control frame is received. | 73 // Called after all the header data for HEADERS control frame is received. |
| 87 void OnHeaders(SpdyStreamId stream_id, | 74 void OnHeaders(SpdyStreamId stream_id, |
| 88 bool has_priority, | 75 bool has_priority, |
| 89 int weight, | 76 int weight, |
| 90 SpdyStreamId parent_stream_id, | 77 SpdyStreamId parent_stream_id, |
| 91 bool exclusive, | 78 bool exclusive, |
| 92 bool fin, | 79 bool fin, |
| 93 const SpdyHeaderBlock& headers) override; | 80 const SpdyHeaderBlock& headers) override; |
| 94 | 81 |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 BufferedSpdyFramer* spdy_framer() { return buffered_spdy_framer_.get(); } | 171 BufferedSpdyFramer* spdy_framer() { return buffered_spdy_framer_.get(); } |
| 185 | 172 |
| 186 const OutputOrdering& output_ordering() const { | 173 const OutputOrdering& output_ordering() const { |
| 187 return client_output_ordering_; | 174 return client_output_ordering_; |
| 188 } | 175 } |
| 189 | 176 |
| 190 static std::string forward_ip_header() { return forward_ip_header_; } | 177 static std::string forward_ip_header() { return forward_ip_header_; } |
| 191 static void set_forward_ip_header(const std::string& value) { | 178 static void set_forward_ip_header(const std::string& value) { |
| 192 forward_ip_header_ = value; | 179 forward_ip_header_ = value; |
| 193 } | 180 } |
| 194 SpdyMajorVersion spdy_version() const { | |
| 195 DCHECK(buffered_spdy_framer_); | |
| 196 return buffered_spdy_framer_->protocol_version(); | |
| 197 } | |
| 198 | 181 |
| 199 private: | 182 private: |
| 200 void SendEOFImpl(uint32_t stream_id); | 183 void SendEOFImpl(uint32_t stream_id); |
| 201 void SendErrorNotFoundImpl(uint32_t stream_id); | 184 void SendErrorNotFoundImpl(uint32_t stream_id); |
| 202 void KillStream(uint32_t stream_id); | 185 void KillStream(uint32_t stream_id); |
| 203 void CopyHeaders(SpdyHeaderBlock& dest, const BalsaHeaders& headers); | 186 void CopyHeaders(SpdyHeaderBlock& dest, const BalsaHeaders& headers); |
| 204 size_t SendSynStreamImpl(uint32_t stream_id, const BalsaHeaders& headers); | 187 size_t SendSynStreamImpl(uint32_t stream_id, const BalsaHeaders& headers); |
| 205 size_t SendSynReplyImpl(uint32_t stream_id, const BalsaHeaders& headers); | 188 size_t SendSynReplyImpl(uint32_t stream_id, const BalsaHeaders& headers); |
| 206 void SendDataFrameImpl(uint32_t stream_id, | 189 void SendDataFrameImpl(uint32_t stream_id, |
| 207 const char* data, | 190 const char* data, |
| (...skipping 21 matching lines...) Expand all Loading... |
| 229 typedef std::map<uint32_t, SMInterface*> StreamToSmif; | 212 typedef std::map<uint32_t, SMInterface*> StreamToSmif; |
| 230 StreamToSmif stream_to_smif_; | 213 StreamToSmif stream_to_smif_; |
| 231 bool close_on_error_; | 214 bool close_on_error_; |
| 232 | 215 |
| 233 static std::string forward_ip_header_; | 216 static std::string forward_ip_header_; |
| 234 }; | 217 }; |
| 235 | 218 |
| 236 } // namespace net | 219 } // namespace net |
| 237 | 220 |
| 238 #endif // NET_TOOLS_FLIP_SERVER_SPDY_INTERFACE_H_ | 221 #endif // NET_TOOLS_FLIP_SERVER_SPDY_INTERFACE_H_ |
| OLD | NEW |