27#include <flow/log/log.hpp>
28#include <flow/async/util.hpp>
29#include <boost/move/unique_ptr.hpp>
30#include <experimental/propagate_const>
309 template<
typename Msg_resource>
312 template<
typename Msg_resource>
488 const std::string&
nickname()
const;
605 template<
typename Task_err>
718 template<
typename Task_err_sz>
720 Task_err_sz&& on_done_func);
741 template<
typename Task_err_sz>
766 template<
typename Msg_resource,
typename Task_err>
768 Task_err&& on_done_func);
792 template<
typename Msg_resource,
typename Task_err>
793 bool async_receive_blob_batch(Blob_batch_in<Msg_resource>* batch,
bool assume_would_block, Task_err&& on_done_func);
935 using Impl_ptr = std::experimental::propagate_const<boost::movelib::unique_ptr<Impl>>;
990template<
typename Task_err>
993 return impl()->async_end_sending(std::move(on_done_func));
996template<
typename Task_err_sz>
999 Task_err_sz&& on_done_func)
1006 return impl()->async_receive_native_handle(target_hndl, target_meta_blob, std::move(on_done_func));
1009template<
typename Task_err_sz>
1012 return impl()->async_receive_blob(target_blob, std::move(on_done_func));
1015template<
typename Msg_resource,
typename Task_err>
1017 bool assume_would_block, Task_err&& on_done_func)
1019 return impl()->async_receive_native_handle_batch<Msg_resource>(batch, assume_would_block, std::move(on_done_func));
1022template<
typename Msg_resource,
typename Task_err>
1024 bool assume_would_block, Task_err&& on_done_func)
1026 return impl()->async_receive_blob_batch<Msg_resource>(batch, assume_would_block, std::move(on_done_func));
Internal, non-movable pImpl-lite implementation of Native_socket_stream class.
Implements both Native_handle_sender and Native_handle_receiver concepts by using a Unix domain socke...
Blob_rcv_stats native_handle_receive_stats() const
Returns the same stats as blob_receive_stats(): since this transport uses a single Unix-domain-socket...
Impl_ptr & impl() const
Helper that simply returns m_impl while guaranteeing that m_impl is non-null upon return.
Native_socket_stream(const Native_socket_stream &)=delete
Copy construction is disallowed.
Native_socket_stream & operator=(const Native_socket_stream &)=delete
Copy assignment is disallowed.
size_t send_blob_max_size() const
Implements Blob_sender API per contract.
bool async_receive_native_handle_batch(Native_handle_batch_in< Msg_resource > *batch, bool assume_would_block, Task_err &&on_done_func)
Implements Native_handle_receiver API per contract.
~Native_socket_stream()
Implements Native_handle_sender and Native_handle_receiver APIs at the same time, per their concept c...
const std::string & nickname() const
Returns nickname, a brief string suitable for logging.
bool async_receive_native_handle(Native_handle *target_hndl, const util::Blob_mutable &target_meta_blob, Task_err_sz &&on_done_func)
Implements Native_handle_receiver API per contract.
Native_socket_stream(Native_socket_stream &&src)
Move-constructs from src; src becomes as-if default-cted (therefore in NULL state).
bool sync_connect(const Shared_name &absolute_name, Error_code *err_code=nullptr)
To be invoked in NULL state only, it synchronously and non-blockingly attempts to connect to an oppos...
static constexpr bool S_BLOB_UNDERFLOW_ALLOWED
Implements concept API; namely it is true: async_receive_blob() with smaller-than-receive_blob_max_si...
Blob_snd_stats native_handle_send_stats() const
Returns the same stats as blob_send_stats(): since this transport uses a single Unix-domain-socket pi...
static const Shared_name & S_RESOURCE_TYPE_ID
Implements concept API.
void native_handle_receive_stats_reset()
Equivalent to blob_receive_stats_reset(); see blob_receive_stats() rationale.
bool async_receive_blob_batch(Blob_batch_in< Msg_resource > *batch, bool assume_would_block, Task_err &&on_done_func)
Implements Blob_receiver API per contract.
transport::stat::Blob_rcv_stats Blob_rcv_stats
Implements Blob_receiver concept API.
bool idle_timer_run(util::Fine_duration timeout=boost::chrono::seconds{5})
Implements Native_handle_receiver, Blob_receiver API per contract.
transport::stat::Blob_snd_stats Blob_snd_stats
Implements Blob_sender concept API.
bool send_native_handle(Native_handle hndl_or_null, const util::Blob_const &meta_blob, Error_code *err_code=nullptr)
Implements Native_handle_sender API per contract.
void blob_receive_stats_reset()
Implements Blob_receiver API per contract.
size_t send_meta_blob_max_size() const
Implements Native_handle_sender API per contract.
static constexpr bool S_META_BLOB_UNDERFLOW_ALLOWED
Implements concept API; namely it is true: async_receive_native_handle() with smaller-than-receive_me...
void blob_send_stats_reset()
Implements Blob_sender API per contract.
bool auto_ping(util::Fine_duration period=boost::chrono::seconds{2})
Implements Native_handle_sender, Blob_sender API per contract.
void native_handle_send_stats_reset()
Equivalent to blob_send_stats_reset(); see blob_send_stats() rationale.
const util::Process_credentials & remote_peer_process_credentials(Error_code *err_code=nullptr) const
OS-reported process credential (PID, etc.) info about the other connected peer's process,...
Native_socket_stream()
Default ctor (object is in NULL state).
std::experimental::propagate_const< boost::movelib::unique_ptr< Impl > > Impl_ptr
Short-hand for const-respecting wrapper around Native_socket_stream_impl for the pImpl-lite idiom.
Impl_ptr m_impl
The true implementation of this class.
bool async_end_sending(Task_err &&on_done_func)
Implements Native_handle_sender, Blob_sender API per contract.
bool async_receive_blob(const util::Blob_mutable &target_blob, Task_err_sz &&on_done_func)
Implements Blob_receiver API per contract.
friend std::ostream & operator<<(std::ostream &os, const Native_socket_stream &val)
Friend of Native_socket_stream.
size_t receive_meta_blob_max_size() const
Implements Native_handle_receiver API per contract.
bool end_sending()
Implements Native_handle_sender, Blob_sender API per contract.
Blob_snd_stats blob_send_stats() const
Implements Blob_sender API per contract.
size_t receive_blob_max_size() const
Implements Blob_receiver API per contract.
typename Impl::template Native_handle_batch_in< Msg_resource > Native_handle_batch_in
Implements Native_handle_receiver concept API.
typename Impl::template Blob_batch_in< Msg_resource > Blob_batch_in
Implements Blob_receiver concept API.
static constexpr size_t S_RCV_NATIVE_HANDLE_BATCH_SZ_RECOMMENDATION
Implements concept API.
static constexpr size_t S_RCV_BLOB_BATCH_SZ_RECOMMENDATION
Implements concept API. Same notes as for S_RCV_NATIVE_HANDLE_BATCH_SZ_RECOMMENDATION; the values are...
Native_socket_stream & operator=(Native_socket_stream &&src)
Move-assigns from src; *this acts as if destructed; src becomes as-if default-cted (therefore in NULL...
bool send_blob(const util::Blob_const &blob, Error_code *err_code=nullptr)
Implements Blob_sender API per contract.
Blob_rcv_stats blob_receive_stats() const
Implements Blob_receiver API per contract.
Dummy type for use as a template param to Channel when either the blobs pipe or handles pipe is disab...
Implements both sync_io::Native_handle_sender and sync_io::Native_handle_receiver concepts by using a...
static constexpr size_t S_RCV_NATIVE_HANDLE_BATCH_SZ_RECOMMENDATION
Implements concept API.
static constexpr size_t S_RCV_BLOB_BATCH_SZ_RECOMMENDATION
Implements concept API.
A process's credentials (PID, UID, GID as of this writing).
String-wrapping abstraction representing a name uniquely distinguishing a kernel-persistent entity fr...
Flow-IPC module providing transmission of structured messages and/or low-level blobs (and more) betwe...
boost::asio::mutable_buffer Blob_mutable
Short-hand for a mutable blob somewhere in memory, stored as exactly a void* and a size_t.
flow::Fine_duration Fine_duration
Short-hand for Flow's Fine_duration.
boost::asio::const_buffer Blob_const
Short-hand for an immutable blob somewhere in memory, stored as exactly a void const * and a size_t.
flow::util::String_view String_view
Short-hand for Flow's String_view.
flow::Error_code Error_code
Short-hand for flow::Error_code which is very common.
Cumulative stats from the incoming-direction (receive) pipe of a Blob_receiver or Native_handle_recei...
Cumulative stats from the outgoing-direction (send) pipe of a Blob_sender or Native_handle_sender con...
A monolayer-thin wrapper around a native handle, a/k/a descriptor a/k/a FD.