rcon v0.2.0 RCON.Packet

Module for handling RCON packets.

Link to this section Summary

Functions

Returns the packet ID used for auth failure

Returns the body for a packet

Returns the body length in bytes for a packet

Creates and encodes a packet in one step

Decodes a packet payload from transmission

Decodes a packet size

Encodes a packet to a binary for transmission

Returns from what side the packet was sent from

Returns the ID for a packet

Returns the length in bytes of the packet id part

Returns the initial packet ID value

Returns the kind for a packet

Returns the packet kind for a code

Returns the length in bytes of the packet kind part

Returns the code for a packet kind

Returns the maximum size a body may have

Returns the max possible value a packet ID may have

The smallest value packet size may be

Returns the length in bytes of the packet size part

Link to this section Types

Link to this type body()
body() :: binary()
Link to this type from()
from() :: :client | :server
Link to this type kind()
kind() :: :exec | :exec_resp | :auth | :auth_resp
Link to this type kind_code()
kind_code() :: 0 | 2 | 3
Link to this type raw()
raw() :: binary()
Link to this type size()
size() :: integer()
Link to this type t()
t() :: {kind(), id(), body(), from()}

Link to this section Functions

Link to this function auth_failed_id()
auth_failed_id() :: id()

Returns the packet ID used for auth failure.

Link to this function body(arg)
body(t()) :: body()

Returns the body for a packet.

Link to this function body_len(arg)
body_len(t()) :: integer()

Returns the body length in bytes for a packet.

Does not include the null character.

Link to this function create(kind, body, id \\ 0, from \\ :client)
create(kind(), body(), id(), from()) :: {:ok, t()} | {:error, binary()}

Creates a packet.

Link to this function create_and_encode(kind, body, id \\ 0, from \\ :client)
create_and_encode(kind(), body(), id(), from()) ::
  {:ok, raw()} | {:error, binary()}

Creates and encodes a packet in one step.

Link to this function decode_payload(size, payload, from \\ :server)
decode_payload(size(), binary(), from()) :: {:ok, t()} | {:error, binary()}

Decodes a packet payload from transmission.

Link to this function decode_size(size_bytes)
decode_size(binary()) :: {:ok, size()} | {:error, binary()}

Decodes a packet size.

Link to this function encode(packet)
encode(t()) :: {:ok, raw()} | {:error, binary()}

Encodes a packet to a binary for transmission.

Link to this function from(arg)
from(t()) :: from()

Returns from what side the packet was sent from.

Link to this function id(arg)
id(t()) :: id()

Returns the ID for a packet.

Link to this function id_part_len()
id_part_len() :: integer()

Returns the length in bytes of the packet id part.

Link to this function initial_id()
initial_id() :: id()

Returns the initial packet ID value.

Link to this function kind(arg)
kind(t()) :: kind()

Returns the kind for a packet.

Link to this function kind_from_code(arg1, arg2)
kind_from_code(kind_code(), from()) :: {:ok, kind()} | {:error, binary()}

Returns the packet kind for a code.

Link to this function kind_part_len()
kind_part_len() :: integer()

Returns the length in bytes of the packet kind part.

Link to this function kind_to_code(arg1, arg2)
kind_to_code(kind(), from()) :: {:ok, kind_code()} | {:error, binary()}

Returns the code for a packet kind.

Link to this function max_body_len()
max_body_len() :: integer()

Returns the maximum size a body may have.

Minecraft only supports a request payload length of max 1446 byte. However some tests showed that only requests with a payload length of 1413 byte or lower work reliably.

Link to this function max_id()
max_id() :: id()

Returns the max possible value a packet ID may have.

Value from signed int32 max (2^31 - 1).

Link to this function min_size()
min_size() :: size()

The smallest value packet size may be.

Link to this function size_part_len()
size_part_len() :: integer()

Returns the length in bytes of the packet size part.