Harald Alvestrand | 7061e51 | 2019-04-10 17:20:42 +0200 | [diff] [blame] | 1 | /* |
| 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 | |
| 13 | namespace webrtc { |
| 14 | |
| 15 | DtlsTransportInformation::DtlsTransportInformation() |
| 16 | : state_(DtlsTransportState::kNew) {} |
| 17 | |
| 18 | DtlsTransportInformation::DtlsTransportInformation(DtlsTransportState state) |
| 19 | : state_(state) {} |
| 20 | |
| 21 | DtlsTransportInformation::DtlsTransportInformation( |
| 22 | DtlsTransportState state, |
Harald Alvestrand | c6c3f86 | 2019-10-29 12:19:31 +0100 | [diff] [blame] | 23 | absl::optional<int> tls_version, |
Harald Alvestrand | 114871b | 2019-04-11 13:37:41 +0200 | [diff] [blame] | 24 | absl::optional<int> ssl_cipher_suite, |
Harald Alvestrand | c6c3f86 | 2019-10-29 12:19:31 +0100 | [diff] [blame] | 25 | absl::optional<int> srtp_cipher_suite, |
Harald Alvestrand | 7061e51 | 2019-04-10 17:20:42 +0200 | [diff] [blame] | 26 | std::unique_ptr<rtc::SSLCertChain> remote_ssl_certificates) |
| 27 | : state_(state), |
Harald Alvestrand | c6c3f86 | 2019-10-29 12:19:31 +0100 | [diff] [blame] | 28 | tls_version_(tls_version), |
Harald Alvestrand | 114871b | 2019-04-11 13:37:41 +0200 | [diff] [blame] | 29 | ssl_cipher_suite_(ssl_cipher_suite), |
Harald Alvestrand | c6c3f86 | 2019-10-29 12:19:31 +0100 | [diff] [blame] | 30 | srtp_cipher_suite_(srtp_cipher_suite), |
Harald Alvestrand | 7061e51 | 2019-04-10 17:20:42 +0200 | [diff] [blame] | 31 | remote_ssl_certificates_(std::move(remote_ssl_certificates)) {} |
| 32 | |
| 33 | DtlsTransportInformation::DtlsTransportInformation( |
| 34 | const DtlsTransportInformation& c) |
| 35 | : state_(c.state()), |
Harald Alvestrand | c6c3f86 | 2019-10-29 12:19:31 +0100 | [diff] [blame] | 36 | tls_version_(c.tls_version_), |
Harald Alvestrand | 114871b | 2019-04-11 13:37:41 +0200 | [diff] [blame] | 37 | ssl_cipher_suite_(c.ssl_cipher_suite_), |
Harald Alvestrand | c6c3f86 | 2019-10-29 12:19:31 +0100 | [diff] [blame] | 38 | srtp_cipher_suite_(c.srtp_cipher_suite_), |
Harald Alvestrand | 7061e51 | 2019-04-10 17:20:42 +0200 | [diff] [blame] | 39 | remote_ssl_certificates_(c.remote_ssl_certificates() |
| 40 | ? c.remote_ssl_certificates()->Clone() |
| 41 | : nullptr) {} |
| 42 | |
| 43 | DtlsTransportInformation& DtlsTransportInformation::operator=( |
| 44 | const DtlsTransportInformation& c) { |
| 45 | state_ = c.state(); |
Harald Alvestrand | c6c3f86 | 2019-10-29 12:19:31 +0100 | [diff] [blame] | 46 | tls_version_ = c.tls_version_; |
Harald Alvestrand | 114871b | 2019-04-11 13:37:41 +0200 | [diff] [blame] | 47 | ssl_cipher_suite_ = c.ssl_cipher_suite_; |
Harald Alvestrand | c6c3f86 | 2019-10-29 12:19:31 +0100 | [diff] [blame] | 48 | srtp_cipher_suite_ = c.srtp_cipher_suite_; |
Harald Alvestrand | 7061e51 | 2019-04-10 17:20:42 +0200 | [diff] [blame] | 49 | remote_ssl_certificates_ = c.remote_ssl_certificates() |
| 50 | ? c.remote_ssl_certificates()->Clone() |
| 51 | : nullptr; |
| 52 | return *this; |
| 53 | } |
| 54 | |
| 55 | } // namespace webrtc |