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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 // otherwise. | 55 // otherwise. |
56 // If packets_dropped is non-null, the socket is configured to track | 56 // If packets_dropped is non-null, the socket is configured to track |
57 // dropped packets, and some packets are read, it will be set to the number of | 57 // dropped packets, and some packets are read, it will be set to the number of |
58 // dropped packets. | 58 // dropped packets. |
59 static bool ReadAndDispatchSinglePacket(int fd, int port, | 59 static bool ReadAndDispatchSinglePacket(int fd, int port, |
60 QuicDispatcher* dispatcher, | 60 QuicDispatcher* dispatcher, |
61 int* packets_dropped); | 61 int* packets_dropped); |
62 | 62 |
63 virtual void OnShutdown(EpollServer* eps, int fd) OVERRIDE {} | 63 virtual void OnShutdown(EpollServer* eps, int fd) OVERRIDE {} |
64 | 64 |
65 // Dispatches the given packet only if it looks like a valid QUIC packet. | |
66 // TODO(rjshade): Return a status describing why a packet was dropped, and log | |
67 // somehow. Maybe expose as a varz. | |
68 static void MaybeDispatchPacket(QuicDispatcher* dispatcher, | |
69 const QuicEncryptedPacket& packet, | |
70 const IPEndPoint& server_address, | |
71 const IPEndPoint& client_address); | |
72 | |
73 void SetStrikeRegisterNoStartupPeriod() { | 65 void SetStrikeRegisterNoStartupPeriod() { |
74 crypto_config_.set_strike_register_no_startup_period(); | 66 crypto_config_.set_strike_register_no_startup_period(); |
75 } | 67 } |
76 | 68 |
77 bool overflow_supported() { return overflow_supported_; } | 69 bool overflow_supported() { return overflow_supported_; } |
78 | 70 |
79 int packets_dropped() { return packets_dropped_; } | 71 int packets_dropped() { return packets_dropped_; } |
80 | 72 |
81 int port() { return port_; } | 73 int port() { return port_; } |
82 | 74 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 // skipped as necessary). | 113 // skipped as necessary). |
122 QuicVersionVector supported_versions_; | 114 QuicVersionVector supported_versions_; |
123 | 115 |
124 DISALLOW_COPY_AND_ASSIGN(QuicServer); | 116 DISALLOW_COPY_AND_ASSIGN(QuicServer); |
125 }; | 117 }; |
126 | 118 |
127 } // namespace tools | 119 } // namespace tools |
128 } // namespace net | 120 } // namespace net |
129 | 121 |
130 #endif // NET_TOOLS_QUIC_QUIC_SERVER_H_ | 122 #endif // NET_TOOLS_QUIC_QUIC_SERVER_H_ |
OLD | NEW |