From e40d3647752f8c7ccdae668293874b4e7075146b Mon Sep 17 00:00:00 2001 From: g8bpq Date: Wed, 22 Jul 2026 20:06:07 +0100 Subject: [PATCH] 6.0.25.35 --- 6pack.c | 20 +- AEAPactor.c | 2 +- AISCommon.c | 9 - APRSCode.c | 62 +-- ARDOP.c | 114 ++--- BPQINP3.c | 226 ++++++---- BPQNRR.c | 13 +- BPQTermMDI.c | 5 +- BPQWinAPP.c | 33 +- Bpq32.c | 18 +- Cmd.c | 9 +- CommonCode.c | 76 +++- Debug/BuildLog.htm | Bin 9552 -> 0 bytes Debug/NodeMapTest.exe.embed.manifest | 8 - Debug/NodeMapTest.exe.embed.manifest.res | Bin 468 -> 0 bytes Debug/NodeMapTest.exe.intermediate.manifest | 8 - Debug/NodeMapTest.obj | Bin 105125 -> 0 bytes Debug/mt.dep | 1 - Debug/vc80.idb | Bin 142336 -> 0 bytes Debug/vc80.pdb | Bin 69632 -> 0 bytes Events.c | 57 ++- FLDigi.c | 28 +- FreeDATA.c | 75 ++-- HALDriver.c | 79 ++-- HFCommon.c | 16 +- HSMODEM.c | 14 +- HTTPcode.c | 173 ++++++- IPCode.c | 6 +- KAMPactor.c | 14 +- KISSHF.c | 22 +- L2Code.c | 10 +- L3Code.c | 4 +- L4Code.c | 35 +- LinBPQ.c | 474 ++++++++++---------- MHSave.txt | 0 MULTIPSK.c | 8 +- Moncode.c | 2 +- NETROMTCP.c | 12 +- NodeMapTest.c | 4 +- RHP.c | 2 +- RigControl.c | 34 +- SCSPactor.c | 33 +- SCSTracker.c | 35 +- SerialPort.c | 6 +- TNCEmulators.c | 4 +- TelnetV6.c | 92 ++-- UIARQ.c | 8 +- UZ7HODrv.c | 49 +- V4.c | 40 +- VARA.c | 155 +++---- Versions.h | 4 +- WINMOR.c | 75 ++-- WinRPR.c | 43 +- adif.c | 4 +- asmstrucs.h | 9 +- bpq32.h | 6 +- bpqaxip.c | 2 +- cMain.c | 151 ++++--- cheaders.h | 14 +- config.c | 9 +- configstructs.h | 1 + datadefs.c | 11 +- kiss.c | 20 +- mqtt.c | 4 +- nodeapi.c | 6 +- nodelog.txt | 0 tncinfo.h | 18 +- 67 files changed, 1355 insertions(+), 1117 deletions(-) delete mode 100644 Debug/BuildLog.htm delete mode 100644 Debug/NodeMapTest.exe.embed.manifest delete mode 100644 Debug/NodeMapTest.exe.embed.manifest.res delete mode 100644 Debug/NodeMapTest.exe.intermediate.manifest delete mode 100644 Debug/NodeMapTest.obj delete mode 100644 Debug/mt.dep delete mode 100644 Debug/vc80.idb delete mode 100644 Debug/vc80.pdb delete mode 100644 MHSave.txt delete mode 100644 nodelog.txt diff --git a/6pack.c b/6pack.c index 5557827..3fea1fb 100644 --- a/6pack.c +++ b/6pack.c @@ -274,7 +274,7 @@ VOID SixPackProcessReceivedPacket(struct TNCINFO * TNC) TNC->Streams[0].ReportDISC = TRUE; sprintf(TNC->WEB_COMMSSTATE, "Connection to TNC lost"); - MySetWindowText(TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE); + MySetWindowText(TNC, TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE); return; } @@ -948,7 +948,7 @@ ok: SuspendOtherPorts(TNC); sprintf(TNC->WEB_TNCSTATE, "In Use by %s", TNC->Streams[0].MyCall); - MySetWindowText(TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE); + MySetWindowText(TNC, TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE); // Stop Scanning @@ -1328,7 +1328,7 @@ VOID SIXPACKReleaseTNC(struct TNCINFO * TNC) Rig_Command( (TRANSPORTENTRY *) -1, TXMsg); strcpy(TNC->WEB_TNCSTATE, "Free"); - MySetWindowText(TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE); + MySetWindowText(TNC, TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE); ReleaseOtherPorts(TNC); } @@ -1343,7 +1343,7 @@ VOID SIXPACKReleasePort(struct TNCINFO * TNC) static int WebProc(struct TNCINFO * TNC, char * Buff, BOOL LOCAL) { - int Len = sprintf(Buff, "" + int Len = sprintf(Buff, "" "" - "FreDATA Status" + int Len = sprintf(Buff, "

FreeData Status" "

", @@ -1364,7 +1359,7 @@ VOID * FreeDataExtInit(EXTPORTDATA * PortEntry) int i; int n = 0; - srand(time(NULL)); + srand(NOW); port = PortEntry->PORTCONTROL.PORTNUMBER; @@ -1925,9 +1920,9 @@ VOID FreeDataProcessTNCMessage(struct TNCINFO * TNC, char * Call, unsigned char if (WL2K) strcpy(SESS->RMSCall, WL2K->RMSCall); - MySetWindowText(TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE); + MySetWindowText(TNC, TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE); - STREAM->ConnectTime = time(NULL); + STREAM->ConnectTime = NOW; STREAM->bytesRXed = STREAM->bytesTXed = STREAM->PacketsSent = 0; STREAM->Connected = TRUE; @@ -1941,7 +1936,7 @@ VOID FreeDataProcessTNCMessage(struct TNCINFO * TNC, char * Call, unsigned char // Connect ACK sprintf(TNC->WEB_TNCSTATE, "%s Connected to %s", STREAM->MyCall, STREAM->RemoteCall); - MySetWindowText(TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE); + MySetWindowText(TNC, TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE); STREAM->Connected = TRUE; STREAM->Connecting = FALSE; @@ -1974,7 +1969,7 @@ VOID FreeDataProcessTNCMessage(struct TNCINFO * TNC, char * Call, unsigned char // Connection Refused - If there is a message, pass to appl sprintf(TNC->WEB_TNCSTATE, "In Use by %s", STREAM->MyCall); - MySetWindowText(TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE); + MySetWindowText(TNC, TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE); STREAM->Connecting = FALSE; buffptr = (PMSGWITHLEN)GetBuff(); @@ -2005,7 +2000,7 @@ VOID FreeDataProcessTNCMessage(struct TNCINFO * TNC, char * Call, unsigned char STREAM->Disconnecting = FALSE; strcpy(TNC->WEB_TNCSTATE, "Free"); - MySetWindowText(TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE); + MySetWindowText(TNC, TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE); return; @@ -2039,7 +2034,7 @@ VOID FreeDataProcessTNCMessage(struct TNCINFO * TNC, char * Call, unsigned char STREAM->bytesRXed += Len; sprintf(TNC->WEB_TRAFFIC, "Sent %d RXed %d Queued %d", STREAM->bytesTXed - TNC->FreeDataInfo->toSendCount, STREAM->bytesRXed, TNC->FreeDataInfo->toSendCount); - MySetWindowText(TNC->xIDC_TRAFFIC, TNC->WEB_TRAFFIC); + MySetWindowText(TNC, TNC->xIDC_TRAFFIC, TNC->WEB_TRAFFIC); return; @@ -2288,9 +2283,9 @@ VOID FreeDataProcessNewConnect(struct TNCINFO * TNC, char * fromCall, char * toC if (WL2K) strcpy(SESS->RMSCall, WL2K->RMSCall); - MySetWindowText(TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE); + MySetWindowText(TNC, TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE); - STREAM->ConnectTime = time(NULL); + STREAM->ConnectTime = NOW; STREAM->bytesRXed = STREAM->bytesTXed = STREAM->PacketsSent = 0; STREAM->Connected = TRUE; @@ -2305,7 +2300,7 @@ VOID FreeDataProcessConnectAck(struct TNCINFO * TNC, char * Call, unsigned char struct FreeDataINFO * Modem = TNC->FreeDataInfo; sprintf(TNC->WEB_TNCSTATE, "%s Connected to %s", STREAM->MyCall, STREAM->RemoteCall); - MySetWindowText(TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE); + MySetWindowText(TNC, TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE); STREAM->Connected = TRUE; STREAM->Connecting = FALSE; @@ -2392,7 +2387,7 @@ void FlushData(struct TNCINFO * TNC) sprintf(TNC->WEB_TRAFFIC, "Sent %d RXed %d Queued %d", STREAM->bytesTXed - TNC->FreeDataInfo->toSendCount, STREAM->bytesRXed, TNC->FreeDataInfo->toSendCount); - MySetWindowText(TNC->xIDC_TRAFFIC, TNC->WEB_TRAFFIC); + MySetWindowText(TNC, TNC->xIDC_TRAFFIC, TNC->WEB_TRAFFIC); } @@ -2418,7 +2413,7 @@ static int SendAsFile(struct TNCINFO * TNC, char * Call, char * Msg, int Len) sprintf(TNC->WEB_TRAFFIC, "Sent %d RXed %d Queued %d", STREAM->bytesTXed - TNC->FreeDataInfo->toSendCount, STREAM->bytesRXed, TNC->FreeDataInfo->toSendCount); - MySetWindowText(TNC->xIDC_TRAFFIC, TNC->WEB_TRAFFIC); + MySetWindowText(TNC, TNC->xIDC_TRAFFIC, TNC->WEB_TRAFFIC); return Len; } @@ -2443,7 +2438,7 @@ static void SendPing(struct TNCINFO * TNC, char * Call) char Message[256]; int Len, ret; - Len = sprintf(Message, Ping, Call, time(NULL)); + Len = sprintf(Message, Ping, Call, NOW); ret = send(TNC->TCPDataSock, (char *)&Message, Len, 0); } @@ -2698,7 +2693,7 @@ void ProcessMessageObject(struct TNCINFO * TNC, char * This) sprintf(TNC->WEB_TRAFFIC, "Sent %d RXed %d Queued %d", STREAM->bytesTXed - TNC->FreeDataInfo->toSendCount, STREAM->bytesRXed, TNC->FreeDataInfo->toSendCount); - MySetWindowText(TNC->xIDC_TRAFFIC, TNC->WEB_TRAFFIC); + MySetWindowText(TNC, TNC->xIDC_TRAFFIC, TNC->WEB_TRAFFIC); } return; } @@ -2792,7 +2787,7 @@ void ProcessMessageObject(struct TNCINFO * TNC, char * This) sprintf(TNC->WEB_TRAFFIC, "Sent %d RXed %d Queued %d", STREAM->bytesTXed - TNC->FreeDataInfo->toSendCount, STREAM->bytesRXed, TNC->FreeDataInfo->toSendCount); - MySetWindowText(TNC->xIDC_TRAFFIC, TNC->WEB_TRAFFIC); + MySetWindowText(TNC, TNC->xIDC_TRAFFIC, TNC->WEB_TRAFFIC); } } else @@ -2958,7 +2953,7 @@ void processJSONINFO(struct TNCINFO * TNC, char * Info, char * Call, double snr) if (STREAM->Connecting) { sprintf(TNC->WEB_TNCSTATE, "In Use by %s", STREAM->MyCall); - MySetWindowText(TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE); + MySetWindowText(TNC, TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE); STREAM->Connecting = FALSE; buffptr = (PMSGWITHLEN)GetBuff(); @@ -3131,7 +3126,7 @@ void ProcessTNCJSON(struct TNCINFO * TNC, char * Msg, int Len) STREAM->Disconnecting = FALSE; strcpy(TNC->WEB_TNCSTATE, "Free"); - MySetWindowText(TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE); + MySetWindowText(TNC, TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE); } } else if (memcmp(ptr, "connecting", 10) == 0) @@ -3186,7 +3181,7 @@ void ProcessTNCJSON(struct TNCINFO * TNC, char * Msg, int Len) if (STREAM->Connecting) { sprintf(TNC->WEB_TNCSTATE, "In Use by %s", STREAM->MyCall); - MySetWindowText(TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE); + MySetWindowText(TNC, TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE); STREAM->Connecting = FALSE; buffptr = (PMSGWITHLEN)GetBuff(); @@ -3309,7 +3304,7 @@ void ProcessTNCJSON(struct TNCINFO * TNC, char * Msg, int Len) STREAM->Disconnecting = FALSE; strcpy(TNC->WEB_TNCSTATE, "Free"); - MySetWindowText(TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE); + MySetWindowText(TNC, TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE); } } else if (memcmp(ptr, "connecting", 10) == 0) @@ -3364,7 +3359,7 @@ void ProcessTNCJSON(struct TNCINFO * TNC, char * Msg, int Len) if (STREAM->Connecting) { sprintf(TNC->WEB_TNCSTATE, "In Use by %s", STREAM->MyCall); - MySetWindowText(TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE); + MySetWindowText(TNC, TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE); STREAM->Connecting = FALSE; buffptr = (PMSGWITHLEN)GetBuff(); @@ -3725,10 +3720,10 @@ void FreeDataProcessTNCMsg(struct TNCINFO * TNC) STREAM->Disconnecting = FALSE; strcpy(TNC->WEB_TNCSTATE, "Free"); - MySetWindowText(TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE); + MySetWindowText(TNC, TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE); sprintf(TNC->WEB_COMMSSTATE, "Connection to TNC lost"); - MySetWindowText(TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE); + MySetWindowText(TNC, TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE); return; } @@ -3895,7 +3890,7 @@ TNCRunning: if (TNC->Alerted == FALSE) { sprintf(TNC->WEB_COMMSSTATE, "Connecting to TNC"); - MySetWindowText(TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE); + MySetWindowText(TNC, TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE); } TNC->Datadestaddr.sin_addr.s_addr = inet_addr(TNC->HostName); @@ -3947,7 +3942,7 @@ TNCRunning: i=sprintf(Msg, "Connect Failed for FreeData TNC socket - error code = %d\r\n", err); WritetoConsole(Msg); sprintf(TNC->WEB_COMMSSTATE, "Connection to TNC failed"); - MySetWindowText(TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE); + MySetWindowText(TNC, TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE); TNC->Alerted = TRUE; } @@ -3971,7 +3966,7 @@ TNCRunning: TNC->Alerted = TRUE; sprintf(TNC->WEB_COMMSSTATE, "Connected to FreeData TNC"); - MySetWindowText(TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE); + MySetWindowText(TNC, TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE); sprintf(Msg, "Connected to FreeData TNC Port %d\r\n", TNC->Port); WritetoConsole(Msg); @@ -4027,7 +4022,7 @@ Lost: WritetoConsole(Msg); sprintf(TNC->WEB_COMMSSTATE, "Connection to TNC lost"); - MySetWindowText(TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE); + MySetWindowText(TNC, TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE); TNC->TNCCONNECTED = FALSE; TNC->Alerted = FALSE; @@ -4056,7 +4051,7 @@ closeThread: } sprintf(Msg, "FreeData Thread Terminated Port %d\r\n", TNC->Port); - TNC->lasttime = time(NULL); // Prevent immediate restart + TNC->lasttime = NOW; // Prevent immediate restart WritetoConsole(Msg); } @@ -4088,7 +4083,7 @@ void ConnectTNCPort(struct TNCINFO * TNC) // Connected successful sprintf(TNC->WEB_COMMSSTATE, "Connected to FreeData TNC"); - MySetWindowText(TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE); + MySetWindowText(TNC, TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE); TNC->TNCCONNECTING = FALSE; TNC->TNCCONNECTED = TRUE; TNC->Alerted = FALSE; @@ -4106,7 +4101,7 @@ void ConnectTNCPort(struct TNCINFO * TNC) TNC->TNCCONNECTING = FALSE; sprintf(TNC->WEB_COMMSSTATE, "Connection to TNC failed"); - MySetWindowText(TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE); + MySetWindowText(TNC, TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE); } closesocket(TNC->TCPDataSock); diff --git a/HALDriver.c b/HALDriver.c index 408ff97..d8e5ffe 100644 --- a/HALDriver.c +++ b/HALDriver.c @@ -82,6 +82,7 @@ VOID DoMonitor(struct TNCINFO * TNC, UCHAR * Msg, int Len); BOOL HALConnected(struct TNCINFO * TNC, char * Call); VOID HALDisconnected(struct TNCINFO * TNC); +VOID halSetWindowText(struct TNCINFO * TNC, char * Msg); static VOID EncodeAndSend(struct TNCINFO * TNC, UCHAR * txbuffer, int Len); VOID SendCmd(struct TNCINFO * TNC, UCHAR * txbuffer, int Len); @@ -113,7 +114,7 @@ UCHAR FN[MAX_PATH]; time_t T; struct tm * tm; - T = time(NULL); + T = NOW; tm = gmtime(&T); sprintf(FN,"%s\\HALLog_%02d%02d%02d_%s.bin", BaseDir, tm->tm_mday, tm->tm_hour, tm->tm_min, Logs[Flags]); @@ -443,7 +444,7 @@ static size_t ExtProc(int fn, int port , PDATAMESSAGE buff) static int WebProc(struct TNCINFO * TNC, char * Buff, BOOL LOCAL) { - int Len = sprintf(Buff, "" + int Len = sprintf(Buff, "" "HAL Status

HAL Status

"); Len += sprintf(&Buff[Len], ""); @@ -718,7 +719,7 @@ VOID HALPoll(int Port) TNC->HostMode = 0; sprintf(TNC->WEB_COMMSSTATE,"%s Open but TNC not responding", TNC->PortRecord->PORTCONTROL.SerialPortName); - MySetWindowText(TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE); + MySetWindowText(TNC, TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE); //for (Stream = 0; Stream <= MaxStreams; Stream++) { @@ -758,7 +759,7 @@ VOID HALPoll(int Port) SendCmd(TNC, TXMsg, datalen + 1); // Send the NULL sprintf(TNC->WEB_TNCSTATE, "In Use by %s", STREAM->MyCall); - MySetWindowText(TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE); + MySetWindowText(TNC, TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE); // Stop Scanning @@ -911,7 +912,7 @@ VOID HALPoll(int Port) buffptr->Len = sprintf((UCHAR *)buffptr->Data,"HAL} Ok\r"); C_Q_ADD(&STREAM->PACTORtoBPQ_Q, buffptr); - MySetWindowText(TNC->xIDC_MODE, "Clover"); + MySetWindowText(TNC, TNC->xIDC_MODE, "Clover"); strcpy(TNC->WEB_MODE, "Clover"); SendCmd(TNC, "\x80", 1); // Clover @@ -972,7 +973,7 @@ VOID HALPoll(int Port) break; } - MySetWindowText(TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE); + MySetWindowText(TNC, TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE); SendCmd(TNC, TXMsg, datalen + 1); // Include NULL ReleaseBuffer(buffptr); @@ -992,7 +993,7 @@ VOID HALPoll(int Port) sprintf(TNC->WEB_TNCSTATE, "%s Connecting to %s - CLOVER", STREAM->MyCall, STREAM->RemoteCall); - MySetWindowText(TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE); + MySetWindowText(TNC, TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE); ReleaseBuffer(buffptr); @@ -1253,9 +1254,9 @@ NotData: ProcessHALCmd(TNC); } -VOID mySetWindowText(struct TNCINFO * TNC, char * Msg) +VOID halSetWindowText(struct TNCINFO * TNC, char * Msg) { - MySetWindowText(TNC->xIDC_STATE, Msg); + MySetWindowText(TNC, TNC->xIDC_STATE, Msg); strcpy(TNC->WEB_STATE, Msg); } @@ -1282,7 +1283,7 @@ CmdLoop: TNC->Timeout = 0; sprintf(TNC->WEB_COMMSSTATE,"%s TNC link OK", TNC->PortRecord->PORTCONTROL.SerialPortName); - MySetWindowText(TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE); + MySetWindowText(TNC, TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE); // We may have more than one response in the buffer, and only each cmd/response decoder knows how many it needs @@ -1319,7 +1320,7 @@ CmdLoop: // Diaplay Linke Status - MySetWindowText(TNC->xIDC_MODE, status[StatusByte]); + MySetWindowText(TNC, TNC->xIDC_MODE, status[StatusByte]); strcpy(TNC->WEB_MODE, status[StatusByte]); break; @@ -1329,7 +1330,7 @@ CmdLoop: // if we were connecting, this means connect failed. - MySetWindowText(TNC->xIDC_MODE, status[StatusByte]); + MySetWindowText(TNC, TNC->xIDC_MODE, status[StatusByte]); strcpy(TNC->WEB_MODE, status[StatusByte]); if (STREAM->Connecting) @@ -1339,14 +1340,14 @@ CmdLoop: case 0x0E: // ISS (AMTOR/P-MODE) - MySetWindowText(TNC->xIDC_TXRX,"ISS"); + MySetWindowText(TNC, TNC->xIDC_TXRX,"ISS"); strcpy(TNC->WEB_TXRX, "ISS"); TNC->TXRXState = 'S'; break; case 0x0F: // IRS (AMTOR/P-MODE) - MySetWindowText(TNC->xIDC_TXRX,"IRS"); + MySetWindowText(TNC, TNC->xIDC_TXRX,"IRS"); strcpy(TNC->WEB_TXRX, "IRS"); TNC->TXRXState = 'R'; break; @@ -1358,7 +1359,7 @@ CmdLoop: case 0x04: // PHS (AMTOR/P-MODE) case 0x05: // OVER (AMTOR/P-MODE) (not implemented) - MySetWindowText(TNC->xIDC_STATE, status[StatusByte]); + MySetWindowText(TNC, TNC->xIDC_STATE, status[StatusByte]); strcpy(TNC->WEB_MODE, status[StatusByte]); @@ -1389,7 +1390,7 @@ CmdLoop: (Leds & 0x01)? 'X' : ' '); // STBY CALL LINK ERROR TX RX - MySetWindowText(TNC->xIDC_LEDS, TNC->WEB_LEDS); + MySetWindowText(TNC, TNC->xIDC_LEDS, TNC->WEB_LEDS); Used = 2; break; @@ -1525,25 +1526,25 @@ CmdLoop: switch (StatusByte) { - case 0x00: mySetWindowText(TNC, "Channel idle"); break; - case 0x01: mySetWindowText(TNC, "Channel occupied with non-Clover signal"); break; - case 0x42: mySetWindowText(TNC, "Linked stations monitored"); break; - case 0x64: mySetWindowText(TNC, "Attempting normal link"); break; - case 0x65: mySetWindowText(TNC, "Attempting robust link"); break; - case 0x66: mySetWindowText(TNC, "Calling ARQ CQ"); break; - case 0x78: mySetWindowText(TNC, "Clover Control Block (CCB) send retry"); break; - case 0x79: mySetWindowText(TNC, "Clover Control Block (CCB) receive retry"); break; - case 0x7D: mySetWindowText(TNC, "Clover Control Block (CCB) received successfully"); break; - case 0x8A: mySetWindowText(TNC, "TX data block sent"); break; - case 0x8B: mySetWindowText(TNC, "RX data block received ok (precedes data block)"); break; - case 0x8C: mySetWindowText(TNC, "TX data block re-sent"); break; - case 0x8D: mySetWindowText(TNC, "RX data block decode failed (precedes data block)"); break; - case 0x8E: mySetWindowText(TNC, "TX idle"); break; - case 0x8F: mySetWindowText(TNC, "RX idle"); break; - case 0x9C: mySetWindowText(TNC, "Link failed: CCB send retries exceeded"); break; - case 0x9D: mySetWindowText(TNC, "Link failed: CCB receive retries exceeded"); break; - case 0x9E: mySetWindowText(TNC, "Link failed: protocol error"); break; - case 0xA0: mySetWindowText(TNC, "Receiving FEC SYNC sequence"); break; + case 0x00: halSetWindowText(TNC, "Channel idle"); break; + case 0x01: halSetWindowText(TNC, "Channel occupied with non-Clover signal"); break; + case 0x42: halSetWindowText(TNC, "Linked stations monitored"); break; + case 0x64: halSetWindowText(TNC, "Attempting normal link"); break; + case 0x65: halSetWindowText(TNC, "Attempting robust link"); break; + case 0x66: halSetWindowText(TNC, "Calling ARQ CQ"); break; + case 0x78: halSetWindowText(TNC, "Clover Control Block (CCB) send retry"); break; + case 0x79: halSetWindowText(TNC, "Clover Control Block (CCB) receive retry"); break; + case 0x7D: halSetWindowText(TNC, "Clover Control Block (CCB) received successfully"); break; + case 0x8A: halSetWindowText(TNC, "TX data block sent"); break; + case 0x8B: halSetWindowText(TNC, "RX data block received ok (precedes data block)"); break; + case 0x8C: halSetWindowText(TNC, "TX data block re-sent"); break; + case 0x8D: halSetWindowText(TNC, "RX data block decode failed (precedes data block)"); break; + case 0x8E: halSetWindowText(TNC, "TX idle"); break; + case 0x8F: halSetWindowText(TNC, "RX idle"); break; + case 0x9C: halSetWindowText(TNC, "Link failed: CCB send retries exceeded"); break; + case 0x9D: halSetWindowText(TNC, "Link failed: CCB receive retries exceeded"); break; + case 0x9E: halSetWindowText(TNC, "Link failed: protocol error"); break; + case 0xA0: halSetWindowText(TNC, "Receiving FEC SYNC sequence"); break; } Used = 2; @@ -1725,7 +1726,7 @@ VOID HALDisconnected(struct TNCINFO * TNC) STREAM->FramesQueued = 0; sprintf(TNC->WEB_TNCSTATE, "In Use by %s", STREAM->MyCall); - MySetWindowText(TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE); + MySetWindowText(TNC, TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE); return; } @@ -1757,7 +1758,7 @@ BOOL HALConnected(struct TNCINFO * TNC, char * Call) strcat(CallCopy, " "); // Some routines expect 10 char calls STREAM->bytesRXed = STREAM->bytesTXed = STREAM->BytesAcked = 0; - STREAM->ConnectTime = time(NULL); + STREAM->ConnectTime = NOW; // Stop Scanner @@ -1780,7 +1781,7 @@ BOOL HALConnected(struct TNCINFO * TNC, char * Call) ProcessIncommingConnect(TNC, CallCopy, 0, TRUE); sprintf(TNC->WEB_TNCSTATE, "%s Connected to %s Inbound", STREAM->RemoteCall, TNC->NodeCall); - MySetWindowText(TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE); + MySetWindowText(TNC, TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE); if (TNC->CurrentMode != Clover) SendCmd(TNC, "\x87", 1); // Changeover to ISS @@ -1822,7 +1823,7 @@ BOOL HALConnected(struct TNCINFO * TNC, char * Call) STREAM->Connected = TRUE; // Subsequent data to data channel sprintf(TNC->WEB_TNCSTATE, "%s Connected to %s Outbound", TNC->NodeCall, STREAM->RemoteCall); - MySetWindowText(TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE); + MySetWindowText(TNC, TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE); UpdateMH(TNC, CallCopy, '+', 'O'); diff --git a/HFCommon.c b/HFCommon.c index 7aa274c..71bf5ed 100644 --- a/HFCommon.c +++ b/HFCommon.c @@ -320,7 +320,7 @@ LRESULT CALLBACK PacWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPara TNC->TXOffset = SendMessage(TNC->xIDC_TXTUNE, TBM_GETPOS, 0, 0); sprintf(value, "%d", TNC->TXOffset); - MySetWindowText(TNC->xIDC_TXTUNEVAL, value); + MySetWindowText(TNC, TNC->xIDC_TXTUNEVAL, value); break; } @@ -644,7 +644,7 @@ VOID SendWL2KRegisterHybrid(struct TNCINFO * TNC) strcpy(Call, TCP->GatewayCall); strlop(Call, '-'); - T = time(NULL); + T = NOW; tm = gmtime(&T); //2021-10-31-14=35=29 @@ -771,7 +771,7 @@ IdTag (random alphanumeric, 12 chars) if (ADIF->StartTime == 0 || ADIF->ServerSID[0] == 0 || ADIF->CMSCall[0] == 0) return TRUE; - T = time(NULL); + T = NOW; // Extract Info we need @@ -1506,7 +1506,7 @@ DoMove: // memcpy (MHBASE->MHCALL, Buffer->ORIGIN, 7 * 9); memcpy (MHBASE->MHCALL, AXCall, 7 * 9); // Save Digis MHBASE->MHDIGI = Mode; - MHBASE->MHTIME = time(NULL); + MHBASE->MHTIME = NOW; MHBASE->MHCOUNT = ++OldCount; memcpy(MHBASE->MHLocator, LOC, 6); @@ -2032,10 +2032,10 @@ void sendModeReport() char Msg[300] = "MODE "; int i, Len = 5; - if ((CurrentSecs - LastModeReportTime) < 900) // Every 15 Mins + if ((NOW - LastModeReportTime) < 900) // Every 15 Mins return; - LastModeReportTime = CurrentSecs; + LastModeReportTime = NOW; for (i = 0; i < NUMBEROFPORTS; i++) { @@ -2099,10 +2099,10 @@ void sendFreqReport(char * From) struct PORTCONTROL * PORT = PORTTABLE; struct TNCINFO * TNC; - if ((CurrentSecs - LastFreqReportTime) < 7200) // Every 2 Hours + if ((NOW - LastFreqReportTime) < 7200) // Every 2 Hours return; - LastFreqReportTime = CurrentSecs; + LastFreqReportTime = NOW; for (p = 0; p < NumberofPorts; p++) { diff --git a/HSMODEM.c b/HSMODEM.c index 7b44895..a817ef5 100644 --- a/HSMODEM.c +++ b/HSMODEM.c @@ -391,7 +391,7 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff) if (TNC->CONNECTED == 0) { sprintf(TNC->WEB_COMMSSTATE, "Connection to HSMODEM lost"); - MySetWindowText(TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE); + MySetWindowText(TNC, TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE); } } @@ -526,7 +526,7 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff) SuspendOtherPorts(TNC); //sprintf(TNC->WEB_TNCSTATE, "In Use by %s", TNC->Streams[0].MyCall); - //MySetWindowText(TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE); + //MySetWindowText(TNC, TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE); // Stop Scanning @@ -734,7 +734,7 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff) // Save Command, and wait up to 10 secs sprintf(TNC->WEB_TNCSTATE, "Waiting for clear channel"); - MySetWindowText(TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE); + MySetWindowText(TNC, TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE); TNC->ConnectCmd = _strdup(Connect); TNC->BusyDelay = TNC->BusyWait * 10; // BusyWait secs @@ -749,7 +749,7 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff) sprintf(TNC->WEB_TNCSTATE, "%s Connecting to %s", STREAM->MyCall, STREAM->RemoteCall); HSMODEMSendCommand(TNC, Connect); - MySetWindowText(TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE); + MySetWindowText(TNC, TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE); STREAM->Connecting = TRUE; return 0; @@ -878,7 +878,7 @@ VOID HSMODEMReleasePort(struct TNCINFO * TNC) static int WebProc(struct TNCINFO * TNC, char * Buff, BOOL LOCAL) { - int Len = sprintf(Buff, "" + int Len = sprintf(Buff, "" "\r\n" + "\r\n" + "\r\n" + "
Waiting for data...
\r\n" + "\r\n"; + + int Port = atoi(Context); + int xxx; + + ReplyLen = sprintf(_REPLYBUFFER, Part1, Port, Port, Port); + xxx = ReplyLen; + } + else if (_stricmp(NodeURL, "/Node/ShowLog.html") == 0) { char ShowLogPage[] = @@ -3100,7 +3171,7 @@ doHeader: struct tm * tm; char Name[64] = ""; - T = time(NULL); + T = NOW; tm = gmtime(&T); if (LOCAL == FALSE && COOKIE == FALSE) @@ -3782,7 +3853,6 @@ doHeader: struct AXIPPORTINFO * AXPORT = Portlist[0]; struct PORTCONTROL * PORT = PORTTABLE; struct arp_table_entry * arp; - time_t NOW = time(NULL); char AXIPHeader[] = "
" @@ -4203,7 +4273,7 @@ CMDS60: SendResp: - FormatTime3(TimeString, time(NULL)); + FormatTime3(TimeString, NOW); strcpy(&_REPLYBUFFER[ReplyLen], Tail); ReplyLen += (int)strlen(Tail); @@ -4741,6 +4811,27 @@ int BuildRigCtlPage(char * _REPLYBUFFER) } +void BuildDevicePage(struct TNCINFO * TNC) +{ + int Len; + char Page[65536]; + + Len = TNC->WebWindowProc(TNC, Page, 1); + + if (TNC->WebPage) + { + if (strcmp(TNC->WebPage, Page) == 0) + return; // No change + else + free(TNC->WebPage); + } + + TNC->WebPage = _strdup(Page); + + SendDeviceWebPage(TNC->Port); + +} + void SendRigWebPage() { int i, n; @@ -4793,6 +4884,68 @@ void SendRigWebPage() } } +void SendDeviceWebPage(int Port) +{ + int i, n; + struct ConnectionInfo * sockptr; + struct TNCINFO * TNC = TNCInfo[Port]; + struct TCPINFO * TCP; + char DevString[16]; + + char Msg[65536]; + int MsgLen; + + if (TNC->WebPage == 0) + return; + + strcpy(&Msg[4], TNC->WebPage); + MsgLen = strlen(&TNC->WebPage[4]); + + sprintf(DevString, "DEVICE%d", Port); + + for (i = 0; i < 33; i++) + { + TNC = TNCInfo[i]; + + if (TNC && TNC->Hardware == H_TELNET) + { + TCP = TNC->TCPInfo; + + if (TCP) + { + for (n = 0; n <= TCP->MaxSessions; n++) + { + sockptr = TNC->Streams[n].ConnectionInfo; + + if (sockptr->SocketActive) + { + if (sockptr->HTTPMode && sockptr->WebSocks && strcmp(sockptr->WebURL, DevString) == 0) + { + char* ptr; + + Msg[0] = 0x81; // Fin, Data + Msg[1] = 126; // Unmasked, Extended Len + Msg[2] = MsgLen >> 8; + Msg[3] = MsgLen & 0xff; + + // If secure session enable PTT button + + if (sockptr->WebSecure) + { + while (ptr = strstr(&Msg[4], "hidden")) + memcpy(ptr, " ", 6); + } + + send(sockptr->socket, Msg, MsgLen + 4, 0); + } + } + } + } + } + } +} + + // Webmail web socket code int ProcessWebmailWebSock(char * MsgPtr, char * OutBuffer); diff --git a/IPCode.c b/IPCode.c index 4d9abca..6783d14 100644 --- a/IPCode.c +++ b/IPCode.c @@ -2472,7 +2472,7 @@ VOID ProcessRIP44Message(PIPMSG IPptr) SaveIPRoutes(); qsort(RouteRecords, NumberofRoutes, sizeof(void *), CompareMasks); - LastRIP44Msg = time(NULL); + LastRIP44Msg = NOW; } @@ -3639,7 +3639,6 @@ VOID DoRouteTimer() { int i; PROUTEENTRY Route; - time_t NOW = time(NULL); for (i=0; i < NumberofRoutes; i++) { @@ -4746,7 +4745,6 @@ VOID PING(TRANSPORTENTRY * Session, char * Bufferptr, char * CmdTail, struct CMD UCHAR Msg[120] = ""; PIPMSG IPptr = (PIPMSG)&Msg[40]; // Space for frame header (not used) PICMPMSG ICMPptr = (PICMPMSG)&IPptr->Data; - time_t NOW = time(NULL); Bufferptr = Cmdprintf(Session, Bufferptr, "\r"); @@ -5362,7 +5360,7 @@ int ProcessSNMPPayload(UCHAR * Msg, int Len, UCHAR * Reply, int * OffPtr) else if (memcmp(OID, sysUpTime, sysUpTimeLen) == 0) { int ValOffset = 10; - ValLen = ASNPutInt(Value, ValOffset, (int)((time(NULL) - TimeLoaded) * 100), TimeTicks); + ValLen = ASNPutInt(Value, ValOffset, (int)((NOW - TimeLoaded) * 100), TimeTicks); ValOffset -= ValLen; PDULen = BuildReply(Reply, Offset, sysUpTime, sysUpTimeLen, &Value[ValOffset], ReqID); diff --git a/KAMPactor.c b/KAMPactor.c index 239b183..6991987 100644 --- a/KAMPactor.c +++ b/KAMPactor.c @@ -102,7 +102,7 @@ BOOL KAMStopPort(struct PORTCONTROL * PORT) TNC->HostMode = FALSE; sprintf(PORT->TNC->WEB_COMMSSTATE, "%s", "Port Stopped"); - MySetWindowText(PORT->TNC->xIDC_COMMSSTATE, PORT->TNC->WEB_COMMSSTATE); + MySetWindowText(TNC, PORT->TNC->xIDC_COMMSSTATE, PORT->TNC->WEB_COMMSSTATE); return TRUE; } @@ -117,7 +117,7 @@ BOOL KAMStartPort(struct PORTCONTROL * PORT) TNC->ReinitState = 0; sprintf(PORT->TNC->WEB_COMMSSTATE, "%s", "Port Restarted"); - MySetWindowText(PORT->TNC->xIDC_COMMSSTATE, PORT->TNC->WEB_COMMSSTATE); + MySetWindowText(TNC, PORT->TNC->xIDC_COMMSSTATE, PORT->TNC->WEB_COMMSSTATE); return TRUE; } @@ -142,7 +142,7 @@ static BOOL OpenLogFile(int Flags) time_t T; struct tm * tm; - T = time(NULL); + T = NOW; tm = gmtime(&T); sprintf(FN,"%s/logs/KAMLog_%02d%02d_%d.txt", LogDirectory, tm->tm_mon + 1, tm->tm_mday, Flags); @@ -524,7 +524,7 @@ VOID KAMSuspendPort(struct TNCINFO * TNC, struct TNCINFO * ThisTNC) struct STREAMINFO * STREAM = &TNC->Streams[0]; strcpy(TNC->WEB_TNCSTATE, "Interlocked"); - MySetWindowText(TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE); + MySetWindowText(TNC, TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE); // STREAM->CmdSet = STREAM->CmdSave = zalloc(100); // sprintf(STREAM->CmdSet, "I%s\r", "SCSPTC"); // Should prevent connects @@ -536,14 +536,14 @@ VOID KAMReleasePort(struct TNCINFO * TNC) struct STREAMINFO * STREAM = &TNC->Streams[0]; strcpy(TNC->WEB_TNCSTATE, "Free"); - MySetWindowText(TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE); + MySetWindowText(TNC, TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE); } static int WebProc(struct TNCINFO * TNC, char * Buff, BOOL LOCAL) { - int Len = sprintf(Buff, "" + int Len = sprintf(Buff, "" "KAM Pactor Status

KAM Pactor Status

"); Len += sprintf(&Buff[Len], "
"); @@ -1940,7 +1940,7 @@ VOID ProcessKHOSTPacket(struct TNCINFO * TNC, UCHAR * Msg, int Len) } STREAM->bytesRXed = STREAM->bytesTXed = STREAM->BytesAcked = 0; - STREAM->ConnectTime = time(NULL); + STREAM->ConnectTime = NOW; if (Stream == 0) { diff --git a/KISSHF.c b/KISSHF.c index 59fd3ec..0d747f9 100644 --- a/KISSHF.c +++ b/KISSHF.c @@ -336,7 +336,7 @@ ok: SuspendOtherPorts(TNC); sprintf(TNC->WEB_TNCSTATE, "In Use by %s", TNC->Streams[0].MyCall); - MySetWindowText(TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE); + MySetWindowText(TNC, TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE); // Stop Scanning @@ -725,7 +725,7 @@ VOID KISSHFReleaseTNC(struct TNCINFO * TNC) Rig_Command( (TRANSPORTENTRY *) -1, TXMsg); strcpy(TNC->WEB_TNCSTATE, "Free"); - MySetWindowText(TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE); + MySetWindowText(TNC, TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE); ReleaseOtherPorts(TNC); } @@ -734,19 +734,19 @@ VOID KISSHFSuspendPort(struct TNCINFO * TNC, struct TNCINFO * THISTNC) { TNC->PortRecord->PORTCONTROL.PortSuspended = 1; strcpy(TNC->WEB_TNCSTATE, "Interlocked"); - MySetWindowText(TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE); + MySetWindowText(TNC, TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE); } VOID KISSHFReleasePort(struct TNCINFO * TNC) { TNC->PortRecord->PORTCONTROL.PortSuspended = 0; strcpy(TNC->WEB_TNCSTATE, "Free"); - MySetWindowText(TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE); + MySetWindowText(TNC, TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE); } static int WebProc(struct TNCINFO * TNC, char * Buff, BOOL LOCAL) { - int Len = sprintf(Buff, "" + int Len = sprintf(Buff, "" "" - "UZ7HO Status" - "

UZ7HO Status" - "

", - TNC->Port); -*/ - int Len = sprintf(Buff, WebProcTemplate, TNC->Port, TNC->Port, "UZ7HO Status", "UZ7HO Status"); - + int Len = sprintf(Buff, WebProcTemplate, "UZ7HO Status"); if (TNC->TXFreq) Len += sprintf(&Buff[Len], sliderBit, TNC->TXOffset, TNC->TXOffset); @@ -1507,7 +1490,7 @@ void * UZ7HOExtInit(EXTPORTDATA * PortEntry) // Slave Port sprintf(TNC->WEB_COMMSSTATE, "Slave to Port %d", MasterPort[port] ); - MySetWindowText(TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE); + MySetWindowText(TNC, TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE); } time(&lasttime[port]); // Get initial time value @@ -1933,7 +1916,7 @@ VOID ConnecttoUZ7HOThread(void * portptr) TNC->CONNECTED = TRUE; sprintf(TNC->WEB_COMMSSTATE, "Connected to TNC"); - MySetWindowText(TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE); + MySetWindowText(TNC, TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE); ioctl(TNC->TCPSock, FIONBIO, ¶m); } @@ -1948,7 +1931,7 @@ VOID ConnecttoUZ7HOThread(void * portptr) WritetoConsole(Msg); sprintf(TNC->WEB_COMMSSTATE, "Connection to TNC failed"); - MySetWindowText(TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE); + MySetWindowText(TNC, TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE); TNC->Alerted = TRUE; } @@ -1994,7 +1977,7 @@ static int ProcessReceivedData(int port) TNC->Alerted = FALSE; sprintf(TNC->WEB_COMMSSTATE, "Disconnected from TNC"); - MySetWindowText(TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE); + MySetWindowText(TNC, TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE); return (0); @@ -2011,7 +1994,7 @@ static int ProcessReceivedData(int port) TNC->Alerted = FALSE; sprintf(TNC->WEB_COMMSSTATE, "Disconnected from TNC"); - MySetWindowText(TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE); + MySetWindowText(TNC, TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE); closesocket(TNC->TCPSock); @@ -2042,7 +2025,7 @@ static int ProcessReceivedData(int port) TNC->Alerted = FALSE; sprintf(TNC->WEB_COMMSSTATE, "Disconnected from TNC"); - MySetWindowText(TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE); + MySetWindowText(TNC, TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE); return 0; } @@ -2389,7 +2372,7 @@ GotStream: STREAM = &TNC->Streams[Stream]; memcpy(STREAM->AGWKey, Key, 21); STREAM->Connected = TRUE; - STREAM->ConnectTime = time(NULL); + STREAM->ConnectTime = NOW; STREAM->bytesRXed = STREAM->bytesTXed = 0; SuspendOtherPorts(TNC); @@ -2550,7 +2533,7 @@ GotStream: STREAM->Connected = TRUE; STREAM->Connecting = FALSE; - STREAM->ConnectTime = time(NULL); + STREAM->ConnectTime = NOW; STREAM->bytesRXed = STREAM->bytesTXed = 0; buffptr = GetBuff(); diff --git a/V4.c b/V4.c index d9815af..483691e 100644 --- a/V4.c +++ b/V4.c @@ -281,7 +281,7 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff) memcpy(TNC->Streams[0].RemoteCall, &TNC->ConnectCmd[11], strlen(TNC->ConnectCmd)-13); sprintf(Status, "%s Connecting to %s", TNC->Streams[0].MyCall, TNC->Streams[0].RemoteCall); - MySetWindowText(TNC->xIDC_TNCSTATE, Status); + MySetWindowText(TNC, TNC->xIDC_TNCSTATE, Status); strcpy(TNC->WEB_TNCSTATE, Status); free(TNC->ConnectCmd); @@ -411,18 +411,18 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff) char Time[80]; TNC->Restarts++; - TNC->LastRestart = time(NULL); + TNC->LastRestart = NOW; tm = gmtime(&TNC->LastRestart); sprintf_s(Time, sizeof(Time),"%04d/%02d/%02d %02d:%02dZ", tm->tm_year +1900, tm->tm_mon+1, tm->tm_mday, tm->tm_hour, tm->tm_min); - MySetWindowText(TNC->xIDC_RESTARTTIME, Time); + MySetWindowText(TNC, TNC->xIDC_RESTARTTIME, Time); strcpy(TNC->WEB_RESTARTTIME, Time); sprintf_s(Time, sizeof(Time),"%d", TNC->Restarts); - MySetWindowText(TNC->xIDC_RESTARTS, Time); + MySetWindowText(TNC, TNC->xIDC_RESTARTS, Time); strcpy(TNC->WEB_RESTARTS, Time); KillTNC(TNC); @@ -456,7 +456,7 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff) SuspendOtherPorts(TNC); sprintf(Status, "In Use by %s", TNC->Streams[0].MyCall); - MySetWindowText(TNC->xIDC_TNCSTATE, Status); + MySetWindowText(TNC, TNC->xIDC_TNCSTATE, Status); strcpy(TNC->WEB_TNCSTATE, Status); // Stop Scanning @@ -657,7 +657,7 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff) TNC->FECIDTimer = 0; send(TNC->TCPSock,"MODE FEC\r\n", 10, 0); strcpy(TNC->WEB_MODE, "FEC"); - MySetWindowText(TNC->xIDC_MODE, TNC->WEB_MODE); + MySetWindowText(TNC, TNC->xIDC_MODE, TNC->WEB_MODE); return 0; } @@ -700,7 +700,7 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff) memcpy(TNC->Streams[0].RemoteCall, &Connect[11], txlen-13); sprintf(Status, "%s Connecting to %s", TNC->Streams[0].MyCall, TNC->Streams[0].RemoteCall); - MySetWindowText(TNC->xIDC_TNCSTATE, Status); + MySetWindowText(TNC, TNC->xIDC_TNCSTATE, Status); strcpy(TNC->WEB_TNCSTATE, Status); } @@ -836,7 +836,7 @@ loop: // Does this mean closed? strcpy(TNC->WEB_COMMSSTATE, "Connection to TNC lost"); - MySetWindowText(TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE); + MySetWindowText(TNC, TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE); TNC->CONNECTING = FALSE; @@ -910,7 +910,7 @@ static VOID ReleaseTNC(struct TNCINFO * TNC) // send(TNC->TCPSock, "LISTEN TRUE\r\nMAXCONREQ 4\r\n", 26, 0); - MySetWindowText(TNC->xIDC_TNCSTATE, "Free"); + MySetWindowText(TNC, TNC->xIDC_TNCSTATE, "Free"); strcpy(TNC->WEB_TNCSTATE, "Free"); // Start Scanner @@ -921,7 +921,7 @@ static VOID ReleaseTNC(struct TNCINFO * TNC) static int WebProc(struct TNCINFO * TNC, char * Buff, BOOL LOCAL) { - int Len = sprintf(Buff, "" + int Len = sprintf(Buff, "" "" - "%s" - "" - "%s" - ""; -*/ -char WebProcTemplate[] = "" + +char WebProcTemplate[] = "\r\n" "\r\n" - "%s\r\n" - "

%s

"; + "

%s

"; -char Menubit[] = "" - "\r\n" +char Menubit[] = ""; char sliderBit[] = " TX Offset %d" @@ -1082,16 +1055,16 @@ char sliderBit[] = " TX Of "var output = document.getElementById('val');" "slider.oninput = function() {output.innerHTML = this.value;}\r\n" "slider.onmouseout = function() {myInt = setInterval('Refresh()', 15000 );" - "output.innerHTML = this.value;yyy(this.value);}\r\n" + "output.innerHTML = this.value;freqOffset(this.value);}\r\n" "slider.onmouseover = function() {clearInterval(myInt)};" "\r\n"; static int WebProc(struct TNCINFO * TNC, char * Buff, BOOL LOCAL) { - int Len = sprintf(Buff, WebProcTemplate, TNC->Port, TNC->Port, "VARA Status", "VARA Status"); + int Len = sprintf(Buff, WebProcTemplate, "VARA Status"); if (LOCAL) - Len += sprintf(&Buff[Len], Menubit, TNC->TXOffset, TNC->TXOffset); + Len += sprintf(&Buff[Len], Menubit); if (TNC->TXFreq) Len += sprintf(&Buff[Len], sliderBit, TNC->TXOffset, TNC->TXOffset); @@ -1118,7 +1091,7 @@ VOID VARASuspendPort(struct TNCINFO * TNC, struct TNCINFO * ThisTNC) TNC->PortRecord->PORTCONTROL.PortSuspended = TRUE; VARASendCommand(TNC, "LISTEN OFF\r", TRUE); strcpy(TNC->WEB_TNCSTATE, "Interlocked"); - MySetWindowText(TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE); + MySetWindowText(TNC, TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE); } @@ -1127,7 +1100,7 @@ VOID VARAReleasePort(struct TNCINFO * TNC) TNC->PortRecord->PORTCONTROL.PortSuspended = FALSE; VARASendCommand(TNC, "LISTEN ON\r", TRUE); strcpy(TNC->WEB_TNCSTATE, "Free"); - MySetWindowText(TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE); + MySetWindowText(TNC, TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE); } @@ -1508,7 +1481,7 @@ TNCRunning: if (TNC->Alerted == FALSE) { sprintf(TNC->WEB_COMMSSTATE, "Connecting to TNC"); - MySetWindowText(TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE); + MySetWindowText(TNC, TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE); } TNC->destaddr.sin_addr.s_addr = inet_addr(TNC->HostName); @@ -1583,7 +1556,7 @@ TNCRunning: TNC->Alerted = TRUE; sprintf(TNC->WEB_COMMSSTATE, "Connection to TNC failed"); - MySetWindowText(TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE); + MySetWindowText(TNC, TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE); } // printf("VARA Connect failed\n"); @@ -1613,7 +1586,7 @@ VConnected: i=sprintf(Msg, "Connect Failed for VARA Data socket - error code = %d\r\n", err); WritetoConsole(Msg); sprintf(TNC->WEB_COMMSSTATE, "Connection to TNC failed"); - MySetWindowText(TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE); + MySetWindowText(TNC, TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE); TNC->Alerted = TRUE; } @@ -1676,7 +1649,7 @@ VConnected: TNC->Alerted = TRUE; sprintf(TNC->WEB_COMMSSTATE, "Connected to VARA TNC"); - MySetWindowText(TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE); + MySetWindowText(TNC, TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE); FreeSemaphore(&Semaphore); @@ -1742,7 +1715,7 @@ Lost: WritetoConsole(Msg); sprintf(TNC->WEB_COMMSSTATE, "Connection to TNC lost"); - MySetWindowText(TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE); + MySetWindowText(TNC, TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE); TNC->CONNECTED = FALSE; TNC->Alerted = FALSE; @@ -1766,7 +1739,7 @@ Lost: WritetoConsole(Msg); sprintf(TNC->WEB_COMMSSTATE, "Connection to TNC lost"); - MySetWindowText(TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE); + MySetWindowText(TNC, TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE); TNC->CONNECTED = FALSE; TNC->Alerted = FALSE; @@ -1795,7 +1768,7 @@ Lost: // sprintf(TNC->WEB_COMMSSTATE, "Connection to TNC lost"); // GetSemaphore(&Semaphore, 52); -// MySetWindowText(TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE); +// MySetWindowText(TNC, TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE); // FreeSemaphore(&Semaphore); @@ -1900,7 +1873,7 @@ VOID VARAProcessResponse(struct TNCINFO * TNC, UCHAR * Buffer, int MsgLen) if (_memicmp(Buffer, "SN ", 3) == 0) { strcpy(TNC->WEB_PROTOSTATE, &Buffer[3]); - MySetWindowText(TNC->xIDC_PROTOSTATE, TNC->WEB_PROTOSTATE); + MySetWindowText(TNC, TNC->xIDC_PROTOSTATE, TNC->WEB_PROTOSTATE); TNC->SNR = atof(&Buffer[3]); return; @@ -1913,10 +1886,10 @@ VOID VARAProcessResponse(struct TNCINFO * TNC, UCHAR * Buffer, int MsgLen) TNC->BusyonTime = GetTickCount(); - MySetWindowText(TNC->xIDC_CHANSTATE, "Busy"); + MySetWindowText(TNC, TNC->xIDC_CHANSTATE, "Busy"); strcpy(TNC->WEB_CHANSTATE, "Busy"); - TNC->WinmorRestartCodecTimer = time(NULL); + TNC->WinmorRestartCodecTimer = NOW; return; } @@ -1935,8 +1908,8 @@ VOID VARAProcessResponse(struct TNCINFO * TNC, UCHAR * Buffer, int MsgLen) } - MySetWindowText(TNC->xIDC_CHANSTATE, TNC->WEB_CHANSTATE); - TNC->WinmorRestartCodecTimer = time(NULL); + MySetWindowText(TNC, TNC->xIDC_CHANSTATE, TNC->WEB_CHANSTATE); + TNC->WinmorRestartCodecTimer = NOW; return; } @@ -2017,7 +1990,7 @@ VOID VARAProcessResponse(struct TNCINFO * TNC, UCHAR * Buffer, int MsgLen) sprintf(TNC->WEB_TRAFFIC, "Sent %d RXed %d Queued %s", STREAM->bytesTXed, STREAM->bytesRXed, &Buffer[7]); - MySetWindowText(TNC->xIDC_TRAFFIC, TNC->WEB_TRAFFIC); + MySetWindowText(TNC, TNC->xIDC_TRAFFIC, TNC->WEB_TRAFFIC); return; } @@ -2077,7 +2050,7 @@ VOID VARAProcessResponse(struct TNCINFO * TNC, UCHAR * Buffer, int MsgLen) strcpy(TNC->WEB_MODE, "2750"); } - MySetWindowText(TNC->xIDC_MODE, TNC->WEB_MODE); + MySetWindowText(TNC, TNC->xIDC_MODE, TNC->WEB_MODE); memcpy(Call, &Buffer[10], 10); ptr = strchr(Call, ' '); @@ -2105,7 +2078,7 @@ VOID VARAProcessResponse(struct TNCINFO * TNC, UCHAR * Buffer, int MsgLen) memset(STREAM, 0, sizeof(struct STREAMINFO)); - STREAM->ConnectTime = time(NULL); + STREAM->ConnectTime = NOW; SuspendOtherPorts(TNC); @@ -2146,7 +2119,7 @@ VOID VARAProcessResponse(struct TNCINFO * TNC, UCHAR * Buffer, int MsgLen) if (WL2K) strcpy(SESS->RMSCall, WL2K->RMSCall); - MySetWindowText(TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE); + MySetWindowText(TNC, TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE); // Check for ExcludeList @@ -2297,7 +2270,7 @@ VOID VARAProcessResponse(struct TNCINFO * TNC, UCHAR * Buffer, int MsgLen) char Reply[80]; int ReplyLen; - STREAM->ConnectTime = time(NULL); + STREAM->ConnectTime = NOW; if (TNC->NetRomMode) { @@ -2342,7 +2315,7 @@ VOID VARAProcessResponse(struct TNCINFO * TNC, UCHAR * Buffer, int MsgLen) else sprintf(TNC->WEB_TNCSTATE, "%s Connected to %s Outbound", TNC->Streams[0].MyCall, TNC->Streams[0].RemoteCall); - MySetWindowText(TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE); + MySetWindowText(TNC, TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE); UpdateMH(TNC, TNC->TargetCall, '+', 'O'); return; @@ -2499,7 +2472,7 @@ VOID VARAProcessReceivedData(struct TNCINFO * TNC) // closesocket(TNC->TCPSock); sprintf(TNC->WEB_COMMSSTATE, "Connection to TNC lost"); - MySetWindowText(TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE); + MySetWindowText(TNC, TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE); TNC->CONNECTED = FALSE; TNC->Alerted = FALSE; @@ -2701,7 +2674,7 @@ VOID VARAProcessReceivedControl(struct TNCINFO * TNC) TNC->Streams[0].Disconnecting = FALSE; sprintf(TNC->WEB_COMMSSTATE, "Connection to TNC lost"); - MySetWindowText(TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE); + MySetWindowText(TNC, TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE); return; } @@ -2773,7 +2746,7 @@ VOID VARAProcessDataPacket(struct TNCINFO * TNC, UCHAR * Data, int Length) sprintf(TNC->WEB_TRAFFIC, "Sent %d RXed %d Queued %d", STREAM->bytesTXed, STREAM->bytesRXed,STREAM->BytesOutstanding); - MySetWindowText(TNC->xIDC_TRAFFIC, TNC->WEB_TRAFFIC); + MySetWindowText(TNC, TNC->xIDC_TRAFFIC, TNC->WEB_TRAFFIC); // if VARAAC Mode, remove byte count from front and add cr // could possibly be longer than buffer size @@ -2970,7 +2943,7 @@ VOID VARAReleaseTNC(struct TNCINFO * TNC) VARASendCommand(TNC, "LISTEN ON\r", TRUE); strcpy(TNC->WEB_TNCSTATE, "Free"); - MySetWindowText(TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE); + MySetWindowText(TNC, TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE); // Start Scanner @@ -3047,7 +3020,7 @@ void SendVARANetrom(struct TNCINFO * TNC, unsigned char * Data, int Len) // Save Command, and wait up to 10 secs sprintf(TNC->WEB_TNCSTATE, "Waiting for clear channel"); - MySetWindowText(TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE); + MySetWindowText(TNC, TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE); TNC->ConnectCmd = _strdup(Connect); TNC->BusyDelay = TNC->BusyWait * 10; // BusyWait secs @@ -3057,13 +3030,13 @@ void SendVARANetrom(struct TNCINFO * TNC, unsigned char * Data, int Len) TNC->OverrideBusy = FALSE; VARASendCommand(TNC, Connect, TRUE); - TNC->Streams[0].ConnectTime = time(NULL); + TNC->Streams[0].ConnectTime = NOW; memset(TNC->Streams[0].RemoteCall, 0, 10); strcpy(TNC->Streams[0].RemoteCall, MYNETROMCALL); sprintf(TNC->WEB_TNCSTATE, "%s Connecting to %s", TNC->Streams[0].MyCall, TNC->Streams[0].RemoteCall); - MySetWindowText(TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE); + MySetWindowText(TNC, TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE); } } diff --git a/Versions.h b/Versions.h index f1cfa66..ec8062b 100644 --- a/Versions.h +++ b/Versions.h @@ -10,8 +10,8 @@ #endif -#define KVers 6,0,25,32 -#define KVerstring "6.0.25.32\0" +#define KVers 6,0,25,35 +#define KVerstring "6.0.25.35\0" #ifdef CKernel diff --git a/WINMOR.c b/WINMOR.c index ac47068..975bde0 100644 --- a/WINMOR.c +++ b/WINMOR.c @@ -151,6 +151,8 @@ VOID WritetoTraceSupport(struct TNCINFO * TNC, char * Msg, int Len) if (Len < 0) return; + TNC->PageChanged = TNC->WebSockUsed; + Save = Msg[Len]; Msg[Len] = 0; @@ -215,7 +217,7 @@ lineloop: #endif // Write to Web Buffer - T = time(NULL); + T = NOW; tm = gmtime(&T); sprintf_s(Time, sizeof(Time),"%02d:%02d ", tm->tm_hour, tm->tm_min); @@ -263,7 +265,7 @@ lineloop: #else index=SendMessage(TNC->hMonitor, LB_ADDSTRING, 0, (LPARAM)(LPCTSTR) ptr1 ); #endif - T = time(NULL); + T = NOW; tm = gmtime(&T); sprintf_s(Time, sizeof(Time),"%02d:%02d ", tm->tm_hour, tm->tm_min); @@ -314,24 +316,28 @@ int C_Q_ADD_NP(VOID *PQ, VOID *PBUFF); struct SEM SetWindTextSem = {0, 0, 0, 0}; -VOID MySetWindowText(HWND hWnd, char * Msg) +VOID MySetWindowText(struct TNCINFO * TNC, HWND hWnd, char * Msg) { + if (TNC) + TNC->PageChanged = TNC->WebSockUsed; + #ifndef LINBPQ + { + PMSGWITHLEN buffptr; - PMSGWITHLEN buffptr; + GetSemaphore(&SetWindTextSem, 61); + buffptr = zalloc(400); - GetSemaphore(&SetWindTextSem, 61); - buffptr = zalloc(400); + if (buffptr) + { + buffptr->Len= (UINT)hWnd; + memcpy(&buffptr->Data[0], Msg, strlen(Msg) + 1); - if (buffptr) - { - buffptr->Len= (UINT)hWnd; - memcpy(&buffptr->Data[0], Msg, strlen(Msg) + 1); - - C_Q_ADD_NP(&SetWindowTextQ, buffptr); - } + C_Q_ADD_NP(&SetWindowTextQ, buffptr); + } - FreeSemaphore(&SetWindTextSem); + FreeSemaphore(&SetWindTextSem); + } #endif } @@ -598,7 +604,7 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff) if ((STREAM->Connecting || STREAM->Connected) && !STREAM->Disconnecting) { - if (TNC->SessionTimeLimit && STREAM->ConnectTime && time(NULL) > (TNC->SessionTimeLimit + STREAM->ConnectTime)) + if (TNC->SessionTimeLimit && STREAM->ConnectTime && NOW > (TNC->SessionTimeLimit + STREAM->ConnectTime)) { send(TNC->TCPSock,"DISCONNECT\r\n", 12, 0); STREAM->Disconnecting = TRUE; @@ -680,7 +686,7 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff) { char wtext[100]; sprintf (wtext, "WINMOR Sound Card TNC - BPQ %s", TNC->PortRecord->PORTCONTROL.PORTDESCRIPTION); - MySetWindowText(TNC->hWnd, wtext); + MySetWindowText(TNC, TNC->hWnd, wtext); } TNC->HeartBeat = 0; @@ -693,7 +699,7 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff) send(TNC->TCPSock, "MODE\r\n", 6, 0); else { - if (time(NULL) - TNC->WinmorRestartCodecTimer > 900) // 15 mins + if (NOW - TNC->WinmorRestartCodecTimer > 900) // 15 mins { send(TNC->TCPSock, "CODEC FALSE\r\n", 13, 0); send(TNC->TCPSock, "CODEC TRUE\r\n", 12, 0); @@ -768,7 +774,7 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff) char Time[80]; TNC->Restarts++; - TNC->LastRestart = time(NULL); + TNC->LastRestart = NOW; tm = gmtime(&TNC->LastRestart); @@ -1336,12 +1342,12 @@ VOID ReleaseTNC(struct TNCINFO * TNC) send(TNC->TCPSock, "LISTEN TRUE\r\nMAXCONREQ 4\r\n", 26, 0); strcpy(TNC->WEB_TNCSTATE, "Free"); - MySetWindowText(TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE); + MySetWindowText(TNC, TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE); if (TNC->hWnd) { sprintf (wtext, "WINMOR Sound Card TNC - BPQ %s", TNC->PortRecord->PORTCONTROL.PORTDESCRIPTION); - MySetWindowText(TNC->hWnd, wtext); + MySetWindowText(TNC, TNC->hWnd, wtext); } // Start Scanner @@ -1416,7 +1422,7 @@ VOID WinmorSuspendPort(struct TNCINFO * TNC, struct TNCINFO * ThisTNC) if (TNC->Busy) { TNC->Busy = FALSE; // Can't clear detector if CODEC off. - MySetWindowText(TNC->xIDC_CHANSTATE, "Clear"); + MySetWindowText(TNC, TNC->xIDC_CHANSTATE, "Clear"); strcpy(TNC->WEB_CHANSTATE, "Clear"); } } @@ -1429,15 +1435,18 @@ VOID WinmorReleasePort(struct TNCINFO * TNC) extern char WebProcTemplate[]; extern char sliderBit[]; +extern char Menubit[]; static int WebProc(struct TNCINFO * TNC, char * Buff, BOOL LOCAL) { - int Len = sprintf(Buff, WebProcTemplate, TNC->Port, TNC->Port, "WINMOR Status", "WINMOR Status"); + int Len = sprintf(Buff, WebProcTemplate, "WINMOR Status"); + + if (LOCAL) + Len += sprintf(&Buff[Len], Menubit); if (TNC->TXFreq) Len += sprintf(&Buff[Len], sliderBit, TNC->TXOffset, TNC->TXOffset); - Len += sprintf(&Buff[Len], "
"); Len += sprintf(&Buff[Len], "", TNC->WEB_COMMSSTATE); Len += sprintf(&Buff[Len], "", TNC->WEB_TNCSTATE); @@ -1801,7 +1810,7 @@ VOID WINMORThread(void * portptr) i=sprintf(Msg, "Connect Failed for WINMOR socket - error code = %d\r\n", err); WritetoConsole(Msg); sprintf(TNC->WEB_COMMSSTATE, "Connection to TNC failed"); - MySetWindowText(TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE); + MySetWindowText(TNC, TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE); TNC->Alerted = TRUE; } @@ -1867,7 +1876,7 @@ VOID WINMORThread(void * portptr) sprintf(TNC->WEB_COMMSSTATE, "Connected to WINMOR TNC"); GetSemaphore(&Semaphore, 40); - MySetWindowText(TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE); + MySetWindowText(TNC, TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE); FreeSemaphore(&Semaphore); } @@ -1925,7 +1934,7 @@ Lost: sprintf(TNC->WEB_COMMSSTATE, "Connection to TNC lost"); GetSemaphore(&Semaphore, 40); - MySetWindowText(TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE); + MySetWindowText(TNC, TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE); FreeSemaphore(&Semaphore); TNC->CONNECTED = FALSE; @@ -1955,7 +1964,7 @@ Lost: sprintf(TNC->WEB_COMMSSTATE, "Connection to TNC lost"); GetSemaphore(&Semaphore, 40); - MySetWindowText(TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE); + MySetWindowText(TNC, TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE); FreeSemaphore(&Semaphore); TNC->CONNECTED = FALSE; @@ -2082,7 +2091,7 @@ VOID ProcessResponse(struct TNCINFO * TNC, UCHAR * Buffer, int MsgLen) SetWindowText(TNC->xIDC_CHANSTATE, "Busy"); strcpy(TNC->WEB_CHANSTATE, "Busy"); - TNC->WinmorRestartCodecTimer = time(NULL); + TNC->WinmorRestartCodecTimer = NOW; return; } @@ -2095,7 +2104,7 @@ VOID ProcessResponse(struct TNCINFO * TNC, UCHAR * Buffer, int MsgLen) strcpy(TNC->WEB_CHANSTATE, "Clear"); SetWindowText(TNC->xIDC_CHANSTATE, TNC->WEB_CHANSTATE); - TNC->WinmorRestartCodecTimer = time(NULL); + TNC->WinmorRestartCodecTimer = NOW; return; } @@ -2132,7 +2141,7 @@ VOID ProcessResponse(struct TNCINFO * TNC, UCHAR * Buffer, int MsgLen) WritetoTrace(TNC, Buffer, MsgLen - 2); FreeSemaphore(&Semaphore); - STREAM->ConnectTime = time(NULL); + STREAM->ConnectTime = NOW; STREAM->bytesRXed = STREAM->bytesTXed = STREAM->PacketsSent = 0; if (TNC->StartInRobust) @@ -2483,7 +2492,7 @@ VOID ProcessResponse(struct TNCINFO * TNC, UCHAR * Buffer, int MsgLen) strcpy(TNC->WEB_MODE, &Buffer[5]); GetSemaphore(&Semaphore, 50); - MySetWindowText(TNC->xIDC_MODE, &Buffer[5]); + MySetWindowText(TNC, TNC->xIDC_MODE, &Buffer[5]); FreeSemaphore(&Semaphore); return; } @@ -2499,7 +2508,7 @@ VOID ProcessResponse(struct TNCINFO * TNC, UCHAR * Buffer, int MsgLen) if (_memicmp(Buffer, "NEWSTATE", 8) == 0) { - TNC->WinmorRestartCodecTimer = time(NULL); + TNC->WinmorRestartCodecTimer = NOW; SetWindowText(TNC->xIDC_PROTOSTATE, &Buffer[9]); strcpy(TNC->WEB_PROTOSTATE, &Buffer[9]); @@ -2710,7 +2719,7 @@ loop: // Does this mean closed? sprintf(TNC->WEB_COMMSSTATE, "Connection to TNC lost"); - MySetWindowText(TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE); + MySetWindowText(TNC, TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE); TNC->CONNECTING = FALSE; TNC->CONNECTED = FALSE; diff --git a/WinRPR.c b/WinRPR.c index 531f41e..2f1a4bb 100644 --- a/WinRPR.c +++ b/WinRPR.c @@ -718,33 +718,9 @@ ok: int WebProc(struct TNCINFO * TNC, char * Buff, BOOL LOCAL) { - int Interval = 15; int Len; - if (LOCAL) - { - if (TNC->WEB_CHANGED) - Interval = 1; - else - Interval = 4; - } - else - { - if (TNC->WEB_CHANGED) - Interval = 4; - else - Interval = 15; - } - - if (TNC->WEB_CHANGED) - { - TNC->WEB_CHANGED -= Interval; - if (TNC->WEB_CHANGED < 0) - TNC->WEB_CHANGED = 0; - } - - Len = sprintf(Buff, "" - "WinRPR Status

WinRPR Status

", Interval); + Len = sprintf(Buff, "

WinRPR Status

"); Len += sprintf(&Buff[Len], "
Comms State%s
TNC State%s
"); @@ -1177,7 +1153,7 @@ VOID WinRPRProcessReceivedPacket(struct TNCINFO * TNC) TNC->Streams[0].ReportDISC = TRUE; sprintf(TNC->WEB_COMMSSTATE, "Connection to TNC lost"); - MySetWindowText(TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE); + MySetWindowText(TNC, TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE); return; } @@ -1533,10 +1509,11 @@ TNCRunning: // sinx.sin_addr.s_addr = INADDR_ANY; // sinx.sin_port = 0; - sprintf(TNC->WEB_COMMSSTATE, "Connecting to TNC"); - MySetWindowText(TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE); - - + if (!TNC->Alerted) + { + sprintf(TNC->WEB_COMMSSTATE, "Connecting to TNC"); + MySetWindowText(TNC, TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE); + } if (connect(TNC->TCPSock,(LPSOCKADDR) &TNC->destaddr,sizeof(TNC->destaddr)) == 0) { @@ -1558,7 +1535,7 @@ TNCRunning: WritetoConsoleLocal(Msg); sprintf(TNC->WEB_COMMSSTATE, "Connection to TNC failed"); - MySetWindowText(TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE); + MySetWindowText(TNC, TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE); TNC->Alerted = TRUE; } @@ -1614,7 +1591,7 @@ TNCRunning: TNC->Alerted = TRUE; sprintf(TNC->WEB_COMMSSTATE, "Connected to WinRPR TNC"); - MySetWindowText(TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE); + MySetWindowText(TNC, TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE); FreeSemaphore(&Semaphore); @@ -1666,7 +1643,7 @@ Lost: WritetoConsoleLocal(Msg); sprintf(TNC->WEB_COMMSSTATE, "Connection to TNC lost"); - MySetWindowText(TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE); + MySetWindowText(TNC, TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE); TNC->CONNECTED = FALSE; TNC->Alerted = FALSE; diff --git a/adif.c b/adif.c index 6fab6fc..1214fed 100644 --- a/adif.c +++ b/adif.c @@ -143,7 +143,7 @@ BOOL UpdateADIFRecord(ADIF * ADIF, char * Msg, char Dirn) if (ADIF->StartTime == 0) { - ADIF->StartTime = time(NULL); + ADIF->StartTime = NOW; // ADIF->Mode = 49; // Unused value (unforunately 0 = PKT1200) } @@ -393,7 +393,7 @@ BOOL WriteADIFRecord(ADIF * ADIF) if (ADIF == NULL) return TRUE; - T = time(NULL); + T = NOW; tm = gmtime(&T); memcpy(&endtm, tm, sizeof(endtm)); diff --git a/asmstrucs.h b/asmstrucs.h index 4c26ec5..22a00e5 100644 --- a/asmstrucs.h +++ b/asmstrucs.h @@ -139,7 +139,7 @@ typedef struct _TRANSPORTENTRY UCHAR SPYFLAG; // SPY - CONNECT TO NODE VIA BBS CALLSIGN UCHAR RTT_SEQ; // SEQUENCE NUMBER BEING TIMED - uint32_t RTT_TIMER; // TIME ABOVE SEQUENCE WAS SENT + uint64_t RTT_TIMER; // TIME ABOVE SEQUENCE WAS SENT USHORT PASSWORD; // AUTHORISATION CODE FOR REMOTE SYSOP @@ -182,7 +182,7 @@ typedef struct _TRANSPORTENTRY int segsResent; int NRRID; - time_t NRRTime; + uint64_t NRRTicks; time_t ConnectTime; char Direction[16]; // In or Out @@ -266,6 +266,7 @@ typedef struct ROUTE int recNum; // This entry's index it Routes table int noV2point2; // Set to force V2.0 connect. Can be set in config or dynamically learned int Stopped; // Set by STOPROUTE command + int NPR; // NPR Link } *PROUTE; @@ -690,8 +691,8 @@ typedef struct PORTCONTROL UCHAR SOFTDCDFLAG; // IF SET USE 'SOFT DCD' - IF MODEM CANT GIVE A REAL ONE UCHAR PORTSLOTTIME; // SLOT TIME UCHAR PORTTAILTIME; // TAIL TIME - UCHAR PORTT1; // L2 TIMEOUT - UCHAR PORTT2; // L2 DELAYED ACK TIMER + UCHAR PORTT1; // L2 TIMEOUT (100 ms intervals) + UCHAR PORTT2; // L2 DELAYED ACK TIMER (100 ms intervals) UCHAR PORTN2; // RETRIES UCHAR PORTPACLEN; // DEFAULT PACLEN FOR INCOMING SESSIONS diff --git a/bpq32.h b/bpq32.h index 2bab90a..012f252 100644 --- a/bpq32.h +++ b/bpq32.h @@ -13,7 +13,7 @@ make the code use GetProcAddress rather than LoadLibrary. Without this the refer count on BPQ32.dll gets messed up, and the code will not unload cleanly. */ - +#include "winstdint.h" #ifndef DYNLOADBPQ @@ -264,9 +264,11 @@ VOID APIENTRY SendChatReport(UINT_PTR ChatReportSocket, char * buff, int txlen); int APIENTRY CountFramesQueuedOnStream(int Stream); +int APIENTRY RunBPQ32Background(); + char * APIENTRY GetLOC(); -DllExport uint64_t APIENTRY GetPortFrequency(int PortNo, char * FreqString); +uint64_t APIENTRY GetPortFrequency(int PortNo, char * FreqString); #else diff --git a/bpqaxip.c b/bpqaxip.c index 5553b8c..10c6ecd 100644 --- a/bpqaxip.c +++ b/bpqaxip.c @@ -2630,7 +2630,7 @@ BOOL CheckSourceisResolvable(struct AXIPPORTINFO * PORT, char * call, int FromPo arp->SourcePort = ToPort; } } - arp->LastHeard = time(NULL); + arp->LastHeard = NOW; return 1; // Ok to process } index++; diff --git a/cMain.c b/cMain.c index b7f1b59..1e0adad 100644 --- a/cMain.c +++ b/cMain.c @@ -254,15 +254,13 @@ void * TRACE_Q = NULL; // TRANSMITTED FRAMES TO BE TRACED int RANDOM = 0; // 'RANDOM' NUMBER FOR PERSISTENCE CALCS int L2TIMERFLAG = 0; // INCREMENTED AT 18HZ BY TIMER INTERRUPT -int L3TIMERFLAG = 0; // DITTO -int L4TIMERFLAG = 0; // DITTO char HEADERCHAR = '}'; // CHAR FOR _NODE HEADER MSGS VOID * LASTPOINTER = NULL; // PERVIOUS _NODE DURING CHAINING -int REALTIMETICKS = 0; -int BGTIMER = 0; // TO CONTROL BG SCANS +int REALTIMETICKS = 0; // Count of 100 ms intervals since load + VOID * CONFIGPTR = NULL; // Internal Config Get Offset @@ -451,6 +449,9 @@ VOID EXTTX(PEXTPORTDATA PORTVEC, MESSAGE * Buffer) } +VOID * GetBuffQuick(); +UINT ReleaseBufferQuick(VOID *pBUFF); + VOID EXTRX(PEXTPORTDATA PORTVEC) { struct _MESSAGE * Message; @@ -462,16 +463,16 @@ Loop: if (QCOUNT < 10) return; - Message = GetBuff(); - + Message = GetBuffQuick(); + if (Message == NULL) return; Len = (size_t)PORTVEC->PORT_EXT_ADDR(1, PORT->PORTNUMBER, (PDATAMESSAGE)Message); - + if (Len == 0) { - ReleaseBuffer((UINT *)Message); + ReleaseBufferQuick((UINT *)Message); return; } @@ -484,7 +485,7 @@ Loop: int Sessno = Message->PORT; TRANSPORTENTRY * Session; - ReleaseBuffer((UINT *)Message); + ReleaseBufferQuick((UINT *)Message); // GET RID OF ANY SESSION ENTRIES @@ -533,8 +534,12 @@ Loop: VOID EXTTIMER(PEXTPORTDATA PORTVEC) { + // Called every 100 mS + // USED TO SEND A RE-INIT IN THE CORRECT PROCESS + struct TNCINFO * TNC = TNCInfo[PORTVEC->PORTCONTROL.PORTNUMBER]; + if (PORTVEC->EXTRESTART) { PORTVEC->EXTRESTART = 0; //CLEAR @@ -542,10 +547,19 @@ VOID EXTTIMER(PEXTPORTDATA PORTVEC) } PORTVEC->PORT_EXT_ADDR(7, PORTVEC->PORTCONTROL.PORTNUMBER, 0); // Timer Routine + + if (TNC && TNC->PageChanged) + { + BuildDevicePage(TNC); + TNC->PageChanged = FALSE; + } + } VOID EXTSLOWTIMER(PEXTPORTDATA PORTVEC) { + // Called every minute 60 secs + PORTVEC->PORT_EXT_ADDR(8, PORTVEC->PORTCONTROL.PORTNUMBER, 0); // Timer Routine } @@ -655,9 +669,9 @@ VOID * TXCHECKCODE[12] = {KISSTXCHECK, HDLCTXCHECK, HDLCTXCHECK, HDLCTXCHECK, KI extern int BACKGROUND(); extern int L2TimerProc(); -extern int L3TimerProc(); -extern int L4TimerProc(); -extern int L3FastTimer(); +extern int L3MinuteTimerProc(); +extern int L4SecTimer(); +extern int L3SecTimer(); extern int StatsTimer(); extern int COMMANDHANDLER(); VOID SDETX(struct _LINKTABLE * LINK); @@ -711,7 +725,7 @@ BOOL Start() if (cfg->C_NODEALIAS[0] == 0) memset(cfg->C_NODEALIAS, ' ', 10); - TimeLoaded = time(NULL); + TimeLoaded = NOW; AUTOSAVE = cfg->C_AUTOSAVE; @@ -1056,8 +1070,8 @@ BOOL Start() PORT->FULLDUPLEX = (UCHAR)PortRec->FULLDUP; PORT->SOFTDCDFLAG = (UCHAR)PortRec->SOFTDCD; - PORT->PORTT1 = PortRec->FRACK / 333; - PORT->PORTT2 = PortRec->RESPTIME /333; + PORT->PORTT1 = PortRec->FRACK / 100; + PORT->PORTT2 = PortRec->RESPTIME /100; PORT->PORTN2 = (UCHAR)PortRec->RETRIES; PORT->PORTPACLEN = (UCHAR)PortRec->PACLEN; @@ -1432,7 +1446,7 @@ BOOL Start() ROUTE->NBOUR_MAXFRAME = Rcfg->pwind & 0x3f; FRACK = Rcfg->pfrack; - ROUTE->NBOUR_FRACK = FRACK / 333; + ROUTE->NBOUR_FRACK = FRACK / 100; ROUTE->NBOUR_PACLEN = Rcfg->ppacl; ROUTE->OtherendsRouteQual = ROUTE->OtherendLocked = Rcfg->farQual; @@ -1447,6 +1461,8 @@ BOOL Start() ROUTE->TCPAddress->ai_addr = (struct sockaddr *) zalloc(sizeof(struct sockaddr)); } + ROUTE->NPR = Rcfg->NPR; + ROUTE->recNum = index++; Rcfg++; @@ -1636,7 +1652,11 @@ BOOL Start() _beginthread(WritePacketLogThread, 0, NULL); - lastSaveSecs = CurrentSecs = lastSlowSecs = time(NULL); + // Initialise interval timers + + lastMinuteSecs = lastHourSecs = lastTenSecSecs = NOW = time(NULL); + + last100mSTickCount = lastSecTickCount = GetTickCount(); // if EnableOARCAPI set try to resolve host here so we can send Node up event before anything else @@ -1655,7 +1675,7 @@ BOOL Start() hookNodeStarted(); nodeStartedSent = 1; - LastNodeStatus = time(NULL); + LastNodeStatus = NOW; } } @@ -2175,9 +2195,13 @@ int DelayBuffers = 0; void sendModeReport(); void sendFreqReport(); -VOID TIMERINTERRUPT() +int TIMERINTERRUPT() { - // Main Processing loop - CALLED EVERY 100 MS + // Main Processing - Called rapidly (maybe 1 mS) + + // Returns 1 if 100mS has passed since last call + + int retval = 0; int i; struct PORTCONTROL * PORT = PORTTABLE; @@ -2186,41 +2210,44 @@ VOID TIMERINTERRUPT() struct _MESSAGE * Message; int toPort; - CurrentSecs = time(NULL); + if (GetTickCount() - last100mSTickCount > 100) + { + retval = 1; + + last100mSTickCount = GetTickCount(); + REALTIMETICKS++; + + // CALL PORT TIMER 100 mS ROUTINES - BGTIMER++; - REALTIMETICKS++; - L2TIMERFLAG++; // INCREMENT FLAG FOR BG - L3TIMERFLAG++; // INCREMENT FLAG FOR BG - L4TIMERFLAG++; // INCREMENT FLAG FOR BG + for (i = 0; i < NUMBEROFPORTS; i++) + { + PORT->PORTTIMERCODE(PORT); -// CALL PORT TIMER ROUTINES + // Check Smart ID timer - for (i = 0; i < NUMBEROFPORTS; i++) - { - PORT->PORTTIMERCODE(PORT); + if (PORT->SmartIDNeeded && PORT->SmartIDNeeded < NOW) + SendSmartID(PORT); - // Check Smart ID timer + PORT = PORT->PORTPOINTER; + } - if (PORT->SmartIDNeeded && PORT->SmartIDNeeded < time(NULL)) - SendSmartID(PORT); - PORT = PORT->PORTPOINTER; - } + if (last100mSTickCount - lastSecTickCount > 1000) + { + lastSecTickCount = last100mSTickCount; - // CHECK FOR TIMER ACTIVITY + L3SecTimer(); + L4SecTimer(); + } - if (L2TIMERFLAG >= 3) - { - L2TIMERFLAG -= 3; - L2TimerProc(); // 300 mS + L2TimerProc(); // Now 100 mS } - if (CurrentSecs - lastSlowSecs >= 60) // 1 PER MIN + if (NOW - lastMinuteSecs >= 60) // 1 PER MIN { - lastSlowSecs = CurrentSecs; + lastMinuteSecs = NOW; - L3TimerProc(); + L3MinuteTimerProc(); if (needAIS) AISTimer(); @@ -2258,9 +2285,9 @@ VOID TIMERINTERRUPT() if (MQTT) MQTTTimer(); - if (LastNodeStatus && (time(NULL) - LastNodeStatus) > nodeStatusTimer) + if (LastNodeStatus && (NOW - LastNodeStatus) > nodeStatusTimer) { - LastNodeStatus = time(NULL); + LastNodeStatus = NOW; hookNodeRunning(); } @@ -2282,9 +2309,9 @@ VOID TIMERINTERRUPT() // Check Autosave Nodes and MH timer - if (CurrentSecs - lastSaveSecs >= 3600) // 1 per hour + if (NOW - lastHourSecs >= 3600) // 1 per hour { - lastSaveSecs = CurrentSecs; + lastHourSecs = NOW; if (AUTOSAVE == 1) SaveNodes(); @@ -2292,16 +2319,10 @@ VOID TIMERINTERRUPT() SaveMH(); } - if (L4TIMERFLAG >= 10) // 1 PER SEC - { - L4TIMERFLAG -= 10; - - L3FastTimer(); - L4TimerProc(); - } - // SEE IF ANY FRAMES TO TRACE + // The rest runs on every call + Buffer = Q_REM(&TRACE_Q); while (Buffer) @@ -2347,8 +2368,6 @@ VOID TIMERINTERRUPT() while (Buffer) { Message = (struct _MESSAGE *) Buffer; - if (CURRENTPORT == 30) - Sent = Sent; if (PORT->PROTOCOL == 10) { @@ -2428,7 +2447,7 @@ VOID TIMERINTERRUPT() L2Packet: // TIME STAMP IT - time(&Message->Timestamp); + Message->Timestamp = NOW; Message->PORT = CURRENTPORT; @@ -2459,7 +2478,7 @@ L2Packet: { // Using Smart ID, but none scheduled - BPORT->SmartIDNeeded = time(NULL) + BPORT->SmartIDInterval; + BPORT->SmartIDNeeded = NOW + BPORT->SmartIDInterval; } PUT_ON_PORT_Q(BPORT, BBuffer); } @@ -2626,7 +2645,7 @@ ENDOFLIST: { // Stuck link debug check - if (LINK->LINKWINDOW == 0 || LINK->LASTFRAMESENT == 0 || (time(NULL) - LINK->LASTFRAMESENT) > 60) // No send for 60 secs + if (LINK->LINKWINDOW == 0 || LINK->LASTFRAMESENT == 0 || (NOW - LINK->LASTFRAMESENT) > 60) // No send for 60 secs { if (COUNT_AT_L2(LINK) > 16 || LINK->LINKWINDOW == 0) { @@ -2636,7 +2655,7 @@ ENDOFLIST: char Normcall2[11] = ""; int Count = COUNT_AT_L2(LINK); - int secs = time(NULL) - LINK->LASTFRAMESENT; + int secs = NOW - LINK->LASTFRAMESENT; ConvFromAX25(LINK->LINKCALL, Normcall); @@ -2657,12 +2676,10 @@ ENDOFLIST: L2SENDCOMMAND(LINK, DISC | PFBIT); - return; + return retval; // why?? } } - } - } } LINK++; @@ -2671,6 +2688,10 @@ ENDOFLIST: L4BG(); // DO LEVEL 4 PROCESSING L3BG(); TNCTimerProc(); + + return retval; + + } VOID DoListenMonitor(TRANSPORTENTRY * L4, MESSAGE * Msg) @@ -3060,7 +3081,7 @@ void WriteConnectLog(char * fromCall, char * toCall, UCHAR * Mode) char LogMsg[256]; int MsgLen; - T = time(NULL); + T = NOW; tm = gmtime(&T); sprintf(FN,"%s/logs/ConnectLog_%02d%02d%02d.log", LogDirectory, tm->tm_year - 100, tm->tm_mon + 1, tm->tm_mday); diff --git a/cheaders.h b/cheaders.h index bd2b259..35abd8f 100644 --- a/cheaders.h +++ b/cheaders.h @@ -161,7 +161,7 @@ struct SEM; void _GetSemaphore(struct SEM * Semaphore, int ID, char * File, int Line); void FreeSemaphore(struct SEM * Semaphore); -void MySetWindowText(HWND hWnd, char * Msg); +void MySetWindowText(struct TNCINFO * TNC, HWND hWnd, char * Msg); Dll int APIENTRY SessionControl(int stream, int command, int Mask); @@ -396,9 +396,14 @@ extern UCHAR AuthorisedProgram; // Local Variable. Set if Program is on secure extern int REALTIMETICKS; -extern time_t CurrentSecs; -extern time_t lastSlowSecs; -extern time_t lastSaveSecs; +extern time_t NOW; // From time() +extern time_t lastMinuteSecs; // Time minute process last run +extern time_t lastHourSecs; // Time hour process last run +extern time_t lastTenSecSecs; + +extern uint64_t last100mSTickCount; +extern uint64_t lastSecTickCount; + // SNMP Variables @@ -438,6 +443,7 @@ extern char MQTT_PASS[80]; extern int SUPPORT2point2; +extern char * DevWebPage[MaxBPQPortNo]; DllExport uint64_t APIENTRY GetPortFrequency(int PortNo, char * FreqStringMhz); diff --git a/config.c b/config.c index 640ce10..25a6671 100644 --- a/config.c +++ b/config.c @@ -703,7 +703,7 @@ BOOL ProcessConfig() /* // Dump to file for debugging - sprintf_s(inputname, sizeof(inputname), "CFG%d", time(NULL)); + sprintf_s(inputname, sizeof(inputname), "CFG%d", NOW); fp1 = fopen(inputname, "wb"); @@ -1702,6 +1702,13 @@ int routes(int i) Route->inp3 = atoi(val); } + else if (strcmp(ptr, "NPR") == 0) + { + char * val = strtok_s(NULL, " ,=", &context); + + if (val) + Route->NPR = atoi(val); + } else if (strcmp(ptr, "NOKEEPALIVES") == 0) { char * val = strtok_s(NULL, " ,=", &context); diff --git a/configstructs.h b/configstructs.h index 6c09c26..92d7c23 100644 --- a/configstructs.h +++ b/configstructs.h @@ -101,6 +101,7 @@ struct ROUTECONFIG int ppacl; int farQual; int inp3; + int NPR; int nokeepalives; int noV2point2; char * tcphost; diff --git a/datadefs.c b/datadefs.c index e688283..a704b06 100644 --- a/datadefs.c +++ b/datadefs.c @@ -66,8 +66,15 @@ UCHAR PACTORCALL[7] = {'P'+'P','A'+'A','C'+'C','T'+'T','O'+'O','R'+'R'}; //PACTO UCHAR L3RTT[7] = {'L'+'L','3'+'3','R'+'R','T'+'T','T'+'T',0x40, 0xe0}; // L3RTT IN AX25 UCHAR L3KEEP[7] = {'K'+'K','E'+'E','E'+'E','P'+'P','L'+'L','I'+'I', 0xe0}; // KEEPLI IN AX25 -time_t CurrentSecs; -time_t lastSlowSecs; +time_t NOW; // From time() +time_t lastMinuteSecs; // Time minute process last run +time_t lastHourSecs; // Time hour process last run +time_t lastTenSecSecs; + +uint64_t last100mSTickCount; +uint64_t lastSecTickCount; + + time_t lastSaveSecs; char WL2KCall[10] = ""; diff --git a/kiss.c b/kiss.c index 468d32c..b720485 100644 --- a/kiss.c +++ b/kiss.c @@ -1593,7 +1593,7 @@ SeeifMore: // If a response to a qtsm command display it - if (PORT->Session && (time(NULL) - PORT->LastKISSCmdTime < 10)) + if (PORT->Session && (NOW - PORT->LastKISSCmdTime < 10)) { PDATAMESSAGE Buffer; BPQVECSTRUC * VEC; @@ -1666,7 +1666,7 @@ SeeifMore: // If a reply to a manual KISS command(Session set and time not too long ago) // send reponse to terminal - if (PORT->Session && (time(NULL) - PORT->LastKISSCmdTime < 10)) + if (PORT->Session && (NOW - PORT->LastKISSCmdTime < 10)) { PDATAMESSAGE Buffer; BPQVECSTRUC * VEC; @@ -2198,16 +2198,24 @@ int KISSGetTCPMessage(NPASYINFO ASY) { // Bind Failed - int err = WSAGetLastError(); - Consoleprintf("Bind Failed for KISS TCP port %d - error code = %d", ASY->Portvector->ListenPort, err); + if (ASY->Alerted == FALSE) + { + int err = WSAGetLastError(); + Consoleprintf("Bind Failed for KISS TCP port %d - error code = %d", ASY->Portvector->ListenPort, err); + ASY->Alerted = TRUE; + } closesocket(sock); } else { if (listen(sock, 1) < 0) { - int err = WSAGetLastError(); - Consoleprintf("Listen Failed for KISS TCP port %d - error code = %d", ASY->Portvector->ListenPort, err); + if (ASY->Alerted == FALSE) + { + int err = WSAGetLastError(); + Consoleprintf("Listen Failed for KISS TCP port %d - error code = %d", ASY->Portvector->ListenPort, err); + ASY->Alerted = TRUE; + } closesocket(sock); } else diff --git a/mqtt.c b/mqtt.c index a9e91b4..6cc3018 100644 --- a/mqtt.c +++ b/mqtt.c @@ -31,7 +31,7 @@ void MQTTSendStatus() strcpy(payload,"{\"status\":\"online\"}"); MQTTSend(topic, payload, strlen(payload)); - MQTTLastStatus = time(NULL); + MQTTLastStatus = NOW; } void MQTTTimer() @@ -39,7 +39,7 @@ void MQTTTimer() if (MQTT_Connecting == 0 && MQTT_Connected == 0) MQTTConnect(MQTT_HOST, MQTT_PORT, MQTT_USER, MQTT_PASS); - if ((time(NULL) - MQTTLastStatus) > 1800) + if ((NOW - MQTTLastStatus) > 1800) MQTTSendStatus(); } diff --git a/nodeapi.c b/nodeapi.c index 148728b..16d9ef2 100644 --- a/nodeapi.c +++ b/nodeapi.c @@ -246,7 +246,7 @@ Token * generate_token() token->token[i] = 'A' + rand() % 26; // Random uppercase alphabet character } token->token[TOKEN_SIZE] = '\0'; // Null-terminate the token - token->expiration_time = time(NULL) + TOKEN_EXPIRATION; // Set token expiration time + token->expiration_time = NOW + TOKEN_EXPIRATION; // Set token expiration time add_token_to_list(token); return token; } @@ -280,7 +280,7 @@ int verify_token(const char* token) if (existing_token != NULL) { // Check if the token has expired - time_t current_time = time(NULL); + time_t current_time = NOW; if (current_time > existing_token->expiration_time) { // Token has expired, remove it from the token list @@ -297,7 +297,7 @@ int verify_token(const char* token) void remove_expired_tokens() { - time_t current_time = time(NULL); + time_t current_time = NOW; Token* current_token = token_list; Token* prev_token = NULL; Token* next_token; diff --git a/nodelog.txt b/nodelog.txt deleted file mode 100644 index e69de29..0000000 diff --git a/tncinfo.h b/tncinfo.h index 2e2c553..f3a86fc 100644 --- a/tncinfo.h +++ b/tncinfo.h @@ -17,6 +17,10 @@ extern HANDLE hInstance; extern HMENU hMainFrameMenu; extern HMENU hWndMenu; + +void BuildDevicePage(struct TNCINFO * TNC); + + /* struct WL2KInfo { @@ -812,7 +816,13 @@ typedef struct TNCINFO char * WEB_RESTARTS; char * WEB_PACTORLEVEL; char * WEB_LEVELS; - int WEB_CHANGED; // Used to speed up refresh when active + char WEB_CHANGED; // Used to speed up refresh when active + char WebSockUsed; // If not set don't build page + char PageChanged; // Set when page could have changed + + char * WebPage; // Device Web Page. Used for Websocks refresh + int WebPageLen; + HMENU hMenu; HMENU hWndMenu; @@ -863,9 +873,9 @@ typedef struct TNCINFO int NRCloseTimer; struct _LINKTABLE * DummyLink; // Simulated link to simplify interface to ax,25 netrom code struct sixPackPortInfo * sixPack; - int VaraACAllowed; // Set by config - int VaraACMode; // Set by first message received - int VaraModeSet; // Have decicded if VarAC mode or not + char VaraACAllowed; // Set by config + char VaraACMode; // Set by first message received + char VaraModeSet; // Have decicded if VarAC mode or not char * VARACMsg; // to build message from packets int VarACTimer; // delayed send timer size_t VARACSize; // malloc'ed size