Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(300)

Side by Side Diff: webrtc/p2p/base/udptransport.h

Issue 2675173003: Adding "adapter" ORTC objects on top of ChannelManager/BaseChannel/etc. (Closed)
Patch Set: Add memcheck suppression for end-to-end tests. Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « webrtc/p2p/base/packettransportinternal.h ('k') | webrtc/pc/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/ortc/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/packettransportinternal.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 rtc::PacketTransportInternal,
35 public rtc::PacketTransportInternal { 35 public webrtc::UdpTransportInterface {
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;
(...skipping 11 matching lines...) Expand all
57 57
58 int SendPacket(const char* data, 58 int SendPacket(const char* data,
59 size_t len, 59 size_t len,
60 const rtc::PacketOptions& options, 60 const rtc::PacketOptions& options,
61 int flags) override; 61 int flags) override;
62 62
63 int SetOption(rtc::Socket::Option opt, int value) override { return 0; } 63 int SetOption(rtc::Socket::Option opt, int value) override { return 0; }
64 64
65 int GetError() override { return send_error_; } 65 int GetError() override { return send_error_; }
66 66
67 protected:
68 PacketTransportInternal* GetInternal() override { return this; }
69
67 private: 70 private:
68 void OnSocketReadPacket(rtc::AsyncPacketSocket* socket, 71 void OnSocketReadPacket(rtc::AsyncPacketSocket* socket,
69 const char* data, 72 const char* data,
70 size_t len, 73 size_t len,
71 const rtc::SocketAddress& remote_addr, 74 const rtc::SocketAddress& remote_addr,
72 const rtc::PacketTime& packet_time); 75 const rtc::PacketTime& packet_time);
73 void OnSocketSentPacket(rtc::AsyncPacketSocket* socket, 76 void OnSocketSentPacket(rtc::AsyncPacketSocket* socket,
74 const rtc::SentPacket& packet); 77 const rtc::SentPacket& packet);
75 bool IsLocalConsistent(); 78 bool IsLocalConsistent();
76 std::string transport_name_; 79 std::string transport_name_;
77 int send_error_ = 0; 80 int send_error_ = 0;
78 std::unique_ptr<rtc::AsyncPacketSocket> socket_; 81 std::unique_ptr<rtc::AsyncPacketSocket> socket_;
79 // If not set, will be an "nil" address ("IsNil" returns true). 82 // If not set, will be an "nil" address ("IsNil" returns true).
80 rtc::SocketAddress remote_address_; 83 rtc::SocketAddress remote_address_;
81 rtc::ThreadChecker network_thread_checker_; 84 rtc::ThreadChecker network_thread_checker_;
82 }; 85 };
86
83 } // namespace cricket 87 } // namespace cricket
84 88
85 #endif // WEBRTC_P2P_BASE_UDPTRANSPORT_H_ 89 #endif // WEBRTC_P2P_BASE_UDPTRANSPORT_H_
OLDNEW
« no previous file with comments | « webrtc/p2p/base/packettransportinternal.h ('k') | webrtc/pc/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698