master 24.69.1
John Wiseman 1 year ago
parent eee55a9871
commit 7ed5345e74

@ -1,243 +1,243 @@
/*
Copyright 2001-2022 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
*/
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#define _CRT_SECURE_NO_DEPRECATE
#include "compatbits.h"
#include <string.h>
#include "asmstrucs.h"
#include "tncinfo.h"
VOID __cdecl Debugprintf(const char * format, ...);
#ifndef WIN32
#define APIENTRY
#define DllExport
#define VOID void
#else
#include <windows.h>
#endif
extern BOOL EventsEnabled;
void MQTTReportSession(char * Msg);
extern int MQTT;
extern char Modenames[19][10];
// Runs use specified routine on certain event
#ifndef WIN32
void RunEventProgram(char * Program, char * Param)
{
char * arg_list[] = {Program, NULL, NULL};
pid_t child_pid;
if (EventsEnabled == 0)
return;
signal(SIGCHLD, SIG_IGN); // Silently (and portably) reap children.
if (Param && Param[0])
arg_list[1] = Param;
// Fork and Exec Specified program
// Duplicate this process.
child_pid = fork ();
if (child_pid == -1)
{
printf ("Event fork() Failed\n");
return;
}
if (child_pid == 0)
{
execvp (arg_list[0], arg_list);
// The execvp function returns only if an error occurs.
printf ("Failed to run %s\n", arg_list[0]);
exit(0); // Kill the new process
}
#else
DllExport void APIENTRY RunEventProgram(char * Program, char * Param)
{
int n = 0;
char cmdLine[256];
STARTUPINFO SInfo; // pointer to STARTUPINFO
PROCESS_INFORMATION PInfo; // pointer to PROCESS_INFORMATION
if (EventsEnabled == 0)
return;
SInfo.cb=sizeof(SInfo);
SInfo.lpReserved=NULL;
SInfo.lpDesktop=NULL;
SInfo.lpTitle=NULL;
SInfo.dwFlags=0;
SInfo.cbReserved2=0;
SInfo.lpReserved2=NULL;
sprintf(cmdLine, "%s %s", Program, Param);
if (!CreateProcess(NULL, cmdLine, NULL, NULL, FALSE,0 ,NULL ,NULL, &SInfo, &PInfo))
Debugprintf("Failed to Start %s Error %d ", Program, GetLastError());
#endif
return;
}
void hookL2SessionAccepted(int Port, char * remotecall, char * ourcall, struct _LINKTABLE * LINK)
{
// Incoming SABM
LINK->ConnectTime = time(NULL);
LINK->bytesTXed = LINK->bytesRXed = 0;
strcpy(LINK->callingCall, remotecall);
strcpy(LINK->receivingCall, ourcall);
strcpy(LINK->Direction, "In");
}
void hookL2SessionDeleted(struct _LINKTABLE * LINK)
{
// calculate session time and av bytes/min in and out
if (LINK->ConnectTime)
{
if (LINK->bytesTXed == 0 && LINK->bytesRXed == 0)
{
// assume failed connect and ignore for now - maybe log later
}
else
{
char Msg[256];
char timestamp[16];
time_t sessionTime = time(NULL) - LINK->ConnectTime;
double avBytesSent = LINK->bytesTXed / (sessionTime / 60.0);
double avBytesRXed = LINK->bytesRXed / (sessionTime / 60.0);
time_t Now = time(NULL);
struct tm * TM = localtime(&Now);
sprintf(timestamp, "%02d:%02d:%02d", TM->tm_hour, TM->tm_min, TM->tm_sec);
if (sessionTime == 0)
sessionTime = 1; // Or will get divide by zero error
Debugprintf("KISS Session Stats Port %d %s %s %d secs Bytes Sent %d BPM %4.2f Bytes Received %d %4.2f BPM ",
LINK->LINKPORT->PORTNUMBER, LINK->callingCall, LINK->receivingCall, sessionTime, LINK->bytesTXed, avBytesSent, LINK->bytesRXed, avBytesRXed, timestamp);
sprintf(Msg, "{\"mode\": \"%s\", \"direction\": \"%s\", \"port\": %d, \"callfrom\": \"%s\", \"callto\": \"%s\", \"time\": %d, \"bytesSent\": %d,"
"\"BPMSent\": %4.2f, \"BytesReceived\": %d, \"BPMReceived\": %4.2f, \"timestamp\": \"%s\"}",
"KISS", LINK->Direction, LINK->LINKPORT->PORTNUMBER, LINK->callingCall, LINK->receivingCall, sessionTime,
LINK->bytesTXed, avBytesSent, LINK->bytesRXed, avBytesRXed, timestamp);
if (MQTT)
MQTTReportSession(Msg);
}
LINK->ConnectTime = 0;
}
if (LINK->Sent && LINK->Received && (LINK->SentAfterCompression || LINK->ReceivedAfterExpansion))
Debugprintf("L2 Compression Stats %s %s TX %d %d %d%% RX %d %d %d%%", LINK->callingCall, LINK->receivingCall,
LINK->Sent, LINK->SentAfterCompression, ((LINK->Sent - LINK->SentAfterCompression) * 100) / LINK->Sent,
LINK->Received, LINK->ReceivedAfterExpansion, ((LINK->ReceivedAfterExpansion - LINK->Received) * 100) / LINK->Received);
}
void hookL2SessionAttempt(int Port, char * ourcall, char * remotecall, struct _LINKTABLE * LINK)
{
LINK->ConnectTime = time(NULL);
LINK->bytesTXed = LINK->bytesRXed = 0;
strcpy(LINK->callingCall, ourcall);
strcpy(LINK->receivingCall, remotecall);
strcpy(LINK->Direction, "Out");
}
void hookL4SessionAttempt(struct STREAMINFO * STREAM, char * remotecall, char * ourcall)
{
// Outgoing Connect
STREAM->ConnectTime = time(NULL);
STREAM->bytesTXed = STREAM->bytesRXed = 0;
strcpy(STREAM->callingCall, ourcall);
strcpy(STREAM->receivingCall, remotecall);
strcpy(STREAM->Direction, "Out");
}
void hookL4SessionAccepted(struct STREAMINFO * STREAM, char * remotecall, char * ourcall)
{
// Incoming Connect
STREAM->ConnectTime = time(NULL);
STREAM->bytesTXed = STREAM->bytesRXed = 0;
strcpy(STREAM->callingCall, remotecall);
strcpy(STREAM->receivingCall, ourcall);
strcpy(STREAM->Direction, "In");
}
void hookL4SessionDeleted(struct TNCINFO * TNC, struct STREAMINFO * STREAM)
{
char Msg[256];
char timestamp[16];
if (STREAM->ConnectTime)
{
time_t sessionTime = time(NULL) - STREAM->ConnectTime;
double avBytesRXed = STREAM->bytesRXed / (sessionTime / 60.0);
double avBytesSent = STREAM->bytesTXed / (sessionTime / 60.0);
time_t Now = time(NULL);
struct tm * TM = localtime(&Now);
sprintf(timestamp, "%02d:%02d:%02d", TM->tm_hour, TM->tm_min, TM->tm_sec);
if (sessionTime == 0)
sessionTime = 1; // Or will get divide by zero error
sprintf(Msg, "{\"mode\": \"%s\", \"direction\": \"%s\", \"port\": %d, \"callfrom\": \"%s\", \"callto\": \"%s\", \"time\": %d, \"bytesSent\": %d,"
"\"BPMSent\": %4.2f, \"BytesReceived\": %d, \"BPMReceived\": %4.2f, \"timestamp\": \"%s\"}",
Modenames[TNC->Hardware - 1], STREAM->Direction, TNC->Port, STREAM->callingCall, STREAM->receivingCall, sessionTime,
STREAM->bytesTXed, avBytesSent, STREAM->bytesRXed, avBytesRXed, timestamp);
if (MQTT)
MQTTReportSession(Msg);
STREAM->ConnectTime = 0;
}
}
/*
Copyright 2001-2022 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
*/
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#define _CRT_SECURE_NO_DEPRECATE
#include "compatbits.h"
#include <string.h>
#include "asmstrucs.h"
#include "tncinfo.h"
VOID __cdecl Debugprintf(const char * format, ...);
#ifndef WIN32
#define APIENTRY
#define DllExport
#define VOID void
#else
#include <windows.h>
#endif
extern BOOL EventsEnabled;
void MQTTReportSession(char * Msg);
extern int MQTT;
extern char Modenames[19][10];
// Runs use specified routine on certain event
#ifndef WIN32
void RunEventProgram(char * Program, char * Param)
{
char * arg_list[] = {Program, NULL, NULL};
pid_t child_pid;
if (EventsEnabled == 0)
return;
signal(SIGCHLD, SIG_IGN); // Silently (and portably) reap children.
if (Param && Param[0])
arg_list[1] = Param;
// Fork and Exec Specified program
// Duplicate this process.
child_pid = fork ();
if (child_pid == -1)
{
printf ("Event fork() Failed\n");
return;
}
if (child_pid == 0)
{
execvp (arg_list[0], arg_list);
// The execvp function returns only if an error occurs.
printf ("Failed to run %s\n", arg_list[0]);
exit(0); // Kill the new process
}
#else
DllExport void APIENTRY RunEventProgram(char * Program, char * Param)
{
int n = 0;
char cmdLine[256];
STARTUPINFO SInfo; // pointer to STARTUPINFO
PROCESS_INFORMATION PInfo; // pointer to PROCESS_INFORMATION
if (EventsEnabled == 0)
return;
SInfo.cb=sizeof(SInfo);
SInfo.lpReserved=NULL;
SInfo.lpDesktop=NULL;
SInfo.lpTitle=NULL;
SInfo.dwFlags=0;
SInfo.cbReserved2=0;
SInfo.lpReserved2=NULL;
sprintf(cmdLine, "%s %s", Program, Param);
if (!CreateProcess(NULL, cmdLine, NULL, NULL, FALSE,0 ,NULL ,NULL, &SInfo, &PInfo))
Debugprintf("Failed to Start %s Error %d ", Program, GetLastError());
#endif
return;
}
void hookL2SessionAccepted(int Port, char * remotecall, char * ourcall, struct _LINKTABLE * LINK)
{
// Incoming SABM
LINK->ConnectTime = time(NULL);
LINK->bytesTXed = LINK->bytesRXed = 0;
strcpy(LINK->callingCall, remotecall);
strcpy(LINK->receivingCall, ourcall);
strcpy(LINK->Direction, "In");
}
void hookL2SessionDeleted(struct _LINKTABLE * LINK)
{
// calculate session time and av bytes/min in and out
if (LINK->ConnectTime)
{
if (LINK->bytesTXed == 0 && LINK->bytesRXed == 0)
{
// assume failed connect and ignore for now - maybe log later
}
else
{
char Msg[256];
char timestamp[16];
time_t sessionTime = time(NULL) - LINK->ConnectTime;
double avBytesSent = LINK->bytesTXed / (sessionTime / 60.0);
double avBytesRXed = LINK->bytesRXed / (sessionTime / 60.0);
time_t Now = time(NULL);
struct tm * TM = localtime(&Now);
sprintf(timestamp, "%02d:%02d:%02d", TM->tm_hour, TM->tm_min, TM->tm_sec);
if (sessionTime == 0)
sessionTime = 1; // Or will get divide by zero error
Debugprintf("KISS Session Stats Port %d %s %s %d secs Bytes Sent %d BPM %4.2f Bytes Received %d %4.2f BPM ",
LINK->LINKPORT->PORTNUMBER, LINK->callingCall, LINK->receivingCall, sessionTime, LINK->bytesTXed, avBytesSent, LINK->bytesRXed, avBytesRXed, timestamp);
sprintf(Msg, "{\"mode\": \"%s\", \"direction\": \"%s\", \"port\": %d, \"callfrom\": \"%s\", \"callto\": \"%s\", \"time\": %d, \"bytesSent\": %d,"
"\"BPMSent\": %4.2f, \"BytesReceived\": %d, \"BPMReceived\": %4.2f, \"timestamp\": \"%s\"}",
"KISS", LINK->Direction, LINK->LINKPORT->PORTNUMBER, LINK->callingCall, LINK->receivingCall, sessionTime,
LINK->bytesTXed, avBytesSent, LINK->bytesRXed, avBytesRXed, timestamp);
if (MQTT)
MQTTReportSession(Msg);
}
LINK->ConnectTime = 0;
}
if (LINK->Sent && LINK->Received && (LINK->SentAfterCompression || LINK->ReceivedAfterExpansion))
Debugprintf("L2 Compression Stats %s %s TX %d %d %d%% RX %d %d %d%%", LINK->callingCall, LINK->receivingCall,
LINK->Sent, LINK->SentAfterCompression, ((LINK->Sent - LINK->SentAfterCompression) * 100) / LINK->Sent,
LINK->Received, LINK->ReceivedAfterExpansion, ((LINK->ReceivedAfterExpansion - LINK->Received) * 100) / LINK->Received);
}
void hookL2SessionAttempt(int Port, char * ourcall, char * remotecall, struct _LINKTABLE * LINK)
{
LINK->ConnectTime = time(NULL);
LINK->bytesTXed = LINK->bytesRXed = 0;
strcpy(LINK->callingCall, ourcall);
strcpy(LINK->receivingCall, remotecall);
strcpy(LINK->Direction, "Out");
}
void hookL4SessionAttempt(struct STREAMINFO * STREAM, char * remotecall, char * ourcall)
{
// Outgoing Connect
STREAM->ConnectTime = time(NULL);
STREAM->bytesTXed = STREAM->bytesRXed = 0;
strcpy(STREAM->callingCall, ourcall);
strcpy(STREAM->receivingCall, remotecall);
strcpy(STREAM->Direction, "Out");
}
void hookL4SessionAccepted(struct STREAMINFO * STREAM, char * remotecall, char * ourcall)
{
// Incoming Connect
STREAM->ConnectTime = time(NULL);
STREAM->bytesTXed = STREAM->bytesRXed = 0;
strcpy(STREAM->callingCall, remotecall);
strcpy(STREAM->receivingCall, ourcall);
strcpy(STREAM->Direction, "In");
}
void hookL4SessionDeleted(struct TNCINFO * TNC, struct STREAMINFO * STREAM)
{
char Msg[256];
char timestamp[16];
if (STREAM->ConnectTime)
{
time_t sessionTime = time(NULL) - STREAM->ConnectTime;
double avBytesRXed = STREAM->bytesRXed / (sessionTime / 60.0);
double avBytesSent = STREAM->bytesTXed / (sessionTime / 60.0);
time_t Now = time(NULL);
struct tm * TM = localtime(&Now);
sprintf(timestamp, "%02d:%02d:%02d", TM->tm_hour, TM->tm_min, TM->tm_sec);
if (sessionTime == 0)
sessionTime = 1; // Or will get divide by zero error
sprintf(Msg, "{\"mode\": \"%s\", \"direction\": \"%s\", \"port\": %d, \"callfrom\": \"%s\", \"callto\": \"%s\", \"time\": %d, \"bytesSent\": %d,"
"\"BPMSent\": %4.2f, \"BytesReceived\": %d, \"BPMReceived\": %4.2f, \"timestamp\": \"%s\"}",
Modenames[TNC->Hardware - 1], STREAM->Direction, TNC->Port, STREAM->callingCall, STREAM->receivingCall, sessionTime,
STREAM->bytesTXed, avBytesSent, STREAM->bytesRXed, avBytesRXed, timestamp);
if (MQTT)
MQTTReportSession(Msg);
STREAM->ConnectTime = 0;
}
}

@ -1,111 +1,111 @@
#ifndef TELNETSERVER
#define TELNETSERVER
#ifndef LINBPQ
//#include "resource.h"
#endif
#define WSA_ACCEPT WM_USER + 1
#define WSA_CONNECT WM_USER + 2
#define WSA_DATA WM_USER + 3
#define InputBufferLen 100000
struct ConnectionInfo
{
int Number; // Number of record - for Connections display
SOCKET socket;
union
{
struct sockaddr_in6 sin6;
struct sockaddr_in sin;
};
BOOL SocketActive;
int BPQStream;
char Callsign[10];
BOOL GotHeader;
unsigned char InputBuffer[InputBufferLen];
int InputLen;
struct UserRec * UserPointer;
int Retries;
int LoginState; // 1 = user ok, 2 = password ok
BOOL DoingCommand; // Processing Telnet Command
BOOL DoEcho; // Telnet Echo option accepted
BOOL CMSSession; // Set if connect to CMS
BOOL FBBMode; // Pure TCP for FBB forwarding
BOOL NeedLF; // FBB mode, but with cr > crlf outbound
BOOL RelayMode; // Pure TCP for RMS Relay Emulation forwarding
BOOL DRATSMode; // HTML Terminal Emulator
BOOL SyncMode; // RMS Relay Sync
BOOL HTTPMode; // HTTP Server
BOOL APIMode; // REST API Server
BOOL TriMode; // Trimode emulation
BOOL TriModeConnected; // Set when remote session is connected - now send data to DataSock
SOCKET TriModeDataSock; // Data Socket
BOOL Auth; // Set if User is flagged as a Secure User
BOOL BPQTermMode; // Set if connected to BPQTermTCP
BOOL ClientSession; // Set if acting as a client (ie Linux HOST Mode)
BOOL MonitorNODES; // Monitor Control Flags
unsigned long long MMASK;
BOOL MCOM;
BOOL MonitorColour;
BOOL MTX;
BOOL MUIOnly;
int CMSIndex; // Pointer to CMS used for this connect
UCHAR * FromHostBuffer; // Somewhere to store msg from CMS - it sends the whole message at once
int FromHostBufferSize;
int FromHostBuffPutptr;
int FromHostBuffGetptr;
struct TNCINFO * TNC; // Used to pass TCP struct to http code (for passwood list)
time_t ConnectTime;
BOOL UTF8; // Set if BPQTerminal in UTF8 Mode
BOOL RelaySession; // Set if connection to RMS Relay
BOOL LogonSent; // To ignore second callsign: prompt
char Signon[100]; // User/Pass/Appl for Outgoing Connects
BOOL Keepalive; // For HOST (esp CCC) Keepalives
time_t LastSendTime;
BOOL NoCallsign; // Don't Send Callsign to host if no Signon
UCHAR * ResendBuffer; // Used if send() returns EWOULDBLOCK
int ResendLen; // Len to resend
struct ADIF * ADIF; // ADIF Logging info
int WebSocks;
char WebURL[32]; // URL for WebSocket Connection
int WebSecure; // Set if secure session
};
#define Disconnect(stream) SessionControl(stream,2,0)
#define Connect(stream) SessionControl(stream,1,0)
#define SE 240 // End of subnegotiation parameters
#define NOP 241 //No operation
#define xDM 242 //Data mark Indicates the position of a Synch event within the data stream. This should always be accompanied by a TCP urgent notification.
#define BRK 243 //Break Indicates that the "break" or "attention" key was hi.
#define IPx 244 //Suspend Interrupt or abort the process to which the NVT is connected.
#define AO 245 //Abort output Allows the current process to run to completion but does not send its output to the user.
#define AYT 246 //Are you there Send back to the NVT some visible evidence that the AYT was received.
#define EC 247 //Erase character The receiver should delete the last preceding undeleted character from the data stream.
#define EL 248 //Erase line Delete characters from the data stream back to but not including the previous CRLF.
#define GA 249 //Go ahead Under certain circumstances used to tell the other end that it can transmit.
#define SB 250 //Subnegotiation Subnegotiation of the indicated option follows.
#define WILL 251 //will Indicates the desire to begin performing, or confirmation that you are now performing, the indicated option.
#define WONT 252 //wont Indicates the refusal to perform, or continue performing, the indicated option.
#define DOx 253 //do Indicates the request that the other party perform, or confirmation that you are expecting the other party to perform, the indicated option.
#define DONT 254 //dont Indicates the demand that the other party stop performing, or confirmation that you are no longer expecting the other party to perform, the indicated option.
#define IAC 255
#define suppressgoahead 3 //858
#define xStatus 5 //859
#define echo 1 //857
#define timingmark 6 //860
#define terminaltype 24 //1091
#define windowsize 31 //1073
#define terminalspeed 32 //1079
#define remoteflowcontrol 33 //1372
#define linemode 34 //1184
#define environmentvariables 36 //1408
#endif
#ifndef TELNETSERVER
#define TELNETSERVER
#ifndef LINBPQ
//#include "resource.h"
#endif
#define WSA_ACCEPT WM_USER + 1
#define WSA_CONNECT WM_USER + 2
#define WSA_DATA WM_USER + 3
#define InputBufferLen 100000
struct ConnectionInfo
{
int Number; // Number of record - for Connections display
SOCKET socket;
union
{
struct sockaddr_in6 sin6;
struct sockaddr_in sin;
};
BOOL SocketActive;
int BPQStream;
char Callsign[10];
BOOL GotHeader;
unsigned char InputBuffer[InputBufferLen];
int InputLen;
struct UserRec * UserPointer;
int Retries;
int LoginState; // 1 = user ok, 2 = password ok
BOOL DoingCommand; // Processing Telnet Command
BOOL DoEcho; // Telnet Echo option accepted
BOOL CMSSession; // Set if connect to CMS
BOOL FBBMode; // Pure TCP for FBB forwarding
BOOL NeedLF; // FBB mode, but with cr > crlf outbound
BOOL RelayMode; // Pure TCP for RMS Relay Emulation forwarding
BOOL DRATSMode; // HTML Terminal Emulator
BOOL SyncMode; // RMS Relay Sync
BOOL HTTPMode; // HTTP Server
BOOL APIMode; // REST API Server
BOOL TriMode; // Trimode emulation
BOOL TriModeConnected; // Set when remote session is connected - now send data to DataSock
SOCKET TriModeDataSock; // Data Socket
BOOL Auth; // Set if User is flagged as a Secure User
BOOL BPQTermMode; // Set if connected to BPQTermTCP
BOOL ClientSession; // Set if acting as a client (ie Linux HOST Mode)
BOOL MonitorNODES; // Monitor Control Flags
unsigned long long MMASK;
BOOL MCOM;
BOOL MonitorColour;
BOOL MTX;
BOOL MUIOnly;
int CMSIndex; // Pointer to CMS used for this connect
UCHAR * FromHostBuffer; // Somewhere to store msg from CMS - it sends the whole message at once
int FromHostBufferSize;
int FromHostBuffPutptr;
int FromHostBuffGetptr;
struct TNCINFO * TNC; // Used to pass TCP struct to http code (for passwood list)
time_t ConnectTime;
BOOL UTF8; // Set if BPQTerminal in UTF8 Mode
BOOL RelaySession; // Set if connection to RMS Relay
BOOL LogonSent; // To ignore second callsign: prompt
char Signon[100]; // User/Pass/Appl for Outgoing Connects
BOOL Keepalive; // For HOST (esp CCC) Keepalives
time_t LastSendTime;
BOOL NoCallsign; // Don't Send Callsign to host if no Signon
UCHAR * ResendBuffer; // Used if send() returns EWOULDBLOCK
int ResendLen; // Len to resend
struct ADIF * ADIF; // ADIF Logging info
int WebSocks;
char WebURL[32]; // URL for WebSocket Connection
int WebSecure; // Set if secure session
};
#define Disconnect(stream) SessionControl(stream,2,0)
#define Connect(stream) SessionControl(stream,1,0)
#define SE 240 // End of subnegotiation parameters
#define NOP 241 //No operation
#define xDM 242 //Data mark Indicates the position of a Synch event within the data stream. This should always be accompanied by a TCP urgent notification.
#define BRK 243 //Break Indicates that the "break" or "attention" key was hi.
#define IPx 244 //Suspend Interrupt or abort the process to which the NVT is connected.
#define AO 245 //Abort output Allows the current process to run to completion but does not send its output to the user.
#define AYT 246 //Are you there Send back to the NVT some visible evidence that the AYT was received.
#define EC 247 //Erase character The receiver should delete the last preceding undeleted character from the data stream.
#define EL 248 //Erase line Delete characters from the data stream back to but not including the previous CRLF.
#define GA 249 //Go ahead Under certain circumstances used to tell the other end that it can transmit.
#define SB 250 //Subnegotiation Subnegotiation of the indicated option follows.
#define WILL 251 //will Indicates the desire to begin performing, or confirmation that you are now performing, the indicated option.
#define WONT 252 //wont Indicates the refusal to perform, or continue performing, the indicated option.
#define DOx 253 //do Indicates the request that the other party perform, or confirmation that you are expecting the other party to perform, the indicated option.
#define DONT 254 //dont Indicates the demand that the other party stop performing, or confirmation that you are no longer expecting the other party to perform, the indicated option.
#define IAC 255
#define suppressgoahead 3 //858
#define xStatus 5 //859
#define echo 1 //857
#define timingmark 6 //860
#define terminaltype 24 //1091
#define windowsize 31 //1073
#define terminalspeed 32 //1079
#define remoteflowcontrol 33 //1372
#define linemode 34 //1184
#define environmentvariables 36 //1408
#endif

@ -1,232 +1,232 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{8EFA1E59-8654-4A23-8102-AA77A074D57C}</ProjectGuid>
<RootNamespace>CBPQ32</RootNamespace>
<Keyword>Win32Proj</Keyword>
<WindowsTargetPlatformVersion>10.0.17763.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<PlatformToolset>v141</PlatformToolset>
<CharacterSet>NotSet</CharacterSet>
<WholeProgramOptimization>false</WholeProgramOptimization>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<PlatformToolset>v141</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
<Import Project="$(VCTargetsPath)\BuildCustomizations\masm.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>15.0.28127.55</_ProjectFileVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<OutDir>$(SolutionDir)$(Configuration)\</OutDir>
<IntDir>C:\Dev\Msdev2005\Intermed\$(SolutionName)\$(Configuration)\</IntDir>
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<OutDir>$(SolutionDir)$(Configuration)\</OutDir>
<IntDir>C:\Dev\Msdev2005\Intermed\$(SolutionName)\$(Configuration)\</IntDir>
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<MASM>
<PreserveIdentifierCase>3</PreserveIdentifierCase>
<IncludePaths>..\CInclude</IncludePaths>
<EnableMASM51Compatibility>true</EnableMASM51Compatibility>
</MASM>
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\CInclude;..\CommonSource;..\CKernel;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;BPQ32_EXPORTS;MDIKERNEL;_USE_32BIT_TIME_T;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<PrecompiledHeader />
<AssemblerOutput>All</AssemblerOutput>
<AssemblerListingLocation>c:\devprogs\bpq32\listings\debug\</AssemblerListingLocation>
<BrowseInformation>true</BrowseInformation>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
</ClCompile>
<Link>
<AdditionalOptions> /section:_BPQDATA,srw %(AdditionalOptions)</AdditionalOptions>
<AdditionalDependencies>WS2_32.Lib;winmm.lib;DbgHelp.lib;comctl32.lib;Iphlpapi.lib;setupapi.lib;..\lib\libconfig.lib;miniupnpc.lib;zlibstat.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>c:\DevProgs\BPQ32\bpq32.dll</OutputFile>
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
<IgnoreSpecificDefaultLibraries>LIBCMTD.lib;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
<ModuleDefinitionFile>..\CommonSource\bpq32.def</ModuleDefinitionFile>
<GenerateDebugInformation>true</GenerateDebugInformation>
<GenerateMapFile>true</GenerateMapFile>
<MapFileName>c:\DevProgs\BPQ32\bpqdev.map</MapFileName>
<MapExports>true</MapExports>
<SubSystem>Windows</SubSystem>
<HeapCommitSize>8000000</HeapCommitSize>
<StackCommitSize>4000000</StackCommitSize>
<EnableCOMDATFolding>false</EnableCOMDATFolding>
<EntryPointSymbol />
<BaseAddress>0x42000000</BaseAddress>
<ImportLibrary>..\lib\bpq32.lib</ImportLibrary>
<TargetMachine>MachineX86</TargetMachine>
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
</Link>
<Bscmake>
<OutputFile>C:\Dev\Msdev2005\Intermed\$(SolutionName)\$(Configuration)\$(ProjectName).bsc</OutputFile>
</Bscmake>
<PostBuildEvent>
<Command>"C:\Program Files\7-Zip\7z.exe" a C:\DevProgs\BPQ32\bpq32.zip C:\DevProgs\BPQ32\bpq32.dll &amp;&amp; myxcopy /y c:\DevProgs\BPQ32\bpq32.dll c:\windows\SysWOW64\bpq32.dll &amp;&amp; del C:\DevProgs\BPQ32\bpq32.dll</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<MASM>
<PreserveIdentifierCase>3</PreserveIdentifierCase>
<AssembledCodeListingFile>$(IntDir)$(ProjectName)</AssembledCodeListingFile>
<IncludePaths>..\CInclude</IncludePaths>
<ListAllAvailableInformation>true</ListAllAvailableInformation>
<EnableAssemblyGeneratedCodeListing>true</EnableAssemblyGeneratedCodeListing>
<EnableFalseConditionalsInListing>true</EnableFalseConditionalsInListing>
<EnableMASM51Compatibility>true</EnableMASM51Compatibility>
</MASM>
<ClCompile>
<AdditionalOptions>/D "MDIKERNEL" %(AdditionalOptions)</AdditionalOptions>
<Optimization>Disabled</Optimization>
<WholeProgramOptimization>false</WholeProgramOptimization>
<AdditionalIncludeDirectories>..\CInclude;..\CommonSource;..\CKernel;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;BPQ32_EXPORTS;MDIKERNEL;_USE_32BIT_TIME_T;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<PrecompiledHeader />
<AssemblerOutput>All</AssemblerOutput>
<AssemblerListingLocation>c:\devprogs\bpq32\listings\</AssemblerListingLocation>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
<Link>
<AdditionalOptions> /section:_BPQDATA,srw %(AdditionalOptions)</AdditionalOptions>
<AdditionalDependencies>WS2_32.Lib;winmm.lib;DbgHelp.lib;comctl32.lib;setupapi.lib;..\lib\libconfig.lib;miniupnpc.lib;zlibstat.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>C:\DevProgs\BPQ32\bpq32.dll</OutputFile>
<ModuleDefinitionFile>..\CommonSource\bpq32.def</ModuleDefinitionFile>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>c:\DevProgs\BPQ32\bpq32.pdb</ProgramDatabaseFile>
<GenerateMapFile>true</GenerateMapFile>
<MapFileName>c:\DevProgs\BPQ32\bpqpdn.map</MapFileName>
<MapExports>true</MapExports>
<SubSystem>Windows</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<LinkTimeCodeGeneration />
<BaseAddress>0x42000000</BaseAddress>
<ImportLibrary>C:\Dev\Msdev2005\Projects\BPQ32\lib\bpq32.lib</ImportLibrary>
<TargetMachine>MachineX86</TargetMachine>
</Link>
<Bscmake>
<OutputFile>C:\Dev\Msdev2005\Intermed\$(SolutionName)\$(Configuration)\$(ProjectName).bsc</OutputFile>
</Bscmake>
<PostBuildEvent>
<Command>"C:\Program Files\7-Zip\7z.exe" a C:\DevProgs\BPQ32\bpq32.zip C:\DevProgs\BPQ32\bpq32.dll &amp;&amp; myxcopy /y c:\DevProgs\BPQ32\bpq32.dll c:\windows\SysWOW64\bpq32.dll &amp;&amp; del C:\DevProgs\BPQ32\bpq32.dll</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="adif.c" />
<ClCompile Include="AEAPactor.c" />
<ClCompile Include="AGWAPI.c" />
<ClCompile Include="AGWMoncode.c" />
<ClCompile Include="AISCommon.c" />
<ClCompile Include="APRSCode.c" />
<ClCompile Include="APRSStdPages.c" />
<ClCompile Include="ARDOP.c" />
<ClCompile Include="Bpq32.c" />
<ClCompile Include="bpqaxip.c" />
<ClCompile Include="bpqether.c" />
<ClCompile Include="bpqhdlc.c" />
<ClCompile Include="BPQINP3.c" />
<ClCompile Include="BPQNRR.c" />
<ClCompile Include="BPQTermMDI.c" />
<ClCompile Include="BPQtoAGW.c" />
<ClCompile Include="bpqvkiss.c" />
<ClCompile Include="cMain.c" />
<ClCompile Include="Cmd.c" />
<ClCompile Include="CMSAuth.c" />
<ClCompile Include="CommonCode.c" />
<ClCompile Include="compatbits.c" />
<ClCompile Include="config.c" />
<ClCompile Include="datadefs.c" />
<ClCompile Include="DOSAPI.c" />
<ClCompile Include="FLDigi.c" />
<ClCompile Include="HALDriver.c" />
<ClCompile Include="HFCommon.c" />
<ClCompile Include="hid.c" />
<ClCompile Include="HSMODEM.c" />
<ClCompile Include="HTTPcode.c" />
<ClCompile Include="IPCode.c" />
<ClCompile Include="KAMPactor.c" />
<ClCompile Include="kiss.c" />
<ClCompile Include="KISSHF.c" />
<ClCompile Include="L2Code.c" />
<ClCompile Include="L3Code.c" />
<ClCompile Include="L4Code.c" />
<ClCompile Include="md5.c" />
<ClCompile Include="Moncode.c" />
<ClCompile Include="MULTIPSK.c" />
<ClCompile Include="PortMapper.c" />
<ClCompile Include="RigControl.c" />
<ClCompile Include="SCSPactor.c" />
<ClCompile Include="SCSTrackeMulti.c" />
<ClCompile Include="SCSTracker.c" />
<ClCompile Include="SerialPort.c" />
<ClCompile Include="TelnetV6.c" />
<ClCompile Include="TNCCode.c" />
<ClCompile Include="TNCEmulators.c" />
<ClCompile Include="UIARQ.c" />
<ClCompile Include="upnp.c" />
<ClCompile Include="utf8Routines.c" />
<ClCompile Include="UZ7HODrv.c" />
<ClCompile Include="V4.c" />
<ClCompile Include="VARA.c" />
<ClCompile Include="WINMOR.c" />
<ClCompile Include="WinRPR.c" />
</ItemGroup>
<ItemGroup>
<MASM Include="asmDOSAPI.asm" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\CKernel\kernelresource.h" />
<ClInclude Include="asmstrucs.h" />
<ClInclude Include="CHeaders.h" />
<ClInclude Include="compatbits.h" />
<ClInclude Include="Versions.h" />
</ItemGroup>
<ItemGroup>
<None Include="..\CInclude\Strucs.inc" />
<None Include="bpq32.def" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="KernelScript1.rc" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
<Import Project="$(VCTargetsPath)\BuildCustomizations\masm.targets" />
</ImportGroup>
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{8EFA1E59-8654-4A23-8102-AA77A074D57C}</ProjectGuid>
<RootNamespace>CBPQ32</RootNamespace>
<Keyword>Win32Proj</Keyword>
<WindowsTargetPlatformVersion>10.0.17763.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<PlatformToolset>v141</PlatformToolset>
<CharacterSet>NotSet</CharacterSet>
<WholeProgramOptimization>false</WholeProgramOptimization>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<PlatformToolset>v141</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
<Import Project="$(VCTargetsPath)\BuildCustomizations\masm.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>15.0.28127.55</_ProjectFileVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<OutDir>$(SolutionDir)$(Configuration)\</OutDir>
<IntDir>C:\Dev\Msdev2005\Intermed\$(SolutionName)\$(Configuration)\</IntDir>
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<OutDir>$(SolutionDir)$(Configuration)\</OutDir>
<IntDir>C:\Dev\Msdev2005\Intermed\$(SolutionName)\$(Configuration)\</IntDir>
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<MASM>
<PreserveIdentifierCase>3</PreserveIdentifierCase>
<IncludePaths>..\CInclude</IncludePaths>
<EnableMASM51Compatibility>true</EnableMASM51Compatibility>
</MASM>
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\CInclude;..\CommonSource;..\CKernel;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;BPQ32_EXPORTS;MDIKERNEL;_USE_32BIT_TIME_T;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<PrecompiledHeader />
<AssemblerOutput>All</AssemblerOutput>
<AssemblerListingLocation>c:\devprogs\bpq32\listings\debug\</AssemblerListingLocation>
<BrowseInformation>true</BrowseInformation>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
</ClCompile>
<Link>
<AdditionalOptions> /section:_BPQDATA,srw %(AdditionalOptions)</AdditionalOptions>
<AdditionalDependencies>WS2_32.Lib;winmm.lib;DbgHelp.lib;comctl32.lib;Iphlpapi.lib;setupapi.lib;..\lib\libconfig.lib;miniupnpc.lib;zlibstat.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>c:\DevProgs\BPQ32\bpq32.dll</OutputFile>
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
<IgnoreSpecificDefaultLibraries>LIBCMTD.lib;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
<ModuleDefinitionFile>..\CommonSource\bpq32.def</ModuleDefinitionFile>
<GenerateDebugInformation>true</GenerateDebugInformation>
<GenerateMapFile>true</GenerateMapFile>
<MapFileName>c:\DevProgs\BPQ32\bpqdev.map</MapFileName>
<MapExports>true</MapExports>
<SubSystem>Windows</SubSystem>
<HeapCommitSize>8000000</HeapCommitSize>
<StackCommitSize>4000000</StackCommitSize>
<EnableCOMDATFolding>false</EnableCOMDATFolding>
<EntryPointSymbol />
<BaseAddress>0x42000000</BaseAddress>
<ImportLibrary>..\lib\bpq32.lib</ImportLibrary>
<TargetMachine>MachineX86</TargetMachine>
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
</Link>
<Bscmake>
<OutputFile>C:\Dev\Msdev2005\Intermed\$(SolutionName)\$(Configuration)\$(ProjectName).bsc</OutputFile>
</Bscmake>
<PostBuildEvent>
<Command>"C:\Program Files\7-Zip\7z.exe" a C:\DevProgs\BPQ32\bpq32.zip C:\DevProgs\BPQ32\bpq32.dll &amp;&amp; myxcopy /y c:\DevProgs\BPQ32\bpq32.dll c:\windows\SysWOW64\bpq32.dll &amp;&amp; del C:\DevProgs\BPQ32\bpq32.dll</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<MASM>
<PreserveIdentifierCase>3</PreserveIdentifierCase>
<AssembledCodeListingFile>$(IntDir)$(ProjectName)</AssembledCodeListingFile>
<IncludePaths>..\CInclude</IncludePaths>
<ListAllAvailableInformation>true</ListAllAvailableInformation>
<EnableAssemblyGeneratedCodeListing>true</EnableAssemblyGeneratedCodeListing>
<EnableFalseConditionalsInListing>true</EnableFalseConditionalsInListing>
<EnableMASM51Compatibility>true</EnableMASM51Compatibility>
</MASM>
<ClCompile>
<AdditionalOptions>/D "MDIKERNEL" %(AdditionalOptions)</AdditionalOptions>
<Optimization>Disabled</Optimization>
<WholeProgramOptimization>false</WholeProgramOptimization>
<AdditionalIncludeDirectories>..\CInclude;..\CommonSource;..\CKernel;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;BPQ32_EXPORTS;MDIKERNEL;_USE_32BIT_TIME_T;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<PrecompiledHeader />
<AssemblerOutput>All</AssemblerOutput>
<AssemblerListingLocation>c:\devprogs\bpq32\listings\</AssemblerListingLocation>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
<Link>
<AdditionalOptions> /section:_BPQDATA,srw %(AdditionalOptions)</AdditionalOptions>
<AdditionalDependencies>WS2_32.Lib;winmm.lib;DbgHelp.lib;comctl32.lib;setupapi.lib;..\lib\libconfig.lib;miniupnpc.lib;zlibstat.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>C:\DevProgs\BPQ32\bpq32.dll</OutputFile>
<ModuleDefinitionFile>..\CommonSource\bpq32.def</ModuleDefinitionFile>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>c:\DevProgs\BPQ32\bpq32.pdb</ProgramDatabaseFile>
<GenerateMapFile>true</GenerateMapFile>
<MapFileName>c:\DevProgs\BPQ32\bpqpdn.map</MapFileName>
<MapExports>true</MapExports>
<SubSystem>Windows</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<LinkTimeCodeGeneration />
<BaseAddress>0x42000000</BaseAddress>
<ImportLibrary>C:\Dev\Msdev2005\Projects\BPQ32\lib\bpq32.lib</ImportLibrary>
<TargetMachine>MachineX86</TargetMachine>
</Link>
<Bscmake>
<OutputFile>C:\Dev\Msdev2005\Intermed\$(SolutionName)\$(Configuration)\$(ProjectName).bsc</OutputFile>
</Bscmake>
<PostBuildEvent>
<Command>"C:\Program Files\7-Zip\7z.exe" a C:\DevProgs\BPQ32\bpq32.zip C:\DevProgs\BPQ32\bpq32.dll &amp;&amp; myxcopy /y c:\DevProgs\BPQ32\bpq32.dll c:\windows\SysWOW64\bpq32.dll &amp;&amp; del C:\DevProgs\BPQ32\bpq32.dll</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="adif.c" />
<ClCompile Include="AEAPactor.c" />
<ClCompile Include="AGWAPI.c" />
<ClCompile Include="AGWMoncode.c" />
<ClCompile Include="AISCommon.c" />
<ClCompile Include="APRSCode.c" />
<ClCompile Include="APRSStdPages.c" />
<ClCompile Include="ARDOP.c" />
<ClCompile Include="Bpq32.c" />
<ClCompile Include="bpqaxip.c" />
<ClCompile Include="bpqether.c" />
<ClCompile Include="bpqhdlc.c" />
<ClCompile Include="BPQINP3.c" />
<ClCompile Include="BPQNRR.c" />
<ClCompile Include="BPQTermMDI.c" />
<ClCompile Include="BPQtoAGW.c" />
<ClCompile Include="bpqvkiss.c" />
<ClCompile Include="cMain.c" />
<ClCompile Include="Cmd.c" />
<ClCompile Include="CMSAuth.c" />
<ClCompile Include="CommonCode.c" />
<ClCompile Include="compatbits.c" />
<ClCompile Include="config.c" />
<ClCompile Include="datadefs.c" />
<ClCompile Include="DOSAPI.c" />
<ClCompile Include="FLDigi.c" />
<ClCompile Include="HALDriver.c" />
<ClCompile Include="HFCommon.c" />
<ClCompile Include="hid.c" />
<ClCompile Include="HSMODEM.c" />
<ClCompile Include="HTTPcode.c" />
<ClCompile Include="IPCode.c" />
<ClCompile Include="KAMPactor.c" />
<ClCompile Include="kiss.c" />
<ClCompile Include="KISSHF.c" />
<ClCompile Include="L2Code.c" />
<ClCompile Include="L3Code.c" />
<ClCompile Include="L4Code.c" />
<ClCompile Include="md5.c" />
<ClCompile Include="Moncode.c" />
<ClCompile Include="MULTIPSK.c" />
<ClCompile Include="PortMapper.c" />
<ClCompile Include="RigControl.c" />
<ClCompile Include="SCSPactor.c" />
<ClCompile Include="SCSTrackeMulti.c" />
<ClCompile Include="SCSTracker.c" />
<ClCompile Include="SerialPort.c" />
<ClCompile Include="TelnetV6.c" />
<ClCompile Include="TNCCode.c" />
<ClCompile Include="TNCEmulators.c" />
<ClCompile Include="UIARQ.c" />
<ClCompile Include="upnp.c" />
<ClCompile Include="utf8Routines.c" />
<ClCompile Include="UZ7HODrv.c" />
<ClCompile Include="V4.c" />
<ClCompile Include="VARA.c" />
<ClCompile Include="WINMOR.c" />
<ClCompile Include="WinRPR.c" />
</ItemGroup>
<ItemGroup>
<MASM Include="asmDOSAPI.asm" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\CKernel\kernelresource.h" />
<ClInclude Include="asmstrucs.h" />
<ClInclude Include="CHeaders.h" />
<ClInclude Include="compatbits.h" />
<ClInclude Include="Versions.h" />
</ItemGroup>
<ItemGroup>
<None Include="..\CInclude\Strucs.inc" />
<None Include="bpq32.def" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="KernelScript1.rc" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
<Import Project="$(VCTargetsPath)\BuildCustomizations\masm.targets" />
</ImportGroup>
</Project>

@ -1,71 +1,71 @@
//Microsoft Developer Studio generated resource script.
//
//#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "windows.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (U.K.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENG)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK
#pragma code_page(1252)
#endif //_WIN32
#define BPQICON 400
BPQICON ICON DISCARDABLE "..\\bpqicon.ico"
//
// Version
//
#define TEXTVER "2. 0. 1. 1\0"
#define BINVER 2, 0, 1, 1
VS_VERSION_INFO VERSIONINFO
FILEVERSION BINVER
PRODUCTVERSION BINVER
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x40004L
FILETYPE 0x1L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "080904b0"
BEGIN
VALUE "Comments", "Program to hold BPQ32.dll in memory\0"
VALUE "CompanyName", " \0"
VALUE "FileDescription", "bpq32\0"
VALUE "FileVersion", TEXTVER
VALUE "InternalName", "bpq32\0"
VALUE "LegalCopyright", "Copyright © 2006-2011 G8BPQ\0"
VALUE "OriginalFilename", "bpq32.exe\0"
VALUE "ProductName", " bpq32\0"
VALUE "ProductVersion", TEXTVER
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x809, 1200
END
END
#endif // not APSTUDIO_INVOKED
//Microsoft Developer Studio generated resource script.
//
//#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "windows.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (U.K.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENG)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK
#pragma code_page(1252)
#endif //_WIN32
#define BPQICON 400
BPQICON ICON DISCARDABLE "..\\bpqicon.ico"
//
// Version
//
#define TEXTVER "2. 0. 1. 1\0"
#define BINVER 2, 0, 1, 1
VS_VERSION_INFO VERSIONINFO
FILEVERSION BINVER
PRODUCTVERSION BINVER
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x40004L
FILETYPE 0x1L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "080904b0"
BEGIN
VALUE "Comments", "Program to hold BPQ32.dll in memory\0"
VALUE "CompanyName", " \0"
VALUE "FileDescription", "bpq32\0"
VALUE "FileVersion", TEXTVER
VALUE "InternalName", "bpq32\0"
VALUE "LegalCopyright", "Copyright © 2006-2011 G8BPQ\0"
VALUE "OriginalFilename", "bpq32.exe\0"
VALUE "ProductName", " bpq32\0"
VALUE "ProductVersion", TEXTVER
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x809, 1200
END
END
#endif // not APSTUDIO_INVOKED

@ -1,199 +1,199 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8.00"
Name="WinRPRHelper"
ProjectGUID="{8FED3782-1A9B-435D-96AC-6A1432995818}"
RootNamespace="WinRPRHelper"
Keyword="Win32Proj"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="c:\devprogs\bpq32\"
IntermediateDirectory="$(SolutionDir))Intermed\$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="WS2_32.Lib"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="1"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="c:\devprogs\bpq32\"
IntermediateDirectory="$(SolutionDir)Intermed\$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="2"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="WS2_32.Lib"
LinkIncremental="1"
GenerateDebugInformation="true"
SubSystem="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath=".\WinRPRHelper.c"
>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
</Filter>
<Filter
Name="Resource Files"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8.00"
Name="WinRPRHelper"
ProjectGUID="{8FED3782-1A9B-435D-96AC-6A1432995818}"
RootNamespace="WinRPRHelper"
Keyword="Win32Proj"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="c:\devprogs\bpq32\"
IntermediateDirectory="$(SolutionDir))Intermed\$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="WS2_32.Lib"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="1"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="c:\devprogs\bpq32\"
IntermediateDirectory="$(SolutionDir)Intermed\$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="2"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="WS2_32.Lib"
LinkIncremental="1"
GenerateDebugInformation="true"
SubSystem="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath=".\WinRPRHelper.c"
>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
</Filter>
<Filter
Name="Resource Files"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

@ -1,135 +1,135 @@
/* LzmaLib.h -- LZMA library interface
2008-08-05
Igor Pavlov
Public domain */
#ifndef __LZMALIB_H
#define __LZMALIB_H
#include "types.h"
#ifdef __cplusplus
#define MY_EXTERN_C extern "C"
#else
#define MY_EXTERN_C extern
#endif
#define MY_STDAPI MY_EXTERN_C int MY_STD_CALL
#define LZMA_PROPS_SIZE 5
/*
RAM requirements for LZMA:
for compression: (dictSize * 11.5 + 6 MB) + state_size
for decompression: dictSize + state_size
state_size = (4 + (1.5 << (lc + lp))) KB
by default (lc=3, lp=0), state_size = 16 KB.
LZMA properties (5 bytes) format
Offset Size Description
0 1 lc, lp and pb in encoded form.
1 4 dictSize (little endian).
*/
/*
LzmaCompress
------------
outPropsSize -
In: the pointer to the size of outProps buffer; *outPropsSize = LZMA_PROPS_SIZE = 5.
Out: the pointer to the size of written properties in outProps buffer; *outPropsSize = LZMA_PROPS_SIZE = 5.
LZMA Encoder will use defult values for any parameter, if it is
-1 for any from: level, loc, lp, pb, fb, numThreads
0 for dictSize
level - compression level: 0 <= level <= 9;
level dictSize algo fb
0: 16 KB 0 32
1: 64 KB 0 32
2: 256 KB 0 32
3: 1 MB 0 32
4: 4 MB 0 32
5: 16 MB 1 32
6: 32 MB 1 32
7+: 64 MB 1 64
The default value for "level" is 5.
algo = 0 means fast method
algo = 1 means normal method
dictSize - The dictionary size in bytes. The maximum value is
128 MB = (1 << 27) bytes for 32-bit version
1 GB = (1 << 30) bytes for 64-bit version
The default value is 16 MB = (1 << 24) bytes.
It's recommended to use the dictionary that is larger than 4 KB and
that can be calculated as (1 << N) or (3 << N) sizes.
lc - The number of literal context bits (high bits of previous literal).
It can be in the range from 0 to 8. The default value is 3.
Sometimes lc=4 gives the gain for big files.
lp - The number of literal pos bits (low bits of current position for literals).
It can be in the range from 0 to 4. The default value is 0.
The lp switch is intended for periodical data when the period is equal to 2^lp.
For example, for 32-bit (4 bytes) periodical data you can use lp=2. Often it's
better to set lc=0, if you change lp switch.
pb - The number of pos bits (low bits of current position).
It can be in the range from 0 to 4. The default value is 2.
The pb switch is intended for periodical data when the period is equal 2^pb.
fb - Word size (the number of fast bytes).
It can be in the range from 5 to 273. The default value is 32.
Usually, a big number gives a little bit better compression ratio and
slower compression process.
numThreads - The number of thereads. 1 or 2. The default value is 2.
Fast mode (algo = 0) can use only 1 thread.
Out:
destLen - processed output size
Returns:
SZ_OK - OK
SZ_ERROR_MEM - Memory allocation error
SZ_ERROR_PARAM - Incorrect paramater
SZ_ERROR_OUTPUT_EOF - output buffer overflow
SZ_ERROR_THREAD - errors in multithreading functions (only for Mt version)
*/
MY_STDAPI LzmaCompress(unsigned char *dest, size_t *destLen, const unsigned char *src, size_t srcLen,
unsigned char *outProps, size_t *outPropsSize, /* *outPropsSize must be = 5 */
int level, /* 0 <= level <= 9, default = 5 */
unsigned dictSize, /* default = (1 << 24) */
int lc, /* 0 <= lc <= 8, default = 3 */
int lp, /* 0 <= lp <= 4, default = 0 */
int pb, /* 0 <= pb <= 4, default = 2 */
int fb, /* 5 <= fb <= 273, default = 32 */
int numThreads /* 1 or 2, default = 2 */
);
/*
LzmaUncompress
--------------
In:
dest - output data
destLen - output data size
src - input data
srcLen - input data size
Out:
destLen - processed output size
srcLen - processed input size
Returns:
SZ_OK - OK
SZ_ERROR_DATA - Data error
SZ_ERROR_MEM - Memory allocation arror
SZ_ERROR_UNSUPPORTED - Unsupported properties
SZ_ERROR_INPUT_EOF - it needs more bytes in input buffer (src)
*/
MY_STDAPI LzmaUncompress(unsigned char *dest, size_t *destLen, const unsigned char *src, SizeT *srcLen,
const unsigned char *props, size_t propsSize);
#endif
/* LzmaLib.h -- LZMA library interface
2008-08-05
Igor Pavlov
Public domain */
#ifndef __LZMALIB_H
#define __LZMALIB_H
#include "types.h"
#ifdef __cplusplus
#define MY_EXTERN_C extern "C"
#else
#define MY_EXTERN_C extern
#endif
#define MY_STDAPI MY_EXTERN_C int MY_STD_CALL
#define LZMA_PROPS_SIZE 5
/*
RAM requirements for LZMA:
for compression: (dictSize * 11.5 + 6 MB) + state_size
for decompression: dictSize + state_size
state_size = (4 + (1.5 << (lc + lp))) KB
by default (lc=3, lp=0), state_size = 16 KB.
LZMA properties (5 bytes) format
Offset Size Description
0 1 lc, lp and pb in encoded form.
1 4 dictSize (little endian).
*/
/*
LzmaCompress
------------
outPropsSize -
In: the pointer to the size of outProps buffer; *outPropsSize = LZMA_PROPS_SIZE = 5.
Out: the pointer to the size of written properties in outProps buffer; *outPropsSize = LZMA_PROPS_SIZE = 5.
LZMA Encoder will use defult values for any parameter, if it is
-1 for any from: level, loc, lp, pb, fb, numThreads
0 for dictSize
level - compression level: 0 <= level <= 9;
level dictSize algo fb
0: 16 KB 0 32
1: 64 KB 0 32
2: 256 KB 0 32
3: 1 MB 0 32
4: 4 MB 0 32
5: 16 MB 1 32
6: 32 MB 1 32
7+: 64 MB 1 64
The default value for "level" is 5.
algo = 0 means fast method
algo = 1 means normal method
dictSize - The dictionary size in bytes. The maximum value is
128 MB = (1 << 27) bytes for 32-bit version
1 GB = (1 << 30) bytes for 64-bit version
The default value is 16 MB = (1 << 24) bytes.
It's recommended to use the dictionary that is larger than 4 KB and
that can be calculated as (1 << N) or (3 << N) sizes.
lc - The number of literal context bits (high bits of previous literal).
It can be in the range from 0 to 8. The default value is 3.
Sometimes lc=4 gives the gain for big files.
lp - The number of literal pos bits (low bits of current position for literals).
It can be in the range from 0 to 4. The default value is 0.
The lp switch is intended for periodical data when the period is equal to 2^lp.
For example, for 32-bit (4 bytes) periodical data you can use lp=2. Often it's
better to set lc=0, if you change lp switch.
pb - The number of pos bits (low bits of current position).
It can be in the range from 0 to 4. The default value is 2.
The pb switch is intended for periodical data when the period is equal 2^pb.
fb - Word size (the number of fast bytes).
It can be in the range from 5 to 273. The default value is 32.
Usually, a big number gives a little bit better compression ratio and
slower compression process.
numThreads - The number of thereads. 1 or 2. The default value is 2.
Fast mode (algo = 0) can use only 1 thread.
Out:
destLen - processed output size
Returns:
SZ_OK - OK
SZ_ERROR_MEM - Memory allocation error
SZ_ERROR_PARAM - Incorrect paramater
SZ_ERROR_OUTPUT_EOF - output buffer overflow
SZ_ERROR_THREAD - errors in multithreading functions (only for Mt version)
*/
MY_STDAPI LzmaCompress(unsigned char *dest, size_t *destLen, const unsigned char *src, size_t srcLen,
unsigned char *outProps, size_t *outPropsSize, /* *outPropsSize must be = 5 */
int level, /* 0 <= level <= 9, default = 5 */
unsigned dictSize, /* default = (1 << 24) */
int lc, /* 0 <= lc <= 8, default = 3 */
int lp, /* 0 <= lp <= 4, default = 0 */
int pb, /* 0 <= pb <= 4, default = 2 */
int fb, /* 5 <= fb <= 273, default = 32 */
int numThreads /* 1 or 2, default = 2 */
);
/*
LzmaUncompress
--------------
In:
dest - output data
destLen - output data size
src - input data
srcLen - input data size
Out:
destLen - processed output size
srcLen - processed input size
Returns:
SZ_OK - OK
SZ_ERROR_DATA - Data error
SZ_ERROR_MEM - Memory allocation arror
SZ_ERROR_UNSUPPORTED - Unsupported properties
SZ_ERROR_INPUT_EOF - it needs more bytes in input buffer (src)
*/
MY_STDAPI LzmaUncompress(unsigned char *dest, size_t *destLen, const unsigned char *src, SizeT *srcLen,
const unsigned char *props, size_t propsSize);
#endif

@ -1,424 +1,424 @@
// Mail and Chat Server for BPQ32 Packet Switch
//
// Monitor Window(s) Module
#include "bpqmail.h"
static char ClassName[]="BPQMONWINDOW";
char SYSOPCall[50];
static WNDPROC wpOrigInputProc;
static WNDPROC wpOrigOutputProc;
HWND hMonitor;
static HWND hwndInput;
static HWND hwndOutput;
static HMENU hMenu; // handle of menu
#define InputBoxHeight 25
RECT MonitorRect;
RECT OutputRect;
int Height, Width, LastY;
static char kbbuf[160];
static int kbptr=0;
static char * readbuff;
static int readbufflen;
static BOOL StripLF = TRUE;
BOOL MonBBS = TRUE;
BOOL MonCHAT = TRUE;
BOOL MonTCP = TRUE;
BOOL LogBBS = TRUE;
BOOL LogCHAT = TRUE;
BOOL LogTCP = TRUE;
static int PartLinePtr=0;
static int PartLineIndex=0; // Listbox index of (last) incomplete line
static LRESULT CALLBACK MonWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
static LRESULT APIENTRY InputProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) ;
static LRESULT APIENTRY OutputProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) ;
static LRESULT APIENTRY MonProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) ;
static void MoveWindows();
static void MoveMCWindows();
#define BGCOLOUR RGB(236,233,216)
BOOL CreateMonitor()
{
WNDCLASS wc;
HBRUSH bgBrush;
if (hMonitor)
{
ShowWindow(hMonitor, SW_SHOWNORMAL);
SetForegroundWindow(hMonitor);
return FALSE; // Alreaqy open
}
bgBrush = CreateSolidBrush(BGCOLOUR);
wc.style = CS_HREDRAW | CS_VREDRAW;
wc.lpfnWndProc = MonWndProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = DLGWINDOWEXTRA;
wc.hInstance = hInst;
wc.hIcon = LoadIcon( hInst, MAKEINTRESOURCE(BPQICON) );
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
wc.hbrBackground = bgBrush;
wc.lpszMenuName = NULL;
wc.lpszClassName = ClassName;
RegisterClass(&wc);
hMonitor=CreateDialog(hInst,ClassName,0,NULL);
if (!hMonitor)
return (FALSE);
readbuff = zalloc(1000);
readbufflen = 1000;
hMenu=GetMenu(hMonitor);
CheckMenuItem(hMenu,MONBBS, MonBBS ? MF_CHECKED : MF_UNCHECKED);
CheckMenuItem(hMenu,MONCHAT, MonCHAT ? MF_CHECKED : MF_UNCHECKED);
CheckMenuItem(hMenu,MONTCP, MonTCP ? MF_CHECKED : MF_UNCHECKED);
DrawMenuBar(hWnd);
// Retrieve the handlse to the edit controls.
hwndOutput = GetDlgItem(hMonitor, 121);
// Set our own WndProcs for the controls.
wpOrigOutputProc = (WNDPROC)SetWindowLong(hwndOutput, GWL_WNDPROC, (LONG)OutputProc);
if (cfgMinToTray)
AddTrayMenuItem(hMonitor, "Mail Monitor");
ShowWindow(hMonitor, SW_SHOWNORMAL);
if (MonitorRect.right < 100 || MonitorRect.bottom < 100)
{
GetWindowRect(hMonitor, &MonitorRect);
}
MoveWindow(hMonitor,MonitorRect.left,MonitorRect.top, MonitorRect.right-MonitorRect.left, MonitorRect.bottom-MonitorRect.top, TRUE);
MoveWindows();
return TRUE;
}
static void MoveWindows()
{
RECT rcMain, rcClient;
int ClientHeight, ClientWidth;
GetWindowRect(hMonitor, &rcMain);
GetClientRect(hMonitor, &rcClient);
ClientHeight = rcClient.bottom;
ClientWidth = rcClient.right;
// MoveWindow(hwndMon,2, 0, ClientWidth-4, SplitPos, TRUE);
MoveWindow(hwndOutput,2, 2, ClientWidth-4, ClientHeight-4, TRUE);
// MoveWindow(hwndSplit,0, SplitPos, ClientWidth, SplitBarHeight, TRUE);
}
static LRESULT CALLBACK MonWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
int wmId, wmEvent;
LPRECT lprc;
switch (message)
{
case WM_ACTIVATE:
SetFocus(hwndInput);
break;
case WM_CLOSE:
if (wParam) // Used by Close All Programs.
return 0;
return (DefWindowProc(hWnd, message, wParam, lParam));
case WM_COMMAND:
wmId = LOWORD(wParam); // Remember, these are...
wmEvent = HIWORD(wParam); // ...different for Win32!
switch (wmId) {
case MONBBS:
ToggleParam(hMenu, hWnd, &MonBBS, MONBBS);
break;
case MONCHAT:
ToggleParam(hMenu, hWnd, &MonCHAT, MONCHAT);
break;
case MONTCP:
ToggleParam(hMenu, hWnd, &MonTCP, MONTCP);
break;
case BPQCLEAROUT:
SendMessage(hwndOutput,LB_RESETCONTENT, 0, 0);
break;
case BPQCOPYOUT:
CopyToClipboard(hwndOutput);
break;
//case BPQHELP:
// HtmlHelp(hWnd,"BPQTerminal.chm",HH_HELP_FINDER,0);
// break;
default:
return 0;
}
case WM_SYSCOMMAND:
wmId = LOWORD(wParam); // Remember, these are...
wmEvent = HIWORD(wParam); // ...different for Win32!
switch (wmId) {
case SC_MINIMIZE:
if (cfgMinToTray)
return ShowWindow(hWnd, SW_HIDE);
default:
return (DefWindowProc(hWnd, message, wParam, lParam));
}
case WM_SIZING:
lprc = (LPRECT) lParam;
Height = lprc->bottom-lprc->top;
Width = lprc->right-lprc->left;
MoveWindows();
return TRUE;
case WM_DESTROY:
// Remove the subclass from the edit control.
GetWindowRect(hWnd, &MonitorRect); // For save soutine
SetWindowLong(hwndInput, GWL_WNDPROC,
(LONG) wpOrigInputProc);
if (cfgMinToTray)
DeleteTrayMenuItem(hWnd);
hMonitor = NULL;
free(readbuff);
readbufflen = 0;
break;
default:
return (DefWindowProc(hWnd, message, wParam, lParam));
}
return (0);
}
LRESULT APIENTRY OutputProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
// Trap mouse messages, so we cant select stuff in output and mon windows,
// otherwise scrolling doesnt work.
if (uMsg >= WM_MOUSEFIRST && uMsg <= WM_LBUTTONDBLCLK)
return TRUE;
return CallWindowProc(wpOrigOutputProc, hwnd, uMsg, wParam, lParam);
}
int WritetoMonitorWindow(char * Msg, int len)
{
char * ptr1, * ptr2;
int index;
if (len+PartLinePtr > readbufflen)
{
readbufflen += len+PartLinePtr;
readbuff = realloc(readbuff, readbufflen);
}
if (PartLinePtr != 0)
SendMessage(hwndOutput,LB_DELETESTRING,PartLineIndex,(LPARAM)(LPCTSTR) 0 );
memcpy(&readbuff[PartLinePtr], Msg, len);
len=len+PartLinePtr;
ptr1=&readbuff[0];
readbuff[len]=0;
do {
ptr2=memchr(ptr1,7,len);
if (ptr2)
*(ptr2)=32;
} while (ptr2);
lineloop:
// if (PartLinePtr > 300)
// PartLinePtr = 0;
if (len > 0)
{
// copy text to control a line at a time
ptr2=memchr(ptr1,13,len);
if (ptr2 == 0)
{
// no newline. Move data to start of buffer and Save pointer
PartLinePtr=len;
memmove(readbuff,ptr1,len);
PartLineIndex=SendMessage(hwndOutput,LB_ADDSTRING,0,(LPARAM)(LPCTSTR) ptr1 );
SendMessage(hwndOutput,LB_SETCARETINDEX,(WPARAM) PartLineIndex, MAKELPARAM(FALSE, 0));
return (0);
}
*(ptr2++)=0;
index=SendMessage(hwndOutput,LB_ADDSTRING,0,(LPARAM)(LPCTSTR) ptr1 );
// if (LogOutput) WriteMonitorLine(ptr1, ptr2 - ptr1);
PartLinePtr=0;
len-=(ptr2-ptr1);
ptr1=ptr2;
if ((len > 0) && StripLF)
{
if (*ptr1 == 0x0a) // Line Feed
{
ptr1++;
len--;
}
}
if (index > 1200)
do{
index=SendMessage(hwndOutput,LB_DELETESTRING, 0, 0);
} while (index > 1000);
SendMessage(hwndOutput,LB_SETCARETINDEX,(WPARAM) index, MAKELPARAM(FALSE, 0));
goto lineloop;
}
return (0);
}
static int ToggleParam(HMENU hMenu, HWND hWnd, BOOL * Param, int Item)
{
*Param = !(*Param);
CheckMenuItem(hMenu,Item, (*Param) ? MF_CHECKED : MF_UNCHECKED);
return (0);
}
static void CopyToClipboard(HWND hWnd)
{
int i,n, len=0;
HGLOBAL hMem;
char * ptr;
//
// Copy List Box to clipboard
//
n = SendMessage(hWnd, LB_GETCOUNT, 0, 0);
for (i=0; i<n; i++)
{
len+=SendMessage(hWnd, LB_GETTEXTLEN, i, 0);
}
hMem=GlobalAlloc(GMEM_MOVEABLE | GMEM_DDESHARE, len+n+n+1);
if (hMem != 0)
{
ptr=GlobalLock(hMem);
if (OpenClipboard(MainWnd))
{
// CopyScreentoBuffer(GlobalLock(hMem));
for (i=0; i<n; i++)
{
ptr+=SendMessage(hWnd, LB_GETTEXT, i, (LPARAM) ptr);
*(ptr++)=13;
*(ptr++)=10;
}
*(ptr)=0; // end of data
GlobalUnlock(hMem);
EmptyClipboard();
SetClipboardData(CF_TEXT,hMem);
CloseClipboard();
}
else
GlobalFree(hMem);
}
}
// Mail and Chat Server for BPQ32 Packet Switch
//
// Monitor Window(s) Module
#include "bpqmail.h"
static char ClassName[]="BPQMONWINDOW";
char SYSOPCall[50];
static WNDPROC wpOrigInputProc;
static WNDPROC wpOrigOutputProc;
HWND hMonitor;
static HWND hwndInput;
static HWND hwndOutput;
static HMENU hMenu; // handle of menu
#define InputBoxHeight 25
RECT MonitorRect;
RECT OutputRect;
int Height, Width, LastY;
static char kbbuf[160];
static int kbptr=0;
static char * readbuff;
static int readbufflen;
static BOOL StripLF = TRUE;
BOOL MonBBS = TRUE;
BOOL MonCHAT = TRUE;
BOOL MonTCP = TRUE;
BOOL LogBBS = TRUE;
BOOL LogCHAT = TRUE;
BOOL LogTCP = TRUE;
static int PartLinePtr=0;
static int PartLineIndex=0; // Listbox index of (last) incomplete line
static LRESULT CALLBACK MonWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
static LRESULT APIENTRY InputProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) ;
static LRESULT APIENTRY OutputProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) ;
static LRESULT APIENTRY MonProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) ;
static void MoveWindows();
static void MoveMCWindows();
#define BGCOLOUR RGB(236,233,216)
BOOL CreateMonitor()
{
WNDCLASS wc;
HBRUSH bgBrush;
if (hMonitor)
{
ShowWindow(hMonitor, SW_SHOWNORMAL);
SetForegroundWindow(hMonitor);
return FALSE; // Alreaqy open
}
bgBrush = CreateSolidBrush(BGCOLOUR);
wc.style = CS_HREDRAW | CS_VREDRAW;
wc.lpfnWndProc = MonWndProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = DLGWINDOWEXTRA;
wc.hInstance = hInst;
wc.hIcon = LoadIcon( hInst, MAKEINTRESOURCE(BPQICON) );
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
wc.hbrBackground = bgBrush;
wc.lpszMenuName = NULL;
wc.lpszClassName = ClassName;
RegisterClass(&wc);
hMonitor=CreateDialog(hInst,ClassName,0,NULL);
if (!hMonitor)
return (FALSE);
readbuff = zalloc(1000);
readbufflen = 1000;
hMenu=GetMenu(hMonitor);
CheckMenuItem(hMenu,MONBBS, MonBBS ? MF_CHECKED : MF_UNCHECKED);
CheckMenuItem(hMenu,MONCHAT, MonCHAT ? MF_CHECKED : MF_UNCHECKED);
CheckMenuItem(hMenu,MONTCP, MonTCP ? MF_CHECKED : MF_UNCHECKED);
DrawMenuBar(hWnd);
// Retrieve the handlse to the edit controls.
hwndOutput = GetDlgItem(hMonitor, 121);
// Set our own WndProcs for the controls.
wpOrigOutputProc = (WNDPROC)SetWindowLong(hwndOutput, GWL_WNDPROC, (LONG)OutputProc);
if (cfgMinToTray)
AddTrayMenuItem(hMonitor, "Mail Monitor");
ShowWindow(hMonitor, SW_SHOWNORMAL);
if (MonitorRect.right < 100 || MonitorRect.bottom < 100)
{
GetWindowRect(hMonitor, &MonitorRect);
}
MoveWindow(hMonitor,MonitorRect.left,MonitorRect.top, MonitorRect.right-MonitorRect.left, MonitorRect.bottom-MonitorRect.top, TRUE);
MoveWindows();
return TRUE;
}
static void MoveWindows()
{
RECT rcMain, rcClient;
int ClientHeight, ClientWidth;
GetWindowRect(hMonitor, &rcMain);
GetClientRect(hMonitor, &rcClient);
ClientHeight = rcClient.bottom;
ClientWidth = rcClient.right;
// MoveWindow(hwndMon,2, 0, ClientWidth-4, SplitPos, TRUE);
MoveWindow(hwndOutput,2, 2, ClientWidth-4, ClientHeight-4, TRUE);
// MoveWindow(hwndSplit,0, SplitPos, ClientWidth, SplitBarHeight, TRUE);
}
static LRESULT CALLBACK MonWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
int wmId, wmEvent;
LPRECT lprc;
switch (message)
{
case WM_ACTIVATE:
SetFocus(hwndInput);
break;
case WM_CLOSE:
if (wParam) // Used by Close All Programs.
return 0;
return (DefWindowProc(hWnd, message, wParam, lParam));
case WM_COMMAND:
wmId = LOWORD(wParam); // Remember, these are...
wmEvent = HIWORD(wParam); // ...different for Win32!
switch (wmId) {
case MONBBS:
ToggleParam(hMenu, hWnd, &MonBBS, MONBBS);
break;
case MONCHAT:
ToggleParam(hMenu, hWnd, &MonCHAT, MONCHAT);
break;
case MONTCP:
ToggleParam(hMenu, hWnd, &MonTCP, MONTCP);
break;
case BPQCLEAROUT:
SendMessage(hwndOutput,LB_RESETCONTENT, 0, 0);
break;
case BPQCOPYOUT:
CopyToClipboard(hwndOutput);
break;
//case BPQHELP:
// HtmlHelp(hWnd,"BPQTerminal.chm",HH_HELP_FINDER,0);
// break;
default:
return 0;
}
case WM_SYSCOMMAND:
wmId = LOWORD(wParam); // Remember, these are...
wmEvent = HIWORD(wParam); // ...different for Win32!
switch (wmId) {
case SC_MINIMIZE:
if (cfgMinToTray)
return ShowWindow(hWnd, SW_HIDE);
default:
return (DefWindowProc(hWnd, message, wParam, lParam));
}
case WM_SIZING:
lprc = (LPRECT) lParam;
Height = lprc->bottom-lprc->top;
Width = lprc->right-lprc->left;
MoveWindows();
return TRUE;
case WM_DESTROY:
// Remove the subclass from the edit control.
GetWindowRect(hWnd, &MonitorRect); // For save soutine
SetWindowLong(hwndInput, GWL_WNDPROC,
(LONG) wpOrigInputProc);
if (cfgMinToTray)
DeleteTrayMenuItem(hWnd);
hMonitor = NULL;
free(readbuff);
readbufflen = 0;
break;
default:
return (DefWindowProc(hWnd, message, wParam, lParam));
}
return (0);
}
LRESULT APIENTRY OutputProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
// Trap mouse messages, so we cant select stuff in output and mon windows,
// otherwise scrolling doesnt work.
if (uMsg >= WM_MOUSEFIRST && uMsg <= WM_LBUTTONDBLCLK)
return TRUE;
return CallWindowProc(wpOrigOutputProc, hwnd, uMsg, wParam, lParam);
}
int WritetoMonitorWindow(char * Msg, int len)
{
char * ptr1, * ptr2;
int index;
if (len+PartLinePtr > readbufflen)
{
readbufflen += len+PartLinePtr;
readbuff = realloc(readbuff, readbufflen);
}
if (PartLinePtr != 0)
SendMessage(hwndOutput,LB_DELETESTRING,PartLineIndex,(LPARAM)(LPCTSTR) 0 );
memcpy(&readbuff[PartLinePtr], Msg, len);
len=len+PartLinePtr;
ptr1=&readbuff[0];
readbuff[len]=0;
do {
ptr2=memchr(ptr1,7,len);
if (ptr2)
*(ptr2)=32;
} while (ptr2);
lineloop:
// if (PartLinePtr > 300)
// PartLinePtr = 0;
if (len > 0)
{
// copy text to control a line at a time
ptr2=memchr(ptr1,13,len);
if (ptr2 == 0)
{
// no newline. Move data to start of buffer and Save pointer
PartLinePtr=len;
memmove(readbuff,ptr1,len);
PartLineIndex=SendMessage(hwndOutput,LB_ADDSTRING,0,(LPARAM)(LPCTSTR) ptr1 );
SendMessage(hwndOutput,LB_SETCARETINDEX,(WPARAM) PartLineIndex, MAKELPARAM(FALSE, 0));
return (0);
}
*(ptr2++)=0;
index=SendMessage(hwndOutput,LB_ADDSTRING,0,(LPARAM)(LPCTSTR) ptr1 );
// if (LogOutput) WriteMonitorLine(ptr1, ptr2 - ptr1);
PartLinePtr=0;
len-=(ptr2-ptr1);
ptr1=ptr2;
if ((len > 0) && StripLF)
{
if (*ptr1 == 0x0a) // Line Feed
{
ptr1++;
len--;
}
}
if (index > 1200)
do{
index=SendMessage(hwndOutput,LB_DELETESTRING, 0, 0);
} while (index > 1000);
SendMessage(hwndOutput,LB_SETCARETINDEX,(WPARAM) index, MAKELPARAM(FALSE, 0));
goto lineloop;
}
return (0);
}
static int ToggleParam(HMENU hMenu, HWND hWnd, BOOL * Param, int Item)
{
*Param = !(*Param);
CheckMenuItem(hMenu,Item, (*Param) ? MF_CHECKED : MF_UNCHECKED);
return (0);
}
static void CopyToClipboard(HWND hWnd)
{
int i,n, len=0;
HGLOBAL hMem;
char * ptr;
//
// Copy List Box to clipboard
//
n = SendMessage(hWnd, LB_GETCOUNT, 0, 0);
for (i=0; i<n; i++)
{
len+=SendMessage(hWnd, LB_GETTEXTLEN, i, 0);
}
hMem=GlobalAlloc(GMEM_MOVEABLE | GMEM_DDESHARE, len+n+n+1);
if (hMem != 0)
{
ptr=GlobalLock(hMem);
if (OpenClipboard(MainWnd))
{
// CopyScreentoBuffer(GlobalLock(hMem));
for (i=0; i<n; i++)
{
ptr+=SendMessage(hWnd, LB_GETTEXT, i, (LPARAM) ptr);
*(ptr++)=13;
*(ptr++)=10;
}
*(ptr)=0; // end of data
GlobalUnlock(hMem);
EmptyClipboard();
SetClipboardData(CF_TEXT,hMem);
CloseClipboard();
}
else
GlobalFree(hMem);
}
}

@ -1,22 +1,22 @@
Chat :
{
ApplNum = 2;
MaxStreams = 11;
OtherChatNodes = "RDGCHT:GB7RDG-1|C STHGTE|C 1 MB7NCR-2|C RDGCHT\r\nRDGCHT:GB7RDG-1|C STHGTE|C 1 MB7NCR-2|C RDGCHT\r\n\r\n";
ChatWelcomeMsg = "G8BPQ Chat Server.$WType /h for command summary.$WBringing up links to other nodes.$WThis may take a minute or two.$WThe /p command shows what nodes are linked.$W";
MapPosition = "MapPosition=5259.04N, 00107.01W";
MapPopup = "MapPopup=G8BPQ Nottingham<p><a href=\"http://www.g8bpq.org.uk\">BPQ32 Home Page</a";
PopupMode = 0;
Bells = 1;
FlashOnBell = 0;
StripLF = 0;
WarnWrap = 0;
WrapInput = 0;
FlashOnConnect = 0;
CloseWindowOnBye = 0;
ConsoleSize = "821,1629,283,893";
MonitorSize = "828,1644,148,770";
DebugSize = "0,0,0,0";
WindowSize = "231,835,254,602";
Version = "6,0,24,32";
};
Chat :
{
ApplNum = 2;
MaxStreams = 11;
OtherChatNodes = "RDGCHT:GB7RDG-1|C STHGTE|C 1 MB7NCR-2|C RDGCHT\r\nRDGCHT:GB7RDG-1|C STHGTE|C 1 MB7NCR-2|C RDGCHT\r\n\r\n";
ChatWelcomeMsg = "G8BPQ Chat Server.$WType /h for command summary.$WBringing up links to other nodes.$WThis may take a minute or two.$WThe /p command shows what nodes are linked.$W";
MapPosition = "MapPosition=5259.04N, 00107.01W";
MapPopup = "MapPopup=G8BPQ Nottingham<p><a href=\"http://www.g8bpq.org.uk\">BPQ32 Home Page</a";
PopupMode = 0;
Bells = 1;
FlashOnBell = 0;
StripLF = 0;
WarnWrap = 0;
WrapInput = 0;
FlashOnConnect = 0;
CloseWindowOnBye = 0;
ConsoleSize = "821,1629,283,893";
MonitorSize = "828,1644,148,770";
DebugSize = "0,0,0,0";
WindowSize = "231,835,254,602";
Version = "6,0,24,32";
};

@ -1,82 +1,82 @@
//
// Standard __except handler to dump stack and code around eip
//
__except(memcpy(&exinfo, GetExceptionInformation(), sizeof(struct _EXCEPTION_POINTERS)), EXCEPTION_EXECUTE_HANDLER)
{
unsigned __int32 SPPtr = 0;
unsigned __int32 SPVal = 0;
unsigned __int32 eip = 0;
unsigned __int32 rev = 0;
int i;
DWORD Stack[16];
DWORD CodeDump[16];
#ifndef _WIN64
eip = exinfo.ContextRecord->Eip;
SPPtr = exinfo.ContextRecord->Esp;
__asm
{
mov eax, SPPtr
mov SPVal,eax
lea edi,Stack
mov esi,eax
mov ecx,64
rep movsb
lea edi,CodeDump
mov esi,eip
mov ecx,64
rep movsb
}
Debugprintf("BPQ32 *** Program Error %x at %x in %s",
exinfo.ExceptionRecord->ExceptionCode, exinfo.ExceptionRecord->ExceptionAddress, EXCEPTMSG);
Debugprintf("EAX %x EBX %x ECX %x EDX %x ESI %x EDI %x ESP %x",
exinfo.ContextRecord->Eax, exinfo.ContextRecord->Ebx, exinfo.ContextRecord->Ecx,
exinfo.ContextRecord->Edx, exinfo.ContextRecord->Esi, exinfo.ContextRecord->Edi, SPVal);
#endif
Debugprintf("Stack:");
Debugprintf("%08x %08x %08x %08x %08x %08x %08x %08x %08x ",
SPVal, Stack[0], Stack[1], Stack[2], Stack[3], Stack[4], Stack[5], Stack[6], Stack[7]);
Debugprintf("%08x %08x %08x %08x %08x %08x %08x %08x %08x ",
SPVal+32, Stack[8], Stack[9], Stack[10], Stack[11], Stack[12], Stack[13], Stack[14], Stack[15]);
Debugprintf("Code:");
for (i = 0; i < 16; i++)
{
rev = (CodeDump[i] & 0xff) << 24;
rev |= (CodeDump[i] & 0xff00) << 8;
rev |= (CodeDump[i] & 0xff0000) >> 8;
rev |= (CodeDump[i] & 0xff000000) >> 24;
CodeDump[i] = rev;
}
Debugprintf("%08x %08x %08x %08x %08x %08x %08x %08x %08x ",
eip, CodeDump[0], CodeDump[1], CodeDump[2], CodeDump[3], CodeDump[4], CodeDump[5], CodeDump[6], CodeDump[7]);
Debugprintf("%08x %08x %08x %08x %08x %08x %08x %08x %08x ",
eip+32, CodeDump[8], CodeDump[9], CodeDump[10], CodeDump[11], CodeDump[12], CodeDump[13], CodeDump[14], CodeDump[15]);
WriteMiniDump();
// Note - no closing } so additional code may be run in the __except block
#ifdef MDIKERNEL
if (CloseOnError == 1)
CloseAllNeeded = 1;
#endif
#undef EXCEPTMSG
//
// Standard __except handler to dump stack and code around eip
//
__except(memcpy(&exinfo, GetExceptionInformation(), sizeof(struct _EXCEPTION_POINTERS)), EXCEPTION_EXECUTE_HANDLER)
{
unsigned __int32 SPPtr = 0;
unsigned __int32 SPVal = 0;
unsigned __int32 eip = 0;
unsigned __int32 rev = 0;
int i;
DWORD Stack[16];
DWORD CodeDump[16];
#ifndef _WIN64
eip = exinfo.ContextRecord->Eip;
SPPtr = exinfo.ContextRecord->Esp;
__asm
{
mov eax, SPPtr
mov SPVal,eax
lea edi,Stack
mov esi,eax
mov ecx,64
rep movsb
lea edi,CodeDump
mov esi,eip
mov ecx,64
rep movsb
}
Debugprintf("BPQ32 *** Program Error %x at %x in %s",
exinfo.ExceptionRecord->ExceptionCode, exinfo.ExceptionRecord->ExceptionAddress, EXCEPTMSG);
Debugprintf("EAX %x EBX %x ECX %x EDX %x ESI %x EDI %x ESP %x",
exinfo.ContextRecord->Eax, exinfo.ContextRecord->Ebx, exinfo.ContextRecord->Ecx,
exinfo.ContextRecord->Edx, exinfo.ContextRecord->Esi, exinfo.ContextRecord->Edi, SPVal);
#endif
Debugprintf("Stack:");
Debugprintf("%08x %08x %08x %08x %08x %08x %08x %08x %08x ",
SPVal, Stack[0], Stack[1], Stack[2], Stack[3], Stack[4], Stack[5], Stack[6], Stack[7]);
Debugprintf("%08x %08x %08x %08x %08x %08x %08x %08x %08x ",
SPVal+32, Stack[8], Stack[9], Stack[10], Stack[11], Stack[12], Stack[13], Stack[14], Stack[15]);
Debugprintf("Code:");
for (i = 0; i < 16; i++)
{
rev = (CodeDump[i] & 0xff) << 24;
rev |= (CodeDump[i] & 0xff00) << 8;
rev |= (CodeDump[i] & 0xff0000) >> 8;
rev |= (CodeDump[i] & 0xff000000) >> 24;
CodeDump[i] = rev;
}
Debugprintf("%08x %08x %08x %08x %08x %08x %08x %08x %08x ",
eip, CodeDump[0], CodeDump[1], CodeDump[2], CodeDump[3], CodeDump[4], CodeDump[5], CodeDump[6], CodeDump[7]);
Debugprintf("%08x %08x %08x %08x %08x %08x %08x %08x %08x ",
eip+32, CodeDump[8], CodeDump[9], CodeDump[10], CodeDump[11], CodeDump[12], CodeDump[13], CodeDump[14], CodeDump[15]);
WriteMiniDump();
// Note - no closing } so additional code may be run in the __except block
#ifdef MDIKERNEL
if (CloseOnError == 1)
CloseAllNeeded = 1;
#endif
#undef EXCEPTMSG

@ -1,219 +1,219 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8.00"
Name="FormatHTML"
ProjectGUID="{2B892B53-6549-4872-AF51-45280ADC8AB5}"
RootNamespace="FormatHTML"
Keyword="Win32Proj"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="C:\Dev\Msdev2005\$(SolutionName)\$(ProjectName)\$(ConfigurationName)"
IntermediateDirectory="C:\Dev\Msdev2005\Intermed\$(SolutionName)\$(ProjectName)\$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="0"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="kernel32.lib $(NoInherit)"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="1"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="C:\Dev\Msdev2005\$(SolutionName)\$(ProjectName)\$(ConfigurationName)"
IntermediateDirectory="C:\Dev\Msdev2005\Intermed\$(SolutionName)\$(ProjectName)\$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="1"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="kernel32.lib $(NoInherit)"
LinkIncremental="1"
GenerateDebugInformation="true"
SubSystem="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath=".\FormatHTML.cpp"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
CompileAs="1"
/>
</FileConfiguration>
</File>
<File
RelativePath=".\stdafx.cpp"
>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
<File
RelativePath=".\stdafx.h"
>
</File>
</Filter>
<Filter
Name="Resource Files"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
>
</Filter>
<File
RelativePath=".\ReadMe.txt"
>
</File>
</Files>
<Globals>
</Globals>
</VisualStudioProject>
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8.00"
Name="FormatHTML"
ProjectGUID="{2B892B53-6549-4872-AF51-45280ADC8AB5}"
RootNamespace="FormatHTML"
Keyword="Win32Proj"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="C:\Dev\Msdev2005\$(SolutionName)\$(ProjectName)\$(ConfigurationName)"
IntermediateDirectory="C:\Dev\Msdev2005\Intermed\$(SolutionName)\$(ProjectName)\$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="0"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="kernel32.lib $(NoInherit)"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="1"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="C:\Dev\Msdev2005\$(SolutionName)\$(ProjectName)\$(ConfigurationName)"
IntermediateDirectory="C:\Dev\Msdev2005\Intermed\$(SolutionName)\$(ProjectName)\$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="1"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="kernel32.lib $(NoInherit)"
LinkIncremental="1"
GenerateDebugInformation="true"
SubSystem="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath=".\FormatHTML.cpp"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
CompileAs="1"
/>
</FileConfiguration>
</File>
<File
RelativePath=".\stdafx.cpp"
>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
<File
RelativePath=".\stdafx.h"
>
</File>
</Filter>
<Filter
Name="Resource Files"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
>
</Filter>
<File
RelativePath=".\ReadMe.txt"
>
</File>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

@ -1,237 +1,237 @@
/*
Copyright 2001-2022 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
*/
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#define _CRT_SECURE_NO_DEPRECATE
#include "compatbits.h"
#include <string.h>
#include "asmstrucs.h"
#include "tncinfo.h"
VOID __cdecl Debugprintf(const char * format, ...);
#ifndef WIN32
#define APIENTRY
#define DllExport
#define VOID void
#else
#include <windows.h>
#endif
extern BOOL EventsEnabled;
void MQTTReportSession(char * Msg);
extern int MQTT;
extern char Modenames[19][10];
// Runs use specified routine on certain event
#ifndef WIN32
void RunEventProgram(char * Program, char * Param)
{
char * arg_list[] = {Program, NULL, NULL};
pid_t child_pid;
if (EventsEnabled == 0)
return;
signal(SIGCHLD, SIG_IGN); // Silently (and portably) reap children.
if (Param && Param[0])
arg_list[1] = Param;
// Fork and Exec Specified program
// Duplicate this process.
child_pid = fork ();
if (child_pid == -1)
{
printf ("Event fork() Failed\n");
return;
}
if (child_pid == 0)
{
execvp (arg_list[0], arg_list);
// The execvp function returns only if an error occurs.
printf ("Failed to run %s\n", arg_list[0]);
exit(0); // Kill the new process
}
#else
DllExport void APIENTRY RunEventProgram(char * Program, char * Param)
{
int n = 0;
char cmdLine[256];
STARTUPINFO SInfo; // pointer to STARTUPINFO
PROCESS_INFORMATION PInfo; // pointer to PROCESS_INFORMATION
if (EventsEnabled == 0)
return;
SInfo.cb=sizeof(SInfo);
SInfo.lpReserved=NULL;
SInfo.lpDesktop=NULL;
SInfo.lpTitle=NULL;
SInfo.dwFlags=0;
SInfo.cbReserved2=0;
SInfo.lpReserved2=NULL;
sprintf(cmdLine, "%s %s", Program, Param);
if (!CreateProcess(NULL, cmdLine, NULL, NULL, FALSE,0 ,NULL ,NULL, &SInfo, &PInfo))
Debugprintf("Failed to Start %s Error %d ", Program, GetLastError());
#endif
return;
}
void hookL2SessionAccepted(int Port, char * remotecall, char * ourcall, struct _LINKTABLE * LINK)
{
// Incoming SABM
LINK->ConnectTime = time(NULL);
LINK->bytesTXed = LINK->bytesRXed = 0;
strcpy(LINK->callingCall, remotecall);
strcpy(LINK->receivingCall, ourcall);
strcpy(LINK->Direction, "In");
}
void hookL2SessionDeleted(struct _LINKTABLE * LINK)
{
// calculate session time and av bytes/min in and out
if (LINK->ConnectTime)
{
if (LINK->bytesTXed == 0 && LINK->bytesRXed == 0)
{
// assume failed connect and ignore for now - maybe log later
}
else
{
char Msg[256];
char timestamp[16];
time_t sessionTime = time(NULL) - LINK->ConnectTime;
double avBytesSent = LINK->bytesTXed / (sessionTime / 60.0);
double avBytesRXed = LINK->bytesRXed / (sessionTime / 60.0);
time_t Now = time(NULL);
struct tm * TM = localtime(&Now);
sprintf(timestamp, "%02d:%02d:%02d", TM->tm_hour, TM->tm_min, TM->tm_sec);
if (sessionTime == 0)
sessionTime = 1; // Or will get divide by zero error
Debugprintf("KISS Session Stats Port %d %s %s %d secs Bytes Sent %d BPM %4.2f Bytes Received %d %4.2f BPM ",
LINK->LINKPORT->PORTNUMBER, LINK->callingCall, LINK->receivingCall, sessionTime, LINK->bytesTXed, avBytesSent, LINK->bytesRXed, avBytesRXed, timestamp);
sprintf(Msg, "{\"mode\": \"%s\", \"direction\": \"%s\", \"port\": %d, \"callfrom\": \"%s\", \"callto\": \"%s\", \"time\": %d, \"bytesSent\": %d,"
"\"BPMSent\": %4.2f, \"BytesReceived\": %d, \"BPMReceived\": %4.2f, \"timestamp\": \"%s\"}",
"KISS", LINK->Direction, LINK->LINKPORT->PORTNUMBER, LINK->callingCall, LINK->receivingCall, sessionTime,
LINK->bytesTXed, avBytesSent, LINK->bytesRXed, avBytesRXed, timestamp);
if (MQTT)
MQTTReportSession(Msg);
}
LINK->ConnectTime = 0;
}
}
void hookL2SessionAttempt(int Port, char * ourcall, char * remotecall, struct _LINKTABLE * LINK)
{
LINK->ConnectTime = time(NULL);
LINK->bytesTXed = LINK->bytesRXed = 0;
strcpy(LINK->callingCall, ourcall);
strcpy(LINK->receivingCall, remotecall);
strcpy(LINK->Direction, "Out");
}
void hookL4SessionAttempt(struct STREAMINFO * STREAM, char * remotecall, char * ourcall)
{
// Outgoing Connect
STREAM->ConnectTime = time(NULL);
STREAM->bytesTXed = STREAM->bytesRXed = 0;
strcpy(STREAM->callingCall, ourcall);
strcpy(STREAM->receivingCall, remotecall);
strcpy(STREAM->Direction, "Out");
}
void hookL4SessionAccepted(struct STREAMINFO * STREAM, char * remotecall, char * ourcall)
{
// Incoming Connect
STREAM->ConnectTime = time(NULL);
STREAM->bytesTXed = STREAM->bytesRXed = 0;
strcpy(STREAM->callingCall, remotecall);
strcpy(STREAM->receivingCall, ourcall);
strcpy(STREAM->Direction, "In");
}
void hookL4SessionDeleted(struct TNCINFO * TNC, struct STREAMINFO * STREAM)
{
char Msg[256];
char timestamp[16];
if (STREAM->ConnectTime)
{
time_t sessionTime = time(NULL) - STREAM->ConnectTime;
double avBytesRXed = STREAM->bytesRXed / (sessionTime / 60.0);
double avBytesSent = STREAM->bytesTXed / (sessionTime / 60.0);
time_t Now = time(NULL);
struct tm * TM = localtime(&Now);
sprintf(timestamp, "%02d:%02d:%02d", TM->tm_hour, TM->tm_min, TM->tm_sec);
if (sessionTime == 0)
sessionTime = 1; // Or will get divide by zero error
sprintf(Msg, "{\"mode\": \"%s\", \"direction\": \"%s\", \"port\": %d, \"callfrom\": \"%s\", \"callto\": \"%s\", \"time\": %d, \"bytesSent\": %d,"
"\"BPMSent\": %4.2f, \"BytesReceived\": %d, \"BPMReceived\": %4.2f, \"timestamp\": \"%s\"}",
Modenames[TNC->Hardware - 1], STREAM->Direction, TNC->Port, STREAM->callingCall, STREAM->receivingCall, sessionTime,
STREAM->bytesTXed, avBytesSent, STREAM->bytesRXed, avBytesRXed, timestamp);
if (MQTT)
MQTTReportSession(Msg);
STREAM->ConnectTime = 0;
}
}
/*
Copyright 2001-2022 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
*/
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#define _CRT_SECURE_NO_DEPRECATE
#include "compatbits.h"
#include <string.h>
#include "asmstrucs.h"
#include "tncinfo.h"
VOID __cdecl Debugprintf(const char * format, ...);
#ifndef WIN32
#define APIENTRY
#define DllExport
#define VOID void
#else
#include <windows.h>
#endif
extern BOOL EventsEnabled;
void MQTTReportSession(char * Msg);
extern int MQTT;
extern char Modenames[19][10];
// Runs use specified routine on certain event
#ifndef WIN32
void RunEventProgram(char * Program, char * Param)
{
char * arg_list[] = {Program, NULL, NULL};
pid_t child_pid;
if (EventsEnabled == 0)
return;
signal(SIGCHLD, SIG_IGN); // Silently (and portably) reap children.
if (Param && Param[0])
arg_list[1] = Param;
// Fork and Exec Specified program
// Duplicate this process.
child_pid = fork ();
if (child_pid == -1)
{
printf ("Event fork() Failed\n");
return;
}
if (child_pid == 0)
{
execvp (arg_list[0], arg_list);
// The execvp function returns only if an error occurs.
printf ("Failed to run %s\n", arg_list[0]);
exit(0); // Kill the new process
}
#else
DllExport void APIENTRY RunEventProgram(char * Program, char * Param)
{
int n = 0;
char cmdLine[256];
STARTUPINFO SInfo; // pointer to STARTUPINFO
PROCESS_INFORMATION PInfo; // pointer to PROCESS_INFORMATION
if (EventsEnabled == 0)
return;
SInfo.cb=sizeof(SInfo);
SInfo.lpReserved=NULL;
SInfo.lpDesktop=NULL;
SInfo.lpTitle=NULL;
SInfo.dwFlags=0;
SInfo.cbReserved2=0;
SInfo.lpReserved2=NULL;
sprintf(cmdLine, "%s %s", Program, Param);
if (!CreateProcess(NULL, cmdLine, NULL, NULL, FALSE,0 ,NULL ,NULL, &SInfo, &PInfo))
Debugprintf("Failed to Start %s Error %d ", Program, GetLastError());
#endif
return;
}
void hookL2SessionAccepted(int Port, char * remotecall, char * ourcall, struct _LINKTABLE * LINK)
{
// Incoming SABM
LINK->ConnectTime = time(NULL);
LINK->bytesTXed = LINK->bytesRXed = 0;
strcpy(LINK->callingCall, remotecall);
strcpy(LINK->receivingCall, ourcall);
strcpy(LINK->Direction, "In");
}
void hookL2SessionDeleted(struct _LINKTABLE * LINK)
{
// calculate session time and av bytes/min in and out
if (LINK->ConnectTime)
{
if (LINK->bytesTXed == 0 && LINK->bytesRXed == 0)
{
// assume failed connect and ignore for now - maybe log later
}
else
{
char Msg[256];
char timestamp[16];
time_t sessionTime = time(NULL) - LINK->ConnectTime;
double avBytesSent = LINK->bytesTXed / (sessionTime / 60.0);
double avBytesRXed = LINK->bytesRXed / (sessionTime / 60.0);
time_t Now = time(NULL);
struct tm * TM = localtime(&Now);
sprintf(timestamp, "%02d:%02d:%02d", TM->tm_hour, TM->tm_min, TM->tm_sec);
if (sessionTime == 0)
sessionTime = 1; // Or will get divide by zero error
Debugprintf("KISS Session Stats Port %d %s %s %d secs Bytes Sent %d BPM %4.2f Bytes Received %d %4.2f BPM ",
LINK->LINKPORT->PORTNUMBER, LINK->callingCall, LINK->receivingCall, sessionTime, LINK->bytesTXed, avBytesSent, LINK->bytesRXed, avBytesRXed, timestamp);
sprintf(Msg, "{\"mode\": \"%s\", \"direction\": \"%s\", \"port\": %d, \"callfrom\": \"%s\", \"callto\": \"%s\", \"time\": %d, \"bytesSent\": %d,"
"\"BPMSent\": %4.2f, \"BytesReceived\": %d, \"BPMReceived\": %4.2f, \"timestamp\": \"%s\"}",
"KISS", LINK->Direction, LINK->LINKPORT->PORTNUMBER, LINK->callingCall, LINK->receivingCall, sessionTime,
LINK->bytesTXed, avBytesSent, LINK->bytesRXed, avBytesRXed, timestamp);
if (MQTT)
MQTTReportSession(Msg);
}
LINK->ConnectTime = 0;
}
}
void hookL2SessionAttempt(int Port, char * ourcall, char * remotecall, struct _LINKTABLE * LINK)
{
LINK->ConnectTime = time(NULL);
LINK->bytesTXed = LINK->bytesRXed = 0;
strcpy(LINK->callingCall, ourcall);
strcpy(LINK->receivingCall, remotecall);
strcpy(LINK->Direction, "Out");
}
void hookL4SessionAttempt(struct STREAMINFO * STREAM, char * remotecall, char * ourcall)
{
// Outgoing Connect
STREAM->ConnectTime = time(NULL);
STREAM->bytesTXed = STREAM->bytesRXed = 0;
strcpy(STREAM->callingCall, ourcall);
strcpy(STREAM->receivingCall, remotecall);
strcpy(STREAM->Direction, "Out");
}
void hookL4SessionAccepted(struct STREAMINFO * STREAM, char * remotecall, char * ourcall)
{
// Incoming Connect
STREAM->ConnectTime = time(NULL);
STREAM->bytesTXed = STREAM->bytesRXed = 0;
strcpy(STREAM->callingCall, remotecall);
strcpy(STREAM->receivingCall, ourcall);
strcpy(STREAM->Direction, "In");
}
void hookL4SessionDeleted(struct TNCINFO * TNC, struct STREAMINFO * STREAM)
{
char Msg[256];
char timestamp[16];
if (STREAM->ConnectTime)
{
time_t sessionTime = time(NULL) - STREAM->ConnectTime;
double avBytesRXed = STREAM->bytesRXed / (sessionTime / 60.0);
double avBytesSent = STREAM->bytesTXed / (sessionTime / 60.0);
time_t Now = time(NULL);
struct tm * TM = localtime(&Now);
sprintf(timestamp, "%02d:%02d:%02d", TM->tm_hour, TM->tm_min, TM->tm_sec);
if (sessionTime == 0)
sessionTime = 1; // Or will get divide by zero error
sprintf(Msg, "{\"mode\": \"%s\", \"direction\": \"%s\", \"port\": %d, \"callfrom\": \"%s\", \"callto\": \"%s\", \"time\": %d, \"bytesSent\": %d,"
"\"BPMSent\": %4.2f, \"BytesReceived\": %d, \"BPMReceived\": %4.2f, \"timestamp\": \"%s\"}",
Modenames[TNC->Hardware - 1], STREAM->Direction, TNC->Port, STREAM->callingCall, STREAM->receivingCall, sessionTime,
STREAM->bytesTXed, avBytesSent, STREAM->bytesRXed, avBytesRXed, timestamp);
if (MQTT)
MQTTReportSession(Msg);
STREAM->ConnectTime = 0;
}
}

@ -1,45 +1,45 @@
//
// HTTP Session Control. Used In Kernel HTTPCode, BBSHTMLConfig
// and ChatHTMLConfig
// On Windows changes to layout or length of this struct require rebuilding BPQ32.dll, BPQMail and BPQChat
struct HTTPConnectionInfo // Used for Web Server for thread-specific stuff
{
struct HTTPConnectionInfo * Next;
struct STATIONRECORD * SelCall; // Station Record for individual station display
char Callsign[12];
int WindDirn, WindSpeed, WindGust, Temp, RainLastHour, RainLastDay, RainToday, Humidity, Pressure; //WX Fields
char * ScreenLines[100]; // Screen Image for Teminal access mode - max 100 lines (cyclic buffer)
int ScreenLineLen[100]; // Length of each lime
int LastLine; // Pointer to last line of data
BOOL PartLine; // Last line does not have CR on end
char HTTPCall[10]; // Call of HTTP user
BOOL Changed; // Changed since last poll. If set, reply immediately, else set timer and wait
SOCKET sock; // Socket for pending send
int ResponseTimer; // Timer for delayed response
int KillTimer; // Clean up timer (no activity timeout)
int Stream; // BPQ Stream Number
char Key[20]; // Session Key
BOOL Connected;
// Use by Mail Module
#ifdef MAIL
struct UserInfo * User; // Selected User
struct MsgInfo * Msg; // Selected Message
WPRec * WP; // Selected WP record
WebMailInfo * WebMail; // Webmail Forms Info
#else
VOID * User; // Selected User
VOID * Msg; // Selected Message
VOID * WP; // Selected WP record
VOID * WebMail; // Webmail Forms Info
#endif
struct UserRec * USER; // Telnet Server USER record
int WebMailSkip; // Number to skip at start of list (for paging)
char WebMailTypes[4]; // Types To List
BOOL WebMailMine; // List all meessage to or from me
BOOL WebMailMyTX; // List all meessage from me
BOOL WebMailMyRX; // List all meessage to me
time_t WebMailLastUsed;
struct TNCINFO * TNC; // Session -> TNC link
};
//
// HTTP Session Control. Used In Kernel HTTPCode, BBSHTMLConfig
// and ChatHTMLConfig
// On Windows changes to layout or length of this struct require rebuilding BPQ32.dll, BPQMail and BPQChat
struct HTTPConnectionInfo // Used for Web Server for thread-specific stuff
{
struct HTTPConnectionInfo * Next;
struct STATIONRECORD * SelCall; // Station Record for individual station display
char Callsign[12];
int WindDirn, WindSpeed, WindGust, Temp, RainLastHour, RainLastDay, RainToday, Humidity, Pressure; //WX Fields
char * ScreenLines[100]; // Screen Image for Teminal access mode - max 100 lines (cyclic buffer)
int ScreenLineLen[100]; // Length of each lime
int LastLine; // Pointer to last line of data
BOOL PartLine; // Last line does not have CR on end
char HTTPCall[10]; // Call of HTTP user
BOOL Changed; // Changed since last poll. If set, reply immediately, else set timer and wait
SOCKET sock; // Socket for pending send
int ResponseTimer; // Timer for delayed response
int KillTimer; // Clean up timer (no activity timeout)
int Stream; // BPQ Stream Number
char Key[20]; // Session Key
BOOL Connected;
// Use by Mail Module
#ifdef MAIL
struct UserInfo * User; // Selected User
struct MsgInfo * Msg; // Selected Message
WPRec * WP; // Selected WP record
WebMailInfo * WebMail; // Webmail Forms Info
#else
VOID * User; // Selected User
VOID * Msg; // Selected Message
VOID * WP; // Selected WP record
VOID * WebMail; // Webmail Forms Info
#endif
struct UserRec * USER; // Telnet Server USER record
int WebMailSkip; // Number to skip at start of list (for paging)
char WebMailTypes[4]; // Types To List
BOOL WebMailMine; // List all meessage to or from me
BOOL WebMailMyTX; // List all meessage from me
BOOL WebMailMyRX; // List all meessage to me
time_t WebMailLastUsed;
struct TNCINFO * TNC; // Session -> TNC link
};

@ -1,190 +1,190 @@
/*
Copyright 2001-2022 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
*/
/*
Stuff to make compiling on WINDOWS and LINUX easier
*/
#ifdef WIN32
typedef unsigned int uint32_t;
#define pthread_t uint32_t
int pthread_equal(pthread_t T1, pthread_t T2)
{
return (T1 == T2);
}
#else
#include <stdio.h>
#include <ctype.h>
#include <syslog.h>
#include <stdarg.h>
#include <unistd.h>
#define BOOL int
#define VOID void
#define UCHAR unsigned char
#define USHORT unsigned short
#define ULONG uint32_t
#define UINT unsigned int
#define SHORT short
#define DWORD int32_t
#define APIENTRY
#define TRUE 1
#define FALSE 0
#define FAR
#define HWND unsigned int
#define HINSTANCE unsigned int
#define strtok_s strtok_r
VOID Debugprintf(const char * format, ...);
int memicmp(unsigned char *a, unsigned char *b, int n)
{
if (n)
{
while (n && (toupper(*a) == toupper(*b)))
n--, a++, b++;
if (n)
return toupper(*a) - toupper(*b);
}
return 0;
}
int stricmp(const unsigned char * pStr1, const unsigned char *pStr2)
{
unsigned char c1, c2;
int v;
if (pStr1 == NULL)
{
if (pStr2)
Debugprintf("stricmp called with NULL 1st param - 2nd %s ", pStr2);
else
Debugprintf("stricmp called with two NULL params");
return 1;
}
do {
c1 = *pStr1++;
c2 = *pStr2++;
/* The casts are necessary when pStr1 is shorter & char is signed */
v = tolower(c1) - tolower(c2);
} while ((v == 0) && (c1 != '\0') && (c2 != '\0') );
return v;
}
char * strupr(char* s)
{
char* p = s;
if (s == 0)
return 0;
while (*p = toupper( *p )) p++;
return s;
}
char * strlwr(char* s)
{
char* p = s;
while (*p = tolower( *p )) p++;
return s;
}
int sprintf_s(char * string, int plen, const char * format, ...)
{
va_list(arglist);
int Len;
va_start(arglist, format);
Len = vsprintf(string, format, arglist);
va_end(arglist);
return Len;
}
#include <pthread.h>
pthread_t _beginthread(void(*start_address)(), unsigned stack_size, VOID * arglist)
{
pthread_t thread;
// Need to set stack size for Mac
int s, tnum, opt, num_threads;
struct thread_info *tinfo;
pthread_attr_t attr;
void *res;
s = pthread_attr_init(&attr);
if (s != 0)
{
perror("pthread_attr_init");
return 0;
}
if (stack_size > 0)
{
s = pthread_attr_setstacksize(&attr, stack_size);
if (s != 0)
{
perror("pthread_attr_setstacksize");
return 0;
}
}
if (pthread_create(&thread, &attr, (void * (*)(void *))start_address, (void*) arglist) != 0)
perror("New Thread");
else
pthread_detach(thread);
return thread;
}
int Sleep(int ms)
{
usleep(ms * 1000);
return 0;
}
VOID OutputDebugString(char * string)
{
syslog(LOG_DEBUG, "%s", string);
}
void closesocket(int sock)
{
if (sock)
close(sock);
}
#endif
/*
Copyright 2001-2022 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
*/
/*
Stuff to make compiling on WINDOWS and LINUX easier
*/
#ifdef WIN32
typedef unsigned int uint32_t;
#define pthread_t uint32_t
int pthread_equal(pthread_t T1, pthread_t T2)
{
return (T1 == T2);
}
#else
#include <stdio.h>
#include <ctype.h>
#include <syslog.h>
#include <stdarg.h>
#include <unistd.h>
#define BOOL int
#define VOID void
#define UCHAR unsigned char
#define USHORT unsigned short
#define ULONG uint32_t
#define UINT unsigned int
#define SHORT short
#define DWORD int32_t
#define APIENTRY
#define TRUE 1
#define FALSE 0
#define FAR
#define HWND unsigned int
#define HINSTANCE unsigned int
#define strtok_s strtok_r
VOID Debugprintf(const char * format, ...);
int memicmp(unsigned char *a, unsigned char *b, int n)
{
if (n)
{
while (n && (toupper(*a) == toupper(*b)))
n--, a++, b++;
if (n)
return toupper(*a) - toupper(*b);
}
return 0;
}
int stricmp(const unsigned char * pStr1, const unsigned char *pStr2)
{
unsigned char c1, c2;
int v;
if (pStr1 == NULL)
{
if (pStr2)
Debugprintf("stricmp called with NULL 1st param - 2nd %s ", pStr2);
else
Debugprintf("stricmp called with two NULL params");
return 1;
}
do {
c1 = *pStr1++;
c2 = *pStr2++;
/* The casts are necessary when pStr1 is shorter & char is signed */
v = tolower(c1) - tolower(c2);
} while ((v == 0) && (c1 != '\0') && (c2 != '\0') );
return v;
}
char * strupr(char* s)
{
char* p = s;
if (s == 0)
return 0;
while (*p = toupper( *p )) p++;
return s;
}
char * strlwr(char* s)
{
char* p = s;
while (*p = tolower( *p )) p++;
return s;
}
int sprintf_s(char * string, int plen, const char * format, ...)
{
va_list(arglist);
int Len;
va_start(arglist, format);
Len = vsprintf(string, format, arglist);
va_end(arglist);
return Len;
}
#include <pthread.h>
pthread_t _beginthread(void(*start_address)(), unsigned stack_size, VOID * arglist)
{
pthread_t thread;
// Need to set stack size for Mac
int s, tnum, opt, num_threads;
struct thread_info *tinfo;
pthread_attr_t attr;
void *res;
s = pthread_attr_init(&attr);
if (s != 0)
{
perror("pthread_attr_init");
return 0;
}
if (stack_size > 0)
{
s = pthread_attr_setstacksize(&attr, stack_size);
if (s != 0)
{
perror("pthread_attr_setstacksize");
return 0;
}
}
if (pthread_create(&thread, &attr, (void * (*)(void *))start_address, (void*) arglist) != 0)
perror("New Thread");
else
pthread_detach(thread);
return thread;
}
int Sleep(int ms)
{
usleep(ms * 1000);
return 0;
}
VOID OutputDebugString(char * string)
{
syslog(LOG_DEBUG, "%s", string);
}
void closesocket(int sock)
{
if (sock)
close(sock);
}
#endif

@ -1,399 +1,399 @@
/*
Copyright 2001-2022 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
*/
//
// C replacement for TNCCode.asm
//
#define Kernel
#define _CRT_SECURE_NO_DEPRECATE
#pragma data_seg("_BPQDATA")
#include "time.h"
#include "stdio.h"
#include <fcntl.h>
#include "cheaders.h"
#include "tncinfo.h"
int C_Q_COUNT(VOID *PQ);
VOID SENDUIMESSAGE(struct DATAMESSAGE * Msg);
VOID TNCTimerProc()
{
// CALLED AT 10 HZ
int n = BPQHOSTSTREAMS;
PBPQVECSTRUC HOSTSESS = BPQHOSTVECTOR;
TRANSPORTENTRY * Session;
UCHAR DISCFLAG = 0;
while (n--)
{
// Action any DISC Requests (must be done in timer owning process)
if (HOSTSESS->HOSTFLAGS & 0x40) // DISC REQUEST
{
if (HOSTSESS->HOSTFLAGS & 0x20) // Stay?
DISCFLAG = 'S';
HOSTSESS->HOSTFLAGS &= 0x9F; // Clear Flags
Session = HOSTSESS->HOSTSESSION;
if (Session == 0) // Gone??
{
HOSTSESS->HOSTFLAGS |= 3; // STATE CHANGE
#ifndef LINBPQ
if (HOSTSESS->HOSTHANDLE);
{
PostMessage(HOSTSESS->HOSTHANDLE, BPQMsg, HOSTSESS->HOSTSTREAM, 4);
}
#endif
continue;
}
if (Session->L4CROSSLINK)
Session->L4CROSSLINK->STAYFLAG = DISCFLAG;
HOSTSESS->HOSTSESSION = 0;
HOSTSESS->HOSTFLAGS |= 3; // STATE CHANGE
PostStateChange(Session);
CloseSessionPartner(Session); // SEND CLOSE TO PARTNER (IF PRESENT)
}
// Check Trace Q
if (HOSTSESS->HOSTAPPLFLAGS & 0x80)
{
if (HOSTSESS->HOSTTRACEQ)
{
int Count = C_Q_COUNT(&HOSTSESS->HOSTTRACEQ);
if (Count > 100)
ReleaseBuffer((void *)Q_REM((void *)&HOSTSESS->HOSTTRACEQ));
}
}
HOSTSESS++;
}
}
VOID SendSmartID(struct PORTCONTROL * PORT)
{
struct _MESSAGE * ID = IDMSG;
struct _MESSAGE * Buffer;
PORT->SmartIDNeeded = 0;
Buffer = GetBuff();
if (Buffer)
{
memcpy(Buffer, ID, ID->LENGTH);
Buffer->PORT = PORT->PORTNUMBER;
// IF PORT HAS A CALLSIGN DEFINED, SEND THAT INSTEAD
if (PORT->PORTCALL[0] > 0x40)
{
memcpy(Buffer->ORIGIN, PORT->PORTCALL, 7);
Buffer->ORIGIN[6] |= 1; // SET END OF CALL BIT
}
// If Pactor Style add to UI_Q
if (PORT->PROTOCOL == 10 && PORT->TNC && PORT->TNC->Hardware != H_KISSHF && PORT->UICAPABLE)
{
EXTPORTDATA * EXTPORT = (EXTPORTDATA *) PORT;
C_Q_ADD(&EXTPORT->UI_Q, Buffer);
return;
}
PUT_ON_PORT_Q(PORT, Buffer);
}
}
VOID SENDIDMSG()
{
struct PORTCONTROL * PORT = PORTTABLE;
struct _MESSAGE * ID = IDMSG;
struct _MESSAGE * Buffer;
while (PORT)
{
if (PORT->PROTOCOL < 10) // Not Pactor-style
{
Buffer = GetBuff();
if (Buffer)
{
memcpy(Buffer, ID, ID->LENGTH);
Buffer->PORT = PORT->PORTNUMBER;
// IF PORT HAS A CALLSIGN DEFINED, SEND THAT INSTEAD
if (PORT->PORTCALL[0] > 0x40)
{
memcpy(Buffer->ORIGIN, PORT->PORTCALL, 7);
Buffer->ORIGIN[6] |= 1; // SET END OF CALL BIT
}
C_Q_ADD(&IDMSG_Q, Buffer);
}
}
PORT = PORT->PORTPOINTER;
}
}
VOID SENDBTMSG()
{
struct PORTCONTROL * PORT = PORTTABLE;
struct _MESSAGE * Buffer;
char * ptr1, * ptr2;
while (PORT)
{
if (PORT->PROTOCOL >= 10 || PORT->PORTUNPROTO == 0) // Pactor-style or no UNPROTO ADDR?
{
PORT = PORT->PORTPOINTER;
continue;
}
Buffer = GetBuff();
if (Buffer)
{
memcpy(Buffer->DEST, PORT->PORTUNPROTO, 7);
Buffer->DEST[6] |= 0xC0; // Set Command bits
// Send from BBSCALL unless PORTBCALL defined
if (PORT->PORTBCALL[0] > 32)
memcpy(Buffer->ORIGIN, PORT->PORTBCALL, 7);
else if (APPLCALLTABLE->APPLCALL[0] > 32)
memcpy(Buffer->ORIGIN, APPLCALLTABLE->APPLCALL, 7);
else
memcpy(Buffer->ORIGIN, MYCALL, 7);
ptr1 = &PORT->PORTUNPROTO[7]; // First Digi
ptr2 = &Buffer->CTL; // Digi field in buffer
// Copy any digis
while (*(ptr1))
{
memcpy(ptr2, ptr1, 7);
ptr1 += 7;
ptr2 += 7;
}
*(ptr2 - 1) |= 1; // Set End of Address
*(ptr2++) = UI;
memcpy(ptr2, &BTHDDR.PID, BTHDDR.LENGTH);
ptr2 += BTHDDR.LENGTH;
Buffer->LENGTH = (int)(ptr2 - (char *)Buffer);
Buffer->PORT = PORT->PORTNUMBER;
C_Q_ADD(&IDMSG_Q, Buffer);
}
PORT = PORT->PORTPOINTER;
}
}
VOID SENDUIMESSAGE(struct DATAMESSAGE * Msg)
{
struct PORTCONTROL * PORT = PORTTABLE;
struct _MESSAGE * Buffer;
char * ptr1, * ptr2;
Msg->LENGTH -= MSGHDDRLEN; // Remove Header
while (PORT)
{
if ((PORT->PROTOCOL == 10 && PORT->UICAPABLE == 0) || PORT->PORTUNPROTO == 0) // Pactor-style or no UNPROTO ADDR?
{
PORT = PORT->PORTPOINTER;
continue;
}
Buffer = GetBuff();
if (Buffer)
{
memcpy(Buffer->DEST, PORT->PORTUNPROTO, 7);
Buffer->DEST[6] |= 0xC0; // Set Command bits
// Send from BBSCALL unless PORTBCALL defined
if (PORT->PORTBCALL[0] > 32)
memcpy(Buffer->ORIGIN, PORT->PORTBCALL, 7);
else if (APPLCALLTABLE->APPLCALL[0] > 32)
memcpy(Buffer->ORIGIN, APPLCALLTABLE->APPLCALL, 7);
else
memcpy(Buffer->ORIGIN, MYCALL, 7);
ptr1 = &PORT->PORTUNPROTO[7]; // First Digi
ptr2 = &Buffer->CTL; // Digi field in buffer
// Copy any digis
while (*(ptr1))
{
memcpy(ptr2, ptr1, 7);
ptr1 += 7;
ptr2 += 7;
}
*(ptr2 - 1) |= 1; // Set End of Address
*(ptr2++) = UI;
memcpy(ptr2, &Msg->PID, Msg->LENGTH);
ptr2 += Msg->LENGTH;
Buffer->LENGTH = (int)(ptr2 - (char *)Buffer);
Buffer->PORT = PORT->PORTNUMBER;
if (PORT->PROTOCOL == 10)
{
EXTPORTDATA * EXTPORT = (EXTPORTDATA *) PORT;
C_Q_ADD(&EXTPORT->UI_Q, Buffer);
}
else
C_Q_ADD(&IDMSG_Q, Buffer);
}
PORT = PORT->PORTPOINTER;
}
}
Dll VOID APIENTRY Send_AX(UCHAR * Block, DWORD Len, UCHAR Port)
{
// Block included the 7/11 byte header, Len does not
struct PORTCONTROL * PORT;
PMESSAGE Copy;
if (Len > 360 - 15)
return;
if (QCOUNT < 50)
return; // Running low
PORT = GetPortTableEntryFromPortNum(Port);
if (PORT == 0)
return;
Copy = GetBuff();
if (Copy == 0)
return;
memcpy(&Copy->DEST[0], &Block[MSGHDDRLEN], Len);
Copy->LENGTH = (USHORT)Len + MSGHDDRLEN;
if (PORT->PROTOCOL == 10 && PORT->TNC && PORT->TNC->Hardware != H_KISSHF)
{
// Pactor Style. Probably will only be used for Tracker uneless we do APRS over V4 or WINMOR
EXTPORTDATA * EXTPORT = (EXTPORTDATA *) PORT;
C_Q_ADD(&EXTPORT->UI_Q, Copy);
return;
}
Copy->PORT = Port;
PUT_ON_PORT_Q(PORT, Copy);
}
TRANSPORTENTRY * SetupSessionFromHost(PBPQVECSTRUC HOST, UINT ApplMask)
{
// Create a Transport (L4) session linked to an incoming HOST (API) Session
TRANSPORTENTRY * NewSess = L4TABLE;
int Index = 0;
while (Index < MAXCIRCUITS)
{
if (NewSess->L4USER[0] == 0)
{
// Got One
UCHAR * ourcall = &MYCALL[0];
// IF APPL PORT USE APPL CALL, ELSE NODE CALL
if (ApplMask)
{
// Circuit for APPL - look for an APPLCALL
APPLCALLS * APPL = APPLCALLTABLE;
while ((ApplMask & 1) == 0)
{
ApplMask >>= 1;
APPL++;
}
if (APPL->APPLCALL[0] > 0x40) // We have an applcall
ourcall = &APPL->APPLCALL[0];
}
memcpy(NewSess->L4USER, ourcall, 7);
memcpy(NewSess->L4MYCALL, ourcall, 7);
NewSess->CIRCUITINDEX = Index; //OUR INDEX
NewSess->CIRCUITID = NEXTID;
NEXTID++;
if (NEXTID == 0)
NEXTID++; // Keep Non-Zero
NewSess->L4TARGET.HOST = HOST;
NewSess->L4STATE = 5;
NewSess->SESSIONT1 = L4T1;
NewSess->L4WINDOW = (UCHAR)L4DEFAULTWINDOW;
NewSess->SESSPACLEN = PACLEN; // Default;
return NewSess;
}
Index++;
NewSess++;
}
// Table Full
return NULL;
}
/*
Copyright 2001-2022 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
*/
//
// C replacement for TNCCode.asm
//
#define Kernel
#define _CRT_SECURE_NO_DEPRECATE
#pragma data_seg("_BPQDATA")
#include "time.h"
#include "stdio.h"
#include <fcntl.h>
#include "cheaders.h"
#include "tncinfo.h"
int C_Q_COUNT(VOID *PQ);
VOID SENDUIMESSAGE(struct DATAMESSAGE * Msg);
VOID TNCTimerProc()
{
// CALLED AT 10 HZ
int n = BPQHOSTSTREAMS;
PBPQVECSTRUC HOSTSESS = BPQHOSTVECTOR;
TRANSPORTENTRY * Session;
UCHAR DISCFLAG = 0;
while (n--)
{
// Action any DISC Requests (must be done in timer owning process)
if (HOSTSESS->HOSTFLAGS & 0x40) // DISC REQUEST
{
if (HOSTSESS->HOSTFLAGS & 0x20) // Stay?
DISCFLAG = 'S';
HOSTSESS->HOSTFLAGS &= 0x9F; // Clear Flags
Session = HOSTSESS->HOSTSESSION;
if (Session == 0) // Gone??
{
HOSTSESS->HOSTFLAGS |= 3; // STATE CHANGE
#ifndef LINBPQ
if (HOSTSESS->HOSTHANDLE);
{
PostMessage(HOSTSESS->HOSTHANDLE, BPQMsg, HOSTSESS->HOSTSTREAM, 4);
}
#endif
continue;
}
if (Session->L4CROSSLINK)
Session->L4CROSSLINK->STAYFLAG = DISCFLAG;
HOSTSESS->HOSTSESSION = 0;
HOSTSESS->HOSTFLAGS |= 3; // STATE CHANGE
PostStateChange(Session);
CloseSessionPartner(Session); // SEND CLOSE TO PARTNER (IF PRESENT)
}
// Check Trace Q
if (HOSTSESS->HOSTAPPLFLAGS & 0x80)
{
if (HOSTSESS->HOSTTRACEQ)
{
int Count = C_Q_COUNT(&HOSTSESS->HOSTTRACEQ);
if (Count > 100)
ReleaseBuffer((void *)Q_REM((void *)&HOSTSESS->HOSTTRACEQ));
}
}
HOSTSESS++;
}
}
VOID SendSmartID(struct PORTCONTROL * PORT)
{
struct _MESSAGE * ID = IDMSG;
struct _MESSAGE * Buffer;
PORT->SmartIDNeeded = 0;
Buffer = GetBuff();
if (Buffer)
{
memcpy(Buffer, ID, ID->LENGTH);
Buffer->PORT = PORT->PORTNUMBER;
// IF PORT HAS A CALLSIGN DEFINED, SEND THAT INSTEAD
if (PORT->PORTCALL[0] > 0x40)
{
memcpy(Buffer->ORIGIN, PORT->PORTCALL, 7);
Buffer->ORIGIN[6] |= 1; // SET END OF CALL BIT
}
// If Pactor Style add to UI_Q
if (PORT->PROTOCOL == 10 && PORT->TNC && PORT->TNC->Hardware != H_KISSHF && PORT->UICAPABLE)
{
EXTPORTDATA * EXTPORT = (EXTPORTDATA *) PORT;
C_Q_ADD(&EXTPORT->UI_Q, Buffer);
return;
}
PUT_ON_PORT_Q(PORT, Buffer);
}
}
VOID SENDIDMSG()
{
struct PORTCONTROL * PORT = PORTTABLE;
struct _MESSAGE * ID = IDMSG;
struct _MESSAGE * Buffer;
while (PORT)
{
if (PORT->PROTOCOL < 10) // Not Pactor-style
{
Buffer = GetBuff();
if (Buffer)
{
memcpy(Buffer, ID, ID->LENGTH);
Buffer->PORT = PORT->PORTNUMBER;
// IF PORT HAS A CALLSIGN DEFINED, SEND THAT INSTEAD
if (PORT->PORTCALL[0] > 0x40)
{
memcpy(Buffer->ORIGIN, PORT->PORTCALL, 7);
Buffer->ORIGIN[6] |= 1; // SET END OF CALL BIT
}
C_Q_ADD(&IDMSG_Q, Buffer);
}
}
PORT = PORT->PORTPOINTER;
}
}
VOID SENDBTMSG()
{
struct PORTCONTROL * PORT = PORTTABLE;
struct _MESSAGE * Buffer;
char * ptr1, * ptr2;
while (PORT)
{
if (PORT->PROTOCOL >= 10 || PORT->PORTUNPROTO == 0) // Pactor-style or no UNPROTO ADDR?
{
PORT = PORT->PORTPOINTER;
continue;
}
Buffer = GetBuff();
if (Buffer)
{
memcpy(Buffer->DEST, PORT->PORTUNPROTO, 7);
Buffer->DEST[6] |= 0xC0; // Set Command bits
// Send from BBSCALL unless PORTBCALL defined
if (PORT->PORTBCALL[0] > 32)
memcpy(Buffer->ORIGIN, PORT->PORTBCALL, 7);
else if (APPLCALLTABLE->APPLCALL[0] > 32)
memcpy(Buffer->ORIGIN, APPLCALLTABLE->APPLCALL, 7);
else
memcpy(Buffer->ORIGIN, MYCALL, 7);
ptr1 = &PORT->PORTUNPROTO[7]; // First Digi
ptr2 = &Buffer->CTL; // Digi field in buffer
// Copy any digis
while (*(ptr1))
{
memcpy(ptr2, ptr1, 7);
ptr1 += 7;
ptr2 += 7;
}
*(ptr2 - 1) |= 1; // Set End of Address
*(ptr2++) = UI;
memcpy(ptr2, &BTHDDR.PID, BTHDDR.LENGTH);
ptr2 += BTHDDR.LENGTH;
Buffer->LENGTH = (int)(ptr2 - (char *)Buffer);
Buffer->PORT = PORT->PORTNUMBER;
C_Q_ADD(&IDMSG_Q, Buffer);
}
PORT = PORT->PORTPOINTER;
}
}
VOID SENDUIMESSAGE(struct DATAMESSAGE * Msg)
{
struct PORTCONTROL * PORT = PORTTABLE;
struct _MESSAGE * Buffer;
char * ptr1, * ptr2;
Msg->LENGTH -= MSGHDDRLEN; // Remove Header
while (PORT)
{
if ((PORT->PROTOCOL == 10 && PORT->UICAPABLE == 0) || PORT->PORTUNPROTO == 0) // Pactor-style or no UNPROTO ADDR?
{
PORT = PORT->PORTPOINTER;
continue;
}
Buffer = GetBuff();
if (Buffer)
{
memcpy(Buffer->DEST, PORT->PORTUNPROTO, 7);
Buffer->DEST[6] |= 0xC0; // Set Command bits
// Send from BBSCALL unless PORTBCALL defined
if (PORT->PORTBCALL[0] > 32)
memcpy(Buffer->ORIGIN, PORT->PORTBCALL, 7);
else if (APPLCALLTABLE->APPLCALL[0] > 32)
memcpy(Buffer->ORIGIN, APPLCALLTABLE->APPLCALL, 7);
else
memcpy(Buffer->ORIGIN, MYCALL, 7);
ptr1 = &PORT->PORTUNPROTO[7]; // First Digi
ptr2 = &Buffer->CTL; // Digi field in buffer
// Copy any digis
while (*(ptr1))
{
memcpy(ptr2, ptr1, 7);
ptr1 += 7;
ptr2 += 7;
}
*(ptr2 - 1) |= 1; // Set End of Address
*(ptr2++) = UI;
memcpy(ptr2, &Msg->PID, Msg->LENGTH);
ptr2 += Msg->LENGTH;
Buffer->LENGTH = (int)(ptr2 - (char *)Buffer);
Buffer->PORT = PORT->PORTNUMBER;
if (PORT->PROTOCOL == 10)
{
EXTPORTDATA * EXTPORT = (EXTPORTDATA *) PORT;
C_Q_ADD(&EXTPORT->UI_Q, Buffer);
}
else
C_Q_ADD(&IDMSG_Q, Buffer);
}
PORT = PORT->PORTPOINTER;
}
}
Dll VOID APIENTRY Send_AX(UCHAR * Block, DWORD Len, UCHAR Port)
{
// Block included the 7/11 byte header, Len does not
struct PORTCONTROL * PORT;
PMESSAGE Copy;
if (Len > 360 - 15)
return;
if (QCOUNT < 50)
return; // Running low
PORT = GetPortTableEntryFromPortNum(Port);
if (PORT == 0)
return;
Copy = GetBuff();
if (Copy == 0)
return;
memcpy(&Copy->DEST[0], &Block[MSGHDDRLEN], Len);
Copy->LENGTH = (USHORT)Len + MSGHDDRLEN;
if (PORT->PROTOCOL == 10 && PORT->TNC && PORT->TNC->Hardware != H_KISSHF)
{
// Pactor Style. Probably will only be used for Tracker uneless we do APRS over V4 or WINMOR
EXTPORTDATA * EXTPORT = (EXTPORTDATA *) PORT;
C_Q_ADD(&EXTPORT->UI_Q, Copy);
return;
}
Copy->PORT = Port;
PUT_ON_PORT_Q(PORT, Copy);
}
TRANSPORTENTRY * SetupSessionFromHost(PBPQVECSTRUC HOST, UINT ApplMask)
{
// Create a Transport (L4) session linked to an incoming HOST (API) Session
TRANSPORTENTRY * NewSess = L4TABLE;
int Index = 0;
while (Index < MAXCIRCUITS)
{
if (NewSess->L4USER[0] == 0)
{
// Got One
UCHAR * ourcall = &MYCALL[0];
// IF APPL PORT USE APPL CALL, ELSE NODE CALL
if (ApplMask)
{
// Circuit for APPL - look for an APPLCALL
APPLCALLS * APPL = APPLCALLTABLE;
while ((ApplMask & 1) == 0)
{
ApplMask >>= 1;
APPL++;
}
if (APPL->APPLCALL[0] > 0x40) // We have an applcall
ourcall = &APPL->APPLCALL[0];
}
memcpy(NewSess->L4USER, ourcall, 7);
memcpy(NewSess->L4MYCALL, ourcall, 7);
NewSess->CIRCUITINDEX = Index; //OUR INDEX
NewSess->CIRCUITID = NEXTID;
NEXTID++;
if (NEXTID == 0)
NEXTID++; // Keep Non-Zero
NewSess->L4TARGET.HOST = HOST;
NewSess->L4STATE = 5;
NewSess->SESSIONT1 = L4T1;
NewSess->L4WINDOW = (UCHAR)L4DEFAULTWINDOW;
NewSess->SESSPACLEN = PACLEN; // Default;
return NewSess;
}
Index++;
NewSess++;
}
// Table Full
return NULL;
}

@ -1,125 +1,125 @@
#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,65
#define KVerstring "6.0.24.65\0"
#ifdef CKernel
#define Vers KVers
#define Verstring KVerstring
#define Datestring "February 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
#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,65
#define KVerstring "6.0.24.65\0"
#ifdef CKernel
#define Vers KVers
#define Verstring KVerstring
#define Datestring "February 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

@ -1,20 +1,20 @@

Microsoft Visual Studio Solution File, Format Version 9.00
# Visual C++ Express 2005
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UDPtoTCP", "UDPtoTCP\UDPtoTCP.vcproj", "{879D4FD3-82E0-429E-8A54-7AF4CA9FEF7D}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{879D4FD3-82E0-429E-8A54-7AF4CA9FEF7D}.Debug|Win32.ActiveCfg = Debug|Win32
{879D4FD3-82E0-429E-8A54-7AF4CA9FEF7D}.Debug|Win32.Build.0 = Debug|Win32
{879D4FD3-82E0-429E-8A54-7AF4CA9FEF7D}.Release|Win32.ActiveCfg = Release|Win32
{879D4FD3-82E0-429E-8A54-7AF4CA9FEF7D}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

Microsoft Visual Studio Solution File, Format Version 9.00
# Visual C++ Express 2005
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UDPtoTCP", "UDPtoTCP\UDPtoTCP.vcproj", "{879D4FD3-82E0-429E-8A54-7AF4CA9FEF7D}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{879D4FD3-82E0-429E-8A54-7AF4CA9FEF7D}.Debug|Win32.ActiveCfg = Debug|Win32
{879D4FD3-82E0-429E-8A54-7AF4CA9FEF7D}.Debug|Win32.Build.0 = Debug|Win32
{879D4FD3-82E0-429E-8A54-7AF4CA9FEF7D}.Release|Win32.ActiveCfg = Release|Win32
{879D4FD3-82E0-429E-8A54-7AF4CA9FEF7D}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

@ -1,224 +1,224 @@
/*
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 "bpqmail.h"
int LastVer[4] = {0, 0, 0, 0}; // In case we need to do somthing the first time a version is run
HWND MainWnd;
HWND hWndSess;
RECT MainRect;
HMENU hActionMenu;
static HMENU hMenu;
HMENU hDisMenu; // Disconnect Menu Handle
HMENU hFWDMenu; // Forward Menu Handle
int SessX, SessY, SessWidth; // Params for Session Window
char szBuff[80];
#define MaxSockets 64
ConnectionInfo Connections[MaxSockets+1];
struct SEM ChatSemaphore = {0, 0};
struct SEM AllocSemaphore = {0, 0};
struct SEM ConSemaphore = {0, 0};
struct SEM Semaphore = {0, 0};
struct SEM OutputSEM = {0, 0};
struct SEM ConfigSEM = {0, 0};
struct UserInfo ** UserRecPtr=NULL;
int NumberofUsers=0;
struct UserInfo * BBSChain = NULL; // Chain of users that are BBSes
struct MsgInfo ** MsgHddrPtr=NULL;
int NumberofMessages=0;
int FirstMessageIndextoForward = 0; // Lowest Message with a forward bit set - limits search
BIDRec ** BIDRecPtr=NULL;
int NumberofBIDs=0;
BIDRec ** TempBIDRecPtr=NULL;
int NumberofTempBIDs=0;
WPRec ** WPRecPtr=NULL;
int NumberofWPrecs=0;
char ** BadWords=NULL;
int NumberofBadWords=0;
char * BadFile = NULL;
int LatestMsg = 0;
struct SEM MsgNoSemaphore = {0, 0}; // For locking updates to LatestMsg
int HighestBBSNumber = 0;
int MaxMsgno = 60000;
int BidLifetime = 60;
int MaxAge = 30;
int MaintInterval = 24;
int MaintTime = 0;
int UserLifetime = 0;
BOOL cfgMinToTray;
BOOL DisconnectOnClose=FALSE;
char PasswordMsg[100]="Password:";
char cfgHOSTPROMPT[100];
char cfgCTEXT[100];
char cfgLOCALECHO[100];
char AttemptsMsg[] = "Too many attempts - Disconnected\r\r";
char disMsg[] = "Disconnected by SYSOP\r\r";
char LoginMsg[]="user:";
char BlankCall[]=" ";
ULONG BBSApplMask;
ULONG ChatApplMask;
int BBSApplNum=0;
int ChatApplNum=0;
//int StartStream=0;
int NumberofStreams=0;
int MaxStreams=0;
char BBSSID[]="[%s%d.%d.%d.%d-%s%s%s%sIH%sM$]\r";
char ChatSID[]="[BPQChatServer-%d.%d.%d.%d]\r";
char NewUserPrompt[100]="Please enter your Name\r>\r";
char * WelcomeMsg = NULL;
char * NewWelcomeMsg = NULL;
char * ExpertWelcomeMsg = NULL;
char * Prompt = NULL;
char * NewPrompt = NULL;
char * ExpertPrompt = NULL;
char BBSName[100] = "NOCALL";
char SYSOPCall[50];
char MailForText[100];
char HRoute[100];
char AMPRDomain[100];
BOOL SendAMPRDirect = 0;
char SignoffMsg[120];
char AbortedMsg[100]="\rOutput aborted\r";
char UserDatabaseName[MAX_PATH] = "BPQBBSUsers.dat";
char UserDatabasePath[MAX_PATH];
char MsgDatabasePath[MAX_PATH];
char MsgDatabaseName[MAX_PATH] = "DIRMES.SYS";
char BIDDatabasePath[MAX_PATH];
char BIDDatabaseName[MAX_PATH] = "WFBID.SYS";
char WPDatabasePath[MAX_PATH];
char WPDatabaseName[MAX_PATH] = "WP.SYS";
char BadWordsPath[MAX_PATH];
char BadWordsName[MAX_PATH] = "BADWORDS.SYS";
char NTSAliasesPath[MAX_PATH];
char NTSAliasesName[MAX_PATH] = "INTRCPT.APS";
char ConfigName[250];
char ChatConfigName[250];
BOOL UsingingRegConfig = FALSE;
BOOL MulticastRX = FALSE;
char BaseDir[MAX_PATH];
char BaseDirRaw[MAX_PATH]; // As set in registry - may contain %NAME%
char ProperBaseDir[MAX_PATH]; // BPQ Directory/BPQMailChat
char MailDir[MAX_PATH];
char RlineVer[50];
BOOL KISSOnly = FALSE;
BOOL EnableUI = FALSE;
BOOL RefuseBulls = FALSE;
BOOL SendSYStoSYSOPCall = FALSE;
BOOL SendBBStoSYSOPCall = FALSE;
BOOL DontHoldNewUsers = FALSE;
BOOL DefaultNoWINLINK = FALSE;
BOOL ForwardToMe = FALSE;
BOOL OnlyKnown = FALSE;
BOOL DontNeedHomeBBS = FALSE;
BOOL DontCheckFromCall = FALSE;
// Send WP Params
BOOL SendWP;
BOOL FilterWPBulls;
BOOL NoWPGuesses;
char SendWPVIA[81];
char SendWPTO[11];
char ** SendWPAddrs; // Replaces WP To and VIA
int SendWPType;
int SMTPMsgs;
int MailForInterval = 0;
char zeros[NBMASK]; // For forward bitmask tests
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.
// Filter Params
char ** RejFrom; // Reject on FROM Call
char ** RejTo; // Reject on TO Call
char ** RejAt; // Reject on AT Call
char ** RejBID; // Reject on BID
char ** HoldFrom; // Hold on FROM Call
char ** HoldTo; // Hold on TO Call
char ** HoldAt; // Hold on AT Call
char ** HoldBID; // Hold on BID
/*
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 "bpqmail.h"
int LastVer[4] = {0, 0, 0, 0}; // In case we need to do somthing the first time a version is run
HWND MainWnd;
HWND hWndSess;
RECT MainRect;
HMENU hActionMenu;
static HMENU hMenu;
HMENU hDisMenu; // Disconnect Menu Handle
HMENU hFWDMenu; // Forward Menu Handle
int SessX, SessY, SessWidth; // Params for Session Window
char szBuff[80];
#define MaxSockets 64
ConnectionInfo Connections[MaxSockets+1];
struct SEM ChatSemaphore = {0, 0};
struct SEM AllocSemaphore = {0, 0};
struct SEM ConSemaphore = {0, 0};
struct SEM Semaphore = {0, 0};
struct SEM OutputSEM = {0, 0};
struct SEM ConfigSEM = {0, 0};
struct UserInfo ** UserRecPtr=NULL;
int NumberofUsers=0;
struct UserInfo * BBSChain = NULL; // Chain of users that are BBSes
struct MsgInfo ** MsgHddrPtr=NULL;
int NumberofMessages=0;
int FirstMessageIndextoForward = 0; // Lowest Message with a forward bit set - limits search
BIDRec ** BIDRecPtr=NULL;
int NumberofBIDs=0;
BIDRec ** TempBIDRecPtr=NULL;
int NumberofTempBIDs=0;
WPRec ** WPRecPtr=NULL;
int NumberofWPrecs=0;
char ** BadWords=NULL;
int NumberofBadWords=0;
char * BadFile = NULL;
int LatestMsg = 0;
struct SEM MsgNoSemaphore = {0, 0}; // For locking updates to LatestMsg
int HighestBBSNumber = 0;
int MaxMsgno = 60000;
int BidLifetime = 60;
int MaxAge = 30;
int MaintInterval = 24;
int MaintTime = 0;
int UserLifetime = 0;
BOOL cfgMinToTray;
BOOL DisconnectOnClose=FALSE;
char PasswordMsg[100]="Password:";
char cfgHOSTPROMPT[100];
char cfgCTEXT[100];
char cfgLOCALECHO[100];
char AttemptsMsg[] = "Too many attempts - Disconnected\r\r";
char disMsg[] = "Disconnected by SYSOP\r\r";
char LoginMsg[]="user:";
char BlankCall[]=" ";
ULONG BBSApplMask;
ULONG ChatApplMask;
int BBSApplNum=0;
int ChatApplNum=0;
//int StartStream=0;
int NumberofStreams=0;
int MaxStreams=0;
char BBSSID[]="[%s%d.%d.%d.%d-%s%s%s%sIH%sM$]\r";
char ChatSID[]="[BPQChatServer-%d.%d.%d.%d]\r";
char NewUserPrompt[100]="Please enter your Name\r>\r";
char * WelcomeMsg = NULL;
char * NewWelcomeMsg = NULL;
char * ExpertWelcomeMsg = NULL;
char * Prompt = NULL;
char * NewPrompt = NULL;
char * ExpertPrompt = NULL;
char BBSName[100] = "NOCALL";
char SYSOPCall[50];
char MailForText[100];
char HRoute[100];
char AMPRDomain[100];
BOOL SendAMPRDirect = 0;
char SignoffMsg[120];
char AbortedMsg[100]="\rOutput aborted\r";
char UserDatabaseName[MAX_PATH] = "BPQBBSUsers.dat";
char UserDatabasePath[MAX_PATH];
char MsgDatabasePath[MAX_PATH];
char MsgDatabaseName[MAX_PATH] = "DIRMES.SYS";
char BIDDatabasePath[MAX_PATH];
char BIDDatabaseName[MAX_PATH] = "WFBID.SYS";
char WPDatabasePath[MAX_PATH];
char WPDatabaseName[MAX_PATH] = "WP.SYS";
char BadWordsPath[MAX_PATH];
char BadWordsName[MAX_PATH] = "BADWORDS.SYS";
char NTSAliasesPath[MAX_PATH];
char NTSAliasesName[MAX_PATH] = "INTRCPT.APS";
char ConfigName[250];
char ChatConfigName[250];
BOOL UsingingRegConfig = FALSE;
BOOL MulticastRX = FALSE;
char BaseDir[MAX_PATH];
char BaseDirRaw[MAX_PATH]; // As set in registry - may contain %NAME%
char ProperBaseDir[MAX_PATH]; // BPQ Directory/BPQMailChat
char MailDir[MAX_PATH];
char RlineVer[50];
BOOL KISSOnly = FALSE;
BOOL EnableUI = FALSE;
BOOL RefuseBulls = FALSE;
BOOL SendSYStoSYSOPCall = FALSE;
BOOL SendBBStoSYSOPCall = FALSE;
BOOL DontHoldNewUsers = FALSE;
BOOL DefaultNoWINLINK = FALSE;
BOOL ForwardToMe = FALSE;
BOOL OnlyKnown = FALSE;
BOOL DontNeedHomeBBS = FALSE;
BOOL DontCheckFromCall = FALSE;
// Send WP Params
BOOL SendWP;
BOOL FilterWPBulls;
BOOL NoWPGuesses;
char SendWPVIA[81];
char SendWPTO[11];
char ** SendWPAddrs; // Replaces WP To and VIA
int SendWPType;
int SMTPMsgs;
int MailForInterval = 0;
char zeros[NBMASK]; // For forward bitmask tests
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.
// Filter Params
char ** RejFrom; // Reject on FROM Call
char ** RejTo; // Reject on TO Call
char ** RejAt; // Reject on AT Call
char ** RejBID; // Reject on BID
char ** HoldFrom; // Hold on FROM Call
char ** HoldTo; // Hold on TO Call
char ** HoldAt; // Hold on AT Call
char ** HoldBID; // Hold on BID
struct ConsoleInfo * ConsHeader[2];

@ -1,68 +1,68 @@
// CmdLineAuth.cpp : Defines the entry point for the console application.
//
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#define _CRT_SECURE_NO_DEPRECATE
#define _USE_32BIT_TIME_T
#include <stdio.h>
#include <time.h>
#include <stdio.h>
#include "MD5.c"
int LastNow;
int PassCode;
VOID CreateOneTimePassword(char * KeyPhrase)
{
// Create a time dependent One Time Password from the KeyPhrase
time_t NOW = time(NULL);
unsigned char Hash[16];
char Password[20];
char Key[1000];
int i, chr;
long long Val;
NOW = NOW/30; // Only Change every 30 secs
if (NOW == LastNow)
return;
LastNow = NOW;
sprintf(Key, "%s%x", KeyPhrase, NOW);
md5(Key, Hash);
for (i=0; i<16; i++)
{
chr = (Hash[i] & 31);
if (chr > 9) chr += 7;
Password[i] = chr + 48;
}
Password[16] = 0;
memcpy(&Val, Password, 8);
PassCode = Val %= 1000000;
printf("Passcode is %d\n", PassCode);
return;
}
int main(int argc, char * argv[])
{
if (argc < 2)
{
printf ("Need to supply KeyPhrase\n");
return 0;
}
CreateOneTimePassword(argv[1]);
return 0;
}
// CmdLineAuth.cpp : Defines the entry point for the console application.
//
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#define _CRT_SECURE_NO_DEPRECATE
#define _USE_32BIT_TIME_T
#include <stdio.h>
#include <time.h>
#include <stdio.h>
#include "MD5.c"
int LastNow;
int PassCode;
VOID CreateOneTimePassword(char * KeyPhrase)
{
// Create a time dependent One Time Password from the KeyPhrase
time_t NOW = time(NULL);
unsigned char Hash[16];
char Password[20];
char Key[1000];
int i, chr;
long long Val;
NOW = NOW/30; // Only Change every 30 secs
if (NOW == LastNow)
return;
LastNow = NOW;
sprintf(Key, "%s%x", KeyPhrase, NOW);
md5(Key, Hash);
for (i=0; i<16; i++)
{
chr = (Hash[i] & 31);
if (chr > 9) chr += 7;
Password[i] = chr + 48;
}
Password[16] = 0;
memcpy(&Val, Password, 8);
PassCode = Val %= 1000000;
printf("Passcode is %d\n", PassCode);
return;
}
int main(int argc, char * argv[])
{
if (argc < 2)
{
printf ("Need to supply KeyPhrase\n");
return 0;
}
CreateOneTimePassword(argv[1]);
return 0;
}

@ -1,71 +1,71 @@
//Microsoft Developer Studio generated resource script.
//
//#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "windows.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (U.K.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENG)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK
#pragma code_page(1252)
#endif //_WIN32
#define BPQICON 400
BPQICON ICON DISCARDABLE "..\BPQIcon.ICO"
//
// Version
//
#define TEXTVER "1. 0. 3. 4\0"
#define BINVER 1, 0, 3, 4
VS_VERSION_INFO VERSIONINFO
FILEVERSION BINVER
PRODUCTVERSION BINVER
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x40004L
FILETYPE 0x1L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "080904b0"
BEGIN
VALUE "Comments", "Program to control WINMOR TNC when running remotely\0"
VALUE "CompanyName", " \0"
VALUE "FileDescription", "WinmorControl\0"
VALUE "FileVersion", TEXTVER
VALUE "InternalName", "bpq32\0"
VALUE "LegalCopyright", "Copyright © 2021 G8BPQ\0"
VALUE "OriginalFilename", "\WinmorControl.exe\0"
VALUE "ProductName", "WinmorControl\0"
VALUE "ProductVersion", TEXTVER
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x809, 1200
END
END
#endif // not APSTUDIO_INVOKED
//Microsoft Developer Studio generated resource script.
//
//#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "windows.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (U.K.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENG)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK
#pragma code_page(1252)
#endif //_WIN32
#define BPQICON 400
BPQICON ICON DISCARDABLE "..\BPQIcon.ICO"
//
// Version
//
#define TEXTVER "1. 0. 3. 4\0"
#define BINVER 1, 0, 3, 4
VS_VERSION_INFO VERSIONINFO
FILEVERSION BINVER
PRODUCTVERSION BINVER
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x40004L
FILETYPE 0x1L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "080904b0"
BEGIN
VALUE "Comments", "Program to control WINMOR TNC when running remotely\0"
VALUE "CompanyName", " \0"
VALUE "FileDescription", "WinmorControl\0"
VALUE "FileVersion", TEXTVER
VALUE "InternalName", "bpq32\0"
VALUE "LegalCopyright", "Copyright © 2021 G8BPQ\0"
VALUE "OriginalFilename", "\WinmorControl.exe\0"
VALUE "ProductName", "WinmorControl\0"
VALUE "ProductVersion", TEXTVER
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x809, 1200
END
END
#endif // not APSTUDIO_INVOKED

@ -1,65 +1,65 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioUserFile
ProjectType="Visual C++"
Version="8.00"
ShowAllFiles="false"
>
<Configurations>
<Configuration
Name="Debug|Win32"
>
<DebugSettings
Command="$(TargetPath)"
WorkingDirectory=""
CommandArguments=""
Attach="false"
DebuggerType="3"
Remote="1"
RemoteMachine="SKIGACER"
RemoteCommand=""
HttpUrl=""
PDBPath=""
SQLDebugging=""
Environment=""
EnvironmentMerge="true"
DebuggerFlavor=""
MPIRunCommand=""
MPIRunArguments=""
MPIRunWorkingDirectory=""
ApplicationCommand=""
ApplicationArguments=""
ShimCommand=""
MPIAcceptMode=""
MPIAcceptFilter=""
/>
</Configuration>
<Configuration
Name="Release|Win32"
>
<DebugSettings
Command="$(TargetPath)"
WorkingDirectory=""
CommandArguments=""
Attach="false"
DebuggerType="3"
Remote="1"
RemoteMachine="SKIGACER"
RemoteCommand=""
HttpUrl=""
PDBPath=""
SQLDebugging=""
Environment=""
EnvironmentMerge="true"
DebuggerFlavor=""
MPIRunCommand=""
MPIRunArguments=""
MPIRunWorkingDirectory=""
ApplicationCommand=""
ApplicationArguments=""
ShimCommand=""
MPIAcceptMode=""
MPIAcceptFilter=""
/>
</Configuration>
</Configurations>
</VisualStudioUserFile>
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioUserFile
ProjectType="Visual C++"
Version="8.00"
ShowAllFiles="false"
>
<Configurations>
<Configuration
Name="Debug|Win32"
>
<DebugSettings
Command="$(TargetPath)"
WorkingDirectory=""
CommandArguments=""
Attach="false"
DebuggerType="3"
Remote="1"
RemoteMachine="SKIGACER"
RemoteCommand=""
HttpUrl=""
PDBPath=""
SQLDebugging=""
Environment=""
EnvironmentMerge="true"
DebuggerFlavor=""
MPIRunCommand=""
MPIRunArguments=""
MPIRunWorkingDirectory=""
ApplicationCommand=""
ApplicationArguments=""
ShimCommand=""
MPIAcceptMode=""
MPIAcceptFilter=""
/>
</Configuration>
<Configuration
Name="Release|Win32"
>
<DebugSettings
Command="$(TargetPath)"
WorkingDirectory=""
CommandArguments=""
Attach="false"
DebuggerType="3"
Remote="1"
RemoteMachine="SKIGACER"
RemoteCommand=""
HttpUrl=""
PDBPath=""
SQLDebugging=""
Environment=""
EnvironmentMerge="true"
DebuggerFlavor=""
MPIRunCommand=""
MPIRunArguments=""
MPIRunWorkingDirectory=""
ApplicationCommand=""
ApplicationArguments=""
ShimCommand=""
MPIAcceptMode=""
MPIAcceptFilter=""
/>
</Configuration>
</Configurations>
</VisualStudioUserFile>

@ -1,62 +1,62 @@
// CmdLineAuth.cpp : Defines the entry point for the console application.
//
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#define _CRT_SECURE_NO_DEPRECATE
#define _USE_32BIT_TIME_T
#include <stdio.h>
#include <time.h>
#include <stdio.h>
#include "md5.c"
VOID CreateOneTimePassword(char * KeyPhrase)
{
// Create a time dependent One Time Password from the KeyPhrase
time_t NOW = time(NULL);
unsigned char Hash[16];
char Password[20];
char Key[1000];
int i, chr;
long long Val;
int PassCode;
NOW = NOW/30; // Only Change every 30 secs
sprintf(Key, "%s%x", KeyPhrase, NOW);
md5(Key, Hash);
for (i=0; i<16; i++)
{
chr = (Hash[i] & 31);
if (chr > 9) chr += 7;
Password[i] = chr + 48;
}
Password[16] = 0;
memcpy(&Val, Password, 8);
PassCode = Val % 1000000;
printf("Passcode is %06d\n", PassCode);
return;
}
int main(int argc, char * argv[])
{
if (argc < 2)
{
printf ("Need to supply KeyPhrase\n");
return 0;
}
CreateOneTimePassword(argv[1]);
return 0;
}
// CmdLineAuth.cpp : Defines the entry point for the console application.
//
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#define _CRT_SECURE_NO_DEPRECATE
#define _USE_32BIT_TIME_T
#include <stdio.h>
#include <time.h>
#include <stdio.h>
#include "md5.c"
VOID CreateOneTimePassword(char * KeyPhrase)
{
// Create a time dependent One Time Password from the KeyPhrase
time_t NOW = time(NULL);
unsigned char Hash[16];
char Password[20];
char Key[1000];
int i, chr;
long long Val;
int PassCode;
NOW = NOW/30; // Only Change every 30 secs
sprintf(Key, "%s%x", KeyPhrase, NOW);
md5(Key, Hash);
for (i=0; i<16; i++)
{
chr = (Hash[i] & 31);
if (chr > 9) chr += 7;
Password[i] = chr + 48;
}
Password[16] = 0;
memcpy(&Val, Password, 8);
PassCode = Val % 1000000;
printf("Passcode is %06d\n", PassCode);
return;
}
int main(int argc, char * argv[])
{
if (argc < 2)
{
printf ("Need to supply KeyPhrase\n");
return 0;
}
CreateOneTimePassword(argv[1]);
return 0;
}

@ -1,41 +1,41 @@
/*
Copyright 2001-2015 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 "cheaders.h"
#include "tncinfo.h"
//int SENDNODES() {return 0;}
//int BYECMD() {return 0;}
//int CMDR00() {return 0;}
//int DoNetromConnect() {return 0;}
//int CMDC00() {return 0;}
//int CheckReceivedData() {return 0;}
//int GetLastError() {return 0;}
/*
Copyright 2001-2015 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 "cheaders.h"
#include "tncinfo.h"
//int SENDNODES() {return 0;}
//int BYECMD() {return 0;}
//int CMDR00() {return 0;}
//int DoNetromConnect() {return 0;}
//int CMDC00() {return 0;}
//int CheckReceivedData() {return 0;}
//int GetLastError() {return 0;}

@ -1,434 +1,434 @@
#define _CRT_SECURE_NO_DEPRECATE
#ifndef NOMQTT
#include "MQTTAsync.h"
#ifndef WIN32
#include <jansson.h>
#endif
#include "cheaders.h"
#include "asmstrucs.h"
#include "mqtt.h"
extern int MQTT_Connecting;
extern int MQTT_Connected;
DllExport int APIENTRY MQTTSend(char * topic, char * Msg, int MsgLen);
MQTTAsync client = NULL;
time_t MQTTLastStatus = 0;
void MQTTSendStatus()
{
char topic[256];
char payload[128];
sprintf(topic, "PACKETNODE/%s", NODECALLLOPPED);
strcpy(payload,"{\"status\":\"online\"}");
MQTTSend(topic, payload, strlen(payload));
MQTTLastStatus = time(NULL);
}
void MQTTTimer()
{
if (MQTT_Connecting == 0 && MQTT_Connected == 0)
MQTTConnect(MQTT_HOST, MQTT_PORT, MQTT_USER, MQTT_PASS);
if ((time(NULL) - MQTTLastStatus) > 1800)
MQTTSendStatus();
}
void MQTTDisconnect()
{
if (MQTT_Connected)
{
MQTTAsync_disconnectOptions disc_opts = MQTTAsync_disconnectOptions_initializer;
MQTTAsync_disconnect(client, &disc_opts);
MQTT_Connecting = MQTT_Connected = 0;
// Try to recconect. If it fails system will rety every minute
MQTTConnect(MQTT_HOST, MQTT_PORT, MQTT_USER, MQTT_PASS);
}
}
DllExport int APIENTRY MQTTSend(char * topic, char * Msg, int MsgLen)
{
int rc;
MQTTAsync_responseOptions opts = MQTTAsync_responseOptions_initializer;
MQTTAsync_message pubmsg = MQTTAsync_message_initializer;
pubmsg.payload = Msg;
pubmsg.payloadlen = MsgLen;
rc = MQTTAsync_sendMessage(client, topic, &pubmsg, &opts);
if (rc)
MQTTDisconnect();
return rc;
}
void onConnect(void* context, MQTTAsync_successData* response)
{
MQTTAsync_responseOptions opts = MQTTAsync_responseOptions_initializer;
MQTTAsync_message pubmsg = MQTTAsync_message_initializer;
MQTT_Connecting = 0;
MQTT_Connected = 1;
printf("Successful MQTT connection\n");
// Send start up message
MQTTSendStatus();
}
void onConnectFailure(void* context, MQTTAsync_failureData* response)
{
printf("MQTT connection failed, rc %d\n", response ? response->code : 0);
MQTT_Connecting = 0;
}
char* jsonEncodeMessage(MESSAGE *msg)
{
char From[10];
char To[10];
char buffer[1024];
unsigned long long SaveMMASK = MMASK;
BOOL SaveMTX = MTX;
BOOL SaveMCOM = MCOM;
BOOL SaveMUI = MUIONLY;
int len;
char *msg_str;
char payload_timestamp[16];
struct tm * TM = localtime(&msg->Timestamp);
sprintf(payload_timestamp, "%02d:%02d:%02d", TM->tm_hour, TM->tm_min, TM->tm_sec);
IntSetTraceOptionsEx(MMASK, TRUE, TRUE, FALSE);
From[ConvFromAX25(msg->ORIGIN, From)] = 0;
To[ConvFromAX25(msg->DEST, To)] = 0;
len = IntDecodeFrame(msg, buffer, msg->Timestamp, 0xffffffffffffffff, FALSE, FALSE);
IntSetTraceOptionsEx(SaveMMASK, SaveMTX, SaveMCOM, SaveMUI);
buffer[len] = 0;
#ifdef WIN32
msg_str = zalloc(2048);
sprintf(msg_str, "{\"from\": \"%s\", \"to\": \"%s\", \"payload\": \"%s\", \"port\": %d, \"timestamp\": \"%s\"}",
From, To, buffer, msg->PORT, payload_timestamp);
#else
json_t *root;
root = json_object();
json_object_set_new(root, "from", json_string(From));
json_object_set_new(root, "to", json_string(To));
json_object_set_new(root, "payload", json_string(buffer));
json_object_set_new(root, "port", json_integer(msg->PORT));
sprintf(payload_timestamp, "%02d:%02d:%02d", TM->tm_hour, TM->tm_min, TM->tm_sec);
json_object_set_new(root, "timestamp", json_string(payload_timestamp));
msg_str = json_dumps(root, 0);
json_decref(root);
#endif
return msg_str;
}
void MQTTKISSTX(void *message)
{
MESSAGE *msg = (MESSAGE *)message;
char topic[256];
char *msg_str;
sprintf(topic, "PACKETNODE/ax25/trace/bpqformat/%s/sent/%d", NODECALLLOPPED, msg->PORT);
msg_str = jsonEncodeMessage(msg);
MQTTSend(topic, msg_str, strlen(msg_str));
free(msg_str);
}
void MQTTKISSTX_RAW(char* buffer, int bufferLength, void* PORT)
{
PPORTCONTROL PPORT = (PPORTCONTROL)PORT;
char topic[256];
sprintf(topic, "PACKETNODE/kiss/%s/sent/%d", NODECALLLOPPED, PPORT->PORTNUMBER);
MQTTSend(topic, buffer, bufferLength);
}
void MQTTKISSRX(void *message)
{
MESSAGE *msg = (MESSAGE *)message;
char topic[256];
char *msg_str;
sprintf(topic, "PACKETNODE/ax25/trace/bpqformat/%s/rcvd/%d", NODECALLLOPPED, msg->PORT);
msg_str = jsonEncodeMessage(msg);
MQTTSend(topic, msg_str, strlen(msg_str));
free(msg_str);
}
void MQTTKISSRX_RAW(char* buffer, int bufferLength, void* PORT)
{
PPORTCONTROL PPORT = (PPORTCONTROL)PORT;
char topic[256];
sprintf(topic, "PACKETNODE/kiss/%s/rcvd/%d", NODECALLLOPPED, PPORT->PORTNUMBER);
MQTTSend(topic, buffer, bufferLength);
}
void MQTTReportSession(char * Msg)
{
char topic[256];
sprintf(topic, "PACKETNODE/stats/session/%s", NODECALLLOPPED);
MQTTSend(topic, Msg, strlen(Msg));
}
char* replace(char* str, char* a, char* b)
{
int len = strlen(str);
int lena = strlen(a), lenb = strlen(b);
char * p;
for (p = str; p = strstr(p, a); p) {
if (lena != lenb) // shift end as needed
memmove(p + lenb, p + lena,
len - (p - str) + lenb);
memcpy(p, b, lenb);
}
return str;
}
int MQTTPublish(void *message, char *topic)
{
MESSAGE *msg = (MESSAGE *)message;
char From[10];
char To[10];
MQTTAsync_responseOptions opts = MQTTAsync_responseOptions_initializer;
MQTTAsync_message pubmsg = MQTTAsync_message_initializer;
unsigned long long SaveMMASK = MMASK;
BOOL SaveMTX = MTX;
BOOL SaveMCOM = MCOM;
BOOL SaveMUI = MUIONLY;
int len;
char* replaced_buffer;
char buffer[1024];
time_t timestamp = msg->Timestamp;
From[ConvFromAX25(msg->ORIGIN, From)] = 0;
To[ConvFromAX25(msg->DEST, To)] = 0;
IntSetTraceOptionsEx(8, TRUE, TRUE, FALSE);
len = IntDecodeFrame(msg, buffer, timestamp, 1, FALSE, FALSE);
IntSetTraceOptionsEx(SaveMMASK, SaveMTX, SaveMCOM, SaveMUI);
// MQTT _really_ doesn't like \r, so replace it with something
// that is at least human readable
replaced_buffer = replace(buffer, "\r", "\r\n");
pubmsg.payload = replaced_buffer;
pubmsg.payloadlen = strlen(replaced_buffer);
printf("%s\n", replaced_buffer);
return MQTTAsync_sendMessage(client, topic, &pubmsg, &opts);
}
int MQTTConnect(char* host, int port, char* user, char* pass)
{
MQTTAsync_connectOptions conn_opts = MQTTAsync_connectOptions_initializer;
int rc;
char hostString[256];
sprintf(hostString, "tcp://%s:%d", host, port);
printf("MQTT Connect to %s\n", hostString);
rc = MQTTAsync_create(&client, hostString, NODECALLLOPPED, MQTTCLIENT_PERSISTENCE_NONE, NULL);
if (rc != MQTTASYNC_SUCCESS)
{
printf("Failed to create client, return code %d\n", rc);
return rc;
}
conn_opts.keepAliveInterval = 20;
conn_opts.cleansession = 1;
conn_opts.username = user;
conn_opts.password = pass;
conn_opts.onSuccess = onConnect;
conn_opts.onFailure = onConnectFailure;
// conn_opts.automaticReconnect = 1;
// conn_opts.minRetryInterval = 30;
// conn_opts.maxRetryInterval = 300;
rc = MQTTAsync_connect(client, &conn_opts);
if (rc != MQTTASYNC_SUCCESS)
{
printf("Failed to start connect, return code %d\n", rc);
return rc;
}
MQTT_Connecting = 1;
return 0;
}
// Message Database Entry. Designed to be compatible with FBB
#define NBBBS 160 // Max BBSes we can forward to. Must be Multiple of 8, and must be 80 for FBB compatibliliy
#define NBMASK NBBBS/8 // Number of bytes in Forward bitlists.
#pragma pack(1)
struct MsgInfo
{
char type;
char status;
int number;
int length;
int xdatereceived;
char bbsfrom[7]; // ? BBS we got it from ?
char via[41];
char from[7];
char to[7];
char bid[13];
char title[61];
int nntpnum; // Number within topic (ie Bull TO Addr) - used for nntp
UCHAR B2Flags; // Not all flags specific to B2
#define B2Msg 1 // Set if Message File is a formatted B2 message
#define Attachments 2 // Set if B2 message has attachments
#define FromPaclink 4
#define FromCMS 8
#define FromRMSExpress 16
#define RadioOnlyMsg 32 // Received using call-T
#define RadioOnlyFwd 64 // Received using call-R
#define WarnNotForwardedSent 128
int xdatecreated;
int xdatechanged;
UCHAR fbbs[NBMASK];
UCHAR forw[NBMASK];
char emailfrom[41];
char Locked; // Set if selected for sending (NTS Pickup)
char Defered; // FBB response '=' received
UCHAR UTF8; // Set if Message is in UTF8 (ie from POP/SMTP)
// For 64 bit time_t compatibility define as long long
// (so struct is same with 32 or 64 bit time_t)
int64_t datereceived;
int64_t datecreated;
int64_t datechanged;
char Spare[61 - 24]; // For future use
} ;
#pragma pack()
void MQTTMessageEvent(void* message)
{
struct MsgInfo* msg = (struct MsgInfo *)message;
char *msg_str;
char * ptr;
MQTTAsync_responseOptions opts = MQTTAsync_responseOptions_initializer;
MQTTAsync_message pubmsg = MQTTAsync_message_initializer;
char topic[256];
json_t *root = json_object();
json_object_set_new(root, "id", json_integer(msg->number));
json_object_set_new(root, "size", json_integer(msg->length));
json_object_set_new(root, "type", json_string(msg->type == 'P' ? "P" : "B"));
json_object_set_new(root, "to", json_string(msg->to));
json_object_set_new(root, "from", json_string(msg->from));
json_object_set_new(root, "subj", json_string(msg->title));
switch(msg->status) {
case 'N':
json_object_set_new(root, "event", json_string("newmsg"));
break;
case 'F':
json_object_set_new(root, "event", json_string("fwded"));
break;
case 'R':
json_object_set_new(root, "event", json_string("read"));
break;
case 'K':
json_object_set_new(root, "event", json_string("killed"));
break;
}
msg_str = json_dumps(root, 0);
pubmsg.payload = msg_str;
pubmsg.payloadlen = strlen(msg_str);
sprintf(topic, "PACKETNODE/event/%s/pmsg", NODECALLLOPPED);
MQTTAsync_sendMessage(client, topic, &pubmsg, &opts);
}
#else
// Dummies ofr build without MQTT libraries
int MQTTConnect(char* host, int port, char* user, char* pass)
{
return 0;
}
void MQTTKISSTX(void *message) {};
void MQTTKISSTX_RAW(char* buffer, int bufferLength, void* PORT) {};
void MQTTKISSRX(void *message) {};
void MQTTKISSRX_RAW(char* buffer, int bufferLength, void* PORT) {};
void MQTTTimer() {};
void MQTTReportSession(char * Msg) {};
#endif
#define _CRT_SECURE_NO_DEPRECATE
#ifndef NOMQTT
#include "MQTTAsync.h"
#ifndef WIN32
#include <jansson.h>
#endif
#include "cheaders.h"
#include "asmstrucs.h"
#include "mqtt.h"
extern int MQTT_Connecting;
extern int MQTT_Connected;
DllExport int APIENTRY MQTTSend(char * topic, char * Msg, int MsgLen);
MQTTAsync client = NULL;
time_t MQTTLastStatus = 0;
void MQTTSendStatus()
{
char topic[256];
char payload[128];
sprintf(topic, "PACKETNODE/%s", NODECALLLOPPED);
strcpy(payload,"{\"status\":\"online\"}");
MQTTSend(topic, payload, strlen(payload));
MQTTLastStatus = time(NULL);
}
void MQTTTimer()
{
if (MQTT_Connecting == 0 && MQTT_Connected == 0)
MQTTConnect(MQTT_HOST, MQTT_PORT, MQTT_USER, MQTT_PASS);
if ((time(NULL) - MQTTLastStatus) > 1800)
MQTTSendStatus();
}
void MQTTDisconnect()
{
if (MQTT_Connected)
{
MQTTAsync_disconnectOptions disc_opts = MQTTAsync_disconnectOptions_initializer;
MQTTAsync_disconnect(client, &disc_opts);
MQTT_Connecting = MQTT_Connected = 0;
// Try to recconect. If it fails system will rety every minute
MQTTConnect(MQTT_HOST, MQTT_PORT, MQTT_USER, MQTT_PASS);
}
}
DllExport int APIENTRY MQTTSend(char * topic, char * Msg, int MsgLen)
{
int rc;
MQTTAsync_responseOptions opts = MQTTAsync_responseOptions_initializer;
MQTTAsync_message pubmsg = MQTTAsync_message_initializer;
pubmsg.payload = Msg;
pubmsg.payloadlen = MsgLen;
rc = MQTTAsync_sendMessage(client, topic, &pubmsg, &opts);
if (rc)
MQTTDisconnect();
return rc;
}
void onConnect(void* context, MQTTAsync_successData* response)
{
MQTTAsync_responseOptions opts = MQTTAsync_responseOptions_initializer;
MQTTAsync_message pubmsg = MQTTAsync_message_initializer;
MQTT_Connecting = 0;
MQTT_Connected = 1;
printf("Successful MQTT connection\n");
// Send start up message
MQTTSendStatus();
}
void onConnectFailure(void* context, MQTTAsync_failureData* response)
{
printf("MQTT connection failed, rc %d\n", response ? response->code : 0);
MQTT_Connecting = 0;
}
char* jsonEncodeMessage(MESSAGE *msg)
{
char From[10];
char To[10];
char buffer[1024];
unsigned long long SaveMMASK = MMASK;
BOOL SaveMTX = MTX;
BOOL SaveMCOM = MCOM;
BOOL SaveMUI = MUIONLY;
int len;
char *msg_str;
char payload_timestamp[16];
struct tm * TM = localtime(&msg->Timestamp);
sprintf(payload_timestamp, "%02d:%02d:%02d", TM->tm_hour, TM->tm_min, TM->tm_sec);
IntSetTraceOptionsEx(MMASK, TRUE, TRUE, FALSE);
From[ConvFromAX25(msg->ORIGIN, From)] = 0;
To[ConvFromAX25(msg->DEST, To)] = 0;
len = IntDecodeFrame(msg, buffer, msg->Timestamp, 0xffffffffffffffff, FALSE, FALSE);
IntSetTraceOptionsEx(SaveMMASK, SaveMTX, SaveMCOM, SaveMUI);
buffer[len] = 0;
#ifdef WIN32
msg_str = zalloc(2048);
sprintf(msg_str, "{\"from\": \"%s\", \"to\": \"%s\", \"payload\": \"%s\", \"port\": %d, \"timestamp\": \"%s\"}",
From, To, buffer, msg->PORT, payload_timestamp);
#else
json_t *root;
root = json_object();
json_object_set_new(root, "from", json_string(From));
json_object_set_new(root, "to", json_string(To));
json_object_set_new(root, "payload", json_string(buffer));
json_object_set_new(root, "port", json_integer(msg->PORT));
sprintf(payload_timestamp, "%02d:%02d:%02d", TM->tm_hour, TM->tm_min, TM->tm_sec);
json_object_set_new(root, "timestamp", json_string(payload_timestamp));
msg_str = json_dumps(root, 0);
json_decref(root);
#endif
return msg_str;
}
void MQTTKISSTX(void *message)
{
MESSAGE *msg = (MESSAGE *)message;
char topic[256];
char *msg_str;
sprintf(topic, "PACKETNODE/ax25/trace/bpqformat/%s/sent/%d", NODECALLLOPPED, msg->PORT);
msg_str = jsonEncodeMessage(msg);
MQTTSend(topic, msg_str, strlen(msg_str));
free(msg_str);
}
void MQTTKISSTX_RAW(char* buffer, int bufferLength, void* PORT)
{
PPORTCONTROL PPORT = (PPORTCONTROL)PORT;
char topic[256];
sprintf(topic, "PACKETNODE/kiss/%s/sent/%d", NODECALLLOPPED, PPORT->PORTNUMBER);
MQTTSend(topic, buffer, bufferLength);
}
void MQTTKISSRX(void *message)
{
MESSAGE *msg = (MESSAGE *)message;
char topic[256];
char *msg_str;
sprintf(topic, "PACKETNODE/ax25/trace/bpqformat/%s/rcvd/%d", NODECALLLOPPED, msg->PORT);
msg_str = jsonEncodeMessage(msg);
MQTTSend(topic, msg_str, strlen(msg_str));
free(msg_str);
}
void MQTTKISSRX_RAW(char* buffer, int bufferLength, void* PORT)
{
PPORTCONTROL PPORT = (PPORTCONTROL)PORT;
char topic[256];
sprintf(topic, "PACKETNODE/kiss/%s/rcvd/%d", NODECALLLOPPED, PPORT->PORTNUMBER);
MQTTSend(topic, buffer, bufferLength);
}
void MQTTReportSession(char * Msg)
{
char topic[256];
sprintf(topic, "PACKETNODE/stats/session/%s", NODECALLLOPPED);
MQTTSend(topic, Msg, strlen(Msg));
}
char* replace(char* str, char* a, char* b)
{
int len = strlen(str);
int lena = strlen(a), lenb = strlen(b);
char * p;
for (p = str; p = strstr(p, a); p) {
if (lena != lenb) // shift end as needed
memmove(p + lenb, p + lena,
len - (p - str) + lenb);
memcpy(p, b, lenb);
}
return str;
}
int MQTTPublish(void *message, char *topic)
{
MESSAGE *msg = (MESSAGE *)message;
char From[10];
char To[10];
MQTTAsync_responseOptions opts = MQTTAsync_responseOptions_initializer;
MQTTAsync_message pubmsg = MQTTAsync_message_initializer;
unsigned long long SaveMMASK = MMASK;
BOOL SaveMTX = MTX;
BOOL SaveMCOM = MCOM;
BOOL SaveMUI = MUIONLY;
int len;
char* replaced_buffer;
char buffer[1024];
time_t timestamp = msg->Timestamp;
From[ConvFromAX25(msg->ORIGIN, From)] = 0;
To[ConvFromAX25(msg->DEST, To)] = 0;
IntSetTraceOptionsEx(8, TRUE, TRUE, FALSE);
len = IntDecodeFrame(msg, buffer, timestamp, 1, FALSE, FALSE);
IntSetTraceOptionsEx(SaveMMASK, SaveMTX, SaveMCOM, SaveMUI);
// MQTT _really_ doesn't like \r, so replace it with something
// that is at least human readable
replaced_buffer = replace(buffer, "\r", "\r\n");
pubmsg.payload = replaced_buffer;
pubmsg.payloadlen = strlen(replaced_buffer);
printf("%s\n", replaced_buffer);
return MQTTAsync_sendMessage(client, topic, &pubmsg, &opts);
}
int MQTTConnect(char* host, int port, char* user, char* pass)
{
MQTTAsync_connectOptions conn_opts = MQTTAsync_connectOptions_initializer;
int rc;
char hostString[256];
sprintf(hostString, "tcp://%s:%d", host, port);
printf("MQTT Connect to %s\n", hostString);
rc = MQTTAsync_create(&client, hostString, NODECALLLOPPED, MQTTCLIENT_PERSISTENCE_NONE, NULL);
if (rc != MQTTASYNC_SUCCESS)
{
printf("Failed to create client, return code %d\n", rc);
return rc;
}
conn_opts.keepAliveInterval = 20;
conn_opts.cleansession = 1;
conn_opts.username = user;
conn_opts.password = pass;
conn_opts.onSuccess = onConnect;
conn_opts.onFailure = onConnectFailure;
// conn_opts.automaticReconnect = 1;
// conn_opts.minRetryInterval = 30;
// conn_opts.maxRetryInterval = 300;
rc = MQTTAsync_connect(client, &conn_opts);
if (rc != MQTTASYNC_SUCCESS)
{
printf("Failed to start connect, return code %d\n", rc);
return rc;
}
MQTT_Connecting = 1;
return 0;
}
// Message Database Entry. Designed to be compatible with FBB
#define NBBBS 160 // Max BBSes we can forward to. Must be Multiple of 8, and must be 80 for FBB compatibliliy
#define NBMASK NBBBS/8 // Number of bytes in Forward bitlists.
#pragma pack(1)
struct MsgInfo
{
char type;
char status;
int number;
int length;
int xdatereceived;
char bbsfrom[7]; // ? BBS we got it from ?
char via[41];
char from[7];
char to[7];
char bid[13];
char title[61];
int nntpnum; // Number within topic (ie Bull TO Addr) - used for nntp
UCHAR B2Flags; // Not all flags specific to B2
#define B2Msg 1 // Set if Message File is a formatted B2 message
#define Attachments 2 // Set if B2 message has attachments
#define FromPaclink 4
#define FromCMS 8
#define FromRMSExpress 16
#define RadioOnlyMsg 32 // Received using call-T
#define RadioOnlyFwd 64 // Received using call-R
#define WarnNotForwardedSent 128
int xdatecreated;
int xdatechanged;
UCHAR fbbs[NBMASK];
UCHAR forw[NBMASK];
char emailfrom[41];
char Locked; // Set if selected for sending (NTS Pickup)
char Defered; // FBB response '=' received
UCHAR UTF8; // Set if Message is in UTF8 (ie from POP/SMTP)
// For 64 bit time_t compatibility define as long long
// (so struct is same with 32 or 64 bit time_t)
int64_t datereceived;
int64_t datecreated;
int64_t datechanged;
char Spare[61 - 24]; // For future use
} ;
#pragma pack()
void MQTTMessageEvent(void* message)
{
struct MsgInfo* msg = (struct MsgInfo *)message;
char *msg_str;
char * ptr;
MQTTAsync_responseOptions opts = MQTTAsync_responseOptions_initializer;
MQTTAsync_message pubmsg = MQTTAsync_message_initializer;
char topic[256];
json_t *root = json_object();
json_object_set_new(root, "id", json_integer(msg->number));
json_object_set_new(root, "size", json_integer(msg->length));
json_object_set_new(root, "type", json_string(msg->type == 'P' ? "P" : "B"));
json_object_set_new(root, "to", json_string(msg->to));
json_object_set_new(root, "from", json_string(msg->from));
json_object_set_new(root, "subj", json_string(msg->title));
switch(msg->status) {
case 'N':
json_object_set_new(root, "event", json_string("newmsg"));
break;
case 'F':
json_object_set_new(root, "event", json_string("fwded"));
break;
case 'R':
json_object_set_new(root, "event", json_string("read"));
break;
case 'K':
json_object_set_new(root, "event", json_string("killed"));
break;
}
msg_str = json_dumps(root, 0);
pubmsg.payload = msg_str;
pubmsg.payloadlen = strlen(msg_str);
sprintf(topic, "PACKETNODE/event/%s/pmsg", NODECALLLOPPED);
MQTTAsync_sendMessage(client, topic, &pubmsg, &opts);
}
#else
// Dummies ofr build without MQTT libraries
int MQTTConnect(char* host, int port, char* user, char* pass)
{
return 0;
}
void MQTTKISSTX(void *message) {};
void MQTTKISSTX_RAW(char* buffer, int bufferLength, void* PORT) {};
void MQTTKISSRX(void *message) {};
void MQTTKISSRX_RAW(char* buffer, int bufferLength, void* PORT) {};
void MQTTTimer() {};
void MQTTReportSession(char * Msg) {};
#endif

@ -1,229 +1,229 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8.00"
Name="WinmorControl"
ProjectGUID="{005A91EA-3A00-4FB4-ADD9-EB78DBFA2B82}"
RootNamespace="WinmorControl"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="C:\Dev\Msdev2005\$(SolutionName)\$(ProjectName)\$(ConfigurationName)"
IntermediateDirectory="C:\Dev\Msdev2005\Intermed\$(SolutionName)\$(ProjectName)\$(ConfigurationName)"
ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="_DEBUG"
MkTypLibCompatible="true"
SuppressStartupBanner="true"
TargetEnvironment="1"
TypeLibraryName=".\Debug/WinmorControl.tlb"
HeaderFileName=""
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS"
MinimalRebuild="true"
RuntimeLibrary="1"
PrecompiledHeaderFile=".\Debug/WinmorControl.pch"
AssemblerListingLocation="$(IntDir)\"
ObjectFile="$(IntDir)\"
ProgramDataBaseFileName="$(IntDir)\"
WarningLevel="3"
SuppressStartupBanner="true"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG"
Culture="2057"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="WS2_32.Lib Psapi.lib"
OutputFile="c:\DevProgs\bpq32\WinmorControl.exe"
LinkIncremental="2"
SuppressStartupBanner="true"
GenerateDebugInformation="true"
ProgramDatabaseFile=".\Debug/bpq32.pdb"
GenerateMapFile="true"
MapFileName="c:\devprogs\bpq32\bpqpp.map"
SubSystem="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
SuppressStartupBanner="true"
OutputFile=".\Debug/WinmorControl.bsc"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="C:\Dev\Msdev2005\$(SolutionName)\$(ProjectName)\$(ConfigurationName)"
IntermediateDirectory="C:\Dev\Msdev2005\Intermed\$(SolutionName)\$(ProjectName)\$(ConfigurationName)"
ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="NDEBUG"
MkTypLibCompatible="true"
SuppressStartupBanner="true"
TargetEnvironment="1"
TypeLibraryName=".\Release/WinmorControl.tlb"
HeaderFileName=""
/>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
InlineFunctionExpansion="1"
AdditionalIncludeDirectories="..\cinclude"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
StringPooling="true"
RuntimeLibrary="0"
EnableFunctionLevelLinking="true"
PrecompiledHeaderFile="C:\msdev2005\Intermed\Release/WinmorControl.pch"
AssemblerListingLocation="$(IntDir)\"
ObjectFile="$(IntDir)\"
ProgramDataBaseFileName="$(IntDir)\"
WarningLevel="3"
SuppressStartupBanner="true"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="2057"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="WS2_32.Lib Psapi.lib"
OutputFile="c:\DevProgs\bpq32\WinmorControl.exe"
LinkIncremental="1"
SuppressStartupBanner="true"
ProgramDatabaseFile=".\Release/WinmorControl.pdb"
GenerateMapFile="true"
MapFileName="c:\devprogs\bpq32\WinmorControl.map"
SubSystem="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
SuppressStartupBanner="true"
OutputFile=".\Release/WinmorControl.bsc"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cxx;rc;def;r;odl;hpj;bat;for;f90"
>
<File
RelativePath=".\WinmorControl.c"
>
</File>
<File
RelativePath=".\WinmorControl.rc"
>
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8.00"
Name="WinmorControl"
ProjectGUID="{005A91EA-3A00-4FB4-ADD9-EB78DBFA2B82}"
RootNamespace="WinmorControl"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="C:\Dev\Msdev2005\$(SolutionName)\$(ProjectName)\$(ConfigurationName)"
IntermediateDirectory="C:\Dev\Msdev2005\Intermed\$(SolutionName)\$(ProjectName)\$(ConfigurationName)"
ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="_DEBUG"
MkTypLibCompatible="true"
SuppressStartupBanner="true"
TargetEnvironment="1"
TypeLibraryName=".\Debug/WinmorControl.tlb"
HeaderFileName=""
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS"
MinimalRebuild="true"
RuntimeLibrary="1"
PrecompiledHeaderFile=".\Debug/WinmorControl.pch"
AssemblerListingLocation="$(IntDir)\"
ObjectFile="$(IntDir)\"
ProgramDataBaseFileName="$(IntDir)\"
WarningLevel="3"
SuppressStartupBanner="true"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG"
Culture="2057"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="WS2_32.Lib Psapi.lib"
OutputFile="c:\DevProgs\bpq32\WinmorControl.exe"
LinkIncremental="2"
SuppressStartupBanner="true"
GenerateDebugInformation="true"
ProgramDatabaseFile=".\Debug/bpq32.pdb"
GenerateMapFile="true"
MapFileName="c:\devprogs\bpq32\bpqpp.map"
SubSystem="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
SuppressStartupBanner="true"
OutputFile=".\Debug/WinmorControl.bsc"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="C:\Dev\Msdev2005\$(SolutionName)\$(ProjectName)\$(ConfigurationName)"
IntermediateDirectory="C:\Dev\Msdev2005\Intermed\$(SolutionName)\$(ProjectName)\$(ConfigurationName)"
ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="NDEBUG"
MkTypLibCompatible="true"
SuppressStartupBanner="true"
TargetEnvironment="1"
TypeLibraryName=".\Release/WinmorControl.tlb"
HeaderFileName=""
/>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
InlineFunctionExpansion="1"
AdditionalIncludeDirectories="..\cinclude"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
StringPooling="true"
RuntimeLibrary="0"
EnableFunctionLevelLinking="true"
PrecompiledHeaderFile="C:\msdev2005\Intermed\Release/WinmorControl.pch"
AssemblerListingLocation="$(IntDir)\"
ObjectFile="$(IntDir)\"
ProgramDataBaseFileName="$(IntDir)\"
WarningLevel="3"
SuppressStartupBanner="true"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="2057"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="WS2_32.Lib Psapi.lib"
OutputFile="c:\DevProgs\bpq32\WinmorControl.exe"
LinkIncremental="1"
SuppressStartupBanner="true"
ProgramDatabaseFile=".\Release/WinmorControl.pdb"
GenerateMapFile="true"
MapFileName="c:\devprogs\bpq32\WinmorControl.map"
SubSystem="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
SuppressStartupBanner="true"
OutputFile=".\Release/WinmorControl.bsc"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cxx;rc;def;r;odl;hpj;bat;for;f90"
>
<File
RelativePath=".\WinmorControl.c"
>
</File>
<File
RelativePath=".\WinmorControl.rc"
>
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

@ -1,193 +1,193 @@
/*
Copyright 2001-2022 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
*/
//
// Netrom Record ROute Suport Code for BPQ32 Switch
//
// All code runs from the BPQ32 Received or Timer Routines under Semaphore.
// As most data areas are dynamically allocated, they will not survive a Timer Process Swap.
// Shared data can be used for Config Info.
#define _CRT_SECURE_NO_DEPRECATE
#pragma data_seg("_BPQDATA")
#include "time.h"
#include "stdio.h"
#include <fcntl.h>
//#include "vmm.h"
#include "cheaders.h"
extern int SENDNETFRAME();
extern VOID Q_ADD();
VOID __cdecl Debugprintf(const char * format, ...);
TRANSPORTENTRY * NRRSession;
/*
datagrams (and other things) to be transported in Netrom L3 frames.
When the frametype is 0x00, the "circuit index" and "circuit id" (first 2
bytes of the transport header) take on a different meaning, something like
"protocol family" and "protocol id". IP over netrom uses 0x0C for both
bytes, TheNet uses 0x00 for both bytes when making L3RTT measurements, and
Xnet uses family 0x00, protocol id 0x01 for Netrom Record Route. I believe
there are authors using other values too. Unfortunately there is no
co-ordinating authority for these numbers, so authors just pick an unused
one.
*/
VOID NRRecordRoute(UCHAR * Buff, int Len)
{
// NRR frame for us. If We originated it, report outcome, else put our call on end, and send back
L3MESSAGEBUFFER * Msg = (L3MESSAGEBUFFER *)Buff;
struct DEST_LIST * DEST;
char Temp[7];
int NRRLen = Len - (21 + MSGHDDRLEN);
UCHAR Flags;
char call[10];
int calllen;
char * Save = Buff;
if (memcmp(&Msg->L4DATA, MYCALL, 7) == 0)
{
UCHAR * BUFFER = GetBuff();
UCHAR * ptr1;
struct _MESSAGE * Msg;
if (BUFFER == NULL)
return;
ptr1 = &BUFFER[MSGHDDRLEN];
*ptr1++ = 0xf0; // PID
ptr1 += sprintf(ptr1, "NRR Response:");
Buff += 21 + MSGHDDRLEN;
Len -= (21 + MSGHDDRLEN);
while (Len > 0)
{
calllen = ConvFromAX25(Buff, call);
call[calllen] = 0;
ptr1 += sprintf(ptr1, " %s", call);
if ((Buff[7] & 0x80) == 0x80) // Check turnround bit
*ptr1++ = '*';
Buff+=8;
Len -= 8;
}
// Add ours on end for neatness
calllen = ConvFromAX25(MYCALL, call);
call[calllen] = 0;
ptr1 += sprintf(ptr1, " %s", call);
*ptr1++ = 0x0d; // CR
Len = (int)(ptr1 - BUFFER);
Msg = (struct _MESSAGE *)BUFFER;
Msg->LENGTH = Len;
Msg->CHAIN = NULL;
C_Q_ADD(&NRRSession->L4TX_Q, (UINT *)BUFFER);
PostDataAvailable(NRRSession);
ReleaseBuffer(Save);
return;
}
// Add our call on end, and increase count
Flags = Buff[Len - 1];
Flags--;
if (Flags && NRRLen < 228) // Dont update if full
{
Flags |= 0x80; // Set End of route bit
Msg->L3PID = NRPID;
memcpy(&Msg->L4DATA[NRRLen], MYCALL, 7);
Msg->L4DATA[NRRLen+7] = Flags;
NRRLen += 8;
}
// We should send it back via our bast route, or recorded route could be wrong
memcpy(Temp, Msg->L3DEST, 7);
memcpy(Msg->L3DEST, Msg->L3SRCE, 7);
memcpy(Msg->L3SRCE, Temp, 7);
if (FindDestination(Msg->L3DEST, &DEST) == 0)
{
ReleaseBuffer(Msg); // CANT FIND DESTINATION
return;
}
Msg->LENGTH = NRRLen + 21 + MSGHDDRLEN;
Debugprintf("NRR TX Len %d Flags %d NRRLen %d", Msg->LENGTH, Flags, NRRLen);
C_Q_ADD(&DEST->DEST_Q, Msg);
}
VOID SendNRRecordRoute(struct DEST_LIST * DEST, TRANSPORTENTRY * Session)
{
L3MESSAGEBUFFER * Msg = GetBuff();
int Stream = 1;
if (Msg == NULL)
return;
NRRSession = Session; // Save Session Pointer for reply
Msg->Port = 0;
Msg->L3PID = NRPID;
memcpy(Msg->L3DEST, DEST->DEST_CALL, 7);
memcpy(Msg->L3SRCE, MYCALL, 7);
Msg->L3TTL = L3LIVES;
Msg->L4ID = 1;
Msg->L4INDEX = 0;
Msg->L4FLAGS = 0;
memcpy(Msg->L4DATA, MYCALL, 7);
Msg->L4DATA[7] = Stream + 28;
Msg->LENGTH = 8 + 21 + MSGHDDRLEN;
C_Q_ADD(&DEST->DEST_Q, Msg);
}
/*
Copyright 2001-2022 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
*/
//
// Netrom Record ROute Suport Code for BPQ32 Switch
//
// All code runs from the BPQ32 Received or Timer Routines under Semaphore.
// As most data areas are dynamically allocated, they will not survive a Timer Process Swap.
// Shared data can be used for Config Info.
#define _CRT_SECURE_NO_DEPRECATE
#pragma data_seg("_BPQDATA")
#include "time.h"
#include "stdio.h"
#include <fcntl.h>
//#include "vmm.h"
#include "cheaders.h"
extern int SENDNETFRAME();
extern VOID Q_ADD();
VOID __cdecl Debugprintf(const char * format, ...);
TRANSPORTENTRY * NRRSession;
/*
datagrams (and other things) to be transported in Netrom L3 frames.
When the frametype is 0x00, the "circuit index" and "circuit id" (first 2
bytes of the transport header) take on a different meaning, something like
"protocol family" and "protocol id". IP over netrom uses 0x0C for both
bytes, TheNet uses 0x00 for both bytes when making L3RTT measurements, and
Xnet uses family 0x00, protocol id 0x01 for Netrom Record Route. I believe
there are authors using other values too. Unfortunately there is no
co-ordinating authority for these numbers, so authors just pick an unused
one.
*/
VOID NRRecordRoute(UCHAR * Buff, int Len)
{
// NRR frame for us. If We originated it, report outcome, else put our call on end, and send back
L3MESSAGEBUFFER * Msg = (L3MESSAGEBUFFER *)Buff;
struct DEST_LIST * DEST;
char Temp[7];
int NRRLen = Len - (21 + MSGHDDRLEN);
UCHAR Flags;
char call[10];
int calllen;
char * Save = Buff;
if (memcmp(&Msg->L4DATA, MYCALL, 7) == 0)
{
UCHAR * BUFFER = GetBuff();
UCHAR * ptr1;
struct _MESSAGE * Msg;
if (BUFFER == NULL)
return;
ptr1 = &BUFFER[MSGHDDRLEN];
*ptr1++ = 0xf0; // PID
ptr1 += sprintf(ptr1, "NRR Response:");
Buff += 21 + MSGHDDRLEN;
Len -= (21 + MSGHDDRLEN);
while (Len > 0)
{
calllen = ConvFromAX25(Buff, call);
call[calllen] = 0;
ptr1 += sprintf(ptr1, " %s", call);
if ((Buff[7] & 0x80) == 0x80) // Check turnround bit
*ptr1++ = '*';
Buff+=8;
Len -= 8;
}
// Add ours on end for neatness
calllen = ConvFromAX25(MYCALL, call);
call[calllen] = 0;
ptr1 += sprintf(ptr1, " %s", call);
*ptr1++ = 0x0d; // CR
Len = (int)(ptr1 - BUFFER);
Msg = (struct _MESSAGE *)BUFFER;
Msg->LENGTH = Len;
Msg->CHAIN = NULL;
C_Q_ADD(&NRRSession->L4TX_Q, (UINT *)BUFFER);
PostDataAvailable(NRRSession);
ReleaseBuffer(Save);
return;
}
// Add our call on end, and increase count
Flags = Buff[Len - 1];
Flags--;
if (Flags && NRRLen < 228) // Dont update if full
{
Flags |= 0x80; // Set End of route bit
Msg->L3PID = NRPID;
memcpy(&Msg->L4DATA[NRRLen], MYCALL, 7);
Msg->L4DATA[NRRLen+7] = Flags;
NRRLen += 8;
}
// We should send it back via our bast route, or recorded route could be wrong
memcpy(Temp, Msg->L3DEST, 7);
memcpy(Msg->L3DEST, Msg->L3SRCE, 7);
memcpy(Msg->L3SRCE, Temp, 7);
if (FindDestination(Msg->L3DEST, &DEST) == 0)
{
ReleaseBuffer(Msg); // CANT FIND DESTINATION
return;
}
Msg->LENGTH = NRRLen + 21 + MSGHDDRLEN;
Debugprintf("NRR TX Len %d Flags %d NRRLen %d", Msg->LENGTH, Flags, NRRLen);
C_Q_ADD(&DEST->DEST_Q, Msg);
}
VOID SendNRRecordRoute(struct DEST_LIST * DEST, TRANSPORTENTRY * Session)
{
L3MESSAGEBUFFER * Msg = GetBuff();
int Stream = 1;
if (Msg == NULL)
return;
NRRSession = Session; // Save Session Pointer for reply
Msg->Port = 0;
Msg->L3PID = NRPID;
memcpy(Msg->L3DEST, DEST->DEST_CALL, 7);
memcpy(Msg->L3SRCE, MYCALL, 7);
Msg->L3TTL = L3LIVES;
Msg->L4ID = 1;
Msg->L4INDEX = 0;
Msg->L4FLAGS = 0;
memcpy(Msg->L4DATA, MYCALL, 7);
Msg->L4DATA[7] = Stream + 28;
Msg->LENGTH = 8 + 21 + MSGHDDRLEN;
C_Q_ADD(&DEST->DEST_Q, Msg);
}

@ -1,432 +1,432 @@
// Mail and Chat Server for BPQ32 Packet Switch
//
// Debug Window(s) Module
#include "BPQChat.h"
static char ClassName[]="BPQDEBUGWINDOW";
static WNDPROC wpOrigInputProc;
static WNDPROC wpOrigOutputProc;
HWND hDebug;
static HWND hwndInput;
static HWND hwndOutput;
static HMENU hMenu; // handle of menu
#define InputBoxHeight 25
RECT DebugRect;
int Height, Width, LastY;
static char readbuff[1024];
static BOOL Bells = TRUE;
static BOOL StripLF = TRUE;
static BOOL MonBBS = TRUE;
static BOOL MonCHAT = TRUE;
static BOOL MonTCP = TRUE;
static int PartLinePtr=0;
static int PartLineIndex=0; // Listbox index of (last) incomplete line
static LRESULT CALLBACK MonWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
static LRESULT APIENTRY InputProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) ;
static LRESULT APIENTRY OutputProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) ;
static LRESULT APIENTRY MonProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) ;
static LRESULT APIENTRY SplitProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) ;
static void MoveWindows();
#define BGCOLOUR RGB(236,233,216)
extern char DebugSize[32];
BOOL CreateDebugWindow()
{
WNDCLASS wc;
HBRUSH bgBrush;
char Text[80];
if (hDebug)
{
ShowWindow(hDebug, SW_SHOWNORMAL);
SetForegroundWindow(hDebug);
return FALSE; // Alreaqy open
}
bgBrush = CreateSolidBrush(BGCOLOUR);
wc.style = CS_HREDRAW | CS_VREDRAW;
wc.lpfnWndProc = MonWndProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = DLGWINDOWEXTRA;
wc.hInstance = hInst;
wc.hIcon = LoadIcon( hInst, MAKEINTRESOURCE(BPQICON) );
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
wc.hbrBackground = bgBrush;
wc.lpszMenuName = NULL;
wc.lpszClassName = ClassName;
RegisterClass(&wc);
hDebug=CreateDialog(hInst,ClassName,0,NULL);
if (!hDebug)
return (FALSE);
wsprintf(Text, "Chat %s Debug", Session);
SetWindowText(hDebug, Text);
hMenu=GetMenu(hDebug);
if (Bells & 1)
CheckMenuItem(hMenu,BPQBELLS, MF_CHECKED);
else
CheckMenuItem(hMenu,BPQBELLS, MF_UNCHECKED);
if (StripLF & 1)
CheckMenuItem(hMenu,BPQStripLF, MF_CHECKED);
else
CheckMenuItem(hMenu,BPQStripLF, MF_UNCHECKED);
CheckMenuItem(hMenu,MONBBS, MonBBS ? MF_CHECKED : MF_UNCHECKED);
CheckMenuItem(hMenu,MONCHAT, MonCHAT ? MF_CHECKED : MF_UNCHECKED);
CheckMenuItem(hMenu,MONTCP, MonTCP ? MF_CHECKED : MF_UNCHECKED);
DrawMenuBar(hWnd);
// Retrieve the handlse to the edit controls.
hwndOutput = GetDlgItem(hDebug, 122);
// Set our own WndProcs for the controls.
wpOrigOutputProc = (WNDPROC)SetWindowLong(hwndOutput, GWL_WNDPROC, (LONG)OutputProc);
if (cfgMinToTray)
{
AddTrayMenuItem(hDebug, Text);
}
ShowWindow(hDebug, SW_SHOWNORMAL);
if (DebugRect.right < 100 || DebugRect.bottom < 100)
{
GetWindowRect(hDebug, &DebugRect);
}
MoveWindow(hDebug,DebugRect.left,DebugRect.top, DebugRect.right-DebugRect.left, DebugRect.bottom-DebugRect.top, TRUE);
MoveWindows();
return TRUE;
}
static void MoveWindows()
{
RECT rcMain, rcClient;
int ClientHeight, ClientWidth;
GetWindowRect(hDebug, &rcMain);
GetClientRect(hDebug, &rcClient);
ClientHeight = rcClient.bottom;
ClientWidth = rcClient.right;
// MoveWindow(hwndMon,2, 0, ClientWidth-4, SplitPos, TRUE);
MoveWindow(hwndOutput,2, 2, ClientWidth-4, ClientHeight-4, TRUE);
// MoveWindow(hwndSplit,0, SplitPos, ClientWidth, SplitBarHeight, TRUE);
}
static LRESULT CALLBACK MonWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
int wmId, wmEvent;
LPRECT lprc;
switch (message) {
case WM_ACTIVATE:
SetFocus(hwndInput);
break;
case WM_COMMAND:
wmId = LOWORD(wParam); // Remember, these are...
wmEvent = HIWORD(wParam); // ...different for Win32!
switch (wmId) {
case MONBBS:
ToggleParam(hMenu, hWnd, &MonBBS, MONBBS);
break;
case MONCHAT:
ToggleParam(hMenu, hWnd, &MonCHAT, MONCHAT);
break;
case MONTCP:
ToggleParam(hMenu, hWnd, &MonTCP, MONTCP);
break;
case BPQCLEAROUT:
SendMessage(hwndOutput,LB_RESETCONTENT, 0, 0);
break;
case BPQCOPYOUT:
CopyToClipboard(hwndOutput);
break;
//case BPQHELP:
// HtmlHelp(hWnd,"BPQTerminal.chm",HH_HELP_FINDER,0);
// break;
default:
return 0;
}
case WM_SYSCOMMAND:
wmId = LOWORD(wParam); // Remember, these are...
wmEvent = HIWORD(wParam); // ...different for Win32!
switch (wmId) {
case SC_MINIMIZE:
if (cfgMinToTray)
return ShowWindow(hWnd, SW_HIDE);
default:
return (DefWindowProc(hWnd, message, wParam, lParam));
}
case WM_SIZING:
lprc = (LPRECT) lParam;
Height = lprc->bottom-lprc->top;
Width = lprc->right-lprc->left;
MoveWindows();
return TRUE;
case WM_DESTROY:
// Remove the subclass from the edit control.
GetWindowRect(hWnd, &DebugRect); // For save soutine
SetWindowLong(hwndInput, GWL_WNDPROC,
(LONG) wpOrigInputProc);
if (cfgMinToTray)
DeleteTrayMenuItem(hWnd);
hDebug = NULL;
break;
default:
return (DefWindowProc(hWnd, message, wParam, lParam));
}
return (0);
}
LRESULT APIENTRY OutputProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
// Trap mouse messages, so we cant select stuff in output and mon windows,
// otherwise scrolling doesnt work.
if (uMsg >= WM_MOUSEFIRST && uMsg <= WM_MOUSELAST)
return TRUE;
return CallWindowProc(wpOrigOutputProc, hwnd, uMsg, wParam, lParam);
}
VOID ClearDebugWindow()
{
SendMessage(hwndOutput,LB_RESETCONTENT, 0, 0);
}
VOID WritetoDebugWindow(char * Msg, int len)
{
char * ptr1, * ptr2;
int index;
if (len ==0)
return;
if (PartLinePtr != 0)
SendMessage(hwndOutput,LB_DELETESTRING,PartLineIndex,(LPARAM)(LPCTSTR) 0 );
memcpy(&readbuff[PartLinePtr], Msg, len);
len=len+PartLinePtr;
ptr1=&readbuff[0];
readbuff[len]=0;
if (Bells)
{
do {
ptr2=memchr(ptr1,7,len);
if (ptr2)
{
*(ptr2)=32;
Beep(440,250);
}
} while (ptr2);
}
lineloop:
if (PartLinePtr > 300)
PartLinePtr = 0;
if (len > 0)
{
// copy text to control a line at a time
ptr2=memchr(ptr1,13,len);
if (ptr2 == 0)
{
// no newline. Move data to start of buffer and Save pointer
PartLinePtr=len;
memmove(readbuff,ptr1,len);
PartLineIndex=SendMessage(hwndOutput,LB_ADDSTRING,0,(LPARAM)(LPCTSTR) ptr1 );
SendMessage(hwndOutput,LB_SETCARETINDEX,(WPARAM) PartLineIndex, MAKELPARAM(FALSE, 0));
return;
}
*(ptr2++)=0;
index=SendMessage(hwndOutput,LB_ADDSTRING,0,(LPARAM)(LPCTSTR) ptr1 );
// if (LogOutput) WriteMonitorLine(ptr1, ptr2 - ptr1);
PartLinePtr=0;
len-=(ptr2-ptr1);
ptr1=ptr2;
if ((len > 0) && StripLF)
{
if (*ptr1 == 0x0a) // Line Feed
{
ptr1++;
len--;
}
}
if (index > 1200)
do{
index=SendMessage(hwndOutput,LB_DELETESTRING, 0, 0);
} while (index > 1000);
SendMessage(hwndOutput,LB_SETCARETINDEX,(WPARAM) index, MAKELPARAM(FALSE, 0));
goto lineloop;
}
return;
}
/*static int ToggleParam(HMENU hMenu, HWND hWnd, BOOL * Param, int Item)
{
*Param = !(*Param);
CheckMenuItem(hMenu,Item, (*Param) ? MF_CHECKED : MF_UNCHECKED);
return (0);
}
*/
static void CopyToClipboard(HWND hWnd)
{
int i,n, len=0;
HGLOBAL hMem;
char * ptr;
//
// Copy List Box to clipboard
//
n = SendMessage(hWnd, LB_GETCOUNT, 0, 0);
for (i=0; i<n; i++)
{
len+=SendMessage(hWnd, LB_GETTEXTLEN, i, 0);
}
hMem=GlobalAlloc(GMEM_MOVEABLE | GMEM_DDESHARE, len+n+n+1);
if (hMem != 0)
{
ptr=GlobalLock(hMem);
if (OpenClipboard(MainWnd))
{
// CopyScreentoBuffer(GlobalLock(hMem));
for (i=0; i<n; i++)
{
ptr+=SendMessage(hWnd, LB_GETTEXT, i, (LPARAM) ptr);
*(ptr++)=13;
*(ptr++)=10;
}
*(ptr)=0; // end of data
GlobalUnlock(hMem);
EmptyClipboard();
SetClipboardData(CF_TEXT,hMem);
CloseClipboard();
}
else
GlobalFree(hMem);
}
}
// Mail and Chat Server for BPQ32 Packet Switch
//
// Debug Window(s) Module
#include "BPQChat.h"
static char ClassName[]="BPQDEBUGWINDOW";
static WNDPROC wpOrigInputProc;
static WNDPROC wpOrigOutputProc;
HWND hDebug;
static HWND hwndInput;
static HWND hwndOutput;
static HMENU hMenu; // handle of menu
#define InputBoxHeight 25
RECT DebugRect;
int Height, Width, LastY;
static char readbuff[1024];
static BOOL Bells = TRUE;
static BOOL StripLF = TRUE;
static BOOL MonBBS = TRUE;
static BOOL MonCHAT = TRUE;
static BOOL MonTCP = TRUE;
static int PartLinePtr=0;
static int PartLineIndex=0; // Listbox index of (last) incomplete line
static LRESULT CALLBACK MonWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
static LRESULT APIENTRY InputProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) ;
static LRESULT APIENTRY OutputProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) ;
static LRESULT APIENTRY MonProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) ;
static LRESULT APIENTRY SplitProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) ;
static void MoveWindows();
#define BGCOLOUR RGB(236,233,216)
extern char DebugSize[32];
BOOL CreateDebugWindow()
{
WNDCLASS wc;
HBRUSH bgBrush;
char Text[80];
if (hDebug)
{
ShowWindow(hDebug, SW_SHOWNORMAL);
SetForegroundWindow(hDebug);
return FALSE; // Alreaqy open
}
bgBrush = CreateSolidBrush(BGCOLOUR);
wc.style = CS_HREDRAW | CS_VREDRAW;
wc.lpfnWndProc = MonWndProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = DLGWINDOWEXTRA;
wc.hInstance = hInst;
wc.hIcon = LoadIcon( hInst, MAKEINTRESOURCE(BPQICON) );
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
wc.hbrBackground = bgBrush;
wc.lpszMenuName = NULL;
wc.lpszClassName = ClassName;
RegisterClass(&wc);
hDebug=CreateDialog(hInst,ClassName,0,NULL);
if (!hDebug)
return (FALSE);
wsprintf(Text, "Chat %s Debug", Session);
SetWindowText(hDebug, Text);
hMenu=GetMenu(hDebug);
if (Bells & 1)
CheckMenuItem(hMenu,BPQBELLS, MF_CHECKED);
else
CheckMenuItem(hMenu,BPQBELLS, MF_UNCHECKED);
if (StripLF & 1)
CheckMenuItem(hMenu,BPQStripLF, MF_CHECKED);
else
CheckMenuItem(hMenu,BPQStripLF, MF_UNCHECKED);
CheckMenuItem(hMenu,MONBBS, MonBBS ? MF_CHECKED : MF_UNCHECKED);
CheckMenuItem(hMenu,MONCHAT, MonCHAT ? MF_CHECKED : MF_UNCHECKED);
CheckMenuItem(hMenu,MONTCP, MonTCP ? MF_CHECKED : MF_UNCHECKED);
DrawMenuBar(hWnd);
// Retrieve the handlse to the edit controls.
hwndOutput = GetDlgItem(hDebug, 122);
// Set our own WndProcs for the controls.
wpOrigOutputProc = (WNDPROC)SetWindowLong(hwndOutput, GWL_WNDPROC, (LONG)OutputProc);
if (cfgMinToTray)
{
AddTrayMenuItem(hDebug, Text);
}
ShowWindow(hDebug, SW_SHOWNORMAL);
if (DebugRect.right < 100 || DebugRect.bottom < 100)
{
GetWindowRect(hDebug, &DebugRect);
}
MoveWindow(hDebug,DebugRect.left,DebugRect.top, DebugRect.right-DebugRect.left, DebugRect.bottom-DebugRect.top, TRUE);
MoveWindows();
return TRUE;
}
static void MoveWindows()
{
RECT rcMain, rcClient;
int ClientHeight, ClientWidth;
GetWindowRect(hDebug, &rcMain);
GetClientRect(hDebug, &rcClient);
ClientHeight = rcClient.bottom;
ClientWidth = rcClient.right;
// MoveWindow(hwndMon,2, 0, ClientWidth-4, SplitPos, TRUE);
MoveWindow(hwndOutput,2, 2, ClientWidth-4, ClientHeight-4, TRUE);
// MoveWindow(hwndSplit,0, SplitPos, ClientWidth, SplitBarHeight, TRUE);
}
static LRESULT CALLBACK MonWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
int wmId, wmEvent;
LPRECT lprc;
switch (message) {
case WM_ACTIVATE:
SetFocus(hwndInput);
break;
case WM_COMMAND:
wmId = LOWORD(wParam); // Remember, these are...
wmEvent = HIWORD(wParam); // ...different for Win32!
switch (wmId) {
case MONBBS:
ToggleParam(hMenu, hWnd, &MonBBS, MONBBS);
break;
case MONCHAT:
ToggleParam(hMenu, hWnd, &MonCHAT, MONCHAT);
break;
case MONTCP:
ToggleParam(hMenu, hWnd, &MonTCP, MONTCP);
break;
case BPQCLEAROUT:
SendMessage(hwndOutput,LB_RESETCONTENT, 0, 0);
break;
case BPQCOPYOUT:
CopyToClipboard(hwndOutput);
break;
//case BPQHELP:
// HtmlHelp(hWnd,"BPQTerminal.chm",HH_HELP_FINDER,0);
// break;
default:
return 0;
}
case WM_SYSCOMMAND:
wmId = LOWORD(wParam); // Remember, these are...
wmEvent = HIWORD(wParam); // ...different for Win32!
switch (wmId) {
case SC_MINIMIZE:
if (cfgMinToTray)
return ShowWindow(hWnd, SW_HIDE);
default:
return (DefWindowProc(hWnd, message, wParam, lParam));
}
case WM_SIZING:
lprc = (LPRECT) lParam;
Height = lprc->bottom-lprc->top;
Width = lprc->right-lprc->left;
MoveWindows();
return TRUE;
case WM_DESTROY:
// Remove the subclass from the edit control.
GetWindowRect(hWnd, &DebugRect); // For save soutine
SetWindowLong(hwndInput, GWL_WNDPROC,
(LONG) wpOrigInputProc);
if (cfgMinToTray)
DeleteTrayMenuItem(hWnd);
hDebug = NULL;
break;
default:
return (DefWindowProc(hWnd, message, wParam, lParam));
}
return (0);
}
LRESULT APIENTRY OutputProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
// Trap mouse messages, so we cant select stuff in output and mon windows,
// otherwise scrolling doesnt work.
if (uMsg >= WM_MOUSEFIRST && uMsg <= WM_MOUSELAST)
return TRUE;
return CallWindowProc(wpOrigOutputProc, hwnd, uMsg, wParam, lParam);
}
VOID ClearDebugWindow()
{
SendMessage(hwndOutput,LB_RESETCONTENT, 0, 0);
}
VOID WritetoDebugWindow(char * Msg, int len)
{
char * ptr1, * ptr2;
int index;
if (len ==0)
return;
if (PartLinePtr != 0)
SendMessage(hwndOutput,LB_DELETESTRING,PartLineIndex,(LPARAM)(LPCTSTR) 0 );
memcpy(&readbuff[PartLinePtr], Msg, len);
len=len+PartLinePtr;
ptr1=&readbuff[0];
readbuff[len]=0;
if (Bells)
{
do {
ptr2=memchr(ptr1,7,len);
if (ptr2)
{
*(ptr2)=32;
Beep(440,250);
}
} while (ptr2);
}
lineloop:
if (PartLinePtr > 300)
PartLinePtr = 0;
if (len > 0)
{
// copy text to control a line at a time
ptr2=memchr(ptr1,13,len);
if (ptr2 == 0)
{
// no newline. Move data to start of buffer and Save pointer
PartLinePtr=len;
memmove(readbuff,ptr1,len);
PartLineIndex=SendMessage(hwndOutput,LB_ADDSTRING,0,(LPARAM)(LPCTSTR) ptr1 );
SendMessage(hwndOutput,LB_SETCARETINDEX,(WPARAM) PartLineIndex, MAKELPARAM(FALSE, 0));
return;
}
*(ptr2++)=0;
index=SendMessage(hwndOutput,LB_ADDSTRING,0,(LPARAM)(LPCTSTR) ptr1 );
// if (LogOutput) WriteMonitorLine(ptr1, ptr2 - ptr1);
PartLinePtr=0;
len-=(ptr2-ptr1);
ptr1=ptr2;
if ((len > 0) && StripLF)
{
if (*ptr1 == 0x0a) // Line Feed
{
ptr1++;
len--;
}
}
if (index > 1200)
do{
index=SendMessage(hwndOutput,LB_DELETESTRING, 0, 0);
} while (index > 1000);
SendMessage(hwndOutput,LB_SETCARETINDEX,(WPARAM) index, MAKELPARAM(FALSE, 0));
goto lineloop;
}
return;
}
/*static int ToggleParam(HMENU hMenu, HWND hWnd, BOOL * Param, int Item)
{
*Param = !(*Param);
CheckMenuItem(hMenu,Item, (*Param) ? MF_CHECKED : MF_UNCHECKED);
return (0);
}
*/
static void CopyToClipboard(HWND hWnd)
{
int i,n, len=0;
HGLOBAL hMem;
char * ptr;
//
// Copy List Box to clipboard
//
n = SendMessage(hWnd, LB_GETCOUNT, 0, 0);
for (i=0; i<n; i++)
{
len+=SendMessage(hWnd, LB_GETTEXTLEN, i, 0);
}
hMem=GlobalAlloc(GMEM_MOVEABLE | GMEM_DDESHARE, len+n+n+1);
if (hMem != 0)
{
ptr=GlobalLock(hMem);
if (OpenClipboard(MainWnd))
{
// CopyScreentoBuffer(GlobalLock(hMem));
for (i=0; i<n; i++)
{
ptr+=SendMessage(hWnd, LB_GETTEXT, i, (LPARAM) ptr);
*(ptr++)=13;
*(ptr++)=10;
}
*(ptr)=0; // end of data
GlobalUnlock(hMem);
EmptyClipboard();
SetClipboardData(CF_TEXT,hMem);
CloseClipboard();
}
else
GlobalFree(hMem);
}
}

@ -1,455 +1,455 @@
// Mail and Chat Server for BPQ32 Packet Switch
//
// Monitor Window(s) Module
#include "BPQChat.h"
static char ClassName[]="BPQMONWINDOW";
static WNDPROC wpOrigInputProc;
static WNDPROC wpOrigOutputProc;
HWND hMonitor;
static HWND hwndInput;
static HWND hwndOutput;
static HMENU hMenu; // handle of menu
#define InputBoxHeight 25
RECT MonitorRect;
RECT OutputRect;
int Height, Width, LastY;
static char kbbuf[160];
static int kbptr=0;
static char * readbuff;
static int readbufflen;
static BOOL StripLF = TRUE;
static BOOL MonBBS = TRUE;
static BOOL MonCHAT = TRUE;
static BOOL MonTCP = TRUE;
BOOL LogBBS = TRUE;
BOOL LogCHAT = TRUE;
BOOL LogTCP = TRUE;
static int PartLinePtr=0;
static int PartLineIndex=0; // Listbox index of (last) incomplete line
static LRESULT CALLBACK MonWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
static LRESULT APIENTRY InputProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) ;
static LRESULT APIENTRY OutputProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) ;
static LRESULT APIENTRY MonProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) ;
static void MoveWindows();
#define BGCOLOUR RGB(236,233,216)
extern char MonitorSize[32];
BOOL CreateMonitor()
{
WNDCLASS wc;
HBRUSH bgBrush;
char Text[80];
if (hMonitor)
{
ShowWindow(hMonitor, SW_SHOWNORMAL);
SetForegroundWindow(hMonitor);
return FALSE; // Alreaqy open
}
bgBrush = CreateSolidBrush(BGCOLOUR);
wc.style = CS_HREDRAW | CS_VREDRAW;
wc.lpfnWndProc = MonWndProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = DLGWINDOWEXTRA;
wc.hInstance = hInst;
wc.hIcon = LoadIcon( hInst, MAKEINTRESOURCE(BPQICON) );
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
wc.hbrBackground = bgBrush;
wc.lpszMenuName = NULL;
wc.lpszClassName = ClassName;
RegisterClass(&wc);
hMonitor=CreateDialog(hInst,ClassName,0,NULL);
if (!hMonitor)
return (FALSE);
wsprintf(Text, "Chat %s Monitor", Session);
SetWindowText(hMonitor, Text);
readbuff = zalloc(1000);
readbufflen = 1000;
hMenu=GetMenu(hMonitor);
CheckMenuItem(hMenu,MONBBS, MonBBS ? MF_CHECKED : MF_UNCHECKED);
CheckMenuItem(hMenu,MONCHAT, MonCHAT ? MF_CHECKED : MF_UNCHECKED);
CheckMenuItem(hMenu,MONTCP, MonTCP ? MF_CHECKED : MF_UNCHECKED);
DrawMenuBar(hWnd);
// Retrieve the handlse to the edit controls.
hwndOutput = GetDlgItem(hMonitor, 121);
// Set our own WndProcs for the controls.
wpOrigOutputProc = (WNDPROC)SetWindowLong(hwndOutput, GWL_WNDPROC, (LONG)OutputProc);
if (cfgMinToTray)
{
AddTrayMenuItem(hMonitor, Text);
}
ShowWindow(hMonitor, SW_SHOWNORMAL);
if (MonitorRect.right < 100 || MonitorRect.bottom < 100)
{
GetWindowRect(hMonitor, &MonitorRect);
}
MoveWindow(hMonitor,MonitorRect.left,MonitorRect.top, MonitorRect.right-MonitorRect.left, MonitorRect.bottom-MonitorRect.top, TRUE);
MoveWindows();
return TRUE;
}
static void MoveWindows()
{
RECT rcMain, rcClient;
int ClientHeight, ClientWidth;
GetWindowRect(hMonitor, &rcMain);
GetClientRect(hMonitor, &rcClient);
ClientHeight = rcClient.bottom;
ClientWidth = rcClient.right;
// MoveWindow(hwndMon,2, 0, ClientWidth-4, SplitPos, TRUE);
MoveWindow(hwndOutput,2, 2, ClientWidth-4, ClientHeight-4, TRUE);
// MoveWindow(hwndSplit,0, SplitPos, ClientWidth, SplitBarHeight, TRUE);
}
static LRESULT CALLBACK MonWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
int wmId, wmEvent;
LPRECT lprc;
switch (message) {
case WM_ACTIVATE:
SetFocus(hwndInput);
break;
case WM_COMMAND:
wmId = LOWORD(wParam); // Remember, these are...
wmEvent = HIWORD(wParam); // ...different for Win32!
switch (wmId) {
case MONBBS:
ToggleParam(hMenu, hWnd, &MonBBS, MONBBS);
break;
case MONCHAT:
ToggleParam(hMenu, hWnd, &MonCHAT, MONCHAT);
break;
case MONTCP:
ToggleParam(hMenu, hWnd, &MonTCP, MONTCP);
break;
case BPQCLEAROUT:
SendMessage(hwndOutput,LB_RESETCONTENT, 0, 0);
break;
case BPQCOPYOUT:
CopyToClipboard(hwndOutput);
break;
//case BPQHELP:
// HtmlHelp(hWnd,"BPQTerminal.chm",HH_HELP_FINDER,0);
// break;
default:
return 0;
}
case WM_SYSCOMMAND:
wmId = LOWORD(wParam); // Remember, these are...
wmEvent = HIWORD(wParam); // ...different for Win32!
switch (wmId) {
case SC_MINIMIZE:
if (cfgMinToTray)
return ShowWindow(hWnd, SW_HIDE);
default:
return (DefWindowProc(hWnd, message, wParam, lParam));
}
case WM_SIZING:
lprc = (LPRECT) lParam;
Height = lprc->bottom-lprc->top;
Width = lprc->right-lprc->left;
MoveWindows();
return TRUE;
case WM_DESTROY:
// Remove the subclass from the edit control.
GetWindowRect(hWnd, &MonitorRect); // For save soutine
SetWindowLong(hwndInput, GWL_WNDPROC,
(LONG) wpOrigInputProc);
if (cfgMinToTray)
DeleteTrayMenuItem(hWnd);
hMonitor = NULL;
free(readbuff);
readbufflen = 0;
break;
default:
return (DefWindowProc(hWnd, message, wParam, lParam));
}
return (0);
}
LRESULT APIENTRY OutputProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
// Trap mouse messages, so we cant select stuff in output and mon windows,
// otherwise scrolling doesnt work.
if (uMsg >= WM_MOUSEFIRST && uMsg <= WM_LBUTTONDBLCLK)
return TRUE;
return CallWindowProc(wpOrigOutputProc, hwnd, uMsg, wParam, lParam);
}
int WritetoMonitorWindow(char * Msg, int len)
{
char * ptr1, * ptr2;
int index;
if (len+PartLinePtr > readbufflen)
{
readbufflen += len+PartLinePtr;
readbuff = realloc(readbuff, readbufflen);
}
if (PartLinePtr != 0)
SendMessage(hwndOutput,LB_DELETESTRING,PartLineIndex,(LPARAM)(LPCTSTR) 0 );
memcpy(&readbuff[PartLinePtr], Msg, len);
len=len+PartLinePtr;
ptr1=&readbuff[0];
readbuff[len]=0;
do {
ptr2=memchr(ptr1,7,len);
if (ptr2)
*(ptr2)=32;
} while (ptr2);
lineloop:
// if (PartLinePtr > 300)
// PartLinePtr = 0;
if (len > 0)
{
// copy text to control a line at a time
ptr2=memchr(ptr1,13,len);
if (ptr2 == 0)
{
// no newline. Move data to start of buffer and Save pointer
PartLinePtr=len;
memmove(readbuff,ptr1,len);
PartLineIndex=SendMessage(hwndOutput,LB_ADDSTRING,0,(LPARAM)(LPCTSTR) ptr1 );
SendMessage(hwndOutput,LB_SETCARETINDEX,(WPARAM) PartLineIndex, MAKELPARAM(FALSE, 0));
return (0);
}
*(ptr2++)=0;
index=SendMessage(hwndOutput,LB_ADDSTRING,0,(LPARAM)(LPCTSTR) ptr1 );
// if (LogOutput) WriteMonitorLine(ptr1, ptr2 - ptr1);
PartLinePtr=0;
len-=(ptr2-ptr1);
ptr1=ptr2;
if ((len > 0) && StripLF)
{
if (*ptr1 == 0x0a) // Line Feed
{
ptr1++;
len--;
}
}
if (index > 1200)
do{
index=SendMessage(hwndOutput,LB_DELETESTRING, 0, 0);
} while (index > 1000);
SendMessage(hwndOutput,LB_SETCARETINDEX,(WPARAM) index, MAKELPARAM(FALSE, 0));
goto lineloop;
}
return (0);
}
static int ToggleParam(HMENU hMenu, HWND hWnd, BOOL * Param, int Item)
{
*Param = !(*Param);
CheckMenuItem(hMenu,Item, (*Param) ? MF_CHECKED : MF_UNCHECKED);
return (0);
}
static void CopyToClipboard(HWND hWnd)
{
int i,n, len=0;
HGLOBAL hMem;
char * ptr;
//
// Copy List Box to clipboard
//
n = SendMessage(hWnd, LB_GETCOUNT, 0, 0);
for (i=0; i<n; i++)
{
len+=SendMessage(hWnd, LB_GETTEXTLEN, i, 0);
}
hMem=GlobalAlloc(GMEM_MOVEABLE | GMEM_DDESHARE, len+n+n+1);
if (hMem != 0)
{
ptr=GlobalLock(hMem);
if (OpenClipboard(MainWnd))
{
// CopyScreentoBuffer(GlobalLock(hMem));
for (i=0; i<n; i++)
{
ptr+=SendMessage(hWnd, LB_GETTEXT, i, (LPARAM) ptr);
*(ptr++)=13;
*(ptr++)=10;
}
*(ptr)=0; // end of data
GlobalUnlock(hMem);
EmptyClipboard();
SetClipboardData(CF_TEXT,hMem);
CloseClipboard();
}
else
GlobalFree(hMem);
}
}
HANDLE LogHandle[4] = {INVALID_HANDLE_VALUE, INVALID_HANDLE_VALUE, INVALID_HANDLE_VALUE, INVALID_HANDLE_VALUE};
char * Logs[4] = {"BBS", "CHAT", "TCP", "DEBUG"};
BOOL OpenLogfile(int Flags)
{
UCHAR FN[MAX_PATH];
time_t T;
struct tm * tm;
T = time(NULL);
tm = gmtime(&T);
sprintf(FN,"%s/logs/log_%02d%02d%02d_%s.txt", GetLogDirectory(), tm->tm_year-100, tm->tm_mon+1, tm->tm_mday, Logs[Flags]);
LogHandle[Flags] = CreateFile(FN,
GENERIC_WRITE,
FILE_SHARE_READ,
NULL,
OPEN_ALWAYS,
FILE_ATTRIBUTE_NORMAL,
NULL);
SetFilePointer(LogHandle[Flags], 0, 0, FILE_END);
return (LogHandle[Flags] != INVALID_HANDLE_VALUE);
}
// Mail and Chat Server for BPQ32 Packet Switch
//
// Monitor Window(s) Module
#include "BPQChat.h"
static char ClassName[]="BPQMONWINDOW";
static WNDPROC wpOrigInputProc;
static WNDPROC wpOrigOutputProc;
HWND hMonitor;
static HWND hwndInput;
static HWND hwndOutput;
static HMENU hMenu; // handle of menu
#define InputBoxHeight 25
RECT MonitorRect;
RECT OutputRect;
int Height, Width, LastY;
static char kbbuf[160];
static int kbptr=0;
static char * readbuff;
static int readbufflen;
static BOOL StripLF = TRUE;
static BOOL MonBBS = TRUE;
static BOOL MonCHAT = TRUE;
static BOOL MonTCP = TRUE;
BOOL LogBBS = TRUE;
BOOL LogCHAT = TRUE;
BOOL LogTCP = TRUE;
static int PartLinePtr=0;
static int PartLineIndex=0; // Listbox index of (last) incomplete line
static LRESULT CALLBACK MonWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
static LRESULT APIENTRY InputProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) ;
static LRESULT APIENTRY OutputProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) ;
static LRESULT APIENTRY MonProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) ;
static void MoveWindows();
#define BGCOLOUR RGB(236,233,216)
extern char MonitorSize[32];
BOOL CreateMonitor()
{
WNDCLASS wc;
HBRUSH bgBrush;
char Text[80];
if (hMonitor)
{
ShowWindow(hMonitor, SW_SHOWNORMAL);
SetForegroundWindow(hMonitor);
return FALSE; // Alreaqy open
}
bgBrush = CreateSolidBrush(BGCOLOUR);
wc.style = CS_HREDRAW | CS_VREDRAW;
wc.lpfnWndProc = MonWndProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = DLGWINDOWEXTRA;
wc.hInstance = hInst;
wc.hIcon = LoadIcon( hInst, MAKEINTRESOURCE(BPQICON) );
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
wc.hbrBackground = bgBrush;
wc.lpszMenuName = NULL;
wc.lpszClassName = ClassName;
RegisterClass(&wc);
hMonitor=CreateDialog(hInst,ClassName,0,NULL);
if (!hMonitor)
return (FALSE);
wsprintf(Text, "Chat %s Monitor", Session);
SetWindowText(hMonitor, Text);
readbuff = zalloc(1000);
readbufflen = 1000;
hMenu=GetMenu(hMonitor);
CheckMenuItem(hMenu,MONBBS, MonBBS ? MF_CHECKED : MF_UNCHECKED);
CheckMenuItem(hMenu,MONCHAT, MonCHAT ? MF_CHECKED : MF_UNCHECKED);
CheckMenuItem(hMenu,MONTCP, MonTCP ? MF_CHECKED : MF_UNCHECKED);
DrawMenuBar(hWnd);
// Retrieve the handlse to the edit controls.
hwndOutput = GetDlgItem(hMonitor, 121);
// Set our own WndProcs for the controls.
wpOrigOutputProc = (WNDPROC)SetWindowLong(hwndOutput, GWL_WNDPROC, (LONG)OutputProc);
if (cfgMinToTray)
{
AddTrayMenuItem(hMonitor, Text);
}
ShowWindow(hMonitor, SW_SHOWNORMAL);
if (MonitorRect.right < 100 || MonitorRect.bottom < 100)
{
GetWindowRect(hMonitor, &MonitorRect);
}
MoveWindow(hMonitor,MonitorRect.left,MonitorRect.top, MonitorRect.right-MonitorRect.left, MonitorRect.bottom-MonitorRect.top, TRUE);
MoveWindows();
return TRUE;
}
static void MoveWindows()
{
RECT rcMain, rcClient;
int ClientHeight, ClientWidth;
GetWindowRect(hMonitor, &rcMain);
GetClientRect(hMonitor, &rcClient);
ClientHeight = rcClient.bottom;
ClientWidth = rcClient.right;
// MoveWindow(hwndMon,2, 0, ClientWidth-4, SplitPos, TRUE);
MoveWindow(hwndOutput,2, 2, ClientWidth-4, ClientHeight-4, TRUE);
// MoveWindow(hwndSplit,0, SplitPos, ClientWidth, SplitBarHeight, TRUE);
}
static LRESULT CALLBACK MonWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
int wmId, wmEvent;
LPRECT lprc;
switch (message) {
case WM_ACTIVATE:
SetFocus(hwndInput);
break;
case WM_COMMAND:
wmId = LOWORD(wParam); // Remember, these are...
wmEvent = HIWORD(wParam); // ...different for Win32!
switch (wmId) {
case MONBBS:
ToggleParam(hMenu, hWnd, &MonBBS, MONBBS);
break;
case MONCHAT:
ToggleParam(hMenu, hWnd, &MonCHAT, MONCHAT);
break;
case MONTCP:
ToggleParam(hMenu, hWnd, &MonTCP, MONTCP);
break;
case BPQCLEAROUT:
SendMessage(hwndOutput,LB_RESETCONTENT, 0, 0);
break;
case BPQCOPYOUT:
CopyToClipboard(hwndOutput);
break;
//case BPQHELP:
// HtmlHelp(hWnd,"BPQTerminal.chm",HH_HELP_FINDER,0);
// break;
default:
return 0;
}
case WM_SYSCOMMAND:
wmId = LOWORD(wParam); // Remember, these are...
wmEvent = HIWORD(wParam); // ...different for Win32!
switch (wmId) {
case SC_MINIMIZE:
if (cfgMinToTray)
return ShowWindow(hWnd, SW_HIDE);
default:
return (DefWindowProc(hWnd, message, wParam, lParam));
}
case WM_SIZING:
lprc = (LPRECT) lParam;
Height = lprc->bottom-lprc->top;
Width = lprc->right-lprc->left;
MoveWindows();
return TRUE;
case WM_DESTROY:
// Remove the subclass from the edit control.
GetWindowRect(hWnd, &MonitorRect); // For save soutine
SetWindowLong(hwndInput, GWL_WNDPROC,
(LONG) wpOrigInputProc);
if (cfgMinToTray)
DeleteTrayMenuItem(hWnd);
hMonitor = NULL;
free(readbuff);
readbufflen = 0;
break;
default:
return (DefWindowProc(hWnd, message, wParam, lParam));
}
return (0);
}
LRESULT APIENTRY OutputProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
// Trap mouse messages, so we cant select stuff in output and mon windows,
// otherwise scrolling doesnt work.
if (uMsg >= WM_MOUSEFIRST && uMsg <= WM_LBUTTONDBLCLK)
return TRUE;
return CallWindowProc(wpOrigOutputProc, hwnd, uMsg, wParam, lParam);
}
int WritetoMonitorWindow(char * Msg, int len)
{
char * ptr1, * ptr2;
int index;
if (len+PartLinePtr > readbufflen)
{
readbufflen += len+PartLinePtr;
readbuff = realloc(readbuff, readbufflen);
}
if (PartLinePtr != 0)
SendMessage(hwndOutput,LB_DELETESTRING,PartLineIndex,(LPARAM)(LPCTSTR) 0 );
memcpy(&readbuff[PartLinePtr], Msg, len);
len=len+PartLinePtr;
ptr1=&readbuff[0];
readbuff[len]=0;
do {
ptr2=memchr(ptr1,7,len);
if (ptr2)
*(ptr2)=32;
} while (ptr2);
lineloop:
// if (PartLinePtr > 300)
// PartLinePtr = 0;
if (len > 0)
{
// copy text to control a line at a time
ptr2=memchr(ptr1,13,len);
if (ptr2 == 0)
{
// no newline. Move data to start of buffer and Save pointer
PartLinePtr=len;
memmove(readbuff,ptr1,len);
PartLineIndex=SendMessage(hwndOutput,LB_ADDSTRING,0,(LPARAM)(LPCTSTR) ptr1 );
SendMessage(hwndOutput,LB_SETCARETINDEX,(WPARAM) PartLineIndex, MAKELPARAM(FALSE, 0));
return (0);
}
*(ptr2++)=0;
index=SendMessage(hwndOutput,LB_ADDSTRING,0,(LPARAM)(LPCTSTR) ptr1 );
// if (LogOutput) WriteMonitorLine(ptr1, ptr2 - ptr1);
PartLinePtr=0;
len-=(ptr2-ptr1);
ptr1=ptr2;
if ((len > 0) && StripLF)
{
if (*ptr1 == 0x0a) // Line Feed
{
ptr1++;
len--;
}
}
if (index > 1200)
do{
index=SendMessage(hwndOutput,LB_DELETESTRING, 0, 0);
} while (index > 1000);
SendMessage(hwndOutput,LB_SETCARETINDEX,(WPARAM) index, MAKELPARAM(FALSE, 0));
goto lineloop;
}
return (0);
}
static int ToggleParam(HMENU hMenu, HWND hWnd, BOOL * Param, int Item)
{
*Param = !(*Param);
CheckMenuItem(hMenu,Item, (*Param) ? MF_CHECKED : MF_UNCHECKED);
return (0);
}
static void CopyToClipboard(HWND hWnd)
{
int i,n, len=0;
HGLOBAL hMem;
char * ptr;
//
// Copy List Box to clipboard
//
n = SendMessage(hWnd, LB_GETCOUNT, 0, 0);
for (i=0; i<n; i++)
{
len+=SendMessage(hWnd, LB_GETTEXTLEN, i, 0);
}
hMem=GlobalAlloc(GMEM_MOVEABLE | GMEM_DDESHARE, len+n+n+1);
if (hMem != 0)
{
ptr=GlobalLock(hMem);
if (OpenClipboard(MainWnd))
{
// CopyScreentoBuffer(GlobalLock(hMem));
for (i=0; i<n; i++)
{
ptr+=SendMessage(hWnd, LB_GETTEXT, i, (LPARAM) ptr);
*(ptr++)=13;
*(ptr++)=10;
}
*(ptr)=0; // end of data
GlobalUnlock(hMem);
EmptyClipboard();
SetClipboardData(CF_TEXT,hMem);
CloseClipboard();
}
else
GlobalFree(hMem);
}
}
HANDLE LogHandle[4] = {INVALID_HANDLE_VALUE, INVALID_HANDLE_VALUE, INVALID_HANDLE_VALUE, INVALID_HANDLE_VALUE};
char * Logs[4] = {"BBS", "CHAT", "TCP", "DEBUG"};
BOOL OpenLogfile(int Flags)
{
UCHAR FN[MAX_PATH];
time_t T;
struct tm * tm;
T = time(NULL);
tm = gmtime(&T);
sprintf(FN,"%s/logs/log_%02d%02d%02d_%s.txt", GetLogDirectory(), tm->tm_year-100, tm->tm_mon+1, tm->tm_mday, Logs[Flags]);
LogHandle[Flags] = CreateFile(FN,
GENERIC_WRITE,
FILE_SHARE_READ,
NULL,
OPEN_ALWAYS,
FILE_ATTRIBUTE_NORMAL,
NULL);
SetFilePointer(LogHandle[Flags], 0, 0, FILE_END);
return (LogHandle[Flags] != INVALID_HANDLE_VALUE);
}

@ -1,147 +1,147 @@
#define MAXSTACK 20
#define INPUTLEN 512
#define MAXLINES 1000
#define LINELEN 200
#define BPQICON 2
#define IDR_MENU1 101
#define BPQMENU 101
#define BPQCONNECT 102
#define BPQDISCONNECT 103
#define IDD_FONT 105
#define ID_WARNWRAP 415
#define ID_WRAP 416
#define ID_FLASHONBELL 417
#define IDC_FONTWIDTH 1008
#define IDC_FONTNAME 1009
#define IDC_CODEPAGE 1010
#define IDC_CHARSET 1011
#define IDC_FONTSIZE 1012
#define BPQMTX 1164
#define BPQMCOM 1165
#define BPQCOPYMON 1166
#define BPQCOPYOUT 1167
#define BPQCLEARMON 1168
#define BPQCLEAROUT 1169
#define BPQBELLS 1170
#define BPQCHAT 1171
#define BPQHELP 1172
#define BPQStripLF 1173
#define BPQLogOutput 1174
#define BPQLogMonitor 1175
#define BPQSendDisconnected 1176
#define BPQMNODES 1177
#define MONCOLOUR 1178
#define CHATTERM 1179
#define IDM_CLOSEWINDOW 1180
#define MONITORAPRS 1181
#define MONLOCALTIME 1182
#define MON_UI_ONLY 40006
#define StopALLMon 40007
#define IDR_MAINFRAME_MENU 191
#define TERM_MENU 192
#define MON_MENU 193
#define IDI_SIGMA_MAIN_ICON 104
#define IDI_SYSTEM_INFO 106
#define RTFCOPY 30000
#define ID_INFORMATION_SYSTEMINFORMATION 30001
#define ID_HELP_ABOUT 30002
#define ID_WINDOWS_CASCADE 30003
#define ID_FILE_EXIT 30004
#define ID_WINDOWS_TILE 30005
#define ID_NEWWINDOW 30006
#define ID_WINDOWS_RESTORE 30007
#define ID_SETUP_FONT 30008
#define ID_ACTION_RESETWINDOWSPLIT 30009
#define BPQBASE 40100
#define IDM_FIRSTCHILD 50000 // used in structure when creating mdi client area for the main frame
// Port monitoring flags use BPQBASE -> BPQBASE+100
struct ConsoleInfo
{
struct ConsoleInfo * next;
int BPQStream;
BOOL Active;
int Incoming;
WNDPROC wpOrigInputProc;
HWND hConsole;
HWND hwndInput;
HWND hwndOutput;
HMENU hMenu; // handle of menu
RECT ConsoleRect;
RECT OutputRect;
int CharWidth;
int Height, Width, Top, Left;
int ClientHeight, ClientWidth;
char kbbuf[INPUTLEN];
int kbptr;
int readbufflen; // Current Length
char * readbuff; // Malloc'ed
char * KbdStack[MAXSTACK];
int StackIndex;
// BOOL Bells;
// BOOL FlashOnBell; // Flash instead of Beep
BOOL StripLF;
// BOOL WarnWrap;
// BOOL FlashOnConnect;
// BOOL WrapInput;
// BOOL CloseWindowOnBye;
unsigned int WrapLen;
int WarnLen;
int maxlinelen;
int PartLinePtr;
int PartLineIndex; // Listbox index of (last) incomplete line
DWORD dwCharX; // average width of characters
DWORD dwCharY; // height of characters
DWORD dwClientX; // width of client area
DWORD dwClientY; // height of client area
DWORD dwLineLen; // line length
int nCaretPosX; // horizontal position of caret
int nCaretPosY; // vertical position of caret
COLORREF FGColour; // Text Colour
COLORREF BGColour; // Background Colour
COLORREF DefaultColour; // Default Text Colour
int CurrentLine; // Line we are writing to in circular buffer.
int Index;
BOOL SendHeader;
BOOL Finished;
char OutputScreen[MAXLINES][LINELEN];
int Colourvalue[MAXLINES];
int LineLen[MAXLINES];
int CurrentColour;
int Thumb;
int FirstTime;
BOOL Scrolled; // Set if scrolled back
int RTFHeight; // Height of RTF control in pixels
BOOL CONNECTED;
int SlowTimer;
BOOL Minimized;
BOOL NeedRefresh;
};
#define MAXSTACK 20
#define INPUTLEN 512
#define MAXLINES 1000
#define LINELEN 200
#define BPQICON 2
#define IDR_MENU1 101
#define BPQMENU 101
#define BPQCONNECT 102
#define BPQDISCONNECT 103
#define IDD_FONT 105
#define ID_WARNWRAP 415
#define ID_WRAP 416
#define ID_FLASHONBELL 417
#define IDC_FONTWIDTH 1008
#define IDC_FONTNAME 1009
#define IDC_CODEPAGE 1010
#define IDC_CHARSET 1011
#define IDC_FONTSIZE 1012
#define BPQMTX 1164
#define BPQMCOM 1165
#define BPQCOPYMON 1166
#define BPQCOPYOUT 1167
#define BPQCLEARMON 1168
#define BPQCLEAROUT 1169
#define BPQBELLS 1170
#define BPQCHAT 1171
#define BPQHELP 1172
#define BPQStripLF 1173
#define BPQLogOutput 1174
#define BPQLogMonitor 1175
#define BPQSendDisconnected 1176
#define BPQMNODES 1177
#define MONCOLOUR 1178
#define CHATTERM 1179
#define IDM_CLOSEWINDOW 1180
#define MONITORAPRS 1181
#define MONLOCALTIME 1182
#define MON_UI_ONLY 40006
#define StopALLMon 40007
#define IDR_MAINFRAME_MENU 191
#define TERM_MENU 192
#define MON_MENU 193
#define IDI_SIGMA_MAIN_ICON 104
#define IDI_SYSTEM_INFO 106
#define RTFCOPY 30000
#define ID_INFORMATION_SYSTEMINFORMATION 30001
#define ID_HELP_ABOUT 30002
#define ID_WINDOWS_CASCADE 30003
#define ID_FILE_EXIT 30004
#define ID_WINDOWS_TILE 30005
#define ID_NEWWINDOW 30006
#define ID_WINDOWS_RESTORE 30007
#define ID_SETUP_FONT 30008
#define ID_ACTION_RESETWINDOWSPLIT 30009
#define BPQBASE 40100
#define IDM_FIRSTCHILD 50000 // used in structure when creating mdi client area for the main frame
// Port monitoring flags use BPQBASE -> BPQBASE+100
struct ConsoleInfo
{
struct ConsoleInfo * next;
int BPQStream;
BOOL Active;
int Incoming;
WNDPROC wpOrigInputProc;
HWND hConsole;
HWND hwndInput;
HWND hwndOutput;
HMENU hMenu; // handle of menu
RECT ConsoleRect;
RECT OutputRect;
int CharWidth;
int Height, Width, Top, Left;
int ClientHeight, ClientWidth;
char kbbuf[INPUTLEN];
int kbptr;
int readbufflen; // Current Length
char * readbuff; // Malloc'ed
char * KbdStack[MAXSTACK];
int StackIndex;
// BOOL Bells;
// BOOL FlashOnBell; // Flash instead of Beep
BOOL StripLF;
// BOOL WarnWrap;
// BOOL FlashOnConnect;
// BOOL WrapInput;
// BOOL CloseWindowOnBye;
unsigned int WrapLen;
int WarnLen;
int maxlinelen;
int PartLinePtr;
int PartLineIndex; // Listbox index of (last) incomplete line
DWORD dwCharX; // average width of characters
DWORD dwCharY; // height of characters
DWORD dwClientX; // width of client area
DWORD dwClientY; // height of client area
DWORD dwLineLen; // line length
int nCaretPosX; // horizontal position of caret
int nCaretPosY; // vertical position of caret
COLORREF FGColour; // Text Colour
COLORREF BGColour; // Background Colour
COLORREF DefaultColour; // Default Text Colour
int CurrentLine; // Line we are writing to in circular buffer.
int Index;
BOOL SendHeader;
BOOL Finished;
char OutputScreen[MAXLINES][LINELEN];
int Colourvalue[MAXLINES];
int LineLen[MAXLINES];
int CurrentColour;
int Thumb;
int FirstTime;
BOOL Scrolled; // Set if scrolled back
int RTFHeight; // Height of RTF control in pixels
BOOL CONNECTED;
int SlowTimer;
BOOL Minimized;
BOOL NeedRefresh;
};

@ -1,60 +1,60 @@
// FormatHTML.cpp : Defines the entry point for the console application.
//
#include <stdio.h>
int main () {
FILE *fp, *fp2;
char str[256];
char newstr[256];
char * ptr, * inptr;
/* opening file for reading */
fp = fopen("D:/AtomProject/test.html" , "r");
fp2 = fopen("D:/AtomProject/test.html.c" , "w");
if(fp == NULL) {
perror("Error opening file");
return(-1);
}
while(fgets (str, 256, fp) != NULL)
{
// Replace any " with \" and add " on front and \r\n" on end
char c;
ptr = newstr;
inptr = str;
c = *(inptr++);
*(ptr++) = '"';
while (c && c != 10)
{
if (c == '"')
*(ptr++) = '\\';
*(ptr++) = c;
c = *(inptr++);
}
*(ptr++) = '\\';
*(ptr++) = 'r';
*(ptr++) = '\\';
*(ptr++) = 'n';
*(ptr++) = '"';
*(ptr++) = 10;
*(ptr++) = 0;
puts(newstr);
fputs(newstr, fp2);
}
fclose(fp);
fclose(fp2);
return(0);
// FormatHTML.cpp : Defines the entry point for the console application.
//
#include <stdio.h>
int main () {
FILE *fp, *fp2;
char str[256];
char newstr[256];
char * ptr, * inptr;
/* opening file for reading */
fp = fopen("D:/AtomProject/test.html" , "r");
fp2 = fopen("D:/AtomProject/test.html.c" , "w");
if(fp == NULL) {
perror("Error opening file");
return(-1);
}
while(fgets (str, 256, fp) != NULL)
{
// Replace any " with \" and add " on front and \r\n" on end
char c;
ptr = newstr;
inptr = str;
c = *(inptr++);
*(ptr++) = '"';
while (c && c != 10)
{
if (c == '"')
*(ptr++) = '\\';
*(ptr++) = c;
c = *(inptr++);
}
*(ptr++) = '\\';
*(ptr++) = 'r';
*(ptr++) = '\\';
*(ptr++) = 'n';
*(ptr++) = '"';
*(ptr++) = 10;
*(ptr++) = 0;
puts(newstr);
fputs(newstr, fp2);
}
fclose(fp);
fclose(fp2);
return(0);
}

@ -1,32 +1,32 @@
//{{NO_DEPENDENCIES}}
// Microsoft Developer Studio generated include file.
// Used by BPQRemotePTT.rc
//
#define IDC_BPQHOST 1000
#define IDC_COM1 1001
#define IDC_HAMLIBPORT1 1002
#define IDC_COM2 1003
#define IDC_STATE1 1004
#define IDC_TEST1 1005
#define IDC_HAMLIBPORT2 1006
#define IDC_STATE2 1007
#define IDC_TEST2 1008
#define IDC_COM3 1009
#define IDC_HAMLIBPORT3 1010
#define IDC_STATE3 1011
#define IDC_TEST3 1012
#define IDC_COM4 1013
#define IDC_HAMLIBPORT4 1014
#define IDC_STATE4 1015
#define IDC_TEST4 1016
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 102
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1006
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
//{{NO_DEPENDENCIES}}
// Microsoft Developer Studio generated include file.
// Used by BPQRemotePTT.rc
//
#define IDC_BPQHOST 1000
#define IDC_COM1 1001
#define IDC_HAMLIBPORT1 1002
#define IDC_COM2 1003
#define IDC_STATE1 1004
#define IDC_TEST1 1005
#define IDC_HAMLIBPORT2 1006
#define IDC_STATE2 1007
#define IDC_TEST2 1008
#define IDC_COM3 1009
#define IDC_HAMLIBPORT3 1010
#define IDC_STATE3 1011
#define IDC_TEST3 1012
#define IDC_COM4 1013
#define IDC_HAMLIBPORT4 1014
#define IDC_STATE4 1015
#define IDC_TEST4 1016
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 102
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1006
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif

@ -1,29 +1,29 @@
char VersionString[50]="";
char VersionStringWithBuild[50]="";
int Ver[4] = {Vers};
char TextVerstring[50] = "";
void GetVersionInfo(char * File)
{
#ifndef LINBPQ
char isDebug[40]="";
#ifdef SPECIALVERSION
strcat(isDebug, " ");
strcat(isDebug, SPECIALVERSION);
#endif
#ifdef _DEBUG
strcat(isDebug, " Debug Build");
#endif
sprintf(VersionString,"%d.%d.%d.%d%s", Ver[0], Ver[1], Ver[2], Ver[3], isDebug);
sprintf(TextVerstring,"V%d.%d.%d.%d", Ver[0], Ver[1], Ver[2], Ver[3]);
sprintf(VersionStringWithBuild,"%d.%d.%d Build %d %s", Ver[0], Ver[1], Ver[2], Ver[3], isDebug);
return;
#endif
}
char VersionString[50]="";
char VersionStringWithBuild[50]="";
int Ver[4] = {Vers};
char TextVerstring[50] = "";
void GetVersionInfo(char * File)
{
#ifndef LINBPQ
char isDebug[40]="";
#ifdef SPECIALVERSION
strcat(isDebug, " ");
strcat(isDebug, SPECIALVERSION);
#endif
#ifdef _DEBUG
strcat(isDebug, " Debug Build");
#endif
sprintf(VersionString,"%d.%d.%d.%d%s", Ver[0], Ver[1], Ver[2], Ver[3], isDebug);
sprintf(TextVerstring,"V%d.%d.%d.%d", Ver[0], Ver[1], Ver[2], Ver[3]);
sprintf(VersionStringWithBuild,"%d.%d.%d Build %d %s", Ver[0], Ver[1], Ver[2], Ver[3], isDebug);
return;
#endif
}

@ -1,340 +1,340 @@
//Microsoft Developer Studio generated resource script.
//
#include "kernelresource.h"
#define CKernel
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"
#include "BpqTermMDI.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (U.K.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENG)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK
#pragma code_page(1252)
#endif //_WIN32
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
BPQMAINWINDOW DIALOG DISCARDABLE 17, 25, 382, 300
STYLE DS_3DLOOK | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU |
WS_THICKFRAME
CAPTION "BPQ32 Console"
CLASS "BPQMAINWINDOW"
FONT 8, "Fixedsys"
BEGIN
LTEXT "",IDC_BACKGROUND,22,20,337,273
CONTROL "",IDC_ENIGATE,"Button",BS_AUTOCHECKBOX | BS_LEFTTEXT |
WS_TABSTOP,57,0,8,12
LTEXT "IGate State - Disconnected",IGATESTATE,69,0,110,12,
SS_CENTERIMAGE
LTEXT "IGATE Stats - Msgs 0 Local Stns 0",IGATESTATS,180,0,
152,12,SS_CENTERIMAGE
LISTBOX BPQCONSOLE,1,17,359,262,LBS_NOINTEGRALHEIGHT |
LBS_DISABLENOSCROLL | LBS_NOSEL | WS_VSCROLL |
WS_HSCROLL
LTEXT "GPS Off",IDC_GPS,332,0,40,12,SS_CENTERIMAGE
LTEXT "Enable IGate",IDC_STATIC,5,2,49,10
END
CONFIG DIALOGEX 249, 200, 160, 118
STYLE DS_MODALFRAME | DS_3DLOOK | WS_POPUP | WS_CAPTION
EXSTYLE WS_EX_DLGMODALFRAME | WS_EX_WINDOWEDGE
CAPTION "Configuration"
CLASS "CONFIG"
FONT 8, "MS Shell Dlg", 0, 0, 0x1
BEGIN
EDITTEXT 1001,50,5,43,14,ES_AUTOHSCROLL | NOT WS_BORDER,
WS_EX_NOPARENTNOTIFY | WS_EX_CLIENTEDGE
EDITTEXT 1002,50,25,100,14,ES_AUTOHSCROLL | NOT WS_BORDER,
WS_EX_NOPARENTNOTIFY | WS_EX_CLIENTEDGE
EDITTEXT 1003,50,65,43,14,ES_AUTOHSCROLL | NOT WS_BORDER,
WS_EX_NOPARENTNOTIFY | WS_EX_CLIENTEDGE
LTEXT "Call",1,10,5,21,18,0,WS_EX_NOPARENTNOTIFY
LTEXT "Host",2,10,25,30,20,0,WS_EX_NOPARENTNOTIFY
LTEXT "UDP Port",3,10,65,32,15,0,WS_EX_NOPARENTNOTIFY
PUSHBUTTON "Cancel",ID_CANCEL,15,95,35,14,0,WS_EX_NOPARENTNOTIFY
PUSHBUTTON "Apply",ID_SAVE,55,95,35,14,0,WS_EX_NOPARENTNOTIFY
CONTROL "UDP Flag ",1004,"Button",BS_AUTOCHECKBOX | BS_LEFT |
WS_TABSTOP,8,45,50,14,WS_EX_RIGHT
CONTROL "Broadcast Flag ",1005,"Button",BS_AUTOCHECKBOX |
BS_LEFT | WS_TABSTOP,68,45,70,14,WS_EX_RIGHT
END
IDD_WL2KSYSOP DIALOGEX 0, 0, 277, 355
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "WL2K Sysop Record Update"
FONT 8, "MS Sans Serif"
BEGIN
LTEXT "Name",3,5,31,28,10,0,WS_EX_NOPARENTNOTIFY
EDITTEXT NAME,60,30,64,12,ES_AUTOHSCROLL | NOT WS_BORDER,
WS_EX_NOPARENTNOTIFY | WS_EX_CLIENTEDGE
LTEXT "Address Line 1",6,5,72,50,9,0,WS_EX_NOPARENTNOTIFY
EDITTEXT ADDR1,60,71,133,14,ES_AUTOHSCROLL | NOT WS_BORDER,
WS_EX_NOPARENTNOTIFY | WS_EX_CLIENTEDGE
LTEXT "Address Line 2",7,5,92,50,9,0,WS_EX_NOPARENTNOTIFY
EDITTEXT ADDR2,60,91,133,14,ES_AUTOHSCROLL | NOT WS_BORDER,
WS_EX_NOPARENTNOTIFY | WS_EX_CLIENTEDGE
LTEXT "City",4,5,112,40,9,0,WS_EX_NOPARENTNOTIFY
EDITTEXT CITY,60,111,133,14,ES_AUTOHSCROLL | NOT WS_BORDER,
WS_EX_NOPARENTNOTIFY | WS_EX_CLIENTEDGE
LTEXT "State",8,5,132,40,9,0,WS_EX_NOPARENTNOTIFY
EDITTEXT STATE,60,131,133,14,ES_AUTOHSCROLL | NOT WS_BORDER,
WS_EX_NOPARENTNOTIFY | WS_EX_CLIENTEDGE
LTEXT "Country",9,5,152,40,9,0,WS_EX_NOPARENTNOTIFY
EDITTEXT COUNTRY,60,151,133,14,ES_AUTOHSCROLL | NOT WS_BORDER,
WS_EX_NOPARENTNOTIFY | WS_EX_CLIENTEDGE
PUSHBUTTON "Cancel",ID_CANCEL,115,311,47,17,0,WS_EX_NOPARENTNOTIFY
PUSHBUTTON "Apply",ID_SAVE,55,311,47,17,0,WS_EX_NOPARENTNOTIFY
LTEXT "PostCode",10,5,172,40,9,0,WS_EX_NOPARENTNOTIFY
EDITTEXT POSTCODE,60,171,133,14,ES_AUTOHSCROLL | NOT WS_BORDER,
WS_EX_NOPARENTNOTIFY | WS_EX_CLIENTEDGE
LTEXT "Email",11,5,192,40,9,0,WS_EX_NOPARENTNOTIFY
EDITTEXT EMAIL,60,191,133,14,ES_AUTOHSCROLL | NOT WS_BORDER,
WS_EX_NOPARENTNOTIFY | WS_EX_CLIENTEDGE
LTEXT "Website",12,5,212,40,9,0,WS_EX_NOPARENTNOTIFY
EDITTEXT WEBSITE,60,209,133,14,ES_AUTOHSCROLL | NOT WS_BORDER,
WS_EX_NOPARENTNOTIFY | WS_EX_CLIENTEDGE
LTEXT "Phone",13,6,232,40,9,0,WS_EX_NOPARENTNOTIFY
EDITTEXT PHONE,60,231,133,14,ES_AUTOHSCROLL | NOT WS_BORDER,
WS_EX_NOPARENTNOTIFY | WS_EX_CLIENTEDGE
LTEXT "Addiitional Data",14,5,252,50,9,0,WS_EX_NOPARENTNOTIFY
EDITTEXT ADDITIONALDATA,60,251,205,14,ES_AUTOHSCROLL | NOT
WS_BORDER,WS_EX_NOPARENTNOTIFY | WS_EX_CLIENTEDGE
LTEXT "Password",15,5,13,50,9,0,WS_EX_NOPARENTNOTIFY
EDITTEXT IDC_Password,60,12,133,14,ES_AUTOHSCROLL | NOT WS_BORDER,
WS_EX_NOPARENTNOTIFY | WS_EX_CLIENTEDGE
LTEXT "Locator",16,5,49,50,9,0,WS_EX_NOPARENTNOTIFY
EDITTEXT IDC_Locator,60,48,133,14,ES_AUTOHSCROLL | NOT WS_BORDER,
WS_EX_NOPARENTNOTIFY | WS_EX_CLIENTEDGE
END
UIMAINWINDOW DIALOG DISCARDABLE 100, 100, 323, 304
STYLE WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME
CAPTION "BPQ32 UI Utility"
CLASS "UIMAINWINDOW"
FONT 8, "FixedSys"
BEGIN
END
PORTPAGE DIALOG DISCARDABLE 26, 5, 366, 186
STYLE WS_CHILD | WS_VISIBLE
FONT 8, "FixedSys"
BEGIN
LTEXT "Send Beacon Every",IDC_STATIC,17,25,68,14,
SS_CENTERIMAGE
EDITTEXT IDC_INTERVAL,90,26,20,12,ES_AUTOHSCROLL
LTEXT "Minutes to ",IDC_STATIC,117,25,55,14,SS_CENTERIMAGE
EDITTEXT IDC_UIDEST,175,26,59,12,ES_UPPERCASE | ES_AUTOHSCROLL
CONTROL "Send From File",IDC_FROMFILE,"Button",BS_AUTOCHECKBOX |
BS_VCENTER | WS_TABSTOP,17,59,68,13
EDITTEXT IDC_FILENAME,89,58,223,12,ES_AUTOHSCROLL
PUSHBUTTON "Find File",IDC_FILE,316,58,40,12
DEFPUSHBUTTON "Save",IDOK,122,142,40,12
DEFPUSHBUTTON "Test",ID_TEST,205,142,40,12
EDITTEXT IDC_MESSAGE,20,84,294,52,ES_MULTILINE | ES_AUTOVSCROLL |
ES_AUTOHSCROLL | ES_WANTRETURN
LTEXT "",IDC_PORTNAME,12,9,139,14,SS_CENTERIMAGE
LTEXT "Path",IDC_STATIC,17,42,57,14,SS_CENTERIMAGE
EDITTEXT IDC_UIDIGIS,90,42,223,12,ES_UPPERCASE | ES_AUTOHSCROLL
END
/////////////////////////////////////////////////////////////////////////////
//
// Menu
//
IDR_MAINFRAME_MENU MENU DISCARDABLE
BEGIN
POPUP "Window"
BEGIN
MENUITEM "New Terminal Window", ID_NEWWINDOW
MENUITEM "Cascade", ID_WINDOWS_CASCADE
MENUITEM "Tile", ID_WINDOWS_TILE
MENUITEM "Beacon Config", BPQUICONFIG
MENUITEM "Close all BPQ32 Programs", BPQCLOSEALL
END
END
CONS_MENU MENU DISCARDABLE
BEGIN
POPUP "Window"
BEGIN
MENUITEM "New Terminal Window", ID_NEWWINDOW
MENUITEM "Cascade", ID_WINDOWS_CASCADE
MENUITEM "Tile", ID_WINDOWS_TILE
MENUITEM "Beacon Config", BPQUICONFIG
MENUITEM "Close all BPQ32 Programs", BPQCLOSEALL
END
POPUP "Actions"
BEGIN
MENUITEM "Save Nodes to file BPQNODES.DAT", BPQSAVENODES
MENUITEM "Save Registry Configuration", BPQSAVEREG
MENUITEM "Diagnostic Dump to file BPQDUMP", BPQDUMP
MENUITEM "Re-read Rigcontrol Config", SCANRECONFIG
MENUITEM "Re-read APRS Config", APRSRECONFIG
MENUITEM "Start Minimized", BPQSTARTMIN
MENUITEM "Minimize to Notification Area (System Tray)", BPQMINTOTRAY
MENUITEM "Update WL2K Sysop Record", IDD_WL2KSYSOP
END
END
TERM_MENU MENU DISCARDABLE
BEGIN
POPUP "Window"
BEGIN
MENUITEM "New Terminal Window", ID_NEWWINDOW
MENUITEM "Cascade", ID_WINDOWS_CASCADE
MENUITEM "Tile", ID_WINDOWS_TILE
MENUITEM "Beacon Config", BPQUICONFIG
MENUITEM "Close all BPQ32 Programs", BPQCLOSEALL
END
POPUP "Action"
BEGIN
MENUITEM "Connect", BPQCONNECT
MENUITEM "Disconnect", BPQDISCONNECT, GRAYED
END
POPUP "Config"
BEGIN
MENUITEM "Font", ID_SETUP_FONT
MENUITEM "Enable Bells", BPQBELLS
MENUITEM "Strip Linefeeds", BPQStripLF
MENUITEM "Log Output", BPQLogOutput
MENUITEM "Send Disconnected", BPQSendDisconnected
MENUITEM "Chat Terminal Mode (Send Keppalives)", CHATTERM
MENUITEM "Restore Windows on load", ID_WINDOWS_RESTORE
MENUITEM "Beep if input too long", ID_WARNWRAP
MENUITEM "Wrap Input", ID_WRAP
MENUITEM "Flash instead of Beep on Bell", ID_FLASHONBELL
END
POPUP "Edit"
BEGIN
MENUITEM "Copy Output Window", BPQCOPYOUT
MENUITEM "Clear Output Window", BPQCLEAROUT
END
MENUITEM "Help", BPQHELP
END
MON_MENU MENU DISCARDABLE
BEGIN
POPUP "Window"
BEGIN
MENUITEM "New Window", ID_NEWWINDOW
MENUITEM "Cascade", ID_WINDOWS_CASCADE
MENUITEM "Tile", ID_WINDOWS_TILE
MENUITEM "Beacon Config", BPQUICONFIG
MENUITEM "Close all BPQ32 Programs", BPQCLOSEALL
END
POPUP "Monitor"
BEGIN
MENUITEM "Use Local Time", MONLOCALTIME
MENUITEM "Monitor TX", BPQMTX
MENUITEM "Monitor Supervisory", BPQMCOM
MENUITEM "Monitor UI Only", MON_UI_ONLY
MENUITEM "Monitor NODES", BPQMNODES
MENUITEM "Enable Colour", MONCOLOUR
MENUITEM "Log Monitor", BPQLogMonitor
MENUITEM "Trace APRS-IS", MONITORAPRS
MENUITEM "Clear all port flags", StopALLMon
END
POPUP "Edit"
BEGIN
MENUITEM "Copy Monitor Window", BPQCOPYMON
MENUITEM "Clear Monitor Window", BPQCLEARMON
END
MENUITEM "Help", BPQHELP
END
/////////////////////////////////////////////////////////////////////////////
//
// WAVE
//
INCOMINGCALL WAVE MOVEABLE PURE "Ring.wav"
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE DISCARDABLE
BEGIN
"kernelresource.h\0"
"""\r\n"
"BpqTermMDI.h\0"
END
2 TEXTINCLUDE DISCARDABLE
BEGIN
"#include ""afxres.h""\r\n"
"#include ""BpqTermMDI.h""\r\n"
"\0"
END
3 TEXTINCLUDE DISCARDABLE
BEGIN
"#include ""..\\CommonSource\\Versions.h""\r\n"
"#include ""..\\CommonSource\\StdVer.inc""\r\n"
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO DISCARDABLE
BEGIN
"BPQMAINWINDOW", DIALOG
BEGIN
RIGHTMARGIN, 360
END
IDD_WL2KSYSOP, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 270
TOPMARGIN, 7
BOTTOMMARGIN, 348
END
END
#endif // APSTUDIO_INVOKED
#endif // English (U.K.) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
#include "..\CommonSource\Versions.h"
#include "..\StdVer.inc"
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED
//Microsoft Developer Studio generated resource script.
//
#include "kernelresource.h"
#define CKernel
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"
#include "BpqTermMDI.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (U.K.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENG)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK
#pragma code_page(1252)
#endif //_WIN32
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
BPQMAINWINDOW DIALOG DISCARDABLE 17, 25, 382, 300
STYLE DS_3DLOOK | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU |
WS_THICKFRAME
CAPTION "BPQ32 Console"
CLASS "BPQMAINWINDOW"
FONT 8, "Fixedsys"
BEGIN
LTEXT "",IDC_BACKGROUND,22,20,337,273
CONTROL "",IDC_ENIGATE,"Button",BS_AUTOCHECKBOX | BS_LEFTTEXT |
WS_TABSTOP,57,0,8,12
LTEXT "IGate State - Disconnected",IGATESTATE,69,0,110,12,
SS_CENTERIMAGE
LTEXT "IGATE Stats - Msgs 0 Local Stns 0",IGATESTATS,180,0,
152,12,SS_CENTERIMAGE
LISTBOX BPQCONSOLE,1,17,359,262,LBS_NOINTEGRALHEIGHT |
LBS_DISABLENOSCROLL | LBS_NOSEL | WS_VSCROLL |
WS_HSCROLL
LTEXT "GPS Off",IDC_GPS,332,0,40,12,SS_CENTERIMAGE
LTEXT "Enable IGate",IDC_STATIC,5,2,49,10
END
CONFIG DIALOGEX 249, 200, 160, 118
STYLE DS_MODALFRAME | DS_3DLOOK | WS_POPUP | WS_CAPTION
EXSTYLE WS_EX_DLGMODALFRAME | WS_EX_WINDOWEDGE
CAPTION "Configuration"
CLASS "CONFIG"
FONT 8, "MS Shell Dlg", 0, 0, 0x1
BEGIN
EDITTEXT 1001,50,5,43,14,ES_AUTOHSCROLL | NOT WS_BORDER,
WS_EX_NOPARENTNOTIFY | WS_EX_CLIENTEDGE
EDITTEXT 1002,50,25,100,14,ES_AUTOHSCROLL | NOT WS_BORDER,
WS_EX_NOPARENTNOTIFY | WS_EX_CLIENTEDGE
EDITTEXT 1003,50,65,43,14,ES_AUTOHSCROLL | NOT WS_BORDER,
WS_EX_NOPARENTNOTIFY | WS_EX_CLIENTEDGE
LTEXT "Call",1,10,5,21,18,0,WS_EX_NOPARENTNOTIFY
LTEXT "Host",2,10,25,30,20,0,WS_EX_NOPARENTNOTIFY
LTEXT "UDP Port",3,10,65,32,15,0,WS_EX_NOPARENTNOTIFY
PUSHBUTTON "Cancel",ID_CANCEL,15,95,35,14,0,WS_EX_NOPARENTNOTIFY
PUSHBUTTON "Apply",ID_SAVE,55,95,35,14,0,WS_EX_NOPARENTNOTIFY
CONTROL "UDP Flag ",1004,"Button",BS_AUTOCHECKBOX | BS_LEFT |
WS_TABSTOP,8,45,50,14,WS_EX_RIGHT
CONTROL "Broadcast Flag ",1005,"Button",BS_AUTOCHECKBOX |
BS_LEFT | WS_TABSTOP,68,45,70,14,WS_EX_RIGHT
END
IDD_WL2KSYSOP DIALOGEX 0, 0, 277, 355
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "WL2K Sysop Record Update"
FONT 8, "MS Sans Serif"
BEGIN
LTEXT "Name",3,5,31,28,10,0,WS_EX_NOPARENTNOTIFY
EDITTEXT NAME,60,30,64,12,ES_AUTOHSCROLL | NOT WS_BORDER,
WS_EX_NOPARENTNOTIFY | WS_EX_CLIENTEDGE
LTEXT "Address Line 1",6,5,72,50,9,0,WS_EX_NOPARENTNOTIFY
EDITTEXT ADDR1,60,71,133,14,ES_AUTOHSCROLL | NOT WS_BORDER,
WS_EX_NOPARENTNOTIFY | WS_EX_CLIENTEDGE
LTEXT "Address Line 2",7,5,92,50,9,0,WS_EX_NOPARENTNOTIFY
EDITTEXT ADDR2,60,91,133,14,ES_AUTOHSCROLL | NOT WS_BORDER,
WS_EX_NOPARENTNOTIFY | WS_EX_CLIENTEDGE
LTEXT "City",4,5,112,40,9,0,WS_EX_NOPARENTNOTIFY
EDITTEXT CITY,60,111,133,14,ES_AUTOHSCROLL | NOT WS_BORDER,
WS_EX_NOPARENTNOTIFY | WS_EX_CLIENTEDGE
LTEXT "State",8,5,132,40,9,0,WS_EX_NOPARENTNOTIFY
EDITTEXT STATE,60,131,133,14,ES_AUTOHSCROLL | NOT WS_BORDER,
WS_EX_NOPARENTNOTIFY | WS_EX_CLIENTEDGE
LTEXT "Country",9,5,152,40,9,0,WS_EX_NOPARENTNOTIFY
EDITTEXT COUNTRY,60,151,133,14,ES_AUTOHSCROLL | NOT WS_BORDER,
WS_EX_NOPARENTNOTIFY | WS_EX_CLIENTEDGE
PUSHBUTTON "Cancel",ID_CANCEL,115,311,47,17,0,WS_EX_NOPARENTNOTIFY
PUSHBUTTON "Apply",ID_SAVE,55,311,47,17,0,WS_EX_NOPARENTNOTIFY
LTEXT "PostCode",10,5,172,40,9,0,WS_EX_NOPARENTNOTIFY
EDITTEXT POSTCODE,60,171,133,14,ES_AUTOHSCROLL | NOT WS_BORDER,
WS_EX_NOPARENTNOTIFY | WS_EX_CLIENTEDGE
LTEXT "Email",11,5,192,40,9,0,WS_EX_NOPARENTNOTIFY
EDITTEXT EMAIL,60,191,133,14,ES_AUTOHSCROLL | NOT WS_BORDER,
WS_EX_NOPARENTNOTIFY | WS_EX_CLIENTEDGE
LTEXT "Website",12,5,212,40,9,0,WS_EX_NOPARENTNOTIFY
EDITTEXT WEBSITE,60,209,133,14,ES_AUTOHSCROLL | NOT WS_BORDER,
WS_EX_NOPARENTNOTIFY | WS_EX_CLIENTEDGE
LTEXT "Phone",13,6,232,40,9,0,WS_EX_NOPARENTNOTIFY
EDITTEXT PHONE,60,231,133,14,ES_AUTOHSCROLL | NOT WS_BORDER,
WS_EX_NOPARENTNOTIFY | WS_EX_CLIENTEDGE
LTEXT "Addiitional Data",14,5,252,50,9,0,WS_EX_NOPARENTNOTIFY
EDITTEXT ADDITIONALDATA,60,251,205,14,ES_AUTOHSCROLL | NOT
WS_BORDER,WS_EX_NOPARENTNOTIFY | WS_EX_CLIENTEDGE
LTEXT "Password",15,5,13,50,9,0,WS_EX_NOPARENTNOTIFY
EDITTEXT IDC_Password,60,12,133,14,ES_AUTOHSCROLL | NOT WS_BORDER,
WS_EX_NOPARENTNOTIFY | WS_EX_CLIENTEDGE
LTEXT "Locator",16,5,49,50,9,0,WS_EX_NOPARENTNOTIFY
EDITTEXT IDC_Locator,60,48,133,14,ES_AUTOHSCROLL | NOT WS_BORDER,
WS_EX_NOPARENTNOTIFY | WS_EX_CLIENTEDGE
END
UIMAINWINDOW DIALOG DISCARDABLE 100, 100, 323, 304
STYLE WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME
CAPTION "BPQ32 UI Utility"
CLASS "UIMAINWINDOW"
FONT 8, "FixedSys"
BEGIN
END
PORTPAGE DIALOG DISCARDABLE 26, 5, 366, 186
STYLE WS_CHILD | WS_VISIBLE
FONT 8, "FixedSys"
BEGIN
LTEXT "Send Beacon Every",IDC_STATIC,17,25,68,14,
SS_CENTERIMAGE
EDITTEXT IDC_INTERVAL,90,26,20,12,ES_AUTOHSCROLL
LTEXT "Minutes to ",IDC_STATIC,117,25,55,14,SS_CENTERIMAGE
EDITTEXT IDC_UIDEST,175,26,59,12,ES_UPPERCASE | ES_AUTOHSCROLL
CONTROL "Send From File",IDC_FROMFILE,"Button",BS_AUTOCHECKBOX |
BS_VCENTER | WS_TABSTOP,17,59,68,13
EDITTEXT IDC_FILENAME,89,58,223,12,ES_AUTOHSCROLL
PUSHBUTTON "Find File",IDC_FILE,316,58,40,12
DEFPUSHBUTTON "Save",IDOK,122,142,40,12
DEFPUSHBUTTON "Test",ID_TEST,205,142,40,12
EDITTEXT IDC_MESSAGE,20,84,294,52,ES_MULTILINE | ES_AUTOVSCROLL |
ES_AUTOHSCROLL | ES_WANTRETURN
LTEXT "",IDC_PORTNAME,12,9,139,14,SS_CENTERIMAGE
LTEXT "Path",IDC_STATIC,17,42,57,14,SS_CENTERIMAGE
EDITTEXT IDC_UIDIGIS,90,42,223,12,ES_UPPERCASE | ES_AUTOHSCROLL
END
/////////////////////////////////////////////////////////////////////////////
//
// Menu
//
IDR_MAINFRAME_MENU MENU DISCARDABLE
BEGIN
POPUP "Window"
BEGIN
MENUITEM "New Terminal Window", ID_NEWWINDOW
MENUITEM "Cascade", ID_WINDOWS_CASCADE
MENUITEM "Tile", ID_WINDOWS_TILE
MENUITEM "Beacon Config", BPQUICONFIG
MENUITEM "Close all BPQ32 Programs", BPQCLOSEALL
END
END
CONS_MENU MENU DISCARDABLE
BEGIN
POPUP "Window"
BEGIN
MENUITEM "New Terminal Window", ID_NEWWINDOW
MENUITEM "Cascade", ID_WINDOWS_CASCADE
MENUITEM "Tile", ID_WINDOWS_TILE
MENUITEM "Beacon Config", BPQUICONFIG
MENUITEM "Close all BPQ32 Programs", BPQCLOSEALL
END
POPUP "Actions"
BEGIN
MENUITEM "Save Nodes to file BPQNODES.DAT", BPQSAVENODES
MENUITEM "Save Registry Configuration", BPQSAVEREG
MENUITEM "Diagnostic Dump to file BPQDUMP", BPQDUMP
MENUITEM "Re-read Rigcontrol Config", SCANRECONFIG
MENUITEM "Re-read APRS Config", APRSRECONFIG
MENUITEM "Start Minimized", BPQSTARTMIN
MENUITEM "Minimize to Notification Area (System Tray)", BPQMINTOTRAY
MENUITEM "Update WL2K Sysop Record", IDD_WL2KSYSOP
END
END
TERM_MENU MENU DISCARDABLE
BEGIN
POPUP "Window"
BEGIN
MENUITEM "New Terminal Window", ID_NEWWINDOW
MENUITEM "Cascade", ID_WINDOWS_CASCADE
MENUITEM "Tile", ID_WINDOWS_TILE
MENUITEM "Beacon Config", BPQUICONFIG
MENUITEM "Close all BPQ32 Programs", BPQCLOSEALL
END
POPUP "Action"
BEGIN
MENUITEM "Connect", BPQCONNECT
MENUITEM "Disconnect", BPQDISCONNECT, GRAYED
END
POPUP "Config"
BEGIN
MENUITEM "Font", ID_SETUP_FONT
MENUITEM "Enable Bells", BPQBELLS
MENUITEM "Strip Linefeeds", BPQStripLF
MENUITEM "Log Output", BPQLogOutput
MENUITEM "Send Disconnected", BPQSendDisconnected
MENUITEM "Chat Terminal Mode (Send Keppalives)", CHATTERM
MENUITEM "Restore Windows on load", ID_WINDOWS_RESTORE
MENUITEM "Beep if input too long", ID_WARNWRAP
MENUITEM "Wrap Input", ID_WRAP
MENUITEM "Flash instead of Beep on Bell", ID_FLASHONBELL
END
POPUP "Edit"
BEGIN
MENUITEM "Copy Output Window", BPQCOPYOUT
MENUITEM "Clear Output Window", BPQCLEAROUT
END
MENUITEM "Help", BPQHELP
END
MON_MENU MENU DISCARDABLE
BEGIN
POPUP "Window"
BEGIN
MENUITEM "New Window", ID_NEWWINDOW
MENUITEM "Cascade", ID_WINDOWS_CASCADE
MENUITEM "Tile", ID_WINDOWS_TILE
MENUITEM "Beacon Config", BPQUICONFIG
MENUITEM "Close all BPQ32 Programs", BPQCLOSEALL
END
POPUP "Monitor"
BEGIN
MENUITEM "Use Local Time", MONLOCALTIME
MENUITEM "Monitor TX", BPQMTX
MENUITEM "Monitor Supervisory", BPQMCOM
MENUITEM "Monitor UI Only", MON_UI_ONLY
MENUITEM "Monitor NODES", BPQMNODES
MENUITEM "Enable Colour", MONCOLOUR
MENUITEM "Log Monitor", BPQLogMonitor
MENUITEM "Trace APRS-IS", MONITORAPRS
MENUITEM "Clear all port flags", StopALLMon
END
POPUP "Edit"
BEGIN
MENUITEM "Copy Monitor Window", BPQCOPYMON
MENUITEM "Clear Monitor Window", BPQCLEARMON
END
MENUITEM "Help", BPQHELP
END
/////////////////////////////////////////////////////////////////////////////
//
// WAVE
//
INCOMINGCALL WAVE MOVEABLE PURE "Ring.wav"
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE DISCARDABLE
BEGIN
"kernelresource.h\0"
"""\r\n"
"BpqTermMDI.h\0"
END
2 TEXTINCLUDE DISCARDABLE
BEGIN
"#include ""afxres.h""\r\n"
"#include ""BpqTermMDI.h""\r\n"
"\0"
END
3 TEXTINCLUDE DISCARDABLE
BEGIN
"#include ""..\\CommonSource\\Versions.h""\r\n"
"#include ""..\\CommonSource\\StdVer.inc""\r\n"
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO DISCARDABLE
BEGIN
"BPQMAINWINDOW", DIALOG
BEGIN
RIGHTMARGIN, 360
END
IDD_WL2KSYSOP, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 270
TOPMARGIN, 7
BOTTOMMARGIN, 348
END
END
#endif // APSTUDIO_INVOKED
#endif // English (U.K.) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
#include "..\CommonSource\Versions.h"
#include "..\StdVer.inc"
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

@ -1,32 +1,32 @@
/* Alloc.h -- Memory allocation functions
2008-03-13
Igor Pavlov
Public domain */
#ifndef __COMMON_ALLOC_H
#define __COMMON_ALLOC_H
#include <stddef.h>
void *MyAlloc(size_t size);
void MyFree(void *address);
#ifdef _WIN32
void SetLargePageSize();
void *MidAlloc(size_t size);
void MidFree(void *address);
void *BigAlloc(size_t size);
void BigFree(void *address);
#else
#define MidAlloc(size) MyAlloc(size)
#define MidFree(address) MyFree(address)
#define BigAlloc(size) MyAlloc(size)
#define BigFree(address) MyFree(address)
#endif
#endif
/* Alloc.h -- Memory allocation functions
2008-03-13
Igor Pavlov
Public domain */
#ifndef __COMMON_ALLOC_H
#define __COMMON_ALLOC_H
#include <stddef.h>
void *MyAlloc(size_t size);
void MyFree(void *address);
#ifdef _WIN32
void SetLargePageSize();
void *MidAlloc(size_t size);
void MidFree(void *address);
void *BigAlloc(size_t size);
void BigFree(void *address);
#else
#define MidAlloc(size) MyAlloc(size)
#define MidFree(address) MyFree(address)
#define BigAlloc(size) MyAlloc(size)
#define BigFree(address) MyFree(address)
#endif
#endif

@ -1,230 +1,230 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8.00"
Name="BPQWinAPP"
ProjectGUID="{005A91EA-3A00-4FB4-ADD9-EB78DBFA2B81}"
RootNamespace="BPQWinAPP"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="C:\Dev\Msdev200\$(SolutionName)\$(ProjectName)\$(ConfigurationName)"
IntermediateDirectory="C:\Dev\Msdev2005\Intermed\$(SolutionName)\$(ProjectName)\$(ConfigurationName)"
ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="_DEBUG"
MkTypLibCompatible="true"
SuppressStartupBanner="true"
TargetEnvironment="1"
TypeLibraryName=".\Debug/BPQWinAPP.tlb"
HeaderFileName=""
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="C:\Users\johnw\OneDrive\Dev\Source\bpq32\Commonsource;C:\Users\johnw\OneDrive\Dev\Source\bpq32\CInclude"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS"
MinimalRebuild="true"
RuntimeLibrary="1"
PrecompiledHeaderFile=".\Debug/BPQWinAPP.pch"
AssemblerListingLocation="$(IntDir)\"
ObjectFile="$(IntDir)\"
ProgramDataBaseFileName="$(IntDir)\"
WarningLevel="3"
SuppressStartupBanner="true"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG"
Culture="2057"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="..\lib\bpq32.lib DbgHelp.lib"
OutputFile="c:\DevProgs\bpq32\bpq32.exe"
LinkIncremental="1"
SuppressStartupBanner="true"
GenerateDebugInformation="true"
ProgramDatabaseFile=".\Debug/bpq32.pdb"
GenerateMapFile="true"
SubSystem="2"
StackReserveSize="0"
StackCommitSize="0"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
SuppressStartupBanner="true"
OutputFile=".\Debug/BPQWinAPP.bsc"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="C:\Dev\Msdev2005\Intermed\$(SolutionName)\$(ProjectName)\$(ConfigurationName)"
IntermediateDirectory="C:\Dev\Msdev2005\Intermed\$(SolutionName)\$(ProjectName)\$(ConfigurationName)"
ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="NDEBUG"
MkTypLibCompatible="true"
SuppressStartupBanner="true"
TargetEnvironment="1"
TypeLibraryName=".\Release/BPQWinAPP.tlb"
HeaderFileName=""
/>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
InlineFunctionExpansion="1"
AdditionalIncludeDirectories="C:\Users\johnw\OneDrive\Dev\Source\bpq32\Commonsource"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
StringPooling="true"
RuntimeLibrary="0"
EnableFunctionLevelLinking="true"
PrecompiledHeaderFile="C:\msdev2005\Intermed\Release/BPQWinAPP.pch"
AssemblerListingLocation="$(IntDir)\"
ObjectFile="$(IntDir)\"
ProgramDataBaseFileName="$(IntDir)\"
WarningLevel="3"
SuppressStartupBanner="true"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="2057"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="..\lib\bpq32.lib DbgHelp.lib"
OutputFile="c:\DevProgs\bpq32\bpq32.exe"
LinkIncremental="1"
SuppressStartupBanner="true"
ProgramDatabaseFile=".\Release/bpq32.pdb"
GenerateMapFile="true"
MapFileName="c:\DevProgs\bpq32\bpq32app.map"
SubSystem="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
SuppressStartupBanner="true"
OutputFile=".\Release/BPQWinAPP.bsc"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cxx;rc;def;r;odl;hpj;bat;for;f90"
>
<File
RelativePath=".\BPQWinAPP.c"
>
</File>
<File
RelativePath=".\BPQWinAPP.rc"
>
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8.00"
Name="BPQWinAPP"
ProjectGUID="{005A91EA-3A00-4FB4-ADD9-EB78DBFA2B81}"
RootNamespace="BPQWinAPP"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="C:\Dev\Msdev200\$(SolutionName)\$(ProjectName)\$(ConfigurationName)"
IntermediateDirectory="C:\Dev\Msdev2005\Intermed\$(SolutionName)\$(ProjectName)\$(ConfigurationName)"
ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="_DEBUG"
MkTypLibCompatible="true"
SuppressStartupBanner="true"
TargetEnvironment="1"
TypeLibraryName=".\Debug/BPQWinAPP.tlb"
HeaderFileName=""
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="C:\Users\johnw\OneDrive\Dev\Source\bpq32\Commonsource;C:\Users\johnw\OneDrive\Dev\Source\bpq32\CInclude"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS"
MinimalRebuild="true"
RuntimeLibrary="1"
PrecompiledHeaderFile=".\Debug/BPQWinAPP.pch"
AssemblerListingLocation="$(IntDir)\"
ObjectFile="$(IntDir)\"
ProgramDataBaseFileName="$(IntDir)\"
WarningLevel="3"
SuppressStartupBanner="true"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG"
Culture="2057"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="..\lib\bpq32.lib DbgHelp.lib"
OutputFile="c:\DevProgs\bpq32\bpq32.exe"
LinkIncremental="1"
SuppressStartupBanner="true"
GenerateDebugInformation="true"
ProgramDatabaseFile=".\Debug/bpq32.pdb"
GenerateMapFile="true"
SubSystem="2"
StackReserveSize="0"
StackCommitSize="0"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
SuppressStartupBanner="true"
OutputFile=".\Debug/BPQWinAPP.bsc"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="C:\Dev\Msdev2005\Intermed\$(SolutionName)\$(ProjectName)\$(ConfigurationName)"
IntermediateDirectory="C:\Dev\Msdev2005\Intermed\$(SolutionName)\$(ProjectName)\$(ConfigurationName)"
ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="NDEBUG"
MkTypLibCompatible="true"
SuppressStartupBanner="true"
TargetEnvironment="1"
TypeLibraryName=".\Release/BPQWinAPP.tlb"
HeaderFileName=""
/>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
InlineFunctionExpansion="1"
AdditionalIncludeDirectories="C:\Users\johnw\OneDrive\Dev\Source\bpq32\Commonsource"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
StringPooling="true"
RuntimeLibrary="0"
EnableFunctionLevelLinking="true"
PrecompiledHeaderFile="C:\msdev2005\Intermed\Release/BPQWinAPP.pch"
AssemblerListingLocation="$(IntDir)\"
ObjectFile="$(IntDir)\"
ProgramDataBaseFileName="$(IntDir)\"
WarningLevel="3"
SuppressStartupBanner="true"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="2057"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="..\lib\bpq32.lib DbgHelp.lib"
OutputFile="c:\DevProgs\bpq32\bpq32.exe"
LinkIncremental="1"
SuppressStartupBanner="true"
ProgramDatabaseFile=".\Release/bpq32.pdb"
GenerateMapFile="true"
MapFileName="c:\DevProgs\bpq32\bpq32app.map"
SubSystem="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
SuppressStartupBanner="true"
OutputFile=".\Release/BPQWinAPP.bsc"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cxx;rc;def;r;odl;hpj;bat;for;f90"
>
<File
RelativePath=".\BPQWinAPP.c"
>
</File>
<File
RelativePath=".\BPQWinAPP.rc"
>
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

@ -1,48 +1,48 @@
/*
Copyright 2001-2015 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 "CHeaders.h"
#include "tncinfo.h"
//int SENDNODES() {return 0;}
//int BYECMD() {return 0;}
//int CMDR00() {return 0;}
//int DoNetromConnect() {return 0;}
//int CMDC00() {return 0;}
//int CheckReceivedData() {return 0;}
//int GetLastError() {return 0;}
VOID i2c_smbus_write_byte()
{
}
VOID i2c_smbus_read_byte()
{
}
/*
Copyright 2001-2015 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 "CHeaders.h"
#include "tncinfo.h"
//int SENDNODES() {return 0;}
//int BYECMD() {return 0;}
//int CMDR00() {return 0;}
//int DoNetromConnect() {return 0;}
//int CMDC00() {return 0;}
//int CheckReceivedData() {return 0;}
//int GetLastError() {return 0;}
VOID i2c_smbus_write_byte()
{
}
VOID i2c_smbus_read_byte()
{
}

@ -1,24 +1,24 @@
#include <stdio.h>
#include <windows.h>
/*
* TST_PG.C
*
* Little test program of "PG" command for FBB BBS software.
*
* (C) F6FBB 1991.
*
* FBB software 5.14 and up.
*
*
* This program echoes to the user what he types
* or executes a BBS command preceded by "CMD"
* until "BYE" is received
*/
main(int argc, char **argv)
{
Sleep(10000);
return 0;
#include <stdio.h>
#include <windows.h>
/*
* TST_PG.C
*
* Little test program of "PG" command for FBB BBS software.
*
* (C) F6FBB 1991.
*
* FBB software 5.14 and up.
*
*
* This program echoes to the user what he types
* or executes a BBS command preceded by "CMD"
* until "BYE" is received
*/
main(int argc, char **argv)
{
Sleep(10000);
return 0;
}

@ -1,406 +1,406 @@
/*
Copyright 2001-2015 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
*/
//
// Implements the DOS register based API.
// Called via an assmbler glue that puts registers into C variables.
#define _CRT_SECURE_NO_DEPRECATE
#pragma data_seg("_BPQDATA")
#include "time.h"
#include "stdio.h"
#include <fcntl.h>
#include "compatbits.h"
#include "cheaders.h"
extern QCOUNT;
extern BPQVECSTRUC BPQHOSTVECTOR[];
extern int MAJORVERSION;
extern int MINORVERSION;
extern char pgm[256]; // Uninitialised so per process
VOID PostDataAvailable(TRANSPORTENTRY * Session);
DllExport int APIENTRY SendMsg(int stream, char * msg, int len);
DllExport int APIENTRY AllocateStream(int stream);
DllExport int APIENTRY SendRaw(int port, char * msg, int len);
DllExport time_t APIENTRY GetRaw(int stream, char * msg, int * len, int * count);
VOID SENDNODESMSG();
int BTLENGTH;
char BTEXTFLD[256];
int REALTIMETICKS;
VOID CHOSTAPI(ULONG * pEAX, ULONG * pEBX, ULONG * pECX, ULONG * pEDX, VOID ** pESI, VOID ** pEDI)
{
ULONG EAX = *pEAX;
ULONG EBX = *pEBX;
ULONG ECX = *pECX;
ULONG EDX = *pEDX;
VOID * ESI = *pESI;
VOID * EDI = *pEDI;
int Command;
int Stream;
int n;
int Temp;
PBPQVECSTRUC HostVec;
TRANSPORTENTRY * Session;
/*
; COMMANDS SUPPORTED ARE
;
; AH = 0 Get node/switch version number and description. On return
; AH = major version number and AL = minor version number,
; and user's buffer pointed to by ES:ESI is set to the text
; string normally output by the USERS command, eg:
; "G8BPQ Packet Switch Version 4.01 Dev". CX is set to the
; length of the text string.
;
;
; AH = 1 Set application mask to value in DL (or even DX if 16
; applications are ever to be supported).
;
; Set application flag(s) to value in CL (or CX).
; whether user gets connected/disconnected messages issued
; by the node etc.
;
;
; AH = 2 Send frame in ES:ESI (length CX)
;
;
; AH = 3 Receive frame into buffer at ES:ESI, length of frame returned
; in CX. BX returns the number of outstanding frames still to
; be received (ie. after this one) or zero if no more frames
; (ie. this is last one).
;
;
;
; AH = 4 Get stream status. Returns:
;
; CX = 0 if stream disconnected or CX = 1 if stream connected
; DX = 0 if no change of state since last read, or DX = 1 if
; the connected/disconnected state has changed since
; last read (ie. delta-stream status).
;
;
;
; AH = 6 Session control.
;
; CX = 0 Conneect - _APPLMASK in DL
; CX = 1 connect
; CX = 2 disconnect
; CX = 3 return user to node
;
;
; AH = 7 Get buffer counts for stream. Returns:
;
; AX = number of status change messages to be received
; BX = number of frames queued for receive
; CX = number of un-acked frames to be sent
; DX = number of buffers left in node
; SI = number of trace frames queued for receive
;
;AH = 8 Port control/information. Called with a stream number
; in AL returns:
;
; AL = Radio port on which channel is connected (or zero)
; AH = SESSION TYPE BITS
; BX = L2 paclen for the radio port
; CX = L2 maxframe for the radio port
; DX = L4 window size (if L4 circuit, or zero)
; ES:EDI = CALLSIGN
;AH = 9 Fetch node/application callsign & alias. AL = application
; number:
;
; 0 = node
; 1 = BBS
; 2 = HOST
; 3 = SYSOP etc. etc.
;
; Returns string with alias & callsign or application name in
; user's buffer pointed to by ES:ESI length CX. For example:
;
; "WORCS:G8TIC" or "TICPMS:G8TIC-10".
;
;
; AH = 10 Unproto transmit frame. Data pointed to by ES:ESI, of
; length CX, is transmitted as a HDLC frame on the radio
; port (not stream) in AL.
;
;
; AH = 11 Get Trace (RAW Data) Frame into ES:EDI,
; Length to CX, Timestamp to AX
;
;
; AH = 12 Update Switch. At the moment only Beacon Text may be updated
; DX = Function
; 1=update BT. ES:ESI, Len CX = Text
; 2=kick off nodes broadcast
;
; AH = 14 Internal Interface for IP Router
;
; Send frame - to NETROM L3 if DL=0
; to L2 Session if DL<>0
;
;
; AH = 15 Get interval timer
;
*/
Command = (EAX & 0xFFFF) >> 8;
Stream = (EAX & 0xFF);
n = Stream - 1; // API Numbers Streams 1-64
if (n < 0 || n > 63)
n = 64;
HostVec = &BPQHOSTVECTOR[n];
Session = HostVec->HOSTSESSION;
switch (Command)
{
case 0: // Check Loaded/Get Version
EAX = ('P' << 8) | 'B';
EBX = ('Q' << 8) | ' ';
EDX = (MAJORVERSION << 8) | MINORVERSION;
break;
case 1: // Set Appl mAsk
HostVec->HOSTAPPLMASK = EDX; // APPL MASK
HostVec->HOSTAPPLFLAGS = (UCHAR)ECX; // APPL FLAGS
// If either is non-zero, set allocated and Process. This gets round problem with
// stations that don't call allocate stream
if (ECX || EBX)
{
HostVec->HOSTFLAGS |= 0x80; // SET ALLOCATED BIT
HostVec->STREAMOWNER = GetCurrentProcessId();
// Set Program Name
memcpy(&HostVec->PgmName, pgm, 31);
}
break;
case 2: // Send Frame
// ES:ESI = MESSAGE, CX = LENGTH, BX = VECTOR
EAX = SendMsg(Stream, ESI, ECX);
break;
case 3:
// AH = 3 Receive frame into buffer at ES:EDI, length of frame returned
// in CX. BX returns the number of outstanding frames still to
// be received (ie. after this one) or zero if no more frames
// (ie. this is last one).
EAX = GetMsg(Stream, EDI, &ECX, &EBX);
break;
case 4:
// AH = 4 Get stream status. Returns:
// CX = 0 if stream disconnected or CX = 1 if stream connected
// DX = 0 if no change of state since last read, or DX = 1 if
// the connected/disconnected state has changed since
// last read (ie. delta-stream status).
ECX = EDX = 0;
if (HostVec->HOSTFLAGS & 3) //STATE CHANGE BITS
EDX = 1;
if (Session)
ECX = 1;
break;
case 5:
// AH = 5 Ack stream status change
HostVec->HOSTFLAGS &= 0xFC; // Clear Chnage Bits
break;
case 6:
// AH = 6 Session control.
// CX = 0 Conneect - APPLMASK in DL
// CX = 1 connect
// CX = 2 disconnect
// CX = 3 return user to node
SessionControl(Stream, ECX, EDX);
break;
case 7:
// AH = 7 Get buffer counts for stream. Returns:
// AX = number of status change messages to be received
// BX = number of frames queued for receive
// CX = number of un-acked frames to be sent
// DX = number of buffers left in node
// SI = number of trace frames queued for receive
ECX = 0; // unacked frames
EDX = QCOUNT;
ESI = (void *)MONCount(Stream);
EBX = RXCount(Stream);
ECX = TXCount(Stream);
EAX = 0; // Is this right ???
break;
case 8:
// AH = 8 Port control/information. Called with a stream number
// in AL returns:
//
// AL = Radio port on which channel is connected (or zero)
// AH = SESSION TYPE BITS
// BX = L2 paclen for the radio port
// CX = L2 maxframe for the radio port
// DX = L4 window size (if L4 circuit, or zero)
// ES:EDI = CALLSIGN
GetConnectionInfo(Stream, EDI, &EAX, &Temp, &EBX, &ECX, &EDX); // Return the Secure Session Flag rather than not connected
EAX |= Temp <<8;
break;
case 9:
// Not Implemented
break;
case 10:
// AH = 10 Unproto transmit frame. Data pointed to by ES:ESI, of
// length CX, is transmitted as a HDLC frame on the radio
// port (not stream) in AL.
EAX = SendRaw(EAX, ESI, ECX);
return;
case 11:
// AH = 11 Get Trace (RAW Data) Frame into ES:EDI,
// Length to CX, Timestamp to AX
EAX = GetRaw(Stream, EDI, &ECX, &EBX);
break;
case 12:
// Update Switch
if (EDX == 2)
{
SENDNODESMSG();
break;
}
if (EDX == 2)
{
// UPDATE BT
BTLENGTH = ECX;
memcpy(BTEXTFLD, ESI, ECX + 7);
}
break;
case 13:
// BPQALLOC
// AL = 0 = Find Free
// AL != 0 Alloc or Release
if (EAX == 0)
{
EAX = FindFreeStream();
break;
}
if (ECX == 1) // Allocate
{
EAX = AllocateStream(Stream);
break;
}
DeallocateStream(Stream);
break;
case 14:
// AH = 14 Internal Interface for IP Router
// Send frame - to NETROM L3 if DL=0
// to L2 Session if DL<>0
break; // Shouldn't be needed
case 15:
// GETTIME
EAX = REALTIMETICKS;
EBX = 0;
#ifdef EXCLUDEBITS
EBX = (ULONG)ExcludeList;
#endif
break;
}
*pEAX = EAX;
*pEBX = EBX;
*pECX = ECX;
*pEDX = EDX;
*pESI = ESI;
*pEDI = EDI;
return;
}
/*
Copyright 2001-2015 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
*/
//
// Implements the DOS register based API.
// Called via an assmbler glue that puts registers into C variables.
#define _CRT_SECURE_NO_DEPRECATE
#pragma data_seg("_BPQDATA")
#include "time.h"
#include "stdio.h"
#include <fcntl.h>
#include "compatbits.h"
#include "cheaders.h"
extern QCOUNT;
extern BPQVECSTRUC BPQHOSTVECTOR[];
extern int MAJORVERSION;
extern int MINORVERSION;
extern char pgm[256]; // Uninitialised so per process
VOID PostDataAvailable(TRANSPORTENTRY * Session);
DllExport int APIENTRY SendMsg(int stream, char * msg, int len);
DllExport int APIENTRY AllocateStream(int stream);
DllExport int APIENTRY SendRaw(int port, char * msg, int len);
DllExport time_t APIENTRY GetRaw(int stream, char * msg, int * len, int * count);
VOID SENDNODESMSG();
int BTLENGTH;
char BTEXTFLD[256];
int REALTIMETICKS;
VOID CHOSTAPI(ULONG * pEAX, ULONG * pEBX, ULONG * pECX, ULONG * pEDX, VOID ** pESI, VOID ** pEDI)
{
ULONG EAX = *pEAX;
ULONG EBX = *pEBX;
ULONG ECX = *pECX;
ULONG EDX = *pEDX;
VOID * ESI = *pESI;
VOID * EDI = *pEDI;
int Command;
int Stream;
int n;
int Temp;
PBPQVECSTRUC HostVec;
TRANSPORTENTRY * Session;
/*
; COMMANDS SUPPORTED ARE
;
; AH = 0 Get node/switch version number and description. On return
; AH = major version number and AL = minor version number,
; and user's buffer pointed to by ES:ESI is set to the text
; string normally output by the USERS command, eg:
; "G8BPQ Packet Switch Version 4.01 Dev". CX is set to the
; length of the text string.
;
;
; AH = 1 Set application mask to value in DL (or even DX if 16
; applications are ever to be supported).
;
; Set application flag(s) to value in CL (or CX).
; whether user gets connected/disconnected messages issued
; by the node etc.
;
;
; AH = 2 Send frame in ES:ESI (length CX)
;
;
; AH = 3 Receive frame into buffer at ES:ESI, length of frame returned
; in CX. BX returns the number of outstanding frames still to
; be received (ie. after this one) or zero if no more frames
; (ie. this is last one).
;
;
;
; AH = 4 Get stream status. Returns:
;
; CX = 0 if stream disconnected or CX = 1 if stream connected
; DX = 0 if no change of state since last read, or DX = 1 if
; the connected/disconnected state has changed since
; last read (ie. delta-stream status).
;
;
;
; AH = 6 Session control.
;
; CX = 0 Conneect - _APPLMASK in DL
; CX = 1 connect
; CX = 2 disconnect
; CX = 3 return user to node
;
;
; AH = 7 Get buffer counts for stream. Returns:
;
; AX = number of status change messages to be received
; BX = number of frames queued for receive
; CX = number of un-acked frames to be sent
; DX = number of buffers left in node
; SI = number of trace frames queued for receive
;
;AH = 8 Port control/information. Called with a stream number
; in AL returns:
;
; AL = Radio port on which channel is connected (or zero)
; AH = SESSION TYPE BITS
; BX = L2 paclen for the radio port
; CX = L2 maxframe for the radio port
; DX = L4 window size (if L4 circuit, or zero)
; ES:EDI = CALLSIGN
;AH = 9 Fetch node/application callsign & alias. AL = application
; number:
;
; 0 = node
; 1 = BBS
; 2 = HOST
; 3 = SYSOP etc. etc.
;
; Returns string with alias & callsign or application name in
; user's buffer pointed to by ES:ESI length CX. For example:
;
; "WORCS:G8TIC" or "TICPMS:G8TIC-10".
;
;
; AH = 10 Unproto transmit frame. Data pointed to by ES:ESI, of
; length CX, is transmitted as a HDLC frame on the radio
; port (not stream) in AL.
;
;
; AH = 11 Get Trace (RAW Data) Frame into ES:EDI,
; Length to CX, Timestamp to AX
;
;
; AH = 12 Update Switch. At the moment only Beacon Text may be updated
; DX = Function
; 1=update BT. ES:ESI, Len CX = Text
; 2=kick off nodes broadcast
;
; AH = 14 Internal Interface for IP Router
;
; Send frame - to NETROM L3 if DL=0
; to L2 Session if DL<>0
;
;
; AH = 15 Get interval timer
;
*/
Command = (EAX & 0xFFFF) >> 8;
Stream = (EAX & 0xFF);
n = Stream - 1; // API Numbers Streams 1-64
if (n < 0 || n > 63)
n = 64;
HostVec = &BPQHOSTVECTOR[n];
Session = HostVec->HOSTSESSION;
switch (Command)
{
case 0: // Check Loaded/Get Version
EAX = ('P' << 8) | 'B';
EBX = ('Q' << 8) | ' ';
EDX = (MAJORVERSION << 8) | MINORVERSION;
break;
case 1: // Set Appl mAsk
HostVec->HOSTAPPLMASK = EDX; // APPL MASK
HostVec->HOSTAPPLFLAGS = (UCHAR)ECX; // APPL FLAGS
// If either is non-zero, set allocated and Process. This gets round problem with
// stations that don't call allocate stream
if (ECX || EBX)
{
HostVec->HOSTFLAGS |= 0x80; // SET ALLOCATED BIT
HostVec->STREAMOWNER = GetCurrentProcessId();
// Set Program Name
memcpy(&HostVec->PgmName, pgm, 31);
}
break;
case 2: // Send Frame
// ES:ESI = MESSAGE, CX = LENGTH, BX = VECTOR
EAX = SendMsg(Stream, ESI, ECX);
break;
case 3:
// AH = 3 Receive frame into buffer at ES:EDI, length of frame returned
// in CX. BX returns the number of outstanding frames still to
// be received (ie. after this one) or zero if no more frames
// (ie. this is last one).
EAX = GetMsg(Stream, EDI, &ECX, &EBX);
break;
case 4:
// AH = 4 Get stream status. Returns:
// CX = 0 if stream disconnected or CX = 1 if stream connected
// DX = 0 if no change of state since last read, or DX = 1 if
// the connected/disconnected state has changed since
// last read (ie. delta-stream status).
ECX = EDX = 0;
if (HostVec->HOSTFLAGS & 3) //STATE CHANGE BITS
EDX = 1;
if (Session)
ECX = 1;
break;
case 5:
// AH = 5 Ack stream status change
HostVec->HOSTFLAGS &= 0xFC; // Clear Chnage Bits
break;
case 6:
// AH = 6 Session control.
// CX = 0 Conneect - APPLMASK in DL
// CX = 1 connect
// CX = 2 disconnect
// CX = 3 return user to node
SessionControl(Stream, ECX, EDX);
break;
case 7:
// AH = 7 Get buffer counts for stream. Returns:
// AX = number of status change messages to be received
// BX = number of frames queued for receive
// CX = number of un-acked frames to be sent
// DX = number of buffers left in node
// SI = number of trace frames queued for receive
ECX = 0; // unacked frames
EDX = QCOUNT;
ESI = (void *)MONCount(Stream);
EBX = RXCount(Stream);
ECX = TXCount(Stream);
EAX = 0; // Is this right ???
break;
case 8:
// AH = 8 Port control/information. Called with a stream number
// in AL returns:
//
// AL = Radio port on which channel is connected (or zero)
// AH = SESSION TYPE BITS
// BX = L2 paclen for the radio port
// CX = L2 maxframe for the radio port
// DX = L4 window size (if L4 circuit, or zero)
// ES:EDI = CALLSIGN
GetConnectionInfo(Stream, EDI, &EAX, &Temp, &EBX, &ECX, &EDX); // Return the Secure Session Flag rather than not connected
EAX |= Temp <<8;
break;
case 9:
// Not Implemented
break;
case 10:
// AH = 10 Unproto transmit frame. Data pointed to by ES:ESI, of
// length CX, is transmitted as a HDLC frame on the radio
// port (not stream) in AL.
EAX = SendRaw(EAX, ESI, ECX);
return;
case 11:
// AH = 11 Get Trace (RAW Data) Frame into ES:EDI,
// Length to CX, Timestamp to AX
EAX = GetRaw(Stream, EDI, &ECX, &EBX);
break;
case 12:
// Update Switch
if (EDX == 2)
{
SENDNODESMSG();
break;
}
if (EDX == 2)
{
// UPDATE BT
BTLENGTH = ECX;
memcpy(BTEXTFLD, ESI, ECX + 7);
}
break;
case 13:
// BPQALLOC
// AL = 0 = Find Free
// AL != 0 Alloc or Release
if (EAX == 0)
{
EAX = FindFreeStream();
break;
}
if (ECX == 1) // Allocate
{
EAX = AllocateStream(Stream);
break;
}
DeallocateStream(Stream);
break;
case 14:
// AH = 14 Internal Interface for IP Router
// Send frame - to NETROM L3 if DL=0
// to L2 Session if DL<>0
break; // Shouldn't be needed
case 15:
// GETTIME
EAX = REALTIMETICKS;
EBX = 0;
#ifdef EXCLUDEBITS
EBX = (ULONG)ExcludeList;
#endif
break;
}
*pEAX = EAX;
*pEBX = EBX;
*pECX = ECX;
*pEDX = EDX;
*pESI = ESI;
*pEDI = EDI;
return;
}

@ -1,63 +1,63 @@
#define KISSMAXBLOCK 512
// KISS over TCP Slave now allows multiple connections
// so need a struct to keep track of them
typedef struct _KISSTCPSess
{
struct _KISSTCPSesssion * Next;
SOCKET Socket;
UCHAR RXBuffer[KISSMAXBLOCK];
int RXLen;
time_t Timeout;
} KISSTCPSess;
typedef struct tagASYINFO
{
HANDLE idComDev ;
BYTE bPort;
DWORD dwBaudRate ;
SOCKET sock; // for KISS over UDP/TCP
BOOL Connecting; // Kiss over TCP
BOOL Connected; // Kiss over TCP
BOOL Listening; // Kiss over TCP
BOOL Alerted; // Connect Fail Reported
struct sockaddr_in destaddr;
struct PORTCONTROL * Portvector;
UCHAR RXMSG[512]; // Msg being built
UCHAR RXBUFFER[KISSMAXBLOCK]; // Raw chars from Comms
int RXBCOUNT; // chars in RXBUFFER
UCHAR * RXBPTR; // get pointer for RXBUFFER (put ptr is RXBCOUNT)
UCHAR * RXMPTR; // put pointer for RXMSG
BOOL MSGREADY; // Complete msg in RXMSG
BOOL ESCFLAG; // FESC/DLE received
BOOL NEEDCRC; // ETX received, waiting for CRC (NETROM)
int ReopenTimer; // for failed com ports
// We now allow multiple connections to KISS Slave
struct _KISSTCPSess * slaveSessions;
} ASYINFO, *NPASYINFO ;
extern NPASYINFO KISSInfo[MAXBPQPORTS];
#define _fmemset memset
#define _fmemmove memmove
// function prototypes (private)
NPASYINFO CreateKISSINFO( int port, int speed );
BOOL DestroyKISSINFO(NPASYINFO npKISSINFO) ;
int ReadCommBlock(NPASYINFO npKISSINFO, char * lpszBlock, int nMaxLength);
static BOOL WriteCommBlock(NPASYINFO npKISSINFO, char * lpByte, DWORD dwBytesToWrite);
HANDLE OpenConnection(struct PORTCONTROL * PortVector);
BOOL SetupConnection(NPASYINFO npKISSINFO);
BOOL CloseConnection(NPASYINFO npKISSINFO);
#define KISSMAXBLOCK 512
// KISS over TCP Slave now allows multiple connections
// so need a struct to keep track of them
typedef struct _KISSTCPSess
{
struct _KISSTCPSesssion * Next;
SOCKET Socket;
UCHAR RXBuffer[KISSMAXBLOCK];
int RXLen;
time_t Timeout;
} KISSTCPSess;
typedef struct tagASYINFO
{
HANDLE idComDev ;
BYTE bPort;
DWORD dwBaudRate ;
SOCKET sock; // for KISS over UDP/TCP
BOOL Connecting; // Kiss over TCP
BOOL Connected; // Kiss over TCP
BOOL Listening; // Kiss over TCP
BOOL Alerted; // Connect Fail Reported
struct sockaddr_in destaddr;
struct PORTCONTROL * Portvector;
UCHAR RXMSG[512]; // Msg being built
UCHAR RXBUFFER[KISSMAXBLOCK]; // Raw chars from Comms
int RXBCOUNT; // chars in RXBUFFER
UCHAR * RXBPTR; // get pointer for RXBUFFER (put ptr is RXBCOUNT)
UCHAR * RXMPTR; // put pointer for RXMSG
BOOL MSGREADY; // Complete msg in RXMSG
BOOL ESCFLAG; // FESC/DLE received
BOOL NEEDCRC; // ETX received, waiting for CRC (NETROM)
int ReopenTimer; // for failed com ports
// We now allow multiple connections to KISS Slave
struct _KISSTCPSess * slaveSessions;
} ASYINFO, *NPASYINFO ;
extern NPASYINFO KISSInfo[MAXBPQPORTS];
#define _fmemset memset
#define _fmemmove memmove
// function prototypes (private)
NPASYINFO CreateKISSINFO( int port, int speed );
BOOL DestroyKISSINFO(NPASYINFO npKISSINFO) ;
int ReadCommBlock(NPASYINFO npKISSINFO, char * lpszBlock, int nMaxLength);
static BOOL WriteCommBlock(NPASYINFO npKISSINFO, char * lpByte, DWORD dwBytesToWrite);
HANDLE OpenConnection(struct PORTCONTROL * PortVector);
BOOL SetupConnection(NPASYINFO npKISSINFO);
BOOL CloseConnection(NPASYINFO npKISSINFO);

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save

Powered by TurnKey Linux.