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 11 #import "RTCDataChannel.h" 12 13 #include "api/data_channel_interface.h" 14 #include "api/scoped_refptr.h" 15 16 NS_ASSUME_NONNULL_BEGIN 17 18 @class RTC_OBJC_TYPE(RTCPeerConnectionFactory); 19 20 @interface RTC_OBJC_TYPE (RTCDataBuffer) 21 () 22 23 /** 24 * The native DataBuffer representation of this RTCDatabuffer object. This is 25 * needed to pass to the underlying C++ APIs. 26 */ 27 @property(nonatomic, readonly) const webrtc::DataBuffer *nativeDataBuffer; 28 29 /** Initialize an RTCDataBuffer from a native DataBuffer. */ 30 - (instancetype)initWithNativeBuffer:(const webrtc::DataBuffer &)nativeBuffer; 31 32 @end 33 34 @interface RTC_OBJC_TYPE (RTCDataChannel) 35 () 36 37 /** Initialize an RTCDataChannel from a native DataChannelInterface. */ 38 - (instancetype)initWithFactory 39 : (RTC_OBJC_TYPE(RTCPeerConnectionFactory) *)factory nativeDataChannel 40 : (rtc::scoped_refptr<webrtc::DataChannelInterface>)nativeDataChannel NS_DESIGNATED_INITIALIZER; 41 42 + (webrtc::DataChannelInterface::DataState)nativeDataChannelStateForState: 43 (RTCDataChannelState)state; 44 45 + (RTCDataChannelState)dataChannelStateForNativeState: 46 (webrtc::DataChannelInterface::DataState)nativeState; 47 48 + (NSString *)stringForState:(RTCDataChannelState)state; 49 50 @end 51 52 NS_ASSUME_NONNULL_END 53