Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(73)

Side by Side Diff: content/browser/renderer_host/p2p/socket_host.h

Issue 17132012: Proxy support for P2P TCP Socket (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "content/common/content_export.h" 8 #include "content/common/content_export.h"
9 #include "content/common/p2p_sockets.h" 9 #include "content/common/p2p_sockets.h"
10 10
11 #include "net/base/ip_endpoint.h" 11 #include "net/base/ip_endpoint.h"
12 12
13 namespace IPC { 13 namespace IPC {
14 class Sender; 14 class Sender;
15 } 15 }
16 16
17 namespace net {
18 class URLRequestContextGetter;
19 }
20
17 namespace content { 21 namespace content {
18 22
19 // Base class for P2P sockets. 23 // Base class for P2P sockets.
20 class CONTENT_EXPORT P2PSocketHost { 24 class CONTENT_EXPORT P2PSocketHost {
21 public: 25 public:
22 static const int kStunHeaderSize = 20; 26 static const int kStunHeaderSize = 20;
23 // Creates P2PSocketHost of the specific type. 27 // Creates P2PSocketHost of the specific type.
24 static P2PSocketHost* Create(IPC::Sender* message_sender, 28 static P2PSocketHost* Create(IPC::Sender* message_sender,
25 int id, P2PSocketType type); 29 int id, P2PSocketType type,
30 net::URLRequestContextGetter* url_context);
26 31
27 virtual ~P2PSocketHost(); 32 virtual ~P2PSocketHost();
28 33
29 // Initalizes the socket. Returns false when initiazations fails. 34 // Initalizes the socket. Returns false when initiazations fails.
30 virtual bool Init(const net::IPEndPoint& local_address, 35 virtual bool Init(const net::IPEndPoint& local_address,
31 const net::IPEndPoint& remote_address) = 0; 36 const net::IPEndPoint& remote_address) = 0;
32 37
33 // Sends |data| on the socket to |to|. 38 // Sends |data| on the socket to |to|.
34 virtual void Send(const net::IPEndPoint& to, 39 virtual void Send(const net::IPEndPoint& to,
35 const std::vector<char>& data) = 0; 40 const std::vector<char>& data) = 0;
36 41
37 virtual P2PSocketHost* AcceptIncomingTcpConnection( 42 virtual P2PSocketHost* AcceptIncomingTcpConnection(
38 const net::IPEndPoint& remote_address, int id) = 0; 43 const net::IPEndPoint& remote_address, int id) = 0;
39 44
40 protected: 45 protected:
41 friend class P2PSocketHostTcpTest; 46 friend class P2PSocketHostTcpTestBase;
42 friend class P2PSocketHostStunTcpTest;
43 47
44 enum StunMessageType { 48 enum StunMessageType {
45 STUN_BINDING_REQUEST = 0x0001, 49 STUN_BINDING_REQUEST = 0x0001,
46 STUN_BINDING_RESPONSE = 0x0101, 50 STUN_BINDING_RESPONSE = 0x0101,
47 STUN_BINDING_ERROR_RESPONSE = 0x0111, 51 STUN_BINDING_ERROR_RESPONSE = 0x0111,
48 STUN_SHARED_SECRET_REQUEST = 0x0002, 52 STUN_SHARED_SECRET_REQUEST = 0x0002,
49 STUN_SHARED_SECRET_RESPONSE = 0x0102, 53 STUN_SHARED_SECRET_RESPONSE = 0x0102,
50 STUN_SHARED_SECRET_ERROR_RESPONSE = 0x0112, 54 STUN_SHARED_SECRET_ERROR_RESPONSE = 0x0112,
51 STUN_ALLOCATE_REQUEST = 0x0003, 55 STUN_ALLOCATE_REQUEST = 0x0003,
52 STUN_ALLOCATE_RESPONSE = 0x0103, 56 STUN_ALLOCATE_RESPONSE = 0x0103,
(...skipping 22 matching lines...) Expand all
75 IPC::Sender* message_sender_; 79 IPC::Sender* message_sender_;
76 int id_; 80 int id_;
77 State state_; 81 State state_;
78 82
79 DISALLOW_COPY_AND_ASSIGN(P2PSocketHost); 83 DISALLOW_COPY_AND_ASSIGN(P2PSocketHost);
80 }; 84 };
81 85
82 } // namespace content 86 } // namespace content
83 87
84 #endif // CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_HOST_H_ 88 #endif // CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_HOST_H_
OLDNEW
« no previous file with comments | « content/browser/renderer_host/p2p/socket_dispatcher_host.cc ('k') | content/browser/renderer_host/p2p/socket_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698