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/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" |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 const std::vector<char>& data, | 46 const std::vector<char>& data, |
47 const talk_base::PacketOptions& options, | 47 const talk_base::PacketOptions& options, |
48 uint64 packet_id) = 0; | 48 uint64 packet_id) = 0; |
49 | 49 |
50 virtual P2PSocketHost* AcceptIncomingTcpConnection( | 50 virtual P2PSocketHost* AcceptIncomingTcpConnection( |
51 const net::IPEndPoint& remote_address, int id) = 0; | 51 const net::IPEndPoint& remote_address, int id) = 0; |
52 | 52 |
53 virtual bool SetOption(P2PSocketOption option, int value) = 0; | 53 virtual bool SetOption(P2PSocketOption option, int value) = 0; |
54 | 54 |
55 protected: | 55 protected: |
56 friend class P2PSocketHostTcpTestBase; | 56 |
| 57 void MaybeUpdatePacketSendTimeExtn(char* data, int length, |
| 58 const talk_base::PacketOptions& options); |
57 | 59 |
58 // TODO(mallinath) - Remove this below enum and use one defined in | 60 // TODO(mallinath) - Remove this below enum and use one defined in |
59 // libjingle/souce/talk/p2p/base/stun.h | 61 // libjingle/souce/talk/p2p/base/stun.h |
60 enum StunMessageType { | 62 enum StunMessageType { |
61 STUN_BINDING_REQUEST = 0x0001, | 63 STUN_BINDING_REQUEST = 0x0001, |
62 STUN_BINDING_RESPONSE = 0x0101, | 64 STUN_BINDING_RESPONSE = 0x0101, |
63 STUN_BINDING_ERROR_RESPONSE = 0x0111, | 65 STUN_BINDING_ERROR_RESPONSE = 0x0111, |
64 STUN_SHARED_SECRET_REQUEST = 0x0002, | 66 STUN_SHARED_SECRET_REQUEST = 0x0002, |
65 STUN_SHARED_SECRET_RESPONSE = 0x0102, | 67 STUN_SHARED_SECRET_RESPONSE = 0x0102, |
66 STUN_SHARED_SECRET_ERROR_RESPONSE = 0x0112, | 68 STUN_SHARED_SECRET_ERROR_RESPONSE = 0x0112, |
(...skipping 23 matching lines...) Expand all Loading... |
90 }; | 92 }; |
91 | 93 |
92 P2PSocketHost(IPC::Sender* message_sender, int id); | 94 P2PSocketHost(IPC::Sender* message_sender, int id); |
93 | 95 |
94 // Verifies that the packet |data| has a valid STUN header. In case | 96 // Verifies that the packet |data| has a valid STUN header. In case |
95 // of success stores type of the message in |type|. | 97 // of success stores type of the message in |type|. |
96 static bool GetStunPacketType(const char* data, int data_size, | 98 static bool GetStunPacketType(const char* data, int data_size, |
97 StunMessageType* type); | 99 StunMessageType* type); |
98 static bool IsRequestOrResponse(StunMessageType type); | 100 static bool IsRequestOrResponse(StunMessageType type); |
99 | 101 |
| 102 bool MaybeUpdateRtpSendTimeExtn(char* rtp, int length, |
| 103 int extension_id); |
| 104 bool GetRtpPacketStartPositionAndLength(char* data, int length, |
| 105 int* rtp_start_pos, |
| 106 int* rtp_packet_length); |
| 107 void UpdateSendTimeExtnValue(char* data, int len); |
| 108 |
| 109 void MaybeUpdateRtpAuthTag(char* packet, int len, |
| 110 const talk_base::PacketOptions& options); |
| 111 |
100 IPC::Sender* message_sender_; | 112 IPC::Sender* message_sender_; |
101 int id_; | 113 int id_; |
102 State state_; | 114 State state_; |
103 | 115 |
104 DISALLOW_COPY_AND_ASSIGN(P2PSocketHost); | 116 DISALLOW_COPY_AND_ASSIGN(P2PSocketHost); |
105 }; | 117 }; |
106 | 118 |
107 } // namespace content | 119 } // namespace content |
108 | 120 |
109 #endif // CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_HOST_H_ | 121 #endif // CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_HOST_H_ |
OLD | NEW |