Compare commits
2 Commits
d09a168608
...
3a600bee23
Author | SHA1 | Date |
---|---|---|
Hibby | 3a600bee23 | |
Hibby | d1c36fce6e |
123
AGWAPI.c
123
AGWAPI.c
|
@ -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;
|
||||||
|
|
||||||
ioctlsocket(sock,FIONREAD,&DataLength);
|
while (n--)
|
||||||
|
{
|
||||||
|
Sleep(10);
|
||||||
|
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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();
|
||||||
|
|
|
@ -5566,14 +5566,19 @@ BOOL CreateMessage(CIRCUIT * conn, char * From, char * ToCall, char * ATBBS, cha
|
||||||
{
|
{
|
||||||
if (_memicmp(ToCall, "rms:", 4) == 0)
|
if (_memicmp(ToCall, "rms:", 4) == 0)
|
||||||
{
|
{
|
||||||
if (!FindRMS())
|
// Could be ampr.org message
|
||||||
{
|
|
||||||
nodeprintf(conn, "*** Error - Forwarding via RMS is not configured on this BBS\r");
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if (!isAMPRMsg(ToCall))
|
||||||
|
{
|
||||||
|
if (!FindRMS())
|
||||||
|
{
|
||||||
|
nodeprintf(conn, "*** Error - Forwarding via RMS is not configured on this BBS\r");
|
||||||
|
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)
|
||||||
|
|
18
BPQMail.c
18
BPQMail.c
|
@ -1143,6 +1143,8 @@
|
||||||
// Semaphore calls to SaveConfig
|
// Semaphore calls to SaveConfig
|
||||||
// Include SERVIC as valid from call (for Winlink Service messages) (49)
|
// Include SERVIC as valid from call (for Winlink Service messages) (49)
|
||||||
// Attempt to detect line draw characters in Webmail (50)
|
// Attempt to detect line draw characters in Webmail (50)
|
||||||
|
// Fix sending ampr.org mail when RMS is not enabled (51)
|
||||||
|
// Send forwarding info to packetnodes.spots.radio database (51)
|
||||||
|
|
||||||
#include "bpqmail.h"
|
#include "bpqmail.h"
|
||||||
#include "winstdint.h"
|
#include "winstdint.h"
|
||||||
|
@ -1161,6 +1163,8 @@ FARPROCZ pGetLOC;
|
||||||
FARPROCX pRefreshWebMailIndex;
|
FARPROCX pRefreshWebMailIndex;
|
||||||
FARPROCX pRunEventProgram;
|
FARPROCX pRunEventProgram;
|
||||||
FARPROCX pGetPortFrequency;
|
FARPROCX pGetPortFrequency;
|
||||||
|
FARPROCX pSendWebRequest;
|
||||||
|
FARPROCX pGetLatLon;
|
||||||
|
|
||||||
BOOL WINE = FALSE;
|
BOOL WINE = FALSE;
|
||||||
|
|
||||||
|
@ -1385,6 +1389,7 @@ char * CheckToAddress(CIRCUIT * conn, char * Addr);
|
||||||
BOOL CheckifPacket(char * Via);
|
BOOL CheckifPacket(char * Via);
|
||||||
int GetHTMLForms();
|
int GetHTMLForms();
|
||||||
VOID GetPGConfig();
|
VOID GetPGConfig();
|
||||||
|
void SendBBSDataToPktMap();
|
||||||
|
|
||||||
struct _EXCEPTION_POINTERS exinfox;
|
struct _EXCEPTION_POINTERS exinfox;
|
||||||
|
|
||||||
|
@ -1936,6 +1941,8 @@ BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
|
||||||
pRefreshWebMailIndex = GetProcAddress(ExtDriver,"_RefreshWebMailIndex@0");
|
pRefreshWebMailIndex = GetProcAddress(ExtDriver,"_RefreshWebMailIndex@0");
|
||||||
pRunEventProgram = GetProcAddress(ExtDriver,"_RunEventProgram@8");
|
pRunEventProgram = GetProcAddress(ExtDriver,"_RunEventProgram@8");
|
||||||
pGetPortFrequency = GetProcAddress(ExtDriver,"_GetPortFrequency@8");
|
pGetPortFrequency = GetProcAddress(ExtDriver,"_GetPortFrequency@8");
|
||||||
|
pSendWebRequest = GetProcAddress(ExtDriver,"_SendWebRequest@16");
|
||||||
|
pGetLatLon = GetProcAddress(ExtDriver,"_GetLatLon@8");
|
||||||
|
|
||||||
|
|
||||||
if (pGetLOC)
|
if (pGetLOC)
|
||||||
|
@ -2183,6 +2190,13 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
Debugprintf("|Enter HouseKeeping");
|
Debugprintf("|Enter HouseKeeping");
|
||||||
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
|
||||||
|
@ -3057,7 +3071,6 @@ static PSOCKADDR_IN psin;
|
||||||
SOCKET sock;
|
SOCKET sock;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
BOOL Initialise()
|
BOOL Initialise()
|
||||||
{
|
{
|
||||||
int i, len;
|
int i, len;
|
||||||
|
@ -3383,6 +3396,9 @@ BOOL Initialise()
|
||||||
CreatePipeThread();
|
CreatePipeThread();
|
||||||
GetPGConfig();
|
GetPGConfig();
|
||||||
|
|
||||||
|
|
||||||
|
APIClock = 0;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
19
Bpq32.c
19
Bpq32.c
|
@ -1086,7 +1086,7 @@ along with LinBPQ/BPQ32. If not, see http://www.gnu.org/licenses
|
||||||
// Add ? and * wildcards to NODES command (74)
|
// Add ? and * wildcards to NODES command (74)
|
||||||
// Add Port RADIO config parameter (74)
|
// Add Port RADIO config parameter (74)
|
||||||
|
|
||||||
// Version 6.0.24.1 August 2024
|
// Version 6.0.24.1 August 2023
|
||||||
|
|
||||||
// Apply NODES command wildcard to alias as well a call (2)
|
// Apply NODES command wildcard to alias as well a call (2)
|
||||||
// Add STOPPORT/STARTPORT to VARA Driver (2)
|
// Add STOPPORT/STARTPORT to VARA Driver (2)
|
||||||
|
@ -1234,6 +1234,8 @@ along with LinBPQ/BPQ32. If not, see http://www.gnu.org/licenses
|
||||||
// Add optional ATTACH time limit for VARA (48)
|
// Add optional ATTACH time limit for VARA (48)
|
||||||
// API format fixes (48)
|
// API format fixes (48)
|
||||||
// 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)
|
||||||
|
// Fix handling long unix device names (now max 250 bytes) (52)
|
||||||
|
|
||||||
#define CKernel
|
#define CKernel
|
||||||
|
|
||||||
|
@ -1374,6 +1376,9 @@ extern struct _LINKTABLE * LINKS;
|
||||||
extern int LINK_TABLE_LEN;
|
extern int LINK_TABLE_LEN;
|
||||||
extern int MAXLINKS;
|
extern int MAXLINKS;
|
||||||
|
|
||||||
|
extern double LatFromLOC;
|
||||||
|
extern double LonFromLOC;
|
||||||
|
|
||||||
|
|
||||||
extern int BPQHOSTAPI();
|
extern int BPQHOSTAPI();
|
||||||
extern int INITIALISEPORTS();
|
extern int INITIALISEPORTS();
|
||||||
|
@ -3068,7 +3073,7 @@ SkipInit:
|
||||||
|
|
||||||
if (AttachedProcesses < 2)
|
if (AttachedProcesses < 2)
|
||||||
{
|
{
|
||||||
if (AUTOSAVE == 1)
|
if (AUTOSAVE)
|
||||||
SaveNodes();
|
SaveNodes();
|
||||||
if (AUTOSAVEMH)
|
if (AUTOSAVEMH)
|
||||||
SaveMH();
|
SaveMH();
|
||||||
|
@ -6621,11 +6626,19 @@ int GetListeningPortsPID(int Port)
|
||||||
return 0; // Not found
|
return 0; // Not found
|
||||||
}
|
}
|
||||||
|
|
||||||
DllExport char * APIENTRY GetLOC()
|
DllExport char * APIENTRY GetLOC()
|
||||||
{
|
{
|
||||||
return LOC;
|
return LOC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DllExport void APIENTRY GetLatLon(double * lat, double * lon)
|
||||||
|
{
|
||||||
|
*lat = LatFromLOC;
|
||||||
|
*lon = LonFromLOC;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// UZ7HO Dll PTT interface
|
// UZ7HO Dll PTT interface
|
||||||
|
|
||||||
// 1 ext_PTT_info
|
// 1 ext_PTT_info
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
33
CommonCode.c
33
CommonCode.c
|
@ -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;
|
||||||
|
@ -5035,6 +5044,7 @@ VOID SendWebRequest(SOCKET sock, char * Host, char * Request, char * Params, int
|
||||||
|
|
||||||
Debugprintf("Map Update failed - %s", Buffer);
|
Debugprintf("Map Update failed - %s", Buffer);
|
||||||
}
|
}
|
||||||
|
closesocket(sock);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5046,6 +5056,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 +5595,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\"}]}";
|
||||||
|
|
|
@ -471,7 +471,7 @@ VOID * HALExtInit(EXTPORTDATA * PortEntry)
|
||||||
int port;
|
int port;
|
||||||
char * ptr;
|
char * ptr;
|
||||||
int len;
|
int len;
|
||||||
char Msg[80];
|
char Msg[512];
|
||||||
#ifndef LINBPQ
|
#ifndef LINBPQ
|
||||||
HWND x;
|
HWND x;
|
||||||
#endif
|
#endif
|
||||||
|
@ -548,7 +548,7 @@ VOID * HALExtInit(EXTPORTDATA * PortEntry)
|
||||||
TNC->WebWinX = 510;
|
TNC->WebWinX = 510;
|
||||||
TNC->WebWinY = 280;
|
TNC->WebWinY = 280;
|
||||||
|
|
||||||
TNC->WEB_COMMSSTATE = zalloc(100);
|
TNC->WEB_COMMSSTATE = zalloc(512);
|
||||||
TNC->WEB_TNCSTATE = zalloc(100);
|
TNC->WEB_TNCSTATE = zalloc(100);
|
||||||
strcpy(TNC->WEB_TNCSTATE, "Free");
|
strcpy(TNC->WEB_TNCSTATE, "Free");
|
||||||
TNC->WEB_MODE = zalloc(100);
|
TNC->WEB_MODE = zalloc(100);
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
12
LinBPQ.c
12
LinBPQ.c
|
@ -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
|
||||||
|
|
|
@ -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.
|
||||||
|
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -735,7 +735,7 @@ VOID SerialReleasePort(struct TNCINFO * TNC)
|
||||||
VOID * SerialExtInit(EXTPORTDATA * PortEntry)
|
VOID * SerialExtInit(EXTPORTDATA * PortEntry)
|
||||||
{
|
{
|
||||||
int port;
|
int port;
|
||||||
char Msg[255];
|
char Msg[512];
|
||||||
char * ptr;
|
char * ptr;
|
||||||
struct TNCINFO * TNC;
|
struct TNCINFO * TNC;
|
||||||
char * TempScript;
|
char * TempScript;
|
||||||
|
|
|
@ -10,14 +10,14 @@
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define KVers 6,0,24,50
|
#define KVers 6,0,24,52
|
||||||
#define KVerstring "6.0.24.50\0"
|
#define KVerstring "6.0.24.52\0"
|
||||||
|
|
||||||
#ifdef CKernel
|
#ifdef CKernel
|
||||||
|
|
||||||
#define Vers KVers
|
#define Vers KVers
|
||||||
#define Verstring KVerstring
|
#define Verstring KVerstring
|
||||||
#define Datestring "October 2024"
|
#define Datestring "November 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"
|
||||||
|
|
1
adif.c
1
adif.c
|
@ -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]);
|
||||||
|
|
||||||
|
|
|
@ -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
|
||||||
|
|
15
cMain.c
15
cMain.c
|
@ -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"
|
||||||
|
|
||||||
|
@ -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;
|
||||||
|
|
23
config.c
23
config.c
|
@ -174,15 +174,20 @@ 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, ...)
|
||||||
{
|
{
|
||||||
char Mess[255];
|
char Mess[512];
|
||||||
va_list(arglist);
|
va_list(arglist);
|
||||||
|
|
||||||
va_start(arglist, format);
|
va_start(arglist, 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;
|
||||||
|
@ -2397,11 +2412,11 @@ int doSerialPortName(int i, char * value, char * rec)
|
||||||
{
|
{
|
||||||
rec += 8;
|
rec += 8;
|
||||||
|
|
||||||
if (strlen(rec) > 79)
|
if (strlen(rec) > 250)
|
||||||
{
|
{
|
||||||
Consoleprintf("Serial Port Name too long - Truncated");
|
Consoleprintf("Serial Port Name too long - Truncated");
|
||||||
Consoleprintf("%s\r\n",rec);
|
Consoleprintf("%s\r\n",rec);
|
||||||
rec[79] = 0;
|
rec[250] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
strlop(rec, ' ');
|
strlop(rec, ' ');
|
||||||
|
|
|
@ -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] = "";
|
||||||
|
|
4
kiss.c
4
kiss.c
|
@ -209,7 +209,7 @@ VOID EnableFLDIGIReports(struct PORTCONTROL * PORT)
|
||||||
|
|
||||||
VOID ASYDISP(struct PORTCONTROL * PortVector)
|
VOID ASYDISP(struct PORTCONTROL * PortVector)
|
||||||
{
|
{
|
||||||
char Msg[80];
|
char Msg[512];
|
||||||
|
|
||||||
if (PortVector->PORTIPADDR.s_addr || PortVector->KISSTCP)
|
if (PortVector->PORTIPADDR.s_addr || PortVector->KISSTCP)
|
||||||
|
|
||||||
|
@ -235,7 +235,7 @@ VOID ASYDISP(struct PORTCONTROL * PortVector)
|
||||||
|
|
||||||
int ASYINIT(int comport, int speed, struct PORTCONTROL * PortVector, char Channel )
|
int ASYINIT(int comport, int speed, struct PORTCONTROL * PortVector, char Channel )
|
||||||
{
|
{
|
||||||
char Msg[80];
|
char Msg[256];
|
||||||
NPASYINFO npKISSINFO;
|
NPASYINFO npKISSINFO;
|
||||||
int BPQPort = PortVector->PORTNUMBER;
|
int BPQPort = PortVector->PORTNUMBER;
|
||||||
|
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
|
|
400
mailapi.c
400
mailapi.c
|
@ -706,3 +706,403 @@ packetmail_queue_length{partner="GB7NWL"} 0 1729090716916
|
||||||
packetmail_queue_length{partner="GM8BPQ"} 0 1729090716916
|
packetmail_queue_length{partner="GM8BPQ"} 0 1729090716916
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
// Stuff send to packetnodes.spots.radio/api/bbsdata/{bbsCall}
|
||||||
|
//https://nodes.ukpacketradio.network/swagger/index.html
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
BbsData{
|
||||||
|
callsign* [...]
|
||||||
|
time* [...]
|
||||||
|
hroute* [...]
|
||||||
|
peers [...]
|
||||||
|
software* [...]
|
||||||
|
version* [...]
|
||||||
|
mailQueues [...]
|
||||||
|
messages [...]
|
||||||
|
latitude [...]
|
||||||
|
longitude [...]
|
||||||
|
locator [...]
|
||||||
|
location [...]
|
||||||
|
unroutable [...]
|
||||||
|
}
|
||||||
|
|
||||||
|
[
|
||||||
|
|
||||||
|
{
|
||||||
|
"callsign": "GE8PZT",
|
||||||
|
"time": "2024-11-25T10:07:41+00:00",
|
||||||
|
"hroute": ".#24.GBR.EU",
|
||||||
|
"peers": [
|
||||||
|
"GB7BBS",
|
||||||
|
"VE2PKT",
|
||||||
|
"GB7NXT",
|
||||||
|
"VA2OM"
|
||||||
|
],
|
||||||
|
"software": "XrLin",
|
||||||
|
"version": "504a",
|
||||||
|
"mailQueues": [],
|
||||||
|
"messages": [
|
||||||
|
{
|
||||||
|
"to": "TECH@WW",
|
||||||
|
"mid": "20539_GB7CIP",
|
||||||
|
"rcvd": "2024-11-24T09:27:59+00:00",
|
||||||
|
"routing": [
|
||||||
|
"R:241124/0927Z @:GE8PZT.#24.GBR.EU [Lamanva] #:2315 XrLin504a",
|
||||||
|
|
||||||
|
|
||||||
|
{
|
||||||
|
"to": "TNC@WW",
|
||||||
|
"mid": "37_PA2SNK",
|
||||||
|
"rcvd": "2024-11-18T21:56:55+00:00",
|
||||||
|
"routing": [
|
||||||
|
"R:241118/2156Z @:GE8PZT.#24.GBR.EU [] #:2215 XrLin504a",
|
||||||
|
"R:241118/2156Z 12456@VE2PKT.#TRV.QC.CAN.NOAM BPQ6.0.24",
|
||||||
|
"R:241118/2130Z 51539@VE3KPG.#ECON.ON.CAN.NOAM BPQK6.0.23",
|
||||||
|
"R:241118/2130Z 26087@VE3CGR.#SCON.ON.CAN.NOAM LinBPQ6.0.24",
|
||||||
|
"R:241118/2130Z 37521@PA8F.#ZH1.NLD.EURO LinBPQ6.0.24",
|
||||||
|
"R:241118/2129Z 48377@PI8LAP.#ZLD.NLD.EURO LinBPQ6.0.24",
|
||||||
|
"R:241118/2129Z @:PD0LPM.FRL.EURO.NLD #:33044 [Joure] $:37_PA2SNK"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"latitude": 50.145832,
|
||||||
|
"longitude": -5.125,
|
||||||
|
"locator": "IO70KD",
|
||||||
|
"location": "Lamanva",
|
||||||
|
"unroutable": [
|
||||||
|
{
|
||||||
|
"type": "P",
|
||||||
|
"at": "WW"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "P",
|
||||||
|
"at": "G8PZT-2"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "P",
|
||||||
|
"at": "g8pzt._24.gbr.eu"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "P",
|
||||||
|
"at": "G8PZT.#24.GBR.EU"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "P",
|
||||||
|
"at": "GE8PZT.#24.GBR.EU"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "P",
|
||||||
|
"at": "G8PZT.#24.GBR.EURO"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
// https://packetnodes.spots.radio/swagger/index.html
|
||||||
|
|
||||||
|
// "unroutable": [{"type": "P","at": "WW"}, {"type": "P", "at": "G8PZT.#24.GBR.EURO"}]
|
||||||
|
|
||||||
|
char * ViaList[100000]; // Pointers to the Message Header field
|
||||||
|
char TypeList[100000];
|
||||||
|
|
||||||
|
int unroutableCount = 0;
|
||||||
|
|
||||||
|
|
||||||
|
void CheckifRoutable(struct MsgInfo * Msg)
|
||||||
|
{
|
||||||
|
char NextBBS[64];
|
||||||
|
int n;
|
||||||
|
|
||||||
|
if (Msg->status == 'K')
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (Msg->via[0] == 0) // No routing
|
||||||
|
return;
|
||||||
|
|
||||||
|
strcpy(NextBBS, Msg->via);
|
||||||
|
strlop(NextBBS, '.');
|
||||||
|
|
||||||
|
if (strcmp(NextBBS, BBSName) == 0) // via this BBS
|
||||||
|
return;
|
||||||
|
|
||||||
|
if ((memcmp(Msg->fbbs, zeros, NBMASK) != 0) || (memcmp(Msg->forw, zeros, NBMASK) != 0)) // Has Forwarding Info
|
||||||
|
return;
|
||||||
|
|
||||||
|
// See if we already have it
|
||||||
|
|
||||||
|
for (n = 0; n < unroutableCount; n++)
|
||||||
|
{
|
||||||
|
if ((TypeList[n] == Msg->type) && strcmp(ViaList[n], Msg->via) == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add to list
|
||||||
|
|
||||||
|
TypeList[unroutableCount] = Msg->type;
|
||||||
|
ViaList[unroutableCount] = Msg->via;
|
||||||
|
|
||||||
|
unroutableCount++;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
extern char LOC[7];
|
||||||
|
|
||||||
|
|
||||||
|
DllExport VOID WINAPI SendWebRequest(char * Host, char * Request, char * Params, char * Return);
|
||||||
|
|
||||||
|
#ifdef LINBPQ
|
||||||
|
extern double LatFromLOC;
|
||||||
|
extern double LonFromLOC;
|
||||||
|
#else
|
||||||
|
typedef int (WINAPI FAR *FARPROCX)();
|
||||||
|
extern FARPROCX pSendWebRequest;
|
||||||
|
extern FARPROCX pGetLatLon;
|
||||||
|
double LatFromLOC = 0;
|
||||||
|
double LonFromLOC = 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void SendBBSDataToPktMap()
|
||||||
|
{
|
||||||
|
char Return[4096];
|
||||||
|
char Request[64];
|
||||||
|
char * Params;
|
||||||
|
char * ptr;
|
||||||
|
int paramLen;
|
||||||
|
struct MsgInfo * Msg;
|
||||||
|
|
||||||
|
struct UserInfo * ourBBSRec = LookupCall(BBSName);
|
||||||
|
struct UserInfo * USER;
|
||||||
|
char Time[64];
|
||||||
|
struct tm * tm;
|
||||||
|
time_t Date = time(NULL);
|
||||||
|
char Peers[2048] = "[]";
|
||||||
|
char MsgQueues[16000] = "[]";
|
||||||
|
char * Messages = malloc(1000000);
|
||||||
|
char * Unroutables;
|
||||||
|
int m;
|
||||||
|
char * MsgBytes;
|
||||||
|
char * Rlineptr;
|
||||||
|
char * Rlineend;
|
||||||
|
char * RLines;
|
||||||
|
char * ptr1, * ptr2;
|
||||||
|
int n;
|
||||||
|
|
||||||
|
#ifndef LINBPQ
|
||||||
|
if (pSendWebRequest == 0)
|
||||||
|
return; // Old Version of bpq32.dll
|
||||||
|
|
||||||
|
pGetLatLon(&LatFromLOC, &LonFromLOC);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
if (ourBBSRec == 0)
|
||||||
|
return; // Wot!!
|
||||||
|
|
||||||
|
// Get peers and Mail Queues
|
||||||
|
|
||||||
|
ptr = &Peers[1];
|
||||||
|
ptr1 = &MsgQueues[1];
|
||||||
|
|
||||||
|
for (USER = BBSChain; USER; USER = USER->BBSNext)
|
||||||
|
{
|
||||||
|
if (strcmp(USER->Call, BBSName) != 0)
|
||||||
|
{
|
||||||
|
int Bytes;
|
||||||
|
|
||||||
|
int Count = CountMessagestoForward(USER);
|
||||||
|
|
||||||
|
ptr += sprintf(ptr, "\"%s\",", USER->Call);
|
||||||
|
|
||||||
|
if (Count)
|
||||||
|
{
|
||||||
|
Bytes = CountBytestoForward(USER);
|
||||||
|
|
||||||
|
ptr1 += sprintf(ptr1, "{\"peerCall\": \"%s\", \"numQueued\": %d, \"bytesQueued\": %d},",
|
||||||
|
USER->Call, Count, Bytes);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((*ptr) != ']') // Have some entries
|
||||||
|
{
|
||||||
|
ptr--; // over trailing comms
|
||||||
|
*(ptr++) = ']';
|
||||||
|
*(ptr) = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((*ptr1) != ']') // Have some entries
|
||||||
|
{
|
||||||
|
ptr1--; // over trailing comms
|
||||||
|
*(ptr1++) = ']';
|
||||||
|
*(ptr1) = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get Messages
|
||||||
|
|
||||||
|
strcpy(Messages, "[]");
|
||||||
|
ptr = &Messages[1];
|
||||||
|
|
||||||
|
for (m = LatestMsg; m >= 1; m--)
|
||||||
|
{
|
||||||
|
if (ptr > &Messages[999000])
|
||||||
|
break; // protect buffer
|
||||||
|
|
||||||
|
Msg = GetMsgFromNumber(m);
|
||||||
|
|
||||||
|
if (Msg == 0 || Msg->type == 0 || Msg->status == 0)
|
||||||
|
continue; // Protect against corrupt messages
|
||||||
|
|
||||||
|
// Paula suggests including H and K but limit it to the last 30 days or the last 100 messages, whichever is the smaller.
|
||||||
|
|
||||||
|
// if (Msg->status == 'K' || Msg->status == 'H')
|
||||||
|
// continue;
|
||||||
|
|
||||||
|
if ((Date - Msg->datereceived) > 30 * 86400) // Too old
|
||||||
|
continue;
|
||||||
|
|
||||||
|
CheckifRoutable(Msg);
|
||||||
|
|
||||||
|
tm = gmtime(&Msg->datereceived);
|
||||||
|
|
||||||
|
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);
|
||||||
|
|
||||||
|
// Get Routing
|
||||||
|
|
||||||
|
MsgBytes = ReadMessageFile(Msg->number);
|
||||||
|
RLines = malloc(Msg->length * 2); // Very unlikely to need so much but better safe..
|
||||||
|
|
||||||
|
strcpy(RLines, "[]");
|
||||||
|
|
||||||
|
ptr2 = &RLines[1];
|
||||||
|
|
||||||
|
// Need to skip B2 header if B2 Message
|
||||||
|
|
||||||
|
Rlineptr = MsgBytes;
|
||||||
|
|
||||||
|
// If it is a B2 Message, Must Skip B2 Header
|
||||||
|
|
||||||
|
if (Msg->B2Flags & B2Msg)
|
||||||
|
{
|
||||||
|
Rlineptr = strstr(Rlineptr, "\r\n\r\n");
|
||||||
|
if (Rlineptr)
|
||||||
|
Rlineptr += 4;
|
||||||
|
else
|
||||||
|
Rlineptr = MsgBytes;
|
||||||
|
}
|
||||||
|
|
||||||
|
// We have to process R: lines one at a time as we need to send each one as a separate string
|
||||||
|
|
||||||
|
while (memcmp(Rlineptr, "R:", 2) == 0)
|
||||||
|
{
|
||||||
|
// Have R Lines
|
||||||
|
|
||||||
|
Rlineend = strstr(Rlineptr, "\r\n");
|
||||||
|
Rlineend[0] = 0;
|
||||||
|
ptr2 += sprintf(ptr2, "\"%s\",", Rlineptr);
|
||||||
|
|
||||||
|
Rlineptr = Rlineend + 2; // over crlf
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((*ptr2) == ']') // no entries
|
||||||
|
continue;
|
||||||
|
|
||||||
|
ptr2--; // over trailing comms
|
||||||
|
*(ptr2++) = ']';
|
||||||
|
*(ptr2) = 0;
|
||||||
|
|
||||||
|
ptr += sprintf(ptr, "{\"to\": \"%s\", \"mid\": \"%s\", \"rcvd\": \"%s\", \"routing\": %s},",
|
||||||
|
Msg->to, Msg->bid, Time, RLines);
|
||||||
|
|
||||||
|
free(MsgBytes);
|
||||||
|
free(RLines);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((*ptr) != ']') // Have some entries?
|
||||||
|
{
|
||||||
|
ptr--; // over trailing comms
|
||||||
|
*(ptr++) = ']';
|
||||||
|
*(ptr) = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get unroutables
|
||||||
|
|
||||||
|
Unroutables = malloc((unroutableCount + 1) * 100);
|
||||||
|
|
||||||
|
strcpy(Unroutables, "[]");
|
||||||
|
ptr = &Unroutables[1];
|
||||||
|
|
||||||
|
|
||||||
|
for (n = 0; n < unroutableCount; n++)
|
||||||
|
{
|
||||||
|
ptr += sprintf(ptr, "{\"type\": \"%c\",\"at\": \"%s\"},", TypeList[n], ViaList[n]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((*ptr) != ']') // Have some entries?
|
||||||
|
{
|
||||||
|
ptr--; // over trailing comms
|
||||||
|
*(ptr++) = ']';
|
||||||
|
*(ptr) = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
char * ViaList[100000]; // Pointers to the Message Header field
|
||||||
|
char TypeList[100000];
|
||||||
|
|
||||||
|
int unroutableCount = 0;
|
||||||
|
"unroutable": [{"type": "P","at": "WW"}, {"type": "P", "at": "G8PZT.#24.GBR.EURO"}]
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
tm = gmtime(&Date);
|
||||||
|
|
||||||
|
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);
|
||||||
|
|
||||||
|
|
||||||
|
paramLen = strlen(Peers) + strlen(MsgQueues) + strlen(Messages) + strlen(Unroutables);
|
||||||
|
|
||||||
|
Params = malloc(paramLen + 1000);
|
||||||
|
|
||||||
|
if (Params == 0)
|
||||||
|
{
|
||||||
|
free(Messages);
|
||||||
|
free(Unroutables);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
ptr = Params;
|
||||||
|
|
||||||
|
sprintf(Request, "/api/bbsdata/%s", BBSName);
|
||||||
|
|
||||||
|
ptr += sprintf(ptr, "{\"callsign\": \"%s\",\r\n", BBSName);
|
||||||
|
ptr += sprintf(ptr, "\"time\": \"%s\",\r\n", Time);
|
||||||
|
ptr += sprintf(ptr, "\"hroute\": \"%s\",\r\n", HRoute);
|
||||||
|
ptr += sprintf(ptr, "\"peers\": %s,\r\n", Peers);
|
||||||
|
#ifdef LINBPQ
|
||||||
|
ptr += sprintf(ptr, "\"software\": \"%s\",\r\n", "linbpq");
|
||||||
|
#else
|
||||||
|
ptr += sprintf(ptr, "\"software\": \"%s\",\r\n", "BPQMail");
|
||||||
|
#endif
|
||||||
|
ptr += sprintf(ptr, "\"version\": \"%s\",\r\n", VersionString);
|
||||||
|
ptr += sprintf(ptr, "\"mailQueues\": %s,\r\n", MsgQueues);
|
||||||
|
ptr += sprintf(ptr, "\"messages\": %s,\r\n", Messages);
|
||||||
|
ptr += sprintf(ptr, "\"latitude\": %1.6f,\r\n", LatFromLOC);
|
||||||
|
ptr += sprintf(ptr, "\"longitude\": %.6f,\r\n", LonFromLOC);
|
||||||
|
ptr += sprintf(ptr, "\"locator\": \"%s\",\r\n", LOC);
|
||||||
|
ptr += sprintf(ptr, "\"location\": \"%s\",\r\n", ourBBSRec->Address);
|
||||||
|
ptr += sprintf(ptr, "\"unroutable\": %s\r\n}\r\n", Unroutables);
|
||||||
|
|
||||||
|
SendWebRequest("packetnodes.spots.radio", Request, Params, Return);
|
||||||
|
free(Messages);
|
||||||
|
free(Unroutables);
|
||||||
|
free(Params);
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue