Blame docs/src/pipe.rst

Packit Service 7c31a4
Packit Service 7c31a4
.. _pipe:
Packit Service 7c31a4
Packit Service 7c31a4
:c:type:`uv_pipe_t` --- Pipe handle
Packit Service 7c31a4
===================================
Packit Service 7c31a4
Packit Service 7c31a4
Pipe handles provide an abstraction over streaming files on Unix (including
Packit Service 7c31a4
local domain sockets, pipes, and FIFOs) and named pipes on Windows.
Packit Service 7c31a4
Packit Service 7c31a4
:c:type:`uv_pipe_t` is a 'subclass' of :c:type:`uv_stream_t`.
Packit Service 7c31a4
Packit Service 7c31a4
Packit Service 7c31a4
Data types
Packit Service 7c31a4
----------
Packit Service 7c31a4
Packit Service 7c31a4
.. c:type:: uv_pipe_t
Packit Service 7c31a4
Packit Service 7c31a4
    Pipe handle type.
Packit Service 7c31a4
Packit Service 7c31a4
Packit Service 7c31a4
Public members
Packit Service 7c31a4
^^^^^^^^^^^^^^
Packit Service 7c31a4
Packit Service 7c31a4
.. c:member:: int uv_pipe_t.ipc
Packit Service 7c31a4
Packit Service 7c31a4
    Whether this pipe is suitable for handle passing between processes.
Packit Service 7c31a4
    Only a connected pipe that will be passing the handles should have this flag
Packit Service 7c31a4
    set, not the listening pipe that uv_accept is called on.
Packit Service 7c31a4
Packit Service 7c31a4
.. seealso:: The :c:type:`uv_stream_t` members also apply.
Packit Service 7c31a4
Packit Service 7c31a4
Packit Service 7c31a4
API
Packit Service 7c31a4
---
Packit Service 7c31a4
Packit Service 7c31a4
.. c:function:: int uv_pipe_init(uv_loop_t* loop, uv_pipe_t* handle, int ipc)
Packit Service 7c31a4
Packit Service 7c31a4
    Initialize a pipe handle. The `ipc` argument is a boolean to indicate if
Packit Service 7c31a4
    this pipe will be used for handle passing between processes (which may
Packit Service 7c31a4
    change the bytes on the wire). Only a connected pipe that will be
Packit Service 7c31a4
    passing the handles should have this flag set, not the listening pipe
Packit Service 7c31a4
    that uv_accept is called on.
Packit Service 7c31a4
Packit Service 7c31a4
.. c:function:: int uv_pipe_open(uv_pipe_t* handle, uv_file file)
Packit Service 7c31a4
Packit Service 7c31a4
    Open an existing file descriptor or HANDLE as a pipe.
Packit Service 7c31a4
Packit Service 7c31a4
    .. versionchanged:: 1.2.1 the file descriptor is set to non-blocking mode.
Packit Service 7c31a4
Packit Service 7c31a4
    .. note::
Packit Service 7c31a4
        The passed file descriptor or HANDLE is not checked for its type, but
Packit Service 7c31a4
        it's required that it represents a valid pipe.
Packit Service 7c31a4
Packit Service 7c31a4
.. c:function:: int uv_pipe_bind(uv_pipe_t* handle, const char* name)
Packit Service 7c31a4
Packit Service 7c31a4
    Bind the pipe to a file path (Unix) or a name (Windows).
Packit Service 7c31a4
Packit Service 7c31a4
    .. note::
Packit Service 7c31a4
        Paths on Unix get truncated to ``sizeof(sockaddr_un.sun_path)`` bytes, typically between
Packit Service 7c31a4
        92 and 108 bytes.
Packit Service 7c31a4
Packit Service 7c31a4
.. c:function:: void uv_pipe_connect(uv_connect_t* req, uv_pipe_t* handle, const char* name, uv_connect_cb cb)
Packit Service 7c31a4
Packit Service 7c31a4
    Connect to the Unix domain socket or the named pipe.
Packit Service 7c31a4
Packit Service 7c31a4
    .. note::
Packit Service 7c31a4
        Paths on Unix get truncated to ``sizeof(sockaddr_un.sun_path)`` bytes, typically between
Packit Service 7c31a4
        92 and 108 bytes.
Packit Service 7c31a4
Packit Service 7c31a4
.. c:function:: int uv_pipe_getsockname(const uv_pipe_t* handle, char* buffer, size_t* size)
Packit Service 7c31a4
Packit Service 7c31a4
    Get the name of the Unix domain socket or the named pipe.
Packit Service 7c31a4
Packit Service 7c31a4
    A preallocated buffer must be provided. The size parameter holds the length
Packit Service 7c31a4
    of the buffer and it's set to the number of bytes written to the buffer on
Packit Service 7c31a4
    output. If the buffer is not big enough ``UV_ENOBUFS`` will be returned and
Packit Service 7c31a4
    len will contain the required size.
Packit Service 7c31a4
Packit Service 7c31a4
    .. versionchanged:: 1.3.0 the returned length no longer includes the terminating null byte,
Packit Service 7c31a4
                        and the buffer is not null terminated.
Packit Service 7c31a4
Packit Service 7c31a4
.. c:function:: int uv_pipe_getpeername(const uv_pipe_t* handle, char* buffer, size_t* size)
Packit Service 7c31a4
Packit Service 7c31a4
    Get the name of the Unix domain socket or the named pipe to which the handle
Packit Service 7c31a4
    is connected.
Packit Service 7c31a4
Packit Service 7c31a4
    A preallocated buffer must be provided. The size parameter holds the length
Packit Service 7c31a4
    of the buffer and it's set to the number of bytes written to the buffer on
Packit Service 7c31a4
    output. If the buffer is not big enough ``UV_ENOBUFS`` will be returned and
Packit Service 7c31a4
    len will contain the required size.
Packit Service 7c31a4
Packit Service 7c31a4
    .. versionadded:: 1.3.0
Packit Service 7c31a4
Packit Service 7c31a4
.. c:function:: void uv_pipe_pending_instances(uv_pipe_t* handle, int count)
Packit Service 7c31a4
Packit Service 7c31a4
    Set the number of pending pipe instance handles when the pipe server is
Packit Service 7c31a4
    waiting for connections.
Packit Service 7c31a4
Packit Service 7c31a4
    .. note::
Packit Service 7c31a4
        This setting applies to Windows only.
Packit Service 7c31a4
Packit Service 7c31a4
.. c:function:: int uv_pipe_pending_count(uv_pipe_t* handle)
Packit Service 7c31a4
.. c:function:: uv_handle_type uv_pipe_pending_type(uv_pipe_t* handle)
Packit Service 7c31a4
Packit Service 7c31a4
    Used to receive handles over IPC pipes.
Packit Service 7c31a4
Packit Service 7c31a4
    First - call :c:func:`uv_pipe_pending_count`, if it's > 0 then initialize
Packit Service 7c31a4
    a handle of the given `type`, returned by :c:func:`uv_pipe_pending_type`
Packit Service 7c31a4
    and call ``uv_accept(pipe, handle)``.
Packit Service 7c31a4
Packit Service 7c31a4
.. seealso:: The :c:type:`uv_stream_t` API functions also apply.
Packit Service 7c31a4
Packit Service 7c31a4
.. c:function:: int uv_pipe_chmod(uv_pipe_t* handle, int flags)
Packit Service 7c31a4
Packit Service 7c31a4
    Alters pipe permissions, allowing it to be accessed from processes run by
Packit Service 7c31a4
    different users. Makes the pipe writable or readable by all users. Mode can
Packit Service 7c31a4
    be ``UV_WRITABLE``, ``UV_READABLE`` or ``UV_WRITABLE | UV_READABLE``. This
Packit Service 7c31a4
    function is blocking.
Packit Service 7c31a4
Packit Service 7c31a4
    .. versionadded:: 1.16.0