blob: a68ff8feb027818c13fea2540faa84c0978d6ad6 [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 Alvestrandc6c3f862019-10-29 12:19:31 +010023 absl::optional<int> tls_version,
Harald Alvestrand114871b2019-04-11 13:37:41 +020024 absl::optional<int> ssl_cipher_suite,
Harald Alvestrandc6c3f862019-10-29 12:19:31 +010025 absl::optional<int> srtp_cipher_suite,
Harald Alvestrand7061e512019-04-10 17:20:42 +020026 std::unique_ptr<rtc::SSLCertChain> remote_ssl_certificates)
27 : state_(state),
Harald Alvestrandc6c3f862019-10-29 12:19:31 +010028 tls_version_(tls_version),
Harald Alvestrand114871b2019-04-11 13:37:41 +020029 ssl_cipher_suite_(ssl_cipher_suite),
Harald Alvestrandc6c3f862019-10-29 12:19:31 +010030 srtp_cipher_suite_(srtp_cipher_suite),
Harald Alvestrand7061e512019-04-10 17:20:42 +020031 remote_ssl_certificates_(std::move(remote_ssl_certificates)) {}
32
33DtlsTransportInformation::DtlsTransportInformation(
34 const DtlsTransportInformation& c)
35 : state_(c.state()),
Harald Alvestrandc6c3f862019-10-29 12:19:31 +010036 tls_version_(c.tls_version_),
Harald Alvestrand114871b2019-04-11 13:37:41 +020037 ssl_cipher_suite_(c.ssl_cipher_suite_),
Harald Alvestrandc6c3f862019-10-29 12:19:31 +010038 srtp_cipher_suite_(c.srtp_cipher_suite_),
Harald Alvestrand7061e512019-04-10 17:20:42 +020039 remote_ssl_certificates_(c.remote_ssl_certificates()
40 ? c.remote_ssl_certificates()->Clone()
41 : nullptr) {}
42
43DtlsTransportInformation& DtlsTransportInformation::operator=(
44 const DtlsTransportInformation& c) {
45 state_ = c.state();
Harald Alvestrandc6c3f862019-10-29 12:19:31 +010046 tls_version_ = c.tls_version_;
Harald Alvestrand114871b2019-04-11 13:37:41 +020047 ssl_cipher_suite_ = c.ssl_cipher_suite_;
Harald Alvestrandc6c3f862019-10-29 12:19:31 +010048 srtp_cipher_suite_ = c.srtp_cipher_suite_;
Harald Alvestrand7061e512019-04-10 17:20:42 +020049 remote_ssl_certificates_ = c.remote_ssl_certificates()
50 ? c.remote_ssl_certificates()->Clone()
51 : nullptr;
52 return *this;
53}
54
55} // namespace webrtc