FreeCalypso > hg > freecalypso-tools
changeset 222:7168f63fc3b8
rvinterf: implemented keepalive mechanism
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sat, 20 May 2017 21:00:15 +0000 |
parents | a46a68500517 |
children | ac49d8814893 |
files | rvinterf/lowlevel/rvifmain.c rvinterf/lowlevel/rvtdump.c |
diffstat | 2 files changed, 18 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/rvinterf/lowlevel/rvifmain.c Sat May 20 20:04:35 2017 +0000 +++ b/rvinterf/lowlevel/rvifmain.c Sat May 20 21:00:15 2017 +0000 @@ -36,6 +36,10 @@ int wakeup_after_sec = 7; +static char keepalive_msg[] = + "Received keepalive query, responding with keepalive answer"; +static u_char keepalive_answer[2] = {RVT_KEEPALIVE_HEADER, 'A'}; + main(argc, argv) char **argv; { @@ -203,6 +207,12 @@ if (client_head) forward_nonrvt_pkt(); return; + case RVT_KEEPALIVE_HEADER: + if (rxpkt_len != 2 || rxpkt[1] != 'Q') + goto unknown; + output_line(keepalive_msg); + send_pkt_to_target(keepalive_answer, 2); + return; case '*': print_fc_lld_msg(); return;
--- a/rvinterf/lowlevel/rvtdump.c Sat May 20 20:04:35 2017 +0000 +++ b/rvinterf/lowlevel/rvtdump.c Sat May 20 21:00:15 2017 +0000 @@ -23,6 +23,9 @@ int background; int no_output; /* for output.c */ +static char keepalive_msg[] = + "Received keepalive query, unable to respond, please run rvinterf"; + main(argc, argv) char **argv; { @@ -128,6 +131,11 @@ case RVT_TCH_HEADER: print_tch_output_raw(); return; + case RVT_KEEPALIVE_HEADER: + if (rxpkt_len != 2 || rxpkt[1] != 'Q') + goto unknown; + output_line(keepalive_msg); + return; case '*': print_fc_lld_msg(); return;