OLD | NEW |
---|---|
(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/base/thread_checker.h" | |
19 #include "webrtc/p2p/base/transportchannel.h" | |
20 #include "webrtc/p2p/base/transportchannelimpl.h" | |
21 | |
22 namespace rtc { | |
23 class AsyncUDPSocket; | |
24 class PhysicalSocketServer; | |
25 class SocketServer; | |
26 class Thread; | |
27 } | |
28 | |
29 namespace cricket { | |
30 | |
31 class RawUdpCandidate : public Candidate { | |
Taylor Brandstetter
2016/10/07 18:24:03
The Candidate struct already has an IP/port/protoc
johan
2016/10/11 13:36:10
Acknowledged.
| |
32 // TODO(johan) add Rtcp sockaddr to candidate | |
pthatcher1
2016/10/07 17:36:36
Style: "TODO(johan): Add RTCP port."
Actually, a
| |
33 }; | |
34 | |
35 class RawUdpTransportChannel : public TransportChannelImpl { | |
pthatcher1
2016/10/07 17:36:37
Why bother with TransportChannelImpl? Why not use
johan
2016/10/11 13:36:10
Currently TransportController::CreateTransportChan
| |
36 public: | |
37 RawUdpTransportChannel(const std::string& transport_name, int component); | |
38 // TODO(johan): replace raw pointers by (weak) references to std::shared_ptr, | |
39 // when available | |
pthatcher1
2016/10/07 17:36:36
Style: "TODO(johan): Replace raw pointers by (weak
Taylor Brandstetter
2016/10/07 18:24:03
Do we really plan to do this? It's the first I've
pthatcher1
2016/10/07 21:15:39
There are a few other places in the code with comm
johan
2016/10/11 13:36:10
Here the shared pointer would just by my personal
| |
40 RawUdpTransportChannel(const std::string& transport_name, | |
41 int component, | |
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); | |
Taylor Brandstetter
2016/10/07 18:24:03
To match our current design, a transport channel w
johan
2016/10/11 13:36:10
Ack on "should not be public".
See my other commen
| |
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); | |
pthatcher1
2016/10/07 17:36:37
Can you put a comment some where that says somethi
| |
65 int SetRemoteAddr(const char* addr); | |
pthatcher1
2016/10/07 17:36:36
I'd prefer you have a SetRemoteParameters(const Ud
Taylor Brandstetter
2016/10/07 18:24:03
You could use an rtc::SocketAddress here. And can
johan
2016/10/11 13:36:10
Blame me, I had already removed this method's impl
| |
66 TransportChannelState GetState() const override; | |
67 | |
68 int SetOption(rtc::Socket::Option opt, int value) override { | |
69 RTC_NOTREACHED(); | |
70 return 0; | |
71 } | |
pthatcher1
2016/10/07 17:36:36
That's not going to work. SetOption is definitely
johan
2016/10/11 13:36:10
Acknowledged.
| |
72 | |
73 int GetError() override { | |
74 RTC_NOTREACHED(); | |
75 return 0; | |
pthatcher1
2016/10/07 17:36:37
Same here
johan
2016/10/11 13:36:10
Acknowledged.
| |
76 } | |
77 | |
78 bool GetStats(ConnectionInfos* infos) override { | |
79 RTC_NOTREACHED(); | |
80 return false; | |
81 } | |
pthatcher1
2016/10/07 17:36:36
And here
johan
2016/10/11 13:36:10
Acknowledged.
| |
82 | |
83 bool IsDtlsActive() const override { | |
84 RTC_NOTREACHED(); | |
85 return false; | |
pthatcher1
2016/10/07 17:36:37
And here. Although removing it would be even bett
johan
2016/10/11 13:36:10
Replacing the RTC_NOTREACHED() by a method removal
| |
86 } | |
87 | |
88 bool GetSslRole(rtc::SSLRole* role) const override { | |
89 RTC_NOTREACHED(); | |
pthatcher1
2016/10/07 17:36:37
This one should stay, and the next few, unless you
johan
2016/10/11 13:36:10
Acknowledged.
| |
90 return false; | |
91 } | |
92 | |
93 rtc::scoped_refptr<rtc::RTCCertificate> GetLocalCertificate() const override { | |
94 RTC_NOTREACHED(); | |
95 return nullptr; | |
96 } | |
97 | |
98 std::unique_ptr<rtc::SSLCertificate> GetRemoteSSLCertificate() | |
99 const override { | |
100 RTC_NOTREACHED(); | |
101 return nullptr; | |
102 } | |
103 | |
104 bool ExportKeyingMaterial(const std::string& label, | |
105 const uint8_t* context, | |
106 size_t context_len, | |
107 bool use_context, | |
108 uint8_t* result, | |
109 size_t result_len) override { | |
110 RTC_NOTREACHED(); | |
111 return false; | |
112 } | |
113 | |
114 // TransportChannelImpl overrides | |
115 IceRole GetIceRole() const override { | |
116 RTC_NOTREACHED(); | |
117 return ICEROLE_UNKNOWN; | |
118 } | |
119 | |
120 void SetIceRole(IceRole role) override { RTC_NOTREACHED(); } | |
121 | |
122 void SetIceTiebreaker(uint64_t tiebreaker) override { RTC_NOTREACHED(); } | |
123 | |
124 void SetIceParameters(const IceParameters& ice_params) override { | |
125 RTC_NOTREACHED(); | |
126 } | |
127 | |
128 void SetRemoteIceParameters(const IceParameters& ice_params) override { | |
129 RTC_NOTREACHED(); | |
130 } | |
131 | |
132 void SetRemoteIceMode(IceMode mode) override { RTC_NOTREACHED(); } | |
133 | |
134 void SetIceConfig(const IceConfig& config) override { RTC_NOTREACHED(); } | |
pthatcher1
2016/10/07 17:36:37
FYI, we're currently refactoring all of this. Can
johan
2016/10/11 13:36:10
Adding the TODO with next patch set. Maybe switchi
| |
135 | |
136 void MaybeStartGathering() override; | |
137 | |
138 void AddRemoteCandidate(const Candidate& candidate) override; | |
pthatcher1
2016/10/07 17:36:36
Shouldn't the "remote candidate" be contained in t
johan
2016/10/11 13:36:10
Currently AddRemoteCandidate() is TransportControl
| |
139 | |
140 // TransportChannelImpl overrides | |
141 void RemoveRemoteCandidate(const Candidate& candidate) override { | |
142 // TODO(johan) implement | |
pthatcher1
2016/10/07 17:36:36
Why would you implement this? It's an ICE thing.
johan
2016/10/11 13:36:10
Removing the TODO.
| |
143 RTC_NOTREACHED(); | |
144 } | |
145 | |
146 IceGatheringState gathering_state() const override; | |
147 | |
148 bool SetLocalCertificate( | |
149 const rtc::scoped_refptr<rtc::RTCCertificate>& certificate) override { | |
150 RTC_NOTREACHED(); | |
151 return false; | |
152 } | |
153 | |
154 bool SetRemoteFingerprint(const std::string& digest_alg, | |
155 const uint8_t* digest, | |
156 size_t digest_len) override { | |
157 RTC_NOTREACHED(); | |
158 return false; | |
159 } | |
160 | |
161 bool SetSslRole(rtc::SSLRole role) override { | |
162 RTC_NOTREACHED(); | |
163 return false; | |
164 } | |
165 | |
166 void SetMetricsObserver(webrtc::MetricsObserverInterface* observer) override { | |
167 RTC_NOTREACHED(); | |
pthatcher1
2016/10/07 17:36:37
I don't think you should have this NOTREACHED().
johan
2016/10/11 13:36:10
Acknowledged.
| |
168 } | |
169 | |
170 // TODO(johan) make this private, once addcandidate is working | |
171 bool SetRemoteAddrAndPorts(const char* ip_addr, int rtp_port); | |
pthatcher1
2016/10/07 17:36:36
I think you should not implement AddCandidate, and
johan
2016/10/11 13:36:10
My fault. This declaration is a left-over from my
| |
172 | |
173 private: | |
174 bool TryAllocateSockets(); | |
175 void SetGatheringState( | |
176 IceGatheringState new_gathering_state); // Set State and Signal | |
Taylor Brandstetter
2016/10/07 18:24:03
nit: "Set state and signal."
johan
2016/10/11 13:36:10
Acknowledged.
| |
177 void SetTransportChannelState( | |
178 TransportChannelState new_tch_state); // Set State and Signal | |
179 TransportChannelState tch_state_; | |
pthatcher1
2016/10/07 17:36:37
Just state_ is enough.
johan
2016/10/11 13:36:10
Acknowledged.
| |
180 IceGatheringState gathering_state_; | |
johan
2016/10/11 13:36:10
Whether gathering_state_ is required depends on in
| |
181 void UpdateWritableState(); | |
pthatcher1
2016/10/07 17:36:36
I don't think you need UpdateWritableState(), beca
johan
2016/10/11 13:36:10
cricket::TransportChannel has a non virtual method
| |
182 std::unique_ptr<rtc::AsyncUDPSocket> rtp_socket_; | |
183 std::unique_ptr<rtc::AsyncUDPSocket> rtcp_socket_; | |
pthatcher1
2016/10/07 17:36:37
As I mentioned, a transport channel should have on
| |
184 Candidate local_candidate_; | |
185 Candidate remote_candidate_; | |
pthatcher1
2016/10/07 17:36:37
This should be local_parameters_ and remote_parame
| |
186 rtc::SocketAddress remote_addr_; | |
pthatcher1
2016/10/07 17:36:36
remote_addr_ should be a part of remote_parameters
| |
187 rtc::SocketServer* socket_server_; | |
188 rtc::ThreadChecker network_thread_checker_; | |
189 }; | |
190 } // namespace cricket | |
191 | |
192 #endif // WEBRTC_P2P_RAWUDP_RAWUDPTRANSPORTCHANNEL_H_ | |
OLD | NEW |