mirror of
https://github.com/craigerl/aprsd.git
synced 2025-08-05 14:52:28 -04:00
This patch adds the new PacketFilter class as a generic mechanism for doing packet filtering during the packet processing phase of recieving packets. The packet phases are: 1. reception and stats collection 2. packet processing. Each phase has a single thread for handling that phase. Phase 1: The ARPSDRXThread connects to the APRS client, and gets packets from the client. Then it puts the packet through the Collector for stats and tracking. Then the packet is put into the packet_queue. Phase 2: Packets are pulled from the packet_queue. Then packets are run through the PacketFilter mechanism, then processed depending on the command being run. By default there is 1 loaded packet filter, which is the DupePacketFilter which removes "duplicate" packets that aprsd has already seen and processed within the configured time frame. This PacketFilter mechanism allows an external extension or plugin to add/remove packet filters at will depending on the function of the extension or plugin. For example, this allows an extension to get a packet and push the packet into an MQTT queue.
12 lines
259 B
Python
12 lines
259 B
Python
import queue
|
|
|
|
# Make these available to anyone importing
|
|
# aprsd.threads
|
|
from .aprsd import APRSDThread, APRSDThreadList # noqa: F401
|
|
from .rx import ( # noqa: F401
|
|
APRSDProcessPacketThread,
|
|
APRSDRXThread,
|
|
)
|
|
|
|
packet_queue = queue.Queue(maxsize=500)
|