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

Side by Side Diff: webrtc/p2p/rawudp/rawudptransportchannel.h

Issue 2377883003: First step in providing a UdpTransportChannel. (Closed)
Patch Set: Fix signed / unsigned comparison in test code. Created 4 years, 2 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
OLDNEW
(Empty)
1 /*
2 * Copyright 2016 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 #ifndef WEBRTC_P2P_RAWUDP_RAWUDPTRANSPORTCHANNEL_H_
12 #define WEBRTC_P2P_RAWUDP_RAWUDPTRANSPORTCHANNEL_H_
13
14 #include <memory>
15 #include <string>
16
17 #include "webrtc/base/socketaddress.h"
18 #include "webrtc/p2p/base/transportchannel.h"
19 #include "webrtc/p2p/base/transportchannelimpl.h"
20
21 namespace rtc {
22 class AsyncUDPSocket;
23 class PhysicalSocketServer;
24 class SocketServer;
25 class Thread;
26 }
27
28 namespace cricket {
29
30 class RawUdpCandidate : public Candidate {
31 // TODO(johan) add Rtcp sockaddr to candidate
32 };
33
34 class RawUdpTransportChannel : public TransportChannelImpl {
35 public:
36 RawUdpTransportChannel(const std::string& transport_name, int component);
37 // TODO(johan): replace raw pointers by (weak) references to std::shared_ptr,
38 // when available
39 RawUdpTransportChannel(const std::string& transport_name,
40 int component,
41 rtc::Thread* network_thread,
42 rtc::SocketServer* ss);
43 ~RawUdpTransportChannel();
44 int SendPacket(const char* data,
45 size_t len,
46 const rtc::PacketOptions& options,
47 int flags) override;
48 int Recv();
49 void OnSocketReadPacket(rtc::AsyncPacketSocket* socket,
50 const char* data,
51 size_t len,
52 const rtc::SocketAddress& remote_addr,
53 const rtc::PacketTime& packet_time,
54 bool is_rtcp);
55 void OnRtpSocketReadPacket(rtc::AsyncPacketSocket* socket,
56 const char* data,
57 size_t len,
58 const rtc::SocketAddress& remote_addr,
59 const rtc::PacketTime& packet_time);
60 void OnRtcpSocketReadPacket(rtc::AsyncPacketSocket* socket,
61 const char* data,
62 size_t len,
63 const rtc::SocketAddress& remote_addr,
64 const rtc::PacketTime& packet_time);
65
66 // int SendPacket (rtc::CopyOnWriteBuffer * buf, const rtc::PacketOptions
67 // &options, int flags);
sprang_webrtc 2016/10/07 09:56:21 Did you intend to leave this comment?
68 int SetRemoteAddr(const char* addr);
69 TransportChannelState GetState() const override;
70
71 int SetOption(rtc::Socket::Option opt, int value) override {
72 RTC_NOTREACHED();
73 return 0;
74 }
75
76 int GetError() override {
77 RTC_NOTREACHED();
78 return 0;
79 }
80
81 bool GetStats(ConnectionInfos* infos) override {
82 RTC_NOTREACHED();
83 return false;
84 }
85
86 bool IsDtlsActive() const override {
87 RTC_NOTREACHED();
88 return false;
89 }
90
91 bool GetSslRole(rtc::SSLRole* role) const override {
92 RTC_NOTREACHED();
93 return false;
94 }
95
96 rtc::scoped_refptr<rtc::RTCCertificate> GetLocalCertificate() const override {
97 RTC_NOTREACHED();
98 return nullptr;
99 }
100
101 std::unique_ptr<rtc::SSLCertificate> GetRemoteSSLCertificate()
102 const override {
103 RTC_NOTREACHED();
104 return nullptr;
105 }
106
107 bool ExportKeyingMaterial(const std::string& label,
108 const uint8_t* context,
109 size_t context_len,
110 bool use_context,
111 uint8_t* result,
112 size_t result_len) override {
113 RTC_NOTREACHED();
114 return false;
115 }
116
117 // TransportChannelImpl overrides
118 IceRole GetIceRole() const override {
119 RTC_NOTREACHED();
120 return ICEROLE_UNKNOWN;
121 }
122
123 void SetIceRole(IceRole role) override { RTC_NOTREACHED(); }
124
125 void SetIceTiebreaker(uint64_t tiebreaker) override { RTC_NOTREACHED(); }
126
127 void SetIceParameters(const IceParameters& ice_params) override {
128 RTC_NOTREACHED();
129 }
130
131 void SetRemoteIceParameters(const IceParameters& ice_params) override {
132 RTC_NOTREACHED();
133 }
134
135 void SetRemoteIceMode(IceMode mode) override { RTC_NOTREACHED(); }
136
137 void SetIceConfig(const IceConfig& config) override { RTC_NOTREACHED(); }
138
139 void MaybeStartGathering() override;
140
141 void AddRemoteCandidate(const Candidate& candidate) override;
142
143 // TransportChannelImpl overrides
144 void RemoveRemoteCandidate(const Candidate& candidate) override {
145 // TODO(johan) implement
146 RTC_NOTREACHED();
147 }
148
149 IceGatheringState gathering_state() const override;
150
151 bool SetLocalCertificate(
152 const rtc::scoped_refptr<rtc::RTCCertificate>& certificate) override {
153 RTC_NOTREACHED();
154 return false;
155 }
156
157 bool SetRemoteFingerprint(const std::string& digest_alg,
158 const uint8_t* digest,
159 size_t digest_len) override {
160 RTC_NOTREACHED();
161 return false;
162 }
163
164 bool SetSslRole(rtc::SSLRole role) override {
165 RTC_NOTREACHED();
166 return false;
167 }
168
169 // TODO(johan) make this private, once addcandidate is working
sprang_webrtc 2016/10/07 09:56:21 nit: end all comments with a period. Here and else
170 bool SetRemoteAddrAndPorts(const char* ip_addr, int rtp_port);
171
172 private:
173 bool TryAllocateSockets();
174 void SetGatheringState(
175 IceGatheringState new_gathering_state); // Set State and Signal
176 void SetTransportChannelState(
177 TransportChannelState new_tch_state); // Set State and Signal
178 TransportChannelState tch_state_;
179 IceGatheringState gathering_state_;
180 void UpdateWritableState();
sprang_webrtc 2016/10/07 09:56:21 Move above field declarations.
181 std::unique_ptr<rtc::AsyncUDPSocket> rtp_socket_;
182 std::unique_ptr<rtc::AsyncUDPSocket> rtcp_socket_;
183 Candidate local_candidate_;
184 Candidate remote_candidate_;
185 rtc::SocketAddress remote_addr_;
186 rtc::SocketServer* ss_;
sprang_webrtc 2016/10/07 09:56:21 rtc::SocketServer* const ss_; ? On closer look, do
187 rtc::Thread* network_thread_;
188 };
189 } // namespace cricket
190
191 #endif // WEBRTC_P2P_RAWUDP_RAWUDPTRANSPORTCHANNEL_H_
192
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698