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 |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "net/base/ip_endpoint.h" | 12 #include "net/base/ip_endpoint.h" |
13 #include "net/quic/crypto/crypto_server_config.h" | 13 #include "net/quic/crypto/crypto_server_config.h" |
14 #include "net/quic/quic_config.h" | 14 #include "net/quic/quic_config.h" |
15 #include "net/quic/quic_framer.h" | 15 #include "net/quic/quic_framer.h" |
16 #include "net/tools/flip_server/epoll_server.h" | 16 #include "net/tools/flip_server/epoll_server.h" |
17 #include "net/tools/quic/quic_dispatcher.h" | 17 #include "net/tools/quic/quic_dispatcher.h" |
18 | 18 |
19 namespace net { | 19 namespace net { |
20 | 20 |
21 class QuicCryptoServerConfig; | |
22 | |
23 namespace tools { | 21 namespace tools { |
24 | 22 |
25 class QuicDispatcher; | 23 class QuicDispatcher; |
26 | 24 |
27 class QuicServer : public EpollCallbackInterface { | 25 class QuicServer : public EpollCallbackInterface { |
28 public: | 26 public: |
29 QuicServer(); | 27 QuicServer(); |
30 explicit QuicServer(const QuicConfig& config); | 28 explicit QuicServer(const QuicConfig& config); |
31 | 29 |
32 virtual ~QuicServer(); | 30 virtual ~QuicServer(); |
(...skipping 27 matching lines...) Expand all Loading... |
60 virtual void OnShutdown(EpollServer* eps, int fd) OVERRIDE {} | 58 virtual void OnShutdown(EpollServer* eps, int fd) OVERRIDE {} |
61 | 59 |
62 // Dispatches the given packet only if it looks like a valid QUIC packet. | 60 // Dispatches the given packet only if it looks like a valid QUIC packet. |
63 // TODO(rjshade): Return a status describing why a packet was dropped, and log | 61 // TODO(rjshade): Return a status describing why a packet was dropped, and log |
64 // somehow. Maybe expose as a varz. | 62 // somehow. Maybe expose as a varz. |
65 static void MaybeDispatchPacket(QuicDispatcher* dispatcher, | 63 static void MaybeDispatchPacket(QuicDispatcher* dispatcher, |
66 const QuicEncryptedPacket& packet, | 64 const QuicEncryptedPacket& packet, |
67 const IPEndPoint& server_address, | 65 const IPEndPoint& server_address, |
68 const IPEndPoint& client_address); | 66 const IPEndPoint& client_address); |
69 | 67 |
| 68 void SetStrikeRegisterNoStartupPeriod() { |
| 69 crypto_config_.set_strike_register_no_startup_period(); |
| 70 } |
| 71 |
70 bool overflow_supported() { return overflow_supported_; } | 72 bool overflow_supported() { return overflow_supported_; } |
71 | 73 |
72 int packets_dropped() { return packets_dropped_; } | 74 int packets_dropped() { return packets_dropped_; } |
73 | 75 |
74 int port() { return port_; } | 76 int port() { return port_; } |
75 | 77 |
76 private: | 78 private: |
77 // Initialize the internal state of the server. | 79 // Initialize the internal state of the server. |
78 void Initialize(); | 80 void Initialize(); |
79 | 81 |
(...skipping 26 matching lines...) Expand all Loading... |
106 // crypto_config_ contains crypto parameters for the handshake. | 108 // crypto_config_ contains crypto parameters for the handshake. |
107 QuicCryptoServerConfig crypto_config_; | 109 QuicCryptoServerConfig crypto_config_; |
108 | 110 |
109 DISALLOW_COPY_AND_ASSIGN(QuicServer); | 111 DISALLOW_COPY_AND_ASSIGN(QuicServer); |
110 }; | 112 }; |
111 | 113 |
112 } // namespace tools | 114 } // namespace tools |
113 } // namespace net | 115 } // namespace net |
114 | 116 |
115 #endif // NET_TOOLS_QUIC_QUIC_SERVER_H_ | 117 #endif // NET_TOOLS_QUIC_QUIC_SERVER_H_ |
OLD | NEW |