Packages
ankh
0.14.0
0.17.0
0.16.0
0.15.0
0.14.5
0.14.4
0.14.3
0.14.2
0.14.1
0.14.0
0.13.0
0.12.1
0.12.0
0.11.0
0.10.0
0.9.0
0.8.11
0.8.10
0.8.9
0.8.8
0.8.7
0.8.6
0.8.5
0.8.4
0.8.3
0.8.2
0.8.1
0.8.0
0.7.2
0.7.1
0.7.0
0.6.0
0.5.3
0.5.2
0.5.1
0.5.0
0.4.6
0.4.5
0.4.4
0.4.3
0.4.2
0.4.1
0.4.0
0.3.1
0.3.0
0.1.1
0.1.0
0.0.5
0.0.4
0.0.3
0.0.2
0.0.1
Pure Elixir HTTP/2 implementation
Current section
Files
Jump to
Current section
Files
lib/ankh/transport.ex
defprotocol Ankh.Transport do
@moduledoc """
Transport interface
"""
@typedoc "Transport socket"
@type t :: struct()
@typedoc "Size"
@type size :: non_neg_integer()
@typedoc "Socket"
@type socket :: any()
@typedoc """
Transport options
"""
@type options :: keyword()
@doc """
Creates a new transport with the passed socket
"""
@spec new(t(), socket()) :: {:ok, t()} | {:error, any()}
def new(transport, socket)
@doc """
Accepts a client connection
"""
@spec accept(t(), options()) :: {:ok, t()} | {:error, any()}
def accept(transport, options)
@doc """
Closes the connection
"""
@spec close(t()) :: {:ok, t()} | {:error, any()}
def close(transport)
@doc """
Connects to an host
"""
@spec connect(t(), URI.t(), timeout(), options()) :: {:ok, t()} | {:error, any()}
def connect(transport, uri, timeout, options)
@doc """
Sends data
"""
@spec send(t(), iodata()) :: :ok | {:error, any()}
def send(transport, data)
@doc """
Receives data
"""
@spec recv(t(), size(), timeout()) :: {:ok, iodata()} | {:error, any()}
def recv(transport, size, timeout)
@doc """
Handles transport messages
"""
@spec handle_msg(t(), any()) :: {:ok, iodata()} | {:error, any()}
def handle_msg(transport, message)
@doc """
Returns the transport negotiated protocol if any, nil otherwise
"""
@spec negotiated_protocol(t()) :: {:ok, String.t()} | {:error, :protocol_not_negotiated}
def negotiated_protocol(transport)
end