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

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

Issue 474383003: Initial P2P implementation for WebRTC on QUIC prototype Base URL: https://chromium.googlesource.com/chromium/src.git@tests-squashed
Patch Set: Created 6 years, 4 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/quic/quic_p2p_server_session.cc ('k') | net/quic/quic_p2p_session.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 // Use of this source code is governed by a BSD-style license that can be
2 // found in the LICENSE file.
3
4 #ifndef NET_QUIC_QUIC_P2P_SESSION_H_
5 #define NET_QUIC_QUIC_P2P_SESSION_H_
6
7 #include "base/memory/scoped_ptr.h"
8 #include "base/strings/string_piece.h"
9 #include "net/base/hash_value.h"
10 #include "net/quic/quic_client_session_base.h"
11 #include "net/quic/quic_message_stream.h"
12 #include "net/quic/quic_protocol.h"
13 #include "net/quic/quic_server_id.h"
14
15 namespace net {
16
17 class QuicConfig;
18 class QuicConnection;
19 class QuicCryptoClientConfig;
20 class QuicCryptoServerConfig;
21 class X509Certificate;
22
23 class NET_EXPORT QuicP2PSession : public QuicClientSessionBase {
24 public:
25 class NET_EXPORT Delegate {
26 public:
27 virtual ~Delegate() {}
28 virtual void OnHandshakeComplete() = 0;
29 // TODO(dmz) merge QuicMessageStream::ReadDelegate?
30 };
31 static QuicP2PSession* Create(bool is_server_role,
32 X509Certificate* local_identity,
33 base::StringPiece private_key,
34 HashValue remote_fingerprint,
35 QuicConnectionHelperInterface* helper,
36 QuicPacketWriter* writer,
37 Delegate* delegate,
38 QuicMessageStream::ReadDelegate* read_delegate);
39
40 // TODO split
41 QuicP2PSession(const QuicConfig& config,
42 QuicConnection* connection,
43 Delegate* delegate,
44 QuicMessageStream::ReadDelegate* read_delegate);
45 virtual ~QuicP2PSession();
46
47 virtual bool Connect() = 0;
48
49 bool GetPeerCertificate(X509Certificate** cert);
50
51 bool OnPacketRead(const char* data, size_t data_len);
52 int WriteMessage(QuicStreamId stream_id, const char* data, size_t data_len);
53
54 bool ExportKeyingMaterial(base::StringPiece label,
55 base::StringPiece context,
56 size_t result_len,
57 string* result);
58
59 bool is_server_role() const { return connection()->is_server(); }
60
61 virtual void OnCryptoHandshakeEvent(CryptoHandshakeEvent event) OVERRIDE;
62
63 virtual void OnProofValid(
64 const QuicCryptoClientConfig::CachedState& cached) OVERRIDE {}
65
66 virtual void OnProofVerifyDetailsAvailable(
67 const ProofVerifyDetails& verify_details) OVERRIDE {}
68
69 protected:
70 // QuicSession methods:
71 virtual QuicDataStream* CreateIncomingDataStream(QuicStreamId id) OVERRIDE;
72 virtual QuicDataStream* CreateOutgoingDataStream() OVERRIDE;
73
74 private:
75 QuicDataStream* CreateDataStream(QuicStreamId id);
76
77 Delegate* delegate_;
78 QuicMessageStream::ReadDelegate* read_delegate_;
79 scoped_ptr<QuicCryptoStream> crypto_stream_;
80
81 DISALLOW_COPY_AND_ASSIGN(QuicP2PSession);
82 };
83
84 } // namespace net
85
86 #endif // NET_QUIC_QUIC_P2P_SESSION_H_
OLDNEW
« no previous file with comments | « net/quic/quic_p2p_server_session.cc ('k') | net/quic/quic_p2p_session.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698