| 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 "net/base/completion_callback.h" | |
| 9 #include "net/base/net_util.h" | |
| 10 #include "net/udp/datagram_server_socket.h" | |
| 11 #include "net/udp/udp_socket.h" | |
| 12 | |
| 13 namespace net { | |
| 14 | |
| 15 class IPEndPoint; | |
| 16 class BoundNetLog; | |
| 17 | |
| 18 // A client socket that uses UDP as the transport layer. | |
| 19 class NET_EXPORT UDPServerSocket : public DatagramServerSocket { | |
| 20 public: | |
| 21 UDPServerSocket(net::NetLog* net_log, const net::NetLog::Source& source); | |
| 22 ~UDPServerSocket() override; | |
| 23 | |
| 24 // Implement DatagramServerSocket: | |
| 25 int Listen(const IPEndPoint& address) override; | |
| 26 int RecvFrom(IOBuffer* buf, | |
| 27 int buf_len, | |
| 28 IPEndPoint* address, | |
| 29 const CompletionCallback& callback) override; | |
| 30 int SendTo(IOBuffer* buf, | |
| 31 int buf_len, | |
| 32 const IPEndPoint& address, | |
| 33 const CompletionCallback& callback) override; | |
| 34 int SetReceiveBufferSize(int32 size) override; | |
| 35 int SetSendBufferSize(int32 size) override; | |
| 36 void Close() override; | |
| 37 int GetPeerAddress(IPEndPoint* address) const override; | |
| 38 int GetLocalAddress(IPEndPoint* address) const override; | |
| 39 const BoundNetLog& NetLog() const override; | |
| 40 void AllowAddressReuse() override; | |
| 41 void AllowBroadcast() override; | |
| 42 int JoinGroup(const IPAddressNumber& group_address) const override; | |
| 43 int LeaveGroup(const IPAddressNumber& group_address) const override; | |
| 44 int SetMulticastInterface(uint32 interface_index) override; | |
| 45 int SetMulticastTimeToLive(int time_to_live) override; | |
| 46 int SetMulticastLoopbackMode(bool loopback) override; | |
| 47 int SetDiffServCodePoint(DiffServCodePoint dscp) override; | |
| 48 void DetachFromThread() override; | |
| 49 | |
| 50 #if defined(OS_WIN) | |
| 51 // Switch to use non-blocking IO. Must be called right after construction and | |
| 52 // before other calls. | |
| 53 void UseNonBlockingIO(); | |
| 54 #endif | |
| 55 | |
| 56 private: | |
| 57 UDPSocket socket_; | |
| 58 bool allow_address_reuse_; | |
| 59 bool allow_broadcast_; | |
| 60 DISALLOW_COPY_AND_ASSIGN(UDPServerSocket); | |
| 61 }; | |
| 62 | |
| 63 } // namespace net | |
| 64 | |
| 65 #endif // NET_SOCKET_UDP_SERVER_SOCKET_H_ | |
| OLD | NEW |