*
* $WIZ$ module_name = "ax25"
* $WIZ$ module_configuration = "bertos/cfg/cfg_ax25.h"
- * $WIZ$ module_depends = "kfile"
+ * $WIZ$ module_depends = "kfile", "crc-ccitt"
*/
uint8_t ssid; ///< SSID (secondary station ID) for the call
} AX25Call;
+/**
+ * Create an AX25Call structure on the fly and return its pointer.
+ * \param str callsign, can be 6 characters or shorter.
+ * \param id ssid associated with the callsign.
+ */
+#define AX25_CALL(str, id) ({ static const AX25Call _call = { .call = (str), .ssid = (id) }; &_call; })
+
/**
* Maximum number of Repeaters in a AX25 message.
*/
#endif
uint16_t ctrl; ///< AX25 control field
uint8_t pid; ///< AX25 PID field
- uint8_t *info; ///< Pointer to the info field (payload) of the message
+ const uint8_t *info; ///< Pointer to the info field (payload) of the message
size_t len; ///< Payload length
} AX25Msg;
#define AX25_PID_NOLAYER3 0xF0
/**
- * HDLC flags
+ * \name HDLC flags.
* These should be moved in
* a separated HDLC related file one day...
* \{
*/
void ax25_poll(AX25Ctx *ctx);
+/**
+ * Send an AX25 frame on the channel.
+ * \param ctx AX25 context to operate on.
+ * \param dst the destination callsign for the frame, \see AX25_CALL
+ * for a handy way to create a callsign on the fly.
+ * \param src the source callsign for the frame, \see AX25_CALL
+ * for a handy way to create a callsign on the fly.
+ * \param _buf payload buffer.
+ * \param len length of the payload.
+ */
+void ax25_send(AX25Ctx *ctx, const AX25Call *dst, const AX25Call *src, const void *_buf, size_t len);
+
+
/**
* Init the AX25 protocol decoder.
*
*/
void ax25_init(AX25Ctx *ctx, KFile *channel, ax25_callback_t hook);
+int ax25_testSetup(void);
+int ax25_testTearDown(void);
+int ax25_testRun(void);
+
#endif /* NET_AX25_H */