summaryrefslogtreecommitdiff
path: root/MULTIPSK.c
diff options
context:
space:
mode:
authorDave Hibberd <hibby@debian.org>2026-09-29 21:39:24 +0100
committerDave Hibberd <hibby@debian.org>2026-09-29 21:39:24 +0100
commit592e5967b8fcd79423802071319d0c646f2080df (patch)
tree0eef3a28cfe1a939caf9d61e419a56d79b3c38e3 /MULTIPSK.c
parent23de03a0c8bf8a564cc0442f49d050ed11e372b8 (diff)
New upstream version 6.0.25.41+repackupstream/6.0.25.41+repack
Diffstat (limited to 'MULTIPSK.c')
-rw-r--r--MULTIPSK.c94
1 files changed, 49 insertions, 45 deletions
diff --git a/MULTIPSK.c b/MULTIPSK.c
index 59e389f..236b81f 100644
--- a/MULTIPSK.c
+++ b/MULTIPSK.c
@@ -195,7 +195,7 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff)
switch (fn)
{
- case 1: // poll
+ case 7: // poll
if (MasterPort[port] == port)
{
@@ -204,7 +204,7 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff)
if (TNC->CONNECTED == FALSE && TNC->CONNECTING == FALSE)
{
// See if time to reconnect
-
+
time( &ltime );
if (ltime-lasttime[port] >9 )
{
@@ -212,12 +212,12 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff)
lasttime[port]=ltime;
}
}
-
+
FD_ZERO(&readfs);
-
+
if (TNC->CONNECTED) FD_SET(TNC->TCPSock,&readfs);
-
+
FD_ZERO(&writefs);
if (TNC->CONNECTING) FD_SET(TNC->TCPSock,&writefs); // Need notification of Connect
@@ -227,7 +227,7 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff)
FD_ZERO(&errorfs);
-
+
if (TNC->CONNECTING ||TNC->CONNECTED) FD_SET(TNC->TCPSock,&errorfs);
if (select((int)TNC->TCPSock+ 1, &readfs, &writefs, &errorfs, &timeout) > 0)
@@ -237,7 +237,7 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff)
if (FD_ISSET(TNC->TCPSock,&readfs))
{
// data available
-
+
ProcessReceivedData(port);
}
@@ -249,47 +249,55 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff)
TNC->CONNECTING = FALSE;
// If required, send signon
-
+
send(TNC->TCPSock,"\x1a", 1, 0);
send(TNC->TCPSock,"DIGITAL MODE ?", 14, 0);
send(TNC->TCPSock,"\x1b", 1, 0);
-// EnumWindows(EnumTNCWindowsProc, (LPARAM)TNC);
+ // EnumWindows(EnumTNCWindowsProc, (LPARAM)TNC);
}
-
+
if (FD_ISSET(TNC->TCPSock,&errorfs))
{
// if connecting, then failed, if connected then has just disconnected
-// if (CONNECTED[port])
-// if (!CONNECTING[port])
-// {
-// i=sprintf(ErrMsg, "MPSK Connection lost for BPQ Port %d\r\n", port);
-// WritetoConsole(ErrMsg);
-// }
+ // if (CONNECTED[port])
+ // if (!CONNECTING[port])
+ // {
+ // i=sprintf(ErrMsg, "MPSK Connection lost for BPQ Port %d\r\n", port);
+ // WritetoConsole(ErrMsg);
+ // }
CONNECTING[port]=FALSE;
CONNECTED[port]=FALSE;
-
+
}
}
}
- // See if any frames for this port
for (Stream = 0; Stream <= TNC->MPSKInfo->MaxSessions; Stream++)
{
STREAM = &TNC->Streams[Stream];
- // Have to time out connects, as TNC doesn't report failure
+ if (STREAM->PACTORtoBPQ_Q == 0)
+ {
+ if (STREAM->DiscWhenAllSent)
+ {
+ STREAM->DiscWhenAllSent--;
+ if (STREAM->DiscWhenAllSent == 0)
+ STREAM->ReportDISC = TRUE; // Dont want to leave session attached. Causes too much confusion
+ }
+ }
+ // Have to time out connects, as TNC doesn't report failure
if (STREAM->Connecting)
{
STREAM->Connecting--;
-
+
if (STREAM->Connecting == 0)
{
// Report Connect Failed, and drop back to command mode
@@ -301,7 +309,7 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff)
buffptr->Len = sprintf(buffptr->Data, "MPSK} Failure with %s\r", STREAM->RemoteCall);
C_Q_ADD(&STREAM->PACTORtoBPQ_Q, buffptr);
}
-
+
STREAM->Connected = FALSE; // Back to Command Mode
STREAM->DiscWhenAllSent = 10;
@@ -310,9 +318,18 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff)
TidyClose(TNC, Stream);
}
}
-
+
if (STREAM->Attached)
CheckForDetach(TNC, Stream, STREAM, TidyClose, ForcedClose, CloseComplete);
+ }
+
+ return 0;
+
+ case 1:
+
+ for (Stream = 0; Stream <= TNC->MPSKInfo->MaxSessions; Stream++)
+ {
+ STREAM = &TNC->Streams[Stream];
if (STREAM->ReportDISC)
{
@@ -322,21 +339,10 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff)
return -1;
}
- // if Busy, send buffer status poll
-
- if (STREAM->PACTORtoBPQ_Q == 0)
- {
- if (STREAM->DiscWhenAllSent)
- {
- STREAM->DiscWhenAllSent--;
- if (STREAM->DiscWhenAllSent == 0)
- STREAM->ReportDISC = TRUE; // Dont want to leave session attached. Causes too much confusion
- }
- }
- else
+ if (STREAM->PACTORtoBPQ_Q)
{
int datalen;
-
+
buffptr = Q_REM(&STREAM->PACTORtoBPQ_Q);
datalen = (int)buffptr->Len;
@@ -348,7 +354,7 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff)
PutLengthinBuffer(buff, datalen);
ReleaseBuffer(buffptr);
-
+
return (1);
}
}
@@ -361,15 +367,13 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff)
buffptr = Q_REM(&TNC->PortRecord->UI_Q);
Sock = TNCInfo[MasterPort[port]]->TCPSock;
-
+
ReleaseBuffer((UINT *)buffptr);
}
-
-
+
return (0);
-
case 2: // send
@@ -503,7 +507,7 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff)
if (buffptr)
{
buffptr->Len = sprintf((UCHAR *)&buffptr->Data[0],
- "MPSK} Error - Call missing from C command\r", STREAM->MyCall, STREAM->RemoteCall);
+ "MPSK} Error - Call missing from C command\r");
C_Q_ADD(&STREAM->PACTORtoBPQ_Q, buffptr);
}
@@ -940,7 +944,7 @@ VOID ConnecttoMPSKThread(void * portptr)
err=WSAGetLastError();
i=sprintf(Msg, "Connect Failed for MPSK socket - error code = %d\n", err);
WritetoConsole(Msg);
- MySetWindowText(TNC->xIDC_COMMSSTATE, "Connection to TNC failed");
+ MySetWindowText(TNC, TNC->xIDC_COMMSSTATE, "Connection to TNC failed");
TNC->Alerted = TRUE;
}
@@ -951,7 +955,7 @@ VOID ConnecttoMPSKThread(void * portptr)
TNC->LastFreq = 0; // so V4 display will be updated
- MySetWindowText(TNC->xIDC_COMMSSTATE, "Connected to MPSK TNC");
+ MySetWindowText(TNC, TNC->xIDC_COMMSSTATE, "Connected to MPSK TNC");
return;
@@ -1387,7 +1391,7 @@ DataLoop:
STREAM->Connected = TRUE;
STREAM->Connecting = FALSE;
- STREAM->ConnectTime = time(NULL);
+ STREAM->ConnectTime = NOW;
STREAM->bytesRXed = STREAM->bytesTXed = 0;
buffptr = GetBuff();
@@ -1402,7 +1406,7 @@ DataLoop:
// Incoming. Look for a free Stream
STREAM->Connected = TRUE;
- STREAM->ConnectTime = time(NULL);
+ STREAM->ConnectTime = NOW;
STREAM->bytesRXed = STREAM->bytesTXed = 0;
UpdateMH(TNC, CallFrom, '+', 'I');