FreeCalypso > hg > freecalypso-sw
diff rvinterf/lowlevel/clientcmd.c @ 180:59ee5817b194
rvinterf: packet sending implemented
author | Michael Spacefalcon <msokolov@ivan.Harhan.ORG> |
---|---|
date | Sat, 23 Nov 2013 22:42:19 +0000 |
parents | 7ab6b29e76bb |
children | ec040f521cc2 |
line wrap: on
line diff
--- a/rvinterf/lowlevel/clientcmd.c Sat Nov 23 22:21:20 2013 +0000 +++ b/rvinterf/lowlevel/clientcmd.c Sat Nov 23 22:42:19 2013 +0000 @@ -9,6 +9,7 @@ #include <stdlib.h> #include <unistd.h> #include "../pktmux.h" +#include "../limits.h" #include "../localsock.h" #include "client.h" @@ -53,6 +54,15 @@ send_local_msg_to_client(cli, "+OK"); return; case CLI2RVI_PKT_TO_TARGET: + c = cli->rx_msglen - 1; + if (c < 1 || c > MAX_PKT_TO_TARGET) { + send_local_msg_to_client(cli, + "-Invalid Tx packet length"); + return; + } + send_pkt_to_target(cli->rx_buf + 1, c); + log_sent_packet(cli->rx_buf + 1, c); + return; case CLI2RVI_RAWBYTES_TO_TARGET: /* To be implemented */ default: