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 | |
Steve Anton | 10542f2 | 2019-01-11 09:11:00 -0800 | [diff] [blame] | 11 | #ifndef P2P_BASE_BASIC_PACKET_SOCKET_FACTORY_H_ |
| 12 | #define P2P_BASE_BASIC_PACKET_SOCKET_FACTORY_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 | |
Patrik Höglund | 662e31f | 2019-09-05 14:35:04 +0200 | [diff] [blame] | 16 | #include "api/packet_socket_factory.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; |
Patrik Höglund | a42b632 | 2019-08-30 15:31:55 +0200 | [diff] [blame] | 38 | AsyncPacketSocket* CreateClientTcpSocket( |
| 39 | const SocketAddress& local_address, |
Diogo Real | 1dca9d5 | 2017-08-29 12:18:32 -0700 | [diff] [blame] | 40 | const SocketAddress& remote_address, |
| 41 | const ProxyInfo& proxy_info, |
| 42 | const std::string& user_agent, |
| 43 | const PacketSocketTcpOptions& tcp_options) override; |
henrike@webrtc.org | 269fb4b | 2014-10-28 22:20:11 +0000 | [diff] [blame] | 44 | |
pkasting@chromium.org | 332331f | 2014-11-06 20:19:22 +0000 | [diff] [blame] | 45 | AsyncResolverInterface* CreateAsyncResolver() override; |
henrike@webrtc.org | 269fb4b | 2014-10-28 22:20:11 +0000 | [diff] [blame] | 46 | |
| 47 | private: |
pkasting@chromium.org | 332331f | 2014-11-06 20:19:22 +0000 | [diff] [blame] | 48 | int BindSocket(AsyncSocket* socket, |
| 49 | const SocketAddress& local_address, |
Peter Boström | 0c4e06b | 2015-10-07 12:23:21 +0200 | [diff] [blame] | 50 | uint16_t min_port, |
| 51 | uint16_t max_port); |
henrike@webrtc.org | 269fb4b | 2014-10-28 22:20:11 +0000 | [diff] [blame] | 52 | |
| 53 | SocketFactory* socket_factory(); |
| 54 | |
| 55 | Thread* thread_; |
| 56 | SocketFactory* socket_factory_; |
| 57 | }; |
| 58 | |
| 59 | } // namespace rtc |
| 60 | |
Steve Anton | 10542f2 | 2019-01-11 09:11:00 -0800 | [diff] [blame] | 61 | #endif // P2P_BASE_BASIC_PACKET_SOCKET_FACTORY_H_ |