$ show wb2osz/direwolf
Dire Wolf is a software Terminal Node Controller (TNC) for amateur radio packet radio, specifically AX.25 and APRS. It replaces hardware TNCs by demodulating audio from sound cards or SDR receivers, decoding AX.25 frames, and providing network interfaces (KISS, AGW) for client applications like Xastir, APRSIS32, and UI-View. The codebase is a monolithic C application with threaded audio capture, multiple modem demodulators (AFSK, PSK, G3RUH, 9600bps), forward error correction (FX.25, IL2P), digipeating, IGate (internet gateway), GPS integration, DTMF/APRStt gateway, and telemetry decoding. It runs on Linux, Windows, and macOS. The architecture is single-process with multiple threads, using a global event queue for inter-module communication. Key entry points include the main `direwolf` daemon and several standalone utilities (`decode_aprs`, `kissutil`, `gen_packets`, `atest`, etc.). The implementation is production-grade, with extensive protocol handling and real-world tuning, but exhibits some monolithic design patterns and legacy code (vendored regex, geotranz).
The LLM identified 5 files worth highlighting for reuse:
Implements a boolean expression parser and evaluator for packet filtering rules (e.g., 'b/144.39 and (o or d)'). Uses recursive descent on a tokenized expression, supports typed literals (call signs, SSID, digipeater count, etc.), and includes a built-in test harness (PFTEST). The module is self-contained, has no dependencies on internal Dire Wolf globals beyond a config pointer passed in, and can be reused in any project requiring a simple filter DSL.
Provides a comprehensive set of functions for converting between APRS positional formats (standard, compressed, Maidenhead, NMEA), plus distance/bearing calculations and grid square conversion. Each conversion function is pure and stateless, making it easily extractable. The embedded LLTEST main demonstrates correctness. This is a high-quality utility module for any project dealing with geospatial data in amateur radio or general coordinate systems.
Encodes APRS information fields for position, object, item, message, and telemetry packets. Functions are self-contained, accept structs with latitude/longitude/comment, and produce properly formatted APRS strings. The module has no internal dependencies beyond character utilities. It can be reused as a standalone APRS packet builder.
A self-contained library for creating, modifying, parsing, and serializing AX.25 frames. Provides functions like ax25_from_text, ax25_from_frame, ax25_dup, ax25_pack, and address manipulation. Used extensively throughout the codebase but is largely independent of other Dire Wolf modules (only relies on basic types and a few utility functions). Could be extracted as a standalone AX.25 packet handling library.
Implements KISS protocol framing (encapsulation, unwrapping, command processing) with a clear state machine for byte collection and decode. Includes a test harness (KISSTEST). The module is isolated, uses only a callback for sending data, and is reusable for any project needing KISS TNC protocol support.