blob: 08f525e90a140806d2e392c250c592f93175e3e0 [file] [log] [blame]
henrike@webrtc.org269fb4b2014-10-28 22:20:11 +00001/*
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 Bonadei92ea95e2017-09-15 06:47:31 +020011#ifndef P2P_BASE_BASICPACKETSOCKETFACTORY_H_
12#define P2P_BASE_BASICPACKETSOCKETFACTORY_H_
henrike@webrtc.org269fb4b2014-10-28 22:20:11 +000013
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020014#include "p2p/base/packetsocketfactory.h"
henrike@webrtc.org269fb4b2014-10-28 22:20:11 +000015
16namespace rtc {
17
18class AsyncSocket;
19class SocketFactory;
20class Thread;
21
22class BasicPacketSocketFactory : public PacketSocketFactory {
23 public:
24 BasicPacketSocketFactory();
25 explicit BasicPacketSocketFactory(Thread* thread);
26 explicit BasicPacketSocketFactory(SocketFactory* socket_factory);
pkasting@chromium.org332331f2014-11-06 20:19:22 +000027 ~BasicPacketSocketFactory() override;
henrike@webrtc.org269fb4b2014-10-28 22:20:11 +000028
pkasting@chromium.org332331f2014-11-06 20:19:22 +000029 AsyncPacketSocket* CreateUdpSocket(const SocketAddress& local_address,
Peter Boström0c4e06b2015-10-07 12:23:21 +020030 uint16_t min_port,
31 uint16_t max_port) override;
pkasting@chromium.org332331f2014-11-06 20:19:22 +000032 AsyncPacketSocket* CreateServerTcpSocket(const SocketAddress& local_address,
Peter Boström0c4e06b2015-10-07 12:23:21 +020033 uint16_t min_port,
34 uint16_t max_port,
pkasting@chromium.org332331f2014-11-06 20:19:22 +000035 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,
Steve Antoneae3e652017-10-25 14:46:18 -070040 int opts) override;
Diogo Real1dca9d52017-08-29 12:18:32 -070041 AsyncPacketSocket* CreateClientTcpSocket(
42 const SocketAddress& local_address,
43 const SocketAddress& remote_address,
44 const ProxyInfo& proxy_info,
45 const std::string& user_agent,
46 const PacketSocketTcpOptions& tcp_options) override;
henrike@webrtc.org269fb4b2014-10-28 22:20:11 +000047
pkasting@chromium.org332331f2014-11-06 20:19:22 +000048 AsyncResolverInterface* CreateAsyncResolver() override;
henrike@webrtc.org269fb4b2014-10-28 22:20:11 +000049
50 private:
pkasting@chromium.org332331f2014-11-06 20:19:22 +000051 int BindSocket(AsyncSocket* socket,
52 const SocketAddress& local_address,
Peter Boström0c4e06b2015-10-07 12:23:21 +020053 uint16_t min_port,
54 uint16_t max_port);
henrike@webrtc.org269fb4b2014-10-28 22:20:11 +000055
56 SocketFactory* socket_factory();
57
58 Thread* thread_;
59 SocketFactory* socket_factory_;
60};
61
62} // namespace rtc
63
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020064#endif // P2P_BASE_BASICPACKETSOCKETFACTORY_H_