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

Unified Diff: webrtc/p2p/base/transportchannelproxy.h

Issue 1358413003: Revert of TransportController refactoring. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/p2p/base/transportchannelimpl.h ('k') | webrtc/p2p/base/transportchannelproxy.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/p2p/base/transportchannelproxy.h
diff --git a/webrtc/p2p/base/transportchannelproxy.h b/webrtc/p2p/base/transportchannelproxy.h
new file mode 100644
index 0000000000000000000000000000000000000000..80ee20aabb06de9851560de3168b40646813b82a
--- /dev/null
+++ b/webrtc/p2p/base/transportchannelproxy.h
@@ -0,0 +1,96 @@
+/*
+ * Copyright 2004 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_BASE_TRANSPORTCHANNELPROXY_H_
+#define WEBRTC_P2P_BASE_TRANSPORTCHANNELPROXY_H_
+
+#include <string>
+#include <utility>
+#include <vector>
+
+#include "webrtc/p2p/base/transportchannel.h"
+#include "webrtc/base/messagehandler.h"
+
+namespace rtc {
+class Thread;
+}
+
+namespace cricket {
+
+class TransportChannelImpl;
+
+// Proxies calls between the client and the transport channel implementation.
+// This is needed because clients are allowed to create channels before the
+// network negotiation is complete. Hence, we create a proxy up front, and
+// when negotiation completes, connect the proxy to the implementaiton.
+class TransportChannelProxy : public TransportChannel,
+ public rtc::MessageHandler {
+ public:
+ TransportChannelProxy(const std::string& content_name,
+ int component);
+ ~TransportChannelProxy() override;
+
+ TransportChannelImpl* impl() { return impl_; }
+
+ TransportChannelState GetState() const override;
+
+ // Sets the implementation to which we will proxy.
+ void SetImplementation(TransportChannelImpl* impl);
+
+ // Implementation of the TransportChannel interface. These simply forward to
+ // the implementation.
+ int SendPacket(const char* data, size_t len,
+ const rtc::PacketOptions& options,
+ int flags) override;
+ int SetOption(rtc::Socket::Option opt, int value) override;
+ bool GetOption(rtc::Socket::Option opt, int* value) override;
+ int GetError() override;
+ virtual IceRole GetIceRole() const;
+ bool GetStats(ConnectionInfos* infos) override;
+ bool IsDtlsActive() const override;
+ bool GetSslRole(rtc::SSLRole* role) const override;
+ virtual bool SetSslRole(rtc::SSLRole role);
+ bool SetSrtpCiphers(const std::vector<std::string>& ciphers) override;
+ bool GetSrtpCipher(std::string* cipher) override;
+ bool GetSslCipher(std::string* cipher) override;
+ rtc::scoped_refptr<rtc::RTCCertificate> GetLocalCertificate() const override;
+ bool GetRemoteSSLCertificate(rtc::SSLCertificate** cert) const override;
+ bool ExportKeyingMaterial(const std::string& label,
+ const uint8* context,
+ size_t context_len,
+ bool use_context,
+ uint8* result,
+ size_t result_len) override;
+
+ private:
+ // Catch signals from the implementation channel. These just forward to the
+ // client (after updating our state to match).
+ void OnReceivingState(TransportChannel* channel);
+ void OnWritableState(TransportChannel* channel);
+ void OnReadPacket(TransportChannel* channel, const char* data, size_t size,
+ const rtc::PacketTime& packet_time, int flags);
+ void OnReadyToSend(TransportChannel* channel);
+ void OnRouteChange(TransportChannel* channel, const Candidate& candidate);
+
+ void OnMessage(rtc::Message* message) override;
+
+ typedef std::pair<rtc::Socket::Option, int> OptionPair;
+ typedef std::vector<OptionPair> OptionList;
+ rtc::Thread* worker_thread_;
+ TransportChannelImpl* impl_;
+ OptionList options_;
+ std::vector<std::string> pending_srtp_ciphers_;
+
+ RTC_DISALLOW_COPY_AND_ASSIGN(TransportChannelProxy);
+};
+
+} // namespace cricket
+
+#endif // WEBRTC_P2P_BASE_TRANSPORTCHANNELPROXY_H_
« no previous file with comments | « webrtc/p2p/base/transportchannelimpl.h ('k') | webrtc/p2p/base/transportchannelproxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698