OLD | NEW |
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/proxyinfo.h" | 14 #include "webrtc/base/proxyinfo.h" |
15 | 15 |
16 namespace rtc { | 16 namespace rtc { |
17 | 17 |
18 class AsyncPacketSocket; | 18 class AsyncPacketSocket; |
19 class AsyncResolverInterface; | 19 class AsyncResolverInterface; |
| 20 class Network; |
20 | 21 |
21 class PacketSocketFactory { | 22 class PacketSocketFactory { |
22 public: | 23 public: |
23 enum Options { | 24 enum Options { |
24 OPT_SSLTCP = 0x01, // Pseudo-TLS. | 25 OPT_SSLTCP = 0x01, // Pseudo-TLS. |
25 OPT_TLS = 0x02, | 26 OPT_TLS = 0x02, |
26 OPT_STUN = 0x04, | 27 OPT_STUN = 0x04, |
27 }; | 28 }; |
28 | 29 |
29 PacketSocketFactory() { } | 30 PacketSocketFactory() { } |
30 virtual ~PacketSocketFactory() { } | 31 virtual ~PacketSocketFactory() { } |
31 | 32 |
32 virtual AsyncPacketSocket* CreateUdpSocket(const SocketAddress& address, | 33 virtual AsyncPacketSocket* CreateUdpSocket(const SocketAddress& address, |
33 uint16_t min_port, | 34 uint16_t min_port, |
34 uint16_t max_port) = 0; | 35 uint16_t max_port) = 0; |
| 36 virtual AsyncPacketSocket* CreateUdpSocket( |
| 37 const SocketAddress& address, |
| 38 uint16_t min_port, |
| 39 uint16_t max_port, |
| 40 const Network* network) { return nullptr; } |
| 41 |
35 virtual AsyncPacketSocket* CreateServerTcpSocket( | 42 virtual AsyncPacketSocket* CreateServerTcpSocket( |
36 const SocketAddress& local_address, | 43 const SocketAddress& local_address, |
37 uint16_t min_port, | 44 uint16_t min_port, |
38 uint16_t max_port, | 45 uint16_t max_port, |
39 int opts) = 0; | 46 int opts) = 0; |
40 | 47 |
41 // TODO: |proxy_info| and |user_agent| should be set | 48 // TODO: |proxy_info| and |user_agent| should be set |
42 // per-factory and not when socket is created. | 49 // per-factory and not when socket is created. |
43 virtual AsyncPacketSocket* CreateClientTcpSocket( | 50 virtual AsyncPacketSocket* CreateClientTcpSocket( |
44 const SocketAddress& local_address, | 51 const SocketAddress& local_address, |
45 const SocketAddress& remote_address, | 52 const SocketAddress& remote_address, |
46 const ProxyInfo& proxy_info, | 53 const ProxyInfo& proxy_info, |
47 const std::string& user_agent, | 54 const std::string& user_agent, |
48 int opts) = 0; | 55 int opts) = 0; |
49 | 56 |
50 virtual AsyncResolverInterface* CreateAsyncResolver() = 0; | 57 virtual AsyncResolverInterface* CreateAsyncResolver() = 0; |
51 | 58 |
52 private: | 59 private: |
53 RTC_DISALLOW_COPY_AND_ASSIGN(PacketSocketFactory); | 60 RTC_DISALLOW_COPY_AND_ASSIGN(PacketSocketFactory); |
54 }; | 61 }; |
55 | 62 |
56 } // namespace rtc | 63 } // namespace rtc |
57 | 64 |
58 #endif // WEBRTC_P2P_BASE_PACKETSOCKETFACTORY_H_ | 65 #endif // WEBRTC_P2P_BASE_PACKETSOCKETFACTORY_H_ |
OLD | NEW |