OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CONTENT_RENDERER_P2P_SOCKET_CLIENT_H_ | 5 #ifndef CONTENT_RENDERER_P2P_SOCKET_CLIENT_H_ |
6 #define CONTENT_RENDERER_P2P_SOCKET_CLIENT_H_ | 6 #define CONTENT_RENDERER_P2P_SOCKET_CLIENT_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <vector> | 10 #include <vector> |
(...skipping 15 matching lines...) Expand all Loading... |
26 // called on the same thread. | 26 // called on the same thread. |
27 class P2PSocketClient : public base::RefCountedThreadSafe<P2PSocketClient> { | 27 class P2PSocketClient : public base::RefCountedThreadSafe<P2PSocketClient> { |
28 public: | 28 public: |
29 // Create a new P2PSocketClient() of the specified |type| and connected to | 29 // Create a new P2PSocketClient() of the specified |type| and connected to |
30 // the specified |address|. |address| matters only when |type| is set to | 30 // the specified |address|. |address| matters only when |type| is set to |
31 // P2P_SOCKET_TCP_CLIENT. The methods on the returned socket may only be | 31 // P2P_SOCKET_TCP_CLIENT. The methods on the returned socket may only be |
32 // called on the same thread that created it. | 32 // called on the same thread that created it. |
33 static scoped_refptr<P2PSocketClient> Create( | 33 static scoped_refptr<P2PSocketClient> Create( |
34 P2PSocketType type, | 34 P2PSocketType type, |
35 const net::IPEndPoint& local_address, | 35 const net::IPEndPoint& local_address, |
| 36 uint16_t min_port, |
| 37 uint16_t max_port, |
36 const net::IPEndPoint& remote_address, | 38 const net::IPEndPoint& remote_address, |
37 P2PSocketClientDelegate* delegate); | 39 P2PSocketClientDelegate* delegate); |
38 | 40 |
39 P2PSocketClient() {} | 41 P2PSocketClient() {} |
40 | 42 |
41 // Send the |data| to the |address| using Differentiated Services Code Point | 43 // Send the |data| to the |address| using Differentiated Services Code Point |
42 // |dscp|. Return value is the unique packet_id for this packet. | 44 // |dscp|. Return value is the unique packet_id for this packet. |
43 virtual uint64_t Send(const net::IPEndPoint& address, | 45 virtual uint64_t Send(const net::IPEndPoint& address, |
44 const std::vector<char>& data, | 46 const std::vector<char>& data, |
45 const rtc::PacketOptions& options) = 0; | 47 const rtc::PacketOptions& options) = 0; |
46 | 48 |
47 virtual void SetOption(P2PSocketOption option, int value) = 0; | 49 virtual void SetOption(P2PSocketOption option, int value) = 0; |
48 | 50 |
49 // Must be called before the socket is destroyed. | 51 // Must be called before the socket is destroyed. |
50 virtual void Close() = 0; | 52 virtual void Close() = 0; |
51 | 53 |
52 virtual int GetSocketID() const = 0; | 54 virtual int GetSocketID() const = 0; |
53 virtual void SetDelegate(P2PSocketClientDelegate* delegate) = 0; | 55 virtual void SetDelegate(P2PSocketClientDelegate* delegate) = 0; |
54 | 56 |
55 protected: | 57 protected: |
56 virtual ~P2PSocketClient() {} | 58 virtual ~P2PSocketClient() {} |
57 | 59 |
58 private: | 60 private: |
59 // Calls destructor. | 61 // Calls destructor. |
60 friend class base::RefCountedThreadSafe<P2PSocketClient>; | 62 friend class base::RefCountedThreadSafe<P2PSocketClient>; |
61 }; | 63 }; |
62 } // namespace content | 64 } // namespace content |
63 | 65 |
64 #endif // CONTENT_RENDERER_P2P_SOCKET_CLIENT_H_ | 66 #endif // CONTENT_RENDERER_P2P_SOCKET_CLIENT_H_ |
OLD | NEW |