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 "RTCDataChannelConfiguration+Private.h"
12
13#import "helpers/NSString+StdString.h"
14
15@implementation RTC_OBJC_TYPE (RTCDataChannelConfiguration)
16
17@synthesize nativeDataChannelInit = _nativeDataChannelInit;
18
19- (BOOL)isOrdered {
20  return _nativeDataChannelInit.ordered;
21}
22
23- (void)setIsOrdered:(BOOL)isOrdered {
24  _nativeDataChannelInit.ordered = isOrdered;
25}
26
27- (NSInteger)maxRetransmitTimeMs {
28  return self.maxPacketLifeTime;
29}
30
31- (void)setMaxRetransmitTimeMs:(NSInteger)maxRetransmitTimeMs {
32  self.maxPacketLifeTime = maxRetransmitTimeMs;
33}
34
35- (int)maxPacketLifeTime {
36  return *_nativeDataChannelInit.maxRetransmitTime;
37}
38
39- (void)setMaxPacketLifeTime:(int)maxPacketLifeTime {
40  _nativeDataChannelInit.maxRetransmitTime = maxPacketLifeTime;
41}
42
43- (int)maxRetransmits {
44  if (_nativeDataChannelInit.maxRetransmits) {
45    return *_nativeDataChannelInit.maxRetransmits;
46  } else {
47    return -1;
48  }
49}
50
51- (void)setMaxRetransmits:(int)maxRetransmits {
52  _nativeDataChannelInit.maxRetransmits = maxRetransmits;
53}
54
55- (NSString *)protocol {
56  return [NSString stringForStdString:_nativeDataChannelInit.protocol];
57}
58
59- (void)setProtocol:(NSString *)protocol {
60  _nativeDataChannelInit.protocol = [NSString stdStringForString:protocol];
61}
62
63- (BOOL)isNegotiated {
64  return _nativeDataChannelInit.negotiated;
65}
66
67- (void)setIsNegotiated:(BOOL)isNegotiated {
68  _nativeDataChannelInit.negotiated = isNegotiated;
69}
70
71- (int)streamId {
72  return self.channelId;
73}
74
75- (void)setStreamId:(int)streamId {
76  self.channelId = streamId;
77}
78
79- (int)channelId {
80  return _nativeDataChannelInit.id;
81}
82
83- (void)setChannelId:(int)channelId {
84  _nativeDataChannelInit.id = channelId;
85}
86
87@end
88