| 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 "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 // If abs_send_time is 0, ApplyPacketOption will get current time from system. | |
| 34 CONTENT_EXPORT bool ApplyPacketOptions(char* data, int length, | |
| 35 const talk_base::PacketOptions& options, | |
| 36 uint32 abs_send_time); | |
| 37 | |
| 38 // Helper method which finds RTP ofset and length if the packet is encapsulated | |
| 39 // in a TURN Channel Message or TURN Send Indication message. | |
| 40 CONTENT_EXPORT bool GetRtpPacketStartPositionAndLength(char* data, int length, | |
| 41 int* rtp_start_pos, | |
| 42 int* rtp_packet_length); | |
| 43 // Helper method which updates absoulute send time extension if present. | |
| 44 CONTENT_EXPORT bool UpdateRtpAbsSendTimeExtn(char* rtp, int length, | |
| 45 int extension_id, | |
| 46 uint32 abs_send_time); | |
| 47 | |
| 48 } // packet_processing_helpers | |
| 49 | |
| 50 // Base class for P2P sockets. | 28 // Base class for P2P sockets. |
| 51 class CONTENT_EXPORT P2PSocketHost { | 29 class CONTENT_EXPORT P2PSocketHost { |
| 52 public: | 30 public: |
| 53 static const int kStunHeaderSize = 20; | 31 static const int kStunHeaderSize = 20; |
| 54 // Creates P2PSocketHost of the specific type. | 32 // Creates P2PSocketHost of the specific type. |
| 55 static P2PSocketHost* Create(IPC::Sender* message_sender, | 33 static P2PSocketHost* Create(IPC::Sender* message_sender, |
| 56 int id, P2PSocketType type, | 34 int id, P2PSocketType type, |
| 57 net::URLRequestContextGetter* url_context, | 35 net::URLRequestContextGetter* url_context, |
| 58 P2PMessageThrottler* throttler); | 36 P2PMessageThrottler* throttler); |
| 59 | 37 |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 IPC::Sender* message_sender_; | 100 IPC::Sender* message_sender_; |
| 123 int id_; | 101 int id_; |
| 124 State state_; | 102 State state_; |
| 125 | 103 |
| 126 DISALLOW_COPY_AND_ASSIGN(P2PSocketHost); | 104 DISALLOW_COPY_AND_ASSIGN(P2PSocketHost); |
| 127 }; | 105 }; |
| 128 | 106 |
| 129 } // namespace content | 107 } // namespace content |
| 130 | 108 |
| 131 #endif // CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_HOST_H_ | 109 #endif // CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_HOST_H_ |
| OLD | NEW |