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