Revision | 3652bb6c4696c75c500ca526a5d0006b48c08947 (tree) |
---|---|
Zeit | 2022-12-01 18:44:46 |
Autor | Satoshi Yasuda <7m3tjz@jarl...> |
Commiter | Satoshi Yasuda |
modified: dmonitor.h
modified: dmonitor_utils.c
modified: dvap.c
modified: dvmega_utils.c
modified: extern_dmonitor.h
modified: from_node.c
modified: inet_read.c
modified: init.c
modified: main.c
modified: repeater_mon.c
modified: rig_read.c
modified: rpt_conn.c
@@ -102,7 +102,7 @@ | ||
102 | 102 | #define PACKAGE_NAME "dmonitor" |
103 | 103 | |
104 | 104 | /* Define to the full name and version of this package. */ |
105 | -#define PACKAGE_STRING "dmonitor 01.81" | |
105 | +#define PACKAGE_STRING "dmonitor 01.82" | |
106 | 106 | |
107 | 107 | /* Define to the one symbol short name of this package. */ |
108 | 108 | #define PACKAGE_TARNAME "dmonitor" |
@@ -111,13 +111,13 @@ | ||
111 | 111 | #define PACKAGE_URL "" |
112 | 112 | |
113 | 113 | /* Define to the version of this package. */ |
114 | -#define PACKAGE_VERSION "01.81" | |
114 | +#define PACKAGE_VERSION "01.82" | |
115 | 115 | |
116 | 116 | /* Define to 1 if you have the ANSI C header files. */ |
117 | 117 | #define STDC_HEADERS 1 |
118 | 118 | |
119 | 119 | /* Version number of package */ |
120 | -#define VERSION "01.81" | |
120 | +#define VERSION "01.82" | |
121 | 121 | |
122 | 122 | /* Define for Solaris 2.5.1 so the uint32_t typedef from <sys/synch.h>, |
123 | 123 | <pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the |
@@ -1,6 +1,6 @@ | ||
1 | 1 | #! /bin/sh |
2 | 2 | # Guess values for system-dependent variables and create Makefiles. |
3 | -# Generated by GNU Autoconf 2.69 for dmonitor 01.81. | |
3 | +# Generated by GNU Autoconf 2.69 for dmonitor 01.82. | |
4 | 4 | # |
5 | 5 | # Report bugs to <7m3tjz@jarl.com>. |
6 | 6 | # |
@@ -580,8 +580,8 @@ MAKEFLAGS= | ||
580 | 580 | # Identity of this package. |
581 | 581 | PACKAGE_NAME='dmonitor' |
582 | 582 | PACKAGE_TARNAME='dmonitor' |
583 | -PACKAGE_VERSION='01.81' | |
584 | -PACKAGE_STRING='dmonitor 01.81' | |
583 | +PACKAGE_VERSION='01.82' | |
584 | +PACKAGE_STRING='dmonitor 01.82' | |
585 | 585 | PACKAGE_BUGREPORT='7m3tjz@jarl.com' |
586 | 586 | PACKAGE_URL='' |
587 | 587 |
@@ -1277,7 +1277,7 @@ if test "$ac_init_help" = "long"; then | ||
1277 | 1277 | # Omit some internal or obsolete options to make the list less imposing. |
1278 | 1278 | # This message is too long to be a string in the A/UX 3.1 sh. |
1279 | 1279 | cat <<_ACEOF |
1280 | -\`configure' configures dmonitor 01.81 to adapt to many kinds of systems. | |
1280 | +\`configure' configures dmonitor 01.82 to adapt to many kinds of systems. | |
1281 | 1281 | |
1282 | 1282 | Usage: $0 [OPTION]... [VAR=VALUE]... |
1283 | 1283 |
@@ -1344,7 +1344,7 @@ fi | ||
1344 | 1344 | |
1345 | 1345 | if test -n "$ac_init_help"; then |
1346 | 1346 | case $ac_init_help in |
1347 | - short | recursive ) echo "Configuration of dmonitor 01.81:";; | |
1347 | + short | recursive ) echo "Configuration of dmonitor 01.82:";; | |
1348 | 1348 | esac |
1349 | 1349 | cat <<\_ACEOF |
1350 | 1350 |
@@ -1435,7 +1435,7 @@ fi | ||
1435 | 1435 | test -n "$ac_init_help" && exit $ac_status |
1436 | 1436 | if $ac_init_version; then |
1437 | 1437 | cat <<\_ACEOF |
1438 | -dmonitor configure 01.81 | |
1438 | +dmonitor configure 01.82 | |
1439 | 1439 | generated by GNU Autoconf 2.69 |
1440 | 1440 | |
1441 | 1441 | Copyright (C) 2012 Free Software Foundation, Inc. |
@@ -1912,7 +1912,7 @@ cat >config.log <<_ACEOF | ||
1912 | 1912 | This file contains any messages produced by compilers while |
1913 | 1913 | running configure, to aid debugging if configure makes a mistake. |
1914 | 1914 | |
1915 | -It was created by dmonitor $as_me 01.81, which was | |
1915 | +It was created by dmonitor $as_me 01.82, which was | |
1916 | 1916 | generated by GNU Autoconf 2.69. Invocation command line was |
1917 | 1917 | |
1918 | 1918 | $ $0 $@ |
@@ -2773,7 +2773,7 @@ fi | ||
2773 | 2773 | |
2774 | 2774 | # Define the identity of the package. |
2775 | 2775 | PACKAGE='dmonitor' |
2776 | - VERSION='01.81' | |
2776 | + VERSION='01.82' | |
2777 | 2777 | |
2778 | 2778 | |
2779 | 2779 | cat >>confdefs.h <<_ACEOF |
@@ -5043,7 +5043,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 | ||
5043 | 5043 | # report actual input values of CONFIG_FILES etc. instead of their |
5044 | 5044 | # values after options handling. |
5045 | 5045 | ac_log=" |
5046 | -This file was extended by dmonitor $as_me 01.81, which was | |
5046 | +This file was extended by dmonitor $as_me 01.82, which was | |
5047 | 5047 | generated by GNU Autoconf 2.69. Invocation command line was |
5048 | 5048 | |
5049 | 5049 | CONFIG_FILES = $CONFIG_FILES |
@@ -5109,7 +5109,7 @@ _ACEOF | ||
5109 | 5109 | cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 |
5110 | 5110 | ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" |
5111 | 5111 | ac_cs_version="\\ |
5112 | -dmonitor config.status 01.81 | |
5112 | +dmonitor config.status 01.82 | |
5113 | 5113 | configured by $0, generated by GNU Autoconf 2.69, |
5114 | 5114 | with options \\"\$ac_cs_config\\" |
5115 | 5115 |
@@ -1,9 +1,33 @@ | ||
1 | +dmonitor (01.82) unstable; urgency=low | |
2 | + | |
3 | + * V01.82 release (#145) | |
4 | + | |
5 | + -- Satoshi Yasuda <7m3tjz@jarl.com> Wed, 27 Oct 2022 06:20:00 +0900 | |
6 | + | |
7 | +dmonitor (01.82c) unstable; urgency=low | |
8 | + | |
9 | + * added gps_skip_sw (#144) | |
10 | + | |
11 | + -- Satoshi Yasuda <7m3tjz@jarl.com> Wed, 26 Oct 2022 14:00:00 +0900 | |
12 | + | |
13 | +dmonitor (01.82b) unstable; urgency=low | |
14 | + | |
15 | + * changed repeacter_mon cookie (#143) | |
16 | + | |
17 | + -- Satoshi Yasuda <7m3tjz@jarl.com> Tue, 25 Oct 2022 11:50:00 +0900 | |
18 | + | |
19 | +dmonitor (01.82a) unstable; urgency=low | |
20 | + | |
21 | + * changed droppacket routine (#142) | |
22 | + | |
23 | + -- Satoshi Yasuda <7m3tjz@jarl.com> Mon, 24 Oct 2022 23:30:00 +0900 | |
24 | + | |
1 | 25 | dmonitor (01.81) unstable; urgency=low |
2 | 26 | |
3 | 27 | * bug fixed main.c (#141) |
4 | 28 | * added skip the gps only packet & ci-v mode |
5 | 29 | |
6 | - -- Satoshi Yasuda <7m3tjz@jarl.com> Tue, 18 Oct 2022 09:20:00 +0900 | |
30 | + -- Satoshi Yasuda <7m3tjz@jarl.com> Sat, 22 Oct 2022 23:20:00 +0900 | |
7 | 31 | |
8 | 32 | dmonitor (01.80) unstable; urgency=low |
9 | 33 |
@@ -41,6 +41,7 @@ | ||
41 | 41 | //#define _DEBUG_DVAP_SQUELCH |
42 | 42 | //#define _DEBUG_JITTER |
43 | 43 | //#define _DEBUG_INET |
44 | +//#define _DEBUG_RIG_WRITE_PACKET | |
44 | 45 | //#define _DEBUG_GPS_ONLY |
45 | 46 | #define _DEBUG_MD5 |
46 | 47 |
@@ -53,7 +54,7 @@ | ||
53 | 54 | #define HOLE_PUNCHD_SERVER "hole-punchd.d-star.info" |
54 | 55 | #define HOLE_PUNCHD_PORT 30010 |
55 | 56 | |
56 | -#define KEEP_ALIVE_INTERVAL 2 | |
57 | +#define KEEP_ALIVE_INTERVAL 5 | |
57 | 58 | |
58 | 59 | #define CONNECTED_LIST "/var/tmp/connected_table.html" |
59 | 60 | #define CONNECTED_LIST_TEMP "/var/tmp/connected_table.temp" |
@@ -108,6 +109,8 @@ int rig_fd; | ||
108 | 109 | struct termios save_attr; |
109 | 110 | struct termios attr; |
110 | 111 | |
112 | +struct sockaddr_in hole_punch_server_addr; | |
113 | + | |
111 | 114 | time_t send_time; |
112 | 115 | |
113 | 116 | time_t rig_alive_recv; |
@@ -133,6 +136,10 @@ struct timeval inet_recv_time; | ||
133 | 136 | struct timeval inet_recv_time_save; |
134 | 137 | struct timeval inet_recv_timeout; |
135 | 138 | |
139 | +struct timeval dvmega_recv_time; | |
140 | +struct timeval dvmega_status_time; | |
141 | +struct timeval dvmega_temp; | |
142 | + | |
136 | 143 | struct timeval rig_last_timeout; |
137 | 144 | int seq; |
138 | 145 | unsigned char send_buff[128]; |
@@ -324,7 +331,8 @@ long int l_int; | ||
324 | 331 | /* GPS skip */ |
325 | 332 | int gps_wait; |
326 | 333 | int gps_only; |
334 | +int gps_skip_sw; | |
327 | 335 | |
328 | 336 | char rf_header_save[44]; |
329 | 337 | |
330 | - | |
338 | +char voice_save[9]; |
@@ -16,6 +16,7 @@ void lcd_write(void); | ||
16 | 16 | int node_space_check (int length); |
17 | 17 | int check_getFifo(void); |
18 | 18 | void send_dvap_keep_alive(void); |
19 | +void send_synmetric_nat (void); | |
19 | 20 | |
20 | 21 | extern char dummy_frame_1[12]; |
21 | 22 | extern char dummy_frame_2[12]; |
@@ -44,6 +45,25 @@ int htoi (const char *s) | ||
44 | 45 | return n; |
45 | 46 | } |
46 | 47 | |
48 | +void get_hole_punch_server_addr (void) | |
49 | +{ | |
50 | + int k; | |
51 | + int n; | |
52 | + int ret; | |
53 | + char buff[88]; | |
54 | + struct hostent *host; | |
55 | + | |
56 | + hole_punch_server_addr.sin_family = AF_INET; | |
57 | + hole_punch_server_addr.sin_port = htons(hole_punch_port); | |
58 | + hole_punch_server_addr.sin_addr.s_addr = inet_addr(hole_punch_server); | |
59 | + if (hole_punch_server_addr.sin_addr.s_addr == 0xffffffff) | |
60 | + { | |
61 | + host = gethostbyname(hole_punch_server); | |
62 | + if (host == NULL) return; | |
63 | + hole_punch_server_addr.sin_addr.s_addr = *(unsigned int *)host->h_addr_list[0]; | |
64 | + } | |
65 | +} | |
66 | + | |
47 | 67 | int rig_open(void) |
48 | 68 | { |
49 | 69 | struct termios attr; |
@@ -138,7 +158,7 @@ void pselectSet(void) | ||
138 | 158 | { |
139 | 159 | FD_ZERO (&fd_save); |
140 | 160 | timeout.tv_sec = 0; |
141 | - timeout.tv_nsec = 10000000; | |
161 | + timeout.tv_nsec = 2000000; | |
142 | 162 | } |
143 | 163 | |
144 | 164 | void handler (int sig) |
@@ -261,6 +281,7 @@ int send_dest_keep_alive (void) | ||
261 | 281 | { |
262 | 282 | int k; |
263 | 283 | int n; |
284 | + int ret; | |
264 | 285 | char buff[80]; |
265 | 286 | struct hostent *host; |
266 | 287 |
@@ -277,8 +298,9 @@ int send_dest_keep_alive (void) | ||
277 | 298 | memset (buff, 0x00, sizeof(buff)); |
278 | 299 | memcpy (&buff[20], connect_call, 8); |
279 | 300 | sprintf (&buff[4], "%s", inet_ntoa (in_addr.sin_addr)); |
280 | - sendto(in_addr_sock, &buff[4], 24, MSG_DONTWAIT, | |
301 | + ret = sendto(in_addr_sock, &buff[4], 24, MSG_DONTWAIT, | |
281 | 302 | (struct sockaddr *)&in_addr, sizeof(in_addr)); |
303 | + if (ret == -1) syslog (LOG_ERR, "dest keep alive send error %s", strerror(errno)); | |
282 | 304 | time(&hole_punch_send_time); |
283 | 305 | time(&dest_keep_alive_send_time); |
284 | 306 | return TRUE; |
@@ -348,22 +370,13 @@ void send_keep_alive(void) | ||
348 | 370 | } |
349 | 371 | } |
350 | 372 | |
351 | - in_addr.sin_family = AF_INET; | |
352 | - in_addr.sin_port = htons(hole_punch_port); | |
353 | - in_addr.sin_addr.s_addr = inet_addr(hole_punch_server); | |
354 | - if (in_addr.sin_addr.s_addr == 0xffffffff) | |
355 | - { | |
356 | - host = gethostbyname(hole_punch_server); | |
357 | - if (host == NULL) return; | |
358 | - in_addr.sin_addr.s_addr = *(unsigned int *)host->h_addr_list[0]; | |
359 | - } | |
360 | 373 | memcpy (buff, "HPCH", 4); |
361 | 374 | memcpy (&buff[64], area_call, 8); |
362 | 375 | memcpy (&buff[72], zone_call, 7); |
363 | 376 | memcpy (&buff[80], connect_call, 8); |
364 | 377 | buff[79] = 0x20; |
365 | 378 | ret = sendto(in_addr_sock, buff, 88, MSG_DONTWAIT, |
366 | - (struct sockaddr *)&in_addr, sizeof(in_addr)); | |
379 | + (struct sockaddr *)&hole_punch_server_addr, sizeof(hole_punch_server_addr)); | |
367 | 380 | time(&hole_punch_send_time); |
368 | 381 | time(&dest_keep_alive_send_time); |
369 | 382 | } |
@@ -401,14 +414,17 @@ void send_drop_packet (void) | ||
401 | 414 | { |
402 | 415 | send_buff[0] = 0x10; |
403 | 416 | send_buff[1] = 0x22; |
417 | + send_buff[3]++; | |
404 | 418 | if (send_buff[3] > 20) |
405 | 419 | { |
406 | 420 | send_buff[3] = 0; |
407 | 421 | memcpy (&send_buff[4], NullVoice, 12); |
422 | + memcpy (&send_buff[4], voice_save, 9); | |
408 | 423 | } |
409 | 424 | else |
410 | 425 | { |
411 | 426 | memcpy (&send_buff[4], NullVoice1, 12); |
427 | + memcpy (&send_buff[4], voice_save, 9); | |
412 | 428 | } |
413 | 429 | send_buff[2] = seq & 0xff; |
414 | 430 | seq++; |
@@ -443,6 +459,7 @@ int send_rig (void) | ||
443 | 459 | else if (length == 42) |
444 | 460 | { |
445 | 461 | rig_write (42, &send_buff[3]); |
462 | + memcpy (voice_save, NullVoice, 9); | |
446 | 463 | seq = 0; |
447 | 464 | } |
448 | 465 | else if (length == 13) |
@@ -475,6 +492,7 @@ int send_rig (void) | ||
475 | 492 | frameID = 0; |
476 | 493 | } |
477 | 494 | } |
495 | + memcpy (voice_save, &send_buff[4], 9); | |
478 | 496 | return TRUE; |
479 | 497 | } |
480 | 498 |
@@ -1078,3 +1096,31 @@ void right_os (void) | ||
1078 | 1096 | ret = system (cmd); |
1079 | 1097 | } |
1080 | 1098 | |
1099 | +void send_synmetric_nat (void) | |
1100 | +{ | |
1101 | + int k; | |
1102 | + int n; | |
1103 | + char buff[42]; | |
1104 | + struct hostent *host; | |
1105 | + | |
1106 | + in_addr.sin_family = AF_INET; | |
1107 | + in_addr.sin_port = htons(dest_inet_port); | |
1108 | + //in_addr.sin_port = htons(51000); | |
1109 | + in_addr.sin_addr.s_addr = inet_addr(dest_address); | |
1110 | + if (in_addr.sin_addr.s_addr == 0xffffffff) | |
1111 | + { | |
1112 | + host = gethostbyname(dest_address); | |
1113 | + if (host == NULL) return; | |
1114 | + in_addr.sin_addr.s_addr = *(unsigned int *)host->h_addr_list[0]; | |
1115 | + } | |
1116 | + memset (buff, 0x00, sizeof(buff)); | |
1117 | + memcpy (buff, "HPCH", 4); | |
1118 | + sprintf (&buff[4], "%s:%d", inet_ntoa (in_addr.sin_addr), dest_inet_port); | |
1119 | + //memcpy (&buff[4], "0.0.0.0:0", 9); | |
1120 | + memcpy (&buff[26], area_call, 8); | |
1121 | + memcpy (&buff[34], zone_call, 8); | |
1122 | + buff[41] = 0x20; | |
1123 | + sendto(in_addr_sock, buff, 42, MSG_DONTWAIT, | |
1124 | + (struct sockaddr *)&in_addr, sizeof(in_addr)); | |
1125 | +} | |
1126 | + |
@@ -699,11 +699,14 @@ void dvap_send_voice (void) | ||
699 | 699 | if (gps_wait) |
700 | 700 | { |
701 | 701 | gps_wait = FALSE; |
702 | - if (!memcmp (&dvap_voice[6], NullVoice, 12) | |
703 | - || !memcmp (&dvap_voice[6], gps_only_1, 12)) | |
702 | + if (gps_skip_sw) | |
704 | 703 | { |
705 | - gps_only = TRUE; | |
706 | - goto gps_skip; | |
704 | + if (!memcmp (&dvap_voice[6], NullVoice, 12) | |
705 | + || !memcmp (&dvap_voice[6], gps_only_1, 12)) | |
706 | + { | |
707 | + gps_only = TRUE; | |
708 | + goto gps_skip; | |
709 | + } | |
707 | 710 | } |
708 | 711 | inet_send_buff[16] = 0x80; |
709 | 712 | //memcpy (&inet_send_buff[17], &dvap_header[6], 41); |
@@ -216,6 +216,7 @@ void dvmega_read (void) | ||
216 | 216 | break; |
217 | 217 | |
218 | 218 | case DVMEGA_DSTAR_DATA: |
219 | + gettimeofday (&dvmega_recv_time, NULL); | |
219 | 220 | if (gps_only) break; |
220 | 221 | if (gps_wait) |
221 | 222 | { |
@@ -226,17 +227,21 @@ void dvmega_read (void) | ||
226 | 227 | rig_buff[3], rig_buff[4], rig_buff[5], rig_buff[6], rig_buff[7], rig_buff[8], |
227 | 228 | rig_buff[9], rig_buff[10], rig_buff[11], rig_buff[12], rig_buff[13], rig_buff[14]); |
228 | 229 | syslog (LOG_DEBUG, "gps only 100 %2.2x %2.2x %2.2x %2.2x %2.2x %2.2x %2.2x %2.2x %2.2x %2.2x %2.2x %2.2x", |
229 | - gps_only_1[0], gps_only_1[1],gps_only_1[2],gps_only_1[3],gps_only_1[4],gps_only_1[5],gps_only_1[6],gps_only_1[7],gps_only_1[8],gps_only_1[9],gps_only_1[10],gps_only_1[11]); | |
230 | + gps_only_1[0], gps_only_1[1],gps_only_1[2],gps_only_1[3],gps_only_1[4],gps_only_1[5],gps_only_1[6], | |
231 | + gps_only_1[7],gps_only_1[8],gps_only_1[9],gps_only_1[10],gps_only_1[11]); | |
230 | 232 | #endif |
231 | - if (!memcmp (&rig_buff[3], NullVoice, 12) | |
232 | - || !memcmp (&rig_buff[3], gps_only_1, 12)) | |
233 | + if (gps_skip_sw) | |
233 | 234 | { |
234 | - #ifdef _DEBUG_GPS_ONLY | |
235 | - syslog (LOG_DEBUG, "gps only Set"); | |
236 | - #endif | |
237 | - frameID = 0; | |
238 | - gps_only = TRUE; | |
239 | - break; | |
235 | + if (!memcmp (&rig_buff[3], NullVoice, 12) | |
236 | + || !memcmp (&rig_buff[3], gps_only_1, 12)) | |
237 | + { | |
238 | + #ifdef _DEBUG_GPS_ONLY | |
239 | + syslog (LOG_DEBUG, "gps only Set"); | |
240 | + #endif | |
241 | + frameID = 0; | |
242 | + gps_only = TRUE; | |
243 | + break; | |
244 | + } | |
240 | 245 | } |
241 | 246 | gw_on = FALSE; |
242 | 247 | if (!inet_send_buff_set()) break; |
@@ -377,12 +382,13 @@ void dvmega_read (void) | ||
377 | 382 | #ifdef _DEBUG_DVMEGA |
378 | 383 | syslog (LOG_DEBUG, "EOT"); |
379 | 384 | #endif |
385 | +eot: | |
380 | 386 | send_header_sw = FALSE; |
381 | 387 | if (!dvmega_last_frame_sw) |
382 | 388 | { |
383 | 389 | if (send_sw && no_cmd_sw) |
384 | 390 | { |
385 | - //if (!gps_only) | |
391 | + if (!gps_only) | |
386 | 392 | { |
387 | 393 | inet_send_buff[9] = 0x13; |
388 | 394 | inet_send_buff[4] = (m_seq >> 8) & 0xff; |
@@ -408,8 +414,6 @@ void dvmega_read (void) | ||
408 | 414 | inet_send_buff[9] = 0x13; |
409 | 415 | inet_send_buff[4] = (m_seq >> 8) & 0xff; |
410 | 416 | inet_send_buff[5] = m_seq & 0xff; |
411 | - inet_send_buff[7] &= 0x33; | |
412 | - inet_send_buff[7] |= FWD | ZR; | |
413 | 417 | inet_send_buff[16] = dvmega_frame_seq; |
414 | 418 | inet_send_buff[16] |= 0x40; |
415 | 419 | dvmega_frame_seq++; |
@@ -437,6 +441,12 @@ void dvmega_read (void) | ||
437 | 441 | #ifdef _DEBUG_DVMEGA |
438 | 442 | syslog (LOG_INFO, "dvmega dstar space:%d dvmega_mode:%2.2x dvmega_tx:%2.2x", dvmega_dstarSpace, dvmega_mode, dvmega_tx); |
439 | 443 | #endif |
444 | + if ((inet_frame_id[0] == 0xff) && (inet_frame_id[1] == 0xff)) | |
445 | + { | |
446 | + gettimeofday (&dvmega_status_time, NULL); | |
447 | + timersub (&dvmega_status_time, &dvmega_recv_time, &dvmega_temp); | |
448 | + if (dvmega_temp.tv_sec || (dvmega_temp.tv_usec > 40000)) goto eot; | |
449 | + } | |
440 | 450 | break; |
441 | 451 | |
442 | 452 | default: |
@@ -40,6 +40,7 @@ | ||
40 | 40 | //#define _DEBUG_DVAP_SQUELCH |
41 | 41 | //#define _DEBUG_JITTER |
42 | 42 | //#define _DEBUG_INET |
43 | +//#define _DEBUG_RIG_WRITE_PACKET | |
43 | 44 | //#define _DEBUG_GPS_ONLY |
44 | 45 | |
45 | 46 | #define GW 0x80 |
@@ -51,7 +52,7 @@ | ||
51 | 52 | #define HOLE_PUNCHD_SERVER "hole-punchd.d-star.info" |
52 | 53 | #define HOLE_PUNCHD_PORT 30010 |
53 | 54 | |
54 | -#define KEEP_ALIVE_INTERVAL 2 | |
55 | +#define KEEP_ALIVE_INTERVAL 5 | |
55 | 56 | |
56 | 57 | #define CONNECTED_LIST "/var/tmp/connected_table.html" |
57 | 58 | #define CONNECTED_LIST_TEMP "/var/tmp/connected_table.temp" |
@@ -102,6 +103,8 @@ extern int in_addr_sock; | ||
102 | 103 | |
103 | 104 | extern struct sockaddr_in out_addr; |
104 | 105 | |
106 | +extern struct sockaddr_in hole_punch_server_addr; | |
107 | + | |
105 | 108 | extern int rig_fd; |
106 | 109 | extern struct termios save_attr; |
107 | 110 | extern struct termios attr; |
@@ -131,6 +134,10 @@ extern struct timeval inet_recv_time; | ||
131 | 134 | extern struct timeval inet_recv_time_save; |
132 | 135 | extern struct timeval inet_recv_timeout; |
133 | 136 | |
137 | +extern struct timeval dvmega_recv_time; | |
138 | +extern struct timeval dvmega_status_time; | |
139 | +extern struct timeval dvmega_temp; | |
140 | + | |
134 | 141 | extern struct timeval rig_last_timeout; |
135 | 142 | extern int seq; |
136 | 143 | extern unsigned char send_buff[128]; |
@@ -321,8 +328,10 @@ extern long int l_int; | ||
321 | 328 | /* GPS only cehck */ |
322 | 329 | extern int gps_wait; |
323 | 330 | extern int gps_only; |
331 | +extern int gps_skip_sw; | |
324 | 332 | |
325 | -extern char rf_header_save[44]; | |
333 | +extern char rf_header_save[44]; | |
334 | +extern char voice_save[9]; | |
326 | 335 | |
327 | 336 | extern unsigned char NullVoice[12]; |
328 | 337 | extern unsigned char NullVoice1[12]; |
@@ -183,12 +183,15 @@ int voice_read_from_node() | ||
183 | 183 | } |
184 | 184 | if (gps_wait) |
185 | 185 | { |
186 | - if (!memcmp (&node_voice_save[12], NullVoice, 12) | |
187 | - || !memcmp (&node_voice_save[12], gps_only_1, 12)) | |
186 | + if (gps_skip_sw) | |
188 | 187 | { |
189 | - gps_only = TRUE; | |
190 | - voice_pnt = 12; | |
191 | - goto loop_end;; | |
188 | + if (!memcmp (&node_voice_save[12], NullVoice, 12) | |
189 | + || !memcmp (&node_voice_save[12], gps_only_1, 12)) | |
190 | + { | |
191 | + gps_only = TRUE; | |
192 | + voice_pnt = 12; | |
193 | + goto loop_end;; | |
194 | + } | |
192 | 195 | } |
193 | 196 | gw_on = FALSE; |
194 | 197 | if (!inet_send_buff_set()) return len; |
@@ -85,9 +85,10 @@ void inet_read (void) | ||
85 | 85 | syslog (LOG_ERR, "recvfrom error (inet_read) %s", strerror (errno)); |
86 | 86 | return; |
87 | 87 | } |
88 | -//syslog (LOG_DEBUG, "test length %d %4.4s", length, recvBuff); | |
88 | +syslog (LOG_DEBUG, "length:%d %s", length, inet_ntoa (in_addr.sin_addr)); | |
89 | 89 | if (length == 24) |
90 | 90 | { |
91 | + //time (&dest_keep_alive_send_time); | |
91 | 92 | dest_keep_alive_send_time = 0; |
92 | 93 | dest_keep_alive_cnt = 0; |
93 | 94 | return; |
@@ -97,7 +98,7 @@ void inet_read (void) | ||
97 | 98 | if (!memcmp (recvBuff, "HPCH", 4)) |
98 | 99 | { |
99 | 100 | in_addr.sin_family = AF_INET; |
100 | - in_addr.sin_port = htons(dest_inet_port); | |
101 | + //in_addr.sin_port = htons(dest_inet_port); //debug test | |
101 | 102 | in_addr.sin_addr.s_addr = inet_addr(dest_address); |
102 | 103 | if (in_addr.sin_addr.s_addr == 0xffffffff) |
103 | 104 | { |
@@ -9,11 +9,13 @@ void init (void) | ||
9 | 9 | if (!scan_sw) syslog (LOG_INFO, "dmonitor start V%s (Compiled %s %s)\n", PACKAGE_VERSION, __DATE__, __TIME__); |
10 | 10 | else fprintf (status_fd, "dmonitor start V%s (Compiled %s %s)\n", PACKAGE_VERSION, __DATE__, __TIME__); |
11 | 11 | in_addr_sock = socket(AF_INET, SOCK_DGRAM, 0); |
12 | - if (setsockopt (in_addr_sock, SOL_SOCKET, SO_REUSEADDR, (const char *)&yes, sizeof(yes)) < 0) | |
12 | + #if 0 // for symmetric nat | |
13 | + if (setsockopt (in_addr_sock, SOL_SOCKET, SO_REUSEADDR, (const char *)&yes, sizeof(yes)) < 0) // symmetric nat | |
13 | 14 | { |
14 | 15 | syslog(LOG_ERR, "Monitor socket (setsockopt) error"); |
15 | 16 | if(scan_sw) fprintf (status_fd, "Monitor socket (setsockopt) error"); |
16 | 17 | } |
18 | + #endif | |
17 | 19 | |
18 | 20 | #if 0 |
19 | 21 | out_addr.sin_family = AF_INET; |
@@ -46,7 +46,8 @@ void lcd_write (void); | ||
46 | 46 | void ntpdate(void); |
47 | 47 | void dvap_reopen(void); |
48 | 48 | void invalid_os (void); |
49 | - | |
49 | +void send_synmetric_nat (void); | |
50 | +void get_hole_punch_server_addr (void); | |
50 | 51 | |
51 | 52 | time_t send_time; |
52 | 53 | unsigned char *ppp; |
@@ -148,6 +149,7 @@ os_ok: | ||
148 | 149 | { |
149 | 150 | rig_type = ICOM; |
150 | 151 | lcd_type = NONE; |
152 | + gps_skip_sw = TRUE; | |
151 | 153 | } |
152 | 154 | else |
153 | 155 | { |
@@ -163,6 +165,13 @@ os_ok: | ||
163 | 165 | else if (!memcmp (recvBuff, "G20x4", 5)) lcd_type = LCD_20x4; |
164 | 166 | else if (!memcmp (recvBuff, "G16x2", 5)) lcd_type = LCD_16x2; |
165 | 167 | } |
168 | + fgets (recvBuff, sizeof (recvBuff), dmonitor_file); // callsign skip | |
169 | + if (fgets (recvBuff, sizeof (recvBuff), dmonitor_file)) | |
170 | + { | |
171 | + if (!memcmp (recvBuff, "SKIP", 4)) gps_skip_sw = TRUE; | |
172 | + else | |
173 | + gps_skip_sw = FALSE; | |
174 | + } | |
166 | 175 | } |
167 | 176 | fclose (dmonitor_file); |
168 | 177 | } |
@@ -348,13 +357,14 @@ os_ok: | ||
348 | 357 | else if (rig_type == NODE) node_conf(); |
349 | 358 | dvap_first_voice_pkt = FALSE; |
350 | 359 | |
360 | + get_hole_punch_server_addr(); | |
351 | 361 | for (k = 0 ; k < 2 ; k++) |
352 | 362 | { |
353 | 363 | send_keep_alive(); |
354 | 364 | usleep (10000); |
355 | 365 | } |
356 | 366 | |
357 | - dest_keep_alive_cnt= 0; | |
367 | + dest_keep_alive_cnt = 0; | |
358 | 368 | memset (short_msg, 0x20, 20); |
359 | 369 | memset (used_call, 0x20, 8); |
360 | 370 | memset (used_call2, 0x20, 4); |
@@ -439,7 +449,7 @@ top: | ||
439 | 449 | if (hole_punch_send_cnt < 3) send_dest_keep_alive(); |
440 | 450 | else alt_send_dest_keep_alive(); |
441 | 451 | #else |
442 | - send_dest_keep_alive(); | |
452 | + send_keep_alive(); | |
443 | 453 | #endif |
444 | 454 | } |
445 | 455 | if (dest_keep_alive_send_time) |
@@ -447,7 +457,8 @@ top: | ||
447 | 457 | if ((cur_time - dest_keep_alive_send_time) >= KEEP_ALIVE_INTERVAL) |
448 | 458 | { |
449 | 459 | dest_keep_alive_cnt++; |
450 | - if (dest_keep_alive_cnt >= 10) | |
460 | +syslog (LOG_DEBUG, "dest_keep_alive_send_time:%d", dest_keep_alive_send_time); | |
461 | + if (dest_keep_alive_cnt >= (60 / KEEP_ALIVE_INTERVAL)) | |
451 | 462 | { |
452 | 463 | sprintf (msg_temp, "RPT DOWN %8.8s ", area_call); |
453 | 464 | memcpy (mycall2, "DOWN", 4); |
@@ -463,7 +474,7 @@ top: | ||
463 | 474 | } |
464 | 475 | break; |
465 | 476 | } |
466 | - send_keep_alive(); | |
477 | + send_dest_keep_alive(); | |
467 | 478 | } |
468 | 479 | } |
469 | 480 | if(rig_send_sw) |
@@ -472,15 +483,12 @@ top: | ||
472 | 483 | timeradd (&rig_send_time, &rig_send_time_20mSec, &temp_time); |
473 | 484 | if (timercmp (&c_time, &temp_time, >=)) |
474 | 485 | { |
475 | - if (send_rig()) | |
486 | + rig_send_time.tv_sec = temp_time.tv_sec; | |
487 | + rig_send_time.tv_usec = temp_time.tv_usec; | |
488 | + if (!send_rig()) | |
476 | 489 | { |
477 | - rig_send_time.tv_sec = temp_time.tv_sec; | |
478 | - rig_send_time.tv_usec = temp_time.tv_usec; | |
479 | - } | |
480 | - else | |
481 | - { | |
482 | - syslog (LOG_INFO, "Empty of the jitter buffer"); | |
483 | 490 | send_drop_packet(); |
491 | + syslog (LOG_INFO, "Empty of the jitter buffer"); | |
484 | 492 | //LastFrameSend(); |
485 | 493 | } |
486 | 494 | } |
@@ -494,14 +502,16 @@ top: | ||
494 | 502 | if (timercmp (&c_time, &temp_time, >)) |
495 | 503 | { |
496 | 504 | syslog (LOG_INFO, "%19.19s:%03ld", ctime(&c_time.tv_sec), c_time.tv_usec/1000); |
497 | - syslog (LOG_INFO, "%19.19s:%03ld", ctime(&inet_recv_timeout.tv_sec), inet_recv_timeout.tv_usec/1000); | |
505 | + syslog (LOG_INFO, "%19.19s:%03ld", ctime(&temp_time.tv_sec), temp_time.tv_usec/1000); | |
498 | 506 | syslog (LOG_INFO, "insert dummy_last_frame (main)"); |
499 | 507 | dummy_last_frame(); |
500 | 508 | //#ifdef _SPECIFICATION_CHECK |
501 | 509 | timersub (&c_time, &inet_recv_time, &temp_time); |
502 | 510 | syslog (LOG_INFO, "long interval %ld.%03ld Sec.", temp_time.tv_sec, temp_time.tv_usec/1000); |
503 | 511 | //#endif |
504 | - gettimeofday (&inet_recv_time, NULL); | |
512 | + //gettimeofday (&inet_recv_time, NULL); | |
513 | + inet_recv_time.tv_sec = temp_time.tv_sec; | |
514 | + inet_recv_time.tv_usec = temp_time.tv_usec; | |
505 | 515 | } |
506 | 516 | } |
507 | 517 | } |
@@ -212,7 +212,7 @@ void prase (char str[]) | ||
212 | 212 | col = 0; |
213 | 213 | } |
214 | 214 | area_save = area; |
215 | - fprintf (html_fd, "<a name=\"area%c\"></a>%cエリア<br>\n", area, area); | |
215 | + fprintf (html_fd, "<a id=\"area%c\">%cエリア</a><br>\n", area, area); | |
216 | 216 | fprintf (html_fd, "<table border=\"1\" style=\"font-size:0.9em;\">\n"); |
217 | 217 | } |
218 | 218 | if ((col % COL) == 0) fprintf (html_fd, "<tr>"); |
@@ -565,7 +565,7 @@ os_ok: | ||
565 | 565 | fprintf (html_fd, "}\n"); |
566 | 566 | fprintf (html_fd, "return(\"\");\n"); |
567 | 567 | fprintf (html_fd, "}\n"); |
568 | - fprintf (html_fd, "function setCookie(key, val, tmp) {\n"); | |
568 | + fprintf (html_fd, "function setCookie(key, val) {\n"); | |
569 | 569 | fprintf (html_fd, "tmp = key + \"=\" + escape(val) + \"; \";\n"); |
570 | 570 | fprintf (html_fd, "tmp += \"expires=Tue, 31-Dec-2030 23:59:59; \";\n"); |
571 | 571 | fprintf (html_fd, "document.cookie = tmp;\n"); |
@@ -518,11 +518,14 @@ int rig_read (void) | ||
518 | 518 | if (gps_wait) |
519 | 519 | { |
520 | 520 | gps_wait = FALSE; |
521 | - if (!memcmp (&rig_buff[4], NullVoice, 12) | |
522 | - || !memcmp (&rig_buff[4], gps_only_1, 12)) | |
521 | + if (gps_skip_sw) | |
523 | 522 | { |
524 | - gps_only = TRUE; | |
525 | - goto voice_skip; | |
523 | + if (!memcmp (&rig_buff[4], NullVoice, 12) | |
524 | + || !memcmp (&rig_buff[4], gps_only_1, 12)) | |
525 | + { | |
526 | + gps_only = TRUE; | |
527 | + goto voice_skip; | |
528 | + } | |
526 | 529 | } |
527 | 530 | inet_send_buff[16] = 0x80; |
528 | 531 | //memcpy (&inet_send_buff[17], &rig_buff[2], 41); |
@@ -655,6 +658,7 @@ void rig_write (int length, unsigned char buff[]) | ||
655 | 658 | { |
656 | 659 | int ret; |
657 | 660 | unsigned char temp[8]; |
661 | + struct timeval check_time; | |
658 | 662 | |
659 | 663 | if (length == 17) |
660 | 664 | { |
@@ -695,8 +699,10 @@ void rig_write (int length, unsigned char buff[]) | ||
695 | 699 | #ifdef _DEBUG_RIG_WRITE_PACKET |
696 | 700 | if (length == 17) |
697 | 701 | { |
698 | - syslog (LOG_DEBUG, | |
699 | - "%2.2x %2.2x %2.2x %2.2x %2.2x %2.2x %2.2x %2.2x %2.2x %2.2x %2.2x %2.2x %2.2x %2.2x %2.2x %2.2x %2.2x %d %d", | |
702 | + gettimeofday (&check_time, NULL); | |
703 | + syslog (LOG_DEBUG, | |
704 | + "%03ld %2.2x %2.2x %2.2x %2.2x %2.2x %2.2x %2.2x %2.2x %2.2x %2.2x %2.2x %2.2x %2.2x %2.2x %2.2x %2.2x %2.2x %d %d", | |
705 | + check_time.tv_usec/1000, | |
700 | 706 | buff[0], buff[1], buff[2], buff[3], buff[4], buff[5], buff[6], buff[7], buff[8], buff[9], buff[10], |
701 | 707 | buff[11], buff[12], buff[13], buff[14], buff[15], buff[16], fifo_hold_limit, Fifo_cnt); |
702 | 708 | } |
@@ -333,6 +333,6 @@ end: | ||
333 | 333 | if (udev) node_close(); |
334 | 334 | closelog(); |
335 | 335 | remove (PID_FILE); |
336 | - usleep (500000); | |
336 | + usleep (1000000); | |
337 | 337 | } |
338 | 338 |