OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2013 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 |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 channel_type = DCOMCT_UNORDERED_PARTIAL_RTXS; | 157 channel_type = DCOMCT_UNORDERED_PARTIAL_RTXS; |
158 reliability_param = config.maxRetransmits; | 158 reliability_param = config.maxRetransmits; |
159 } else if (config.maxRetransmitTime > -1) { | 159 } else if (config.maxRetransmitTime > -1) { |
160 channel_type = DCOMCT_UNORDERED_PARTIAL_TIME; | 160 channel_type = DCOMCT_UNORDERED_PARTIAL_TIME; |
161 reliability_param = config.maxRetransmitTime; | 161 reliability_param = config.maxRetransmitTime; |
162 } else { | 162 } else { |
163 channel_type = DCOMCT_UNORDERED_RELIABLE; | 163 channel_type = DCOMCT_UNORDERED_RELIABLE; |
164 } | 164 } |
165 } | 165 } |
166 | 166 |
167 rtc::ByteBufferWriter buffer( | 167 rtc::ByteBufferWriter buffer(nullptr, |
168 NULL, 20 + label.length() + config.protocol.length(), | 168 20 + label.length() + config.protocol.length(), |
169 rtc::ByteBuffer::ORDER_NETWORK); | 169 rtc::ByteBuffer::ORDER_NETWORK); |
170 // TODO(tommi): Add error handling and check resulting length. | 170 // TODO(tommi): Add error handling and check resulting length. |
171 buffer.WriteUInt8(DATA_CHANNEL_OPEN_MESSAGE_TYPE); | 171 buffer.WriteUInt8(DATA_CHANNEL_OPEN_MESSAGE_TYPE); |
172 buffer.WriteUInt8(channel_type); | 172 buffer.WriteUInt8(channel_type); |
173 buffer.WriteUInt16(priority); | 173 buffer.WriteUInt16(priority); |
174 buffer.WriteUInt32(reliability_param); | 174 buffer.WriteUInt32(reliability_param); |
175 buffer.WriteUInt16(static_cast<uint16_t>(label.length())); | 175 buffer.WriteUInt16(static_cast<uint16_t>(label.length())); |
176 buffer.WriteUInt16(static_cast<uint16_t>(config.protocol.length())); | 176 buffer.WriteUInt16(static_cast<uint16_t>(config.protocol.length())); |
177 buffer.WriteString(label); | 177 buffer.WriteString(label); |
178 buffer.WriteString(config.protocol); | 178 buffer.WriteString(config.protocol); |
179 payload->SetData(buffer.Data(), buffer.Length()); | 179 payload->SetData(buffer.Data(), buffer.Length()); |
180 return true; | 180 return true; |
181 } | 181 } |
182 | 182 |
183 void WriteDataChannelOpenAckMessage(rtc::CopyOnWriteBuffer* payload) { | 183 void WriteDataChannelOpenAckMessage(rtc::CopyOnWriteBuffer* payload) { |
184 uint8_t data = DATA_CHANNEL_OPEN_ACK_MESSAGE_TYPE; | 184 uint8_t data = DATA_CHANNEL_OPEN_ACK_MESSAGE_TYPE; |
185 payload->SetData(&data, sizeof(data)); | 185 payload->SetData(&data, sizeof(data)); |
186 } | 186 } |
187 | 187 |
188 } // namespace webrtc | 188 } // namespace webrtc |
OLD | NEW |