E-MailRelay
Static Public Member Functions | List of all members
G::Msg Class Reference

Wrappers for sendmsg() and recvmsg(). More...

#include <gmsg.h>

Static Public Member Functions

static ssize_t send (SOCKET, const void *, std::size_t, int flags) noexcept
 A send() wrapper. More...
 
static ssize_t sendto (SOCKET, const void *, std::size_t, int flags, const sockaddr *, socklen_t) noexcept
 A sendto() wrapper. More...
 
static ssize_t sendto (SOCKET, const void *, std::size_t, int flags, const sockaddr *, socklen_t, int fd_to_send)
 A sendmsg() wrapper. Not always implemented. More...
 
static ssize_t sendto (SOCKET, const std::vector< std::string_view > &, int flags, const sockaddr *, socklen_t)
 A sendto() wrapper with scatter-gather data chunks. Not always implemented. More...
 
static ssize_t recv (SOCKET, void *, std::size_t, int flags) noexcept
 A recv() wrapper. More...
 
static ssize_t recvfrom (SOCKET, void *, std::size_t, int, sockaddr *, socklen_t *) noexcept
 A recvfrom() wrapper. More...
 
static ssize_t recvfrom (SOCKET, void *, std::size_t, int, sockaddr *, socklen_t *, int *fd_received_p)
 A recvmsg() wrapper. More...
 
static bool fatal (int error) noexcept
 Returns true if the error value indicates a permanent problem with the socket. More...
 

Detailed Description

Wrappers for sendmsg() and recvmsg().

These are near drop-in replacements for send()/sendto() and recv()/recvto(), but with SIGPIPE disabled and optional file-descriptor-passing capabilities.

See also
man unix(7) and man cmsg(3)

Definition at line 39 of file gmsg.h.

Member Function Documentation

◆ fatal()

bool G::Msg::fatal ( int  error)
staticnoexcept

Returns true if the error value indicates a permanent problem with the socket.

Definition at line 50 of file gmsg_mac.cpp.

◆ recv()

ssize_t G::Msg::recv ( SOCKET  fd,
void *  buffer,
std::size_t  size,
int  flags 
)
staticnoexcept

A recv() wrapper.

Definition at line 39 of file gmsg_mac.cpp.

◆ recvfrom() [1/2]

ssize_t G::Msg::recvfrom ( SOCKET  fd,
void *  buffer,
std::size_t  size,
int  flags,
sockaddr *  address_p,
socklen_t *  address_np 
)
staticnoexcept

A recvfrom() wrapper.

Definition at line 44 of file gmsg_mac.cpp.

◆ recvfrom() [2/2]

ssize_t G::Msg::recvfrom ( SOCKET  fd,
void *  buffer,
std::size_t  size,
int  flags,
sockaddr *  address_p,
socklen_t *  address_np,
int *  fd_received_p 
)
static

A recvmsg() wrapper.

The address and file descriptor pointers can be null independently. Not always implemented.

NOLINT

Definition at line 153 of file gmsg_unix.cpp.

◆ send()

ssize_t G::Msg::send ( SOCKET  fd,
const void *  buffer,
std::size_t  size,
int  flags 
)
staticnoexcept

A send() wrapper.

Definition at line 27 of file gmsg_mac.cpp.

◆ sendto() [1/3]

ssize_t G::Msg::sendto ( SOCKET  fd,
const std::vector< std::string_view > &  data,
int  flags,
const sockaddr *  address_p,
socklen_t  address_n 
)
static

A sendto() wrapper with scatter-gather data chunks. Not always implemented.

Definition at line 61 of file gmsg_unix.cpp.

◆ sendto() [2/3]

ssize_t G::Msg::sendto ( SOCKET  fd,
const void *  buffer,
std::size_t  size,
int  flags,
const sockaddr *  address_p,
socklen_t  address_n 
)
staticnoexcept

A sendto() wrapper.

Definition at line 32 of file gmsg_mac.cpp.

◆ sendto() [3/3]

ssize_t G::Msg::sendto ( SOCKET  fd,
const void *  buffer,
std::size_t  size,
int  flags,
const sockaddr *  address_p,
socklen_t  address_n,
int  fd_to_send 
)
static

A sendmsg() wrapper. Not always implemented.

Definition at line 92 of file gmsg_unix.cpp.


The documentation for this class was generated from the following files: