Home | History | Annotate | Download | only in udp
      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 "net/base/net_log.h"
      9 #include "net/base/rand_callback.h"
     10 #include "net/udp/datagram_client_socket.h"
     11 #include "net/udp/udp_socket.h"
     12 
     13 namespace net {
     14 
     15 class BoundNetLog;
     16 
     17 // A client socket that uses UDP as the transport layer.
     18 class NET_EXPORT_PRIVATE UDPClientSocket : public DatagramClientSocket {
     19  public:
     20   UDPClientSocket(DatagramSocket::BindType bind_type,
     21                   const RandIntCallback& rand_int_cb,
     22                   net::NetLog* net_log,
     23                   const net::NetLog::Source& source);
     24   virtual ~UDPClientSocket();
     25 
     26   // DatagramClientSocket implementation.
     27   virtual int Connect(const IPEndPoint& address) OVERRIDE;
     28   virtual int Read(IOBuffer* buf, int buf_len,
     29                    const CompletionCallback& callback) OVERRIDE;
     30   virtual int Write(IOBuffer* buf, int buf_len,
     31                     const CompletionCallback& callback) OVERRIDE;
     32   virtual void Close() OVERRIDE;
     33   virtual int GetPeerAddress(IPEndPoint* address) const OVERRIDE;
     34   virtual int GetLocalAddress(IPEndPoint* address) const OVERRIDE;
     35   virtual int SetReceiveBufferSize(int32 size) OVERRIDE;
     36   virtual int SetSendBufferSize(int32 size) OVERRIDE;
     37   virtual const BoundNetLog& NetLog() const OVERRIDE;
     38 
     39  private:
     40   UDPSocket socket_;
     41   DISALLOW_COPY_AND_ASSIGN(UDPClientSocket);
     42 };
     43 
     44 }  // namespace net
     45 
     46 #endif  // NET_SOCKET_UDP_CLIENT_SOCKET_H_
     47