| 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_UDP_UDP_SOCKET_POSIX_H_ | 5 #ifndef NET_UDP_UDP_SOCKET_POSIX_H_ |
| 6 #define NET_UDP_UDP_SOCKET_POSIX_H_ | 6 #define NET_UDP_UDP_SOCKET_POSIX_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> |
| 11 |
| 10 #include "base/macros.h" | 12 #include "base/macros.h" |
| 11 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
| 12 #include "base/memory/scoped_ptr.h" | |
| 13 #include "base/message_loop/message_loop.h" | 14 #include "base/message_loop/message_loop.h" |
| 14 #include "base/threading/non_thread_safe.h" | 15 #include "base/threading/non_thread_safe.h" |
| 15 #include "net/base/address_family.h" | 16 #include "net/base/address_family.h" |
| 16 #include "net/base/completion_callback.h" | 17 #include "net/base/completion_callback.h" |
| 17 #include "net/base/io_buffer.h" | 18 #include "net/base/io_buffer.h" |
| 18 #include "net/base/ip_endpoint.h" | 19 #include "net/base/ip_endpoint.h" |
| 19 #include "net/base/net_export.h" | 20 #include "net/base/net_export.h" |
| 20 #include "net/base/network_change_notifier.h" | 21 #include "net/base/network_change_notifier.h" |
| 21 #include "net/base/rand_callback.h" | 22 #include "net/base/rand_callback.h" |
| 22 #include "net/log/net_log.h" | 23 #include "net/log/net_log.h" |
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 | 274 |
| 274 // How to do source port binding, used only when UDPSocket is part of | 275 // How to do source port binding, used only when UDPSocket is part of |
| 275 // UDPClientSocket, since UDPServerSocket provides Bind. | 276 // UDPClientSocket, since UDPServerSocket provides Bind. |
| 276 DatagramSocket::BindType bind_type_; | 277 DatagramSocket::BindType bind_type_; |
| 277 | 278 |
| 278 // PRNG function for generating port numbers. | 279 // PRNG function for generating port numbers. |
| 279 RandIntCallback rand_int_cb_; | 280 RandIntCallback rand_int_cb_; |
| 280 | 281 |
| 281 // These are mutable since they're just cached copies to make | 282 // These are mutable since they're just cached copies to make |
| 282 // GetPeerAddress/GetLocalAddress smarter. | 283 // GetPeerAddress/GetLocalAddress smarter. |
| 283 mutable scoped_ptr<IPEndPoint> local_address_; | 284 mutable std::unique_ptr<IPEndPoint> local_address_; |
| 284 mutable scoped_ptr<IPEndPoint> remote_address_; | 285 mutable std::unique_ptr<IPEndPoint> remote_address_; |
| 285 | 286 |
| 286 // The socket's posix wrappers | 287 // The socket's posix wrappers |
| 287 base::MessageLoopForIO::FileDescriptorWatcher read_socket_watcher_; | 288 base::MessageLoopForIO::FileDescriptorWatcher read_socket_watcher_; |
| 288 base::MessageLoopForIO::FileDescriptorWatcher write_socket_watcher_; | 289 base::MessageLoopForIO::FileDescriptorWatcher write_socket_watcher_; |
| 289 | 290 |
| 290 // The corresponding watchers for reads and writes. | 291 // The corresponding watchers for reads and writes. |
| 291 ReadWatcher read_watcher_; | 292 ReadWatcher read_watcher_; |
| 292 WriteWatcher write_watcher_; | 293 WriteWatcher write_watcher_; |
| 293 | 294 |
| 294 // The buffer used by InternalRead() to retry Read requests | 295 // The buffer used by InternalRead() to retry Read requests |
| 295 scoped_refptr<IOBuffer> read_buf_; | 296 scoped_refptr<IOBuffer> read_buf_; |
| 296 int read_buf_len_; | 297 int read_buf_len_; |
| 297 IPEndPoint* recv_from_address_; | 298 IPEndPoint* recv_from_address_; |
| 298 | 299 |
| 299 // The buffer used by InternalWrite() to retry Write requests | 300 // The buffer used by InternalWrite() to retry Write requests |
| 300 scoped_refptr<IOBuffer> write_buf_; | 301 scoped_refptr<IOBuffer> write_buf_; |
| 301 int write_buf_len_; | 302 int write_buf_len_; |
| 302 scoped_ptr<IPEndPoint> send_to_address_; | 303 std::unique_ptr<IPEndPoint> send_to_address_; |
| 303 | 304 |
| 304 // External callback; called when read is complete. | 305 // External callback; called when read is complete. |
| 305 CompletionCallback read_callback_; | 306 CompletionCallback read_callback_; |
| 306 | 307 |
| 307 // External callback; called when write is complete. | 308 // External callback; called when write is complete. |
| 308 CompletionCallback write_callback_; | 309 CompletionCallback write_callback_; |
| 309 | 310 |
| 310 BoundNetLog net_log_; | 311 BoundNetLog net_log_; |
| 311 | 312 |
| 312 DISALLOW_COPY_AND_ASSIGN(UDPSocketPosix); | 313 DISALLOW_COPY_AND_ASSIGN(UDPSocketPosix); |
| 313 }; | 314 }; |
| 314 | 315 |
| 315 } // namespace net | 316 } // namespace net |
| 316 | 317 |
| 317 #endif // NET_UDP_UDP_SOCKET_POSIX_H_ | 318 #endif // NET_UDP_UDP_SOCKET_POSIX_H_ |
| OLD | NEW |