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 29 matching lines...) Expand all Loading... |
40 | 40 |
41 // Wait up to 50ms, and handle any events which occur. | 41 // Wait up to 50ms, and handle any events which occur. |
42 void WaitForEvents(); | 42 void WaitForEvents(); |
43 | 43 |
44 // Server deletion is imminent. Start cleaning up the epoll server. | 44 // Server deletion is imminent. Start cleaning up the epoll server. |
45 void Shutdown(); | 45 void Shutdown(); |
46 | 46 |
47 // From EpollCallbackInterface | 47 // From EpollCallbackInterface |
48 virtual void OnRegistration(EpollServer* eps, | 48 virtual void OnRegistration(EpollServer* eps, |
49 int fd, | 49 int fd, |
50 int event_mask) OVERRIDE {} | 50 int event_mask) override {} |
51 virtual void OnModification(int fd, int event_mask) OVERRIDE {} | 51 virtual void OnModification(int fd, int event_mask) override {} |
52 virtual void OnEvent(int fd, EpollEvent* event) OVERRIDE; | 52 virtual void OnEvent(int fd, EpollEvent* event) override; |
53 virtual void OnUnregistration(int fd, bool replaced) OVERRIDE {} | 53 virtual void OnUnregistration(int fd, bool replaced) override {} |
54 | 54 |
55 // Reads a packet from the given fd, and then passes it off to | 55 // Reads a packet from the given fd, and then passes it off to |
56 // the QuicDispatcher. Returns true if a packet is read, false | 56 // the QuicDispatcher. Returns true if a packet is read, false |
57 // otherwise. | 57 // otherwise. |
58 // If packets_dropped is non-null, the socket is configured to track | 58 // If packets_dropped is non-null, the socket is configured to track |
59 // dropped packets, and some packets are read, it will be set to the number of | 59 // dropped packets, and some packets are read, it will be set to the number of |
60 // dropped packets. | 60 // dropped packets. |
61 static bool ReadAndDispatchSinglePacket(int fd, int port, | 61 static bool ReadAndDispatchSinglePacket(int fd, int port, |
62 ProcessPacketInterface* processor, | 62 ProcessPacketInterface* processor, |
63 uint32* packets_dropped); | 63 uint32* packets_dropped); |
64 | 64 |
65 virtual void OnShutdown(EpollServer* eps, int fd) OVERRIDE {} | 65 virtual void OnShutdown(EpollServer* eps, int fd) override {} |
66 | 66 |
67 void SetStrikeRegisterNoStartupPeriod() { | 67 void SetStrikeRegisterNoStartupPeriod() { |
68 crypto_config_.set_strike_register_no_startup_period(); | 68 crypto_config_.set_strike_register_no_startup_period(); |
69 } | 69 } |
70 | 70 |
71 // SetProofSource sets the ProofSource that will be used to verify the | 71 // SetProofSource sets the ProofSource that will be used to verify the |
72 // server's certificate, and takes ownership of |source|. | 72 // server's certificate, and takes ownership of |source|. |
73 void SetProofSource(ProofSource* source) { | 73 void SetProofSource(ProofSource* source) { |
74 crypto_config_.SetProofSource(source); | 74 crypto_config_.SetProofSource(source); |
75 } | 75 } |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 // connections. | 137 // connections. |
138 uint32 server_initial_flow_control_receive_window_; | 138 uint32 server_initial_flow_control_receive_window_; |
139 | 139 |
140 DISALLOW_COPY_AND_ASSIGN(QuicServer); | 140 DISALLOW_COPY_AND_ASSIGN(QuicServer); |
141 }; | 141 }; |
142 | 142 |
143 } // namespace tools | 143 } // namespace tools |
144 } // namespace net | 144 } // namespace net |
145 | 145 |
146 #endif // NET_TOOLS_QUIC_QUIC_SERVER_H_ | 146 #endif // NET_TOOLS_QUIC_QUIC_SERVER_H_ |
OLD | NEW |