object

ccsds_packet_services

Helpers for CCSDS packet service packet-zone splitting and cross-frame TM/AOS packet reassembly.

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

Public predicates

valid_reassembly_state/1

True if the argument is a valid packet reassembly state term.

Compilation flags:
static
Template:
valid_reassembly_state(State)
Mode and number of proofs:
valid_reassembly_state(@compound) - zero_or_one

initial_reassembly_state/1

Returns the initial cross-frame packet reassembly state.

Compilation flags:
static
Template:
initial_reassembly_state(State)
Mode and number of proofs:
initial_reassembly_state(-compound) - one

pending_data/2

Extracts the currently buffered trailing packet fragment bytes from a packet reassembly state.

Compilation flags:
static
Template:
pending_data(State,Bytes)
Mode and number of proofs:
pending_data(+compound,-list(byte)) - one

valid_channel_reassembly_state/1

True if the argument is a valid frame-channel packet reassembly state term keyed by frame type, spacecraft identifier, and virtual channel identifier.

Compilation flags:
static
Template:
valid_channel_reassembly_state(State)
Mode and number of proofs:
valid_channel_reassembly_state(@compound) - zero_or_one

initial_channel_reassembly_state/1

Returns the initial frame-channel packet reassembly state.

Compilation flags:
static
Template:
initial_channel_reassembly_state(State)
Mode and number of proofs:
initial_channel_reassembly_state(-compound) - one

pending_fragments/2

Extracts the non-empty pending packet fragments buffered per frame type, spacecraft identifier, and virtual channel identifier.

Compilation flags:
static
Template:
pending_fragments(State,PendingFragments)
Mode and number of proofs:
pending_fragments(+compound,-list(compound)) - one

valid_discontinuity_policy/1

True if the argument is a valid discontinuity recovery policy atom. Valid values are throw, drop, and resynchronize.

Compilation flags:
static
Template:
valid_discontinuity_policy(Policy)
Mode and number of proofs:
valid_discontinuity_policy(@atom) - zero_or_one

valid/1

True if the argument is a valid packet-zone term.

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

prefix_data/2

Extracts the bytes that precede the first complete packet in a packet zone.

Compilation flags:
static
Template:
prefix_data(PacketZone,PrefixData)
Mode and number of proofs:
prefix_data(+compound,-list(byte)) - one

packets/2

Extracts the list of complete packets in a packet zone.

Compilation flags:
static
Template:
packets(PacketZone,Packets)
Mode and number of proofs:
packets(+compound,-list(compound)) - one

suffix_data/2

Extracts the bytes that trail the last complete packet in a packet zone.

Compilation flags:
static
Template:
suffix_data(PacketZone,SuffixData)
Mode and number of proofs:
suffix_data(+compound,-list(byte)) - one

split_packet_zone/4

Splits a packet-zone byte sequence using the first header pointer and parses any complete packets starting at that offset. A pointer value of 2047 denotes that no packet starts in the zone.

Compilation flags:
static
Template:
split_packet_zone(Bytes,FirstHeaderPointer,SecondaryHeaderLength,PacketZone)
Mode and number of proofs:
split_packet_zone(+list(byte),+integer,+integer,-compound) - one_or_error

join_packet_zone/4

Encodes a packet-zone term back into bytes and returns the corresponding first header pointer. When the packet list is empty, the pointer is set to 2047.

Compilation flags:
static
Template:
join_packet_zone(PacketZone,SecondaryHeaderLength,Bytes,FirstHeaderPointer)
Mode and number of proofs:
join_packet_zone(+compound,+integer,-list(byte),-integer) - one_or_error

extract_tm_packets/3

Extracts a TM transfer frame packet zone as a packet-zone term using the frame first header pointer and the given packet secondary header length.

Compilation flags:
static
Template:
extract_tm_packets(Frame,SecondaryHeaderLength,PacketZone)
Mode and number of proofs:
extract_tm_packets(+compound,+integer,-compound) - one_or_error

insert_tm_packets/4

Updates a TM transfer frame data field and first header pointer from a packet-zone term while preserving the remaining frame fields unchanged.

Compilation flags:
static
Template:
insert_tm_packets(PacketZone,SecondaryHeaderLength,Frame,UpdatedFrame)
Mode and number of proofs:
insert_tm_packets(+compound,+integer,+compound,-compound) - one_or_error

split_aos_packet_zone/3

Splits an AOS M_PDU packet-service data field into a packet-zone term. The first two octets are interpreted as the M_PDU first header pointer field, where 2046 denotes idle data only and 2047 denotes that no packet starts in the packet zone.

Compilation flags:
static
Template:
split_aos_packet_zone(Bytes,SecondaryHeaderLength,PacketZone)
Mode and number of proofs:
split_aos_packet_zone(+list(byte),+integer,-compound) - one_or_error

join_aos_packet_zone/3

Encodes a packet-zone term as an AOS M_PDU packet-service data field, including the two-octet first header pointer field.

Compilation flags:
static
Template:
join_aos_packet_zone(PacketZone,SecondaryHeaderLength,Bytes)
Mode and number of proofs:
join_aos_packet_zone(+compound,+integer,-list(byte)) - one_or_error

reassemble_packet_zone/5

Reassembles complete packets from a packet-zone term and a prior packet reassembly state, returning any complete packets plus the updated trailing fragment state.

Compilation flags:
static
Template:
reassemble_packet_zone(PacketZone,SecondaryHeaderLength,State,Packets,UpdatedState)
Mode and number of proofs:
reassemble_packet_zone(+compound,+integer,+compound,-list(compound),-compound) - one_or_error

extract_aos_packets/3

Extracts an AOS transfer frame packet zone as a packet-zone term using the two-octet M_PDU header at the beginning of the frame data field.

Compilation flags:
static
Template:
extract_aos_packets(Frame,SecondaryHeaderLength,PacketZone)
Mode and number of proofs:
extract_aos_packets(+compound,+integer,-compound) - one_or_error

insert_aos_packets/4

Updates an AOS transfer frame data field from a packet-zone term by regenerating the M_PDU first header pointer and packet-zone bytes while preserving the remaining frame fields unchanged.

Compilation flags:
static
Template:
insert_aos_packets(PacketZone,SecondaryHeaderLength,Frame,UpdatedFrame)
Mode and number of proofs:
insert_aos_packets(+compound,+integer,+compound,-compound) - one_or_error

reassemble_tm_packets/5

Extracts the packet zone from a TM transfer frame, using the default throw discontinuity recovery policy, and returns the complete packets plus the updated channel reassembly state.

Compilation flags:
static
Template:
reassemble_tm_packets(Frame,SecondaryHeaderLength,State,Packets,UpdatedState)
Mode and number of proofs:
reassemble_tm_packets(+compound,+integer,+compound,-list(compound),-compound) - one_or_error

reassemble_tm_packets/6

Extracts the packet zone from a TM transfer frame, applies the selected discontinuity recovery policy when frame-count continuity is broken, and returns the complete packets plus the updated channel reassembly state.

Compilation flags:
static
Template:
reassemble_tm_packets(Frame,SecondaryHeaderLength,Policy,State,Packets,UpdatedState)
Mode and number of proofs:
reassemble_tm_packets(+compound,+integer,+atom,+compound,-list(compound),-compound) - one_or_error

reassemble_tm_packets/7

Extracts the packet zone from a TM transfer frame, applies the selected discontinuity recovery policy when frame-count continuity is broken, and returns the complete packets, updated channel reassembly state, and explicit recovery events.

Compilation flags:
static
Template:
reassemble_tm_packets(Frame,SecondaryHeaderLength,Policy,State,Packets,UpdatedState,Events)
Mode and number of proofs:
reassemble_tm_packets(+compound,+integer,+atom,+compound,-list(compound),-compound,-list(compound)) - one_or_error

reassemble_tm_frames/5

Reassembles complete packets across a sequence of TM transfer frames using the default throw discontinuity recovery policy.

Compilation flags:
static
Template:
reassemble_tm_frames(Frames,SecondaryHeaderLength,State,Packets,UpdatedState)
Mode and number of proofs:
reassemble_tm_frames(+list(compound),+integer,+compound,-list(compound),-compound) - one_or_error

reassemble_tm_frames/6

Reassembles complete packets across a sequence of TM transfer frames using the selected discontinuity recovery policy.

Compilation flags:
static
Template:
reassemble_tm_frames(Frames,SecondaryHeaderLength,Policy,State,Packets,UpdatedState)
Mode and number of proofs:
reassemble_tm_frames(+list(compound),+integer,+atom,+compound,-list(compound),-compound) - one_or_error

reassemble_tm_frames/7

Reassembles complete packets across a sequence of TM transfer frames using the selected discontinuity recovery policy and returns any recovery events in frame order.

Compilation flags:
static
Template:
reassemble_tm_frames(Frames,SecondaryHeaderLength,Policy,State,Packets,UpdatedState,Events)
Mode and number of proofs:
reassemble_tm_frames(+list(compound),+integer,+atom,+compound,-list(compound),-compound,-list(compound)) - one_or_error

reassemble_aos_packets/5

Extracts the packet zone from an AOS transfer frame, using the default throw discontinuity recovery policy, and returns the complete packets plus the updated channel reassembly state.

Compilation flags:
static
Template:
reassemble_aos_packets(Frame,SecondaryHeaderLength,State,Packets,UpdatedState)
Mode and number of proofs:
reassemble_aos_packets(+compound,+integer,+compound,-list(compound),-compound) - one_or_error

reassemble_aos_packets/6

Extracts the packet zone from an AOS transfer frame, applies the selected discontinuity recovery policy when frame-count continuity is broken, and returns the complete packets plus the updated channel reassembly state.

Compilation flags:
static
Template:
reassemble_aos_packets(Frame,SecondaryHeaderLength,Policy,State,Packets,UpdatedState)
Mode and number of proofs:
reassemble_aos_packets(+compound,+integer,+atom,+compound,-list(compound),-compound) - one_or_error

reassemble_aos_packets/7

Extracts the packet zone from an AOS transfer frame, applies the selected discontinuity recovery policy when frame-count continuity is broken, and returns the complete packets, updated channel reassembly state, and explicit recovery events.

Compilation flags:
static
Template:
reassemble_aos_packets(Frame,SecondaryHeaderLength,Policy,State,Packets,UpdatedState,Events)
Mode and number of proofs:
reassemble_aos_packets(+compound,+integer,+atom,+compound,-list(compound),-compound,-list(compound)) - one_or_error

reassemble_aos_frames/5

Reassembles complete packets across a sequence of AOS transfer frames using the default throw discontinuity recovery policy.

Compilation flags:
static
Template:
reassemble_aos_frames(Frames,SecondaryHeaderLength,State,Packets,UpdatedState)
Mode and number of proofs:
reassemble_aos_frames(+list(compound),+integer,+compound,-list(compound),-compound) - one_or_error

reassemble_aos_frames/6

Reassembles complete packets across a sequence of AOS transfer frames using the selected discontinuity recovery policy.

Compilation flags:
static
Template:
reassemble_aos_frames(Frames,SecondaryHeaderLength,Policy,State,Packets,UpdatedState)
Mode and number of proofs:
reassemble_aos_frames(+list(compound),+integer,+atom,+compound,-list(compound),-compound) - one_or_error

reassemble_aos_frames/7

Reassembles complete packets across a sequence of AOS transfer frames using the selected discontinuity recovery policy and returns any recovery events in frame order.

Compilation flags:
static
Template:
reassemble_aos_frames(Frames,SecondaryHeaderLength,Policy,State,Packets,UpdatedState,Events)
Mode and number of proofs:
reassemble_aos_frames(+list(compound),+integer,+atom,+compound,-list(compound),-compound,-list(compound)) - one_or_error

Protected predicates

(no local declarations; see entity ancestors if any)

Private predicates

(no local declarations; see entity ancestors if any)

Operators

(none)