master 24.48a
John Wiseman 1 year ago
parent 033b8fbf8d
commit 0a458ce9e2

@ -970,7 +970,7 @@ ok:
UCHAR * data = &buffptr->Data[0]; UCHAR * data = &buffptr->Data[0];
STREAM->FramesQueued--; STREAM->FramesQueued--;
txlen = (int)buffptr->Len; txlen = (int)buffptr->Len;
STREAM->BytesTXed += txlen; STREAM->bytesTXed += txlen;
bytes=SerialSendData(TNC, data, txlen); bytes=SerialSendData(TNC, data, txlen);
WritetoTrace(TNC, data, txlen); WritetoTrace(TNC, data, txlen);

@ -812,7 +812,7 @@ VOID AEAPoll(int Port)
{ {
// Limit amount in TX // Limit amount in TX
if (TNC->Streams[0].BytesTXed - TNC->Streams[0].BytesAcked > 200) if (TNC->Streams[0].bytesTXed - TNC->Streams[0].BytesAcked > 200)
continue; continue;
// If in IRS state for too long, force turnround // If in IRS state for too long, force turnround
@ -877,8 +877,8 @@ VOID AEAPoll(int Port)
EncodeAndSend(TNC, TXMsg, datalen + 1); EncodeAndSend(TNC, TXMsg, datalen + 1);
ReleaseBuffer(buffptr); ReleaseBuffer(buffptr);
TNC->Streams[Stream].BytesTXed += datalen; TNC->Streams[Stream].bytesTXed += datalen;
Debugprintf("Stream %d Sending %d, BytesTXED now %d", Stream, datalen, TNC->Streams[Stream].BytesTXed); Debugprintf("Stream %d Sending %d, BytesTXED now %d", Stream, datalen, TNC->Streams[Stream].bytesTXed);
TNC->Timeout = 0; TNC->Timeout = 0;
TNC->DataBusy = TRUE; TNC->DataBusy = TRUE;
@ -1212,7 +1212,7 @@ static VOID ProcessAEAPacket(struct TNCINFO * TNC, UCHAR * Msg, size_t Len)
// If nothing more to send, turn round link // If nothing more to send, turn round link
if ((TNC->Streams[0].BPQtoPACTOR_Q == 0) && TNC->NeedTurnRound && if ((TNC->Streams[0].BPQtoPACTOR_Q == 0) && TNC->NeedTurnRound &&
(TNC->Streams[0].BytesAcked >= TNC->Streams[0].BytesTXed)) // Nothing following and all acked (TNC->Streams[0].BytesAcked >= TNC->Streams[0].bytesTXed)) // Nothing following and all acked
{ {
Debugprintf("AEA Sent = Acked - sending Turnround"); Debugprintf("AEA Sent = Acked - sending Turnround");
@ -1247,7 +1247,7 @@ static VOID ProcessAEAPacket(struct TNCINFO * TNC, UCHAR * Msg, size_t Len)
Len--; // Remove Header Len--; // Remove Header
buffptr->Len = Len; // Length buffptr->Len = Len; // Length
TNC->Streams[Stream].BytesRXed += (int)Len; TNC->Streams[Stream].bytesRXed += (int)Len;
memcpy(&buffptr->Data[0], Buffer, Len); memcpy(&buffptr->Data[0], Buffer, Len);
C_Q_ADD(&TNC->Streams[Stream].PACTORtoBPQ_Q, buffptr); C_Q_ADD(&TNC->Streams[Stream].PACTORtoBPQ_Q, buffptr);
@ -1418,7 +1418,7 @@ static VOID ProcessAEAPacket(struct TNCINFO * TNC, UCHAR * Msg, size_t Len)
Buffer[Len-2] = 0; Buffer[Len-2] = 0;
} }
TNC->Streams[Stream].BytesRXed = TNC->Streams[Stream].BytesTXed = TNC->Streams[Stream].BytesAcked = 0; TNC->Streams[Stream].bytesRXed = TNC->Streams[Stream].bytesTXed = TNC->Streams[Stream].BytesAcked = 0;
TNC->Streams[Stream].ConnectTime = time(NULL); TNC->Streams[Stream].ConnectTime = time(NULL);
if (Stream == 0) if (Stream == 0)

@ -314,7 +314,7 @@ void SendARDOPorPacketData(struct TNCINFO * TNC, int Stream, UCHAR * Buff, int t
if (Stream == 0) if (Stream == 0)
{ {
ARDOPSendData(TNC, Buff, txlen); ARDOPSendData(TNC, Buff, txlen);
STREAM->BytesTXed += txlen; STREAM->bytesTXed += txlen;
WritetoTrace(TNC, Buff, txlen); WritetoTrace(TNC, Buff, txlen);
} }
else else
@ -1274,7 +1274,7 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff)
UCHAR * data = &buffptr->Data[0]; UCHAR * data = &buffptr->Data[0];
STREAM->FramesQueued--; STREAM->FramesQueued--;
txlen = (int)buffptr->Len; txlen = (int)buffptr->Len;
STREAM->BytesTXed += txlen; STREAM->bytesTXed += txlen;
if (Stream == 0) if (Stream == 0)
{ {
@ -1381,7 +1381,7 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff)
{ {
bytes=ARDOPSendData(TNC, &buff->L2DATA[0], txlen); bytes=ARDOPSendData(TNC, &buff->L2DATA[0], txlen);
TNC->Streams[Stream].BytesOutstanding += bytes; // So flow control works - will be updated by BUFFER response TNC->Streams[Stream].BytesOutstanding += bytes; // So flow control works - will be updated by BUFFER response
STREAM->BytesTXed += bytes; STREAM->bytesTXed += bytes;
WritetoTrace(TNC, &buff->L2DATA[0], txlen); WritetoTrace(TNC, &buff->L2DATA[0], txlen);
} }
else else
@ -1627,6 +1627,8 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff)
ARDOPChangeMYC(TNC, TNC->Streams[0].MyCall); ARDOPChangeMYC(TNC, TNC->Streams[0].MyCall);
hookL4SessionAttempt(STREAM, &buff->L2DATA[2], TNC->Streams[0].MyCall);
// See if Busy // See if Busy
if (InterlockedCheckBusy(TNC)) if (InterlockedCheckBusy(TNC))
@ -2263,7 +2265,7 @@ VOID TNCLost(struct TNCINFO * TNC)
if (Stream == 0) if (Stream == 0)
{ {
sprintf(TNC->WEB_TRAFFIC, "Sent %d RXed %d Queued %d", sprintf(TNC->WEB_TRAFFIC, "Sent %d RXed %d Queued %d",
STREAM->BytesTXed - STREAM->BytesOutstanding, STREAM->BytesRXed, STREAM->BytesOutstanding); STREAM->bytesTXed - STREAM->BytesOutstanding, STREAM->bytesRXed, STREAM->BytesOutstanding);
MySetWindowText(TNC->xIDC_TRAFFIC, TNC->WEB_TRAFFIC); MySetWindowText(TNC->xIDC_TRAFFIC, TNC->WEB_TRAFFIC);
} }
@ -3063,7 +3065,7 @@ VOID ARDOPProcessResponse(struct TNCINFO * TNC, UCHAR * Buffer, int MsgLen)
} }
sprintf(TNC->WEB_TRAFFIC, "Sent %d RXed %d Queued %d", sprintf(TNC->WEB_TRAFFIC, "Sent %d RXed %d Queued %d",
STREAM->BytesTXed - STREAM->BytesOutstanding, STREAM->BytesRXed, STREAM->BytesOutstanding); STREAM->bytesTXed - STREAM->BytesOutstanding, STREAM->bytesRXed, STREAM->BytesOutstanding);
MySetWindowText(TNC->xIDC_TRAFFIC, TNC->WEB_TRAFFIC); MySetWindowText(TNC->xIDC_TRAFFIC, TNC->WEB_TRAFFIC);
return; return;
} }
@ -3083,7 +3085,7 @@ VOID ARDOPProcessResponse(struct TNCINFO * TNC, UCHAR * Buffer, int MsgLen)
WritetoTrace(TNC, Buffer, MsgLen - 1); WritetoTrace(TNC, Buffer, MsgLen - 1);
STREAM->ConnectTime = time(NULL); STREAM->ConnectTime = time(NULL);
STREAM->BytesRXed = STREAM->BytesTXed = STREAM->PacketsSent = 0; STREAM->bytesRXed = STREAM->bytesTXed = STREAM->PacketsSent = 0;
memcpy(Call, &Buffer[10], 10); memcpy(Call, &Buffer[10], 10);
@ -3834,12 +3836,12 @@ VOID ARDOPProcessDataPacket(struct TNCINFO * TNC, UCHAR * Type, UCHAR * Data, in
return; return;
} }
STREAM->BytesRXed += Length; STREAM->bytesRXed += Length;
Data[Length] = 0; Data[Length] = 0;
sprintf(TNC->WEB_TRAFFIC, "Sent %d RXed %d Queued %d", sprintf(TNC->WEB_TRAFFIC, "Sent %d RXed %d Queued %d",
STREAM->BytesTXed - STREAM->BytesOutstanding, STREAM->BytesRXed, STREAM->BytesOutstanding); STREAM->bytesTXed - STREAM->BytesOutstanding, STREAM->bytesRXed, STREAM->BytesOutstanding);
MySetWindowText(TNC->xIDC_TRAFFIC, TNC->WEB_TRAFFIC); MySetWindowText(TNC->xIDC_TRAFFIC, TNC->WEB_TRAFFIC);
@ -4988,7 +4990,7 @@ tcpHostFrame:
WritetoTrace(TNC, Buffer, len); WritetoTrace(TNC, Buffer, len);
STREAM->ConnectTime = time(NULL); STREAM->ConnectTime = time(NULL);
STREAM->BytesRXed = STREAM->BytesTXed = STREAM->PacketsSent = 0; STREAM->bytesRXed = STREAM->bytesTXed = STREAM->PacketsSent = 0;
memcpy(Call, &Buffer[19], 10); memcpy(Call, &Buffer[19], 10);
ptr = strchr(Call, ' '); ptr = strchr(Call, ' ');

@ -1230,8 +1230,9 @@ along with LinBPQ/BPQ32. If not, see http://www.gnu.org/licenses
// NodeAPI improvements (46) // NodeAPI improvements (46)
// Add MQTT Interface (46) // Add MQTT Interface (46)
// Fix buffer leak in ARDOP codev(46) // Fix buffer leak in ARDOP codev(46)
// Fix possilbe crash if MQTT not in use (47) // Fix possible crash if MQTT not in use (47)
// Add optional ATTACH time limit for VARA (48)
// API foramt fixes (48)
#define CKernel #define CKernel

@ -50,7 +50,7 @@
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
Optimization="0" Optimization="0"
AdditionalIncludeDirectories="..\CInclude;..\CommonSource;..\CKernel" AdditionalIncludeDirectories="..\CInclude;..\CommonSource;..\CKernel"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;BPQ32_EXPORTS;MDIKERNEL;_USE_32BIT_TIME_T;BPQ32" PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;BPQ32_EXPORTS;MDIKERNEL;_USE_32BIT_TIME_T;BPQ32;NOMQTT"
MinimalRebuild="true" MinimalRebuild="true"
BasicRuntimeChecks="3" BasicRuntimeChecks="3"
RuntimeLibrary="1" RuntimeLibrary="1"
@ -74,7 +74,7 @@
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalOptions=" /section:_BPQDATA,srw" AdditionalOptions=" /section:_BPQDATA,srw"
AdditionalDependencies="WS2_32.Lib winmm.lib DbgHelp.lib comctl32.lib Iphlpapi.lib setupapi.lib paho-mqtt3a.lib ..\lib\libconfigd.lib miniupnpc.lib zlibstat.lib" AdditionalDependencies="WS2_32.Lib winmm.lib DbgHelp.lib comctl32.lib Iphlpapi.lib setupapi.lib ..\lib\libconfigd.lib miniupnpc.lib zlibstat.lib"
OutputFile="c:\DevProgs\BPQ32\bpq32.dll" OutputFile="c:\DevProgs\BPQ32\bpq32.dll"
LinkIncremental="2" LinkIncremental="2"
IgnoreAllDefaultLibraries="false" IgnoreAllDefaultLibraries="false"
@ -159,7 +159,7 @@
Optimization="0" Optimization="0"
WholeProgramOptimization="false" WholeProgramOptimization="false"
AdditionalIncludeDirectories="..\CInclude;..\CommonSource;..\CKernel" AdditionalIncludeDirectories="..\CInclude;..\CommonSource;..\CKernel"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;BPQ32_EXPORTS;MDIKERNEL;_USE_32BIT_TIME_T" PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;BPQ32_EXPORTS;MDIKERNEL;_USE_32BIT_TIME_T;NOMQTT"
RuntimeLibrary="0" RuntimeLibrary="0"
UsePrecompiledHeader="0" UsePrecompiledHeader="0"
AssemblerOutput="2" AssemblerOutput="2"
@ -180,7 +180,7 @@
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalOptions=" /section:_BPQDATA,srw" AdditionalOptions=" /section:_BPQDATA,srw"
AdditionalDependencies="WS2_32.Lib winmm.lib comctl32.lib setupapi.lib ..\lib\libconfig.lib miniupnpc.lib zlibstat.lib DbgHelp.lib paho-mqtt3a.lib" AdditionalDependencies="WS2_32.Lib winmm.lib comctl32.lib setupapi.lib ..\lib\libconfig.lib miniupnpc.lib zlibstat.lib DbgHelp.lib"
OutputFile="C:\DevProgs\BPQ32\bpq32.dll" OutputFile="C:\DevProgs\BPQ32\bpq32.dll"
LinkIncremental="1" LinkIncremental="1"
IgnoreDefaultLibraryNames="" IgnoreDefaultLibraryNames=""

@ -441,4 +441,7 @@ DllExport uint64_t APIENTRY GetPortFrequency(int PortNo, char * FreqStringMhz);
void hookL2SessionAccepted(int Port, char * remotecall, char * ourcall, struct _LINKTABLE * LINK); void hookL2SessionAccepted(int Port, char * remotecall, char * ourcall, struct _LINKTABLE * LINK);
void hookL2SessionDeleted(struct _LINKTABLE * LINK); void hookL2SessionDeleted(struct _LINKTABLE * LINK);
void hookL2SessionAttempt(int Port, char * ourcall, char * remotecall, struct _LINKTABLE * LINK); void hookL2SessionAttempt(int Port, char * ourcall, char * remotecall, struct _LINKTABLE * LINK);
void hookL4SessionAttempt(void * STREAM, char * remotecall, char * ourcall);
void hookL4SessionAccepted(void * STREAM, char * remotecall, char * ourcall);
void hookL4SessionDeleted(struct TNCINFO * TNC, void * STREAM); void hookL4SessionDeleted(struct TNCINFO * TNC, void * STREAM);

@ -906,6 +906,7 @@ BOOL ProcessIncommingConnectEx(struct TNCINFO * TNC, char * Call, int Stream, BO
int Totallen = 0; int Totallen = 0;
UCHAR * ptr; UCHAR * ptr;
struct PORTCONTROL * PORT = (struct PORTCONTROL *)TNC->PortRecord; struct PORTCONTROL * PORT = (struct PORTCONTROL *)TNC->PortRecord;
struct STREAMINFO * STREAM = &TNC->Streams[Stream];
// Stop Scanner // Stop Scanner
@ -938,7 +939,11 @@ BOOL ProcessIncommingConnectEx(struct TNCINFO * TNC, char * Call, int Stream, BO
memset(Session, 0, sizeof(TRANSPORTENTRY)); memset(Session, 0, sizeof(TRANSPORTENTRY));
memcpy(TNC->Streams[Stream].RemoteCall, Call, 9); // Save Text Callsign memcpy(STREAM->RemoteCall, Call, 9); // Save Text Callsign
// May be subsequently rejected but a good place to capture calls
hookL4SessionAccepted(STREAM, Call, TNC->TargetCall);
if (AllowTR) if (AllowTR)
ConvToAX25Ex(Call, Session->L4USER); // Allow -T and -R SSID's for MPS ConvToAX25Ex(Call, Session->L4USER); // Allow -T and -R SSID's for MPS
@ -951,7 +956,7 @@ BOOL ProcessIncommingConnectEx(struct TNCINFO * TNC, char * Call, int Stream, BO
if (NEXTID == 0) NEXTID++; // Keep non-zero if (NEXTID == 0) NEXTID++; // Keep non-zero
TNC->PortRecord->ATTACHEDSESSIONS[Stream] = Session; TNC->PortRecord->ATTACHEDSESSIONS[Stream] = Session;
TNC->Streams[Stream].Attached = TRUE; STREAM->Attached = TRUE;
Session->L4TARGET.EXTPORT = TNC->PortRecord; Session->L4TARGET.EXTPORT = TNC->PortRecord;
@ -962,7 +967,7 @@ BOOL ProcessIncommingConnectEx(struct TNCINFO * TNC, char * Call, int Stream, BO
Session->SESSPACLEN = TNC->PortRecord->PORTCONTROL.PORTPACLEN; Session->SESSPACLEN = TNC->PortRecord->PORTCONTROL.PORTPACLEN;
Session->KAMSESSION = Stream; Session->KAMSESSION = Stream;
TNC->Streams[Stream].Connected = TRUE; // Subsequent data to data channel STREAM->Connected = TRUE; // Subsequent data to data channel
if (LogAllConnects) if (LogAllConnects)
{ {

@ -181,6 +181,29 @@ void hookL2SessionAttempt(int Port, char * ourcall, char * remotecall, struct _L
strcpy(LINK->Direction, "Out"); strcpy(LINK->Direction, "Out");
} }
void hookL4SessionAttempt(struct STREAMINFO * STREAM, char * remotecall, char * ourcall)
{
// Outgoing Connect
STREAM->ConnectTime = time(NULL);
STREAM->bytesTXed = STREAM->bytesRXed = 0;
strcpy(STREAM->callingCall, ourcall);
strcpy(STREAM->receivingCall, remotecall);
strcpy(STREAM->Direction, "Out");
}
void hookL4SessionAccepted(struct STREAMINFO * STREAM, char * remotecall, char * ourcall)
{
// Incoming Connect
STREAM->ConnectTime = time(NULL);
STREAM->bytesTXed = STREAM->bytesRXed = 0;
strcpy(STREAM->callingCall, remotecall);
strcpy(STREAM->receivingCall, ourcall);
strcpy(STREAM->Direction, "In");
}
void hookL4SessionDeleted(struct TNCINFO * TNC, struct STREAMINFO * STREAM) void hookL4SessionDeleted(struct TNCINFO * TNC, struct STREAMINFO * STREAM)
{ {
@ -191,8 +214,8 @@ void hookL4SessionDeleted(struct TNCINFO * TNC, struct STREAMINFO * STREAM)
if (STREAM->ConnectTime) if (STREAM->ConnectTime)
{ {
time_t sessionTime = time(NULL) - STREAM->ConnectTime; time_t sessionTime = time(NULL) - STREAM->ConnectTime;
double avBytesRXed = STREAM->BytesRXed / (sessionTime / 60.0); double avBytesRXed = STREAM->bytesRXed / (sessionTime / 60.0);
double avBytesSent = STREAM->BytesTXed / (sessionTime / 60.0); double avBytesSent = STREAM->bytesTXed / (sessionTime / 60.0);
time_t Now = time(NULL); time_t Now = time(NULL);
struct tm * TM = localtime(&Now); struct tm * TM = localtime(&Now);
sprintf(timestamp, "%02d:%02d:%02d", TM->tm_hour, TM->tm_min, TM->tm_sec); sprintf(timestamp, "%02d:%02d:%02d", TM->tm_hour, TM->tm_min, TM->tm_sec);
@ -200,10 +223,10 @@ void hookL4SessionDeleted(struct TNCINFO * TNC, struct STREAMINFO * STREAM)
if (sessionTime == 0) if (sessionTime == 0)
sessionTime = 1; // Or will get divide by zero error sessionTime = 1; // Or will get divide by zero error
sprintf(Msg, "{\"mode\": \"%s\", \"port\": %d, \"callfrom\": \"%s\", \"callto\": \"%s\", \"time\": %d, \"bytesSent\": %d," sprintf(Msg, "{\"mode\": \"%s\", \"direction\": \"%s\", \"port\": %d, \"callfrom\": \"%s\", \"callto\": \"%s\", \"time\": %d, \"bytesSent\": %d,"
"\"BPMSent\": %4.2f, \"BytesReceived\": %d, \"BPMRECEIVED\": %4.2f, \"timestamp\": \"%s\"}", "\"BPMSent\": %4.2f, \"BytesReceived\": %d, \"BPMReceived\": %4.2f, \"timestamp\": \"%s\"}",
Modenames[TNC->Hardware - 1], TNC->Port, STREAM->MyCall, STREAM->RemoteCall, sessionTime, Modenames[TNC->Hardware - 1], STREAM->Direction, TNC->Port, STREAM->callingCall, STREAM->receivingCall, sessionTime,
STREAM->BytesTXed, avBytesSent, STREAM->BytesRXed, avBytesRXed, timestamp); STREAM->bytesTXed, avBytesSent, STREAM->bytesRXed, avBytesRXed, timestamp);
if (MQTT) if (MQTT)
MQTTReportSession(Msg); MQTTReportSession(Msg);

@ -1637,7 +1637,7 @@ static VOID ConnecttoFLDigiThread(void * portptr)
VOID UpdateStatsLine(struct TNCINFO * TNC, struct STREAMINFO * STREAM) VOID UpdateStatsLine(struct TNCINFO * TNC, struct STREAMINFO * STREAM)
{ {
sprintf(TNC->WEB_TRAFFIC, "RX %d TX %d ACKED %d Resent %d Queued %d", sprintf(TNC->WEB_TRAFFIC, "RX %d TX %d ACKED %d Resent %d Queued %d",
STREAM->BytesRXed, STREAM->BytesTXed, STREAM->BytesAcked, STREAM->BytesResent, STREAM->BytesOutstanding); STREAM->bytesRXed, STREAM->bytesTXed, STREAM->BytesAcked, STREAM->BytesResent, STREAM->BytesOutstanding);
SetWindowText(TNC->xIDC_TRAFFIC, TNC->WEB_TRAFFIC); SetWindowText(TNC->xIDC_TRAFFIC, TNC->WEB_TRAFFIC);
} }
@ -2531,7 +2531,7 @@ VOID ProcessFLDigiData(struct TNCINFO * TNC, UCHAR * Input, int Len, char Channe
strcpy(STREAM->MyCall, call2); strcpy(STREAM->MyCall, call2);
STREAM->ConnectTime = time(NULL); STREAM->ConnectTime = time(NULL);
STREAM->BytesRXed = STREAM->BytesTXed = STREAM->BytesAcked = STREAM->BytesResent = 0; STREAM->bytesRXed = STREAM->bytesTXed = STREAM->BytesAcked = STREAM->BytesResent = 0;
if (TNC->RIG && TNC->RIG != &TNC->DummyRig && strcmp(TNC->RIG->RigName, "PTT")) if (TNC->RIG && TNC->RIG != &TNC->DummyRig && strcmp(TNC->RIG->RigName, "PTT"))
{ {
@ -2690,7 +2690,7 @@ AckConnectRequest:
goto SendKReply; // Repeated ACK goto SendKReply; // Repeated ACK
STREAM->ConnectTime = time(NULL); STREAM->ConnectTime = time(NULL);
STREAM->BytesRXed = STREAM->BytesTXed = STREAM->BytesAcked = STREAM->BytesResent = 0; STREAM->bytesRXed = STREAM->bytesTXed = STREAM->BytesAcked = STREAM->BytesResent = 0;
STREAM->Connected = TRUE; STREAM->Connected = TRUE;
ARQ->ARQTimerState = 0; ARQ->ARQTimerState = 0;
@ -3014,7 +3014,7 @@ SendKReply:
buffptr->Len = Len; buffptr->Len = Len;
memcpy(buffptr->Data, &Input[1], Len); memcpy(buffptr->Data, &Input[1], Len);
STREAM->BytesRXed += Len; STREAM->bytesRXed += Len;
UpdateStatsLine(TNC, STREAM); UpdateStatsLine(TNC, STREAM);
@ -3131,7 +3131,7 @@ VOID SendARQData(struct TNCINFO * TNC, PMSGWITHLEN Buffer)
ARQ->TXHOLDQ[ARQ->TXSeq] = Buffer; ARQ->TXHOLDQ[ARQ->TXSeq] = Buffer;
STREAM->BytesTXed += Origlen; STREAM->bytesTXed += Origlen;
UpdateStatsLine(TNC, STREAM); UpdateStatsLine(TNC, STREAM);

@ -971,7 +971,7 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff)
memset(STREAM->RemoteCall, 0, 10); memset(STREAM->RemoteCall, 0, 10);
strcpy(STREAM->RemoteCall, &buff->L2DATA[2]); strcpy(STREAM->RemoteCall, &buff->L2DATA[2]);
STREAM->ConnectTime = time(NULL); STREAM->ConnectTime = time(NULL);
STREAM->BytesRXed = STREAM->BytesTXed = STREAM->PacketsSent = 0; STREAM->bytesRXed = STREAM->bytesTXed = STREAM->PacketsSent = 0;
sprintf(TNC->WEB_TNCSTATE, "%s Connecting to %s", STREAM->MyCall, STREAM->RemoteCall); sprintf(TNC->WEB_TNCSTATE, "%s Connecting to %s", STREAM->MyCall, STREAM->RemoteCall);
MySetWindowText(TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE); MySetWindowText(TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
@ -1950,7 +1950,7 @@ VOID FreeDataProcessTNCMessage(struct TNCINFO * TNC, char * Call, unsigned char
MySetWindowText(TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE); MySetWindowText(TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
STREAM->ConnectTime = time(NULL); STREAM->ConnectTime = time(NULL);
STREAM->BytesRXed = STREAM->BytesTXed = STREAM->PacketsSent = 0; STREAM->bytesRXed = STREAM->bytesTXed = STREAM->PacketsSent = 0;
STREAM->Connected = TRUE; STREAM->Connected = TRUE;
// Send Connect ACK // Send Connect ACK
@ -2049,7 +2049,7 @@ VOID FreeDataProcessTNCMessage(struct TNCINFO * TNC, char * Call, unsigned char
WritetoTrace(TNC, Msg, 256); WritetoTrace(TNC, Msg, 256);
Len -= 256; Len -= 256;
Msg += 256; Msg += 256;
STREAM->BytesRXed += 256; STREAM->bytesRXed += 256;
} }
@ -2058,9 +2058,9 @@ VOID FreeDataProcessTNCMessage(struct TNCINFO * TNC, char * Call, unsigned char
memcpy(buffptr->Data, Msg, Len); memcpy(buffptr->Data, Msg, Len);
C_Q_ADD(&STREAM->PACTORtoBPQ_Q, buffptr); C_Q_ADD(&STREAM->PACTORtoBPQ_Q, buffptr);
WritetoTrace(TNC, Msg, Len); WritetoTrace(TNC, Msg, Len);
STREAM->BytesRXed += Len; STREAM->bytesRXed += Len;
sprintf(TNC->WEB_TRAFFIC, "Sent %d RXed %d Queued %d", sprintf(TNC->WEB_TRAFFIC, "Sent %d RXed %d Queued %d",
STREAM->BytesTXed - TNC->FreeDataInfo->toSendCount, STREAM->BytesRXed, TNC->FreeDataInfo->toSendCount); STREAM->bytesTXed - TNC->FreeDataInfo->toSendCount, STREAM->bytesRXed, TNC->FreeDataInfo->toSendCount);
MySetWindowText(TNC->xIDC_TRAFFIC, TNC->WEB_TRAFFIC); MySetWindowText(TNC->xIDC_TRAFFIC, TNC->WEB_TRAFFIC);
return; return;
@ -2313,7 +2313,7 @@ VOID FreeDataProcessNewConnect(struct TNCINFO * TNC, char * fromCall, char * toC
MySetWindowText(TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE); MySetWindowText(TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
STREAM->ConnectTime = time(NULL); STREAM->ConnectTime = time(NULL);
STREAM->BytesRXed = STREAM->BytesTXed = STREAM->PacketsSent = 0; STREAM->bytesRXed = STREAM->bytesTXed = STREAM->PacketsSent = 0;
STREAM->Connected = TRUE; STREAM->Connected = TRUE;
return; return;
@ -2413,7 +2413,7 @@ void FlushData(struct TNCINFO * TNC)
Info->toSendTimeout = 0; Info->toSendTimeout = 0;
sprintf(TNC->WEB_TRAFFIC, "Sent %d RXed %d Queued %d", sprintf(TNC->WEB_TRAFFIC, "Sent %d RXed %d Queued %d",
STREAM->BytesTXed - TNC->FreeDataInfo->toSendCount, STREAM->BytesRXed, TNC->FreeDataInfo->toSendCount); STREAM->bytesTXed - TNC->FreeDataInfo->toSendCount, STREAM->bytesRXed, TNC->FreeDataInfo->toSendCount);
MySetWindowText(TNC->xIDC_TRAFFIC, TNC->WEB_TRAFFIC); MySetWindowText(TNC->xIDC_TRAFFIC, TNC->WEB_TRAFFIC);
} }
@ -2436,10 +2436,10 @@ static int SendAsFile(struct TNCINFO * TNC, char * Call, char * Msg, int Len)
Info->toSendCount += Len; Info->toSendCount += Len;
Info->toSendTimeout = 10; // About a second Info->toSendTimeout = 10; // About a second
STREAM->BytesTXed += Len; STREAM->bytesTXed += Len;
sprintf(TNC->WEB_TRAFFIC, "Sent %d RXed %d Queued %d", sprintf(TNC->WEB_TRAFFIC, "Sent %d RXed %d Queued %d",
STREAM->BytesTXed - TNC->FreeDataInfo->toSendCount, STREAM->BytesRXed, TNC->FreeDataInfo->toSendCount); STREAM->bytesTXed - TNC->FreeDataInfo->toSendCount, STREAM->bytesRXed, TNC->FreeDataInfo->toSendCount);
MySetWindowText(TNC->xIDC_TRAFFIC, TNC->WEB_TRAFFIC); MySetWindowText(TNC->xIDC_TRAFFIC, TNC->WEB_TRAFFIC);
return Len; return Len;
@ -2706,7 +2706,7 @@ void ProcessMessageObject(struct TNCINFO * TNC, char * This)
WritetoTrace(TNC, Line, 256); WritetoTrace(TNC, Line, 256);
Len -= 256; Len -= 256;
Line += 256; Line += 256;
STREAM->BytesRXed += 256; STREAM->bytesRXed += 256;
} }
buffptr = GetBuff(); buffptr = GetBuff();
@ -2714,12 +2714,12 @@ void ProcessMessageObject(struct TNCINFO * TNC, char * This)
memcpy(buffptr->Data, Line, Len); memcpy(buffptr->Data, Line, Len);
C_Q_ADD(&STREAM->PACTORtoBPQ_Q, buffptr); C_Q_ADD(&STREAM->PACTORtoBPQ_Q, buffptr);
WritetoTrace(TNC, Line, Len); WritetoTrace(TNC, Line, Len);
STREAM->BytesRXed += Len; STREAM->bytesRXed += Len;
} }
sprintf(TNC->WEB_TRAFFIC, "Sent %d RXed %d Queued %d", sprintf(TNC->WEB_TRAFFIC, "Sent %d RXed %d Queued %d",
STREAM->BytesTXed - TNC->FreeDataInfo->toSendCount, STREAM->BytesRXed, TNC->FreeDataInfo->toSendCount); STREAM->bytesTXed - TNC->FreeDataInfo->toSendCount, STREAM->bytesRXed, TNC->FreeDataInfo->toSendCount);
MySetWindowText(TNC->xIDC_TRAFFIC, TNC->WEB_TRAFFIC); MySetWindowText(TNC->xIDC_TRAFFIC, TNC->WEB_TRAFFIC);
} }
return; return;
@ -2798,7 +2798,7 @@ void ProcessMessageObject(struct TNCINFO * TNC, char * This)
WritetoTrace(TNC, Line, 256); WritetoTrace(TNC, Line, 256);
Len -= 256; Len -= 256;
TEXT += 256; TEXT += 256;
STREAM->BytesRXed += 256; STREAM->bytesRXed += 256;
} }
buffptr = GetBuff(); buffptr = GetBuff();
@ -2806,14 +2806,14 @@ void ProcessMessageObject(struct TNCINFO * TNC, char * This)
memcpy(buffptr->Data, Line, Len); memcpy(buffptr->Data, Line, Len);
C_Q_ADD(&STREAM->PACTORtoBPQ_Q, buffptr); C_Q_ADD(&STREAM->PACTORtoBPQ_Q, buffptr);
WritetoTrace(TNC, Line, Len); WritetoTrace(TNC, Line, Len);
STREAM->BytesRXed += Len; STREAM->bytesRXed += Len;
TEXT = rest; TEXT = rest;
rest = strlop(TEXT, 10); // FreeData chat ues LF rest = strlop(TEXT, 10); // FreeData chat ues LF
} }
sprintf(TNC->WEB_TRAFFIC, "Sent %d RXed %d Queued %d", sprintf(TNC->WEB_TRAFFIC, "Sent %d RXed %d Queued %d",
STREAM->BytesTXed - TNC->FreeDataInfo->toSendCount, STREAM->BytesRXed, TNC->FreeDataInfo->toSendCount); STREAM->bytesTXed - TNC->FreeDataInfo->toSendCount, STREAM->bytesRXed, TNC->FreeDataInfo->toSendCount);
MySetWindowText(TNC->xIDC_TRAFFIC, TNC->WEB_TRAFFIC); MySetWindowText(TNC->xIDC_TRAFFIC, TNC->WEB_TRAFFIC);
} }
} }

@ -749,7 +749,7 @@ VOID HALPoll(int Port)
STREAM->Attached = TRUE; STREAM->Attached = TRUE;
STREAM->BytesRXed = STREAM->BytesTXed = STREAM->BytesAcked = 0; STREAM->bytesRXed = STREAM->bytesTXed = STREAM->BytesAcked = 0;
calllen = ConvFromAX25(TNC->PortRecord->ATTACHEDSESSIONS[0]->L4USER, STREAM->MyCall); calllen = ConvFromAX25(TNC->PortRecord->ATTACHEDSESSIONS[0]->L4USER, STREAM->MyCall);
STREAM->MyCall[calllen] = 0; STREAM->MyCall[calllen] = 0;
@ -829,7 +829,7 @@ VOID HALPoll(int Port)
//for (Stream = 0; Stream <= MaxStreams; Stream++) //for (Stream = 0; Stream <= MaxStreams; Stream++)
{ {
if (TNC->TNCOK && STREAM->BPQtoPACTOR_Q && (STREAM->BytesTXed - STREAM->BytesAcked < 600)) if (TNC->TNCOK && STREAM->BPQtoPACTOR_Q && (STREAM->bytesTXed - STREAM->BytesAcked < 600))
{ {
int datalen; int datalen;
PMSGWITHLEN buffptr; PMSGWITHLEN buffptr;
@ -872,7 +872,7 @@ VOID HALPoll(int Port)
ReleaseBuffer(buffptr); ReleaseBuffer(buffptr);
WriteLogLine(2, MsgPtr, datalen); WriteLogLine(2, MsgPtr, datalen);
STREAM->BytesTXed += datalen; STREAM->bytesTXed += datalen;
STREAM->FramesQueued--; STREAM->FramesQueued--;
ShowTraffic(TNC); ShowTraffic(TNC);
@ -1090,10 +1090,10 @@ VOID ProcessHALData(struct TNCINFO * TNC)
STREAM->BytesAcked += Len; STREAM->BytesAcked += Len;
// Debugprintf("Acked %d", Len); // Debugprintf("Acked %d", Len);
if (STREAM->BytesAcked > STREAM->BytesTXed) if (STREAM->BytesAcked > STREAM->bytesTXed)
Debugprintf("Too Much Acked"); Debugprintf("Too Much Acked");
if ((STREAM->BPQtoPACTOR_Q == 0) && STREAM->BytesAcked >= STREAM->BytesTXed) if ((STREAM->BPQtoPACTOR_Q == 0) && STREAM->BytesAcked >= STREAM->bytesTXed)
{ {
// All sent // All sent
@ -1121,7 +1121,7 @@ VOID ProcessHALData(struct TNCINFO * TNC)
WriteLogLine(1, TNC->DataBuffer, Len); WriteLogLine(1, TNC->DataBuffer, Len);
STREAM->BytesRXed += Len; STREAM->bytesRXed += Len;
memcpy(buffptr->Data, TNC->DataBuffer, Len); memcpy(buffptr->Data, TNC->DataBuffer, Len);
@ -1756,7 +1756,7 @@ BOOL HALConnected(struct TNCINFO * TNC, char * Call)
strcpy(CallCopy, Call); strcpy(CallCopy, Call);
strcat(CallCopy, " "); // Some routines expect 10 char calls strcat(CallCopy, " "); // Some routines expect 10 char calls
STREAM->BytesRXed = STREAM->BytesTXed = STREAM->BytesAcked = 0; STREAM->bytesRXed = STREAM->bytesTXed = STREAM->BytesAcked = 0;
STREAM->ConnectTime = time(NULL); STREAM->ConnectTime = time(NULL);
// Stop Scanner // Stop Scanner
@ -1804,7 +1804,7 @@ BOOL HALConnected(struct TNCINFO * TNC, char * Call)
EncodeAndSend(TNC, CTEXTMSG, CTEXTLEN); EncodeAndSend(TNC, CTEXTMSG, CTEXTLEN);
WriteLogLine(2, CTEXTMSG, CTEXTLEN); WriteLogLine(2, CTEXTMSG, CTEXTLEN);
STREAM->BytesTXed += CTEXTLEN; STREAM->bytesTXed += CTEXTLEN;
} }
return TRUE; return TRUE;
} }

@ -1602,7 +1602,7 @@ VOID ShowTraffic(struct TNCINFO * TNC)
char Status[80]; char Status[80];
sprintf(Status, "RX %d TX %d ACKED %d ", sprintf(Status, "RX %d TX %d ACKED %d ",
TNC->Streams[0].BytesRXed, TNC->Streams[0].BytesTXed, TNC->Streams[0].BytesAcked); TNC->Streams[0].bytesRXed, TNC->Streams[0].bytesTXed, TNC->Streams[0].BytesAcked);
#ifndef LINBPQ #ifndef LINBPQ
SetDlgItemText(TNC->hDlg, IDC_TRAFFIC, Status); SetDlgItemText(TNC->hDlg, IDC_TRAFFIC, Status);
#endif #endif

@ -589,7 +589,7 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff)
UCHAR * data = &buffptr->Data[0]; UCHAR * data = &buffptr->Data[0];
STREAM->FramesQueued--; STREAM->FramesQueued--;
txlen = (int)buffptr->Len; txlen = (int)buffptr->Len;
STREAM->BytesTXed += txlen; STREAM->bytesTXed += txlen;
bytes=HSMODEMSendData(TNC, data, txlen); bytes=HSMODEMSendData(TNC, data, txlen);
WritetoTrace(TNC, data, txlen); WritetoTrace(TNC, data, txlen);
@ -668,7 +668,7 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff)
bytes=HSMODEMSendData(TNC, TXMsg, txlen); bytes=HSMODEMSendData(TNC, TXMsg, txlen);
TNC->Streams[Stream].BytesOutstanding += bytes; // So flow control works - will be updated by BUFFER response TNC->Streams[Stream].BytesOutstanding += bytes; // So flow control works - will be updated by BUFFER response
STREAM->BytesTXed += bytes; STREAM->bytesTXed += bytes;
// WritetoTrace(TNC, &buff->L2DATA[0], txlen); // WritetoTrace(TNC, &buff->L2DATA[0], txlen);
return 1; return 1;

@ -1099,7 +1099,7 @@ VOID KAMPoll(int Port)
// Limit amount in TX, so we keep some on the TX Q and don't send turnround too early // Limit amount in TX, so we keep some on the TX Q and don't send turnround too early
if (TNC->Streams[0].BytesTXed - TNC->Streams[0].BytesAcked > 200) if (TNC->Streams[0].bytesTXed - TNC->Streams[0].BytesAcked > 200)
continue; continue;
// Dont send if IRS State // Dont send if IRS State
@ -1132,7 +1132,7 @@ VOID KAMPoll(int Port)
} }
Next = 0; Next = 0;
STREAM->BytesTXed += datalen; STREAM->bytesTXed += datalen;
if (Stream == 0) if (Stream == 0)
{ {
@ -1157,7 +1157,7 @@ VOID KAMPoll(int Port)
if (Stream == 0) if (Stream == 0)
{ {
sprintf(Status, "RX %d TX %d ACKED %d ", sprintf(Status, "RX %d TX %d ACKED %d ",
TNC->Streams[0].BytesRXed, TNC->Streams[0].BytesTXed, TNC->Streams[0].BytesAcked); TNC->Streams[0].bytesRXed, TNC->Streams[0].bytesTXed, TNC->Streams[0].BytesAcked);
SetWindowText(TNC->xIDC_TRAFFIC, Status); SetWindowText(TNC->xIDC_TRAFFIC, Status);
if ((TNC->HFPacket == 0) && (TNC->Streams[0].BPQtoPACTOR_Q == 0)) // Nothing following if ((TNC->HFPacket == 0) && (TNC->Streams[0].BPQtoPACTOR_Q == 0)) // Nothing following
@ -1532,14 +1532,14 @@ VOID ProcessKHOSTPacket(struct TNCINFO * TNC, UCHAR * Msg, int Len)
{ {
if (Msg[1] == '2') // HF Port if (Msg[1] == '2') // HF Port
{ {
if (TNC->Streams[0].BytesTXed) if (TNC->Streams[0].bytesTXed)
TNC->Streams[0].BytesAcked += Len - 3; // We get an ack before the first send TNC->Streams[0].BytesAcked += Len - 3; // We get an ack before the first send
sprintf(Status, "RX %d TX %d ACKED %d ", sprintf(Status, "RX %d TX %d ACKED %d ",
TNC->Streams[0].BytesRXed, TNC->Streams[0].BytesTXed, TNC->Streams[0].BytesAcked); TNC->Streams[0].bytesRXed, TNC->Streams[0].bytesTXed, TNC->Streams[0].BytesAcked);
SetWindowText(TNC->xIDC_TRAFFIC, Status); SetWindowText(TNC->xIDC_TRAFFIC, Status);
if (TNC->Streams[0].BytesTXed - TNC->Streams[0].BytesAcked < 500) if (TNC->Streams[0].bytesTXed - TNC->Streams[0].BytesAcked < 500)
TNC->Streams[0].FramesOutstanding = 0; TNC->Streams[0].FramesOutstanding = 0;
} }
return; return;
@ -1555,7 +1555,7 @@ VOID ProcessKHOSTPacket(struct TNCINFO * TNC, UCHAR * Msg, int Len)
Len-=3; // Remove Header Len-=3; // Remove Header
buffptr->Len = Len; // Length buffptr->Len = Len; // Length
STREAM->BytesRXed += Len; STREAM->bytesRXed += Len;
memcpy(buffptr->Data, Buffer, Len); memcpy(buffptr->Data, Buffer, Len);
C_Q_ADD(&STREAM->PACTORtoBPQ_Q, buffptr); C_Q_ADD(&STREAM->PACTORtoBPQ_Q, buffptr);
@ -1563,7 +1563,7 @@ VOID ProcessKHOSTPacket(struct TNCINFO * TNC, UCHAR * Msg, int Len)
if (Stream == 0) if (Stream == 0)
{ {
sprintf(TNC->WEB_TRAFFIC, "RX %d TX %d ACKED %d ", sprintf(TNC->WEB_TRAFFIC, "RX %d TX %d ACKED %d ",
TNC->Streams[0].BytesRXed, TNC->Streams[0].BytesTXed, TNC->Streams[0].BytesAcked); TNC->Streams[0].bytesRXed, TNC->Streams[0].bytesTXed, TNC->Streams[0].BytesAcked);
SetWindowText(TNC->xIDC_TRAFFIC, TNC->WEB_TRAFFIC); SetWindowText(TNC->xIDC_TRAFFIC, TNC->WEB_TRAFFIC);
} }
@ -1762,7 +1762,7 @@ VOID ProcessKHOSTPacket(struct TNCINFO * TNC, UCHAR * Msg, int Len)
Buffer[Len-4] = 0; Buffer[Len-4] = 0;
} }
STREAM->BytesRXed = STREAM->BytesTXed = STREAM->BytesAcked = 0; STREAM->bytesRXed = STREAM->bytesTXed = STREAM->BytesAcked = 0;
STREAM->ConnectTime = time(NULL); STREAM->ConnectTime = time(NULL);
if (Stream == 0) if (Stream == 0)
@ -1776,7 +1776,7 @@ VOID ProcessKHOSTPacket(struct TNCINFO * TNC, UCHAR * Msg, int Len)
Rig_Command( (TRANSPORTENTRY *) -1, Msg); Rig_Command( (TRANSPORTENTRY *) -1, Msg);
sprintf(TNC->WEB_TRAFFIC, "RX %d TX %d ACKED %d ", sprintf(TNC->WEB_TRAFFIC, "RX %d TX %d ACKED %d ",
TNC->Streams[0].BytesRXed, TNC->Streams[0].BytesTXed, TNC->Streams[0].BytesAcked); TNC->Streams[0].bytesRXed, TNC->Streams[0].bytesTXed, TNC->Streams[0].BytesAcked);
SetWindowText(TNC->xIDC_TRAFFIC, TNC->WEB_TRAFFIC); SetWindowText(TNC->xIDC_TRAFFIC, TNC->WEB_TRAFFIC);
} }
@ -1874,7 +1874,7 @@ VOID ProcessKHOSTPacket(struct TNCINFO * TNC, UCHAR * Msg, int Len)
memcpy(&CTBuff[3], &CTEXTMSG[Next], Len); memcpy(&CTBuff[3], &CTEXTMSG[Next], Len);
EncodeAndSend(TNC, CTBuff, Len + 3); EncodeAndSend(TNC, CTBuff, Len + 3);
EncodeAndSend(TNC, "E", 1); // Changeover when all sent EncodeAndSend(TNC, "E", 1); // Changeover when all sent
TNC->Streams[0].BytesTXed += CTEXTLEN; TNC->Streams[0].bytesTXed += CTEXTLEN;
} }
return; return;

@ -358,7 +358,7 @@ ok:
UCHAR * data = &buffptr->Data[0]; UCHAR * data = &buffptr->Data[0];
STREAM->FramesQueued--; STREAM->FramesQueued--;
txlen = (int)buffptr->Len; txlen = (int)buffptr->Len;
STREAM->BytesTXed += txlen; STREAM->bytesTXed += txlen;
bytes=SerialSendData(TNC, data, txlen); bytes=SerialSendData(TNC, data, txlen);
WritetoTrace(TNC, data, txlen); WritetoTrace(TNC, data, txlen);

@ -1288,6 +1288,10 @@ int main(int argc, char * argv[])
AGWActive = AGWAPIInit(); AGWActive = AGWAPIInit();
if (Redirected == 0)
ConTerm.BPQStream = FindFreeStream();
#ifndef WIN32 #ifndef WIN32
for (i = 1; i < argc; i++) for (i = 1; i < argc; i++)

File diff suppressed because it is too large Load Diff

@ -1317,7 +1317,7 @@ VOID ProcessMSPKData(struct TNCINFO * TNC)
C_Q_ADD(&STREAM->PACTORtoBPQ_Q, buffptr); C_Q_ADD(&STREAM->PACTORtoBPQ_Q, buffptr);
STREAM->BytesRXed += TNC->DataLen; STREAM->bytesRXed += TNC->DataLen;
} }
TNC->DataLen = 0; TNC->DataLen = 0;
@ -1387,7 +1387,7 @@ DataLoop:
STREAM->Connected = TRUE; STREAM->Connected = TRUE;
STREAM->Connecting = FALSE; STREAM->Connecting = FALSE;
STREAM->ConnectTime = time(NULL); STREAM->ConnectTime = time(NULL);
STREAM->BytesRXed = STREAM->BytesTXed = 0; STREAM->bytesRXed = STREAM->bytesTXed = 0;
buffptr = GetBuff(); buffptr = GetBuff();
if (buffptr) if (buffptr)
@ -1402,7 +1402,7 @@ DataLoop:
STREAM->Connected = TRUE; STREAM->Connected = TRUE;
STREAM->ConnectTime = time(NULL); STREAM->ConnectTime = time(NULL);
STREAM->BytesRXed = STREAM->BytesTXed = 0; STREAM->bytesRXed = STREAM->bytesTXed = 0;
UpdateMH(TNC, CallFrom, '+', 'I'); UpdateMH(TNC, CallFrom, '+', 'I');
@ -1483,7 +1483,7 @@ VOID SendData(struct TNCINFO * TNC, char * Msg, int MsgLen)
char * inptr = Msg; char * inptr = Msg;
SOCKET sock = TNCInfo[MasterPort[TNC->Port]]->TCPSock; SOCKET sock = TNCInfo[MasterPort[TNC->Port]]->TCPSock;
TNC->Streams[0].BytesTXed += MsgLen; TNC->Streams[0].bytesTXed += MsgLen;
for (n = 0; n < MsgLen; n++) for (n = 0; n < MsgLen; n++)
{ {

@ -41,7 +41,7 @@
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
Optimization="0" Optimization="0"
AdditionalIncludeDirectories="..\CKernel;..\CommonSource;..\CInclude" AdditionalIncludeDirectories="..\CKernel;..\CommonSource;..\CInclude"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;LINBPQ;_USE_32BIT_TIME_T" PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;LINBPQ;_USE_32BIT_TIME_T;NOMQTT"
MinimalRebuild="true" MinimalRebuild="true"
BasicRuntimeChecks="3" BasicRuntimeChecks="3"
RuntimeLibrary="1" RuntimeLibrary="1"
@ -456,6 +456,10 @@
RelativePath="..\CommonSource\Moncode.c" RelativePath="..\CommonSource\Moncode.c"
> >
</File> </File>
<File
RelativePath=".\mqtt.c"
>
</File>
<File <File
RelativePath="..\CommonSource\Multicast.c" RelativePath="..\CommonSource\Multicast.c"
> >

@ -1972,7 +1972,7 @@ VOID SCSPoll(int Port)
} }
Poll[3] = 0; // Data? Poll[3] = 0; // Data?
TNC->Streams[Stream].BytesTXed += datalen; TNC->Streams[Stream].bytesTXed += datalen;
Poll[4] = datalen - 1; Poll[4] = datalen - 1;
memcpy(&Poll[5], Buffer, datalen); memcpy(&Poll[5], Buffer, datalen);
@ -2324,7 +2324,7 @@ void SCSTryToSendDATA(struct TNCINFO * TNC, int Stream)
} }
Poll[3] = 0; // Data Poll[3] = 0; // Data
STREAM->BytesTXed += datalen; STREAM->bytesTXed += datalen;
Poll[4] = datalen - 1; Poll[4] = datalen - 1;
memcpy(&Poll[5], Buffer, datalen); memcpy(&Poll[5], Buffer, datalen);
@ -3402,7 +3402,7 @@ VOID ProcessDEDFrame(struct TNCINFO * TNC, UCHAR * Msg, int framelen)
{ {
if (TNC->TXBuffer[6]== 'T') // TX count Status if (TNC->TXBuffer[6]== 'T') // TX count Status
{ {
sprintf(TNC->WEB_TRAFFIC, "RX %d TX %d ACKED %s", TNC->Streams[Stream].BytesRXed, TNC->Streams[Stream].BytesTXed, Buffer); sprintf(TNC->WEB_TRAFFIC, "RX %d TX %d ACKED %s", TNC->Streams[Stream].bytesRXed, TNC->Streams[Stream].bytesTXed, Buffer);
SetWindowText(TNC->xIDC_TRAFFIC, TNC->WEB_TRAFFIC); SetWindowText(TNC->xIDC_TRAFFIC, TNC->WEB_TRAFFIC);
return; return;
} }
@ -3501,7 +3501,7 @@ VOID ProcessDEDFrame(struct TNCINFO * TNC, UCHAR * Msg, int framelen)
STREAM->Connected = TRUE; // Subsequent data to data channel STREAM->Connected = TRUE; // Subsequent data to data channel
STREAM->Connecting = FALSE; STREAM->Connecting = FALSE;
STREAM->ConnectTime = time(NULL); STREAM->ConnectTime = time(NULL);
STREAM->BytesRXed = STREAM->BytesTXed = 0; STREAM->bytesRXed = STREAM->bytesTXed = 0;
// Stop Scanner // Stop Scanner
@ -3897,7 +3897,7 @@ VOID ProcessDEDFrame(struct TNCINFO * TNC, UCHAR * Msg, int framelen)
if (buffptr == NULL) return; // No buffers, so ignore if (buffptr == NULL) return; // No buffers, so ignore
buffptr->Len = Msg[4] + 1; // Length buffptr->Len = Msg[4] + 1; // Length
TNC->Streams[Stream].BytesRXed += (int)buffptr->Len; TNC->Streams[Stream].bytesRXed += (int)buffptr->Len;
memcpy(buffptr->Data, &Msg[5], buffptr->Len); memcpy(buffptr->Data, &Msg[5], buffptr->Len);
WritetoTrace(TNC, &Msg[5], (int)buffptr->Len); WritetoTrace(TNC, &Msg[5], (int)buffptr->Len);

@ -825,7 +825,7 @@ static VOID DEDPoll(int Port)
} }
Poll[1] = 0; // Data Poll[1] = 0; // Data
TNC->Streams[Stream].BytesTXed += datalen; TNC->Streams[Stream].bytesTXed += datalen;
Poll[2] = datalen - 1; Poll[2] = datalen - 1;
memcpy(&Poll[3], Buffer, datalen); memcpy(&Poll[3], Buffer, datalen);
@ -1508,7 +1508,7 @@ static VOID ProcessDEDFrame(struct TNCINFO * TNC)
STREAM->Connected = TRUE; // Subsequent data to data channel STREAM->Connected = TRUE; // Subsequent data to data channel
STREAM->Connecting = FALSE; STREAM->Connecting = FALSE;
STREAM->BytesRXed = STREAM->BytesTXed = 0; STREAM->bytesRXed = STREAM->bytesTXed = 0;
memcpy(MHCall, Call, 9); memcpy(MHCall, Call, 9);
MHCall[9] = 0; MHCall[9] = 0;
@ -1677,7 +1677,7 @@ static VOID ProcessDEDFrame(struct TNCINFO * TNC)
if (buffptr == NULL) return; // No buffers, so ignore if (buffptr == NULL) return; // No buffers, so ignore
buffptr->Len = framelen; // Length buffptr->Len = framelen; // Length
TNC->Streams[Stream].BytesRXed += buffptr->Len; TNC->Streams[Stream].bytesRXed += buffptr->Len;
memcpy(buffptr->Data, Msg, buffptr->Len); memcpy(buffptr->Data, Msg, buffptr->Len);
C_Q_ADD(&TNC->Streams[Stream].PACTORtoBPQ_Q, buffptr); C_Q_ADD(&TNC->Streams[Stream].PACTORtoBPQ_Q, buffptr);

@ -1267,7 +1267,7 @@ reinit:
} }
Poll[1] = 0; // Data Poll[1] = 0; // Data
TNC->Streams[Stream].BytesTXed += datalen; TNC->Streams[Stream].bytesTXed += datalen;
Poll[2] = datalen - 1; Poll[2] = datalen - 1;
memcpy(&Poll[3], Buffer, datalen); memcpy(&Poll[3], Buffer, datalen);
@ -1888,7 +1888,7 @@ VOID TrkProcessDEDFrame(struct TNCINFO * TNC)
{ {
if (TNC->TXBuffer[4]== 'T') // TX count Status if (TNC->TXBuffer[4]== 'T') // TX count Status
{ {
sprintf(TNC->WEB_TRAFFIC, "RX %d TX %d ACKED %s", TNC->Streams[Stream].BytesRXed, TNC->Streams[Stream].BytesTXed, Buffer); sprintf(TNC->WEB_TRAFFIC, "RX %d TX %d ACKED %s", TNC->Streams[Stream].bytesRXed, TNC->Streams[Stream].bytesTXed, Buffer);
SetWindowText(TNC->xIDC_TRAFFIC, TNC->WEB_TRAFFIC); SetWindowText(TNC->xIDC_TRAFFIC, TNC->WEB_TRAFFIC);
TNC->WEB_CHANGED = TRUE; TNC->WEB_CHANGED = TRUE;
return; return;
@ -2027,7 +2027,7 @@ VOID TrkProcessDEDFrame(struct TNCINFO * TNC)
STREAM->Connected = TRUE; // Subsequent data to data channel STREAM->Connected = TRUE; // Subsequent data to data channel
STREAM->Connecting = FALSE; STREAM->Connecting = FALSE;
STREAM->ConnectTime = time(NULL); STREAM->ConnectTime = time(NULL);
STREAM->BytesRXed = STREAM->BytesTXed = 0; STREAM->bytesRXed = STREAM->bytesTXed = 0;
if (TNC->SlowTimer) if (TNC->SlowTimer)
Debugprintf("RP Incoming call to APPLCALL completed"); Debugprintf("RP Incoming call to APPLCALL completed");
@ -2385,7 +2385,7 @@ VOID TrkProcessDEDFrame(struct TNCINFO * TNC)
if (buffptr == NULL) return; // No buffers, so ignore if (buffptr == NULL) return; // No buffers, so ignore
buffptr->Len = framelen; // Length buffptr->Len = framelen; // Length
TNC->Streams[Stream].BytesRXed += (int)buffptr->Len; TNC->Streams[Stream].bytesRXed += (int)buffptr->Len;
memcpy(buffptr->Data, Msg, buffptr->Len); memcpy(buffptr->Data, Msg, buffptr->Len);
WritetoTrace(TNC, Msg, (int)buffptr->Len); WritetoTrace(TNC, Msg, (int)buffptr->Len);

@ -402,7 +402,7 @@ ok:
UCHAR * data = &buffptr->Data[0]; UCHAR * data = &buffptr->Data[0];
STREAM->FramesQueued--; STREAM->FramesQueued--;
txlen = (int)buffptr->Len; txlen = (int)buffptr->Len;
STREAM->BytesTXed += txlen; STREAM->bytesTXed += txlen;
bytes=SerialSendData(TNC, data, txlen); bytes=SerialSendData(TNC, data, txlen);
WritetoTrace(TNC, data, txlen); WritetoTrace(TNC, data, txlen);
@ -491,7 +491,7 @@ ok:
bytes=SerialSendData(TNC, TXMsg, txlen); bytes=SerialSendData(TNC, TXMsg, txlen);
TNC->Streams[Stream].BytesOutstanding += bytes; // So flow control works - will be updated by BUFFER response TNC->Streams[Stream].BytesOutstanding += bytes; // So flow control works - will be updated by BUFFER response
STREAM->BytesTXed += bytes; STREAM->bytesTXed += bytes;
// WritetoTrace(TNC, &buff->L2DATA[0], txlen); // WritetoTrace(TNC, &buff->L2DATA[0], txlen);
return 1; return 1;

@ -2382,7 +2382,7 @@ nosocks:
{ {
char logmsg[120]; char logmsg[120];
sprintf(logmsg,"%d Disconnected. Bytes Sent = %d Bytes Received %d\n", sprintf(logmsg,"%d Disconnected. Bytes Sent = %d Bytes Received %d\n",
sockptr->Number, STREAM->BytesTXed, STREAM->BytesRXed); sockptr->Number, STREAM->bytesTXed, STREAM->bytesRXed);
WriteLog (logmsg); WriteLog (logmsg);
} }
@ -2407,7 +2407,7 @@ nosocks:
{ {
char logmsg[120]; char logmsg[120];
sprintf(logmsg,"%d Disconnected. Bytes Sent = %d Bytes Received %d Time %d Seconds\r\n", sprintf(logmsg,"%d Disconnected. Bytes Sent = %d Bytes Received %d Time %d Seconds\r\n",
sockptr->Number, STREAM->BytesTXed, STREAM->BytesRXed, (int)(time(NULL) - sockptr->ConnectTime)); sockptr->Number, STREAM->bytesTXed, STREAM->bytesRXed, (int)(time(NULL) - sockptr->ConnectTime));
WriteCMSLog (logmsg); WriteCMSLog (logmsg);
} }
@ -2415,7 +2415,7 @@ nosocks:
// Don't report if Internet down unless ReportRelayTraffic set) // Don't report if Internet down unless ReportRelayTraffic set)
if (sockptr->RelaySession == FALSE || TCP->ReportRelayTraffic) if (sockptr->RelaySession == FALSE || TCP->ReportRelayTraffic)
SendWL2KSessionRecord(sockptr->ADIF, STREAM->BytesTXed, STREAM->BytesRXed); SendWL2KSessionRecord(sockptr->ADIF, STREAM->bytesTXed, STREAM->bytesRXed);
WriteADIFRecord(sockptr->ADIF); WriteADIFRecord(sockptr->ADIF);
@ -3285,7 +3285,7 @@ int Socket_Accept(struct TNCINFO * TNC, SOCKET SocketId, int Port)
sockptr->Keepalive = FALSE; sockptr->Keepalive = FALSE;
sockptr->UTF8 = 0; sockptr->UTF8 = 0;
TNC->Streams[n].BytesRXed = TNC->Streams[n].BytesTXed = 0; TNC->Streams[n].bytesRXed = TNC->Streams[n].bytesTXed = 0;
TNC->Streams[n].FramesQueued = 0; TNC->Streams[n].FramesQueued = 0;
sockptr->HTTPMode = FALSE; sockptr->HTTPMode = FALSE;
@ -3834,7 +3834,7 @@ MsgLoop:
// Normal Data State // Normal Data State
STREAM->BytesRXed += MsgLen; STREAM->bytesRXed += MsgLen;
SendIndex = 0; SendIndex = 0;
// Line could be up to 500 chars if coming from a program rather than an interative user // Line could be up to 500 chars if coming from a program rather than an interative user
@ -3986,7 +3986,7 @@ MsgLoop:
if (ctlen > 0) send(sock, ct, ctlen, 0); if (ctlen > 0) send(sock, ct, ctlen, 0);
STREAM->BytesTXed = ctlen; STREAM->bytesTXed = ctlen;
if (LogEnabled) if (LogEnabled)
{ {
@ -4067,7 +4067,7 @@ int DataSocket_ReadRelay(struct TNCINFO * TNC, struct ConnectionInfo * sockptr,
MsgPtr = &sockptr->InputBuffer[0]; MsgPtr = &sockptr->InputBuffer[0];
InputLen = sockptr->InputLen; InputLen = sockptr->InputLen;
STREAM->BytesRXed += InputLen; STREAM->bytesRXed += InputLen;
if (sockptr->LoginState == 2) if (sockptr->LoginState == 2)
{ {
@ -4077,7 +4077,7 @@ int DataSocket_ReadRelay(struct TNCINFO * TNC, struct ConnectionInfo * sockptr,
// Queue to Node. Data may arrive it large quatities, possibly exceeding node buffer capacity // Queue to Node. Data may arrive it large quatities, possibly exceeding node buffer capacity
STREAM->BytesRXed += InputLen; STREAM->bytesRXed += InputLen;
if (sockptr->FromHostBuffPutptr + InputLen > sockptr->FromHostBufferSize) if (sockptr->FromHostBuffPutptr + InputLen > sockptr->FromHostBufferSize)
{ {
@ -4347,7 +4347,7 @@ int DataSocket_ReadSync(struct TNCINFO * TNC, struct ConnectionInfo * sockptr, S
InputLen = sockptr->InputLen; InputLen = sockptr->InputLen;
MsgPtr[InputLen] = 0; MsgPtr[InputLen] = 0;
STREAM->BytesRXed += InputLen; STREAM->bytesRXed += InputLen;
if (sockptr->LoginState == 0) // Initial connection if (sockptr->LoginState == 0) // Initial connection
{ {
@ -4495,7 +4495,7 @@ MsgLoop:
// Queue to Node. Data may arrive it large quantities, possibly exceeding node buffer capacity // Queue to Node. Data may arrive it large quantities, possibly exceeding node buffer capacity
STREAM->BytesRXed += InputLen; STREAM->bytesRXed += InputLen;
BuffertoNode(sockptr, MsgPtr, InputLen); BuffertoNode(sockptr, MsgPtr, InputLen);
sockptr->InputLen = 0; sockptr->InputLen = 0;
@ -5650,7 +5650,7 @@ int Telnet_Connected(struct TNCINFO * TNC, struct ConnectionInfo * sockptr, SOCK
sockptr->FromHostBuffPutptr = sockptr->FromHostBuffGetptr = 0; sockptr->FromHostBuffPutptr = sockptr->FromHostBuffGetptr = 0;
TNC->Streams[Stream].BytesRXed = TNC->Streams[Stream].BytesTXed = 0; TNC->Streams[Stream].bytesRXed = TNC->Streams[Stream].bytesTXed = 0;
return 0; return 0;
} }
@ -6508,7 +6508,7 @@ BOOL TelSendPacket(int Stream, struct STREAMINFO * STREAM, PMSGWITHLEN buffptr,
datalen = (int)buffptr->Len; datalen = (int)buffptr->Len;
MsgPtr = &buffptr->Data[0]; MsgPtr = &buffptr->Data[0];
STREAM->BytesTXed += datalen; STREAM->bytesTXed += datalen;
sock = sockptr->socket; sock = sockptr->socket;

@ -367,10 +367,10 @@ static VOID UpdateStatsLine(struct TNCINFO * TNC, struct STREAMINFO * STREAM)
{ {
char Count[16]; char Count[16];
sprintf(Count, "%d", STREAM->BytesRXed); sprintf(Count, "%d", STREAM->bytesRXed);
SetWindowText(STREAM->xIDC_RXED, Count); SetWindowText(STREAM->xIDC_RXED, Count);
sprintf(Count, "%d", STREAM->BytesTXed); sprintf(Count, "%d", STREAM->bytesTXed);
SetWindowText(STREAM->xIDC_SEND, Count); SetWindowText(STREAM->xIDC_SEND, Count);
sprintf(Count, "%d", STREAM->BytesResent); sprintf(Count, "%d", STREAM->BytesResent);
@ -849,7 +849,7 @@ static VOID ProcessFLDigiData(struct TNCINFO * TNC, UCHAR * Input, int Len, int
strcpy(STREAM->MyCall, call2); strcpy(STREAM->MyCall, call2);
STREAM->ConnectTime = time(NULL); STREAM->ConnectTime = time(NULL);
STREAM->BytesRXed = STREAM->BytesTXed = STREAM->BytesAcked = STREAM->BytesResent = 0; STREAM->bytesRXed = STREAM->bytesTXed = STREAM->BytesAcked = STREAM->BytesResent = 0;
if (WL2K) if (WL2K)
strcpy(SESS->RMSCall, WL2K->RMSCall); strcpy(SESS->RMSCall, WL2K->RMSCall);
@ -1001,7 +1001,7 @@ AckConnectRequest:
goto SendKReply; // Repeated ACK goto SendKReply; // Repeated ACK
STREAM->ConnectTime = time(NULL); STREAM->ConnectTime = time(NULL);
STREAM->BytesRXed = STREAM->BytesTXed = STREAM->BytesAcked = STREAM->BytesResent = 0; STREAM->bytesRXed = STREAM->bytesTXed = STREAM->BytesAcked = STREAM->BytesResent = 0;
STREAM->Connected = TRUE; STREAM->Connected = TRUE;
ARQ->ARQTimerState = 0; ARQ->ARQTimerState = 0;
@ -1300,7 +1300,7 @@ SendKReply:
buffptr->Len = Len; buffptr->Len = Len;
memcpy(buffptr->Data, &Input[1], Len); memcpy(buffptr->Data, &Input[1], Len);
STREAM->BytesRXed += Len; STREAM->bytesRXed += Len;
UpdateStatsLine(TNC, STREAM); UpdateStatsLine(TNC, STREAM);
@ -1388,7 +1388,7 @@ static VOID SendARQData(struct TNCINFO * TNC, PMSGWITHLEN Buffer, int Stream)
ARQ->TXHOLDQ[ARQ->TXSeq] = Buffer; ARQ->TXHOLDQ[ARQ->TXSeq] = Buffer;
STREAM->BytesTXed += Origlen; STREAM->bytesTXed += Origlen;
UpdateStatsLine(TNC, STREAM); UpdateStatsLine(TNC, STREAM);

@ -1230,6 +1230,9 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff)
ViaList[0] = Digis; ViaList[0] = Digis;
} }
hookL4SessionAttempt(STREAM,&STREAM->AGWKey[1], &STREAM->AGWKey[11]);
sent = send(TNCInfo[MasterPort[port]]->TCPSock, (char *)&AGW->TXHeader, AGWHDDRLEN, 0); sent = send(TNCInfo[MasterPort[port]]->TCPSock, (char *)&AGW->TXHeader, AGWHDDRLEN, 0);
if (Digis) if (Digis)
send(TNCInfo[MasterPort[port]]->TCPSock, ViaList, Digis * 10 + 1, 0); send(TNCInfo[MasterPort[port]]->TCPSock, ViaList, Digis * 10 + 1, 0);
@ -2231,7 +2234,7 @@ VOID ProcessAGWPacket(struct TNCINFO * TNC, UCHAR * Message)
buffptr->Len = RXHeader->DataLength; buffptr->Len = RXHeader->DataLength;
memcpy(buffptr->Data, Message, RXHeader->DataLength); memcpy(buffptr->Data, Message, RXHeader->DataLength);
STREAM->BytesRXed += RXHeader->DataLength; STREAM->bytesRXed += RXHeader->DataLength;
C_Q_ADD(&STREAM->PACTORtoBPQ_Q, buffptr); C_Q_ADD(&STREAM->PACTORtoBPQ_Q, buffptr);
return; return;
@ -2373,7 +2376,7 @@ GotStream:
memcpy(STREAM->AGWKey, Key, 21); memcpy(STREAM->AGWKey, Key, 21);
STREAM->Connected = TRUE; STREAM->Connected = TRUE;
STREAM->ConnectTime = time(NULL); STREAM->ConnectTime = time(NULL);
STREAM->BytesRXed = STREAM->BytesTXed = 0; STREAM->bytesRXed = STREAM->bytesTXed = 0;
SuspendOtherPorts(TNC); SuspendOtherPorts(TNC);
@ -2534,7 +2537,7 @@ GotStream:
STREAM->Connected = TRUE; STREAM->Connected = TRUE;
STREAM->Connecting = FALSE; STREAM->Connecting = FALSE;
STREAM->ConnectTime = time(NULL); STREAM->ConnectTime = time(NULL);
STREAM->BytesRXed = STREAM->BytesTXed = 0; STREAM->bytesRXed = STREAM->bytesTXed = 0;
buffptr = GetBuff(); buffptr = GetBuff();
if (buffptr == 0) return; // No buffers, so ignore if (buffptr == 0) return; // No buffers, so ignore
@ -2936,7 +2939,7 @@ VOID SendData(int Stream, struct TNCINFO * TNC, char * Key, char * Msg, int MsgL
memcpy(AGW->TXHeader.callfrom, &Key[11], 10); memcpy(AGW->TXHeader.callfrom, &Key[11], 10);
memcpy(AGW->TXHeader.callto, &Key[1], 10); memcpy(AGW->TXHeader.callto, &Key[1], 10);
TNC->Streams[Stream].BytesTXed += MsgLen; TNC->Streams[Stream].bytesTXed += MsgLen;
// If Length is greater than Paclen we should fragment // If Length is greater than Paclen we should fragment

@ -394,6 +394,18 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff)
} }
} }
// Check ATTACH time limit
if (STREAM->Attached)
{
if (STREAM->AttachTime && TNC->AttachTimeLimit && time(NULL) > (TNC->AttachTimeLimit + STREAM->AttachTime))
{
STREAM->ReportDISC = 1;
STREAM->AttachTime = 0;
}
}
while (TNC->PortRecord->UI_Q) while (TNC->PortRecord->UI_Q)
{ {
buffptr = Q_REM(&TNC->PortRecord->UI_Q); buffptr = Q_REM(&TNC->PortRecord->UI_Q);
@ -506,6 +518,8 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff)
int calllen; int calllen;
char Msg[80]; char Msg[80];
memset(STREAM, 0, sizeof(struct STREAMINFO));
TNC->Streams[0].Attached = TRUE; TNC->Streams[0].Attached = TRUE;
calllen = ConvFromAX25(TNC->PortRecord->ATTACHEDSESSIONS[0]->L4USER, TNC->Streams[0].MyCall); calllen = ConvFromAX25(TNC->PortRecord->ATTACHEDSESSIONS[0]->L4USER, TNC->Streams[0].MyCall);
@ -516,6 +530,7 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff)
VARASendCommand(TNC, "LISTEN OFF\r", TRUE); VARASendCommand(TNC, "LISTEN OFF\r", TRUE);
TNC->SessionTimeLimit = TNC->DefaultSessionTimeLimit; // Reset Limit TNC->SessionTimeLimit = TNC->DefaultSessionTimeLimit; // Reset Limit
STREAM->AttachTime = time(NULL);
// Stop other ports in same group // Stop other ports in same group
@ -568,7 +583,7 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff)
buffptr->Data[txlen] = 0; // Null terminate buffptr->Data[txlen] = 0; // Null terminate
STREAM->BytesTXed += txlen; STREAM->bytesTXed += txlen;
WritetoTrace(TNC, buffptr->Data, txlen); WritetoTrace(TNC, buffptr->Data, txlen);
// Always add to stored data and set timer. If it expires send message // Always add to stored data and set timer. If it expires send message
@ -599,7 +614,7 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff)
memcpy(txbuff, buffptr->Data, txlen); memcpy(txbuff, buffptr->Data, txlen);
bytes = VARASendData(TNC, &txbuff[0], txlen); bytes = VARASendData(TNC, &txbuff[0], txlen);
STREAM->BytesTXed += bytes; STREAM->bytesTXed += bytes;
ReleaseBuffer(buffptr); ReleaseBuffer(buffptr);
} }
@ -647,7 +662,7 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff)
txlen = (int)buffptr->Len; txlen = (int)buffptr->Len;
memcpy(txbuff, buffptr->Data, txlen); memcpy(txbuff, buffptr->Data, txlen);
bytes=send(TNC->TCPDataSock, buff->L2DATA, txlen, 0); bytes=send(TNC->TCPDataSock, buff->L2DATA, txlen, 0);
STREAM->BytesTXed += bytes; STREAM->bytesTXed += bytes;
WritetoTrace(TNC, txbuff, txlen); WritetoTrace(TNC, txbuff, txlen);
ReleaseBuffer(buffptr); ReleaseBuffer(buffptr);
} }
@ -674,7 +689,7 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff)
memcpy(txbuff, buff->L2DATA, txlen); memcpy(txbuff, buff->L2DATA, txlen);
bytes=send(TNC->TCPDataSock, txbuff, txlen, 0); bytes=send(TNC->TCPDataSock, txbuff, txlen, 0);
STREAM->BytesTXed += bytes; STREAM->bytesTXed += bytes;
WritetoTrace(TNC, buff->L2DATA, txlen); WritetoTrace(TNC, buff->L2DATA, txlen);
return 0; return 0;
} }
@ -690,7 +705,7 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff)
buff->L2DATA[txlen] = 0; // Null terminate buff->L2DATA[txlen] = 0; // Null terminate
STREAM->BytesTXed += txlen; STREAM->bytesTXed += txlen;
WritetoTrace(TNC, buff->L2DATA, txlen); WritetoTrace(TNC, buff->L2DATA, txlen);
// Always add to stored data and set timer. If it expires send message // Always add to stored data and set timer. If it expires send message
@ -815,6 +830,8 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff)
// Need to set connecting here as if we delay for busy we may incorrectly process OK response // Need to set connecting here as if we delay for busy we may incorrectly process OK response
TNC->Streams[0].Connecting = TRUE; TNC->Streams[0].Connecting = TRUE;
hookL4SessionAttempt(STREAM, &buff->L2DATA[2], TNC->Streams[0].MyCall);
// See if Busy // See if Busy
@ -2000,7 +2017,7 @@ VOID VARAProcessResponse(struct TNCINFO * TNC, UCHAR * Buffer, int MsgLen)
} }
sprintf(TNC->WEB_TRAFFIC, "Sent %d RXed %d Queued %s", sprintf(TNC->WEB_TRAFFIC, "Sent %d RXed %d Queued %s",
STREAM->BytesTXed, STREAM->BytesRXed, &Buffer[7]); STREAM->bytesTXed, STREAM->bytesRXed, &Buffer[7]);
MySetWindowText(TNC->xIDC_TRAFFIC, TNC->WEB_TRAFFIC); MySetWindowText(TNC->xIDC_TRAFFIC, TNC->WEB_TRAFFIC);
return; return;
@ -2020,8 +2037,7 @@ VOID VARAProcessResponse(struct TNCINFO * TNC, UCHAR * Buffer, int MsgLen)
Debugprintf(Buffer); Debugprintf(Buffer);
WritetoTrace(TNC, Buffer, MsgLen - 1); WritetoTrace(TNC, Buffer, MsgLen - 1);
STREAM->ConnectTime = time(NULL); STREAM->bytesRXed = STREAM->bytesTXed = STREAM->PacketsSent = 0;
STREAM->BytesRXed = STREAM->BytesTXed = STREAM->PacketsSent = 0;
if (TNC->VARACMsg) if (TNC->VARACMsg)
free(TNC->VARACMsg); free(TNC->VARACMsg);
@ -2088,6 +2104,10 @@ VOID VARAProcessResponse(struct TNCINFO * TNC, UCHAR * Buffer, int MsgLen)
// Stop other ports in same group // Stop other ports in same group
memset(STREAM, 0, sizeof(struct STREAMINFO));
STREAM->ConnectTime = time(NULL);
SuspendOtherPorts(TNC); SuspendOtherPorts(TNC);
TNC->SessionTimeLimit = TNC->DefaultSessionTimeLimit; // Reset Limit TNC->SessionTimeLimit = TNC->DefaultSessionTimeLimit; // Reset Limit
@ -2183,7 +2203,7 @@ VOID VARAProcessResponse(struct TNCINFO * TNC, UCHAR * Buffer, int MsgLen)
STREAM->PacketsSent++; STREAM->PacketsSent++;
bytes = send(TNC->TCPDataSock, TNC->NetRomTxBuffer, TNC->NetRomTxLen, 0); bytes = send(TNC->TCPDataSock, TNC->NetRomTxBuffer, TNC->NetRomTxLen, 0);
STREAM->BytesTXed += TNC->NetRomTxLen; STREAM->bytesTXed += TNC->NetRomTxLen;
free(TNC->NetRomTxBuffer); free(TNC->NetRomTxBuffer);
TNC->NetRomTxBuffer = NULL; TNC->NetRomTxBuffer = NULL;
@ -2275,6 +2295,7 @@ VOID VARAProcessResponse(struct TNCINFO * TNC, UCHAR * Buffer, int MsgLen)
char Reply[80]; char Reply[80];
int ReplyLen; int ReplyLen;
STREAM->ConnectTime = time(NULL);
if (TNC->NetRomMode) if (TNC->NetRomMode)
{ {
@ -2287,7 +2308,7 @@ VOID VARAProcessResponse(struct TNCINFO * TNC, UCHAR * Buffer, int MsgLen)
STREAM->PacketsSent++; STREAM->PacketsSent++;
bytes = send(TNC->TCPDataSock, TNC->NetRomTxBuffer, TNC->NetRomTxLen, 0); bytes = send(TNC->TCPDataSock, TNC->NetRomTxBuffer, TNC->NetRomTxLen, 0);
STREAM->BytesTXed += TNC->NetRomTxLen; STREAM->bytesTXed += TNC->NetRomTxLen;
free(TNC->NetRomTxBuffer); free(TNC->NetRomTxBuffer);
TNC->NetRomTxBuffer = NULL; TNC->NetRomTxBuffer = NULL;
TNC->NetRomTxLen = 0; TNC->NetRomTxLen = 0;
@ -2729,13 +2750,13 @@ VOID VARAProcessDataPacket(struct TNCINFO * TNC, UCHAR * Data, int Length)
TNC->TimeSinceLast = 0; TNC->TimeSinceLast = 0;
STREAM->BytesRXed += Length; STREAM->bytesRXed += Length;
Data[Length] = 0; Data[Length] = 0;
// Debugprintf("VARA: RXD %d bytes", Length); // Debugprintf("VARA: RXD %d bytes", Length);
sprintf(TNC->WEB_TRAFFIC, "Sent %d RXed %d Queued %d", sprintf(TNC->WEB_TRAFFIC, "Sent %d RXed %d Queued %d",
STREAM->BytesTXed, STREAM->BytesRXed,STREAM->BytesOutstanding); STREAM->bytesTXed, STREAM->bytesRXed,STREAM->BytesOutstanding);
MySetWindowText(TNC->xIDC_TRAFFIC, TNC->WEB_TRAFFIC); MySetWindowText(TNC->xIDC_TRAFFIC, TNC->WEB_TRAFFIC);
// if VARAAC Mode, remove byte count from front and add cr // if VARAAC Mode, remove byte count from front and add cr
@ -2878,7 +2899,7 @@ int VARASendData(struct TNCINFO * TNC, UCHAR * Buff, int Len)
struct STREAMINFO * STREAM = &TNC->Streams[0]; struct STREAMINFO * STREAM = &TNC->Streams[0];
int bytes=send(TNC->TCPDataSock,(const char FAR *)Buff, Len, 0); int bytes=send(TNC->TCPDataSock,(const char FAR *)Buff, Len, 0);
STREAM->BytesTXed += bytes; STREAM->bytesTXed += bytes;
WritetoTrace(TNC, Buff, Len); WritetoTrace(TNC, Buff, Len);
return bytes; return bytes;
} }
@ -2977,7 +2998,7 @@ void SendVARANetrom(struct TNCINFO * TNC, unsigned char * Data, int Len)
STREAM->PacketsSent++; STREAM->PacketsSent++;
bytes = send(TNC->TCPDataSock, TNC->NetRomTxBuffer, TNC->NetRomTxLen, 0); bytes = send(TNC->TCPDataSock, TNC->NetRomTxBuffer, TNC->NetRomTxLen, 0);
STREAM->BytesTXed += TNC->NetRomTxLen; STREAM->bytesTXed += TNC->NetRomTxLen;
free(TNC->NetRomTxBuffer); free(TNC->NetRomTxBuffer);
TNC->NetRomTxBuffer = NULL; TNC->NetRomTxBuffer = NULL;

@ -10,8 +10,8 @@
#endif #endif
#define KVers 6,0,24,47 #define KVers 6,0,24,48
#define KVerstring "6.0.24.47\0" #define KVerstring "6.0.24.48\0"
#ifdef CKernel #ifdef CKernel

@ -915,7 +915,7 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff)
txlen = buffptr->Len; txlen = buffptr->Len;
memcpy(txbuff, buffptr->Data, txlen); memcpy(txbuff, buffptr->Data, txlen);
bytes = send(TNC->TCPDataSock, txbuff, (int)txlen, 0); bytes = send(TNC->TCPDataSock, txbuff, (int)txlen, 0);
STREAM->BytesTXed += bytes; STREAM->bytesTXed += bytes;
WritetoTrace(TNC, txbuff, (int)txlen); WritetoTrace(TNC, txbuff, (int)txlen);
ReleaseBuffer(buffptr); ReleaseBuffer(buffptr);
} }
@ -941,7 +941,7 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff)
} }
bytes = send(TNC->TCPDataSock,buff->L2DATA, (int)txlen, 0); bytes = send(TNC->TCPDataSock,buff->L2DATA, (int)txlen, 0);
STREAM->BytesTXed += bytes; STREAM->bytesTXed += bytes;
WritetoTrace(TNC, &buff->L2DATA[0], (int)txlen); WritetoTrace(TNC, &buff->L2DATA[0], (int)txlen);
} }
@ -2106,7 +2106,7 @@ VOID ProcessResponse(struct TNCINFO * TNC, UCHAR * Buffer, int MsgLen)
FreeSemaphore(&Semaphore); FreeSemaphore(&Semaphore);
STREAM->ConnectTime = time(NULL); STREAM->ConnectTime = time(NULL);
STREAM->BytesRXed = STREAM->BytesTXed = STREAM->PacketsSent = 0; STREAM->bytesRXed = STREAM->bytesTXed = STREAM->PacketsSent = 0;
if (TNC->StartInRobust) if (TNC->StartInRobust)
send(TNC->TCPSock, "ROBUST TRUE\r\n", 13, 0); send(TNC->TCPSock, "ROBUST TRUE\r\n", 13, 0);
@ -2207,7 +2207,7 @@ VOID ProcessResponse(struct TNCINFO * TNC, UCHAR * Buffer, int MsgLen)
PMSGWITHLEN buffptr = Q_REM(&STREAM->BPQtoPACTOR_Q); PMSGWITHLEN buffptr = Q_REM(&STREAM->BPQtoPACTOR_Q);
send(TNC->TCPDataSock, buffptr->Data, (int)buffptr->Len, 0); send(TNC->TCPDataSock, buffptr->Data, (int)buffptr->Len, 0);
STREAM->BytesTXed += (int)buffptr->Len; STREAM->bytesTXed += (int)buffptr->Len;
WritetoTrace(TNC, buffptr->Data, (int)buffptr->Len); WritetoTrace(TNC, buffptr->Data, (int)buffptr->Len);
ReleaseBuffer(buffptr); ReleaseBuffer(buffptr);
} }
@ -2693,7 +2693,7 @@ loop:
return; return;
} }
STREAM->BytesRXed += InputLen; STREAM->bytesRXed += InputLen;
msg = &buffptr->Data[0]; msg = &buffptr->Data[0];
msg[InputLen] = 0; msg[InputLen] = 0;

@ -247,7 +247,7 @@ int MailAPIProcessHTTPMessage(struct HTTPConnectionInfo * Session, char * respon
// Return Token // Return Token
sprintf(response, "{\"access_token\":\"%s\", \"expires_in\":%d, \"scope\":\"create\"}\r\n", sprintf(response, "{\"access_token\":\"%s\", \"expires_at\":%d, \"scope\":\"create\"}\r\n",
Token->token, Token->expiration_time); Token->token, Token->expiration_time);
return strlen(response); return strlen(response);
@ -514,7 +514,7 @@ char * APIConvTime(int ss)
mm = (ss - (hh * 3600)) / 60; mm = (ss - (hh * 3600)) / 60;
ss = ss % 60; ss = ss % 60;
sprintf(timebuf, "%02d:%02d:%02d", hh, mm, ss); sprintf(timebuf, "\"%02d:%02d:%02d\"", hh, mm, ss);
return timebuf; return timebuf;
} }
@ -528,7 +528,9 @@ int sendFwdConfig(struct HTTPConnectionInfo * Session, char * response, char * R
int i = 0; int i = 0;
int Len = 0; int Len = 0;
n = sprintf(ptr,"{\"forwardconfig\":[\r\n");
ptr += n;
for (USER = BBSChain; USER; USER = USER->BBSNext) for (USER = BBSChain; USER; USER = USER->BBSNext)
{ {
struct BBSForwardingInfo * FWDInfo = USER->ForwardingInfo; struct BBSForwardingInfo * FWDInfo = USER->ForwardingInfo;
@ -575,10 +577,15 @@ int sendFwdConfig(struct HTTPConnectionInfo * Session, char * response, char * R
ptr += sprintf(ptr, " }\r\n},\r\n"); ptr += sprintf(ptr, " }\r\n},\r\n");
} }
if (response[n]) // No entries if (response[n] == 0) // No entries
{
response[strlen(response) - 2] = '\0'; // remove \r\n
strcat(response, "]}\r\n");
}
else
{ {
response[strlen(response)-3 ] = '\0'; // remove ,\r\n response[strlen(response)-3 ] = '\0'; // remove ,\r\n
strcat(response, "\r\n"); strcat(response, "\r\n]}\r\n");
} }
return strlen(response); return strlen(response);

Binary file not shown.

@ -222,17 +222,20 @@ struct STREAMINFO
char MyCall[10] ; // Call we are using char MyCall[10] ; // Call we are using
char RemoteCall[10]; // Callsign char RemoteCall[10]; // Callsign
char callingCall[10]; // for reporting. My abnd Remote calls depend on which end connected char callingCall[10]; // for reporting. Link and Our calls depand on which end connected
char receivingCall[10]; // for reporting. Link and Our calls depand on which end connected char receivingCall[10]; // for reporting. Link and Our calls depand on which end connected
char Direction[4]; // In or Out
char AGWKey[21]; // Session Key for AGW Session Based Drivers char AGWKey[21]; // Session Key for AGW Session Based Drivers
time_t ConnectTime; // Time connection made time_t ConnectTime; // Time connection made
time_t AttachTime; time_t AttachTime;
int BytesTXed; int bytesTXed;
int BytesAcked; int BytesAcked;
int BytesRXed; int bytesRXed;
int PacketsSent; int PacketsSent;
int BytesResent; int BytesResent;
int BytesOutstanding; // For Packet Channels int BytesOutstanding; // For Packet Channels

Loading…
Cancel
Save

Powered by TurnKey Linux.