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_UDP_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_HOST_UDP_H_ |
6 #define CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_HOST_UDP_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_HOST_UDP_H_ |
7 | 7 |
8 #include <deque> | 8 #include <deque> |
9 #include <set> | 9 #include <set> |
10 #include <vector> | 10 #include <vector> |
(...skipping 30 matching lines...) Expand all Loading... |
41 | 41 |
42 struct PendingPacket { | 42 struct PendingPacket { |
43 PendingPacket(const net::IPEndPoint& to, const std::vector<char>& content); | 43 PendingPacket(const net::IPEndPoint& to, const std::vector<char>& content); |
44 ~PendingPacket(); | 44 ~PendingPacket(); |
45 net::IPEndPoint to; | 45 net::IPEndPoint to; |
46 scoped_refptr<net::IOBuffer> data; | 46 scoped_refptr<net::IOBuffer> data; |
47 int size; | 47 int size; |
48 }; | 48 }; |
49 | 49 |
50 void OnError(); | 50 void OnError(); |
| 51 |
51 void DoRead(); | 52 void DoRead(); |
52 void DoSend(const PendingPacket& packet); | 53 void DoSend(const PendingPacket& packet); |
53 void DidCompleteRead(int result); | 54 void DidCompleteRead(int result); |
| 55 void DidCompleteSend(int result); |
54 | 56 |
55 // Callbacks for RecvFrom() and SendTo(). | 57 // Callbacks for RecvFrom() and SendTo(). |
56 void OnRecv(int result); | 58 void OnRecv(int result); |
57 void OnSend(int result); | 59 void OnSend(int result); |
58 | 60 |
59 scoped_ptr<net::DatagramServerSocket> socket_; | 61 scoped_ptr<net::DatagramServerSocket> socket_; |
60 scoped_refptr<net::IOBuffer> recv_buffer_; | 62 scoped_refptr<net::IOBuffer> recv_buffer_; |
61 net::IPEndPoint recv_address_; | 63 net::IPEndPoint recv_address_; |
62 | 64 |
63 std::deque<PendingPacket> send_queue_; | 65 std::deque<PendingPacket> send_queue_; |
64 int send_queue_bytes_; | |
65 bool send_pending_; | 66 bool send_pending_; |
66 | 67 |
67 // Set of peer for which we have received STUN binding request or | 68 // Set of peer for which we have received STUN binding request or |
68 // response or relay allocation request or response. | 69 // response or relay allocation request or response. |
69 ConnectedPeerSet connected_peers_; | 70 ConnectedPeerSet connected_peers_; |
70 | 71 |
71 DISALLOW_COPY_AND_ASSIGN(P2PSocketHostUdp); | 72 DISALLOW_COPY_AND_ASSIGN(P2PSocketHostUdp); |
72 }; | 73 }; |
73 | 74 |
74 } // namespace content | 75 } // namespace content |
75 | 76 |
76 #endif // CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_HOST_UDP_H_ | 77 #endif // CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_HOST_UDP_H_ |
OLD | NEW |