| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2009 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2009 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 13 matching lines...) Expand all Loading... |
| 24 #include "webrtc/base/fakesslidentity.h" | 24 #include "webrtc/base/fakesslidentity.h" |
| 25 #include "webrtc/base/messagequeue.h" | 25 #include "webrtc/base/messagequeue.h" |
| 26 #include "webrtc/base/sigslot.h" | 26 #include "webrtc/base/sigslot.h" |
| 27 #include "webrtc/base/sslfingerprint.h" | 27 #include "webrtc/base/sslfingerprint.h" |
| 28 #include "webrtc/base/thread.h" | 28 #include "webrtc/base/thread.h" |
| 29 | 29 |
| 30 namespace cricket { | 30 namespace cricket { |
| 31 | 31 |
| 32 class FakeTransport; | 32 class FakeTransport; |
| 33 | 33 |
| 34 namespace { |
| 34 struct PacketMessageData : public rtc::MessageData { | 35 struct PacketMessageData : public rtc::MessageData { |
| 35 PacketMessageData(const char* data, size_t len) : packet(data, len) {} | 36 PacketMessageData(const char* data, size_t len) : packet(data, len) {} |
| 36 rtc::Buffer packet; | 37 rtc::Buffer packet; |
| 37 }; | 38 }; |
| 39 } // namespace |
| 38 | 40 |
| 39 // Fake transport channel class, which can be passed to anything that needs a | 41 // Fake transport channel class, which can be passed to anything that needs a |
| 40 // transport channel. Can be informed of another FakeTransportChannel via | 42 // transport channel. Can be informed of another FakeTransportChannel via |
| 41 // SetDestination. | 43 // SetDestination. |
| 42 // TODO(hbos): Move implementation to .cc file, this and other classes in file. | 44 // TODO(hbos): Move implementation to .cc file, this and other classes in file. |
| 43 class FakeTransportChannel : public TransportChannelImpl, | 45 class FakeTransportChannel : public TransportChannelImpl, |
| 44 public rtc::MessageHandler { | 46 public rtc::MessageHandler { |
| 45 public: | 47 public: |
| 46 explicit FakeTransportChannel(Transport* transport, | 48 explicit FakeTransportChannel(Transport* transport, |
| 47 const std::string& name, | 49 const std::string& name, |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 if (flags != PF_SRTP_BYPASS && flags != 0) { | 203 if (flags != PF_SRTP_BYPASS && flags != 0) { |
| 202 return -1; | 204 return -1; |
| 203 } | 205 } |
| 204 | 206 |
| 205 PacketMessageData* packet = new PacketMessageData(data, len); | 207 PacketMessageData* packet = new PacketMessageData(data, len); |
| 206 if (async_) { | 208 if (async_) { |
| 207 rtc::Thread::Current()->Post(this, 0, packet); | 209 rtc::Thread::Current()->Post(this, 0, packet); |
| 208 } else { | 210 } else { |
| 209 rtc::Thread::Current()->Send(this, 0, packet); | 211 rtc::Thread::Current()->Send(this, 0, packet); |
| 210 } | 212 } |
| 213 rtc::SentPacket sent_packet(options.packet_id, rtc::Time()); |
| 214 SignalSentPacket(this, sent_packet); |
| 211 return static_cast<int>(len); | 215 return static_cast<int>(len); |
| 212 } | 216 } |
| 213 int SetOption(rtc::Socket::Option opt, int value) override { return true; } | 217 int SetOption(rtc::Socket::Option opt, int value) override { return true; } |
| 214 bool GetOption(rtc::Socket::Option opt, int* value) override { return true; } | 218 bool GetOption(rtc::Socket::Option opt, int* value) override { return true; } |
| 215 int GetError() override { return 0; } | 219 int GetError() override { return 0; } |
| 216 | 220 |
| 217 void AddRemoteCandidate(const Candidate& candidate) override { | 221 void AddRemoteCandidate(const Candidate& candidate) override { |
| 218 remote_candidates_.push_back(candidate); | 222 remote_candidates_.push_back(candidate); |
| 219 } | 223 } |
| 220 const Candidates& remote_candidates() const { return remote_candidates_; } | 224 const Candidates& remote_candidates() const { return remote_candidates_; } |
| (...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 531 } | 535 } |
| 532 } | 536 } |
| 533 | 537 |
| 534 private: | 538 private: |
| 535 bool fail_create_channel_; | 539 bool fail_create_channel_; |
| 536 }; | 540 }; |
| 537 | 541 |
| 538 } // namespace cricket | 542 } // namespace cricket |
| 539 | 543 |
| 540 #endif // WEBRTC_P2P_BASE_FAKETRANSPORTCONTROLLER_H_ | 544 #endif // WEBRTC_P2P_BASE_FAKETRANSPORTCONTROLLER_H_ |
| OLD | NEW |