31 explicit PipeHandle(ConstructorAccess ca, std::shared_ptr<Loop> ref,
bool pass =
false)
40 return initialize(&uv_pipe_init, ipc);
53 invoke(&uv_pipe_open,
get(), file);
64 void bind(std::string name) {
65 invoke(&uv_pipe_bind,
get(), name.data());
79 auto listener = [ptr = shared_from_this()](
const auto &event,
const auto &) {
86 connect->connect(&uv_pipe_connect,
get(), name.data());
94 std::string
sock() const noexcept {
95 return details::tryRead(&uv_pipe_getsockname,
get());
104 std::string
peer() const noexcept {
105 return details::tryRead(&uv_pipe_getpeername,
get());
118 uv_pipe_pending_instances(
get(), count);
126 return uv_pipe_pending_count(
get());
std::enable_if_t< std::is_base_of< BaseHandle, R >::value, std::shared_ptr< R > > resource(Args &&... args)
Creates resources of handles' types.
std::string sock() const noexcept
Gets the name of the Unix domain socket or the named pipe.
details::UVTypeWrapper< uv_file > FileHandle
int pending() noexcept
Gets the number of pending pipe this instance can handle.
void bind(std::string name)
bind Binds the pipe to a file path (Unix) or a name (Windows).
details::UVTypeWrapper< uv_handle_type > HandleCategory
HandleType receive() noexcept
Used to receive handles over IPC pipes.
void pending(int count) noexcept
Sets the number of pending pipe this instance can handle.
static HandleType guessHandle(HandleCategory category) noexcept
Gets the type of the handle given a category.
std::string peer() const noexcept
Gets the name of the Unix domain socket or the named pipe to which the handle is connected.
HandleCategory category() const noexcept override
Gets the category of the handle.
bool init()
Initializes the handle.
void open(FileHandle file)
Opens an existing file descriptor or HANDLE as a pipe.
Loop & loop() const noexcept
Gets the loop from which the resource was originated.
void connect(std::string name)
Connects to the Unix domain socket or the named pipe.