blob: 337efca843c6bbbcb93d8cd9b9c8870f1ac0a42a [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
Steve Anton10542f22019-01-11 09:11:00 -080011#ifndef P2P_BASE_BASIC_PACKET_SOCKET_FACTORY_H_
12#define P2P_BASE_BASIC_PACKET_SOCKET_FACTORY_H_
henrike@webrtc.org269fb4b2014-10-28 22:20:11 +000013
Steve Anton6c38cc72017-11-29 10:25:58 -080014#include <string>
15
Patrik Höglund662e31f2019-09-05 14:35:04 +020016#include "api/packet_socket_factory.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;
Patrik Höglunda42b6322019-08-30 15:31:55 +020038 AsyncPacketSocket* CreateClientTcpSocket(
39 const SocketAddress& local_address,
Diogo Real1dca9d52017-08-29 12:18:32 -070040 const SocketAddress& remote_address,
41 const ProxyInfo& proxy_info,
42 const std::string& user_agent,
43 const PacketSocketTcpOptions& tcp_options) override;
henrike@webrtc.org269fb4b2014-10-28 22:20:11 +000044
pkasting@chromium.org332331f2014-11-06 20:19:22 +000045 AsyncResolverInterface* CreateAsyncResolver() override;
henrike@webrtc.org269fb4b2014-10-28 22:20:11 +000046
47 private:
pkasting@chromium.org332331f2014-11-06 20:19:22 +000048 int BindSocket(AsyncSocket* socket,
49 const SocketAddress& local_address,
Peter Boström0c4e06b2015-10-07 12:23:21 +020050 uint16_t min_port,
51 uint16_t max_port);
henrike@webrtc.org269fb4b2014-10-28 22:20:11 +000052
53 SocketFactory* socket_factory();
54
55 Thread* thread_;
56 SocketFactory* socket_factory_;
57};
58
59} // namespace rtc
60
Steve Anton10542f22019-01-11 09:11:00 -080061#endif // P2P_BASE_BASIC_PACKET_SOCKET_FACTORY_H_