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

Side by Side Diff: webrtc/p2p/quic/quictransportchannel.h

Issue 1856513002: Add QuicTransportChannel methods for QUIC streams (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 8 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
OLDNEW
1 /* 1 /*
2 * Copyright 2016 The WebRTC Project Authors. All rights reserved. 2 * Copyright 2016 The WebRTC Project Authors. All rights reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 30 matching lines...) Expand all
41 // Once the wrapped transport channel is connected, QuicTransportChannel 41 // Once the wrapped transport channel is connected, QuicTransportChannel
42 // negotiates the crypto handshake and establishes SRTP keying material. 42 // negotiates the crypto handshake and establishes SRTP keying material.
43 // 43 //
44 // How it works: 44 // How it works:
45 // 45 //
46 // QuicTransportChannel { 46 // QuicTransportChannel {
47 // QuicSession* quic_; 47 // QuicSession* quic_;
48 // TransportChannelImpl* channel_; 48 // TransportChannelImpl* channel_;
49 // } 49 // }
50 // 50 //
51 // - Data written to SendPacket() is passed directly to |channel_| if it is 51 // - Data written to SendPacket() is passed directly to |channel_| if it is
52 // an SRTP packet with the PF_SRTP_BYPASS flag. 52 // an SRTP packet with the PF_SRTP_BYPASS flag.
53 // 53 //
54 // - |quic_| passes outgoing packets to WritePacket(), which transfers them 54 // - |quic_| passes outgoing packets to WritePacket(), which transfers them
55 // to |channel_| to be sent across the network. 55 // to |channel_| to be sent across the network.
56 // 56 //
57 // - Data which comes into QuicTransportChannel::OnReadPacket is checked to 57 // - Data which comes into QuicTransportChannel::OnReadPacket is checked to
58 // see if it is QUIC, and if it is, passed to |quic_|. SRTP packets are 58 // see if it is QUIC, and if it is, passed to |quic_|. SRTP packets are
59 // signaled upwards as bypass packets. 59 // signaled upwards as bypass packets.
60 // 60 //
61 // - When the QUIC handshake is completed, quic_state() returns 61 // - When the QUIC handshake is completed, quic_state() returns
62 // QUIC_TRANSPORT_CONNECTED and SRTP keying material can be exported. 62 // QUIC_TRANSPORT_CONNECTED and SRTP keying material can be exported.
63 // 63 //
64 // TODO(mikescarlett): Implement secure QUIC handshake, 0-RTT handshakes, and 64 // - CreateQuicStream() creates an outgoing QUIC stream. Once the local peer
65 // QUIC data streams. 65 // sends data from this stream, the remote peer emits SignalIncomingStream
66 // with a QUIC stream of the same id to handle received data.
67 //
68 // TODO(mikescarlett): Implement secure QUIC handshake and 0-RTT handshakes.
66 class QuicTransportChannel : public TransportChannelImpl, 69 class QuicTransportChannel : public TransportChannelImpl,
67 public net::QuicPacketWriter, 70 public net::QuicPacketWriter,
68 public net::QuicCryptoClientStream::ProofHandler { 71 public net::QuicCryptoClientStream::ProofHandler {
69 public: 72 public:
70 // |channel| - the TransportChannelImpl we are wrapping. 73 // |channel| - the TransportChannelImpl we are wrapping.
71 explicit QuicTransportChannel(TransportChannelImpl* channel); 74 explicit QuicTransportChannel(TransportChannelImpl* channel);
72 ~QuicTransportChannel() override; 75 ~QuicTransportChannel() override;
73 76
74 // TransportChannel overrides. 77 // TransportChannel overrides.
75 // TODO(mikescarlett): Implement certificate authentication. 78 // TODO(mikescarlett): Implement certificate authentication.
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 void OnProofVerifyDetailsAvailable( 202 void OnProofVerifyDetailsAvailable(
200 const net::ProofVerifyDetails& verify_details) override; 203 const net::ProofVerifyDetails& verify_details) override;
201 204
202 // Returns true if |quic_| has queued data which wasn't written due 205 // Returns true if |quic_| has queued data which wasn't written due
203 // to |channel_| being write blocked. 206 // to |channel_| being write blocked.
204 bool HasDataToWrite() const; 207 bool HasDataToWrite() const;
205 // Writes queued data for |quic_| when |channel_| is no longer write blocked. 208 // Writes queued data for |quic_| when |channel_| is no longer write blocked.
206 void OnCanWrite(); 209 void OnCanWrite();
207 // Connectivity state of QuicTransportChannel. 210 // Connectivity state of QuicTransportChannel.
208 QuicTransportState quic_state() const { return quic_state_; } 211 QuicTransportState quic_state() const { return quic_state_; }
212 // Creates a new QUIC stream that can send data.
213 ReliableQuicStream* CreateQuicStream();
214
215 // Emitted when |quic_| creates a QUIC stream to receive data from the remote
216 // peer, when the stream did not exist previously.
217 sigslot::signal1<ReliableQuicStream*> SignalIncomingStream;
218 // Emitted when the QuicTransportChannel state becomes QUIC_TRANSPORT_CLOSED.
219 sigslot::signal0<> SignalClosed;
209 220
210 private: 221 private:
211 // Fingerprint of remote peer. 222 // Fingerprint of remote peer.
212 struct RemoteFingerprint { 223 struct RemoteFingerprint {
213 std::string value; 224 std::string value;
214 std::string algorithm; 225 std::string algorithm;
215 }; 226 };
216 227
217 // Callbacks for |channel_|. 228 // Callbacks for |channel_|.
218 void OnReadableState(TransportChannel* channel); 229 void OnReadableState(TransportChannel* channel);
(...skipping 15 matching lines...) Expand all
234 TransportChannel* channel, 245 TransportChannel* channel,
235 CandidatePairInterface* selected_candidate_pair, 246 CandidatePairInterface* selected_candidate_pair,
236 int last_sent_packet_id); 247 int last_sent_packet_id);
237 void OnConnectionRemoved(TransportChannelImpl* channel); 248 void OnConnectionRemoved(TransportChannelImpl* channel);
238 249
239 // Callbacks for |quic_|. 250 // Callbacks for |quic_|.
240 // Called when |quic_| has established the crypto handshake. 251 // Called when |quic_| has established the crypto handshake.
241 void OnHandshakeComplete(); 252 void OnHandshakeComplete();
242 // Called when |quic_| has closed the connection. 253 // Called when |quic_| has closed the connection.
243 void OnConnectionClosed(net::QuicErrorCode error, bool from_peer); 254 void OnConnectionClosed(net::QuicErrorCode error, bool from_peer);
255 // Called when |quic_| has created a new QUIC stream for incoming data.
256 void OnIncomingStream(ReliableQuicStream* stream);
244 257
245 // Called by OnReadPacket() when a QUIC packet is received. 258 // Called by OnReadPacket() when a QUIC packet is received.
246 bool HandleQuicPacket(const char* data, size_t size); 259 bool HandleQuicPacket(const char* data, size_t size);
247 // Sets up the QUIC handshake. 260 // Sets up the QUIC handshake.
248 bool MaybeStartQuic(); 261 bool MaybeStartQuic();
249 // Creates the QUIC connection and |quic_|. 262 // Creates the QUIC connection and |quic_|.
250 bool CreateQuicSession(); 263 bool CreateQuicSession();
251 // Creates the crypto stream and initializes the handshake. 264 // Creates the crypto stream and initializes the handshake.
252 bool StartQuicHandshake(); 265 bool StartQuicHandshake();
253 // Sets the QuicTransportChannel connectivity state. 266 // Sets the QuicTransportChannel connectivity state.
(...skipping 26 matching lines...) Expand all
280 rtc::scoped_refptr<rtc::RTCCertificate> local_certificate_; 293 rtc::scoped_refptr<rtc::RTCCertificate> local_certificate_;
281 // Fingerprint of the remote peer. This must be set before we start QUIC. 294 // Fingerprint of the remote peer. This must be set before we start QUIC.
282 rtc::Optional<RemoteFingerprint> remote_fingerprint_; 295 rtc::Optional<RemoteFingerprint> remote_fingerprint_;
283 296
284 RTC_DISALLOW_COPY_AND_ASSIGN(QuicTransportChannel); 297 RTC_DISALLOW_COPY_AND_ASSIGN(QuicTransportChannel);
285 }; 298 };
286 299
287 } // namespace cricket 300 } // namespace cricket
288 301
289 #endif // WEBRTC_P2P_QUIC_QUICTRANSPORTCHANNEL_H_ 302 #endif // WEBRTC_P2P_QUIC_QUICTRANSPORTCHANNEL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698