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 26 matching lines...) Expand all Loading... |
37 // Start listening on the specified address. | 37 // Start listening on the specified address. |
38 bool Listen(const IPEndPoint& address); | 38 bool Listen(const IPEndPoint& address); |
39 | 39 |
40 // Wait up to 50ms, and handle any events which occur. | 40 // Wait up to 50ms, and handle any events which occur. |
41 void WaitForEvents(); | 41 void WaitForEvents(); |
42 | 42 |
43 // Server deletion is imminent. Start cleaning up the epoll server. | 43 // Server deletion is imminent. Start cleaning up the epoll server. |
44 void Shutdown(); | 44 void Shutdown(); |
45 | 45 |
46 // From EpollCallbackInterface | 46 // From EpollCallbackInterface |
47 virtual void OnRegistration( | 47 virtual void OnRegistration(EpollServer* eps, |
48 EpollServer* eps, int fd, int event_mask) OVERRIDE {} | 48 int fd, |
| 49 int event_mask) OVERRIDE {} |
49 virtual void OnModification(int fd, int event_mask) OVERRIDE {} | 50 virtual void OnModification(int fd, int event_mask) OVERRIDE {} |
50 virtual void OnEvent(int fd, EpollEvent* event) OVERRIDE; | 51 virtual void OnEvent(int fd, EpollEvent* event) OVERRIDE; |
51 virtual void OnUnregistration(int fd, bool replaced) OVERRIDE {} | 52 virtual void OnUnregistration(int fd, bool replaced) OVERRIDE {} |
52 | 53 |
53 // Reads a packet from the given fd, and then passes it off to | 54 // Reads a packet from the given fd, and then passes it off to |
54 // the QuicDispatcher. Returns true if a packet is read, false | 55 // the QuicDispatcher. Returns true if a packet is read, false |
55 // otherwise. | 56 // otherwise. |
56 // If packets_dropped is non-null, the socket is configured to track | 57 // 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 | 58 // dropped packets, and some packets are read, it will be set to the number of |
58 // dropped packets. | 59 // dropped packets. |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 // skipped as necessary). | 114 // skipped as necessary). |
114 QuicVersionVector supported_versions_; | 115 QuicVersionVector supported_versions_; |
115 | 116 |
116 DISALLOW_COPY_AND_ASSIGN(QuicServer); | 117 DISALLOW_COPY_AND_ASSIGN(QuicServer); |
117 }; | 118 }; |
118 | 119 |
119 } // namespace tools | 120 } // namespace tools |
120 } // namespace net | 121 } // namespace net |
121 | 122 |
122 #endif // NET_TOOLS_QUIC_QUIC_SERVER_H_ | 123 #endif // NET_TOOLS_QUIC_QUIC_SERVER_H_ |
OLD | NEW |