Ankh.Transport protocol (ankh v0.12.1)

Transport interface

Link to this section Summary

Types

Transport options

Size

Socket

t()

Transport socket

Functions

Accepts a client connection

Closes the connection

Handles transport messages

Returns the transport negotiated protocol if any, nil otherwise

Link to this section Types

Specs

options() :: Keyword.t()

Transport options

Specs

size() :: non_neg_integer()

Size

Specs

socket() :: any()

Socket

Specs

t() :: struct()

Transport socket

Link to this section Functions

Link to this function

accept(transport, options)

Specs

accept(t(), Keyword.t()) :: {:ok, t()} | {:error, any()}

Accepts a client connection

Link to this function

close(transport)

Specs

close(t()) :: {:ok, t()} | {:error, any()}

Closes the connection

Link to this function

connect(transport, uri, timeout, options)

Specs

connect(t(), URI.t(), timeout(), options()) :: {:ok, t()} | {:error, any()}

Connects to an host

Link to this function

handle_msg(transport, message)

Specs

handle_msg(t(), any()) :: {:ok, iodata()} | {:error, any()}

Handles transport messages

Link to this function

negotiated_protocol(transport)

Specs

negotiated_protocol(t()) ::
  {:ok, String.t()} | {:error, :protocol_not_negotiated}

Returns the transport negotiated protocol if any, nil otherwise

Link to this function

recv(transport, size, timeout)

Specs

recv(t(), size(), timeout()) :: {:ok, iodata()} | {:error, any()}

Receives data

Link to this function

send(transport, data)

Specs

send(t(), iodata()) :: :ok | {:error, any()}

Sends data