master
g8bpq 2 months ago
parent 66252a03a7
commit e40d364775

@ -274,7 +274,7 @@ VOID SixPackProcessReceivedPacket(struct TNCINFO * TNC)
TNC->Streams[0].ReportDISC = TRUE;
sprintf(TNC->WEB_COMMSSTATE, "Connection to TNC lost");
MySetWindowText(TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE);
MySetWindowText(TNC, TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE);
return;
}
@ -948,7 +948,7 @@ ok:
SuspendOtherPorts(TNC);
sprintf(TNC->WEB_TNCSTATE, "In Use by %s", TNC->Streams[0].MyCall);
MySetWindowText(TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
MySetWindowText(TNC, TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
// Stop Scanning
@ -1328,7 +1328,7 @@ VOID SIXPACKReleaseTNC(struct TNCINFO * TNC)
Rig_Command( (TRANSPORTENTRY *) -1, TXMsg);
strcpy(TNC->WEB_TNCSTATE, "Free");
MySetWindowText(TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
MySetWindowText(TNC, TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
ReleaseOtherPorts(TNC);
}
@ -1343,7 +1343,7 @@ VOID SIXPACKReleasePort(struct TNCINFO * TNC)
static int WebProc(struct TNCINFO * TNC, char * Buff, BOOL LOCAL)
{
int Len = sprintf(Buff, "<html><meta http-equiv=expires content=0><meta http-equiv=refresh content=15>"
int Len = sprintf(Buff, "<html><meta http-equiv=expires content=0>"
"<script type=\"text/javascript\">\r\n"
"function ScrollOutput()\r\n"
"{var textarea = document.getElementById('textarea');"
@ -1659,7 +1659,7 @@ VOID SIXPACKProcessReceivedPacket(struct TNCINFO * TNC)
TNC->Streams[0].ReportDISC = TRUE;
sprintf(TNC->WEB_COMMSSTATE, "Connection to TNC lost");
MySetWindowText(TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE);
MySetWindowText(TNC, TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE);
return;
}
@ -1802,7 +1802,7 @@ void AttachSIXPACK(struct PORTCONTROL * PORT, MESSAGE * Buffer)
if (WL2K)
strcpy(SESS->RMSCall, WL2K->RMSCall);
MySetWindowText(TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
MySetWindowText(TNC, TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
}
}
@ -1877,7 +1877,7 @@ void SIXPACKConnected(struct PORTCONTROL * PORT, struct _LINKTABLE * LINK)
if (WL2K)
strcpy(SESS->RMSCall, WL2K->RMSCall);
MySetWindowText(TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
MySetWindowText(TNC, TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
}
}
@ -2019,7 +2019,7 @@ VOID x6PackThead(void * portptr)
i=sprintf(Msg, "Connect Failed for 6Pack socket - error code = %d\r\n", err);
WritetoConsole(Msg);
sprintf(TNC->WEB_COMMSSTATE, "Connection to TNC failed");
MySetWindowText(TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE);
MySetWindowText(TNC, TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE);
TNC->Alerted = TRUE;
}
@ -2042,7 +2042,7 @@ VOID x6PackThead(void * portptr)
TNC->Alerted = TRUE;
sprintf(TNC->WEB_COMMSSTATE, "Connected to TNC");
MySetWindowText(TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE);
MySetWindowText(TNC, TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE);
FreeSemaphore(&Semaphore);
@ -2085,7 +2085,7 @@ Lost:
WritetoConsole(Msg);
sprintf(TNC->WEB_COMMSSTATE, "Connection to TNC lost");
MySetWindowText(TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE);
MySetWindowText(TNC, TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE);
TNC->CONNECTED = FALSE;
TNC->Alerted = FALSE;

@ -1417,7 +1417,7 @@ static VOID ProcessAEAPacket(struct TNCINFO * TNC, UCHAR * Msg, size_t Len)
}
TNC->Streams[Stream].bytesRXed = TNC->Streams[Stream].bytesTXed = TNC->Streams[Stream].BytesAcked = 0;
TNC->Streams[Stream].ConnectTime = time(NULL);
TNC->Streams[Stream].ConnectTime = NOW;
if (Stream == 0)
{

@ -253,8 +253,6 @@ HANDLE TrackHandle;
HANDLE hTrack;
UINT LastTrackFileTime;
UINT NOW;
char Stack[500];
BOOL Stacked=FALSE;
@ -899,8 +897,6 @@ int ProcessAISMessage(char * msg, int len)
char Data[256];
float alt=0.0;
NOW = time(NULL);
ptr1 = &msg[7];
//' Looks like first is no of fragments in message, 2nd fragment seq no, 3rd msg seq, 4th port
@ -2472,8 +2468,6 @@ void AISTimer()
{
// Entered every minute
NOW = time(NULL);
CheckAgeofTargets(MaxAge);
if (VessselDBChanged)
@ -2493,7 +2487,6 @@ void ADSBTimer()
{
// Entered every minute
NOW = time(NULL);
CheckAgeofPlanes(300);
ProcessADSBJSON(ADSBFN);
@ -2567,8 +2560,6 @@ int GetAISPageInfo(char * Buffer, int ais, int adsb)
char * p;
char DestBuffer[128] = "";
NOW = time(NULL);
if (adsb)
ProcessADSBJSON(ADSBFN);

@ -457,7 +457,7 @@ int APRSWriteLog(char * msg)
if (strchr(msg, '\n') == 0)
strcat(msg, "\r\n");
T = time(NULL);
T = NOW;
tm = gmtime(&T);
if (GetLogDirectory()[0] == 0)
@ -969,11 +969,9 @@ time_t lastSecTimer = 0;
Dll VOID APIENTRY Poll_APRS()
{
time_t Now = time(NULL);
if (lastSecTimer != Now)
if (lastSecTimer != NOW)
{
lastSecTimer = Now;
lastSecTimer = NOW;
DoSecTimer();
@ -1219,7 +1217,7 @@ Dll VOID APIENTRY Poll_APRS()
{
// Using Smart ID, but none scheduled
PORT->SmartIDNeeded = time(NULL) + PORT->SmartIDInterval;
PORT->SmartIDNeeded = NOW + PORT->SmartIDInterval;
}
PUT_ON_PORT_Q(PORT, Buffer);
}
@ -1393,7 +1391,7 @@ Dll VOID APIENTRY Poll_APRS()
ISDELAY * SatISEntry = malloc(sizeof(ISDELAY));
SatISEntry->Next = NULL;
SatISEntry->ISMSG = _strdup(ISMsg);
SatISEntry->SendTIme = time(NULL) + 10; // Delay 10 seconds
SatISEntry->SendTIme = NOW + 10; // Delay 10 seconds
if (SatISQueue)
SatISEntry->Next = SatISQueue; // Chain
@ -2653,7 +2651,7 @@ void SendBeaconThread(void * Param)
// Station->LastPort = Port;
DecodeAPRSPayload(Msg.L2DATA, Station);
Station->TimeLastUpdated = time(NULL);
Station->TimeLastUpdated = NOW;
if (toPort)
{
@ -2827,7 +2825,6 @@ VOID DoSecTimer()
if (SatISQueue)
{
time_t NOW = time(NULL);
ISDELAY * SatISEntry = SatISQueue;
ISDELAY * Prev = NULL;
@ -3106,7 +3103,7 @@ VOID APRSISThread(void * Report)
//
#ifndef LINBPQ
MySetWindowText(GetDlgItem(hConsWnd, IGATESTATE), "IGate State: Connect Failed");
MySetWindowText(0, GetDlgItem(hConsWnd, IGATESTATE), "IGate State: Connect Failed");
#else
printf("APRS Igate connect failed\n");
#endif
@ -3123,7 +3120,7 @@ VOID APRSISThread(void * Report)
APRSISOpen = TRUE;
#ifndef LINBPQ
MySetWindowText(GetDlgItem(hConsWnd, IGATESTATE), "IGate State: Connected");
MySetWindowText(0, GetDlgItem(hConsWnd, IGATESTATE), "IGate State: Connected");
#endif
InputLen=recv(sock, Buffer, 500, 0);
@ -3236,7 +3233,6 @@ VOID ProcessAPRSISMsg(char * APRSMsg)
char * ptr;
char Message[255];
PAPRSHEARDRECORD MH;
time_t NOW = time(NULL);
char ISCopy[1024];
struct STATIONRECORD * Station = NULL;
#ifdef WIN32
@ -3465,7 +3461,6 @@ APRSHEARDRECORD * UpdateHeard(UCHAR * Call, int Port)
APRSHEARDRECORD * MH = MHDATA;
APRSHEARDRECORD * MHBASE = MH;
int i;
time_t NOW = time(NULL);
time_t OLDEST = NOW - MAXAGE;
char CallPadded[10] = " ";
BOOL SaveIGate = FALSE;
@ -3556,8 +3551,7 @@ BOOL CheckforDups(char * Call, char * Msg, int Len)
{
// Primitive duplicate suppression - see if same call and text reeived in last few seconds
time_t Now = time(NULL);
time_t DupCheck = Now - DUPSECONDS;
time_t DupCheck = NOW - DUPSECONDS;
int i, saveindex = -1;
char * ptr1;
@ -3600,7 +3594,7 @@ BOOL CheckforDups(char * Call, char * Msg, int Len)
if (saveindex == -1) // List is full
saveindex = MAXDUPS - 1; // Stick on end
DupInfo[saveindex].DupTime = Now;
DupInfo[saveindex].DupTime = NOW;
memcpy(DupInfo[saveindex].DupUser, Call, 7);
if (Len > 99) Len = 99;
@ -3619,7 +3613,7 @@ char * FormatAPRSMH(APRSHEARDRECORD * MH)
static char MHLine[50];
time_t szClock = MH->MHTIME;
szClock = (time(NULL) - szClock);
szClock = (NOW - szClock);
TM = gmtime(&szClock);
sprintf(MHLine, "%-10s %d %.2d:%.2d:%.2d:%.2d %s\r",
@ -3925,8 +3919,6 @@ void DecodeRMC(char * msg, size_t len)
{
if (MobileBeaconInterval)
{
time_t NOW = time(NULL);
if ((NOW - LastMobileBeacon) > MobileBeaconInterval)
{
LastMobileBeacon = NOW;
@ -4748,7 +4740,7 @@ struct STATIONRECORD * FindStation(char * Call, BOOL AddIfNotFount)
// Debugprintf("APRS Add Stn %s Station Count = %d", Call, StationCount);
strcpy(ptr->Callsign, Call);
ptr->TimeLastUpdated = ptr->TimeAdded = time(NULL);
ptr->TimeLastUpdated = ptr->TimeAdded = NOW;
ptr->Index = i;
ptr->NoTracks = DefaultNoTracks;
@ -4842,7 +4834,7 @@ struct STATIONRECORD * ProcessRFFrame(char * Msg, int len, int * ourMessage)
Station->LastPort = Port;
*ourMessage = DecodeAPRSPayload(Payload, Station);
Station->TimeLastUpdated = time(NULL);
Station->TimeLastUpdated = NOW;
return Station;
}
@ -4904,7 +4896,7 @@ struct STATIONRECORD * DecodeAPRSISMsg(char * Msg)
Station->LastPort = 0;
DecodeAPRSPayload(Payload, Station);
Station->TimeLastUpdated = time(NULL);
Station->TimeLastUpdated = NOW;
return Station;
}
@ -5031,7 +5023,6 @@ BOOL DecodeLocationString(UCHAR * Payload, struct STATIONRECORD * Station)
if (Station->Lat != NewLat || Station->Lon != NewLon)
{
time_t NOW = time(NULL);
time_t Age = NOW - Station->TimeLastTracked;
if (Age > 15) // Don't update too often
@ -5138,7 +5129,7 @@ int DecodeAPRSPayload(char * Payload, struct STATIONRECORD * Station)
if (ObjState != '_') // Deleted Objects may have odd positions
DecodeLocationString(ptr, Object);
Object->TimeLastUpdated = time(NULL);
Object->TimeLastUpdated = NOW;
Station->Object = Object;
return 0;
@ -5172,7 +5163,7 @@ int DecodeAPRSPayload(char * Payload, struct STATIONRECORD * Station)
if (ObjState != '_') // Deleted Objects may have odd positions
DecodeLocationString(Payload + 18, Object);
Object->TimeLastUpdated = time(NULL);
Object->TimeLastUpdated = NOW;
Object->LastPort = Station->LastPort;
Station->Object = Object;
return 0;
@ -5241,7 +5232,7 @@ int DecodeAPRSPayload(char * Payload, struct STATIONRECORD * Station)
TPStation->LastPort = 0; // Heard on RF, but info is from IS
DecodeAPRSPayload(Payload, TPStation);
TPStation->TimeLastUpdated = time(NULL);
TPStation->TimeLastUpdated = NOW;
return 0;
@ -5440,7 +5431,6 @@ VOID Decode_MIC_E_Packet(char * Payload, struct STATIONRECORD * Station)
if (Station->Lat != NewLat || Station->Lon != NewLon)
{
time_t NOW = time(NULL);
time_t Age = NOW - Station->TimeLastUpdated;
if (Age > 15) // Don't update too often
@ -5933,8 +5923,6 @@ VOID ProcessMessage(char * Payload, struct STATIONRECORD * Station)
strcpy(Message->Text, TextPtr);
NOW = time(NULL);
if (DefaultLocalTime)
TM = localtime(&NOW);
else
@ -6213,7 +6201,6 @@ VOID SendWeatherBeacon()
char * WXptr;
char * WXend;
time_t WXTime;
time_t now = time(NULL);
FILE * hFile;
struct tm * TM;
struct stat STAT;
@ -6233,7 +6220,7 @@ VOID SendWeatherBeacon()
return;
}
WXTime = (now - STAT.st_mtime) /60; // Minutes
WXTime = (NOW - STAT.st_mtime) /60; // Minutes
if (WXTime > (3 * WXInterval))
{
@ -6811,7 +6798,7 @@ char * APRSLookupKey(struct APRSConnectionInfo * sockptr, char * Key, BOOL KM)
{
char Time[80];
struct tm * TM;
time_t Age = time(NULL) - stn->TimeLastUpdated;
time_t Age = NOW - stn->TimeLastUpdated;
TM = gmtime(&Age);
@ -7738,7 +7725,6 @@ int ProcessMessage(char * Payload, struct STATIONRECORD * Station)
int n = 0;
char FromCall[10] = " ";
struct tm * TM;
time_t NOW;
char noSeq[] = "";
int ourMessage = 0;
@ -7868,8 +7854,6 @@ int ProcessMessage(char * Payload, struct STATIONRECORD * Station)
strcpy(Message->Text, TextPtr);
NOW = time(NULL);
if (DefaultLocalTime)
TM = localtime(&NOW);
else
@ -7933,7 +7917,6 @@ BOOL InternalSendAPRSMessage(char * Text, char * Call)
size_t len = strlen(Call);
APRSHEARDRECORD * STN;
struct tm * TM;
time_t NOW;
struct APRSMESSAGE * Message;
struct APRSMESSAGE * ptr = SMEM->OutstandingMsgs;
@ -7973,8 +7956,6 @@ BOOL InternalSendAPRSMessage(char * Text, char * Call)
Message->Retries = RetryCount;
Message->RetryTimer = RetryTimer;
NOW = time(NULL);
if (DefaultLocalTime)
TM = localtime(&NOW);
else
@ -8008,7 +7989,7 @@ BOOL InternalSendAPRSMessage(char * Text, char * Call)
STN = FindStationInMH(Message->ToCall);
if (STN && STN->MHTIME > (time(NULL) - 900)) // Heard in last 15 mins
if (STN && STN->MHTIME > (NOW - 900)) // Heard in last 15 mins
SendAPRSMessage(Msg, STN->rfPort);
else
{
@ -8646,7 +8627,6 @@ int GetAPRSPageInfo(char * Buffer, double N, double S, double W, double E, int a
struct STATIONRECORD * ptr = *StationRecords;
int n = 0, Len = 0;
struct tm * TM;
time_t NOW = time(NULL);
char popup[65536] = "";
char Msg[2048];
int LocalTime = 0;
@ -9031,7 +9011,7 @@ void SaveAPRSMessage(struct APRSMESSAGE * ptr)
if ((file = fopen(FN, "a")) == NULL)
return ;
fprintf(file, "%d %s,%s,%s,%s,%s\n", time(NULL), ptr->FromCall, ptr->ToCall, ptr->Seq, ptr->Time, ptr->Text);
fprintf(file, "%d %s,%s,%s,%s,%s\n", NOW, ptr->FromCall, ptr->ToCall, ptr->Seq, ptr->Time, ptr->Text);
fclose(file);
}

@ -104,6 +104,7 @@ int ARDOPProcessDEDFrame(struct TNCINFO * TNC, UCHAR * Msg, int framelen);
int ConnecttoARDOP(struct TNCINFO * TNC);
int standardParams(struct TNCINFO * TNC, char * buf);
#ifndef LINBPQ
BOOL CALLBACK EnumARDOPWindowsProc(HWND hwnd, LPARAM lParam);
#endif
@ -170,10 +171,10 @@ BOOL ARDOPStopPort(struct PORTCONTROL * PORT)
}
sprintf(PORT->TNC->WEB_COMMSSTATE, "%s", "Port Stopped");
MySetWindowText(PORT->TNC->xIDC_COMMSSTATE, PORT->TNC->WEB_COMMSSTATE);
MySetWindowText(TNC, PORT->TNC->xIDC_COMMSSTATE, PORT->TNC->WEB_COMMSSTATE);
strcpy(TNC->WEB_TNCSTATE, "Free");
MySetWindowText(TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
MySetWindowText(TNC, TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
return TRUE;
}
@ -187,11 +188,11 @@ BOOL ARDOPStartPort(struct PORTCONTROL * PORT)
if (TNC->ARDOPCommsMode == 'T')
{
ConnecttoARDOP(TNC);
TNC->lasttime = time(NULL);;
TNC->lasttime = NOW;;
}
sprintf(PORT->TNC->WEB_COMMSSTATE, "%s", "Port Restarted");
MySetWindowText(PORT->TNC->xIDC_COMMSSTATE, PORT->TNC->WEB_COMMSSTATE);
MySetWindowText(TNC, PORT->TNC->xIDC_COMMSSTATE, PORT->TNC->WEB_COMMSSTATE);
return TRUE;
}
@ -304,7 +305,7 @@ BOOL ARDOPOpenLogFiles(struct TNCINFO * TNC)
time_t T;
struct tm * tm;
T = time(NULL);
T = NOW;
tm = gmtime(&T);
strlop(TNC->LogPath, 13);
@ -659,7 +660,7 @@ VOID ARDOPSendCommand(struct TNCINFO * TNC, char * Buff, BOOL Queue)
if (memcmp(Buff, "LISTEN ", 7) == 0)
{
strcpy(TNC->WEB_MODE, &Buff[7]);
MySetWindowText(TNC->xIDC_MODE, &Buff[7]);
MySetWindowText(TNC, TNC->xIDC_MODE, &Buff[7]);
}
EncLen = sprintf(Encoded, "%s\r", Buff);
@ -892,7 +893,7 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff)
if ((STREAM->Connecting || STREAM->Connected) && !STREAM->Disconnecting)
{
if (TNC->SessionTimeLimit && STREAM->ConnectTime && time(NULL) > (TNC->SessionTimeLimit + STREAM->ConnectTime))
if (TNC->SessionTimeLimit && STREAM->ConnectTime && NOW > (TNC->SessionTimeLimit + STREAM->ConnectTime))
{
Debugprintf("ARDOP closing session on SessionTimelimit");
ARDOPSendCommand(TNC, "DISCONNECT", TRUE);
@ -905,7 +906,7 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff)
if (STREAM->Attached)
{
if (STREAM->AttachTime && TNC->AttachTimeLimit && time(NULL) > (TNC->AttachTimeLimit + STREAM->AttachTime))
if (STREAM->AttachTime && TNC->AttachTimeLimit && NOW > (TNC->AttachTimeLimit + STREAM->AttachTime))
{
Debugprintf("ARDOP closing session on AttachTimelimit");
STREAM->ReportDISC = 1;
@ -919,12 +920,13 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff)
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
// ARDOP Command Frames. These are hex encoded
if (TNC->ARDOPCommsMode == 'T' && TNC->BPQtoRadio_Q)
{
@ -1042,7 +1044,7 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff)
TNC->Busy--;
if (TNC->Busy == 0)
{
MySetWindowText(TNC->xIDC_CHANSTATE, "Clear");
MySetWindowText(TNC, TNC->xIDC_CHANSTATE, "Clear");
strcpy(TNC->WEB_CHANSTATE, "Clear");
}
}
@ -1065,7 +1067,7 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff)
memcpy(TNC->Streams[0].RemoteCall, &TNC->ConnectCmd[8], (int)strlen(TNC->ConnectCmd)-10);
sprintf(TNC->WEB_TNCSTATE, "%s Connecting to %s", TNC->Streams[0].MyCall, TNC->Streams[0].RemoteCall);
MySetWindowText(TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
MySetWindowText(TNC, TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
free(TNC->ConnectCmd);
TNC->BusyDelay = 0;
@ -1091,7 +1093,7 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff)
free(TNC->ConnectCmd);
sprintf(TNC->WEB_TNCSTATE, "In Use by %s", TNC->Streams[0].MyCall);
MySetWindowText(TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
MySetWindowText(TNC, TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
}
}
@ -1109,7 +1111,7 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff)
fn =fn; //ARDOPSendCommand(TNC, "MODE", TRUE);
else
{
// if (time(NULL) - TNC->WinmorRestartCodecTimer > 300) // 5 mins
// if (NOW - TNC->WinmorRestartCodecTimer > 300) // 5 mins
// {
// ARDOPSendCommand(TNC, "CODEC FALSE", TRUE);
// ARDOPSendCommand(TNC, "CODEC TRUE", TRUE);
@ -1171,18 +1173,18 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff)
char Time[80];
TNC->Restarts++;
TNC->LastRestart = time(NULL);
TNC->LastRestart = NOW;
tm = gmtime(&TNC->LastRestart);
sprintf_s(Time, sizeof(Time),"%04d/%02d/%02d %02d:%02dZ",
tm->tm_year +1900, tm->tm_mon+1, tm->tm_mday, tm->tm_hour, tm->tm_min);
MySetWindowText(TNC->xIDC_RESTARTTIME, Time);
MySetWindowText(TNC, TNC->xIDC_RESTARTTIME, Time);
strcpy(TNC->WEB_RESTARTTIME, Time);
sprintf_s(Time, sizeof(Time),"%d", TNC->Restarts);
MySetWindowText(TNC->xIDC_RESTARTS, Time);
MySetWindowText(TNC, TNC->xIDC_RESTARTS, Time);
strcpy(TNC->WEB_RESTARTS, Time);
KillTNC(TNC);
@ -1225,7 +1227,7 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff)
Debugprintf("ARDOP New Attach Stream %d DEDStream %d", Stream, STREAM->DEDStream);
STREAM->Attached = TRUE;
STREAM->AttachTime = time(NULL);
STREAM->AttachTime = NOW;
calllen = ConvFromAX25(TNC->PortRecord->ATTACHEDSESSIONS[Stream]->L4USER, TNC->Streams[Stream].MyCall);
TNC->Streams[Stream].MyCall[calllen] = 0;
@ -1248,7 +1250,7 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff)
SuspendOtherPorts(TNC);
sprintf(TNC->WEB_TNCSTATE, "In Use by %s", TNC->Streams[0].MyCall);
MySetWindowText(TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
MySetWindowText(TNC, TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
// Stop Scanning
@ -1667,7 +1669,7 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff)
// Save Command, and wait up to 10 secs
sprintf(TNC->WEB_TNCSTATE, "Waiting for clear channel");
MySetWindowText(TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
MySetWindowText(TNC, TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
TNC->ConnectCmd = _strdup(Connect);
TNC->BusyDelay = TNC->BusyWait * 10; // BusyWait secs
@ -1684,7 +1686,7 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff)
sprintf(TNC->WEB_TNCSTATE, "%s Connecting to %s", STREAM->MyCall, STREAM->RemoteCall);
ARDOPSendCommand(TNC, Connect, TRUE);
MySetWindowText(TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
MySetWindowText(TNC, TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
}
else
{
@ -1695,7 +1697,7 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff)
}
STREAM->Connecting = TRUE;
STREAM->ConnectTime = time(NULL);
STREAM->ConnectTime = NOW;
return 0;
}
@ -1895,7 +1897,7 @@ VOID ARDOPReleaseTNC(struct TNCINFO * TNC)
ARDOPChangeMYC(TNC, TNC->NodeCall);
strcpy(TNC->WEB_TNCSTATE, "Free");
MySetWindowText(TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
MySetWindowText(TNC, TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
ARDOPSendCommand(TNC, "LISTEN TRUE", TRUE);
@ -1919,7 +1921,7 @@ VOID ARDOPSuspendPort(struct TNCINFO * TNC, struct TNCINFO * ThisTNC)
TNC->PortRecord->PORTCONTROL.PortSuspended = TRUE;
ARDOPSendCommand(TNC, "LISTEN FALSE", TRUE);
strcpy(TNC->WEB_TNCSTATE, "Interlocked");
MySetWindowText(TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
MySetWindowText(TNC, TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
}
@ -1928,15 +1930,19 @@ VOID ARDOPReleasePort(struct TNCINFO * TNC)
TNC->PortRecord->PORTCONTROL.PortSuspended = FALSE;
ARDOPSendCommand(TNC, "LISTEN TRUE", TRUE);
strcpy(TNC->WEB_TNCSTATE, "Free");
MySetWindowText(TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
MySetWindowText(TNC, TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
}
extern char WebProcTemplate[];
extern char Menubit[];
extern char sliderBit[];
static int WebProc(struct TNCINFO * TNC, char * Buff, BOOL LOCAL)
{
int Len = sprintf(Buff, WebProcTemplate, TNC->Port, TNC->Port, "ARDOP Status", "ARDOP Status");
{
int Len = sprintf(Buff, WebProcTemplate, "ARDOP Status");
if (LOCAL)
Len += sprintf(&Buff[Len], Menubit);
if (TNC->TXFreq)
Len += sprintf(&Buff[Len], sliderBit, TNC->TXOffset, TNC->TXOffset);
@ -2300,7 +2306,7 @@ VOID TNCLost(struct TNCINFO * TNC)
{
sprintf(TNC->WEB_TRAFFIC, "Sent %d RXed %d Queued %d",
STREAM->bytesTXed - STREAM->BytesOutstanding, STREAM->bytesRXed, STREAM->BytesOutstanding);
MySetWindowText(TNC->xIDC_TRAFFIC, TNC->WEB_TRAFFIC);
MySetWindowText(TNC, TNC->xIDC_TRAFFIC, TNC->WEB_TRAFFIC);
}
if (STREAM->Attached)
@ -2481,7 +2487,7 @@ VOID ARDOPThread(VOID * Param)
WritetoConsole(Msg);
sprintf(TNC->WEB_COMMSSTATE, "Connection to TNC failed");
MySetWindowText(TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE);
MySetWindowText(TNC, TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE);
TNC->Alerted = TRUE;
}
@ -2511,7 +2517,7 @@ VOID ARDOPThread(VOID * Param)
i=sprintf(Msg, "Connect Failed for ARDOP Data socket - error code = %d\r\n", err);
WritetoConsole(Msg);
sprintf(TNC->WEB_COMMSSTATE, "Connection to TNC failed");
MySetWindowText(TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE);
MySetWindowText(TNC, TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE);
TNC->Alerted = TRUE;
}
@ -2615,7 +2621,7 @@ VOID ARDOPThread(VOID * Param)
time_t T;
struct tm * tm;
T = time(NULL);
T = NOW;
tm = gmtime(&T);
sprintf(Cmd, "DATETIME %02d %02d %02d %02d %02d %02d",
@ -2638,7 +2644,7 @@ VOID ARDOPThread(VOID * Param)
ARDOPSendCommand(TNC, "LISTEN TRUE", TRUE);
sprintf(TNC->WEB_COMMSSTATE, "Connected to ARDOP TNC");
MySetWindowText(TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE);
MySetWindowText(TNC, TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE);
FreeSemaphore(&Semaphore);
@ -2714,10 +2720,10 @@ VOID ARDOPThread(VOID * Param)
WritetoConsole(Msg);
sprintf(TNC->WEB_COMMSSTATE, "Connection to TNC lost");
MySetWindowText(TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE);
MySetWindowText(TNC, TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE);
strcpy(TNC->WEB_TNCSTATE, "Free");
MySetWindowText(TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
MySetWindowText(TNC, TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
TNC->CONNECTED = FALSE;
@ -2757,7 +2763,7 @@ Lost:
WritetoConsole(Msg);
sprintf(TNC->WEB_COMMSSTATE, "Connection to TNC lost");
MySetWindowText(TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE);
MySetWindowText(TNC, TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE);
TNC->CONNECTED = FALSE;
TNC->Alerted = FALSE;
@ -2781,7 +2787,7 @@ Lost:
WritetoConsole(Msg);
sprintf(TNC->WEB_COMMSSTATE, "Connection to TNC lost");
MySetWindowText(TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE);
MySetWindowText(TNC, TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE);
TNC->CONNECTED = FALSE;
TNC->Alerted = FALSE;
@ -2831,7 +2837,7 @@ Lost:
// sprintf(TNC->WEB_COMMSSTATE, "Connection to TNC lost");
// GetSemaphore(&Semaphore, 52);
// MySetWindowText(TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE);
// MySetWindowText(TNC, TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE);
// FreeSemaphore(&Semaphore);
@ -2956,7 +2962,7 @@ VOID ARDOPProcessResponse(struct TNCINFO * TNC, UCHAR * Buffer, int MsgLen)
{
sscanf(&Buffer[10], "%i %i", &TNC->InputLevelMin, &TNC->InputLevelMax);
sprintf(TNC->WEB_LEVELS, "Input peaks %s", &Buffer[10]);
MySetWindowText(TNC->xIDC_LEVELS, TNC->WEB_LEVELS);
MySetWindowText(TNC, TNC->xIDC_LEVELS, TNC->WEB_LEVELS);
return; // Response shouldn't go to user
}
@ -3034,10 +3040,10 @@ VOID ARDOPProcessResponse(struct TNCINFO * TNC, UCHAR * Buffer, int MsgLen)
TNC->BusyonTime = GetTickCount();
MySetWindowText(TNC->xIDC_CHANSTATE, "Busy");
MySetWindowText(TNC, TNC->xIDC_CHANSTATE, "Busy");
strcpy(TNC->WEB_CHANSTATE, "Busy");
TNC->WinmorRestartCodecTimer = time(NULL);
TNC->WinmorRestartCodecTimer = NOW;
return;
}
@ -3056,8 +3062,8 @@ VOID ARDOPProcessResponse(struct TNCINFO * TNC, UCHAR * Buffer, int MsgLen)
TNC->BusyonTime = 0;
}
MySetWindowText(TNC->xIDC_CHANSTATE, TNC->WEB_CHANSTATE);
TNC->WinmorRestartCodecTimer = time(NULL);
MySetWindowText(TNC, TNC->xIDC_CHANSTATE, TNC->WEB_CHANSTATE);
TNC->WinmorRestartCodecTimer = NOW;
return;
}
@ -3107,7 +3113,7 @@ VOID ARDOPProcessResponse(struct TNCINFO * TNC, UCHAR * Buffer, int MsgLen)
sprintf(TNC->WEB_TRAFFIC, "Sent %d RXed %d Queued %d",
STREAM->bytesTXed - STREAM->BytesOutstanding, STREAM->bytesRXed, STREAM->BytesOutstanding);
MySetWindowText(TNC->xIDC_TRAFFIC, TNC->WEB_TRAFFIC);
MySetWindowText(TNC, TNC->xIDC_TRAFFIC, TNC->WEB_TRAFFIC);
return;
}
@ -3125,7 +3131,7 @@ VOID ARDOPProcessResponse(struct TNCINFO * TNC, UCHAR * Buffer, int MsgLen)
Debugprintf(Buffer);
WritetoTrace(TNC, Buffer, MsgLen - 1);
STREAM->ConnectTime = time(NULL);
STREAM->ConnectTime = NOW;
STREAM->bytesRXed = STREAM->bytesTXed = STREAM->PacketsSent = 0;
memcpy(Call, &Buffer[10], 10);
@ -3159,7 +3165,7 @@ VOID ARDOPProcessResponse(struct TNCINFO * TNC, UCHAR * Buffer, int MsgLen)
// Incoming Connect
TNC->SessionTimeLimit = TNC->DefaultSessionTimeLimit; // Reset Limit
STREAM->AttachTime = time(NULL);
STREAM->AttachTime = NOW;
// Stop other ports in same group
@ -3190,7 +3196,7 @@ VOID ARDOPProcessResponse(struct TNCINFO * TNC, UCHAR * Buffer, int MsgLen)
if (WL2K)
strcpy(SESS->RMSCall, WL2K->RMSCall);
MySetWindowText(TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
MySetWindowText(TNC, TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
// Check for ExcludeList
@ -3335,7 +3341,7 @@ VOID ARDOPProcessResponse(struct TNCINFO * TNC, UCHAR * Buffer, int MsgLen)
else
sprintf(TNC->WEB_TNCSTATE, "%s Connected to %s Outbound", TNC->Streams[0].MyCall, TNC->Streams[0].RemoteCall);
MySetWindowText(TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
MySetWindowText(TNC, TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
UpdateMH(TNC, Call, '+', 'O');
return;
@ -3387,7 +3393,7 @@ VOID ARDOPProcessResponse(struct TNCINFO * TNC, UCHAR * Buffer, int MsgLen)
}
sprintf(TNC->WEB_TNCSTATE, "In Use by %s", TNC->Streams[0].MyCall);
MySetWindowText(TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
MySetWindowText(TNC, TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
return;
}
@ -3420,7 +3426,7 @@ VOID ARDOPProcessResponse(struct TNCINFO * TNC, UCHAR * Buffer, int MsgLen)
if (_memicmp(Buffer, "MODE", 4) == 0)
{
strcpy(TNC->WEB_MODE, &Buffer[5]);
MySetWindowText(TNC->xIDC_MODE, &Buffer[5]);
MySetWindowText(TNC, TNC->xIDC_MODE, &Buffer[5]);
return;
}
@ -3506,9 +3512,9 @@ VOID ARDOPProcessResponse(struct TNCINFO * TNC, UCHAR * Buffer, int MsgLen)
if (_memicmp(Buffer, "NEWSTATE", 8) == 0)
{
TNC->WinmorRestartCodecTimer = time(NULL);
TNC->WinmorRestartCodecTimer = NOW;
MySetWindowText(TNC->xIDC_PROTOSTATE, &Buffer[9]);
MySetWindowText(TNC, TNC->xIDC_PROTOSTATE, &Buffer[9]);
strcpy(TNC->WEB_PROTOSTATE, &Buffer[9]);
if (_memicmp(&Buffer[9], "DISC", 4) == 0)
@ -3887,7 +3893,7 @@ VOID ARDOPProcessDataPacket(struct TNCINFO * TNC, UCHAR * Type, UCHAR * Data, in
sprintf(TNC->WEB_TRAFFIC, "Sent %d RXed %d Queued %d",
STREAM->bytesTXed - STREAM->BytesOutstanding, STREAM->bytesRXed, STREAM->BytesOutstanding);
MySetWindowText(TNC->xIDC_TRAFFIC, TNC->WEB_TRAFFIC);
MySetWindowText(TNC, TNC->xIDC_TRAFFIC, TNC->WEB_TRAFFIC);
if (TNC->FECMode)
@ -4534,7 +4540,7 @@ VOID ARDOPProcessTermModeResponse(struct TNCINFO * TNC)
time_t T;
struct tm * tm;
T = time(NULL);
T = NOW;
tm = gmtime(&T);
len = sprintf(Poll, "DATETIME %02d %02d %02d %02d %02d %02d\r",
@ -5034,7 +5040,7 @@ tcpHostFrame:
Buffer[len-1] = 0;
WritetoTrace(TNC, Buffer, len);
STREAM->ConnectTime = time(NULL);
STREAM->ConnectTime = NOW;
STREAM->bytesRXed = STREAM->bytesTXed = STREAM->PacketsSent = 0;
memcpy(Call, &Buffer[19], 10);
@ -5866,7 +5872,7 @@ VOID SerialConnecttoTCPThread(VOID * Param)
WritetoConsole(Msg);
sprintf(TNC->WEB_COMMSSTATE, "Connection to TNC failed");
MySetWindowText(TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE);
MySetWindowText(TNC, TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE);
TNC->Alerted = TRUE;
}

@ -97,10 +97,10 @@ VOID __cdecl Debugprintf(const char * format, ...);
VOID SendINP3RIF(struct ROUTE * Route, UCHAR * Call, UCHAR * Alias, int Hops, int RTT);
VOID SendOurRIF(struct ROUTE * Route);
VOID UpdateNode(struct ROUTE * Route, UCHAR * axcall, int hops, int rtt, time_t Now, unsigned char * Options);
VOID UpdateRoute(struct DEST_LIST * Dest, struct INP3_DEST_ROUTE_ENTRY * ROUTEPTR, int hops, int rtt, time_t Now);
VOID UpdateNode(struct ROUTE * Route, UCHAR * axcall, int hops, int rtt, unsigned char * Options);
VOID UpdateRoute(struct DEST_LIST * Dest, struct INP3_DEST_ROUTE_ENTRY * ROUTEPTR, int hops, int rtt);
VOID KillRoute(struct INP3_DEST_ROUTE_ENTRY * ROUTEPTR);
VOID AddHere(struct INP3_DEST_ROUTE_ENTRY * ROUTEPTR,struct ROUTE * Route , int hops, int rtt, time_t Now);
VOID AddHere(struct INP3_DEST_ROUTE_ENTRY * ROUTEPTR,struct ROUTE * Route , int hops, int rtt);
VOID SendRIFToNewNeighbour(struct ROUTE * Route);
VOID DecayNETROMRoutes(struct ROUTE * Route);
VOID DeleteINP3Routes(struct ROUTE * Route);
@ -138,7 +138,7 @@ VOID InitialiseRTT()
{
UCHAR temp[256] = "";
SENDRIFTIME = time(NULL);
SENDRIFTIME = NOW;
memset(&RTTMsg, ' ', sizeof(struct _RTTMSG));
memcpy(RTTMsg.ID, "L3RTT: ", 7);
@ -371,22 +371,30 @@ VOID ProcessRTTReply(struct ROUTE * Route, struct _L3MESSAGEBUFFER * Buff)
if (RTT > 60000)
return; // Ignore if more than 60 secs (why ??)
if (RTT == 0)
RTT = 1; // Don't allow a Node TT of zero
if (Route->NPR)
{
Route->RTTIncrement = Route->SRTT = Route->RTT = Route->NPR;
if (DEBUGINP3) Debugprintf("INP3 RTT reply from %s - NPR Set RTT was %d setting to %d", Normcall, RTT, Route->NPR);
}
else
{
if (RTT == 0)
RTT = 1; // Don't allow a Node TT of zero
if (DEBUGINP3) Debugprintf("INP3 RTT reply from %s - SRTT was %d, Current RTT %d", Normcall, Route->SRTT, RTT);
if (DEBUGINP3) Debugprintf("INP3 RTT reply from %s - SRTT was %d, Current RTT %d", Normcall, Route->SRTT, RTT);
Route->RTT = RTT;
Route->RTT = RTT;
if (Route->SRTT == 0)
Route->SRTT = RTT;
else
Route->SRTT = ((Route->SRTT * 80)/100) + ((RTT * 20)/100);
if (Route->SRTT == 0)
Route->SRTT = RTT;
else
Route->SRTT = ((Route->SRTT * 80)/100) + ((RTT * 20)/100);
Route->RTTIncrement = Route->SRTT / 2; // Half for one way time.
Route->RTTIncrement = Route->SRTT / 2; // Half for one way time.
if (Route->RTTIncrement == 0)
Route->RTTIncrement = 1;
if (Route->RTTIncrement == 0)
Route->RTTIncrement = 1;
}
if (Route->senderaddsRTT)
Route->TXRTTIncrement = Route->RTTIncrement;
@ -429,7 +437,6 @@ VOID ProcessINP3RIF(struct ROUTE * Route, UCHAR * ptr1, int msglen, int Port)
char alias[6];
UINT Stamp, HH, MM;
char Normcall[10];
time_t Now = time(NULL);
unsigned char * Options;
int i;
UCHAR * oldptr1;
@ -455,7 +462,7 @@ VOID ProcessINP3RIF(struct ROUTE * Route, UCHAR * ptr1, int msglen, int Port)
// Update Timestamp on Route
Stamp = Now % 86400; // Secs into day
Stamp = NOW % 86400; // Secs into day
HH = Stamp / 3600;
Stamp -= HH * 3600;
@ -512,7 +519,7 @@ VOID ProcessINP3RIF(struct ROUTE * Route, UCHAR * ptr1, int msglen, int Port)
ptr1++;
msglen--; // EOP
UpdateNode(Route, axcall, hops, rtt, Now, Options);
UpdateNode(Route, axcall, hops, rtt, Options);
}
@ -524,7 +531,7 @@ VOID KillRoute(struct INP3_DEST_ROUTE_ENTRY * ROUTEPTR)
}
VOID UpdateNode(struct ROUTE * Route, UCHAR * axcall, int hops, int rtt, time_t Now, unsigned char * Options)
VOID UpdateNode(struct ROUTE * Route, UCHAR * axcall, int hops, int rtt, unsigned char * Options)
{
struct DEST_LIST * Dest;
struct INP3_DEST_ROUTE_ENTRY * ROUTEPTR;
@ -645,7 +652,7 @@ VOID UpdateNode(struct ROUTE * Route, UCHAR * axcall, int hops, int rtt, time_t
Dest->INP3ROUTE[0].Hops = hops;
Dest->INP3ROUTE[0].STT = rtt;
Dest->INP3ROUTE[0].LastRefreshed = Now;
Dest->INP3ROUTE[0].LastRefreshed = NOW;
Dest->INP3FLAGS = NewNode;
@ -689,7 +696,7 @@ Found:
if (ROUTEPTR->ROUT_NEIGHBOUR == Route)
{
if (DEBUGINP3) Debugprintf("INP3 Already have as route[0] - TT was %d updating to %d", ROUTEPTR->STT, rtt);
UpdateRoute(Dest, ROUTEPTR, hops, rtt, Now);
UpdateRoute(Dest, ROUTEPTR, hops, rtt);
return;
}
@ -698,7 +705,7 @@ Found:
if (ROUTEPTR->ROUT_NEIGHBOUR == Route)
{
if (DEBUGINP3) Debugprintf("INP3 Already have as route[1] - TT was %d updating to %d", ROUTEPTR->STT, rtt);
UpdateRoute(Dest, ROUTEPTR, hops, rtt, Now);
UpdateRoute(Dest, ROUTEPTR, hops, rtt);
return;
}
@ -707,7 +714,7 @@ Found:
if (ROUTEPTR->ROUT_NEIGHBOUR == Route)
{
if (DEBUGINP3) Debugprintf("INP3 Already have as route[2] - TT was %d updating to %d", ROUTEPTR->STT, rtt);
UpdateRoute(Dest, ROUTEPTR, hops, rtt, Now);
UpdateRoute(Dest, ROUTEPTR, hops, rtt);
return;
}
@ -723,7 +730,7 @@ Found:
// Add here
if (DEBUGINP3) Debugprintf("INP3 adding as route[%d]", i);
AddHere(ROUTEPTR, Route, hops, rtt, Now);
AddHere(ROUTEPTR, Route, hops, rtt);
if (i == 0)
Dest->LastTT = 0;
SortRoutes(Dest);
@ -745,7 +752,7 @@ Found:
memcpy(&Dest->INP3ROUTE[2], &Dest->INP3ROUTE[1], sizeof(struct INP3_DEST_ROUTE_ENTRY));
memcpy(&Dest->INP3ROUTE[1], &Dest->INP3ROUTE[0], sizeof(struct INP3_DEST_ROUTE_ENTRY));
AddHere(&Dest->INP3ROUTE[0], Route, hops, rtt, Now);
AddHere(&Dest->INP3ROUTE[0], Route, hops, rtt);
return;
}
@ -755,7 +762,7 @@ Found:
if (DEBUGINP3) Debugprintf("INP3 Replacing route 1");
memcpy(&Dest->INP3ROUTE[2], &Dest->INP3ROUTE[1], sizeof(struct INP3_DEST_ROUTE_ENTRY));
AddHere(&Dest->INP3ROUTE[1], Route, hops, rtt, Now);
AddHere(&Dest->INP3ROUTE[1], Route, hops, rtt);
return;
}
@ -764,7 +771,7 @@ Found:
// We are better. Add here
if (DEBUGINP3) Debugprintf("INP3 Replacing route 2");
AddHere(&Dest->INP3ROUTE[2], Route, hops, rtt, Now);
AddHere(&Dest->INP3ROUTE[2], Route, hops, rtt);
return;
}
@ -776,12 +783,12 @@ Found:
}
VOID AddHere(struct INP3_DEST_ROUTE_ENTRY * ROUTEPTR,struct ROUTE * Route , int hops, int rtt, time_t Now)
VOID AddHere(struct INP3_DEST_ROUTE_ENTRY * ROUTEPTR,struct ROUTE * Route , int hops, int rtt)
{
ROUTEPTR->Hops = hops;
ROUTEPTR->STT = rtt;
ROUTEPTR->ROUT_NEIGHBOUR = Route;
ROUTEPTR->LastRefreshed = Now;
ROUTEPTR->LastRefreshed = NOW;
return;
}
@ -792,6 +799,9 @@ struct INP3_DEST_ROUTE_ENTRY Temp;
VOID SortRoutes(struct DEST_LIST * Dest)
{
char Call1[10], Call2[10], Call3[10];
struct INP3_DEST_ROUTE_ENTRY * E0 = &Dest->INP3ROUTE[0];
struct INP3_DEST_ROUTE_ENTRY * E1 = &Dest->INP3ROUTE[1];
struct INP3_DEST_ROUTE_ENTRY * E2 = &Dest->INP3ROUTE[2];
// force route re-evaluation
@ -799,101 +809,112 @@ VOID SortRoutes(struct DEST_LIST * Dest)
// May now be out of order
if (Dest->INP3ROUTE[1].ROUT_NEIGHBOUR == 0)
if (E1->ROUT_NEIGHBOUR == 0)
{
Call1[ConvFromAX25(Dest->INP3ROUTE[0].ROUT_NEIGHBOUR->NEIGHBOUR_CALL, Call1)] = 0;
if (DEBUGINP3) Debugprintf("INP3 1 route %d %s", Dest->INP3ROUTE[0].STT, Call1);
return; // Only One, so cant be out of order
if (DEBUGINP3)
{
Call1[ConvFromAX25(E0->ROUT_NEIGHBOUR->NEIGHBOUR_CALL, Call1)] = 0;
Debugprintf("INP3 1 route %d %s", E0->STT, Call1);
}
return; // Only One, so can't be out of order
}
if (Dest->INP3ROUTE[2].ROUT_NEIGHBOUR == 0)
if (E2->ROUT_NEIGHBOUR == 0)
{
// Only 2
Call1[ConvFromAX25(Dest->INP3ROUTE[0].ROUT_NEIGHBOUR->NEIGHBOUR_CALL, Call1)] = 0;
Call2[ConvFromAX25(Dest->INP3ROUTE[1].ROUT_NEIGHBOUR->NEIGHBOUR_CALL, Call2)] = 0;
if (DEBUGINP3) Debugprintf("INP3 2 routes %d %s %d %s", Dest->INP3ROUTE[0].STT, Call1, Dest->INP3ROUTE[1].STT, Call2);
if (DEBUGINP3)
{
Call1[ConvFromAX25(E0->ROUT_NEIGHBOUR->NEIGHBOUR_CALL, Call1)] = 0;
Call2[ConvFromAX25(E1->ROUT_NEIGHBOUR->NEIGHBOUR_CALL, Call2)] = 0;
Debugprintf("INP3 2 routes %d %s %d %s", E0->STT, Call1, E1->STT, Call2);
}
if (Dest->INP3ROUTE[0].STT <= Dest->INP3ROUTE[1].STT)
if (E0->STT < E1->STT || (E0->STT == E1->STT && E0->Hops <= E1->Hops))
return;
// Swap one and two
memcpy(&Temp, &Dest->INP3ROUTE[0], sizeof(struct INP3_DEST_ROUTE_ENTRY));
memcpy(&Dest->INP3ROUTE[0], &Dest->INP3ROUTE[1], sizeof(struct INP3_DEST_ROUTE_ENTRY));
memcpy(&Dest->INP3ROUTE[1], &Temp, sizeof(struct INP3_DEST_ROUTE_ENTRY));
memcpy(&Temp, E0, sizeof(struct INP3_DEST_ROUTE_ENTRY));
memcpy(E0, E1, sizeof(struct INP3_DEST_ROUTE_ENTRY));
memcpy(E1, &Temp, sizeof(struct INP3_DEST_ROUTE_ENTRY));
if (DEBUGINP3) Debugprintf("INP3 2 routes %d %s %d %s", E0->STT, Call2, E1->STT, Call1);
Call1[ConvFromAX25(Dest->INP3ROUTE[0].ROUT_NEIGHBOUR->NEIGHBOUR_CALL, Call1)] = 0;
Call2[ConvFromAX25(Dest->INP3ROUTE[1].ROUT_NEIGHBOUR->NEIGHBOUR_CALL, Call2)] = 0;
if (DEBUGINP3) Debugprintf("INP3 2 routes %d %s %d %s", Dest->INP3ROUTE[0].STT, Call1, Dest->INP3ROUTE[1].STT, Call2);
return;
}
// Have 3 Entries
Call1[ConvFromAX25(Dest->INP3ROUTE[0].ROUT_NEIGHBOUR->NEIGHBOUR_CALL, Call1)] = 0;
Call2[ConvFromAX25(Dest->INP3ROUTE[1].ROUT_NEIGHBOUR->NEIGHBOUR_CALL, Call2)] = 0;
Call3[ConvFromAX25(Dest->INP3ROUTE[2].ROUT_NEIGHBOUR->NEIGHBOUR_CALL, Call3)] = 0;
if (DEBUGINP3)
{
Call1[ConvFromAX25(E0->ROUT_NEIGHBOUR->NEIGHBOUR_CALL, Call1)] = 0;
Call2[ConvFromAX25(E1->ROUT_NEIGHBOUR->NEIGHBOUR_CALL, Call2)] = 0;
Call3[ConvFromAX25(E2->ROUT_NEIGHBOUR->NEIGHBOUR_CALL, Call3)] = 0;
Debugprintf("INP3 3 routes %d %s %d %s %d %s", E0->STT, Call1, E1->STT, Call2, E2->STT, Call3);
}
if (DEBUGINP3) Debugprintf("INP3 3 routes %d %s %d %s %d %s", Dest->INP3ROUTE[0].STT, Call1, Dest->INP3ROUTE[1].STT, Call2, Dest->INP3ROUTE[2].STT, Call3);
// In order?
if (Dest->INP3ROUTE[0].STT <= Dest->INP3ROUTE[1].STT && Dest->INP3ROUTE[1].STT <= Dest->INP3ROUTE[2].STT)// In order?
if ((E0->STT < E1->STT || (E0->STT == E1->STT && E0->Hops <= E1->Hops)) && (E1->STT < E2->STT || (E1->STT == E2->STT && E1->Hops <= E2->Hops)))
return;
// If second is better that first swap
if (Dest->INP3ROUTE[0].STT > Dest->INP3ROUTE[1].STT)
if (E0->STT > E1->STT || (E0->STT == E1->STT && E0->Hops > E1->Hops))
{
memcpy(&Temp, &Dest->INP3ROUTE[0], sizeof(struct INP3_DEST_ROUTE_ENTRY));
memcpy(&Dest->INP3ROUTE[0], &Dest->INP3ROUTE[1], sizeof(struct INP3_DEST_ROUTE_ENTRY));
memcpy(&Dest->INP3ROUTE[1], &Temp, sizeof(struct INP3_DEST_ROUTE_ENTRY));
memcpy(&Temp, E0, sizeof(struct INP3_DEST_ROUTE_ENTRY));
memcpy(E0, E1, sizeof(struct INP3_DEST_ROUTE_ENTRY));
memcpy(E1, &Temp, sizeof(struct INP3_DEST_ROUTE_ENTRY));
}
Call1[ConvFromAX25(Dest->INP3ROUTE[0].ROUT_NEIGHBOUR->NEIGHBOUR_CALL, Call1)] = 0;
Call2[ConvFromAX25(Dest->INP3ROUTE[1].ROUT_NEIGHBOUR->NEIGHBOUR_CALL, Call2)] = 0;
Call3[ConvFromAX25(Dest->INP3ROUTE[2].ROUT_NEIGHBOUR->NEIGHBOUR_CALL, Call3)] = 0;
Call1[ConvFromAX25(E0->ROUT_NEIGHBOUR->NEIGHBOUR_CALL, Call1)] = 0;
Call2[ConvFromAX25(E1->ROUT_NEIGHBOUR->NEIGHBOUR_CALL, Call2)] = 0;
Call3[ConvFromAX25(E2->ROUT_NEIGHBOUR->NEIGHBOUR_CALL, Call3)] = 0;
if (DEBUGINP3) Debugprintf("INP3 3 routes %d %s %d %s %d %s", Dest->INP3ROUTE[0].STT, Call1, Dest->INP3ROUTE[1].STT, Call2, Dest->INP3ROUTE[2].STT, Call3);
if (DEBUGINP3) Debugprintf("INP3 3 routes %d %s %d %s %d %s", E0->STT, Call1, E1->STT, Call2, E2->STT, Call3);
// if 3 is better than 2 swap them. As two is worse than one. three will then be worst
if (Dest->INP3ROUTE[1].STT > Dest->INP3ROUTE[2].STT)
if (E1->STT > E2->STT || (E1->STT == E2->STT && E1->Hops > E2->Hops))
{
memcpy(&Temp, &Dest->INP3ROUTE[1], sizeof(struct INP3_DEST_ROUTE_ENTRY));
memcpy(&Dest->INP3ROUTE[1], &Dest->INP3ROUTE[2], sizeof(struct INP3_DEST_ROUTE_ENTRY));
memcpy(&Dest->INP3ROUTE[2], &Temp, sizeof(struct INP3_DEST_ROUTE_ENTRY));
memcpy(&Temp, E1, sizeof(struct INP3_DEST_ROUTE_ENTRY));
memcpy(E1, E2, sizeof(struct INP3_DEST_ROUTE_ENTRY));
memcpy(E2, &Temp, sizeof(struct INP3_DEST_ROUTE_ENTRY));
}
Call1[ConvFromAX25(Dest->INP3ROUTE[0].ROUT_NEIGHBOUR->NEIGHBOUR_CALL, Call1)] = 0;
Call2[ConvFromAX25(Dest->INP3ROUTE[1].ROUT_NEIGHBOUR->NEIGHBOUR_CALL, Call2)] = 0;
Call3[ConvFromAX25(Dest->INP3ROUTE[2].ROUT_NEIGHBOUR->NEIGHBOUR_CALL, Call3)] = 0;
Call1[ConvFromAX25(E0->ROUT_NEIGHBOUR->NEIGHBOUR_CALL, Call1)] = 0;
Call2[ConvFromAX25(E1->ROUT_NEIGHBOUR->NEIGHBOUR_CALL, Call2)] = 0;
Call3[ConvFromAX25(E2->ROUT_NEIGHBOUR->NEIGHBOUR_CALL, Call3)] = 0;
if (DEBUGINP3) Debugprintf("INP3 3 routes %d %s %d %s %d %s", Dest->INP3ROUTE[0].STT, Call1, Dest->INP3ROUTE[1].STT, Call2, Dest->INP3ROUTE[2].STT, Call3);
if (DEBUGINP3) Debugprintf("INP3 3 routes %d %s %d %s %d %s", E0->STT, Call1, E1->STT, Call2, E2->STT, Call3);
// 3 is now slowest. 2 could still be better than 1
if (Dest->INP3ROUTE[0].STT > Dest->INP3ROUTE[1].STT)
if (E0->STT > E1->STT || (E0->STT == E1->STT && E0->Hops > E1->Hops))
{
memcpy(&Temp, &Dest->INP3ROUTE[0], sizeof(struct INP3_DEST_ROUTE_ENTRY));
memcpy(&Dest->INP3ROUTE[0], &Dest->INP3ROUTE[1], sizeof(struct INP3_DEST_ROUTE_ENTRY));
memcpy(&Dest->INP3ROUTE[1], &Temp, sizeof(struct INP3_DEST_ROUTE_ENTRY));
memcpy(&Temp, E0, sizeof(struct INP3_DEST_ROUTE_ENTRY));
memcpy(E0, E1, sizeof(struct INP3_DEST_ROUTE_ENTRY));
memcpy(E1, &Temp, sizeof(struct INP3_DEST_ROUTE_ENTRY));
}
if (DEBUGINP3)
{
E0 = &Dest->INP3ROUTE[0];
E1 = &Dest->INP3ROUTE[1];
E2 = &Dest->INP3ROUTE[2];
Call1[ConvFromAX25(Dest->INP3ROUTE[0].ROUT_NEIGHBOUR->NEIGHBOUR_CALL, Call1)] = 0;
Call2[ConvFromAX25(Dest->INP3ROUTE[1].ROUT_NEIGHBOUR->NEIGHBOUR_CALL, Call2)] = 0;
Call3[ConvFromAX25(Dest->INP3ROUTE[2].ROUT_NEIGHBOUR->NEIGHBOUR_CALL, Call3)] = 0;
Call1[ConvFromAX25(E0->ROUT_NEIGHBOUR->NEIGHBOUR_CALL, Call1)] = 0;
Call2[ConvFromAX25(E1->ROUT_NEIGHBOUR->NEIGHBOUR_CALL, Call2)] = 0;
Call3[ConvFromAX25(E2->ROUT_NEIGHBOUR->NEIGHBOUR_CALL, Call3)] = 0;
if (DEBUGINP3) Debugprintf("INP3 3 routes %d %s %d %s %d %s", Dest->INP3ROUTE[0].STT, Call1, Dest->INP3ROUTE[1].STT, Call2, Dest->INP3ROUTE[2].STT, Call3);
Debugprintf("INP3 3 routes %d %s %d %s %d %s", E0->STT, Call1, E1->STT, Call2, E2->STT, Call3);
}
if (Dest->INP3ROUTE[0].STT <= Dest->INP3ROUTE[1].STT && Dest->INP3ROUTE[1].STT <= Dest->INP3ROUTE[2].STT)// In order?
if (E0->STT <= E1->STT && E1->STT <= E2->STT)// In order?
return;
// Something went wrong
@ -931,7 +952,7 @@ VOID UpdateTTforRoute(struct ROUTE * Route, int TTChange)
VOID UpdateRoute(struct DEST_LIST * Dest, struct INP3_DEST_ROUTE_ENTRY * ROUTEPTR, int hops, int rtt, time_t Now)
VOID UpdateRoute(struct DEST_LIST * Dest, struct INP3_DEST_ROUTE_ENTRY * ROUTEPTR, int hops, int rtt)
{
if (ROUTEPTR->Hops == 0)
{
@ -939,7 +960,7 @@ VOID UpdateRoute(struct DEST_LIST * Dest, struct INP3_DEST_ROUTE_ENTRY * ROUTEPT
ROUTEPTR->Hops = hops;
ROUTEPTR->STT = rtt;
ROUTEPTR->LastRefreshed = Now;
ROUTEPTR->LastRefreshed = NOW;
SortRoutes(Dest);
return;
@ -949,7 +970,7 @@ VOID UpdateRoute(struct DEST_LIST * Dest, struct INP3_DEST_ROUTE_ENTRY * ROUTEPT
{
ROUTEPTR->STT = rtt;
ROUTEPTR->Hops = hops;
ROUTEPTR->LastRefreshed = Now;
ROUTEPTR->LastRefreshed = NOW;
SortRoutes(Dest);
return;
@ -958,7 +979,7 @@ VOID UpdateRoute(struct DEST_LIST * Dest, struct INP3_DEST_ROUTE_ENTRY * ROUTEPT
ROUTEPTR->STT = rtt;
ROUTEPTR->Hops = hops;
ROUTEPTR->LastRefreshed = Now;
ROUTEPTR->LastRefreshed = NOW;
SortRoutes(Dest);
return;
@ -1530,7 +1551,7 @@ VOID SendRIFToOtherNeighbours(struct DEST_LIST * Dest, UCHAR * alias, struct INP
char destCall[10];
int rifLen;
unsigned char rif[256];
int sendHops, sendTT, lastTT;
int sendHops, sendTT, lastTT, diff;
// if portNum is set sending a periodic refresh. Just sent to this port
@ -1552,6 +1573,19 @@ VOID SendRIFToOtherNeighbours(struct DEST_LIST * Dest, UCHAR * alias, struct INP
if (!portNum)
{
// 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
{
Routes+=1;
continue;
}
if (Negative)
{
// only send if significantly worse
@ -1677,9 +1711,16 @@ VOID SendRIFToNewNeighbour(struct ROUTE * Route)
Entry = &Dest->INP3ROUTE[0];
if (Entry->ROUT_NEIGHBOUR && Entry->Hops && Route != Entry->ROUT_NEIGHBOUR)
if (Entry->ROUT_NEIGHBOUR == 0)
continue;
if (Route == Entry->ROUT_NEIGHBOUR)
continue;
// Best Route not via this neighbour - send, but only if within their constraints
if (Entry->Hops)
{
// Best Route not via this neighbour - send, but only if within their constraints
sendHops = Entry->Hops + 1;
@ -1982,11 +2023,9 @@ VOID sendAlltoOneNeigbour(struct ROUTE * Route)
VOID SendAllInfo()
{
time_t Now = time(NULL);
if (routeCount == 0) // Not sending
{
if (RIFInterval == 0 || (Now - SENDRIFTIME) < RIFInterval) // Time for new send?
if (RIFInterval == 0 || (NOW - SENDRIFTIME) < RIFInterval) // Time for new send?
return;
Route = NEIGHBOURS;
@ -2003,7 +2042,7 @@ VOID SendAllInfo()
{
//cycle finished
SENDRIFTIME = Now;
SENDRIFTIME = NOW;
routeCount = 0;
return;
}
@ -2018,7 +2057,7 @@ VOID SendAllInfo()
{
//cycle finished
SENDRIFTIME = Now;
SENDRIFTIME = NOW;
routeCount = 0;
}
}
@ -2033,7 +2072,6 @@ void DecayINP3Routes()
struct DEST_LIST * Dest = DESTS;
struct INP3_DEST_ROUTE_ENTRY * Entry;
time_t Now = time(NULL);
int i, n;
time_t xx;
@ -2052,9 +2090,9 @@ void DecayINP3Routes()
if (Entry->ROUT_NEIGHBOUR == 0) // Stop on first unused entry
break;
xx = Now - Entry->LastRefreshed;
xx = NOW - Entry->LastRefreshed;
if (Entry->ROUT_NEIGHBOUR->timeoutRoutes && Entry->LastRefreshed && (Entry->LastRefreshed + INP3NodeTimeout) < Now)
if (Entry->ROUT_NEIGHBOUR->timeoutRoutes && Entry->LastRefreshed && (Entry->LastRefreshed + INP3NodeTimeout) < NOW)
{
char Call1[10];
char Call2[10];
@ -2125,7 +2163,6 @@ VOID INP3TIMER()
if (RIPTimerCount == 0)
{
RIPTimerCount = 10;
SendRIPTimer();
SendAllInfo(); // Timer Driven refresh
DecayINP3Routes();
@ -2439,7 +2476,6 @@ void DecodeRIFOptions(struct DEST_LIST * Dest, UCHAR * ptr1)
// We treat alias separately as that is sent by all software
unsigned char rawoptions[256]; // can't exceed packet size
int rawoptionslen = 0;
unsigned char * startoptions = ptr1;
int gotOptions = 0;

@ -78,8 +78,8 @@ VOID NRRecordRoute(UCHAR * Buff, int Len)
UCHAR * BUFFER = GetBuff();
UCHAR * ptr1;
struct _MESSAGE * Msg1;
time_t Now = time(NULL);
int ID = (Msg->L4TXNO << 8) | Msg->L4RXNO;
int RTT = (int)GetTickCount() - NRRSession->NRRTicks;
if (BUFFER == NULL)
return;
@ -96,10 +96,13 @@ VOID NRRecordRoute(UCHAR * Buff, int Len)
*ptr1++ = 0xf0; // PID
if (ID == NRRSession->NRRID)
ptr1 += sprintf(ptr1, "NRR Response in %d Secs:", (int)(Now - NRRSession->NRRTime));
if (ID == NRRSession->NRRID)
if (RTT < 1000)
ptr1 += sprintf(ptr1, "NRR Response in %dmS:", RTT);
else
ptr1 += sprintf(ptr1, "NRR Response in %2.2fs:", RTT / 1000.0f);
else
ptr1 += sprintf(ptr1, "NRR Response:", (int)(Now - NRRSession->NRRTime));
ptr1 += sprintf(ptr1, "NRR Response:");
Buff += 21 + MSGHDDRLEN;
Len -= (21 + MSGHDDRLEN);
@ -206,7 +209,7 @@ VOID SendNRRecordRoute(struct DEST_LIST * DEST, TRANSPORTENTRY * Session)
Msg->LENGTH = 8 + 21 + MSGHDDRLEN;
Session->NRRTime = time(NULL);
Session->NRRTicks = GetTickCount();
Session->NRRID = NRRID++;
C_Q_ADD(&DEST->DEST_Q, Msg);

@ -75,6 +75,9 @@
#include "bpq32.h" // BPQ32 API Defines
#define BPQTermMDI
extern time_t NOW; // From time()
#ifndef MDIKERNEL
#include "Versions.h"
@ -350,7 +353,6 @@ VOID MonitorAPRSIS(char * Msg, int MsgLen, BOOL TX)
int Len;
struct tm * TM;
time_t NOW;
if (MonWindow.hConsole == NULL || MonitorAPRS == 0)
return;
@ -358,7 +360,6 @@ VOID MonitorAPRSIS(char * Msg, int MsgLen, BOOL TX)
if (MsgLen > 250)
return;
NOW = _time32(NULL);
TM = gmtime(&NOW);
// Mustn't change Msg

@ -21,9 +21,10 @@
#include <memory.h>
#include <time.h>
#include "DbgHelp.h"
#include "winstdint.h"
//#define DYNLOADBPQ // Dynamically Load BPQ32.dll
#include "..\Include\bpq32.h"
#include "bpq32.h"
VOID APIENTRY SetFrameWnd(HWND hWnd);
@ -102,7 +103,7 @@ VOID WriteMiniDump()
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
MSG msg;
BOOL bRet;
int Running = 1;
struct _EXCEPTION_POINTERS exinfo;
Debugprintf("BPQ32.exe %s Entered", lpCmdLine);
@ -115,25 +116,27 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLi
if (!InitInstance(hInstance, nCmdShow))
return (FALSE);
RunBPQ32Background();
// Main message loop:
__try
{
while( (bRet = GetMessage( &msg, NULL, 0, 0 )) != 0)
{
if (bRet == -1)
{
Debugprintf("GetMessage Returned -1 %d", GetLastError());
break;
}
else
while(Running)
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
Sleep(10);
while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
if (msg.message == WM_QUIT)
Running = 0;
}
RunBPQ32Background();
}
}
#define EXCEPTMSG "BPQ32.exe Main Loop"

@ -1545,7 +1545,7 @@ int _C_Q_ADD(VOID *PQ, VOID *PBUFF, char * File, int Line);
VOID SetWindowTextSupport();
int WritetoConsoleSupport(char * buff);
VOID PMClose();
VOID MySetWindowText(HWND hWnd, char * Msg);
VOID MySetWindowText(struct TNCINFO * TNC, HWND hWnd, char * Msg);
BOOL CreateMonitorWindow(char * MonSize);
VOID FormatTime3(char * Time, time_t cTime);
void * zalloc(int len);
@ -1820,6 +1820,9 @@ int needADSB = 0;
extern int AGWPort;
extern time_t NOW; // From time()
Tell_Sessions();
@ -2149,6 +2152,8 @@ VOID TimerProcX()
interval = (int)(currentTime.QuadPart - lastRunTime.QuadPart) / ticksPerMillisec;
lastRunTime.QuadPart = currentTime.QuadPart;
NOW = time(NULL);
//Debugprintf("%d", interval);
// Process WINMORTraceQ
@ -3281,6 +3286,11 @@ SkipInit:
}
return 1;
}
DllExport int APIENTRY RunBPQ32Background()
{
return 1;
}
DllExport int APIENTRY CloseBPQ32()
{
@ -3513,7 +3523,7 @@ if (_winver < 0x0600)
sprintf(msg,"BPQ32 Ver %s Loaded from: %s by %s\n", VersionString, DLLName, pgm);
WritetoConsole(msg);
OutputDebugString(msg);
FormatTime3(Time, time(NULL));
FormatTime3(Time, NOW);
sprintf(msg,"Loaded %s\n", Time);
WritetoConsole(msg);
OutputDebugString(msg);
@ -4659,7 +4669,7 @@ LRESULT CALLBACK FrameWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa
}
wsprintf(Title,"BPQ32 Beacon Configuration");
MySetWindowText(UIhWnd, Title);
MySetWindowText(0, UIhWnd, Title);
ShowWindow(UIhWnd, SW_NORMAL);
OnTabbedDialogInit(UIhWnd); // Set up pages
@ -5354,7 +5364,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
}
wsprintf(Title,"BPQ32 Beacon Utility Version");
MySetWindowText(UIhWnd, Title);
MySetWindowText(0, UIhWnd, Title);
return 0;
}

@ -1619,7 +1619,7 @@ VOID CMDL00(TRANSPORTENTRY * Session, char * Bufferptr, char * CmdTail, struct C
{
// Dump Link State
int secs = time(NULL) - LINK->LASTFRAMESENT;
int secs = NOW - LINK->LASTFRAMESENT;
Bufferptr = Cmdprintf(Session, Bufferptr, " Debug Info: LINK->LINKNS %d LINK->LINKOWS %d SDTSLOT %d LINKWINDOW %d L2FLAGS %d\r", LINK->LINKNS, LINK->LINKOWS, LINK->SDTSLOT, LINK->LINKWINDOW, LINK->L2FLAGS);
Bufferptr = Cmdprintf(Session, Bufferptr, " Debug Info: Slots %x %x %x %x %x %x %x %x\r", LINK->FRAMES[0], LINK->FRAMES[1], LINK->FRAMES[2], LINK->FRAMES[3],
@ -3312,7 +3312,6 @@ char * DoOneNode(TRANSPORTENTRY * Session, char * Bufferptr, struct DEST_LIST *
struct INP3_DEST_ROUTE_ENTRY * Route;
struct ROUTE * Neighbour;
int i, Active, len;
time_t Now = time(NULL);
struct tm * TM;
Alias[6] = 0;
@ -6269,7 +6268,7 @@ VOID KISSCMD(TRANSPORTENTRY * Session, char * Bufferptr, char * CmdTail, struct
// Send Command
PORT->Session = Session;
PORT->LastKISSCmdTime = time(NULL);
PORT->LastKISSCmdTime = NOW;
PORT = (struct PORTCONTROL *)KISS->FIRSTPORT; // ALL FRAMES GO ON SAME Q
KissLen = KissEncode(KissString, ENCBUFF, KissLen);
@ -6342,7 +6341,7 @@ VOID LORACMD(TRANSPORTENTRY * Session, char * Bufferptr, char * CmdTail, struct
KissLen = KissEncode(KissString, ENCBUFF, KissLen);
PORT->Session = Session;
PORT->LastKISSCmdTime = time(NULL);
PORT->LastKISSCmdTime = NOW;
ASYSEND(PORT, ENCBUFF, KissLen);
@ -6833,7 +6832,7 @@ VOID QTSMCMD(TRANSPORTENTRY * Session, char * Bufferptr, char * CmdTail, struct
// Send Command
PORT->Session = Session;
PORT->LastKISSCmdTime = time(NULL);
PORT->LastKISSCmdTime = NOW;
KissString[0] |= KISS->OURCTRL;
PORT = (struct PORTCONTROL *)KISS->FIRSTPORT; // ALL FRAMES GO ON SAME Q

@ -395,6 +395,23 @@ BOK1:
return 0;
}
UINT ReleaseBufferQuick(VOID *pBUFF)
{
void ** pointer, ** BUFF = pBUFF;
if (Semaphore.Flag == 0)
Debugprintf("ReleaseBufferQuick called without semaphore");
pointer = FREE_Q;
*BUFF = pointer;
FREE_Q = BUFF;
QCOUNT++;
return 0;
}
void CheckFreeQueue(char * File, int Line)
{
@ -570,7 +587,7 @@ VOID * _GetBuff(char * File, int Line)
char * fptr = 0;
unsigned char * byteaddr;
CheckFreeQueue(File, Line);
// CheckFreeQueue(File, Line);
Temp = Q_REM(&FREE_Q);
@ -621,6 +638,46 @@ VOID * _GetBuff(char * File, int Line)
return Temp;
}
VOID * GetBuffQuick()
{
UINT * Temp;
MESSAGE * Msg;
char * fptr = 0;
Temp = Q_REM(&FREE_Q);
if (Semaphore.Flag == 0)
Debugprintf("GetBuff called without semaphore");
if (Temp)
{
QCOUNT--;
if (QCOUNT < MINBUFFCOUNT)
MINBUFFCOUNT = QCOUNT;
Msg = (MESSAGE *)Temp;
Msg->Process = (short)GetCurrentProcessId();
Msg->Linkptr = NULL;
Msg->Padding[0] = 0; // Used for modem status info
}
else if (QCOUNT != 0)
{
// Queue must be corrupt
Debugprintf("Fatal - Getbuff returned NULL and Q not empty - exit");
FindLostBuffers();
WriteMiniDump();
Restart();
}
else
Debugprintf("Warning - Getbuff returned NULL");
return Temp;
}
void * zalloc(int len)
{
// malloc and clear
@ -3135,7 +3192,7 @@ char * FormatMH(PMHSTRUC MH, char Format)
if (Format == 'U' || Format =='L')
szClock = MH->MHTIME;
else
szClock = time(NULL) - MH->MHTIME;
szClock = NOW - MH->MHTIME;
if (Format == 'L')
TM = localtime(&szClock);
@ -3159,7 +3216,6 @@ Dll VOID APIENTRY CreateOneTimePassword(char * Password, char * KeyPhrase, int T
// Create a time dependent One Time Password from the KeyPhrase
// TimeOffset is used when checking to allow for slight variation in clocks
time_t NOW = time(NULL);
UCHAR Hash[16];
char Key[1000];
int i, chr;
@ -3505,7 +3561,6 @@ VOID SendNETROMRoute(struct PORTCONTROL * PORT, unsigned char * axcall)
int Len;
char Call[10];
char Report[16];
time_t Now = time(NULL);
int NeedSend = FALSE;
@ -3516,7 +3571,7 @@ VOID SendNETROMRoute(struct PORTCONTROL * PORT, unsigned char * axcall)
sprintf(Report, "%s,%d,", Call, PORT->PORTTYPE);
if (Now - TimeLastNRRouteSent > 60)
if (NOW - TimeLastNRRouteSent > 60)
NeedSend = TRUE;
if (strstr(NRRouteMessage, Report) == 0) // reported recently
@ -3540,7 +3595,7 @@ VOID SendNETROMRoute(struct PORTCONTROL * PORT, unsigned char * axcall)
SendReportMsg((char *)&AXMSG.DEST, Len + 16) ;
TimeLastNRRouteSent = Now;
TimeLastNRRouteSent = NOW;
NRRouteMessage[0] = 0;
}
@ -3801,7 +3856,7 @@ VOID ResolveUpdateThread(void * Unused)
{
hookNodeStarted();
nodeStartedSent = 1;
LastNodeStatus = time(NULL);
LastNodeStatus = NOW;
}
}
@ -3880,17 +3935,16 @@ VOID WriteMiniDumpThread()
BOOL ret;
char FN[256];
struct tm * TM;
time_t Now = time(NULL);
if (lastMiniDump == Now) // Not more than one per second
if (lastMiniDump == NOW) // Not more than one per second
{
Debugprintf("minidump suppressed");
return;
}
lastMiniDump = Now;
lastMiniDump = NOW;
TM = gmtime(&Now);
TM = gmtime(&NOW);
sprintf(FN, "%s/Logs/MiniDump%d%02d%02d%02d%02d%02d.dmp", BPQDirectory,
TM->tm_year + 1900, TM->tm_mon +1, TM->tm_mday, TM->tm_hour, TM->tm_min, TM->tm_sec);

Binary file not shown.

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<dependency>
<dependentAssembly>
<assemblyIdentity type="win32" name="Microsoft.VC80.DebugCRT" version="8.0.50608.0" processorArchitecture="x86" publicKeyToken="1fc8b3b9a1e18e3b"></assemblyIdentity>
</dependentAssembly>
</dependency>
</assembly>

@ -1,8 +0,0 @@
<?xml version='1.0' encoding='UTF-8' standalone='yes'?>
<assembly xmlns='urn:schemas-microsoft-com:asm.v1' manifestVersion='1.0'>
<dependency>
<dependentAssembly>
<assemblyIdentity type='win32' name='Microsoft.VC80.DebugCRT' version='8.0.50608.0' processorArchitecture='x86' publicKeyToken='1fc8b3b9a1e18e3b' />
</dependentAssembly>
</dependency>
</assembly>

Binary file not shown.

@ -1 +0,0 @@
Manifest resource last updated at 13:39:54.21 on 22/06/2026

Binary file not shown.

Binary file not shown.

@ -154,7 +154,7 @@ void hookL2SessionAccepted(int Port, char * remotecall, char * ourcall, struct _
L2CONNECTSIN++;
LINK->apiSeq = linkSeq++;
LINK->lastStatusSentTime = LINK->ConnectTime = time(NULL);
LINK->lastStatusSentTime = LINK->ConnectTime = NOW;
LINK->bytesTXed = LINK->bytesRXed = LINK->framesResent = LINK->framesRXed = LINK->framesTXed = 0;
LINK->LastStatusbytesTXed = LINK->LastStatusbytesRXed = 0;
strcpy(LINK->callingCall, remotecall);
@ -163,7 +163,7 @@ void hookL2SessionAccepted(int Port, char * remotecall, char * ourcall, struct _
if (NodeAPISocket)
{
LINK->lastStatusSentTime = time(NULL);
LINK->lastStatusSentTime = NOW;
udplen = sprintf(UDPMsg, "{\"@type\":\"LinkUpEvent\", \"node\": \"%s\", \"id\": %d, \"direction\": \"incoming\", \"port\": \"%d\", \"remote\": \"%s\", \"local\": \"%s\", \"isRF\": %s}",
NODECALLLOPPED, LINK->apiSeq, LINK->LINKPORT->PORTNUMBER, LINK->callingCall, LINK->receivingCall, (LINK->LINKPORT->isRF)?"true":"false");
@ -190,11 +190,10 @@ void hookL2SessionDeleted(struct _LINKTABLE * LINK)
{
char Msg[256];
char timestamp[64];
time_t sessionTime = time(NULL) - LINK->ConnectTime;
time_t sessionTime = NOW - LINK->ConnectTime;
double avBytesSent = LINK->bytesTXed / (sessionTime / 60.0);
double avBytesRXed = LINK->bytesRXed / (sessionTime / 60.0);
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);
@ -226,7 +225,7 @@ void hookL2SessionDeleted(struct _LINKTABLE * LINK)
void hookL2SessionAttempt(int Port, char * ourcall, char * remotecall, struct _LINKTABLE * LINK)
{
LINK->lastStatusSentTime = LINK->ConnectTime = time(NULL);
LINK->lastStatusSentTime = LINK->ConnectTime = NOW;
LINK->bytesTXed = LINK->bytesRXed = LINK->framesResent = LINK->framesRXed = LINK->framesTXed = 0;
LINK->LastStatusbytesTXed = LINK->LastStatusbytesRXed = 0;
strcpy(LINK->callingCall, ourcall);
@ -246,7 +245,7 @@ void hookL2SessionConnected(struct _LINKTABLE * LINK)
if (NodeAPISocket)
{
LINK->lastStatusSentTime = time(NULL);
LINK->lastStatusSentTime = NOW;
udplen = sprintf(UDPMsg, "{\"@type\":\"LinkUpEvent\", \"node\": \"%s\", \"id\": %d, \"direction\": \"outgoing\", \"port\": \"%d\", \"remote\": \"%s\", \"local\": \"%s\", \"isRF\": %s}",
NODECALLLOPPED, LINK->apiSeq, LINK->LINKPORT->PORTNUMBER, LINK->callingCall, LINK->receivingCall, (LINK->LINKPORT->isRF)?"true":"false");
@ -263,7 +262,6 @@ void hookL2SessionClosed(struct _LINKTABLE * LINK, char * Reason, char * Directi
char UDPMsg[1024];
int udplen;
time_t Now = time(NULL);
if (NodeAPISocket)
{
@ -276,14 +274,14 @@ void hookL2SessionClosed(struct _LINKTABLE * LINK, char * Reason, char * Directi
" \"time\": %d, \"upForSecs\": %d, \"frmsQdPeak\": %d, \"isRF\": %s}",
NODECALLLOPPED, LINK->apiSeq, LINK->LINKPORT->PORTNUMBER, LINK->receivingCall, LINK->callingCall,
LINK->bytesTXed , LINK->bytesRXed, LINK->framesTXed, LINK->framesRXed, COUNT_AT_L2(LINK), LINK->framesResent, Reason,
(int)Now, (int)Now - LINK->ConnectTime, LINK->maxQueued, (LINK->LINKPORT->isRF)?"true":"false");
(int)NOW, (int)NOW - LINK->ConnectTime, LINK->maxQueued, (LINK->LINKPORT->isRF)?"true":"false");
else
udplen = sprintf(UDPMsg, "{\"@type\":\"LinkDownEvent\", \"node\": \"%s\", \"id\": %d, \"direction\": \"incoming\", \"port\": \"%d\", \"remote\": \"%s\", \"local\": \"%s\","
"\"bytesSent\": %d, \"bytesRcvd\": %d, \"frmsSent\": %d, \"frmsRcvd\": %d, \"frmsQueued\": %d, \"frmsResent\": %d, \"reason\": \"%s\","
" \"time\": %d, \"upForSecs\": %d, \"frmsQdPeak\": %d, \"isRF\": %s}",
NODECALLLOPPED, LINK->apiSeq, LINK->LINKPORT->PORTNUMBER, LINK->callingCall, LINK->receivingCall,
LINK->bytesTXed , LINK->bytesRXed, LINK->framesTXed, LINK->framesRXed, COUNT_AT_L2(LINK), LINK->framesResent, Reason,
(int)Now, (int)Now - LINK->ConnectTime, LINK->maxQueued, (LINK->LINKPORT->isRF)?"true":"false");
(int)NOW, (int)NOW - LINK->ConnectTime, LINK->maxQueued, (LINK->LINKPORT->isRF)?"true":"false");
// Debugprintf(UDPMsg);
@ -297,16 +295,15 @@ void hookL2SessionStatus(struct _LINKTABLE * LINK)
char UDPMsg[1024];
int udplen;
time_t Now = time(NULL);
int bpsTx, bpsRx, interval;
if (NodeAPISocket)
{
interval = Now - (int)LINK->lastStatusSentTime;
interval = NOW - (int)LINK->lastStatusSentTime;
bpsTx = (LINK->bytesTXed - LINK->LastStatusbytesTXed) / interval;
bpsRx = (LINK->bytesRXed - LINK->LastStatusbytesRXed) / interval;
LINK->lastStatusSentTime = Now;
LINK->lastStatusSentTime = NOW;
LINK->LastStatusbytesTXed = LINK->bytesTXed;
LINK->LastStatusbytesRXed = LINK->bytesRXed;
@ -316,14 +313,14 @@ void hookL2SessionStatus(struct _LINKTABLE * LINK)
"\"upForSecs\": %d, \"frmsQdPeak\": %d, \"bpsTxMean\": %d, \"bpsRxMean\": %d, \"frmQMax\": %d, \"l2rttMs\": %d, \"isRF\": %s}",
NODECALLLOPPED, LINK->apiSeq, LINK->LINKPORT->PORTNUMBER, LINK->receivingCall, LINK->callingCall,
LINK->bytesTXed, LINK->bytesRXed, LINK->framesTXed, LINK->framesRXed, 0, LINK->framesResent,
(int)Now - LINK->ConnectTime, LINK->maxQueued, bpsTx, bpsRx, LINK->intervalMaxQueued, LINK->RTT, (LINK->LINKPORT->isRF)?"true":"false");
(int)NOW - LINK->ConnectTime, LINK->maxQueued, bpsTx, bpsRx, LINK->intervalMaxQueued, LINK->RTT, (LINK->LINKPORT->isRF)?"true":"false");
else
udplen = sprintf(UDPMsg, "{\"@type\":\"LinkStatus\", \"node\": \"%s\", \"id\": %d, \"direction\": \"incoming\", \"port\": \"%d\", \"remote\": \"%s\", \"local\": \"%s\","
"\"bytesSent\": %d, \"bytesRcvd\": %d, \"frmsSent\": %d, \"frmsRcvd\": %d, \"frmsQueued\": %d, \"frmsResent\": %d,"
"\"upForSecs\": %d, \"frmsQdPeak\": %d, \"bpsTxMean\": %d, \"bpsRxMean\": %d, \"frmQMax\": %d, \"l2rttMs\": %d, \"isRF\": %s}",
NODECALLLOPPED, LINK->apiSeq, LINK->LINKPORT->PORTNUMBER, LINK->callingCall, LINK->receivingCall,
LINK->bytesTXed, LINK->bytesRXed, LINK->framesTXed, LINK->framesRXed, 0, LINK->framesResent,
(int)Now - LINK->ConnectTime, LINK->maxQueued, bpsTx, bpsRx, LINK->intervalMaxQueued, LINK->RTT, (LINK->LINKPORT->isRF)?"true":"false");
(int)NOW - LINK->ConnectTime, LINK->maxQueued, bpsTx, bpsRx, LINK->intervalMaxQueued, LINK->RTT, (LINK->LINKPORT->isRF)?"true":"false");
LINK->intervalMaxQueued = 0;
@ -339,7 +336,7 @@ void hookL4SessionAttempt(struct STREAMINFO * STREAM, char * remotecall, char *
{
// Outgoing Connect
STREAM->ConnectTime = time(NULL);
STREAM->ConnectTime = NOW;
STREAM->bytesTXed = STREAM->bytesRXed = 0;
strcpy(STREAM->callingCall, ourcall);
@ -351,7 +348,7 @@ void hookL4SessionAccepted(struct STREAMINFO * STREAM, char * remotecall, char *
{
// Incoming Connect
STREAM->ConnectTime = time(NULL);
STREAM->ConnectTime = NOW;
STREAM->bytesTXed = STREAM->bytesRXed = 0;
strcpy(STREAM->callingCall, remotecall);
@ -381,11 +378,10 @@ void hookL4SessionDeleted(struct TNCINFO * TNC, struct STREAMINFO * STREAM)
if (STREAM->ConnectTime)
{
time_t sessionTime = time(NULL) - STREAM->ConnectTime;
time_t sessionTime = NOW - STREAM->ConnectTime;
double avBytesRXed = STREAM->bytesRXed / (sessionTime / 60.0);
double avBytesSent = STREAM->bytesTXed / (sessionTime / 60.0);
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);
if (sessionTime == 0)
@ -444,7 +440,7 @@ void hookNodeClosing(char * Reason)
{
udplen = sprintf(UDPMsg, "{\"@type\": \"NodeDownEvent\", \"nodeCall\": \"%s\", \"nodeAlias\": \"%s\", \"reason\": \"%s\", \"uptimeSecs\": %d,"
"\"linksIn\": %d, \"linksOut\": %d, \"cctsIn\": %d, \"cctsOut\": %d, \"l3Relayed\": %d}",
NODECALLLOPPED, MYALIASLOPPED, Reason, time(NULL) - TimeLoaded, L2CONNECTSIN, L2CONNECTSOUT, L4CONNECTSIN, L4CONNECTSOUT, L3FRAMES);
NODECALLLOPPED, MYALIASLOPPED, Reason, NOW - TimeLoaded, L2CONNECTSIN, L2CONNECTSOUT, L4CONNECTSIN, L4CONNECTSOUT, L3FRAMES);
// Debugprintf(UDPMsg);
@ -471,7 +467,7 @@ void hookNodeRunning()
udplen = sprintf(UDPMsg, "{\"@type\": \"NodeStatus\", \"nodeCall\": \"%s\", \"nodeAlias\": \"%s\", \"locator\": \"%s\","
"\"latitude\": %f, \"longitude\": %f, \"software\": \"%s\", \"version\": \"%s\", \"uptimeSecs\": %d,"
"\"linksIn\": %d, \"linksOut\": %d, \"cctsIn\": %d, \"cctsOut\": %d, \"l3Relayed\": %d}",
NODECALLLOPPED, MYALIASLOPPED, LOC, LatFromLOC, LonFromLOC, Software, VersionString, time(NULL) - TimeLoaded,
NODECALLLOPPED, MYALIASLOPPED, LOC, LatFromLOC, LonFromLOC, Software, VersionString, NOW - TimeLoaded,
L2CONNECTSIN, L2CONNECTSOUT, L4CONNECTSIN, L4CONNECTSOUT, L3FRAMES);
// Debugprintf(UDPMsg);
@ -497,7 +493,7 @@ void IncomingL4ConnectionEvent(TRANSPORTENTRY * L4)
if (NodeAPISocket)
{
L4->lastStatusSentTime = time(NULL);
L4->lastStatusSentTime = NOW;
remotecall[ConvFromAX25(L4->L4TARGET.DEST->DEST_CALL, remotecall)] = 0;
// remotecall[ConvFromAX25(L4->L4USER, remotecall)] = 0;
@ -542,7 +538,7 @@ void OutgoingL4ConnectionEvent(TRANSPORTENTRY * L4)
if (NodeAPISocket)
{
L4->lastStatusSentTime = time(NULL);
L4->lastStatusSentTime = NOW;
remotecall[ConvFromAX25(L4->L4TARGET.DEST->DEST_CALL, remotecall)] = 0;
// remotecall[ConvFromAX25(L4->L4USER, remotecall)] = 0;
@ -635,7 +631,6 @@ void L4StatusSeport(TRANSPORTENTRY * L4)
char nodecall[16];
char circuitinfo[32];
int Count;
time_t Now = time(NULL);
int Service = L4->Service;
@ -644,7 +639,7 @@ void L4StatusSeport(TRANSPORTENTRY * L4)
if (NodeAPISocket)
{
L4->lastStatusSentTime = Now;
L4->lastStatusSentTime = NOW;
nodecall[ConvFromAX25(L4->L4TARGET.DEST->DEST_CALL, nodecall)] = 0;
remotecall[ConvFromAX25(L4->L4USER, remotecall)] = 0;
ourcall[ConvFromAX25(L4->L4MYCALL, ourcall)] = 0;
@ -664,11 +659,11 @@ void L4StatusSeport(TRANSPORTENTRY * L4)
if (Service == -1)
udplen = sprintf(UDPMsg, "{\"@type\": \"CircuitStatus\", \"node\": \"%s\", \"id\": %d, \"direction\": \"%s\","
"\"upForSecs\": %d,\"remote\": \"%s\", \"local\": \"%s\", \"segsSent\": %d, \"segsRcvd\": %d, \"segsResent\": %d, \"segsQueued\": %d}",
NODECALLLOPPED, L4->apiSeq, L4->Direction, Now - L4->ConnectTime, remotecall, ourcall,L4->segsSent, L4->segsRcvd, L4->segsResent, Count);
NODECALLLOPPED, L4->apiSeq, L4->Direction, NOW - L4->ConnectTime, remotecall, ourcall,L4->segsSent, L4->segsRcvd, L4->segsResent, Count);
else
udplen = sprintf(UDPMsg, "{\"@type\": \"CircuitStatus\", \"node\": \"%s\", \"id\": %d, \"direction\": \"%s\","
"\"upForSecs\": %d, \"service\": %d, \"remote\": \"%s\", \"local\": \"%s\", \"segsSent\": %d, \"segsRcvd\": %d, \"segsResent\": %d, \"segsQueued\": %d}",
NODECALLLOPPED, L4->apiSeq, L4->Direction, Now - L4->ConnectTime, Service, remotecall, ourcall,L4->segsSent, L4->segsRcvd, L4->segsResent, Count);
NODECALLLOPPED, L4->apiSeq, L4->Direction, NOW - L4->ConnectTime, Service, remotecall, ourcall,L4->segsSent, L4->segsRcvd, L4->segsResent, Count);
// Debugprintf(UDPMsg);
sendto(NodeAPISocket, UDPMsg, udplen, 0, (struct sockaddr *)&UDPreportdest, sizeof(UDPreportdest));
@ -751,7 +746,6 @@ void APIL2Trace(struct _MESSAGE * Message, char * Dirn)
int NS;
int NR;
struct PORTCONTROL * PORT = GetPortTableEntryFromPortNum(Message->PORT);
time_t Now = time(NULL);
#ifndef WIN32
struct timespec ts;
#else
@ -785,7 +779,7 @@ void APIL2Trace(struct _MESSAGE * Message, char * Dirn)
#ifndef WIN32
if (clock_gettime(CLOCK_REALTIME, &ts) == -1)
NowMs = Now;
NowMs = NOW;
else
NowMs = ts.tv_sec + ts.tv_nsec / 1000000000.0;
#else
@ -982,14 +976,13 @@ void NetromTCPTrace(struct _MESSAGE * Message, char * Dirn)
{
char UDPMsg[2048];
int udplen;
time_t Now = time(NULL);
int iLen = Message->LENGTH - (15 + MSGHDDRLEN);
int isRF = 0;
udplen = snprintf(UDPMsg, 2048,
"{\"@type\": \"L3Trace\", \"serial\": %d, \"time\": %d, \"dirn\": \"%s\", \"isRF\": %s, \"reportFrom\": \"%s\", \"port\": %d",
UDPSeq++, (int)Now, Dirn, (isRF)?"true":"false", NODECALLLOPPED, Message->PORT);
UDPSeq++, (int)NOW, Dirn, (isRF)?"true":"false", NODECALLLOPPED, Message->PORT);
udplen += snprintf(&UDPMsg[udplen], 2048 - udplen,

@ -1113,7 +1113,7 @@ static int RestartTNC(struct TNCINFO * TNC)
static int WebProc(struct TNCINFO * TNC, char * Buff, BOOL LOCAL)
{
int Len = sprintf(Buff, "<html><meta http-equiv=expires content=0><meta http-equiv=refresh content=15>"
int Len = sprintf(Buff, "<html><meta http-equiv=expires content=0>"
"<script type=\"text/javascript\">\r\n"
"function ScrollOutput()\r\n"
"{var textarea = document.getElementById('textarea');"
@ -1171,7 +1171,7 @@ VOID * FLDigiExtInit(EXTPORTDATA * PortEntry)
// The Socket to connect to is in IOBASE
//
srand((unsigned int)time(NULL));
srand((unsigned int)NOW);
port = PortEntry->PORTCONTROL.PORTNUMBER;
@ -1565,7 +1565,7 @@ VOID ConnecttoFLDigiThread(void * portptr)
WritetoConsole(Msg);
sprintf(TNC->WEB_COMMSSTATE, "Connection to TNC failed");
MySetWindowText(TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE);
MySetWindowText(TNC, TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE);
TNC->Alerted = TRUE;
}
@ -2538,7 +2538,7 @@ VOID ProcessFLDigiData(struct TNCINFO * TNC, UCHAR * Input, int Len, char Channe
SESS = TNC->PortRecord->ATTACHEDSESSIONS[0];
strcpy(STREAM->MyCall, call2);
STREAM->ConnectTime = time(NULL);
STREAM->ConnectTime = NOW;
STREAM->bytesRXed = STREAM->bytesTXed = STREAM->BytesAcked = STREAM->BytesResent = 0;
if (TNC->RIG && TNC->RIG != &TNC->DummyRig && strcmp(TNC->RIG->RigName, "PTT"))
@ -2697,7 +2697,7 @@ AckConnectRequest:
if (STREAM->Connected)
goto SendKReply; // Repeated ACK
STREAM->ConnectTime = time(NULL);
STREAM->ConnectTime = NOW;
STREAM->bytesRXed = STREAM->bytesTXed = STREAM->BytesAcked = STREAM->BytesResent = 0;
STREAM->Connected = TRUE;
@ -3682,15 +3682,17 @@ VOID FLSlowTimer(struct TNCINFO * TNC)
if (FL->KISSMODE)
{
if (FL->Responding)
{
FL->Responding--;
if (FL->Responding == 0)
{
TNC->TNCOK = FALSE;
TNC->CONNECTED = FALSE;
if (FL->Responding == 0)
{
TNC->TNCOK = FALSE;
TNC->CONNECTED = FALSE;
sprintf(TNC->WEB_COMMSSTATE, "Connection to FLDIGI lost");
SetWindowText(TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE);
sprintf(TNC->WEB_COMMSSTATE, "Connection to FLDIGI lost");
SetWindowText(TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE);
}
// Set basic params till it responds
}
@ -3838,7 +3840,7 @@ static int ProcessXMLData(int port)
SetWindowText(TNC->xIDC_CHANSTATE, "Busy");
strcpy(TNC->WEB_CHANSTATE, "Busy");
TNC->WinmorRestartCodecTimer = time(NULL);
TNC->WinmorRestartCodecTimer = NOW;
*/
return 0;
}
@ -3852,7 +3854,7 @@ static int ProcessXMLData(int port)
strcpy(TNC->WEB_CHANSTATE, "Clear");
SetWindowText(TNC->xIDC_CHANSTATE, TNC->WEB_CHANSTATE);
TNC->WinmorRestartCodecTimer = time(NULL);
TNC->WinmorRestartCodecTimer = NOW;
return;
}
*/

@ -557,7 +557,7 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff)
FreeDataDisconnect(TNC);
strcpy(TNC->WEB_TNCSTATE, "Disconnecting");
MySetWindowText(TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
MySetWindowText(TNC, TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
}
}
@ -587,7 +587,7 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff)
TNC->SessionTimeLimit = TNC->DefaultSessionTimeLimit; // Reset Limit
sprintf(TNC->WEB_TNCSTATE, "In Use by %s", STREAM->MyCall);
MySetWindowText(TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
MySetWindowText(TNC, TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
// Stop Scanning
@ -936,7 +936,7 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff)
// Save Command, and wait up to 10 secs
sprintf(TNC->WEB_TNCSTATE, "Waiting for clear channel");
MySetWindowText(TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
MySetWindowText(TNC, TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
TNC->ConnectCmd = _strdup(Connect);
TNC->BusyDelay = TNC->BusyWait * 10; // BusyWait secs
@ -948,11 +948,11 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff)
memset(STREAM->RemoteCall, 0, 10);
strcpy(STREAM->RemoteCall, &buff->L2DATA[2]);
STREAM->ConnectTime = time(NULL);
STREAM->ConnectTime = NOW;
STREAM->bytesRXed = STREAM->bytesTXed = STREAM->PacketsSent = 0;
sprintf(TNC->WEB_TNCSTATE, "%s Connecting to %s", STREAM->MyCall, STREAM->RemoteCall);
MySetWindowText(TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
MySetWindowText(TNC, TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
// FreeDataSendCommand(TNC, Connect);
FreeDataConnect(TNC, STREAM->RemoteCall);
@ -1098,12 +1098,7 @@ VOID FreeDataReleasePort(struct TNCINFO * TNC)
static int WebProc(struct TNCINFO * TNC, char * Buff, BOOL LOCAL)
{
int Len = sprintf(Buff, "<html><meta http-equiv=expires content=0><meta http-equiv=refresh content=15>"
"<script type=\"text/javascript\">\r\n"
"function ScrollOutput()\r\n"
"{var textarea = document.getElementById('textarea');"
"textarea.scrollTop = textarea.scrollHeight;}</script>"
"</head><title>FreDATA Status</title></head><body id=Text onload=\"ScrollOutput()\">"
int Len = sprintf(Buff,
"<h2><form method=post target=\"POPUPW\" onsubmit=\"POPUPW = window.open('about:blank','POPUPW',"
"'width=440,height=150');\" action=ARDOPAbort?%d>FreeData Status"
"<input name=Save value=\"Abort Session\" type=submit style=\"position: absolute; right: 20;\"></form></h2>",
@ -1364,7 +1359,7 @@ VOID * FreeDataExtInit(EXTPORTDATA * PortEntry)
int i;
int n = 0;
srand(time(NULL));
srand(NOW);
port = PortEntry->PORTCONTROL.PORTNUMBER;
@ -1925,9 +1920,9 @@ VOID FreeDataProcessTNCMessage(struct TNCINFO * TNC, char * Call, unsigned char
if (WL2K)
strcpy(SESS->RMSCall, WL2K->RMSCall);
MySetWindowText(TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
MySetWindowText(TNC, TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
STREAM->ConnectTime = time(NULL);
STREAM->ConnectTime = NOW;
STREAM->bytesRXed = STREAM->bytesTXed = STREAM->PacketsSent = 0;
STREAM->Connected = TRUE;
@ -1941,7 +1936,7 @@ VOID FreeDataProcessTNCMessage(struct TNCINFO * TNC, char * Call, unsigned char
// Connect ACK
sprintf(TNC->WEB_TNCSTATE, "%s Connected to %s", STREAM->MyCall, STREAM->RemoteCall);
MySetWindowText(TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
MySetWindowText(TNC, TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
STREAM->Connected = TRUE;
STREAM->Connecting = FALSE;
@ -1974,7 +1969,7 @@ VOID FreeDataProcessTNCMessage(struct TNCINFO * TNC, char * Call, unsigned char
// Connection Refused - If there is a message, pass to appl
sprintf(TNC->WEB_TNCSTATE, "In Use by %s", STREAM->MyCall);
MySetWindowText(TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
MySetWindowText(TNC, TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
STREAM->Connecting = FALSE;
buffptr = (PMSGWITHLEN)GetBuff();
@ -2005,7 +2000,7 @@ VOID FreeDataProcessTNCMessage(struct TNCINFO * TNC, char * Call, unsigned char
STREAM->Disconnecting = FALSE;
strcpy(TNC->WEB_TNCSTATE, "Free");
MySetWindowText(TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
MySetWindowText(TNC, TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
return;
@ -2039,7 +2034,7 @@ VOID FreeDataProcessTNCMessage(struct TNCINFO * TNC, char * Call, unsigned char
STREAM->bytesRXed += Len;
sprintf(TNC->WEB_TRAFFIC, "Sent %d RXed %d Queued %d",
STREAM->bytesTXed - TNC->FreeDataInfo->toSendCount, STREAM->bytesRXed, TNC->FreeDataInfo->toSendCount);
MySetWindowText(TNC->xIDC_TRAFFIC, TNC->WEB_TRAFFIC);
MySetWindowText(TNC, TNC->xIDC_TRAFFIC, TNC->WEB_TRAFFIC);
return;
@ -2288,9 +2283,9 @@ VOID FreeDataProcessNewConnect(struct TNCINFO * TNC, char * fromCall, char * toC
if (WL2K)
strcpy(SESS->RMSCall, WL2K->RMSCall);
MySetWindowText(TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
MySetWindowText(TNC, TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
STREAM->ConnectTime = time(NULL);
STREAM->ConnectTime = NOW;
STREAM->bytesRXed = STREAM->bytesTXed = STREAM->PacketsSent = 0;
STREAM->Connected = TRUE;
@ -2305,7 +2300,7 @@ VOID FreeDataProcessConnectAck(struct TNCINFO * TNC, char * Call, unsigned char
struct FreeDataINFO * Modem = TNC->FreeDataInfo;
sprintf(TNC->WEB_TNCSTATE, "%s Connected to %s", STREAM->MyCall, STREAM->RemoteCall);
MySetWindowText(TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
MySetWindowText(TNC, TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
STREAM->Connected = TRUE;
STREAM->Connecting = FALSE;
@ -2392,7 +2387,7 @@ void FlushData(struct TNCINFO * TNC)
sprintf(TNC->WEB_TRAFFIC, "Sent %d RXed %d Queued %d",
STREAM->bytesTXed - TNC->FreeDataInfo->toSendCount, STREAM->bytesRXed, TNC->FreeDataInfo->toSendCount);
MySetWindowText(TNC->xIDC_TRAFFIC, TNC->WEB_TRAFFIC);
MySetWindowText(TNC, TNC->xIDC_TRAFFIC, TNC->WEB_TRAFFIC);
}
@ -2418,7 +2413,7 @@ static int SendAsFile(struct TNCINFO * TNC, char * Call, char * Msg, int Len)
sprintf(TNC->WEB_TRAFFIC, "Sent %d RXed %d Queued %d",
STREAM->bytesTXed - TNC->FreeDataInfo->toSendCount, STREAM->bytesRXed, TNC->FreeDataInfo->toSendCount);
MySetWindowText(TNC->xIDC_TRAFFIC, TNC->WEB_TRAFFIC);
MySetWindowText(TNC, TNC->xIDC_TRAFFIC, TNC->WEB_TRAFFIC);
return Len;
}
@ -2443,7 +2438,7 @@ static void SendPing(struct TNCINFO * TNC, char * Call)
char Message[256];
int Len, ret;
Len = sprintf(Message, Ping, Call, time(NULL));
Len = sprintf(Message, Ping, Call, NOW);
ret = send(TNC->TCPDataSock, (char *)&Message, Len, 0);
}
@ -2698,7 +2693,7 @@ void ProcessMessageObject(struct TNCINFO * TNC, char * This)
sprintf(TNC->WEB_TRAFFIC, "Sent %d RXed %d Queued %d",
STREAM->bytesTXed - TNC->FreeDataInfo->toSendCount, STREAM->bytesRXed, TNC->FreeDataInfo->toSendCount);
MySetWindowText(TNC->xIDC_TRAFFIC, TNC->WEB_TRAFFIC);
MySetWindowText(TNC, TNC->xIDC_TRAFFIC, TNC->WEB_TRAFFIC);
}
return;
}
@ -2792,7 +2787,7 @@ void ProcessMessageObject(struct TNCINFO * TNC, char * This)
sprintf(TNC->WEB_TRAFFIC, "Sent %d RXed %d Queued %d",
STREAM->bytesTXed - TNC->FreeDataInfo->toSendCount, STREAM->bytesRXed, TNC->FreeDataInfo->toSendCount);
MySetWindowText(TNC->xIDC_TRAFFIC, TNC->WEB_TRAFFIC);
MySetWindowText(TNC, TNC->xIDC_TRAFFIC, TNC->WEB_TRAFFIC);
}
}
else
@ -2958,7 +2953,7 @@ void processJSONINFO(struct TNCINFO * TNC, char * Info, char * Call, double snr)
if (STREAM->Connecting)
{
sprintf(TNC->WEB_TNCSTATE, "In Use by %s", STREAM->MyCall);
MySetWindowText(TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
MySetWindowText(TNC, TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
STREAM->Connecting = FALSE;
buffptr = (PMSGWITHLEN)GetBuff();
@ -3131,7 +3126,7 @@ void ProcessTNCJSON(struct TNCINFO * TNC, char * Msg, int Len)
STREAM->Disconnecting = FALSE;
strcpy(TNC->WEB_TNCSTATE, "Free");
MySetWindowText(TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
MySetWindowText(TNC, TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
}
}
else if (memcmp(ptr, "connecting", 10) == 0)
@ -3186,7 +3181,7 @@ void ProcessTNCJSON(struct TNCINFO * TNC, char * Msg, int Len)
if (STREAM->Connecting)
{
sprintf(TNC->WEB_TNCSTATE, "In Use by %s", STREAM->MyCall);
MySetWindowText(TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
MySetWindowText(TNC, TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
STREAM->Connecting = FALSE;
buffptr = (PMSGWITHLEN)GetBuff();
@ -3309,7 +3304,7 @@ void ProcessTNCJSON(struct TNCINFO * TNC, char * Msg, int Len)
STREAM->Disconnecting = FALSE;
strcpy(TNC->WEB_TNCSTATE, "Free");
MySetWindowText(TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
MySetWindowText(TNC, TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
}
}
else if (memcmp(ptr, "connecting", 10) == 0)
@ -3364,7 +3359,7 @@ void ProcessTNCJSON(struct TNCINFO * TNC, char * Msg, int Len)
if (STREAM->Connecting)
{
sprintf(TNC->WEB_TNCSTATE, "In Use by %s", STREAM->MyCall);
MySetWindowText(TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
MySetWindowText(TNC, TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
STREAM->Connecting = FALSE;
buffptr = (PMSGWITHLEN)GetBuff();
@ -3725,10 +3720,10 @@ void FreeDataProcessTNCMsg(struct TNCINFO * TNC)
STREAM->Disconnecting = FALSE;
strcpy(TNC->WEB_TNCSTATE, "Free");
MySetWindowText(TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
MySetWindowText(TNC, TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
sprintf(TNC->WEB_COMMSSTATE, "Connection to TNC lost");
MySetWindowText(TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE);
MySetWindowText(TNC, TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE);
return;
}
@ -3895,7 +3890,7 @@ TNCRunning:
if (TNC->Alerted == FALSE)
{
sprintf(TNC->WEB_COMMSSTATE, "Connecting to TNC");
MySetWindowText(TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE);
MySetWindowText(TNC, TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE);
}
TNC->Datadestaddr.sin_addr.s_addr = inet_addr(TNC->HostName);
@ -3947,7 +3942,7 @@ TNCRunning:
i=sprintf(Msg, "Connect Failed for FreeData TNC socket - error code = %d\r\n", err);
WritetoConsole(Msg);
sprintf(TNC->WEB_COMMSSTATE, "Connection to TNC failed");
MySetWindowText(TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE);
MySetWindowText(TNC, TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE);
TNC->Alerted = TRUE;
}
@ -3971,7 +3966,7 @@ TNCRunning:
TNC->Alerted = TRUE;
sprintf(TNC->WEB_COMMSSTATE, "Connected to FreeData TNC");
MySetWindowText(TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE);
MySetWindowText(TNC, TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE);
sprintf(Msg, "Connected to FreeData TNC Port %d\r\n", TNC->Port);
WritetoConsole(Msg);
@ -4027,7 +4022,7 @@ Lost:
WritetoConsole(Msg);
sprintf(TNC->WEB_COMMSSTATE, "Connection to TNC lost");
MySetWindowText(TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE);
MySetWindowText(TNC, TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE);
TNC->TNCCONNECTED = FALSE;
TNC->Alerted = FALSE;
@ -4056,7 +4051,7 @@ closeThread:
}
sprintf(Msg, "FreeData Thread Terminated Port %d\r\n", TNC->Port);
TNC->lasttime = time(NULL); // Prevent immediate restart
TNC->lasttime = NOW; // Prevent immediate restart
WritetoConsole(Msg);
}
@ -4088,7 +4083,7 @@ void ConnectTNCPort(struct TNCINFO * TNC)
// Connected successful
sprintf(TNC->WEB_COMMSSTATE, "Connected to FreeData TNC");
MySetWindowText(TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE);
MySetWindowText(TNC, TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE);
TNC->TNCCONNECTING = FALSE;
TNC->TNCCONNECTED = TRUE;
TNC->Alerted = FALSE;
@ -4106,7 +4101,7 @@ void ConnectTNCPort(struct TNCINFO * TNC)
TNC->TNCCONNECTING = FALSE;
sprintf(TNC->WEB_COMMSSTATE, "Connection to TNC failed");
MySetWindowText(TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE);
MySetWindowText(TNC, TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE);
}
closesocket(TNC->TCPDataSock);

@ -82,6 +82,7 @@ VOID DoMonitor(struct TNCINFO * TNC, UCHAR * Msg, int Len);
BOOL HALConnected(struct TNCINFO * TNC, char * Call);
VOID HALDisconnected(struct TNCINFO * TNC);
VOID halSetWindowText(struct TNCINFO * TNC, char * Msg);
static VOID EncodeAndSend(struct TNCINFO * TNC, UCHAR * txbuffer, int Len);
VOID SendCmd(struct TNCINFO * TNC, UCHAR * txbuffer, int Len);
@ -113,7 +114,7 @@ UCHAR FN[MAX_PATH];
time_t T;
struct tm * tm;
T = time(NULL);
T = NOW;
tm = gmtime(&T);
sprintf(FN,"%s\\HALLog_%02d%02d%02d_%s.bin", BaseDir, tm->tm_mday, tm->tm_hour, tm->tm_min, Logs[Flags]);
@ -443,7 +444,7 @@ static size_t ExtProc(int fn, int port , PDATAMESSAGE buff)
static int WebProc(struct TNCINFO * TNC, char * Buff, BOOL LOCAL)
{
int Len = sprintf(Buff, "<html><meta http-equiv=expires content=0><meta http-equiv=refresh content=15>"
int Len = sprintf(Buff, "<html><meta http-equiv=expires content=0>"
"<head><title>HAL Status</title></head><body><h3>HAL Status</h3>");
Len += sprintf(&Buff[Len], "<table style=\"text-align: left; width: 480px; font-family: monospace; align=center \" border=1 cellpadding=2 cellspacing=2>");
@ -718,7 +719,7 @@ VOID HALPoll(int Port)
TNC->HostMode = 0;
sprintf(TNC->WEB_COMMSSTATE,"%s Open but TNC not responding", TNC->PortRecord->PORTCONTROL.SerialPortName);
MySetWindowText(TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE);
MySetWindowText(TNC, TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE);
//for (Stream = 0; Stream <= MaxStreams; Stream++)
{
@ -758,7 +759,7 @@ VOID HALPoll(int Port)
SendCmd(TNC, TXMsg, datalen + 1); // Send the NULL
sprintf(TNC->WEB_TNCSTATE, "In Use by %s", STREAM->MyCall);
MySetWindowText(TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
MySetWindowText(TNC, TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
// Stop Scanning
@ -911,7 +912,7 @@ VOID HALPoll(int Port)
buffptr->Len = sprintf((UCHAR *)buffptr->Data,"HAL} Ok\r");
C_Q_ADD(&STREAM->PACTORtoBPQ_Q, buffptr);
MySetWindowText(TNC->xIDC_MODE, "Clover");
MySetWindowText(TNC, TNC->xIDC_MODE, "Clover");
strcpy(TNC->WEB_MODE, "Clover");
SendCmd(TNC, "\x80", 1); // Clover
@ -972,7 +973,7 @@ VOID HALPoll(int Port)
break;
}
MySetWindowText(TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
MySetWindowText(TNC, TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
SendCmd(TNC, TXMsg, datalen + 1); // Include NULL
ReleaseBuffer(buffptr);
@ -992,7 +993,7 @@ VOID HALPoll(int Port)
sprintf(TNC->WEB_TNCSTATE, "%s Connecting to %s - CLOVER",
STREAM->MyCall, STREAM->RemoteCall);
MySetWindowText(TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
MySetWindowText(TNC, TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
ReleaseBuffer(buffptr);
@ -1253,9 +1254,9 @@ NotData:
ProcessHALCmd(TNC);
}
VOID mySetWindowText(struct TNCINFO * TNC, char * Msg)
VOID halSetWindowText(struct TNCINFO * TNC, char * Msg)
{
MySetWindowText(TNC->xIDC_STATE, Msg);
MySetWindowText(TNC, TNC->xIDC_STATE, Msg);
strcpy(TNC->WEB_STATE, Msg);
}
@ -1282,7 +1283,7 @@ CmdLoop:
TNC->Timeout = 0;
sprintf(TNC->WEB_COMMSSTATE,"%s TNC link OK", TNC->PortRecord->PORTCONTROL.SerialPortName);
MySetWindowText(TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE);
MySetWindowText(TNC, TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE);
// We may have more than one response in the buffer, and only each cmd/response decoder knows how many it needs
@ -1319,7 +1320,7 @@ CmdLoop:
// Diaplay Linke Status
MySetWindowText(TNC->xIDC_MODE, status[StatusByte]);
MySetWindowText(TNC, TNC->xIDC_MODE, status[StatusByte]);
strcpy(TNC->WEB_MODE, status[StatusByte]);
break;
@ -1329,7 +1330,7 @@ CmdLoop:
// if we were connecting, this means connect failed.
MySetWindowText(TNC->xIDC_MODE, status[StatusByte]);
MySetWindowText(TNC, TNC->xIDC_MODE, status[StatusByte]);
strcpy(TNC->WEB_MODE, status[StatusByte]);
if (STREAM->Connecting)
@ -1339,14 +1340,14 @@ CmdLoop:
case 0x0E: // ISS (AMTOR/P-MODE)
MySetWindowText(TNC->xIDC_TXRX,"ISS");
MySetWindowText(TNC, TNC->xIDC_TXRX,"ISS");
strcpy(TNC->WEB_TXRX, "ISS");
TNC->TXRXState = 'S';
break;
case 0x0F: // IRS (AMTOR/P-MODE)
MySetWindowText(TNC->xIDC_TXRX,"IRS");
MySetWindowText(TNC, TNC->xIDC_TXRX,"IRS");
strcpy(TNC->WEB_TXRX, "IRS");
TNC->TXRXState = 'R';
break;
@ -1358,7 +1359,7 @@ CmdLoop:
case 0x04: // PHS (AMTOR/P-MODE)
case 0x05: // OVER (AMTOR/P-MODE) (not implemented)
MySetWindowText(TNC->xIDC_STATE, status[StatusByte]);
MySetWindowText(TNC, TNC->xIDC_STATE, status[StatusByte]);
strcpy(TNC->WEB_MODE, status[StatusByte]);
@ -1389,7 +1390,7 @@ CmdLoop:
(Leds & 0x01)? 'X' : ' ');
// STBY CALL LINK ERROR TX RX
MySetWindowText(TNC->xIDC_LEDS, TNC->WEB_LEDS);
MySetWindowText(TNC, TNC->xIDC_LEDS, TNC->WEB_LEDS);
Used = 2;
break;
@ -1525,25 +1526,25 @@ CmdLoop:
switch (StatusByte)
{
case 0x00: mySetWindowText(TNC, "Channel idle"); break;
case 0x01: mySetWindowText(TNC, "Channel occupied with non-Clover signal"); break;
case 0x42: mySetWindowText(TNC, "Linked stations monitored"); break;
case 0x64: mySetWindowText(TNC, "Attempting normal link"); break;
case 0x65: mySetWindowText(TNC, "Attempting robust link"); break;
case 0x66: mySetWindowText(TNC, "Calling ARQ CQ"); break;
case 0x78: mySetWindowText(TNC, "Clover Control Block (CCB) send retry"); break;
case 0x79: mySetWindowText(TNC, "Clover Control Block (CCB) receive retry"); break;
case 0x7D: mySetWindowText(TNC, "Clover Control Block (CCB) received successfully"); break;
case 0x8A: mySetWindowText(TNC, "TX data block sent"); break;
case 0x8B: mySetWindowText(TNC, "RX data block received ok (precedes data block)"); break;
case 0x8C: mySetWindowText(TNC, "TX data block re-sent"); break;
case 0x8D: mySetWindowText(TNC, "RX data block decode failed (precedes data block)"); break;
case 0x8E: mySetWindowText(TNC, "TX idle"); break;
case 0x8F: mySetWindowText(TNC, "RX idle"); break;
case 0x9C: mySetWindowText(TNC, "Link failed: CCB send retries exceeded"); break;
case 0x9D: mySetWindowText(TNC, "Link failed: CCB receive retries exceeded"); break;
case 0x9E: mySetWindowText(TNC, "Link failed: protocol error"); break;
case 0xA0: mySetWindowText(TNC, "Receiving FEC SYNC sequence"); break;
case 0x00: halSetWindowText(TNC, "Channel idle"); break;
case 0x01: halSetWindowText(TNC, "Channel occupied with non-Clover signal"); break;
case 0x42: halSetWindowText(TNC, "Linked stations monitored"); break;
case 0x64: halSetWindowText(TNC, "Attempting normal link"); break;
case 0x65: halSetWindowText(TNC, "Attempting robust link"); break;
case 0x66: halSetWindowText(TNC, "Calling ARQ CQ"); break;
case 0x78: halSetWindowText(TNC, "Clover Control Block (CCB) send retry"); break;
case 0x79: halSetWindowText(TNC, "Clover Control Block (CCB) receive retry"); break;
case 0x7D: halSetWindowText(TNC, "Clover Control Block (CCB) received successfully"); break;
case 0x8A: halSetWindowText(TNC, "TX data block sent"); break;
case 0x8B: halSetWindowText(TNC, "RX data block received ok (precedes data block)"); break;
case 0x8C: halSetWindowText(TNC, "TX data block re-sent"); break;
case 0x8D: halSetWindowText(TNC, "RX data block decode failed (precedes data block)"); break;
case 0x8E: halSetWindowText(TNC, "TX idle"); break;
case 0x8F: halSetWindowText(TNC, "RX idle"); break;
case 0x9C: halSetWindowText(TNC, "Link failed: CCB send retries exceeded"); break;
case 0x9D: halSetWindowText(TNC, "Link failed: CCB receive retries exceeded"); break;
case 0x9E: halSetWindowText(TNC, "Link failed: protocol error"); break;
case 0xA0: halSetWindowText(TNC, "Receiving FEC SYNC sequence"); break;
}
Used = 2;
@ -1725,7 +1726,7 @@ VOID HALDisconnected(struct TNCINFO * TNC)
STREAM->FramesQueued = 0;
sprintf(TNC->WEB_TNCSTATE, "In Use by %s", STREAM->MyCall);
MySetWindowText(TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
MySetWindowText(TNC, TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
return;
}
@ -1757,7 +1758,7 @@ BOOL HALConnected(struct TNCINFO * TNC, char * Call)
strcat(CallCopy, " "); // Some routines expect 10 char calls
STREAM->bytesRXed = STREAM->bytesTXed = STREAM->BytesAcked = 0;
STREAM->ConnectTime = time(NULL);
STREAM->ConnectTime = NOW;
// Stop Scanner
@ -1780,7 +1781,7 @@ BOOL HALConnected(struct TNCINFO * TNC, char * Call)
ProcessIncommingConnect(TNC, CallCopy, 0, TRUE);
sprintf(TNC->WEB_TNCSTATE, "%s Connected to %s Inbound", STREAM->RemoteCall, TNC->NodeCall);
MySetWindowText(TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
MySetWindowText(TNC, TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
if (TNC->CurrentMode != Clover)
SendCmd(TNC, "\x87", 1); // Changeover to ISS
@ -1822,7 +1823,7 @@ BOOL HALConnected(struct TNCINFO * TNC, char * Call)
STREAM->Connected = TRUE; // Subsequent data to data channel
sprintf(TNC->WEB_TNCSTATE, "%s Connected to %s Outbound", TNC->NodeCall, STREAM->RemoteCall);
MySetWindowText(TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
MySetWindowText(TNC, TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
UpdateMH(TNC, CallCopy, '+', 'O');

@ -320,7 +320,7 @@ LRESULT CALLBACK PacWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPara
TNC->TXOffset = SendMessage(TNC->xIDC_TXTUNE, TBM_GETPOS, 0, 0);
sprintf(value, "%d", TNC->TXOffset);
MySetWindowText(TNC->xIDC_TXTUNEVAL, value);
MySetWindowText(TNC, TNC->xIDC_TXTUNEVAL, value);
break;
}
@ -644,7 +644,7 @@ VOID SendWL2KRegisterHybrid(struct TNCINFO * TNC)
strcpy(Call, TCP->GatewayCall);
strlop(Call, '-');
T = time(NULL);
T = NOW;
tm = gmtime(&T);
//2021-10-31-14=35=29
@ -771,7 +771,7 @@ IdTag (random alphanumeric, 12 chars)
if (ADIF->StartTime == 0 || ADIF->ServerSID[0] == 0 || ADIF->CMSCall[0] == 0)
return TRUE;
T = time(NULL);
T = NOW;
// Extract Info we need
@ -1506,7 +1506,7 @@ DoMove:
// memcpy (MHBASE->MHCALL, Buffer->ORIGIN, 7 * 9);
memcpy (MHBASE->MHCALL, AXCall, 7 * 9); // Save Digis
MHBASE->MHDIGI = Mode;
MHBASE->MHTIME = time(NULL);
MHBASE->MHTIME = NOW;
MHBASE->MHCOUNT = ++OldCount;
memcpy(MHBASE->MHLocator, LOC, 6);
@ -2032,10 +2032,10 @@ void sendModeReport()
char Msg[300] = "MODE ";
int i, Len = 5;
if ((CurrentSecs - LastModeReportTime) < 900) // Every 15 Mins
if ((NOW - LastModeReportTime) < 900) // Every 15 Mins
return;
LastModeReportTime = CurrentSecs;
LastModeReportTime = NOW;
for (i = 0; i < NUMBEROFPORTS; i++)
{
@ -2099,10 +2099,10 @@ void sendFreqReport(char * From)
struct PORTCONTROL * PORT = PORTTABLE;
struct TNCINFO * TNC;
if ((CurrentSecs - LastFreqReportTime) < 7200) // Every 2 Hours
if ((NOW - LastFreqReportTime) < 7200) // Every 2 Hours
return;
LastFreqReportTime = CurrentSecs;
LastFreqReportTime = NOW;
for (p = 0; p < NumberofPorts; p++)
{

@ -391,7 +391,7 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff)
if (TNC->CONNECTED == 0)
{
sprintf(TNC->WEB_COMMSSTATE, "Connection to HSMODEM lost");
MySetWindowText(TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE);
MySetWindowText(TNC, TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE);
}
}
@ -526,7 +526,7 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff)
SuspendOtherPorts(TNC);
//sprintf(TNC->WEB_TNCSTATE, "In Use by %s", TNC->Streams[0].MyCall);
//MySetWindowText(TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
//MySetWindowText(TNC, TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
// Stop Scanning
@ -734,7 +734,7 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff)
// Save Command, and wait up to 10 secs
sprintf(TNC->WEB_TNCSTATE, "Waiting for clear channel");
MySetWindowText(TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
MySetWindowText(TNC, TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
TNC->ConnectCmd = _strdup(Connect);
TNC->BusyDelay = TNC->BusyWait * 10; // BusyWait secs
@ -749,7 +749,7 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff)
sprintf(TNC->WEB_TNCSTATE, "%s Connecting to %s", STREAM->MyCall, STREAM->RemoteCall);
HSMODEMSendCommand(TNC, Connect);
MySetWindowText(TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
MySetWindowText(TNC, TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
STREAM->Connecting = TRUE;
return 0;
@ -878,7 +878,7 @@ VOID HSMODEMReleasePort(struct TNCINFO * TNC)
static int WebProc(struct TNCINFO * TNC, char * Buff, BOOL LOCAL)
{
int Len = sprintf(Buff, "<html><meta http-equiv=expires content=0><meta http-equiv=refresh content=15>"
int Len = sprintf(Buff, "<html><meta http-equiv=expires content=0>"
"<script type=\"text/javascript\">\r\n"
"function ScrollOutput()\r\n"
"{var textarea = document.getElementById('textarea');"
@ -1420,7 +1420,7 @@ VOID HSMODEMProcessTNCMessage(struct TNCINFO * TNC, unsigned char * Msg, int Len
// Just come up
sprintf(TNC->WEB_COMMSSTATE, "Connected to HSMODEM");
MySetWindowText(TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE);
MySetWindowText(TNC, TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE);
SendMode(TNC);
}
@ -1507,7 +1507,7 @@ VOID HSMODEMProcessTNCMessage(struct TNCINFO * TNC, unsigned char * Msg, int Len
Info->lastBlock = 0;
Info->lostBlocks = 0;
Info->LastRX = time(NULL);
Info->LastRX = NOW;
Debugprintf("%d %d %04X %02x %s %d %s", Msg[1], Seq, FH->CRC, Msg[4],
FH->filename, fileLen, FH->Data);

@ -73,6 +73,7 @@ int APIProcessHTTPMessage(char * response, char * Method, char * URL, char * req
int RHPProcessHTTPMessage(struct ConnectionInfo * conn, char * response, char * Method, char * URL, char * request, BOOL LOCAL, BOOL COOKIE);
unsigned char * Compressit(unsigned char * In, int Len, int * OutLen);
int doinflate(unsigned char * source, unsigned char * dest, int Len, int destlen, int * outLen);
void SendDeviceWebPage(int Port);
extern struct ROUTE * NEIGHBOURS;
extern int ROUTE_LEN;
@ -319,7 +320,6 @@ static char ConfigEditPage[] = "<html><head><meta content=\"text/html; charset=I
static char EXCEPTMSG[80] = "";
void UndoTransparency(char * input)
{
char * ptr1, * ptr2;
@ -665,7 +665,7 @@ struct HTTPConnectionInfo * AllocateSession(SOCKET sock, char Mode)
SessionControl(Session->Stream, 1, 0);
}
KeyVal = (int)sock * time(NULL);
KeyVal = (int)sock * NOW;
sprintf(Session->Key, "%c%012X", Mode, (int)KeyVal);
@ -1163,11 +1163,11 @@ int SendMessageFile(SOCKET sock, char * FN, BOOL OnlyifExists, int allowDeflate)
if ((strcmp(FN, "/") == 0 || strstr(FN, "htm" ) || strstr(FN, "HTM")) && strstr(MsgBytes, "##" ))
{
FileSize = ProcessSpecialPage(MsgBytes, FileSize);
FormatTime3(FileTimeString, time(NULL));
FormatTime3(FileTimeString, NOW);
}
FormatTime3(TimeString, time(NULL));
FormatTime3(TimeString, NOW);
ptr = FN;
@ -1649,12 +1649,12 @@ int InnerProcessHTTPMessage(struct ConnectionInfo * conn)
"<td> </td><td>%s</td></tr>\r\n";
char PortLineWithDriver[] = "<tr><td>%d</td><td>%s</td><td>%s</td><td> </td>"
"<td><a href=\"javascript:dev_win('/Node/Port?%d',%d,%d,%d,%d);\">Driver Window</a></td><td>%s</td></tr>\r\n";
"<td><a href=\"javascript:dev_win('/Node/DevicePage?%d',%d,%d,%d,%d);\">Driver Window</a></td><td>%s</td></tr>\r\n";
char PortLineWithBeaconAndDriver[] = "<tr><td>%d</td><td>%s</td><td>%s</td>"
"<td><a href=PortBeacons?%d>&nbsp;Beacons</a></td>"
"<td><a href=\"javascript:dev_win('/Node/Port?%d',%d,%d,%d,%d);\">Driver Window</a></td><td>%s</td></tr>\r\n";
"<td><a href=\"javascript:dev_win('/Node/DevicePage?%d',%d,%d,%d,%d);\">Driver Window</a></td><td>%s</td></tr>\r\n";
char RigControlLine[] = "<tr><td>%d</td><td>%s</td><td>%s</td><td> </td>"
"<td><a href=\"javascript:dev_win('/Node/RigControl.html',%d,%d,%d,%d);\">Rig Control</a></td></tr>\r\n";
@ -2457,7 +2457,7 @@ doHeader:
TNC->TXOffset = atoi(input);
#ifdef WIN32
sprintf(value, "%d", TNC->TXOffset);
MySetWindowText(TNC->xIDC_TXTUNEVAL, value);
MySetWindowText(TNC, TNC->xIDC_TXTUNEVAL, value);
SendMessage(TNC->xIDC_TXTUNE, TBM_SETPOS, (WPARAM) TRUE, (LPARAM) TNC->TXOffset); // min. & max. positions
#endif
@ -3067,6 +3067,77 @@ doHeader:
ReplyLen = sprintf(_REPLYBUFFER, "%s", NoRigCtl);
}
else if (_stricmp(NodeURL, "/Node/DevicePage") == 0)
{
char Part1[] =
"<html><meta http-equiv=expires content=0>\r\n"
"<head><title>Device</title></head>\r\n"
"<script type = \"text/javascript\">\r\n"
"var ws;"
"function Action(data){\r\n"
"req = new XMLHttpRequest();\r\n"
"req.open('POST', 'PortAction?%d', true);\r\n"
"req.send(data);alert(data + ' Sent');}\r\n"
"function freqOffset(data){\r\n"
"req = new XMLHttpRequest();\r\n"
"req.open('POST', 'freqOffset?%d', true);\r\n"
"req.send(data);}\r\n"
"function OpenWebSocket()"
"{"
" 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] + '/DEVICE%d');\r\n"
" ws.onopen = function() {\r\n"
" // Web Socket is connected\r\n"
" const div = document.getElementById('div');\r\n"
" div.innerHTML = 'Websock Connected'\r\n};\r\n"
"ws.onmessage = function (evt)"
"{"
" var received_msg = evt.data;\r\n"
" const div = document.getElementById('div');\r\n"
" div.innerHTML = received_msg\r\n"
" const text = document.getElementById('textarea');\r\n"
" text.scrollTop = text.scrollHeight;\r\n"
" };\r\n"
" ws.onclose = function()"
" {"
" // websocket is closed.\r\n"
" const div = document.getElementById('div');\r\n"
" div.innerHTML = 'Websock Connection Lost'\r\n"
" };"
" }"
" else"
" {"
" // The browser doesn't support WebSocket\r\n"
" const div = document.getElementById('div');\r\n"
" div.innerHTML = 'WebSocket not supported by your Browser - Device Page not availible'\r\n"
" }"
"}"
"</script>\r\n"
"</head>\r\n"
"<body height: 600px; onload=OpenWebSocket()>\r\n"
"<div id = 'div'>Waiting for data...</div>\r\n"
"</body></html>\r\n";
int Port = atoi(Context);
int xxx;
ReplyLen = sprintf(_REPLYBUFFER, Part1, Port, Port, Port);
xxx = ReplyLen;
}
else if (_stricmp(NodeURL, "/Node/ShowLog.html") == 0)
{
char ShowLogPage[] =
@ -3100,7 +3171,7 @@ doHeader:
struct tm * tm;
char Name[64] = "";
T = time(NULL);
T = NOW;
tm = gmtime(&T);
if (LOCAL == FALSE && COOKIE == FALSE)
@ -3782,7 +3853,6 @@ doHeader:
struct AXIPPORTINFO * AXPORT = Portlist[0];
struct PORTCONTROL * PORT = PORTTABLE;
struct arp_table_entry * arp;
time_t NOW = time(NULL);
char AXIPHeader[] =
"<table align='center' bgcolor='ffffff' border=2 cellpadding=10 cellspacing=2 style=font-family:monospace>"
@ -4203,7 +4273,7 @@ CMDS60:
SendResp:
FormatTime3(TimeString, time(NULL));
FormatTime3(TimeString, NOW);
strcpy(&_REPLYBUFFER[ReplyLen], Tail);
ReplyLen += (int)strlen(Tail);
@ -4741,6 +4811,27 @@ int BuildRigCtlPage(char * _REPLYBUFFER)
}
void BuildDevicePage(struct TNCINFO * TNC)
{
int Len;
char Page[65536];
Len = TNC->WebWindowProc(TNC, Page, 1);
if (TNC->WebPage)
{
if (strcmp(TNC->WebPage, Page) == 0)
return; // No change
else
free(TNC->WebPage);
}
TNC->WebPage = _strdup(Page);
SendDeviceWebPage(TNC->Port);
}
void SendRigWebPage()
{
int i, n;
@ -4793,6 +4884,68 @@ void SendRigWebPage()
}
}
void SendDeviceWebPage(int Port)
{
int i, n;
struct ConnectionInfo * sockptr;
struct TNCINFO * TNC = TNCInfo[Port];
struct TCPINFO * TCP;
char DevString[16];
char Msg[65536];
int MsgLen;
if (TNC->WebPage == 0)
return;
strcpy(&Msg[4], TNC->WebPage);
MsgLen = strlen(&TNC->WebPage[4]);
sprintf(DevString, "DEVICE%d", Port);
for (i = 0; i < 33; i++)
{
TNC = TNCInfo[i];
if (TNC && TNC->Hardware == H_TELNET)
{
TCP = TNC->TCPInfo;
if (TCP)
{
for (n = 0; n <= TCP->MaxSessions; n++)
{
sockptr = TNC->Streams[n].ConnectionInfo;
if (sockptr->SocketActive)
{
if (sockptr->HTTPMode && sockptr->WebSocks && strcmp(sockptr->WebURL, DevString) == 0)
{
char* ptr;
Msg[0] = 0x81; // Fin, Data
Msg[1] = 126; // Unmasked, Extended Len
Msg[2] = MsgLen >> 8;
Msg[3] = MsgLen & 0xff;
// If secure session enable PTT button
if (sockptr->WebSecure)
{
while (ptr = strstr(&Msg[4], "hidden"))
memcpy(ptr, " ", 6);
}
send(sockptr->socket, Msg, MsgLen + 4, 0);
}
}
}
}
}
}
}
// Webmail web socket code
int ProcessWebmailWebSock(char * MsgPtr, char * OutBuffer);

@ -2472,7 +2472,7 @@ VOID ProcessRIP44Message(PIPMSG IPptr)
SaveIPRoutes();
qsort(RouteRecords, NumberofRoutes, sizeof(void *), CompareMasks);
LastRIP44Msg = time(NULL);
LastRIP44Msg = NOW;
}
@ -3639,7 +3639,6 @@ VOID DoRouteTimer()
{
int i;
PROUTEENTRY Route;
time_t NOW = time(NULL);
for (i=0; i < NumberofRoutes; i++)
{
@ -4746,7 +4745,6 @@ VOID PING(TRANSPORTENTRY * Session, char * Bufferptr, char * CmdTail, struct CMD
UCHAR Msg[120] = "";
PIPMSG IPptr = (PIPMSG)&Msg[40]; // Space for frame header (not used)
PICMPMSG ICMPptr = (PICMPMSG)&IPptr->Data;
time_t NOW = time(NULL);
Bufferptr = Cmdprintf(Session, Bufferptr, "\r");
@ -5362,7 +5360,7 @@ int ProcessSNMPPayload(UCHAR * Msg, int Len, UCHAR * Reply, int * OffPtr)
else if (memcmp(OID, sysUpTime, sysUpTimeLen) == 0)
{
int ValOffset = 10;
ValLen = ASNPutInt(Value, ValOffset, (int)((time(NULL) - TimeLoaded) * 100), TimeTicks);
ValLen = ASNPutInt(Value, ValOffset, (int)((NOW - TimeLoaded) * 100), TimeTicks);
ValOffset -= ValLen;
PDULen = BuildReply(Reply, Offset, sysUpTime, sysUpTimeLen, &Value[ValOffset], ReqID);

@ -102,7 +102,7 @@ BOOL KAMStopPort(struct PORTCONTROL * PORT)
TNC->HostMode = FALSE;
sprintf(PORT->TNC->WEB_COMMSSTATE, "%s", "Port Stopped");
MySetWindowText(PORT->TNC->xIDC_COMMSSTATE, PORT->TNC->WEB_COMMSSTATE);
MySetWindowText(TNC, PORT->TNC->xIDC_COMMSSTATE, PORT->TNC->WEB_COMMSSTATE);
return TRUE;
}
@ -117,7 +117,7 @@ BOOL KAMStartPort(struct PORTCONTROL * PORT)
TNC->ReinitState = 0;
sprintf(PORT->TNC->WEB_COMMSSTATE, "%s", "Port Restarted");
MySetWindowText(PORT->TNC->xIDC_COMMSSTATE, PORT->TNC->WEB_COMMSSTATE);
MySetWindowText(TNC, PORT->TNC->xIDC_COMMSSTATE, PORT->TNC->WEB_COMMSSTATE);
return TRUE;
}
@ -142,7 +142,7 @@ static BOOL OpenLogFile(int Flags)
time_t T;
struct tm * tm;
T = time(NULL);
T = NOW;
tm = gmtime(&T);
sprintf(FN,"%s/logs/KAMLog_%02d%02d_%d.txt", LogDirectory, tm->tm_mon + 1, tm->tm_mday, Flags);
@ -524,7 +524,7 @@ VOID KAMSuspendPort(struct TNCINFO * TNC, struct TNCINFO * ThisTNC)
struct STREAMINFO * STREAM = &TNC->Streams[0];
strcpy(TNC->WEB_TNCSTATE, "Interlocked");
MySetWindowText(TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
MySetWindowText(TNC, TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
// STREAM->CmdSet = STREAM->CmdSave = zalloc(100);
// sprintf(STREAM->CmdSet, "I%s\r", "SCSPTC"); // Should prevent connects
@ -536,14 +536,14 @@ VOID KAMReleasePort(struct TNCINFO * TNC)
struct STREAMINFO * STREAM = &TNC->Streams[0];
strcpy(TNC->WEB_TNCSTATE, "Free");
MySetWindowText(TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
MySetWindowText(TNC, TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
}
static int WebProc(struct TNCINFO * TNC, char * Buff, BOOL LOCAL)
{
int Len = sprintf(Buff, "<html><meta http-equiv=expires content=0><meta http-equiv=refresh content=15>"
int Len = sprintf(Buff, "<html><meta http-equiv=expires content=0>"
"<head><title>KAM Pactor Status</title></head><body><h3>KAM Pactor Status</h3>");
Len += sprintf(&Buff[Len], "<table style=\"text-align: left; width: 480px; font-family: monospace; align=center \" border=1 cellpadding=2 cellspacing=2>");
@ -1940,7 +1940,7 @@ VOID ProcessKHOSTPacket(struct TNCINFO * TNC, UCHAR * Msg, int Len)
}
STREAM->bytesRXed = STREAM->bytesTXed = STREAM->BytesAcked = 0;
STREAM->ConnectTime = time(NULL);
STREAM->ConnectTime = NOW;
if (Stream == 0)
{

@ -336,7 +336,7 @@ ok:
SuspendOtherPorts(TNC);
sprintf(TNC->WEB_TNCSTATE, "In Use by %s", TNC->Streams[0].MyCall);
MySetWindowText(TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
MySetWindowText(TNC, TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
// Stop Scanning
@ -725,7 +725,7 @@ VOID KISSHFReleaseTNC(struct TNCINFO * TNC)
Rig_Command( (TRANSPORTENTRY *) -1, TXMsg);
strcpy(TNC->WEB_TNCSTATE, "Free");
MySetWindowText(TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
MySetWindowText(TNC, TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
ReleaseOtherPorts(TNC);
}
@ -734,19 +734,19 @@ VOID KISSHFSuspendPort(struct TNCINFO * TNC, struct TNCINFO * THISTNC)
{
TNC->PortRecord->PORTCONTROL.PortSuspended = 1;
strcpy(TNC->WEB_TNCSTATE, "Interlocked");
MySetWindowText(TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
MySetWindowText(TNC, TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
}
VOID KISSHFReleasePort(struct TNCINFO * TNC)
{
TNC->PortRecord->PORTCONTROL.PortSuspended = 0;
strcpy(TNC->WEB_TNCSTATE, "Free");
MySetWindowText(TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
MySetWindowText(TNC, TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
}
static int WebProc(struct TNCINFO * TNC, char * Buff, BOOL LOCAL)
{
int Len = sprintf(Buff, "<html><meta http-equiv=expires content=0><meta http-equiv=refresh content=15>"
int Len = sprintf(Buff, "<html><meta http-equiv=expires content=0>"
"<script type=\"text/javascript\">\r\n"
"function ScrollOutput()\r\n"
"{var textarea = document.getElementById('textarea');"
@ -1099,7 +1099,7 @@ VOID KISSThread(void * portptr)
i=sprintf(Msg, "Connect Failed for KISSHF socket - error code = %d\r\n", err);
WritetoConsole(Msg);
sprintf(TNC->WEB_COMMSSTATE, "Connection to TNC failed");
MySetWindowText(TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE);
MySetWindowText(TNC, TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE);
TNC->Alerted = TRUE;
}
@ -1160,7 +1160,7 @@ VOID KISSThread(void * portptr)
TNC->Alerted = TRUE;
sprintf(TNC->WEB_COMMSSTATE, "Connected to KISS TNC");
MySetWindowText(TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE);
MySetWindowText(TNC, TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE);
FreeSemaphore(&Semaphore);
@ -1212,7 +1212,7 @@ Lost:
WritetoConsole(Msg);
sprintf(TNC->WEB_COMMSSTATE, "Connection to TNC lost");
MySetWindowText(TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE);
MySetWindowText(TNC, TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE);
TNC->CONNECTED = FALSE;
TNC->Alerted = FALSE;
@ -1352,7 +1352,7 @@ VOID KISSHFProcessReceivedPacket(struct TNCINFO * TNC, int Channel)
TNC->Streams[0].ReportDISC = TRUE;
sprintf(TNC->WEB_COMMSSTATE, "Connection to TNC lost");
MySetWindowText(TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE);
MySetWindowText(TNC, TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE);
return;
}
@ -1529,7 +1529,7 @@ void AttachKISSHF(struct PORTCONTROL * PORT, MESSAGE * Buffer)
if (WL2K)
strcpy(SESS->RMSCall, WL2K->RMSCall);
MySetWindowText(TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
MySetWindowText(TNC, TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
}
}
@ -1604,7 +1604,7 @@ void KISSHFConnected(struct PORTCONTROL * PORT, struct _LINKTABLE * LINK)
if (WL2K)
strcpy(SESS->RMSCall, WL2K->RMSCall);
MySetWindowText(TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
MySetWindowText(TNC, TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
}
}

@ -575,7 +575,7 @@ DoMove:
memcpy (MHBASE->MHCALL, Buffer->ORIGIN, 7 * 9); // Save Digis
MHBASE->MHDIGI = DIGI;
MHBASE->MHTIME = time(NULL);
MHBASE->MHTIME = NOW;
MHBASE->MHCOUNT = ++OldCount;
strcpy(MHBASE->MHFreq, Freq);
MHBASE->MHLocator[0] = 0;
@ -3157,7 +3157,7 @@ VOID SDETX(struct _LINKTABLE * LINK)
// **** Debug code **** look for stuck links
if (LINK->LINKWINDOW == 0 || LINK->LASTFRAMESENT == 0 || (time(NULL) - LINK->LASTFRAMESENT) > 60) // No send for 60 secs
if (LINK->LINKWINDOW == 0 || LINK->LASTFRAMESENT == 0 || (NOW - LINK->LASTFRAMESENT) > 60) // No send for 60 secs
{
if (COUNT_AT_L2(LINK) > 16 || LINK->LINKWINDOW == 0)
{
@ -3167,7 +3167,7 @@ VOID SDETX(struct _LINKTABLE * LINK)
char Normcall2[11] = "";
int Count = COUNT_AT_L2(LINK);
int secs = time(NULL) - LINK->LASTFRAMESENT;
int secs = NOW - LINK->LASTFRAMESENT;
ConvFromAX25(LINK->LINKCALL, Normcall);
ConvFromAX25(LINK->OURCALL, Normcall2);
@ -3209,7 +3209,7 @@ VOID SDETX(struct _LINKTABLE * LINK)
Msg = Q_REM(&LINK->TX_Q);
Msg->CHAIN = NULL;
LINK->LASTFRAMESENT = time(NULL);
LINK->LASTFRAMESENT = NOW;
LINK->LASTSENTQCOUNT = COUNT_AT_L2(LINK);
if (LINK->LASTSENTQCOUNT > LINK->maxQueued)
@ -3461,7 +3461,7 @@ VOID L2TimerProc()
int i = MAXLINKS;
struct _LINKTABLE * LINK = LINKS;
struct PORTCONTROL * PORT = PORTTABLE;
time_t Now = time(NULL);
time_t Now = NOW;
while (i--)
{

@ -1028,7 +1028,7 @@ VOID CLEARACTIVEROUTE(struct ROUTE * ROUTE, int Reason)
}
VOID L3TimerProc()
VOID L3MinuteTimerProc()
{
int i;
struct PORTCONTROL * PORT = PORTTABLE;
@ -1127,7 +1127,7 @@ VOID L3TimerProc()
}
}
VOID L3FastTimer()
VOID L3SecTimer()
{
// CALLED ONCE PER SECOND - USED ONLY TO SEND NEXT PART OF A NODES OR
// ID MESSAGE SEQUENCE

@ -59,7 +59,7 @@ int CHECKIFBUSYL4(TRANSPORTENTRY * L4);
VOID AUTOTIMER(TRANSPORTENTRY * L4);
VOID NRRecordRoute(UCHAR * Buff, int Len);
VOID REFRESHROUTE(TRANSPORTENTRY * Session);
VOID ACKFRAMES(L3MESSAGEBUFFER * L3MSG, TRANSPORTENTRY * L4, int NR);
VOID ACKFRAMES(L3MESSAGEBUFFER * L3MSG, TRANSPORTENTRY * L4, int NR, int UPDATERTT);
VOID SENDL4IACK(TRANSPORTENTRY * Session);
VOID CHECKNEIGHBOUR(struct _LINKTABLE * LINK, L3MESSAGEBUFFER * Msg);
VOID ProcessINP3RIF(struct ROUTE * Route, UCHAR * ptr1, int msglen, int Port);
@ -1124,7 +1124,7 @@ VOID CLOSECURRENTSESSION(TRANSPORTENTRY * Session)
}
VOID L4TimerProc()
VOID L4SecTimer()
{
// CHECK FOR TIMER EXPIRY
@ -1132,7 +1132,7 @@ VOID L4TimerProc()
TRANSPORTENTRY * L4 = L4TABLE;
TRANSPORTENTRY * Partner;
int MaxLinks = MAXLINKS;
time_t Now = time(NULL);
time_t Now = NOW;
while (n--)
{
@ -1577,7 +1577,7 @@ void WriteL4LogLine(UCHAR * mycall, UCHAR * call, UCHAR * node)
Call3[ConvFromAX25(node, Call3)] = 0;
T = time(NULL);
T = NOW;
tm = gmtime(&T);
sprintf(FN,"%s/L4Log_%02d%02d.txt", BPQDirectory, tm->tm_mon + 1, tm->tm_mday);
@ -2389,7 +2389,7 @@ VOID FRAMEFORUS(struct _LINKTABLE * LINK, L3MESSAGEBUFFER * L3MSG, int ApplMask,
}
*/
ACKFRAMES(L3MSG, L4, L3MSG->L4RXNO);
ACKFRAMES(L3MSG, L4, L3MSG->L4RXNO, 1);
// If DISCPENDING or STATE IS 4, THEN SESSION IS CLOSING - IGNORE ANY I FRAMES
@ -2627,7 +2627,7 @@ checkReseq:
case L4IACK:
ACKFRAMES(L3MSG, L4, L3MSG->L4RXNO);
ACKFRAMES(L3MSG, L4, L3MSG->L4RXNO, 0);
REFRESHROUTE(L4);
ReleaseBuffer(L3MSG);
@ -2642,7 +2642,7 @@ checkReseq:
}
VOID ACKFRAMES(L3MESSAGEBUFFER * L3MSG, TRANSPORTENTRY * L4, int NR)
VOID ACKFRAMES(L3MESSAGEBUFFER * L3MSG, TRANSPORTENTRY * L4, int NR, int UPDATERTT)
{
// SEE HOW MANY FRAMES ARE ACKED - IF NEGATIVE, THAN THIS MUST BE A
// DELAYED REPEAT OF AN ACK ALREADY PROCESSED
@ -2682,18 +2682,21 @@ VOID ACKFRAMES(L3MESSAGEBUFFER * L3MSG, TRANSPORTENTRY * L4, int NR)
{
if (L4->RTT_TIMER)
{
// FRAME BEING TIMED HAS BEEN ACKED - UPDATE DEST RTT TIMER
// FRAME BEING TIMED HAS BEEN ACKED - UPDATE DEST RTT TIMER unless INFO ACK
DEST = L4->L4TARGET.DEST;
if (UPDATERTT)
{
DEST = L4->L4TARGET.DEST;
RTT = GetTickCount() - L4->RTT_TIMER;
RTT = GetTickCount() - L4->RTT_TIMER;
if (RTT < 180000) // Sanity Check
{
if (DEST->DEST_RTT == 0)
DEST->DEST_RTT = RTT;
else
DEST->DEST_RTT = ((DEST->DEST_RTT * 9) + RTT) /10; // 90% Old + New
if (RTT < 180000) // Sanity Check
{
if (DEST->DEST_RTT == 0)
DEST->DEST_RTT = RTT;
else
DEST->DEST_RTT = ((DEST->DEST_RTT * 9) + RTT) /10; // 90% Old + New
}
}
L4->RTT_TIMER = 0;
}

@ -273,7 +273,7 @@ BOOL CLOSING = FALSE;
int ProgramErrors;
int Slowtimer = 0;
#define REPORTINTERVAL 15 * 549; // Magic Ticks Per Minute for PC's nominal 100 ms timer
#define REPORTINTERVAL 15 * 600; // 15 mins
int ReportTimer = 0;
// Console Terminal Support
@ -543,7 +543,7 @@ VOID MonitorThread(void * x)
VOID TIMERINTERRUPT();
int TIMERINTERRUPT();
BOOL Start();
VOID INITIALISEPORTS();
@ -809,6 +809,183 @@ static void abrthandler(int sig);
void GetRestartData();
void Main100msCode()
{
// code that doesn't need to run every tick - run every 100 mS
// Runs under semaphore
if (IPActive) Poll_IP();
if (RigActive) Rig_Poll();
if (APRSActive) Poll_APRS();
CheckWL2KReportTimer();
if (QCOUNT < 10)
{
if (CLOSING == FALSE)
FindLostBuffers();
CLOSING = TRUE;
}
if (CLOSING)
{
if (RunChat)
{
CloseChat();
RunChat = FALSE;
}
if (RunMail)
{
int BPQStream, n;
RunMail = FALSE;
for (n = 0; n < NumberofStreams; n++)
{
BPQStream = Connections[n].BPQStream;
if (BPQStream)
{
SetAppl(BPQStream, 0, 0);
Disconnect(BPQStream);
DeallocateStream(BPQStream);
}
}
// SaveUserDatabase();
SaveMessageDatabase();
SaveBIDDatabase();
SaveConfig(ConfigName);
SaveRestartData();
}
KEEPGOING--; // Give time for links to close
setbuf(stdout, NULL);
printf("Closing... %d \r", KEEPGOING);
}
if (RigReconfigFlag)
{
RigReconfigFlag = FALSE;
Rig_Close();
Sleep(2000); // Allow CATPTT threads to close
RigActive = Rig_Init();
Consoleprintf("Rigcontrol Reconfiguration Complete");
}
if (APRSReconfigFlag)
{
APRSReconfigFlag = FALSE;
APRSClose();
APRSActive = Init_APRS();
Consoleprintf("APRS Reconfiguration Complete");
}
if (ReconfigFlag)
{
int i;
BPQVECSTRUC * HOSTVEC;
PEXTPORTDATA PORTVEC=(PEXTPORTDATA)PORTTABLE;
ReconfigFlag = FALSE;
// SetupBPQDirectory();
WritetoConsoleLocal("Reconfiguring ...\n\n");
OutputDebugString("BPQ32 Reconfiguring ...\n");
for (i=0;i<NUMBEROFPORTS;i++)
{
if (PORTVEC->PORTCONTROL.PORTTYPE == 0x10) // External
{
if (PORTVEC->PORT_EXT_ADDR)
{
// SaveWindowPos(PORTVEC->PORTCONTROL.PORTNUMBER);
// SaveAXIPWindowPos(PORTVEC->PORTCONTROL.PORTNUMBER);
// CloseDriverWindow(PORTVEC->PORTCONTROL.PORTNUMBER);
PORTVEC->PORT_EXT_ADDR(5,PORTVEC->PORTCONTROL.PORTNUMBER, NULL); // Close External Ports
}
}
PORTVEC->PORTCONTROL.PORTCLOSECODE(&PORTVEC->PORTCONTROL);
PORTVEC=(PEXTPORTDATA)PORTVEC->PORTCONTROL.PORTPOINTER;
}
IPClose();
APRSClose();
Rig_Close();
CloseTNCEmulator();
if (AGWActive)
AGWAPITerminate();
WL2KReports = NULL;
// Sleep(2000);
Consoleprintf("G8BPQ AX25 Packet Switch System Version %s %s", TextVerstring, Datestring);
Consoleprintf(VerCopyright);
Start();
NETROMTCPResolve();
INITIALISEPORTS();
SetApplPorts();
GetUIConfig();
FreeConfig();
for (i=1; i<68; i++) // Include Telnet, APRS, IP Vec
{
HOSTVEC=&BPQHOSTVECTOR[i-1];
HOSTVEC->HOSTTRACEQ=0;
if (HOSTVEC->HOSTSESSION !=0)
{
// Had a connection
HOSTVEC->HOSTSESSION=0;
HOSTVEC->HOSTFLAGS |=3; // Disconnected
// PostMessage(HOSTVEC->HOSTHANDLE, BPQMsg, i, 4);
}
}
OpenReportingSockets();
WritetoConsoleLocal("\n\nReconfiguration Complete\n");
if (IPRequired) IPActive = Init_IP();
APRSActive = Init_APRS();
if (ISPort == 0)
IGateEnabled = 0;
RigActive = Rig_Init();
if (NUMBEROFTNCPORTS)
{
FreeSemaphore(&Semaphore);
InitializeTNCEmulator();
GetSemaphore(&Semaphore, 2);
}
FreeSemaphore(&Semaphore);
AGWActive = AGWAPIInit();
GetSemaphore(&Semaphore, 2);
OutputDebugString("BPQ32 Reconfiguration Complete\n");
}
}
int main(int argc, char * argv[])
{
@ -866,7 +1043,8 @@ int main(int argc, char * argv[])
printf("%d", sizeof(struct DEST_LIST));
srand(time(NULL));
NOW = time(NULL);
srand(NOW);
// look for optarg format parameters
@ -1432,270 +1610,108 @@ int main(int argc, char * argv[])
while (KEEPGOING)
{
Sleep(100);
GetSemaphore(&Semaphore, 2);
if (QCOUNT < 10)
{
if (CLOSING == FALSE)
FindLostBuffers();
CLOSING = TRUE;
}
if (CLOSING)
{
if (RunChat)
{
CloseChat();
RunChat = FALSE;
}
Sleep(10);
if (RunMail)
{
int BPQStream, n;
NOW = time(NULL);
RunMail = FALSE;
for (n = 0; n < NumberofStreams; n++)
{
BPQStream = Connections[n].BPQStream;
if (BPQStream)
{
SetAppl(BPQStream, 0, 0);
Disconnect(BPQStream);
DeallocateStream(BPQStream);
}
}
// SaveUserDatabase();
SaveMessageDatabase();
SaveBIDDatabase();
SaveConfig(ConfigName);
SaveRestartData();
}
KEEPGOING--; // Give time for links to close
setbuf(stdout, NULL);
printf("Closing... %d \r", KEEPGOING);
}
if (RigReconfigFlag)
{
RigReconfigFlag = FALSE;
Rig_Close();
Sleep(2000); // Allow CATPTT threads to close
RigActive = Rig_Init();
Consoleprintf("Rigcontrol Reconfiguration Complete");
}
GetSemaphore(&Semaphore, 2);
if (APRSReconfigFlag)
if (TIMERINTERRUPT()) // Run background code
{
APRSReconfigFlag = FALSE;
APRSClose();
APRSActive = Init_APRS();
// 100mS has elapsed
Consoleprintf("APRS Reconfiguration Complete");
}
if (ReconfigFlag)
{
int i;
BPQVECSTRUC * HOSTVEC;
PEXTPORTDATA PORTVEC=(PEXTPORTDATA)PORTTABLE;
Main100msCode();
Slowtimer++;
FreeSemaphore(&Semaphore);
ReconfigFlag = FALSE;
if (Redirected == 0)
ConTermPoll();
// SetupBPQDirectory();
if (NUMBEROFTNCPORTS)
TNCTimer();
WritetoConsoleLocal("Reconfiguring ...\n\n");
OutputDebugString("BPQ32 Reconfiguring ...\n");
if (AGWActive)
Poll_AGW();
DRATSPoll();
RHPPoll();
for (i=0;i<NUMBEROFPORTS;i++)
if (ReportTimer)
{
if (PORTVEC->PORTCONTROL.PORTTYPE == 0x10) // External
ReportTimer--;
if (ReportTimer == 0)
{
if (PORTVEC->PORT_EXT_ADDR)
{
// SaveWindowPos(PORTVEC->PORTCONTROL.PORTNUMBER);
// SaveAXIPWindowPos(PORTVEC->PORTCONTROL.PORTNUMBER);
// CloseDriverWindow(PORTVEC->PORTCONTROL.PORTNUMBER);
PORTVEC->PORT_EXT_ADDR(5,PORTVEC->PORTCONTROL.PORTNUMBER, NULL); // Close External Ports
}
ReportTimer = REPORTINTERVAL;
SendLocation();
}
PORTVEC->PORTCONTROL.PORTCLOSECODE(&PORTVEC->PORTCONTROL);
PORTVEC=(PEXTPORTDATA)PORTVEC->PORTCONTROL.PORTPOINTER;
}
IPClose();
APRSClose();
Rig_Close();
CloseTNCEmulator();
if (AGWActive)
AGWAPITerminate();
WL2KReports = NULL;
// Sleep(2000);
Consoleprintf("G8BPQ AX25 Packet Switch System Version %s %s", TextVerstring, Datestring);
Consoleprintf(VerCopyright);
Start();
NETROMTCPResolve();
INITIALISEPORTS();
SetApplPorts();
GetUIConfig();
FreeConfig();
HTTPTimer();
for (i=1; i<68; i++) // Include Telnet, APRS, IP Vec
if (RunChat)
{
HOSTVEC=&BPQHOSTVECTOR[i-1];
HOSTVEC->HOSTTRACEQ=0;
ChatPollStreams();
ChatTrytoSend();
if (HOSTVEC->HOSTSESSION !=0)
if (Slowtimer > 100) // 10 secs
{
// Had a connection
HOSTVEC->HOSTSESSION=0;
HOSTVEC->HOSTFLAGS |=3; // Disconnected
// PostMessage(HOSTVEC->HOSTHANDLE, BPQMsg, i, 4);
ChatTimer();
}
}
OpenReportingSockets();
WritetoConsoleLocal("\n\nReconfiguration Complete\n");
if (IPRequired) IPActive = Init_IP();
APRSActive = Init_APRS();
if (ISPort == 0)
IGateEnabled = 0;
RigActive = Rig_Init();
if (NUMBEROFTNCPORTS)
{
FreeSemaphore(&Semaphore);
InitializeTNCEmulator();
GetSemaphore(&Semaphore, 2);
}
FreeSemaphore(&Semaphore);
AGWActive = AGWAPIInit();
GetSemaphore(&Semaphore, 2);
OutputDebugString("BPQ32 Reconfiguration Complete\n");
}
if (IPActive) Poll_IP();
if (RigActive) Rig_Poll();
if (APRSActive) Poll_APRS();
CheckWL2KReportTimer();
TIMERINTERRUPT();
FreeSemaphore(&Semaphore);
if (Redirected == 0)
ConTermPoll();
if (NUMBEROFTNCPORTS)
TNCTimer();
if (AGWActive)
Poll_AGW();
DRATSPoll();
RHPPoll();
HTTPTimer();
if (ReportTimer)
{
ReportTimer--;
if (ReportTimer == 0)
{
ReportTimer = REPORTINTERVAL;
SendLocation();
}
}
Slowtimer++;
if (RunChat)
{
ChatPollStreams();
ChatTrytoSend();
if (Slowtimer > 100) // 10 secs
if (RunMail)
{
ChatTimer();
}
}
PollStreams();
if (RunMail)
{
PollStreams();
if ((Slowtimer % 20) == 0)
FWDTimerProc();
if ((Slowtimer % 20) == 0)
FWDTimerProc();
if (Slowtimer > 100) // 10 secs
{
time_t NOW = time(NULL);
struct tm * tm;
if (Slowtimer > 100) // 10 secs
{
struct tm * tm;
TCPTimer();
BBSSlowTimer();
TCPTimer();
BBSSlowTimer();
if (MaintClock < NOW)
{
while (MaintClock < NOW) // in case large time step
MaintClock += MaintInterval * 3600;
if (MaintClock < NOW)
{
while (MaintClock < NOW) // in case large time step
MaintClock += MaintInterval * 3600;
Debugprintf("|Enter HouseKeeping");
DoHouseKeeping(FALSE);
}
Debugprintf("|Enter HouseKeeping");
DoHouseKeeping(FALSE);
}
if (APIClock < NOW)
{
SendBBSDataToPktMap();
APIClock = NOW + 7200; // Every 2 hours
}
if (APIClock < NOW)
{
SendBBSDataToPktMap();
APIClock = NOW + 7200; // Every 2 hours
}
tm = gmtime(&NOW);
tm = gmtime(&NOW);
if (tm->tm_wday == 0) // Sunday
{
if (GenerateTrafficReport && (LastTrafficTime + 86400) < NOW)
if (tm->tm_wday == 0) // Sunday
{
CreateBBSTrafficReport();
LastTrafficTime = NOW;
if (GenerateTrafficReport && (LastTrafficTime + 86400) < NOW)
{
CreateBBSTrafficReport();
LastTrafficTime = NOW;
}
}
}
TCPFastTimer();
TrytoSend();
}
TCPFastTimer();
TrytoSend();
if (Slowtimer > 100)
Slowtimer = 0;
}
else
FreeSemaphore(&Semaphore);
if (Slowtimer > 100)
Slowtimer = 0;
}
hookNodeClosing("Shutdown");

@ -940,7 +940,7 @@ VOID ConnecttoMPSKThread(void * portptr)
err=WSAGetLastError();
i=sprintf(Msg, "Connect Failed for MPSK socket - error code = %d\n", err);
WritetoConsole(Msg);
MySetWindowText(TNC->xIDC_COMMSSTATE, "Connection to TNC failed");
MySetWindowText(TNC, TNC->xIDC_COMMSSTATE, "Connection to TNC failed");
TNC->Alerted = TRUE;
}
@ -951,7 +951,7 @@ VOID ConnecttoMPSKThread(void * portptr)
TNC->LastFreq = 0; // so V4 display will be updated
MySetWindowText(TNC->xIDC_COMMSSTATE, "Connected to MPSK TNC");
MySetWindowText(TNC, TNC->xIDC_COMMSSTATE, "Connected to MPSK TNC");
return;
@ -1387,7 +1387,7 @@ DataLoop:
STREAM->Connected = TRUE;
STREAM->Connecting = FALSE;
STREAM->ConnectTime = time(NULL);
STREAM->ConnectTime = NOW;
STREAM->bytesRXed = STREAM->bytesTXed = 0;
buffptr = GetBuff();
@ -1402,7 +1402,7 @@ DataLoop:
// Incoming. Look for a free Stream
STREAM->Connected = TRUE;
STREAM->ConnectTime = time(NULL);
STREAM->ConnectTime = NOW;
STREAM->bytesRXed = STREAM->bytesTXed = 0;
UpdateMH(TNC, CallFrom, '+', 'I');

@ -1057,7 +1057,7 @@ void WritePacketLogThread(void * param)
// Open log file and write decoded packets
T = time(NULL);
T = NOW;
tm = gmtime(&T);
if (LogDirectory[0] == 0)

@ -109,7 +109,7 @@ struct ConnectionInfo * AllocateNRTCPRec()
if (sockptr->SocketActive == FALSE)
{
sockptr->SocketActive = TRUE;
sockptr->ConnectTime = sockptr->LastSendTime = time(NULL);
sockptr->ConnectTime = sockptr->LastSendTime = NOW;
Debugprintf("NRTCP Allocated %d", i);
return sockptr;
@ -125,7 +125,7 @@ void checkNRTCPSockets(int portNo)
SOCKET maxsock;
int retval;
int i;
time_t Now = time(NULL);
time_t Now = NOW;
struct timeval timeout;
fd_set readfd, writefd, exceptfd;
@ -345,7 +345,7 @@ int NETROMTCPConnect(struct ROUTE * Route, struct ConnectionInfo * sockptr)
//
sockptr->Connected = TRUE;
sockptr->LastReceiveTime = time(NULL);
sockptr->LastReceiveTime = NOW;
return TRUE;
}
else
@ -397,7 +397,7 @@ void NETROMConnectionAccepted(struct ConnectionInfo * sockptr)
Debugprintf("INP3 Accept() Local port %d", htons(sockptr->sin.sin_port));
sockptr->Connected = TRUE;
sockptr->LastReceiveTime = time(NULL);
sockptr->LastReceiveTime = NOW;
// Debugprintf("NRTCP Connection Accepted");
}
@ -411,7 +411,7 @@ void NETROMConnected(struct ConnectionInfo * sockptr, SOCKET sock, struct NRTCPS
sockptr->Connecting = FALSE;
sockptr->Connected = TRUE;
sockptr->LastReceiveTime = time(NULL);
sockptr->LastReceiveTime = NOW;
Info->LINK->L2STATE = 5;
@ -444,7 +444,7 @@ int DataSocket_ReadNETROM(struct ConnectionInfo * sockptr, SOCKET sock, struct N
return 0;
}
sockptr->LastReceiveTime = time(NULL);
sockptr->LastReceiveTime = NOW;
sockptr->InputLen += len;

@ -1711,9 +1711,11 @@ void GenerateOutputFiles(time_t Now)
// We need unheard nodes in the file for the MH list. Display on main map in blue
if (Age < 3600)
if (Age < 3600 * 6)
Colour = 'G';
else if (Age < 86400)
Colour ='Y';
else if (Age < 2 * 86400)
Colour ='R';
else
{

@ -681,7 +681,7 @@ void RHPPoll()
Buffer[pktlen] = 0;
RHPSession->sockptr->LastSendTime = time(NULL);
RHPSession->sockptr->LastSendTime = NOW;
// Message is JSON so Convert CR to \r, \ to \\ " to \"

@ -222,13 +222,13 @@ struct TimeScan * AllocateTimeRec(struct RIGINFO * RIG)
struct ScanEntry ** CheckTimeBands(struct RIGINFO * RIG)
{
int i = 0;
time_t NOW = time(NULL) % 86400;
time_t Now = NOW % 86400;
// Find TimeBand
while (i < RIG->NumberofBands)
{
if (RIG->TimeBands[i + 1]->Start > NOW)
if (RIG->TimeBands[i + 1]->Start > Now)
{
break;
}
@ -275,7 +275,7 @@ VOID Rig_PTTEx(struct RIGINFO * RIG, BOOL PTTState, struct TNCINFO * TNC)
if (PTTState)
{
MySetWindowText(RIG->hPTT, "T");
MySetWindowText(TNC, RIG->hPTT, "T");
RIG->WEB_PTT = 'T';
RIG->PTTTimer = PTTLimit;
RIG->repeatPTTOFFTimer = 0; // Cancel repeated off command
@ -420,7 +420,7 @@ VOID Rig_PTTEx(struct RIGINFO * RIG, BOOL PTTState, struct TNCINFO * TNC)
{
// Drop PTT
MySetWindowText(RIG->hPTT, " ");
MySetWindowText(TNC, RIG->hPTT, " ");
RIG->WEB_PTT = ' ';
RIG->PTTTimer = 0;
if (PORT->PortType == ICOM)
@ -684,13 +684,13 @@ void saveNewFreq(struct RIGINFO * RIG, double Freq, char * Mode)
{
_gcvt((Freq + RIG->rxOffset) / 1000000.0, 9, RIG->Valchar);
strcpy(RIG->WEB_FREQ, RIG->Valchar);
MySetWindowText(RIG->hFREQ, RIG->WEB_FREQ);
MySetWindowText(0, RIG->hFREQ, RIG->WEB_FREQ);
}
if (Mode[0])
{
strcpy(RIG->ModeString, Mode);
MySetWindowText(RIG->hMODE, Mode);
MySetWindowText(0, RIG->hMODE, Mode);
}
}
@ -905,7 +905,7 @@ int Rig_CommandEx(struct RIGPORTINFO * PORT, struct RIGINFO * RIG, TRANSPORTENTR
PORT->Closed = 1;
RigCloseConnection(PORT);
MySetWindowText(RIG->hSCAN, "C");
MySetWindowText(0, RIG->hSCAN, "C");
RIG->WEB_SCAN = 'C';
sprintf(Command, "Ok\r");
@ -917,7 +917,7 @@ int Rig_CommandEx(struct RIGPORTINFO * PORT, struct RIGINFO * RIG, TRANSPORTENTR
PORT->ReopenDelay = 300;
PORT->Closed = 0;
MySetWindowText(RIG->hSCAN, "");
MySetWindowText(0, RIG->hSCAN, "");
RIG->WEB_SCAN = ' ';
sprintf(Command, "Ok\r");
@ -965,7 +965,7 @@ int Rig_CommandEx(struct RIGPORTINFO * PORT, struct RIGINFO * RIG, TRANSPORTENTR
if (Session != (TRANSPORTENTRY *) -1) // Used for internal Stop/Start
RIG->ScanStopped |= 1; // Set Manual Stopped Bit
MySetWindowText(RIG->hSCAN, "");
MySetWindowText(0, RIG->hSCAN, "");
RIG->WEB_SCAN = ' ';
sprintf(Command, "Ok\r");
@ -3309,7 +3309,7 @@ CheckOtherPorts:
PortRecord->PORT_DLL_NAME, PORT->FreqPtr->Dwell);
RIG->WaitingForPermission = FALSE;
MySetWindowText(RIG->hSCAN, "-");
MySetWindowText(0, RIG->hSCAN, "-");
RIG->WEB_SCAN = '-';
if (PORT->FreqPtr)
@ -3364,7 +3364,7 @@ CheckOtherPorts:
if (RIG->ScanCounter == 0) // ? After manual change
RIG->ScanCounter = 150;
MySetWindowText(RIG->hSCAN, "S");
MySetWindowText(0, RIG->hSCAN, "S");
RIG->WEB_SCAN = 'S';
// Do Bandwidth and antenna switches (if needed)
@ -7992,7 +7992,7 @@ void ProcessFLRIGFrame(struct RIGPORTINFO * PORT)
else
sprintf(RIG->WEB_MODE, "%s/%d", RIG->ModeString, b1);
MySetWindowText(RIG->hMODE, RIG->WEB_MODE);
MySetWindowText(0, RIG->hMODE, RIG->WEB_MODE);
}
}
else
@ -8011,7 +8011,7 @@ void ProcessFLRIGFrame(struct RIGPORTINFO * PORT)
_gcvt(RIG->RigFreq, 9, RIG->Valchar);
sprintf(RIG->WEB_FREQ,"%s", RIG->Valchar);
MySetWindowText(RIG->hFREQ, RIG->WEB_FREQ);
MySetWindowText(0, RIG->hFREQ, RIG->WEB_FREQ);
// Read Mode
@ -8036,7 +8036,7 @@ void ProcessFLRIGFrame(struct RIGPORTINFO * PORT)
else
SetWindowText(RIG->hMODE, RIG->WEB_MODE);
MySetWindowText(RIG->hMODE, RIG->WEB_MODE);
MySetWindowText(0, RIG->hMODE, RIG->WEB_MODE);
Len = sprintf(ReqBuf, Req, "rig.get_bw", "");
Len = sprintf(SendBuff, MsgHddr, Len, ReqBuf);
@ -8106,7 +8106,7 @@ void ProcessFLRIGFrame(struct RIGPORTINFO * PORT)
_gcvt(RIG->RigFreq, 9, RIG->Valchar);
sprintf(RIG->WEB_FREQ,"%s", RIG->Valchar);
MySetWindowText(RIG->hFREQ, RIG->WEB_FREQ);
MySetWindowText(TNC, RIG->hFREQ, RIG->WEB_FREQ);
strcpy(PORT->TXBuffer, "rig.get_mode");
Len = sprintf(ReqBuf, Req, "rig.get_mode", "");
@ -8123,7 +8123,7 @@ void ProcessFLRIGFrame(struct RIGPORTINFO * PORT)
{
strlop(val, '<');
sprintf(RIG->WEB_MODE, "%s", val);
MySetWindowText(RIG->hMODE, RIG->WEB_MODE);
MySetWindowText(TNC, RIG->hMODE, RIG->WEB_MODE);
}
}
@ -8843,7 +8843,7 @@ VOID FLRIGPoll(struct RIGPORTINFO * PORT)
_gcvt(RIG->RigFreq, 9, RIG->Valchar);
sprintf(RIG->WEB_FREQ,"%s", RIG->Valchar);
MySetWindowText(RIG->hFREQ, RIG->WEB_FREQ);
MySetWindowText(0, RIG->hFREQ, RIG->WEB_FREQ);
}

@ -158,7 +158,7 @@ BOOL SCSStopPort(struct PORTCONTROL * PORT)
TNC->HostMode = FALSE;
sprintf(PORT->TNC->WEB_COMMSSTATE, "%s", "Port Stopped");
MySetWindowText(PORT->TNC->xIDC_COMMSSTATE, PORT->TNC->WEB_COMMSSTATE);
MySetWindowText(TNC, PORT->TNC->xIDC_COMMSSTATE, PORT->TNC->WEB_COMMSSTATE);
return TRUE;
}
@ -172,7 +172,7 @@ BOOL SCSStartPort(struct PORTCONTROL * PORT)
TNC->ReopenTimer = 999; // Reopen immediately
sprintf(PORT->TNC->WEB_COMMSSTATE, "%s", "Port Restarted");
MySetWindowText(PORT->TNC->xIDC_COMMSSTATE, PORT->TNC->WEB_COMMSSTATE);
MySetWindowText(TNC, PORT->TNC->xIDC_COMMSSTATE, PORT->TNC->WEB_COMMSSTATE);
return TRUE;
}
@ -197,7 +197,7 @@ static BOOL OpenLogFile(int Flags)
time_t T;
struct tm * tm;
T = time(NULL);
T = NOW;
tm = gmtime(&T);
sprintf(FN,"%s/logs/SCSLog_%02d%02d_%d.txt", LogDirectory, tm->tm_mon + 1, tm->tm_mday, Flags);
@ -327,7 +327,7 @@ ConfigLine:
time_t T;
struct tm * tm;
T = time(NULL);
T = NOW;
tm = gmtime(&T);
sprintf(Cmd,"DATE %02d%02d%02d\r", tm->tm_mday, tm->tm_mon + 1, tm->tm_year - 100);
@ -340,7 +340,7 @@ ConfigLine:
time_t T;
struct tm * tm;
T = time(NULL);
T = NOW;
tm = gmtime(&T);
sprintf(Cmd,"TIME %02d%02d%02d\r", tm->tm_hour, tm->tm_min, tm->tm_sec);
@ -487,7 +487,7 @@ ok:
if ((STREAM->Connecting || STREAM->Connected) && !STREAM->Disconnecting)
{
if (TNC->SessionTimeLimit && STREAM->ConnectTime && time(NULL) > (TNC->SessionTimeLimit + STREAM->ConnectTime))
if (TNC->SessionTimeLimit && STREAM->ConnectTime && NOW > (TNC->SessionTimeLimit + STREAM->ConnectTime))
{
STREAM->CmdSet = STREAM->CmdSave = malloc(100);
sprintf(STREAM->CmdSet, "D\r");
@ -658,7 +658,7 @@ ok:
{
if (TNC->PTCStatus == 6) // Sync
{
int insync = (int)(time(NULL) - TNC->TimeEnteredSYNCMode);
int insync = (int)(NOW - TNC->TimeEnteredSYNCMode);
if (insync > 4)
{
Debugprintf("SCS Scan - in SYNC for %d Secs - allow change regardless", insync);
@ -667,7 +667,7 @@ ok:
}
else if (TNC->TimeScanLocked)
{
time_t timeLocked = time(NULL) - TNC->TimeScanLocked;
time_t timeLocked = NOW - TNC->TimeScanLocked;
if (timeLocked > 4)
{
Debugprintf("SCS Scan - Scan Locked for %d Secs - allow change regardless", timeLocked);
@ -695,7 +695,7 @@ ok:
{
TNC->DontReleasePermission = FALSE;
if (TNC->SyncSupported == FALSE)
TNC->TimeScanLocked = time(NULL) + 100; // Make sure doesnt time out
TNC->TimeScanLocked = NOW + 100; // Make sure doesnt time out
return 0;
}
@ -797,8 +797,7 @@ int DoScanLine(struct TNCINFO * TNC, char * Buff, int Len)
static int WebProc(struct TNCINFO * TNC, char * Buff, BOOL LOCAL)
{
int Len = sprintf(Buff, "<html><meta http-equiv=expires content=0><meta http-equiv=refresh content=15>"
"<head><title>SCS Pactor Status</title></head><body><h3>SCS Pactor Status</h3>");
int Len = sprintf(Buff, "<h3>SCS Pactor Status</h3>");
Len += sprintf(&Buff[Len], "<table style=\"text-align: left; width: 480px; font-family: monospace; align=center \" border=1 cellpadding=2 cellspacing=2>");
@ -1523,7 +1522,7 @@ VOID SCSPoll(int Port)
TNC->Streams[0].CmdSet = TNC->ConnectCmd;
TNC->Streams[0].Connecting = TRUE;
TNC->Streams[0].ConnectTime = time(NULL);
TNC->Streams[0].ConnectTime = NOW;
sprintf(TNC->WEB_TNCSTATE, "%s Connecting to %s", TNC->Streams[0].MyCall, TNC->Streams[0].RemoteCall);
SetWindowText(TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
@ -3419,7 +3418,7 @@ VOID ProcessDEDFrame(struct TNCINFO * TNC, UCHAR * Msg, int framelen)
{
TNC->OKToChangeFreq = -1;
if (TNC->SyncSupported == FALSE && TNC->UseAPPLCallsforPactor && TNC->TimeScanLocked == 0)
TNC->TimeScanLocked = time(NULL);
TNC->TimeScanLocked = NOW;
if (TNC->RIG->RIG_DEBUG)
Debugprintf("Scan Debug SCS Pactor TNC refused permission");
@ -3499,7 +3498,7 @@ VOID ProcessDEDFrame(struct TNCINFO * TNC, UCHAR * Msg, int framelen)
STREAM->Connected = TRUE; // Subsequent data to data channel
STREAM->Connecting = FALSE;
STREAM->ConnectTime = time(NULL);
STREAM->ConnectTime = NOW;
STREAM->bytesRXed = STREAM->bytesTXed = 0;
// Stop Scanner
@ -3790,7 +3789,7 @@ VOID ProcessDEDFrame(struct TNCINFO * TNC, UCHAR * Msg, int framelen)
if (TNC->RIG->RIG_DEBUG)
Debugprintf("SCS New SYNC Detected");
TNC->TimeEnteredSYNCMode = time(NULL);
TNC->TimeEnteredSYNCMode = NOW;
TNC->SyncSupported = TRUE;
}
else
@ -4297,7 +4296,7 @@ VOID PTCSuspendPort(struct TNCINFO * TNC, struct TNCINFO * ThisTNC)
struct STREAMINFO * STREAM = &TNC->Streams[0];
strcpy(TNC->WEB_TNCSTATE, "Interlocked");
MySetWindowText(TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
MySetWindowText(TNC, TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
STREAM->CmdSet = STREAM->CmdSave = zalloc(100);
sprintf(STREAM->CmdSet, "I%s\r", "SCSPTC"); // Should prevent connects
@ -4310,7 +4309,7 @@ VOID PTCReleasePort(struct TNCINFO * TNC)
struct STREAMINFO * STREAM = &TNC->Streams[0];
strcpy(TNC->WEB_TNCSTATE, "Free");
MySetWindowText(TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
MySetWindowText(TNC, TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
STREAM->CmdSet = STREAM->CmdSave = zalloc(100);

@ -109,7 +109,7 @@ VOID TRKSuspendPort(struct TNCINFO * TNC, struct TNCINFO * ThisTNC)
struct STREAMINFO * STREAM = &TNC->Streams[0];
strcpy(TNC->WEB_TNCSTATE, "Interlocked");
MySetWindowText(TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
MySetWindowText(TNC, TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
STREAM->CmdSet = STREAM->CmdSave = zalloc(100);
sprintf(STREAM->CmdSet, "\1\1\1IDSPTNC");
@ -120,7 +120,7 @@ VOID TRKReleasePort(struct TNCINFO * TNC)
struct STREAMINFO * STREAM = &TNC->Streams[0];
strcpy(TNC->WEB_TNCSTATE, "Free");
MySetWindowText(TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
MySetWindowText(TNC, TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
STREAM->CmdSet = STREAM->CmdSave = zalloc(100);
sprintf(STREAM->CmdSet, "\1\1\1I%s", TNC->NodeCall);
@ -147,7 +147,7 @@ BOOL OpenDebugLogFile(int Port)
if (LogHandle[Port])
return TRUE; // already open
T = LogTime[Port] = time(NULL);
T = LogTime[Port] = NOW;
tm = gmtime(&T);
sprintf(FN,"%s/logs/Port%02dDebugLog_%02d%02d.txt", LogDirectory, Port, tm->tm_mon + 1, tm->tm_mday);
@ -172,7 +172,7 @@ void WriteDebugLogLine(int Port, char Dirn, char * Msg, int MsgLen)
UCHAR c;
char textbit[33] = " ";
int i;
T = time(NULL);
T = NOW;
tm = gmtime(&T);
len = sprintf(hddr,"%02d:%02d:%02d %c Len %3d ", tm->tm_hour, tm->tm_min, tm->tm_sec, Dirn, MsgLen);
@ -590,30 +590,7 @@ int TrkWebProc(struct TNCINFO * TNC, char * Buff, BOOL LOCAL)
int Interval = 15;
int Len;
if (LOCAL)
{
if (TNC->WEB_CHANGED)
Interval = 1;
else
Interval = 4;
}
else
{
if (TNC->WEB_CHANGED)
Interval = 4;
else
Interval = 15;
}
if (TNC->WEB_CHANGED)
{
TNC->WEB_CHANGED -= Interval;
if (TNC->WEB_CHANGED < 0)
TNC->WEB_CHANGED = 0;
}
Len = sprintf(Buff, "<html><meta http-equiv=expires content=0><meta http-equiv=refresh content=%d>"
"<head><title>SCSTracker Status</title></head><body><h2>SCSTracker Status</h2>", Interval);
Len = sprintf(Buff, "<h2>SCSTracker Status</h2>");
Len += sprintf(&Buff[Len], "<table style=\"text-align: left; width: 480px; font-family: monospace; align=center \" border=1 cellpadding=2 cellspacing=2>");
@ -2024,7 +2001,7 @@ VOID TrkProcessDEDFrame(struct TNCINFO * TNC)
STREAM->Connected = TRUE; // Subsequent data to data channel
STREAM->Connecting = FALSE;
STREAM->ConnectTime = time(NULL);
STREAM->ConnectTime = NOW;
STREAM->bytesRXed = STREAM->bytesTXed = 0;
if (TNC->SlowTimer)

@ -376,7 +376,7 @@ ok:
SuspendOtherPorts(TNC);
//sprintf(TNC->WEB_TNCSTATE, "In Use by %s", TNC->Streams[0].MyCall);
//MySetWindowText(TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
//MySetWindowText(TNC, TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
// Stop Scanning
@ -574,7 +574,7 @@ ok:
// Save Command, and wait up to 10 secs
sprintf(TNC->WEB_TNCSTATE, "Waiting for clear channel");
MySetWindowText(TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
MySetWindowText(TNC, TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
TNC->ConnectCmd = _strdup(Connect);
TNC->BusyDelay = TNC->BusyWait * 10; // BusyWait secs
@ -589,7 +589,7 @@ ok:
sprintf(TNC->WEB_TNCSTATE, "%s Connecting to %s", STREAM->MyCall, STREAM->RemoteCall);
SerialSendCommand(TNC, Connect);
MySetWindowText(TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
MySetWindowText(TNC, TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
STREAM->Connecting = TRUE;
return 0;

@ -1776,7 +1776,7 @@ VOID TNCTimer()
while (TNC)
{
if (TNC->LastDEDPollTime && (time(NULL) > TNC->LastDEDPollTime + 30)) // No polls for 30 secs
if (TNC->LastDEDPollTime && (NOW > TNC->LastDEDPollTime + 30)) // No polls for 30 secs
{
int Len = 0;
int Count;
@ -3529,7 +3529,7 @@ NOTDATA:
{
//SEE IF MONITORED FRAMES AVAILABLE
TNC->LastDEDPollTime = time(NULL);
TNC->LastDEDPollTime = NOW;
if (MONCount(TNC->Channels[0]->BPQStream))
Work = 0x31;

@ -201,7 +201,7 @@ int DeleteLogFile(char * Log, int KeepDays)
HANDLE hFind = INVALID_HANDLE_VALUE;
DWORD dwError=0;
LARGE_INTEGER ft;
time_t now = time(NULL);
time_t now = NOW;
int Age;
@ -261,7 +261,7 @@ int DeleteLogFile(char * Log, int KeepDays)
struct dirent **namelist;
int n;
struct stat STAT;
time_t now = time(NULL);
time_t now = NOW;
int Age = 0, res;
char FN[256];
@ -957,7 +957,7 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff)
{
if (sockptr->WebSocks == 0)
{
if (sockptr->LastSendTime && (time(NULL) - sockptr->LastSendTime) > 150) // ~ 2.5 mins
if (sockptr->LastSendTime && (NOW - sockptr->LastSendTime) > 150) // ~ 2.5 mins
{
closesocket(sockptr->socket);
sockptr->SocketActive = FALSE;
@ -970,7 +970,7 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff)
// Normally keepalives are sent each way around every 9 mins
// Keepalives aren't sent when connecting so may need a bit longer
if (sockptr->LastSendTime && (time(NULL) - sockptr->LastSendTime) > 20 * 60) // 20mins
if (sockptr->LastSendTime && (NOW - sockptr->LastSendTime) > 20 * 60) // 20mins
{
ProcessRHPWebSockClosed(sockptr->socket);
closesocket(sockptr->socket);
@ -983,7 +983,7 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff)
{
// Time out Login
if (sockptr->LoginState < 2 && (time(NULL) - sockptr->ConnectTime) > 30)
if (sockptr->LoginState < 2 && (NOW - sockptr->ConnectTime) > 30)
{
closesocket(sockptr->socket);
sockptr->SocketActive = FALSE;
@ -992,8 +992,11 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff)
}
}
}
if (TNC->PageChanged)
{
BuildDevicePage(TNC);
TNC->PageChanged = FALSE;
}
return 0;
@ -1312,8 +1315,7 @@ static int WebProc(struct TNCINFO * TNC, char * Buff, BOOL LOCAL)
strcpy(CMSStatus, "No CMS");
}
Len = sprintf(Buff, "<html><meta http-equiv=expires content=0><meta http-equiv=refresh content=15>"
"<head><title>Telnet Status</title></head><body><b>Telnet Status &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;%s</b>", CMSStatus);
Len = sprintf(Buff, "<b>Telnet Status &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;%s</b>", CMSStatus);
Len += sprintf(&Buff[Len], "<table style=\"text-align: left; width: 250px; font-family: monospace; align=center \" border=1 cellpadding=2 cellspacing=2>");
@ -1337,9 +1339,9 @@ static int WebProc(struct TNCINFO * TNC, char * Buff, BOOL LOCAL)
char Addr[100];
Tel_Format_Addr(sockptr, Addr);
if (sockptr->WebSocks)
sprintf(msg,"<tr><td>Websock<%s</td><td>&nbsp;</td><td>&nbsp;</td></tr>", Addr);
sprintf(msg,"<tr><td>Websock&lt;%s</td><td>&nbsp;</td><td>&nbsp;</td></tr>", Addr);
else
sprintf(msg,"<tr><td>HTTP<%s</td><td>&nbsp;</td><td>&nbsp;</td></tr>", Addr);
sprintf(msg,"<tr><td>HTTP&lt;%s</td><td>&nbsp;</td><td>&nbsp;</td></tr>", Addr);
}
else if (sockptr->DRATSMode)
{
@ -2470,7 +2472,7 @@ nosocks:
{
char logmsg[120];
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)(NOW - sockptr->ConnectTime));
WriteCMSLog (logmsg);
}
@ -2531,11 +2533,11 @@ nosocks:
if (sockptr->SocketActive && sockptr->Keepalive && L4LIMIT)
{
if ((time(NULL) - sockptr->LastSendTime) > (L4LIMIT - 60)) // PC Ticks are about 10% slow
if ((NOW - sockptr->LastSendTime) > (L4LIMIT - 60)) // PC Ticks are about 10% slow
{
// Send Keepalive
sockptr->LastSendTime = time(NULL);
sockptr->LastSendTime = NOW;
BuffertoNode(sockptr, "Keepalive\r", 10);
}
}
@ -2665,7 +2667,7 @@ nosocks:
if (P3[0] == 'K' || P4[0] == 'K' || P5[0] == 'K' || P6[0] == 'K')
{
sockptr->Keepalive = TRUE;
sockptr->LastSendTime = time(NULL);
sockptr->LastSendTime = NOW;
}
if (P3[0] == 'S' || P4[0] == 'S' || P5[0] == 'S' || P6[0] == 'S')
@ -2857,7 +2859,7 @@ nosocks:
Msglen = sockptr->FromHostBuffPutptr - sockptr->FromHostBuffGetptr;
if (Msglen)
if (Msglen > 0)
{
int Paclen = 0;
int Queued = 0;
@ -2887,7 +2889,7 @@ nosocks:
if (Paclen == 0)
Paclen = 256;
ShowConnections(TNC);
// ShowConnections(TNC);
if (Msglen > Paclen)
Msglen = Paclen;
@ -2897,7 +2899,7 @@ nosocks:
SendtoNode(TNC, Stream, &sockptr->FromHostBuffer[sockptr->FromHostBuffGetptr], Msglen);
sockptr->FromHostBuffGetptr += Msglen;
sockptr->LastSendTime = time(NULL);
sockptr->LastSendTime = NOW;
}
}
}
@ -3396,7 +3398,7 @@ int Socket_Accept(struct TNCINFO * TNC, SOCKET SocketId, int Port)
sockptr->UserPointer = 0;
sockptr->DoEcho = FALSE;
sockptr->BPQTermMode = FALSE;
sockptr->ConnectTime = time(NULL);
sockptr->ConnectTime = NOW;
sockptr->Keepalive = FALSE;
sockptr->UTF8 = 0;
@ -5090,6 +5092,8 @@ MsgLoop:
extern char * RigWebPage;
struct RHPParamBlock
{
unsigned char * Msg;
@ -5237,7 +5241,7 @@ int DataSocket_ReadHTTP(struct TNCINFO * TNC, struct ConnectionInfo * sockptr, S
{
sockcopy = malloc(sizeof(struct ConnectionInfo));
sockptr->TNC = TNC;
sockptr->LastSendTime = time(NULL);
sockptr->LastSendTime = NOW;
memcpy(sockcopy, sockptr, sizeof(struct ConnectionInfo));
@ -5255,7 +5259,7 @@ int DataSocket_ReadHTTP(struct TNCINFO * TNC, struct ConnectionInfo * sockptr, S
ParamBlock->Len = Len;
ParamBlock->Msg = malloc(Len + 10);
memcpy(ParamBlock->Msg, Payload, Len);
sockptr->LastSendTime = time(NULL);
sockptr->LastSendTime = NOW;
_beginthread(RHPThread, 0, (VOID *)ParamBlock);
@ -5297,7 +5301,7 @@ int DataSocket_ReadHTTP(struct TNCINFO * TNC, struct ConnectionInfo * sockptr, S
sockcopy = malloc(sizeof(struct ConnectionInfo));
sockptr->TNC = TNC;
sockptr->LastSendTime = time(NULL);
sockptr->LastSendTime = NOW;
memcpy(sockcopy, sockptr, sizeof(struct ConnectionInfo));
@ -5311,8 +5315,30 @@ int DataSocket_ReadHTTP(struct TNCINFO * TNC, struct ConnectionInfo * sockptr, S
memcpy(sockptr->WebURL, &MsgPtr[5], 31);
strlop(sockptr->WebURL, ' ');
if (RigWebPage)
RigWebPage[0] = 0;
if (strcmp(sockptr->WebURL, "RIGCTL") == 0)
{
if (RigWebPage)
RigWebPage[0] = 0;
}
else if (memcmp(sockptr->WebURL, "DEVICE", 6) == 0)
{
int Port = atoi(&sockptr->WebURL[6]);
if (Port > 0 && Port <= MaxBPQPortNo)
{
struct TNCINFO * PTNC = TNCInfo[Port];
if (PTNC)
{
if (PTNC->WebPage)
PTNC->WebPage[0] = 0;
PTNC->WebSockUsed = 1;
PTNC->PageChanged = 1;
}
}
}
ptr = strstr(MsgPtr, "BPQSessionCookie=N");
@ -5426,6 +5452,8 @@ int ShowConnections(struct TNCINFO * TNC)
SendMessage(TNC->hMonitor, LB_ADDSTRING ,0, (LPARAM)msg);
}
#endif
TNC->PageChanged = TNC->WebSockUsed;
return 0;
}
byte * EncodeCall(byte * Call)
@ -5545,7 +5573,7 @@ int WriteLog(char * msg)
time_t T;
struct tm * tm;
T = time(NULL);
T = NOW;
tm = gmtime(&T);
if (LogDirectory[0] == 0)
@ -5600,7 +5628,7 @@ VOID WriteCMSLog(char * msg)
if (CMSLogEnabled == FALSE)
return;
T = time(NULL);
T = NOW;
tm = gmtime(&T);
if (LogDirectory[0] == 0)
@ -5791,7 +5819,7 @@ int Telnet_Connected(struct TNCINFO * TNC, struct ConnectionInfo * sockptr, SOCK
sockptr->InputLen = 0;
// sockptr->Number = Stream;
sockptr->RelayMode = FALSE;
sockptr->ConnectTime = time(NULL);
sockptr->ConnectTime = NOW;
TNC->Streams[Stream].Connecting = FALSE;
TNC->Streams[Stream].Connected = TRUE;
@ -6031,9 +6059,9 @@ CheckServers:
#ifndef LINBPQ
if (TCP->CMSOK)
MySetWindowText(TCP->hCMSWnd, "CMS OK");
MySetWindowText(TNC, TCP->hCMSWnd, "CMS OK");
else
MySetWindowText(TCP->hCMSWnd, "NO CMS");
MySetWindowText(TNC, TCP->hCMSWnd, "NO CMS");
#endif
return;
}
@ -6360,7 +6388,7 @@ VOID SaveCMSHostInfo(int port, struct TCPINFO * TCP, int CMSNo)
memcpy(work, &TCP->CMSAddr[CMSNo].s_addr, 4);
sprintf(Info,"%s %d %d.%d.%d.%d\n", TCP->CMSName[CMSNo], (int)time(NULL),
sprintf(Info,"%s %d %d.%d.%d.%d\n", TCP->CMSName[CMSNo], (int)NOW,
work[0], work[1], work[2], work[3]);
@ -6400,7 +6428,7 @@ VOID SaveCMSHostInfo(int port, struct TCPINFO * TCP, int CMSNo)
if (n == 3)
{
time_t age = time(NULL) - t;
time_t age = NOW - t;
// if not current server and not too old, copy across
@ -7283,7 +7311,7 @@ int DoRefreshWebMailIndex()
{
sockcopy = malloc(sizeof(struct ConnectionInfo));
sockptr->TNC = TNC;
sockptr->LastSendTime = time(NULL);
sockptr->LastSendTime = NOW;
memcpy(sockcopy, sockptr, sizeof(struct ConnectionInfo));

@ -387,7 +387,7 @@ static VOID UpdateStatsLine(struct TNCINFO * TNC, struct STREAMINFO * STREAM)
static int WebProc(struct TNCINFO * TNC, char * Buff, BOOL LOCAL)
{
int Len = sprintf(Buff, "<html><meta http-equiv=expires content=0><meta http-equiv=refresh content=15>"
int Len = sprintf(Buff, "<html><meta http-equiv=expires content=0>"
"<script type=\"text/javascript\">\r\n"
"function ScrollOutput()\r\n"
"{var textarea = document.getElementById('textarea');"
@ -421,7 +421,7 @@ UINT UIARQExtInit(EXTPORTDATA * PortEntry)
struct PORTCONTROL * PORT;
struct STREAMINFO * STREAM;
srand((unsigned int)time(NULL));
srand((unsigned int)NOW);
port = PortEntry->PORTCONTROL.PORTNUMBER;
@ -853,7 +853,7 @@ static VOID ProcessFLDigiData(struct TNCINFO * TNC, UCHAR * Input, int Len, int
SESS = TNC->PortRecord->ATTACHEDSESSIONS[Stream];
strcpy(STREAM->MyCall, call2);
STREAM->ConnectTime = time(NULL);
STREAM->ConnectTime = NOW;
STREAM->bytesRXed = STREAM->bytesTXed = STREAM->BytesAcked = STREAM->BytesResent = 0;
if (WL2K)
@ -1005,7 +1005,7 @@ AckConnectRequest:
if (STREAM->Connected)
goto SendKReply; // Repeated ACK
STREAM->ConnectTime = time(NULL);
STREAM->ConnectTime = NOW;
STREAM->bytesRXed = STREAM->bytesTXed = STREAM->BytesAcked = STREAM->BytesResent = 0;
STREAM->Connected = TRUE;

@ -321,7 +321,7 @@ BOOL UZ7HOStopPort(struct PORTCONTROL * PORT)
KillTNC(TNC);
sprintf(PORT->TNC->WEB_COMMSSTATE, "%s", "Port Stopped");
MySetWindowText(PORT->TNC->xIDC_COMMSSTATE, PORT->TNC->WEB_COMMSSTATE);
MySetWindowText(TNC, PORT->TNC->xIDC_COMMSSTATE, PORT->TNC->WEB_COMMSSTATE);
return TRUE;
}
@ -335,10 +335,10 @@ BOOL UZ7HOStartPort(struct PORTCONTROL * PORT)
struct TNCINFO * TNC = PORT->TNC;
ConnecttoUZ7HO(TNC->Port);
TNC->lasttime = time(NULL);;
TNC->lasttime = NOW;;
sprintf(PORT->TNC->WEB_COMMSSTATE, "%s", "Port Restarted");
MySetWindowText(PORT->TNC->xIDC_COMMSSTATE, PORT->TNC->WEB_COMMSSTATE);
MySetWindowText(TNC, PORT->TNC->xIDC_COMMSSTATE, PORT->TNC->WEB_COMMSSTATE);
return TRUE;
}
@ -356,7 +356,7 @@ VOID UZ7HOSuspendPort(struct TNCINFO * TNC, struct TNCINFO * ThisTNC)
TNC->PortRecord->PORTCONTROL.PortSuspended = TRUE;
strcpy(TNC->WEB_TNCSTATE, "Interlocked");
MySetWindowText(TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
MySetWindowText(TNC, TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
RegisterAPPLCalls(TNC, TRUE);
}
@ -364,7 +364,7 @@ VOID UZ7HOReleasePort(struct TNCINFO * TNC)
{
TNC->PortRecord->PORTCONTROL.PortSuspended = FALSE;
strcpy(TNC->WEB_TNCSTATE, "Free");
MySetWindowText(TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
MySetWindowText(TNC, TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
RegisterAPPLCalls(TNC, FALSE);
}
@ -763,7 +763,7 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff)
TNC->CONNECTING = FALSE;
sprintf(TNC->WEB_COMMSSTATE, "Connected to TNC");
MySetWindowText(TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE);
MySetWindowText(TNC, TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE);
// If required, send signon
@ -1284,7 +1284,7 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff)
TNC->Alerted = FALSE;
sprintf(TNC->WEB_COMMSSTATE, "Disconnected from TNC");
MySetWindowText(TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE);
MySetWindowText(TNC, TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE);
if (TNC->WeStartedTNC)
{
@ -1317,24 +1317,7 @@ extern char WebProcTemplate[];
static int WebProc(struct TNCINFO * TNC, char * Buff, BOOL LOCAL)
{
/*
int Len = sprintf(Buff, "<html><meta http-equiv=expires content=0><meta http-equiv=refresh content=15>"
"<script type=\"text/javascript\">\r\n"
"function ScrollOutput()\r\n"
"{var textarea = document.getElementById('textarea');"
"textarea.scrollTop = textarea.scrollHeight;}"
"myInt = setInterval('Refresh()', 15000 );\n"
"function Refresh( )\n"
"{location.reload()}\n"
"</script>"
"</head><title>UZ7HO Status</title></head><body id=Text onload=\"ScrollOutput()\">"
"<h2><form method=post target=\"POPUPW\" onsubmit=\"POPUPW = window.open('about:blank','POPUPW',"
"'width=440,height=150');\" action=ARDOPAbort?%d>UZ7HO Status"
"<input name=Save value=\"Abort Session\" type=submit style=\"position: absolute; right: 10;top:10;\"></form></h2>",
TNC->Port);
*/
int Len = sprintf(Buff, WebProcTemplate, TNC->Port, TNC->Port, "UZ7HO Status", "UZ7HO Status");
int Len = sprintf(Buff, WebProcTemplate, "UZ7HO Status");
if (TNC->TXFreq)
Len += sprintf(&Buff[Len], sliderBit, TNC->TXOffset, TNC->TXOffset);
@ -1507,7 +1490,7 @@ void * UZ7HOExtInit(EXTPORTDATA * PortEntry)
// Slave Port
sprintf(TNC->WEB_COMMSSTATE, "Slave to Port %d", MasterPort[port] );
MySetWindowText(TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE);
MySetWindowText(TNC, TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE);
}
time(&lasttime[port]); // Get initial time value
@ -1933,7 +1916,7 @@ VOID ConnecttoUZ7HOThread(void * portptr)
TNC->CONNECTED = TRUE;
sprintf(TNC->WEB_COMMSSTATE, "Connected to TNC");
MySetWindowText(TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE);
MySetWindowText(TNC, TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE);
ioctl(TNC->TCPSock, FIONBIO, &param);
}
@ -1948,7 +1931,7 @@ VOID ConnecttoUZ7HOThread(void * portptr)
WritetoConsole(Msg);
sprintf(TNC->WEB_COMMSSTATE, "Connection to TNC failed");
MySetWindowText(TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE);
MySetWindowText(TNC, TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE);
TNC->Alerted = TRUE;
}
@ -1994,7 +1977,7 @@ static int ProcessReceivedData(int port)
TNC->Alerted = FALSE;
sprintf(TNC->WEB_COMMSSTATE, "Disconnected from TNC");
MySetWindowText(TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE);
MySetWindowText(TNC, TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE);
return (0);
@ -2011,7 +1994,7 @@ static int ProcessReceivedData(int port)
TNC->Alerted = FALSE;
sprintf(TNC->WEB_COMMSSTATE, "Disconnected from TNC");
MySetWindowText(TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE);
MySetWindowText(TNC, TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE);
closesocket(TNC->TCPSock);
@ -2042,7 +2025,7 @@ static int ProcessReceivedData(int port)
TNC->Alerted = FALSE;
sprintf(TNC->WEB_COMMSSTATE, "Disconnected from TNC");
MySetWindowText(TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE);
MySetWindowText(TNC, TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE);
return 0;
}
@ -2389,7 +2372,7 @@ GotStream:
STREAM = &TNC->Streams[Stream];
memcpy(STREAM->AGWKey, Key, 21);
STREAM->Connected = TRUE;
STREAM->ConnectTime = time(NULL);
STREAM->ConnectTime = NOW;
STREAM->bytesRXed = STREAM->bytesTXed = 0;
SuspendOtherPorts(TNC);
@ -2550,7 +2533,7 @@ GotStream:
STREAM->Connected = TRUE;
STREAM->Connecting = FALSE;
STREAM->ConnectTime = time(NULL);
STREAM->ConnectTime = NOW;
STREAM->bytesRXed = STREAM->bytesTXed = 0;
buffptr = GetBuff();

40
V4.c

@ -281,7 +281,7 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff)
memcpy(TNC->Streams[0].RemoteCall, &TNC->ConnectCmd[11], strlen(TNC->ConnectCmd)-13);
sprintf(Status, "%s Connecting to %s", TNC->Streams[0].MyCall, TNC->Streams[0].RemoteCall);
MySetWindowText(TNC->xIDC_TNCSTATE, Status);
MySetWindowText(TNC, TNC->xIDC_TNCSTATE, Status);
strcpy(TNC->WEB_TNCSTATE, Status);
free(TNC->ConnectCmd);
@ -411,18 +411,18 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff)
char Time[80];
TNC->Restarts++;
TNC->LastRestart = time(NULL);
TNC->LastRestart = NOW;
tm = gmtime(&TNC->LastRestart);
sprintf_s(Time, sizeof(Time),"%04d/%02d/%02d %02d:%02dZ",
tm->tm_year +1900, tm->tm_mon+1, tm->tm_mday, tm->tm_hour, tm->tm_min);
MySetWindowText(TNC->xIDC_RESTARTTIME, Time);
MySetWindowText(TNC, TNC->xIDC_RESTARTTIME, Time);
strcpy(TNC->WEB_RESTARTTIME, Time);
sprintf_s(Time, sizeof(Time),"%d", TNC->Restarts);
MySetWindowText(TNC->xIDC_RESTARTS, Time);
MySetWindowText(TNC, TNC->xIDC_RESTARTS, Time);
strcpy(TNC->WEB_RESTARTS, Time);
KillTNC(TNC);
@ -456,7 +456,7 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff)
SuspendOtherPorts(TNC);
sprintf(Status, "In Use by %s", TNC->Streams[0].MyCall);
MySetWindowText(TNC->xIDC_TNCSTATE, Status);
MySetWindowText(TNC, TNC->xIDC_TNCSTATE, Status);
strcpy(TNC->WEB_TNCSTATE, Status);
// Stop Scanning
@ -657,7 +657,7 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff)
TNC->FECIDTimer = 0;
send(TNC->TCPSock,"MODE FEC\r\n", 10, 0);
strcpy(TNC->WEB_MODE, "FEC");
MySetWindowText(TNC->xIDC_MODE, TNC->WEB_MODE);
MySetWindowText(TNC, TNC->xIDC_MODE, TNC->WEB_MODE);
return 0;
}
@ -700,7 +700,7 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff)
memcpy(TNC->Streams[0].RemoteCall, &Connect[11], txlen-13);
sprintf(Status, "%s Connecting to %s", TNC->Streams[0].MyCall, TNC->Streams[0].RemoteCall);
MySetWindowText(TNC->xIDC_TNCSTATE, Status);
MySetWindowText(TNC, TNC->xIDC_TNCSTATE, Status);
strcpy(TNC->WEB_TNCSTATE, Status);
}
@ -836,7 +836,7 @@ loop:
// Does this mean closed?
strcpy(TNC->WEB_COMMSSTATE, "Connection to TNC lost");
MySetWindowText(TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE);
MySetWindowText(TNC, TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE);
TNC->CONNECTING = FALSE;
@ -910,7 +910,7 @@ static VOID ReleaseTNC(struct TNCINFO * TNC)
// send(TNC->TCPSock, "LISTEN TRUE\r\nMAXCONREQ 4\r\n", 26, 0);
MySetWindowText(TNC->xIDC_TNCSTATE, "Free");
MySetWindowText(TNC, TNC->xIDC_TNCSTATE, "Free");
strcpy(TNC->WEB_TNCSTATE, "Free");
// Start Scanner
@ -921,7 +921,7 @@ static VOID ReleaseTNC(struct TNCINFO * TNC)
static int WebProc(struct TNCINFO * TNC, char * Buff, BOOL LOCAL)
{
int Len = sprintf(Buff, "<html><meta http-equiv=expires content=0><meta http-equiv=refresh content=15>"
int Len = sprintf(Buff, "<html>"
"<script type=\"text/javascript\">\r\n"
"function ScrollOutput()\r\n"
"{var textarea = document.getElementById('textarea');"
@ -1115,7 +1115,7 @@ void * V4ExtInit(EXTPORTDATA * PortEntry)
WritetoConsole(Msg);
strcpy(TNC->WEB_MODE, "ARQ");
MySetWindowText(TNC->xIDC_MODE, TNC->WEB_MODE);
MySetWindowText(TNC, TNC->xIDC_MODE, TNC->WEB_MODE);
ConnecttoWINMOR(port);
time(&TNC->lasttime); // Get initial time value
@ -1147,7 +1147,7 @@ static BOOL CALLBACK EnumTNCWindowsProc(HWND hwnd, LPARAM lParam)
// Our Process
sprintf (wtext, "V4 Sound Card TNC - BPQ %s", TNC->PortRecord->PORTCONTROL.PORTDESCRIPTION);
MySetWindowText(hwnd, wtext);
MySetWindowText(TNC, hwnd, wtext);
// return FALSE;
}
}
@ -1197,7 +1197,7 @@ static VOID ProcessResponse(struct TNCINFO * TNC, UCHAR * Buffer, int MsgLen)
if (_memicmp(Buffer, "BUSY TRUE", 9) == 0)
{
TNC->Busy |= CDBusy;
MySetWindowText(TNC->xIDC_CHANSTATE, "Busy");
MySetWindowText(TNC, TNC->xIDC_CHANSTATE, "Busy");
strcpy(TNC->WEB_CHANSTATE, "Busy");
return;
@ -1206,7 +1206,7 @@ static VOID ProcessResponse(struct TNCINFO * TNC, UCHAR * Buffer, int MsgLen)
if (_memicmp(Buffer, "BUSY FALSE", 10) == 0)
{
TNC->Busy &= ~CDBusy;
MySetWindowText(TNC->xIDC_CHANSTATE, "Clear");
MySetWindowText(TNC, TNC->xIDC_CHANSTATE, "Clear");
strcpy(TNC->WEB_CHANSTATE, "Clear");
return;
}
@ -1229,7 +1229,7 @@ static VOID ProcessResponse(struct TNCINFO * TNC, UCHAR * Buffer, int MsgLen)
WritetoTrace(TNC, Buffer, MsgLen - 2);
STREAM->ConnectTime = time(NULL);
STREAM->ConnectTime = NOW;
memcpy(Call, &Buffer[10], 10);
@ -1254,7 +1254,7 @@ static VOID ProcessResponse(struct TNCINFO * TNC, UCHAR * Buffer, int MsgLen)
else
sprintf(Status, "%s Connected to %s Inbound", TNC->Streams[0].RemoteCall, TNC->TargetCall);
MySetWindowText(TNC->xIDC_TNCSTATE, Status);
MySetWindowText(TNC, TNC->xIDC_TNCSTATE, Status);
strcpy(TNC->WEB_TNCSTATE, Status);
// See which application the connect is for
@ -1343,7 +1343,7 @@ static VOID ProcessResponse(struct TNCINFO * TNC, UCHAR * Buffer, int MsgLen)
else
sprintf(Status, "%s Connected to %s Outbound", TNC->Streams[0].MyCall, TNC->Streams[0].RemoteCall);
MySetWindowText(TNC->xIDC_TNCSTATE, Status);
MySetWindowText(TNC, TNC->xIDC_TNCSTATE, Status);
strcpy(TNC->WEB_TNCSTATE, Status);
UpdateMH(TNC, Call, '+', 'O');
@ -1377,7 +1377,7 @@ static VOID ProcessResponse(struct TNCINFO * TNC, UCHAR * Buffer, int MsgLen)
C_Q_ADD(&TNC->WINMORtoBPQ_Q, buffptr);
sprintf(Status, "In Use by %s", TNC->Streams[0].MyCall);
MySetWindowText(TNC->xIDC_TNCSTATE, Status);
MySetWindowText(TNC, TNC->xIDC_TNCSTATE, Status);
strcpy(TNC->WEB_TNCSTATE, Status);
return;
@ -1463,7 +1463,7 @@ static VOID ProcessResponse(struct TNCINFO * TNC, UCHAR * Buffer, int MsgLen)
}
}
MySetWindowText(TNC->xIDC_TRAFFIC, &Buffer[7]);
MySetWindowText(TNC, TNC->xIDC_TRAFFIC, &Buffer[7]);
strcpy(TNC->WEB_TRAFFIC, &Buffer[7]);
return;
@ -1760,6 +1760,6 @@ VOID CloseComplete(struct TNCINFO * TNC, int Stream)
TNC->FECMode = FALSE;
send(TNC->TCPSock,"MODE ARQ\r\n", 10, 0);
strcpy(TNC->WEB_MODE, "ARQ");
MySetWindowText(TNC->xIDC_MODE, TNC->WEB_MODE);
MySetWindowText(TNC, TNC->xIDC_MODE, TNC->WEB_MODE);
}
}

155
VARA.c

@ -136,7 +136,7 @@ BOOL VARAStopPort(struct PORTCONTROL * PORT)
KillTNC(TNC);
sprintf(PORT->TNC->WEB_COMMSSTATE, "%s", "Port Stopped");
MySetWindowText(PORT->TNC->xIDC_COMMSSTATE, PORT->TNC->WEB_COMMSSTATE);
MySetWindowText(TNC, PORT->TNC->xIDC_COMMSSTATE, PORT->TNC->WEB_COMMSSTATE);
return TRUE;
}
@ -150,10 +150,10 @@ BOOL VARAStartPort(struct PORTCONTROL * PORT)
struct TNCINFO * TNC = PORT->TNC;
ConnecttoVARA(TNC->Port);
TNC->lasttime = time(NULL);;
TNC->lasttime = NOW;;
sprintf(PORT->TNC->WEB_COMMSSTATE, "%s", "Port Restarted");
MySetWindowText(PORT->TNC->xIDC_COMMSSTATE, PORT->TNC->WEB_COMMSSTATE);
MySetWindowText(TNC, PORT->TNC->xIDC_COMMSSTATE, PORT->TNC->WEB_COMMSSTATE);
return TRUE;
}
@ -364,6 +364,8 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff)
{
case 8:
// 60 sec timer
return 0;
case 7:
@ -390,7 +392,7 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff)
if ((STREAM->Connecting || STREAM->Connected) && !STREAM->Disconnecting)
{
if (TNC->SessionTimeLimit && STREAM->ConnectTime && time(NULL) > (TNC->SessionTimeLimit + STREAM->ConnectTime))
if (TNC->SessionTimeLimit && STREAM->ConnectTime && NOW > (TNC->SessionTimeLimit + STREAM->ConnectTime))
{
VARASendCommand(TNC, "CLEANTXBUFFER\r", TRUE);
VARASendCommand(TNC, "DISCONNECT\r", TRUE);
@ -403,7 +405,7 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff)
if (STREAM->Attached)
{
if (STREAM->AttachTime && TNC->AttachTimeLimit && time(NULL) > (TNC->AttachTimeLimit + STREAM->AttachTime))
if (STREAM->AttachTime && TNC->AttachTimeLimit && NOW > (TNC->AttachTimeLimit + STREAM->AttachTime))
{
STREAM->ReportDISC = 1;
STREAM->AttachTime = 0;
@ -439,7 +441,7 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff)
VARASendCommand(TNC, TNC->ConnectCmd, TRUE);
TNC->Streams[0].Connecting = TRUE;
TNC->Streams[0].ConnectTime = time(NULL);
TNC->Streams[0].ConnectTime = NOW;
memset(TNC->Streams[0].RemoteCall, 0, 10);
memcpy(TNC->Streams[0].RemoteCall, &TNC->ConnectCmd[8], strlen(TNC->ConnectCmd)-10);
@ -463,7 +465,7 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff)
PMSGWITHLEN buffptr = GetBuff();
TNC->Streams[0].Connecting = FALSE;
TNC->Streams[0].ConnectTime = time(NULL);
TNC->Streams[0].ConnectTime = NOW;
if (buffptr == 0) return (0); // No buffers, so ignore
@ -480,6 +482,12 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff)
}
}
if (TNC->PageChanged)
{
BuildDevicePage(TNC);
TNC->PageChanged = FALSE;
}
return 0;
case 1: // poll
@ -502,18 +510,18 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff)
char Time[80];
TNC->Restarts++;
TNC->LastRestart = time(NULL);
TNC->LastRestart = NOW;
tm = gmtime(&TNC->LastRestart);
sprintf_s(Time, sizeof(Time),"%04d/%02d/%02d %02d:%02dZ",
tm->tm_year +1900, tm->tm_mon+1, tm->tm_mday, tm->tm_hour, tm->tm_min);
MySetWindowText(TNC->xIDC_RESTARTTIME, Time);
MySetWindowText(TNC, TNC->xIDC_RESTARTTIME, Time);
strcpy(TNC->WEB_RESTARTTIME, Time);
sprintf_s(Time, sizeof(Time),"%d", TNC->Restarts);
MySetWindowText(TNC->xIDC_RESTARTS, Time);
MySetWindowText(TNC, TNC->xIDC_RESTARTS, Time);
strcpy(TNC->WEB_RESTARTS, Time);
*/
@ -536,14 +544,14 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff)
VARASendCommand(TNC, "LISTEN OFF\r", TRUE);
TNC->SessionTimeLimit = TNC->DefaultSessionTimeLimit; // Reset Limit
STREAM->AttachTime = time(NULL);
STREAM->AttachTime = NOW;
// Stop other ports in same group
SuspendOtherPorts(TNC);
sprintf(TNC->WEB_TNCSTATE, "In Use by %s", TNC->Streams[0].MyCall);
MySetWindowText(TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
MySetWindowText(TNC, TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
// Stop Scanning
@ -850,7 +858,7 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff)
// Save Command, and wait up to 10 secs
sprintf(TNC->WEB_TNCSTATE, "Waiting for clear channel");
MySetWindowText(TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
MySetWindowText(TNC, TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
TNC->ConnectCmd = _strdup(Connect);
TNC->BusyDelay = TNC->BusyWait * 10; // BusyWait secs
@ -861,14 +869,14 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff)
TNC->OverrideBusy = FALSE;
VARASendCommand(TNC, Connect, TRUE);
TNC->Streams[0].ConnectTime = time(NULL);
TNC->Streams[0].ConnectTime = NOW;
memset(TNC->Streams[0].RemoteCall, 0, 10);
strcpy(TNC->Streams[0].RemoteCall, &buff->L2DATA[2]);
sprintf(TNC->WEB_TNCSTATE, "%s Connecting to %s", TNC->Streams[0].MyCall, TNC->Streams[0].RemoteCall);
MySetWindowText(TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
MySetWindowText(TNC, TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
}
else
{
@ -1011,68 +1019,33 @@ void CountRestarts(struct TNCINFO * TNC)
char Time[80];
TNC->Restarts++;
TNC->LastRestart = time(NULL);
TNC->LastRestart = NOW;
tm = gmtime(&TNC->LastRestart);
sprintf_s(Time, sizeof(Time),"%04d/%02d/%02d %02d:%02dZ",
tm->tm_year +1900, tm->tm_mon+1, tm->tm_mday, tm->tm_hour, tm->tm_min);
//MySetWindowText(TNC->xIDC_RESTARTTIME, Time);
//MySetWindowText(TNC, TNC->xIDC_RESTARTTIME, Time);
//strcpy(TNC->WEB_RESTARTTIME, Time);
sprintf_s(Time, sizeof(Time),"%d", TNC->Restarts);
MySetWindowText(TNC->xIDC_RESTARTS, Time);
MySetWindowText(TNC, TNC->xIDC_RESTARTS, Time);
strcpy(TNC->WEB_RESTARTS, Time);
}
/*
char WebProcTemplate[] = "<html><meta http-equiv=expires content=0><meta http-equiv=refresh content=15>"
"<link rel='stylesheet' href='webproc.css'>\r\n"
"<script type=\"text/javascript\">\r\n"
"function ScrollOutput()\r\n"
"{var textarea = document.getElementById('textarea');"
"textarea.scrollTop = textarea.scrollHeight;}\r\n"
"function xxx(data){\r\n"
"req = new XMLHttpRequest();\r\n"
"req.open('POST', 'PortAction?%d', true);\r\n"
"req.send(data);alert(data + ' Sent');}\r\n"
"</script>"
"</head><title>%s</title></head><body id=Text onload=\"ScrollOutput()\">"
"<span class='dropdown'>"
"<button class='dropbtn'>Actions</button><span style=\"margin-left:120px;font-size:16px\"><b>%s</b></span>"
"<div class='dropdown-content'>"
"<a href='javascript:xxx(\"Abort\");'>Abort Session</a>"
"<a href='javascript:xxx(\"Kill\");'>Kill TNC</a>"
"<a href='javascript:xxx(\"KillRestart\");'>Kill and Restart TNC</a>"
"</div></span>";
*/
char WebProcTemplate[] = "<html><meta http-equiv=expires content=0>"
char WebProcTemplate[] =
"<link rel='stylesheet' href='webproc.css'>\r\n"
"<script type=\"text/javascript\">\r\n"
"function ScrollOutput()\r\n"
"{var textarea = document.getElementById('textarea');"
"textarea.scrollTop = textarea.scrollHeight;}\r\n"
"function xxx(data){\r\n"
"req = new XMLHttpRequest();\r\n"
"req.open('POST', 'PortAction?%d', true);\r\n"
"req.send(data);alert(data + ' Sent');}\r\n"
"function yyy(data){\r\n"
"req = new XMLHttpRequest();\r\n"
"req.open('POST', 'freqOffset?%d', true);\r\n"
"req.send(data);}\r\n"
"myInt = setInterval('Refresh()', 15000 );\n"
"function Refresh( )\n"
"{location.reload()}\n"
"</script>\r\n"
"</head><title>%s</title></head><body id=Text onload=\"ScrollOutput()\">\r\n"
"<h2 style=\"margin-bottom: 0.2em; text-align:center\">%s</h2>";
"<h3 style=\"margin-bottom: 0.2em; text-align:center\">%s</h3>";
char Menubit[] = "<span class='dropdown' style=\"position: absolute; left: 10;top: 12;\">"
"<button class='dropbtn'>Actions</button>\r\n"
char Menubit[] = "<span hidden class='dropdown' style=\"position: absolute; left: 10;top: 12;\">"
"<button hidden class='dropbtn'>Actions</button>\r\n"
"<span class='dropdown-content'>"
"<a href='javascript:xxx(\"Abort\");'>Abort Session</a>"
"<a href='javascript:xxx(\"Kill\");'>Kill TNC</a>"
"<a href='javascript:xxx(\"KillRestart\");'>Kill and Restart TNC</a>"
"<a href='javascript:Action(\"Abort\");'>Abort Session</a>"
"<a href='javascript:Action(\"Kill\");'>Kill TNC</a>"
"<a href='javascript:Action(\"KillRestart\");'>Kill and Restart TNC</a>"
"</span></span>";
char sliderBit[] = "<span style=\"position: absolute; left: 380;top: 2;\"> TX Offset <span id='val'>%d</span></span>"
@ -1082,16 +1055,16 @@ char sliderBit[] = "<span style=\"position: absolute; left: 380;top: 2;\"> TX Of
"var output = document.getElementById('val');"
"slider.oninput = function() {output.innerHTML = this.value;}\r\n"
"slider.onmouseout = function() {myInt = setInterval('Refresh()', 15000 );"
"output.innerHTML = this.value;yyy(this.value);}\r\n"
"output.innerHTML = this.value;freqOffset(this.value);}\r\n"
"slider.onmouseover = function() {clearInterval(myInt)};"
"</script>\r\n";
static int WebProc(struct TNCINFO * TNC, char * Buff, BOOL LOCAL)
{
int Len = sprintf(Buff, WebProcTemplate, TNC->Port, TNC->Port, "VARA Status", "VARA Status");
int Len = sprintf(Buff, WebProcTemplate, "VARA Status");
if (LOCAL)
Len += sprintf(&Buff[Len], Menubit, TNC->TXOffset, TNC->TXOffset);
Len += sprintf(&Buff[Len], Menubit);
if (TNC->TXFreq)
Len += sprintf(&Buff[Len], sliderBit, TNC->TXOffset, TNC->TXOffset);
@ -1118,7 +1091,7 @@ VOID VARASuspendPort(struct TNCINFO * TNC, struct TNCINFO * ThisTNC)
TNC->PortRecord->PORTCONTROL.PortSuspended = TRUE;
VARASendCommand(TNC, "LISTEN OFF\r", TRUE);
strcpy(TNC->WEB_TNCSTATE, "Interlocked");
MySetWindowText(TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
MySetWindowText(TNC, TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
}
@ -1127,7 +1100,7 @@ VOID VARAReleasePort(struct TNCINFO * TNC)
TNC->PortRecord->PORTCONTROL.PortSuspended = FALSE;
VARASendCommand(TNC, "LISTEN ON\r", TRUE);
strcpy(TNC->WEB_TNCSTATE, "Free");
MySetWindowText(TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
MySetWindowText(TNC, TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
}
@ -1508,7 +1481,7 @@ TNCRunning:
if (TNC->Alerted == FALSE)
{
sprintf(TNC->WEB_COMMSSTATE, "Connecting to TNC");
MySetWindowText(TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE);
MySetWindowText(TNC, TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE);
}
TNC->destaddr.sin_addr.s_addr = inet_addr(TNC->HostName);
@ -1583,7 +1556,7 @@ TNCRunning:
TNC->Alerted = TRUE;
sprintf(TNC->WEB_COMMSSTATE, "Connection to TNC failed");
MySetWindowText(TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE);
MySetWindowText(TNC, TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE);
}
// printf("VARA Connect failed\n");
@ -1613,7 +1586,7 @@ VConnected:
i=sprintf(Msg, "Connect Failed for VARA Data socket - error code = %d\r\n", err);
WritetoConsole(Msg);
sprintf(TNC->WEB_COMMSSTATE, "Connection to TNC failed");
MySetWindowText(TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE);
MySetWindowText(TNC, TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE);
TNC->Alerted = TRUE;
}
@ -1676,7 +1649,7 @@ VConnected:
TNC->Alerted = TRUE;
sprintf(TNC->WEB_COMMSSTATE, "Connected to VARA TNC");
MySetWindowText(TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE);
MySetWindowText(TNC, TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE);
FreeSemaphore(&Semaphore);
@ -1742,7 +1715,7 @@ Lost:
WritetoConsole(Msg);
sprintf(TNC->WEB_COMMSSTATE, "Connection to TNC lost");
MySetWindowText(TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE);
MySetWindowText(TNC, TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE);
TNC->CONNECTED = FALSE;
TNC->Alerted = FALSE;
@ -1766,7 +1739,7 @@ Lost:
WritetoConsole(Msg);
sprintf(TNC->WEB_COMMSSTATE, "Connection to TNC lost");
MySetWindowText(TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE);
MySetWindowText(TNC, TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE);
TNC->CONNECTED = FALSE;
TNC->Alerted = FALSE;
@ -1795,7 +1768,7 @@ Lost:
// sprintf(TNC->WEB_COMMSSTATE, "Connection to TNC lost");
// GetSemaphore(&Semaphore, 52);
// MySetWindowText(TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE);
// MySetWindowText(TNC, TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE);
// FreeSemaphore(&Semaphore);
@ -1900,7 +1873,7 @@ VOID VARAProcessResponse(struct TNCINFO * TNC, UCHAR * Buffer, int MsgLen)
if (_memicmp(Buffer, "SN ", 3) == 0)
{
strcpy(TNC->WEB_PROTOSTATE, &Buffer[3]);
MySetWindowText(TNC->xIDC_PROTOSTATE, TNC->WEB_PROTOSTATE);
MySetWindowText(TNC, TNC->xIDC_PROTOSTATE, TNC->WEB_PROTOSTATE);
TNC->SNR = atof(&Buffer[3]);
return;
@ -1913,10 +1886,10 @@ VOID VARAProcessResponse(struct TNCINFO * TNC, UCHAR * Buffer, int MsgLen)
TNC->BusyonTime = GetTickCount();
MySetWindowText(TNC->xIDC_CHANSTATE, "Busy");
MySetWindowText(TNC, TNC->xIDC_CHANSTATE, "Busy");
strcpy(TNC->WEB_CHANSTATE, "Busy");
TNC->WinmorRestartCodecTimer = time(NULL);
TNC->WinmorRestartCodecTimer = NOW;
return;
}
@ -1935,8 +1908,8 @@ VOID VARAProcessResponse(struct TNCINFO * TNC, UCHAR * Buffer, int MsgLen)
}
MySetWindowText(TNC->xIDC_CHANSTATE, TNC->WEB_CHANSTATE);
TNC->WinmorRestartCodecTimer = time(NULL);
MySetWindowText(TNC, TNC->xIDC_CHANSTATE, TNC->WEB_CHANSTATE);
TNC->WinmorRestartCodecTimer = NOW;
return;
}
@ -2017,7 +1990,7 @@ VOID VARAProcessResponse(struct TNCINFO * TNC, UCHAR * Buffer, int MsgLen)
sprintf(TNC->WEB_TRAFFIC, "Sent %d RXed %d Queued %s",
STREAM->bytesTXed, STREAM->bytesRXed, &Buffer[7]);
MySetWindowText(TNC->xIDC_TRAFFIC, TNC->WEB_TRAFFIC);
MySetWindowText(TNC, TNC->xIDC_TRAFFIC, TNC->WEB_TRAFFIC);
return;
}
@ -2077,7 +2050,7 @@ VOID VARAProcessResponse(struct TNCINFO * TNC, UCHAR * Buffer, int MsgLen)
strcpy(TNC->WEB_MODE, "2750");
}
MySetWindowText(TNC->xIDC_MODE, TNC->WEB_MODE);
MySetWindowText(TNC, TNC->xIDC_MODE, TNC->WEB_MODE);
memcpy(Call, &Buffer[10], 10);
ptr = strchr(Call, ' ');
@ -2105,7 +2078,7 @@ VOID VARAProcessResponse(struct TNCINFO * TNC, UCHAR * Buffer, int MsgLen)
memset(STREAM, 0, sizeof(struct STREAMINFO));
STREAM->ConnectTime = time(NULL);
STREAM->ConnectTime = NOW;
SuspendOtherPorts(TNC);
@ -2146,7 +2119,7 @@ VOID VARAProcessResponse(struct TNCINFO * TNC, UCHAR * Buffer, int MsgLen)
if (WL2K)
strcpy(SESS->RMSCall, WL2K->RMSCall);
MySetWindowText(TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
MySetWindowText(TNC, TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
// Check for ExcludeList
@ -2297,7 +2270,7 @@ VOID VARAProcessResponse(struct TNCINFO * TNC, UCHAR * Buffer, int MsgLen)
char Reply[80];
int ReplyLen;
STREAM->ConnectTime = time(NULL);
STREAM->ConnectTime = NOW;
if (TNC->NetRomMode)
{
@ -2342,7 +2315,7 @@ VOID VARAProcessResponse(struct TNCINFO * TNC, UCHAR * Buffer, int MsgLen)
else
sprintf(TNC->WEB_TNCSTATE, "%s Connected to %s Outbound", TNC->Streams[0].MyCall, TNC->Streams[0].RemoteCall);
MySetWindowText(TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
MySetWindowText(TNC, TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
UpdateMH(TNC, TNC->TargetCall, '+', 'O');
return;
@ -2499,7 +2472,7 @@ VOID VARAProcessReceivedData(struct TNCINFO * TNC)
// closesocket(TNC->TCPSock);
sprintf(TNC->WEB_COMMSSTATE, "Connection to TNC lost");
MySetWindowText(TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE);
MySetWindowText(TNC, TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE);
TNC->CONNECTED = FALSE;
TNC->Alerted = FALSE;
@ -2701,7 +2674,7 @@ VOID VARAProcessReceivedControl(struct TNCINFO * TNC)
TNC->Streams[0].Disconnecting = FALSE;
sprintf(TNC->WEB_COMMSSTATE, "Connection to TNC lost");
MySetWindowText(TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE);
MySetWindowText(TNC, TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE);
return;
}
@ -2773,7 +2746,7 @@ VOID VARAProcessDataPacket(struct TNCINFO * TNC, UCHAR * Data, int Length)
sprintf(TNC->WEB_TRAFFIC, "Sent %d RXed %d Queued %d",
STREAM->bytesTXed, STREAM->bytesRXed,STREAM->BytesOutstanding);
MySetWindowText(TNC->xIDC_TRAFFIC, TNC->WEB_TRAFFIC);
MySetWindowText(TNC, TNC->xIDC_TRAFFIC, TNC->WEB_TRAFFIC);
// if VARAAC Mode, remove byte count from front and add cr
// could possibly be longer than buffer size
@ -2970,7 +2943,7 @@ VOID VARAReleaseTNC(struct TNCINFO * TNC)
VARASendCommand(TNC, "LISTEN ON\r", TRUE);
strcpy(TNC->WEB_TNCSTATE, "Free");
MySetWindowText(TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
MySetWindowText(TNC, TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
// Start Scanner
@ -3047,7 +3020,7 @@ void SendVARANetrom(struct TNCINFO * TNC, unsigned char * Data, int Len)
// Save Command, and wait up to 10 secs
sprintf(TNC->WEB_TNCSTATE, "Waiting for clear channel");
MySetWindowText(TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
MySetWindowText(TNC, TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
TNC->ConnectCmd = _strdup(Connect);
TNC->BusyDelay = TNC->BusyWait * 10; // BusyWait secs
@ -3057,13 +3030,13 @@ void SendVARANetrom(struct TNCINFO * TNC, unsigned char * Data, int Len)
TNC->OverrideBusy = FALSE;
VARASendCommand(TNC, Connect, TRUE);
TNC->Streams[0].ConnectTime = time(NULL);
TNC->Streams[0].ConnectTime = NOW;
memset(TNC->Streams[0].RemoteCall, 0, 10);
strcpy(TNC->Streams[0].RemoteCall, MYNETROMCALL);
sprintf(TNC->WEB_TNCSTATE, "%s Connecting to %s", TNC->Streams[0].MyCall, TNC->Streams[0].RemoteCall);
MySetWindowText(TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
MySetWindowText(TNC, TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
}
}

@ -10,8 +10,8 @@
#endif
#define KVers 6,0,25,32
#define KVerstring "6.0.25.32\0"
#define KVers 6,0,25,35
#define KVerstring "6.0.25.35\0"
#ifdef CKernel

@ -151,6 +151,8 @@ VOID WritetoTraceSupport(struct TNCINFO * TNC, char * Msg, int Len)
if (Len < 0)
return;
TNC->PageChanged = TNC->WebSockUsed;
Save = Msg[Len];
Msg[Len] = 0;
@ -215,7 +217,7 @@ lineloop:
#endif
// Write to Web Buffer
T = time(NULL);
T = NOW;
tm = gmtime(&T);
sprintf_s(Time, sizeof(Time),"%02d:%02d ", tm->tm_hour, tm->tm_min);
@ -263,7 +265,7 @@ lineloop:
#else
index=SendMessage(TNC->hMonitor, LB_ADDSTRING, 0, (LPARAM)(LPCTSTR) ptr1 );
#endif
T = time(NULL);
T = NOW;
tm = gmtime(&T);
sprintf_s(Time, sizeof(Time),"%02d:%02d ", tm->tm_hour, tm->tm_min);
@ -314,24 +316,28 @@ int C_Q_ADD_NP(VOID *PQ, VOID *PBUFF);
struct SEM SetWindTextSem = {0, 0, 0, 0};
VOID MySetWindowText(HWND hWnd, char * Msg)
VOID MySetWindowText(struct TNCINFO * TNC, HWND hWnd, char * Msg)
{
if (TNC)
TNC->PageChanged = TNC->WebSockUsed;
#ifndef LINBPQ
{
PMSGWITHLEN buffptr;
PMSGWITHLEN buffptr;
GetSemaphore(&SetWindTextSem, 61);
buffptr = zalloc(400);
GetSemaphore(&SetWindTextSem, 61);
buffptr = zalloc(400);
if (buffptr)
{
buffptr->Len= (UINT)hWnd;
memcpy(&buffptr->Data[0], Msg, strlen(Msg) + 1);
if (buffptr)
{
buffptr->Len= (UINT)hWnd;
memcpy(&buffptr->Data[0], Msg, strlen(Msg) + 1);
C_Q_ADD_NP(&SetWindowTextQ, buffptr);
}
C_Q_ADD_NP(&SetWindowTextQ, buffptr);
}
FreeSemaphore(&SetWindTextSem);
FreeSemaphore(&SetWindTextSem);
}
#endif
}
@ -598,7 +604,7 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff)
if ((STREAM->Connecting || STREAM->Connected) && !STREAM->Disconnecting)
{
if (TNC->SessionTimeLimit && STREAM->ConnectTime && time(NULL) > (TNC->SessionTimeLimit + STREAM->ConnectTime))
if (TNC->SessionTimeLimit && STREAM->ConnectTime && NOW > (TNC->SessionTimeLimit + STREAM->ConnectTime))
{
send(TNC->TCPSock,"DISCONNECT\r\n", 12, 0);
STREAM->Disconnecting = TRUE;
@ -680,7 +686,7 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff)
{
char wtext[100];
sprintf (wtext, "WINMOR Sound Card TNC - BPQ %s", TNC->PortRecord->PORTCONTROL.PORTDESCRIPTION);
MySetWindowText(TNC->hWnd, wtext);
MySetWindowText(TNC, TNC->hWnd, wtext);
}
TNC->HeartBeat = 0;
@ -693,7 +699,7 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff)
send(TNC->TCPSock, "MODE\r\n", 6, 0);
else
{
if (time(NULL) - TNC->WinmorRestartCodecTimer > 900) // 15 mins
if (NOW - TNC->WinmorRestartCodecTimer > 900) // 15 mins
{
send(TNC->TCPSock, "CODEC FALSE\r\n", 13, 0);
send(TNC->TCPSock, "CODEC TRUE\r\n", 12, 0);
@ -768,7 +774,7 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff)
char Time[80];
TNC->Restarts++;
TNC->LastRestart = time(NULL);
TNC->LastRestart = NOW;
tm = gmtime(&TNC->LastRestart);
@ -1336,12 +1342,12 @@ VOID ReleaseTNC(struct TNCINFO * TNC)
send(TNC->TCPSock, "LISTEN TRUE\r\nMAXCONREQ 4\r\n", 26, 0);
strcpy(TNC->WEB_TNCSTATE, "Free");
MySetWindowText(TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
MySetWindowText(TNC, TNC->xIDC_TNCSTATE, TNC->WEB_TNCSTATE);
if (TNC->hWnd)
{
sprintf (wtext, "WINMOR Sound Card TNC - BPQ %s", TNC->PortRecord->PORTCONTROL.PORTDESCRIPTION);
MySetWindowText(TNC->hWnd, wtext);
MySetWindowText(TNC, TNC->hWnd, wtext);
}
// Start Scanner
@ -1416,7 +1422,7 @@ VOID WinmorSuspendPort(struct TNCINFO * TNC, struct TNCINFO * ThisTNC)
if (TNC->Busy)
{
TNC->Busy = FALSE; // Can't clear detector if CODEC off.
MySetWindowText(TNC->xIDC_CHANSTATE, "Clear");
MySetWindowText(TNC, TNC->xIDC_CHANSTATE, "Clear");
strcpy(TNC->WEB_CHANSTATE, "Clear");
}
}
@ -1429,15 +1435,18 @@ VOID WinmorReleasePort(struct TNCINFO * TNC)
extern char WebProcTemplate[];
extern char sliderBit[];
extern char Menubit[];
static int WebProc(struct TNCINFO * TNC, char * Buff, BOOL LOCAL)
{
int Len = sprintf(Buff, WebProcTemplate, TNC->Port, TNC->Port, "WINMOR Status", "WINMOR Status");
int Len = sprintf(Buff, WebProcTemplate, "WINMOR Status");
if (LOCAL)
Len += sprintf(&Buff[Len], Menubit);
if (TNC->TXFreq)
Len += sprintf(&Buff[Len], sliderBit, TNC->TXOffset, TNC->TXOffset);
Len += sprintf(&Buff[Len], "<table style=\"text-align: left; width: 500px; font-family: monospace; align=center \" border=1 cellpadding=2 cellspacing=2>");
Len += sprintf(&Buff[Len], "<tr><td width=110px>Comms State</td><td>%s</td></tr>", TNC->WEB_COMMSSTATE);
Len += sprintf(&Buff[Len], "<tr><td>TNC State</td><td>%s</td></tr>", TNC->WEB_TNCSTATE);
@ -1801,7 +1810,7 @@ VOID WINMORThread(void * portptr)
i=sprintf(Msg, "Connect Failed for WINMOR socket - error code = %d\r\n", err);
WritetoConsole(Msg);
sprintf(TNC->WEB_COMMSSTATE, "Connection to TNC failed");
MySetWindowText(TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE);
MySetWindowText(TNC, TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE);
TNC->Alerted = TRUE;
}
@ -1867,7 +1876,7 @@ VOID WINMORThread(void * portptr)
sprintf(TNC->WEB_COMMSSTATE, "Connected to WINMOR TNC");
GetSemaphore(&Semaphore, 40);
MySetWindowText(TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE);
MySetWindowText(TNC, TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE);
FreeSemaphore(&Semaphore);
}
@ -1925,7 +1934,7 @@ Lost:
sprintf(TNC->WEB_COMMSSTATE, "Connection to TNC lost");
GetSemaphore(&Semaphore, 40);
MySetWindowText(TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE);
MySetWindowText(TNC, TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE);
FreeSemaphore(&Semaphore);
TNC->CONNECTED = FALSE;
@ -1955,7 +1964,7 @@ Lost:
sprintf(TNC->WEB_COMMSSTATE, "Connection to TNC lost");
GetSemaphore(&Semaphore, 40);
MySetWindowText(TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE);
MySetWindowText(TNC, TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE);
FreeSemaphore(&Semaphore);
TNC->CONNECTED = FALSE;
@ -2082,7 +2091,7 @@ VOID ProcessResponse(struct TNCINFO * TNC, UCHAR * Buffer, int MsgLen)
SetWindowText(TNC->xIDC_CHANSTATE, "Busy");
strcpy(TNC->WEB_CHANSTATE, "Busy");
TNC->WinmorRestartCodecTimer = time(NULL);
TNC->WinmorRestartCodecTimer = NOW;
return;
}
@ -2095,7 +2104,7 @@ VOID ProcessResponse(struct TNCINFO * TNC, UCHAR * Buffer, int MsgLen)
strcpy(TNC->WEB_CHANSTATE, "Clear");
SetWindowText(TNC->xIDC_CHANSTATE, TNC->WEB_CHANSTATE);
TNC->WinmorRestartCodecTimer = time(NULL);
TNC->WinmorRestartCodecTimer = NOW;
return;
}
@ -2132,7 +2141,7 @@ VOID ProcessResponse(struct TNCINFO * TNC, UCHAR * Buffer, int MsgLen)
WritetoTrace(TNC, Buffer, MsgLen - 2);
FreeSemaphore(&Semaphore);
STREAM->ConnectTime = time(NULL);
STREAM->ConnectTime = NOW;
STREAM->bytesRXed = STREAM->bytesTXed = STREAM->PacketsSent = 0;
if (TNC->StartInRobust)
@ -2483,7 +2492,7 @@ VOID ProcessResponse(struct TNCINFO * TNC, UCHAR * Buffer, int MsgLen)
strcpy(TNC->WEB_MODE, &Buffer[5]);
GetSemaphore(&Semaphore, 50);
MySetWindowText(TNC->xIDC_MODE, &Buffer[5]);
MySetWindowText(TNC, TNC->xIDC_MODE, &Buffer[5]);
FreeSemaphore(&Semaphore);
return;
}
@ -2499,7 +2508,7 @@ VOID ProcessResponse(struct TNCINFO * TNC, UCHAR * Buffer, int MsgLen)
if (_memicmp(Buffer, "NEWSTATE", 8) == 0)
{
TNC->WinmorRestartCodecTimer = time(NULL);
TNC->WinmorRestartCodecTimer = NOW;
SetWindowText(TNC->xIDC_PROTOSTATE, &Buffer[9]);
strcpy(TNC->WEB_PROTOSTATE, &Buffer[9]);
@ -2710,7 +2719,7 @@ loop:
// Does this mean closed?
sprintf(TNC->WEB_COMMSSTATE, "Connection to TNC lost");
MySetWindowText(TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE);
MySetWindowText(TNC, TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE);
TNC->CONNECTING = FALSE;
TNC->CONNECTED = FALSE;

@ -718,33 +718,9 @@ ok:
int WebProc(struct TNCINFO * TNC, char * Buff, BOOL LOCAL)
{
int Interval = 15;
int Len;
if (LOCAL)
{
if (TNC->WEB_CHANGED)
Interval = 1;
else
Interval = 4;
}
else
{
if (TNC->WEB_CHANGED)
Interval = 4;
else
Interval = 15;
}
if (TNC->WEB_CHANGED)
{
TNC->WEB_CHANGED -= Interval;
if (TNC->WEB_CHANGED < 0)
TNC->WEB_CHANGED = 0;
}
Len = sprintf(Buff, "<html><meta http-equiv=expires content=0><meta http-equiv=refresh content=%d>"
"<head><title>WinRPR Status</title></head><body><h2>WinRPR Status</h2>", Interval);
Len = sprintf(Buff, "<h2>WinRPR Status</h2>");
Len += sprintf(&Buff[Len], "<table style=\"text-align: left; width: 480px; font-family: monospace; align=center \" border=1 cellpadding=2 cellspacing=2>");
@ -1177,7 +1153,7 @@ VOID WinRPRProcessReceivedPacket(struct TNCINFO * TNC)
TNC->Streams[0].ReportDISC = TRUE;
sprintf(TNC->WEB_COMMSSTATE, "Connection to TNC lost");
MySetWindowText(TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE);
MySetWindowText(TNC, TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE);
return;
}
@ -1533,10 +1509,11 @@ TNCRunning:
// sinx.sin_addr.s_addr = INADDR_ANY;
// sinx.sin_port = 0;
sprintf(TNC->WEB_COMMSSTATE, "Connecting to TNC");
MySetWindowText(TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE);
if (!TNC->Alerted)
{
sprintf(TNC->WEB_COMMSSTATE, "Connecting to TNC");
MySetWindowText(TNC, TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE);
}
if (connect(TNC->TCPSock,(LPSOCKADDR) &TNC->destaddr,sizeof(TNC->destaddr)) == 0)
{
@ -1558,7 +1535,7 @@ TNCRunning:
WritetoConsoleLocal(Msg);
sprintf(TNC->WEB_COMMSSTATE, "Connection to TNC failed");
MySetWindowText(TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE);
MySetWindowText(TNC, TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE);
TNC->Alerted = TRUE;
}
@ -1614,7 +1591,7 @@ TNCRunning:
TNC->Alerted = TRUE;
sprintf(TNC->WEB_COMMSSTATE, "Connected to WinRPR TNC");
MySetWindowText(TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE);
MySetWindowText(TNC, TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE);
FreeSemaphore(&Semaphore);
@ -1666,7 +1643,7 @@ Lost:
WritetoConsoleLocal(Msg);
sprintf(TNC->WEB_COMMSSTATE, "Connection to TNC lost");
MySetWindowText(TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE);
MySetWindowText(TNC, TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE);
TNC->CONNECTED = FALSE;
TNC->Alerted = FALSE;

@ -143,7 +143,7 @@ BOOL UpdateADIFRecord(ADIF * ADIF, char * Msg, char Dirn)
if (ADIF->StartTime == 0)
{
ADIF->StartTime = time(NULL);
ADIF->StartTime = NOW;
// ADIF->Mode = 49; // Unused value (unforunately 0 = PKT1200)
}
@ -393,7 +393,7 @@ BOOL WriteADIFRecord(ADIF * ADIF)
if (ADIF == NULL)
return TRUE;
T = time(NULL);
T = NOW;
tm = gmtime(&T);
memcpy(&endtm, tm, sizeof(endtm));

@ -139,7 +139,7 @@ typedef struct _TRANSPORTENTRY
UCHAR SPYFLAG; // SPY - CONNECT TO NODE VIA BBS CALLSIGN
UCHAR RTT_SEQ; // SEQUENCE NUMBER BEING TIMED
uint32_t RTT_TIMER; // TIME ABOVE SEQUENCE WAS SENT
uint64_t RTT_TIMER; // TIME ABOVE SEQUENCE WAS SENT
USHORT PASSWORD; // AUTHORISATION CODE FOR REMOTE SYSOP
@ -182,7 +182,7 @@ typedef struct _TRANSPORTENTRY
int segsResent;
int NRRID;
time_t NRRTime;
uint64_t NRRTicks;
time_t ConnectTime;
char Direction[16]; // In or Out
@ -266,6 +266,7 @@ typedef struct ROUTE
int recNum; // This entry's index it Routes table
int noV2point2; // Set to force V2.0 connect. Can be set in config or dynamically learned
int Stopped; // Set by STOPROUTE command
int NPR; // NPR Link
} *PROUTE;
@ -690,8 +691,8 @@ typedef struct PORTCONTROL
UCHAR SOFTDCDFLAG; // IF SET USE 'SOFT DCD' - IF MODEM CANT GIVE A REAL ONE
UCHAR PORTSLOTTIME; // SLOT TIME
UCHAR PORTTAILTIME; // TAIL TIME
UCHAR PORTT1; // L2 TIMEOUT
UCHAR PORTT2; // L2 DELAYED ACK TIMER
UCHAR PORTT1; // L2 TIMEOUT (100 ms intervals)
UCHAR PORTT2; // L2 DELAYED ACK TIMER (100 ms intervals)
UCHAR PORTN2; // RETRIES
UCHAR PORTPACLEN; // DEFAULT PACLEN FOR INCOMING SESSIONS

@ -13,7 +13,7 @@ make the code use GetProcAddress rather than LoadLibrary. Without this the refer
count on BPQ32.dll gets messed up, and the code will not unload cleanly.
*/
#include "winstdint.h"
#ifndef DYNLOADBPQ
@ -264,9 +264,11 @@ VOID APIENTRY SendChatReport(UINT_PTR ChatReportSocket, char * buff, int txlen);
int APIENTRY CountFramesQueuedOnStream(int Stream);
int APIENTRY RunBPQ32Background();
char * APIENTRY GetLOC();
DllExport uint64_t APIENTRY GetPortFrequency(int PortNo, char * FreqString);
uint64_t APIENTRY GetPortFrequency(int PortNo, char * FreqString);
#else

@ -2630,7 +2630,7 @@ BOOL CheckSourceisResolvable(struct AXIPPORTINFO * PORT, char * call, int FromPo
arp->SourcePort = ToPort;
}
}
arp->LastHeard = time(NULL);
arp->LastHeard = NOW;
return 1; // Ok to process
}
index++;

@ -254,15 +254,13 @@ void * TRACE_Q = NULL; // TRANSMITTED FRAMES TO BE TRACED
int RANDOM = 0; // 'RANDOM' NUMBER FOR PERSISTENCE CALCS
int L2TIMERFLAG = 0; // INCREMENTED AT 18HZ BY TIMER INTERRUPT
int L3TIMERFLAG = 0; // DITTO
int L4TIMERFLAG = 0; // DITTO
char HEADERCHAR = '}'; // CHAR FOR _NODE HEADER MSGS
VOID * LASTPOINTER = NULL; // PERVIOUS _NODE DURING CHAINING
int REALTIMETICKS = 0;
int BGTIMER = 0; // TO CONTROL BG SCANS
int REALTIMETICKS = 0; // Count of 100 ms intervals since load
VOID * CONFIGPTR = NULL; // Internal Config Get Offset
@ -451,6 +449,9 @@ VOID EXTTX(PEXTPORTDATA PORTVEC, MESSAGE * Buffer)
}
VOID * GetBuffQuick();
UINT ReleaseBufferQuick(VOID *pBUFF);
VOID EXTRX(PEXTPORTDATA PORTVEC)
{
struct _MESSAGE * Message;
@ -462,16 +463,16 @@ Loop:
if (QCOUNT < 10)
return;
Message = GetBuff();
Message = GetBuffQuick();
if (Message == NULL)
return;
Len = (size_t)PORTVEC->PORT_EXT_ADDR(1, PORT->PORTNUMBER, (PDATAMESSAGE)Message);
if (Len == 0)
{
ReleaseBuffer((UINT *)Message);
ReleaseBufferQuick((UINT *)Message);
return;
}
@ -484,7 +485,7 @@ Loop:
int Sessno = Message->PORT;
TRANSPORTENTRY * Session;
ReleaseBuffer((UINT *)Message);
ReleaseBufferQuick((UINT *)Message);
// GET RID OF ANY SESSION ENTRIES
@ -533,8 +534,12 @@ Loop:
VOID EXTTIMER(PEXTPORTDATA PORTVEC)
{
// Called every 100 mS
// USED TO SEND A RE-INIT IN THE CORRECT PROCESS
struct TNCINFO * TNC = TNCInfo[PORTVEC->PORTCONTROL.PORTNUMBER];
if (PORTVEC->EXTRESTART)
{
PORTVEC->EXTRESTART = 0; //CLEAR
@ -542,10 +547,19 @@ VOID EXTTIMER(PEXTPORTDATA PORTVEC)
}
PORTVEC->PORT_EXT_ADDR(7, PORTVEC->PORTCONTROL.PORTNUMBER, 0); // Timer Routine
if (TNC && TNC->PageChanged)
{
BuildDevicePage(TNC);
TNC->PageChanged = FALSE;
}
}
VOID EXTSLOWTIMER(PEXTPORTDATA PORTVEC)
{
// Called every minute 60 secs
PORTVEC->PORT_EXT_ADDR(8, PORTVEC->PORTCONTROL.PORTNUMBER, 0); // Timer Routine
}
@ -655,9 +669,9 @@ VOID * TXCHECKCODE[12] = {KISSTXCHECK, HDLCTXCHECK, HDLCTXCHECK, HDLCTXCHECK, KI
extern int BACKGROUND();
extern int L2TimerProc();
extern int L3TimerProc();
extern int L4TimerProc();
extern int L3FastTimer();
extern int L3MinuteTimerProc();
extern int L4SecTimer();
extern int L3SecTimer();
extern int StatsTimer();
extern int COMMANDHANDLER();
VOID SDETX(struct _LINKTABLE * LINK);
@ -711,7 +725,7 @@ BOOL Start()
if (cfg->C_NODEALIAS[0] == 0)
memset(cfg->C_NODEALIAS, ' ', 10);
TimeLoaded = time(NULL);
TimeLoaded = NOW;
AUTOSAVE = cfg->C_AUTOSAVE;
@ -1056,8 +1070,8 @@ BOOL Start()
PORT->FULLDUPLEX = (UCHAR)PortRec->FULLDUP;
PORT->SOFTDCDFLAG = (UCHAR)PortRec->SOFTDCD;
PORT->PORTT1 = PortRec->FRACK / 333;
PORT->PORTT2 = PortRec->RESPTIME /333;
PORT->PORTT1 = PortRec->FRACK / 100;
PORT->PORTT2 = PortRec->RESPTIME /100;
PORT->PORTN2 = (UCHAR)PortRec->RETRIES;
PORT->PORTPACLEN = (UCHAR)PortRec->PACLEN;
@ -1432,7 +1446,7 @@ BOOL Start()
ROUTE->NBOUR_MAXFRAME = Rcfg->pwind & 0x3f;
FRACK = Rcfg->pfrack;
ROUTE->NBOUR_FRACK = FRACK / 333;
ROUTE->NBOUR_FRACK = FRACK / 100;
ROUTE->NBOUR_PACLEN = Rcfg->ppacl;
ROUTE->OtherendsRouteQual = ROUTE->OtherendLocked = Rcfg->farQual;
@ -1447,6 +1461,8 @@ BOOL Start()
ROUTE->TCPAddress->ai_addr = (struct sockaddr *) zalloc(sizeof(struct sockaddr));
}
ROUTE->NPR = Rcfg->NPR;
ROUTE->recNum = index++;
Rcfg++;
@ -1636,7 +1652,11 @@ BOOL Start()
_beginthread(WritePacketLogThread, 0, NULL);
lastSaveSecs = CurrentSecs = lastSlowSecs = time(NULL);
// Initialise interval timers
lastMinuteSecs = lastHourSecs = lastTenSecSecs = NOW = time(NULL);
last100mSTickCount = lastSecTickCount = GetTickCount();
// if EnableOARCAPI set try to resolve host here so we can send Node up event before anything else
@ -1655,7 +1675,7 @@ BOOL Start()
hookNodeStarted();
nodeStartedSent = 1;
LastNodeStatus = time(NULL);
LastNodeStatus = NOW;
}
}
@ -2175,9 +2195,13 @@ int DelayBuffers = 0;
void sendModeReport();
void sendFreqReport();
VOID TIMERINTERRUPT()
int TIMERINTERRUPT()
{
// Main Processing loop - CALLED EVERY 100 MS
// Main Processing - Called rapidly (maybe 1 mS)
// Returns 1 if 100mS has passed since last call
int retval = 0;
int i;
struct PORTCONTROL * PORT = PORTTABLE;
@ -2186,41 +2210,44 @@ VOID TIMERINTERRUPT()
struct _MESSAGE * Message;
int toPort;
CurrentSecs = time(NULL);
if (GetTickCount() - last100mSTickCount > 100)
{
retval = 1;
last100mSTickCount = GetTickCount();
REALTIMETICKS++;
// CALL PORT TIMER 100 mS ROUTINES
BGTIMER++;
REALTIMETICKS++;
L2TIMERFLAG++; // INCREMENT FLAG FOR BG
L3TIMERFLAG++; // INCREMENT FLAG FOR BG
L4TIMERFLAG++; // INCREMENT FLAG FOR BG
for (i = 0; i < NUMBEROFPORTS; i++)
{
PORT->PORTTIMERCODE(PORT);
// CALL PORT TIMER ROUTINES
// Check Smart ID timer
for (i = 0; i < NUMBEROFPORTS; i++)
{
PORT->PORTTIMERCODE(PORT);
if (PORT->SmartIDNeeded && PORT->SmartIDNeeded < NOW)
SendSmartID(PORT);
// Check Smart ID timer
PORT = PORT->PORTPOINTER;
}
if (PORT->SmartIDNeeded && PORT->SmartIDNeeded < time(NULL))
SendSmartID(PORT);
PORT = PORT->PORTPOINTER;
}
if (last100mSTickCount - lastSecTickCount > 1000)
{
lastSecTickCount = last100mSTickCount;
// CHECK FOR TIMER ACTIVITY
L3SecTimer();
L4SecTimer();
}
if (L2TIMERFLAG >= 3)
{
L2TIMERFLAG -= 3;
L2TimerProc(); // 300 mS
L2TimerProc(); // Now 100 mS
}
if (CurrentSecs - lastSlowSecs >= 60) // 1 PER MIN
if (NOW - lastMinuteSecs >= 60) // 1 PER MIN
{
lastSlowSecs = CurrentSecs;
lastMinuteSecs = NOW;
L3TimerProc();
L3MinuteTimerProc();
if (needAIS)
AISTimer();
@ -2258,9 +2285,9 @@ VOID TIMERINTERRUPT()
if (MQTT)
MQTTTimer();
if (LastNodeStatus && (time(NULL) - LastNodeStatus) > nodeStatusTimer)
if (LastNodeStatus && (NOW - LastNodeStatus) > nodeStatusTimer)
{
LastNodeStatus = time(NULL);
LastNodeStatus = NOW;
hookNodeRunning();
}
@ -2282,9 +2309,9 @@ VOID TIMERINTERRUPT()
// Check Autosave Nodes and MH timer
if (CurrentSecs - lastSaveSecs >= 3600) // 1 per hour
if (NOW - lastHourSecs >= 3600) // 1 per hour
{
lastSaveSecs = CurrentSecs;
lastHourSecs = NOW;
if (AUTOSAVE == 1)
SaveNodes();
@ -2292,16 +2319,10 @@ VOID TIMERINTERRUPT()
SaveMH();
}
if (L4TIMERFLAG >= 10) // 1 PER SEC
{
L4TIMERFLAG -= 10;
L3FastTimer();
L4TimerProc();
}
// SEE IF ANY FRAMES TO TRACE
// The rest runs on every call
Buffer = Q_REM(&TRACE_Q);
while (Buffer)
@ -2347,8 +2368,6 @@ VOID TIMERINTERRUPT()
while (Buffer)
{
Message = (struct _MESSAGE *) Buffer;
if (CURRENTPORT == 30)
Sent = Sent;
if (PORT->PROTOCOL == 10)
{
@ -2428,7 +2447,7 @@ VOID TIMERINTERRUPT()
L2Packet:
// TIME STAMP IT
time(&Message->Timestamp);
Message->Timestamp = NOW;
Message->PORT = CURRENTPORT;
@ -2459,7 +2478,7 @@ L2Packet:
{
// Using Smart ID, but none scheduled
BPORT->SmartIDNeeded = time(NULL) + BPORT->SmartIDInterval;
BPORT->SmartIDNeeded = NOW + BPORT->SmartIDInterval;
}
PUT_ON_PORT_Q(BPORT, BBuffer);
}
@ -2626,7 +2645,7 @@ ENDOFLIST:
{
// Stuck link debug check
if (LINK->LINKWINDOW == 0 || LINK->LASTFRAMESENT == 0 || (time(NULL) - LINK->LASTFRAMESENT) > 60) // No send for 60 secs
if (LINK->LINKWINDOW == 0 || LINK->LASTFRAMESENT == 0 || (NOW - LINK->LASTFRAMESENT) > 60) // No send for 60 secs
{
if (COUNT_AT_L2(LINK) > 16 || LINK->LINKWINDOW == 0)
{
@ -2636,7 +2655,7 @@ ENDOFLIST:
char Normcall2[11] = "";
int Count = COUNT_AT_L2(LINK);
int secs = time(NULL) - LINK->LASTFRAMESENT;
int secs = NOW - LINK->LASTFRAMESENT;
ConvFromAX25(LINK->LINKCALL, Normcall);
@ -2657,12 +2676,10 @@ ENDOFLIST:
L2SENDCOMMAND(LINK, DISC | PFBIT);
return;
return retval; // why??
}
}
}
}
}
LINK++;
@ -2671,6 +2688,10 @@ ENDOFLIST:
L4BG(); // DO LEVEL 4 PROCESSING
L3BG();
TNCTimerProc();
return retval;
}
VOID DoListenMonitor(TRANSPORTENTRY * L4, MESSAGE * Msg)
@ -3060,7 +3081,7 @@ void WriteConnectLog(char * fromCall, char * toCall, UCHAR * Mode)
char LogMsg[256];
int MsgLen;
T = time(NULL);
T = NOW;
tm = gmtime(&T);
sprintf(FN,"%s/logs/ConnectLog_%02d%02d%02d.log", LogDirectory, tm->tm_year - 100, tm->tm_mon + 1, tm->tm_mday);

@ -161,7 +161,7 @@ struct SEM;
void _GetSemaphore(struct SEM * Semaphore, int ID, char * File, int Line);
void FreeSemaphore(struct SEM * Semaphore);
void MySetWindowText(HWND hWnd, char * Msg);
void MySetWindowText(struct TNCINFO * TNC, HWND hWnd, char * Msg);
Dll int APIENTRY SessionControl(int stream, int command, int Mask);
@ -396,9 +396,14 @@ extern UCHAR AuthorisedProgram; // Local Variable. Set if Program is on secure
extern int REALTIMETICKS;
extern time_t CurrentSecs;
extern time_t lastSlowSecs;
extern time_t lastSaveSecs;
extern time_t NOW; // From time()
extern time_t lastMinuteSecs; // Time minute process last run
extern time_t lastHourSecs; // Time hour process last run
extern time_t lastTenSecSecs;
extern uint64_t last100mSTickCount;
extern uint64_t lastSecTickCount;
// SNMP Variables
@ -438,6 +443,7 @@ extern char MQTT_PASS[80];
extern int SUPPORT2point2;
extern char * DevWebPage[MaxBPQPortNo];
DllExport uint64_t APIENTRY GetPortFrequency(int PortNo, char * FreqStringMhz);

@ -703,7 +703,7 @@ BOOL ProcessConfig()
/*
// Dump to file for debugging
sprintf_s(inputname, sizeof(inputname), "CFG%d", time(NULL));
sprintf_s(inputname, sizeof(inputname), "CFG%d", NOW);
fp1 = fopen(inputname, "wb");
@ -1702,6 +1702,13 @@ int routes(int i)
Route->inp3 = atoi(val);
}
else if (strcmp(ptr, "NPR") == 0)
{
char * val = strtok_s(NULL, " ,=", &context);
if (val)
Route->NPR = atoi(val);
}
else if (strcmp(ptr, "NOKEEPALIVES") == 0)
{
char * val = strtok_s(NULL, " ,=", &context);

@ -101,6 +101,7 @@ struct ROUTECONFIG
int ppacl;
int farQual;
int inp3;
int NPR;
int nokeepalives;
int noV2point2;
char * tcphost;

@ -66,8 +66,15 @@ UCHAR PACTORCALL[7] = {'P'+'P','A'+'A','C'+'C','T'+'T','O'+'O','R'+'R'}; //PACTO
UCHAR L3RTT[7] = {'L'+'L','3'+'3','R'+'R','T'+'T','T'+'T',0x40, 0xe0}; // L3RTT IN AX25
UCHAR L3KEEP[7] = {'K'+'K','E'+'E','E'+'E','P'+'P','L'+'L','I'+'I', 0xe0}; // KEEPLI IN AX25
time_t CurrentSecs;
time_t lastSlowSecs;
time_t NOW; // From time()
time_t lastMinuteSecs; // Time minute process last run
time_t lastHourSecs; // Time hour process last run
time_t lastTenSecSecs;
uint64_t last100mSTickCount;
uint64_t lastSecTickCount;
time_t lastSaveSecs;
char WL2KCall[10] = "";

@ -1593,7 +1593,7 @@ SeeifMore:
// If a response to a qtsm command display it
if (PORT->Session && (time(NULL) - PORT->LastKISSCmdTime < 10))
if (PORT->Session && (NOW - PORT->LastKISSCmdTime < 10))
{
PDATAMESSAGE Buffer;
BPQVECSTRUC * VEC;
@ -1666,7 +1666,7 @@ SeeifMore:
// If a reply to a manual KISS command(Session set and time not too long ago)
// send reponse to terminal
if (PORT->Session && (time(NULL) - PORT->LastKISSCmdTime < 10))
if (PORT->Session && (NOW - PORT->LastKISSCmdTime < 10))
{
PDATAMESSAGE Buffer;
BPQVECSTRUC * VEC;
@ -2198,16 +2198,24 @@ int KISSGetTCPMessage(NPASYINFO ASY)
{
// Bind Failed
int err = WSAGetLastError();
Consoleprintf("Bind Failed for KISS TCP port %d - error code = %d", ASY->Portvector->ListenPort, err);
if (ASY->Alerted == FALSE)
{
int err = WSAGetLastError();
Consoleprintf("Bind Failed for KISS TCP port %d - error code = %d", ASY->Portvector->ListenPort, err);
ASY->Alerted = TRUE;
}
closesocket(sock);
}
else
{
if (listen(sock, 1) < 0)
{
int err = WSAGetLastError();
Consoleprintf("Listen Failed for KISS TCP port %d - error code = %d", ASY->Portvector->ListenPort, err);
if (ASY->Alerted == FALSE)
{
int err = WSAGetLastError();
Consoleprintf("Listen Failed for KISS TCP port %d - error code = %d", ASY->Portvector->ListenPort, err);
ASY->Alerted = TRUE;
}
closesocket(sock);
}
else

@ -31,7 +31,7 @@ void MQTTSendStatus()
strcpy(payload,"{\"status\":\"online\"}");
MQTTSend(topic, payload, strlen(payload));
MQTTLastStatus = time(NULL);
MQTTLastStatus = NOW;
}
void MQTTTimer()
@ -39,7 +39,7 @@ void MQTTTimer()
if (MQTT_Connecting == 0 && MQTT_Connected == 0)
MQTTConnect(MQTT_HOST, MQTT_PORT, MQTT_USER, MQTT_PASS);
if ((time(NULL) - MQTTLastStatus) > 1800)
if ((NOW - MQTTLastStatus) > 1800)
MQTTSendStatus();
}

@ -246,7 +246,7 @@ Token * generate_token()
token->token[i] = 'A' + rand() % 26; // Random uppercase alphabet character
}
token->token[TOKEN_SIZE] = '\0'; // Null-terminate the token
token->expiration_time = time(NULL) + TOKEN_EXPIRATION; // Set token expiration time
token->expiration_time = NOW + TOKEN_EXPIRATION; // Set token expiration time
add_token_to_list(token);
return token;
}
@ -280,7 +280,7 @@ int verify_token(const char* token)
if (existing_token != NULL)
{
// Check if the token has expired
time_t current_time = time(NULL);
time_t current_time = NOW;
if (current_time > existing_token->expiration_time)
{
// Token has expired, remove it from the token list
@ -297,7 +297,7 @@ int verify_token(const char* token)
void remove_expired_tokens()
{
time_t current_time = time(NULL);
time_t current_time = NOW;
Token* current_token = token_list;
Token* prev_token = NULL;
Token* next_token;

@ -17,6 +17,10 @@ extern HANDLE hInstance;
extern HMENU hMainFrameMenu;
extern HMENU hWndMenu;
void BuildDevicePage(struct TNCINFO * TNC);
/*
struct WL2KInfo
{
@ -812,7 +816,13 @@ typedef struct TNCINFO
char * WEB_RESTARTS;
char * WEB_PACTORLEVEL;
char * WEB_LEVELS;
int WEB_CHANGED; // Used to speed up refresh when active
char WEB_CHANGED; // Used to speed up refresh when active
char WebSockUsed; // If not set don't build page
char PageChanged; // Set when page could have changed
char * WebPage; // Device Web Page. Used for Websocks refresh
int WebPageLen;
HMENU hMenu;
HMENU hWndMenu;
@ -863,9 +873,9 @@ typedef struct TNCINFO
int NRCloseTimer;
struct _LINKTABLE * DummyLink; // Simulated link to simplify interface to ax,25 netrom code
struct sixPackPortInfo * sixPack;
int VaraACAllowed; // Set by config
int VaraACMode; // Set by first message received
int VaraModeSet; // Have decicded if VarAC mode or not
char VaraACAllowed; // Set by config
char VaraACMode; // Set by first message received
char VaraModeSet; // Have decicded if VarAC mode or not
char * VARACMsg; // to build message from packets
int VarACTimer; // delayed send timer
size_t VARACSize; // malloc'ed size

Loading…
Cancel
Save

Powered by TurnKey Linux.