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