blob: 29f82db13d171c9d063381e2ef35801cb041eec2 [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
Steve Anton6c38cc72017-11-29 10:25:58 -080014#include <string>
15
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020016#include "p2p/base/packetsocketfactory.h"
henrike@webrtc.org269fb4b2014-10-28 22:20:11 +000017
18namespace rtc {
19
20class AsyncSocket;
21class SocketFactory;
22class Thread;
23
24class BasicPacketSocketFactory : public PacketSocketFactory {
25 public:
26 BasicPacketSocketFactory();
27 explicit BasicPacketSocketFactory(Thread* thread);
28 explicit BasicPacketSocketFactory(SocketFactory* socket_factory);
pkasting@chromium.org332331f2014-11-06 20:19:22 +000029 ~BasicPacketSocketFactory() override;
henrike@webrtc.org269fb4b2014-10-28 22:20:11 +000030
pkasting@chromium.org332331f2014-11-06 20:19:22 +000031 AsyncPacketSocket* CreateUdpSocket(const SocketAddress& local_address,
Peter Boström0c4e06b2015-10-07 12:23:21 +020032 uint16_t min_port,
33 uint16_t max_port) override;
pkasting@chromium.org332331f2014-11-06 20:19:22 +000034 AsyncPacketSocket* CreateServerTcpSocket(const SocketAddress& local_address,
Peter Boström0c4e06b2015-10-07 12:23:21 +020035 uint16_t min_port,
36 uint16_t max_port,
pkasting@chromium.org332331f2014-11-06 20:19:22 +000037 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 Antoneae3e652017-10-25 14:46:18 -070042 int opts) override;
Diogo Real1dca9d52017-08-29 12:18:32 -070043 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.org269fb4b2014-10-28 22:20:11 +000049
pkasting@chromium.org332331f2014-11-06 20:19:22 +000050 AsyncResolverInterface* CreateAsyncResolver() override;
henrike@webrtc.org269fb4b2014-10-28 22:20:11 +000051
52 private:
pkasting@chromium.org332331f2014-11-06 20:19:22 +000053 int BindSocket(AsyncSocket* socket,
54 const SocketAddress& local_address,
Peter Boström0c4e06b2015-10-07 12:23:21 +020055 uint16_t min_port,
56 uint16_t max_port);
henrike@webrtc.org269fb4b2014-10-28 22:20:11 +000057
58 SocketFactory* socket_factory();
59
60 Thread* thread_;
61 SocketFactory* socket_factory_;
62};
63
64} // namespace rtc
65
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020066#endif // P2P_BASE_BASICPACKETSOCKETFACTORY_H_