IEC60870.AppLayerParameters (ExIEC60870 v0.1.0)

Copy Markdown View Source

Application layer parameters shared by IEC 60870-5-101 and IEC 60870-5-104. Corresponds to sCS101_AppLayerParameters in lib60870-C.

Summary

Functions

Decodes an Information Object Address (IOA) according to size_of_ioa (little-endian).

Default parameters for IEC 60870-5-101 (COT=1 or 2, CA=1 or 2, IOA=2 or 3, maxASDU=253). Match lib60870-C defaults (COT=2, CA=2, IOA=3, maxASDU=249) unless overridden.

Default parameters for IEC 60870-5-104 (COT=2, CA=2, IOA=3, maxASDU=249).

Encodes an Information Object Address (IOA) according to size_of_ioa (little-endian).

Returns the byte length of the ASDU header (TypeID + VSQ + COT(+OA) + CA).

Types

t()

@type t() :: %IEC60870.AppLayerParameters{
  max_size_of_asdu: pos_integer(),
  originator_address: 0..255,
  size_of_ca: 1 | 2,
  size_of_cot: 1 | 2,
  size_of_ioa: 1 | 2 | 3,
  size_of_type_id: 1,
  size_of_vsq: 1
}

Functions

decode_ioa(arg1, arg2)

@spec decode_ioa(t(), binary()) ::
  {:ok, non_neg_integer(), binary()} | {:error, :insufficient_data}

Decodes an Information Object Address (IOA) according to size_of_ioa (little-endian).

default_cs101(opts \\ [])

@spec default_cs101(keyword()) :: t()

Default parameters for IEC 60870-5-101 (COT=1 or 2, CA=1 or 2, IOA=2 or 3, maxASDU=253). Match lib60870-C defaults (COT=2, CA=2, IOA=3, maxASDU=249) unless overridden.

default_cs104(opts \\ [])

@spec default_cs104(keyword()) :: t()

Default parameters for IEC 60870-5-104 (COT=2, CA=2, IOA=3, maxASDU=249).

encode_ioa(app_layer_parameters, ioa)

@spec encode_ioa(t(), non_neg_integer()) :: binary()

Encodes an Information Object Address (IOA) according to size_of_ioa (little-endian).

header_length(app_layer_parameters)

@spec header_length(t()) :: pos_integer()

Returns the byte length of the ASDU header (TypeID + VSQ + COT(+OA) + CA).