From 9d2c993f496373e51073c8b77129b299d4fc00b8 Mon Sep 17 00:00:00 2001 From: wb2osz Date: Mon, 11 Sep 2017 22:28:54 -0400 Subject: [PATCH] New "kissutil" application. --- kiss.c | 9 ++++++--- kissnet.c | 9 +++++++-- kissserial.c | 7 +++++-- 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/kiss.c b/kiss.c index 4e6b3ea..761f6ba 100644 --- a/kiss.c +++ b/kiss.c @@ -94,7 +94,7 @@ void kisspt_set_debug (int n) return; } -void kisspt_send_rec_packet (int chan, unsigned char *fbuf, int flen, int client) +void kisspt_send_rec_packet (int chan, int kiss_cmd, unsigned char *fbuf, int flen, int client) { return; } @@ -367,6 +367,9 @@ static int kisspt_open_pt (void) * Inputs: chan - Channel number where packet was received. * 0 = first, 1 = second if any. * + * kiss_cmd - Usually KISS_CMD_DATA_FRAME but we can also have + * KISS_CMD_SET_HARDWARE when responding to a query. + * * pp - Identifier for packet object. * * fbuf - Address of raw received frame buffer @@ -386,7 +389,7 @@ static int kisspt_open_pt (void) *--------------------------------------------------------------------*/ -void kisspt_send_rec_packet (int chan, unsigned char *fbuf, int flen, int client) +void kisspt_send_rec_packet (int chan, int kiss_cmd, unsigned char *fbuf, int flen, int client) { unsigned char kiss_buff[2 * AX25_MAX_PACKET_LEN + 2]; int kiss_len; @@ -415,7 +418,7 @@ void kisspt_send_rec_packet (int chan, unsigned char *fbuf, int flen, int clien flen = (int)(sizeof(stemp)) - 1; } - stemp[0] = (chan << 4) + 0; + stemp[0] = (chan << 4) | kiss_cmd; memcpy (stemp+1, fbuf, flen); if (kisspt_debug >= 2) { diff --git a/kissnet.c b/kissnet.c index 0f2d378..cd8c5e1 100644 --- a/kissnet.c +++ b/kissnet.c @@ -520,9 +520,14 @@ static THREAD_F connect_listen_thread (void *arg) * Inputs: chan - Channel number where packet was received. * 0 = first, 1 = second if any. * +// TODO: add kiss_cmd + * * fbuf - Address of raw received frame buffer * or a text string. * + * kiss_cmd - Usually KISS_CMD_DATA_FRAME but we can also have + * KISS_CMD_SET_HARDWARE when responding to a query. + * * flen - Number of bytes for AX.25 frame. * When called from kiss_rec_byte, flen will be -1 * indicating a text string rather than frame content. @@ -544,7 +549,7 @@ static THREAD_F connect_listen_thread (void *arg) *--------------------------------------------------------------------*/ -void kissnet_send_rec_packet (int chan, unsigned char *fbuf, int flen, int tcpclient) +void kissnet_send_rec_packet (int chan, int kiss_cmd, unsigned char *fbuf, int flen, int tcpclient) { unsigned char kiss_buff[2 * AX25_MAX_PACKET_LEN]; int kiss_len; @@ -597,7 +602,7 @@ void kissnet_send_rec_packet (int chan, unsigned char *fbuf, int flen, int tcpcl assert (flen < (int)(sizeof(stemp))); - stemp[0] = (chan << 4) + 0; + stemp[0] = (chan << 4) | kiss_cmd; memcpy (stemp+1, fbuf, flen); if (kiss_debug >= 2) { diff --git a/kissserial.c b/kissserial.c index aeab11b..d9aedc2 100644 --- a/kissserial.c +++ b/kissserial.c @@ -258,6 +258,9 @@ void kissserial_init (struct misc_config_s *mc) * Inputs: chan - Channel number where packet was received. * 0 = first, 1 = second if any. * + * kiss_cmd - Usually KISS_CMD_DATA_FRAME but we can also have + * KISS_CMD_SET_HARDWARE when responding to a query. + * * pp - Identifier for packet object. * * fbuf - Address of raw received frame buffer @@ -277,7 +280,7 @@ void kissserial_init (struct misc_config_s *mc) *--------------------------------------------------------------------*/ -void kissserial_send_rec_packet (int chan, unsigned char *fbuf, int flen, int client) +void kissserial_send_rec_packet (int chan, int kiss_cmd, unsigned char *fbuf, int flen, int client) { unsigned char kiss_buff[2 * AX25_MAX_PACKET_LEN + 2]; int kiss_len; @@ -309,7 +312,7 @@ void kissserial_send_rec_packet (int chan, unsigned char *fbuf, int flen, int c flen = (int)(sizeof(stemp)) - 1; } - stemp[0] = (chan << 4) + 0; + stemp[0] = (chan << 4) | kiss_cmd; memcpy (stemp+1, fbuf, flen); if (kissserial_debug >= 2) {