| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 // A toy server, which listens on a specified address for QUIC traffic and | 5 // A toy server, which listens on a specified address for QUIC traffic and |
| 6 // handles incoming responses. | 6 // handles incoming responses. |
| 7 | 7 |
| 8 #ifndef NET_QUIC_TOOLS_QUIC_SIMPLE_SERVER_H_ | 8 #ifndef NET_QUIC_TOOLS_QUIC_SIMPLE_SERVER_H_ |
| 9 #define NET_QUIC_TOOLS_QUIC_SIMPLE_SERVER_H_ | 9 #define NET_QUIC_TOOLS_QUIC_SIMPLE_SERVER_H_ |
| 10 | 10 |
| 11 #include <memory> | 11 #include <memory> |
| 12 | 12 |
| 13 #include "base/macros.h" | 13 #include "base/macros.h" |
| 14 #include "net/base/io_buffer.h" | 14 #include "net/base/io_buffer.h" |
| 15 #include "net/base/ip_endpoint.h" | 15 #include "net/base/ip_endpoint.h" |
| 16 #include "net/log/net_log.h" | 16 #include "net/log/net_log.h" |
| 17 #include "net/quic/chromium/quic_chromium_alarm_factory.h" | 17 #include "net/quic/chromium/quic_chromium_alarm_factory.h" |
| 18 #include "net/quic/chromium/quic_chromium_connection_helper.h" | 18 #include "net/quic/chromium/quic_chromium_connection_helper.h" |
| 19 #include "net/quic/core/crypto/quic_crypto_server_config.h" | 19 #include "net/quic/core/crypto/quic_crypto_server_config.h" |
| 20 #include "net/quic/core/quic_clock.h" | 20 #include "net/quic/core/quic_clock.h" |
| 21 #include "net/quic/core/quic_config.h" | 21 #include "net/quic/core/quic_config.h" |
| 22 #include "net/tools/quic/quic_in_memory_cache.h" |
| 22 | 23 |
| 23 namespace net { | 24 namespace net { |
| 24 | 25 |
| 25 class UDPServerSocket; | 26 class UDPServerSocket; |
| 26 | 27 |
| 27 | 28 |
| 28 class QuicDispatcher; | 29 class QuicDispatcher; |
| 29 | 30 |
| 30 namespace test { | 31 namespace test { |
| 31 class QuicSimpleServerPeer; | 32 class QuicSimpleServerPeer; |
| 32 } // namespace test | 33 } // namespace test |
| 33 | 34 |
| 34 class QuicSimpleServer { | 35 class QuicSimpleServer { |
| 35 public: | 36 public: |
| 36 QuicSimpleServer( | 37 QuicSimpleServer( |
| 37 std::unique_ptr<ProofSource> proof_source, | 38 std::unique_ptr<ProofSource> proof_source, |
| 38 const QuicConfig& config, | 39 const QuicConfig& config, |
| 39 const QuicCryptoServerConfig::ConfigOptions& crypto_config_options, | 40 const QuicCryptoServerConfig::ConfigOptions& crypto_config_options, |
| 40 const QuicVersionVector& supported_versions); | 41 const QuicVersionVector& supported_versions, |
| 42 QuicInMemoryCache* in_memory_cache); |
| 41 | 43 |
| 42 virtual ~QuicSimpleServer(); | 44 virtual ~QuicSimpleServer(); |
| 43 | 45 |
| 44 // Start listening on the specified address. Returns an error code. | 46 // Start listening on the specified address. Returns an error code. |
| 45 int Listen(const IPEndPoint& address); | 47 int Listen(const IPEndPoint& address); |
| 46 | 48 |
| 47 // Server deletion is imminent. Start cleaning up. | 49 // Server deletion is imminent. Start cleaning up. |
| 48 void Shutdown(); | 50 void Shutdown(); |
| 49 | 51 |
| 50 // Start reading on the socket. On asynchronous reads, this registers | 52 // Start reading on the socket. On asynchronous reads, this registers |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 | 106 |
| 105 // The target buffer of the current read. | 107 // The target buffer of the current read. |
| 106 scoped_refptr<IOBufferWithSize> read_buffer_; | 108 scoped_refptr<IOBufferWithSize> read_buffer_; |
| 107 | 109 |
| 108 // The source address of the current read. | 110 // The source address of the current read. |
| 109 IPEndPoint client_address_; | 111 IPEndPoint client_address_; |
| 110 | 112 |
| 111 // The log to use for the socket. | 113 // The log to use for the socket. |
| 112 NetLog net_log_; | 114 NetLog net_log_; |
| 113 | 115 |
| 116 QuicInMemoryCache* in_memory_cache_; |
| 117 |
| 114 base::WeakPtrFactory<QuicSimpleServer> weak_factory_; | 118 base::WeakPtrFactory<QuicSimpleServer> weak_factory_; |
| 115 | 119 |
| 116 DISALLOW_COPY_AND_ASSIGN(QuicSimpleServer); | 120 DISALLOW_COPY_AND_ASSIGN(QuicSimpleServer); |
| 117 }; | 121 }; |
| 118 | 122 |
| 119 } // namespace net | 123 } // namespace net |
| 120 | 124 |
| 121 #endif // NET_QUIC_TOOLS_QUIC_SIMPLE_SERVER_H_ | 125 #endif // NET_QUIC_TOOLS_QUIC_SIMPLE_SERVER_H_ |
| OLD | NEW |