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_TCP_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_HOST_TCP_H_ |
6 #define CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_HOST_TCP_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_HOST_TCP_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 20 matching lines...) Expand all Loading... |
31 | 31 |
32 class CONTENT_EXPORT P2PSocketHostTcpBase : public P2PSocketHost { | 32 class CONTENT_EXPORT P2PSocketHostTcpBase : public P2PSocketHost { |
33 public: | 33 public: |
34 P2PSocketHostTcpBase(IPC::Sender* message_sender, | 34 P2PSocketHostTcpBase(IPC::Sender* message_sender, |
35 int socket_id, | 35 int socket_id, |
36 P2PSocketType type, | 36 P2PSocketType type, |
37 net::URLRequestContextGetter* url_context); | 37 net::URLRequestContextGetter* url_context); |
38 ~P2PSocketHostTcpBase() override; | 38 ~P2PSocketHostTcpBase() override; |
39 | 39 |
40 bool InitAccepted(const net::IPEndPoint& remote_address, | 40 bool InitAccepted(const net::IPEndPoint& remote_address, |
41 net::StreamSocket* socket); | 41 std::unique_ptr<net::StreamSocket> socket); |
42 | 42 |
43 // P2PSocketHost overrides. | 43 // P2PSocketHost overrides. |
44 bool Init(const net::IPEndPoint& local_address, | 44 bool Init(const net::IPEndPoint& local_address, |
45 uint16_t min_port, | 45 uint16_t min_port, |
46 uint16_t max_port, | 46 uint16_t max_port, |
47 const P2PHostAndIPEndPoint& remote_address) override; | 47 const P2PHostAndIPEndPoint& remote_address) override; |
48 void Send(const net::IPEndPoint& to, | 48 void Send(const net::IPEndPoint& to, |
49 const std::vector<char>& data, | 49 const std::vector<char>& data, |
50 const rtc::PacketOptions& options, | 50 const rtc::PacketOptions& options, |
51 uint64_t packet_id) override; | 51 uint64_t packet_id) override; |
52 P2PSocketHost* AcceptIncomingTcpConnection( | 52 std::unique_ptr<P2PSocketHost> AcceptIncomingTcpConnection( |
53 const net::IPEndPoint& remote_address, | 53 const net::IPEndPoint& remote_address, |
54 int id) override; | 54 int id) override; |
55 bool SetOption(P2PSocketOption option, int value) override; | 55 bool SetOption(P2PSocketOption option, int value) override; |
56 | 56 |
57 protected: | 57 protected: |
58 // Derived classes will provide the implementation. | 58 // Derived classes will provide the implementation. |
59 virtual int ProcessInput(char* input, int input_len) = 0; | 59 virtual int ProcessInput(char* input, int input_len) = 0; |
60 virtual void DoSend(const net::IPEndPoint& to, | 60 virtual void DoSend(const net::IPEndPoint& to, |
61 const std::vector<char>& data, | 61 const std::vector<char>& data, |
62 const rtc::PacketOptions& options) = 0; | 62 const rtc::PacketOptions& options) = 0; |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 private: | 144 private: |
145 int GetExpectedPacketSize(const char* data, int len, int* pad_bytes); | 145 int GetExpectedPacketSize(const char* data, int len, int* pad_bytes); |
146 | 146 |
147 DISALLOW_COPY_AND_ASSIGN(P2PSocketHostStunTcp); | 147 DISALLOW_COPY_AND_ASSIGN(P2PSocketHostStunTcp); |
148 }; | 148 }; |
149 | 149 |
150 | 150 |
151 } // namespace content | 151 } // namespace content |
152 | 152 |
153 #endif // CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_HOST_TCP_H_ | 153 #endif // CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_HOST_TCP_H_ |
OLD | NEW |