Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(215)

Side by Side Diff: net/quic/quic_server.h

Issue 1031243002: Unify the QUIC dispatcher and make the QuicServer work. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: QuicChromeServerDispatchPacketTest Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/net.gyp ('k') | net/quic/quic_server.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_QUIC_QUIC_SERVER_H_ 8 #ifndef NET_QUIC_QUIC_SERVER_H_
9 #define NET_QUIC_QUIC_SERVER_H_ 9 #define NET_QUIC_QUIC_SERVER_H_
10 10
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "net/base/io_buffer.h" 13 #include "net/base/io_buffer.h"
14 #include "net/base/ip_endpoint.h" 14 #include "net/base/ip_endpoint.h"
15 #include "net/base/net_log.h" 15 #include "net/base/net_log.h"
16 #include "net/quic/crypto/quic_crypto_server_config.h" 16 #include "net/quic/crypto/quic_crypto_server_config.h"
17 #include "net/quic/quic_clock.h" 17 #include "net/quic/quic_clock.h"
18 #include "net/quic/quic_config.h" 18 #include "net/quic/quic_config.h"
19 #include "net/quic/quic_connection_helper.h" 19 #include "net/quic/quic_connection_helper.h"
20 20
21 namespace net { 21 namespace net {
22 22
23 23
24 namespace test { 24 namespace test {
25 class QuicServerPeer; 25 class QuicServerPeer;
26 } // namespace test 26 } // namespace test
27 27
28 namespace tools {
28 class QuicDispatcher; 29 class QuicDispatcher;
30 } // namespace tools
31
29 class UDPServerSocket; 32 class UDPServerSocket;
30 33
31 class QuicServer { 34 class QuicServer {
32 public: 35 public:
33 QuicServer(const QuicConfig& config, 36 QuicServer(const QuicConfig& config,
34 const QuicVersionVector& supported_versions); 37 const QuicVersionVector& supported_versions);
35 38
36 virtual ~QuicServer(); 39 virtual ~QuicServer();
37 40
38 // Start listening on the specified address. Returns an error code. 41 // Start listening on the specified address. Returns an error code.
(...skipping 13 matching lines...) Expand all
52 void SetStrikeRegisterNoStartupPeriod() { 55 void SetStrikeRegisterNoStartupPeriod() {
53 crypto_config_.set_strike_register_no_startup_period(); 56 crypto_config_.set_strike_register_no_startup_period();
54 } 57 }
55 58
56 // SetProofSource sets the ProofSource that will be used to verify the 59 // SetProofSource sets the ProofSource that will be used to verify the
57 // server's certificate, and takes ownership of |source|. 60 // server's certificate, and takes ownership of |source|.
58 void SetProofSource(ProofSource* source) { 61 void SetProofSource(ProofSource* source) {
59 crypto_config_.SetProofSource(source); 62 crypto_config_.SetProofSource(source);
60 } 63 }
61 64
62 QuicDispatcher* dispatcher() { return dispatcher_.get(); } 65 tools::QuicDispatcher* dispatcher() { return dispatcher_.get(); }
63 66
64 private: 67 private:
65 friend class net::test::QuicServerPeer; 68 friend class net::test::QuicServerPeer;
66 69
67 // Initialize the internal state of the server. 70 // Initialize the internal state of the server.
68 void Initialize(); 71 void Initialize();
69 72
70 // Accepts data from the framer and demuxes clients to sessions. 73 // Accepts data from the framer and demuxes clients to sessions.
71 scoped_ptr<QuicDispatcher> dispatcher_; 74 scoped_ptr<tools::QuicDispatcher> dispatcher_;
72 75
73 // Used by the helper_ to time alarms. 76 // Used by the helper_ to time alarms.
74 QuicClock clock_; 77 QuicClock clock_;
75 78
76 // Used to manage the message loop. 79 // Used to manage the message loop.
77 QuicConnectionHelper helper_; 80 QuicConnectionHelper helper_;
78 81
79 // Listening socket. Also used for outbound client communication. 82 // Listening socket. Also used for outbound client communication.
80 scoped_ptr<UDPServerSocket> socket_; 83 scoped_ptr<UDPServerSocket> socket_;
81 84
(...skipping 30 matching lines...) Expand all
112 NetLog net_log_; 115 NetLog net_log_;
113 116
114 base::WeakPtrFactory<QuicServer> weak_factory_; 117 base::WeakPtrFactory<QuicServer> weak_factory_;
115 118
116 DISALLOW_COPY_AND_ASSIGN(QuicServer); 119 DISALLOW_COPY_AND_ASSIGN(QuicServer);
117 }; 120 };
118 121
119 } // namespace net 122 } // namespace net
120 123
121 #endif // NET_QUIC_QUIC_SERVER_H_ 124 #endif // NET_QUIC_QUIC_SERVER_H_
OLDNEW
« no previous file with comments | « net/net.gyp ('k') | net/quic/quic_server.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698