| 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 <queue> | 8 #include <queue> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 class GrowableIOBuffer; | 22 class GrowableIOBuffer; |
| 23 class StreamSocket; | 23 class StreamSocket; |
| 24 class URLRequestContextGetter; | 24 class URLRequestContextGetter; |
| 25 } // namespace net | 25 } // namespace net |
| 26 | 26 |
| 27 namespace content { | 27 namespace content { |
| 28 | 28 |
| 29 class CONTENT_EXPORT P2PSocketHostTcpBase : public P2PSocketHost { | 29 class CONTENT_EXPORT P2PSocketHostTcpBase : public P2PSocketHost { |
| 30 public: | 30 public: |
| 31 P2PSocketHostTcpBase(IPC::Sender* message_sender, | 31 P2PSocketHostTcpBase(IPC::Sender* message_sender, |
| 32 int id, | 32 int socket_id, |
| 33 int render_host_process_id, |
| 33 P2PSocketType type, | 34 P2PSocketType type, |
| 34 net::URLRequestContextGetter* url_context); | 35 net::URLRequestContextGetter* url_context); |
| 35 virtual ~P2PSocketHostTcpBase(); | 36 virtual ~P2PSocketHostTcpBase(); |
| 36 | 37 |
| 37 bool InitAccepted(const net::IPEndPoint& remote_address, | 38 bool InitAccepted(const net::IPEndPoint& remote_address, |
| 38 net::StreamSocket* socket); | 39 net::StreamSocket* socket); |
| 39 | 40 |
| 40 // P2PSocketHost overrides. | 41 // P2PSocketHost overrides. |
| 41 virtual bool Init(const net::IPEndPoint& local_address, | 42 virtual bool Init(const net::IPEndPoint& local_address, |
| 42 const P2PHostAndIPEndPoint& remote_address) OVERRIDE; | 43 const P2PHostAndIPEndPoint& remote_address) OVERRIDE; |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 bool connected_; | 95 bool connected_; |
| 95 P2PSocketType type_; | 96 P2PSocketType type_; |
| 96 scoped_refptr<net::URLRequestContextGetter> url_context_; | 97 scoped_refptr<net::URLRequestContextGetter> url_context_; |
| 97 | 98 |
| 98 DISALLOW_COPY_AND_ASSIGN(P2PSocketHostTcpBase); | 99 DISALLOW_COPY_AND_ASSIGN(P2PSocketHostTcpBase); |
| 99 }; | 100 }; |
| 100 | 101 |
| 101 class CONTENT_EXPORT P2PSocketHostTcp : public P2PSocketHostTcpBase { | 102 class CONTENT_EXPORT P2PSocketHostTcp : public P2PSocketHostTcpBase { |
| 102 public: | 103 public: |
| 103 P2PSocketHostTcp(IPC::Sender* message_sender, | 104 P2PSocketHostTcp(IPC::Sender* message_sender, |
| 104 int id, | 105 int socket_id, |
| 106 int render_host_process_id, |
| 105 P2PSocketType type, | 107 P2PSocketType type, |
| 106 net::URLRequestContextGetter* url_context); | 108 net::URLRequestContextGetter* url_context); |
| 107 virtual ~P2PSocketHostTcp(); | 109 virtual ~P2PSocketHostTcp(); |
| 108 | 110 |
| 109 protected: | 111 protected: |
| 110 virtual int ProcessInput(char* input, int input_len) OVERRIDE; | 112 virtual int ProcessInput(char* input, int input_len) OVERRIDE; |
| 111 virtual void DoSend(const net::IPEndPoint& to, | 113 virtual void DoSend(const net::IPEndPoint& to, |
| 112 const std::vector<char>& data, | 114 const std::vector<char>& data, |
| 113 const talk_base::PacketOptions& options) OVERRIDE; | 115 const talk_base::PacketOptions& options) OVERRIDE; |
| 114 private: | 116 private: |
| 115 DISALLOW_COPY_AND_ASSIGN(P2PSocketHostTcp); | 117 DISALLOW_COPY_AND_ASSIGN(P2PSocketHostTcp); |
| 116 }; | 118 }; |
| 117 | 119 |
| 118 // P2PSocketHostStunTcp class provides the framing of STUN messages when used | 120 // P2PSocketHostStunTcp class provides the framing of STUN messages when used |
| 119 // with TURN. These messages will not have length at front of the packet and | 121 // with TURN. These messages will not have length at front of the packet and |
| 120 // are padded to multiple of 4 bytes. | 122 // are padded to multiple of 4 bytes. |
| 121 // Formatting of messages is defined in RFC5766. | 123 // Formatting of messages is defined in RFC5766. |
| 122 class CONTENT_EXPORT P2PSocketHostStunTcp : public P2PSocketHostTcpBase { | 124 class CONTENT_EXPORT P2PSocketHostStunTcp : public P2PSocketHostTcpBase { |
| 123 public: | 125 public: |
| 124 P2PSocketHostStunTcp(IPC::Sender* message_sender, | 126 P2PSocketHostStunTcp(IPC::Sender* message_sender, |
| 125 int id, | 127 int socket_id, |
| 128 int render_host_process_id, |
| 126 P2PSocketType type, | 129 P2PSocketType type, |
| 127 net::URLRequestContextGetter* url_context); | 130 net::URLRequestContextGetter* url_context); |
| 128 | 131 |
| 129 virtual ~P2PSocketHostStunTcp(); | 132 virtual ~P2PSocketHostStunTcp(); |
| 130 | 133 |
| 131 protected: | 134 protected: |
| 132 virtual int ProcessInput(char* input, int input_len) OVERRIDE; | 135 virtual int ProcessInput(char* input, int input_len) OVERRIDE; |
| 133 virtual void DoSend(const net::IPEndPoint& to, | 136 virtual void DoSend(const net::IPEndPoint& to, |
| 134 const std::vector<char>& data, | 137 const std::vector<char>& data, |
| 135 const talk_base::PacketOptions& options) OVERRIDE; | 138 const talk_base::PacketOptions& options) OVERRIDE; |
| 136 private: | 139 private: |
| 137 int GetExpectedPacketSize(const char* data, int len, int* pad_bytes); | 140 int GetExpectedPacketSize(const char* data, int len, int* pad_bytes); |
| 138 | 141 |
| 139 DISALLOW_COPY_AND_ASSIGN(P2PSocketHostStunTcp); | 142 DISALLOW_COPY_AND_ASSIGN(P2PSocketHostStunTcp); |
| 140 }; | 143 }; |
| 141 | 144 |
| 142 | 145 |
| 143 } // namespace content | 146 } // namespace content |
| 144 | 147 |
| 145 #endif // CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_HOST_TCP_H_ | 148 #endif // CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_HOST_TCP_H_ |
| OLD | NEW |