New upstream version 6.0.24.53+repack

This commit is contained in:
Hibby 2024-12-03 00:27:57 +00:00
parent 697fde3123
commit 96c573931d
27 changed files with 12819 additions and 111 deletions

View File

@ -292,8 +292,7 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff)
{ {
// Send Error Response // Send Error Response
buffptr->Len = 36; buffptr->Len = sprintf(buffptr->Data, "No Connection to PACTOR TNC\r");
memcpy(buffptr->Data, "No Connection to PACTOR TNC\r", 36);
C_Q_ADD(&TNC->Streams[Stream].PACTORtoBPQ_Q, buffptr); C_Q_ADD(&TNC->Streams[Stream].PACTORtoBPQ_Q, buffptr);

121
AGWAPI.c
View File

@ -1017,6 +1017,7 @@ int AGWDataSocket_Read(struct AGWSocketConnectionInfo * sockptr, SOCKET sock)
{ {
int i; int i;
int DataLength; int DataLength;
struct AGWHeader * AGW = &sockptr->AGWRXHeader;
ioctlsocket(sock,FIONREAD,&DataLength); ioctlsocket(sock,FIONREAD,&DataLength);
@ -1028,6 +1029,56 @@ int AGWDataSocket_Read(struct AGWSocketConnectionInfo * sockptr, SOCKET sock)
return 0; return 0;
} }
if (DataLength < 36) // A header
{
// If we don't get a header within a few ms assume a rogue connection and close it
int n = 50;
while (n--)
{
Sleep(10);
ioctlsocket(sock,FIONREAD,&DataLength);
if (DataLength >= 36)
break;
}
if (n < 1)
{
Debugprintf("Corrupt AGW Packet Received");
AGWDataSocket_Disconnect(sockptr);
return 0;
}
}
// Have a header
i=recv(sock,(char *)&sockptr->AGWRXHeader, 36, 0);
if (i == SOCKET_ERROR)
{
i=WSAGetLastError();
AGWDataSocket_Disconnect(sockptr);
}
sockptr->MsgDataLength = sockptr->AGWRXHeader.DataLength;
// Validate packet to protect against accidental (or malicious!) connects from a non-agw application
if (AGW->Port > 64 || AGW->filler2 != 0 || AGW->filler3 != 0 || AGW->DataLength > 400)
{
Debugprintf("Corrupt AGW Packet Received");
AGWDataSocket_Disconnect(sockptr);
return 0;
}
if (sockptr->MsgDataLength == 0)
ProcessAGWCommand (sockptr);
else
sockptr->GotHeader = TRUE; // Wait for data
ioctlsocket(sock,FIONREAD,&DataLength); // See if more data
if (sockptr->GotHeader) if (sockptr->GotHeader)
{ {
@ -1035,11 +1086,26 @@ int AGWDataSocket_Read(struct AGWSocketConnectionInfo * sockptr, SOCKET sock)
if (DataLength < sockptr->MsgDataLength) if (DataLength < sockptr->MsgDataLength)
{ {
// Fiddle - seem to be problems somtimes with un-Neagled hosts // Fiddle - seem to be problems somtimes with un-Neagled hosts so wait a few ms
// if we don't get a full packet assume a rogue connection and close it
Sleep(500); int n = 50;
while (n--)
{
Sleep(10);
ioctlsocket(sock,FIONREAD,&DataLength); ioctlsocket(sock,FIONREAD,&DataLength);
if (DataLength >= sockptr->MsgDataLength)
break;
}
if (n < 1)
{
Debugprintf("Corrupt AGW Packet Received");
AGWDataSocket_Disconnect(sockptr);
return 0;
}
} }
if (DataLength >= sockptr->MsgDataLength) if (DataLength >= sockptr->MsgDataLength)
@ -1052,60 +1118,9 @@ int AGWDataSocket_Read(struct AGWSocketConnectionInfo * sockptr, SOCKET sock)
ProcessAGWCommand (sockptr); ProcessAGWCommand (sockptr);
free(sockptr->MsgData); free(sockptr->MsgData);
sockptr->GotHeader = FALSE; sockptr->GotHeader = FALSE;
} }
// Not Enough Data - wait
} }
else // Not got header
{
if (DataLength > 35)// A header
{
struct AGWHeader * AGW = &sockptr->AGWRXHeader;
i=recv(sock,(char *)&sockptr->AGWRXHeader, 36, 0);
if (i == SOCKET_ERROR)
{
i=WSAGetLastError();
AGWDataSocket_Disconnect(sockptr);
}
sockptr->MsgDataLength = sockptr->AGWRXHeader.DataLength;
// Validate packet to protect against accidental (or malicious!) connects from a non-agw application
if (AGW->Port > 64 || AGW->filler2 != 0 || AGW->filler3 != 0 || AGW->DataLength > 400)
{
Debugprintf("Corrupt AGW Packet Received");
AGWDataSocket_Disconnect(sockptr);
return 0;
}
if (sockptr->MsgDataLength > 500)
OutputDebugString("Corrupt AGW message");
if (sockptr->MsgDataLength == 0)
{
ProcessAGWCommand (sockptr);
}
else
{
sockptr->GotHeader = TRUE; // Wait for data
}
}
// not got 36 bytes
}
return 0; return 0;
} }

View File

@ -88,7 +88,7 @@ double myDistance(double laa, double loa, BOOL KM);
struct STATIONRECORD * FindStation(char * Call, BOOL AddIfNotFound); struct STATIONRECORD * FindStation(char * Call, BOOL AddIfNotFound);
int DecodeAPRSPayload(char * Payload, struct STATIONRECORD * Station); int DecodeAPRSPayload(char * Payload, struct STATIONRECORD * Station);
BOOL KillOldTNC(char * Path); BOOL KillOldTNC(char * Path);
int FromLOC(char * Locator, double * pLat, double * pLon);
BOOL ToLOC(double Lat, double Lon , char * Locator); BOOL ToLOC(double Lat, double Lon , char * Locator);
BOOL InternalSendAPRSMessage(char * Text, char * Call); BOOL InternalSendAPRSMessage(char * Text, char * Call);
void UndoTransparency(char * input); void UndoTransparency(char * input);
@ -104,6 +104,7 @@ void ClearSavedMessages();
void GetSavedAPRSMessages(); void GetSavedAPRSMessages();
static VOID GPSDConnect(void * unused); static VOID GPSDConnect(void * unused);
int CanPortDigi(int Port); int CanPortDigi(int Port);
int FromLOC(char * Locator, double * pLat, double * pLon);
extern int SemHeldByAPI; extern int SemHeldByAPI;
extern int APRSMONDECODE(); extern int APRSMONDECODE();

View File

@ -5565,15 +5565,20 @@ BOOL CreateMessage(CIRCUIT * conn, char * From, char * ToCall, char * ATBBS, cha
else else
{ {
if (_memicmp(ToCall, "rms:", 4) == 0) if (_memicmp(ToCall, "rms:", 4) == 0)
{
// Could be ampr.org message
if (!isAMPRMsg(ToCall))
{ {
if (!FindRMS()) if (!FindRMS())
{ {
nodeprintf(conn, "*** Error - Forwarding via RMS is not configured on this BBS\r"); nodeprintf(conn, "*** Error - Forwarding via RMS is not configured on this BBS\r");
return FALSE; return FALSE;
} }
}
via=strlop(ToCall, ':'); via=strlop(ToCall, ':');
_strupr(ToCall); _strupr(ToCall);
} }
else if (_memicmp(ToCall, "rms/", 4) == 0) else if (_memicmp(ToCall, "rms/", 4) == 0)
{ {
@ -6877,7 +6882,7 @@ int CountMessagestoForward (struct UserInfo * user)
if ((Msg->status != 'H') && (Msg->status != 'D') && Msg->type && check_fwd_bit(Msg->fbbs, BBSNumber)) if ((Msg->status != 'H') && (Msg->status != 'D') && Msg->type && check_fwd_bit(Msg->fbbs, BBSNumber))
{ {
n++; n++;
continue; // So we dont count twice in Flag set and NTS MPS continue; // So we dont count twice if Flag set and NTS MPS
} }
// if an NTS MPS, also check for any matches // if an NTS MPS, also check for any matches
@ -6918,6 +6923,66 @@ int CountMessagestoForward (struct UserInfo * user)
return n; return n;
} }
int CountBytestoForward (struct UserInfo * user)
{
// See if any messages are queued for this BBS. If so return total bytes queued
int m, n=0;
struct MsgInfo * Msg;
int BBSNumber = user->BBSNumber;
int FirstMessage = FirstMessageIndextoForward;
if ((user->flags & F_NTSMPS))
FirstMessage = 1;
for (m = FirstMessage; m <= NumberofMessages; m++)
{
Msg=MsgHddrPtr[m];
if ((Msg->status != 'H') && (Msg->status != 'D') && Msg->type && check_fwd_bit(Msg->fbbs, BBSNumber))
{
n += Msg->length;
continue; // So we dont count twice if Flag set and NTS MPS
}
// if an NTS MPS, also check for any matches
if (Msg->type == 'T' && (user->flags & F_NTSMPS))
{
struct BBSForwardingInfo * ForwardingInfo = user->ForwardingInfo;
int depth;
if (Msg->status == 'N' && ForwardingInfo)
{
depth = CheckBBSToForNTS(Msg, ForwardingInfo);
if (depth > -1 && Msg->Locked == 0)
{
n += Msg->length;
continue;
}
depth = CheckBBSAtList(Msg, ForwardingInfo, Msg->via);
if (depth && Msg->Locked == 0)
{
n += Msg->length;
continue;
}
depth = CheckBBSATListWildCarded(Msg, ForwardingInfo, Msg->via);
if (depth > -1 && Msg->Locked == 0)
{
n += Msg->length;
continue;
}
}
}
}
return n;
}
int ListMessagestoForward(CIRCUIT * conn, struct UserInfo * user) int ListMessagestoForward(CIRCUIT * conn, struct UserInfo * user)
{ {
// See if any messages are queued for this BBS // See if any messages are queued for this BBS
@ -15823,6 +15888,11 @@ void SendMessageReadEvent(char * call, struct MsgInfo * Msg)
} }
} }
void SendMessageForwardedToM0LTE(char * call, struct MsgInfo * Msg)
{
}
void SendNewMessageEvent(char * call, struct MsgInfo * Msg) void SendNewMessageEvent(char * call, struct MsgInfo * Msg)
{ {
if (reportMailEvents) if (reportMailEvents)

View File

@ -3396,7 +3396,6 @@ BOOL Initialise()
CreatePipeThread(); CreatePipeThread();
GetPGConfig(); GetPGConfig();
APIClock = 0; APIClock = 0;
return TRUE; return TRUE;

View File

@ -1236,6 +1236,8 @@ along with LinBPQ/BPQ32. If not, see http://www.gnu.org/licenses
// AGWAPI Add protection against accidental connects from a non-agw application (50) // AGWAPI Add protection against accidental connects from a non-agw application (50)
// Save MH and NODES every hour (51) // Save MH and NODES every hour (51)
// Fix handling long unix device names (now max 250 bytes) (52) // Fix handling long unix device names (now max 250 bytes) (52)
// Fix error reporting in api update (53)
// Coding changes to remove some compiler warnings (53)
#define CKernel #define CKernel

View File

@ -398,6 +398,7 @@ extern int REALTIMETICKS;
extern time_t CurrentSecs; extern time_t CurrentSecs;
extern time_t lastSlowSecs; extern time_t lastSlowSecs;
extern time_t lastSaveSecs;
// SNMP Variables // SNMP Variables

5989
Cmd-skigdebian.c Normal file

File diff suppressed because it is too large Load Diff

View File

@ -4912,7 +4912,7 @@ SOCKET OpenHTTPSock(char * Host)
{ {
err = WSAGetLastError(); err = WSAGetLastError();
Debugprintf("Resolve Failed for %s %d %x", "api.winlink.org", err, err); Debugprintf("Resolve Failed for %s %d %x", Host, err, err);
return 0 ; // Resolve failed return 0 ; // Resolve failed
} }
@ -4945,7 +4945,7 @@ SOCKET OpenHTTPSock(char * Host)
} }
static char HeaderTemplate[] = "POST %s HTTP/1.1\r\n" static char HeaderTemplate[] = "POST %s HTTP/1.1\r\n"
"Accept: application/json\r\n" "Accept: app N B lication/json\r\n"
// "Accept-Encoding: gzip,deflate,gzip, deflate\r\n" // "Accept-Encoding: gzip,deflate,gzip, deflate\r\n"
"Content-Type: application/json\r\n" "Content-Type: application/json\r\n"
"Host: %s:%d\r\n" "Host: %s:%d\r\n"
@ -4955,14 +4955,24 @@ static char HeaderTemplate[] = "POST %s HTTP/1.1\r\n"
"\r\n"; "\r\n";
VOID SendWebRequest(SOCKET sock, char * Host, char * Request, char * Params, int Len, char * Return) DllExport VOID WINAPI SendWebRequest(char * Host, char * Request, char * Params, char * Return)
{ {
SOCKET sock;
int InputLen = 0; int InputLen = 0;
int inptr = 0; int inptr = 0;
char Buffer[4096]; char Buffer[4096];
char Header[256]; char Header[256];
char * ptr, * ptr1; char * ptr, * ptr1;
int Sent; int Sent;
int Len = strlen(Params);
if (M0LTEMap == 0)
return;
sock = OpenHTTPSock(Host);
if (sock == 0)
return;
#ifdef LINBPQ #ifdef LINBPQ
sprintf(Header, HeaderTemplate, Request, Host, 80, Len, "linbpq/", VersionString, Params); sprintf(Header, HeaderTemplate, Request, Host, 80, Len, "linbpq/", VersionString, Params);
@ -4976,6 +4986,7 @@ VOID SendWebRequest(SOCKET sock, char * Host, char * Request, char * Params, int
{ {
int Err = WSAGetLastError(); int Err = WSAGetLastError();
Debugprintf("Error %d from Web Update send()", Err); Debugprintf("Error %d from Web Update send()", Err);
closesocket(sock);
return; return;
} }
@ -4987,12 +4998,10 @@ VOID SendWebRequest(SOCKET sock, char * Host, char * Request, char * Params, int
{ {
int Err = WSAGetLastError(); int Err = WSAGetLastError();
Debugprintf("Error %d from Web Update recv()", Err); Debugprintf("Error %d from Web Update recv()", Err);
closesocket(sock);
return; return;
} }
// As we are using a persistant connection, can't look for close. Check
// for complete message
inptr += InputLen; inptr += InputLen;
Buffer[inptr] = 0; Buffer[inptr] = 0;
@ -5031,10 +5040,9 @@ VOID SendWebRequest(SOCKET sock, char * Host, char * Request, char * Params, int
else else
{ {
strlop(Buffer, 13); strlop(Buffer, 13);
Debugprintf("Map Update Params - %s", Params);
Debugprintf("Map Update failed - %s", Buffer); Debugprintf("Map Update failed - %s", Buffer);
} }
closesocket(sock);
return; return;
} }
} }
@ -5046,6 +5054,7 @@ VOID SendWebRequest(SOCKET sock, char * Host, char * Request, char * Params, int
{ {
// Just accept anything until I've sorted things with Lee // Just accept anything until I've sorted things with Lee
Debugprintf("%s", ptr1); Debugprintf("%s", ptr1);
closesocket(sock);
Debugprintf("Web Database update ok"); Debugprintf("Web Database update ok");
return; return;
} }
@ -5584,19 +5593,11 @@ void SendDataToPktMap(char *Msg)
} }
], ],
*/ */
// "contact": "string", // "contact": "string",
// "neighbours": [{"node": "G7TAJ","port": "30"}] // "neighbours": [{"node": "G7TAJ","port": "30"}]
sock = OpenHTTPSock("packetnodes.spots.radio"); SendWebRequest("packetnodes.spots.radio", Request, Params, Return);
if (sock == 0)
return;
SendWebRequest(sock, "packetnodes.spots.radio", Request, Params, strlen(Params), Return);
closesocket(sock);
} }
// ="{\"neighbours\": [{\"node\": \"G7TAJ\",\"port\": \"30\"}]}"; // ="{\"neighbours\": [{\"node\": \"G7TAJ\",\"port\": \"30\"}]}";

View File

@ -168,7 +168,7 @@ int AllocateDRATSStream(struct DRATSSession * Sess)
if (Stream == 255) return 0; if (Stream == 255) return 0;
if (memcmp(Sess->CallTo, "NODE", 6) == 0) if (memcmp(Sess->CallTo, "NODE", 4) == 0)
{ {
// Just connect to command level on switch // Just connect to command level on switch
} }

View File

@ -93,6 +93,7 @@ VOID CheckFLDigiData(struct TNCINFO * TNC);
VOID SendPacket(struct TNCINFO * TNC, UCHAR * Msg, int MsgLen); VOID SendPacket(struct TNCINFO * TNC, UCHAR * Msg, int MsgLen);
int KissEncode(UCHAR * inbuff, UCHAR * outbuff, int len); int KissEncode(UCHAR * inbuff, UCHAR * outbuff, int len);
VOID SendXMLCommand(struct TNCINFO * TNC, char * Command, char * Value, char ParamType); VOID SendXMLCommand(struct TNCINFO * TNC, char * Command, char * Value, char ParamType);
VOID SendXMLCommandInt(struct TNCINFO * TNC, char * Command, int Value, char ParamType);
VOID FLSlowTimer(struct TNCINFO * TNC); VOID FLSlowTimer(struct TNCINFO * TNC);
VOID SendKISSCommand(struct TNCINFO * TNC, char * Msg); VOID SendKISSCommand(struct TNCINFO * TNC, char * Msg);
@ -592,7 +593,7 @@ pollloop:
} }
else else
{ {
SendXMLCommand(TNC, "modem.set_carrier", (char *)atoi(&buff->L2DATA[5]), 'I'); SendXMLCommandInt(TNC, "modem.set_carrier", atoi(&buff->L2DATA[5]), 'I');
} }
TNC->InternalCmd = TRUE; TNC->InternalCmd = TRUE;
@ -3197,7 +3198,7 @@ VOID FLReleaseTNC(struct TNCINFO * TNC)
else else
{ {
SendXMLCommand(TNC, "modem.set_by_name", TNC->FLInfo->DefaultMode, 'S'); SendXMLCommand(TNC, "modem.set_by_name", TNC->FLInfo->DefaultMode, 'S');
SendXMLCommand(TNC, "modem.set_carrier", (char *)TNC->FLInfo->DefaultFreq, 'I'); SendXMLCommandInt(TNC, "modem.set_carrier", TNC->FLInfo->DefaultFreq, 'I');
} }
} }
// Start Scanner // Start Scanner
@ -3895,6 +3896,27 @@ VOID SendXMLCommand(struct TNCINFO * TNC, char * Command, char * Value, char Par
return; return;
} }
VOID SendXMLCommandInt(struct TNCINFO * TNC, char * Command, int Value, char ParamType)
{
int Len;
char ReqBuf[512];
char SendBuff[512];
struct FLINFO * FL = TNC->FLInfo;
struct ARQINFO * ARQ = TNC->ARQInfo;
char ValueString[256] ="";
if (!TNC->CONNECTED || TNC->FLInfo->KISSMODE)
return;
sprintf(ValueString, "<params><param><value><i4>%d</i4></value></param></params\r\n>", Value);
strcpy(FL->LastXML, Command);
Len = sprintf(ReqBuf, Req, FL->LastXML, ValueString);
Len = sprintf(SendBuff, MsgHddr, Len, ReqBuf);
send(TNC->TCPSock, SendBuff, Len, 0);
return;
}
VOID SendXMLPoll(struct TNCINFO * TNC) VOID SendXMLPoll(struct TNCINFO * TNC)
{ {
int Len; int Len;

4143
L2Code-skigdebian.c Normal file

File diff suppressed because it is too large Load Diff

2416
L4Code-skigdebian.c Normal file

File diff suppressed because it is too large Load Diff

View File

@ -76,6 +76,7 @@ void SaveAIS();
void initAIS(); void initAIS();
void DRATSPoll(); void DRATSPoll();
VOID GetPGConfig(); VOID GetPGConfig();
void SendBBSDataToPktMap();
extern uint64_t timeLoadedMS; extern uint64_t timeLoadedMS;
@ -1281,6 +1282,10 @@ int main(int argc, char * argv[])
printf("Mail Started\n"); printf("Mail Started\n");
Logprintf(LOG_BBS, NULL, '!', "Mail Starting"); Logprintf(LOG_BBS, NULL, '!', "Mail Starting");
APIClock = 0;
SendBBSDataToPktMap();
} }
} }
@ -1579,6 +1584,13 @@ int main(int argc, char * argv[])
DoHouseKeeping(FALSE); DoHouseKeeping(FALSE);
} }
if (APIClock < NOW)
{
SendBBSDataToPktMap();
APIClock = NOW + 7200; // Every 2 hours
}
tm = gmtime(&NOW); tm = gmtime(&NOW);
if (tm->tm_wday == 0) // Sunday if (tm->tm_wday == 0) // Sunday

View File

@ -205,6 +205,7 @@ int MailForInterval = 0;
char zeros[NBMASK]; // For forward bitmask tests char zeros[NBMASK]; // For forward bitmask tests
time_t MaintClock; // Time to run housekeeping time_t MaintClock; // Time to run housekeeping
time_t APIClock; // Time to sent to MOLTE's Database
struct MsgInfo * MsgnotoMsg[100000]; // Message Number to Message Slot List. struct MsgInfo * MsgnotoMsg[100000]; // Message Number to Message Slot List.

View File

@ -2897,6 +2897,8 @@ SocketConn * SMTPConnect(char * Host, int Port, BOOL AMPR, struct MsgInfo * Msg,
sinx.sin_addr.s_addr = INADDR_ANY; sinx.sin_addr.s_addr = INADDR_ANY;
sinx.sin_port = 0; sinx.sin_port = 0;
sockptr->Timeout = 0;
if (bind(sockptr->socket, (LPSOCKADDR) &sinx, addrlen) != 0 ) if (bind(sockptr->socket, (LPSOCKADDR) &sinx, addrlen) != 0 )
{ {
// //
@ -3590,7 +3592,6 @@ VOID ProcessPOP3ClientMessage(SocketConn * sockptr, char * Buffer, int Len)
if (sockptr->POP3MsgCount > sockptr->POP3MsgNum++) if (sockptr->POP3MsgCount > sockptr->POP3MsgNum++)
{ {
sockprintf(sockptr, "RETR %d", sockptr->POP3MsgNum); sockprintf(sockptr, "RETR %d", sockptr->POP3MsgNum);
sockptr->State = WaitingForRETRResponse; sockptr->State = WaitingForRETRResponse;
} }
else else

View File

@ -612,15 +612,15 @@ struct MSESSION * FindMSession(unsigned int Key)
#define LZMA_STR "\1LZMA" #define LZMA_STR "\1LZMA"
UCHAR * LZUncompress(UCHAR * Decoded, int Len, int * NewLen) UCHAR * LZUncompress(UCHAR * Decoded, size_t Len, size_t * NewLen)
{ {
unsigned char * buf; unsigned char * buf;
unsigned char inprops[LZMA_PROPS_SIZE]; unsigned char inprops[LZMA_PROPS_SIZE];
size_t inlen; size_t inlen;
int r; int r;
UINT rlen; size_t rlen = 0;
UINT outlen; size_t outlen;
memcpy(&rlen, &Decoded[5], 4); memcpy(&rlen, &Decoded[5], 4);
@ -668,8 +668,8 @@ void SaveMulticastMessage(struct MSESSION * MSession)
{ {
UCHAR * Decoded = NULL; // Output from Basexxx decode UCHAR * Decoded = NULL; // Output from Basexxx decode
UCHAR * Uncompressed = NULL; UCHAR * Uncompressed = NULL;
int DecodedLen; // Length of decoded message size_t DecodedLen; // Length of decoded message
int UncompressedLen; // Length of decompressed message size_t UncompressedLen; // Length of decompressed message
int ExpectedLen; // From front of Base128 or Base256 message int ExpectedLen; // From front of Base128 or Base256 message
int HddrLen; // Length of Expected Len Header int HddrLen; // Length of Expected Len Header

View File

@ -10,14 +10,14 @@
#endif #endif
#define KVers 6,0,24,52 #define KVers 6,0,24,53
#define KVerstring "6.0.24.52\0" #define KVerstring "6.0.24.53\0"
#ifdef CKernel #ifdef CKernel
#define Vers KVers #define Vers KVers
#define Verstring KVerstring #define Verstring KVerstring
#define Datestring "November 2024" #define Datestring "December 2024"
#define VerComments "G8BPQ Packet Switch (C Version)" KVerstring #define VerComments "G8BPQ Packet Switch (C Version)" KVerstring
#define VerCopyright "Copyright © 2001-2024 John Wiseman G8BPQ\0" #define VerCopyright "Copyright © 2001-2024 John Wiseman G8BPQ\0"
#define VerDesc "BPQ32 Switch\0" #define VerDesc "BPQ32 Switch\0"

View File

@ -1416,7 +1416,7 @@ int CreateWPMessage()
// if (ptr->last_modif > LASTWPSendTime && ptr->Type == 'U' && ptr->first_homebbs[0]) // if (ptr->last_modif > LASTWPSendTime && ptr->Type == 'U' && ptr->first_homebbs[0])
if (ptr->changed && ptr->last_modif > LASTWPSendTime && ptr->first_homebbs[0]) if (ptr->changed && ptr->last_modif > LASTWPSendTime && ptr->first_homebbs[0])
{ {
tm = gmtime(&ptr->last_modif); tm = gmtime((time_t *)&ptr->last_modif);
MsgLen += sprintf(Buffptr, "On %02d%02d%02d %s/%c @ %s zip %s %s %s\r\n", MsgLen += sprintf(Buffptr, "On %02d%02d%02d %s/%c @ %s zip %s %s %s\r\n",
tm->tm_year-100, tm->tm_mon+1, tm->tm_mday, tm->tm_year-100, tm->tm_mon+1, tm->tm_mday,
ptr->callsign, ptr->Type, ptr->first_homebbs, ptr->callsign, ptr->Type, ptr->first_homebbs,
@ -1533,8 +1533,8 @@ VOID CreateWPReport()
len = sprintf(Line, "%-7s,%c,%s,%s,%s,%s,%s,%s,%s,%d,%s,%s\r\n", len = sprintf(Line, "%-7s,%c,%s,%s,%s,%s,%s,%s,%s,%d,%s,%s\r\n",
WP->callsign, WP->Type, WP->first_homebbs, WP->first_qth, WP->first_zip, WP->callsign, WP->Type, WP->first_homebbs, WP->first_qth, WP->first_zip,
WP->secnd_homebbs, WP->secnd_qth, WP->secnd_zip, WP->name, WP->changed, WP->secnd_homebbs, WP->secnd_qth, WP->secnd_zip, WP->name, WP->changed,
FormatWPDate(WP->last_modif), FormatWPDate((time_t)WP->last_modif),
FormatWPDate(WP->last_seen)); FormatWPDate((time_t)WP->last_seen));
fwrite(Line, 1, len, hFile); fwrite(Line, 1, len, hFile);
} }

1
adif.c
View File

@ -609,7 +609,6 @@ VOID ADIFWriteFreqList()
fprintf(Handle, "[Channels]\r\n"); fprintf(Handle, "[Channels]\r\n");
for (i = 0; i < freqCount; i++) for (i = 0; i < freqCount; i++)
fprintf(Handle, "Frequency %d=%lld\r\n" , i + 1, Freqs[i]); fprintf(Handle, "Frequency %d=%lld\r\n" , i + 1, Freqs[i]);

View File

@ -643,9 +643,9 @@ struct MsgInfo
// For 64 bit time_t compatibility define as long long // For 64 bit time_t compatibility define as long long
// (so struct is same with 32 or 64 bit time_t) // (so struct is same with 32 or 64 bit time_t)
long long datereceived; int64_t datereceived;
long long datecreated; int64_t datecreated;
long long datechanged; int64_t datechanged;
char Spare[61 - 24]; // For future use char Spare[61 - 24]; // For future use
} ; } ;
@ -1191,6 +1191,7 @@ BOOL FBBDoForward(CIRCUIT * conn);
BOOL FindMessagestoForward(CIRCUIT * conn); BOOL FindMessagestoForward(CIRCUIT * conn);
BOOL SeeifMessagestoForward(int BBSNumber, CIRCUIT * Conn); BOOL SeeifMessagestoForward(int BBSNumber, CIRCUIT * Conn);
int CountMessagestoForward(struct UserInfo * user); int CountMessagestoForward(struct UserInfo * user);
int CountBytestoForward(struct UserInfo * user);
VOID * GetMultiLineDialogParam(HWND hDialog, int DLGItem); VOID * GetMultiLineDialogParam(HWND hDialog, int DLGItem);
@ -1633,6 +1634,8 @@ extern char ** SendWPAddrs; // Replacers WP To and VIA
extern BOOL DontCheckFromCall; extern BOOL DontCheckFromCall;
extern time_t APIClock;;
// YAPP stuff // YAPP stuff
#define SOH 1 #define SOH 1

17
cMain.c
View File

@ -50,6 +50,7 @@ VOID SendSmartID(struct PORTCONTROL * PORT);
int CanPortDigi(int Port); int CanPortDigi(int Port);
int KissEncode(UCHAR * inbuff, UCHAR * outbuff, int len); int KissEncode(UCHAR * inbuff, UCHAR * outbuff, int len);
void MQTTTimer(); void MQTTTimer();
void SaveMH();
#include "configstructs.h" #include "configstructs.h"
@ -911,7 +912,7 @@ BOOL Start()
PORT->PROTOCOL = (char)PortRec->PROTOCOL; PORT->PROTOCOL = (char)PortRec->PROTOCOL;
PORT->IOBASE = PortRec->IOADDR; PORT->IOBASE = PortRec->IOADDR;
if (PortRec->SerialPortName[0]) if (PortRec->SerialPortName && PortRec->SerialPortName[0])
PORT->SerialPortName = _strdup(PortRec->SerialPortName); PORT->SerialPortName = _strdup(PortRec->SerialPortName);
else else
{ {
@ -1507,7 +1508,7 @@ BOOL Start()
upnpInit(); upnpInit();
CurrentSecs = lastSlowSecs = time(NULL); lastSaveSecs = CurrentSecs = lastSlowSecs = time(NULL);
return 0; return 0;
} }
@ -2106,6 +2107,18 @@ VOID TIMERINTERRUPT()
*/ */
} }
// Check Autosave Nodes and MH timer
if (CurrentSecs - lastSaveSecs >= 3600) // 1 per hour
{
lastSaveSecs = CurrentSecs;
if (AUTOSAVE == 1)
SaveNodes();
if (AUTOSAVEMH == 1)
SaveMH();
}
if (L4TIMERFLAG >= 10) // 1 PER SEC if (L4TIMERFLAG >= 10) // 1 PER SEC
{ {
L4TIMERFLAG -= 10; L4TIMERFLAG -= 10;

View File

@ -174,11 +174,16 @@ extern BOOL Loopflag;
extern char NodeMapServer[80]; extern char NodeMapServer[80];
extern char ChatMapServer[80]; extern char ChatMapServer[80];
double LatFromLOC;
double LonFromLOC;
VOID * zalloc(int len); VOID * zalloc(int len);
int WritetoConsoleLocal(char * buff); int WritetoConsoleLocal(char * buff);
char * stristr (char *ch1, char *ch2); char * stristr (char *ch1, char *ch2);
int FromLOC(char * Locator, double * pLat, double * pLon);
VOID Consoleprintf(const char * format, ...) VOID Consoleprintf(const char * format, ...)
{ {
@ -342,7 +347,7 @@ static int routine[] =
14, 14, 14, 14, 14, 14, 14, 14,
14, 14 ,14, 14, 14, 14 ,14, 14,
15, 0, 2, 9, 9, 15, 0, 2, 9, 9,
2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2,
2, 2, 0, 1, 20, 20} ; // Routine to process param 2, 2, 0, 1, 20, 20} ; // Routine to process param
int PARAMLIM = sizeof(routine)/sizeof(int); int PARAMLIM = sizeof(routine)/sizeof(int);
@ -924,11 +929,21 @@ NextAPRS:
strcat(LOCATOR, ":"); strcat(LOCATOR, ":");
strcat(LOCATOR, ptr2); strcat(LOCATOR, ptr2);
ToLOC(atof(ptr1), atof(ptr2), LOC); ToLOC(atof(ptr1), atof(ptr2), LOC);
LatFromLOC = atof(ptr1);
LonFromLOC = atof(ptr2);
} }
else else
{ {
if (strlen(ptr1) == 6) if (strlen(ptr1) == 6)
{
strcpy(LOC, ptr1); strcpy(LOC, ptr1);
FromLOC(LOC, &LatFromLOC, &LonFromLOC);
// Randomise in square
LatFromLOC += ((rand() / 24.0) / RAND_MAX);
LonFromLOC += ((rand() / 12.0) / RAND_MAX);
}
} }
} }
return 0; return 0;
@ -2409,7 +2424,7 @@ int doSerialPortName(int i, char * value, char * rec)
if (IsNumeric(rec)) if (IsNumeric(rec))
xxp.IOADDR = atoi(rec); xxp.IOADDR = atoi(rec);
else else
strcpy(xxp.SerialPortName, rec); xxp.SerialPortName = strdup(rec);
return 1; return 1;
} }

View File

@ -67,7 +67,7 @@ struct PORTCONFIG
char Pad2[10]; // 246 char Pad2[10]; // 246
char VALIDCALLS[256]; // 256 - 512 char VALIDCALLS[256]; // 256 - 512
struct WL2KInfo * WL2K; // 512 struct WL2KInfo * WL2K; // 512
char SerialPortName[80]; // 516 char * SerialPortName; // 516
struct XDIGI * XDIGIS; // 596 Cross port digi setup struct XDIGI * XDIGIS; // 596 Cross port digi setup
int RIGPORT; // Linked port with RigControl int RIGPORT; // Linked port with RigControl
unsigned int PERMITTEDAPPLS; // Appls allowed on this port unsigned int PERMITTEDAPPLS; // Appls allowed on this port

View File

@ -49,6 +49,9 @@ char MAPCOMMENT[250] = "";
char LOC[7] = ""; // Must be in shared mem// Maidenhead Locator for Reporting char LOC[7] = ""; // Must be in shared mem// Maidenhead Locator for Reporting
char ReportDest[7]; char ReportDest[7];
double LatFromLOC = 0;
double LonFromLOC = 0;
UCHAR BPQDirectory[260] = "."; UCHAR BPQDirectory[260] = ".";
UCHAR ConfigDirectory[260] = "."; UCHAR ConfigDirectory[260] = ".";
UCHAR LogDirectory[260] = ""; UCHAR LogDirectory[260] = "";
@ -62,6 +65,7 @@ UCHAR L3KEEP[7] = {'K'+'K','E'+'E','E'+'E','P'+'P','L'+'L','I'+'I', 0xe0}; // K
time_t CurrentSecs; time_t CurrentSecs;
time_t lastSlowSecs; time_t lastSlowSecs;
time_t lastSaveSecs;
char WL2KCall[10] = ""; char WL2KCall[10] = "";
char WL2KLoc[7] = ""; char WL2KLoc[7] = "";

View File

@ -768,6 +768,9 @@ BOOL CheckifPacket(char * Via)
if (FindContinent(ptr1)) if (FindContinent(ptr1))
return TRUE; // Packet return TRUE; // Packet
if (FindCountry(ptr1))
return TRUE; // Packet
if ((_stricmp(ptr1, "MARS") == 0) || (_stricmp(ptr1, "USA") == 0)) // MARS used both if ((_stricmp(ptr1, "MARS") == 0) || (_stricmp(ptr1, "USA") == 0)) // MARS used both
return TRUE; // Packet return TRUE; // Packet

View File

@ -869,7 +869,6 @@ double LonFromLOC = 0;
void SendBBSDataToPktMap() void SendBBSDataToPktMap()
{ {
char Return[4096];
char Request[64]; char Request[64];
char * Params; char * Params;
char * ptr; char * ptr;
@ -967,7 +966,7 @@ void SendBBSDataToPktMap()
CheckifRoutable(Msg); CheckifRoutable(Msg);
tm = gmtime(&Msg->datereceived); tm = gmtime((time_t *)&Msg->datereceived);
sprintf(Time, "%04d-%02d-%02dT%02d:%02d:%02d+00:00", sprintf(Time, "%04d-%02d-%02dT%02d:%02d:%02d+00:00",
tm->tm_year + 1900, tm->tm_mon+1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec); tm->tm_year + 1900, tm->tm_mon+1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec);
@ -1101,7 +1100,7 @@ int unroutableCount = 0;
ptr += sprintf(ptr, "\"location\": \"%s\",\r\n", ourBBSRec->Address); ptr += sprintf(ptr, "\"location\": \"%s\",\r\n", ourBBSRec->Address);
ptr += sprintf(ptr, "\"unroutable\": %s\r\n}\r\n", Unroutables); ptr += sprintf(ptr, "\"unroutable\": %s\r\n}\r\n", Unroutables);
SendWebRequest("packetnodes.spots.radio", Request, Params, Return); SendWebRequest("packetnodes.spots.radio", Request, Params, 0);
free(Messages); free(Messages);
free(Unroutables); free(Unroutables);
free(Params); free(Params);