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 NET_SOCKET_UDP_CLIENT_SOCKET_H_ | 5 #ifndef NET_SOCKET_UDP_CLIENT_SOCKET_H_ |
6 #define NET_SOCKET_UDP_CLIENT_SOCKET_H_ | 6 #define NET_SOCKET_UDP_CLIENT_SOCKET_H_ |
7 | 7 |
8 #include "net/base/rand_callback.h" | 8 #include "net/base/rand_callback.h" |
9 #include "net/log/net_log.h" | 9 #include "net/log/net_log.h" |
10 #include "net/udp/datagram_client_socket.h" | 10 #include "net/udp/datagram_client_socket.h" |
11 #include "net/udp/udp_socket.h" | 11 #include "net/udp/udp_socket.h" |
12 | 12 |
13 namespace net { | 13 namespace net { |
14 | 14 |
15 class BoundNetLog; | 15 class BoundNetLog; |
16 | 16 |
17 // A client socket that uses UDP as the transport layer. | 17 // A client socket that uses UDP as the transport layer. |
18 class NET_EXPORT_PRIVATE UDPClientSocket : public DatagramClientSocket { | 18 class NET_EXPORT_PRIVATE UDPClientSocket : public DatagramClientSocket { |
19 public: | 19 public: |
20 UDPClientSocket(DatagramSocket::BindType bind_type, | 20 UDPClientSocket(DatagramSocket::BindType bind_type, |
21 const RandIntCallback& rand_int_cb, | 21 const RandIntCallback& rand_int_cb, |
22 net::NetLog* net_log, | 22 net::NetLog* net_log, |
23 const net::NetLog::Source& source); | 23 const net::NetLog::Source& source); |
24 ~UDPClientSocket() override; | 24 ~UDPClientSocket() override; |
25 | 25 |
26 // DatagramClientSocket implementation. | 26 // DatagramClientSocket implementation. |
27 int BindToNetwork(NetworkChangeNotifier::NetworkHandle network) override; | 27 int BindToNetwork(NetworkChangeNotifier::NetworkHandle network) override; |
| 28 int BindToDefaultNetwork() override; |
| 29 NetworkChangeNotifier::NetworkHandle GetBoundNetwork() override; |
28 int Connect(const IPEndPoint& address) override; | 30 int Connect(const IPEndPoint& address) override; |
29 int Read(IOBuffer* buf, | 31 int Read(IOBuffer* buf, |
30 int buf_len, | 32 int buf_len, |
31 const CompletionCallback& callback) override; | 33 const CompletionCallback& callback) override; |
32 int Write(IOBuffer* buf, | 34 int Write(IOBuffer* buf, |
33 int buf_len, | 35 int buf_len, |
34 const CompletionCallback& callback) override; | 36 const CompletionCallback& callback) override; |
35 void Close() override; | 37 void Close() override; |
36 int GetPeerAddress(IPEndPoint* address) const override; | 38 int GetPeerAddress(IPEndPoint* address) const override; |
37 int GetLocalAddress(IPEndPoint* address) const override; | 39 int GetLocalAddress(IPEndPoint* address) const override; |
38 int SetReceiveBufferSize(int32 size) override; | 40 int SetReceiveBufferSize(int32 size) override; |
39 int SetSendBufferSize(int32 size) override; | 41 int SetSendBufferSize(int32 size) override; |
40 const BoundNetLog& NetLog() const override; | 42 const BoundNetLog& NetLog() const override; |
41 | 43 |
42 #if defined(OS_WIN) | 44 #if defined(OS_WIN) |
43 // Switch to use non-blocking IO. Must be called right after construction and | 45 // Switch to use non-blocking IO. Must be called right after construction and |
44 // before other calls. | 46 // before other calls. |
45 void UseNonBlockingIO(); | 47 void UseNonBlockingIO(); |
46 #endif | 48 #endif |
47 | 49 |
48 private: | 50 private: |
49 UDPSocket socket_; | 51 UDPSocket socket_; |
| 52 NetworkChangeNotifier::NetworkHandle network_; |
50 DISALLOW_COPY_AND_ASSIGN(UDPClientSocket); | 53 DISALLOW_COPY_AND_ASSIGN(UDPClientSocket); |
51 }; | 54 }; |
52 | 55 |
53 } // namespace net | 56 } // namespace net |
54 | 57 |
55 #endif // NET_SOCKET_UDP_CLIENT_SOCKET_H_ | 58 #endif // NET_SOCKET_UDP_CLIENT_SOCKET_H_ |
OLD | NEW |