aos

package
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 2, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package aos implements the CCSDS Advanced Orbiting Systems (AOS) Space Data Link Protocol per CCSDS 732.0-B-4.

AOS Transfer Frames carry one of three PDU types per Virtual Channel: Multiplexing PDUs (M_PDU) for variable-length packets, Bitstream PDUs (B_PDU) for octet-aligned bitstreams, or Virtual Channel Access SDUs (VCA) for opaque data. Frames are fixed-length on a physical channel and may include an Insert Zone, Operational Control Field, and a 16-bit Frame Error Control Field.

Index

Constants

View Source
const (
	// MPDUHeaderSize is the encoded size of the M_PDU header in bytes.
	MPDUHeaderSize = 2
	// MPDUMaxFirstHeaderPointer is the maximum value of the 11-bit FHP.
	MPDUMaxFirstHeaderPointer = 0x07FF
	// FHPNoPacketStart marks a frame in which no packet starts
	// (CCSDS 732.0-B-4 clause 4.1.4.2.3.4: FHP set to 'all ones').
	FHPNoPacketStart uint16 = 0x07FF
	// FHPAllIdle marks an M_PDU that contains only idle data
	// (CCSDS 732.0-B-4 clause 4.1.4.2.3.5: FHP set to 'all ones minus one').
	FHPAllIdle uint16 = 0x07FE
)

M_PDU header constants (CCSDS 732.0-B-4 clause 4.1.4.2).

View Source
const (
	// BPDUHeaderSize is the encoded size of the B_PDU header in bytes.
	BPDUHeaderSize = 2
	// BPDUMaxBitstreamDataPointer is the maximum value of the 14-bit BDP.
	BPDUMaxBitstreamDataPointer = 0x3FFF
	// BDPAllValid indicates the bitstream contains no end-of-data within this frame.
	BDPAllValid uint16 = 0x3FFF
	// BDPAllIdle indicates the bitstream is entirely idle fill.
	BDPAllIdle uint16 = 0x3FFE
)

B_PDU header constants (CCSDS 732.0-B-4 clause 4.1.4.3).

View Source
const DefaultIdleFill byte = 0xFE

DefaultIdleFill is the idle fill byte used when ChannelConfig.IdlePattern is empty. The idle pattern is a mission-managed parameter; override it via ChannelConfig.IdlePattern.

View Source
const FECFSize = 2

FECFSize is the size of the Frame Error Control Field in bytes.

View Source
const FHECSize = 2

FHECSize is the size of the Frame Header Error Control field in bytes.

View Source
const MaxVCFrameCount = 0xFFFFFF

MaxVCFrameCount is the maximum value of the 24-bit VC Frame Count.

View Source
const OCFSize = 4

OCFSize is the size of the Operational Control Field in bytes.

View Source
const OIDVCID = 63

OIDVCID is the Virtual Channel ID reserved for Only Idle Data frames.

View Source
const PrimaryHeaderSize = 6

PrimaryHeaderSize is the fixed size of the AOS primary header in bytes.

View Source
const TFVN = 1 // 0b01

TFVN is the AOS Transfer Frame Version Number (CCSDS 732.0-B-4).

Variables

View Source
var (
	// ErrDataTooShort indicates the provided data is too short for decoding.
	ErrDataTooShort = errors.New("provided data is too short to decode")

	// ErrInvalidVersion indicates the TFVN is not 1 (0b01) for AOS.
	ErrInvalidVersion = errors.New("invalid version: TFVN must be 1 (0b01) for AOS")

	// ErrInvalidSpacecraftID indicates the spacecraft ID is out of range.
	ErrInvalidSpacecraftID = errors.New("invalid spacecraft ID: must be in range 0-255 (8 bits)")

	// ErrInvalidVCID indicates the virtual channel ID is out of range.
	ErrInvalidVCID = errors.New("invalid virtual channel ID: must be in range 0-63 (6 bits)")

	// ErrInvalidVCFrameCount indicates the VC frame count exceeds 24 bits.
	ErrInvalidVCFrameCount = errors.New("invalid VC frame count: exceeds 24 bits")

	// ErrInvalidVCFrameCountCycle indicates the VC frame count cycle is out of range.
	ErrInvalidVCFrameCountCycle = errors.New("invalid VC frame count cycle: must be in range 0-15 (4 bits)")

	// ErrInvalidFirstHeaderPointer indicates the M_PDU first header pointer is out of range.
	ErrInvalidFirstHeaderPointer = errors.New("invalid first header pointer: exceeds 11 bits")

	// ErrInvalidBitstreamDataPointer indicates the B_PDU bitstream data pointer is out of range.
	ErrInvalidBitstreamDataPointer = errors.New("invalid bitstream data pointer: exceeds 14 bits")

	// ErrCRCMismatch indicates the received CRC does not match the computed CRC.
	ErrCRCMismatch = errors.New("CRC mismatch: received CRC does not match computed CRC")

	// ErrInvalidSignalingSpare indicates the reserved spare bits of the
	// signaling field are not zero.
	ErrInvalidSignalingSpare = errors.New("invalid signaling field: reserved spare bits must be 00")

	// ErrFHECMismatch indicates the Frame Header Error Control check symbols
	// do not match the protected header octets.
	ErrFHECMismatch = errors.New("FHEC mismatch: header error control check failed")

	// ErrBitstreamTooLongForPointer indicates a partial bitstream cannot be
	// expressed by the 14-bit Bitstream Data Pointer.
	ErrBitstreamTooLongForPointer = errors.New("partial bitstream exceeds what the bitstream data pointer can express")

	// ErrDataTooLarge indicates the data field exceeds the maximum frame length.
	ErrDataTooLarge = errors.New("data field exceeds maximum frame length")

	// ErrEmptyData indicates that the provided data is empty.
	ErrEmptyData = errors.New("data cannot be empty")

	// ErrSizeMismatch indicates the data size does not match the expected fixed size.
	ErrSizeMismatch = errors.New("data size does not match expected fixed size")

	// ErrInvalidOCFLength indicates the OCF is not exactly 4 bytes.
	ErrInvalidOCFLength = errors.New("operational control field must be exactly 4 bytes when present")

	// ErrInvalidInsertZoneLength indicates the insert zone length does not match channel config.
	ErrInvalidInsertZoneLength = errors.New("insert zone length does not match configured length")

	// ErrSCIDMismatch indicates the frame SCID does not match the master channel SCID.
	ErrSCIDMismatch = errors.New("frame SCID does not match master channel SCID")

	// ErrVirtualChannelNotFound indicates no virtual channel exists for the given VCID.
	ErrVirtualChannelNotFound = errors.New("virtual channel not found for specified VCID")

	// ErrDataFieldTooSmall indicates the data field capacity is too small for framing.
	ErrDataFieldTooSmall = errors.New("data field capacity too small")

	// ErrNoPacketSizer indicates no PacketSizer has been set on the M_PDU service.
	ErrNoPacketSizer = errors.New("no PacketSizer configured: call SetPacketSizer before Receive")

	// ErrNoFramesAvailable aliases sdl.ErrNoFramesAvailable.
	ErrNoFramesAvailable = sdl.ErrNoFramesAvailable

	// ErrBufferFull aliases sdl.ErrBufferFull.
	ErrBufferFull = sdl.ErrBufferFull

	// ErrServiceNotFound aliases sdl.ErrServiceNotFound.
	ErrServiceNotFound = sdl.ErrServiceNotFound

	// ErrMasterChannelNotFound aliases sdl.ErrMasterChannelNotFound.
	ErrMasterChannelNotFound = sdl.ErrMasterChannelNotFound

	// ErrNoVirtualChannels aliases sdl.ErrNoChannels.
	ErrNoVirtualChannels = sdl.ErrNoChannels

	// ErrNoMasterChannels aliases sdl.ErrNoMasterChannels.
	ErrNoMasterChannels = sdl.ErrNoMasterChannels
)

Functions

func ComputeFHEC

func ComputeFHEC(header []byte) ([]byte, error)

ComputeFHEC returns the 2-octet Frame Header Error Control for an encoded 6-octet primary header.

func IsIdleFrame

func IsIdleFrame(frame *TransferFrame) bool

IsIdleFrame reports whether the frame is an Only Idle Data frame. Per CCSDS 732.0-B-4 clause 4.1.2.2.4, OID frames use VCID 63.

func PackBPDUDataField

func PackBPDUDataField(bdp uint16, data []byte) ([]byte, error)

PackBPDUDataField returns a Transfer Frame Data Field that begins with a B_PDU header carrying bdp, followed by data. Use BDPAllValid or BDPAllIdle for the special pointer values.

func PackMPDUDataField

func PackMPDUDataField(fhp uint16, data []byte) ([]byte, error)

PackMPDUDataField returns a Transfer Frame Data Field that begins with an M_PDU header pointing to fhp, followed by data. Use FHPNoPacketStart or FHPAllIdle for the special pointer values.

func VerifyFHEC

func VerifyFHEC(header, fhec []byte) bool

VerifyFHEC reports whether the 2-octet FHEC matches the protected octets of the encoded 6-octet primary header.

Types

type AOSServiceManager

type AOSServiceManager = sdl.ServiceManager[ServiceType, *TransferFrame]

AOSServiceManager manages multiple AOS services and Master Channels.

func NewAOSServiceManager

func NewAOSServiceManager() *AOSServiceManager

NewAOSServiceManager creates a new AOS Service Manager.

type BPDUHeader

type BPDUHeader struct {
	BitstreamDataPointer uint16 // 14 bits
}

BPDUHeader represents a B_PDU header carried at the start of a Transfer Frame Data Field that uses the B_PDU service.

Bit layout (CCSDS 732.0-B-4 clause 4.1.4.3):

Byte 0: reserved(2) | BDP[13:8]
Byte 1: BDP[7:0]

func (*BPDUHeader) Decode

func (h *BPDUHeader) Decode(data []byte) error

Decode parses a B_PDU header from the start of data.

func (*BPDUHeader) Encode

func (h *BPDUHeader) Encode() ([]byte, error)

Encode packs the B_PDU header into 2 bytes.

type BitstreamService

type BitstreamService struct {
	// contains filtered or unexported fields
}

BitstreamService implements the B_PDU service for AOS.

Octet-aligned bitstream data is packed into the bitstream zone of fixed-length frames. The Bitstream Data Pointer marks the position where data ends within the frame on the final partial frame.

func NewBitstreamService

func NewBitstreamService(scid, vcid uint8, vc *VirtualChannel, config ChannelConfig, counter *FrameCounter) *BitstreamService

NewBitstreamService creates a new B_PDU service instance.

func (*BitstreamService) Flush

func (s *BitstreamService) Flush() error

Flush pads and emits any remaining buffered bitstream data with a Bitstream Data Pointer marking the last valid byte. When the partial payload holds more valid octets than the 14-bit pointer can express (possible only on zones larger than 2047 bytes), it is split across additional partial frames instead of being mislabeled.

func (*BitstreamService) Receive

func (s *BitstreamService) Receive() ([]byte, error)

Receive returns the bitstream zone of the next frame, trimmed by the Bitstream Data Pointer when present.

func (*BitstreamService) Send

func (s *BitstreamService) Send(data []byte) error

Send buffers bitstream data and emits full frames.

type ChannelConfig

type ChannelConfig struct {
	FrameLength   int    // Total frame length in octets (fixed per physical channel)
	InsertZoneLen int    // Insert zone length in bytes (0 if none)
	HasOCF        bool   // Whether Operational Control Field (4 bytes) is present
	HasFHEC       bool   // Whether Frame Header Error Control (RS(10,6), 2 bytes) is present
	HasFECF       bool   // Whether Frame Error Control Field (CRC-16) is present
	IdlePattern   []byte // Idle fill pattern (repeating); empty means DefaultIdleFill
}

ChannelConfig defines the fixed parameters of an AOS physical channel per CCSDS 732.0-B-4. All frames on a physical channel share the same fixed length and optional field configuration.

func (ChannelConfig) DataFieldCapacity

func (c ChannelConfig) DataFieldCapacity() int

DataFieldCapacity returns the maximum Transfer Frame Data Field size, including any M_PDU or B_PDU header carried at the start of the data field. The caller is responsible for accounting for those 2 bytes when sizing payloads for M_PDU/B_PDU services.

type FrameCounter

type FrameCounter struct {
	// contains filtered or unexported fields
}

FrameCounter manages 24-bit per-VC frame counts per CCSDS 732.0-B-4. AOS does not specify a Master Channel Frame Count.

func NewFrameCounter

func NewFrameCounter() *FrameCounter

NewFrameCounter creates a new FrameCounter.

func (*FrameCounter) Next

func (fc *FrameCounter) Next(vcid uint8) uint32

Next returns the current VC frame count for the given VCID, then increments the counter (with 24-bit wrap).

type FrameGapDetector

type FrameGapDetector struct {
	// contains filtered or unexported fields
}

FrameGapDetector tracks per-VC 24-bit frame counts to detect gaps caused by lost frames during transmission.

func NewFrameGapDetector

func NewFrameGapDetector() *FrameGapDetector

NewFrameGapDetector creates a new detector.

func (*FrameGapDetector) Track

func (d *FrameGapDetector) Track(frame *TransferFrame) int

Track examines the frame's VC frame count and records any gap. Returns the VC gap (0 means no gap or first frame for that VCID).

func (*FrameGapDetector) VCFrameGap

func (d *FrameGapDetector) VCFrameGap() int

VCFrameGap returns the VC gap detected by the last Track call.

type FrameOption

type FrameOption func(*TransferFrame)

FrameOption configures optional fields on a TransferFrame.

func WithFECF

func WithFECF() FrameOption

WithFECF enables the Frame Error Control Field (CRC-16-CCITT).

func WithFHEC

func WithFHEC() FrameOption

WithFHEC enables the Frame Header Error Control (RS(10,6) check symbols over the protected header octets, CCSDS 732.0-B-4 clause 4.1.2.6).

func WithInsertZone

func WithInsertZone(data []byte) FrameOption

WithInsertZone sets the insert zone data.

func WithOCF

func WithOCF(ocf []byte) FrameOption

WithOCF sets the Operational Control Field.

func WithReplayFlag

func WithReplayFlag() FrameOption

WithReplayFlag sets the Replay Flag.

func WithVCFCUsage

func WithVCFCUsage(cycle uint8) FrameOption

WithVCFCUsage enables the VC Frame Count Usage Flag and sets the cycle.

func WithVCFrameCount

func WithVCFrameCount(count uint32) FrameOption

WithVCFrameCount sets the VC frame count.

type MPDUHeader

type MPDUHeader struct {
	FirstHeaderPointer uint16 // 11 bits
}

MPDUHeader represents an M_PDU header carried at the start of a Transfer Frame Data Field that uses the M_PDU service.

Bit layout (CCSDS 732.0-B-4 clause 4.1.4.2):

Byte 0: reserved(5) | FHP[10:8]
Byte 1: FHP[7:0]

func (*MPDUHeader) Decode

func (h *MPDUHeader) Decode(data []byte) error

Decode parses an M_PDU header from the start of data.

func (*MPDUHeader) Encode

func (h *MPDUHeader) Encode() ([]byte, error)

Encode packs the M_PDU header into 2 bytes.

type MasterChannel

type MasterChannel struct {
	// contains filtered or unexported fields
}

MasterChannel manages AOS Transfer Frames for a Master Channel identified by SCID.

func NewMasterChannel

func NewMasterChannel(scid uint8, config ChannelConfig) *MasterChannel

NewMasterChannel creates a new Master Channel for the given spacecraft ID.

func (*MasterChannel) AddFrame

func (mc *MasterChannel) AddFrame(frame *TransferFrame) error

AddFrame routes an inbound frame to the appropriate Virtual Channel.

func (*MasterChannel) AddVirtualChannel

func (mc *MasterChannel) AddVirtualChannel(vc *VirtualChannel, priority int)

AddVirtualChannel registers a Virtual Channel with this Master Channel.

func (*MasterChannel) GetNextFrame

func (mc *MasterChannel) GetNextFrame() (*TransferFrame, error)

GetNextFrame retrieves the next frame from the multiplexer.

func (*MasterChannel) GetNextFrameOrIdle

func (mc *MasterChannel) GetNextFrameOrIdle() (*TransferFrame, error)

GetNextFrameOrIdle returns the next frame or an OID idle frame if no Virtual Channel has pending data.

func (*MasterChannel) HasPendingFrames

func (mc *MasterChannel) HasPendingFrames() bool

HasPendingFrames checks if any Virtual Channel has pending frames.

func (*MasterChannel) SCID

func (mc *MasterChannel) SCID() uint16

SCID returns the 8-bit Spacecraft Identifier for this Master Channel.

func (*MasterChannel) VCFrameGap

func (mc *MasterChannel) VCFrameGap() int

VCFrameGap returns the VC gap from the last AddFrame call.

type MultiplexingService

type MultiplexingService struct {
	// contains filtered or unexported fields
}

MultiplexingService implements the M_PDU service for AOS.

Packets are multiplexed into the data field of fixed-length frames using the M_PDU First Header Pointer for boundary detection. The receive side resyncs from the FHP after frame loss.

func NewMultiplexingService

func NewMultiplexingService(scid, vcid uint8, vc *VirtualChannel, config ChannelConfig, counter *FrameCounter) *MultiplexingService

NewMultiplexingService creates a new M_PDU service instance.

func (*MultiplexingService) Flush

func (s *MultiplexingService) Flush() error

Flush completes any remaining buffered packet data with an SPP idle packet (APID 0x7FF) and emits the final frame(s), per CCSDS 732.0-B-4 Clause 4.1.4.2.2: a partially filled packet zone is completed with an idle packet, not raw fill. When the leftover space is too small to hold a whole idle packet, the idle packet spans into further frames.

func (*MultiplexingService) Receive

func (s *MultiplexingService) Receive() ([]byte, error)

Receive extracts the next complete packet from frame data using the M_PDU First Header Pointer to find packet boundaries. A PacketSizer must be configured via SetPacketSizer before calling Receive.

func (*MultiplexingService) Send

func (s *MultiplexingService) Send(data []byte) error

Send buffers a packet and emits frames whenever the packet zone fills. Call Flush after the last Send to emit any partial frame as idle-padded.

func (*MultiplexingService) SetPacketSizer

func (s *MultiplexingService) SetPacketSizer(sizer PacketSizer)

SetPacketSizer configures the packet sizer used by Receive() to detect packet boundaries within the M_PDU packet zone.

type PacketSizer

type PacketSizer = sdl.PacketSizer

PacketSizer returns the total length in bytes of the packet starting at data[0], or -1 if the data is too short to determine length.

type PhysicalChannel

type PhysicalChannel struct {
	Name string
	// contains filtered or unexported fields
}

PhysicalChannel represents a single AOS physical communication link that carries one or more Master Channels.

func NewPhysicalChannel

func NewPhysicalChannel(name string, config ChannelConfig) *PhysicalChannel

NewPhysicalChannel creates a physical channel with the given configuration.

func (*PhysicalChannel) AddFrame

func (pc *PhysicalChannel) AddFrame(frame *TransferFrame) error

AddFrame demultiplexes an inbound frame to the appropriate Master Channel.

func (*PhysicalChannel) AddMasterChannel

func (pc *PhysicalChannel) AddMasterChannel(mc *MasterChannel, priority int)

AddMasterChannel registers a Master Channel with a priority weight.

func (*PhysicalChannel) GetNextFrame

func (pc *PhysicalChannel) GetNextFrame() (*TransferFrame, error)

GetNextFrame selects the next frame for transmission.

func (*PhysicalChannel) GetNextFrameOrIdle

func (pc *PhysicalChannel) GetNextFrameOrIdle() (*TransferFrame, error)

GetNextFrameOrIdle returns the next frame from MC multiplexing, or an idle frame if no Master Channel has pending data.

func (*PhysicalChannel) HasPendingFrames

func (pc *PhysicalChannel) HasPendingFrames() bool

HasPendingFrames checks if any Master Channel has pending frames.

func (*PhysicalChannel) Len

func (pc *PhysicalChannel) Len() int

Len returns the number of registered Master Channels.

type PrimaryHeader

type PrimaryHeader struct {
	TFVN              uint8  // 2 bits  - Transfer Frame Version Number (must be 1)
	SCID              uint8  // 8 bits  - Spacecraft Identifier
	VCID              uint8  // 6 bits  - Virtual Channel Identifier
	VCFrameCount      uint32 // 24 bits - Virtual Channel Frame Count
	ReplayFlag        bool   // 1 bit   - Replay Flag
	VCFCUsageFlag     bool   // 1 bit   - VC Frame Count Usage Flag
	VCFrameCountCycle uint8  // 4 bits  - VC Frame Count Cycle
}

PrimaryHeader represents the AOS Transfer Frame Primary Header.

Bit layout (CCSDS 732.0-B-4 clause 4.1.2):

Byte 0:  TFVN[1:0]  | SCID[7:2]
Byte 1:  SCID[1:0]  | VCID[5:0]
Byte 2:  VCFrameCount[23:16]
Byte 3:  VCFrameCount[15:8]
Byte 4:  VCFrameCount[7:0]
Byte 5:  Replay | VCFCUsage | reserved(2) | VCFCCycle[3:0]

func (*PrimaryHeader) Decode

func (h *PrimaryHeader) Decode(data []byte) error

Decode parses a byte slice into the PrimaryHeader.

func (*PrimaryHeader) Encode

func (h *PrimaryHeader) Encode() ([]byte, error)

Encode packs the PrimaryHeader fields into a 6-byte slice.

func (*PrimaryHeader) GVCID

func (h *PrimaryHeader) GVCID() uint32

GVCID returns the Global Virtual Channel Identifier (MCID + VCID).

func (*PrimaryHeader) Humanize

func (h *PrimaryHeader) Humanize() string

Humanize returns a multi-line human-readable representation of the header.

func (*PrimaryHeader) MCID

func (h *PrimaryHeader) MCID() uint16

MCID returns the Master Channel Identifier (TFVN + SCID).

func (*PrimaryHeader) Validate

func (h *PrimaryHeader) Validate() error

Validate checks that header values are within their bit-field widths and that TFVN is the AOS version.

type Service

type Service = sdl.Service

Service is the interface for all AOS Data Link services.

type ServiceType

type ServiceType int

ServiceType identifies the AOS service type carried on a Virtual Channel.

const (
	MPDU ServiceType = iota // Multiplexing PDU (variable-length packets)
	BPDU                    // Bitstream PDU
	VCA                     // Virtual Channel Access
	VCF                     // Virtual Channel Frame
)

type TransferFrame

type TransferFrame struct {
	Header     PrimaryHeader
	FHEC       []byte // 2 bytes when present (Frame Header Error Control)
	InsertZone []byte // optional, mission-defined fixed length
	DataField  []byte // includes M_PDU/B_PDU header when applicable
	OCF        []byte // 4 bytes when present
	FECF       []byte // 2 bytes when present
	HasFHEC    bool
	HasFECF    bool
}

TransferFrame represents an AOS Transfer Frame per CCSDS 732.0-B-4.

Layout: PrimaryHeader | InsertZone? | DataField | OCF? | FECF?

The DataField carries one of M_PDU, B_PDU, or VCA payload depending on the Virtual Channel configuration. The frame structure does not encode which PDU type is in use. That is determined per-VC by mission config.

func DecodeFrame

func DecodeFrame(data []byte, config ChannelConfig) (*TransferFrame, error)

DecodeFrame parses a byte slice into an AOS Transfer Frame using the physical channel configuration for the optional fields, including the Frame Header Error Control.

func DecodeTransferFrame

func DecodeTransferFrame(data []byte, insertZoneLen int, hasOCF, hasFECF bool) (*TransferFrame, error)

DecodeTransferFrame parses a byte slice into an AOS Transfer Frame.

insertZoneLen is the configured insert zone length for the physical channel (0 if none). hasOCF and hasFECF select the optional trailing fields. Frames are fixed-length per physical channel; the caller is responsible for delivering exactly one frame.

func NewIdleFrame

func NewIdleFrame(scid uint8, config ChannelConfig) (*TransferFrame, error)

NewIdleFrame creates an OID (Only Idle Data) Transfer Frame on VCID 63 with a data field of the given capacity filled with the channel's idle pattern.

func NewTransferFrame

func NewTransferFrame(scid, vcid uint8, data []byte, opts ...FrameOption) (*TransferFrame, error)

NewTransferFrame creates a new AOS Transfer Frame.

data is the Transfer Frame Data Field as it will appear on the wire, including any M_PDU or B_PDU header when applicable. Use the Pack helpers (PackMPDUDataField, PackBPDUDataField) to build a data field with header.

func (*TransferFrame) Encode

func (f *TransferFrame) Encode() ([]byte, error)

Encode converts the AOS Transfer Frame to a byte slice.

When the frame carries a Frame Error Control Field, it is computed from the frame's current contents on every call, so changes made after construction are always covered. Use EncodeWithoutFECF to build a frame with a deliberately invalid FECF.

func (*TransferFrame) EncodeWithoutFECF

func (f *TransferFrame) EncodeWithoutFECF() ([]byte, error)

EncodeWithoutFECF serializes the frame excluding the Frame Error Control Field. Use it to build frames with a deliberately invalid FECF; Encode always writes a correct one.

func (*TransferFrame) Humanize

func (f *TransferFrame) Humanize() string

Humanize returns a multi-line human-readable representation of the frame.

type VirtualChannel

type VirtualChannel = sdl.Channel[*TransferFrame]

VirtualChannel is a frame buffer for a single AOS virtual channel.

func NewVirtualChannel

func NewVirtualChannel(vcid uint8, bufferSize int) *VirtualChannel

NewVirtualChannel creates a new AOS Virtual Channel.

type VirtualChannelAccessService

type VirtualChannelAccessService struct {
	// contains filtered or unexported fields
}

VirtualChannelAccessService implements the VCA service for AOS.

VCA delivers an opaque, fixed-length SDU per frame. The data field has no protocol header. The entire data field is the SDU.

func NewVirtualChannelAccessService

func NewVirtualChannelAccessService(scid, vcid uint8, sduSize int, vc *VirtualChannel, config ChannelConfig, counter *FrameCounter) *VirtualChannelAccessService

NewVirtualChannelAccessService creates a new VCA service instance.

func (*VirtualChannelAccessService) Flush

Flush is a no-op for VCA service.

func (*VirtualChannelAccessService) Receive

func (s *VirtualChannelAccessService) Receive() ([]byte, error)

Receive retrieves the next frame and returns its data field, which is the whole VCA_SDU: on a fixed-length physical channel the SDU exactly fills the data field, so no out-of-band trimming is needed.

func (*VirtualChannelAccessService) Send

func (s *VirtualChannelAccessService) Send(data []byte) error

Send wraps a fixed-length SDU into an AOS Transfer Frame. On a fixed-length physical channel the VCA_SDU must exactly fill the data field (CCSDS 732.0-B-4 clause 3.3.4: VCA_SDUs are of constant, managed length); short or long SDUs are rejected rather than padded, since a receiver has no in-band way to recover the SDU boundary.

type VirtualChannelFrameService

type VirtualChannelFrameService struct {
	// contains filtered or unexported fields
}

VirtualChannelFrameService implements the VCF service for AOS.

func NewVirtualChannelFrameService

func NewVirtualChannelFrameService(vcid uint8, vc *VirtualChannel, config ChannelConfig) *VirtualChannelFrameService

NewVirtualChannelFrameService creates a new VCF service instance.

func (*VirtualChannelFrameService) Flush

func (s *VirtualChannelFrameService) Flush() error

Flush is a no-op for VCF service.

func (*VirtualChannelFrameService) Receive

func (s *VirtualChannelFrameService) Receive() ([]byte, error)

Receive retrieves the next frame from the Virtual Channel as bytes.

func (*VirtualChannelFrameService) Send

func (s *VirtualChannelFrameService) Send(data []byte) error

Send decodes the provided bytes as an AOS Transfer Frame and pushes it.

type VirtualChannelMultiplexer

type VirtualChannelMultiplexer = sdl.Multiplexer[*TransferFrame]

VirtualChannelMultiplexer is a weighted round-robin frame scheduler for AOS Virtual Channels.

func NewMultiplexer

func NewMultiplexer() *VirtualChannelMultiplexer

NewMultiplexer creates a new AOS Virtual Channel multiplexer.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL