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 <AvailabilityMacros.h> |
12 #import <Foundation/Foundation.h> | 12 #import <Foundation/Foundation.h> |
13 | 13 |
| 14 #import "webrtc/base/objc/RTCMacros.h" |
| 15 |
14 NS_ASSUME_NONNULL_BEGIN | 16 NS_ASSUME_NONNULL_BEGIN |
15 | 17 |
| 18 RTC_EXPORT |
16 @interface RTCDataBuffer : NSObject | 19 @interface RTCDataBuffer : NSObject |
17 | 20 |
18 /** NSData representation of the underlying buffer. */ | 21 /** NSData representation of the underlying buffer. */ |
19 @property(nonatomic, readonly) NSData *data; | 22 @property(nonatomic, readonly) NSData *data; |
20 | 23 |
21 /** Indicates whether |data| contains UTF-8 or binary data. */ | 24 /** Indicates whether |data| contains UTF-8 or binary data. */ |
22 @property(nonatomic, readonly) BOOL isBinary; | 25 @property(nonatomic, readonly) BOOL isBinary; |
23 | 26 |
24 - (instancetype)init NS_UNAVAILABLE; | 27 - (instancetype)init NS_UNAVAILABLE; |
25 | 28 |
26 /** | 29 /** |
27 * Initialize an RTCDataBuffer from NSData. |isBinary| indicates whether |data| | 30 * Initialize an RTCDataBuffer from NSData. |isBinary| indicates whether |data| |
28 * contains UTF-8 or binary data. | 31 * contains UTF-8 or binary data. |
29 */ | 32 */ |
30 - (instancetype)initWithData:(NSData *)data isBinary:(BOOL)isBinary; | 33 - (instancetype)initWithData:(NSData *)data isBinary:(BOOL)isBinary; |
31 | 34 |
32 @end | 35 @end |
33 | 36 |
34 | 37 |
35 @class RTCDataChannel; | 38 @class RTCDataChannel; |
| 39 RTC_EXPORT |
36 @protocol RTCDataChannelDelegate <NSObject> | 40 @protocol RTCDataChannelDelegate <NSObject> |
37 | 41 |
38 /** The data channel state changed. */ | 42 /** The data channel state changed. */ |
39 - (void)dataChannelDidChangeState:(RTCDataChannel *)dataChannel; | 43 - (void)dataChannelDidChangeState:(RTCDataChannel *)dataChannel; |
40 | 44 |
41 /** The data channel successfully received a data buffer. */ | 45 /** The data channel successfully received a data buffer. */ |
42 - (void)dataChannel:(RTCDataChannel *)dataChannel | 46 - (void)dataChannel:(RTCDataChannel *)dataChannel |
43 didReceiveMessageWithBuffer:(RTCDataBuffer *)buffer; | 47 didReceiveMessageWithBuffer:(RTCDataBuffer *)buffer; |
44 | 48 |
45 @optional | 49 @optional |
46 /** The data channel's |bufferedAmount| changed. */ | 50 /** The data channel's |bufferedAmount| changed. */ |
47 - (void)dataChannel:(RTCDataChannel *)dataChannel | 51 - (void)dataChannel:(RTCDataChannel *)dataChannel |
48 didChangeBufferedAmount:(uint64_t)amount; | 52 didChangeBufferedAmount:(uint64_t)amount; |
49 | 53 |
50 @end | 54 @end |
51 | 55 |
52 | 56 |
53 /** Represents the state of the data channel. */ | 57 /** Represents the state of the data channel. */ |
54 typedef NS_ENUM(NSInteger, RTCDataChannelState) { | 58 typedef NS_ENUM(NSInteger, RTCDataChannelState) { |
55 RTCDataChannelStateConnecting, | 59 RTCDataChannelStateConnecting, |
56 RTCDataChannelStateOpen, | 60 RTCDataChannelStateOpen, |
57 RTCDataChannelStateClosing, | 61 RTCDataChannelStateClosing, |
58 RTCDataChannelStateClosed, | 62 RTCDataChannelStateClosed, |
59 }; | 63 }; |
60 | 64 |
61 | 65 RTC_EXPORT |
62 @interface RTCDataChannel : NSObject | 66 @interface RTCDataChannel : NSObject |
63 | 67 |
64 /** | 68 /** |
65 * A label that can be used to distinguish this data channel from other data | 69 * A label that can be used to distinguish this data channel from other data |
66 * channel objects. | 70 * channel objects. |
67 */ | 71 */ |
68 @property(nonatomic, readonly) NSString *label; | 72 @property(nonatomic, readonly) NSString *label; |
69 | 73 |
70 /** Whether the data channel can send messages in unreliable mode. */ | 74 /** Whether the data channel can send messages in unreliable mode. */ |
71 @property(nonatomic, readonly) BOOL isReliable DEPRECATED_ATTRIBUTE; | 75 @property(nonatomic, readonly) BOOL isReliable DEPRECATED_ATTRIBUTE; |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 | 125 |
122 /** Closes the data channel. */ | 126 /** Closes the data channel. */ |
123 - (void)close; | 127 - (void)close; |
124 | 128 |
125 /** Attempt to send |data| on this data channel's underlying data transport. */ | 129 /** Attempt to send |data| on this data channel's underlying data transport. */ |
126 - (BOOL)sendData:(RTCDataBuffer *)data; | 130 - (BOOL)sendData:(RTCDataBuffer *)data; |
127 | 131 |
128 @end | 132 @end |
129 | 133 |
130 NS_ASSUME_NONNULL_END | 134 NS_ASSUME_NONNULL_END |
OLD | NEW |