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