Refactor WebsiteSettings to operate on a SecurityInfo
[chromium-blink-merge.git] / content / renderer / p2p / port_allocator.h
bloba789e7a93cc6384d14988deea084e0ca0c6f2f2d
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CONTENT_RENDERER_P2P_PORT_ALLOCATOR_H_
6 #define CONTENT_RENDERER_P2P_PORT_ALLOCATOR_H_
8 #include "third_party/webrtc/p2p/client/basicportallocator.h"
9 #include "url/gurl.h"
11 namespace content {
13 class P2PPortAllocatorSession;
14 class P2PSocketDispatcher;
16 class P2PPortAllocator : public cricket::BasicPortAllocator {
17 public:
18 struct Config {
19 Config();
20 ~Config();
22 struct RelayServerConfig {
23 RelayServerConfig();
24 ~RelayServerConfig();
26 std::string username;
27 std::string password;
28 std::string server_address;
29 int port;
30 std::string transport_type;
31 bool secure;
34 std::set<rtc::SocketAddress> stun_servers;
36 std::vector<RelayServerConfig> relays;
38 // Enable non-proxied UDP-based transport when set to true. When set to
39 // false, it effectively disables all UDP traffic until UDP-supporting proxy
40 // RETURN is available in the future.
41 bool enable_nonproxied_udp = true;
43 // Disable binding to individual NICs when set to false.
44 bool enable_multiple_routes = true;
47 P2PPortAllocator(P2PSocketDispatcher* socket_dispatcher,
48 rtc::NetworkManager* network_manager,
49 rtc::PacketSocketFactory* socket_factory,
50 const Config& config,
51 const GURL& origin);
52 ~P2PPortAllocator() override;
54 cricket::PortAllocatorSession* CreateSessionInternal(
55 const std::string& content_name,
56 int component,
57 const std::string& ice_username_fragment,
58 const std::string& ice_password) override;
60 private:
61 friend class P2PPortAllocatorSession;
63 P2PSocketDispatcher* socket_dispatcher_;
64 Config config_;
65 GURL origin_;
67 DISALLOW_COPY_AND_ASSIGN(P2PPortAllocator);
70 class P2PPortAllocatorSession : public cricket::BasicPortAllocatorSession {
71 public:
72 P2PPortAllocatorSession(
73 P2PPortAllocator* allocator,
74 const std::string& content_name,
75 int component,
76 const std::string& ice_username_fragment,
77 const std::string& ice_password);
78 ~P2PPortAllocatorSession() override;
80 protected:
81 // Overrides for cricket::BasicPortAllocatorSession.
82 void GetPortConfigurations() override;
84 private:
85 P2PPortAllocator* allocator_;
87 DISALLOW_COPY_AND_ASSIGN(P2PPortAllocatorSession);
90 } // namespace content
92 #endif // CONTENT_RENDERER_P2P_PORT_ALLOCATOR_H_