| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef NET_UDP_DATAGRAM_SOCKET_H_ | 5 #ifndef NET_UDP_DATAGRAM_SOCKET_H_ |
| 6 #define NET_UDP_DATAGRAM_SOCKET_H_ | 6 #define NET_UDP_DATAGRAM_SOCKET_H_ |
| 7 | 7 |
| 8 #include "net/base/net_export.h" | 8 #include "net/base/net_export.h" |
| 9 | 9 |
| 10 namespace net { | 10 namespace net { |
| 11 | 11 |
| 12 class BoundNetLog; | 12 class BoundNetLog; |
| 13 class IPEndPoint; | 13 class IPEndPoint; |
| 14 | 14 |
| 15 // A datagram socket is an interface to a protocol which exchanges | 15 // A datagram socket is an interface to a protocol which exchanges |
| 16 // datagrams, like UDP. | 16 // datagrams, like UDP. |
| 17 class NET_EXPORT_PRIVATE DatagramSocket { | 17 class NET_EXPORT_PRIVATE DatagramSocket { |
| 18 public: | 18 public: |
| 19 // Type of source port binding to use. | 19 // Type of source port binding to use. |
| 20 enum BindType { | 20 enum BindType { |
| 21 RANDOM_BIND, | 21 RANDOM_BIND, |
| 22 DEFAULT_BIND, | 22 DEFAULT_BIND, |
| 23 }; | 23 }; |
| 24 | 24 |
| 25 virtual ~DatagramSocket() {} | 25 virtual ~DatagramSocket() {} |
| 26 | 26 |
| 27 // Close the socket. | 27 // Close the socket. |
| 28 virtual void Close() = 0; | 28 virtual int Close() = 0; |
| 29 | 29 |
| 30 // Copy the remote udp address into |address| and return a network error code. | 30 // Copy the remote udp address into |address| and return a network error code. |
| 31 virtual int GetPeerAddress(IPEndPoint* address) const = 0; | 31 virtual int GetPeerAddress(IPEndPoint* address) const = 0; |
| 32 | 32 |
| 33 // Copy the local udp address into |address| and return a network error code. | 33 // Copy the local udp address into |address| and return a network error code. |
| 34 // (similar to getsockname) | 34 // (similar to getsockname) |
| 35 virtual int GetLocalAddress(IPEndPoint* address) const = 0; | 35 virtual int GetLocalAddress(IPEndPoint* address) const = 0; |
| 36 | 36 |
| 37 // Gets the NetLog for this socket. | 37 // Gets the NetLog for this socket. |
| 38 virtual const BoundNetLog& NetLog() const = 0; | 38 virtual const BoundNetLog& NetLog() const = 0; |
| 39 }; | 39 }; |
| 40 | 40 |
| 41 } // namespace net | 41 } // namespace net |
| 42 | 42 |
| 43 #endif // NET_UDP_DATAGRAM_SOCKET_H_ | 43 #endif // NET_UDP_DATAGRAM_SOCKET_H_ |
| OLD | NEW |