| 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_sockets.h" | 9 #include "content/common/p2p_sockets.h" |
| 10 | 10 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 STUN_DATA_INDICATION = 0x0115 | 55 STUN_DATA_INDICATION = 0x0115 |
| 56 }; | 56 }; |
| 57 | 57 |
| 58 enum State { | 58 enum State { |
| 59 STATE_UNINITIALIZED, | 59 STATE_UNINITIALIZED, |
| 60 STATE_CONNECTING, | 60 STATE_CONNECTING, |
| 61 STATE_OPEN, | 61 STATE_OPEN, |
| 62 STATE_ERROR, | 62 STATE_ERROR, |
| 63 }; | 63 }; |
| 64 | 64 |
| 65 // Maximum size of send buffers. Must be big enough to fit data for | |
| 66 // one data burst. Send buffers size needs to be limited to prevent | |
| 67 // from consuming too much memory with misbehaving renderer process. | |
| 68 // | |
| 69 // TODO(sergeyu): Consider implementing congestion notifications to | |
| 70 // minimize buffering. This will require some fixes in libjingle, | |
| 71 // see crbug.com/91495 . | |
| 72 static const int kMaxSendBufferSize = 256 * 1024; | |
| 73 | |
| 74 P2PSocketHost(IPC::Sender* message_sender, int id); | 65 P2PSocketHost(IPC::Sender* message_sender, int id); |
| 75 | 66 |
| 76 // Verifies that the packet |data| has a valid STUN header. In case | 67 // Verifies that the packet |data| has a valid STUN header. In case |
| 77 // of success stores type of the message in |type|. | 68 // of success stores type of the message in |type|. |
| 78 static bool GetStunPacketType(const char* data, int data_size, | 69 static bool GetStunPacketType(const char* data, int data_size, |
| 79 StunMessageType* type); | 70 StunMessageType* type); |
| 80 static bool IsRequestOrResponse(StunMessageType type); | 71 static bool IsRequestOrResponse(StunMessageType type); |
| 81 | 72 |
| 82 IPC::Sender* message_sender_; | 73 IPC::Sender* message_sender_; |
| 83 int id_; | 74 int id_; |
| 84 State state_; | 75 State state_; |
| 85 | 76 |
| 86 DISALLOW_COPY_AND_ASSIGN(P2PSocketHost); | 77 DISALLOW_COPY_AND_ASSIGN(P2PSocketHost); |
| 87 }; | 78 }; |
| 88 | 79 |
| 89 } // namespace content | 80 } // namespace content |
| 90 | 81 |
| 91 #endif // CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_HOST_H_ | 82 #endif // CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_HOST_H_ |
| OLD | NEW |