include/boost/corosio/native/detail/msg_flags.hpp
100.0% Lines (6/6)
100.0% List of functions (1/1)
66.7% Branches (4/6)
Functions (1)
Function
Calls
Lines
Branches
Blocks
boost::corosio::detail::to_native_msg_flags(int)
:31
144x
100.0%
66.7%
71.0%
| Line | Branch | TLA | Hits | Source Code |
|---|---|---|---|---|
| 1 | // | |||
| 2 | // Copyright (c) 2026 Steve Gerbino | |||
| 3 | // | |||
| 4 | // Distributed under the Boost Software License, Version 1.0. (See accompanying | |||
| 5 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) | |||
| 6 | // | |||
| 7 | // Official repository: https://github.com/cppalliance/corosio | |||
| 8 | // | |||
| 9 | ||||
| 10 | #ifndef BOOST_COROSIO_NATIVE_DETAIL_MSG_FLAGS_HPP | |||
| 11 | #define BOOST_COROSIO_NATIVE_DETAIL_MSG_FLAGS_HPP | |||
| 12 | ||||
| 13 | #include <boost/corosio/detail/platform.hpp> | |||
| 14 | ||||
| 15 | #if BOOST_COROSIO_POSIX | |||
| 16 | #include <sys/socket.h> | |||
| 17 | #else | |||
| 18 | #ifndef WIN32_LEAN_AND_MEAN | |||
| 19 | #define WIN32_LEAN_AND_MEAN | |||
| 20 | #endif | |||
| 21 | #ifndef NOMINMAX | |||
| 22 | #define NOMINMAX | |||
| 23 | #endif | |||
| 24 | #include <WinSock2.h> | |||
| 25 | #endif | |||
| 26 | ||||
| 27 | namespace boost::corosio::detail { | |||
| 28 | ||||
| 29 | /// Map portable message_flags int values to native MSG_* constants. | |||
| 30 | inline int | |||
| 31 | 144x | to_native_msg_flags(int flags) noexcept | ||
| 32 | { | |||
| 33 | 144x | int native = 0; | ||
| 34 |
2/2✓ Branch 0 taken 140 times.
✓ Branch 1 taken 4 times.
|
144x | if (flags & 1) native |= MSG_PEEK; | |
| 35 |
1/2✓ Branch 0 taken 144 times.
✗ Branch 1 not taken.
|
144x | if (flags & 2) native |= MSG_OOB; | |
| 36 |
1/2✓ Branch 0 taken 144 times.
✗ Branch 1 not taken.
|
144x | if (flags & 4) native |= MSG_DONTROUTE; | |
| 37 | 144x | return native; | ||
| 38 | } | |||
| 39 | ||||
| 40 | } // namespace boost::corosio::detail | |||
| 41 | ||||
| 42 | #endif | |||
| 43 |