Index: webrtc/p2p/rawudp/rawudptransportchannel.h |
diff --git a/webrtc/p2p/rawudp/rawudptransportchannel.h b/webrtc/p2p/rawudp/rawudptransportchannel.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..134c5183ea5a26c58044c1c176981fda5fd06f72 |
--- /dev/null |
+++ b/webrtc/p2p/rawudp/rawudptransportchannel.h |
@@ -0,0 +1,192 @@ |
+/* |
+ * Copyright 2016 The WebRTC project authors. All Rights Reserved. |
+ * |
+ * Use of this source code is governed by a BSD-style license |
+ * that can be found in the LICENSE file in the root of the source |
+ * tree. An additional intellectual property rights grant can be found |
+ * in the file PATENTS. All contributing project authors may |
+ * be found in the AUTHORS file in the root of the source tree. |
+ */ |
+ |
+#ifndef WEBRTC_P2P_RAWUDP_RAWUDPTRANSPORTCHANNEL_H_ |
+#define WEBRTC_P2P_RAWUDP_RAWUDPTRANSPORTCHANNEL_H_ |
+ |
+#include <memory> |
+#include <string> |
+ |
+#include "webrtc/base/socketaddress.h" |
+#include "webrtc/p2p/base/transportchannel.h" |
+#include "webrtc/p2p/base/transportchannelimpl.h" |
+ |
+namespace rtc { |
+class AsyncUDPSocket; |
+class PhysicalSocketServer; |
+class SocketServer; |
+class Thread; |
+} |
+ |
+namespace cricket { |
+ |
+class RawUdpCandidate : public Candidate { |
+ // TODO(johan) add Rtcp sockaddr to candidate |
+}; |
+ |
+class RawUdpTransportChannel : public TransportChannelImpl { |
+ public: |
+ RawUdpTransportChannel(const std::string& transport_name, int component); |
+ // TODO(johan): replace raw pointers by (weak) references to std::shared_ptr, |
+ // when available |
+ RawUdpTransportChannel(const std::string& transport_name, |
+ int component, |
+ rtc::Thread* network_thread, |
+ rtc::SocketServer* ss); |
+ ~RawUdpTransportChannel(); |
+ int SendPacket(const char* data, |
+ size_t len, |
+ const rtc::PacketOptions& options, |
+ int flags) override; |
+ int Recv(); |
+ void OnSocketReadPacket(rtc::AsyncPacketSocket* socket, |
+ const char* data, |
+ size_t len, |
+ const rtc::SocketAddress& remote_addr, |
+ const rtc::PacketTime& packet_time, |
+ bool is_rtcp); |
+ void OnRtpSocketReadPacket(rtc::AsyncPacketSocket* socket, |
+ const char* data, |
+ size_t len, |
+ const rtc::SocketAddress& remote_addr, |
+ const rtc::PacketTime& packet_time); |
+ void OnRtcpSocketReadPacket(rtc::AsyncPacketSocket* socket, |
+ const char* data, |
+ size_t len, |
+ const rtc::SocketAddress& remote_addr, |
+ const rtc::PacketTime& packet_time); |
+ |
+ // int SendPacket (rtc::CopyOnWriteBuffer * buf, const rtc::PacketOptions |
+ // &options, int flags); |
sprang_webrtc
2016/10/07 09:56:21
Did you intend to leave this comment?
|
+ int SetRemoteAddr(const char* addr); |
+ TransportChannelState GetState() const override; |
+ |
+ int SetOption(rtc::Socket::Option opt, int value) override { |
+ RTC_NOTREACHED(); |
+ return 0; |
+ } |
+ |
+ int GetError() override { |
+ RTC_NOTREACHED(); |
+ return 0; |
+ } |
+ |
+ bool GetStats(ConnectionInfos* infos) override { |
+ RTC_NOTREACHED(); |
+ return false; |
+ } |
+ |
+ bool IsDtlsActive() const override { |
+ RTC_NOTREACHED(); |
+ return false; |
+ } |
+ |
+ bool GetSslRole(rtc::SSLRole* role) const override { |
+ RTC_NOTREACHED(); |
+ return false; |
+ } |
+ |
+ rtc::scoped_refptr<rtc::RTCCertificate> GetLocalCertificate() const override { |
+ RTC_NOTREACHED(); |
+ return nullptr; |
+ } |
+ |
+ std::unique_ptr<rtc::SSLCertificate> GetRemoteSSLCertificate() |
+ const override { |
+ RTC_NOTREACHED(); |
+ return nullptr; |
+ } |
+ |
+ bool ExportKeyingMaterial(const std::string& label, |
+ const uint8_t* context, |
+ size_t context_len, |
+ bool use_context, |
+ uint8_t* result, |
+ size_t result_len) override { |
+ RTC_NOTREACHED(); |
+ return false; |
+ } |
+ |
+ // TransportChannelImpl overrides |
+ IceRole GetIceRole() const override { |
+ RTC_NOTREACHED(); |
+ return ICEROLE_UNKNOWN; |
+ } |
+ |
+ void SetIceRole(IceRole role) override { RTC_NOTREACHED(); } |
+ |
+ void SetIceTiebreaker(uint64_t tiebreaker) override { RTC_NOTREACHED(); } |
+ |
+ void SetIceParameters(const IceParameters& ice_params) override { |
+ RTC_NOTREACHED(); |
+ } |
+ |
+ void SetRemoteIceParameters(const IceParameters& ice_params) override { |
+ RTC_NOTREACHED(); |
+ } |
+ |
+ void SetRemoteIceMode(IceMode mode) override { RTC_NOTREACHED(); } |
+ |
+ void SetIceConfig(const IceConfig& config) override { RTC_NOTREACHED(); } |
+ |
+ void MaybeStartGathering() override; |
+ |
+ void AddRemoteCandidate(const Candidate& candidate) override; |
+ |
+ // TransportChannelImpl overrides |
+ void RemoveRemoteCandidate(const Candidate& candidate) override { |
+ // TODO(johan) implement |
+ RTC_NOTREACHED(); |
+ } |
+ |
+ IceGatheringState gathering_state() const override; |
+ |
+ bool SetLocalCertificate( |
+ const rtc::scoped_refptr<rtc::RTCCertificate>& certificate) override { |
+ RTC_NOTREACHED(); |
+ return false; |
+ } |
+ |
+ bool SetRemoteFingerprint(const std::string& digest_alg, |
+ const uint8_t* digest, |
+ size_t digest_len) override { |
+ RTC_NOTREACHED(); |
+ return false; |
+ } |
+ |
+ bool SetSslRole(rtc::SSLRole role) override { |
+ RTC_NOTREACHED(); |
+ return false; |
+ } |
+ |
+ // 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
|
+ bool SetRemoteAddrAndPorts(const char* ip_addr, int rtp_port); |
+ |
+ private: |
+ bool TryAllocateSockets(); |
+ void SetGatheringState( |
+ IceGatheringState new_gathering_state); // Set State and Signal |
+ void SetTransportChannelState( |
+ TransportChannelState new_tch_state); // Set State and Signal |
+ TransportChannelState tch_state_; |
+ IceGatheringState gathering_state_; |
+ void UpdateWritableState(); |
sprang_webrtc
2016/10/07 09:56:21
Move above field declarations.
|
+ std::unique_ptr<rtc::AsyncUDPSocket> rtp_socket_; |
+ std::unique_ptr<rtc::AsyncUDPSocket> rtcp_socket_; |
+ Candidate local_candidate_; |
+ Candidate remote_candidate_; |
+ rtc::SocketAddress remote_addr_; |
+ rtc::SocketServer* ss_; |
sprang_webrtc
2016/10/07 09:56:21
rtc::SocketServer* const ss_; ?
On closer look, do
|
+ rtc::Thread* network_thread_; |
+}; |
+} // namespace cricket |
+ |
+#endif // WEBRTC_P2P_RAWUDP_RAWUDPTRANSPORTCHANNEL_H_ |
+ |