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

Side by Side Diff: content/browser/renderer_host/p2p_socket_host.h

Issue 6800023: Security restrictions for P2P UDP Sockets. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: - Created 9 years, 8 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/p2p_sockets.h" 8 #include "content/common/p2p_sockets.h"
9 9
10 #include "ipc/ipc_message.h"
10 #include "net/base/ip_endpoint.h" 11 #include "net/base/ip_endpoint.h"
11 12
12 class P2PSocketsHost;
13
14 // Base class for P2P sockets used by P2PSocketsHost. 13 // Base class for P2P sockets used by P2PSocketsHost.
15 class P2PSocketHost { 14 class P2PSocketHost {
16 public: 15 public:
17 // Creates P2PSocketHost of the specific type. 16 // Creates P2PSocketHost of the specific type.
18 static P2PSocketHost* Create(P2PSocketsHost* host, int routing_id, int id, 17 static P2PSocketHost* Create(IPC::Message::Sender* message_sender,
19 P2PSocketType type); 18 int routing_id, int id, P2PSocketType type);
20 19
21 virtual ~P2PSocketHost(); 20 virtual ~P2PSocketHost();
22 21
23 // Initalizes the socket. Returns false when initiazations fails. 22 // Initalizes the socket. Returns false when initiazations fails.
24 virtual bool Init(const net::IPEndPoint& local_address) = 0; 23 virtual bool Init(const net::IPEndPoint& local_address) = 0;
25 24
26 // Sends |data| on the socket to |socket_address|. 25 // Sends |data| on the socket to |to|.
27 virtual void Send(const net::IPEndPoint& socket_address, 26 virtual void Send(const net::IPEndPoint& to,
28 const std::vector<char>& data) = 0; 27 const std::vector<char>& data) = 0;
29 28
30 protected: 29 protected:
31 P2PSocketHost(P2PSocketsHost* host, int routing_id, int id); 30 enum StunPacketType {
31 STUN_INVALID_PACKET,
32 STUN_BINDING_REQUEST,
33 STUN_BINDING_RESPONSE,
34 STUN_BINDING_ERROR,
35 STUN_UNKNOWN_TYPE,
36 };
32 37
33 P2PSocketsHost* host_; 38 P2PSocketHost(IPC::Message::Sender* message_sender, int routing_id, int id);
39
40 // Verifies that the packet |data| has a valid STUN header.
41 StunPacketType GetStunPacketType(const char* data, int data_size);
42
43 IPC::Message::Sender* message_sender_;
34 int routing_id_; 44 int routing_id_;
35 int id_; 45 int id_;
36 46
37 DISALLOW_COPY_AND_ASSIGN(P2PSocketHost); 47 DISALLOW_COPY_AND_ASSIGN(P2PSocketHost);
38 }; 48 };
39 49
40 #endif // CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_HOST_H_ 50 #endif // CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_HOST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698