Add new "v" packet filter.

Similar to "d" but it considers unused, rather than used, digipeaters.
This commit is contained in:
WB2OSZ 2016-01-26 23:45:58 -05:00
parent 107a8125c7
commit 87d9fe00b8
3 changed files with 28 additions and 4 deletions

View File

@ -10,6 +10,8 @@
- AGW network protocol now works properly for big-endian processors - AGW network protocol now works properly for big-endian processors
such as PowerPC or MIPS. such as PowerPC or MIPS.
- The Mac OSX build procedure is now better about locating the SDK.
---------- ----------
@ -17,7 +19,7 @@ such as PowerPC or MIPS.
### New Feature: ### ### New Feature: ###
- Added support for hamlib. This will provide more flexible options for PTT control. - Added support for hamlib. This will provide more flexible options for PTT control. Needs better documentation.
---------- ----------

Binary file not shown.

View File

@ -1,7 +1,7 @@
// //
// This file is part of Dire Wolf, an amateur radio packet TNC. // This file is part of Dire Wolf, an amateur radio packet TNC.
// //
// Copyright (C) 2015 John Langner, WB2OSZ // Copyright (C) 2015, 2016 John Langner, WB2OSZ
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by
@ -449,15 +449,29 @@ static int parse_filter_spec (pfstate_t *pf)
} }
else if (pf->token_str[0] == 'd' && ispunct(pf->token_str[1])) { else if (pf->token_str[0] == 'd' && ispunct(pf->token_str[1])) {
int n; int n;
// loop on used digipeaters // loop on all digipeaters
result = 0; result = 0;
for (n = AX25_REPEATER_1; result == 0 && n < ax25_get_num_addr (pf->pp); n++) { for (n = AX25_REPEATER_1; result == 0 && n < ax25_get_num_addr (pf->pp); n++) {
// Consider only those with the H (has-been-used) bit set.
if (ax25_get_h (pf->pp, n)) { if (ax25_get_h (pf->pp, n)) {
ax25_get_addr_with_ssid (pf->pp, n, addr); ax25_get_addr_with_ssid (pf->pp, n, addr);
result = filt_bodgu (pf, addr); result = filt_bodgu (pf, addr);
} }
} }
} }
else if (pf->token_str[0] == 'v' && ispunct(pf->token_str[1])) {
int n;
// loop on all digipeaters (mnemonic Via)
result = 0;
for (n = AX25_REPEATER_1; result == 0 && n < ax25_get_num_addr (pf->pp); n++) {
// This is different than the previous "d" filter.
// Consider only those where the the H (has-been-used) bit is NOT set.
if ( ! ax25_get_h (pf->pp, n)) {
ax25_get_addr_with_ssid (pf->pp, n, addr);
result = filt_bodgu (pf, addr);
}
}
}
else if (pf->token_str[0] == 'g' && ispunct(pf->token_str[1])) { else if (pf->token_str[0] == 'g' && ispunct(pf->token_str[1])) {
/* Addressee of message. */ /* Addressee of message. */
if (ax25_get_dti(pf->pp) == ':') { if (ax25_get_dti(pf->pp) == ':') {
@ -529,6 +543,7 @@ static int parse_filter_spec (pfstate_t *pf)
* Digipeater d/digi1/digi2... * Digipeater d/digi1/digi2...
* Group Msg g/call1/call2... * Group Msg g/call1/call2...
* Unproto u/unproto1/unproto2... * Unproto u/unproto1/unproto2...
* Via-not-yet v/digi1/digi2...
* *
* arg - Value to match from source addr, destination, * arg - Value to match from source addr, destination,
* used digipeater, object name, etc. * used digipeater, object name, etc.
@ -1048,6 +1063,13 @@ int main ()
pftest (161, "s//#/LS1", "WB2OSZ-5>APDW12:!4237.14N\\07120.83W#PHG7140Chelmsford MA", 0); pftest (161, "s//#/LS1", "WB2OSZ-5>APDW12:!4237.14N\\07120.83W#PHG7140Chelmsford MA", 0);
pftest (162, "s//#/LS1", "WB2OSZ-5>APDW12:!4237.14N/07120.83W#PHG7140Chelmsford MA", 0); pftest (162, "s//#/LS1", "WB2OSZ-5>APDW12:!4237.14N/07120.83W#PHG7140Chelmsford MA", 0);
pftest (170, "v/DIGI2/DIGI3", "WB2OSZ-5>APDW12,DIGI1,DIGI2,DIGI3,DIGI4:!4237.14NS07120.83W#PHG7140Chelmsford MA", 1);
pftest (171, "v/DIGI2/DIGI3", "WB2OSZ-5>APDW12,DIGI1*,DIGI2,DIGI3,DIGI4:!4237.14NS07120.83W#PHG7140Chelmsford MA", 1);
pftest (172, "v/DIGI2/DIGI3", "WB2OSZ-5>APDW12,DIGI1,DIGI2*,DIGI3,DIGI4:!4237.14NS07120.83W#PHG7140Chelmsford MA", 1);
pftest (173, "v/DIGI2/DIGI3", "WB2OSZ-5>APDW12,DIGI1,DIGI2,DIGI3*,DIGI4:!4237.14NS07120.83W#PHG7140Chelmsford MA", 0);
pftest (174, "v/DIGI2/DIGI3", "WB2OSZ-5>APDW12,DIGI1,DIGI2,DIGI3,DIGI4*:!4237.14NS07120.83W#PHG7140Chelmsford MA", 0);
pftest (175, "v/DIGI9/DIGI2", "WB2OSZ-5>APDW12,DIGI1,DIGI2*,DIGI3,DIGI4:!4237.14NS07120.83W#PHG7140Chelmsford MA", 0);
/* Test error reporting. */ /* Test error reporting. */
pftest (200, "x/", "CWAPID>APRS:;CWAttttz *DDHHMMzLATLONICONADVISETYPE{seq#", -1); pftest (200, "x/", "CWAPID>APRS:;CWAttttz *DDHHMMzLATLONICONADVISETYPE{seq#", -1);