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

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

Issue 159353002: This CL adds methods to manipulate RTP header extension, particularly (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 10 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/public/common/p2p_socket_type.h" 9 #include "content/public/common/p2p_socket_type.h"
10 #include "net/base/ip_endpoint.h" 10 #include "net/base/ip_endpoint.h"
11 #include "net/udp/datagram_socket.h" 11 #include "net/udp/datagram_socket.h"
12 12
13 namespace IPC { 13 namespace IPC {
14 class Sender; 14 class Sender;
15 } 15 }
16 16
17 namespace net { 17 namespace net {
18 class URLRequestContextGetter; 18 class URLRequestContextGetter;
19 } 19 }
20 20
21 namespace talk_base { 21 namespace talk_base {
22 struct PacketOptions; 22 struct PacketOptions;
23 } 23 }
24 24
25 namespace content { 25 namespace content {
26 class P2PMessageThrottler; 26 class P2PMessageThrottler;
27 27
28
29 // Helper methods for processing a packet.
Solis 2014/02/27 09:36:10 put these in a nested namespace: namespace packet
Mallinath (Gone from Chromium) 2014/02/27 19:43:10 Done.
30 bool GetRtpPacketStartPositionAndLength(char* data, int length,
Solis 2014/02/27 09:36:10 Only GetRtpPacketStartPositionAndLength() and Mayb
Mallinath (Gone from Chromium) 2014/02/27 19:43:10 Done.
31 int* rtp_start_pos,
32 int* rtp_packet_length);
33 bool ValidateRtpHeader(char* rtp, int length);
34
35 void MaybeUpdatePacketAbsSendTimeExtn(char* data, int length,
36 const talk_base::PacketOptions& options);
37 bool MaybeUpdateRtpAbsSendTimeExtn(char* rtp, int length,
38 int extension_id);
39 void UpdateAbsSendTimeExtnValue(char* data, int len);
40
41 void MaybeUpdateRtpAuthTag(char* packet, int len,
42 const talk_base::PacketOptions& options);
43
28 // Base class for P2P sockets. 44 // Base class for P2P sockets.
29 class CONTENT_EXPORT P2PSocketHost { 45 class CONTENT_EXPORT P2PSocketHost {
30 public: 46 public:
31 static const int kStunHeaderSize = 20; 47 static const int kStunHeaderSize = 20;
32 // Creates P2PSocketHost of the specific type. 48 // Creates P2PSocketHost of the specific type.
33 static P2PSocketHost* Create(IPC::Sender* message_sender, 49 static P2PSocketHost* Create(IPC::Sender* message_sender,
34 int id, P2PSocketType type, 50 int id, P2PSocketType type,
35 net::URLRequestContextGetter* url_context, 51 net::URLRequestContextGetter* url_context,
36 P2PMessageThrottler* throttler); 52 P2PMessageThrottler* throttler);
37 53
38 virtual ~P2PSocketHost(); 54 virtual ~P2PSocketHost();
39 55
40 // Initalizes the socket. Returns false when initiazations fails. 56 // Initalizes the socket. Returns false when initiazations fails.
41 virtual bool Init(const net::IPEndPoint& local_address, 57 virtual bool Init(const net::IPEndPoint& local_address,
42 const net::IPEndPoint& remote_address) = 0; 58 const net::IPEndPoint& remote_address) = 0;
43 59
44 // Sends |data| on the socket to |to|. 60 // Sends |data| on the socket to |to|.
45 virtual void Send(const net::IPEndPoint& to, 61 virtual void Send(const net::IPEndPoint& to,
46 const std::vector<char>& data, 62 const std::vector<char>& data,
47 const talk_base::PacketOptions& options, 63 const talk_base::PacketOptions& options,
48 uint64 packet_id) = 0; 64 uint64 packet_id) = 0;
49 65
50 virtual P2PSocketHost* AcceptIncomingTcpConnection( 66 virtual P2PSocketHost* AcceptIncomingTcpConnection(
51 const net::IPEndPoint& remote_address, int id) = 0; 67 const net::IPEndPoint& remote_address, int id) = 0;
52 68
53 virtual bool SetOption(P2PSocketOption option, int value) = 0; 69 virtual bool SetOption(P2PSocketOption option, int value) = 0;
54 70
55 protected: 71 protected:
56 friend class P2PSocketHostTcpTestBase;
57 72
58 // TODO(mallinath) - Remove this below enum and use one defined in 73 // TODO(mallinath) - Remove this below enum and use one defined in
59 // libjingle/souce/talk/p2p/base/stun.h 74 // libjingle/souce/talk/p2p/base/stun.h
60 enum StunMessageType { 75 enum StunMessageType {
61 STUN_BINDING_REQUEST = 0x0001, 76 STUN_BINDING_REQUEST = 0x0001,
62 STUN_BINDING_RESPONSE = 0x0101, 77 STUN_BINDING_RESPONSE = 0x0101,
63 STUN_BINDING_ERROR_RESPONSE = 0x0111, 78 STUN_BINDING_ERROR_RESPONSE = 0x0111,
64 STUN_SHARED_SECRET_REQUEST = 0x0002, 79 STUN_SHARED_SECRET_REQUEST = 0x0002,
65 STUN_SHARED_SECRET_RESPONSE = 0x0102, 80 STUN_SHARED_SECRET_RESPONSE = 0x0102,
66 STUN_SHARED_SECRET_ERROR_RESPONSE = 0x0112, 81 STUN_SHARED_SECRET_ERROR_RESPONSE = 0x0112,
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 IPC::Sender* message_sender_; 115 IPC::Sender* message_sender_;
101 int id_; 116 int id_;
102 State state_; 117 State state_;
103 118
104 DISALLOW_COPY_AND_ASSIGN(P2PSocketHost); 119 DISALLOW_COPY_AND_ASSIGN(P2PSocketHost);
105 }; 120 };
106 121
107 } // namespace content 122 } // namespace content
108 123
109 #endif // CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_HOST_H_ 124 #endif // CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_HOST_H_
OLDNEW
« no previous file with comments | « no previous file | content/browser/renderer_host/p2p/socket_host.cc » ('j') | content/browser/renderer_host/p2p/socket_host.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698