OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_BROWSER_RENDERER_HOST_P2P_SOCKET_HOST_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_HOST_H_ |
6 #define CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_HOST_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_HOST_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 26 matching lines...) Expand all Loading... |
37 static const int kStunHeaderSize = 20; | 37 static const int kStunHeaderSize = 20; |
38 // Creates P2PSocketHost of the specific type. | 38 // Creates P2PSocketHost of the specific type. |
39 static P2PSocketHost* Create(IPC::Sender* message_sender, | 39 static P2PSocketHost* Create(IPC::Sender* message_sender, |
40 int socket_id, | 40 int socket_id, |
41 P2PSocketType type, | 41 P2PSocketType type, |
42 net::URLRequestContextGetter* url_context, | 42 net::URLRequestContextGetter* url_context, |
43 P2PMessageThrottler* throttler); | 43 P2PMessageThrottler* throttler); |
44 | 44 |
45 virtual ~P2PSocketHost(); | 45 virtual ~P2PSocketHost(); |
46 | 46 |
47 // Initalizes the socket. Returns false when initiazations fails. | 47 // Initalizes the socket. Returns false when initialization fails. |
| 48 // |min_port| and |max_port| specify the valid range of allowed ports. |
| 49 // |min_port| must be less than or equal to |max_port|. |
| 50 // If |min_port| is zero, |max_port| must also be zero and it means all ports |
| 51 // are valid. |
| 52 // If |local_address.port()| is zero, the socket will be initialized to a port |
| 53 // in the valid range. |
| 54 // If |local_address.port()| is nonzero and not in the valid range, |
| 55 // initialization will fail. |
48 virtual bool Init(const net::IPEndPoint& local_address, | 56 virtual bool Init(const net::IPEndPoint& local_address, |
| 57 uint16_t min_port, |
| 58 uint16_t max_port, |
49 const P2PHostAndIPEndPoint& remote_address) = 0; | 59 const P2PHostAndIPEndPoint& remote_address) = 0; |
50 | 60 |
51 // Sends |data| on the socket to |to|. | 61 // Sends |data| on the socket to |to|. |
52 virtual void Send(const net::IPEndPoint& to, | 62 virtual void Send(const net::IPEndPoint& to, |
53 const std::vector<char>& data, | 63 const std::vector<char>& data, |
54 const rtc::PacketOptions& options, | 64 const rtc::PacketOptions& options, |
55 uint64_t packet_id) = 0; | 65 uint64_t packet_id) = 0; |
56 | 66 |
57 virtual P2PSocketHost* AcceptIncomingTcpConnection( | 67 virtual P2PSocketHost* AcceptIncomingTcpConnection( |
58 const net::IPEndPoint& remote_address, int id) = 0; | 68 const net::IPEndPoint& remote_address, int id) = 0; |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 int32_t send_bytes_delayed_cur_; | 163 int32_t send_bytes_delayed_cur_; |
154 | 164 |
155 base::WeakPtrFactory<P2PSocketHost> weak_ptr_factory_; | 165 base::WeakPtrFactory<P2PSocketHost> weak_ptr_factory_; |
156 | 166 |
157 DISALLOW_COPY_AND_ASSIGN(P2PSocketHost); | 167 DISALLOW_COPY_AND_ASSIGN(P2PSocketHost); |
158 }; | 168 }; |
159 | 169 |
160 } // namespace content | 170 } // namespace content |
161 | 171 |
162 #endif // CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_HOST_H_ | 172 #endif // CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_HOST_H_ |
OLD | NEW |