master
g8bpq 1 month ago
parent be1400c702
commit 1ac3d4ab3d

@ -907,105 +907,107 @@ ok:
switch (fn)
{
case 7:
case 1:
// 100 mS Timer. May now be needed, as Poll can be called more frequently in some circumstances
// 10 mS CheckRX and fast poll
SerialCheckRX(TNC);
return 0;
// See if any frames for this port
case 1: // poll
STREAM = &TNC->Streams[0];
STREAM = &TNC->Streams[0];
if (STREAM->BPQtoPACTOR_Q)
{
PMSGWITHLEN buffptr = (PMSGWITHLEN)Q_REM(&STREAM->BPQtoPACTOR_Q);
UCHAR * data = &buffptr->Data[0];
STREAM->FramesQueued--;
txlen = (int)buffptr->Len;
STREAM->bytesTXed += txlen;
bytes=SerialSendData(TNC, data, txlen);
WritetoTrace(TNC, data, txlen);
}
if (STREAM->NeedDisc)
{
STREAM->NeedDisc--;
if (STREAM->PACTORtoBPQ_Q != 0)
{
buffptr = (PMSGWITHLEN)Q_REM(&STREAM->PACTORtoBPQ_Q);
if (STREAM->NeedDisc == 0)
{
// Send the DISCONNECT
datalen = (int)buffptr->Len;
SerialSendCommand(TNC, "DISCONNECT\r");
}
}
buff->PORT = Stream; // Compatibility with Kam Driver
buff->PID = 0xf0;
memcpy(&buff->L2DATA, &buffptr->Data[0], datalen); // Data goes to + 7, but we have an extra byte
datalen += sizeof(void *) + 4;
if (TNC->PortRecord->ATTACHEDSESSIONS[Stream] && STREAM->Attached == 0)
{
// New Attach
PutLengthinBuffer(buff, datalen);
ReleaseBuffer(buffptr);
return (1);
}
int calllen;
char Msg[80];
if (STREAM->ReportDISC) // May need a delay so treat as a counter
{
STREAM->ReportDISC--;
STREAM->Attached = TRUE;
if (STREAM->ReportDISC == 0)
{
buff->PORT = Stream;
return -1;
}
}
calllen = ConvFromAX25(TNC->PortRecord->ATTACHEDSESSIONS[Stream]->L4USER, TNC->Streams[Stream].MyCall);
TNC->Streams[Stream].MyCall[calllen] = 0;
return (0);
// Stop other ports in same group
case 7: // poll
SuspendOtherPorts(TNC);
SerialCheckRX(TNC);
sprintf(TNC->WEB_TNCSTATE, "In Use by %s", TNC->Streams[0].MyCall);
MySetWindowText(TNC, TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
STREAM = &TNC->Streams[0];
// Stop Scanning
if (STREAM->NeedDisc)
{
STREAM->NeedDisc--;
sprintf(Msg, "%d SCANSTOP", TNC->Port);
if (STREAM->NeedDisc == 0)
{
// Send the DISCONNECT
Rig_Command( (TRANSPORTENTRY *) -1, Msg);
SerialSendCommand(TNC, "DISCONNECT\r");
}
}
if (STREAM->Attached)
CheckForDetach(TNC, Stream, STREAM, TidyClose, ForcedClose, CloseComplete);
if (TNC->PortRecord->ATTACHEDSESSIONS[Stream] && STREAM->Attached == 0)
{
// New Attach
// See if any frames for this port
int calllen;
char Msg[80];
STREAM = &TNC->Streams[0];
STREAM->Attached = TRUE;
if (STREAM->BPQtoPACTOR_Q)
{
PMSGWITHLEN buffptr = (PMSGWITHLEN)Q_REM(&STREAM->BPQtoPACTOR_Q);
UCHAR * data = &buffptr->Data[0];
STREAM->FramesQueued--;
txlen = (int)buffptr->Len;
STREAM->bytesTXed += txlen;
bytes=SerialSendData(TNC, data, txlen);
WritetoTrace(TNC, data, txlen);
}
calllen = ConvFromAX25(TNC->PortRecord->ATTACHEDSESSIONS[Stream]->L4USER, TNC->Streams[Stream].MyCall);
TNC->Streams[Stream].MyCall[calllen] = 0;
if (STREAM->PACTORtoBPQ_Q != 0)
{
buffptr = (PMSGWITHLEN)Q_REM(&STREAM->PACTORtoBPQ_Q);
datalen = (int)buffptr->Len;
// Stop other ports in same group
buff->PORT = Stream; // Compatibility with Kam Driver
buff->PID = 0xf0;
memcpy(&buff->L2DATA, &buffptr->Data[0], datalen); // Data goes to + 7, but we have an extra byte
datalen += sizeof(void *) + 4;
SuspendOtherPorts(TNC);
PutLengthinBuffer(buff, datalen);
sprintf(TNC->WEB_TNCSTATE, "In Use by %s", TNC->Streams[0].MyCall);
MySetWindowText(TNC, TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
ReleaseBuffer(buffptr);
// Stop Scanning
return (1);
}
sprintf(Msg, "%d SCANSTOP", TNC->Port);
if (STREAM->ReportDISC) // May need a delay so treat as a counter
{
STREAM->ReportDISC--;
Rig_Command( (TRANSPORTENTRY *) -1, Msg);
}
if (STREAM->ReportDISC == 0)
{
buff->PORT = Stream;
return -1;
}
}
if (STREAM->Attached)
CheckForDetach(TNC, Stream, STREAM, TidyClose, ForcedClose, CloseComplete);
return (0);
return 0;
case 2: // send

@ -914,127 +914,24 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff)
}
}
if (TNC->ARDOPCommsMode != 'T') // S I or E
{
ARDOPSCSCheckRX(TNC);
ARDOPSCSPoll(TNC);
}
return 0;
case 1: // poll
// If not using serial interface, Rig Contol Frames are sent as
// ARDOP Command Frames. These are hex encoded
if (TNC->ARDOPCommsMode == 'T' && TNC->BPQtoRadio_Q)
if (TNC->CONNECTED == FALSE && TNC->CONNECTING == FALSE)
{
PMSGWITHLEN buffptr;
buffptr = (PMSGWITHLEN)Q_REM(&TNC->BPQtoRadio_Q);
// See if time to reconnect
if (TNC->CONNECTED)
time(&ltime);
if (ltime - TNC->lasttime > 9 )
{
int len = (int)buffptr->Len;
UCHAR * ptr = &buffptr->Data[0];
char RigCommand[256] = "RADIOHEX ";
char * ptr2 = &RigCommand[9] ;
int i, j;
if (len < 120)
{
while (len--)
{
i = *(ptr++);
j = i >>4;
j += '0'; // ascii
if (j > '9')
j += 7;
*(ptr2++) = j;
j = i & 0xf;
j += '0'; // ascii
if (j > '9')
j += 7;
*(ptr2++) = j;
}
ARDOPSendCommand(TNC, RigCommand, FALSE);
}
if (TNC->ARDOPCommsMode == 'T' && TNC->PortRecord->PORTCONTROL.PortStopped == 0)
ConnecttoARDOP(TNC);
TNC->lasttime = ltime;
}
ReleaseBuffer(buffptr);
}
while (TNC->PortRecord->UI_Q)
{
int datalen;
char * Buffer;
char FECMsg[512];
char Call[12] = " ";
struct _MESSAGE * buffptr;
int CallLen;
char * ptr = FECMsg;
buffptr = Q_REM(&TNC->PortRecord->UI_Q);
if (TNC->CONNECTED == 0 ||
TNC->Streams[0].Connecting ||
TNC->Streams[0].Connected)
{
// discard if TNC not connected or session active
ReleaseBuffer(buffptr);
continue;
}
datalen = buffptr->LENGTH - MSGHDDRLEN;
Buffer = &buffptr->DEST[0]; // Raw Frame
Buffer[datalen] = 0;
*ptr++ = '^'; // delimit frame with ^
// Frame has ax.25 format header. Convert to Text
CallLen = ConvFromAX25(Buffer + 7, Call); // Origin
memcpy(ptr, Call, CallLen);
ptr += CallLen;
*ptr++ = '>';
CallLen = ConvFromAX25(Buffer, Call); // Dest
memcpy(ptr, Call, CallLen);
ptr += CallLen;
Buffer += 14; // TO Digis
datalen -= 14;
while ((Buffer[-1] & 1) == 0)
{
*ptr++ = ',';
CallLen = ConvFromAX25(Buffer, Call);
memcpy(ptr, Call, CallLen);
ptr += CallLen;
Buffer += 7; // End of addr
datalen -= 7;
}
*ptr++ = '|'; // delimit calls
if (Buffer[0] == 3) // UI
{
Buffer += 2;
datalen -= 2;
}
memcpy(ptr, Buffer, datalen);
ptr += datalen;
*ptr++ = '^'; // delimit frame with ^
ARDOPSendData(TNC, FECMsg, (int)(ptr - FECMsg));
TNC->FECPending = 1;
ReleaseBuffer((UINT *)buffptr);
if (TNC->ARDOPCommsMode != 'T') // S I or E
{
ARDOPSCSCheckRX(TNC);
ARDOPSCSPoll(TNC);
}
if (TNC->Busy) // Count down to clear
@ -1264,26 +1161,129 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff)
}
}
if (STREAM->Attached)
CheckForDetach(TNC, Stream, STREAM, TidyClose, ForcedClose, CloseComplete);
}
if (TNC->CONNECTED == FALSE && TNC->CONNECTING == FALSE)
return 0;
case 1: // poll. Called around every 10 mS
// If not using serial interface, Rig Contol Frames are sent as
// ARDOP Command Frames. These are hex encoded
if (TNC->ARDOPCommsMode == 'T' && TNC->BPQtoRadio_Q)
{
// See if time to reconnect
PMSGWITHLEN buffptr;
buffptr = (PMSGWITHLEN)Q_REM(&TNC->BPQtoRadio_Q);
time(&ltime);
if (ltime - TNC->lasttime > 9 )
if (TNC->CONNECTED)
{
if (TNC->ARDOPCommsMode == 'T' && TNC->PortRecord->PORTCONTROL.PortStopped == 0)
ConnecttoARDOP(TNC);
TNC->lasttime = ltime;
int len = (int)buffptr->Len;
UCHAR * ptr = &buffptr->Data[0];
char RigCommand[256] = "RADIOHEX ";
char * ptr2 = &RigCommand[9] ;
int i, j;
if (len < 120)
{
while (len--)
{
i = *(ptr++);
j = i >>4;
j += '0'; // ascii
if (j > '9')
j += 7;
*(ptr2++) = j;
j = i & 0xf;
j += '0'; // ascii
if (j > '9')
j += 7;
*(ptr2++) = j;
}
ARDOPSendCommand(TNC, RigCommand, FALSE);
}
}
ReleaseBuffer(buffptr);
}
while (TNC->PortRecord->UI_Q)
{
int datalen;
char * Buffer;
char FECMsg[512];
char Call[12] = " ";
struct _MESSAGE * buffptr;
int CallLen;
char * ptr = FECMsg;
buffptr = Q_REM(&TNC->PortRecord->UI_Q);
if (TNC->CONNECTED == 0 ||
TNC->Streams[0].Connecting ||
TNC->Streams[0].Connected)
{
// discard if TNC not connected or session active
ReleaseBuffer(buffptr);
continue;
}
datalen = buffptr->LENGTH - MSGHDDRLEN;
Buffer = &buffptr->DEST[0]; // Raw Frame
Buffer[datalen] = 0;
*ptr++ = '^'; // delimit frame with ^
// Frame has ax.25 format header. Convert to Text
CallLen = ConvFromAX25(Buffer + 7, Call); // Origin
memcpy(ptr, Call, CallLen);
ptr += CallLen;
*ptr++ = '>';
CallLen = ConvFromAX25(Buffer, Call); // Dest
memcpy(ptr, Call, CallLen);
ptr += CallLen;
Buffer += 14; // TO Digis
datalen -= 14;
while ((Buffer[-1] & 1) == 0)
{
*ptr++ = ',';
CallLen = ConvFromAX25(Buffer, Call);
memcpy(ptr, Call, CallLen);
ptr += CallLen;
Buffer += 7; // End of addr
datalen -= 7;
}
*ptr++ = '|'; // delimit calls
if (Buffer[0] == 3) // UI
{
Buffer += 2;
datalen -= 2;
}
memcpy(ptr, Buffer, datalen);
ptr += datalen;
*ptr++ = '^'; // delimit frame with ^
ARDOPSendData(TNC, FECMsg, (int)(ptr - FECMsg));
TNC->FECPending = 1;
ReleaseBuffer((UINT *)buffptr);
}
// See if any frames for this port
for (Stream = 0; Stream <= APMaxStreams; Stream++)

@ -1761,6 +1761,12 @@ VOID SaveBIDDatabase()
Handle = fopen(BIDDatabasePath, "wb");
if (Handle == NULL)
{
Debugprintf("BPQMAIL can't open BID database (WFBID.SYS) for write");
return;
}
BIDRecPtr[0]->u.msgno = NumberofBIDs; // First Record has file size
for (i=0; i <= NumberofBIDs; i++)
@ -11272,6 +11278,32 @@ int DoReceivedData(int Stream)
if (conn->InputMode == 'P') // Inside PG Server
{
user = conn->UserPointer;
// check for paging
if (conn->Paging && (conn->LinesSent >= conn->PageLen))
{
// Waiting for paging prompt
if (conn->InputLen > 1)
{
if (_memicmp(conn->InputBuffer, "Abort", 1) == 0)
{
ClearQueue(conn);
conn->LinesSent = 0;
nodeprintf(conn, AbortedMsg);
conn->InputMode = 0;
conn->InputLen = 0;
SendPrompt(conn, user);
return 0;
}
}
conn->InputLen = 0;
conn->LinesSent = 0;
return 0;
}
run_pg(conn, user);
return 0;
}
@ -12073,14 +12105,12 @@ void run_pg(CIRCUIT * conn, struct UserInfo * user)
iop = NULL;
printf("Len %d %x %x %x\n", conn->InputLen, conn->InputBuffer[0], conn->InputBuffer[1], conn->InputBuffer[2]);
conn->InputBuffer[conn->InputLen] = 0;
strlop(conn->InputBuffer, 13);
// validate command is alphanumberic
for (i = 0; i < conn->InputLen; i++)
for (i = 0; i < strlen(conn->InputBuffer); i++)
{
if (isalnum(conn->InputBuffer[i]) == 0 && conn->InputBuffer[i] != ' ')
{

Binary file not shown.

Binary file not shown.

@ -45,7 +45,7 @@ int PositiveDelay = 300;
time_t SENDRIFTIME = 0;
int RIFInterval = 3600;
VOID SendNegativeInfo();
VOID SendNegativeInfo(int sendAlways);
VOID SortRoutes(struct DEST_LIST * Dest);
VOID SendRTTMsg(struct ROUTE * Route);
VOID TCPNETROMSend(struct ROUTE * Route, struct _L3MESSAGEBUFFER * Frame);
@ -175,6 +175,8 @@ VOID DeleteINP3Routes(struct ROUTE * Route)
struct DEST_LIST * Dest = DESTS;
char Call1[10];
char Call2[10];
int deletingFirstRoute = 0;
Call1[ConvFromAX25(Route->NEIGHBOUR_CALL, Call1)] = 0;
@ -217,10 +219,26 @@ VOID DeleteINP3Routes(struct ROUTE * Route)
if (DEBUGINP3) Debugprintf("Deleting First INP3 Route to %s", Call2);
Dest->INP3ROUTE[0].STT = 60000; // leave hops so we can check if we need to send
// Need to make sure it is sent by setting by sendnegative info by setting sendAlways below
deletingFirstRoute = 1;
// I don't think this is right. If it is the only route send 60000 to other neighbours but if there are more
// promote them and send the new best, making sure it is sent even if a small change.
if (DEBUGINP3) Debugprintf("Was the only INP3 route");
if (Dest->INP3ROUTE[1].ROUT_NEIGHBOUR == 0) // No other INP3 routes
{
if (DEBUGINP3) Debugprintf("Was the only INP3 route");
Dest->INP3ROUTE[0].STT = 60000; // leave hops so we can check if we need to send
}
else
{
memcpy(&Dest->INP3ROUTE[0], &Dest->INP3ROUTE[1], sizeof(struct INP3_DEST_ROUTE_ENTRY));
memcpy(&Dest->INP3ROUTE[1], &Dest->INP3ROUTE[2], sizeof(struct INP3_DEST_ROUTE_ENTRY));
memset(&Dest->INP3ROUTE[2], 0, sizeof(struct INP3_DEST_ROUTE_ENTRY));
}
if (Dest->DEST_ROUTE == 4) // we were using it
Dest->DEST_ROUTE = 0;
@ -248,8 +266,11 @@ VOID DeleteINP3Routes(struct ROUTE * Route)
// I think we should send Negative info immediately
NegTimerCount = NegativeDelay;
SendNegativeInfo();
if (deletingFirstRoute)
{
NegTimerCount = NegativeDelay;
SendNegativeInfo(TRUE); // TRUE means always send even if little change
}
}
VOID DecayNETROMRoutes(struct ROUTE * Route)
@ -1541,7 +1562,7 @@ VOID SendRIF(struct ROUTE * Route, struct _L3MESSAGEBUFFER * Msg)
SendNetFrame(Route, Msg);
}
VOID SendRIFToOtherNeighbours(struct DEST_LIST * Dest, UCHAR * alias, struct INP3_DEST_ROUTE_ENTRY * Entry, int Negative, int portNum, int includeOptions)
VOID SendRIFToOtherNeighbours(struct DEST_LIST * Dest, UCHAR * alias, struct INP3_DEST_ROUTE_ENTRY * Entry, int Negative, int portNum, int includeOptions, int sendAlways)
{
UCHAR * axcall = Dest->DEST_CALL;
struct ROUTE * Routes = NEIGHBOURS;
@ -1575,35 +1596,40 @@ VOID SendRIFToOtherNeighbours(struct DEST_LIST * Dest, UCHAR * alias, struct INP
{
// as we can now get very short times need to enforce absolute change as well as percentage
diff = sendTT - lastTT;
if (diff < 0)
diff = -diff;
if (diff < 3) // need more than 20 ms change
if (sendAlways == FALSE)
{
Routes+=1;
continue;
}
// Send if sufficient change
if (Negative)
{
// only send if significantly worse
diff = sendTT - lastTT;
if (diff < 0)
diff = -diff;
if (sendTT < (lastTT * NegativePercent) / 100)
if (diff < 3) // need more than 20 ms change
{
Routes+=1;
continue;
}
}
else
{
// Send if significantly better
}
if (sendTT > (lastTT * PositivePercent) / 100)
if (Negative)
{
Routes+=1;
continue;
// only send if significantly worse
if (sendTT < (lastTT * NegativePercent) / 100)
{
Routes+=1;
continue;
}
}
else
{
// Send if significantly better
if (sendTT > (lastTT * PositivePercent) / 100)
{
Routes+=1;
continue;
}
}
}
@ -1789,7 +1815,7 @@ VOID FlushRIFs()
}
}
VOID SendNegativeInfo()
VOID SendNegativeInfo(int sendAlways)
{
int i;
struct DEST_LIST * Dest = DESTS;
@ -1818,7 +1844,7 @@ VOID SendNegativeInfo()
if (Entry->ROUT_NEIGHBOUR == 0)
continue;
SendRIFToOtherNeighbours(Dest, Dest->DEST_ALIAS, Entry, TRUE, FALSE, FALSE);
SendRIFToOtherNeighbours(Dest, 0, Entry, TRUE, FALSE, FALSE, sendAlways);
if (Entry->STT >= 60000)
{
@ -1828,6 +1854,9 @@ VOID SendNegativeInfo()
// I think I need to set lastTT on all routes.
// This should now only happen if there are no more routes but leave oode here in case needed again
if (Dest->INP3ROUTE[1].ROUT_NEIGHBOUR == 0) // No other INP3 routes
{
if (DEBUGINP3) Debugprintf("Was the only INP3 route");
@ -1875,7 +1904,7 @@ VOID SendPositiveInfo()
Entry = &Dest->INP3ROUTE[0];
if (Entry->ROUT_NEIGHBOUR)
SendRIFToOtherNeighbours(Dest, Dest->DEST_ALIAS, Entry, FALSE, FALSE, FALSE);
SendRIFToOtherNeighbours(Dest, 0, Entry, FALSE, FALSE, FALSE, FALSE);
}
}
@ -1902,7 +1931,7 @@ VOID SendNewInfo()
Entry = &Dest->INP3ROUTE[0];
SendRIFToOtherNeighbours(Dest, Dest->DEST_ALIAS, Entry, TRUE, FALSE, TRUE); // Send as negative so will always be worse than zero
SendRIFToOtherNeighbours(Dest, Dest->DEST_ALIAS, Entry, TRUE, FALSE, TRUE, TRUE); // Send as negative with sendAlways set so will always be sent
}
}
}
@ -2155,7 +2184,7 @@ VOID INP3TIMER()
if (NegTimerCount == 0)
{
NegTimerCount = NegativeDelay;
SendNegativeInfo();
SendNegativeInfo(FALSE); // only if significant change
}
else
NegTimerCount--;

@ -1165,6 +1165,9 @@
// Fix mail api returning garbage when deflate isn't requested (27)
// Fix PG command processing on 64 bit Linux (31)
// Limit L command output for new users (32)
// Allow lower case SMTP/POP3 commands (39)
// Fix Webmail Send Reply with SMTP server messages (39)
// Fix paging in PG server (39)
#include "bpqmail.h"

@ -1336,6 +1336,10 @@ along with LinBPQ/BPQ32. If not, see http://www.gnu.org/licenses
// Change Web Driver windows to use Winsocks to give quicker refresh when changed (35)
// Fix timer problem introduced in v33 (36)
// Add LOCALNOTSECURE config param to require signin for web access from 127.0.0.1 (36)
// Convert Web Terminal to winsocks (37)
// More fixes for timer problem introduced in v33 (38)
// Changes to INP3 poison reverse and alias reporting (39)
// L4 Connect Ack now sent via routing table (39)
#define CKernel

@ -1565,6 +1565,42 @@ DllExport int APIENTRY SessionState(int stream, int * state, int * change)
return 0;
}
int SessionStateNoSem(int stream, int * state, int * change)
{
// Get current Session State. Any state changed is ACK'ed
// automatically. See BPQHOST functions 4 and 5.
BPQVECSTRUC * HOST = &BPQHOSTVECTOR[stream -1]; // API counts from 1
Check_Timer(); // In case Appl doesnt call it often ehough
// CX = 0 if stream disconnected or CX = 1 if stream connected
// DX = 0 if no change of state since last read, or DX = 1 if
// the connected/disconnected state has changed since
// last read (ie. delta-stream status).
// HOSTFLAGS = Bit 80 = Allocated
// Bit 40 = Disc Request
// Bit 20 = Stay Flag
// Bit 02 and 01 State Change Bits
if ((HOST->HOSTFLAGS & 3) == 0)
// No Chaange
*change = 0;
else
*change = 1;
if (HOST->HOSTSESSION) // LOCAL SESSION
// Connected
*state = 1;
else
*state = 0;
HOST->HOSTFLAGS &= 0xFC; // Clear Change Bitd
return 0;
}
DllExport int APIENTRY SessionStateNoAck(int stream, int * state)
{
// Get current Session State. Dont ACK any change

@ -224,7 +224,7 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff)
// 100 mS Timer.
// G7TAJ's code to record activity for stats display
if ( TNC->BusyFlags && CDBusy )
TNC->PortRecord->PORTCONTROL.ACTIVE += 2;
@ -246,7 +246,7 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff)
char Reply[80];
SendLen = sprintf(Reply, "c%s:42 %s:24 %c 7 T60R5W10",
STREAM->MyCall, STREAM->RemoteCall, ARQ->OurStream);
STREAM->MyCall, STREAM->RemoteCall, ARQ->OurStream);
strcpy(TNC->WEB_PROTOSTATE, "Connecting");
SetWindowText(TNC->xIDC_PROTOSTATE, TNC->WEB_PROTOSTATE);
@ -317,106 +317,143 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff)
TNC->SlowTimer = 100;
FLSlowTimer(TNC); // 10 Secs
}
return 0;
case 1: // poll
if (TNC->CONNECTED == FALSE && TNC->CONNECTING == FALSE && TNC->FLInfo->KISSMODE == FALSE)
{
// See if time to reconnect
if (TNC->CONNECTED == FALSE && TNC->CONNECTING == FALSE && TNC->FLInfo->KISSMODE == FALSE)
time( &ltime );
if (ltime-lasttime[port] >9 )
{
// See if time to reconnect
time( &ltime );
if (ltime-lasttime[port] >9 )
{
ConnecttoFLDigi(port);
lasttime[port]=ltime;
}
ConnecttoFLDigi(port);
lasttime[port]=ltime;
}
}
pollloop:
FD_ZERO(&readfs);
if (TNC->CONNECTED)
if (TNC->TCPSock)
FD_SET(TNC->TCPSock,&readfs);
FD_ZERO(&readfs);
if (TNC->CONNECTED || TNC->FLInfo->KISSMODE)
FD_SET(TNC->TCPDataSock,&readfs);
// FD_ZERO(&writefs);
if (TNC->CONNECTED)
if (TNC->TCPSock)
FD_SET(TNC->TCPSock,&readfs);
// if (TNC->BPQtoWINMOR_Q) FD_SET(TNC->TCPDataSock,&writefs); // Need notification of busy clearing
if (TNC->CONNECTED || TNC->FLInfo->KISSMODE)
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->CONNECTED)
if (TNC->TCPSock)
FD_SET(TNC->TCPSock,&errorfs);
if (TNC->CONNECTED || TNC->FLInfo->KISSMODE)
FD_SET(TNC->TCPDataSock,&errorfs);
FD_ZERO(&errorfs);
if (TNC->CONNECTED)
if (TNC->TCPSock)
FD_SET(TNC->TCPSock,&errorfs);
if (TNC->CONNECTED || TNC->FLInfo->KISSMODE)
FD_SET(TNC->TCPDataSock,&errorfs);
if (select((int)TNC->TCPDataSock + 1, &readfs, &writefs, &errorfs, &timeout) > 0)
if (select((int)TNC->TCPDataSock + 1, &readfs, &writefs, &errorfs, &timeout) > 0)
{
// See what happened
if (FD_ISSET(TNC->TCPDataSock,&readfs))
{
// See what happened
// data available
if (FD_ISSET(TNC->TCPDataSock,&readfs))
{
// data available
ProcessReceivedData(port);
goto pollloop;
}
ProcessReceivedData(port);
goto pollloop;
}
if (FD_ISSET(TNC->TCPSock,&readfs))
{
// data available
ProcessXMLData(port);
}
if (FD_ISSET(TNC->TCPSock,&readfs))
{
// data available
ProcessXMLData(port);
}
if (FD_ISSET(TNC->TCPDataSock,&writefs))
{
// Connect success
TNC->CONNECTED = TRUE;
TNC->CONNECTING = FALSE;
if (FD_ISSET(TNC->TCPDataSock,&writefs))
{
// Connect success
sprintf(TNC->WEB_COMMSSTATE, "Connected to FLDIGI");
SetWindowText(TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE);
TNC->CONNECTED = TRUE;
TNC->CONNECTING = FALSE;
// If required, send signon
// SendPacket(TNC->TCPDataSock,"\x1a", 1, 0);
// SendPacket(TNC->TCPDataSock,"DIGITAL MODE ?", 14, 0);
// SendPacket(TNC->TCPDataSock,"\x1b", 1, 0);
sprintf(TNC->WEB_COMMSSTATE, "Connected to FLDIGI");
SetWindowText(TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE);
// EnumWindows(EnumTNCWindowsProc, (LPARAM)TNC);
}
if (FD_ISSET(TNC->TCPDataSock,&errorfs) || FD_ISSET(TNC->TCPSock,&errorfs))
{
// if connecting, then failed, if connected then has just disconnected
// If required, send signon
// if (CONNECTED[port])
// if (!CONNECTING[port])
// {
// i=sprintf(ErrMsg, "MPSK Connection lost for BPQ Port %d\r\n", port);
// WritetoConsole(ErrMsg);
// }
// SendPacket(TNC->TCPDataSock,"\x1a", 1, 0);
// SendPacket(TNC->TCPDataSock,"DIGITAL MODE ?", 14, 0);
// SendPacket(TNC->TCPDataSock,"\x1b", 1, 0);
CONNECTING[port]=FALSE;
CONNECTED[port]=FALSE;
}
// EnumWindows(EnumTNCWindowsProc, (LPARAM)TNC);
}
if (FD_ISSET(TNC->TCPDataSock,&errorfs) || 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);
// }
CONNECTING[port]=FALSE;
CONNECTED[port]=FALSE;
}
}
if (TNC->PortRecord->UI_Q)
{
struct _MESSAGE * buffptr;
int SendLen;
char Reply[256];
int UILen;
char * UIMsg;
buffptr = Q_REM(&TNC->PortRecord->UI_Q);
UILen = buffptr->LENGTH;
UILen -= 23;
UIMsg = buffptr->L2DATA;
UIMsg[UILen] = 0;
if (UILen < 129 && TNC->Streams[0].Attached == FALSE) // Be sensible!
{
// >00uG8BPQ:72 TestA
SendLen = sprintf(Reply, "u%s:72 %s", TNC->NodeCall, UIMsg);
SendPacket(TNC, Reply, SendLen);
}
ReleaseBuffer(buffptr);
}
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
}
}
return 0;
case 1: // poll
// See if any frames for this port
for (Stream = 0; Stream <= 1; Stream++)
@ -437,16 +474,7 @@ pollloop:
// 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;
@ -464,36 +492,12 @@ pollloop:
WritetoTrace(TNC, &buffptr->Data[0], datalen - (MSGHDDRLEN + 1));
ReleaseBuffer(buffptr);
return (1);
return 1;
}
}
if (TNC->PortRecord->UI_Q)
{
struct _MESSAGE * buffptr;
int SendLen;
char Reply[256];
int UILen;
char * UIMsg;
return 0;
buffptr = Q_REM(&TNC->PortRecord->UI_Q);
UILen = buffptr->LENGTH;
UILen -= 23;
UIMsg = buffptr->L2DATA;
UIMsg[UILen] = 0;
if (UILen < 129 && TNC->Streams[0].Attached == FALSE) // Be sensible!
{
// >00uG8BPQ:72 TestA
SendLen = sprintf(Reply, "u%s:72 %s", TNC->NodeCall, UIMsg);
SendPacket(TNC, Reply, SendLen);
}
ReleaseBuffer(buffptr);
}
return (0);
case 2: // send

@ -418,32 +418,28 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff)
switch (fn)
{
case 7:
case 7:
// 100 mS Timer. May now be needed, as Poll can be called more frequently in some circumstances
// G7TAJ's code to record activity for stats display
if ( TNC->BusyFlags && CDBusy )
TNC->PortRecord->PORTCONTROL.ACTIVE += 2;
if ( TNC->PTTState )
TNC->PortRecord->PORTCONTROL.SENDING += 2;
SendPoll(TNC);
// Check for buffered data to send
if (TNC->FreeDataInfo->toSendTimeout)
{
TNC->FreeDataInfo->toSendTimeout--;
if (TNC->FreeDataInfo->toSendTimeout <= 0)
FlushData(TNC);
}
SendPoll(TNC);
return 0;
// Check for buffered data to send
case 1: // poll
if (TNC->FreeDataInfo->toSendTimeout)
{
TNC->FreeDataInfo->toSendTimeout--;
if (TNC->FreeDataInfo->toSendTimeout <= 0)
FlushData(TNC);
}
// FreeDataCheckRX(TNC);
@ -600,7 +596,12 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff)
CheckForDetach(TNC, Stream, STREAM, TidyClose, ForcedClose, CloseComplete);
}
return 0;
case 1: // poll
// See if any frames for this port
for (Stream = 0; Stream <= 2; Stream++)
@ -632,7 +633,7 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff)
ReleaseBuffer(buffptr);
return (1);
return 1;
}
if (STREAM->ReportDISC) // May need a delay so treat as a counter
@ -647,7 +648,7 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff)
}
}
}
return (0);
return 0;
case 2: // send

@ -372,12 +372,12 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff)
switch (fn)
{
case 7:
case 7:
// 100 mS Timer. May now be needed, as Poll can be called more frequently in some circumstances
// 100 mS Timer. May now be needed, as Poll can be called more frequently in some circumstances
// G7TAJ's code to record activity for stats display
if ( TNC->BusyFlags && CDBusy )
TNC->PortRecord->PORTCONTROL.ACTIVE += 2;
@ -385,28 +385,109 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff)
TNC->PortRecord->PORTCONTROL.SENDING += 2;
if (TNC->CONNECTED)
{
TNC->CONNECTED--;
if (TNC->CONNECTED == 0)
{
sprintf(TNC->WEB_COMMSSTATE, "Connection to HSMODEM lost");
MySetWindowText(TNC, TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE);
}
}
TNC->PollDelay++;
if (TNC->PollDelay > 20)
{
TNC->PollDelay = 0;
SendPoll(TNC);
}
if (TNC->DiscPending)
{
TNC->DiscPending--;
if (TNC->DiscPending == 0)
{
// Too long in Disc Pending - Kill and Restart TNC
}
}
for (Stream = 0; Stream <= 2; Stream++)
{
STREAM = &TNC->Streams[Stream];
if (STREAM->NeedDisc)
{
TNC->CONNECTED--;
STREAM->NeedDisc--;
if (TNC->CONNECTED == 0)
if (STREAM->NeedDisc == 0)
{
sprintf(TNC->WEB_COMMSSTATE, "Connection to HSMODEM lost");
MySetWindowText(TNC, TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE);
// Send the DISCONNECT
HSMODEMSendCommand(TNC, "DISCONNECT\r");
}
}
}
TNC->PollDelay++;
for (Stream = 0; Stream <= 2; Stream++)
{
STREAM = &TNC->Streams[Stream];
if (TNC->PollDelay > 20)
if (STREAM->NeedDisc)
{
TNC->PollDelay = 0;
SendPoll(TNC);
STREAM->NeedDisc--;
if (STREAM->NeedDisc == 0)
{
// Send the DISCONNECT
HSMODEMSendCommand(TNC, "DISCONNECT\r");
}
}
if (TNC->PortRecord->ATTACHEDSESSIONS[Stream] && STREAM->Attached == 0)
{
// New Attach
int calllen;
char Msg[80];
Debugprintf("HSMODEM New Attach Stream %d", Stream);
STREAM->Attached = TRUE;
calllen = ConvFromAX25(TNC->PortRecord->ATTACHEDSESSIONS[Stream]->L4USER, TNC->Streams[Stream].MyCall);
TNC->Streams[Stream].MyCall[calllen] = 0;
HSMODEMChangeMYC(TNC, TNC->Streams[0].MyCall);
return 0;
// Stop other ports in same group
case 1: // poll
SuspendOtherPorts(TNC);
//sprintf(TNC->WEB_TNCSTATE, "In Use by %s", TNC->Streams[0].MyCall);
//MySetWindowText(TNC, TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
// Stop Scanning
sprintf(Msg, "%d SCANSTOP", TNC->Port);
Rig_Command( (TRANSPORTENTRY *) -1, Msg);
}
if (STREAM->Attached)
CheckForDetach(TNC, Stream, STREAM, TidyClose, ForcedClose, CloseComplete);
}
return 0;
case 1: // poll
HSMODEMCheckRX(TNC);
@ -476,69 +557,7 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff)
ReleaseBuffer(buffptr);
}
if (TNC->DiscPending)
{
TNC->DiscPending--;
if (TNC->DiscPending == 0)
{
// Too long in Disc Pending - Kill and Restart TNC
}
}
for (Stream = 0; Stream <= 2; Stream++)
{
STREAM = &TNC->Streams[Stream];
if (STREAM->NeedDisc)
{
STREAM->NeedDisc--;
if (STREAM->NeedDisc == 0)
{
// Send the DISCONNECT
HSMODEMSendCommand(TNC, "DISCONNECT\r");
}
}
if (TNC->PortRecord->ATTACHEDSESSIONS[Stream] && STREAM->Attached == 0)
{
// New Attach
int calllen;
char Msg[80];
Debugprintf("HSMODEM New Attach Stream %d", Stream);
STREAM->Attached = TRUE;
calllen = ConvFromAX25(TNC->PortRecord->ATTACHEDSESSIONS[Stream]->L4USER, TNC->Streams[Stream].MyCall);
TNC->Streams[Stream].MyCall[calllen] = 0;
HSMODEMChangeMYC(TNC, TNC->Streams[0].MyCall);
// Stop other ports in same group
SuspendOtherPorts(TNC);
//sprintf(TNC->WEB_TNCSTATE, "In Use by %s", TNC->Streams[0].MyCall);
//MySetWindowText(TNC, TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
// Stop Scanning
sprintf(Msg, "%d SCANSTOP", TNC->Port);
Rig_Command( (TRANSPORTENTRY *) -1, Msg);
}
if (STREAM->Attached)
CheckForDetach(TNC, Stream, STREAM, TidyClose, ForcedClose, CloseComplete);
}
// See if any frames for this port

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -295,106 +295,106 @@ ok:
switch (fn)
{
case 7:
case 7:
// 100 mS Timer. May now be needed, as Poll can be called more frequently in some circumstances
SerialCheckRX(TNC);
return 0;
case 1: // poll
STREAM = &TNC->Streams[0];
STREAM = &TNC->Streams[0];
if (STREAM->NeedDisc)
{
STREAM->NeedDisc--;
if (STREAM->NeedDisc)
if (STREAM->NeedDisc == 0)
{
STREAM->NeedDisc--;
if (STREAM->NeedDisc == 0)
{
// Send the DISCONNECT
// Send the DISCONNECT
SerialSendCommand(TNC, "DISCONNECT\r");
}
SerialSendCommand(TNC, "DISCONNECT\r");
}
}
if (TNC->PortRecord->ATTACHEDSESSIONS[Stream] && STREAM->Attached == 0)
{
// New Attach
if (TNC->PortRecord->ATTACHEDSESSIONS[Stream] && STREAM->Attached == 0)
{
// New Attach
int calllen;
char Msg[80];
int calllen;
char Msg[80];
STREAM->Attached = TRUE;
STREAM->Attached = TRUE;
calllen = ConvFromAX25(TNC->PortRecord->ATTACHEDSESSIONS[Stream]->L4USER, TNC->Streams[Stream].MyCall);
TNC->Streams[Stream].MyCall[calllen] = 0;
calllen = ConvFromAX25(TNC->PortRecord->ATTACHEDSESSIONS[Stream]->L4USER, TNC->Streams[Stream].MyCall);
TNC->Streams[Stream].MyCall[calllen] = 0;
// Stop other ports in same group
// Stop other ports in same group
SuspendOtherPorts(TNC);
SuspendOtherPorts(TNC);
sprintf(TNC->WEB_TNCSTATE, "In Use by %s", TNC->Streams[0].MyCall);
MySetWindowText(TNC, TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
sprintf(TNC->WEB_TNCSTATE, "In Use by %s", TNC->Streams[0].MyCall);
MySetWindowText(TNC, TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
// Stop Scanning
// Stop Scanning
sprintf(Msg, "%d SCANSTOP", TNC->Port);
sprintf(Msg, "%d SCANSTOP", TNC->Port);
Rig_Command( (TRANSPORTENTRY *) -1, Msg);
}
Rig_Command( (TRANSPORTENTRY *) -1, Msg);
}
if (STREAM->Attached)
CheckForDetach(TNC, Stream, STREAM, TidyClose, ForcedClose, CloseComplete);
if (STREAM->Attached)
CheckForDetach(TNC, Stream, STREAM, TidyClose, ForcedClose, CloseComplete);
return 0;
// See if any frames for this port
case 1: // poll
// See if any frames for this port
STREAM = &TNC->Streams[0];
if (STREAM->BPQtoPACTOR_Q)
{
PMSGWITHLEN buffptr = (PMSGWITHLEN)Q_REM(&STREAM->BPQtoPACTOR_Q);
UCHAR * data = &buffptr->Data[0];
STREAM->FramesQueued--;
txlen = (int)buffptr->Len;
STREAM->bytesTXed += txlen;
bytes=SerialSendData(TNC, data, txlen);
WritetoTrace(TNC, data, txlen);
}
STREAM = &TNC->Streams[0];
if (STREAM->PACTORtoBPQ_Q != 0)
{
buffptr = (PMSGWITHLEN)Q_REM(&STREAM->PACTORtoBPQ_Q);
if (STREAM->BPQtoPACTOR_Q)
{
PMSGWITHLEN buffptr = (PMSGWITHLEN)Q_REM(&STREAM->BPQtoPACTOR_Q);
UCHAR * data = &buffptr->Data[0];
STREAM->FramesQueued--;
txlen = (int)buffptr->Len;
STREAM->bytesTXed += txlen;
bytes=SerialSendData(TNC, data, txlen);
WritetoTrace(TNC, data, txlen);
}
datalen = (int)buffptr->Len;
if (STREAM->PACTORtoBPQ_Q != 0)
{
buffptr = (PMSGWITHLEN)Q_REM(&STREAM->PACTORtoBPQ_Q);
buff->PORT = Stream; // Compatibility with Kam Driver
buff->PID = 0xf0;
memcpy(&buff->L2DATA, &buffptr->Data[0], datalen); // Data goes to + 7, but we have an extra byte
datalen += sizeof(void *) + 4;
datalen = (int)buffptr->Len;
PutLengthinBuffer(buff, datalen);
buff->PORT = Stream; // Compatibility with Kam Driver
buff->PID = 0xf0;
memcpy(&buff->L2DATA, &buffptr->Data[0], datalen); // Data goes to + 7, but we have an extra byte
datalen += sizeof(void *) + 4;
ReleaseBuffer(buffptr);
PutLengthinBuffer(buff, datalen);
return (1);
}
ReleaseBuffer(buffptr);
if (STREAM->ReportDISC) // May need a delay so treat as a counter
{
STREAM->ReportDISC--;
return (1);
}
if (STREAM->ReportDISC == 0)
{
buff->PORT = Stream;
return -1;
}
if (STREAM->ReportDISC) // May need a delay so treat as a counter
{
STREAM->ReportDISC--;
if (STREAM->ReportDISC == 0)
{
buff->PORT = Stream;
return -1;
}
}
return (0);
return (0);
case 2: // send

@ -1758,8 +1758,6 @@ VOID SendConACK(struct _LINKTABLE * LINK, TRANSPORTENTRY * L4, L3MESSAGEBUFFER *
{
// SEND CONNECT ACK
struct TNCINFO * TNC;
L4CONNECTSIN++;
L3MSG->L4TXNO = L4->CIRCUITINDEX;
@ -1785,6 +1783,39 @@ VOID SendConACK(struct _LINKTABLE * LINK, TRANSPORTENTRY * L4, L3MESSAGEBUFFER *
WriteConnectLog(From, toCall, "NETROM");
}
L3SWAPADDRESSES(L3MSG);
L3MSG->L3TTL = L3LIVES;
L3MSG->LENGTH = MSGHDDRLEN + 22; // CTL 20 BYTE Header Window
if (BPQNODE)
{
L3MSG->L4DATA[1] = L3LIVES; // Our TTL
if (L4->AllowCompress)
L3MSG->L4DATA[1] |= 0x80;
L3MSG->LENGTH++;
}
C_Q_ADD(&L4->L4TARGET.DEST->DEST_Q, (UINT *)L3MSG);
/*
// This sends to neighbour. Now we queue to normal L4 Q
TNC = LINK->LINKPORT->TNC;
if (LINK->NEIGHBOUR && LINK->NEIGHBOUR->TCPPort)
{
TCPNETROMSend(LINK->NEIGHBOUR, L3MSG);
ReleaseBuffer(L3MSG);
}
else if (TNC && TNC->NetRomMode)
SendVARANetromMsg(TNC, L3MSG);
else
C_Q_ADD(&LINK->TX_Q, L3MSG);
*/
if (CTEXTLEN && Applmask == 0) // Connects to Node (not application)
{
@ -1818,33 +1849,6 @@ VOID SendConACK(struct _LINKTABLE * LINK, TRANSPORTENTRY * L4, L3MESSAGEBUFFER *
}
}
L3SWAPADDRESSES(L3MSG);
L3MSG->L3TTL = L3LIVES;
L3MSG->LENGTH = MSGHDDRLEN + 22; // CTL 20 BYTE Header Window
if (BPQNODE)
{
L3MSG->L4DATA[1] = L3LIVES; // Our TTL
if (L4->AllowCompress)
L3MSG->L4DATA[1] |= 0x80;
L3MSG->LENGTH++;
}
TNC = LINK->LINKPORT->TNC;
if (LINK->NEIGHBOUR && LINK->NEIGHBOUR->TCPPort)
{
TCPNETROMSend(LINK->NEIGHBOUR, L3MSG);
ReleaseBuffer(L3MSG);
}
else if (TNC && TNC->NetRomMode)
SendVARANetromMsg(TNC, L3MSG);
else
C_Q_ADD(&LINK->TX_Q, L3MSG);
IncomingL4ConnectionEvent(L4);
}

@ -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

@ -1431,7 +1431,7 @@ VOID ProcessSMTPServerMessage(SocketConn * sockptr, char * Buffer, int Len)
if (sockptr->Flags == GETTINGMESSAGE)
{
if(memcmp(Buffer, ".\r\n", 3) == 0)
if (_memicmp(Buffer, ".\r\n", 3) == 0)
{
char * ptr1, * ptr2;
int linelen, MsgLen;
@ -1782,14 +1782,14 @@ ZvVx9G1hcg==
*/
if(memcmp(Buffer, "AUTH LOGIN", 10) == 0)
if (_memicmp(Buffer, "AUTH LOGIN", 10) == 0)
{
sockptr->State = GettingUser;
SendSock(sockptr, "334 VXNlcm5hbWU6");
return;
}
if(memcmp(Buffer, "EHLO",4) == 0)
if (_memicmp(Buffer, "EHLO",4) == 0)
{
SendSock(sockptr, "250-BPQ Mail Server");
SendSock(sockptr, "250 AUTH LOGIN");
@ -1799,7 +1799,7 @@ ZvVx9G1hcg==
return;
}
if(memcmp(Buffer, "AUTH LOGIN", 10) == 0)
if (_memicmp(Buffer, "AUTH LOGIN", 10) == 0)
{
sockptr->State = GettingUser;
SendSock(sockptr, "334 VXNlcm5hbWU6");
@ -1807,7 +1807,7 @@ ZvVx9G1hcg==
}
if(memcmp(Buffer, "HELO",4) == 0)
if (_memicmp(Buffer, "HELO",4) == 0)
{
SendSock(sockptr, "250 Ok");
return;
@ -1866,7 +1866,7 @@ ZvVx9G1hcg==
return;
}
if(memcmp(Buffer, "DATA\r\n", 6) == 0)
if (_memicmp(Buffer, "DATA\r\n", 6) == 0)
{
sockptr->MailBuffer=malloc(10000);
sockptr->MailBufferSize=10000;
@ -1886,7 +1886,7 @@ ZvVx9G1hcg==
return;
}
if(memcmp(Buffer, "QUIT\r\n", 6) == 0)
if (_memicmp(Buffer, "QUIT\r\n", 6) == 0)
{
SendSock(sockptr, "221 OK");
Sleep(500);
@ -1894,7 +1894,7 @@ ZvVx9G1hcg==
return;
}
if(memcmp(Buffer, "RSET\r\n", 6) == 0)
if (_memicmp(Buffer, "RSET\r\n", 6) == 0)
{
SendSock(sockptr, "250 Ok");
@ -2071,7 +2071,7 @@ int CreateSMTPMessage(SocketConn * sockptr, int i, char * MsgTitle, time_t Date,
// If NTS message (TO is numeric and AT is NTSxx or NTSxx.NTS - Outlook won't accept x@y)
if (isdigits(Msg->to) && memcmp(Msg->via, "NTS", 3) == 0)
if (isdigits(Msg->to) && _memicmp(Msg->via, "NTS", 3) == 0)
{
if (Msg->via[5] == 0 || strcmp(&Msg->via[5], ".NTS") == 0)
{
@ -2321,7 +2321,7 @@ VOID ProcessPOP3ServerMessage(SocketConn * sockptr, char * Buffer, int Len)
WriteLogLine(NULL, '<',Buffer, Len-2, LOG_TCP);
if(memcmp(Buffer, "CAPA",4) == 0)
if (_memicmp(Buffer, "CAPA",4) == 0)
{
SendSock(sockptr, "+OK Capability list follows");
SendSock(sockptr, "UIDL");
@ -2331,7 +2331,7 @@ VOID ProcessPOP3ServerMessage(SocketConn * sockptr, char * Buffer, int Len)
return;
}
if(memcmp(Buffer, "AUTH",4) == 0)
if (_memicmp(Buffer, "AUTH",4) == 0)
{
SendSock(sockptr, "-ERR");
return;
@ -2399,7 +2399,7 @@ VOID ProcessPOP3ServerMessage(SocketConn * sockptr, char * Buffer, int Len)
return;
}
if (memcmp(Buffer, "QUIT",4) == 0)
if (_memicmp(Buffer, "QUIT",4) == 0)
{
SendSock(sockptr, "+OK Finished");
@ -2409,13 +2409,13 @@ VOID ProcessPOP3ServerMessage(SocketConn * sockptr, char * Buffer, int Len)
return;
}
if (memcmp(Buffer, "NOOP",4) == 0)
if (_memicmp(Buffer, "NOOP",4) == 0)
{
SendSock(sockptr, "+OK ");
return;
}
// if (memcmp(Buffer, "LAST",4) == 0)
// if (_memicmp(Buffer, "LAST",4) == 0)
// {
// SendSock(sockptr, "+OK 0");
// return;
@ -2428,7 +2428,7 @@ VOID ProcessPOP3ServerMessage(SocketConn * sockptr, char * Buffer, int Len)
return;
}
if (memcmp(Buffer, "STAT",4) == 0)
if (_memicmp(Buffer, "STAT",4) == 0)
{
char reply[40];
int i, size=0;
@ -2444,7 +2444,7 @@ VOID ProcessPOP3ServerMessage(SocketConn * sockptr, char * Buffer, int Len)
return;
}
if (memcmp(Buffer, "UIDL",4) == 0)
if (_memicmp(Buffer, "UIDL",4) == 0)
{
char reply[40];
int i, count=0, size=0;
@ -2462,7 +2462,7 @@ VOID ProcessPOP3ServerMessage(SocketConn * sockptr, char * Buffer, int Len)
return;
}
if (memcmp(Buffer, "LIST", 4) == 0)
if (_memicmp(Buffer, "LIST", 4) == 0)
{
char reply[40];
int i, count=0, size=0;
@ -2496,7 +2496,7 @@ VOID ProcessPOP3ServerMessage(SocketConn * sockptr, char * Buffer, int Len)
return;
}
if (memcmp(Buffer, "RETR", 4) == 0 || memcmp(Buffer, "TOP", 3) == 0)
if (_memicmp(Buffer, "RETR", 4) == 0 || memcmp(Buffer, "TOP", 3) == 0)
{
char * ptr;
char Header[120];
@ -2510,7 +2510,7 @@ VOID ProcessPOP3ServerMessage(SocketConn * sockptr, char * Buffer, int Len)
BOOL TOP = FALSE;
int Len;
if (memcmp(Buffer, "TOP", 3) == 0)
if (_memicmp(Buffer, "TOP", 3) == 0)
TOP = TRUE;
ptr=strlop(Buffer, ' '); // Get Number
@ -2695,7 +2695,7 @@ VOID ProcessPOP3ServerMessage(SocketConn * sockptr, char * Buffer, int Len)
}
if (memcmp(Buffer, "DELE",4) == 0)
if (_memicmp(Buffer, "DELE",4) == 0)
{
char * ptr;
int i;
@ -2720,7 +2720,7 @@ VOID ProcessPOP3ServerMessage(SocketConn * sockptr, char * Buffer, int Len)
}
if (memcmp(Buffer, "QUIT",4) == 0)
if (_memicmp(Buffer, "QUIT",4) == 0)
{
SendSock(sockptr, "+OK Finished");
@ -2962,7 +2962,7 @@ VOID ProcessSMTPClientMessage(SocketConn * sockptr, char * Buffer, int Len)
if (sockptr->State == WaitingForGreeting)
{
if (memcmp(Buffer, "220 ",4) == 0)
if (_memicmp(Buffer, "220 ",4) == 0)
{
TryHELO = 0;
@ -2987,7 +2987,7 @@ VOID ProcessSMTPClientMessage(SocketConn * sockptr, char * Buffer, int Len)
if (sockptr->State == WaitingForHELOResponse)
{
/*
if (memcmp(Buffer, "500 ",4) == 0 && TryHELO == 0)
if (_memicmp(Buffer, "500 ",4) == 0 && TryHELO == 0)
{
TryHELO = 1;
@ -3001,10 +3001,10 @@ VOID ProcessSMTPClientMessage(SocketConn * sockptr, char * Buffer, int Len)
return;
}
*/
if (memcmp(Buffer, "250-",4) == 0)
if (_memicmp(Buffer, "250-",4) == 0)
return;
if (memcmp(Buffer, "250 ",4) == 0)
if (_memicmp(Buffer, "250 ",4) == 0)
{
if (SMTPAuthNeeded && sockptr->AMPR == FALSE)
{
@ -3030,21 +3030,21 @@ VOID ProcessSMTPClientMessage(SocketConn * sockptr, char * Buffer, int Len)
if (sockptr->State == WaitingForAUTHResponse)
{
if (memcmp(Buffer, "334 VXN", 7) == 0)
if (_memicmp(Buffer, "334 VXN", 7) == 0)
{
char * Msg = str_base64_encode(ISPAccountName);
SendSock(sockptr, Msg);
free(Msg);
return;
}
else if (memcmp(Buffer, "334 UGF", 7) == 0)
else if (_memicmp(Buffer, "334 UGF", 7) == 0)
{
char * Msg = str_base64_encode(ISPAccountPass);
SendSock(sockptr, Msg);
free(Msg);
return;
}
else if (memcmp(Buffer, "235 ", 4) == 0)
else if (_memicmp(Buffer, "235 ", 4) == 0)
{
sockprintf(sockptr, "MAIL FROM: <%s@%s>", sockptr->SMTPMsg->from, sockptr->FromDomain);
// sockprintf(sockptr, "MAIL FROM: <%s@%s.%s>", sockptr->SMTPMsg->from, BBSName, HRoute);
@ -3065,7 +3065,7 @@ VOID ProcessSMTPClientMessage(SocketConn * sockptr, char * Buffer, int Len)
if (sockptr->State == WaitingForFROMResponse)
{
if (memcmp(Buffer, "250 ",4) == 0)
if (_memicmp(Buffer, "250 ",4) == 0)
{
sockprintf(sockptr, "RCPT TO: <%s>", sockptr->SMTPMsg->via);
sockptr->State = WaitingForTOResponse;
@ -3083,7 +3083,7 @@ VOID ProcessSMTPClientMessage(SocketConn * sockptr, char * Buffer, int Len)
if (sockptr->State == WaitingForTOResponse)
{
if (memcmp(Buffer, "250 ",4) == 0)
if (_memicmp(Buffer, "250 ",4) == 0)
{
SendSock(sockptr, "DATA");
sockptr->State = WaitingForDATAResponse;
@ -3104,13 +3104,13 @@ VOID ProcessSMTPClientMessage(SocketConn * sockptr, char * Buffer, int Len)
int Len;
UCHAR * UTF;
if (memcmp(Buffer, "354 ",4) == 0)
if (_memicmp(Buffer, "354 ",4) == 0)
{
sockprintf(sockptr, "To: %s", sockptr->SMTPMsg->via);
sockprintf(sockptr, "From: %s <%s@%s>", sockptr->SMTPMsg->from, sockptr->SMTPMsg->from, sockptr->FromDomain);
sockprintf(sockptr, "Sender: %s@%s", sockptr->SMTPMsg->from, sockptr->FromDomain);
if (GMailMode && sockptr->AMPR == FALSE)
sockprintf(sockptr, "Reply-To: %s+%s@%s", GMailName, sockptr->SMTPMsg->from, sockptr->FromDomain);
sockprintf(sockptr, "Reply-To: %s+%s@gmail.com", GMailName, sockptr->SMTPMsg->from);
else
sockprintf(sockptr, "Reply-To: %s@%s", sockptr->SMTPMsg->from, sockptr->FromDomain);
@ -3187,7 +3187,7 @@ VOID ProcessSMTPClientMessage(SocketConn * sockptr, char * Buffer, int Len)
{
struct MsgInfo * Msg = sockptr->SMTPMsg;
if (memcmp(Buffer, "250 ", 4) == 0)
if (_memicmp(Buffer, "250 ", 4) == 0)
{
// if AMPR, clear forwarding bitmap
@ -3453,7 +3453,7 @@ VOID ProcessPOP3ClientMessage(SocketConn * sockptr, char * Buffer, int Len)
if (sockptr->Flags == GETTINGMESSAGE)
{
if(memcmp(Buffer, ".\r\n", 3) == 0)
if (_memicmp(Buffer, ".\r\n", 3) == 0)
{
// File Message
@ -3625,7 +3625,7 @@ VOID ProcessPOP3ClientMessage(SocketConn * sockptr, char * Buffer, int Len)
if (sockptr->State == WaitingForGreeting)
{
if (memcmp(Buffer, "+OK", 3) == 0)
if (_memicmp(Buffer, "+OK", 3) == 0)
{
sockprintf(sockptr, "USER %s", ISPAccountName);
sockptr->State = WaitingForUSERResponse;
@ -3641,7 +3641,7 @@ VOID ProcessPOP3ClientMessage(SocketConn * sockptr, char * Buffer, int Len)
if (sockptr->State == WaitingForUSERResponse)
{
if (memcmp(Buffer, "+OK", 3) == 0)
if (_memicmp(Buffer, "+OK", 3) == 0)
{
sockprintf(sockptr, "PASS %s", ISPAccountPass);
sockptr->State = WaitingForPASSResponse;
@ -3657,7 +3657,7 @@ VOID ProcessPOP3ClientMessage(SocketConn * sockptr, char * Buffer, int Len)
if (sockptr->State == WaitingForPASSResponse)
{
if (memcmp(Buffer, "+OK", 3) == 0)
if (_memicmp(Buffer, "+OK", 3) == 0)
{
SendSock(sockptr, "STAT");
sockptr->State = WaitingForSTATResponse;
@ -3673,7 +3673,7 @@ VOID ProcessPOP3ClientMessage(SocketConn * sockptr, char * Buffer, int Len)
if (sockptr->State == WaitingForSTATResponse)
{
if (memcmp(Buffer, "+OK", 3) == 0)
if (_memicmp(Buffer, "+OK", 3) == 0)
{
int Msgs = atoi(&Buffer[3]);
@ -3703,7 +3703,7 @@ VOID ProcessPOP3ClientMessage(SocketConn * sockptr, char * Buffer, int Len)
if (sockptr->State == WaitingForRETRResponse)
{
if (memcmp(Buffer, "+OK", 3) == 0)
if (_memicmp(Buffer, "+OK", 3) == 0)
{
sockptr->MailBuffer=malloc(10000);
sockptr->MailBufferSize=10000;
@ -3731,7 +3731,7 @@ VOID ProcessPOP3ClientMessage(SocketConn * sockptr, char * Buffer, int Len)
}
if (sockptr->State == WaitingForDELEResponse)
{
if (memcmp(Buffer, "+OK", 3) == 0)
if (_memicmp(Buffer, "+OK", 3) == 0)
{
if (sockptr->POP3MsgCount > sockptr->POP3MsgNum++)
{

@ -203,18 +203,7 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff)
ok:
switch (fn)
{
case 1: // poll
for (Stream = 0; Stream <= MaxStreams; Stream++)
{
if (TNC->Streams[Stream].ReportDISC)
{
TNC->Streams[Stream].ReportDISC = FALSE;
buff->PORT = Stream;
return -1;
}
}
case 7: // poll
DEDCheckRX(TNC);
DEDPoll(port);
@ -233,7 +222,27 @@ ok:
STREAM->ReportDISC = TRUE; // Dont want to leave session attached. Causes too much confusion
}
}
else
}
return 0;
case 1:
for (Stream = 0; Stream <= MaxStreams; Stream++)
{
STREAM = &TNC->Streams[Stream];
if (STREAM->ReportDISC)
{
STREAM->ReportDISC = FALSE;
buff->PORT = Stream;
return -1;
}
if (STREAM->PACTORtoBPQ_Q)
{
int datalen;

@ -372,6 +372,10 @@ ok:
// 100 mS Timer.
DEDCheckRX(TNC);
DEDPoll(port);
DEDCheckRX(TNC);
// G7TAJ's code to record activity for stats display
if ( TNC->BusyFlags && CDBusy )
@ -408,9 +412,6 @@ ok:
}
}
DEDCheckRX(TNC);
DEDPoll(port);
DEDCheckRX(TNC);
for (Stream = 0; Stream <= MaxStreams; Stream++)
{

@ -308,10 +308,6 @@ ok:
// 100 mS Timer. May now be needed, as Poll can be called more frequently in some circumstances
SerialCheckRX(TNC);
return 0;
case 1: // poll
while (TNC->PortRecord->UI_Q)
{
@ -353,6 +349,17 @@ ok:
SerialSendCommand(TNC, "DISCONNECT\r");
}
}
}
return 0;
case 1: // poll
SerialCheckRX(TNC);
for (Stream = 0; Stream <= 2; Stream++)
{
STREAM = &TNC->Streams[Stream];
if (TNC->PortRecord->ATTACHEDSESSIONS[Stream] && STREAM->Attached == 0)
{

@ -94,6 +94,9 @@ void ProcessRHPWebSockClosed(SOCKET socket);
int ProcessSNMPPayload(UCHAR * Msg, int Len, UCHAR * Reply, int * OffPtr);
int RHPProcessHTTPMessage(struct ConnectionInfo * conn, char * response, char * Method, char * URL, char * request, BOOL LOCAL, BOOL COOKIE);
void checkNRTCPSockets(int portNo);
int ProcessNewTermWebSock(struct ConnectionInfo * sockptr, char * Key);
void ProcessWebTermInput(struct ConnectionInfo * sockptr, char * Payload);
void ProcessWebTermClosed(struct ConnectionInfo * sockptr);
#ifndef LINBPQ
extern HKEY REGTREE;
@ -1000,10 +1003,6 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff)
TNC->PageChanged = FALSE;
}
return 0;
case 1: // poll
for (Stream = 0; Stream <= MaxStreams; Stream++)
{
TRANSPORTENTRY * SESS;
@ -1039,7 +1038,17 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff)
STREAM->ReportDISC = TRUE;
}
}
}
return 0;
case 1:
TelnetPoll(port);
for (Stream = 0; Stream <= MaxStreams; Stream++)
{
STREAM = &TNC->Streams[Stream];
if (STREAM->ReportDISC)
{
STREAM->ReportDISC = FALSE;
@ -1047,13 +1056,6 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff)
return -1;
}
}
TelnetPoll(port);
for (Stream = 0; Stream <= MaxStreams; Stream++)
{
STREAM = &TNC->Streams[Stream];
if (STREAM->PACTORtoBPQ_Q !=0)
{
@ -5223,11 +5225,28 @@ int DataSocket_ReadHTTP(struct TNCINFO * TNC, struct ConnectionInfo * sockptr, S
if (Opcode == 8)
{
Debugprintf("WebSock Close");
char Msg[256];
if (strcmp(sockptr->WebURL, "WEBTERM") == 0)
{
ProcessWebTermClosed(sockptr);
}
// Msg[0] = 0x88; // Fin, Close
// Msg[1] = 9;
// strcpy(&Msg[2], "Close ACK");
// send(sockptr->socket, Msg, 11, 0);
}
else if (Opcode == 1)
{
if (strcmp(sockptr->WebURL, "RIGCTL") == 0)
if (strcmp(sockptr->WebURL, "WEBTERM") == 0)
{
Payload[Len] = 0;
ProcessWebTermInput(sockptr, Payload);
}
else if (strcmp(sockptr->WebURL, "RIGCTL") == 0)
{
// PTT Message
@ -5316,6 +5335,7 @@ int DataSocket_ReadHTTP(struct TNCINFO * TNC, struct ConnectionInfo * sockptr, S
ShowConnections(TNC);
memcpy(sockptr->WebURL, &MsgPtr[5], 31);
strlop(sockptr->WebURL, '?');
strlop(sockptr->WebURL, ' ');
if (strcmp(sockptr->WebURL, "RIGCTL") == 0)
@ -5341,6 +5361,15 @@ int DataSocket_ReadHTTP(struct TNCINFO * TNC, struct ConnectionInfo * sockptr, S
}
}
}
else if (memcmp(sockptr->WebURL, "WEBTERM", 7) == 0)
{
// We have to hook this socket to the Terminal Session
char * Key = strlop(&MsgPtr[5], '?');
strlop(Key, ' ');
ProcessNewTermWebSock(sockptr, Key);
}
ptr = strstr(MsgPtr, "BPQSessionCookie=N");

@ -158,6 +158,17 @@ static int ExtProc(int fn, int port,unsigned char * buff)
TidyClose(TNC, Stream);
}
}
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
}
}
}
ARQTimer(TNC);
@ -183,16 +194,7 @@ static int ExtProc(int fn, int port,unsigned char * buff)
return -1;
}
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;

@ -673,7 +673,7 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff)
switch (fn)
{
case 1: // poll
case 7: // poll
if (MasterPort[port] == port)
{
@ -856,8 +856,6 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff)
}
// See if any frames for this port
for (Stream = 0; Stream <= TNC->AGWInfo->MaxSessions; Stream++)
{
STREAM = &TNC->Streams[Stream];
@ -892,16 +890,7 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff)
if (STREAM->Attached)
CheckForDetach(TNC, Stream, STREAM, TidyClose, ForcedClose, CloseComplete);
if (STREAM->ReportDISC)
{
hookL4SessionDeleted(TNC, STREAM);
STREAM->ReportDISC = FALSE;
buff->PORT = Stream;
return -1;
}
// if Busy, send buffer status poll
// if Busy, send buffer status poll
if (STREAM->Connected && STREAM->FramesOutstanding)
{
@ -934,7 +923,26 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff)
STREAM->ReportDISC = TRUE; // Dont want to leave session attached. Causes too much confusion
}
}
else
}
return 0;
case 1:
for (Stream = 0; Stream <= TNC->AGWInfo->MaxSessions; Stream++)
{
STREAM = &TNC->Streams[Stream];
if (STREAM->ReportDISC)
{
hookL4SessionDeleted(TNC, STREAM);
STREAM->ReportDISC = FALSE;
buff->PORT = Stream;
return -1;
}
if (STREAM->PACTORtoBPQ_Q)
{
int datalen;

137
V4.c

@ -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
{
@ -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,19 +402,19 @@ 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 = 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);
@ -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
@ -462,7 +462,7 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff)
// 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(&ltime);
if (ltime - TNC->lasttime >9 )
{
// See if time to reconnect
time(&ltime);
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);

@ -412,6 +412,18 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff)
}
}
if (STREAM->NeedDisc)
{
STREAM->NeedDisc--;
if (STREAM->NeedDisc == 0)
{
// Send the DISCONNECT
VARASendCommand(TNC, "DISCONNECT\r", TRUE);
}
}
while (TNC->PortRecord->UI_Q)
{
@ -488,42 +500,6 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff)
TNC->PageChanged = FALSE;
}
return 0;
case 1: // poll
if (STREAM->NeedDisc)
{
STREAM->NeedDisc--;
if (STREAM->NeedDisc == 0)
{
// Send the DISCONNECT
VARASendCommand(TNC, "DISCONNECT\r", TRUE);
}
}
/*
{
struct tm * tm;
char Time[80];
TNC->Restarts++;
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, TNC->xIDC_RESTARTTIME, Time);
strcpy(TNC->WEB_RESTARTTIME, Time);
sprintf_s(Time, sizeof(Time),"%d", TNC->Restarts);
MySetWindowText(TNC, TNC->xIDC_RESTARTS, Time);
strcpy(TNC->WEB_RESTARTS, Time);
*/
if (TNC->PortRecord->ATTACHEDSESSIONS[0] && TNC->Streams[0].Attached == 0)
{
@ -560,16 +536,6 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff)
Rig_Command( (TRANSPORTENTRY *) -1, Msg);
}
if (TNC->Streams[0].Attached)
CheckForDetach(TNC, 0, &TNC->Streams[0], TidyClose, ForcedClose, CloseComplete);
if (TNC->Streams[0].ReportDISC)
{
TNC->Streams[0].ReportDISC = FALSE;
buff->PORT = 0;
return -1;
}
if (TNC->CONNECTED == FALSE && TNC->CONNECTING == FALSE)
{
// See if time to reconnect
@ -582,6 +548,20 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff)
}
}
if (TNC->Streams[0].Attached)
CheckForDetach(TNC, 0, &TNC->Streams[0], TidyClose, ForcedClose, CloseComplete);
return 0;
case 1: // poll
if (TNC->Streams[0].ReportDISC)
{
TNC->Streams[0].ReportDISC = FALSE;
buff->PORT = 0;
return -1;
}
// See if any frames for this port
if (TNC->Streams[0].BPQtoPACTOR_Q) //Used for CTEXT

@ -10,15 +10,15 @@
#endif
#define KVers 6,0,25,36
#define KVerstring "6.0.25.36\0"
#define KVers 6,0,25,39
#define KVerstring "6.0.25.39\0"
#ifdef CKernel
#define Vers KVers
#define Verstring KVerstring
#define Datestring "July 2026"
#define Datestring "August 2026"
#define VerComments "G8BPQ Packet Switch (C Version)" KVerstring
#define VerCopyright "Copyright © 2001-2026 John Wiseman G8BPQ\0"
#define VerDesc "BPQ32 Switch\0"

@ -598,7 +598,7 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff)
switch (fn)
{
case 1: // poll
case 7: // poll
// Check session limit timer
@ -765,19 +765,19 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff)
if (TNC->TimeSinceLast++ > 800) // Allow 10 secs for Keepalive
{
// Restart TNC
if (TNC->ProgramPath && TNC->CONNECTED)
{
if (strstr(TNC->ProgramPath, "WINMOR TNC"))
{
struct tm * tm;
char Time[80];
TNC->Restarts++;
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);
@ -787,7 +787,7 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff)
sprintf_s(Time, sizeof(Time),"%d", TNC->Restarts);
SetWindowText(TNC->xIDC_RESTARTS, Time);
strcpy(TNC->WEB_RESTARTS, Time);
KillTNC(TNC);
RestartTNC(TNC);
@ -825,7 +825,7 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff)
// Stop Scanning
sprintf(Msg, "%d SCANSTOP", TNC->Port);
Rig_Command( (TRANSPORTENTRY *) -1, Msg);
}
@ -833,72 +833,76 @@ 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)
{
TNC->Streams[0].ReportDISC = FALSE;
buff->PORT = 0;
return -1;
}
if (TNC->CONNECTED == FALSE && TNC->CONNECTING == FALSE)
if (TNC->CONNECTED == FALSE && TNC->CONNECTING == FALSE)
{
// See if time to reconnect
time(&ltime);
if (ltime - TNC->lasttime > 9 )
{
// See if time to reconnect
time(&ltime);
if (ltime - TNC->lasttime > 9 )
{
ConnecttoWINMOR(port);
TNC->lasttime = ltime;
}
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);
timeout.tv_sec = 0;
timeout.tv_usec = 0; // poll
if (TNC->CONNECTING || TNC->CONNECTED) FD_SET(TNC->TCPDataSock,&errorfs);
if (select((int)TNC->TCPDataSock + 1, &readfs, &writefs, &errorfs, &timeout) > 0)
timeout.tv_sec = 0;
timeout.tv_usec = 0; // poll
if (select((int)TNC->TCPDataSock + 1, &readfs, &writefs, &errorfs, &timeout) > 0)
{
// See what happened
if (FD_ISSET(TNC->TCPDataSock, &readfs))
ProcessDataSocketData(port);
if (FD_ISSET(TNC->TCPDataSock, &writefs))
{
// See what happened
// Write block has cleared. Send rest of packet
if (FD_ISSET(TNC->TCPDataSock, &readfs))
ProcessDataSocketData(port);
if (FD_ISSET(TNC->TCPDataSock, &writefs))
{
// Write block has cleared. Send rest of packet
buffptr=Q_REM(&TNC->BPQtoWINMOR_Q);
txlen = buffptr->Len;
memcpy(txbuff,buffptr->Data,txlen);
bytes=send(TNC->TCPSock, (const char FAR *)&txbuff, (int)txlen, 0);
ReleaseBuffer(buffptr);
}
buffptr=Q_REM(&TNC->BPQtoWINMOR_Q);
txlen = buffptr->Len;
memcpy(txbuff,buffptr->Data,txlen);
bytes=send(TNC->TCPSock, (const char FAR *)&txbuff, (int)txlen, 0);
ReleaseBuffer(buffptr);
}
if (FD_ISSET(TNC->TCPDataSock, &errorfs))
{
i=sprintf(ErrMsg, "WINMOR Data Connection lost for BPQ Port %d\r\n", port);
WritetoConsole(ErrMsg);
TNC->CONNECTING = FALSE;
TNC->CONNECTED = FALSE;
TNC->Streams[0].ReportDISC = TRUE;
}
if (FD_ISSET(TNC->TCPDataSock, &errorfs))
{
i=sprintf(ErrMsg, "WINMOR Data Connection lost for BPQ Port %d\r\n", port);
WritetoConsole(ErrMsg);
TNC->CONNECTING = FALSE;
TNC->CONNECTED = FALSE;
TNC->Streams[0].ReportDISC = TRUE;
}
}
return 0;
case 1:
// See if any frames for this port
if (TNC->Streams[0].ReportDISC)
{
TNC->Streams[0].ReportDISC = FALSE;
buff->PORT = 0;
return -1;
}
if (TNC->WINMORtoBPQ_Q != 0)
{
buffptr=Q_REM(&TNC->WINMORtoBPQ_Q);

@ -1995,10 +1995,10 @@ void ProcessWebMailMessage(struct HTTPConnectionInfo * Session, char * Key, BOOL
" if (\"WebSocket\" in window)"
" {"
" // open a web socket. Get address from URL\r\n"
" var text = window.location.href;"
" var result = text.substring(7);"
" var myArray = result.split('/', 1);"
" ws = new WebSocket('ws://' + myArray[0] + '/WMRefresh&%s');\r\n"
" var proto = (window.location.protocol === 'https:') ? 'wss://' : 'ws://';\r\n"
" ws = new WebSocket(proto + window.location.host + '/WMRefresh&%s');\r\n"
" ws.onopen = function() {\r\n"
@ -2191,7 +2191,7 @@ void ProcessWebMailMessage(struct HTTPConnectionInfo * Session, char * Key, BOOL
EncodedTitle = doXMLTransparency(Msg->title);
*RLen = sprintf(Reply, MsgInputPage, Key, Msg->from, Temp, EncodedTitle , "");
*RLen = sprintf(Reply, MsgInputPage, Key, ReplyAddr, Temp, EncodedTitle , "");
free(EncodedTitle);
return;

@ -511,6 +511,10 @@ ok:
}
}
DEDCheckRX(TNC);
DEDPoll(port);
DEDCheckRX(TNC);
return 0;
case 1: // poll
@ -525,9 +529,6 @@ ok:
}
}
DEDCheckRX(TNC);
DEDPoll(port);
DEDCheckRX(TNC);
for (Stream = 0; Stream <= MaxStreams; Stream++)
{

@ -153,8 +153,31 @@ static size_t ExtProc(int fn, int port, PMESSAGE buff)
}
switch (fn)
{
case 7:
if (PCAP->adhandle == 0)
{
// No handle.
if (PCAP->Adapter[0])
{
// Try reopening periodically
PCAP->pcap_reopen_delay --;
if (PCAP->pcap_reopen_delay < 0)
if (OpenPCAP(PCAP) == FALSE)
PCAP->pcap_reopen_delay = 300; // Retry every 30 seconds
}
}
return 0;
case 1: // poll
if (PCAP->adhandle == 0)
return 0;
res = pcap_next_exx(PCAP->adhandle, &header, &pkt_data);
if (res == 0)

@ -2216,6 +2216,8 @@ int TIMERINTERRUPT()
if (GetTickCount() - last100mSTickCount >= 100)
{
// 100mS has elaped
retval = 1;
last100mSTickCount = GetTickCount();

@ -21,7 +21,11 @@ struct HTTPConnectionInfo // Used for Web Server for thread-specific stuff
int KillTimer; // Clean up timer (no activity timeout)
int Stream; // BPQ Stream Number
char Key[20]; // Session Key
BOOL Connected;
uint8_t WebsockTerm; // Set if Term Session is using Websocks
uint8_t Spare1;
uint8_t Spare2;
uint8_t Spare3;
// Use by Mail Module
#ifdef MAIL
struct UserInfo * User; // Selected User
@ -41,5 +45,6 @@ struct HTTPConnectionInfo // Used for Web Server for thread-specific stuff
BOOL WebMailMyTX; // List all meessage from me
BOOL WebMailMyRX; // List all meessage to me
time_t WebMailLastUsed;
struct ConnectionInfo * sockptr;
struct TNCINFO * TNC; // Session -> TNC link
};

@ -78,6 +78,8 @@ struct ConnectionInfo
int Connecting; // For outward connect
int Connected;
struct UserRec * USER; // Telnet Server USER record - Used for Webterm
};

@ -537,15 +537,13 @@ int TrytoGuessCode(unsigned char * Char, int Len)
if (Char[n] > 127)
{
Above127++;
if (Char[n] > 178 && Char[n] < 219)
{
if (Char[n] > 175 && Char[n] < 224)
LineDraw++;
}
}
}
}
if (Above127 == 0) // DOesn't really matter!
if (Above127 == 0) // Doesn't really matter!
return 1252;
if (LineDraw > ((Above127 * 9) / 10))

Loading…
Cancel
Save

Powered by TurnKey Linux.