Chromium Code Reviews| 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..16ecb62e9be1af753a8b63c705df2b9b48b56d90 |
| --- /dev/null |
| +++ b/content/renderer/p2p/port_allocator.h |
| @@ -0,0 +1,66 @@ |
| +// 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: |
| + // Override for cricket::BasicPortAllocatorSession::GetPortConfigurations(). |
|
Wez
2011/08/29 18:01:57
nit: Does this comment add anything?
Sergey Ulanov
2011/08/29 22:13:39
I think it's useful to annotate overridden methods
|
| + virtual void GetPortConfigurations() OVERRIDE; |
| + |
| + private: |
| + void ResolveStunAddress(); |
| + void OnStunAddress(const net::IPAddressNumber& address); |
| + |
| + P2PPortAllocator* allocator_; |
| + |
| + scoped_refptr<P2PHostAddressRequest> stun_address_request_; |
| + int stun_server_port_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(P2PPortAllocatorSession); |
| +}; |
| + |
| +} // namespace content |
| + |
| +#endif // CONTENT_RENDERER_P2P_PORT_ALLOCATOR_H_ |