$ show njh/mqtt-sn-tools
MQTT-SN Tools is a suite of four command-line applications for working with the MQTT-SN (MQTT for Sensor Networks) protocol. The system provides mqtt-sn-pub for publishing messages, mqtt-sn-sub for subscribing to topics, mqtt-sn-dump for monitoring packets, and mqtt-sn-serial-bridge for serial-to-UDP bridging. All tools share a common C library (mqtt-sn.c/h) that implements the MQTT-SN protocol handling, including socket management, packet encoding/decoding, keep-alive mechanics, and topic mapping. The architecture is modular with clear separation between the protocol library and application-specific logic. Each tool follows a standard pattern: parse command-line arguments, establish UDP connection to an MQTT-SN broker, perform protocol operations (connect, publish/subscribe, etc.), handle incoming/outgoing packets, and clean up resources. The project has active maintenance with recent commits and a test suite.
The LLM identified 1 files worth highlighting for reuse:
This library provides a complete implementation of the MQTT-SN protocol handling, including socket management, packet encoding/decoding for all MQTT-SN packet types, keep-alive handling, topic mapping, and forwarder encapsulation. It's reasonably well-encapsulated with a clear API (mqtt_sn_create_socket, mqtt_sn_send_connect, etc.) that could be extracted for use in other projects needing MQTT-SN functionality with minimal modification. The library demonstrates solid protocol implementation skills with proper error handling, state management, and adherence to the MQTT-SN specification.