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

Unified 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/quic_p2p_endpoint.cc
diff --git a/net/quic/quic_p2p_endpoint.cc b/net/quic/quic_p2p_endpoint.cc
new file mode 100644
index 0000000000000000000000000000000000000000..be545dac3bf26af13305b8cfe9abe5478470ddf7
--- /dev/null
+++ b/net/quic/quic_p2p_endpoint.cc
@@ -0,0 +1,49 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "net/quic/quic_p2p_endpoint.h"
+
+namespace net {
+
+// TODO(dmz): Is this class even necessary?
+
+QuicP2PEndpoint::QuicP2PEndpoint(bool is_server_role,
+ scoped_refptr<X509Certificate> local_identity,
+ string private_key,
+ HashValue remote_fingerprint,
+ QuicConnectionHelperInterface* helper,
+ QuicPacketWriter* writer,
+ QuicMessageStream::ReadDelegate* read_delegate)
+ : helper_(helper),
+ session_(QuicP2PSession(config_,
+ new QuicConnection(GenerateConnectionId(),
+ IPEndPoint(),
+ helper,
+ is_server_role,
+ QuicSupportedVersions()),
+ read_delegate)) {
+ if (is_server_role) {
+ uint8 seed_random_buf[16];
+ helper->GetRandomGenerator()->RandBytes(seed_random_buf,
+ sizeof(seed_random_buf));
+ string source_address_token_secret = string(
+ reinterpret_cast<char*>(seed_random_buf),
+ sizeof(seed_random_buf));
+ server_config_.reset(new QuicCryptoServerConfig(
+ source_address_token_secret,
+ helper->GetRandomGenerator());
+ // TODO(dmz) more on server_config_
+ session_->InitializeAsServer(*server_config_);
+ } else {
+ client_config_.reset(new QuicCryptoClientConfig());
+ client_config_->SetDefaults();
+ // TODO(dmz) more on client_config_
+ // TODO(dmz) QuicServerId has to match
+ session_->InitializeAsClient(QuicServerId(), *client_config_);
+ }
+}
+
+virtual ~QuicP2PEndpoint::QuicP2PEndpoint() {}
+
+} // namespace net
« 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