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 <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include "net/base/rand_callback.h" | 10 #include "net/base/rand_callback.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 public: | 21 public: |
22 UDPClientSocket(DatagramSocket::BindType bind_type, | 22 UDPClientSocket(DatagramSocket::BindType bind_type, |
23 const RandIntCallback& rand_int_cb, | 23 const RandIntCallback& rand_int_cb, |
24 net::NetLog* net_log, | 24 net::NetLog* net_log, |
25 const net::NetLog::Source& source); | 25 const net::NetLog::Source& source); |
26 ~UDPClientSocket() override; | 26 ~UDPClientSocket() override; |
27 | 27 |
28 // DatagramClientSocket implementation. | 28 // DatagramClientSocket implementation. |
29 int BindToNetwork(NetworkChangeNotifier::NetworkHandle network) override; | 29 int BindToNetwork(NetworkChangeNotifier::NetworkHandle network) override; |
30 int BindToDefaultNetwork() override; | 30 int BindToDefaultNetwork() override; |
31 NetworkChangeNotifier::NetworkHandle GetBoundNetwork() override; | 31 NetworkChangeNotifier::NetworkHandle GetBoundNetwork() const override; |
32 int Connect(const IPEndPoint& address) override; | 32 int Connect(const IPEndPoint& address) override; |
33 int Read(IOBuffer* buf, | 33 int Read(IOBuffer* buf, |
34 int buf_len, | 34 int buf_len, |
35 const CompletionCallback& callback) override; | 35 const CompletionCallback& callback) override; |
36 int Write(IOBuffer* buf, | 36 int Write(IOBuffer* buf, |
37 int buf_len, | 37 int buf_len, |
38 const CompletionCallback& callback) override; | 38 const CompletionCallback& callback) override; |
39 void Close() override; | 39 void Close() override; |
40 int GetPeerAddress(IPEndPoint* address) const override; | 40 int GetPeerAddress(IPEndPoint* address) const override; |
41 int GetLocalAddress(IPEndPoint* address) const override; | 41 int GetLocalAddress(IPEndPoint* address) const override; |
42 int SetReceiveBufferSize(int32_t size) override; | 42 int SetReceiveBufferSize(int32_t size) override; |
43 int SetSendBufferSize(int32_t size) override; | 43 int SetSendBufferSize(int32_t size) override; |
44 const BoundNetLog& NetLog() const override; | 44 const BoundNetLog& NetLog() const override; |
45 | 45 |
46 #if defined(OS_WIN) | 46 #if defined(OS_WIN) |
47 // Switch to use non-blocking IO. Must be called right after construction and | 47 // Switch to use non-blocking IO. Must be called right after construction and |
48 // before other calls. | 48 // before other calls. |
49 void UseNonBlockingIO(); | 49 void UseNonBlockingIO(); |
50 #endif | 50 #endif |
51 | 51 |
52 private: | 52 private: |
53 UDPSocket socket_; | 53 UDPSocket socket_; |
54 NetworkChangeNotifier::NetworkHandle network_; | 54 NetworkChangeNotifier::NetworkHandle network_; |
55 DISALLOW_COPY_AND_ASSIGN(UDPClientSocket); | 55 DISALLOW_COPY_AND_ASSIGN(UDPClientSocket); |
56 }; | 56 }; |
57 | 57 |
58 } // namespace net | 58 } // namespace net |
59 | 59 |
60 #endif // NET_SOCKET_UDP_CLIENT_SOCKET_H_ | 60 #endif // NET_SOCKET_UDP_CLIENT_SOCKET_H_ |
OLD | NEW |