blob: fb3a52691df24e868e953a9ffbb9038e144f0915 [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
11#ifndef WEBRTC_P2P_BASE_BASICPACKETSOCKETFACTORY_H_
12#define WEBRTC_P2P_BASE_BASICPACKETSOCKETFACTORY_H_
13
14#include "webrtc/p2p/base/packetsocketfactory.h"
15
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);
27 virtual ~BasicPacketSocketFactory();
28
29 virtual AsyncPacketSocket* CreateUdpSocket(
30 const SocketAddress& local_address, int min_port, int max_port);
31 virtual AsyncPacketSocket* CreateServerTcpSocket(
32 const SocketAddress& local_address, int min_port, int max_port, int opts);
33 virtual AsyncPacketSocket* CreateClientTcpSocket(
34 const SocketAddress& local_address, const SocketAddress& remote_address,
35 const ProxyInfo& proxy_info, const std::string& user_agent, int opts);
36
37 virtual AsyncResolverInterface* CreateAsyncResolver();
38
39 private:
40 int BindSocket(AsyncSocket* socket, const SocketAddress& local_address,
41 int min_port, int max_port);
42
43 SocketFactory* socket_factory();
44
45 Thread* thread_;
46 SocketFactory* socket_factory_;
47};
48
49} // namespace rtc
50
51#endif // WEBRTC_P2P_BASE_BASICPACKETSOCKETFACTORY_H_