ax25.netrom

NET/ROM Routing Table Update Structure

Structure definitions together with methods to pack and unpack native NET/ROM routing table updates. Provides the capabilities for, for example, decoding NET/ROM routing table update packets in programs such as ‘listen’.

Protocol reference:

https://packet-radio.net/wp-content/uploads/2017/04/netrom1.pdf

Classes

Destination

A single destination element of a routing update.

RoutingBroadcast

A complete routing update broadcast.

Module Contents

class ax25.netrom.Destination(callsign, mnemonic, neighbor, quality)

A single destination element of a routing update.

This comprises identifiers for the node, along with information on its best-quality neighbor.

Parameters:
  • callsign (Address or str) – Callsign of the destination.

  • mnemonic (str) – Mnemonic for the destination.

  • neighbor (Address or str) – Best-quality neighbor for the destination.

  • quality (int) – Quality of the best-quality neighbor.

Raises:
  • TypeError – if an address is of an invalid type.

  • ValueError – if either the mnemonic value or the quality value is invalid or out of range.

property callsign

Retrieve the callsign of the destination. Readonly.

Returns:

Destination callsign.

Return type:

Address

property mnemonic

Retrieve the mnemonic for the destination. Readonly.

Returns:

Destination’s mnemonic.

Return type:

str

property best_neighbor

Retrieve the best-quality neighbor for the destination. Readonly.

Returns:

The best-quality neighbor.

Return type:

Address

property best_quality

Retrieve the quality of the best-quality neighbor. Readonly.

Returns:

The best-quality neighbor’s quality.

Return type:

int

pack()

Pack this Destination instance into an encoded byte sequence.

Returns:

Encoded byte sequence for this Destination.

Return type:

bytes

classmethod unpack(buffer)

Unpack the encoded byte sequence into a new Destination instance.

Parameters:

buffer (bytes or bytearray) – Encoded byte sequence.

Returns:

A new Destination instance.

Return type:

Destination

Raises:

ValueError – if the encoded information contains an invalid address.

class ax25.netrom.RoutingBroadcast(sender, destinations)

A complete routing update broadcast.

This comprises sender identification along with a list of destinations.

Parameters:
  • sender (str) – Mnemonic of the sender.

  • destinations (list[Destination] or tuple(Destination)) – List or tuple of destinations.

Raises:
  • TypeError – if a destination is of an invalid type.

  • ValueError – if the sender is invalid.

property sender

Retrieve the sender of the routing broadcast. Readonly.

Returns:

Sender of the routing broadcast.

Return type:

str

property destinations

Retrieve the destinations for routing broadcast. Readonly.

Returns:

Sequence of destinations.

Return type:

tuple(Destination)

pack()

Pack this RoutingBroadcast instance into an encoded byte sequence.

Returns:

Encoded byte sequence for this RoutingBroadcast.

Return type:

bytes

classmethod unpack(buffer)

Unpack the encoded byte sequence into a new RoutingBroadcast instance.

Parameters:

buffer (bytes or bytearray) – Encoded byte sequence.

Returns:

A new RoutingBroadcast instance.

Return type:

RoutingBroadcast

Raises:
  • TypeError – if the byte sequence does not represent a routing broadcast (i.e. if the first byte is not 0xFF).

  • ValueError – if the encoded information contains an invalid address.