| OLD | NEW |
| 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 11 matching lines...) Expand all Loading... |
| 22 #include "webrtc/base/sslidentity.h" | 22 #include "webrtc/base/sslidentity.h" |
| 23 #include "webrtc/p2p/quic/reliablequicstream.h" | 23 #include "webrtc/p2p/quic/reliablequicstream.h" |
| 24 | 24 |
| 25 namespace cricket { | 25 namespace cricket { |
| 26 | 26 |
| 27 // This class provides a QUIC session over peer-to-peer transport that | 27 // This class provides a QUIC session over peer-to-peer transport that |
| 28 // negotiates the crypto handshake (using QuicCryptoHandshake) and provides | 28 // negotiates the crypto handshake (using QuicCryptoHandshake) and provides |
| 29 // reading/writing of data using QUIC packets. | 29 // reading/writing of data using QUIC packets. |
| 30 class QuicSession : public net::QuicSession, public sigslot::has_slots<> { | 30 class QuicSession : public net::QuicSession, public sigslot::has_slots<> { |
| 31 public: | 31 public: |
| 32 QuicSession(scoped_ptr<net::QuicConnection> connection, | 32 QuicSession(rtc::scoped_ptr<net::QuicConnection> connection, |
| 33 const net::QuicConfig& config); | 33 const net::QuicConfig& config); |
| 34 ~QuicSession() override; | 34 ~QuicSession() override; |
| 35 | 35 |
| 36 // Initiates client crypto handshake by sending client hello. | 36 // Initiates client crypto handshake by sending client hello. |
| 37 void StartClientHandshake(net::QuicCryptoClientStream* crypto_stream); | 37 void StartClientHandshake(net::QuicCryptoClientStream* crypto_stream); |
| 38 | 38 |
| 39 // Responds to a client who has inititated the crypto handshake. | 39 // Responds to a client who has inititated the crypto handshake. |
| 40 void StartServerHandshake(net::QuicCryptoServerStream* crypto_stream); | 40 void StartServerHandshake(net::QuicCryptoServerStream* crypto_stream); |
| 41 | 41 |
| 42 // QuicSession overrides. | 42 // QuicSession overrides. |
| 43 net::QuicCryptoStream* GetCryptoStream() override { | 43 net::QuicCryptoStream* GetCryptoStream() override { |
| 44 return crypto_stream_.get(); | 44 return crypto_stream_.get(); |
| 45 } | 45 } |
| 46 // TODO(mikescarlett): Verify whether outgoing streams should be owned by | |
| 47 // caller. It appears these are deleted in the net::QuicSession destructor, | |
| 48 // but Chromium's documentation says this should not happen. | |
| 49 ReliableQuicStream* CreateOutgoingDynamicStream( | 46 ReliableQuicStream* CreateOutgoingDynamicStream( |
| 50 net::SpdyPriority priority) override; | 47 net::SpdyPriority priority) override; |
| 51 | 48 |
| 52 // QuicSession optional overrides. | 49 // QuicSession optional overrides. |
| 53 void OnCryptoHandshakeEvent(CryptoHandshakeEvent event) override; | 50 void OnCryptoHandshakeEvent(CryptoHandshakeEvent event) override; |
| 54 | 51 |
| 55 // QuicConnectionVisitorInterface overrides. | 52 // QuicConnectionVisitorInterface overrides. |
| 56 void OnConnectionClosed(net::QuicErrorCode error, bool from_peer) override; | 53 void OnConnectionClosed(net::QuicErrorCode error, |
| 54 net::ConnectionCloseSource source) override; |
| 57 | 55 |
| 58 // Exports keying material for SRTP. | 56 // Exports keying material for SRTP. |
| 59 bool ExportKeyingMaterial(base::StringPiece label, | 57 bool ExportKeyingMaterial(base::StringPiece label, |
| 60 base::StringPiece context, | 58 base::StringPiece context, |
| 61 size_t result_len, | 59 size_t result_len, |
| 62 string* result); | 60 string* result); |
| 63 | 61 |
| 64 // Decrypts an incoming QUIC packet to a data stream. | 62 // Decrypts an incoming QUIC packet to a data stream. |
| 65 bool OnReadPacket(const char* data, size_t data_len); | 63 bool OnReadPacket(const char* data, size_t data_len); |
| 66 | 64 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 77 // Sets the QUIC crypto stream and takes ownership of it. | 75 // Sets the QUIC crypto stream and takes ownership of it. |
| 78 void SetCryptoStream(net::QuicCryptoStream* crypto_stream); | 76 void SetCryptoStream(net::QuicCryptoStream* crypto_stream); |
| 79 | 77 |
| 80 // QuicSession override. | 78 // QuicSession override. |
| 81 ReliableQuicStream* CreateIncomingDynamicStream( | 79 ReliableQuicStream* CreateIncomingDynamicStream( |
| 82 net::QuicStreamId id) override; | 80 net::QuicStreamId id) override; |
| 83 | 81 |
| 84 virtual ReliableQuicStream* CreateDataStream(net::QuicStreamId id); | 82 virtual ReliableQuicStream* CreateDataStream(net::QuicStreamId id); |
| 85 | 83 |
| 86 private: | 84 private: |
| 87 scoped_ptr<net::QuicCryptoStream> crypto_stream_; | 85 rtc::scoped_ptr<net::QuicCryptoStream> crypto_stream_; |
| 88 | 86 |
| 89 RTC_DISALLOW_COPY_AND_ASSIGN(QuicSession); | 87 RTC_DISALLOW_COPY_AND_ASSIGN(QuicSession); |
| 90 }; | 88 }; |
| 91 | 89 |
| 92 } // namespace cricket | 90 } // namespace cricket |
| 93 | 91 |
| 94 #endif // WEBRTC_P2P_QUIC_QUICSESSION_H_ | 92 #endif // WEBRTC_P2P_QUIC_QUICSESSION_H_ |
| OLD | NEW |