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

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

Issue 22381012: Allow p2p UDP packages to set DSCP (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: extra newline removed Created 7 years, 4 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 #include "net/udp/datagram_socket.h"
12 13
13 namespace IPC { 14 namespace IPC {
14 class Sender; 15 class Sender;
15 } 16 }
16 17
17 namespace net { 18 namespace net {
18 class URLRequestContextGetter; 19 class URLRequestContextGetter;
19 } 20 }
20 21
21 namespace content { 22 namespace content {
22 23
23 // Base class for P2P sockets. 24 // Base class for P2P sockets.
24 class CONTENT_EXPORT P2PSocketHost { 25 class CONTENT_EXPORT P2PSocketHost {
25 public: 26 public:
26 static const int kStunHeaderSize = 20; 27 static const int kStunHeaderSize = 20;
27 // Creates P2PSocketHost of the specific type. 28 // Creates P2PSocketHost of the specific type.
28 static P2PSocketHost* Create(IPC::Sender* message_sender, 29 static P2PSocketHost* Create(IPC::Sender* message_sender,
29 int id, P2PSocketType type, 30 int id, P2PSocketType type,
30 net::URLRequestContextGetter* url_context); 31 net::URLRequestContextGetter* url_context);
31 32
32 virtual ~P2PSocketHost(); 33 virtual ~P2PSocketHost();
33 34
34 // Initalizes the socket. Returns false when initiazations fails. 35 // Initalizes the socket. Returns false when initiazations fails.
35 virtual bool Init(const net::IPEndPoint& local_address, 36 virtual bool Init(const net::IPEndPoint& local_address,
36 const net::IPEndPoint& remote_address) = 0; 37 const net::IPEndPoint& remote_address) = 0;
37 38
38 // Sends |data| on the socket to |to|. 39 // Sends |data| on the socket to |to|.
39 virtual void Send(const net::IPEndPoint& to, 40 virtual void Send(const net::IPEndPoint& to,
40 const std::vector<char>& data) = 0; 41 const std::vector<char>& data,
42 net::DiffServCodePoint dscp) = 0;
41 43
42 virtual P2PSocketHost* AcceptIncomingTcpConnection( 44 virtual P2PSocketHost* AcceptIncomingTcpConnection(
43 const net::IPEndPoint& remote_address, int id) = 0; 45 const net::IPEndPoint& remote_address, int id) = 0;
44 46
45 protected: 47 protected:
46 friend class P2PSocketHostTcpTestBase; 48 friend class P2PSocketHostTcpTestBase;
47 49
48 enum StunMessageType { 50 enum StunMessageType {
49 STUN_BINDING_REQUEST = 0x0001, 51 STUN_BINDING_REQUEST = 0x0001,
50 STUN_BINDING_RESPONSE = 0x0101, 52 STUN_BINDING_RESPONSE = 0x0101,
(...skipping 28 matching lines...) Expand all
79 IPC::Sender* message_sender_; 81 IPC::Sender* message_sender_;
80 int id_; 82 int id_;
81 State state_; 83 State state_;
82 84
83 DISALLOW_COPY_AND_ASSIGN(P2PSocketHost); 85 DISALLOW_COPY_AND_ASSIGN(P2PSocketHost);
84 }; 86 };
85 87
86 } // namespace content 88 } // namespace content
87 89
88 #endif // CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_HOST_H_ 90 #endif // CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_HOST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698