| OLD | NEW |
| 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 "base/memory/weak_ptr.h" | 8 #include "base/memory/weak_ptr.h" |
| 9 #include "content/common/content_export.h" | 9 #include "content/common/content_export.h" |
| 10 #include "content/common/p2p_socket_type.h" | 10 #include "content/common/p2p_socket_type.h" |
| 11 #include "content/public/browser/render_process_host.h" | 11 #include "content/public/browser/render_process_host.h" |
| 12 #include "net/base/ip_endpoint.h" | 12 #include "net/base/ip_endpoint.h" |
| 13 #include "net/udp/datagram_socket.h" | 13 #include "net/udp/datagram_socket.h" |
| 14 | 14 |
| 15 namespace IPC { | 15 namespace IPC { |
| 16 class Sender; | 16 class Sender; |
| 17 } | 17 } |
| 18 | 18 |
| 19 namespace net { | 19 namespace net { |
| 20 class URLRequestContextGetter; | 20 class URLRequestContextGetter; |
| 21 } | 21 } |
| 22 | 22 |
| 23 namespace talk_base { | 23 namespace rtc { |
| 24 struct PacketOptions; | 24 struct PacketOptions; |
| 25 } | 25 } |
| 26 | 26 |
| 27 namespace content { | 27 namespace content { |
| 28 class P2PMessageThrottler; | 28 class P2PMessageThrottler; |
| 29 | 29 |
| 30 namespace packet_processing_helpers { | 30 namespace packet_processing_helpers { |
| 31 | 31 |
| 32 // This method can handle only RTP packet, otherwise this method must not be | 32 // This method can handle only RTP packet, otherwise this method must not be |
| 33 // called. It will try to do, 1. update absolute send time extension header | 33 // called. It will try to do, 1. update absolute send time extension header |
| 34 // if present with current time and 2. update HMAC in RTP packet. | 34 // if present with current time and 2. update HMAC in RTP packet. |
| 35 // If abs_send_time is 0, ApplyPacketOption will get current time from system. | 35 // If abs_send_time is 0, ApplyPacketOption will get current time from system. |
| 36 CONTENT_EXPORT bool ApplyPacketOptions(char* data, int length, | 36 CONTENT_EXPORT bool ApplyPacketOptions(char* data, int length, |
| 37 const talk_base::PacketOptions& options, | 37 const rtc::PacketOptions& options, |
| 38 uint32 abs_send_time); | 38 uint32 abs_send_time); |
| 39 | 39 |
| 40 // Helper method which finds RTP ofset and length if the packet is encapsulated | 40 // Helper method which finds RTP ofset and length if the packet is encapsulated |
| 41 // in a TURN Channel Message or TURN Send Indication message. | 41 // in a TURN Channel Message or TURN Send Indication message. |
| 42 CONTENT_EXPORT bool GetRtpPacketStartPositionAndLength(const char* data, | 42 CONTENT_EXPORT bool GetRtpPacketStartPositionAndLength(const char* data, |
| 43 int length, | 43 int length, |
| 44 int* rtp_start_pos, | 44 int* rtp_start_pos, |
| 45 int* rtp_packet_length); | 45 int* rtp_packet_length); |
| 46 // Helper method which updates absoulute send time extension if present. | 46 // Helper method which updates absoulute send time extension if present. |
| 47 CONTENT_EXPORT bool UpdateRtpAbsSendTimeExtn(char* rtp, int length, | 47 CONTENT_EXPORT bool UpdateRtpAbsSendTimeExtn(char* rtp, int length, |
| (...skipping 15 matching lines...) Expand all Loading... |
| 63 | 63 |
| 64 virtual ~P2PSocketHost(); | 64 virtual ~P2PSocketHost(); |
| 65 | 65 |
| 66 // Initalizes the socket. Returns false when initiazations fails. | 66 // Initalizes the socket. Returns false when initiazations fails. |
| 67 virtual bool Init(const net::IPEndPoint& local_address, | 67 virtual bool Init(const net::IPEndPoint& local_address, |
| 68 const P2PHostAndIPEndPoint& remote_address) = 0; | 68 const P2PHostAndIPEndPoint& remote_address) = 0; |
| 69 | 69 |
| 70 // Sends |data| on the socket to |to|. | 70 // Sends |data| on the socket to |to|. |
| 71 virtual void Send(const net::IPEndPoint& to, | 71 virtual void Send(const net::IPEndPoint& to, |
| 72 const std::vector<char>& data, | 72 const std::vector<char>& data, |
| 73 const talk_base::PacketOptions& options, | 73 const rtc::PacketOptions& options, |
| 74 uint64 packet_id) = 0; | 74 uint64 packet_id) = 0; |
| 75 | 75 |
| 76 virtual P2PSocketHost* AcceptIncomingTcpConnection( | 76 virtual P2PSocketHost* AcceptIncomingTcpConnection( |
| 77 const net::IPEndPoint& remote_address, int id) = 0; | 77 const net::IPEndPoint& remote_address, int id) = 0; |
| 78 | 78 |
| 79 virtual bool SetOption(P2PSocketOption option, int value) = 0; | 79 virtual bool SetOption(P2PSocketOption option, int value) = 0; |
| 80 | 80 |
| 81 void StartRtpDump( | 81 void StartRtpDump( |
| 82 bool incoming, | 82 bool incoming, |
| 83 bool outgoing, | 83 bool outgoing, |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 RenderProcessHost::WebRtcRtpPacketCallback packet_dump_callback_; | 146 RenderProcessHost::WebRtcRtpPacketCallback packet_dump_callback_; |
| 147 | 147 |
| 148 base::WeakPtrFactory<P2PSocketHost> weak_ptr_factory_; | 148 base::WeakPtrFactory<P2PSocketHost> weak_ptr_factory_; |
| 149 | 149 |
| 150 DISALLOW_COPY_AND_ASSIGN(P2PSocketHost); | 150 DISALLOW_COPY_AND_ASSIGN(P2PSocketHost); |
| 151 }; | 151 }; |
| 152 | 152 |
| 153 } // namespace content | 153 } // namespace content |
| 154 | 154 |
| 155 #endif // CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_HOST_H_ | 155 #endif // CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_HOST_H_ |
| OLD | NEW |