Helper Utilities¶
Pax25 comes with a number of utility functions to make manipulating AX.25 frames easy and intuitive. This document details what's available.
Utility functions for working with AX.25 frames.
build_receive_modifier(new_number: int) -> Callable[[Frame], Frame]
¶
Creates a modifier function that will replace an information or supervisory frame's
receive control number with the new_number specified.
Source code in pax25/ax25/utils.py
command(frame: Frame) -> Frame
¶
Mark the frame as a 'Command' frame, sent from the source to the destination.
Source code in pax25/ax25/utils.py
flagged_control(control: C) -> C
¶
Marks the poll/response bit for this frame, or raises if we're an info frame.
Source code in pax25/ax25/utils.py
is_command(frame: Frame) -> bool
¶
Determine whether the frame is a command frame.
is_neutral(frame: Frame) -> bool
¶
Determine whether a frame is neutral (not a command or response frame)
Source code in pax25/ax25/utils.py
is_response(frame: Frame) -> bool
¶
Determine whether the frame is a response frame.
repeated_for(address: Address, frame: Frame) -> Frame
¶
Returns a revised frame with the repeat flag set for the specific address. Raises if this address isn't a repeater for the frame.
Source code in pax25/ax25/utils.py
reply_digipeaters(digipeaters: tuple[AddressHeader, ...]) -> tuple[AddressHeader, ...]
¶
Returns a revised frame that has the digipeaters in reverse order and the repeated flags all set to False.
Source code in pax25/ax25/utils.py
response(frame: Frame) -> Frame
¶
Mark the frame as a 'Response' frame, replying to a command frame.
Source code in pax25/ax25/utils.py
response_frame(frame: Frame) -> Frame
¶
Generates the base of a response frame-- source and destination are swapped, digipeaters reversed, and contents emptied. The control is unchanged, as context for changes to it would be kept elsewhere.
The command_or_repeated flag is swapped along with the addresses (if it is set at all), so bear this in mind.
Source code in pax25/ax25/utils.py
roll_back_ssid(address: Address) -> Address
¶
Given an address, return the previous SSID. This is used by nodes connecting outward to prevent loopback issues, by making sure that the SSID on the next connection outward is different from the current one, and in a way that will be inaudible by the time it loops back around to the original station.
Source code in pax25/ax25/utils.py
should_repeat_for(address: Address, frame: Frame) -> bool
¶
Checks if a given address is next in the digipeater list and this frame requires repeating.
Source code in pax25/ax25/utils.py
size(item: Assembler | Sized) -> int
¶
update_receive_number(frame: Frame, new_number: int) -> Frame
¶
Updates the receive number, if applicable, on the target frame.