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 | |
| 11 | #ifndef WEBRTC_P2P_BASE_BASICPACKETSOCKETFACTORY_H_ |
| 12 | #define WEBRTC_P2P_BASE_BASICPACKETSOCKETFACTORY_H_ |
| 13 | |
| 14 | #include "webrtc/p2p/base/packetsocketfactory.h" |
| 15 | |
| 16 | namespace rtc { |
| 17 | |
| 18 | class AsyncSocket; |
| 19 | class SocketFactory; |
| 20 | class Thread; |
| 21 | |
| 22 | class BasicPacketSocketFactory : public PacketSocketFactory { |
| 23 | public: |
| 24 | BasicPacketSocketFactory(); |
| 25 | explicit BasicPacketSocketFactory(Thread* thread); |
| 26 | explicit BasicPacketSocketFactory(SocketFactory* socket_factory); |
pkasting@chromium.org | 332331f | 2014-11-06 20:19:22 +0000 | [diff] [blame] | 27 | ~BasicPacketSocketFactory() override; |
henrike@webrtc.org | 269fb4b | 2014-10-28 22:20:11 +0000 | [diff] [blame] | 28 | |
pkasting@chromium.org | 332331f | 2014-11-06 20:19:22 +0000 | [diff] [blame] | 29 | AsyncPacketSocket* CreateUdpSocket(const SocketAddress& local_address, |
Peter Boström | 0c4e06b | 2015-10-07 12:23:21 +0200 | [diff] [blame^] | 30 | uint16_t min_port, |
| 31 | uint16_t max_port) override; |
pkasting@chromium.org | 332331f | 2014-11-06 20:19:22 +0000 | [diff] [blame] | 32 | AsyncPacketSocket* CreateServerTcpSocket(const SocketAddress& local_address, |
Peter Boström | 0c4e06b | 2015-10-07 12:23:21 +0200 | [diff] [blame^] | 33 | uint16_t min_port, |
| 34 | uint16_t max_port, |
pkasting@chromium.org | 332331f | 2014-11-06 20:19:22 +0000 | [diff] [blame] | 35 | int opts) override; |
| 36 | AsyncPacketSocket* CreateClientTcpSocket(const SocketAddress& local_address, |
| 37 | const SocketAddress& remote_address, |
| 38 | const ProxyInfo& proxy_info, |
| 39 | const std::string& user_agent, |
| 40 | int opts) override; |
henrike@webrtc.org | 269fb4b | 2014-10-28 22:20:11 +0000 | [diff] [blame] | 41 | |
pkasting@chromium.org | 332331f | 2014-11-06 20:19:22 +0000 | [diff] [blame] | 42 | AsyncResolverInterface* CreateAsyncResolver() override; |
henrike@webrtc.org | 269fb4b | 2014-10-28 22:20:11 +0000 | [diff] [blame] | 43 | |
| 44 | private: |
pkasting@chromium.org | 332331f | 2014-11-06 20:19:22 +0000 | [diff] [blame] | 45 | int BindSocket(AsyncSocket* socket, |
| 46 | const SocketAddress& local_address, |
Peter Boström | 0c4e06b | 2015-10-07 12:23:21 +0200 | [diff] [blame^] | 47 | uint16_t min_port, |
| 48 | uint16_t max_port); |
henrike@webrtc.org | 269fb4b | 2014-10-28 22:20:11 +0000 | [diff] [blame] | 49 | |
| 50 | SocketFactory* socket_factory(); |
| 51 | |
| 52 | Thread* thread_; |
| 53 | SocketFactory* socket_factory_; |
| 54 | }; |
| 55 | |
| 56 | } // namespace rtc |
| 57 | |
| 58 | #endif // WEBRTC_P2P_BASE_BASICPACKETSOCKETFACTORY_H_ |