| 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_WIN_H_ | 5 #ifndef NET_SOCKET_UDP_SOCKET_WIN_H_ |
| 6 #define NET_SOCKET_UDP_SOCKET_WIN_H_ | 6 #define NET_SOCKET_UDP_SOCKET_WIN_H_ |
| 7 | 7 |
| 8 #include <qos2.h> | 8 #include <qos2.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 #include <winsock2.h> | 10 #include <winsock2.h> |
| 11 | 11 |
| 12 #include <memory> | 12 #include <memory> |
| 13 | 13 |
| 14 #include "base/gtest_prod_util.h" | 14 #include "base/gtest_prod_util.h" |
| 15 #include "base/macros.h" | 15 #include "base/macros.h" |
| 16 #include "base/memory/ref_counted.h" | 16 #include "base/memory/ref_counted.h" |
| 17 #include "base/threading/non_thread_safe.h" | 17 #include "base/threading/thread_checker.h" |
| 18 #include "base/win/object_watcher.h" | 18 #include "base/win/object_watcher.h" |
| 19 #include "base/win/scoped_handle.h" | 19 #include "base/win/scoped_handle.h" |
| 20 #include "net/base/address_family.h" | 20 #include "net/base/address_family.h" |
| 21 #include "net/base/completion_callback.h" | 21 #include "net/base/completion_callback.h" |
| 22 #include "net/base/io_buffer.h" | 22 #include "net/base/io_buffer.h" |
| 23 #include "net/base/ip_endpoint.h" | 23 #include "net/base/ip_endpoint.h" |
| 24 #include "net/base/net_export.h" | 24 #include "net/base/net_export.h" |
| 25 #include "net/base/network_change_notifier.h" | 25 #include "net/base/network_change_notifier.h" |
| 26 #include "net/base/rand_callback.h" | 26 #include "net/base/rand_callback.h" |
| 27 #include "net/log/net_log_with_source.h" | 27 #include "net/log/net_log_with_source.h" |
| 28 #include "net/socket/datagram_socket.h" | 28 #include "net/socket/datagram_socket.h" |
| 29 #include "net/socket/diff_serv_code_point.h" | 29 #include "net/socket/diff_serv_code_point.h" |
| 30 | 30 |
| 31 namespace net { | 31 namespace net { |
| 32 | 32 |
| 33 class IPAddress; | 33 class IPAddress; |
| 34 class NetLog; | 34 class NetLog; |
| 35 struct NetLogSource; | 35 struct NetLogSource; |
| 36 | 36 |
| 37 class NET_EXPORT UDPSocketWin | 37 class NET_EXPORT UDPSocketWin |
| 38 : NON_EXPORTED_BASE(public base::NonThreadSafe), | 38 : NON_EXPORTED_BASE(public base::win::ObjectWatcher::Delegate) { |
| 39 NON_EXPORTED_BASE(public base::win::ObjectWatcher::Delegate) { | |
| 40 public: | 39 public: |
| 41 UDPSocketWin(DatagramSocket::BindType bind_type, | 40 UDPSocketWin(DatagramSocket::BindType bind_type, |
| 42 const RandIntCallback& rand_int_cb, | 41 const RandIntCallback& rand_int_cb, |
| 43 net::NetLog* net_log, | 42 net::NetLog* net_log, |
| 44 const net::NetLogSource& source); | 43 const net::NetLogSource& source); |
| 45 ~UDPSocketWin() override; | 44 ~UDPSocketWin() override; |
| 46 | 45 |
| 47 // Opens the socket. | 46 // Opens the socket. |
| 48 // Returns a net error code. | 47 // Returns a net error code. |
| 49 int Open(AddressFamily address_family); | 48 int Open(AddressFamily address_family); |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 318 | 317 |
| 319 // External callback; called when write is complete. | 318 // External callback; called when write is complete. |
| 320 CompletionCallback write_callback_; | 319 CompletionCallback write_callback_; |
| 321 | 320 |
| 322 NetLogWithSource net_log_; | 321 NetLogWithSource net_log_; |
| 323 | 322 |
| 324 // QWAVE data. Used to set DSCP bits on outgoing packets. | 323 // QWAVE data. Used to set DSCP bits on outgoing packets. |
| 325 HANDLE qos_handle_; | 324 HANDLE qos_handle_; |
| 326 QOS_FLOWID qos_flow_id_; | 325 QOS_FLOWID qos_flow_id_; |
| 327 | 326 |
| 327 THREAD_CHECKER(thread_checker_); |
| 328 |
| 328 DISALLOW_COPY_AND_ASSIGN(UDPSocketWin); | 329 DISALLOW_COPY_AND_ASSIGN(UDPSocketWin); |
| 329 }; | 330 }; |
| 330 | 331 |
| 331 //----------------------------------------------------------------------------- | 332 //----------------------------------------------------------------------------- |
| 332 | 333 |
| 333 // QWAVE (Quality Windows Audio/Video Experience) is the latest windows | 334 // QWAVE (Quality Windows Audio/Video Experience) is the latest windows |
| 334 // library for setting packet priorities (and other things). Unfortunately, | 335 // library for setting packet priorities (and other things). Unfortunately, |
| 335 // Microsoft has decided that setting the DSCP bits with setsockopt() no | 336 // Microsoft has decided that setting the DSCP bits with setsockopt() no |
| 336 // longer works, so we have to use this API instead. | 337 // longer works, so we have to use this API instead. |
| 337 // This class is meant to be used as a singleton. It exposes a few dynamically | 338 // This class is meant to be used as a singleton. It exposes a few dynamically |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 381 SetFlowFn set_flow_func_; | 382 SetFlowFn set_flow_func_; |
| 382 | 383 |
| 383 FRIEND_TEST_ALL_PREFIXES(UDPSocketTest, SetDSCPFake); | 384 FRIEND_TEST_ALL_PREFIXES(UDPSocketTest, SetDSCPFake); |
| 384 DISALLOW_COPY_AND_ASSIGN(QwaveAPI); | 385 DISALLOW_COPY_AND_ASSIGN(QwaveAPI); |
| 385 }; | 386 }; |
| 386 | 387 |
| 387 | 388 |
| 388 } // namespace net | 389 } // namespace net |
| 389 | 390 |
| 390 #endif // NET_SOCKET_UDP_SOCKET_WIN_H_ | 391 #endif // NET_SOCKET_UDP_SOCKET_WIN_H_ |
| OLD | NEW |