blob: 103a130390c062bc6ec76ca0ae77c0f52fec3fe9 [file] [log] [blame]
Yura Yaroshevichbf567122018-01-02 13:33:16 +03001/*
2 * Copyright 2017 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#import "RTCPeerConnectionFactoryOptions+Private.h"
12
13#include "rtc_base/network_constants.h"
14
15namespace {
16
17void setNetworkBit(webrtc::PeerConnectionFactoryInterface::Options* options,
18 rtc::AdapterType type,
19 bool ignore) {
20 if (ignore) {
21 options->network_ignore_mask |= type;
22 } else {
23 options->network_ignore_mask &= ~type;
24 }
25}
26} // namespace
27
28@implementation RTCPeerConnectionFactoryOptions
29
30@synthesize disableEncryption = _disableEncryption;
31@synthesize disableNetworkMonitor = _disableNetworkMonitor;
32@synthesize ignoreLoopbackNetworkAdapter = _ignoreLoopbackNetworkAdapter;
33@synthesize ignoreVPNNetworkAdapter = _ignoreVPNNetworkAdapter;
34@synthesize ignoreCellularNetworkAdapter = _ignoreCellularNetworkAdapter;
35@synthesize ignoreWiFiNetworkAdapter = _ignoreWiFiNetworkAdapter;
36@synthesize ignoreEthernetNetworkAdapter = _ignoreEthernetNetworkAdapter;
Taylor Brandstetter5e55fe82018-03-23 11:50:16 -070037@synthesize enableAes128Sha1_32CryptoCipher = _enableAes128Sha1_32CryptoCipher;
Benjamin Wrightd0136b82018-07-17 16:51:55 -070038@synthesize enableGcmCryptoSuites = _enableGcmCryptoSuites;
Yura Yaroshevichbf567122018-01-02 13:33:16 +030039
40- (instancetype)init {
41 return [super init];
42}
43
44- (webrtc::PeerConnectionFactoryInterface::Options)nativeOptions {
45 webrtc::PeerConnectionFactoryInterface::Options options;
46 options.disable_encryption = self.disableEncryption;
47 options.disable_network_monitor = self.disableNetworkMonitor;
48
49 setNetworkBit(&options, rtc::ADAPTER_TYPE_LOOPBACK, self.ignoreLoopbackNetworkAdapter);
50 setNetworkBit(&options, rtc::ADAPTER_TYPE_VPN, self.ignoreVPNNetworkAdapter);
51 setNetworkBit(&options, rtc::ADAPTER_TYPE_CELLULAR, self.ignoreCellularNetworkAdapter);
52 setNetworkBit(&options, rtc::ADAPTER_TYPE_WIFI, self.ignoreWiFiNetworkAdapter);
53 setNetworkBit(&options, rtc::ADAPTER_TYPE_ETHERNET, self.ignoreEthernetNetworkAdapter);
54
Taylor Brandstetter5e55fe82018-03-23 11:50:16 -070055 options.crypto_options.enable_aes128_sha1_32_crypto_cipher = self.enableAes128Sha1_32CryptoCipher;
Benjamin Wrightd0136b82018-07-17 16:51:55 -070056 options.crypto_options.enable_gcm_crypto_suites = self.enableGcmCryptoSuites;
Taylor Brandstetter5e55fe82018-03-23 11:50:16 -070057
Yura Yaroshevichbf567122018-01-02 13:33:16 +030058 return options;
59}
60
61@end