blob: 7b503354e4ee412759c804d9fa1b42dd0c596a63 [file] [log] [blame]
Harald Alvestrand7061e512019-04-10 17:20:42 +02001/*
2 * Copyright 2019 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#include "api/dtls_transport_interface.h"
12
13namespace webrtc {
14
15DtlsTransportInformation::DtlsTransportInformation()
16 : state_(DtlsTransportState::kNew) {}
17
18DtlsTransportInformation::DtlsTransportInformation(DtlsTransportState state)
19 : state_(state) {}
20
21DtlsTransportInformation::DtlsTransportInformation(
22 DtlsTransportState state,
Harald Alvestrand114871b2019-04-11 13:37:41 +020023 absl::optional<int> ssl_cipher_suite,
Harald Alvestrand7061e512019-04-10 17:20:42 +020024 std::unique_ptr<rtc::SSLCertChain> remote_ssl_certificates)
25 : state_(state),
Harald Alvestrand114871b2019-04-11 13:37:41 +020026 ssl_cipher_suite_(ssl_cipher_suite),
Harald Alvestrand7061e512019-04-10 17:20:42 +020027 remote_ssl_certificates_(std::move(remote_ssl_certificates)) {}
28
29DtlsTransportInformation::DtlsTransportInformation(
30 const DtlsTransportInformation& c)
31 : state_(c.state()),
Harald Alvestrand114871b2019-04-11 13:37:41 +020032 ssl_cipher_suite_(c.ssl_cipher_suite_),
Harald Alvestrand7061e512019-04-10 17:20:42 +020033 remote_ssl_certificates_(c.remote_ssl_certificates()
34 ? c.remote_ssl_certificates()->Clone()
35 : nullptr) {}
36
37DtlsTransportInformation& DtlsTransportInformation::operator=(
38 const DtlsTransportInformation& c) {
39 state_ = c.state();
Harald Alvestrand114871b2019-04-11 13:37:41 +020040 ssl_cipher_suite_ = c.ssl_cipher_suite_;
Harald Alvestrand7061e512019-04-10 17:20:42 +020041 remote_ssl_certificates_ = c.remote_ssl_certificates()
42 ? c.remote_ssl_certificates()->Clone()
43 : nullptr;
44 return *this;
45}
46
47} // namespace webrtc