23#include <flow/log/log.hpp>
24#include <flow/error/error.hpp>
25#include <boost/array.hpp>
28#include <sys/socket.h>
66template<
typename Protocol>
70 using boost::system::system_error;
73 FLOW_ERROR_EXEC_AND_THROW_ON_ERROR(
Endpoint<Protocol>, endpoint_at_shared_name<Protocol>,
74 logger_ptr, absolute_name, _1);
77 FLOW_LOG_SET_CONTEXT(logger_ptr, Log_component::S_TRANSPORT);
98 string abstract_namespace_name(
size_t(1),
'\0');
99 abstract_namespace_name += absolute_name.
str();
100 FLOW_LOG_TRACE(
"Abstract-namespace (Linux extension) name above consists of 1 NUL + the name "
101 "[" << absolute_name <<
"]; total of [" << abstract_namespace_name.
size() <<
"] bytes.");
104 auto& sys_err_code = *err_code;
109 endpoint.path(abstract_namespace_name);
110 sys_err_code.clear();
112 catch (
const system_error& exc)
114 FLOW_LOG_WARNING(
"Unable to set up native local stream endpoint structure; "
115 "could be due to name length; details logged below.");
116 sys_err_code = exc.code();
117 FLOW_ERROR_SYS_ERROR_LOG_WARNING();
String-wrapping abstraction representing a name uniquely distinguishing a kernel-persistent entity fr...
const std::string & str() const
Returns (sans copying) ref to immutable entire wrapped name string, suitable to pass into sys calls w...
size_t size() const
Returns str().size().
Additional (versus boost.asio) APIs for advanced work with local (Unix domain) stream and connected-d...
Endpoint< Protocol > endpoint_at_shared_name(flow::log::Logger *logger_ptr, const Shared_name &absolute_name, Error_code *err_code)
Returns an Endpoint corresponding to the given absolute Shared_name, so that an Acceptor or Peer_sock...
typename Protocol::endpoint Endpoint
Short-hand for boost.asio Unix domain peer stream-socket endpoint.
constexpr size_t N_PAYLOAD_FDS
Our transport::asio_local_stream_socket utilities support transmitting at most this many native handl...
flow::Error_code Error_code
Short-hand for flow::Error_code which is very common.
int handle_t
The native handle type. Much logic relies on this type being light-weight (fast to copy).
Ancillary data (for recv[m]msg() and send[m]msg()) buffer, used in our case for storing transmitted n...
boost::array< uint8_t, CMSG_SPACE(sizeof(Native_handle::handle_t) *N_PAYLOAD_FDS)> m_buf
The ancillary-data buffer.
::cmsghdr m_align
The alignment-ensuring thing.