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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "net/base/net_api.h" | 9 #include "net/base/net_export.h" |
10 | 10 |
11 namespace net { | 11 namespace net { |
12 | 12 |
13 class BoundNetLog; | 13 class BoundNetLog; |
14 class IPEndPoint; | 14 class IPEndPoint; |
15 | 15 |
16 // A datagram socket is an interface to a protocol which exchanges | 16 // A datagram socket is an interface to a protocol which exchanges |
17 // datagrams, like UDP. | 17 // datagrams, like UDP. |
18 class NET_TEST DatagramSocket { | 18 class NET_EXPORT_PRIVATE DatagramSocket { |
19 public: | 19 public: |
20 // Type of source port binding to use. | 20 // Type of source port binding to use. |
21 enum BindType { | 21 enum BindType { |
22 RANDOM_BIND, | 22 RANDOM_BIND, |
23 DEFAULT_BIND, | 23 DEFAULT_BIND, |
24 }; | 24 }; |
25 | 25 |
26 virtual ~DatagramSocket() {} | 26 virtual ~DatagramSocket() {} |
27 | 27 |
28 // Close the socket. | 28 // Close the socket. |
29 virtual void Close() = 0; | 29 virtual void Close() = 0; |
30 | 30 |
31 // Copy the remote udp address into |address| and return a network error code. | 31 // Copy the remote udp address into |address| and return a network error code. |
32 virtual int GetPeerAddress(IPEndPoint* address) const = 0; | 32 virtual int GetPeerAddress(IPEndPoint* address) const = 0; |
33 | 33 |
34 // Copy the local udp address into |address| and return a network error code. | 34 // Copy the local udp address into |address| and return a network error code. |
35 // (similar to getsockname) | 35 // (similar to getsockname) |
36 virtual int GetLocalAddress(IPEndPoint* address) const = 0; | 36 virtual int GetLocalAddress(IPEndPoint* address) const = 0; |
37 | 37 |
38 // Gets the NetLog for this socket. | 38 // Gets the NetLog for this socket. |
39 virtual const BoundNetLog& NetLog() const = 0; | 39 virtual const BoundNetLog& NetLog() const = 0; |
40 }; | 40 }; |
41 | 41 |
42 } // namespace net | 42 } // namespace net |
43 | 43 |
44 #endif // NET_UDP_DATAGRAM_SOCKET_H_ | 44 #endif // NET_UDP_DATAGRAM_SOCKET_H_ |
OLD | NEW |