| 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_RENDERER_P2P_SOCKET_CLIENT_H_ | 5 #ifndef CONTENT_RENDERER_P2P_SOCKET_CLIENT_H_ |
| 6 #define CONTENT_RENDERER_P2P_SOCKET_CLIENT_H_ | 6 #define CONTENT_RENDERER_P2P_SOCKET_CLIENT_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 // specified |address|. |address| matters only when |type| is set to | 48 // specified |address|. |address| matters only when |type| is set to |
| 49 // P2P_SOCKET_TCP_CLIENT. | 49 // P2P_SOCKET_TCP_CLIENT. |
| 50 void Init(P2PSocketType type, | 50 void Init(P2PSocketType type, |
| 51 const net::IPEndPoint& local_address, | 51 const net::IPEndPoint& local_address, |
| 52 const net::IPEndPoint& remote_address, | 52 const net::IPEndPoint& remote_address, |
| 53 Delegate* delegate); | 53 Delegate* delegate); |
| 54 | 54 |
| 55 // Send the |data| to the |address|. | 55 // Send the |data| to the |address|. |
| 56 void Send(const net::IPEndPoint& address, const std::vector<char>& data); | 56 void Send(const net::IPEndPoint& address, const std::vector<char>& data); |
| 57 | 57 |
| 58 // Send the |data| to the |address| using Differentiated Services Code Point |
| 59 // |dscp|. |
| 60 void SendWithDscp(const net::IPEndPoint& address, |
| 61 const std::vector<char>& data, |
| 62 net::DiffServCodePoint dscp); |
| 63 |
| 58 // Must be called before the socket is destroyed. The delegate may | 64 // Must be called before the socket is destroyed. The delegate may |
| 59 // not be called after |closed_task| is executed. | 65 // not be called after |closed_task| is executed. |
| 60 void Close(); | 66 void Close(); |
| 61 | 67 |
| 62 int socket_id() const { return socket_id_; } | 68 int socket_id() const { return socket_id_; } |
| 63 | 69 |
| 64 void set_delegate(Delegate* delegate); | 70 void set_delegate(Delegate* delegate); |
| 65 | 71 |
| 66 private: | 72 private: |
| 67 enum State { | 73 enum State { |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 // These two fields are used to identify packets for tracing. | 125 // These two fields are used to identify packets for tracing. |
| 120 uint32 random_socket_id_; | 126 uint32 random_socket_id_; |
| 121 uint32 next_packet_id_; | 127 uint32 next_packet_id_; |
| 122 | 128 |
| 123 DISALLOW_COPY_AND_ASSIGN(P2PSocketClient); | 129 DISALLOW_COPY_AND_ASSIGN(P2PSocketClient); |
| 124 }; | 130 }; |
| 125 | 131 |
| 126 } // namespace content | 132 } // namespace content |
| 127 | 133 |
| 128 #endif // CONTENT_RENDERER_P2P_SOCKET_CLIENT_H_ | 134 #endif // CONTENT_RENDERER_P2P_SOCKET_CLIENT_H_ |
| OLD | NEW |