mirror of https://github.com/wb2osz/direwolf.git
Digipeat noid
This commit is contained in:
parent
0f2b241763
commit
dcabb8f7a5
|
@ -561,6 +561,8 @@ int audio_open (struct audio_s *pa)
|
||||||
*/
|
*/
|
||||||
case AUDIO_IN_TYPE_SOUNDCARD:
|
case AUDIO_IN_TYPE_SOUNDCARD:
|
||||||
|
|
||||||
|
// Use InitializeCriticalSectionAndSpinCount to avoid exceptions in low memory situations?
|
||||||
|
|
||||||
InitializeCriticalSection (&(A->in_cs));
|
InitializeCriticalSection (&(A->in_cs));
|
||||||
|
|
||||||
err = waveInOpen (&(A->audio_in_handle), in_dev_no[a], &wf, (DWORD_PTR)in_callback, a, CALLBACK_FUNCTION);
|
err = waveInOpen (&(A->audio_in_handle), in_dev_no[a], &wf, (DWORD_PTR)in_callback, a, CALLBACK_FUNCTION);
|
||||||
|
|
13
src/config.c
13
src/config.c
|
@ -2397,7 +2397,11 @@ void config_init (char *fname, struct audio_s *p_audio_config,
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* DIGIPEAT from-chan to-chan alias-pattern wide-pattern [ OFF|DROP|MARK|TRACE ]
|
* DIGIPEAT from-chan to-chan alias-pattern wide-pattern [ OFF|DROP|MARK|TRACE | NOID=alias ]
|
||||||
|
*
|
||||||
|
* NOID is an ugly hack for the specific need of ATGP which needs more that 8 digipeaters.
|
||||||
|
* The via path starts out as HOP7-7,HOP7-7 and we do not want tracing so it does not fill up.
|
||||||
|
* DO NOT put this in the User Guide. On a need to know basis.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
else if (strcasecmp(t, "DIGIPEAT") == 0 || strcasecmp(t, "DIGIPEATER") == 0) {
|
else if (strcasecmp(t, "DIGIPEAT") == 0 || strcasecmp(t, "DIGIPEATER") == 0) {
|
||||||
|
@ -2523,6 +2527,10 @@ void config_init (char *fname, struct audio_s *p_audio_config,
|
||||||
p_digi_config->preempt[from_chan][to_chan] = PREEMPT_TRACE;
|
p_digi_config->preempt[from_chan][to_chan] = PREEMPT_TRACE;
|
||||||
t = split(NULL,0);
|
t = split(NULL,0);
|
||||||
}
|
}
|
||||||
|
else if (strncasecmp(t, "NOID=", 5) == 0) {
|
||||||
|
strlcpy (p_digi_config->noid[from_chan][to_chan], t+5, sizeof(p_digi_config->noid[from_chan][to_chan]));;
|
||||||
|
t = split(NULL,0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (t != NULL) {
|
if (t != NULL) {
|
||||||
|
@ -4729,6 +4737,7 @@ void config_init (char *fname, struct audio_s *p_audio_config,
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* KISSCOPY - Data from network KISS client is copied to all others.
|
* KISSCOPY - Data from network KISS client is copied to all others.
|
||||||
|
* This does not apply to pseudo terminal KISS.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
else if (strcasecmp(t, "KISSCOPY") == 0) {
|
else if (strcasecmp(t, "KISSCOPY") == 0) {
|
||||||
|
@ -5633,6 +5642,8 @@ static int beacon_options(char *cmd, struct beacon_s *b, int line, struct audio_
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (strcasecmp(keyword, "ALT") == 0 || strcasecmp(keyword, "ALTITUDE") == 0) {
|
else if (strcasecmp(keyword, "ALT") == 0 || strcasecmp(keyword, "ALTITUDE") == 0) {
|
||||||
|
|
||||||
|
// TODO: allow units.
|
||||||
b->alt_m = atof(value);
|
b->alt_m = atof(value);
|
||||||
}
|
}
|
||||||
else if (strcasecmp(keyword, "ZONE") == 0) {
|
else if (strcasecmp(keyword, "ZONE") == 0) {
|
||||||
|
|
107
src/digipeater.c
107
src/digipeater.c
|
@ -73,7 +73,7 @@
|
||||||
|
|
||||||
|
|
||||||
static packet_t digipeat_match (int from_chan, packet_t pp, char *mycall_rec, char *mycall_xmit,
|
static packet_t digipeat_match (int from_chan, packet_t pp, char *mycall_rec, char *mycall_xmit,
|
||||||
regex_t *uidigi, regex_t *uitrace, int to_chan, enum preempt_e preempt, char *type_filter);
|
regex_t *uidigi, regex_t *uitrace, int to_chan, enum preempt_e preempt, char *noid, char *type_filter);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -176,6 +176,7 @@ void digipeater (int from_chan, packet_t pp)
|
||||||
save_audio_config_p->achan[to_chan].mycall,
|
save_audio_config_p->achan[to_chan].mycall,
|
||||||
&save_digi_config_p->alias[from_chan][to_chan], &save_digi_config_p->wide[from_chan][to_chan],
|
&save_digi_config_p->alias[from_chan][to_chan], &save_digi_config_p->wide[from_chan][to_chan],
|
||||||
to_chan, save_digi_config_p->preempt[from_chan][to_chan],
|
to_chan, save_digi_config_p->preempt[from_chan][to_chan],
|
||||||
|
save_digi_config_p->noid[from_chan][to_chan],
|
||||||
save_digi_config_p->filter_str[from_chan][to_chan]);
|
save_digi_config_p->filter_str[from_chan][to_chan]);
|
||||||
if (result != NULL) {
|
if (result != NULL) {
|
||||||
dedupe_remember (pp, to_chan);
|
dedupe_remember (pp, to_chan);
|
||||||
|
@ -202,6 +203,7 @@ void digipeater (int from_chan, packet_t pp)
|
||||||
save_audio_config_p->achan[to_chan].mycall,
|
save_audio_config_p->achan[to_chan].mycall,
|
||||||
&save_digi_config_p->alias[from_chan][to_chan], &save_digi_config_p->wide[from_chan][to_chan],
|
&save_digi_config_p->alias[from_chan][to_chan], &save_digi_config_p->wide[from_chan][to_chan],
|
||||||
to_chan, save_digi_config_p->preempt[from_chan][to_chan],
|
to_chan, save_digi_config_p->preempt[from_chan][to_chan],
|
||||||
|
save_digi_config_p->noid[from_chan][to_chan],
|
||||||
save_digi_config_p->filter_str[from_chan][to_chan]);
|
save_digi_config_p->filter_str[from_chan][to_chan]);
|
||||||
if (result != NULL) {
|
if (result != NULL) {
|
||||||
dedupe_remember (pp, to_chan);
|
dedupe_remember (pp, to_chan);
|
||||||
|
@ -244,6 +246,9 @@ void digipeater (int from_chan, packet_t pp)
|
||||||
*
|
*
|
||||||
* preempt - Option for "preemptive" digipeating.
|
* preempt - Option for "preemptive" digipeating.
|
||||||
*
|
*
|
||||||
|
* noid - No tracing if this matches alias prefix.
|
||||||
|
* Hack added for special needs of ATGP.
|
||||||
|
*
|
||||||
* filter_str - Filter expression string or NULL.
|
* filter_str - Filter expression string or NULL.
|
||||||
*
|
*
|
||||||
* Returns: Packet object for transmission or NULL.
|
* Returns: Packet object for transmission or NULL.
|
||||||
|
@ -260,32 +265,9 @@ void digipeater (int from_chan, packet_t pp)
|
||||||
*
|
*
|
||||||
*------------------------------------------------------------------------------*/
|
*------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#define OBSOLETE14 1
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef OBSOLETE14
|
|
||||||
static char *dest_ssid_path[16] = {
|
|
||||||
"", /* Use VIA path */
|
|
||||||
"WIDE1-1",
|
|
||||||
"WIDE2-2",
|
|
||||||
"WIDE3-3",
|
|
||||||
"WIDE4-4",
|
|
||||||
"WIDE5-5",
|
|
||||||
"WIDE6-6",
|
|
||||||
"WIDE7-7",
|
|
||||||
"WIDE1-1", /* North */
|
|
||||||
"WIDE1-1", /* South */
|
|
||||||
"WIDE1-1", /* East */
|
|
||||||
"WIDE1-1", /* West */
|
|
||||||
"WIDE2-2", /* North */
|
|
||||||
"WIDE2-2", /* South */
|
|
||||||
"WIDE2-2", /* East */
|
|
||||||
"WIDE2-2" }; /* West */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
static packet_t digipeat_match (int from_chan, packet_t pp, char *mycall_rec, char *mycall_xmit,
|
static packet_t digipeat_match (int from_chan, packet_t pp, char *mycall_rec, char *mycall_xmit,
|
||||||
regex_t *alias, regex_t *wide, int to_chan, enum preempt_e preempt, char *filter_str)
|
regex_t *alias, regex_t *wide, int to_chan, enum preempt_e preempt, char *noid, char *filter_str)
|
||||||
{
|
{
|
||||||
char source[AX25_MAX_ADDR_LEN];
|
char source[AX25_MAX_ADDR_LEN];
|
||||||
int ssid;
|
int ssid;
|
||||||
|
@ -323,15 +305,6 @@ static packet_t digipeat_match (int from_chan, packet_t pp, char *mycall_rec, ch
|
||||||
* Otherwise we don't want to modify the input because this could be called multiple times.
|
* Otherwise we don't want to modify the input because this could be called multiple times.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef OBSOLETE14 // Took it out in 1.4
|
|
||||||
|
|
||||||
if (ax25_get_num_repeaters(pp) == 0 && (ssid = ax25_get_ssid(pp, AX25_DESTINATION)) > 0) {
|
|
||||||
ax25_set_addr(pp, AX25_REPEATER_1, dest_ssid_path[ssid]);
|
|
||||||
ax25_set_ssid(pp, AX25_DESTINATION, 0);
|
|
||||||
/* Continue with general case, below. */
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Find the first repeater station which doesn't have "has been repeated" set.
|
* Find the first repeater station which doesn't have "has been repeated" set.
|
||||||
|
@ -510,6 +483,26 @@ static packet_t digipeat_match (int from_chan, packet_t pp, char *mycall_rec, ch
|
||||||
err = regexec(wide,repeater,0,NULL,0);
|
err = regexec(wide,repeater,0,NULL,0);
|
||||||
if (err == 0) {
|
if (err == 0) {
|
||||||
|
|
||||||
|
// Special hack added for ATGP to behave like UIFLOOD NOID in some TNCs.
|
||||||
|
// More than 8 digipeater hops are required so tracing is disabled.
|
||||||
|
|
||||||
|
if (strlen(noid) > 0 && strncasecmp(repeater, noid, strlen(noid)) == 0) {
|
||||||
|
|
||||||
|
if (ssid >= 1 && ssid <= 7) {
|
||||||
|
packet_t result;
|
||||||
|
|
||||||
|
result = ax25_dup (pp);
|
||||||
|
assert (result != NULL);
|
||||||
|
|
||||||
|
if (ssid == 1) {
|
||||||
|
ax25_set_h (result, r);
|
||||||
|
}
|
||||||
|
ax25_set_ssid(result, r, ssid-1); // could be zero.
|
||||||
|
|
||||||
|
return (result);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If ssid == 1, we simply replace the repeater with my call and
|
* If ssid == 1, we simply replace the repeater with my call and
|
||||||
* mark it as being used.
|
* mark it as being used.
|
||||||
|
@ -627,6 +620,7 @@ static int failed;
|
||||||
|
|
||||||
static enum preempt_e preempt = PREEMPT_OFF;
|
static enum preempt_e preempt = PREEMPT_OFF;
|
||||||
|
|
||||||
|
static char config_noid[AX25_MAX_ADDR_LEN] = "HOP";
|
||||||
|
|
||||||
|
|
||||||
static void test (char *in, char *out)
|
static void test (char *in, char *out)
|
||||||
|
@ -640,6 +634,7 @@ static void test (char *in, char *out)
|
||||||
int frame_len;
|
int frame_len;
|
||||||
alevel_t alevel;
|
alevel_t alevel;
|
||||||
|
|
||||||
|
|
||||||
dw_printf ("\n");
|
dw_printf ("\n");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -689,9 +684,9 @@ static void test (char *in, char *out)
|
||||||
text_color_set(DW_COLOR_REC);
|
text_color_set(DW_COLOR_REC);
|
||||||
dw_printf ("Rec\t%s\n", rec);
|
dw_printf ("Rec\t%s\n", rec);
|
||||||
|
|
||||||
//TODO: Add filtering to test.
|
//TODO: Add filtering to test.
|
||||||
// V
|
// V
|
||||||
result = digipeat_match (0, pp, mycall, mycall, &alias_re, &wide_re, 0, preempt, NULL);
|
result = digipeat_match (0, pp, mycall, mycall, &alias_re, &wide_re, 0, preempt, config_noid, NULL);
|
||||||
|
|
||||||
if (result != NULL) {
|
if (result != NULL) {
|
||||||
|
|
||||||
|
@ -740,7 +735,7 @@ int main (int argc, char *argv[])
|
||||||
exit (1);
|
exit (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
e = regcomp (&wide_re, "^WIDE[1-7]-[1-7]$|^TRACE[1-7]-[1-7]$|^MA[1-7]-[1-7]$", REG_EXTENDED|REG_NOSUB);
|
e = regcomp (&wide_re, "^WIDE[1-7]-[1-7]$|^TRACE[1-7]-[1-7]$|^MA[1-7]-[1-7]$|^HOP[1-7]-[1-7]$", REG_EXTENDED|REG_NOSUB);
|
||||||
if (e != 0) {
|
if (e != 0) {
|
||||||
regerror (e, &wide_re, message, sizeof(message));
|
regerror (e, &wide_re, message, sizeof(message));
|
||||||
text_color_set(DW_COLOR_ERROR);
|
text_color_set(DW_COLOR_ERROR);
|
||||||
|
@ -830,11 +825,8 @@ int main (int argc, char *argv[])
|
||||||
*/
|
*/
|
||||||
|
|
||||||
test ( "W1ABC>TEST-3:",
|
test ( "W1ABC>TEST-3:",
|
||||||
#ifndef OBSOLETE14
|
|
||||||
"W1ABC>TEST,WB2OSZ-9*,WIDE3-2:");
|
|
||||||
#else
|
|
||||||
"");
|
"");
|
||||||
#endif
|
|
||||||
test ( "W1DEF>TEST-3,WIDE2-2:",
|
test ( "W1DEF>TEST-3,WIDE2-2:",
|
||||||
"W1DEF>TEST-3,WB2OSZ-9*,WIDE2-1:");
|
"W1DEF>TEST-3,WB2OSZ-9*,WIDE2-1:");
|
||||||
|
|
||||||
|
@ -844,17 +836,17 @@ int main (int argc, char *argv[])
|
||||||
* The 4th case might be controversial.
|
* The 4th case might be controversial.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
test ( "W1XYZ>TEST,R1*,WIDE3-2:info1",
|
test ( "W1XYZ>TESTD,R1*,WIDE3-2:info1",
|
||||||
"W1XYZ>TEST,R1,WB2OSZ-9*,WIDE3-1:info1");
|
"W1XYZ>TESTD,R1,WB2OSZ-9*,WIDE3-1:info1");
|
||||||
|
|
||||||
test ( "W1XYZ>TEST,R2*,WIDE3-2:info1",
|
test ( "W1XYZ>TESTD,R2*,WIDE3-2:info1",
|
||||||
"");
|
"");
|
||||||
|
|
||||||
test ( "W1XYZ>TEST,R3*,WIDE3-2:info1",
|
test ( "W1XYZ>TESTD,R3*,WIDE3-2:info1",
|
||||||
"");
|
"");
|
||||||
|
|
||||||
test ( "W1XYZ>TEST,R1*,WB2OSZ-9:has explicit routing",
|
test ( "W1XYZ>TESTD,R1*,WB2OSZ-9:has explicit routing",
|
||||||
"W1XYZ>TEST,R1,WB2OSZ-9*:has explicit routing");
|
"W1XYZ>TESTD,R1,WB2OSZ-9*:has explicit routing");
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -931,6 +923,25 @@ int main (int argc, char *argv[])
|
||||||
test ( "WB2OSZ-15>TEST14,WIDE1-1,WIDE1-1:stuff",
|
test ( "WB2OSZ-15>TEST14,WIDE1-1,WIDE1-1:stuff",
|
||||||
"WB2OSZ-15>TEST14,WB2OSZ-9*,WIDE1-1:stuff");
|
"WB2OSZ-15>TEST14,WB2OSZ-9*,WIDE1-1:stuff");
|
||||||
|
|
||||||
|
// New in 1.7 - ATGP Hack
|
||||||
|
|
||||||
|
preempt = PREEMPT_OFF; // Shouldn't make a difference here.
|
||||||
|
|
||||||
|
test ( "W1ABC>TEST51,HOP7-7,HOP7-7:stuff1",
|
||||||
|
"W1ABC>TEST51,HOP7-6,HOP7-7:stuff1");
|
||||||
|
|
||||||
|
test ( "W1ABC>TEST52,HOP7-1,HOP7-7:stuff2",
|
||||||
|
"W1ABC>TEST52,HOP7*,HOP7-7:stuff2");
|
||||||
|
|
||||||
|
test ( "W1ABC>TEST52,HOP7*,HOP7-7:stuff3",
|
||||||
|
"W1ABC>TEST52,HOP7*,HOP7-6:stuff3");
|
||||||
|
|
||||||
|
test ( "W1ABC>TEST52,HOP7*,HOP7-1:stuff4",
|
||||||
|
"W1ABC>TEST52,HOP7,HOP7*:stuff4");
|
||||||
|
|
||||||
|
test ( "W1ABC>TEST52,HOP7,HOP7*:stuff",
|
||||||
|
"");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (failed == 0) {
|
if (failed == 0) {
|
||||||
|
|
Loading…
Reference in New Issue