mirror of git://vps1.g8bpq.net/linbpq
parent
0583ca8e05
commit
48f7c6192c
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,126 @@
|
||||
|
||||
#ifdef Kernel
|
||||
|
||||
#define Vers 5,2,9,2
|
||||
#define Verstring "5.2.9.2\0"
|
||||
#define Datestring "September 2012"
|
||||
#define VerComments "G8BPQ Packet Switch V5.2.9.2\0"
|
||||
#define VerCopyright "Copyright © 2001-2012 John Wiseman G8BPQ\0"
|
||||
#define VerDesc "BPQ32 Switch\0"
|
||||
|
||||
#endif
|
||||
|
||||
#define KVers 6,0,24,75
|
||||
#define KVerstring "6.0.24.75\0"
|
||||
|
||||
|
||||
#ifdef CKernel
|
||||
|
||||
#define Vers KVers
|
||||
#define Verstring KVerstring
|
||||
#define Datestring "June 2025"
|
||||
#define VerComments "G8BPQ Packet Switch (C Version)" KVerstring
|
||||
#define VerCopyright "Copyright © 2001-2025 John Wiseman G8BPQ\0"
|
||||
#define VerDesc "BPQ32 Switch\0"
|
||||
#define VerProduct "BPQ32"
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef TermTCP
|
||||
|
||||
#define Vers 1,0,16,2
|
||||
#define Verstring "1.0.16.2\0"
|
||||
#define VerComments "Internet Terminal for G8BPQ Packet Switch\0"
|
||||
#define VerCopyright "Copyright © 2011-2025 John Wiseman G8BPQ\0"
|
||||
#define VerDesc "Simple TCP Terminal Program for G8BPQ Switch\0"
|
||||
#define VerProduct "BPQTermTCP"
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef BPQTerm
|
||||
|
||||
#define Vers 2,2,5,2
|
||||
#define Verstring "2.2.5.2\0"
|
||||
#define VerComments "Simple Terminal for G8BPQ Packet Switch\0"
|
||||
#define VerCopyright "Copyright © 1999-2025 John Wiseman G8BPQ\0"
|
||||
#define VerDesc "Simple Terminal Program for G8BPQ Switch\0"
|
||||
#define VerProduct "BPQTerminal"
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef BPQTermMDI
|
||||
|
||||
#define Vers 2,2,0,3
|
||||
#define Verstring "2.2.0.3\0"
|
||||
#define VerComments "MDI Terminal for G8BPQ Packet Switch\0"
|
||||
#define VerCopyright "Copyright © 1999-2025 John Wiseman G8BPQ\0"
|
||||
#define VerDesc "MDI Terminal Program for G8BPQ Switch\0"
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef MAIL
|
||||
|
||||
#define Vers KVers
|
||||
#define Verstring KVerstring
|
||||
#define VerComments "Mail server for G8BPQ Packet Switch\0"
|
||||
#define VerCopyright "Copyright © 2009-2025 John Wiseman G8BPQ\0"
|
||||
#define VerDesc "Mail server for G8BPQ's 32 Bit Switch\0"
|
||||
#define VerProduct "BPQMail"
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef HOSTMODES
|
||||
|
||||
#define Vers 1,1,8,1
|
||||
#define Verstring "1.1.8.1\0"
|
||||
//#define SPECIALVERSION "Test 3"
|
||||
#define VerComments "Host Modes Emulator for G8BPQ Packet Switch\0"
|
||||
#define VerCopyright "Copyright © 2009-2019 John Wiseman G8BPQ\0"
|
||||
#define VerDesc "Host Modes Emulator for G8BPQ's 32 Bit Switch\0"
|
||||
#define VerProduct "BPQHostModes"
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef UIUTIL
|
||||
|
||||
#define Vers 0,1,3,1
|
||||
#define Verstring "0.1.3.1\0"
|
||||
#define VerComments "Beacon Utility for G8BPQ Packet Switch\0"
|
||||
#define VerCopyright "Copyright © 2011-2019 John Wiseman G8BPQ\0"
|
||||
#define VerDesc "Beacon Utility for G8BPQ Switch\0"
|
||||
#define VerProduct "BPQUIUtil"
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef AUTH
|
||||
|
||||
#define Vers 0,1,0,0
|
||||
#define Verstring "0.1.0.0\0"
|
||||
#define VerComments "Password Generation Utility for G8BPQ Packet Switch\0"
|
||||
#define VerCopyright "Copyright © 2011-2025 John Wiseman G8BPQ\0"
|
||||
#define VerDesc "Password Generation Utility for G8BPQ Switch\0"
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef APRS
|
||||
|
||||
#define Vers KVers
|
||||
#define Verstring KVerstring
|
||||
#define VerComments "APRS Client for G8BPQ Switch\0"
|
||||
#define VerCopyright "Copyright © 2012-2025 John Wiseman G8BPQ\0"
|
||||
#define VerDesc "APRS Client for G8BPQ Switch\0"
|
||||
#define VerProduct "BPQAPRS"
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef CHAT
|
||||
|
||||
#define Vers KVers
|
||||
#define Verstring KVerstring
|
||||
#define VerComments "Chat server for G8BPQ Packet Switch\0"
|
||||
#define VerCopyright "Copyright © 2009-2025 John Wiseman G8BPQ\0"
|
||||
#define VerDesc "Chat server for G8BPQ's 32 Bit Switch\0"
|
||||
#define VerProduct "BPQChat"
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,825 @@
|
||||
/*
|
||||
Copyright 2001-2018 John Wiseman G8BPQ
|
||||
|
||||
This file is part of LinBPQ/BPQ32.
|
||||
|
||||
LinBPQ/BPQ32 is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
LinBPQ/BPQ32 is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with LinBPQ/BPQ32. If not, see http://www.gnu.org/licenses
|
||||
*/
|
||||
|
||||
|
||||
#include "bpqchat.h"
|
||||
|
||||
extern char OurNode[10];
|
||||
|
||||
// Flags Equates
|
||||
|
||||
#define GETTINGUSER 1
|
||||
#define GETTINGBBS 2
|
||||
#define CHATMODE 4
|
||||
#define GETTINGTITLE 8
|
||||
#define GETTINGMESSAGE 16
|
||||
#define CHATLINK 32 // Link to another Chat Node
|
||||
#define SENDTITLE 64
|
||||
#define SENDBODY 128
|
||||
#define WAITPROMPT 256 // Waiting for prompt after message
|
||||
|
||||
|
||||
extern char PassError[];
|
||||
extern char BusyError[];
|
||||
extern int chatPaclen;
|
||||
|
||||
extern char NodeTail[];
|
||||
extern BOOL APRSApplConnected;
|
||||
|
||||
extern char ChatConfigName[250];
|
||||
|
||||
extern char OtherNodesList[1000];
|
||||
|
||||
extern char ChatWelcomeMsg[1000];
|
||||
|
||||
extern USER *user_hd;
|
||||
extern LINK *link_hd;
|
||||
|
||||
extern UCHAR BPQDirectory[260];
|
||||
|
||||
#define MaxSockets 64
|
||||
|
||||
extern ChatCIRCUIT ChatConnections[MaxSockets+1];
|
||||
|
||||
extern int NumberofChatStreams;
|
||||
|
||||
extern int SMTPMsgs;
|
||||
|
||||
extern int ChatApplNum;
|
||||
extern int MaxChatStreams;
|
||||
|
||||
extern char Position[81];
|
||||
extern char PopupText[251];
|
||||
extern int PopupMode;
|
||||
extern int reportChatEvents;
|
||||
|
||||
#include "httpconnectioninfo.h"
|
||||
|
||||
static struct HTTPConnectionInfo * SessionList; // active bbs config sessions
|
||||
|
||||
static struct HTTPConnectionInfo * AllocateSession(char Appl);
|
||||
static struct HTTPConnectionInfo * FindSession(char * Key);
|
||||
VOID ProcessUserUpdate(struct HTTPConnectionInfo * Session, char * MsgPtr, char * Reply, int * RLen, char * Rest);
|
||||
VOID ProcessMsgFwdUpdate(struct HTTPConnectionInfo * Session, char * MsgPtr, char * Reply, int * RLen, char * Rest);
|
||||
VOID SendConfigPage(char * Reply, int * ReplyLen, char * Key);
|
||||
VOID ProcessConfUpdate(struct HTTPConnectionInfo * Session, char * MsgPtr, char * Reply, int * RLen, char * Rest);
|
||||
VOID ProcessUIUpdate(struct HTTPConnectionInfo * Session, char * MsgPtr, char * Reply, int * RLen, char * Rest);
|
||||
VOID SendUserSelectPage(char * Reply, int * ReplyLen, char * Key);
|
||||
VOID SendFWDSelectPage(char * Reply, int * ReplyLen, char * Key);
|
||||
int EncryptPass(char * Pass, char * Encrypt);
|
||||
VOID ProcessFWDUpdate(struct HTTPConnectionInfo * Session, char * MsgPtr, char * Reply, int * RLen, char * Rest);
|
||||
VOID SendStatusPage(char * Reply, int * ReplyLen, char * Key);
|
||||
VOID SendChatStatusPage(char * Reply, int * ReplyLen, char * Key);
|
||||
VOID SendUIPage(char * Reply, int * ReplyLen, char * Key);
|
||||
static VOID GetParam(char * input, char * key, char * value);
|
||||
BOOL GetConfig(char * ConfigName);
|
||||
VOID ProcessChatDisUser(struct HTTPConnectionInfo * Session, char * MsgPtr, char * Reply, int * RLen, char * Rest);
|
||||
int APIENTRY SessionControl(int stream, int command, int param);
|
||||
int APIENTRY GetNumberofPorts();
|
||||
int APIENTRY GetPortNumber(int portslot);
|
||||
UCHAR * APIENTRY GetPortDescription(int portslot, char * Desc);
|
||||
struct PORTCONTROL * APIENTRY GetPortTableEntryFromSlot(int portslot);
|
||||
VOID SendHouseKeeping(char * Reply, int * ReplyLen, char * Key);
|
||||
VOID SendWelcomePage(char * Reply, int * ReplyLen, char * Key);
|
||||
VOID SaveWelcome(struct HTTPConnectionInfo * Session, char * MsgPtr, char * Reply, int * RLen, char * Key);
|
||||
VOID GetMallocedParam(char * input, char * key, char ** value);
|
||||
VOID SaveMessageText(struct HTTPConnectionInfo * Session, char * MsgPtr, char * Reply, int * RLen, char * Rest);
|
||||
VOID SaveHousekeeping(struct HTTPConnectionInfo * Session, char * MsgPtr, char * Reply, int * RLen, char * Key);
|
||||
VOID SaveWP(struct HTTPConnectionInfo * Session, char * MsgPtr, char * Reply, int * RLen, char * Key);
|
||||
int SetupNodeMenu(char * Buff);
|
||||
VOID SendFwdSelectPage(char * Reply, int * ReplyLen, char * Key);
|
||||
VOID SendFwdDetails(struct HTTPConnectionInfo * Session, char * Reply, int * ReplyLen, char * Key);
|
||||
VOID SendFwdMainPage(char * Reply, int * ReplyLen, char * Key);
|
||||
VOID SaveFwdCommon(struct HTTPConnectionInfo * Session, char * MsgPtr, char * Reply, int * RLen, char * Rest);
|
||||
VOID SaveFwdDetails(struct HTTPConnectionInfo * Session, char * MsgPtr, char * Reply, int * RLen, char * Rest);
|
||||
char ** SeparateMultiString(char * MultiString);
|
||||
VOID SendChatConfigPage(char * Reply, int * ReplyLen, char * Key);
|
||||
VOID SaveChatInfo(struct HTTPConnectionInfo * Session, char * MsgPtr, char * Reply, int * RLen, char * Key);
|
||||
int rtlink (char * Call);
|
||||
char * APIENTRY GetBPQDirectory();
|
||||
VOID SaveChatConfigFile(char * Config);
|
||||
BOOL GetChatConfig(char * Config);
|
||||
char * GetTemplateFromFile(int Version, char * FN);
|
||||
|
||||
static char UNC[] = "";
|
||||
static char CHKD[] = "checked=checked ";
|
||||
static char sel[] = "selected";
|
||||
|
||||
|
||||
char ChatSignon[] = "<html><head><title>BPQ32 Chat Server Access</title></head><body background=\"/background.jpg\">"
|
||||
"<h3 align=center>BPQ32 Chat Server %s Access</h3>"
|
||||
"<h3 align=center>Please enter Callsign and Password to access the Chat Server</h3>"
|
||||
"<form method=post action=/Chat/Signon?Chat>"
|
||||
"<table align=center bgcolor=white>"
|
||||
"<tr><td>User</td><td><input type=text name=user tabindex=1 size=20 maxlength=50 /></td></tr>"
|
||||
"<tr><td>Password</td><td><input type=password name=password tabindex=2 size=20 maxlength=50 /></td></tr></table>"
|
||||
"<p align=center><input type=submit value=Submit /><input type=submit value=Cancel name=Cancel /></form>";
|
||||
|
||||
|
||||
char ChatPage[] = "<html><head><title>%s's Chat Server</title></head>"
|
||||
"<body background=\"/background.jpg\"><h3 align=center>BPQ32 Chat Node %s</h3><P>"
|
||||
"<P align=center><table border=1 cellpadding=2 bgcolor=white><tr>"
|
||||
"<td><a href=/Chat/ChatStatus?%s>Status</a></td>"
|
||||
"<td><a href=/Chat/ChatConf?%s>Configuration</a></td>"
|
||||
"<td><a href=/>Node Menu</a></td>"
|
||||
"</tr></table>";
|
||||
|
||||
|
||||
|
||||
static char LostSession[] = "<html><body>"
|
||||
"<form style=\"font-family: monospace; text-align: center;\" method=post action=/Chat/Lost?%s>"
|
||||
"Sorry, Session had been lost<br><br> "
|
||||
"<input name=Submit value=Restart type=submit> <input type=submit value=Exit name=Cancel><br></form>";
|
||||
|
||||
char * ChatConfigTemplate = NULL;
|
||||
char * ChatStatusTemplate = NULL;
|
||||
|
||||
static int compare(const void *arg1, const void *arg2)
|
||||
{
|
||||
// Compare Calls. Fortunately call is at start of stuct
|
||||
|
||||
return _stricmp(*(char**)arg1 , *(char**)arg2);
|
||||
}
|
||||
|
||||
int SendChatHeader(char * Reply, char * Key)
|
||||
{
|
||||
return sprintf(Reply, ChatPage, OurNode, OurNode, Key, Key);
|
||||
}
|
||||
|
||||
|
||||
void ProcessChatHTTPMessage(struct HTTPConnectionInfo * Session, char * Method, char * URL, char * input, char * Reply, int * RLen)
|
||||
{
|
||||
char * Conxtext = 0, * NodeURL;
|
||||
int ReplyLen;
|
||||
char * Key;
|
||||
char Appl = 'M';
|
||||
|
||||
NodeURL = strtok_s(URL, "?", &Conxtext);
|
||||
Key = Session->Key;
|
||||
|
||||
|
||||
if (strcmp(Method, "POST") == 0)
|
||||
{
|
||||
if (_stricmp(NodeURL, "/Chat/Header") == 0)
|
||||
{
|
||||
*RLen = SendChatHeader(Reply, Session->Key);
|
||||
return;
|
||||
}
|
||||
|
||||
if (_stricmp(NodeURL, "/Chat/ChatConfig") == 0)
|
||||
{
|
||||
if (ChatConfigTemplate)
|
||||
free(ChatConfigTemplate);
|
||||
|
||||
ChatConfigTemplate = GetTemplateFromFile(2, "ChatConfig.txt");
|
||||
|
||||
NodeURL[strlen(NodeURL)] = ' '; // Undo strtok
|
||||
SaveChatInfo(Session, input, Reply, RLen, Key);
|
||||
return ;
|
||||
}
|
||||
|
||||
if (_stricmp(NodeURL, "/Chat/ChatDisSession") == 0)
|
||||
{
|
||||
ProcessChatDisUser(Session, input, Reply, RLen, Key);
|
||||
return ;
|
||||
}
|
||||
|
||||
|
||||
// End of POST section
|
||||
}
|
||||
|
||||
if ((_stricmp(NodeURL, "/chat/Chat.html") == 0) || (_stricmp(NodeURL, "/chat/Header") == 0))
|
||||
{
|
||||
*RLen = SendChatHeader(Reply, Session->Key);
|
||||
return;
|
||||
}
|
||||
|
||||
if ((_stricmp(NodeURL, "/Chat/ChatStatus") == 0) || (_stricmp(NodeURL, "/Chat/ChatDisSession") == 0))
|
||||
{
|
||||
if (ChatStatusTemplate)
|
||||
free(ChatStatusTemplate);
|
||||
|
||||
ChatStatusTemplate = GetTemplateFromFile(1, "ChatStatus.txt");
|
||||
SendChatStatusPage(Reply, RLen, Key);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (_stricmp(NodeURL, "/Chat/ChatConf") == 0)
|
||||
{
|
||||
if (ChatConfigTemplate)
|
||||
free(ChatConfigTemplate);
|
||||
|
||||
ChatConfigTemplate = GetTemplateFromFile(2, "ChatConfig.txt");
|
||||
|
||||
SendChatConfigPage(Reply, RLen, Key);
|
||||
return;
|
||||
}
|
||||
|
||||
ReplyLen = sprintf(Reply, ChatSignon, OurNode, OurNode);
|
||||
*RLen = ReplyLen;
|
||||
|
||||
}
|
||||
|
||||
|
||||
static VOID GetParam(char * input, char * key, char * value)
|
||||
{
|
||||
char * ptr = strstr(input, key);
|
||||
char Param[2048];
|
||||
char * ptr1, * ptr2;
|
||||
char c;
|
||||
|
||||
if (ptr)
|
||||
{
|
||||
ptr2 = strchr(ptr, '&');
|
||||
if (ptr2) *ptr2 = 0;
|
||||
strcpy(Param, ptr + strlen(key));
|
||||
if (ptr2) *ptr2 = '&'; // Restore string
|
||||
|
||||
// Undo any % transparency
|
||||
|
||||
ptr1 = Param;
|
||||
ptr2 = Param;
|
||||
|
||||
c = *(ptr1++);
|
||||
|
||||
while (c)
|
||||
{
|
||||
if (c == '%')
|
||||
{
|
||||
int n;
|
||||
int m = *(ptr1++) - '0';
|
||||
if (m > 9) m = m - 7;
|
||||
n = *(ptr1++) - '0';
|
||||
if (n > 9) n = n - 7;
|
||||
|
||||
*(ptr2++) = m * 16 + n;
|
||||
}
|
||||
else if (c == '+')
|
||||
*(ptr2++) = ' ';
|
||||
else
|
||||
*(ptr2++) = c;
|
||||
|
||||
c = *(ptr1++);
|
||||
}
|
||||
|
||||
*(ptr2++) = 0;
|
||||
|
||||
strcpy(value, Param);
|
||||
}
|
||||
}
|
||||
|
||||
static VOID GetCheckBox(char * input, char * key, int * value)
|
||||
{
|
||||
char * ptr = strstr(input, key);
|
||||
if (ptr)
|
||||
*value = 1;
|
||||
else
|
||||
*value = 0;
|
||||
}
|
||||
|
||||
|
||||
VOID SaveChatInfo(struct HTTPConnectionInfo * Session, char * MsgPtr, char * Reply, int * RLen, char * Key)
|
||||
{
|
||||
int ReplyLen = 0;
|
||||
char * input;
|
||||
struct UserInfo * USER = NULL;
|
||||
char Temp[80];
|
||||
char Nodes[10000] = "";
|
||||
char * ptr1, * ptr2;
|
||||
|
||||
input = strstr(MsgPtr, "\r\n\r\n"); // End of headers
|
||||
|
||||
if (input)
|
||||
{
|
||||
if (strstr(input, "Cancel=Cancel"))
|
||||
{
|
||||
*RLen = SendChatHeader(Reply, Session->Key);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
GetParam(input, "ApplNum=", Temp);
|
||||
ChatApplNum = atoi(Temp);
|
||||
GetParam(input, "Streams=", Temp);
|
||||
MaxChatStreams = atoi(Temp);
|
||||
GetParam(input, "Paclen=", Temp);
|
||||
chatPaclen = atoi(Temp);
|
||||
if (chatPaclen < 60)
|
||||
chatPaclen = 60;
|
||||
|
||||
GetCheckBox(input, "Events=", &reportChatEvents);
|
||||
|
||||
GetParam(input, "nodes=", Nodes);
|
||||
|
||||
ptr1 = Nodes;
|
||||
ptr2 = OtherNodesList;
|
||||
|
||||
// Now we just save with crlf in place
|
||||
|
||||
strcpy(OtherNodesList, Nodes);
|
||||
/*
|
||||
while (*ptr1)
|
||||
{
|
||||
if ((*ptr1) == 13)
|
||||
{
|
||||
*(ptr2++) = ' ';
|
||||
ptr1 += 2;
|
||||
}
|
||||
else
|
||||
*(ptr2++) = *(ptr1++);
|
||||
}
|
||||
*ptr2 = 0;
|
||||
*/
|
||||
GetParam(input, "Posn=", Position);
|
||||
GetParam(input, "MapText=", PopupText);
|
||||
GetParam(input, "welcome=", ChatWelcomeMsg);
|
||||
|
||||
// Replace cr lf in string with $W
|
||||
|
||||
ptr1 = ChatWelcomeMsg;
|
||||
|
||||
scan2:
|
||||
|
||||
ptr1 = strstr(ptr1, "\r\n");
|
||||
|
||||
if (ptr1)
|
||||
{
|
||||
*(ptr1++)='$'; // put in cr
|
||||
*(ptr1++)='W'; // put in lf
|
||||
|
||||
goto scan2;
|
||||
}
|
||||
|
||||
GetCheckBox(input, "PopType=Click", &PopupMode);
|
||||
|
||||
if (strstr(input, "Restart=Restart+Links"))
|
||||
{
|
||||
char * ptr1, * ptr2, * Context;
|
||||
|
||||
node_close();
|
||||
|
||||
Sleep(2);
|
||||
|
||||
// Dont call removelinks - they may still be attached to a circuit. Just clear header
|
||||
|
||||
link_hd = NULL;
|
||||
|
||||
// Set up other nodes list. rtlink messes with the string so pass copy
|
||||
|
||||
ptr2 = ptr1 = strtok_s(_strdup(OtherNodesList), "\r\n", &Context);
|
||||
|
||||
while (ptr1)
|
||||
{
|
||||
rtlink(ptr1);
|
||||
ptr1 = strtok_s(NULL, "\r\n", &Context);
|
||||
}
|
||||
|
||||
free(ptr2);
|
||||
|
||||
if (user_hd) // Any Users?
|
||||
makelinks(); // Bring up links
|
||||
}
|
||||
|
||||
if (strstr(input, "UpdateMap=Update+Map"))
|
||||
{
|
||||
char Msg[500];
|
||||
int len;
|
||||
|
||||
len = sprintf(Msg, "INFO %s|%s|%d|\r", Position, PopupText, PopupMode);
|
||||
|
||||
if (len < 256)
|
||||
Send_MON_Datagram(Msg, len);
|
||||
|
||||
}
|
||||
SaveChatConfigFile(ChatConfigName);
|
||||
GetChatConfig(ChatConfigName);
|
||||
}
|
||||
|
||||
SendChatConfigPage(Reply, RLen, Key);
|
||||
return;
|
||||
}
|
||||
|
||||
VOID ProcessChatDisUser(struct HTTPConnectionInfo * Session, char * MsgPtr, char * Reply, int * RLen, char * Rest)
|
||||
{
|
||||
char * input;
|
||||
char * ptr;
|
||||
|
||||
input = strstr(MsgPtr, "\r\n\r\n"); // End of headers
|
||||
|
||||
if (input)
|
||||
{
|
||||
ptr = strstr(input, "Stream=");
|
||||
if (ptr)
|
||||
{
|
||||
int Stream = atoi(ptr + 7);
|
||||
SessionControl(Stream, 2, 0);
|
||||
}
|
||||
}
|
||||
SendChatStatusPage(Reply, RLen, Rest);
|
||||
}
|
||||
|
||||
VOID SendChatConfigPage(char * Reply, int * ReplyLen, char * Key)
|
||||
{
|
||||
int Len;
|
||||
char Nodes[10000];
|
||||
char Text[1000];
|
||||
char * ptr1, * ptr2;
|
||||
|
||||
// Replace spaces in Node List with CR/LF
|
||||
|
||||
ptr1 = OtherNodesList;
|
||||
ptr2 = Nodes;
|
||||
|
||||
if (strchr(OtherNodesList, 13)) // New format maybe with connect scripts
|
||||
{
|
||||
// OtherNodesList alresdy has crlf
|
||||
|
||||
strcpy(Nodes, OtherNodesList);
|
||||
}
|
||||
else
|
||||
{
|
||||
while (*ptr1)
|
||||
{
|
||||
if ((*ptr1) == ' ')
|
||||
{
|
||||
*(ptr2++) = 13;
|
||||
*(ptr2++) = 10;
|
||||
ptr1++ ;
|
||||
}
|
||||
else
|
||||
*(ptr2++) = *(ptr1++);
|
||||
}
|
||||
|
||||
*ptr2 = 0;
|
||||
}
|
||||
|
||||
// Replace " in Text with "
|
||||
|
||||
ptr1 = PopupText;
|
||||
ptr2 = Text;
|
||||
|
||||
while (*ptr1)
|
||||
{
|
||||
if ((*ptr1) == '"')
|
||||
{
|
||||
*(ptr2++) = '&';
|
||||
*(ptr2++) = 'q';
|
||||
*(ptr2++) = 'u';
|
||||
*(ptr2++) = 'o';
|
||||
*(ptr2++) = 't';
|
||||
*(ptr2++) = ';';
|
||||
ptr1++ ;
|
||||
}
|
||||
else
|
||||
*(ptr2++) = *(ptr1++);
|
||||
}
|
||||
|
||||
*ptr2 = 0;
|
||||
|
||||
// Replace $W in Welcome Message with cr lf
|
||||
|
||||
ptr2 = ptr1 = _strdup(ChatWelcomeMsg);
|
||||
|
||||
scan:
|
||||
|
||||
ptr1 = strstr(ptr1, "$W");
|
||||
|
||||
if (ptr1)
|
||||
{
|
||||
*(ptr1++)=13; // put in cr
|
||||
*(ptr1++)=10; // put in lf
|
||||
|
||||
goto scan;
|
||||
}
|
||||
|
||||
Len = sprintf(Reply, ChatConfigTemplate,
|
||||
OurNode, Key, Key, Key,
|
||||
ChatApplNum, MaxChatStreams,
|
||||
(reportChatEvents) ? CHKD : UNC,
|
||||
Nodes, chatPaclen, Position,
|
||||
(PopupMode) ? UNC : CHKD,
|
||||
(PopupMode) ? CHKD : UNC, Text, ptr2);
|
||||
|
||||
free(ptr2);
|
||||
|
||||
*ReplyLen = Len;
|
||||
}
|
||||
|
||||
VOID SendChatStatusPage(char * Reply, int * ReplyLen, char * Key)
|
||||
{
|
||||
int Len = 0;
|
||||
USER *user;
|
||||
char * Alias;
|
||||
char * Topic;
|
||||
LINK *link;
|
||||
|
||||
char Streams[65536];
|
||||
char Users[65536];
|
||||
char Links[65536];
|
||||
|
||||
ChatCIRCUIT * conn;
|
||||
int i = 0, n;
|
||||
|
||||
Users[0] = 0;
|
||||
|
||||
for (user = user_hd; user; user = user->next)
|
||||
{
|
||||
if ((user->node == 0) || (user->node->alias == 0))
|
||||
Alias = "(Corrupt Alias)";
|
||||
else
|
||||
Alias = user->node->alias;
|
||||
|
||||
if ((user->topic == 0) || (user->topic->name == 0))
|
||||
Topic = "(Corrupt Topic)";
|
||||
else
|
||||
Topic = user->topic->name;
|
||||
|
||||
Len += sprintf(&Users[Len], "<tr><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%d</td><td>%s</td></tr>",
|
||||
user->call, Alias, user->name, Topic, (int)(time(NULL) - user->lastrealmsgtime), user->qth);
|
||||
|
||||
}
|
||||
|
||||
Links[0] = 0;
|
||||
|
||||
Len = 0;
|
||||
|
||||
for (link = link_hd; link; link = link->next)
|
||||
{
|
||||
if (link->flags & p_linked )
|
||||
if (link->supportsPolls)
|
||||
Len += sprintf(&Links[Len], "<tr><td>%s</td><td>Open   RTT %d</td></tr>", link->call, link->RTT);
|
||||
else
|
||||
Len += sprintf(&Links[Len], "<tr><td>%s</td><td>Open</td></tr>", link->call);
|
||||
else if (link->flags & (p_linked | p_linkini))
|
||||
Len += sprintf(&Links[Len], "<tr><td>%s</td><td>Connecting</td></tr>", link->call);
|
||||
else if (link->flags & p_linkfailed)
|
||||
Len += sprintf(&Links[Len], "<tr><td>%s</td><td>Connect failed</td></tr>", link->call);
|
||||
else
|
||||
Len += sprintf(&Links[Len], "<tr><td>%s</td><td>Idle</td></tr>", link->call);
|
||||
}
|
||||
|
||||
Len = 0;
|
||||
Streams[0] = 0;
|
||||
|
||||
for (n = 0; n < NumberofChatStreams; n++)
|
||||
{
|
||||
conn=&ChatConnections[n];
|
||||
i = conn->BPQStream;
|
||||
if (!conn->Active)
|
||||
{
|
||||
Len += sprintf(&Streams[Len], "<tr><td onclick= SelectRow(%d) id=cell_%d>Idle</td><td> </td><td> </td><td> </td><td> </td></tr>", i, i);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (conn->Flags & CHATLINK)
|
||||
{
|
||||
if (conn->BPQStream > 64 || conn->u.link == 0 || conn->u.link->alias == 0)
|
||||
Len += sprintf(&Streams[Len], "<tr><td onclick= SelectRow(%d) id=cell_%d>** Corrupt ChatLink **</td>"
|
||||
"<td> </td><td> </td><td> </td><td> </td></tr>", i, i);
|
||||
else
|
||||
Len += sprintf(&Streams[Len], "<tr><td onclick='SelectRow(%d)' id='cell_%d'>"
|
||||
"%s</td><td>%s</td><td>%d</td><td>%s</td><td>%d</td></tr>",
|
||||
i, i, "Chat Link", conn->u.link->alias, conn->BPQStream,
|
||||
"", conn->OutputQueueLength - conn->OutputGetPointer);
|
||||
}
|
||||
else
|
||||
if ((conn->Flags & CHATMODE) && conn->topic && conn->u.user && conn->u.user->call)
|
||||
{
|
||||
Len += sprintf(&Streams[Len], "<tr><td onclick='SelectRow(%d)' id='cell_%d'>%s</td><td>%s</td><td>%d</td><td>%s</td><td>%d</td></tr>",
|
||||
i, i, conn->u.user->name, conn->u.user->call, conn->BPQStream,
|
||||
conn->topic->topic->name, conn->OutputQueueLength - conn->OutputGetPointer);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (conn->UserPointer == 0)
|
||||
Len += sprintf(&Streams[Len], "Logging in");
|
||||
else
|
||||
{
|
||||
Len += sprintf(&Streams[Len], "<tr><td onclick='SelectRow(%d)' id='cell_%d'>%s</td><td>%s</td><td>%d</td><td>%s</td><td>%d</td></tr>",
|
||||
i, i, conn->UserPointer->Name, conn->UserPointer->Call, conn->BPQStream,
|
||||
"CHAT", conn->OutputQueueLength - conn->OutputGetPointer);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Len = sprintf(Reply, ChatStatusTemplate, OurNode, OurNode, Key, Key, Key, Streams, Users, Links);
|
||||
*ReplyLen = Len;
|
||||
}
|
||||
|
||||
|
||||
static struct HTTPConnectionInfo * AllocateSession(char Appl)
|
||||
{
|
||||
int KeyVal;
|
||||
struct HTTPConnectionInfo * Session = zalloc(sizeof(struct HTTPConnectionInfo));
|
||||
|
||||
if (Session == NULL)
|
||||
return NULL;
|
||||
|
||||
KeyVal = (int)time(NULL);
|
||||
|
||||
sprintf(Session->Key, "%c%012X", Appl, KeyVal);
|
||||
|
||||
if (SessionList)
|
||||
Session->Next = SessionList;
|
||||
|
||||
SessionList = Session;
|
||||
|
||||
return Session;
|
||||
}
|
||||
|
||||
static struct HTTPConnectionInfo * FindSession(char * Key)
|
||||
{
|
||||
struct HTTPConnectionInfo * Session = SessionList;
|
||||
|
||||
while (Session)
|
||||
{
|
||||
if (strcmp(Session->Key, Key) == 0)
|
||||
return Session;
|
||||
|
||||
Session = Session->Next;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
#ifdef WIN32
|
||||
|
||||
static char PipeFileName[] = "\\\\.\\pipe\\BPQChatWebPipe";
|
||||
|
||||
static DWORD WINAPI InstanceThread(LPVOID lpvParam)
|
||||
|
||||
// This routine is a thread processing function to read from and reply to a client
|
||||
// via the open pipe connection passed from the main loop. Note this allows
|
||||
// the main loop to continue executing, potentially creating more threads of
|
||||
// of this procedure to run concurrently, depending on the number of incoming
|
||||
// client connections.
|
||||
{
|
||||
DWORD cbBytesRead = 0, cbReplyBytes = 0, cbWritten = 0;
|
||||
BOOL fSuccess = FALSE;
|
||||
HANDLE hPipe = NULL;
|
||||
char Buffer[4096];
|
||||
char OutBuffer[100000];
|
||||
char * MsgPtr;
|
||||
int InputLen = 0;
|
||||
int OutputLen = 0;
|
||||
struct HTTPConnectionInfo Session;
|
||||
char URL[4096];
|
||||
char * Context, * Method;
|
||||
int n;
|
||||
|
||||
char * ptr;
|
||||
|
||||
// Debugprintf("InstanceThread created, receiving and processing messages.");
|
||||
|
||||
// The thread's parameter is a handle to a pipe object instance.
|
||||
|
||||
hPipe = (HANDLE) lpvParam;
|
||||
|
||||
// Read client requests from the pipe. This simplistic code only allows messages
|
||||
// up to BUFSIZE characters in length.
|
||||
|
||||
n = ReadFile(hPipe, &Session, sizeof (struct HTTPConnectionInfo), &n, NULL);
|
||||
fSuccess = ReadFile(hPipe, Buffer, 4096, &InputLen, NULL);
|
||||
|
||||
if (!fSuccess || InputLen == 0)
|
||||
{
|
||||
if (GetLastError() == ERROR_BROKEN_PIPE)
|
||||
Debugprintf("InstanceThread: client disconnected.", GetLastError());
|
||||
else
|
||||
Debugprintf("InstanceThread ReadFile failed, GLE=%d.", GetLastError());
|
||||
}
|
||||
else
|
||||
{
|
||||
Buffer[InputLen] = 0;
|
||||
|
||||
MsgPtr = &Buffer[0];
|
||||
|
||||
strcpy(URL, MsgPtr);
|
||||
|
||||
ptr = strstr(URL, " HTTP");
|
||||
|
||||
if (ptr)
|
||||
*ptr = 0;
|
||||
|
||||
Method = strtok_s(URL, " ", &Context);
|
||||
|
||||
ProcessChatHTTPMessage(&Session, Method, Context, MsgPtr, OutBuffer, &OutputLen);
|
||||
|
||||
WriteFile(hPipe, &Session, sizeof (struct HTTPConnectionInfo), &n, NULL);
|
||||
WriteFile(hPipe, OutBuffer, OutputLen, &cbWritten, NULL);
|
||||
|
||||
FlushFileBuffers(hPipe);
|
||||
DisconnectNamedPipe(hPipe);
|
||||
CloseHandle(hPipe);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
static DWORD WINAPI PipeThreadProc(LPVOID lpvParam)
|
||||
{
|
||||
BOOL fConnected = FALSE;
|
||||
DWORD dwThreadId = 0;
|
||||
HANDLE hPipe = INVALID_HANDLE_VALUE, hThread = NULL;
|
||||
|
||||
// The main loop creates an instance of the named pipe and
|
||||
// then waits for a client to connect to it. When the client
|
||||
// connects, a thread is created to handle communications
|
||||
// with that client, and this loop is free to wait for the
|
||||
// next client connect request. It is an infinite loop.
|
||||
|
||||
for (;;)
|
||||
{
|
||||
hPipe = CreateNamedPipe(
|
||||
PipeFileName, // pipe name
|
||||
PIPE_ACCESS_DUPLEX, // read/write access
|
||||
PIPE_TYPE_BYTE | // message type pipe
|
||||
PIPE_WAIT, // blocking mode
|
||||
PIPE_UNLIMITED_INSTANCES, // max. instances
|
||||
4096, // output buffer size
|
||||
4096, // input buffer size
|
||||
0, // client time-out
|
||||
NULL); // default security attribute
|
||||
|
||||
if (hPipe == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
Debugprintf("CreateNamedPipe failed, GLE=%d.\n", GetLastError());
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Wait for the client to connect; if it succeeds,
|
||||
// the function returns a nonzero value. If the function
|
||||
// returns zero, GetLastError returns ERROR_PIPE_CONNECTED.
|
||||
|
||||
fConnected = ConnectNamedPipe(hPipe, NULL) ?
|
||||
TRUE : (GetLastError() == ERROR_PIPE_CONNECTED);
|
||||
|
||||
if (fConnected)
|
||||
{
|
||||
// Create a thread for this client.
|
||||
|
||||
hThread = CreateThread(
|
||||
NULL, // no security attribute
|
||||
0, // default stack size
|
||||
InstanceThread, // thread proc
|
||||
(LPVOID) hPipe, // thread parameter
|
||||
0, // not suspended
|
||||
&dwThreadId); // returns thread ID
|
||||
|
||||
if (hThread == NULL)
|
||||
{
|
||||
Debugprintf("CreateThread failed, GLE=%d.\n", GetLastError());
|
||||
return -1;
|
||||
}
|
||||
else CloseHandle(hThread);
|
||||
}
|
||||
else
|
||||
// The client could not connect, so close the pipe.
|
||||
CloseHandle(hPipe);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
BOOL CreateChatPipeThread()
|
||||
{
|
||||
DWORD ThreadId;
|
||||
CreateThread(NULL, 0, PipeThreadProc, 0, 0, &ThreadId);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static char *month[] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
|
||||
static char *dat[] = {"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"};
|
||||
|
||||
|
||||
static VOID FormatTime(char * Time, time_t cTime)
|
||||
{
|
||||
struct tm * TM;
|
||||
TM = gmtime(&cTime);
|
||||
|
||||
sprintf(Time, "%s, %02d %s %3d %02d:%02d:%02d GMT", dat[TM->tm_wday], TM->tm_mday, month[TM->tm_mon],
|
||||
TM->tm_year + 1900, TM->tm_hour, TM->tm_min, TM->tm_sec);
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,451 @@
|
||||
//
|
||||
// Prototypes for BPQ32 Node Functions
|
||||
//
|
||||
|
||||
#define DllImport
|
||||
|
||||
#define EXCLUDEBITS
|
||||
|
||||
#define _WINSOCK_DEPRECATED_NO_WARNINGS
|
||||
|
||||
#include "compatbits.h"
|
||||
|
||||
#include "asmstrucs.h"
|
||||
|
||||
BOOL CheckExcludeList(UCHAR * Call);
|
||||
|
||||
Dll int ConvFromAX25(unsigned char * incall,unsigned char * outcall);
|
||||
Dll BOOL ConvToAX25(unsigned char * callsign, unsigned char * ax25call);
|
||||
DllExport BOOL ConvToAX25Ex(unsigned char * callsign, unsigned char * ax25call);
|
||||
int WritetoConsoleLocal(char * buff);
|
||||
VOID Consoleprintf(const char * format, ...);
|
||||
VOID FreeConfig();
|
||||
int GetListeningPortsPID(int Port);
|
||||
|
||||
void * InitializeExtDriver(PEXTPORTDATA PORTVEC);
|
||||
|
||||
VOID PutLengthinBuffer(PDATAMESSAGE buff, USHORT datalen); // Needed for arm5 portability
|
||||
int GetLengthfromBuffer(PDATAMESSAGE buff);
|
||||
int IntDecodeFrame(MESSAGE * msg, char * buffer, time_t Stamp, uint64_t Mask, BOOL APRS, BOOL MCTL);
|
||||
int IntSetTraceOptionsEx(uint64_t mask, int mtxparam, int mcomparam, int monUIOnly);
|
||||
int CountBits64(uint64_t in);
|
||||
|
||||
|
||||
#define GetSemaphore(Semaphore,ID) _GetSemaphore(Semaphore, ID, __FILE__, __LINE__)
|
||||
|
||||
#define GetBuff() _GetBuff(__FILE__, __LINE__)
|
||||
#define ReleaseBuffer(s) _ReleaseBuffer(s, __FILE__, __LINE__)
|
||||
#define CheckGuardZone() _CheckGuardZone(__FILE__, __LINE__)
|
||||
|
||||
#define Q_REM(s) _Q_REM(s, __FILE__, __LINE__)
|
||||
#define Q_REM_NP(s) _Q_REM_NP(s, __FILE__, __LINE__)
|
||||
|
||||
#define C_Q_ADD(s, b) _C_Q_ADD(s, b, __FILE__, __LINE__)
|
||||
|
||||
void _CheckGuardZone(char * File, int Line);
|
||||
|
||||
VOID * _Q_REM(VOID **Q, char * File, int Line);
|
||||
VOID * _Q_REM_NP(VOID *Q, char * File, int Line);
|
||||
|
||||
int _C_Q_ADD(VOID *Q, VOID *BUFF, char * File, int Line);
|
||||
|
||||
UINT _ReleaseBuffer(VOID *BUFF, char * File, int Line);
|
||||
|
||||
VOID * _GetBuff(char * File, int Line);
|
||||
int _C_Q_ADD(VOID *PQ, VOID *PBUFF, char * File, int Line);
|
||||
|
||||
int C_Q_COUNT(VOID *Q);
|
||||
|
||||
DllExport char * APIENTRY GetApplCall(int Appl);
|
||||
DllExport char * APIENTRY GetApplAlias(int Appl);
|
||||
DllExport int APIENTRY FindFreeStream();
|
||||
DllExport int APIENTRY DeallocateStream(int stream);
|
||||
DllExport int APIENTRY SessionState(int stream, int * state, int * change);
|
||||
DllExport int APIENTRY SetAppl(int stream, int flags, int mask);
|
||||
DllExport int APIENTRY GetMsg(int stream, char * msg, int * len, int * count );
|
||||
DllExport int APIENTRY GetConnectionInfo(int stream, char * callsign,
|
||||
int * port, int * sesstype, int * paclen,
|
||||
int * maxframe, int * l4window);
|
||||
|
||||
#define LIBCONFIG_STATIC
|
||||
#include "libconfig.h"
|
||||
|
||||
int GetIntValue(config_setting_t * group, char * name);
|
||||
BOOL GetStringValue(config_setting_t * group, char * name, char * value, int maxlen);
|
||||
VOID SaveIntValue(config_setting_t * group, char * name, int value);
|
||||
VOID SaveStringValue(config_setting_t * group, char * name, char * value);
|
||||
|
||||
int EncryptPass(char * Pass, char * Encrypt);
|
||||
VOID DecryptPass(char * Encrypt, unsigned char * Pass, unsigned int len);
|
||||
Dll VOID APIENTRY CreateOneTimePassword(char * Password, char * KeyPhrase, int TimeOffset);
|
||||
Dll BOOL APIENTRY CheckOneTimePassword(char * Password, char * KeyPhrase);
|
||||
|
||||
DllExport int APIENTRY TXCount(int stream);
|
||||
DllExport int APIENTRY RXCount(int stream);
|
||||
DllExport int APIENTRY MONCount(int stream);
|
||||
|
||||
VOID ReadNodes();
|
||||
int BPQTRACE(MESSAGE * Msg, BOOL APRS);
|
||||
|
||||
VOID CommandHandler(TRANSPORTENTRY * Session, struct DATAMESSAGE * Buffer);
|
||||
|
||||
VOID PostStateChange(TRANSPORTENTRY * Session);
|
||||
|
||||
VOID InnerCommandHandler(TRANSPORTENTRY * Session, struct DATAMESSAGE * Buffer);
|
||||
VOID DoTheCommand(TRANSPORTENTRY * Session);
|
||||
char * MOVEANDCHECK(TRANSPORTENTRY * Session, char * Bufferptr, char * Source, int Len);
|
||||
VOID DISPLAYCIRCUIT(TRANSPORTENTRY * L4, char * Buffer);
|
||||
char * strlop(char * buf, char delim);
|
||||
BOOL CompareCalls(UCHAR * c1, UCHAR * c2);
|
||||
|
||||
VOID PostDataAvailable(TRANSPORTENTRY * Session);
|
||||
int WritetoConsoleLocal(char * buff);
|
||||
char * CHECKBUFFER(TRANSPORTENTRY * Session, char * Bufferptr);
|
||||
VOID CLOSECURRENTSESSION(TRANSPORTENTRY * Session);
|
||||
|
||||
VOID SendCommandReply(TRANSPORTENTRY * Session, struct DATAMESSAGE * Buffer, int Len);
|
||||
|
||||
DllExport struct PORTCONTROL * APIENTRY GetPortTableEntryFromPortNum(int portnum);
|
||||
|
||||
int cCOUNT_AT_L2(struct _LINKTABLE * LINK);
|
||||
VOID SENDL4CONNECT(TRANSPORTENTRY * Session);
|
||||
|
||||
VOID CloseSessionPartner(TRANSPORTENTRY * Session);
|
||||
int COUNTNODES(struct ROUTE * ROUTE);
|
||||
int DecodeNodeName(char * NodeName, char * ptr);;
|
||||
VOID DISPLAYCIRCUIT(TRANSPORTENTRY * L4, char * Buffer);
|
||||
int cCOUNT_AT_L2(struct _LINKTABLE * LINK);
|
||||
void * zalloc(int len);
|
||||
BOOL FindDestination(UCHAR * Call, struct DEST_LIST ** REQDEST);
|
||||
|
||||
BOOL ProcessConfig();
|
||||
|
||||
VOID PUT_ON_PORT_Q(struct PORTCONTROL * PORT, MESSAGE * Buffer);
|
||||
VOID CLEAROUTLINK(struct _LINKTABLE * LINK);
|
||||
VOID TellINP3LinkGone(struct ROUTE * Route);
|
||||
VOID CLEARACTIVEROUTE(struct ROUTE * ROUTE, int Reason);
|
||||
|
||||
// Reason Equates
|
||||
|
||||
#define NORMALCLOSE 0
|
||||
#define RETRIEDOUT 1
|
||||
#define SETUPFAILED 2
|
||||
#define LINKLOST 3
|
||||
#define LINKSTUCK 4
|
||||
|
||||
int COUNT_AT_L2(struct _LINKTABLE * LINK);
|
||||
VOID SENDIDMSG();
|
||||
VOID SENDBTMSG();
|
||||
VOID INP3TIMER();
|
||||
VOID REMOVENODE(dest_list * DEST);
|
||||
BOOL ACTIVATE_DEST(struct DEST_LIST * DEST);
|
||||
VOID TellINP3LinkSetupFailed(struct ROUTE * Route);
|
||||
BOOL FindNeighbour(UCHAR * Call, int Port, struct ROUTE ** REQROUTE);
|
||||
VOID PROCROUTES(struct DEST_LIST * DEST, struct ROUTE * ROUTE, int Qual);
|
||||
BOOL L2SETUPCROSSLINK(PROUTE ROUTE);
|
||||
VOID REMOVENODE(dest_list * DEST);
|
||||
char * SetupNodeHeader(struct DATAMESSAGE * Buffer);
|
||||
VOID L4CONNECTFAILED(TRANSPORTENTRY * L4);
|
||||
int CountFramesQueuedOnSession(TRANSPORTENTRY * Session);
|
||||
VOID CLEARSESSIONENTRY(TRANSPORTENTRY * Session);
|
||||
VOID __cdecl Debugprintf(const char * format, ...);
|
||||
|
||||
int APIENTRY Restart();
|
||||
int APIENTRY Reboot();
|
||||
int APIENTRY Reconfig();
|
||||
Dll int APIENTRY SaveNodes ();
|
||||
|
||||
|
||||
struct SEM;
|
||||
|
||||
void _GetSemaphore(struct SEM * Semaphore, int ID, char * File, int Line);
|
||||
void FreeSemaphore(struct SEM * Semaphore);
|
||||
|
||||
void MySetWindowText(HWND hWnd, char * Msg);
|
||||
|
||||
Dll int APIENTRY SessionControl(int stream, int command, int Mask);
|
||||
|
||||
HANDLE OpenCOMPort(VOID * pPort, int speed, BOOL SetDTR, BOOL SetRTS, BOOL Quiet, int Stopbits);
|
||||
int ReadCOMBlock(HANDLE fd, char * Block, int MaxLength);
|
||||
BOOL WriteCOMBlock(HANDLE fd, char * Block, int BytesToWrite);
|
||||
VOID CloseCOMPort(HANDLE fd);
|
||||
|
||||
VOID initUTF8();
|
||||
int Is8Bit(unsigned char *cpt, int len);
|
||||
int WebIsUTF8(unsigned char *ptr, int len);
|
||||
int IsUTF8(unsigned char *ptr, int len);
|
||||
int Convert437toUTF8(unsigned char * MsgPtr, int len, unsigned char * UTF);
|
||||
int Convert1251toUTF8(unsigned char * MsgPtr, int len, unsigned char * UTF);
|
||||
int Convert1252toUTF8(unsigned char * MsgPtr, int len, unsigned char * UTF);
|
||||
int TrytoGuessCode(unsigned char * Char, int Len);
|
||||
|
||||
|
||||
#define CMD_TO_APPL 1 // PASS COMMAND TO APPLICATION
|
||||
#define MSG_TO_USER 2 // SEND 'CONNECTED' TO USER
|
||||
#define MSG_TO_APPL 4 // SEND 'CONECTED' TO APPL
|
||||
#define CHECK_FOR_ESC 8 // Look for ^d (^D) to disconnect session)
|
||||
|
||||
#define UI 3
|
||||
#define SABM 0x2F
|
||||
#define DISC 0x43
|
||||
#define DM 0x0F
|
||||
#define UA 0x63
|
||||
#define FRMR 0x87
|
||||
#define RR 1
|
||||
#define RNR 5
|
||||
#define REJ 9
|
||||
|
||||
// V2.2 Types
|
||||
|
||||
#define SREJ 0x0D
|
||||
#define SABME 0x6F
|
||||
#define XID 0xAF
|
||||
#define TEST 0xE3
|
||||
|
||||
// XID Optional Functions
|
||||
|
||||
#define OPMustHave 0x02A080 // Sync TEST 16 bit FCS Extended Address
|
||||
#define OPSREJ 4
|
||||
#define OPSREJMult 0x200000
|
||||
#define OPREJ 2
|
||||
#define OPMod8 0x400
|
||||
#define OPMod128 0x800
|
||||
|
||||
#define BPQHOSTSTREAMS 64
|
||||
|
||||
extern TRANSPORTENTRY * L4TABLE;
|
||||
extern unsigned char NEXTID;
|
||||
extern int MAXCIRCUITS;
|
||||
extern int L4DEFAULTWINDOW;
|
||||
extern int L4T1;
|
||||
extern APPLCALLS APPLCALLTABLE[];
|
||||
extern char * APPLS;
|
||||
extern int NEEDMH;
|
||||
extern int RFOnly;
|
||||
|
||||
extern char SESSIONHDDR[];
|
||||
|
||||
extern UCHAR NEXTID;
|
||||
|
||||
extern struct ROUTE * NEIGHBOURS;
|
||||
extern int MAXNEIGHBOURS;
|
||||
|
||||
extern struct ROUTE * NEIGHBOURS;
|
||||
extern int ROUTE_LEN;
|
||||
extern int MAXNEIGHBOURS;
|
||||
|
||||
extern struct DEST_LIST * DESTS; // NODE LIST
|
||||
extern struct DEST_LIST * ENDDESTLIST;
|
||||
extern int DEST_LIST_LEN;
|
||||
extern int MAXDESTS; // MAX NODES IN SYSTEM
|
||||
|
||||
extern struct _LINKTABLE * LINKS;
|
||||
extern int LINK_TABLE_LEN;
|
||||
extern int MAXLINKS;
|
||||
|
||||
|
||||
|
||||
extern char MYCALL[]; // DB 7 DUP (0) ; NODE CALLSIGN (BIT SHIFTED)
|
||||
extern char MYALIASTEXT[]; // {" " ; NODE ALIAS (KEEP TOGETHER)
|
||||
|
||||
extern UCHAR MYCALLWITHALIAS[13];
|
||||
extern APPLCALLS APPLCALLTABLE[NumberofAppls];
|
||||
|
||||
extern UCHAR MYNODECALL[]; // NODE CALLSIGN (ASCII)
|
||||
extern char NODECALLLOPPED[]; // NODE CALLSIGN (ASCII). Null terminated
|
||||
extern UCHAR MYNETROMCALL[]; // NETROM CALLSIGN (ASCII)
|
||||
|
||||
extern UCHAR NETROMCALL[]; // NETORM CALL (AX25)
|
||||
|
||||
extern VOID * FREE_Q;
|
||||
|
||||
extern struct PORTCONTROL * PORTTABLE;
|
||||
extern int NUMBEROFPORTS;
|
||||
|
||||
|
||||
extern int OBSINIT; // INITIAL OBSOLESCENCE VALUE
|
||||
extern int OBSMIN; // MINIMUM TO BROADCAST
|
||||
extern int L3INTERVAL; // "NODES" INTERVAL IN MINS
|
||||
extern int IDINTERVAL; // "ID" BROADCAST INTERVAL
|
||||
extern int BTINTERVAL; // "BT" BROADCAST INTERVAL
|
||||
extern int MINQUAL; // MIN QUALITY FOR AUTOUPDATES
|
||||
extern int HIDENODES; // N * COMMAND SWITCH
|
||||
extern int BBSQUAL; // QUALITY OF BBS RELATIVE TO NODE
|
||||
|
||||
extern int NUMBEROFBUFFERS; // PACKET BUFFERS
|
||||
extern int PACLEN; //MAX PACKET SIZE
|
||||
|
||||
// L2 SYSTEM TIMER RUNS AT 3 HZ
|
||||
|
||||
extern int T3; // LINK VALIDATION TIMER (3 MINS) (+ a bit to reduce RR collisions)
|
||||
|
||||
extern int L2KILLTIME; // IDLE LINK TIMER (16 MINS)
|
||||
extern int L3LIVES; // MAX L3 HOPS
|
||||
extern int L4N2; // LEVEL 4 RETRY COUNT
|
||||
extern int L4LIMIT; // IDLE SESSION LIMIT - 15 MINS
|
||||
extern int L4DELAY; // L4 DELAYED ACK TIMER
|
||||
|
||||
extern int BBS; // INCLUDE BBS SUPPORT
|
||||
extern int NODE; // INCLUDE SWITCH SUPPORT
|
||||
|
||||
extern int FULL_CTEXT; // CTEXT ON ALL CONNECTS IF NZ
|
||||
|
||||
|
||||
// Although externally streams are numbered 1 to 64, internally offsets are 0 - 63
|
||||
|
||||
extern BPQVECSTRUC DUMMYVEC; // Needed to force correct order of following
|
||||
|
||||
extern BPQVECSTRUC BPQHOSTVECTOR[BPQHOSTSTREAMS + 5];
|
||||
|
||||
extern int NODEORDER;
|
||||
extern UCHAR LINKEDFLAG;
|
||||
|
||||
extern UCHAR UNPROTOCALL[80];
|
||||
|
||||
|
||||
extern char * INFOMSG;
|
||||
|
||||
extern char * CTEXTMSG;
|
||||
extern int CTEXTLEN;
|
||||
|
||||
extern UCHAR MYALIAS[7]; // ALIAS IN AX25 FORM
|
||||
extern UCHAR BBSALIAS[7];
|
||||
|
||||
extern VOID * TRACE_Q; // TRANSMITTED FRAMES TO BE TRACED
|
||||
|
||||
extern char HEADERCHAR; // CHAR FOR _NODE HEADER MSGS
|
||||
|
||||
extern int AUTOSAVE; // AUTO SAVE NODES ON EXIT FLAG
|
||||
extern int L4APPL; // Application for BBSCALL/ALIAS connects
|
||||
extern int CFLAG; // C =HOST Command
|
||||
|
||||
extern VOID * IDMSG_Q; // ID/BEACONS WAITING TO BE SENT
|
||||
|
||||
extern struct DATAMESSAGE BTHDDR;
|
||||
extern struct _MESSAGE IDHDDR;
|
||||
|
||||
extern VOID * IDMSG;
|
||||
|
||||
extern int L3TIMER; // TIMER FOR 'NODES' MESSAGE
|
||||
extern int IDTIMER; // TIMER FOR ID MESSAGE
|
||||
extern int BTTIMER; // TIMER FOR BT MESSAGE
|
||||
|
||||
extern int STATSTIME;
|
||||
|
||||
|
||||
extern BOOL IPRequired;
|
||||
extern int MaxHops;
|
||||
extern int MAXRTT;
|
||||
extern USHORT CWTABLE[];
|
||||
extern TRANSPORTENTRY * L4TABLE;
|
||||
extern UCHAR ROUTEQUAL;
|
||||
extern UINT BPQMsg;
|
||||
extern UCHAR ExcludeList[];
|
||||
|
||||
|
||||
extern APPLCALLS APPLCALLTABLE[];
|
||||
|
||||
extern char VersionStringWithBuild[];
|
||||
extern char VersionString[];
|
||||
|
||||
extern int MAXHEARDENTRIES;
|
||||
extern int MHLEN;
|
||||
|
||||
extern int APPL1;
|
||||
extern int PASSCMD;
|
||||
extern int NUMBEROFCOMMANDS;
|
||||
|
||||
extern char * ConfigBuffer;
|
||||
|
||||
extern char * WL2KReportLine[];
|
||||
|
||||
extern struct CMDX COMMANDS[];
|
||||
|
||||
extern int QCOUNT, MAXBUFFS, MAXCIRCUITS, L4DEFAULTWINDOW, L4T1, CMDXLEN;
|
||||
extern char CMDALIAS[ALIASLEN][NumberofAppls];
|
||||
|
||||
extern int SEMGETS;
|
||||
extern int SEMRELEASES;
|
||||
extern int SEMCLASHES;
|
||||
extern int MINBUFFCOUNT;
|
||||
|
||||
extern UCHAR BPQDirectory[];
|
||||
extern UCHAR BPQProgramDirectory[];
|
||||
|
||||
extern UCHAR WINMOR[];
|
||||
extern UCHAR PACTORCALL[];
|
||||
|
||||
extern UCHAR MCOM;
|
||||
extern UCHAR MUIONLY;
|
||||
extern UCHAR MTX;
|
||||
extern uint64_t MMASK;
|
||||
|
||||
extern UCHAR NODECALL[]; // NODES in ax.25
|
||||
|
||||
extern int L4CONNECTSOUT;
|
||||
extern int L4CONNECTSIN;
|
||||
extern int L4FRAMESTX;
|
||||
extern int L4FRAMESRX;
|
||||
extern int L4FRAMESRETRIED;
|
||||
extern int OLDFRAMES;
|
||||
extern int L3FRAMES;
|
||||
|
||||
extern char * PortConfig[];
|
||||
extern struct SEM Semaphore;
|
||||
extern UCHAR AuthorisedProgram; // Local Variable. Set if Program is on secure list
|
||||
|
||||
extern int REALTIMETICKS;
|
||||
|
||||
extern time_t CurrentSecs;
|
||||
extern time_t lastSlowSecs;
|
||||
extern time_t lastSaveSecs;
|
||||
|
||||
// SNMP Variables
|
||||
|
||||
extern int InOctets[64];
|
||||
extern int OutOctets[64];
|
||||
|
||||
extern BOOL CloseAllNeeded;
|
||||
extern int CloseOnError;
|
||||
|
||||
extern char * PortConfig[70];
|
||||
extern struct TNCINFO * TNCInfo[71]; // Records are Malloc'd
|
||||
|
||||
#define MaxBPQPortNo 63 // Port 64 reserved for BBS Mon
|
||||
#define MAXBPQPORTS 63
|
||||
|
||||
// IP, APRS use port ocnfig slots above the real port range
|
||||
|
||||
#define IPConfigSlot MaxBPQPortNo + 1
|
||||
#define PortMapConfigSlot MaxBPQPortNo + 2
|
||||
#define APRSConfigSlot MaxBPQPortNo + 3
|
||||
|
||||
|
||||
extern char * UIUIDigi[MaxBPQPortNo + 1];
|
||||
extern char UIUIDEST[MaxBPQPortNo + 1][11]; // Dest for Beacons
|
||||
extern UCHAR FN[MaxBPQPortNo + 1][256]; // Filename
|
||||
extern int Interval[MaxBPQPortNo + 1]; // Beacon Interval (Mins)
|
||||
extern char Message[MaxBPQPortNo + 1][1000]; // Beacon Text
|
||||
|
||||
extern int MinCounter[MaxBPQPortNo + 1]; // Interval Countdown
|
||||
extern BOOL SendFromFile[MaxBPQPortNo + 1];
|
||||
|
||||
extern BOOL MQTT;
|
||||
extern char MQTT_HOST[80];
|
||||
extern int MQTT_PORT;
|
||||
extern char MQTT_USER[80];
|
||||
extern char MQTT_PASS[80];
|
||||
|
||||
extern int SUPPORT2point2;
|
||||
|
||||
|
||||
DllExport uint64_t APIENTRY GetPortFrequency(int PortNo, char * FreqStringMhz);
|
||||
|
||||
|
||||
void hookL2SessionAccepted(int Port, char * remotecall, char * ourcall, struct _LINKTABLE * LINK);
|
||||
void hookL2SessionDeleted(struct _LINKTABLE * LINK);
|
||||
void hookL2SessionAttempt(int Port, char * ourcall, char * remotecall, struct _LINKTABLE * LINK);
|
||||
|
||||
void hookL4SessionAttempt(void * STREAM, char * remotecall, char * ourcall);
|
||||
void hookL4SessionAccepted(void * STREAM, char * remotecall, char * ourcall);
|
||||
void hookL4SessionDeleted(struct TNCINFO * TNC, void * STREAM);
|
||||
@ -0,0 +1,604 @@
|
||||
/*
|
||||
|
||||
Declarations of BPQ32 API funtions
|
||||
|
||||
There are two sets of definitions, one for static linking against bpq32.lib, and one for
|
||||
dynamic linking using LoadLibrary/GetProcAddress
|
||||
|
||||
Define symbol DYNLOADBPQ before including this file to use the dynamic form.
|
||||
|
||||
If you are writing an External Driver, rather than an application,
|
||||
you must use Dynamic Linking, and you must also define symbol EXTDLL, which will
|
||||
make the code use GetProcAddress rather than LoadLibrary. Without this the reference
|
||||
count on BPQ32.dll gets messed up, and the code will not unload cleanly.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#ifndef DYNLOADBPQ
|
||||
|
||||
// Definitions for Statically Linked DLL
|
||||
|
||||
struct PORTCONTROL * APIENTRY GetPortTableEntryFromPortNum(int portslot);
|
||||
struct PORTCONTROL * APIENTRY GetPortTableEntryFromSlot(int portslot);
|
||||
|
||||
int APIENTRY GetPortHardwareType(struct PORTCONTROL *PORT);
|
||||
|
||||
|
||||
// Returns number of free buffers
|
||||
// (BPQHOST function 7 (part)).
|
||||
|
||||
int APIENTRY GetFreeBuffs();
|
||||
|
||||
// Returns count of packets waiting on stream
|
||||
// (BPQHOST function 7 (part)).
|
||||
|
||||
int APIENTRY RXCount(int Stream);
|
||||
|
||||
|
||||
// Returns number of packets on TX queue for stream
|
||||
// (BPQHOST function 7 (part)).
|
||||
|
||||
int APIENTRY TXCount(int Stream);
|
||||
|
||||
|
||||
// Returns number of monitor frames available
|
||||
// (BPQHOST function 7 (part)).
|
||||
|
||||
int APIENTRY MONCount(int Stream);
|
||||
|
||||
|
||||
// Returns call connecten on stream (BPQHOST function 8 (part)).
|
||||
|
||||
int APIENTRY GetCallsign(int stream, char * callsign);
|
||||
|
||||
|
||||
// Returns connection info for stream (BPQHOST function 8).
|
||||
|
||||
int APIENTRY GetConnectionInfo(int stream, char * callsign,
|
||||
int * port, int * sesstype, int * paclen,
|
||||
int * maxframe, int * l4window);
|
||||
|
||||
|
||||
int APIENTRY GetStreamPID(int Stream);
|
||||
|
||||
// Returns Path of BPQDirectroy
|
||||
|
||||
char * APIENTRY GetBPQDirectory();
|
||||
char * APIENTRY GetProgramDirectory();
|
||||
UCHAR * APIENTRY GetLogDirectory();
|
||||
|
||||
HKEY APIENTRY GetRegistryKey();
|
||||
char * APIENTRY GetRegistryKeyText();
|
||||
|
||||
char * APIENTRY GetSignOnMsg();
|
||||
|
||||
char * APIENTRY GetVersionString();
|
||||
|
||||
|
||||
// Returns number of prcess attached to BPQ32
|
||||
|
||||
int APIENTRY GetAttachedProcesses();
|
||||
|
||||
|
||||
// Send Session Control command (BPQHOST function 6)
|
||||
// Command = 0 Connect using APPL MASK IN param
|
||||
// Command = 1 Connect
|
||||
// Command = 2 Disconect
|
||||
// Command = 3 Return to Node
|
||||
|
||||
int APIENTRY SessionControl(int stream, int command, int param);
|
||||
|
||||
|
||||
|
||||
// Sets Application Flags and Mask for stream. (BPQHOST function 1)
|
||||
// Top bit of flags enables monitoring
|
||||
|
||||
int APIENTRY SetAppl(int stream, int flags, int mask);
|
||||
|
||||
|
||||
int APIENTRY GetApplMask(int Stream);
|
||||
|
||||
int APIENTRY GetApplFlags(int Stream);
|
||||
|
||||
|
||||
BOOL APIENTRY GetAllocationState(int Stream);
|
||||
|
||||
|
||||
// Get current Session State. Any state changed is ACK'ed
|
||||
// automatically. See BPQHOST functions 4 and 5.
|
||||
|
||||
int APIENTRY SessionState(int stream, int * state, int * change);
|
||||
|
||||
// Get current Session State. Dont Ack state change
|
||||
// See BPQHOST function 4.
|
||||
|
||||
int APIENTRY SessionStateNoAck(int stream, int * state);
|
||||
|
||||
|
||||
|
||||
// Send message to stream (BPQHOST Function 2)
|
||||
|
||||
int APIENTRY SendMsg(int stream, char * msg, int len);
|
||||
|
||||
|
||||
|
||||
// Send Raw (KISS mode) frame to port (BPQHOST function 10)
|
||||
|
||||
int APIENTRY SendRaw(int port, char * msg, int len);
|
||||
|
||||
|
||||
|
||||
// Get message from stream. Returns length, and count of frames
|
||||
// still waiting to be collected. (BPQHOST function 3)
|
||||
|
||||
int APIENTRY GetMsg(int stream, char * msg, int * len, int * count );
|
||||
|
||||
|
||||
// Perl Version - I couldn't get bpq32.pm to call GetMsg. Returns Lenth
|
||||
|
||||
int APIENTRY GetMsgPerl(int stream, char * msg);
|
||||
|
||||
|
||||
// Get Raw (Trace) data (BPQHOST function 11)
|
||||
|
||||
int APIENTRY GetRaw(int stream, char * msg, int * len, int * count );
|
||||
|
||||
|
||||
|
||||
// This is not an API function. It is a utility to decode a received
|
||||
// monitor frame into ascii text.
|
||||
|
||||
int APIENTRY DecodeFrame(char * msg, char * buffer, time_t Stamp);
|
||||
|
||||
|
||||
|
||||
// Sets the tracing options for DecodeFrame. Mask is a bit
|
||||
// mask of ports to monitor (ie 101 binary will monitor ports
|
||||
// 1 and 3). MTX enables monitoring on transmitted frames. MCOM
|
||||
// enables monitoring of protocol control frames (eg SABM, UA, RR),
|
||||
// as well as info frames.
|
||||
|
||||
int APIENTRY SetTraceOptions(long mask, int mtxparam, int mcomparam);
|
||||
int APIENTRY SetTraceOptionsEx(uint64_t mask, int mtxparam, int mcomparam, int monUIOnly);
|
||||
int APIENTRY SetTraceOptions64(uint64_t mask, int mtxparam, int mcomparam, int monUIOnly);
|
||||
|
||||
// Returns number of first unused BPQHOST stream. If none available,
|
||||
// returns 255. See API function 13.
|
||||
|
||||
int APIENTRY FindFreeStream();
|
||||
|
||||
|
||||
|
||||
// Allocate stream. If stream is already allocated, return nonzero.
|
||||
// Otherwise allocate stream, and return zero
|
||||
|
||||
int APIENTRY AllocateStream(int stream);
|
||||
|
||||
|
||||
|
||||
// Release stream.
|
||||
|
||||
int APIENTRY DeallocateStream(int stream);
|
||||
|
||||
// Get number of ports configured
|
||||
|
||||
int APIENTRY GetNumberofPorts();
|
||||
|
||||
|
||||
// Get port number (ports aren't necessarily numbered 1 to n)
|
||||
|
||||
int APIENTRY GetPortNumber(int portslot);
|
||||
|
||||
UCHAR * APIENTRY GetPortDescription(int portslot, char * Desc);
|
||||
|
||||
// Enable async operation - new to Win32 version of API
|
||||
|
||||
int APIENTRY BPQSetHandle(int Stream, HWND hWnd);
|
||||
|
||||
int ConvFromAX25(unsigned char * incall, unsigned char * outcall);
|
||||
BOOL ConvToAX25(unsigned char * callsign, unsigned char * ax25call);
|
||||
char * APIENTRY GetNodeCall();
|
||||
|
||||
int APIENTRY ChangeSessionCallsign(int Stream, unsigned char * AXCall);
|
||||
int APIENTRY ChangeSessionPaclen(int Stream, int Paclen);
|
||||
|
||||
int APIENTRY GetApplNum(int Stream);
|
||||
|
||||
char * APIENTRY GetApplCall(int Appl);
|
||||
|
||||
char * APIENTRY GetApplAlias(int Appl);
|
||||
|
||||
long APIENTRY GetApplQual(int Appl);
|
||||
|
||||
char * APIENTRY GetApplNabe(int Appl);
|
||||
|
||||
BOOL APIENTRY SetApplCall(int Appl, char * NewCall);
|
||||
|
||||
BOOL APIENTRY SetApplAlias(int Appl, char * NewCall);
|
||||
|
||||
BOOL APIENTRY SetApplQual(int Appl, int NewQual);
|
||||
|
||||
|
||||
// Routines to support "Minimize to Tray"
|
||||
|
||||
BOOL APIENTRY GetMinimizetoTrayFlag();
|
||||
|
||||
int APIENTRY AddTrayMenuItem(HWND hWnd, char * Label);
|
||||
|
||||
int APIENTRY DeleteTrayMenuItem(HWND hWnd);
|
||||
|
||||
BOOL APIENTRY StartMinimizedFlag();
|
||||
|
||||
// Log a message to the bpq32 console.
|
||||
|
||||
int APIENTRY WritetoConsole(char * buff);
|
||||
|
||||
// CheckTimer should be called regularly to ensure BPQ32 detects if an application crashes
|
||||
|
||||
int APIENTRY CheckTimer();
|
||||
|
||||
// CloseBPQ32 is used if you want to close and restart BPQ32 while your application is
|
||||
// running. This is only relevant of you have Dynamically linked BPQ32
|
||||
|
||||
int APIENTRY CloseBPQ32();
|
||||
|
||||
int APIENTRY GETBPQAPI();
|
||||
|
||||
UINT APIENTRY GETMONDECODE();
|
||||
|
||||
VOID APIENTRY RelBuff(VOID * Msg);
|
||||
//VOID *APIENTRY GetBuff();
|
||||
|
||||
VOID APIENTRY CreateOneTimePassword(char * Password, char * KeyPhrase, int TimeOffset);
|
||||
|
||||
BOOL APIENTRY CheckOneTimePassword(char * Password, char * KeyPhrase);
|
||||
|
||||
VOID APIENTRY md5 (char *arg, unsigned char * checksum);
|
||||
|
||||
int APIENTRY SetupTrayIcon();
|
||||
|
||||
BOOL APIENTRY SaveReg(char * KeyIn, HANDLE hFile);
|
||||
|
||||
VOID APIENTRY SendChatReport(UINT_PTR ChatReportSocket, char * buff, int txlen);
|
||||
|
||||
int APIENTRY CountFramesQueuedOnStream(int Stream);
|
||||
|
||||
char * APIENTRY GetLOC();
|
||||
|
||||
DllExport uint64_t APIENTRY GetPortFrequency(int PortNo, char * FreqString);
|
||||
|
||||
#else
|
||||
|
||||
struct PORTCONTROL * (FAR WINAPI * GetPortTableEntryFromPortNum) (int portnum);
|
||||
struct PORTCONTROL * (FAR WINAPI * GetPortTableEntryFromSlot) (int portslot);
|
||||
|
||||
// API Definitions for Dynamic Load of BPQ32.dll
|
||||
|
||||
ULONG (FAR WINAPI * GETBPQAPI)();
|
||||
|
||||
ULONG (FAR WINAPI * GETMONDECODE)();
|
||||
|
||||
UCHAR * (FAR WINAPI * GetBPQDirectory)();
|
||||
UCHAR * (FAR WINAPI * GetProgramDirectory)();
|
||||
UCHAR * (FAR WINAPI * GetRegistryKeyText)();
|
||||
HKEY (FAR WINAPI * GetRegistryKey)();
|
||||
|
||||
UCHAR * (FAR WINAPI * GetSignOnMsg)();
|
||||
UCHAR * (FAR WINAPI * GetVersionString)();
|
||||
|
||||
// Returns number of free buffers
|
||||
// (BPQHOST function 7 (part)).
|
||||
|
||||
int (FAR WINAPI * GetFreeBuffs)();
|
||||
|
||||
|
||||
// Returns count of packets waiting on stream
|
||||
// (BPQHOST function 7 (part)).
|
||||
|
||||
int (FAR WINAPI * RXCount) (int Stream);
|
||||
|
||||
// Returns number of packets on TX queue for stream
|
||||
// (BPQHOST function 7 (part)).
|
||||
|
||||
int (FAR WINAPI * TXCount)(int Stream);
|
||||
|
||||
|
||||
// Returns number of monitor frames available
|
||||
// (BPQHOST function 7 (part)).
|
||||
|
||||
int (FAR WINAPI * MONCount) (int Stream);
|
||||
|
||||
// Returns call connecten on stream (BPQHOST function 8 (part)).
|
||||
|
||||
int (FAR WINAPI * GetCallsign)(int stream, char * callsign);
|
||||
|
||||
// Returns connection info for stream (BPQHOST function 8).
|
||||
|
||||
int (FAR WINAPI * GetConnectionInfo) (int stream, char * callsign,
|
||||
int * port, int * sesstype, int * paclen,
|
||||
int * maxframe, int * l4window);
|
||||
|
||||
|
||||
int (FAR WINAPI * GetStreamPID) (int Stream);
|
||||
|
||||
// Returns Path of BPQDirectroy
|
||||
|
||||
UCHAR * (FAR WINAPI * GetBPQDirectory)();
|
||||
|
||||
// Returns number of prcess attached to BPQ32
|
||||
|
||||
int (FAR WINAPI * GetAttachedProcesses) ();
|
||||
|
||||
|
||||
// Send Session Control command (BPQHOST function 6)
|
||||
// Command = 0 Connect using APPL MASK IN param
|
||||
// Command = 1 Connect
|
||||
// Command = 2 Disconect
|
||||
// Command = 3 Return to Node
|
||||
|
||||
int (FAR WINAPI * SessionControl) (int stream, int command, int param);
|
||||
|
||||
|
||||
// Sets Application Flags and Mask for stream. (BPQHOST function 1)
|
||||
// Top bit of flags enables monitoring
|
||||
|
||||
int (FAR WINAPI * SetAppl) (int stream, int flags, int mask);
|
||||
|
||||
int (FAR WINAPI * GetApplMask) (int Stream);
|
||||
|
||||
int (FAR WINAPI * GetApplFlags)(int Stream);
|
||||
|
||||
BOOL (FAR WINAPI * GetAllocationState) (int Stream);
|
||||
|
||||
|
||||
|
||||
// Get current Session State. Any state changed is ACK'ed
|
||||
// automatically. See BPQHOST functions 4 and 5.
|
||||
|
||||
int (FAR WINAPI * SessionState) (int stream, int * state, int * change);
|
||||
|
||||
// Get current Session State. Dont Ack state change
|
||||
// See BPQHOST function 4.
|
||||
|
||||
int (FAR WINAPI * SessionStateNoAck) (int stream, int * state);
|
||||
|
||||
|
||||
// Send message to stream (BPQHOST Function 2)
|
||||
|
||||
int (FAR WINAPI * SendMsg) (int stream, char * msg, int len);
|
||||
|
||||
|
||||
// Send Raw (KISS mode) frame to port (BPQHOST function 10)
|
||||
|
||||
int (FAR WINAPI * SendRaw) (int port, char * msg, int len);
|
||||
|
||||
|
||||
// Get message from stream. Returns length, and count of frames
|
||||
// still waiting to be collected. (BPQHOST function 3)
|
||||
|
||||
int (FAR WINAPI * GetMsg) (int stream, char * msg, int * len, int * count );
|
||||
|
||||
|
||||
// Perl Version - I couldn't get bpq32.pm to call GetMsg. Returns Lenth
|
||||
|
||||
int (FAR WINAPI * GetMsgPerl) (int stream, char * msg);
|
||||
|
||||
|
||||
// Get Raw (Trace) data (BPQHOST function 11)
|
||||
|
||||
int (FAR WINAPI * GetRaw) (int stream, char * msg, int * len, int * count );
|
||||
|
||||
|
||||
|
||||
// This is not an API function. It is a utility to decode a received
|
||||
// monitor frame into ascii text.
|
||||
|
||||
int (FAR WINAPI * DecodeFrame) (char * msg, char * buffer, int Stamp);
|
||||
|
||||
|
||||
// Sets the tracing options for DecodeFrame. Mask is a bit
|
||||
// mask of ports to monitor (ie 101 binary will monitor ports
|
||||
// 1 and 3). MTX enables monitoring on transmitted frames. MCOM
|
||||
// enables monitoring of protocol control frames (eg SABM, UA, RR),
|
||||
// as well as info frames.
|
||||
|
||||
int (FAR WINAPI * SetTraceOptions) (long mask, int mtxparam, int mcomparam);
|
||||
|
||||
|
||||
// Returns number of first unused BPQHOST stream. If none available,
|
||||
// returns 255. See API function 13.
|
||||
|
||||
int (FAR WINAPI * FindFreeStream) ();
|
||||
|
||||
|
||||
// Allocate stream. If stream is already allocated, return nonzero.
|
||||
// Otherwise allocate stream, and return zero
|
||||
|
||||
int (FAR WINAPI * AllocateStream) (int stream);
|
||||
|
||||
|
||||
// Release stream.
|
||||
|
||||
int (FAR WINAPI * DeallocateStream) (int stream);
|
||||
|
||||
// Get number of ports configured
|
||||
|
||||
int (FAR WINAPI * GetNumberofPorts) ();
|
||||
|
||||
|
||||
// Get port number (ports aren't necessarily numbered 1 to n)
|
||||
|
||||
int (FAR WINAPI * GetPortNumber) (int portslot);
|
||||
|
||||
|
||||
// Enable async operation - new to Win32 version of API
|
||||
|
||||
int (FAR WINAPI * BPQSetHandle) (int Stream, HWND hWnd);
|
||||
|
||||
int (FAR * ConvFromAX25) (unsigned char * incall, unsigned char * outcall);
|
||||
BOOL (FAR * ConvToAX25) (unsigned char * callsign, unsigned char * ax25call);
|
||||
|
||||
char * (FAR WINAPI * GetNodeCall) ();
|
||||
int (FAR WINAPI * ChangeSessionCallsign) (int Stream, unsigned char * AXCall);
|
||||
|
||||
int (FAR WINAPI * GetApplNum) (int Stream);
|
||||
|
||||
char * (FAR WINAPI * GetApplCall) (int Appl);
|
||||
|
||||
char * (FAR WINAPI * GetApplAlias) (int Appl);
|
||||
|
||||
char * (FAR WINAPI * GetApplName) (int Appl);
|
||||
|
||||
long (FAR WINAPI * GetApplQual) (int Appl);
|
||||
|
||||
BOOL (FAR WINAPI * SetApplCall) (int Appl, char * NewCall);
|
||||
|
||||
BOOL (FAR WINAPI * SetApplAlias) (int Appl, char * NewCall);
|
||||
|
||||
BOOL (FAR WINAPI * SetApplQual) (int Appl, int NewQual);
|
||||
|
||||
|
||||
// Routines to support "Minimize to Tray"
|
||||
|
||||
BOOL (FAR WINAPI * GetMinimizetoTrayFlag)();
|
||||
|
||||
//int APIENTRY AddTrayMenuItem();
|
||||
int (FAR WINAPI * AddTrayMenuItem)(HWND hWnd, char * Label);
|
||||
|
||||
//int APIENTRY DeleteTrayMenuItem();
|
||||
int (FAR WINAPI * DeleteTrayMenuItem)(HWND hWnd);
|
||||
|
||||
int (FAR WINAPI * SetupTrayIcon)();
|
||||
|
||||
BOOL (FAR WINAPI * GetStartMinimizedFlag)();
|
||||
|
||||
// Log a message to the bpq32 console.
|
||||
|
||||
//int APIENTRY WritetoConsole();
|
||||
int (FAR WINAPI * WritetoConsole)(char * buff);
|
||||
|
||||
int (FAR WINAPI * CheckTimer)();
|
||||
|
||||
int (FAR WINAPI * CloseBPQ32)();
|
||||
|
||||
char (FAR WINAPI * GetLOC)();
|
||||
|
||||
HMODULE ExtDriver;
|
||||
|
||||
BOOL GetAPI()
|
||||
{
|
||||
// This procedure must be called if you are using Dynamic Linking. It loads BPQ32
|
||||
// if necessary, and get the addresses of the API routines
|
||||
|
||||
int err;
|
||||
char Msg[256];
|
||||
|
||||
#ifdef EXTDLL
|
||||
ExtDriver=GetModuleHandle("bpq32.dll");
|
||||
#else
|
||||
ExtDriver=LoadLibrary("bpq32.dll");
|
||||
#endif
|
||||
|
||||
if (ExtDriver == NULL)
|
||||
{
|
||||
err=GetLastError();
|
||||
wsprintf(Msg,"Error loading bpq32.dll - Error code %d",err);
|
||||
|
||||
MessageBox(NULL,Msg,"BPQDEMO",MB_ICONSTOP);
|
||||
|
||||
return(FALSE);
|
||||
}
|
||||
|
||||
GetPortTableEntryFromPortNum = (struct PORTCONTROL * (__stdcall *)(int PortSlot))GetProcAddress(ExtDriver,"_GetPortTableEntryFromPortNum@4");
|
||||
GetPortTableEntryFromSlot = (struct PORTCONTROL * (__stdcall *)(int PortSlot))GetProcAddress(ExtDriver,"_GetPortTableEntryFromSlot@4");
|
||||
|
||||
GETBPQAPI = (ULONG(__stdcall *)())GetProcAddress(ExtDriver,"_GETBPQAPI@0");
|
||||
GETMONDECODE = (ULONG(__stdcall *)())GetProcAddress(ExtDriver,"_GETMONDECODE@0");
|
||||
|
||||
GetFreeBuffs = (int (__stdcall *)(int stream))GetProcAddress(ExtDriver,"_GetFreeBuffs@0");
|
||||
TXCount = (int (__stdcall *)(int stream))GetProcAddress(ExtDriver,"_RXCount@4");
|
||||
RXCount = (int (__stdcall *)(int stream))GetProcAddress(ExtDriver,"_RXCount@4");
|
||||
MONCount = (int (__stdcall *)(int stream))GetProcAddress(ExtDriver,"_MONCount@4");
|
||||
GetCallsign = (int (__stdcall *)(int stream, char * callsign))GetProcAddress(ExtDriver,"_GetCallsign@8");
|
||||
GetBPQDirectory = (UCHAR *(__stdcall *)())GetProcAddress(ExtDriver,"_GetBPQDirectory@0");
|
||||
GetProgramDirectory = (UCHAR *(__stdcall *)())GetProcAddress(ExtDriver,"_GetProgramDirectory@0");
|
||||
|
||||
GetRegistryKey = (HKEY(__stdcall *)())GetProcAddress(ExtDriver,"_GetRegistryKey@0");
|
||||
GetRegistryKeyText = (UCHAR *(__stdcall *)())GetProcAddress(ExtDriver,"_GetRegistryKeyText@0");
|
||||
|
||||
GetSignOnMsg = (UCHAR *(__stdcall *)())GetProcAddress(ExtDriver,"_GetSignOnMsg@0");
|
||||
GetVersionString = (UCHAR *(__stdcall *)())GetProcAddress(ExtDriver,"_GetVersionString@0");
|
||||
GetConnectionInfo = (int (__stdcall *)(int, char *,int *, int *, int *,int *, int *))GetProcAddress(ExtDriver,"_GetConnectionInfo@28");
|
||||
GetStreamPID = (int (__stdcall *)(int Stream))GetProcAddress(ExtDriver,"_GetStreamPID@4");
|
||||
GetAttachedProcesses = (int (__stdcall *)())GetProcAddress(ExtDriver,"_GetAttachedProcesses@0");
|
||||
SessionControl = (int (__stdcall *)(int stream, int command, int param))GetProcAddress(ExtDriver,"_SessionControl@12");
|
||||
SetAppl = (int (__stdcall *)(int stream, int flags, int mask))GetProcAddress(ExtDriver,"_SetAppl@12");
|
||||
GetApplMask = (int (__stdcall *)(int Stream))GetProcAddress(ExtDriver,"_GetApplMask@4");
|
||||
GetApplFlags = (int (__stdcall *)(int Stream))GetProcAddress(ExtDriver,"_GetApplFlags@4");
|
||||
GetAllocationState = (int (__stdcall *)(int Stream))GetProcAddress(ExtDriver,"_GetAllocationState@4");
|
||||
|
||||
SessionState = (int (__stdcall *)(int, int *, int *))GetProcAddress(ExtDriver,"_SessionState@12");
|
||||
SessionStateNoAck = (int (__stdcall *)(int, int *))GetProcAddress(ExtDriver,"_SessionStateNoAck@8");
|
||||
SendMsg = (int (__stdcall *)(int stream, char * msg, int len))GetProcAddress(ExtDriver,"_SendMsg@12");
|
||||
SendRaw = (int (__stdcall *)(int port, char * msg, int len))GetProcAddress(ExtDriver,"_SendRaw@12");
|
||||
GetMsg = (int (__stdcall *)(int stream, char * msg, int * len, int * count ))GetProcAddress(ExtDriver,"_GetMsg@16");
|
||||
GetMsgPerl = (int (__stdcall *)(int stream, char * msg))GetProcAddress(ExtDriver,"_GetMsgPerl@8");
|
||||
GetRaw = (int (__stdcall *)(int stream, char * msg, int * len, int * count))GetProcAddress(ExtDriver,"_GetRaw@16");
|
||||
DecodeFrame = (int (__stdcall *)(char * msg, char * buffer, time_t Stamp))GetProcAddress(ExtDriver,"_DecodeFrame@12");
|
||||
SetTraceOptions = (int (__stdcall *)(long mask, int mtxparam, int mcomparam))GetProcAddress(ExtDriver,"_SetTraceOptions@12");
|
||||
FindFreeStream = (int (__stdcall *)())GetProcAddress(ExtDriver,"_FindFreeStream@0");
|
||||
AllocateStream= (int (__stdcall *)(int Stream))GetProcAddress(ExtDriver,"_AllocateStream@4");
|
||||
DeallocateStream = (int (__stdcall *)(int Stream))GetProcAddress(ExtDriver,"_DeallocateStream@4");
|
||||
|
||||
GetNumberofPorts = (int (__stdcall *)())GetProcAddress(ExtDriver,"_GetNumberofPorts@0");
|
||||
GetPortNumber = (int (__stdcall *)(int))GetProcAddress(ExtDriver,"_GetPortNumber@4");
|
||||
BPQSetHandle = (int (__stdcall *)(int Stream, HWND hWnd))GetProcAddress(ExtDriver,"_BPQSetHandle@8");
|
||||
|
||||
ConvFromAX25 = (int ( *)(unsigned char * incall, unsigned char * outcall))GetProcAddress(ExtDriver,"ConvFromAX25");
|
||||
ConvToAX25 = (BOOL ( *)(unsigned char * callsign, unsigned char * ax25call))GetProcAddress(ExtDriver,"ConvToAX25");
|
||||
GetNodeCall = (char * (__stdcall *) ())GetProcAddress(ExtDriver,"_GetNodeCall@0");
|
||||
ChangeSessionCallsign = (int (__stdcall *) (int Stream, unsigned char * AXCall))GetProcAddress(ExtDriver,"_ChangeSessionCallsign@8");
|
||||
GetApplNum = (int (__stdcall *)(int Stream))GetProcAddress(ExtDriver,"_GetApplNum@4");
|
||||
GetApplCall = (char * (__stdcall *) (int Appl))GetProcAddress(ExtDriver,"_GetApplCall@4");
|
||||
GetApplAlias = (char * (__stdcall *) (int Appl))GetProcAddress(ExtDriver,"_GetApplAlias@4");
|
||||
GetApplQual = (long (__stdcall *)(int Appl))GetProcAddress(ExtDriver,"_GetApplQual@4");
|
||||
GetApplName = (char * (__stdcall *) (int Appl))GetProcAddress(ExtDriver,"_GetApplName@4");
|
||||
SetApplCall = (BOOL (__stdcall *)(int Appl, char * NewCall))GetProcAddress(ExtDriver,"_SetApplCall@8");
|
||||
SetApplAlias = (BOOL (__stdcall *)(int Appl, char * NewCall))GetProcAddress(ExtDriver,"_SetApplAlias@8");
|
||||
SetApplQual = (BOOL (__stdcall *)(int Appl, int NewQual))GetProcAddress(ExtDriver,"_SetApplQual@8");
|
||||
|
||||
GetMinimizetoTrayFlag = (BOOL (__stdcall *)())GetProcAddress(ExtDriver,"_GetMinimizetoTrayFlag@0");
|
||||
AddTrayMenuItem = (int (__stdcall *)(HWND hWnd, char * Label))GetProcAddress(ExtDriver,"_AddTrayMenuItem@8");
|
||||
DeleteTrayMenuItem = (int (__stdcall *)(HWND hWnd))GetProcAddress(ExtDriver,"_DeleteTrayMenuItem@4");
|
||||
SetupTrayIcon = (BOOL (__stdcall *)())GetProcAddress(ExtDriver,"_SetupTrayIcon@0");
|
||||
|
||||
GetStartMinimizedFlag = (BOOL (__stdcall *)())GetProcAddress(ExtDriver,"_GetStartMinimizedFlag@0");
|
||||
WritetoConsole = (int (__stdcall *)(char *))GetProcAddress(ExtDriver,"_WritetoConsole@4");
|
||||
CheckTimer = (int (__stdcall *)(char *))GetProcAddress(ExtDriver,"_CheckTimer@0");
|
||||
CloseBPQ32 = (int (__stdcall *)(char *))GetProcAddress(ExtDriver,"_CloseBPQ32@0");
|
||||
GetLOC = (char * (__stdcall *)(char *))GetProcAddress(ExtDriver,"_GetLOC@0");
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
//
|
||||
// Constants and equates for async operation
|
||||
//
|
||||
|
||||
#ifndef BPQWINMSG
|
||||
#define BPQWINMSG
|
||||
|
||||
static char BPQWinMsg[] = "BPQWindowMessage";
|
||||
extern UINT BPQMsg;
|
||||
|
||||
//
|
||||
// Values returned in lParam of Windows Message
|
||||
//
|
||||
#define BPQMonitorAvail 1
|
||||
#define BPQDataAvail 2
|
||||
#define BPQStateChange 4
|
||||
|
||||
#endif
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Loading…
Reference in new issue