Skip to content

Commit dcabb8f

Browse files
committed
Digipeat noid
1 parent 0f2b241 commit dcabb8f

File tree

3 files changed

+73
-49
lines changed

3 files changed

+73
-49
lines changed

src/audio_win.c

+2
Original file line numberDiff line numberDiff line change
@@ -561,6 +561,8 @@ int audio_open (struct audio_s *pa)
561561
*/
562562
case AUDIO_IN_TYPE_SOUNDCARD:
563563

564+
// Use InitializeCriticalSectionAndSpinCount to avoid exceptions in low memory situations?
565+
564566
InitializeCriticalSection (&(A->in_cs));
565567

566568
err = waveInOpen (&(A->audio_in_handle), in_dev_no[a], &wf, (DWORD_PTR)in_callback, a, CALLBACK_FUNCTION);

src/config.c

+12-1
Original file line numberDiff line numberDiff line change
@@ -2397,7 +2397,11 @@ void config_init (char *fname, struct audio_s *p_audio_config,
23972397
*/
23982398

23992399
/*
2400-
* DIGIPEAT from-chan to-chan alias-pattern wide-pattern [ OFF|DROP|MARK|TRACE ]
2400+
* DIGIPEAT from-chan to-chan alias-pattern wide-pattern [ OFF|DROP|MARK|TRACE | NOID=alias ]
2401+
*
2402+
* NOID is an ugly hack for the specific need of ATGP which needs more that 8 digipeaters.
2403+
* The via path starts out as HOP7-7,HOP7-7 and we do not want tracing so it does not fill up.
2404+
* DO NOT put this in the User Guide. On a need to know basis.
24012405
*/
24022406

24032407
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,
25232527
p_digi_config->preempt[from_chan][to_chan] = PREEMPT_TRACE;
25242528
t = split(NULL,0);
25252529
}
2530+
else if (strncasecmp(t, "NOID=", 5) == 0) {
2531+
strlcpy (p_digi_config->noid[from_chan][to_chan], t+5, sizeof(p_digi_config->noid[from_chan][to_chan]));;
2532+
t = split(NULL,0);
2533+
}
25262534
}
25272535

25282536
if (t != NULL) {
@@ -4729,6 +4737,7 @@ void config_init (char *fname, struct audio_s *p_audio_config,
47294737

47304738
/*
47314739
* KISSCOPY - Data from network KISS client is copied to all others.
4740+
* This does not apply to pseudo terminal KISS.
47324741
*/
47334742

47344743
else if (strcasecmp(t, "KISSCOPY") == 0) {
@@ -5633,6 +5642,8 @@ static int beacon_options(char *cmd, struct beacon_s *b, int line, struct audio_
56335642
}
56345643
}
56355644
else if (strcasecmp(keyword, "ALT") == 0 || strcasecmp(keyword, "ALTITUDE") == 0) {
5645+
5646+
// TODO: allow units.
56365647
b->alt_m = atof(value);
56375648
}
56385649
else if (strcasecmp(keyword, "ZONE") == 0) {

src/digipeater.c

+59-48
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373

7474

7575
static packet_t digipeat_match (int from_chan, packet_t pp, char *mycall_rec, char *mycall_xmit,
76-
regex_t *uidigi, regex_t *uitrace, int to_chan, enum preempt_e preempt, char *type_filter);
76+
regex_t *uidigi, regex_t *uitrace, int to_chan, enum preempt_e preempt, char *noid, char *type_filter);
7777

7878

7979
/*
@@ -176,6 +176,7 @@ void digipeater (int from_chan, packet_t pp)
176176
save_audio_config_p->achan[to_chan].mycall,
177177
&save_digi_config_p->alias[from_chan][to_chan], &save_digi_config_p->wide[from_chan][to_chan],
178178
to_chan, save_digi_config_p->preempt[from_chan][to_chan],
179+
save_digi_config_p->noid[from_chan][to_chan],
179180
save_digi_config_p->filter_str[from_chan][to_chan]);
180181
if (result != NULL) {
181182
dedupe_remember (pp, to_chan);
@@ -202,6 +203,7 @@ void digipeater (int from_chan, packet_t pp)
202203
save_audio_config_p->achan[to_chan].mycall,
203204
&save_digi_config_p->alias[from_chan][to_chan], &save_digi_config_p->wide[from_chan][to_chan],
204205
to_chan, save_digi_config_p->preempt[from_chan][to_chan],
206+
save_digi_config_p->noid[from_chan][to_chan],
205207
save_digi_config_p->filter_str[from_chan][to_chan]);
206208
if (result != NULL) {
207209
dedupe_remember (pp, to_chan);
@@ -244,6 +246,9 @@ void digipeater (int from_chan, packet_t pp)
244246
*
245247
* preempt - Option for "preemptive" digipeating.
246248
*
249+
* noid - No tracing if this matches alias prefix.
250+
* Hack added for special needs of ATGP.
251+
*
247252
* filter_str - Filter expression string or NULL.
248253
*
249254
* Returns: Packet object for transmission or NULL.
@@ -260,32 +265,9 @@ void digipeater (int from_chan, packet_t pp)
260265
*
261266
*------------------------------------------------------------------------------*/
262267

263-
#define OBSOLETE14 1
264-
265-
266-
#ifndef OBSOLETE14
267-
static char *dest_ssid_path[16] = {
268-
"", /* Use VIA path */
269-
"WIDE1-1",
270-
"WIDE2-2",
271-
"WIDE3-3",
272-
"WIDE4-4",
273-
"WIDE5-5",
274-
"WIDE6-6",
275-
"WIDE7-7",
276-
"WIDE1-1", /* North */
277-
"WIDE1-1", /* South */
278-
"WIDE1-1", /* East */
279-
"WIDE1-1", /* West */
280-
"WIDE2-2", /* North */
281-
"WIDE2-2", /* South */
282-
"WIDE2-2", /* East */
283-
"WIDE2-2" }; /* West */
284-
#endif
285-
286268

287269
static packet_t digipeat_match (int from_chan, packet_t pp, char *mycall_rec, char *mycall_xmit,
288-
regex_t *alias, regex_t *wide, int to_chan, enum preempt_e preempt, char *filter_str)
270+
regex_t *alias, regex_t *wide, int to_chan, enum preempt_e preempt, char *noid, char *filter_str)
289271
{
290272
char source[AX25_MAX_ADDR_LEN];
291273
int ssid;
@@ -323,15 +305,6 @@ static packet_t digipeat_match (int from_chan, packet_t pp, char *mycall_rec, ch
323305
* Otherwise we don't want to modify the input because this could be called multiple times.
324306
*/
325307

326-
#ifndef OBSOLETE14 // Took it out in 1.4
327-
328-
if (ax25_get_num_repeaters(pp) == 0 && (ssid = ax25_get_ssid(pp, AX25_DESTINATION)) > 0) {
329-
ax25_set_addr(pp, AX25_REPEATER_1, dest_ssid_path[ssid]);
330-
ax25_set_ssid(pp, AX25_DESTINATION, 0);
331-
/* Continue with general case, below. */
332-
}
333-
#endif
334-
335308

336309
/*
337310
* 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
510483
err = regexec(wide,repeater,0,NULL,0);
511484
if (err == 0) {
512485

486+
// Special hack added for ATGP to behave like UIFLOOD NOID in some TNCs.
487+
// More than 8 digipeater hops are required so tracing is disabled.
488+
489+
if (strlen(noid) > 0 && strncasecmp(repeater, noid, strlen(noid)) == 0) {
490+
491+
if (ssid >= 1 && ssid <= 7) {
492+
packet_t result;
493+
494+
result = ax25_dup (pp);
495+
assert (result != NULL);
496+
497+
if (ssid == 1) {
498+
ax25_set_h (result, r);
499+
}
500+
ax25_set_ssid(result, r, ssid-1); // could be zero.
501+
502+
return (result);
503+
}
504+
}
505+
513506
/*
514507
* If ssid == 1, we simply replace the repeater with my call and
515508
* mark it as being used.
@@ -627,6 +620,7 @@ static int failed;
627620

628621
static enum preempt_e preempt = PREEMPT_OFF;
629622

623+
static char config_noid[AX25_MAX_ADDR_LEN] = "HOP";
630624

631625

632626
static void test (char *in, char *out)
@@ -640,6 +634,7 @@ static void test (char *in, char *out)
640634
int frame_len;
641635
alevel_t alevel;
642636

637+
643638
dw_printf ("\n");
644639

645640
/*
@@ -689,9 +684,9 @@ static void test (char *in, char *out)
689684
text_color_set(DW_COLOR_REC);
690685
dw_printf ("Rec\t%s\n", rec);
691686

692-
//TODO: Add filtering to test.
693-
// V
694-
result = digipeat_match (0, pp, mycall, mycall, &alias_re, &wide_re, 0, preempt, NULL);
687+
//TODO: Add filtering to test.
688+
// V
689+
result = digipeat_match (0, pp, mycall, mycall, &alias_re, &wide_re, 0, preempt, config_noid, NULL);
695690

696691
if (result != NULL) {
697692

@@ -740,7 +735,7 @@ int main (int argc, char *argv[])
740735
exit (1);
741736
}
742737

743-
e = regcomp (&wide_re, "^WIDE[1-7]-[1-7]$|^TRACE[1-7]-[1-7]$|^MA[1-7]-[1-7]$", REG_EXTENDED|REG_NOSUB);
738+
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);
744739
if (e != 0) {
745740
regerror (e, &wide_re, message, sizeof(message));
746741
text_color_set(DW_COLOR_ERROR);
@@ -830,11 +825,8 @@ int main (int argc, char *argv[])
830825
*/
831826

832827
test ( "W1ABC>TEST-3:",
833-
#ifndef OBSOLETE14
834-
"W1ABC>TEST,WB2OSZ-9*,WIDE3-2:");
835-
#else
836828
"");
837-
#endif
829+
838830
test ( "W1DEF>TEST-3,WIDE2-2:",
839831
"W1DEF>TEST-3,WB2OSZ-9*,WIDE2-1:");
840832

@@ -844,17 +836,17 @@ int main (int argc, char *argv[])
844836
* The 4th case might be controversial.
845837
*/
846838

847-
test ( "W1XYZ>TEST,R1*,WIDE3-2:info1",
848-
"W1XYZ>TEST,R1,WB2OSZ-9*,WIDE3-1:info1");
839+
test ( "W1XYZ>TESTD,R1*,WIDE3-2:info1",
840+
"W1XYZ>TESTD,R1,WB2OSZ-9*,WIDE3-1:info1");
849841

850-
test ( "W1XYZ>TEST,R2*,WIDE3-2:info1",
842+
test ( "W1XYZ>TESTD,R2*,WIDE3-2:info1",
851843
"");
852844

853-
test ( "W1XYZ>TEST,R3*,WIDE3-2:info1",
845+
test ( "W1XYZ>TESTD,R3*,WIDE3-2:info1",
854846
"");
855847

856-
test ( "W1XYZ>TEST,R1*,WB2OSZ-9:has explicit routing",
857-
"W1XYZ>TEST,R1,WB2OSZ-9*:has explicit routing");
848+
test ( "W1XYZ>TESTD,R1*,WB2OSZ-9:has explicit routing",
849+
"W1XYZ>TESTD,R1,WB2OSZ-9*:has explicit routing");
858850

859851

860852
/*
@@ -931,6 +923,25 @@ int main (int argc, char *argv[])
931923
test ( "WB2OSZ-15>TEST14,WIDE1-1,WIDE1-1:stuff",
932924
"WB2OSZ-15>TEST14,WB2OSZ-9*,WIDE1-1:stuff");
933925

926+
// New in 1.7 - ATGP Hack
927+
928+
preempt = PREEMPT_OFF; // Shouldn't make a difference here.
929+
930+
test ( "W1ABC>TEST51,HOP7-7,HOP7-7:stuff1",
931+
"W1ABC>TEST51,HOP7-6,HOP7-7:stuff1");
932+
933+
test ( "W1ABC>TEST52,HOP7-1,HOP7-7:stuff2",
934+
"W1ABC>TEST52,HOP7*,HOP7-7:stuff2");
935+
936+
test ( "W1ABC>TEST52,HOP7*,HOP7-7:stuff3",
937+
"W1ABC>TEST52,HOP7*,HOP7-6:stuff3");
938+
939+
test ( "W1ABC>TEST52,HOP7*,HOP7-1:stuff4",
940+
"W1ABC>TEST52,HOP7,HOP7*:stuff4");
941+
942+
test ( "W1ABC>TEST52,HOP7,HOP7*:stuff",
943+
"");
944+
934945

935946

936947
if (failed == 0) {

0 commit comments

Comments
 (0)