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

Side by Side Diff: webrtc/p2p/base/packetsocketfactory.h

Issue 1556743002: Bind a socket to a network if the network handle is set. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 11 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright 2011 The WebRTC Project Authors. All rights reserved. 2 * Copyright 2011 The WebRTC Project Authors. All rights reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
11 #ifndef WEBRTC_P2P_BASE_PACKETSOCKETFACTORY_H_ 11 #ifndef WEBRTC_P2P_BASE_PACKETSOCKETFACTORY_H_
12 #define WEBRTC_P2P_BASE_PACKETSOCKETFACTORY_H_ 12 #define WEBRTC_P2P_BASE_PACKETSOCKETFACTORY_H_
13 13
14 #include "webrtc/base/common.h"
14 #include "webrtc/base/proxyinfo.h" 15 #include "webrtc/base/proxyinfo.h"
15 16
16 namespace rtc { 17 namespace rtc {
17 18
18 class AsyncPacketSocket; 19 class AsyncPacketSocket;
19 class AsyncResolverInterface; 20 class AsyncResolverInterface;
21 class Network;
20 22
21 class PacketSocketFactory { 23 class PacketSocketFactory {
22 public: 24 public:
23 enum Options { 25 enum Options {
24 OPT_SSLTCP = 0x01, // Pseudo-TLS. 26 OPT_SSLTCP = 0x01, // Pseudo-TLS.
25 OPT_TLS = 0x02, 27 OPT_TLS = 0x02,
26 OPT_STUN = 0x04, 28 OPT_STUN = 0x04,
27 }; 29 };
28 30
29 PacketSocketFactory() { } 31 PacketSocketFactory() { }
30 virtual ~PacketSocketFactory() { } 32 virtual ~PacketSocketFactory() { }
31 33
32 virtual AsyncPacketSocket* CreateUdpSocket(const SocketAddress& address, 34 virtual AsyncPacketSocket* CreateUdpSocket(const SocketAddress& address,
33 uint16_t min_port, 35 uint16_t min_port,
34 uint16_t max_port) = 0; 36 uint16_t max_port) = 0;
37 // TODO(honghaiz): Make this pure virtual method when all subclasses in
38 // Chrome define this.
39 virtual AsyncPacketSocket* CreateUdpSocketOnNetwork(
40 const SocketAddress& address,
41 uint16_t min_port,
42 uint16_t max_port,
43 const Network* network) {
44 // Should not have reached here.
45 ASSERT(false);
46 return nullptr;
47 }
48
35 virtual AsyncPacketSocket* CreateServerTcpSocket( 49 virtual AsyncPacketSocket* CreateServerTcpSocket(
36 const SocketAddress& local_address, 50 const SocketAddress& local_address,
37 uint16_t min_port, 51 uint16_t min_port,
38 uint16_t max_port, 52 uint16_t max_port,
39 int opts) = 0; 53 int opts) = 0;
40 54
41 // TODO: |proxy_info| and |user_agent| should be set 55 // TODO: |proxy_info| and |user_agent| should be set
42 // per-factory and not when socket is created. 56 // per-factory and not when socket is created.
43 virtual AsyncPacketSocket* CreateClientTcpSocket( 57 virtual AsyncPacketSocket* CreateClientTcpSocket(
44 const SocketAddress& local_address, 58 const SocketAddress& local_address,
45 const SocketAddress& remote_address, 59 const SocketAddress& remote_address,
46 const ProxyInfo& proxy_info, 60 const ProxyInfo& proxy_info,
47 const std::string& user_agent, 61 const std::string& user_agent,
48 int opts) = 0; 62 int opts) = 0;
49 63
50 virtual AsyncResolverInterface* CreateAsyncResolver() = 0; 64 virtual AsyncResolverInterface* CreateAsyncResolver() = 0;
51 65
52 private: 66 private:
53 RTC_DISALLOW_COPY_AND_ASSIGN(PacketSocketFactory); 67 RTC_DISALLOW_COPY_AND_ASSIGN(PacketSocketFactory);
54 }; 68 };
55 69
56 } // namespace rtc 70 } // namespace rtc
57 71
58 #endif // WEBRTC_P2P_BASE_PACKETSOCKETFACTORY_H_ 72 #endif // WEBRTC_P2P_BASE_PACKETSOCKETFACTORY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698