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

Side by Side Diff: net/quic/quic_p2p_endpoint.cc

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_endpoint.h ('k') | net/quic/quic_p2p_server_session.h » ('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 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "net/quic/quic_p2p_endpoint.h"
6
7 namespace net {
8
9 // TODO(dmz): Is this class even necessary?
10
11 QuicP2PEndpoint::QuicP2PEndpoint(bool is_server_role,
12 scoped_refptr<X509Certificate> local_identity,
13 string private_key,
14 HashValue remote_fingerprint,
15 QuicConnectionHelperInterface* helper,
16 QuicPacketWriter* writer,
17 QuicMessageStream::ReadDelegate* read_delegate)
18 : helper_(helper),
19 session_(QuicP2PSession(config_,
20 new QuicConnection(GenerateConnectionId(),
21 IPEndPoint(),
22 helper,
23 is_server_role,
24 QuicSupportedVersions()),
25 read_delegate)) {
26 if (is_server_role) {
27 uint8 seed_random_buf[16];
28 helper->GetRandomGenerator()->RandBytes(seed_random_buf,
29 sizeof(seed_random_buf));
30 string source_address_token_secret = string(
31 reinterpret_cast<char*>(seed_random_buf),
32 sizeof(seed_random_buf));
33 server_config_.reset(new QuicCryptoServerConfig(
34 source_address_token_secret,
35 helper->GetRandomGenerator());
36 // TODO(dmz) more on server_config_
37 session_->InitializeAsServer(*server_config_);
38 } else {
39 client_config_.reset(new QuicCryptoClientConfig());
40 client_config_->SetDefaults();
41 // TODO(dmz) more on client_config_
42 // TODO(dmz) QuicServerId has to match
43 session_->InitializeAsClient(QuicServerId(), *client_config_);
44 }
45 }
46
47 virtual ~QuicP2PEndpoint::QuicP2PEndpoint() {}
48
49 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_p2p_endpoint.h ('k') | net/quic/quic_p2p_server_session.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698