OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 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 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 SctpDataMediaChannel* channel = static_cast<SctpDataMediaChannel*>(addr); | 186 SctpDataMediaChannel* channel = static_cast<SctpDataMediaChannel*>(addr); |
187 LOG(LS_VERBOSE) << "global OnSctpOutboundPacket():" | 187 LOG(LS_VERBOSE) << "global OnSctpOutboundPacket():" |
188 << "addr: " << addr << "; length: " << length | 188 << "addr: " << addr << "; length: " << length |
189 << "; tos: " << std::hex << static_cast<int>(tos) | 189 << "; tos: " << std::hex << static_cast<int>(tos) |
190 << "; set_df: " << std::hex << static_cast<int>(set_df); | 190 << "; set_df: " << std::hex << static_cast<int>(set_df); |
191 | 191 |
192 VerboseLogPacket(addr, length, SCTP_DUMP_OUTBOUND); | 192 VerboseLogPacket(addr, length, SCTP_DUMP_OUTBOUND); |
193 // Note: We have to copy the data; the caller will delete it. | 193 // Note: We have to copy the data; the caller will delete it. |
194 auto* msg = new OutboundPacketMessage( | 194 auto* msg = new OutboundPacketMessage( |
195 new rtc::CopyOnWriteBuffer(reinterpret_cast<uint8_t*>(data), length)); | 195 new rtc::CopyOnWriteBuffer(reinterpret_cast<uint8_t*>(data), length)); |
196 channel->worker_thread()->Post(channel, MSG_SCTPOUTBOUNDPACKET, msg); | 196 channel->worker_thread()->Post(FROM_HERE, channel, MSG_SCTPOUTBOUNDPACKET, |
| 197 msg); |
197 return 0; | 198 return 0; |
198 } | 199 } |
199 | 200 |
200 // This is the callback called from usrsctp when data has been received, after | 201 // This is the callback called from usrsctp when data has been received, after |
201 // a packet has been interpreted and parsed by usrsctp and found to contain | 202 // a packet has been interpreted and parsed by usrsctp and found to contain |
202 // payload data. It is called by a usrsctp thread. It is assumed this function | 203 // payload data. It is called by a usrsctp thread. It is assumed this function |
203 // will free the memory used by 'data'. | 204 // will free the memory used by 'data'. |
204 static int OnSctpInboundPacket(struct socket* sock, union sctp_sockstore addr, | 205 static int OnSctpInboundPacket(struct socket* sock, union sctp_sockstore addr, |
205 void* data, size_t length, | 206 void* data, size_t length, |
206 struct sctp_rcvinfo rcv, int flags, | 207 struct sctp_rcvinfo rcv, int flags, |
(...skipping 13 matching lines...) Expand all Loading... |
220 } else { | 221 } else { |
221 SctpInboundPacket* packet = new SctpInboundPacket; | 222 SctpInboundPacket* packet = new SctpInboundPacket; |
222 packet->buffer.SetData(reinterpret_cast<uint8_t*>(data), length); | 223 packet->buffer.SetData(reinterpret_cast<uint8_t*>(data), length); |
223 packet->params.ssrc = rcv.rcv_sid; | 224 packet->params.ssrc = rcv.rcv_sid; |
224 packet->params.seq_num = rcv.rcv_ssn; | 225 packet->params.seq_num = rcv.rcv_ssn; |
225 packet->params.timestamp = rcv.rcv_tsn; | 226 packet->params.timestamp = rcv.rcv_tsn; |
226 packet->params.type = type; | 227 packet->params.type = type; |
227 packet->flags = flags; | 228 packet->flags = flags; |
228 // The ownership of |packet| transfers to |msg|. | 229 // The ownership of |packet| transfers to |msg|. |
229 InboundPacketMessage* msg = new InboundPacketMessage(packet); | 230 InboundPacketMessage* msg = new InboundPacketMessage(packet); |
230 channel->worker_thread()->Post(channel, MSG_SCTPINBOUNDPACKET, msg); | 231 channel->worker_thread()->Post(FROM_HERE, channel, MSG_SCTPINBOUNDPACKET, |
| 232 msg); |
231 } | 233 } |
232 free(data); | 234 free(data); |
233 return 1; | 235 return 1; |
234 } | 236 } |
235 | 237 |
236 // Set the initial value of the static SCTP Data Engines reference count. | 238 // Set the initial value of the static SCTP Data Engines reference count. |
237 int SctpDataEngine::usrsctp_engines_count = 0; | 239 int SctpDataEngine::usrsctp_engines_count = 0; |
238 | 240 |
239 SctpDataEngine::SctpDataEngine() { | 241 SctpDataEngine::SctpDataEngine() { |
240 if (usrsctp_engines_count == 0) { | 242 if (usrsctp_engines_count == 0) { |
(...skipping 792 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1033 } | 1035 } |
1034 case MSG_SCTPOUTBOUNDPACKET: { | 1036 case MSG_SCTPOUTBOUNDPACKET: { |
1035 std::unique_ptr<OutboundPacketMessage> pdata( | 1037 std::unique_ptr<OutboundPacketMessage> pdata( |
1036 static_cast<OutboundPacketMessage*>(msg->pdata)); | 1038 static_cast<OutboundPacketMessage*>(msg->pdata)); |
1037 OnPacketFromSctpToNetwork(pdata->data().get()); | 1039 OnPacketFromSctpToNetwork(pdata->data().get()); |
1038 break; | 1040 break; |
1039 } | 1041 } |
1040 } | 1042 } |
1041 } | 1043 } |
1042 } // namespace cricket | 1044 } // namespace cricket |
OLD | NEW |