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 #include "net/tools/quic/quic_dispatcher.h" | 5 #include "net/tools/quic/quic_dispatcher.h" |
6 | 6 |
7 #include <errno.h> | 7 #include <errno.h> |
8 | 8 |
9 #include "base/debug/stack_trace.h" | 9 #include "base/debug/stack_trace.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 | 25 |
26 using base::StringPiece; | 26 using base::StringPiece; |
27 using std::make_pair; | 27 using std::make_pair; |
28 | 28 |
29 class DeleteSessionsAlarm : public EpollAlarm { | 29 class DeleteSessionsAlarm : public EpollAlarm { |
30 public: | 30 public: |
31 explicit DeleteSessionsAlarm(QuicDispatcher* dispatcher) | 31 explicit DeleteSessionsAlarm(QuicDispatcher* dispatcher) |
32 : dispatcher_(dispatcher) { | 32 : dispatcher_(dispatcher) { |
33 } | 33 } |
34 | 34 |
35 virtual int64 OnAlarm() OVERRIDE { | 35 virtual int64 OnAlarm() override { |
36 EpollAlarm::OnAlarm(); | 36 EpollAlarm::OnAlarm(); |
37 dispatcher_->DeleteSessions(); | 37 dispatcher_->DeleteSessions(); |
38 return 0; | 38 return 0; |
39 } | 39 } |
40 | 40 |
41 private: | 41 private: |
42 QuicDispatcher* dispatcher_; | 42 QuicDispatcher* dispatcher_; |
43 }; | 43 }; |
44 | 44 |
45 class QuicDispatcher::QuicFramerVisitor : public QuicFramerVisitorInterface { | 45 class QuicDispatcher::QuicFramerVisitor : public QuicFramerVisitorInterface { |
46 public: | 46 public: |
47 explicit QuicFramerVisitor(QuicDispatcher* dispatcher) | 47 explicit QuicFramerVisitor(QuicDispatcher* dispatcher) |
48 : dispatcher_(dispatcher), | 48 : dispatcher_(dispatcher), |
49 connection_id_(0) {} | 49 connection_id_(0) {} |
50 | 50 |
51 // QuicFramerVisitorInterface implementation | 51 // QuicFramerVisitorInterface implementation |
52 virtual void OnPacket() OVERRIDE {} | 52 virtual void OnPacket() override {} |
53 virtual bool OnUnauthenticatedPublicHeader( | 53 virtual bool OnUnauthenticatedPublicHeader( |
54 const QuicPacketPublicHeader& header) OVERRIDE { | 54 const QuicPacketPublicHeader& header) override { |
55 connection_id_ = header.connection_id; | 55 connection_id_ = header.connection_id; |
56 return dispatcher_->OnUnauthenticatedPublicHeader(header); | 56 return dispatcher_->OnUnauthenticatedPublicHeader(header); |
57 } | 57 } |
58 virtual bool OnUnauthenticatedHeader( | 58 virtual bool OnUnauthenticatedHeader( |
59 const QuicPacketHeader& header) OVERRIDE { | 59 const QuicPacketHeader& header) override { |
60 dispatcher_->OnUnauthenticatedHeader(header); | 60 dispatcher_->OnUnauthenticatedHeader(header); |
61 return false; | 61 return false; |
62 } | 62 } |
63 virtual void OnError(QuicFramer* framer) OVERRIDE { | 63 virtual void OnError(QuicFramer* framer) override { |
64 DVLOG(1) << QuicUtils::ErrorToString(framer->error()); | 64 DVLOG(1) << QuicUtils::ErrorToString(framer->error()); |
65 } | 65 } |
66 | 66 |
67 virtual bool OnProtocolVersionMismatch( | 67 virtual bool OnProtocolVersionMismatch( |
68 QuicVersion /*received_version*/) OVERRIDE { | 68 QuicVersion /*received_version*/) override { |
69 if (dispatcher_->time_wait_list_manager()->IsConnectionIdInTimeWait( | 69 if (dispatcher_->time_wait_list_manager()->IsConnectionIdInTimeWait( |
70 connection_id_)) { | 70 connection_id_)) { |
71 // Keep processing after protocol mismatch - this will be dealt with by | 71 // Keep processing after protocol mismatch - this will be dealt with by |
72 // the TimeWaitListManager. | 72 // the TimeWaitListManager. |
73 return true; | 73 return true; |
74 } else { | 74 } else { |
75 DLOG(DFATAL) << "Version mismatch, connection ID (" << connection_id_ | 75 DLOG(DFATAL) << "Version mismatch, connection ID (" << connection_id_ |
76 << ") not in time wait list."; | 76 << ") not in time wait list."; |
77 return false; | 77 return false; |
78 } | 78 } |
79 } | 79 } |
80 | 80 |
81 // The following methods should never get called because we always return | 81 // The following methods should never get called because we always return |
82 // false from OnUnauthenticatedHeader(). As a result, we never process the | 82 // false from OnUnauthenticatedHeader(). As a result, we never process the |
83 // payload of the packet. | 83 // payload of the packet. |
84 virtual void OnPublicResetPacket( | 84 virtual void OnPublicResetPacket( |
85 const QuicPublicResetPacket& /*packet*/) OVERRIDE { | 85 const QuicPublicResetPacket& /*packet*/) override { |
86 DCHECK(false); | 86 DCHECK(false); |
87 } | 87 } |
88 virtual void OnVersionNegotiationPacket( | 88 virtual void OnVersionNegotiationPacket( |
89 const QuicVersionNegotiationPacket& /*packet*/) OVERRIDE { | 89 const QuicVersionNegotiationPacket& /*packet*/) override { |
90 DCHECK(false); | 90 DCHECK(false); |
91 } | 91 } |
92 virtual void OnDecryptedPacket(EncryptionLevel level) OVERRIDE { | 92 virtual void OnDecryptedPacket(EncryptionLevel level) override { |
93 DCHECK(false); | 93 DCHECK(false); |
94 } | 94 } |
95 virtual bool OnPacketHeader(const QuicPacketHeader& /*header*/) OVERRIDE { | 95 virtual bool OnPacketHeader(const QuicPacketHeader& /*header*/) override { |
96 DCHECK(false); | 96 DCHECK(false); |
97 return false; | 97 return false; |
98 } | 98 } |
99 virtual void OnRevivedPacket() OVERRIDE { | 99 virtual void OnRevivedPacket() override { |
100 DCHECK(false); | 100 DCHECK(false); |
101 } | 101 } |
102 virtual void OnFecProtectedPayload(StringPiece /*payload*/) OVERRIDE { | 102 virtual void OnFecProtectedPayload(StringPiece /*payload*/) override { |
103 DCHECK(false); | 103 DCHECK(false); |
104 } | 104 } |
105 virtual bool OnStreamFrame(const QuicStreamFrame& /*frame*/) OVERRIDE { | 105 virtual bool OnStreamFrame(const QuicStreamFrame& /*frame*/) override { |
106 DCHECK(false); | 106 DCHECK(false); |
107 return false; | 107 return false; |
108 } | 108 } |
109 virtual bool OnAckFrame(const QuicAckFrame& /*frame*/) OVERRIDE { | 109 virtual bool OnAckFrame(const QuicAckFrame& /*frame*/) override { |
110 DCHECK(false); | 110 DCHECK(false); |
111 return false; | 111 return false; |
112 } | 112 } |
113 virtual bool OnCongestionFeedbackFrame( | 113 virtual bool OnCongestionFeedbackFrame( |
114 const QuicCongestionFeedbackFrame& /*frame*/) OVERRIDE { | 114 const QuicCongestionFeedbackFrame& /*frame*/) override { |
115 DCHECK(false); | 115 DCHECK(false); |
116 return false; | 116 return false; |
117 } | 117 } |
118 virtual bool OnStopWaitingFrame( | 118 virtual bool OnStopWaitingFrame( |
119 const QuicStopWaitingFrame& /*frame*/) OVERRIDE { | 119 const QuicStopWaitingFrame& /*frame*/) override { |
120 DCHECK(false); | 120 DCHECK(false); |
121 return false; | 121 return false; |
122 } | 122 } |
123 virtual bool OnPingFrame(const QuicPingFrame& /*frame*/) OVERRIDE { | 123 virtual bool OnPingFrame(const QuicPingFrame& /*frame*/) override { |
124 DCHECK(false); | 124 DCHECK(false); |
125 return false; | 125 return false; |
126 } | 126 } |
127 virtual bool OnRstStreamFrame(const QuicRstStreamFrame& /*frame*/) OVERRIDE { | 127 virtual bool OnRstStreamFrame(const QuicRstStreamFrame& /*frame*/) override { |
128 DCHECK(false); | 128 DCHECK(false); |
129 return false; | 129 return false; |
130 } | 130 } |
131 virtual bool OnConnectionCloseFrame( | 131 virtual bool OnConnectionCloseFrame( |
132 const QuicConnectionCloseFrame & /*frame*/) OVERRIDE { | 132 const QuicConnectionCloseFrame & /*frame*/) override { |
133 DCHECK(false); | 133 DCHECK(false); |
134 return false; | 134 return false; |
135 } | 135 } |
136 virtual bool OnGoAwayFrame(const QuicGoAwayFrame& /*frame*/) OVERRIDE { | 136 virtual bool OnGoAwayFrame(const QuicGoAwayFrame& /*frame*/) override { |
137 DCHECK(false); | 137 DCHECK(false); |
138 return false; | 138 return false; |
139 } | 139 } |
140 virtual bool OnWindowUpdateFrame(const QuicWindowUpdateFrame& /*frame*/) | 140 virtual bool OnWindowUpdateFrame(const QuicWindowUpdateFrame& /*frame*/) |
141 OVERRIDE { | 141 override { |
142 DCHECK(false); | 142 DCHECK(false); |
143 return false; | 143 return false; |
144 } | 144 } |
145 virtual bool OnBlockedFrame(const QuicBlockedFrame& frame) OVERRIDE { | 145 virtual bool OnBlockedFrame(const QuicBlockedFrame& frame) override { |
146 DCHECK(false); | 146 DCHECK(false); |
147 return false; | 147 return false; |
148 } | 148 } |
149 virtual void OnFecData(const QuicFecData& /*fec*/) OVERRIDE { | 149 virtual void OnFecData(const QuicFecData& /*fec*/) override { |
150 DCHECK(false); | 150 DCHECK(false); |
151 } | 151 } |
152 virtual void OnPacketComplete() OVERRIDE { | 152 virtual void OnPacketComplete() override { |
153 DCHECK(false); | 153 DCHECK(false); |
154 } | 154 } |
155 | 155 |
156 private: | 156 private: |
157 QuicDispatcher* dispatcher_; | 157 QuicDispatcher* dispatcher_; |
158 | 158 |
159 // Latched in OnUnauthenticatedPublicHeader for use later. | 159 // Latched in OnUnauthenticatedPublicHeader for use later. |
160 QuicConnectionId connection_id_; | 160 QuicConnectionId connection_id_; |
161 }; | 161 }; |
162 | 162 |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
412 framer_.set_version(time_wait_list_manager_->GetQuicVersionFromConnectionId( | 412 framer_.set_version(time_wait_list_manager_->GetQuicVersionFromConnectionId( |
413 header.connection_id)); | 413 header.connection_id)); |
414 | 414 |
415 // Continue parsing the packet to extract the sequence number. Then | 415 // Continue parsing the packet to extract the sequence number. Then |
416 // send it to the time wait manager in OnUnathenticatedHeader. | 416 // send it to the time wait manager in OnUnathenticatedHeader. |
417 return true; | 417 return true; |
418 } | 418 } |
419 | 419 |
420 } // namespace tools | 420 } // namespace tools |
421 } // namespace net | 421 } // namespace net |
OLD | NEW |