comparison rvinterf/lowlevel/rvifmain.c @ 222:7168f63fc3b8

rvinterf: implemented keepalive mechanism
author Mychaela Falconia <falcon@freecalypso.org>
date Sat, 20 May 2017 21:00:15 +0000
parents e7502631a0f9
children 6f078c4a5506
comparison
equal deleted inserted replaced
221:a46a68500517 222:7168f63fc3b8
33 int max_fd; 33 int max_fd;
34 34
35 char *socket_pathname = "/tmp/rvinterf_socket"; 35 char *socket_pathname = "/tmp/rvinterf_socket";
36 36
37 int wakeup_after_sec = 7; 37 int wakeup_after_sec = 7;
38
39 static char keepalive_msg[] =
40 "Received keepalive query, responding with keepalive answer";
41 static u_char keepalive_answer[2] = {RVT_KEEPALIVE_HEADER, 'A'};
38 42
39 main(argc, argv) 43 main(argc, argv)
40 char **argv; 44 char **argv;
41 { 45 {
42 extern char *optarg; 46 extern char *optarg;
201 if (!no_output || logF) 205 if (!no_output || logF)
202 print_tch_output_raw(); 206 print_tch_output_raw();
203 if (client_head) 207 if (client_head)
204 forward_nonrvt_pkt(); 208 forward_nonrvt_pkt();
205 return; 209 return;
210 case RVT_KEEPALIVE_HEADER:
211 if (rxpkt_len != 2 || rxpkt[1] != 'Q')
212 goto unknown;
213 output_line(keepalive_msg);
214 send_pkt_to_target(keepalive_answer, 2);
215 return;
206 case '*': 216 case '*':
207 print_fc_lld_msg(); 217 print_fc_lld_msg();
208 return; 218 return;
209 default: 219 default:
210 unknown: 220 unknown: