| OLD | NEW |
| (Empty) |
| 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 <AvailabilityMacros.h> | |
| 12 #import <Foundation/Foundation.h> | |
| 13 | |
| 14 #import "webrtc/base/objc/RTCMacros.h" | |
| 15 | |
| 16 NS_ASSUME_NONNULL_BEGIN | |
| 17 | |
| 18 RTC_EXPORT | |
| 19 @interface RTCDataBuffer : NSObject | |
| 20 | |
| 21 /** NSData representation of the underlying buffer. */ | |
| 22 @property(nonatomic, readonly) NSData *data; | |
| 23 | |
| 24 /** Indicates whether |data| contains UTF-8 or binary data. */ | |
| 25 @property(nonatomic, readonly) BOOL isBinary; | |
| 26 | |
| 27 - (instancetype)init NS_UNAVAILABLE; | |
| 28 | |
| 29 /** | |
| 30 * Initialize an RTCDataBuffer from NSData. |isBinary| indicates whether |data| | |
| 31 * contains UTF-8 or binary data. | |
| 32 */ | |
| 33 - (instancetype)initWithData:(NSData *)data isBinary:(BOOL)isBinary; | |
| 34 | |
| 35 @end | |
| 36 | |
| 37 | |
| 38 @class RTCDataChannel; | |
| 39 RTC_EXPORT | |
| 40 @protocol RTCDataChannelDelegate <NSObject> | |
| 41 | |
| 42 /** The data channel state changed. */ | |
| 43 - (void)dataChannelDidChangeState:(RTCDataChannel *)dataChannel; | |
| 44 | |
| 45 /** The data channel successfully received a data buffer. */ | |
| 46 - (void)dataChannel:(RTCDataChannel *)dataChannel | |
| 47 didReceiveMessageWithBuffer:(RTCDataBuffer *)buffer; | |
| 48 | |
| 49 @optional | |
| 50 /** The data channel's |bufferedAmount| changed. */ | |
| 51 - (void)dataChannel:(RTCDataChannel *)dataChannel | |
| 52 didChangeBufferedAmount:(uint64_t)amount; | |
| 53 | |
| 54 @end | |
| 55 | |
| 56 | |
| 57 /** Represents the state of the data channel. */ | |
| 58 typedef NS_ENUM(NSInteger, RTCDataChannelState) { | |
| 59 RTCDataChannelStateConnecting, | |
| 60 RTCDataChannelStateOpen, | |
| 61 RTCDataChannelStateClosing, | |
| 62 RTCDataChannelStateClosed, | |
| 63 }; | |
| 64 | |
| 65 RTC_EXPORT | |
| 66 @interface RTCDataChannel : NSObject | |
| 67 | |
| 68 /** | |
| 69 * A label that can be used to distinguish this data channel from other data | |
| 70 * channel objects. | |
| 71 */ | |
| 72 @property(nonatomic, readonly) NSString *label; | |
| 73 | |
| 74 /** Whether the data channel can send messages in unreliable mode. */ | |
| 75 @property(nonatomic, readonly) BOOL isReliable DEPRECATED_ATTRIBUTE; | |
| 76 | |
| 77 /** Returns whether this data channel is ordered or not. */ | |
| 78 @property(nonatomic, readonly) BOOL isOrdered; | |
| 79 | |
| 80 /** Deprecated. Use maxPacketLifeTime. */ | |
| 81 @property(nonatomic, readonly) NSUInteger maxRetransmitTime | |
| 82 DEPRECATED_ATTRIBUTE; | |
| 83 | |
| 84 /** | |
| 85 * The length of the time window (in milliseconds) during which transmissions | |
| 86 * and retransmissions may occur in unreliable mode. | |
| 87 */ | |
| 88 @property(nonatomic, readonly) uint16_t maxPacketLifeTime; | |
| 89 | |
| 90 /** | |
| 91 * The maximum number of retransmissions that are attempted in unreliable mode. | |
| 92 */ | |
| 93 @property(nonatomic, readonly) uint16_t maxRetransmits; | |
| 94 | |
| 95 /** | |
| 96 * The name of the sub-protocol used with this data channel, if any. Otherwise | |
| 97 * this returns an empty string. | |
| 98 */ | |
| 99 @property(nonatomic, readonly) NSString *protocol; | |
| 100 | |
| 101 /** | |
| 102 * Returns whether this data channel was negotiated by the application or not. | |
| 103 */ | |
| 104 @property(nonatomic, readonly) BOOL isNegotiated; | |
| 105 | |
| 106 /** Deprecated. Use channelId. */ | |
| 107 @property(nonatomic, readonly) NSInteger streamId DEPRECATED_ATTRIBUTE; | |
| 108 | |
| 109 /** The identifier for this data channel. */ | |
| 110 @property(nonatomic, readonly) int channelId; | |
| 111 | |
| 112 /** The state of the data channel. */ | |
| 113 @property(nonatomic, readonly) RTCDataChannelState readyState; | |
| 114 | |
| 115 /** | |
| 116 * The number of bytes of application data that have been queued using | |
| 117 * |sendData:| but that have not yet been transmitted to the network. | |
| 118 */ | |
| 119 @property(nonatomic, readonly) uint64_t bufferedAmount; | |
| 120 | |
| 121 /** The delegate for this data channel. */ | |
| 122 @property(nonatomic, weak) id<RTCDataChannelDelegate> delegate; | |
| 123 | |
| 124 - (instancetype)init NS_UNAVAILABLE; | |
| 125 | |
| 126 /** Closes the data channel. */ | |
| 127 - (void)close; | |
| 128 | |
| 129 /** Attempt to send |data| on this data channel's underlying data transport. */ | |
| 130 - (BOOL)sendData:(RTCDataBuffer *)data; | |
| 131 | |
| 132 @end | |
| 133 | |
| 134 NS_ASSUME_NONNULL_END | |
| OLD | NEW |