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

Unified Diff: content/renderer/p2p/port_allocator.h

Issue 7762008: Implement STUN support for P2P Transport API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: - Created 9 years, 4 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 | « content/renderer/p2p/p2p_transport_impl.cc ('k') | content/renderer/p2p/port_allocator.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/p2p/port_allocator.h
diff --git a/content/renderer/p2p/port_allocator.h b/content/renderer/p2p/port_allocator.h
new file mode 100644
index 0000000000000000000000000000000000000000..0761ba244ce75ed4e896bbc4a9471878952393b4
--- /dev/null
+++ b/content/renderer/p2p/port_allocator.h
@@ -0,0 +1,65 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CONTENT_RENDERER_P2P_PORT_ALLOCATOR_H_
+#define CONTENT_RENDERER_P2P_PORT_ALLOCATOR_H_
+
+#include "base/memory/ref_counted.h"
+#include "net/base/net_util.h"
+#include "third_party/libjingle/source/talk/p2p/client/basicportallocator.h"
+#include "webkit/glue/p2p_transport.h"
+
+namespace content {
+
+class P2PHostAddressRequest;
+class P2PPortAllocatorSession;
+class P2PSocketDispatcher;
+
+class P2PPortAllocator : public cricket::BasicPortAllocator{
+ public:
+ P2PPortAllocator(P2PSocketDispatcher* socket_dispatcher,
+ talk_base::NetworkManager* network_manager,
+ talk_base::PacketSocketFactory* socket_factory,
+ const webkit_glue::P2PTransport::Config& config);
+ virtual ~P2PPortAllocator();
+
+ virtual cricket::PortAllocatorSession* CreateSession(
+ const std::string& name,
+ const std::string& session_type) OVERRIDE;
+
+ private:
+ friend class P2PPortAllocatorSession;
+
+ P2PSocketDispatcher* socket_dispatcher_;
+ webkit_glue::P2PTransport::Config config_;
+
+ DISALLOW_COPY_AND_ASSIGN(P2PPortAllocator);
+};
+
+class P2PPortAllocatorSession : public cricket::BasicPortAllocatorSession {
+ public:
+ P2PPortAllocatorSession(
+ P2PPortAllocator* allocator,
+ const std::string& name,
+ const std::string& session_type);
+ virtual ~P2PPortAllocatorSession();
+
+ protected:
+ // Overrides for cricket::BasicPortAllocatorSession.
+ virtual void GetPortConfigurations() OVERRIDE;
+
+ private:
+ void ResolveStunServerAddress();
+ void OnStunServerAddress(const net::IPAddressNumber& address);
+
+ P2PPortAllocator* allocator_;
+
+ scoped_refptr<P2PHostAddressRequest> stun_address_request_;
+
+ DISALLOW_COPY_AND_ASSIGN(P2PPortAllocatorSession);
+};
+
+} // namespace content
+
+#endif // CONTENT_RENDERER_P2P_PORT_ALLOCATOR_H_
« no previous file with comments | « content/renderer/p2p/p2p_transport_impl.cc ('k') | content/renderer/p2p/port_allocator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698