2014-10-28 22:20:11 +00:00
|
|
|
/*
|
|
|
|
|
* Copyright 2011 The WebRTC Project Authors. All rights reserved.
|
|
|
|
|
*
|
|
|
|
|
* Use of this source code is governed by a BSD-style license
|
|
|
|
|
* that can be found in the LICENSE file in the root of the source
|
|
|
|
|
* tree. An additional intellectual property rights grant can be found
|
|
|
|
|
* in the file PATENTS. All contributing project authors may
|
|
|
|
|
* be found in the AUTHORS file in the root of the source tree.
|
|
|
|
|
*/
|
|
|
|
|
|
2019-01-11 09:11:00 -08:00
|
|
|
#ifndef P2P_BASE_BASIC_PACKET_SOCKET_FACTORY_H_
|
|
|
|
|
#define P2P_BASE_BASIC_PACKET_SOCKET_FACTORY_H_
|
2014-10-28 22:20:11 +00:00
|
|
|
|
2021-10-14 13:57:07 +00:00
|
|
|
#include <stdint.h>
|
|
|
|
|
|
|
|
|
|
#include <memory>
|
2017-11-29 10:25:58 -08:00
|
|
|
#include <string>
|
|
|
|
|
|
2021-10-14 13:57:07 +00:00
|
|
|
#include "api/async_dns_resolver.h"
|
2019-09-05 14:35:04 +02:00
|
|
|
#include "api/packet_socket_factory.h"
|
2021-10-14 13:57:07 +00:00
|
|
|
#include "rtc_base/async_packet_socket.h"
|
|
|
|
|
#include "rtc_base/proxy_info.h"
|
2021-08-12 10:32:30 +02:00
|
|
|
#include "rtc_base/socket.h"
|
2021-10-14 13:57:07 +00:00
|
|
|
#include "rtc_base/socket_address.h"
|
|
|
|
|
#include "rtc_base/socket_factory.h"
|
2014-10-28 22:20:11 +00:00
|
|
|
|
|
|
|
|
namespace rtc {
|
|
|
|
|
|
|
|
|
|
class SocketFactory;
|
|
|
|
|
|
|
|
|
|
class BasicPacketSocketFactory : public PacketSocketFactory {
|
|
|
|
|
public:
|
|
|
|
|
explicit BasicPacketSocketFactory(SocketFactory* socket_factory);
|
2014-11-06 20:19:22 +00:00
|
|
|
~BasicPacketSocketFactory() override;
|
|
|
|
|
|
|
|
|
|
AsyncPacketSocket* CreateUdpSocket(const SocketAddress& local_address,
|
Use suffixed {uint,int}{8,16,32,64}_t types.
Removes the use of uint8, etc. in favor of uint8_t.
BUG=webrtc:5024
R=henrik.lundin@webrtc.org, henrikg@webrtc.org, perkj@webrtc.org, solenberg@webrtc.org, stefan@webrtc.org, tina.legrand@webrtc.org
Review URL: https://codereview.webrtc.org/1362503003 .
Cr-Commit-Position: refs/heads/master@{#10196}
2015-10-07 12:23:21 +02:00
|
|
|
uint16_t min_port,
|
|
|
|
|
uint16_t max_port) override;
|
2021-10-06 11:19:03 +02:00
|
|
|
AsyncListenSocket* CreateServerTcpSocket(const SocketAddress& local_address,
|
Use suffixed {uint,int}{8,16,32,64}_t types.
Removes the use of uint8, etc. in favor of uint8_t.
BUG=webrtc:5024
R=henrik.lundin@webrtc.org, henrikg@webrtc.org, perkj@webrtc.org, solenberg@webrtc.org, stefan@webrtc.org, tina.legrand@webrtc.org
Review URL: https://codereview.webrtc.org/1362503003 .
Cr-Commit-Position: refs/heads/master@{#10196}
2015-10-07 12:23:21 +02:00
|
|
|
uint16_t min_port,
|
|
|
|
|
uint16_t max_port,
|
2014-11-06 20:19:22 +00:00
|
|
|
int opts) override;
|
2017-08-29 12:18:32 -07:00
|
|
|
AsyncPacketSocket* CreateClientTcpSocket(
|
|
|
|
|
const SocketAddress& local_address,
|
|
|
|
|
const SocketAddress& remote_address,
|
|
|
|
|
const ProxyInfo& proxy_info,
|
|
|
|
|
const std::string& user_agent,
|
|
|
|
|
const PacketSocketTcpOptions& tcp_options) override;
|
2014-11-06 20:19:22 +00:00
|
|
|
|
2021-10-14 13:57:07 +00:00
|
|
|
// TODO(bugs.webrtc.org/12598) Remove when downstream stops using it.
|
|
|
|
|
ABSL_DEPRECATED("Use CreateAsyncDnsResolver")
|
2021-10-06 15:05:33 +00:00
|
|
|
AsyncResolverInterface* CreateAsyncResolver() override;
|
2014-10-28 22:20:11 +00:00
|
|
|
|
2021-10-14 13:57:07 +00:00
|
|
|
std::unique_ptr<webrtc::AsyncDnsResolverInterface> CreateAsyncDnsResolver()
|
|
|
|
|
override;
|
|
|
|
|
|
2014-10-28 22:20:11 +00:00
|
|
|
private:
|
2021-08-12 10:32:30 +02:00
|
|
|
int BindSocket(Socket* socket,
|
2014-11-06 20:19:22 +00:00
|
|
|
const SocketAddress& local_address,
|
Use suffixed {uint,int}{8,16,32,64}_t types.
Removes the use of uint8, etc. in favor of uint8_t.
BUG=webrtc:5024
R=henrik.lundin@webrtc.org, henrikg@webrtc.org, perkj@webrtc.org, solenberg@webrtc.org, stefan@webrtc.org, tina.legrand@webrtc.org
Review URL: https://codereview.webrtc.org/1362503003 .
Cr-Commit-Position: refs/heads/master@{#10196}
2015-10-07 12:23:21 +02:00
|
|
|
uint16_t min_port,
|
|
|
|
|
uint16_t max_port);
|
2014-10-28 22:20:11 +00:00
|
|
|
|
|
|
|
|
SocketFactory* socket_factory_;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace rtc
|
|
|
|
|
|
2019-01-11 09:11:00 -08:00
|
|
|
#endif // P2P_BASE_BASIC_PACKET_SOCKET_FACTORY_H_
|