| 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 // 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 // Note that this server is intended to verify correctness of the client and is | 8 // Note that this server is intended to verify correctness of the client and is |
| 9 // in no way expected to be performant. | 9 // in no way expected to be performant. |
| 10 | 10 |
| 11 #ifndef NET_TOOLS_QUIC_QUIC_SERVER_H_ | 11 #ifndef NET_TOOLS_QUIC_QUIC_SERVER_H_ |
| 12 #define NET_TOOLS_QUIC_QUIC_SERVER_H_ | 12 #define NET_TOOLS_QUIC_QUIC_SERVER_H_ |
| 13 | 13 |
| 14 #include <stddef.h> | 14 #include <stddef.h> |
| 15 | 15 |
| 16 #include "base/macros.h" | 16 #include "base/macros.h" |
| 17 #include "base/memory/scoped_ptr.h" | |
| 18 #include "net/base/ip_endpoint.h" | 17 #include "net/base/ip_endpoint.h" |
| 19 #include "net/quic/crypto/quic_crypto_server_config.h" | 18 #include "net/quic/crypto/quic_crypto_server_config.h" |
| 20 #include "net/quic/quic_chromium_connection_helper.h" | 19 #include "net/quic/quic_chromium_connection_helper.h" |
| 21 #include "net/quic/quic_config.h" | 20 #include "net/quic/quic_config.h" |
| 22 #include "net/quic/quic_framer.h" | 21 #include "net/quic/quic_framer.h" |
| 23 #include "net/tools/epoll_server/epoll_server.h" | 22 #include "net/tools/epoll_server/epoll_server.h" |
| 24 #include "net/tools/quic/quic_default_packet_writer.h" | 23 #include "net/tools/quic/quic_default_packet_writer.h" |
| 25 | 24 |
| 26 namespace net { | 25 namespace net { |
| 27 | 26 |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 | 86 |
| 88 QuicDispatcher* dispatcher() { return dispatcher_.get(); } | 87 QuicDispatcher* dispatcher() { return dispatcher_.get(); } |
| 89 | 88 |
| 90 private: | 89 private: |
| 91 friend class net::test::QuicServerPeer; | 90 friend class net::test::QuicServerPeer; |
| 92 | 91 |
| 93 // Initialize the internal state of the server. | 92 // Initialize the internal state of the server. |
| 94 void Initialize(); | 93 void Initialize(); |
| 95 | 94 |
| 96 // Accepts data from the framer and demuxes clients to sessions. | 95 // Accepts data from the framer and demuxes clients to sessions. |
| 97 scoped_ptr<QuicDispatcher> dispatcher_; | 96 std::unique_ptr<QuicDispatcher> dispatcher_; |
| 98 // Frames incoming packets and hands them to the dispatcher. | 97 // Frames incoming packets and hands them to the dispatcher. |
| 99 EpollServer epoll_server_; | 98 EpollServer epoll_server_; |
| 100 | 99 |
| 101 // The port the server is listening on. | 100 // The port the server is listening on. |
| 102 int port_; | 101 int port_; |
| 103 | 102 |
| 104 // Listening connection. Also used for outbound client communication. | 103 // Listening connection. Also used for outbound client communication. |
| 105 int fd_; | 104 int fd_; |
| 106 | 105 |
| 107 // If overflow_supported_ is true this will be the number of packets dropped | 106 // If overflow_supported_ is true this will be the number of packets dropped |
| (...skipping 14 matching lines...) Expand all Loading... |
| 122 QuicCryptoServerConfig::ConfigOptions crypto_config_options_; | 121 QuicCryptoServerConfig::ConfigOptions crypto_config_options_; |
| 123 | 122 |
| 124 // This vector contains QUIC versions which we currently support. | 123 // This vector contains QUIC versions which we currently support. |
| 125 // This should be ordered such that the highest supported version is the first | 124 // This should be ordered such that the highest supported version is the first |
| 126 // element, with subsequent elements in descending order (versions can be | 125 // element, with subsequent elements in descending order (versions can be |
| 127 // skipped as necessary). | 126 // skipped as necessary). |
| 128 QuicVersionVector supported_versions_; | 127 QuicVersionVector supported_versions_; |
| 129 | 128 |
| 130 // Point to a QuicPacketReader object on the heap. The reader allocates more | 129 // Point to a QuicPacketReader object on the heap. The reader allocates more |
| 131 // space than allowed on the stack. | 130 // space than allowed on the stack. |
| 132 scoped_ptr<QuicPacketReader> packet_reader_; | 131 std::unique_ptr<QuicPacketReader> packet_reader_; |
| 133 | 132 |
| 134 DISALLOW_COPY_AND_ASSIGN(QuicServer); | 133 DISALLOW_COPY_AND_ASSIGN(QuicServer); |
| 135 }; | 134 }; |
| 136 | 135 |
| 137 } // namespace net | 136 } // namespace net |
| 138 | 137 |
| 139 #endif // NET_TOOLS_QUIC_QUIC_SERVER_H_ | 138 #endif // NET_TOOLS_QUIC_QUIC_SERVER_H_ |
| OLD | NEW |