changeset 932:3d1abb9f05ef

rvinterf proper: move TM logging to new module
author Mychaela Falconia <falcon@freecalypso.org>
date Tue, 23 May 2023 06:20:21 +0000
parents bb7a03cc1e43
children bd6dd6120180
files rvinterf/lowlevel/Makefile rvinterf/lowlevel/format.c rvinterf/lowlevel/logsent.c rvinterf/lowlevel/rviftmode.c
diffstat 4 files changed, 35 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/rvinterf/lowlevel/Makefile	Tue May 23 06:04:29 2023 +0000
+++ b/rvinterf/lowlevel/Makefile	Tue May 23 06:20:21 2023 +0000
@@ -12,7 +12,7 @@
 
 RVINTERF_OBJS=	clientcmd.o format.o format_fc.o localsock.o logsent.o \
 		output.o packetrx.o packettx.o pktfwd.o rviflcd.o \
-		rvifmain.o tchhide.o
+		rvifmain.o rviftmode.o tchhide.o
 
 TFC139_OBJS=	format.o output.o packetrx.o packettx.o tfc139.o
 
--- a/rvinterf/lowlevel/format.c	Tue May 23 06:04:29 2023 +0000
+++ b/rvinterf/lowlevel/format.c	Tue May 23 06:20:21 2023 +0000
@@ -118,13 +118,6 @@
 }
 
 void
-print_tm_output_new()
-{
-	output_line("Rx Test Mode packet");
-	packet_hex_dump(rxpkt, (unsigned) rxpkt_len, output_cont);
-}
-
-void
 print_unknown_packet()
 {
 	output_line("Rx unknown packet format");
--- a/rvinterf/lowlevel/logsent.c	Tue May 23 06:04:29 2023 +0000
+++ b/rvinterf/lowlevel/logsent.c	Tue May 23 06:20:21 2023 +0000
@@ -36,6 +36,7 @@
 	output_line(buf);
 }
 
+void
 log_sent_packet(pkt, pktlen)
 	u_char *pkt;
 {
@@ -46,8 +47,7 @@
 		log_sent_gpf(pkt, pktlen);
 		return;
 	case RVT_TM_HEADER:
-		output_line("Sent Test Mode packet");
-		packet_hex_dump(pkt, pktlen, output_cont);
+		log_sent_tm(pkt, pktlen);
 		return;
 	case RVT_AT_HEADER:
 		log_sent_ati(pkt, pktlen);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/rvinterf/lowlevel/rviftmode.c	Tue May 23 06:20:21 2023 +0000
@@ -0,0 +1,32 @@
+/*
+ * This module is for rvinterf only.  Whenever we send or receive Test Mode
+ * packets, we should be a little more intelligent about how we display and
+ * log them.  By default we only print a one-line summary, and in verbose mode
+ * we also emit a full hex dump.
+ */
+
+#include <sys/types.h>
+#include <stdio.h>
+#include <string.h>
+#include <strings.h>
+
+extern u_char rxpkt[];
+extern size_t rxpkt_len;
+extern int verbose;
+
+extern void output_cont();
+
+void
+log_sent_tm(pkt, pktlen)
+	u_char *pkt;
+{
+	output_line("Sent Test Mode packet");
+	packet_hex_dump(pkt, pktlen, output_cont);
+}
+
+void
+print_tm_output_new()
+{
+	output_line("Rx Test Mode packet");
+	packet_hex_dump(rxpkt, (unsigned) rxpkt_len, output_cont);
+}