diff options
| author | Dave Hibberd <hibby@debian.org> | 2026-09-29 21:39:24 +0100 |
|---|---|---|
| committer | Dave Hibberd <hibby@debian.org> | 2026-09-29 21:39:24 +0100 |
| commit | 592e5967b8fcd79423802071319d0c646f2080df (patch) | |
| tree | 0eef3a28cfe1a939caf9d61e419a56d79b3c38e3 /V4.c | |
| parent | 23de03a0c8bf8a564cc0442f49d050ed11e372b8 (diff) | |
New upstream version 6.0.25.41+repackupstream/6.0.25.41+repack
Diffstat (limited to 'V4.c')
| -rw-r--r-- | V4.c | 177 |
1 files changed, 91 insertions, 86 deletions
@@ -258,7 +258,7 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff) switch (fn)
{
- case 1: // poll
+ case 7: // poll
while (TNC->PortRecord->UI_Q) // Release anything accidentally put on UI_Q
{
@@ -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);
@@ -373,26 +373,26 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff) }
}
}
-/*
+ /*
if (TNC->UpdateWL2K)
{
- TNC->UpdateWL2KTimer--;
+ TNC->UpdateWL2KTimer--;
- if (TNC->UpdateWL2KTimer == 0)
- {
- TNC->UpdateWL2KTimer = 32910/2; // Every Hour
- if (CheckAppl(TNC, "RMS ")) // Is RMS Available?
- SendReporttoWL2K(TNC);
- }
+ if (TNC->UpdateWL2KTimer == 0)
+ {
+ TNC->UpdateWL2KTimer = 32910/2; // Every Hour
+ if (CheckAppl(TNC, "RMS ")) // Is RMS Available?
+ SendReporttoWL2K(TNC);
}
-*/
+ }
+ */
if (TNC->RIG)
{
if (TNC->RIG->RigFreq != TNC->LastFreq)
{
char FREQMsg[80];
int Len;
-
+
TNC->LastFreq = TNC->RIG->RigFreq;
Len = sprintf(FREQMsg, "DISPLAY CF:%1.4f\r\n", TNC->LastFreq + .0015);
send(TNC->TCPSock,FREQMsg, Len, 0);
@@ -402,27 +402,27 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff) if (TNC->TimeSinceLast++ > 700) // Allow 10 secs for Keepalive
{
// Restart TNC
-
+
if (TNC->ProgramPath)
{
if (strstr(TNC->ProgramPath, "V4 TNC"))
{
struct tm * tm;
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);
@@ -448,7 +448,7 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff) // Stop Listening, and set MYCALL to user's call
-// send(TNC->TCPSock, "LISTEN FALSE\r\n", 14, 0);
+ // send(TNC->TCPSock, "LISTEN FALSE\r\n", 14, 0);
ChangeMYC(TNC, TNC->Streams[0].MyCall);
// Stop other ports in same group
@@ -456,13 +456,13 @@ 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
sprintf(Msg, "%d SCANSTOP", TNC->Port);
-
+
Rig_Command( (TRANSPORTENTRY *) -1, Msg);
}
@@ -470,70 +470,75 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff) if (TNC->Streams[0].Attached)
CheckForDetach(TNC, 0, &TNC->Streams[0], TidyClose, ForcedClose, CloseComplete);
- if (TNC->Streams[0].ReportDISC)
+
+ if (TNC->CONNECTED == FALSE && TNC->CONNECTING == FALSE)
{
- TNC->Streams[0].ReportDISC = FALSE;
- buff->PORT = 0;
- return -1;
- }
+ // See if time to reconnect
- if (TNC->CONNECTED == FALSE && TNC->CONNECTING == FALSE)
+ time(<ime);
+ if (ltime - TNC->lasttime >9 )
{
- // See if time to reconnect
-
- time(<ime);
- if (ltime - TNC->lasttime >9 )
- {
- TNC->LastFreq = 0; // so display will be updated
- ConnecttoWINMOR(port);
- TNC->lasttime = ltime;
- }
+ TNC->LastFreq = 0; // so display will be updated
+ ConnecttoWINMOR(port);
+ TNC->lasttime = ltime;
}
-
- FD_ZERO(&readfs);
-
- if (TNC->CONNECTED) FD_SET(TNC->TCPDataSock,&readfs);
-
- FD_ZERO(&writefs);
+ }
- if (TNC->BPQtoWINMOR_Q) FD_SET(TNC->TCPDataSock,&writefs); // Need notification of busy clearing
+ FD_ZERO(&readfs);
- FD_ZERO(&errorfs);
-
- if (TNC->CONNECTING || TNC->CONNECTED) FD_SET(TNC->TCPDataSock,&errorfs);
+ if (TNC->CONNECTED) FD_SET(TNC->TCPDataSock,&readfs);
+
+ FD_ZERO(&writefs);
+
+ if (TNC->BPQtoWINMOR_Q) FD_SET(TNC->TCPDataSock,&writefs); // Need notification of busy clearing
+
+ FD_ZERO(&errorfs);
+
+ if (TNC->CONNECTING || TNC->CONNECTED) FD_SET(TNC->TCPDataSock,&errorfs);
+
+ if (select((int)TNC->TCPSock + 1, &readfs, &writefs, &errorfs, &timeout) > 0)
+ {
+ // See what happened
+
+ if (readfs.fd_count == 1)
+ V4ProcessDataSocketData(port);
- if (select((int)TNC->TCPSock + 1, &readfs, &writefs, &errorfs, &timeout) > 0)
+ if (writefs.fd_count == 1)
{
- // See what happened
+ // Write block has cleared. Send rest of packet
- if (readfs.fd_count == 1)
- V4ProcessDataSocketData(port);
-
- if (writefs.fd_count == 1)
- {
- // Write block has cleared. Send rest of packet
+ buffptr=Q_REM(&TNC->BPQtoWINMOR_Q);
+ txlen = (unsigned int)buffptr->Len;
- buffptr=Q_REM(&TNC->BPQtoWINMOR_Q);
- txlen = (unsigned int)buffptr->Len;
+ memcpy(txbuff,buffptr->Data, txlen);
+ bytes=send(TNC->TCPSock,(const char FAR *)&txbuff,txlen,0);
+ ReleaseBuffer(buffptr);
+ }
- memcpy(txbuff,buffptr->Data, txlen);
- bytes=send(TNC->TCPSock,(const char FAR *)&txbuff,txlen,0);
- ReleaseBuffer(buffptr);
- }
-
- if (errorfs.fd_count == 1)
- {
- i=sprintf(ErrMsg, "V4 Data Connection lost for BPQ Port %d\n", port);
- WritetoConsole(ErrMsg);
- TNC->CONNECTING = FALSE;
- TNC->CONNECTED = FALSE;
- TNC->Streams[0].ReportDISC = TRUE;
- }
+ if (errorfs.fd_count == 1)
+ {
+ i=sprintf(ErrMsg, "V4 Data Connection lost for BPQ Port %d\n", port);
+ WritetoConsole(ErrMsg);
+ TNC->CONNECTING = FALSE;
+ TNC->CONNECTED = FALSE;
+ TNC->Streams[0].ReportDISC = TRUE;
}
-
+ }
+
+ return 0;
+
+ case 1:
+
+ if (TNC->Streams[0].ReportDISC)
+ {
+ TNC->Streams[0].ReportDISC = FALSE;
+ buff->PORT = 0;
+ return -1;
+ }
+
// See if any frames for this port
- if (TNC->WINMORtoBPQ_Q != 0)
+ if (TNC->WINMORtoBPQ_Q)
{
buffptr = Q_REM(&TNC->WINMORtoBPQ_Q);
@@ -657,7 +662,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 +705,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 +841,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 +915,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 +926,7 @@ static VOID ReleaseTNC(struct TNCINFO * TNC) static int WebProc(struct TNCINFO * TNC, char * Buff, BOOL LOCAL)
{
- int Len = sprintf(Buff, "<html><meta http-equiv=expires content=0><meta http-equiv=refresh content=15>"
+ int Len = sprintf(Buff, "<html>"
"<script type=\"text/javascript\">\r\n"
"function ScrollOutput()\r\n"
"{var textarea = document.getElementById('textarea');"
@@ -1115,7 +1120,7 @@ void * V4ExtInit(EXTPORTDATA * PortEntry) WritetoConsole(Msg);
strcpy(TNC->WEB_MODE, "ARQ");
- MySetWindowText(TNC->xIDC_MODE, TNC->WEB_MODE);
+ MySetWindowText(TNC, TNC->xIDC_MODE, TNC->WEB_MODE);
ConnecttoWINMOR(port);
time(&TNC->lasttime); // Get initial time value
@@ -1147,7 +1152,7 @@ static BOOL CALLBACK EnumTNCWindowsProc(HWND hwnd, LPARAM lParam) // Our Process
sprintf (wtext, "V4 Sound Card TNC - BPQ %s", TNC->PortRecord->PORTCONTROL.PORTDESCRIPTION);
- MySetWindowText(hwnd, wtext);
+ MySetWindowText(TNC, hwnd, wtext);
// return FALSE;
}
}
@@ -1197,7 +1202,7 @@ static VOID ProcessResponse(struct TNCINFO * TNC, UCHAR * Buffer, int MsgLen) if (_memicmp(Buffer, "BUSY TRUE", 9) == 0)
{
TNC->Busy |= CDBusy;
- MySetWindowText(TNC->xIDC_CHANSTATE, "Busy");
+ MySetWindowText(TNC, TNC->xIDC_CHANSTATE, "Busy");
strcpy(TNC->WEB_CHANSTATE, "Busy");
return;
@@ -1206,7 +1211,7 @@ static VOID ProcessResponse(struct TNCINFO * TNC, UCHAR * Buffer, int MsgLen) if (_memicmp(Buffer, "BUSY FALSE", 10) == 0)
{
TNC->Busy &= ~CDBusy;
- MySetWindowText(TNC->xIDC_CHANSTATE, "Clear");
+ MySetWindowText(TNC, TNC->xIDC_CHANSTATE, "Clear");
strcpy(TNC->WEB_CHANSTATE, "Clear");
return;
}
@@ -1229,7 +1234,7 @@ static VOID ProcessResponse(struct TNCINFO * TNC, UCHAR * Buffer, int MsgLen) WritetoTrace(TNC, Buffer, MsgLen - 2);
- STREAM->ConnectTime = time(NULL);
+ STREAM->ConnectTime = NOW;
memcpy(Call, &Buffer[10], 10);
@@ -1254,7 +1259,7 @@ static VOID ProcessResponse(struct TNCINFO * TNC, UCHAR * Buffer, int MsgLen) else
sprintf(Status, "%s Connected to %s Inbound", TNC->Streams[0].RemoteCall, TNC->TargetCall);
- MySetWindowText(TNC->xIDC_TNCSTATE, Status);
+ MySetWindowText(TNC, TNC->xIDC_TNCSTATE, Status);
strcpy(TNC->WEB_TNCSTATE, Status);
// See which application the connect is for
@@ -1343,7 +1348,7 @@ static VOID ProcessResponse(struct TNCINFO * TNC, UCHAR * Buffer, int MsgLen) else
sprintf(Status, "%s Connected to %s Outbound", TNC->Streams[0].MyCall, TNC->Streams[0].RemoteCall);
- MySetWindowText(TNC->xIDC_TNCSTATE, Status);
+ MySetWindowText(TNC, TNC->xIDC_TNCSTATE, Status);
strcpy(TNC->WEB_TNCSTATE, Status);
UpdateMH(TNC, Call, '+', 'O');
@@ -1377,7 +1382,7 @@ static VOID ProcessResponse(struct TNCINFO * TNC, UCHAR * Buffer, int MsgLen) C_Q_ADD(&TNC->WINMORtoBPQ_Q, buffptr);
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);
return;
@@ -1463,7 +1468,7 @@ static VOID ProcessResponse(struct TNCINFO * TNC, UCHAR * Buffer, int MsgLen) }
}
- MySetWindowText(TNC->xIDC_TRAFFIC, &Buffer[7]);
+ MySetWindowText(TNC, TNC->xIDC_TRAFFIC, &Buffer[7]);
strcpy(TNC->WEB_TRAFFIC, &Buffer[7]);
return;
@@ -1760,6 +1765,6 @@ VOID CloseComplete(struct TNCINFO * TNC, int Stream) TNC->FECMode = FALSE;
send(TNC->TCPSock,"MODE ARQ\r\n", 10, 0);
strcpy(TNC->WEB_MODE, "ARQ");
- MySetWindowText(TNC->xIDC_MODE, TNC->WEB_MODE);
+ MySetWindowText(TNC, TNC->xIDC_MODE, TNC->WEB_MODE);
}
}
|
