Module spin_sdk.wit.imports.wasi_sockets_network_0_2_0

Classes

class ErrorCode (*args, **kwds)
Expand source code
class ErrorCode(Enum):
    """
    Error codes.
    
    In theory, every API can return any error code.
    In practice, API's typically only return the errors documented per API
    combined with a couple of errors that are always possible:
    - `unknown`
    - `access-denied`
    - `not-supported`
    - `out-of-memory`
    - `concurrency-conflict`
    
    See each individual API for what the POSIX equivalents are. They sometimes differ per API.
    """
    UNKNOWN = 0
    ACCESS_DENIED = 1
    NOT_SUPPORTED = 2
    INVALID_ARGUMENT = 3
    OUT_OF_MEMORY = 4
    TIMEOUT = 5
    CONCURRENCY_CONFLICT = 6
    NOT_IN_PROGRESS = 7
    WOULD_BLOCK = 8
    INVALID_STATE = 9
    NEW_SOCKET_LIMIT = 10
    ADDRESS_NOT_BINDABLE = 11
    ADDRESS_IN_USE = 12
    REMOTE_UNREACHABLE = 13
    CONNECTION_REFUSED = 14
    CONNECTION_RESET = 15
    CONNECTION_ABORTED = 16
    DATAGRAM_TOO_LARGE = 17
    NAME_UNRESOLVABLE = 18
    TEMPORARY_RESOLVER_FAILURE = 19
    PERMANENT_RESOLVER_FAILURE = 20

Error codes.

In theory, every API can return any error code. In practice, API's typically only return the errors documented per API combined with a couple of errors that are always possible: - unknown - access-denied - not-supported - out-of-memory - concurrency-conflict

See each individual API for what the POSIX equivalents are. They sometimes differ per API.

Ancestors

  • enum.Enum

Class variables

var ACCESS_DENIED
var ADDRESS_IN_USE
var ADDRESS_NOT_BINDABLE
var CONCURRENCY_CONFLICT
var CONNECTION_ABORTED
var CONNECTION_REFUSED
var CONNECTION_RESET
var DATAGRAM_TOO_LARGE
var INVALID_ARGUMENT
var INVALID_STATE
var NAME_UNRESOLVABLE
var NEW_SOCKET_LIMIT
var NOT_IN_PROGRESS
var NOT_SUPPORTED
var OUT_OF_MEMORY
var PERMANENT_RESOLVER_FAILURE
var REMOTE_UNREACHABLE
var TEMPORARY_RESOLVER_FAILURE
var TIMEOUT
var UNKNOWN
var WOULD_BLOCK
class IpAddressFamily (*args, **kwds)
Expand source code
class IpAddressFamily(Enum):
    IPV4 = 0
    IPV6 = 1

Create a collection of name/value pairs.

Example enumeration:

>>> class Color(Enum):
...     RED = 1
...     BLUE = 2
...     GREEN = 3

Access them by:

  • attribute access:

Color.RED

  • value lookup:

Color(1)

  • name lookup:

Color['RED']

Enumerations can be iterated over, and know how many members they have:

>>> len(Color)
3
>>> list(Color)
[<Color.RED: 1>, <Color.BLUE: 2>, <Color.GREEN: 3>]

Methods can be added to enumerations, and members can have their own attributes – see the documentation for details.

Ancestors

  • enum.Enum

Class variables

var IPV4
var IPV6
class IpAddress_Ipv4 (value: Tuple[int, int, int, int])
Expand source code
@dataclass
class IpAddress_Ipv4:
    value: Tuple[int, int, int, int]

IpAddress_Ipv4(value: Tuple[int, int, int, int])

Instance variables

var value : Tuple[int, int, int, int]
class IpAddress_Ipv6 (value: Tuple[int, int, int, int, int, int, int, int])
Expand source code
@dataclass
class IpAddress_Ipv6:
    value: Tuple[int, int, int, int, int, int, int, int]

IpAddress_Ipv6(value: Tuple[int, int, int, int, int, int, int, int])

Instance variables

var value : Tuple[int, int, int, int, int, int, int, int]
class IpSocketAddress_Ipv4 (value: Ipv4SocketAddress)
Expand source code
@dataclass
class IpSocketAddress_Ipv4:
    value: Ipv4SocketAddress

IpSocketAddress_Ipv4(value: spin_sdk.wit.imports.wasi_sockets_network_0_2_0.Ipv4SocketAddress)

Instance variables

var valueIpv4SocketAddress
class IpSocketAddress_Ipv6 (value: Ipv6SocketAddress)
Expand source code
@dataclass
class IpSocketAddress_Ipv6:
    value: Ipv6SocketAddress

IpSocketAddress_Ipv6(value: spin_sdk.wit.imports.wasi_sockets_network_0_2_0.Ipv6SocketAddress)

Instance variables

var valueIpv6SocketAddress
class Ipv4SocketAddress (port: int, address: Tuple[int, int, int, int])
Expand source code
@dataclass
class Ipv4SocketAddress:
    port: int
    address: Tuple[int, int, int, int]

Ipv4SocketAddress(port: int, address: Tuple[int, int, int, int])

Instance variables

var address : Tuple[int, int, int, int]
var port : int
class Ipv6SocketAddress (port: int,
flow_info: int,
address: Tuple[int, int, int, int, int, int, int, int],
scope_id: int)
Expand source code
@dataclass
class Ipv6SocketAddress:
    port: int
    flow_info: int
    address: Tuple[int, int, int, int, int, int, int, int]
    scope_id: int

Ipv6SocketAddress(port: int, flow_info: int, address: Tuple[int, int, int, int, int, int, int, int], scope_id: int)

Instance variables

var address : Tuple[int, int, int, int, int, int, int, int]
var flow_info : int
var port : int
var scope_id : int
class Network
Expand source code
class Network:
    """
    An opaque resource that represents access to (a subset of) the network.
    This enables context-based security for networking.
    There is no need for this to map 1:1 to a physical network interface.
    """
    
    def __enter__(self) -> Self:
        """Returns self"""
        return self
                                
    def __exit__(self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None) -> bool | None:
        """
        Release this resource.
        """
        raise NotImplementedError

An opaque resource that represents access to (a subset of) the network. This enables context-based security for networking. There is no need for this to map 1:1 to a physical network interface.