Documentation
¶
Overview ¶
Package ax25 implements AX.25 v2.0 UI frame encode/decode.
Only Unnumbered Information (UI) frames are supported — the workhorse for APRS, digipeater, and beaconing. Connected-mode frames (I, RR, RNR, REJ, SABM, DISC, UA, DM, FRMR) are recognised by control-field value but not otherwise implemented; see Frame.IsUI.
Index ¶
Constants ¶
const ( // ControlUI is the unnumbered-information control byte (poll/final=0). ControlUI = 0x03 // ControlUIWithPF is UI with the poll/final bit set. ControlUIWithPF = 0x13 // PIDNoLayer3 is the APRS-standard Protocol Identifier. PIDNoLayer3 = 0xF0 )
AX.25 control-field values.
const ( PriorityBeacon = 1 // scheduled beacons PriorityDigipeated = 2 // digipeater-repeated traffic PriorityClient = 3 // KISS/AGW client-originated PriorityIGateMsg = 4 // iGate-delivered directed message )
TX governor priority levels. Higher value = sent sooner.
These live in pkg/ax25 (a leaf package imported by every protocol package) so that submitters in pkg/kiss, pkg/agw, pkg/aprs, and future digipeater/iGate packages can reference the same values without importing pkg/txgovernor (which would create an import cycle).
pkg/txgovernor re-defines the same constants for its own API surface and asserts equality at init time; if these ever drift, the test in pkg/txgovernor will fail.
const MaxRepeaters = 8
MaxRepeaters is the AX.25 maximum number of digipeater addresses in the path.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Address ¶
type Address struct {
Call string // 1..6 uppercase alphanumerics
SSID uint8 // 0..15
Repeated bool // H bit — only meaningful for digipeater path entries
}
An Address is a callsign + SSID pair, with AX.25 digipeater "has been repeated" (H) flag for path entries.
func ParseAddress ¶
ParseAddress parses "CALL[-SSID][*]" into an Address. The trailing '*' sets Repeated.
type Frame ¶
type Frame struct {
Dest Address
Source Address
Path []Address // up to 8 digipeater addresses
Control byte
PID byte
Info []byte
// CommandResp encodes the C-bit layout: direwolf-style command = dest
// C-bit set, source C-bit clear (AX.25 v2.0 "command" frame). The
// default New* constructors produce a command frame.
CommandResp bool
}
A Frame is a decoded AX.25 UI frame (or the header of an unsupported frame type). The zero value is not a valid frame.
func Decode ¶
Decode parses an AX.25 frame from raw bytes. Only UI frames have their info field populated; other control-field values parse the header and return a Frame with IsUI()==false and empty Info.
func NewUIFrame ¶
NewUIFrame constructs a v2.0-command UI frame with the given path and payload. PID defaults to 0xF0 (no-layer-3, APRS).
func (*Frame) DedupKey ¶
DedupKey returns a string suitable as a map key for deduplication at the AX.25 frame level. Uses (dest + source + info) so identical content from the same source to the same destination collapses regardless of how the frame was routed or which digipeaters it traversed. This is the key the centralized TX governor uses to prevent the same frame being queued twice in rapid succession.
Call PathDedupKey instead when the path matters, e.g. the digipeater's own duplicate-suppression map where two copies of the same payload arriving over different geographic paths should be treated as distinct events.
func (*Frame) Encode ¶
Encode serialises f into a byte slice suitable for passing as the Data field of a TransmitFrame IPC message (no FCS — the modem appends it).
func (*Frame) IsUI ¶
IsUI reports whether the frame is an Unnumbered Information frame. Connected-mode control bytes (I, RR, RNR, REJ, SABM/E, DISC, UA, DM, FRMR, XID, TEST) return false.
func (*Frame) PathDedupKey ¶
PathDedupKey returns a dedup key that includes the digipeater path. Used by the digipeater: two copies of the same payload heard via different unconsumed path slots are not the same observation for the purposes of digi suppression, because digi-ing them both could extend a packet's geographic reach legitimately. Only the call and SSID of each path element contribute; the repeated (H) bit is deliberately omitted so an unconsumed-then-consumed pair still dedups (the payload is the same; only the H-bit changed as we digi'd it).