Core

class socket

Represents an nng_socket.

Public Functions

inline socket(ev::enqueuer &r, nngxx::socket &&s)

Construct a socket.

inline ~socket()
inline operator tool_view()
inline void set_options(const socket_opt opts)
inline socket_opt options() const
inline void dial(const char *addr)
inline void listen(const char *addr)
inline void connect(const char *addr, const cmode mode)
inline nngxx::ctx make_ctx()
inline void send_aio(nngxx::aio_view &a)
inline void recv_aio(nngxx::aio_view &a)
template<ev::event_c event_t>
inline void send(event_t ev, pipe p = {})
inline void recv()
inline void stop()
inline int id() const
inline int socket_id() const
inline const char *proto_name() const
inline decltype(ctx.out()) format_to(fmt::format_context &ctx) const
struct socket_opt

Represents the options that can be configured for a given socket.

These can be nng_options for an nng_socket, or they can be options of the nng_req protocol.

nng_socket Options

std::optional<nng_duration> recv_timeout

NNG_OPT_RECVTIMEO.

std::optional<nng_duration> send_timeout

NNG_OPT_SENDTIMEO.

nng_req Options

std::optional<nng_duration> req_resend_time

NNG_OPT_REQ_RESENDTIME.

std::optional<nng_duration> req_resend_tick

NNG_OPT_REQ_RESENDTICK.

class context

Public Functions

inline context(ev::enqueuer &r, nngxx::ctx &&c, const net::socket &s)
inline ~context()
inline operator tool_view()
inline void set_options(context_opt opts)
inline context_opt options() const
inline void send_aio(nngxx::aio_view &a)
inline void recv_aio(nngxx::aio_view &a)
template<ev::event_c event_t>
inline void send(event_t ev, pipe p)
inline void recv()
inline void stop()
inline int id() const
inline int socket_id() const
inline const net::socket &sock() const
inline decltype(ctx.out()) format_to(fmt::format_context &ctx) const
struct context_opt

Public Members

std::optional<nng_duration> recv_timeout
std::optional<nng_duration> send_timeout
class context_registry

Public Functions

inline context_registry(ev::enqueuer &r, net::socket &s)
inline void stop_all()
inline context &emplace()
inline context &of(const net::tool_view &t)
inline void start_recv(int num_ctxs)
class op

Public Functions

inline ~op()
inline explicit operator bool()
template<ev::event_c event_t, tool_c tool_t>
inline void send(ev::enqueuer &r, tool_t &t, pipe p, event_t ev)
template<tool_c tool_t>
inline void recv(ev::enqueuer &r, tool_t &t)
inline void sleep(nng_duration ms, std::function<void()> f)
inline void reset_sleep(nng_duration ms)
inline std::error_code result() const

return result of asynchronous operation

The nng_aio_result() returns the result of the operation associated with the handle aio. If the operation was successful, then 0 is returned. Otherwise a non-zero error code is returned.

Returns:

inline void abort(nngxx::err err)

abort asynchronous I/O operation

The abort() function aborts an operation previously started with the handle aio.

If the operation is aborted, then the callback for the handle will be called, and the function result() will return the error err.

Parameters:

err

inline void cancel()

cancel asynchronous I/O operation

The nng_aio_cancel() function aborts an operation previously started with the handle aio. If the operation is aborted, then the callback for the handle will be called, and the function nng_aio_result() will return the error NNG_ECANCELED.

This function does not wait for the operation to be fully aborted, but returns immediately.

If no operation is currently in progress (either because it has already finished, or no operation has been started yet), then this function has no effect.

Same as abort(nngxx::error::canceled)

inline void wait() const

wait for asynchronous I/O operation

The nng_aio_wait() function waits for an asynchronous I/O operation to complete. If the operation has not been started, or has already completed, then it returns immediately.

inline void stop()

stop asynchronous I/O operation

The stop() function stops the asynchronous I/O operation associated with aio by aborting with NNG_ECANCELED, and then waits for it to complete or to be completely aborted, and for the callback associated with the aio to have completed executing.

Same as cancel() + wait().

class pipe : public clev::iface<nng_pipe>

Public Functions

inline pipe()
inline pipe(nngxx::pipe_view &pv) noexcept
inline int id() const noexcept
inline int socket_id() const
inline operator bool()
inline decltype(ctx.out()) format_to(fmt::format_context &ctx) const
class tool_view

Represents an nng_socket or nng_ctx view.

Public Functions

inline explicit tool_view(nngxx::ctx_view c)

Construct a tool_view from an nng_ctx view.

inline explicit tool_view(nngxx::socket_view s)

Construct a tool_view from an nng_socket view.

inline const std::type_info &type() const

Get the std::type_info of the underlying variant.

inline const char *who() const

Get a string that represents the type of the underlying variant.

inline int id() const

The id of the underlying variant.

inline decltype(ctx.out()) format_to(fmt::format_context &ctx) const

Formatter for debugging purpose.

Warning

doxygentypedef: Cannot find typedef “nngxx::cb_f” in doxygen xml output for project “pars” from directory: /home/runner/work/pars/pars/out/build/linux-debug-llvm/docs/doxygen/xml

enum class pars::net::cmode

Values:

enumerator dial
enumerator listen
static cmode pars::net::cmode_from_string(const char *str)
enum class pars::net::dir

Values:

enumerator out
enumerator in
static std::size_t pars::hash_from_uuid(const std::string_view &uuid)
static std::size_t pars::hash_from_msg(const nngxx::msg &m)