changeset 871:a5c8f48003cd

rvinterf: client programs can now selectively stop receiving packets of a particular RVTMUX type
author Space Falcon <falcon@ivan.Harhan.ORG>
date Fri, 29 May 2015 06:29:38 +0000
parents 2682003dcba7
children 5e46679bdb6a
files rvinterf/include/localsock.h rvinterf/lowlevel/clientcmd.c
diffstat 2 files changed, 18 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/rvinterf/include/localsock.h	Fri May 29 06:16:02 2015 +0000
+++ b/rvinterf/include/localsock.h	Fri May 29 06:29:38 2015 +0000
@@ -22,6 +22,7 @@
 #define	CLI2RVI_PKT_TO_TARGET		0x02
 #define	CLI2RVI_RAWBYTES_TO_TARGET	0x03
 #define	CLI2RVI_RESET_PACKET_RX		0x04
+#define	CLI2RVI_DROP_MUXPROTO		0x05
 
 /*
  * The first two commands (CLI2RVI_WANT_RVTRACE and CLI2RVI_WANT_MUXPROTO)
@@ -42,7 +43,10 @@
  *
  * The CLI2RVI_RESET_PACKET_RX opcode resets the "interests" previously set
  * with CLI2RVI_WANT_RVTRACE and/or CLI2RVI_WANT_MUXPROTO.  It is a "blanket"
- * reset; the command message consists of just the opcode.
+ * reset; the command message consists of just the opcode.  The
+ * CLI2RVI_DROP_MUXPROTO command is more specific and undoes the effect of a
+ * previous CLI2RVI_WANT_MUXPROTO; it needs to be followed by one byte
+ * identifying the RVTMUX protocol in question, just like CLI2RVI_WANT_MUXPROTO.
  *
  * The last two commands (CLI2RVI_PKT_TO_TARGET and CLI2RVI_RAWBYTES_TO_TARGET)
  * cause data payload to be sent to the target serial port.  Payload following
--- a/rvinterf/lowlevel/clientcmd.c	Fri May 29 06:16:02 2015 +0000
+++ b/rvinterf/lowlevel/clientcmd.c	Fri May 29 06:29:38 2015 +0000
@@ -53,6 +53,19 @@
 		cli->int_proto[cli->rx_buf[1] - 0x12] = 1;
 		send_local_msg_to_client(cli, "+OK");
 		return;
+	case CLI2RVI_DROP_MUXPROTO:
+		if (cli->rx_msglen != 2) {
+			send_local_msg_to_client(cli, "-Bad command length");
+			return;
+		}
+		if (cli->rx_buf[1] < 0x12 || cli->rx_buf[1] > 0x1B) {
+			send_local_msg_to_client(cli,
+					"-Unsupported protocol MUX value");
+			return;
+		}
+		cli->int_proto[cli->rx_buf[1] - 0x12] = 0;
+		send_local_msg_to_client(cli, "+OK");
+		return;
 	case CLI2RVI_RESET_PACKET_RX:
 		cli->int_rvt_count = 0;
 		bzero(cli->int_proto, sizeof(cli->int_proto));