hjon | e373dc2 | 2016-01-22 14:04:27 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2015 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 | |
Anders Carlsson | 7bca8ca | 2018-08-30 09:30:29 +0200 | [diff] [blame^] | 11 | #import "RTCDataChannel.h" |
hjon | e373dc2 | 2016-01-22 14:04:27 -0800 | [diff] [blame] | 12 | |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 13 | #include "api/datachannelinterface.h" |
| 14 | #include "rtc_base/scoped_ref_ptr.h" |
hjon | e373dc2 | 2016-01-22 14:04:27 -0800 | [diff] [blame] | 15 | |
| 16 | NS_ASSUME_NONNULL_BEGIN |
| 17 | |
Yura Yaroshevich | c75b35a | 2018-06-27 17:09:14 +0300 | [diff] [blame] | 18 | @class RTCPeerConnectionFactory; |
| 19 | |
hjon | e373dc2 | 2016-01-22 14:04:27 -0800 | [diff] [blame] | 20 | @interface RTCDataBuffer () |
| 21 | |
| 22 | /** |
| 23 | * The native DataBuffer representation of this RTCDatabuffer object. This is |
| 24 | * needed to pass to the underlying C++ APIs. |
| 25 | */ |
| 26 | @property(nonatomic, readonly) const webrtc::DataBuffer *nativeDataBuffer; |
| 27 | |
| 28 | /** Initialize an RTCDataBuffer from a native DataBuffer. */ |
Yves Gerey | 665174f | 2018-06-19 15:03:05 +0200 | [diff] [blame] | 29 | - (instancetype)initWithNativeBuffer:(const webrtc::DataBuffer &)nativeBuffer; |
hjon | e373dc2 | 2016-01-22 14:04:27 -0800 | [diff] [blame] | 30 | |
| 31 | @end |
| 32 | |
hjon | e373dc2 | 2016-01-22 14:04:27 -0800 | [diff] [blame] | 33 | @interface RTCDataChannel () |
| 34 | |
| 35 | /** Initialize an RTCDataChannel from a native DataChannelInterface. */ |
Yura Yaroshevich | c75b35a | 2018-06-27 17:09:14 +0300 | [diff] [blame] | 36 | - (instancetype)initWithFactory:(RTCPeerConnectionFactory *)factory |
| 37 | nativeDataChannel:(rtc::scoped_refptr<webrtc::DataChannelInterface>)nativeDataChannel |
hjon | e373dc2 | 2016-01-22 14:04:27 -0800 | [diff] [blame] | 38 | NS_DESIGNATED_INITIALIZER; |
| 39 | |
Yves Gerey | 665174f | 2018-06-19 15:03:05 +0200 | [diff] [blame] | 40 | + (webrtc::DataChannelInterface::DataState)nativeDataChannelStateForState: |
| 41 | (RTCDataChannelState)state; |
hjon | e373dc2 | 2016-01-22 14:04:27 -0800 | [diff] [blame] | 42 | |
| 43 | + (RTCDataChannelState)dataChannelStateForNativeState: |
Yves Gerey | 665174f | 2018-06-19 15:03:05 +0200 | [diff] [blame] | 44 | (webrtc::DataChannelInterface::DataState)nativeState; |
hjon | e373dc2 | 2016-01-22 14:04:27 -0800 | [diff] [blame] | 45 | |
| 46 | + (NSString *)stringForState:(RTCDataChannelState)state; |
| 47 | |
| 48 | @end |
| 49 | |
| 50 | NS_ASSUME_NONNULL_END |