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

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, 9 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_socket_type.h" 9 #include "content/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 namespace packet_processing_helpers {
29
30 // This method can handle only RTP packet, otherwise this method must not be
31 // called. It will try to do, 1. update absolute send time extension header
32 // if present with current time and 2. update HMAC in RTP packet.
33 bool MaybeUpdatePacketAbsSendTimeExtnAndRtpAuthTag(
34 char* data, int length, const talk_base::PacketOptions& options);
35
36 // Helper method which finds RTP ofset and length if the packet is encapsulated
37 // in a TURN Channel Message or TURN Send Indication message.
38 bool GetRtpPacketStartPositionAndLength(char* data, int length,
39 int* rtp_start_pos,
40 int* rtp_packet_length);
41 // Helper method which updates absoulute send time extension if present.
42 bool UpdateRtpAbsSendTimeExtn(char* rtp, int length, int extension_id);
43
44 } // packet_processing_helpers
45
28 // Base class for P2P sockets. 46 // Base class for P2P sockets.
29 class CONTENT_EXPORT P2PSocketHost { 47 class CONTENT_EXPORT P2PSocketHost {
30 public: 48 public:
31 static const int kStunHeaderSize = 20; 49 static const int kStunHeaderSize = 20;
32 // Creates P2PSocketHost of the specific type. 50 // Creates P2PSocketHost of the specific type.
33 static P2PSocketHost* Create(IPC::Sender* message_sender, 51 static P2PSocketHost* Create(IPC::Sender* message_sender,
34 int id, P2PSocketType type, 52 int id, P2PSocketType type,
35 net::URLRequestContextGetter* url_context, 53 net::URLRequestContextGetter* url_context,
36 P2PMessageThrottler* throttler); 54 P2PMessageThrottler* throttler);
37 55
38 virtual ~P2PSocketHost(); 56 virtual ~P2PSocketHost();
39 57
40 // Initalizes the socket. Returns false when initiazations fails. 58 // Initalizes the socket. Returns false when initiazations fails.
41 virtual bool Init(const net::IPEndPoint& local_address, 59 virtual bool Init(const net::IPEndPoint& local_address,
42 const net::IPEndPoint& remote_address) = 0; 60 const net::IPEndPoint& remote_address) = 0;
43 61
44 // Sends |data| on the socket to |to|. 62 // Sends |data| on the socket to |to|.
45 virtual void Send(const net::IPEndPoint& to, 63 virtual void Send(const net::IPEndPoint& to,
46 const std::vector<char>& data, 64 const std::vector<char>& data,
47 const talk_base::PacketOptions& options, 65 const talk_base::PacketOptions& options,
48 uint64 packet_id) = 0; 66 uint64 packet_id) = 0;
49 67
50 virtual P2PSocketHost* AcceptIncomingTcpConnection( 68 virtual P2PSocketHost* AcceptIncomingTcpConnection(
51 const net::IPEndPoint& remote_address, int id) = 0; 69 const net::IPEndPoint& remote_address, int id) = 0;
52 70
53 virtual bool SetOption(P2PSocketOption option, int value) = 0; 71 virtual bool SetOption(P2PSocketOption option, int value) = 0;
54 72
55 protected: 73 protected:
56 friend class P2PSocketHostTcpTestBase;
57 74
58 // TODO(mallinath) - Remove this below enum and use one defined in 75 // TODO(mallinath) - Remove this below enum and use one defined in
59 // libjingle/souce/talk/p2p/base/stun.h 76 // libjingle/souce/talk/p2p/base/stun.h
60 enum StunMessageType { 77 enum StunMessageType {
61 STUN_BINDING_REQUEST = 0x0001, 78 STUN_BINDING_REQUEST = 0x0001,
62 STUN_BINDING_RESPONSE = 0x0101, 79 STUN_BINDING_RESPONSE = 0x0101,
63 STUN_BINDING_ERROR_RESPONSE = 0x0111, 80 STUN_BINDING_ERROR_RESPONSE = 0x0111,
64 STUN_SHARED_SECRET_REQUEST = 0x0002, 81 STUN_SHARED_SECRET_REQUEST = 0x0002,
65 STUN_SHARED_SECRET_RESPONSE = 0x0102, 82 STUN_SHARED_SECRET_RESPONSE = 0x0102,
66 STUN_SHARED_SECRET_ERROR_RESPONSE = 0x0112, 83 STUN_SHARED_SECRET_ERROR_RESPONSE = 0x0112,
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 IPC::Sender* message_sender_; 117 IPC::Sender* message_sender_;
101 int id_; 118 int id_;
102 State state_; 119 State state_;
103 120
104 DISALLOW_COPY_AND_ASSIGN(P2PSocketHost); 121 DISALLOW_COPY_AND_ASSIGN(P2PSocketHost);
105 }; 122 };
106 123
107 } // namespace content 124 } // namespace content
108 125
109 #endif // CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_HOST_H_ 126 #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