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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/renderer_host/p2p_socket_host.h
diff --git a/content/browser/renderer_host/p2p_socket_host.h b/content/browser/renderer_host/p2p_socket_host.h
index 55af872e301619998fc575ea4057b5a5fe51f298..1d5849db2404da235893e6fca1d9f8ea651830d7 100644
--- a/content/browser/renderer_host/p2p_socket_host.h
+++ b/content/browser/renderer_host/p2p_socket_host.h
@@ -7,30 +7,40 @@
#include "content/common/p2p_sockets.h"
+#include "ipc/ipc_message.h"
#include "net/base/ip_endpoint.h"
-class P2PSocketsHost;
-
// Base class for P2P sockets used by P2PSocketsHost.
class P2PSocketHost {
public:
// Creates P2PSocketHost of the specific type.
- static P2PSocketHost* Create(P2PSocketsHost* host, int routing_id, int id,
- P2PSocketType type);
+ static P2PSocketHost* Create(IPC::Message::Sender* message_sender,
+ int routing_id, int id, P2PSocketType type);
virtual ~P2PSocketHost();
// Initalizes the socket. Returns false when initiazations fails.
virtual bool Init(const net::IPEndPoint& local_address) = 0;
- // Sends |data| on the socket to |socket_address|.
- virtual void Send(const net::IPEndPoint& socket_address,
+ // Sends |data| on the socket to |to|.
+ virtual void Send(const net::IPEndPoint& to,
const std::vector<char>& data) = 0;
protected:
- P2PSocketHost(P2PSocketsHost* host, int routing_id, int id);
+ enum StunPacketType {
+ STUN_INVALID_PACKET,
+ STUN_BINDING_REQUEST,
+ STUN_BINDING_RESPONSE,
+ STUN_BINDING_ERROR,
+ STUN_UNKNOWN_TYPE,
+ };
+
+ P2PSocketHost(IPC::Message::Sender* message_sender, int routing_id, int id);
+
+ // Verifies that the packet |data| has a valid STUN header.
+ StunPacketType GetStunPacketType(const char* data, int data_size);
- P2PSocketsHost* host_;
+ IPC::Message::Sender* message_sender_;
int routing_id_;
int id_;

Powered by Google App Engine
This is Rietveld 408576698