ccsds_frame_protocol — Logtalk 3.100.1

protocol

# `ccsds_frame_protocol`

CCSDS transfer frame parser and generator protocol.

Availability:
`logtalk_load(ccsds_frames(loader))`
Author: Paulo Moura
Version: 1:0:0
Date: 2026-05-08
Compilation flags:
`static`
Dependencies:
(none)
Remarks:
(none)
Inherited public predicates:
(none)

## Public predicates

### `parse/2`

Parses CCSDS transfer frame(s) from a source. Supported source terms are `file(File)`, `stream(Stream)`, and `bytes(Bytes)`.

Compilation flags:
`static`
Template:
`parse(Source,Frames)`
Mode and number of proofs:
`parse(+compound,-list(compound))` - `one_or_error`

### `generate/2`

Generates CCSDS transfer frame bytes to a sink. Supported sink terms are `file(File)`, `stream(Stream)`, and `bytes(Bytes)`.

Compilation flags:
`static`
Template:
`generate(Sink,Frames)`
Mode and number of proofs:
`generate(+compound,+list(compound))` - `one_or_error`

### `generate/3`

Generates a list of bytes from a single CCSDS transfer frame term with an open tail. When the selected object includes an FECF, the generated bytes use a freshly computed FECF derived from the remaining frame fields.

Compilation flags:
`static`
Template:
`generate(Frame,Bytes,Tail)`
Mode and number of proofs:
`generate(+compound,-list(byte),--variable)` - `one_or_error`

### `valid/1`

True if the argument is a valid transfer frame term for the selected object and, when applicable, carries the correct FECF for the remaining frame fields.

Compilation flags:
`static`
Template:
`valid(Frame)`
Mode and number of proofs:
`valid(@compound)` - `zero_or_one`

### `update_fecf/2`

Computes the correct frame error control field for the selected object configuration and returns the corresponding updated frame term.

Compilation flags:
`static`
Template:
`update_fecf(Frame,UpdatedFrame)`
Mode and number of proofs:
`update_fecf(+compound,-compound)` - `one_or_error`

### `verify_fecf/1`

True if the frame term contains the correct FECF for the selected object configuration.

Compilation flags:
`static`
Template:
`verify_fecf(Frame)`
Mode and number of proofs:
`verify_fecf(@compound)` - `zero_or_one`

### `frame_type/2`

Returns the transfer frame type for a frame term.

Compilation flags:
`static`
Template:
`frame_type(Frame,Type)`
Mode and number of proofs:
`frame_type(+compound,-atom)` - `one`

### `version/2`

Extracts the transfer frame version number.

Compilation flags:
`static`
Template:
`version(Frame,Version)`
Mode and number of proofs:
`version(+compound,-integer)` - `one`

### `spacecraft_id/2`

Extracts the spacecraft identifier.

Compilation flags:
`static`
Template:
`spacecraft_id(Frame,SpacecraftId)`
Mode and number of proofs:
`spacecraft_id(+compound,-integer)` - `one`

### `virtual_channel_id/2`

Extracts the virtual channel identifier.

Compilation flags:
`static`
Template:
`virtual_channel_id(Frame,VirtualChannelId)`
Mode and number of proofs:
`virtual_channel_id(+compound,-integer)` - `one`

### `data_field/2`

Extracts the transfer frame data field as a list of bytes.

Compilation flags:
`static`
Template:
`data_field(Frame,DataField)`
Mode and number of proofs:
`data_field(+compound,-list(byte))` - `one`

### `ocf/2`

Extracts the operational control field. Returns `none` when absent.

Compilation flags:
`static`
Template:
`ocf(Frame,OCF)`
Mode and number of proofs:
`ocf(+compound,-compound)` - `one`

### `fecf/2`

Extracts the frame error control field. Returns `none` when absent.

Compilation flags:
`static`
Template:
`fecf(Frame,FECF)`
Mode and number of proofs:
`fecf(+compound,-compound)` - `one`

## Protected predicates

(none)

## Private predicates

(none)

## Operators

(none)