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

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

Issue 1648763002: Create QuicSession (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Sync webrtc/build/common.gypi to fix patch issue Created 4 years, 10 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 | « webrtc/p2p/quic/quicconnectionhelper_unittest.cc ('k') | webrtc/p2p/quic/quicsession.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * Copyright 2016 The WebRTC Project Authors. All rights reserved.
3 *
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
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11 #ifndef WEBRTC_P2P_QUIC_QUICSESSION_H_
12 #define WEBRTC_P2P_QUIC_QUICSESSION_H_
13
14 #include <string>
15
16 #include "net/quic/quic_crypto_client_stream.h"
17 #include "net/quic/quic_crypto_server_stream.h"
18 #include "net/quic/quic_crypto_stream.h"
19 #include "net/quic/quic_session.h"
20 #include "webrtc/base/constructormagic.h"
21 #include "webrtc/base/sigslot.h"
22 #include "webrtc/base/sslidentity.h"
23 #include "webrtc/p2p/quic/reliablequicstream.h"
24
25 namespace cricket {
26
27 // This class provides a QUIC session over peer-to-peer transport that
28 // negotiates the crypto handshake (using QuicCryptoHandshake) and provides
29 // reading/writing of data using QUIC packets.
30 class QuicSession : public net::QuicSession, public sigslot::has_slots<> {
31 public:
32 QuicSession(scoped_ptr<net::QuicConnection> connection,
33 const net::QuicConfig& config);
34 ~QuicSession() override;
35
36 // Initiates client crypto handshake by sending client hello.
37 void StartClientHandshake(net::QuicCryptoClientStream* crypto_stream);
38
39 // Responds to a client who has inititated the crypto handshake.
40 void StartServerHandshake(net::QuicCryptoServerStream* crypto_stream);
41
42 // QuicSession overrides.
43 net::QuicCryptoStream* GetCryptoStream() override {
44 return crypto_stream_.get();
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(
50 net::SpdyPriority priority) override;
51
52 // QuicSession optional overrides.
53 void OnCryptoHandshakeEvent(CryptoHandshakeEvent event) override;
54
55 // QuicConnectionVisitorInterface overrides.
56 void OnConnectionClosed(net::QuicErrorCode error, bool from_peer) override;
57
58 // Exports keying material for SRTP.
59 bool ExportKeyingMaterial(base::StringPiece label,
60 base::StringPiece context,
61 size_t result_len,
62 string* result);
63
64 // Decrypts an incoming QUIC packet to a data stream.
65 bool OnReadPacket(const char* data, size_t data_len);
66
67 // Called when peers have established forward-secure encryption
68 sigslot::signal0<> SignalHandshakeComplete;
69 // Called when connection closes locally, or remotely by peer.
70 sigslot::signal2<net::QuicErrorCode, bool> SignalConnectionClosed;
71 // Called when an incoming QUIC stream is created so we can process data
72 // from it by registering a listener to
73 // ReliableQuicStream::SignalDataReceived.
74 sigslot::signal1<ReliableQuicStream*> SignalIncomingStream;
75
76 protected:
77 // Sets the QUIC crypto stream and takes ownership of it.
78 void SetCryptoStream(net::QuicCryptoStream* crypto_stream);
79
80 // QuicSession override.
81 ReliableQuicStream* CreateIncomingDynamicStream(
82 net::QuicStreamId id) override;
83
84 virtual ReliableQuicStream* CreateDataStream(net::QuicStreamId id);
85
86 private:
87 scoped_ptr<net::QuicCryptoStream> crypto_stream_;
88
89 RTC_DISALLOW_COPY_AND_ASSIGN(QuicSession);
90 };
91
92 } // namespace cricket
93
94 #endif // WEBRTC_P2P_QUIC_QUICSESSION_H_
OLDNEW
« no previous file with comments | « webrtc/p2p/quic/quicconnectionhelper_unittest.cc ('k') | webrtc/p2p/quic/quicsession.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698