| Coverage Report |
 |
|
|
 |
: /*
: Copyright (c) 2025 Giuseppe Roberti.
: All rights reserved.
:
: Redistribution and use in source and binary forms, with or without modification,
: are permitted provided that the following conditions are met:
:
: 1. Redistributions of source code must retain the above copyright notice, this
: list of conditions and the following disclaimer.
:
: 2. Redistributions in binary form must reproduce the above copyright notice,
: this list of conditions and the following disclaimer in the documentation and/or
: other materials provided with the distribution.
:
: 3. Neither the name of the copyright holder nor the names of its contributors
: may be used to endorse or promote products derived from this software without
: specific prior written permission.
:
: THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
: ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
: WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
: DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
: ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
: (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
: LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
: ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
: (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
: SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
: */
: #pragma once
:
: #include <nng/nng.h>
: #include <nng/protocol/reqrep0/req.h>
:
: namespace nngxx
: {
:
: enum class opt
: {
: sockname,
: raw,
: // proto, // deprecated
: // protoname, // deprecated
: // peer, // deprecated
: // peername, // deprecated
: recvbuf,
: sendbuf,
: recvfd,
: sendfd,
: recvtimeo,
: sendtimeo,
: locaddr,
: remaddr,
: url,
: maxttl,
: recvmaxsz,
: reconnmint,
: reconnmaxt,
: peergid,
: peerpid,
: peeruid,
: peerzoneid,
: req_resend_time,
: req_resend_tick
: };
:
: enum class opt_overload
: {
: integer,
: boolean,
: string,
: size,
: sockaddr,
: duration,
: uint64
: };
:
: template<opt o>
: [[nodiscard]] static constexpr const char* opt_to_nng_value() noexcept
: {
0 / 1 : if constexpr (o == opt::sockname)
: {
0 / 1 : return NNG_OPT_SOCKNAME;
: }
0 / 1 : else if constexpr (o == opt::raw)
: {
0 / 1 : return NNG_OPT_RAW;
: }
0 / 1 : else if constexpr (o == opt::recvbuf)
: {
0 / 1 : return NNG_OPT_RECVBUF;
: }
0 / 1 : else if constexpr (o == opt::sendbuf)
: {
0 / 1 : return NNG_OPT_SENDBUF;
: }
0 / 1 : else if constexpr (o == opt::recvfd)
: {
0 / 1 : return NNG_OPT_RECVFD;
: }
0 / 1 : else if constexpr (o == opt::sendfd)
: {
0 / 1 : return NNG_OPT_SENDFD;
: }
0 / 1 : else if constexpr (o == opt::recvtimeo)
: {
0 / 1 : return NNG_OPT_RECVTIMEO;
: }
0 / 1 : else if constexpr (o == opt::sendtimeo)
: {
0 / 1 : return NNG_OPT_SENDTIMEO;
: }
0 / 1 : else if constexpr (o == opt::locaddr)
: {
0 / 1 : return NNG_OPT_LOCADDR;
: }
0 / 1 : else if constexpr (o == opt::remaddr)
: {
0 / 1 : return NNG_OPT_REMADDR;
: }
0 / 1 : else if constexpr (o == opt::url)
: {
0 / 1 : return NNG_OPT_URL;
: }
0 / 1 : else if constexpr (o == opt::maxttl)
: {
0 / 1 : return NNG_OPT_MAXTTL;
: }
0 / 1 : else if constexpr (o == opt::recvmaxsz)
: {
0 / 1 : return NNG_OPT_RECVMAXSZ;
: }
0 / 1 : else if constexpr (o == opt::reconnmint)
: {
0 / 1 : return NNG_OPT_RECONNMINT;
: }
0 / 1 : else if constexpr (o == opt::reconnmaxt)
: {
0 / 1 : return NNG_OPT_RECONNMAXT;
: }
0 / 1 : else if constexpr (o == opt::peergid)
: {
0 / 1 : return NNG_OPT_PEER_GID;
: }
0 / 1 : else if constexpr (o == opt::peerpid)
: {
0 / 1 : return NNG_OPT_PEER_UID;
: }
0 / 1 : else if constexpr (o == opt::peeruid)
: {
0 / 1 : return NNG_OPT_PEER_UID;
: }
0 / 1 : else if constexpr (o == opt::peerzoneid)
: {
0 / 1 : return NNG_OPT_PEER_ZONEID;
: }
0 / 1 : else if constexpr (o == opt::req_resend_time)
: {
0 / 1 : return NNG_OPT_REQ_RESENDTIME;
: }
0 / 1 : else if constexpr (o == opt::req_resend_tick)
: {
0 / 1 : return NNG_OPT_REQ_RESENDTICK;
: }
: }
:
: template<opt o>
: [[nodiscard]] static constexpr opt_overload opt_to_nng_overload() noexcept
: {
0 / 1 : if constexpr (o == opt::sockname)
: {
0 / 1 : return opt_overload::string;
: }
0 / 1 : else if constexpr (o == opt::raw)
: {
0 / 1 : return opt_overload::boolean;
: }
0 / 1 : else if constexpr (o == opt::recvbuf)
: {
0 / 1 : return opt_overload::integer;
: }
0 / 1 : else if constexpr (o == opt::sendbuf)
: {
0 / 1 : return opt_overload::integer;
: }
0 / 1 : else if constexpr (o == opt::recvfd)
: {
0 / 1 : return opt_overload::integer;
: }
0 / 1 : else if constexpr (o == opt::sendfd)
: {
0 / 1 : return opt_overload::integer;
: }
0 / 1 : else if constexpr (o == opt::recvtimeo)
: {
0 / 1 : return opt_overload::duration;
: }
0 / 1 : else if constexpr (o == opt::sendtimeo)
: {
0 / 1 : return opt_overload::duration;
: }
0 / 1 : else if constexpr (o == opt::locaddr)
: {
0 / 1 : return opt_overload::sockaddr;
: }
0 / 1 : else if constexpr (o == opt::remaddr)
: {
0 / 1 : return opt_overload::sockaddr;
: }
0 / 1 : else if constexpr (o == opt::url)
: {
0 / 1 : return opt_overload::string;
: }
0 / 1 : else if constexpr (o == opt::maxttl)
: {
0 / 1 : return opt_overload::integer;
: }
0 / 1 : else if constexpr (o == opt::recvmaxsz)
: {
0 / 1 : return opt_overload::size;
: }
0 / 1 : else if constexpr (o == opt::reconnmint)
: {
0 / 1 : return opt_overload::duration;
: }
0 / 1 : else if constexpr (o == opt::reconnmaxt)
: {
0 / 1 : return opt_overload::duration;
: }
0 / 1 : else if constexpr (o == opt::peergid)
: {
0 / 1 : return opt_overload::uint64;
: }
0 / 1 : else if constexpr (o == opt::peerpid)
: {
0 / 1 : return opt_overload::uint64;
: }
0 / 1 : else if constexpr (o == opt::peeruid)
: {
0 / 1 : return opt_overload::uint64;
: }
0 / 1 : else if constexpr (o == opt::peerzoneid)
: {
0 / 1 : return opt_overload::uint64;
: }
0 / 1 : else if constexpr (o == opt::req_resend_time)
: {
0 / 1 : return opt_overload::duration;
: }
0 / 1 : else if constexpr (o == opt::req_resend_tick)
: {
0 / 1 : return opt_overload::duration;
: }
: }
:
: template<opt o>
: struct opt_to_nng_type;
:
: template<opt o>
: using opt_to_nng_type_t = opt_to_nng_type<o>::return_type;
:
: template<>
: struct opt_to_nng_type<opt::sockname>
: {
: using return_type = const char*;
: };
:
: template<>
: struct opt_to_nng_type<opt::recvtimeo>
: {
: using return_type = nng_duration;
: };
:
: template<>
: struct opt_to_nng_type<opt::sendtimeo>
: {
: using return_type = nng_duration;
: };
:
: template<>
: struct opt_to_nng_type<opt::req_resend_time>
: {
: using return_type = nng_duration;
: };
:
: template<>
: struct opt_to_nng_type<opt::req_resend_tick>
: {
: using return_type = nng_duration;
: };
:
: } // namespace nngxx
 |
| Generated by: llvmcov2html |