OLD | NEW |
1 /* | 1 /* |
2 * libjingle | 2 * Copyright 2012 The WebRTC Project Authors. All rights reserved. |
3 * Copyright 2012 Google Inc. and Robin Seggelmann | |
4 * | 3 * |
5 * Redistribution and use in source and binary forms, with or without | 4 * Use of this source code is governed by a BSD-style license |
6 * modification, are permitted provided that the following conditions are met: | 5 * that can be found in the LICENSE file in the root of the source |
7 * | 6 * tree. An additional intellectual property rights grant can be found |
8 * 1. Redistributions of source code must retain the above copyright notice, | 7 * in the file PATENTS. All contributing project authors may |
9 * this list of conditions and the following disclaimer. | 8 * be found in the AUTHORS file in the root of the source tree. |
10 * 2. Redistributions in binary form must reproduce the above copyright notice, | |
11 * this list of conditions and the following disclaimer in the documentation | |
12 * and/or other materials provided with the distribution. | |
13 * 3. The name of the author may not be used to endorse or promote products | |
14 * derived from this software without specific prior written permission. | |
15 * | |
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED | |
17 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | |
18 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO | |
19 * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
20 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | |
21 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; | |
22 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | |
23 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR | |
24 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | |
25 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
26 */ | 9 */ |
27 | 10 |
28 #include "talk/media/sctp/sctpdataengine.h" | 11 #include "webrtc/media/sctp/sctpdataengine.h" |
29 | 12 |
30 #include <stdarg.h> | 13 #include <stdarg.h> |
31 #include <stdio.h> | 14 #include <stdio.h> |
32 #include <sstream> | 15 #include <sstream> |
33 #include <vector> | 16 #include <vector> |
34 | 17 |
35 #include "talk/media/base/codec.h" | |
36 #include "talk/media/base/constants.h" | |
37 #include "talk/media/base/streamparams.h" | |
38 #include "usrsctplib/usrsctp.h" | 18 #include "usrsctplib/usrsctp.h" |
39 #include "webrtc/base/arraysize.h" | 19 #include "webrtc/base/arraysize.h" |
40 #include "webrtc/base/buffer.h" | 20 #include "webrtc/base/buffer.h" |
41 #include "webrtc/base/helpers.h" | 21 #include "webrtc/base/helpers.h" |
42 #include "webrtc/base/logging.h" | 22 #include "webrtc/base/logging.h" |
43 #include "webrtc/base/safe_conversions.h" | 23 #include "webrtc/base/safe_conversions.h" |
| 24 #include "webrtc/media/base/codec.h" |
| 25 #include "webrtc/media/base/constants.h" |
| 26 #include "webrtc/media/base/streamparams.h" |
44 | 27 |
45 namespace { | 28 namespace { |
46 typedef cricket::SctpDataMediaChannel::StreamSet StreamSet; | 29 typedef cricket::SctpDataMediaChannel::StreamSet StreamSet; |
47 // Returns a comma-separated, human-readable list of the stream IDs in 's' | 30 // Returns a comma-separated, human-readable list of the stream IDs in 's' |
48 std::string ListStreams(const StreamSet& s) { | 31 std::string ListStreams(const StreamSet& s) { |
49 std::stringstream result; | 32 std::stringstream result; |
50 bool first = true; | 33 bool first = true; |
51 for (StreamSet::const_iterator it = s.begin(); it != s.end(); ++it) { | 34 for (StreamSet::const_iterator it = s.begin(); it != s.end(); ++it) { |
52 if (!first) { | 35 if (!first) { |
53 result << ", " << *it; | 36 result << ", " << *it; |
(...skipping 16 matching lines...) Expand all Loading... |
70 int value; | 53 int value; |
71 const char* name; | 54 const char* name; |
72 } flaginfo[] = { | 55 } flaginfo[] = { |
73 MAKEFLAG(SCTP_STREAM_RESET_INCOMING_SSN), | 56 MAKEFLAG(SCTP_STREAM_RESET_INCOMING_SSN), |
74 MAKEFLAG(SCTP_STREAM_RESET_OUTGOING_SSN), | 57 MAKEFLAG(SCTP_STREAM_RESET_OUTGOING_SSN), |
75 MAKEFLAG(SCTP_STREAM_RESET_DENIED), | 58 MAKEFLAG(SCTP_STREAM_RESET_DENIED), |
76 MAKEFLAG(SCTP_STREAM_RESET_FAILED), | 59 MAKEFLAG(SCTP_STREAM_RESET_FAILED), |
77 MAKEFLAG(SCTP_STREAM_CHANGE_DENIED) | 60 MAKEFLAG(SCTP_STREAM_CHANGE_DENIED) |
78 }; | 61 }; |
79 #undef MAKEFLAG | 62 #undef MAKEFLAG |
80 for (int i = 0; i < arraysize(flaginfo); ++i) { | 63 for (uint32_t i = 0; i < arraysize(flaginfo); ++i) { |
81 if (flags & flaginfo[i].value) { | 64 if (flags & flaginfo[i].value) { |
82 if (!first) result << " | "; | 65 if (!first) result << " | "; |
83 result << flaginfo[i].name; | 66 result << flaginfo[i].name; |
84 first = false; | 67 first = false; |
85 } | 68 } |
86 } | 69 } |
87 return result.str(); | 70 return result.str(); |
88 } | 71 } |
89 | 72 |
90 // Returns a comma-separated, human-readable list of the integers in 'array'. | 73 // Returns a comma-separated, human-readable list of the integers in 'array'. |
(...skipping 953 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1044 } | 1027 } |
1045 case MSG_SCTPOUTBOUNDPACKET: { | 1028 case MSG_SCTPOUTBOUNDPACKET: { |
1046 rtc::scoped_ptr<OutboundPacketMessage> pdata( | 1029 rtc::scoped_ptr<OutboundPacketMessage> pdata( |
1047 static_cast<OutboundPacketMessage*>(msg->pdata)); | 1030 static_cast<OutboundPacketMessage*>(msg->pdata)); |
1048 OnPacketFromSctpToNetwork(pdata->data().get()); | 1031 OnPacketFromSctpToNetwork(pdata->data().get()); |
1049 break; | 1032 break; |
1050 } | 1033 } |
1051 } | 1034 } |
1052 } | 1035 } |
1053 } // namespace cricket | 1036 } // namespace cricket |
OLD | NEW |