# `IEC60870.AppLayerParameters`
[🔗](https://github.com/Ultraluv/ex_iec60870/blob/main/lib/iec60870/app_layer_parameters.ex#L1)

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

# `t`

```elixir
@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
}
```

# `decode_ioa`

```elixir
@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`

```elixir
@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`

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

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

# `encode_ioa`

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

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

# `header_length`

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

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

---

*Consult [api-reference.md](api-reference.md) for complete listing*
