| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2016 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2016 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 |
| 11 #ifndef WEBRTC_P2P_BASE_UDPTRANSPORT_H_ | 11 #ifndef WEBRTC_P2P_BASE_UDPTRANSPORT_H_ |
| 12 #define WEBRTC_P2P_BASE_UDPTRANSPORT_H_ | 12 #define WEBRTC_P2P_BASE_UDPTRANSPORT_H_ |
| 13 | 13 |
| 14 #include <memory> | 14 #include <memory> |
| 15 #include <string> | 15 #include <string> |
| 16 | 16 |
| 17 #include "webrtc/api/udptransportinterface.h" | 17 #include "webrtc/api/udptransportinterface.h" |
| 18 #include "webrtc/base/asyncpacketsocket.h" // For PacketOptions. | 18 #include "webrtc/base/asyncpacketsocket.h" // For PacketOptions. |
| 19 #include "webrtc/base/optional.h" | 19 #include "webrtc/base/optional.h" |
| 20 #include "webrtc/base/thread_checker.h" | 20 #include "webrtc/base/thread_checker.h" |
| 21 #include "webrtc/p2p/base/packettransportinterface.h" | 21 #include "webrtc/p2p/base/packettransportinternal.h" |
| 22 | 22 |
| 23 namespace rtc { | 23 namespace rtc { |
| 24 class AsyncPacketSocket; | 24 class AsyncPacketSocket; |
| 25 struct PacketTime; | 25 struct PacketTime; |
| 26 struct SentPacket; | 26 struct SentPacket; |
| 27 class SocketAddress; | 27 class SocketAddress; |
| 28 } | 28 } |
| 29 | 29 |
| 30 namespace cricket { | 30 namespace cricket { |
| 31 | 31 |
| 32 // Implementation of UdpTransportInterface. | 32 // Implementation of UdpTransportInterface. |
| 33 // Used by OrtcFactory. | 33 // Used by OrtcFactory. |
| 34 class UdpTransport : public webrtc::UdpTransportInterface, | 34 class UdpTransport : public webrtc::UdpTransportInterface, |
| 35 public rtc::PacketTransportInterface { | 35 public rtc::PacketTransportInternal { |
| 36 public: | 36 public: |
| 37 // |transport_name| is only used for identification/logging. | 37 // |transport_name| is only used for identification/logging. |
| 38 // |socket| must be non-null. | 38 // |socket| must be non-null. |
| 39 UdpTransport(const std::string& transport_name, | 39 UdpTransport(const std::string& transport_name, |
| 40 std::unique_ptr<rtc::AsyncPacketSocket> socket); | 40 std::unique_ptr<rtc::AsyncPacketSocket> socket); |
| 41 ~UdpTransport(); | 41 ~UdpTransport(); |
| 42 | 42 |
| 43 // Overrides of UdpTransportInterface, used by the API consumer. | 43 // Overrides of UdpTransportInterface, used by the API consumer. |
| 44 rtc::SocketAddress GetLocalAddress() const override; | 44 rtc::SocketAddress GetLocalAddress() const override; |
| 45 bool SetRemoteAddress(const rtc::SocketAddress& addr) override; | 45 bool SetRemoteAddress(const rtc::SocketAddress& addr) override; |
| 46 rtc::SocketAddress GetRemoteAddress() const override; | 46 rtc::SocketAddress GetRemoteAddress() const override; |
| 47 | 47 |
| 48 // Overrides of PacketTransportInterface, used by webrtc internally. | 48 // Overrides of PacketTransportInternal, used by webrtc internally. |
| 49 std::string debug_name() const override { return transport_name_; } | 49 std::string debug_name() const override { return transport_name_; } |
| 50 | 50 |
| 51 bool receiving() const override { | 51 bool receiving() const override { |
| 52 // TODO(johan): Implement method and signal. | 52 // TODO(johan): Implement method and signal. |
| 53 return true; | 53 return true; |
| 54 } | 54 } |
| 55 | 55 |
| 56 bool writable() const override; | 56 bool writable() const override; |
| 57 | 57 |
| 58 int SendPacket(const char* data, | 58 int SendPacket(const char* data, |
| (...skipping 17 matching lines...) Expand all Loading... |
| 76 std::string transport_name_; | 76 std::string transport_name_; |
| 77 int send_error_ = 0; | 77 int send_error_ = 0; |
| 78 std::unique_ptr<rtc::AsyncPacketSocket> socket_; | 78 std::unique_ptr<rtc::AsyncPacketSocket> socket_; |
| 79 // If not set, will be an "nil" address ("IsNil" returns true). | 79 // If not set, will be an "nil" address ("IsNil" returns true). |
| 80 rtc::SocketAddress remote_address_; | 80 rtc::SocketAddress remote_address_; |
| 81 rtc::ThreadChecker network_thread_checker_; | 81 rtc::ThreadChecker network_thread_checker_; |
| 82 }; | 82 }; |
| 83 } // namespace cricket | 83 } // namespace cricket |
| 84 | 84 |
| 85 #endif // WEBRTC_P2P_BASE_UDPTRANSPORT_H_ | 85 #endif // WEBRTC_P2P_BASE_UDPTRANSPORT_H_ |
| OLD | NEW |