blob: b0e161210b1ad83930cd4b8dbbc375cd07447ada [file]
# Copyright 2025 The Fuchsia Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# This stub file is used for both mypy typechecking at compile time, as well as IDE assistance
# via pyright/pylance.
class FcTransportStatus(Exception):
FC_OK: int
FC_ERR_INVALID_ARGS: int
FC_ERR_NOT_SUPPORTED: int
FC_ERR_NOT_FOUND: int
FC_ERR_BUFFER_TOO_SMALL: int
FC_ERR_SHOULD_WAIT: int
FC_ERR_INTERNAL: int
FC_ERR_SOCKET_WRITE: int
FC_ERR_CHANNEL_WRITE: int
FC_ERR_FDOMAIN: int
FC_ERR_PROTOCOL: int
FC_ERR_PROTOCOL_OBJECT_TYPE_INCOMPATIBLE: int
FC_ERR_PROTOCOL_RIGHTS_INCOMPATIBLE: int
FC_ERR_PROTOCOL_STREAM_EVENT_INCOMPATIBLE: int
FC_ERR_TRANSPORT: int
FC_ERR_CONNECTION_MISMATCH: int
FC_ERR_STREAMING_ABORTED: int
def code(self) -> int: ...
def desc(self) -> str | None: ...
def __repr__(self) -> str: ...
def __str__(self) -> str: ...
# TODO(https://fxbug.dev/346628306): It might be less code to define ZxStatus in Python
# instead of exposing it via a C extension. The value of each zx_status_t is
# stable, as they are copied other places, such as in rust-lang.
class ZxStatus(Exception):
ZX_OK: int
ZX_ERR_INTERNAL: int
ZX_ERR_NOT_SUPPORTED: int
ZX_ERR_NO_RESOURCES: int
ZX_ERR_NO_MEMORY: int
ZX_ERR_INVALID_ARGS: int
ZX_ERR_BAD_HANDLE: int
ZX_ERR_WRONG_TYPE: int
ZX_ERR_BAD_SYSCALL: int
ZX_ERR_OUT_OF_RANGE: int
ZX_ERR_BUFFER_TOO_SMALL: int
ZX_ERR_BAD_STATE: int
ZX_ERR_TIMED_OUT: int
ZX_ERR_SHOULD_WAIT: int
ZX_ERR_CANCELED: int
ZX_ERR_PEER_CLOSED: int
ZX_ERR_NOT_FOUND: int
ZX_ERR_ALREADY_EXISTS: int
ZX_ERR_ALREADY_BOUND: int
ZX_ERR_UNAVAILABLE: int
ZX_ERR_ACCESS_DENIED: int
ZX_ERR_IO: int
ZX_ERR_IO_REFUSED: int
ZX_ERR_IO_DATA_INTEGRITY: int
ZX_ERR_IO_DATA_LOSS: int
ZX_ERR_IO_NOT_PRESENT: int
ZX_ERR_IO_OVERRUN: int
ZX_ERR_IO_MISSED_DEADLINE: int
ZX_ERR_IO_INVALID: int
ZX_ERR_BAD_PATH: int
ZX_ERR_NOT_DIR: int
ZX_ERR_NOT_FILE: int
ZX_ERR_FILE_BIG: int
ZX_ERR_NO_SPACE: int
ZX_ERR_NOT_EMPTY: int
ZX_ERR_STOP: int
ZX_ERR_NEXT: int
ZX_ERR_ASYNC: int
ZX_ERR_PROTOCOL_NOT_SUPPORTED: int
ZX_ERR_ADDRESS_UNREACHABLE: int
ZX_ERR_ADDRESS_IN_USE: int
ZX_ERR_NOT_CONNECTED: int
ZX_ERR_CONNECTION_REFUSED: int
ZX_ERR_CONNECTION_RESET: int
ZX_ERR_CONNECTION_ABORTED: int
def raw(self) -> int: ...
def __repr__(self) -> str: ...
def __str__(self) -> str: ...
class InternalHandle: ...
def handle_from_int(handle: int) -> InternalHandle: ...
def handle_as_int(handle: InternalHandle) -> int: ...
def handle_take(handle: InternalHandle) -> int: ...
def handle_koid(handle: InternalHandle) -> int: ...
def context_create(
config: str | None, isolate: str
) -> InternalHandle: ...
def context_connect_device_proxy(
context: InternalHandle, moniker: str, capability: str
) -> InternalHandle: ...
def context_connect_remote_control_proxy(
context: InternalHandle,
) -> InternalHandle: ...
def context_target_wait(
context: InternalHandle, timeout: int, offline: bool
) -> None: ...
def context_config_get_string(context: InternalHandle, key: str) -> str: ...
def channel_read(
channel: InternalHandle,
) -> tuple[bytes, list[InternalHandle]]: ...
def channel_write(
channel: InternalHandle, buffer: bytes, handle_dispositions: bytes
) -> None: ...
def channel_as_int(channel: InternalHandle) -> int: ...
def channel_take(channel: InternalHandle) -> int: ...
def channel_create(context: InternalHandle) -> tuple[InternalHandle, InternalHandle]: ...
def channel_from_int(handle: int) -> InternalHandle: ...
def channel_koid(channel: InternalHandle) -> int: ...
def socket_read(socket: InternalHandle) -> bytes: ...
def socket_write(socket: InternalHandle, buffer: bytes) -> int: ...
def socket_as_int(socket: InternalHandle) -> int: ...
def socket_take(socket: InternalHandle) -> int: ...
def socket_create(context: InternalHandle, options: int) -> tuple[InternalHandle, InternalHandle]: ...
def connect_handle_notifier() -> int: ...
def socket_from_int(handle: int) -> InternalHandle: ...
def socket_koid(socket: InternalHandle) -> int: ...
def event_from_int(handle: int) -> InternalHandle: ...
def event_as_int(event: InternalHandle) -> int: ...
def event_take(event: InternalHandle) -> int: ...
def event_signal_peer(
event: InternalHandle, clear_mask: int, set_mask: int
) -> None: ...
def event_create(context: InternalHandle) -> InternalHandle: ...
def event_create_pair(context: InternalHandle) -> tuple[InternalHandle, InternalHandle]: ...
def event_koid(event: InternalHandle) -> int: ...
def isolate_dir_create(dir: str | None) -> InternalHandle: ...
def isolate_dir_get_path(isolate_dir: InternalHandle) -> str: ...
def _block_forever() -> None: ...