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 #ifndef NET_TOOLS_QUIC_QUIC_SERVER_H_ | 8 #ifndef NET_TOOLS_QUIC_QUIC_SERVER_H_ |
9 #define NET_TOOLS_QUIC_QUIC_SERVER_H_ | 9 #define NET_TOOLS_QUIC_QUIC_SERVER_H_ |
10 | 10 |
(...skipping 13 matching lines...) Expand all Loading... |
24 namespace test { | 24 namespace test { |
25 class QuicServerPeer; | 25 class QuicServerPeer; |
26 } // namespace test | 26 } // namespace test |
27 | 27 |
28 class QuicDispatcher; | 28 class QuicDispatcher; |
29 | 29 |
30 class QuicServer : public EpollCallbackInterface { | 30 class QuicServer : public EpollCallbackInterface { |
31 public: | 31 public: |
32 QuicServer(); | 32 QuicServer(); |
33 QuicServer(const QuicConfig& config, | 33 QuicServer(const QuicConfig& config, |
34 const QuicVersionVector& supported_versions, | 34 const QuicVersionVector& supported_versions); |
35 uint32 server_initial_flow_control_receive_window); | |
36 | 35 |
37 virtual ~QuicServer(); | 36 virtual ~QuicServer(); |
38 | 37 |
39 // Start listening on the specified address. | 38 // Start listening on the specified address. |
40 bool Listen(const IPEndPoint& address); | 39 bool Listen(const IPEndPoint& address); |
41 | 40 |
42 // Wait up to 50ms, and handle any events which occur. | 41 // Wait up to 50ms, and handle any events which occur. |
43 void WaitForEvents(); | 42 void WaitForEvents(); |
44 | 43 |
45 // Server deletion is imminent. Start cleaning up the epoll server. | 44 // Server deletion is imminent. Start cleaning up the epoll server. |
(...skipping 28 matching lines...) Expand all Loading... |
74 void SetProofSource(ProofSource* source) { | 73 void SetProofSource(ProofSource* source) { |
75 crypto_config_.SetProofSource(source); | 74 crypto_config_.SetProofSource(source); |
76 } | 75 } |
77 | 76 |
78 bool overflow_supported() { return overflow_supported_; } | 77 bool overflow_supported() { return overflow_supported_; } |
79 | 78 |
80 uint32 packets_dropped() { return packets_dropped_; } | 79 uint32 packets_dropped() { return packets_dropped_; } |
81 | 80 |
82 int port() { return port_; } | 81 int port() { return port_; } |
83 | 82 |
| 83 protected: |
| 84 virtual QuicDispatcher* CreateQuicDispatcher(); |
| 85 |
| 86 const QuicConfig& config() const { return config_; } |
| 87 const QuicCryptoServerConfig& crypto_config() const { |
| 88 return crypto_config_; |
| 89 } |
| 90 const QuicVersionVector& supported_versions() const { |
| 91 return supported_versions_; |
| 92 } |
| 93 EpollServer* epoll_server() { return &epoll_server_; } |
| 94 |
84 private: | 95 private: |
85 friend class net::tools::test::QuicServerPeer; | 96 friend class net::tools::test::QuicServerPeer; |
86 | 97 |
87 // Initialize the internal state of the server. | 98 // Initialize the internal state of the server. |
88 void Initialize(); | 99 void Initialize(); |
89 | 100 |
90 // Accepts data from the framer and demuxes clients to sessions. | 101 // Accepts data from the framer and demuxes clients to sessions. |
91 scoped_ptr<QuicDispatcher> dispatcher_; | 102 scoped_ptr<QuicDispatcher> dispatcher_; |
92 // Frames incoming packets and hands them to the dispatcher. | 103 // Frames incoming packets and hands them to the dispatcher. |
93 EpollServer epoll_server_; | 104 EpollServer epoll_server_; |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 // connections. | 137 // connections. |
127 uint32 server_initial_flow_control_receive_window_; | 138 uint32 server_initial_flow_control_receive_window_; |
128 | 139 |
129 DISALLOW_COPY_AND_ASSIGN(QuicServer); | 140 DISALLOW_COPY_AND_ASSIGN(QuicServer); |
130 }; | 141 }; |
131 | 142 |
132 } // namespace tools | 143 } // namespace tools |
133 } // namespace net | 144 } // namespace net |
134 | 145 |
135 #endif // NET_TOOLS_QUIC_QUIC_SERVER_H_ | 146 #endif // NET_TOOLS_QUIC_QUIC_SERVER_H_ |
OLD | NEW |