28#include <flow/log/log.hpp>
29#include <flow/async/util.hpp>
30#include <boost/move/unique_ptr.hpp>
31#include <experimental/propagate_const>
175 template<
typename Msg_resource>
178 template<
typename Msg_resource>
345 const std::string&
nickname()
const;
361 template<
typename Create_ev_wait_hndl_func>
403 template<
typename Event_wait_func_t>
418 template<
typename Event_wait_func_t>
471 template<
typename Task_err>
534 template<
typename Event_wait_func_t>
549 template<
typename Event_wait_func_t>
575 template<
typename Task_err_sz>
578 Task_err_sz&& on_done_func);
601 template<
typename Task_err_sz>
603 Task_err_sz&& on_done_func);
628 template<
typename Msg_resource,
typename Task_err>
630 Error_code* sync_err_code, Task_err&& on_done_func);
655 template<
typename Msg_resource,
typename Task_err>
657 Task_err&& on_done_func);
711 using Impl_ptr = std::experimental::propagate_const<boost::movelib::unique_ptr<Impl>>;
767template<
typename Create_ev_wait_hndl_func>
770 return impl()->replace_event_wait_handles(create_ev_wait_hndl_func);
773template<
typename Event_wait_func_t>
776 return impl()->start_send_native_handle_ops(std::move(ev_wait_func));
779template<
typename Event_wait_func_t>
782 return impl()->start_send_blob_ops(std::move(ev_wait_func));
785template<
typename Task_err>
788 return impl()->async_end_sending(sync_err_code, std::move(on_done_func));
791template<
typename Event_wait_func_t>
794 return impl()->start_receive_native_handle_ops(std::move(ev_wait_func));
797template<
typename Event_wait_func_t>
800 return impl()->start_receive_blob_ops(std::move(ev_wait_func));
803template<
typename Task_err_sz>
807 Task_err_sz&& on_done_func)
814 return impl()->async_receive_native_handle(target_hndl, target_meta_blob, sync_err_code, sync_sz,
815 std::move(on_done_func));
818template<
typename Task_err_sz>
820 Error_code* sync_err_code,
size_t* sync_sz, Task_err_sz&& on_done_func)
822 return impl()->async_receive_blob(target_blob, sync_err_code, sync_sz, std::move(on_done_func));
825template<
typename Msg_resource,
typename Task_err>
827 bool assume_would_block,
828 Error_code* sync_err_code, Task_err&& on_done_func)
830 return impl()->async_receive_native_handle_batch<Msg_resource>(batch, assume_would_block, sync_err_code,
831 std::move(on_done_func));
834template<
typename Msg_resource,
typename Task_err>
836 Error_code* sync_err_code, Task_err&& on_done_func)
838 return impl()->async_receive_blob_batch<Msg_resource>(batch, assume_would_block, sync_err_code,
839 std::move(on_done_func));
static constexpr bool S_USE_OS_DGRAM_BATCH_SUPPORT
Whether the OS provides, and we shall use for sync_io::Native_socket_stream and derivative(s),...
static constexpr bool S_USE_OS_DGRAM_SUPPORT
Whether the OS provides, and we shall use for sync_io::Native_socket_stream and derivative(s),...
Implements both Native_handle_sender and Native_handle_receiver concepts by using a Unix domain socke...
Dummy type for use as a template param to Channel when either the blobs pipe or handles pipe is disab...
Internal, non-movable pImpl-lite implementation of sync_io::Native_socket_stream class.
Implements both sync_io::Native_handle_sender and sync_io::Native_handle_receiver concepts by using a...
bool async_receive_native_handle(Native_handle *target_hndl, const util::Blob_mutable &target_meta_blob, Error_code *sync_err_code, size_t *sync_sz, Task_err_sz &&on_done_func)
Implements Native_handle_receiver API per contract.
transport::stat::Blob_snd_stats Blob_snd_stats
Implements sync_io::Blob_sender concept API.
static constexpr size_t S_RCV_NATIVE_HANDLE_BATCH_SZ_RECOMMENDATION
Implements concept API.
Native_socket_stream(Native_socket_stream &&src)
Move-constructs from src; src becomes as-if default-cted (therefore in NULL state).
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.
static constexpr size_t S_RCV_BLOB_BATCH_SZ_RECOMMENDATION
Implements concept API.
const util::Process_credentials & remote_peer_process_credentials(Error_code *err_code=nullptr) const
See transport::Native_socket_stream counterpart.
bool start_send_blob_ops(Event_wait_func_t &&ev_wait_func)
Implements Blob_sender API per contract.
bool start_send_native_handle_ops(Event_wait_func_t &&ev_wait_func)
Implements Native_handle_sender API per contract.
static const Shared_name S_RESOURCE_TYPE_ID
Implements concept API.
Native_socket_stream()
Default ctor (object is in NULL state).
Native_socket_stream & operator=(const Native_socket_stream &)=delete
Copy assignment is disallowed.
Blob_snd_stats blob_send_stats() const
Implements sync_io::Blob_sender API per contract.
std::experimental::propagate_const< boost::movelib::unique_ptr< Impl > > Impl_ptr
Short-hand for const-respecting wrapper around Impl for the pImpl-lite idiom.
void blob_send_stats_reset()
Implements sync_io::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.
bool async_receive_blob_batch(Blob_batch_in< Msg_resource > *batch, bool assume_would_block, Error_code *sync_err_code, Task_err &&on_done_func)
Implements Blob_receiver API per contract.
Native_socket_stream(const Native_socket_stream &)=delete
Copy construction is disallowed.
bool end_sending()
Implements Native_handle_sender, Blob_sender API per contract.
static constexpr bool S_BLOB_UNDERFLOW_ALLOWED
Implements concept API; namely it is true.
bool idle_timer_run(util::Fine_duration timeout=boost::chrono::seconds{5})
Implements Native_handle_receiver, Blob_receiver API per contract.
transport::stat::Blob_rcv_stats Blob_rcv_stats
Implements sync_io::Blob_receiver concept API.
const std::string & nickname() const
Returns nickname, a brief string suitable for logging.
Blob_rcv_stats native_handle_receive_stats() const
Implements sync_io::Native_handle_receiver API per contract.
typename Impl::template Blob_batch_in< Msg_resource > Blob_batch_in
Implements Blob_receiver concept API.
bool async_receive_blob(const util::Blob_mutable &target_blob, Error_code *sync_err_code, size_t *sync_sz, Task_err_sz &&on_done_func)
Implements Blob_receiver API per contract.
bool sync_connect(const Shared_name &absolute_name, Error_code *err_code=nullptr)
Identical to Async_io_obj counterpart.
void native_handle_send_stats_reset()
Implements sync_io::Native_handle_sender API per contract. Identical to blob_send_stats_reset().
Impl_ptr & impl() const
Helper that simply returns m_impl while guaranteeing that m_impl is non-null upon return.
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 start_receive_blob_ops(Event_wait_func_t &&ev_wait_func)
Implements Blob_receiver API per contract.
size_t send_meta_blob_max_size() const
Implements Native_handle_sender API per contract.
Impl_ptr m_impl
The true implementation of this class.
Blob_rcv_stats blob_receive_stats() const
Implements sync_io::Blob_receiver API per contract.
size_t receive_blob_max_size() const
Implements Blob_receiver API per contract.
static constexpr bool S_META_BLOB_UNDERFLOW_ALLOWED
Implements concept API; namely it is true.
size_t send_blob_max_size() const
Implements Blob_sender API per contract.
flow::log::Logger * get_logger() const
Returns logger (possibly null).
typename Impl::template Native_handle_batch_in< Msg_resource > Native_handle_batch_in
Implements Native_handle_receiver concept API.
friend std::ostream & operator<<(std::ostream &os, const Native_socket_stream &val)
Friend of Native_socket_stream.
bool start_receive_native_handle_ops(Event_wait_func_t &&ev_wait_func)
Implements Native_handle_receiver API per contract.
bool send_blob(const util::Blob_const &blob, Error_code *err_code=nullptr)
Implements Blob_sender API per contract.
size_t receive_meta_blob_max_size() const
Implements Native_handle_receiver API per contract.
bool async_receive_native_handle_batch(Native_handle_batch_in< Msg_resource > *batch, bool assume_would_block, Error_code *sync_err_code, 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...
void native_handle_receive_stats_reset()
Implements sync_io::Native_handle_receiver API per contract. Identical to blob_receive_stats_reset().
void blob_receive_stats_reset()
Implements sync_io::Blob_receiver API per contract.
static constexpr bool S_TRANSMIT_NATIVE_HANDLES
Useful for generic programming: true to indicate a *this has a send_native_handle() and an async_rece...
bool replace_event_wait_handles(const Create_ev_wait_hndl_func &create_ev_wait_hndl_func)
Implements Native_handle_sender and Native_handle_receiver APIs at the same time, per their concept c...
Blob_snd_stats native_handle_send_stats() const
Implements sync_io::Native_handle_sender API per contract.
bool async_end_sending(Error_code *sync_err_code, Task_err &&on_done_func)
Implements Native_handle_sender, Blob_sender API per contract.
A process's credentials (PID, UID, GID as of this writing).
String-wrapping abstraction representing a name uniquely distinguishing a kernel-persistent entity fr...
sync_io-pattern counterparts to async-I/O-pattern object types in parent namespace ipc::transport.
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.