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_UDP_DATAGRAM_SOCKET_H_
      6 #define NET_UDP_DATAGRAM_SOCKET_H_
      7 #pragma once
      8 
      9 namespace net {
     10 
     11 class IPEndPoint;
     12 
     13 // A datagram socket is an interface to a protocol which exchanges
     14 // datagrams, like UDP.
     15 class DatagramSocket {
     16  public:
     17   virtual ~DatagramSocket() {}
     18 
     19   // Close the socket.
     20   virtual void Close() = 0;
     21 
     22   // Copy the remote udp address into |address| and return a network error code.
     23   virtual int GetPeerAddress(IPEndPoint* address) const = 0;
     24 
     25   // Copy the local udp address into |address| and return a network error code.
     26   // (similar to getsockname)
     27   virtual int GetLocalAddress(IPEndPoint* address) const = 0;
     28 };
     29 
     30 }  // namespace net
     31 
     32 #endif  // NET_UDP_DATAGRAM_SOCKET_H_
     33