• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
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_PACKETSOCKETFACTORY_H_
12 #define WEBRTC_P2P_BASE_PACKETSOCKETFACTORY_H_
13 
14 #include "webrtc/base/proxyinfo.h"
15 
16 namespace rtc {
17 
18 class AsyncPacketSocket;
19 class AsyncResolverInterface;
20 
21 class PacketSocketFactory {
22  public:
23   enum Options {
24     OPT_SSLTCP = 0x01,  // Pseudo-TLS.
25     OPT_TLS = 0x02,
26     OPT_STUN = 0x04,
27   };
28 
PacketSocketFactory()29   PacketSocketFactory() { }
~PacketSocketFactory()30   virtual ~PacketSocketFactory() { }
31 
32   virtual AsyncPacketSocket* CreateUdpSocket(const SocketAddress& address,
33                                              uint16_t min_port,
34                                              uint16_t max_port) = 0;
35   virtual AsyncPacketSocket* CreateServerTcpSocket(
36       const SocketAddress& local_address,
37       uint16_t min_port,
38       uint16_t max_port,
39       int opts) = 0;
40 
41   // TODO: |proxy_info| and |user_agent| should be set
42   // per-factory and not when socket is created.
43   virtual AsyncPacketSocket* CreateClientTcpSocket(
44       const SocketAddress& local_address,
45       const SocketAddress& remote_address,
46       const ProxyInfo& proxy_info,
47       const std::string& user_agent,
48       int opts) = 0;
49 
50   virtual AsyncResolverInterface* CreateAsyncResolver() = 0;
51 
52  private:
53   RTC_DISALLOW_COPY_AND_ASSIGN(PacketSocketFactory);
54 };
55 
56 }  // namespace rtc
57 
58 #endif  // WEBRTC_P2P_BASE_PACKETSOCKETFACTORY_H_
59