include/boost/corosio/native/detail/msg_flags.hpp
100.0% Lines (6/6)
100.0% List of functions (1/1)
Functions (1)
Function
Calls
Lines
Blocks
boost::corosio::detail::to_native_msg_flags(int)
:31
150x
100.0%
75.0%
| Line | 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 | 150x | to_native_msg_flags(int flags) noexcept | |
| 32 | { | ||
| 33 | 150x | int native = 0; | |
| 34 | 150x | if (flags & 1) native |= MSG_PEEK; | |
| 35 | 150x | if (flags & 2) native |= MSG_OOB; | |
| 36 | 150x | if (flags & 4) native |= MSG_DONTROUTE; | |
| 37 | 150x | return native; | |
| 38 | } | ||
| 39 | |||
| 40 | } // namespace boost::corosio::detail | ||
| 41 | |||
| 42 | #endif | ||
| 43 |