RCON v0.2.1 RCON.Packet View Source

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 from() View Source
from() :: :client | :server
Link to this type kind() View Source
kind() :: :exec | :exec_resp | :auth | :auth_resp
Link to this type kind_code() View Source
kind_code() :: 0 | 2 | 3

Link to this section Functions

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

Returns the packet ID used for auth failure.

Returns the body for a packet.

Link to this function body_len(packet) View Source
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) View Source
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) View Source
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) View Source
decode_payload(size(), binary(), from()) :: {:ok, t()} | {:error, binary()}

Decodes a packet payload from transmission.

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

Decodes a packet size.

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

Encodes a packet to a binary for transmission.

Returns from what side the packet was sent from.

Returns the ID for a packet.

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

Returns the length in bytes of the packet id part.

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

Returns the initial packet ID value.

Returns the kind for a packet.

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

Returns the packet kind for a code.

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

Returns the length in bytes of the packet kind part.

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

Returns the code for a packet kind.

Link to this function max_body_len() View Source
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.

Returns the max possible value a packet ID may have.

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

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

The smallest value packet size may be.

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

Returns the length in bytes of the packet size part.