blob: a68ff8feb027818c13fea2540faa84c0978d6ad6 [file] [log] [blame]
Harald Alvestrand7061e512019-04-10 15:20:421/*
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 11:19:3123 absl::optional<int> tls_version,
Harald Alvestrand114871b2019-04-11 11:37:4124 absl::optional<int> ssl_cipher_suite,
Harald Alvestrandc6c3f862019-10-29 11:19:3125 absl::optional<int> srtp_cipher_suite,
Harald Alvestrand7061e512019-04-10 15:20:4226 std::unique_ptr<rtc::SSLCertChain> remote_ssl_certificates)
27 : state_(state),
Harald Alvestrandc6c3f862019-10-29 11:19:3128 tls_version_(tls_version),
Harald Alvestrand114871b2019-04-11 11:37:4129 ssl_cipher_suite_(ssl_cipher_suite),
Harald Alvestrandc6c3f862019-10-29 11:19:3130 srtp_cipher_suite_(srtp_cipher_suite),
Harald Alvestrand7061e512019-04-10 15:20:4231 remote_ssl_certificates_(std::move(remote_ssl_certificates)) {}
32
33DtlsTransportInformation::DtlsTransportInformation(
34 const DtlsTransportInformation& c)
35 : state_(c.state()),
Harald Alvestrandc6c3f862019-10-29 11:19:3136 tls_version_(c.tls_version_),
Harald Alvestrand114871b2019-04-11 11:37:4137 ssl_cipher_suite_(c.ssl_cipher_suite_),
Harald Alvestrandc6c3f862019-10-29 11:19:3138 srtp_cipher_suite_(c.srtp_cipher_suite_),
Harald Alvestrand7061e512019-04-10 15:20:4239 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 11:19:3146 tls_version_ = c.tls_version_;
Harald Alvestrand114871b2019-04-11 11:37:4147 ssl_cipher_suite_ = c.ssl_cipher_suite_;
Harald Alvestrandc6c3f862019-10-29 11:19:3148 srtp_cipher_suite_ = c.srtp_cipher_suite_;
Harald Alvestrand7061e512019-04-10 15:20:4249 remote_ssl_certificates_ = c.remote_ssl_certificates()
50 ? c.remote_ssl_certificates()->Clone()
51 : nullptr;
52 return *this;
53}
54
55} // namespace webrtc