OLD | NEW |
| (Empty) |
1 // Copyright (c) 2012 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_SERVER_SOCKET_H_ | |
6 #define NET_SOCKET_UDP_SERVER_SOCKET_H_ | |
7 | |
8 #include <stdint.h> | |
9 | |
10 #include "base/macros.h" | |
11 #include "net/base/completion_callback.h" | |
12 #include "net/base/net_export.h" | |
13 #include "net/udp/datagram_server_socket.h" | |
14 #include "net/udp/udp_socket.h" | |
15 | |
16 namespace net { | |
17 | |
18 class IPAddress; | |
19 class IPEndPoint; | |
20 class NetLog; | |
21 struct NetLogSource; | |
22 | |
23 // A client socket that uses UDP as the transport layer. | |
24 class NET_EXPORT UDPServerSocket : public DatagramServerSocket { | |
25 public: | |
26 UDPServerSocket(net::NetLog* net_log, const net::NetLogSource& source); | |
27 ~UDPServerSocket() override; | |
28 | |
29 // Implement DatagramServerSocket: | |
30 int Listen(const IPEndPoint& address) override; | |
31 int RecvFrom(IOBuffer* buf, | |
32 int buf_len, | |
33 IPEndPoint* address, | |
34 const CompletionCallback& callback) override; | |
35 int SendTo(IOBuffer* buf, | |
36 int buf_len, | |
37 const IPEndPoint& address, | |
38 const CompletionCallback& callback) override; | |
39 int SetReceiveBufferSize(int32_t size) override; | |
40 int SetSendBufferSize(int32_t size) override; | |
41 int SetDoNotFragment() override; | |
42 void Close() override; | |
43 int GetPeerAddress(IPEndPoint* address) const override; | |
44 int GetLocalAddress(IPEndPoint* address) const override; | |
45 void UseNonBlockingIO() override; | |
46 const NetLogWithSource& NetLog() const override; | |
47 void AllowAddressReuse() override; | |
48 void AllowBroadcast() override; | |
49 int JoinGroup(const IPAddress& group_address) const override; | |
50 int LeaveGroup(const IPAddress& group_address) const override; | |
51 int SetMulticastInterface(uint32_t interface_index) override; | |
52 int SetMulticastTimeToLive(int time_to_live) override; | |
53 int SetMulticastLoopbackMode(bool loopback) override; | |
54 int SetDiffServCodePoint(DiffServCodePoint dscp) override; | |
55 void DetachFromThread() override; | |
56 | |
57 private: | |
58 UDPSocket socket_; | |
59 bool allow_address_reuse_; | |
60 bool allow_broadcast_; | |
61 DISALLOW_COPY_AND_ASSIGN(UDPServerSocket); | |
62 }; | |
63 | |
64 } // namespace net | |
65 | |
66 #endif // NET_SOCKET_UDP_SERVER_SOCKET_H_ | |
OLD | NEW |