From 2ccd083256a3a05ae1f402a0ef259fbfff709088 Mon Sep 17 00:00:00 2001 From: Dave Hibberd Date: Fri, 8 Dec 2023 12:26:52 +0000 Subject: [PATCH] New upstream version 6.0.24.22 --- APRSCode.c | 4 +- AlertWords.txt | 2 - BPQINP3.c | 10 +- BPQMail.c | 3 +- BPQTermMDI.c | 27 +++++ Bpq32.c | 9 +- BpqTermMDI.h | 1 + ChatUsers.txt | 16 --- CommonCode.c | 1 + FormatHTML.cpp | 60 +++++++++++ FormatHTML.vcproj | 219 +++++++++++++++++++++++++++++++++++++++ IPCode.c | 48 ++++++--- KernelScript1.rc | 7 +- L4Code.c | 2 +- LinBPQ.c | 2 +- MHSave.txt | 0 MailNode.vcxproj | 6 +- MailNode.vcxproj.filters | 3 + MailNode.vcxproj.user | 2 +- Moncode.c | 2 +- RTKnown.txt | 26 ----- RigControl.c | 98 ++++++++++++------ SCSPactor.c | 14 +++ Versions.h | 6 +- WebMail.c | 9 ++ WinRPR.c | 40 ++++--- cMain.c | 2 +- configstructs.h | 2 +- nodelog.txt | 0 nodestatus.txt | 2 - rigcontrol.h | 3 +- savelinks.txt | 0 savenodes.txt | 0 upnp.c | 14 ++- upnp.c.bak | 187 +++++++++++++++++++++++++++++++++ 35 files changed, 694 insertions(+), 133 deletions(-) delete mode 100644 AlertWords.txt delete mode 100644 ChatUsers.txt create mode 100644 FormatHTML.cpp create mode 100644 FormatHTML.vcproj delete mode 100644 MHSave.txt delete mode 100644 RTKnown.txt delete mode 100644 nodelog.txt delete mode 100644 nodestatus.txt delete mode 100644 savelinks.txt delete mode 100644 savenodes.txt create mode 100644 upnp.c.bak diff --git a/APRSCode.c b/APRSCode.c index fea004a..a9af47a 100644 --- a/APRSCode.c +++ b/APRSCode.c @@ -1581,9 +1581,9 @@ OK: // Copy frame to a DIGIMessage Struct - memcpy(&Msg, monbuff, 21 + (7 * Digis)); // Header, Dest, Source, Addresses and Digis + memcpy(&Msg, monbuff, MSGHDDRLEN + 14 + (7 * Digis)); // Header, Dest, Source, Addresses and Digis - len = Msg.LENGTH - 21 - (7 * Digis); // Payload Length (including CTL and PID + len = Msg.LENGTH - (MSGHDDRLEN + 14) - (7 * Digis); // Payload Length (including CTL and PID memcpy(&Msg.CTL, &AdjBuff->CTL, len); diff --git a/AlertWords.txt b/AlertWords.txt deleted file mode 100644 index 97b746b..0000000 --- a/AlertWords.txt +++ /dev/null @@ -1,2 +0,0 @@ -g8bpq -very bad phrase diff --git a/BPQINP3.c b/BPQINP3.c index e541518..bfe7cb0 100644 --- a/BPQINP3.c +++ b/BPQINP3.c @@ -358,9 +358,7 @@ VOID ProcessINP3RIF(struct ROUTE * Route, UCHAR * ptr1, int msglen, int Port) // Update Timestamp on Route - time((time_t *)&Stamp); - - Stamp = Stamp % 86400; // Secs into day + Stamp = time(NULL) % 86400; // Secs into day HH = Stamp / 3600; Stamp -= HH * 3600; @@ -370,6 +368,12 @@ VOID ProcessINP3RIF(struct ROUTE * Route, UCHAR * ptr1, int msglen, int Port) while (msglen > 0) { + if (msglen < 10) + { + Debugprintf("Corrupt INP3 Message"); + return; + } + memset(alias, ' ', 6); memcpy(axcall, ptr1, 7); diff --git a/BPQMail.c b/BPQMail.c index f586b86..bd37641 100644 --- a/BPQMail.c +++ b/BPQMail.c @@ -1120,8 +1120,9 @@ // 6.0.25.1 ?? -// Add FBB reject.sys style filters (3) +// Add FBB reject.sys style filters (3) // Improve Webmail on 64 bit builds +// Fix setting status '$' on Bulls sent via WebMail (22) diff --git a/BPQTermMDI.c b/BPQTermMDI.c index 54ef348..d07eb39 100644 --- a/BPQTermMDI.c +++ b/BPQTermMDI.c @@ -613,6 +613,11 @@ VOID CALLBACK SetupTermSessions(HWND hwnd, UINT uMsg, UINT idEvent, DWORD dw else AppendMenu(hMonCfgMenu,MF_STRING | MF_UNCHECKED,BPQBASE + i,msg); } + + if (mtxparam & 0x80) + CheckMenuItem(hMonCfgMenu,MONLOCALTIME,MF_CHECKED); + else + CheckMenuItem(hMonCfgMenu,MONLOCALTIME,MF_UNCHECKED); if (mtxparam & 1) CheckMenuItem(hMonCfgMenu,BPQMTX,MF_CHECKED); @@ -1733,6 +1738,10 @@ LRESULT CALLBACK MonWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPara break; } + case MONLOCALTIME: + + ToggleLocalTime(); + break; case BPQMTX: @@ -4266,6 +4275,24 @@ int ToggleMTX(HWND hWnd) return (0); +} + +int ToggleLocalTime(HWND hWnd) +{ + mtxparam = mtxparam ^ 0x80; + + if (mtxparam & 0x80) + + CheckMenuItem(hMonCfgMenu,MONLOCALTIME,MF_CHECKED); + + else + + CheckMenuItem(hMonCfgMenu,MONLOCALTIME,MF_UNCHECKED); + + IntSetTraceOptionsEx(portmask,mtxparam,mcomparam, monUI); + + return (0); + } int ToggleMCOM(HWND hWnd) { diff --git a/Bpq32.c b/Bpq32.c index 9d87e34..f2c5451 100644 --- a/Bpq32.c +++ b/Bpq32.c @@ -1195,7 +1195,14 @@ along with LinBPQ/BPQ32. If not, see http://www.gnu.org/licenses // Allow zero resptime (send RR immediately) (13) // Make sure CMD bit is set on UI frames // Add setting Modem Flags in QtSM AGW mode -// If FT847 om PTC Port send a "Cat On" command (16) +// If FT847 om PTC Port send a "Cat On" command (17) +// Fix some 63 port bugs in RigCOntrol (17) +// Fix 63 port bug in Bridging (18) +// Add FTDX10 Rigcontrol (19) +// Fix 64 bit bug in displaying INP3 Messages (20) +// Improve restart of WinRPR TNC on remote host (21) +// Fix some Rigcontrol issues with empty timebands (22) +// Fix 64 bit bug in processing INP3 Messages (22) #define CKernel diff --git a/BpqTermMDI.h b/BpqTermMDI.h index b92785f..d011a26 100644 --- a/BpqTermMDI.h +++ b/BpqTermMDI.h @@ -40,6 +40,7 @@ #define CHATTERM 1179 #define IDM_CLOSEWINDOW 1180 #define MONITORAPRS 1181 +#define MONLOCALTIME 1182 #define MON_UI_ONLY 40006 #define StopALLMon 40007 diff --git a/ChatUsers.txt b/ChatUsers.txt deleted file mode 100644 index 17a5a25..0000000 --- a/ChatUsers.txt +++ /dev/null @@ -1,16 +0,0 @@ -IZ4FVW 0 Giulio Cesena ITA JN64ce, 1k2 bps radio link¬55¬0 -N5UXT 0 Angelo th New Orleans, La¬99¬0 -N0NJY 0 Rick Oak Island, NC¬76¬0 -KB8UVN 0 Matt Johnstown, Ohio¬95¬0 -WA3WLH 0 Rich East Greenville, PA¬55¬0 -EI2GYB 0 Steve_353 Donegal, Ireland (IO65JG)¬55¬0 -PE1RRR 0 Red Network Hub Monitor¬91¬0 -PE1NNZ 0 Guido nr Eindhoven¬91¬0 -G7TAJ 0 Steve_44 E.Sussex UK,JO00FU¬91¬0 -N3HYM 0 Ray Frederick, Md¬97¬0 -VE3CGH 0 Ted ?_qth¬71¬0 -WE1H 0 Matt Merrimack, NH¬26¬0 -W9IKU 0 Greg Portage, Wisconsin USA¬55¬0 -KA3VSP 0 Brian New Castle, DE¬91¬0 -G8BPQ 0 John Nottingham¬26¬0 -GM8BPQ 40 John ?_qth¬14¬0 diff --git a/CommonCode.c b/CommonCode.c index 6eeb7aa..d28cefa 100644 --- a/CommonCode.c +++ b/CommonCode.c @@ -4955,6 +4955,7 @@ VOID SendWebRequest(SOCKET sock, char * Host, char * Request, char * Params, int { strlop(Buffer, 13); Debugprintf("Map Update Params - %s", Params); + Debugprintf("Map Update failed - %s", Buffer); } return; diff --git a/FormatHTML.cpp b/FormatHTML.cpp new file mode 100644 index 0000000..f27498c --- /dev/null +++ b/FormatHTML.cpp @@ -0,0 +1,60 @@ +// FormatHTML.cpp : Defines the entry point for the console application. +// +#include + +int main () { + FILE *fp, *fp2; + char str[256]; + char newstr[256]; + char * ptr, * inptr; + + /* opening file for reading */ + fp = fopen("D:/AtomProject/test.html" , "r"); + fp2 = fopen("D:/AtomProject/test.html.c" , "w"); + + if(fp == NULL) { + perror("Error opening file"); + return(-1); + } + + while(fgets (str, 256, fp) != NULL) + { + // Replace any " with \" and add " on front and \r\n" on end + + char c; + ptr = newstr; + inptr = str; + + c = *(inptr++); + + *(ptr++) = '"'; + + while (c && c != 10) + { + if (c == '"') + *(ptr++) = '\\'; + + *(ptr++) = c; + + c = *(inptr++); + } + + + *(ptr++) = '\\'; + *(ptr++) = 'r'; + *(ptr++) = '\\'; + *(ptr++) = 'n'; + *(ptr++) = '"'; + *(ptr++) = 10; + *(ptr++) = 0; + + puts(newstr); + fputs(newstr, fp2); + + } + + fclose(fp); + fclose(fp2); + + return(0); +} \ No newline at end of file diff --git a/FormatHTML.vcproj b/FormatHTML.vcproj new file mode 100644 index 0000000..95563d4 --- /dev/null +++ b/FormatHTML.vcproj @@ -0,0 +1,219 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/IPCode.c b/IPCode.c index 8013b61..efc4d91 100644 --- a/IPCode.c +++ b/IPCode.c @@ -233,7 +233,7 @@ UCHAR ourMACAddr[6] = {02,'B','P','Q',1,1}; UCHAR RealMacAddress[6]; -int IPPortMask = 0; +uint64_t IPPortMask = 0; IPSTATS IPStats = {0}; @@ -1548,7 +1548,8 @@ VOID ProcessEthIPMsg(PETHMSG Buffer) VOID ProcessEthARPMsg(PETHARP arpptr, BOOL FromTAP) { - int i=0, Mask=IPPortMask; + int i=0; + uint64_t Mask=IPPortMask; PARPDATA Arp; PROUTEENTRY Route; BOOL Found; @@ -1748,12 +1749,12 @@ ProxyARPReply: memset(AXARPREQMSG.TARGETHWADDR, 0, 7); AXARPREQMSG.ARPOPCODE = 0x0100; - for (i=1; i<=NUMBEROFPORTS; i++) + for (i = 1; i <= MaxBPQPortNo; i++) { if (Mask & 1) Send_AX_Datagram((PMESSAGE)&AXARPREQMSG, 46, i, QST); - Mask>>=1; + Mask >>= 1; } break; @@ -1847,7 +1848,8 @@ SendBack: VOID ProcessAXARPMsg(PAXARP arpptr) { - int i=0, Mask=IPPortMask; + int i=0; + uint64_t Mask=IPPortMask; PARPDATA Arp; PROUTEENTRY Route; @@ -1954,13 +1956,13 @@ AXProxyARPReply: AXARPREQMSG.TARGETIPADDR = arpptr->TARGETIPADDR; AXARPREQMSG.SENDIPADDR = arpptr->SENDIPADDR; - for (i=1; i<=NUMBEROFPORTS; i++) + for (i=1; i<=MaxBPQPortNo; i++) { if (i != arpptr->MSGHDDR.PORT) if (Mask & 1) Send_AX_Datagram((PMESSAGE)&AXARPREQMSG, 46, i, QST); - Mask>>=1; + Mask >>= 1; } memset(ETHARPREQMSG.MSGHDDR.DEST, 0xff, 6); @@ -3281,7 +3283,7 @@ static BOOL ReadConfigFile() static int ProcessLine(char * buf) { - char * ptr, * p_value, * p_origport, * p_host, * p_port; + char * ptr, * p_value, * p_origport, * p_host; int port, mappedport, ipad, mappedipad; BOOL NATTAP = FALSE; int i; @@ -3447,16 +3449,28 @@ static int ProcessLine(char * buf) if (_stricmp(ptr,"IPPorts") == 0) { - p_port = strtok(p_value, " ,\t\n\r"); - - while (p_port != NULL) - { - i=atoi(p_port); - if (i == 0) return FALSE; - if (i > NUMBEROFPORTS) return FALSE; + struct _EXTPORTDATA * PORTVEC; - IPPortMask |= 1 << (i-1); - p_port = strtok(NULL, " ,\t\n\r"); + while (p_value != NULL) + { + i=atoi(p_value); + if (i == 0) return FALSE; + + PORTVEC = (struct _EXTPORTDATA * )GetPortTableEntryFromPortNum(i); + + if (PORTVEC == NULL) + return FALSE; + + // if not KISS, make sure it can send UI frames + + if (PORTVEC->PORTCONTROL.PORTTYPE == 16) // EXTERNAL + if (PORTVEC->PORTCONTROL.PROTOCOL == 10) // Pactor/WINMOR + if (PORTVEC->PORTCONTROL.UICAPABLE == 0) + return FALSE; + + + IPPortMask |= (uint64_t)1 << (i-1); + p_value = strlop(p_value, ','); } return (TRUE); } diff --git a/KernelScript1.rc b/KernelScript1.rc index 55876e7..4eef3b5 100644 --- a/KernelScript1.rc +++ b/KernelScript1.rc @@ -10,7 +10,7 @@ // Generated from the TEXTINCLUDE 2 resource. // #include "afxres.h" -#include "bpqtermmdi.h" +#include "BpqTermMDI.h" ///////////////////////////////////////////////////////////////////////////// #undef APSTUDIO_READONLY_SYMBOLS @@ -241,6 +241,7 @@ BEGIN END POPUP "Monitor" BEGIN + MENUITEM "Use Local Time", MONLOCALTIME MENUITEM "Monitor TX", BPQMTX MENUITEM "Monitor Supervisory", BPQMCOM MENUITEM "Monitor UI Only", MON_UI_ONLY @@ -276,13 +277,13 @@ INCOMINGCALL WAVE MOVEABLE PURE "Ring.wav" BEGIN "kernelresource.h\0" """\r\n" - "bpqtermmdi.h\0" + "BpqTermMDI.h\0" END 2 TEXTINCLUDE DISCARDABLE BEGIN "#include ""afxres.h""\r\n" - "#include ""bpqtermmdi.h""\r\n" + "#include ""BpqTermMDI.h""\r\n" "\0" END diff --git a/L4Code.c b/L4Code.c index 424522d..483746e 100644 --- a/L4Code.c +++ b/L4Code.c @@ -115,7 +115,7 @@ VOID NETROMMSG(struct _LINKTABLE * LINK, L3MESSAGEBUFFER * L3MSG) { // INP3 - ProcessINP3RIF(LINK->NEIGHBOUR, &L3MSG->L3SRCE[1], L3MSG->LENGTH - 9, L3MSG->Port); + ProcessINP3RIF(LINK->NEIGHBOUR, &L3MSG->L3SRCE[1], L3MSG->LENGTH - (MSGHDDRLEN + 2), L3MSG->Port); // = 2 = PID + FF Flag ReleaseBuffer(L3MSG); return; } diff --git a/LinBPQ.c b/LinBPQ.c index 8cda726..084ee45 100644 --- a/LinBPQ.c +++ b/LinBPQ.c @@ -1581,8 +1581,8 @@ int main(int argc, char * argv[]) { if (GenerateTrafficReport && (LastTrafficTime + 86400) < NOW) { - LastTrafficTime = NOW; CreateBBSTrafficReport(); + LastTrafficTime = NOW; } } } diff --git a/MHSave.txt b/MHSave.txt deleted file mode 100644 index e69de29..0000000 diff --git a/MailNode.vcxproj b/MailNode.vcxproj index aae4482..429ce34 100644 --- a/MailNode.vcxproj +++ b/MailNode.vcxproj @@ -74,6 +74,7 @@ true + D:\linbpq C:\Dev\Msdev2005\$(SolutionName)\$(ProjectName)\$(Configuration)\ @@ -117,10 +118,10 @@ Level3 - ProgramDatabase + EditAndContinue - kernel32.lib;WS2_32.Lib;..\lib\libconfigd.lib;DbgHelp.lib;setupapi.lib;miniupnpc.lib;zlibstat.lib;%(AdditionalDependencies) + kernel32.lib;WS2_32.Lib;C:\OneDrive\Dev\Source\bpq32\libconfig\x64\Release\libconfig.lib;DbgHelp.lib;setupapi.lib;C:\Dev\Msdev2005\projects\bpq32\CKernel\x64\Debug\miniupnpc.lib;C:\OneDrive\Dev\Source\zlib-1.2.11\contrib\vstudio\vc14\x64\ZlibStatDebug\zlibstat.lib;%(AdditionalDependencies) c:\LINBPQ\$(ProjectName).exe true true @@ -215,6 +216,7 @@ + diff --git a/MailNode.vcxproj.filters b/MailNode.vcxproj.filters index 9f953ec..d32f45b 100644 --- a/MailNode.vcxproj.filters +++ b/MailNode.vcxproj.filters @@ -315,6 +315,9 @@ Source Files + + Source Files + diff --git a/MailNode.vcxproj.user b/MailNode.vcxproj.user index 448994b..3ea46b0 100644 --- a/MailNode.vcxproj.user +++ b/MailNode.vcxproj.user @@ -1,7 +1,7 @@  - C:\Dev\Msdev2005\projects\bpq32\BPQMail\x64\Debug\LinBPQ.exe + c:\linbpq\linbpq.exe c:\linbpq WindowsLocalDebugger diff --git a/Moncode.c b/Moncode.c index 091229e..aa1c0bd 100644 --- a/Moncode.c +++ b/Moncode.c @@ -634,7 +634,7 @@ char * DISPLAY_NETROM(MESSAGE * ADJBUFFER, UCHAR * Output, int MsgLen) // If an INP3 RIF (type <> UI) decode as such if (ADJBUFFER->CTL != 3) // UI - return DisplayINP3RIF(&ADJBUFFER->L2DATA[1], Output, MsgLen - 24); + return DisplayINP3RIF(&ADJBUFFER->L2DATA[1], Output, MsgLen - (MSGHDDRLEN + 14 + 3)); memcpy(Alias, ++ptr, 6); diff --git a/RTKnown.txt b/RTKnown.txt deleted file mode 100644 index 5827f30..0000000 --- a/RTKnown.txt +++ /dev/null @@ -1,26 +0,0 @@ -G8BPQ-1 1681280155 -GM8BPQ-3 1681280155 -KB8UVN-6 1681280155 -N8BHL-6 1681280155 -KF8MZ-6 1681280155 -W8BAP-6 1681280155 -G8BPQ-4 1681280155 -EI2GYB-4 1681280155 -IZ4FVW-10 1681280155 -PE1NNZ-5 1681280155 -PI1LAP-4 1681280155 -K8OPG-14 1681280155 -KB9PVH-11 1681280155 -N0NJY-11 1681280155 -N3MEL-3 1681280155 -K5DAT-11 1681280155 -N2UEM-11 1681280155 -W9IKU-11 1681280155 -WA3WLH-11 1681280155 -WA3WLH-14 1681280155 -PE1RRR-4 1681280155 -MS0HFI-4 1681280155 -AE5E-2 1681280155 -G0BMH-4 1681280155 -OH5RM-8 1681280155 -GM8BPQ-4 1681280155 diff --git a/RigControl.c b/RigControl.c index 77b1ffe..0e56d6e 100644 --- a/RigControl.c +++ b/RigControl.c @@ -175,9 +175,10 @@ char FTRXModes[8][6] = {"LSB", "USB", "CW", "AM", "FM", "RTTY", "PKT", ""}; char KenwoodModes[16][6] = {"????", "LSB", "USB", "CW", "FM", "AM", "FSK", "????"}; -//char FT2000Modes[16][6] = {"????", "LSB", "USB", "CW", "FM", "AM", "FSK", "PKT-L", "FSK-R", "PKT-FM", "FM-N", "PKT-U", "????"}; char FT2000Modes[16][6] = {"????", "LSB", "USB", "CW", "FM", "AM", "FSK", "CW-R", "PKT-L", "FSK-R", "PKT-FM", "FM-N", "PKT-U", "????"}; +char FTDX10Modes[16][9] = {"????", "LSB", "USB", "CW-U", "FM", "AM", "RTTY-L", "CW-L", "DATA-L", "RTTY-U", "DATA-FM", "FM-N", "DATA-U", "AM-N", "PSK", "DATA-FM-N"}; + char FT991AModes[16][9] = {"????", "LSB", "USB", "CW-U", "FM", "AM", "RTTY-LSB", "CW-L", "DATA-LSB", "RTTY-USB", "DATA-FM", "FM-N", "DATA-USB", "AM-N", "C4FM", "????"}; char FLEXModes[16][6] = {"LSB", "USB", "DSB", "CWL", "CWU", "FM", "AM", "DIGU", "SPEC", "DIGL", "SAM", "DRM"}; @@ -202,7 +203,7 @@ char * RigWebPage = 0; int RigWebPageLen = 0; -struct RIGPORTINFO * PORTInfo[34] = {NULL}; // Records are Malloc'd +struct RIGPORTINFO * PORTInfo[MAXBPQPORTS + 2] = {NULL}; // Records are Malloc'd struct RIGINFO * DLLRIG = NULL; // Rig record for dll PTT interface (currently only for UZ7HO); @@ -564,6 +565,7 @@ VOID Rig_PTTEx(struct RIGINFO * RIG, BOOL PTTState, struct TNCINFO * TNC) case ICOM: case KENWOOD: case FT2000: + case FTDX10: case FT991A: case FLEX: case NMEA: @@ -782,7 +784,7 @@ int Rig_Command(TRANSPORTENTRY * Session, char * Command) { RIG = &PORT->Rigs[i]; - if (RIG->BPQPort & (1 << Port)) + if (RIG->BPQPort & ((uint64_t)1 << Port)) goto portok; } } @@ -1285,6 +1287,7 @@ int Rig_CommandEx(struct RIGPORTINFO * PORT, struct RIGINFO * RIG, TRANSPORTENTR case KENWOOD: case FT991A: case FT2000: + case FTDX10: case FLEX: case NMEA: @@ -1870,6 +1873,7 @@ int Rig_CommandEx(struct RIGPORTINFO * PORT, struct RIGINFO * RIG, TRANSPORTENTR case KENWOOD: case FT2000: + case FTDX10: case FT991A: case FLEX: @@ -1885,6 +1889,10 @@ int Rig_CommandEx(struct RIGPORTINFO * PORT, struct RIGINFO * RIG, TRANSPORTENTR if (_stricmp(FT2000Modes[ModeNo], Mode) == 0) break; + if (PORT->PortType == FTDX10) + if (_stricmp(FTDX10Modes[ModeNo], Mode) == 0) + break; + if (PORT->PortType == FT991A) if (_stricmp(FT991AModes[ModeNo], Mode) == 0) break; @@ -1925,8 +1933,8 @@ int Rig_CommandEx(struct RIGPORTINFO * PORT, struct RIGINFO * RIG, TRANSPORTENTR if (PORT->PortType == FT2000) FreqPtr->Cmd1Len = sprintf(Poll, "FA%s;MD0%X;FA;MD;", &FreqString[1], ModeNo); else - if (PORT->PortType == FT991A) - FreqPtr->Cmd1Len = sprintf(Poll, "FA%s;MD0%X;FA;MD;", &FreqString, ModeNo); + if (PORT->PortType == FT991A || PORT->PortType == FTDX10) + FreqPtr->Cmd1Len = sprintf(Poll, "FA%s;MD0%X;FA;MD;", FreqString, ModeNo); else if (PORT->PortType == FLEX) FreqPtr->Cmd1Len = sprintf(Poll, "ZZFA00%s;ZZMD%02d;ZZFA;ZZMD;", &FreqString[1], ModeNo); @@ -2201,12 +2209,12 @@ DllExport BOOL APIENTRY Rig_Init() NumberofPorts = 0; - for (port = 0; port < 32; port++) + for (port = 0; port < MAXBPQPORTS; port++) PORTInfo[port] = NULL; // See if any rigcontrol defined (either RADIO or RIGCONTROL lines) - for (port = 0; port < 32; port++) + for (port = 0; port < MAXBPQPORTS; port++) { if (RadioConfigMsg[port]) NeedRig++; @@ -2362,15 +2370,6 @@ DllExport BOOL APIENTRY Rig_Init() } else PORT->hPTTDevice = PORT->hDevice; // Use same port for PTT - - - // Looks like FT847 Needa a "Cat On" Command. If PTC port need to send it here - - if (PORT->PTC && strcmp(PORT->Rigs[0].RigName, "FT847") == 0) - { - UCHAR CATON[6] = {0,0,0,0,0}; - SendPTCRadioCommand(PORT->PTC, CATON, 5); - } } for (p = 0; p < NumberofPorts; p++) @@ -2381,7 +2380,7 @@ DllExport BOOL APIENTRY Rig_Init() { int j; int k = 0; - int BitMask; + uint64_t BitMask; struct _EXTPORTDATA * PortEntry; RIG = &PORT->Rigs[i]; @@ -2395,7 +2394,7 @@ DllExport BOOL APIENTRY Rig_Init() // then those with neither BitMask = RIG->BPQPort; - for (j = 0; j < 32; j++) + for (j = 0; j < MAXBPQPORTS; j++) { if (BitMask & 1) { @@ -2408,7 +2407,7 @@ DllExport BOOL APIENTRY Rig_Init() } BitMask = RIG->BPQPort; - for (j = 0; j < 32; j++) + for (j = 0; j < MAXBPQPORTS; j++) { if (BitMask & 1) { @@ -2421,7 +2420,7 @@ DllExport BOOL APIENTRY Rig_Init() } BitMask = RIG->BPQPort; - for (j = 0; j < 32; j++) + for (j = 0; j < MAXBPQPORTS; j++) { if (BitMask & 1) { @@ -2703,6 +2702,7 @@ BOOL Rig_Poll() case KENWOOD: case FT2000: + case FTDX10: case FT991A: case FLEX: case NMEA: @@ -2772,7 +2772,7 @@ int OpenRigCOMMPort(struct RIGPORTINFO * PORT, VOID * Port, int Speed) if (PORT->remoteSock) // Using WINMORCONTROL return TRUE; - if (PORT->PortType == FT2000 || PORT->PortType == FT991A || strcmp(PORT->Rigs[0].RigName, "FT847") == 0) // FT2000 and similar seem to need two stop bits + if (PORT->PortType == FT2000 || PORT->PortType == FT991A || PORT->PortType == FTDX10 || strcmp(PORT->Rigs[0].RigName, "FT847") == 0) // FT2000 and similar seem to need two stop bits PORT->hDevice = OpenCOMPort((VOID *)Port, Speed, FALSE, FALSE, PORT->Alerted, TWOSTOPBITS); else if (PORT->PortType == NMEA) PORT->hDevice = OpenCOMPort((VOID *)Port, Speed, FALSE, FALSE, PORT->Alerted, ONESTOPBIT); @@ -2985,6 +2985,7 @@ void CheckRX(struct RIGPORTINFO * PORT) case KENWOOD: case FT2000: + case FTDX10: case FT991A: case FLEX: @@ -3266,7 +3267,7 @@ CheckOtherPorts: { PortRecord = RIG->PortRecord[i]; - if (PortRecord->PORT_EXT_ADDR(6, PortRecord->PORTCONTROL.PORTNUMBER, 1)) + if (PortRecord->PORT_EXT_ADDR && PortRecord->PORT_EXT_ADDR(6, PortRecord->PORTCONTROL.PORTNUMBER, 1)) { // 1 means can't change - release all @@ -4779,6 +4780,17 @@ Loop: strcpy(RIG->WEB_MODE, FT991AModes[Mode]); strcpy(RIG->ModeString, RIG->WEB_MODE); } + else if (PORT->PortType == FTDX10) + { + Mode = Msg[3] - 48; + if (Mode > 16) + Mode -= 7; + + if (Mode > 15) Mode = 15; + SetWindowText(RIG->hMODE, FTDX10Modes[Mode]); + strcpy(RIG->WEB_MODE, FTDX10Modes[Mode]); + strcpy(RIG->ModeString, RIG->WEB_MODE); + } else if (PORT->PortType == FLEX) { Mode = atoi(&Msg[3]); @@ -5902,6 +5914,13 @@ PortFound: PORT->PortType = FT2000; } + // FTDX10 seems to be different to most other YAESU types + + if (strcmp(RigName, "FTDX10") == 0 && PORT->PortType == YAESU) + { + PORT->PortType = FTDX10; + } + // FT991A seems to be different to most other YAESU types if (strcmp(RigName, "FT991A") == 0 && PORT->PortType == YAESU) @@ -6193,7 +6212,7 @@ CheckOtherParams: RIG->defaultFreq = atoi(&ptr[12]); } - else if (atoi(ptr)) + else if (atoi(ptr) || ptr[2] == ':') break; // Not scan freq oe timeband, so see if another param ptr = strtok_s(NULL, " \t\n\r", &Context); @@ -6462,7 +6481,7 @@ CheckOtherParams: strcpy(RIG->PTTOff, "TX0;"); RIG->PTTOffLen = 4; } - else if (PORT->PortType == FT991A) + else if (PORT->PortType == FT991A || PORT->PortType == FTDX10) { RIG->PollLen = 7; strcpy(RIG->Poll, "FA;MD0;"); @@ -6571,7 +6590,7 @@ CheckScan: VARAMode[0] = 0; Dwell = 0.0; - while (strchr(ptr, ':')) + while (ptr && strchr(ptr, ':')) { // New TimeBand @@ -6593,6 +6612,9 @@ CheckScan: ptr = strtok_s(NULL, " \t\n\r", &Context); } + if (ptr == 0) + break; + if (strchr(ptr, ',')) // New Format { DecodeModePtr(ptr, &Dwell, &Freq, Mode, &PMinLevel, &PMaxLevel, &PacketMode, @@ -6793,6 +6815,24 @@ CheckScan: } break; + case FTDX10: + + for (ModeNo = 0; ModeNo < 16; ModeNo++) + { + if (strlen(Mode) == 1) + { + if (FTDX10Modes[ModeNo][0] == Mode[0]) + break; + } + else + { + if (_stricmp(FTDX10Modes[ModeNo], Mode) == 0) + break; + } + } + break; + + case FT100: @@ -7172,7 +7212,7 @@ CheckScan: { FreqPtr[0]->Cmd1Len = sprintf(CmdPtr, "FA%s;MD0%X;FA;MD;", &FreqString[1], ModeNo); } - else if (PORT->PortType == FT991A) + else if (PORT->PortType == FT991A || PORT->PortType == FTDX10) { FreqPtr[0]->Cmd1Len = sprintf(CmdPtr, "FA%s;MD0%X;FA;MD0;", &FreqString, ModeNo); } @@ -7330,7 +7370,7 @@ VOID SetupScanInterLockGroups(struct RIGINFO *RIG) if (TNC->RXRadio == Interlock) { int p = PortRecord->PORTNUMBER; - RIG->BPQPort |= (1 << p); + RIG->BPQPort |= ((uint64_t)1 << p); sprintf(PortString, "%s,%d", PortString, p); TNC->RIG = RIG; @@ -7340,7 +7380,7 @@ VOID SetupScanInterLockGroups(struct RIGINFO *RIG) if (TNC->TXRadio == Interlock && TNC->TXRadio != TNC->RXRadio) { int p = PortRecord->PORTNUMBER; - RIG->BPQPort |= (1 << p); + RIG->BPQPort |= ((uint64_t)1 << p); sprintf(TxPortString, "%s,%d", TxPortString, p); TNC->TXRIG = RIG; @@ -9912,7 +9952,7 @@ void ProcessSDRANGELFrame(struct RIGPORTINFO * PORT) // As we mess with the message, save a copy and restore for each Rig - save = strdup(ptr3); + save = _strdup(ptr3); for (i = 0; i < PORT->ConfiguredRigs; i++) { diff --git a/SCSPactor.c b/SCSPactor.c index eff5512..4ae57be 100644 --- a/SCSPactor.c +++ b/SCSPactor.c @@ -122,6 +122,7 @@ VOID WritetoTrace(struct TNCINFO * TNC, char * Msg, int Len); void SCSTryToSendDATA(struct TNCINFO * TNC, int Stream); VOID UpdateMHwithDigis(struct TNCINFO * TNC, UCHAR * Call, char Mode, char Direction); int standardParams(struct TNCINFO * TNC, char * buf); +int SendPTCRadioCommand(struct TNCINFO * TNC, char * Block, int Length); #define FEND 0xC0 // KISS CONTROL CODES #define FESC 0xDB @@ -3179,10 +3180,23 @@ VOID ProcessDEDFrame(struct TNCINFO * TNC, UCHAR * Msg, int framelen) if (TNC->TNCOK == FALSE) { // Just come up + + struct RIGPORTINFO * PORT; TNC->TNCOK = TRUE; sprintf(TNC->WEB_COMMSSTATE,"%s TNC link OK", TNC->PortRecord->PORTCONTROL.SerialPortName); SetWindowText(TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE); + + // If using an FT847 on PTC Port it needa a "Cat On" Command. Send it here + + PORT = TNC->RIG->PORT; + + if (PORT->PTC && strcmp(PORT->Rigs[0].RigName, "FT847") == 0) + { + UCHAR CATON[6] = {0,0,0,0,0}; + SendPTCRadioCommand(PORT->PTC, CATON, 5); + } + } Stream = RealStream = Msg[2]; diff --git a/Versions.h b/Versions.h index 411efe1..56bfe73 100644 --- a/Versions.h +++ b/Versions.h @@ -10,14 +10,14 @@ #endif -#define KVers 6,0,24,16 -#define KVerstring "6.0.24.16\0" +#define KVers 6,0,24,22 +#define KVerstring "6.0.24.22\0" #ifdef CKernel #define Vers KVers #define Verstring KVerstring -#define Datestring "October 2023" +#define Datestring "November 2023" #define VerComments "G8BPQ Packet Switch (C Version)" KVerstring #define VerCopyright "Copyright © 2001-2023 John Wiseman G8BPQ\0" #define VerDesc "BPQ32 Switch\0" diff --git a/WebMail.c b/WebMail.c index 1b4cd33..f626975 100644 --- a/WebMail.c +++ b/WebMail.c @@ -2773,6 +2773,9 @@ VOID SaveNewMessage(struct HTTPConnectionInfo * Session, char * MsgPtr, char * R BuildNNTPList(Msg); // Build NNTP Groups list + if (Msg->status != 'H' && Msg->type == 'B' && memcmp(Msg->fbbs, zeros, NBMASK) != 0) + Msg->status = '$'; // Has forwarding + if (EnableUI) SendMsgUI(Msg); @@ -3698,6 +3701,9 @@ VOID WriteOneRecipient(struct MsgInfo * Msg, WebMailInfo * WebMail, int MsgLen, MatchMessagetoBBSList(Msg, 0); + if (Msg->status != 'H' && Msg->type == 'B' && memcmp(Msg->fbbs, zeros, NBMASK) != 0) + Msg->status = '$'; // Has forwarding + BuildNNTPList(Msg); // Build NNTP Groups list } @@ -4278,6 +4284,9 @@ VOID BuildMessageFromHTMLInput(struct HTTPConnectionInfo * Session, char * Reply MatchMessagetoBBSList(Msg, 0); + if (Msg->status != 'H' && Msg->type == 'B' && memcmp(Msg->fbbs, zeros, NBMASK) != 0) + Msg->status = '$'; // Has forwarding + BuildNNTPList(Msg); // Build NNTP Groups list SaveMessageDatabase(); diff --git a/WinRPR.c b/WinRPR.c index 51c6983..03d81ac 100644 --- a/WinRPR.c +++ b/WinRPR.c @@ -106,6 +106,7 @@ int ConnecttoWinRPR(int port); BOOL KillOldTNC(char * Path); int KillTNC(struct TNCINFO * TNC); +void CountRestarts(struct TNCINFO * TNC); static BOOL RestartTNC(struct TNCINFO * TNC) { @@ -789,16 +790,15 @@ void * WinRPRExtInit(EXTPORTDATA * PortEntry) return ExtProc; } + if (TNC->AutoStartDelay == 0) + TNC->AutoStartDelay = 2000; + sprintf(msg,"WinRPR Host %s %d", TNC->HostName, htons(TNC->destaddr.sin_port)); WritetoConsoleLocal(msg); TNC->Port = port; TNC->Hardware = H_WINRPR; - if (TNC->ProgramPath) - TNC->WeStartedTNC = RestartTNC(TNC); - - // Set up DED addresses for streams for (Stream = 0; Stream <= MaxStreams; Stream++) @@ -887,6 +887,9 @@ void * WinRPRExtInit(EXTPORTDATA * PortEntry) TNC->WEB_MODE = zalloc(20); TNC->WEB_BUFFERS = zalloc(100); TNC->WEB_TRAFFIC = zalloc(100); + TNC->WEB_RESTARTTIME = zalloc(100); + TNC->WEB_RESTARTS = zalloc(100); + #ifndef LINBPQ @@ -1451,14 +1454,9 @@ VOID WinRPRThread(void * portptr) // can only check if running on local host TNC->PID = GetListeningPortsPID(TNC->destaddr.sin_port); + if (TNC->PID == 0) - { - TNC->CONNECTING = FALSE; - sprintf(TNC->WEB_COMMSSTATE, "Waiting for TNC"); - MySetWindowText(TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE); - - return; // Not listening so no point trying to connect - } + goto TNCNotRunning; // Get the File Name in case we want to restart it. @@ -1480,17 +1478,25 @@ VOID WinRPRThread(void * portptr) } } } + goto TNCRunning; } #endif -// // If we started the TNC make sure it is still running. +TNCNotRunning: -// if (!IsProcess(TNC->PID)) -// { -// RestartTNC(TNC); -// Sleep(3000); -// } + // Not running or can't check, restart if we have a path + if (TNC->ProgramPath) + { + Consoleprintf("Trying to (re)start TNC %s", TNC->ProgramPath); + + if (RestartTNC(TNC)) + CountRestarts(TNC); + + Sleep(TNC->AutoStartDelay); + } + +TNCRunning: TNC->destaddr.sin_addr.s_addr = inet_addr(TNC->HostName); TNC->Datadestaddr.sin_addr.s_addr = inet_addr(TNC->HostName); diff --git a/cMain.c b/cMain.c index abab877..7ca9e2e 100644 --- a/cMain.c +++ b/cMain.c @@ -2213,7 +2213,7 @@ L2Packet: // Bridge if requested - for (toPort = 1; toPort <= NUMBEROFPORTS; toPort++) + for (toPort = 1; toPort <= MaxBPQPortNo; toPort++) { if (BridgeMap[CURRENTPORT][toPort]) { diff --git a/configstructs.h b/configstructs.h index 67a6fbf..9dae4fb 100644 --- a/configstructs.h +++ b/configstructs.h @@ -158,7 +158,7 @@ struct CONFIGTABLE char C_IDMSG[512]; char C_CTEXT[512]; char C_INFOMSG[2048]; - UCHAR CfgBridgeMap[MaxBPQPortNo][MaxBPQPortNo]; + UCHAR CfgBridgeMap[MaxBPQPortNo + 1][MaxBPQPortNo + 1]; struct ROUTECONFIG C_ROUTE[MaxLockedRoutes]; struct APPLCONFIG C_APPL[NumberofAppls]; struct PORTCONFIG C_PORT[MaxBPQPortNo + 4]; diff --git a/nodelog.txt b/nodelog.txt deleted file mode 100644 index e69de29..0000000 diff --git a/nodestatus.txt b/nodestatus.txt deleted file mode 100644 index 85f31cb..0000000 --- a/nodestatus.txt +++ /dev/null @@ -1,2 +0,0 @@ -2021/03/24 16:23:50 - 0 Active Nodes -| \ No newline at end of file diff --git a/rigcontrol.h b/rigcontrol.h index 2868704..1f841cf 100644 --- a/rigcontrol.h +++ b/rigcontrol.h @@ -67,7 +67,7 @@ struct RIGINFO void * BPQtoRADIO_Q; // Frames from switch for radio - UINT BPQPort; // Port this radio is attached to. Bit Map, as may be more than one port controlling radio + uint64_t BPQPort; // Port this radio is attached to. Bit Map, as may be more than one port controlling radio // int PortNum; // Number of port that defined this rig int Interlock; // Interlock group for this Radio int IC735; // Old ICOM with shorter freq message @@ -202,6 +202,7 @@ struct RIGINFO //G7TAJ #define SDRANGEL 19 //G7TAJ +#define FTDX10 20 // Yease seem to have lots of variants of the same model diff --git a/savelinks.txt b/savelinks.txt deleted file mode 100644 index e69de29..0000000 diff --git a/savenodes.txt b/savenodes.txt deleted file mode 100644 index e69de29..0000000 diff --git a/upnp.c b/upnp.c index cdc68a4..dbc7c8d 100644 --- a/upnp.c +++ b/upnp.c @@ -39,13 +39,23 @@ POSSIBILITY OF SUCH DAMAGE. #include "miniupnpc.h" #include "upnperrors.h" #include -#else +#endif +#ifdef LINBPQ +#ifndef MACBPQ +#ifndef WIN32 #include #include #include #include #endif - +#endif +#endif +#ifdef MACBPQ +#include +#include +#include +#include +#endif int AddMap(char * controlURL, char * eport, char * iport, char * proto); int DeleteMap(char * controlURL, char * eport, char * iport, char * proto); diff --git a/upnp.c.bak b/upnp.c.bak new file mode 100644 index 0000000..cdc68a4 --- /dev/null +++ b/upnp.c.bak @@ -0,0 +1,187 @@ +// Includes code from MiniUPnPc, used subject to the following conditions: + +/* + +MiniUPnPc +Copyright (c) 2005-2020, Thomas BERNARD +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * The name of the author may not be used to endorse or promote products + derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. + +*/ + +#define MINIUPNP_STATICLIB + +#include +#ifdef _WIN32 +#include "upnpcommands.h" +#include "miniupnpc.h" +#include "upnperrors.h" +#include +#else +#include +#include +#include +#include +#endif + +int AddMap(char * controlURL, char * eport, char * iport, char * proto); +int DeleteMap(char * controlURL, char * eport, char * iport, char * proto); + +void Consoleprintf(const char * format, ...); + +struct UPNP +{ + struct UPNP * Next; + char * Protocol; + char * LANport; + char * WANPort; +}; + +extern struct UPNP * UPNPConfig; + +char * controlURL = 0; +char * servicetype = 0; +char iaddr[] = "IP"; +char * inClient = NULL; +#ifdef LINBPQ +char desc[] = "LinBPQ "; +#else +char desc[] = "BPQ32 "; +#endif +char * remoteHost = NULL; +char * leaseDuration = NULL; + +struct UPNPDev * devlist = 0; +char lanaddr[64] = "unset"; /* my ip address on the LAN */ +struct UPNPUrls urls; +struct IGDdatas data; + +int i; +const char * rootdescurl = 0; +const char * multicastif = 0; +const char * minissdpdpath = 0; +int localport = UPNP_LOCAL_PORT_ANY; +int retcode = 0; +int error = 0; +int ipv6 = 0; +int ignore = 0; +unsigned char ttl = 2; + + +int upnpInit() +{ + struct UPNP * Config = UPNPConfig; + int i; +#ifdef WIN32 + WSADATA wsaData; + int nResult = WSAStartup(MAKEWORD(2,2), &wsaData); + if(nResult != NO_ERROR) + { + fprintf(stderr, "WSAStartup() failed.\n"); + return -1; + } +#endif + + while (Config) + { + if (devlist == NULL) + { + devlist = upnpDiscover(2000, multicastif, minissdpdpath, localport, ipv6, ttl, &error); + + if (devlist == NULL) + { + Consoleprintf("Failed to find a UPNP device"); + return 0; + } + + i = UPNP_GetValidIGD(devlist, &urls, &data, lanaddr, sizeof(lanaddr)); + } + + AddMap(devlist->descURL, Config->LANport, Config->WANPort, Config->Protocol); + Config = Config->Next; + } + + return 0; +} + +int upnpClose() +{ + struct UPNP * Config = UPNPConfig; + int i; + + while (Config) + { + if (devlist == NULL) + { + devlist = upnpDiscover(2000, multicastif, minissdpdpath, localport, ipv6, ttl, &error); + + if (devlist == NULL) + { + Consoleprintf("Failed to find a UPNP device"); + return 0; + } + + i = UPNP_GetValidIGD(devlist, &urls, &data, lanaddr, sizeof(lanaddr)); + } + + DeleteMap(devlist->descURL, Config->LANport, Config->WANPort, Config->Protocol); + Config = Config->Next; + } + + return 0; +} + +int AddMap(char * controlURL, char * eport, char * iport, char * proto) +{ + int r = UPNP_AddPortMapping(urls.controlURL, data.first.servicetype, + eport, iport, lanaddr, desc, + proto, remoteHost, leaseDuration); + + if (r != UPNPCOMMAND_SUCCESS) + { + Consoleprintf("UPNP AddPortMapping(%s, %s, %s) failed with code %d (%s)", eport, iport, lanaddr, r, strupnperror(r)); + return -2; + } + Consoleprintf("UPNP AddPortMapping(%s, %s, %s) Succeeded", eport, iport, lanaddr, r); + return 0; +} + +int DeleteMap(char * controlURL, char * eport, char * iport, char * proto) +{ + int r = UPNP_DeletePortMapping(urls.controlURL, data.first.servicetype, eport, proto, remoteHost); + + if(r != UPNPCOMMAND_SUCCESS) + { + Consoleprintf("UPNP DeletePortMapping(%s, %s, %s) failed with code %d (%s)", eport, iport, lanaddr, r, strupnperror(r)); + return -2; + } + Consoleprintf("UPNP DeletePortMapping(%s, %s, %s) Succeeded", eport, iport, lanaddr, r); + + return 0; +} + + + +