1*6777b538SAndroid Build Coastguard Worker // Copyright 2011 The Chromium Authors 2*6777b538SAndroid Build Coastguard Worker // Use of this source code is governed by a BSD-style license that can be 3*6777b538SAndroid Build Coastguard Worker // found in the LICENSE file. 4*6777b538SAndroid Build Coastguard Worker 5*6777b538SAndroid Build Coastguard Worker #ifndef NET_BASE_WINSOCK_UTIL_H_ 6*6777b538SAndroid Build Coastguard Worker #define NET_BASE_WINSOCK_UTIL_H_ 7*6777b538SAndroid Build Coastguard Worker 8*6777b538SAndroid Build Coastguard Worker #include <winsock2.h> 9*6777b538SAndroid Build Coastguard Worker 10*6777b538SAndroid Build Coastguard Worker #include <stddef.h> 11*6777b538SAndroid Build Coastguard Worker 12*6777b538SAndroid Build Coastguard Worker namespace net { 13*6777b538SAndroid Build Coastguard Worker 14*6777b538SAndroid Build Coastguard Worker // Bluetooth address size. Windows Bluetooth is supported via winsock. 15*6777b538SAndroid Build Coastguard Worker static const size_t kBluetoothAddressSize = 6; 16*6777b538SAndroid Build Coastguard Worker 17*6777b538SAndroid Build Coastguard Worker // If the (manual-reset) event object is signaled, resets it and returns true. 18*6777b538SAndroid Build Coastguard Worker // Otherwise, does nothing and returns false. Called after a Winsock function 19*6777b538SAndroid Build Coastguard Worker // succeeds synchronously 20*6777b538SAndroid Build Coastguard Worker // 21*6777b538SAndroid Build Coastguard Worker // Our testing shows that except in rare cases (when running inside QEMU), 22*6777b538SAndroid Build Coastguard Worker // the event object is already signaled at this point, so we call this method 23*6777b538SAndroid Build Coastguard Worker // to avoid a context switch in common cases. This is just a performance 24*6777b538SAndroid Build Coastguard Worker // optimization. The code still works if this function simply returns false. 25*6777b538SAndroid Build Coastguard Worker bool ResetEventIfSignaled(WSAEVENT hEvent); 26*6777b538SAndroid Build Coastguard Worker 27*6777b538SAndroid Build Coastguard Worker } // namespace net 28*6777b538SAndroid Build Coastguard Worker 29*6777b538SAndroid Build Coastguard Worker #endif // NET_BASE_WINSOCK_UTIL_H_ 30