| 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
|
|
|