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 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 | 48 |
49 // Server deletion is imminent. Start cleaning up the epoll server. | 49 // Server deletion is imminent. Start cleaning up the epoll server. |
50 void Shutdown(); | 50 void Shutdown(); |
51 | 51 |
52 // From EpollCallbackInterface | 52 // From EpollCallbackInterface |
53 void OnRegistration(EpollServer* eps, int fd, int event_mask) override {} | 53 void OnRegistration(EpollServer* eps, int fd, int event_mask) override {} |
54 void OnModification(int fd, int event_mask) override {} | 54 void OnModification(int fd, int event_mask) override {} |
55 void OnEvent(int fd, EpollEvent* event) override; | 55 void OnEvent(int fd, EpollEvent* event) override; |
56 void OnUnregistration(int fd, bool replaced) override {} | 56 void OnUnregistration(int fd, bool replaced) override {} |
57 | 57 |
58 // Reads a number of packets from the given fd, and then passes them off to | |
59 // the QuicDispatcher. Returns true if some packets are read, false | |
60 // otherwise. | |
61 // If packets_dropped is non-null, the socket is configured to track | |
62 // dropped packets, and some packets are read, it will be set to the number of | |
63 // dropped packets. | |
64 static bool ReadAndDispatchPackets(int fd, int port, | |
65 ProcessPacketInterface* processor, | |
66 QuicPacketCount* packets_dropped); | |
67 // Same as ReadAndDispatchPackets, only does one packet at a time. | |
68 static bool ReadAndDispatchSinglePacket(int fd, int port, | |
69 ProcessPacketInterface* processor, | |
70 QuicPacketCount* packets_dropped); | |
71 | |
72 void OnShutdown(EpollServer* eps, int fd) override {} | 58 void OnShutdown(EpollServer* eps, int fd) override {} |
73 | 59 |
74 void SetStrikeRegisterNoStartupPeriod() { | 60 void SetStrikeRegisterNoStartupPeriod() { |
75 crypto_config_.set_strike_register_no_startup_period(); | 61 crypto_config_.set_strike_register_no_startup_period(); |
76 } | 62 } |
77 | 63 |
78 // SetProofSource sets the ProofSource that will be used to verify the | 64 // SetProofSource sets the ProofSource that will be used to verify the |
79 // server's certificate, and takes ownership of |source|. | 65 // server's certificate, and takes ownership of |source|. |
80 void SetProofSource(ProofSource* source) { | 66 void SetProofSource(ProofSource* source) { |
81 crypto_config_.SetProofSource(source); | 67 crypto_config_.SetProofSource(source); |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 | 132 |
147 scoped_ptr<QuicPacketReader> packet_reader_; | 133 scoped_ptr<QuicPacketReader> packet_reader_; |
148 | 134 |
149 DISALLOW_COPY_AND_ASSIGN(QuicServer); | 135 DISALLOW_COPY_AND_ASSIGN(QuicServer); |
150 }; | 136 }; |
151 | 137 |
152 } // namespace tools | 138 } // namespace tools |
153 } // namespace net | 139 } // namespace net |
154 | 140 |
155 #endif // NET_TOOLS_QUIC_QUIC_SERVER_H_ | 141 #endif // NET_TOOLS_QUIC_QUIC_SERVER_H_ |
OLD | NEW |