OLD | NEW |
| (Empty) |
1 /* | |
2 * Copyright 2004 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 #include <sstream> | |
12 #include "webrtc/p2p/base/common.h" | |
13 #include "webrtc/p2p/base/transportchannel.h" | |
14 | |
15 namespace cricket { | |
16 | |
17 std::string TransportChannel::ToString() const { | |
18 const char RECEIVING_ABBREV[2] = { '_', 'R' }; | |
19 const char WRITABLE_ABBREV[2] = { '_', 'W' }; | |
20 std::stringstream ss; | |
21 ss << "Channel[" << transport_name_ << "|" << component_ << "|" | |
22 << RECEIVING_ABBREV[receiving_] << WRITABLE_ABBREV[writable_] << "]"; | |
23 return ss.str(); | |
24 } | |
25 | |
26 void TransportChannel::set_receiving(bool receiving) { | |
27 if (receiving_ == receiving) { | |
28 return; | |
29 } | |
30 receiving_ = receiving; | |
31 SignalReceivingState(this); | |
32 } | |
33 | |
34 void TransportChannel::set_writable(bool writable) { | |
35 if (writable_ == writable) { | |
36 return; | |
37 } | |
38 LOG_J(LS_VERBOSE, this) << "set_writable from:" << writable_ << " to " | |
39 << writable; | |
40 writable_ = writable; | |
41 if (writable_) { | |
42 SignalReadyToSend(this); | |
43 } | |
44 SignalWritableState(this); | |
45 } | |
46 | |
47 void TransportChannel::set_dtls_state(DtlsTransportState state) { | |
48 if (dtls_state_ == state) { | |
49 return; | |
50 } | |
51 LOG_J(LS_VERBOSE, this) << "set_dtls_state from:" << dtls_state_ << " to " | |
52 << state; | |
53 dtls_state_ = state; | |
54 SignalDtlsState(this, state); | |
55 } | |
56 | |
57 bool TransportChannel::SetSrtpCryptoSuites(const std::vector<int>& ciphers) { | |
58 return false; | |
59 } | |
60 | |
61 // TODO(guoweis): Remove this function once everything is moved away. | |
62 bool TransportChannel::SetSrtpCiphers(const std::vector<std::string>& ciphers) { | |
63 std::vector<int> crypto_suites; | |
64 for (const auto cipher : ciphers) { | |
65 crypto_suites.push_back(rtc::SrtpCryptoSuiteFromName(cipher)); | |
66 } | |
67 return SetSrtpCryptoSuites(crypto_suites); | |
68 } | |
69 | |
70 } // namespace cricket | |
OLD | NEW |