OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2004 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 1150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1161 return !available_space; | 1161 return !available_space; |
1162 } | 1162 } |
1163 | 1163 |
1164 void | 1164 void |
1165 PseudoTcp::disableWindowScale() { | 1165 PseudoTcp::disableWindowScale() { |
1166 m_support_wnd_scale = false; | 1166 m_support_wnd_scale = false; |
1167 } | 1167 } |
1168 | 1168 |
1169 void | 1169 void |
1170 PseudoTcp::queueConnectMessage() { | 1170 PseudoTcp::queueConnectMessage() { |
1171 rtc::ByteBuffer buf(rtc::ByteBuffer::ORDER_NETWORK); | 1171 rtc::ByteBufferWriter buf(rtc::ByteBuffer::ORDER_NETWORK); |
1172 | 1172 |
1173 buf.WriteUInt8(CTL_CONNECT); | 1173 buf.WriteUInt8(CTL_CONNECT); |
1174 if (m_support_wnd_scale) { | 1174 if (m_support_wnd_scale) { |
1175 buf.WriteUInt8(TCP_OPT_WND_SCALE); | 1175 buf.WriteUInt8(TCP_OPT_WND_SCALE); |
1176 buf.WriteUInt8(1); | 1176 buf.WriteUInt8(1); |
1177 buf.WriteUInt8(m_rwnd_scale); | 1177 buf.WriteUInt8(m_rwnd_scale); |
1178 } | 1178 } |
1179 m_snd_wnd = static_cast<uint32_t>(buf.Length()); | 1179 m_snd_wnd = static_cast<uint32_t>(buf.Length()); |
1180 queue(buf.Data(), static_cast<uint32_t>(buf.Length()), true); | 1180 queue(buf.Data(), static_cast<uint32_t>(buf.Length()), true); |
1181 } | 1181 } |
1182 | 1182 |
1183 void PseudoTcp::parseOptions(const char* data, uint32_t len) { | 1183 void PseudoTcp::parseOptions(const char* data, uint32_t len) { |
1184 std::set<uint8_t> options_specified; | 1184 std::set<uint8_t> options_specified; |
1185 | 1185 |
1186 // See http://www.freesoft.org/CIE/Course/Section4/8.htm for | 1186 // See http://www.freesoft.org/CIE/Course/Section4/8.htm for |
1187 // parsing the options list. | 1187 // parsing the options list. |
1188 rtc::ByteBuffer buf(data, len); | 1188 rtc::ByteBufferReader buf(data, len); |
1189 while (buf.Length()) { | 1189 while (buf.Length()) { |
1190 uint8_t kind = TCP_OPT_EOL; | 1190 uint8_t kind = TCP_OPT_EOL; |
1191 buf.ReadUInt8(&kind); | 1191 buf.ReadUInt8(&kind); |
1192 | 1192 |
1193 if (kind == TCP_OPT_EOL) { | 1193 if (kind == TCP_OPT_EOL) { |
1194 // End of option list. | 1194 // End of option list. |
1195 break; | 1195 break; |
1196 } else if (kind == TCP_OPT_NOOP) { | 1196 } else if (kind == TCP_OPT_NOOP) { |
1197 // No op. | 1197 // No op. |
1198 continue; | 1198 continue; |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1274 m_rbuf_len = new_size; | 1274 m_rbuf_len = new_size; |
1275 m_rwnd_scale = scale_factor; | 1275 m_rwnd_scale = scale_factor; |
1276 m_ssthresh = new_size; | 1276 m_ssthresh = new_size; |
1277 | 1277 |
1278 size_t available_space = 0; | 1278 size_t available_space = 0; |
1279 m_rbuf.GetWriteRemaining(&available_space); | 1279 m_rbuf.GetWriteRemaining(&available_space); |
1280 m_rcv_wnd = static_cast<uint32_t>(available_space); | 1280 m_rcv_wnd = static_cast<uint32_t>(available_space); |
1281 } | 1281 } |
1282 | 1282 |
1283 } // namespace cricket | 1283 } // namespace cricket |
OLD | NEW |