| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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_SOCKET_UDP_SOCKET_POSIX_H_ | 5 #ifndef NET_SOCKET_UDP_SOCKET_POSIX_H_ |
| 6 #define NET_SOCKET_UDP_SOCKET_POSIX_H_ | 6 #define NET_SOCKET_UDP_SOCKET_POSIX_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| 11 | 11 |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
| 14 #include "base/message_loop/message_loop.h" | 14 #include "base/message_loop/message_loop.h" |
| 15 #include "base/threading/non_thread_safe.h" | 15 #include "base/threading/thread_checker.h" |
| 16 #include "net/base/address_family.h" | 16 #include "net/base/address_family.h" |
| 17 #include "net/base/completion_callback.h" | 17 #include "net/base/completion_callback.h" |
| 18 #include "net/base/io_buffer.h" | 18 #include "net/base/io_buffer.h" |
| 19 #include "net/base/ip_endpoint.h" | 19 #include "net/base/ip_endpoint.h" |
| 20 #include "net/base/net_export.h" | 20 #include "net/base/net_export.h" |
| 21 #include "net/base/network_change_notifier.h" | 21 #include "net/base/network_change_notifier.h" |
| 22 #include "net/base/rand_callback.h" | 22 #include "net/base/rand_callback.h" |
| 23 #include "net/log/net_log_with_source.h" | 23 #include "net/log/net_log_with_source.h" |
| 24 #include "net/socket/datagram_socket.h" | 24 #include "net/socket/datagram_socket.h" |
| 25 #include "net/socket/diff_serv_code_point.h" | 25 #include "net/socket/diff_serv_code_point.h" |
| 26 #include "net/socket/socket_descriptor.h" | 26 #include "net/socket/socket_descriptor.h" |
| 27 | 27 |
| 28 namespace net { | 28 namespace net { |
| 29 | 29 |
| 30 class IPAddress; | 30 class IPAddress; |
| 31 class NetLog; | 31 class NetLog; |
| 32 struct NetLogSource; | 32 struct NetLogSource; |
| 33 | 33 |
| 34 class NET_EXPORT UDPSocketPosix : public base::NonThreadSafe { | 34 class NET_EXPORT UDPSocketPosix { |
| 35 public: | 35 public: |
| 36 UDPSocketPosix(DatagramSocket::BindType bind_type, | 36 UDPSocketPosix(DatagramSocket::BindType bind_type, |
| 37 const RandIntCallback& rand_int_cb, | 37 const RandIntCallback& rand_int_cb, |
| 38 net::NetLog* net_log, | 38 net::NetLog* net_log, |
| 39 const net::NetLogSource& source); | 39 const net::NetLogSource& source); |
| 40 virtual ~UDPSocketPosix(); | 40 virtual ~UDPSocketPosix(); |
| 41 | 41 |
| 42 // Opens the socket. | 42 // Opens the socket. |
| 43 // Returns a net error code. | 43 // Returns a net error code. |
| 44 int Open(AddressFamily address_family); | 44 int Open(AddressFamily address_family); |
| (...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 314 CompletionCallback read_callback_; | 314 CompletionCallback read_callback_; |
| 315 | 315 |
| 316 // External callback; called when write is complete. | 316 // External callback; called when write is complete. |
| 317 CompletionCallback write_callback_; | 317 CompletionCallback write_callback_; |
| 318 | 318 |
| 319 NetLogWithSource net_log_; | 319 NetLogWithSource net_log_; |
| 320 | 320 |
| 321 // Network that this socket is bound to via BindToNetwork(). | 321 // Network that this socket is bound to via BindToNetwork(). |
| 322 NetworkChangeNotifier::NetworkHandle bound_network_; | 322 NetworkChangeNotifier::NetworkHandle bound_network_; |
| 323 | 323 |
| 324 THREAD_CHECKER(thread_checker_); |
| 325 |
| 324 DISALLOW_COPY_AND_ASSIGN(UDPSocketPosix); | 326 DISALLOW_COPY_AND_ASSIGN(UDPSocketPosix); |
| 325 }; | 327 }; |
| 326 | 328 |
| 327 } // namespace net | 329 } // namespace net |
| 328 | 330 |
| 329 #endif // NET_SOCKET_UDP_SOCKET_POSIX_H_ | 331 #endif // NET_SOCKET_UDP_SOCKET_POSIX_H_ |
| OLD | NEW |