IEC60870.FileService.TransparentFile (ExIEC60870 v0.1.0)

Copy Markdown View Source

Represents a file composed of one or more binary sections for IEC 60870-5-101/104 File Transfer (CS101_IFileProvider / CS101_TransparentFile in cs101_file_service.h).

Summary

Functions

Extracts a segment binary from section_index (0-based) starting at offset with size.

Creates a new TransparentFile with (nof, data).

Creates a new TransparentFile with (nof, name, data) or (nof, data, opts).

Creates a new TransparentFile with (nof, name, data, opts).

Creates a new TransparentFile from a single binary or a list of section binaries.

Returns the byte size of section section_index (0-based), or 0 if out of range.

Concatenates all sections into a single binary.

Types

t()

@type t() :: %IEC60870.FileService.TransparentFile{
  ca: non_neg_integer(),
  created_at: IEC60870.Types.CPTime.CP56Time2a.t(),
  data: binary() | nil,
  ioa: non_neg_integer(),
  name: String.t() | nil,
  nof: non_neg_integer(),
  on_complete: (boolean() -> any()) | nil,
  sections: [binary()],
  sof: non_neg_integer()
}

Functions

add_section(file, section_bin)

@spec add_section(t(), binary()) :: t()

file_size(transparent_file)

@spec file_size(t()) :: non_neg_integer()

get_segment_data(transparent_file, section_index, offset, size)

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

Extracts a segment binary from section_index (0-based) starting at offset with size.

new(nof, data)

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

Creates a new TransparentFile with (nof, data).

new(nof, name, data)

@spec new(non_neg_integer(), String.t() | binary(), binary() | keyword()) :: t()

Creates a new TransparentFile with (nof, name, data) or (nof, data, opts).

new(nof, name, data, opts)

@spec new(non_neg_integer(), String.t(), binary(), keyword()) :: t()

Creates a new TransparentFile with (nof, name, data, opts).

new(ca, ioa, nof, data_or_sections, opts \\ [])

@spec new(
  non_neg_integer(),
  non_neg_integer(),
  non_neg_integer(),
  binary() | [binary()],
  keyword()
) ::
  t()

Creates a new TransparentFile from a single binary or a list of section binaries.

section_size(transparent_file, section_index)

@spec section_size(t(), non_neg_integer()) :: non_neg_integer()

Returns the byte size of section section_index (0-based), or 0 if out of range.

to_binary(transparent_file)

@spec to_binary(t()) :: binary()

Concatenates all sections into a single binary.