henrike@webrtc.org | 269fb4b | 2014-10-28 22:20:11 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2011 The WebRTC Project Authors. All rights reserved. |
| 3 | * |
| 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 |
| 6 | * tree. An additional intellectual property rights grant can be found |
| 7 | * in the file PATENTS. All contributing project authors may |
| 8 | * be found in the AUTHORS file in the root of the source tree. |
| 9 | */ |
| 10 | |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 11 | #ifndef P2P_BASE_BASICPACKETSOCKETFACTORY_H_ |
| 12 | #define P2P_BASE_BASICPACKETSOCKETFACTORY_H_ |
henrike@webrtc.org | 269fb4b | 2014-10-28 22:20:11 +0000 | [diff] [blame] | 13 | |
Steve Anton | 6c38cc7 | 2017-11-29 10:25:58 -0800 | [diff] [blame] | 14 | #include <string> |
| 15 | |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 16 | #include "p2p/base/packetsocketfactory.h" |
henrike@webrtc.org | 269fb4b | 2014-10-28 22:20:11 +0000 | [diff] [blame] | 17 | |
| 18 | namespace rtc { |
| 19 | |
| 20 | class AsyncSocket; |
| 21 | class SocketFactory; |
| 22 | class Thread; |
| 23 | |
| 24 | class BasicPacketSocketFactory : public PacketSocketFactory { |
| 25 | public: |
| 26 | BasicPacketSocketFactory(); |
| 27 | explicit BasicPacketSocketFactory(Thread* thread); |
| 28 | explicit BasicPacketSocketFactory(SocketFactory* socket_factory); |
pkasting@chromium.org | 332331f | 2014-11-06 20:19:22 +0000 | [diff] [blame] | 29 | ~BasicPacketSocketFactory() override; |
henrike@webrtc.org | 269fb4b | 2014-10-28 22:20:11 +0000 | [diff] [blame] | 30 | |
pkasting@chromium.org | 332331f | 2014-11-06 20:19:22 +0000 | [diff] [blame] | 31 | AsyncPacketSocket* CreateUdpSocket(const SocketAddress& local_address, |
Peter Boström | 0c4e06b | 2015-10-07 12:23:21 +0200 | [diff] [blame] | 32 | uint16_t min_port, |
| 33 | uint16_t max_port) override; |
pkasting@chromium.org | 332331f | 2014-11-06 20:19:22 +0000 | [diff] [blame] | 34 | AsyncPacketSocket* CreateServerTcpSocket(const SocketAddress& local_address, |
Peter Boström | 0c4e06b | 2015-10-07 12:23:21 +0200 | [diff] [blame] | 35 | uint16_t min_port, |
| 36 | uint16_t max_port, |
pkasting@chromium.org | 332331f | 2014-11-06 20:19:22 +0000 | [diff] [blame] | 37 | int opts) override; |
| 38 | AsyncPacketSocket* CreateClientTcpSocket(const SocketAddress& local_address, |
| 39 | const SocketAddress& remote_address, |
| 40 | const ProxyInfo& proxy_info, |
| 41 | const std::string& user_agent, |
Steve Anton | eae3e65 | 2017-10-25 14:46:18 -0700 | [diff] [blame] | 42 | int opts) override; |
Diogo Real | 1dca9d5 | 2017-08-29 12:18:32 -0700 | [diff] [blame] | 43 | AsyncPacketSocket* CreateClientTcpSocket( |
| 44 | const SocketAddress& local_address, |
| 45 | const SocketAddress& remote_address, |
| 46 | const ProxyInfo& proxy_info, |
| 47 | const std::string& user_agent, |
| 48 | const PacketSocketTcpOptions& tcp_options) override; |
henrike@webrtc.org | 269fb4b | 2014-10-28 22:20:11 +0000 | [diff] [blame] | 49 | |
pkasting@chromium.org | 332331f | 2014-11-06 20:19:22 +0000 | [diff] [blame] | 50 | AsyncResolverInterface* CreateAsyncResolver() override; |
henrike@webrtc.org | 269fb4b | 2014-10-28 22:20:11 +0000 | [diff] [blame] | 51 | |
| 52 | private: |
pkasting@chromium.org | 332331f | 2014-11-06 20:19:22 +0000 | [diff] [blame] | 53 | int BindSocket(AsyncSocket* socket, |
| 54 | const SocketAddress& local_address, |
Peter Boström | 0c4e06b | 2015-10-07 12:23:21 +0200 | [diff] [blame] | 55 | uint16_t min_port, |
| 56 | uint16_t max_port); |
henrike@webrtc.org | 269fb4b | 2014-10-28 22:20:11 +0000 | [diff] [blame] | 57 | |
| 58 | SocketFactory* socket_factory(); |
| 59 | |
| 60 | Thread* thread_; |
| 61 | SocketFactory* socket_factory_; |
| 62 | }; |
| 63 | |
| 64 | } // namespace rtc |
| 65 | |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 66 | #endif // P2P_BASE_BASICPACKETSOCKETFACTORY_H_ |