| 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> |
| 12 |
| 11 #include "base/macros.h" | 13 #include "base/macros.h" |
| 12 #include "base/memory/scoped_ptr.h" | |
| 13 #include "net/base/io_buffer.h" | 14 #include "net/base/io_buffer.h" |
| 14 #include "net/base/ip_endpoint.h" | 15 #include "net/base/ip_endpoint.h" |
| 15 #include "net/log/net_log.h" | 16 #include "net/log/net_log.h" |
| 16 #include "net/quic/crypto/quic_crypto_server_config.h" | 17 #include "net/quic/crypto/quic_crypto_server_config.h" |
| 17 #include "net/quic/quic_chromium_connection_helper.h" | 18 #include "net/quic/quic_chromium_connection_helper.h" |
| 18 #include "net/quic/quic_clock.h" | 19 #include "net/quic/quic_clock.h" |
| 19 #include "net/quic/quic_config.h" | 20 #include "net/quic/quic_config.h" |
| 20 | 21 |
| 21 namespace net { | 22 namespace net { |
| 22 | 23 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 | 58 |
| 58 QuicDispatcher* dispatcher() { return dispatcher_.get(); } | 59 QuicDispatcher* dispatcher() { return dispatcher_.get(); } |
| 59 | 60 |
| 60 private: | 61 private: |
| 61 friend class test::QuicSimpleServerPeer; | 62 friend class test::QuicSimpleServerPeer; |
| 62 | 63 |
| 63 // Initialize the internal state of the server. | 64 // Initialize the internal state of the server. |
| 64 void Initialize(); | 65 void Initialize(); |
| 65 | 66 |
| 66 // Accepts data from the framer and demuxes clients to sessions. | 67 // Accepts data from the framer and demuxes clients to sessions. |
| 67 scoped_ptr<QuicDispatcher> dispatcher_; | 68 std::unique_ptr<QuicDispatcher> dispatcher_; |
| 68 | 69 |
| 69 // Used by the helper_ to time alarms. | 70 // Used by the helper_ to time alarms. |
| 70 QuicClock clock_; | 71 QuicClock clock_; |
| 71 | 72 |
| 72 // Used to manage the message loop. Owned by dispatcher_. | 73 // Used to manage the message loop. Owned by dispatcher_. |
| 73 QuicChromiumConnectionHelper* helper_; | 74 QuicChromiumConnectionHelper* helper_; |
| 74 | 75 |
| 75 // Listening socket. Also used for outbound client communication. | 76 // Listening socket. Also used for outbound client communication. |
| 76 scoped_ptr<UDPServerSocket> socket_; | 77 std::unique_ptr<UDPServerSocket> socket_; |
| 77 | 78 |
| 78 // config_ contains non-crypto parameters that are negotiated in the crypto | 79 // config_ contains non-crypto parameters that are negotiated in the crypto |
| 79 // handshake. | 80 // handshake. |
| 80 QuicConfig config_; | 81 QuicConfig config_; |
| 81 // crypto_config_ contains crypto parameters for the handshake. | 82 // crypto_config_ contains crypto parameters for the handshake. |
| 82 QuicCryptoServerConfig crypto_config_; | 83 QuicCryptoServerConfig crypto_config_; |
| 83 | 84 |
| 84 // This vector contains QUIC versions which we currently support. | 85 // This vector contains QUIC versions which we currently support. |
| 85 // This should be ordered such that the highest supported version is the first | 86 // This should be ordered such that the highest supported version is the first |
| 86 // element, with subsequent elements in descending order (versions can be | 87 // element, with subsequent elements in descending order (versions can be |
| (...skipping 21 matching lines...) Expand all Loading... |
| 108 NetLog net_log_; | 109 NetLog net_log_; |
| 109 | 110 |
| 110 base::WeakPtrFactory<QuicSimpleServer> weak_factory_; | 111 base::WeakPtrFactory<QuicSimpleServer> weak_factory_; |
| 111 | 112 |
| 112 DISALLOW_COPY_AND_ASSIGN(QuicSimpleServer); | 113 DISALLOW_COPY_AND_ASSIGN(QuicSimpleServer); |
| 113 }; | 114 }; |
| 114 | 115 |
| 115 } // namespace net | 116 } // namespace net |
| 116 | 117 |
| 117 #endif // NET_QUIC_TOOLS_QUIC_SIMPLE_SERVER_H_ | 118 #endif // NET_QUIC_TOOLS_QUIC_SIMPLE_SERVER_H_ |
| OLD | NEW |