Merge branch 'upstream/latest' into debian/latest

This commit is contained in:
Dave Hibberd 2023-08-28 20:39:34 +01:00
commit 95a6ab069f
No known key found for this signature in database
GPG Key ID: 03A1FB7A1904771B
43 changed files with 32777 additions and 23130 deletions

View File

@ -8061,6 +8061,14 @@ BOOL ProcessBBSConnectScript(CIRCUIT * conn, char * Buffer, int len)
now %= 86400;
Line = Scripts[n];
// Skip comments
while (Line && ((strcmp(Line, " ") == 0 || Line[0] == ';' || Line[0] == '#')))
{
n++;
Line = Scripts[n];
}
if (_memicmp(Line, "TIMES", 5) == 0)
{
NextBand:
@ -9668,7 +9676,7 @@ VOID SaveConfig(char * ConfigName)
// Save UI config
for (i=1; i<=32; i++)
for (i=1; i <= GetNumberofPorts(); i++)
{
char Key[100];
@ -10192,7 +10200,7 @@ BOOL GetConfig(char * ConfigName)
GetStringValue(group, "Version", Size);
sscanf(Size,"%d,%d,%d,%d", &LastVer[0], &LastVer[1], &LastVer[2], &LastVer[3]);
for (i=1; i<=32; i++)
for (i =1 ; i <= GetNumberofPorts(); i++)
{
char Key[100];
@ -10654,7 +10662,8 @@ int Disconnected (int Stream)
}
/* ---- TAJ PG SERVER ---- */
if ( conn->UserPointer->Temp->RUNPGPARAMS ) {
if (conn->UserPointer && conn->UserPointer->Temp && conn->UserPointer->Temp->RUNPGPARAMS)
{
printf("Freeing RUNPGPARAMS\n");
free(conn->UserPointer->Temp->RUNPGPARAMS);
conn->UserPointer->Temp->RUNPGPARAMS = NULL;
@ -11870,7 +11879,7 @@ void run_pg( CIRCUIT * conn, struct UserInfo * user )
PROCESS_INFORMATION piProcInfo;
STARTUPINFO siStartInfo;
BOOL bSuccess = FALSE;
DWORD dwRead, dwWritten;
DWORD dwRead;
CHAR chBuf[BUFSIZE];
int index = 0;
int ret = 0;
@ -14526,7 +14535,7 @@ void ProcessSyncModeMessage(CIRCUIT * conn, struct UserInfo * user, char* Buffer
char * BIDptr;
BIDRec * BID;
char *ptr1, *ptr2, *context;
char *ptr2, *context;
// TR AddMessage_1145_G8BPQ 727 1202 440 True
@ -14762,8 +14771,6 @@ void SendRequestSync(CIRCUIT * conn)
char MsgTime[32];
time_t Time = time(NULL);
char * Encoded;
tm = gmtime(&Time);
sprintf_s(Date, sizeof(Date), "%04d%02d%02d%02d%02d%02d",

View File

@ -1097,7 +1097,7 @@
// Disconnect immediately if "Invalid Command" "*** Protocol Error" or "Already Connected" received (.70)
// Check Badword and Reject filters before processing WP Messages
// 6.0.24.1 ?? 2022
// 6.0.24.1 August 2023
// Fix ' in Webmail subject (8)
// Change web buttons to white on black when pressed (10)
@ -1110,10 +1110,13 @@
// Fix Webmail auto-refresh when page exceeds 64K bytes (54)
// Fix Webmail send when using both headers/footers and attachmonts (55)
// Fix R: line corruption on some 64 bit builds
// Dont drop empty lines inm TEXTFORWARDING (61)
// Dont drop empty lines in TEXTFORWARDING (61)
// Dont wait for body prompt for TEXTFORWARDING for SID [PMS-3.2-C$] (62)
// Add forwarding mode SETCALLTOSENDER for PMS Systems that don't accept < in SP (63)
// QtTerm Monitoring fixed for 63 port version of BPQ (69)
// Fix to UI system to support up to 63 ports (79)
// Fix recently introduced crash when "Don't allow new users" is set (81)
// Skip comments before TIMES at start of Connect Script (83)
#include "bpqmail.h"
@ -1711,7 +1714,7 @@ int APIENTRY WinMain(HINSTANCE hInstance,
}
/* ---------- TAJ --PG Server------*/
if ( user->Temp->RUNPGPARAMS ) {
if (user->Temp && user->Temp->RUNPGPARAMS ) {
printf("Also freeing RUNPGARGS\n");
free(user->Temp->RUNPGPARAMS);

15
Bpq32.c
View File

@ -1086,7 +1086,7 @@ along with LinBPQ/BPQ32. If not, see http://www.gnu.org/licenses
// Add ? and * wildcards to NODES command (74)
// Add Port RADIO config parameter (74)
// Version 6.0.24.1 ??
// Version 6.0.24.1 August 2023
// Apply NODES command wildcard to alias as well a call (2)
// Add STOPPORT/STARTPORT to VARA Driver (2)
@ -1115,7 +1115,7 @@ along with LinBPQ/BPQ32. If not, see http://www.gnu.org/licenses
// Fix processing C command if first port driver is SCSPACTROR (20)
// Fix crash in UZ7HO driver if bad raw frame received (21)
// Fix using FLARQ chat mode with FLDIGI ddriover (22)
// Fixed to KISSHF driver (23)
// Fix to KISSHF driver (23)
// Fix for application buffer loss (24)
// Add Web Sockets auto-refresh option for Webmail index page (25)
// Fix FREEDATA driver for compatibility with FreeData TNC version 0.6.4-alpha.3 (25)
@ -1173,7 +1173,16 @@ along with LinBPQ/BPQ32. If not, see http://www.gnu.org/licenses
// Detect loss of DED application (76)
// Fix connects to Application Alias with UZ7HO Driver (76)
// Fix Interlock of ports on same UZ7HO modem. (76)
// Add extended Ports command
// Add extended Ports command (77)
// Fix crash in Linbpq when stdout is redirected to /dev/tty? and stdin ia redirected (78)
// Fix Web Terminal (80)
// Trap ENCRYPTION message from VARA (81)
// Fix processing of the Winlink API /account/exists response (82)
// Fix sending CTEXT to L4 connects to Node when FULL_CTEXT is not set
// Version 6.0.25.?
// Fix 64 bit compatibility problems in SCSTracker and UZ7HO drivers
#define CKernel

View File

@ -321,10 +321,26 @@
<File
RelativePath="..\CommonSource\Cmd.c"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
AssemblerOutput="0"
/>
</FileConfiguration>
</File>
<File
RelativePath="..\CommonSource\CMSAuth.c"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
AssemblerOutput="0"
/>
</FileConfiguration>
</File>
<File
RelativePath="..\CommonSource\CommonCode.c"

View File

@ -0,0 +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=""
WorkingDirectory=""
CommandArguments=""
Attach="false"
DebuggerType="3"
Remote="1"
RemoteMachine="DESKTOP-MHE5LO8"
RemoteCommand=""
HttpUrl=""
PDBPath=""
SQLDebugging=""
Environment=""
EnvironmentMerge="true"
DebuggerFlavor=""
MPIRunCommand=""
MPIRunArguments=""
MPIRunWorkingDirectory=""
ApplicationCommand=""
ApplicationArguments=""
ShimCommand=""
MPIAcceptMode=""
MPIAcceptFilter=""
/>
</Configuration>
<Configuration
Name="Release|Win32"
>
<DebugSettings
Command=""
WorkingDirectory=""
CommandArguments=""
Attach="false"
DebuggerType="3"
Remote="1"
RemoteMachine="DESKTOP-MHE5LO8"
RemoteCommand=""
HttpUrl=""
PDBPath=""
SQLDebugging=""
Environment=""
EnvironmentMerge="true"
DebuggerFlavor=""
MPIRunCommand=""
MPIRunArguments=""
MPIRunWorkingDirectory=""
ApplicationCommand=""
ApplicationArguments=""
ShimCommand=""
MPIAcceptMode=""
MPIAcceptFilter=""
/>
</Configuration>
</Configurations>
</VisualStudioUserFile>

View File

@ -310,7 +310,7 @@ ConfigLine:
return (TRUE);
}
static size_t ExtProc(int fn, int port,unsigned char * buff)
static size_t ExtProc(int fn, int port , PDATAMESSAGE buff)
{
int txlen = 0;
PMSGWITHLEN buffptr;
@ -342,7 +342,7 @@ static size_t ExtProc(int fn, int port,unsigned char * buff)
if (STREAM->ReportDISC)
{
STREAM->ReportDISC = FALSE;
buff[4] = 0;
buff->PORT = 0;
return -1;
}
@ -359,17 +359,15 @@ static size_t ExtProc(int fn, int port,unsigned char * buff)
buffptr=Q_REM(&STREAM->PACTORtoBPQ_Q);
datalen=buffptr->Len;
datalen = (int)buffptr->Len;
buff[4] = 0;
buff[7] = 0xf0;
memcpy(&buff[8],buffptr->Data,datalen); // Data goes to +7, but we have an extra byte
datalen+=8;
buff->PORT = 0; // Compatibility with Kam Driver
buff->PID = 0xf0;
memcpy(&buff->L2DATA, &buffptr->Data[0], datalen); // Data goes to + 7, but we have an extra byte
datalen += sizeof(void *) + 4;
PutLengthinBuffer((PDATAMESSAGE)buff, datalen);
PutLengthinBuffer(buff, datalen);
// buff[5]=(datalen & 0xff);
// buff[6]=(datalen >> 8);
ReleaseBuffer(buffptr);
@ -387,24 +385,27 @@ static size_t ExtProc(int fn, int port,unsigned char * buff)
// Find TNC Record
Stream = buff[4];
Stream = buff->PORT;
if (!TNC->TNCOK)
{
// Send Error Response
buffptr->Len = 36;
memcpy(buffptr->Data, "No Connection to PACTOR TNC\r", 36);
PMSGWITHLEN buffptr = (PMSGWITHLEN)GetBuff();
C_Q_ADD(&STREAM->PACTORtoBPQ_Q, buffptr);
if (buffptr == 0) return (0); // No buffers, so ignore
buffptr->Len = 27;
memcpy(&buffptr->Data[0], "No Connection to PACTOR TNC\r", 27);
C_Q_ADD(&TNC->Streams[Stream].PACTORtoBPQ_Q, buffptr);
return 0;
}
txlen = GetLengthfromBuffer((PDATAMESSAGE)buff) - 8;
txlen = GetLengthfromBuffer(buff) - (sizeof(void *) + 4);
buffptr->Len = txlen;
memcpy(buffptr->Data, &buff[8], txlen);
memcpy(&buffptr->Data[0], &buff->L2DATA[0], txlen);
C_Q_ADD(&STREAM->BPQtoPACTOR_Q, buffptr);
@ -415,7 +416,7 @@ static size_t ExtProc(int fn, int port,unsigned char * buff)
case 3: // CHECK IF OK TO SEND. Also used to check if TNC is responding
Stream = (int)buff;
Stream = (int)(size_t)buff;
if (STREAM->FramesQueued > 4)
return (1 | TNC->HostMode << 8);
@ -463,7 +464,7 @@ static int WebProc(struct TNCINFO * TNC, char * Buff, BOOL LOCAL)
}
UINT HALExtInit(EXTPORTDATA * PortEntry)
VOID * HALExtInit(EXTPORTDATA * PortEntry)
{
char msg[500];
struct TNCINFO * TNC;
@ -471,8 +472,9 @@ UINT HALExtInit(EXTPORTDATA * PortEntry)
char * ptr;
int len;
char Msg[80];
#ifndef LINBPQ
HWND x;
#endif
//
// Will be called once for each Pactor Port
// The COM port number is in IOBASE
@ -493,7 +495,7 @@ UINT HALExtInit(EXTPORTDATA * PortEntry)
sprintf(msg," ** Error - no info in BPQ32.cfg for this port");
WritetoConsole(msg);
return (int)ExtProc;
return ExtProc;
}
TNC->Port = port;
@ -598,7 +600,7 @@ UINT HALExtInit(EXTPORTDATA * PortEntry)
WritetoConsole("\n");
return ((int)ExtProc);
return ExtProc;
}
@ -1401,7 +1403,7 @@ CmdLoop:
return; // Wait for more
Call = &TNC->CmdBuffer[1];
Used = strlen(Call) + 2; // Opcode and Null
Used = (int)strlen(Call) + 2; // Opcode and Null
UpdateMH(TNC, Call, '!', 0);
@ -1458,7 +1460,7 @@ CmdLoop:
return; // Wait for more
Call = &TNC->CmdBuffer[1];
Used = strlen(Call) + 2; // Opcode and Null
Used = (int)strlen(Call) + 2; // Opcode and Null
HALConnected(TNC, Call);

1903
HALDriver.c.bak Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1444,7 +1444,7 @@ CmdLoop:
return; // Wait for more
Call = &TNC->CmdBuffer[1];
Used = (int)strlen(Call) + 2; // Opcode and Null
Used = strlen(Call) + 2; // Opcode and Null
// Could possibly be used for APPLCALLS by changing MYCALL when we see a call to one of our calls

1907
HALDriver64.c.bak Normal file

File diff suppressed because it is too large Load Diff

View File

@ -752,7 +752,7 @@ IdTag (random alphanumeric, 12 chars)
SendHTTPRequest(sock, "/account/exists", Message, Len, Response);
closesocket(sock);
if (strstr(Response, "false"))
if (strstr(Response, "\"CallsignExists\":false"))
{
WritetoConsole("WL2K Traffic Reporting disabled - Gateway ");
WritetoConsole(ADIF->CMSCall);
@ -959,7 +959,7 @@ VOID SendHTTPReporttoWL2KThread(void * unused)
SendHTTPRequest(sock, "/account/exists", Message, Len, Response);
closesocket(sock);
if (strstr(Response, "false"))
if (strstr(Response, "\"CallsignExists\":false"))
{
WritetoConsole("WL2K Reporting disabled - Gateway ");
WritetoConsole(WL2KReport->BaseCall);

View File

@ -1645,7 +1645,7 @@ int InnerProcessHTTPMessage(struct ConnectionInfo * conn)
HostPtr = strstr(MsgPtr, "Host: ");
WebSock = strstr(MsgPtr, "Upgrade");
WebSock = strstr(MsgPtr, "Upgrade: websocket");
if (HostPtr)
{

4849
HTTPcode.c.bak Normal file

File diff suppressed because it is too large Load Diff

View File

@ -3044,7 +3044,7 @@ int rt_cmd(ChatCIRCUIT *circuit, char * Buffer)
nputs(circuit, "/T Name - Join Topic or Create new Topic. Topic Names are not case sensitive\r/P - Show Ports and Links.\r");
nprintf(circuit, "/A - Toggle Alert on user join - %s.\r",
(user->rtflags & u_bells) ? "Enabled" : "Disabled");
nprintf(circuit, "/C - Toggle Colour Mode on or off (only works on Console or BPQTerminal - %s.\r",
nprintf(circuit, "/C - Toggle Colour Mode on or off (only works on Console or BPQTerm/TermTCP/QtTermTCP - %s.\r",
(user->rtflags & u_colour) ? "Enabled" : "Disabled");
nputs(circuit, "/Codepage CPnnnn - Set Codepage to use if UTF-8 is disabled.\r");
nprintf(circuit, "/E - Toggle Echo - %s .\r",

View File

@ -215,7 +215,7 @@ BEGIN
MENUITEM "Strip Linefeeds", BPQStripLF
MENUITEM "Log Output", BPQLogOutput
MENUITEM "Send Disconnected", BPQSendDisconnected
MENUITEM "Chat Terminal Mode", CHATTERM
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

View File

@ -1417,7 +1417,7 @@ VOID SendConACK(struct _LINKTABLE * LINK, TRANSPORTENTRY * L4, L3MESSAGEBUFFER *
}
if (CTEXTLEN && (Applmask == 0) && FULL_CTEXT) // Any connect, or call to alias
if (CTEXTLEN && Applmask == 0) // Connects to Node (not application)
{
struct DATAMESSAGE * Msg;
int Totallen = CTEXTLEN;

View File

@ -749,7 +749,10 @@ int main(int argc, char * argv[])
// Disable Console Terminal if stdout redirected
if (!isatty(STDOUT_FILENO))
// printf("STDOUT %d\n",isatty(STDOUT_FILENO));
// printf("STDIN %d\n",isatty(STDIN_FILENO));
if (!isatty(STDOUT_FILENO) || !isatty(STDIN_FILENO))
Redirected = 1;
#endif

427
MCP2221.c Normal file
View File

@ -0,0 +1,427 @@
// MCP2221.cpp : This file contains the 'main' function. Program execution begins and ends there.
//
#define _CRT_SECURE_NO_DEPRECATE
#include <stdio.h>
#include <stdlib.h>
#include "time.h"
#include "winstdint.h"
#include "hidapi.h"
void DecodeCM108(int Port, char * ptr);
#ifdef WIN32
/* Simple Raw HID functions for Windows - for use with Teensy RawHID example
* http://www.pjrc.com/teensy/rawhid.html
* Copyright (c) 2009 PJRC.COM, LLC
*
* rawhid_open - open 1 or more devices
* rawhid_recv - receive a packet
* rawhid_send - send a packet
* rawhid_close - close a device
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above description, website URL and copyright notice and this permission
* notice shall be included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* Version 1.0: Initial Release
*/
#include <stdio.h>
#include <stdlib.h>
//#include <stdint.h>
#include <windows.h>
#include <setupapi.h>
//#include <ddk/hidsdi.h>
//#include <ddk/hidclass.h>
typedef USHORT USAGE;
typedef struct _HIDD_CONFIGURATION {
PVOID cookie;
ULONG size;
ULONG RingBufferSize;
} HIDD_CONFIGURATION, *PHIDD_CONFIGURATION;
typedef struct _HIDD_ATTRIBUTES {
ULONG Size;
USHORT VendorID;
USHORT ProductID;
USHORT VersionNumber;
} HIDD_ATTRIBUTES, *PHIDD_ATTRIBUTES;
typedef struct _HIDP_CAPS {
USAGE Usage;
USAGE UsagePage;
USHORT InputReportByteLength;
USHORT OutputReportByteLength;
USHORT FeatureReportByteLength;
USHORT Reserved[17];
USHORT NumberLinkCollectionNodes;
USHORT NumberInputButtonCaps;
USHORT NumberInputValueCaps;
USHORT NumberInputDataIndices;
USHORT NumberOutputButtonCaps;
USHORT NumberOutputValueCaps;
USHORT NumberOutputDataIndices;
USHORT NumberFeatureButtonCaps;
USHORT NumberFeatureValueCaps;
USHORT NumberFeatureDataIndices;
} HIDP_CAPS, *PHIDP_CAPS;
typedef struct _HIDP_PREPARSED_DATA * PHIDP_PREPARSED_DATA;
// a list of all opened HID devices, so the caller can
// simply refer to them by number
typedef struct hid_struct hid_t;
static hid_t *first_hid = NULL;
static hid_t *last_hid = NULL;
struct hid_struct {
HANDLE handle;
int open;
struct hid_struct *prev;
struct hid_struct *next;
};
static HANDLE rx_event=NULL;
static HANDLE tx_event=NULL;
static CRITICAL_SECTION rx_mutex;
static CRITICAL_SECTION tx_mutex;
// private functions, not intended to be used from outside this file
static void add_hid(hid_t *h);
static hid_t * get_hid(int num);
static void free_all_hid(void);
void print_win32_err(void);
// rawhid_recv - receive a packet
// Inputs:
// num = device to receive from (zero based)
// buf = buffer to receive packet
// len = buffer's size
// timeout = time to wait, in milliseconds
// Output:
// number of bytes received, or -1 on error
//
int rawhid_recv(int num, void *buf, int len, int timeout)
{
hid_t *hid;
unsigned char tmpbuf[516];
OVERLAPPED ov;
DWORD r;
int n;
if (sizeof(tmpbuf) < len + 1) return -1;
hid = get_hid(num);
if (!hid || !hid->open) return -1;
EnterCriticalSection(&rx_mutex);
ResetEvent(&rx_event);
memset(&ov, 0, sizeof(ov));
ov.hEvent = rx_event;
if (!ReadFile(hid->handle, tmpbuf, len + 1, NULL, &ov)) {
if (GetLastError() != ERROR_IO_PENDING) goto return_error;
r = WaitForSingleObject(rx_event, timeout);
if (r == WAIT_TIMEOUT) goto return_timeout;
if (r != WAIT_OBJECT_0) goto return_error;
}
if (!GetOverlappedResult(hid->handle, &ov, &n, FALSE)) goto return_error;
LeaveCriticalSection(&rx_mutex);
if (n <= 0) return -1;
n--;
if (n > len) n = len;
memcpy(buf, tmpbuf + 1, n);
return n;
return_timeout:
CancelIo(hid->handle);
LeaveCriticalSection(&rx_mutex);
return 0;
return_error:
print_win32_err();
LeaveCriticalSection(&rx_mutex);
return -1;
}
// rawhid_send - send a packet
// Inputs:
// num = device to transmit to (zero based)
// buf = buffer containing packet to send
// len = number of bytes to transmit
// timeout = time to wait, in milliseconds
// Output:
// number of bytes sent, or -1 on error
//
int rawhid_send(int num, void *buf, int len, int timeout)
{
hid_t *hid;
unsigned char tmpbuf[516];
OVERLAPPED ov;
DWORD n, r;
if (sizeof(tmpbuf) < len + 1) return -1;
hid = get_hid(num);
if (!hid || !hid->open) return -1;
EnterCriticalSection(&tx_mutex);
ResetEvent(&tx_event);
memset(&ov, 0, sizeof(ov));
ov.hEvent = tx_event;
tmpbuf[0] = 0;
memcpy(tmpbuf + 1, buf, len);
if (!WriteFile(hid->handle, tmpbuf, len + 1, NULL, &ov)) {
if (GetLastError() != ERROR_IO_PENDING) goto return_error;
r = WaitForSingleObject(tx_event, timeout);
if (r == WAIT_TIMEOUT) goto return_timeout;
if (r != WAIT_OBJECT_0) goto return_error;
}
if (!GetOverlappedResult(hid->handle, &ov, &n, FALSE)) goto return_error;
LeaveCriticalSection(&tx_mutex);
if (n <= 0) return -1;
return n - 1;
return_timeout:
CancelIo(hid->handle);
LeaveCriticalSection(&tx_mutex);
return 0;
return_error:
print_win32_err();
LeaveCriticalSection(&tx_mutex);
return -1;
}
HANDLE rawhid_open(char * Device)
{
DWORD index=0;
HANDLE h;
hid_t *hid;
int count=0;
if (first_hid) free_all_hid();
if (!rx_event)
{
rx_event = CreateEvent(NULL, TRUE, TRUE, NULL);
tx_event = CreateEvent(NULL, TRUE, TRUE, NULL);
InitializeCriticalSection(&rx_mutex);
InitializeCriticalSection(&tx_mutex);
}
h = CreateFile(Device, GENERIC_READ|GENERIC_WRITE,
FILE_SHARE_READ|FILE_SHARE_WRITE, NULL,
OPEN_EXISTING, FILE_FLAG_OVERLAPPED, NULL);
if (h == INVALID_HANDLE_VALUE)
return 0;
hid = (struct hid_struct *)malloc(sizeof(struct hid_struct));
if (!hid)
{
CloseHandle(h);
return 0;
}
hid->handle = h;
hid->open = 1;
add_hid(hid);
return h;
}
// rawhid_close - close a device
//
// Inputs:
// num = device to close (zero based)
// Output
// (nothing)
//
void rawhid_close(int num)
{
hid_t *hid;
hid = get_hid(num);
if (!hid || !hid->open) return;
CloseHandle(hid->handle);
hid->handle = NULL;
hid->open = FALSE;
}
static void add_hid(hid_t *h)
{
if (!first_hid || !last_hid) {
first_hid = last_hid = h;
h->next = h->prev = NULL;
return;
}
last_hid->next = h;
h->prev = last_hid;
h->next = NULL;
last_hid = h;
}
static hid_t * get_hid(int num)
{
hid_t *p;
for (p = first_hid; p && num > 0; p = p->next, num--) ;
return p;
}
static void free_all_hid(void)
{
hid_t *p, *q;
for (p = first_hid; p; p = p->next)
{
CloseHandle(p->handle);
p->handle = NULL;
p->open = FALSE;
}
p = first_hid;
while (p) {
q = p;
p = p->next;
free(q);
}
first_hid = last_hid = NULL;
}
void print_win32_err(void)
{
char buf[256];
DWORD err;
err = GetLastError();
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, err,
0, buf, sizeof(buf), NULL);
printf("err %ld: %s\n", err, buf);
}
#endif
HANDLE hDevice;
char * HIDDevice;
int main()
{
int Len;
unsigned char Msg[65] = "";
DecodeCM108(0, "0x4D8:0xDD");
hDevice = rawhid_open(HIDDevice);
if (hDevice)
printf("Rigcontrol HID Device %s opened\n", HIDDevice);
Msg[0] = 0x51;
Msg[0] = 0xB0;
Msg[1] = 0x1;
Len = rawhid_send(0, Msg, 64, 100);
Msg[0] = 0;
#ifdef WIN32
Len = rawhid_recv(0, Msg, 64, 100);
#else
Len = read(PORT->hDevice, Msg, 64);
#endif
return 0;
}
char * CM108Device = NULL;
void DecodeCM108(int Port, char * ptr)
{
// Called if Device Name or PTT = Param is CM108
#ifdef WIN32
// Next Param is VID and PID - 0xd8c:0x8 or Full device name
// On Windows device name is very long and difficult to find, so
// easier to use VID/PID, but allow device in case more than one needed
char * next;
int32_t VID = 0, PID = 0;
char product[256];
char sernum[256] = "NULL";
struct hid_device_info *devs, *cur_dev;
const char *path_to_open = NULL;
hid_device *handle = NULL;
if (strlen(ptr) > 16)
CM108Device = _strdup(ptr);
else
{
VID = strtol(ptr, &next, 0);
if (next)
PID = strtol(++next, &next, 0);
// Look for Device
devs = hid_enumerate(0, 0); // so we list devices(USHORT)VID, (USHORT)PID);
cur_dev = devs;
while (cur_dev)
{
wcstombs(product, cur_dev->product_string, 255);
if (cur_dev->serial_number)
wcstombs(sernum, cur_dev->serial_number, 255);
if (product)
printf("HID Device %s VID %X PID %X Ser %s %s\n", product, cur_dev->vendor_id, cur_dev->product_id, sernum, cur_dev->path);
else
printf("HID Device %s VID %X PID %X Ser %s %s", "Missing Product\n", cur_dev->vendor_id, cur_dev->product_id, sernum, cur_dev->path);
if (cur_dev->vendor_id == VID && cur_dev->product_id == PID)
path_to_open = cur_dev->path;
cur_dev = cur_dev->next;
}
if (path_to_open)
{
HIDDevice = _strdup(path_to_open);
}
hid_free_enumeration(devs);
}
#else
// Linux - Next Param HID Device, eg /dev/hidraw0
CM108Device = _strdup(ptr);
#endif
}

203
MCP2221.vcproj Normal file
View File

@ -0,0 +1,203 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8.00"
Name="MCP2221"
ProjectGUID="{FCBB40CD-F7C2-4A97-989A-FC5CEADF7FC1}"
RootNamespace="MCP2221"
Keyword="Win32Proj"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(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="kernel32.lib setupapi.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="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(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=".\hid.c"
>
</File>
<File
RelativePath=".\MCP2221.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>

View File

@ -0,0 +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="DESKTOP-TGEL8RC"
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="DESKTOP-TGEL8RC"
RemoteCommand=""
HttpUrl=""
PDBPath=""
SQLDebugging=""
Environment=""
EnvironmentMerge="true"
DebuggerFlavor=""
MPIRunCommand=""
MPIRunArguments=""
MPIRunWorkingDirectory=""
ApplicationCommand=""
ApplicationArguments=""
ShimCommand=""
MPIAcceptMode=""
MPIAcceptFilter=""
/>
</Configuration>
</Configurations>
</VisualStudioUserFile>

View File

@ -3592,7 +3592,7 @@ ok:
else
{
if (!PORT->AutoPoll)
SendResponse(RIG->Session, "Frequency Set OK");
SendResponse(RIG->Session, "Frequency Set OK");
PORT->Timeout = 0;
}
@ -5286,6 +5286,7 @@ void DecodeCM108(int Port, char * ptr)
char * next;
int32_t VID = 0, PID = 0;
char product[256];
char sernum[256] = "NULL";
struct hid_device_info *devs, *cur_dev;
const char *path_to_open = NULL;
@ -5306,11 +5307,13 @@ void DecodeCM108(int Port, char * ptr)
while (cur_dev)
{
wcstombs(product, cur_dev->product_string, 255);
if (cur_dev->serial_number)
wcstombs(sernum, cur_dev->serial_number, 255);
if (product)
Debugprintf("HID Device %s VID %X PID %X %s", product, cur_dev->vendor_id, cur_dev->product_id, cur_dev->path);
Debugprintf("HID Device %s VID %X PID %X Ser %s %s", product, cur_dev->vendor_id, cur_dev->product_id, sernum, cur_dev->path);
else
Debugprintf("HID Device %s VID %X PID %X %s", "Missing Product", cur_dev->vendor_id, cur_dev->product_id, cur_dev->path);
Debugprintf("HID Device %s VID %X PID %X Ser %s %s", "Missing Product", cur_dev->vendor_id, cur_dev->product_id, sernum, cur_dev->path);
if (cur_dev->vendor_id == VID && cur_dev->product_id == PID)
path_to_open = cur_dev->path;

View File

@ -552,6 +552,12 @@ ok:
txlen = GetLengthfromBuffer(buff) - (MSGHDDRLEN + 1); // 1 as no PID
if (txlen == 1 && buff->L2DATA[0] == 0) // Keepalive Packet
{
ReleaseBuffer(buffptr);
return 0;
}
buffptr->Len = txlen;
memcpy(buffptr->Data, buff->L2DATA, txlen);
@ -1093,6 +1099,56 @@ void SCSCheckRX(struct TNCINFO * TNC)
// complete. If CRC is duff, we will eventually time out and get a retry. The retry code
// can clear the RC buffer
if (TNC->UsingTermMode)
{
// Send response to Host if connected
PMSGWITHLEN buffptr;
int Len = TNC->RXLen;
int Posn = 0;
// First message is probably ACK of JHO4T - AA AA 1F 00 1E 19
if (TNC->RXBuffer[0] == 0xaa && Len > 6)
{
memmove(TNC->RXBuffer, &TNC->RXBuffer[6], Len - 6);
Len -= 6;
}
// TNC seems to send 1e f7 or 1e 87 regularly
while (TNC->RXBuffer[0] == 0x1e && Len > 1)
{
memmove(TNC->RXBuffer, &TNC->RXBuffer[2], Len - 2);
Len -= 2;
}
if (Len == 0)
{
TNC->RXLen = 0; // Ready for next frame
return;
}
while (Len > 250)
{
buffptr = GetBuff();
buffptr->Len = 250;
memcpy(buffptr->Data, &TNC->RXBuffer[Posn], 250);
C_Q_ADD(&TNC->Streams[0].PACTORtoBPQ_Q, buffptr);
Len -= 250;
Posn += 250;
}
buffptr = GetBuff();
buffptr->Len = Len;
memcpy(buffptr->Data, &TNC->RXBuffer[Posn], Len);
C_Q_ADD(&TNC->Streams[0].PACTORtoBPQ_Q, buffptr);
TNC->RXLen = 0; // Ready for next frame
return;
}
if (TNC->RXBuffer[0] != 170)
{
// Char Mode Frame I think we need to see cmd: on end
@ -1247,6 +1303,51 @@ VOID SCSPoll(int Port)
int nn;
struct STREAMINFO * STREAM;
if (TNC->UsingTermMode)
{
if (TNC->Streams[Stream].BPQtoPACTOR_Q)
{
PMSGWITHLEN buffptr = Q_REM(&TNC->Streams[Stream].BPQtoPACTOR_Q);
// See if enter host mode command
if (_memicmp(buffptr->Data, "ENTERHOST\r", buffptr->Len) == 0)
{
TNC->UsingTermMode = FALSE;
memcpy(Poll, "JHOST4\r", 7);
TNC->TXLen = 7;
WriteCommBlock(TNC);
// No response expected
Sleep(10);
Poll[2] = 255; // Channel
TNC->Toggle = 0;
Poll[3] = 0x41;
Poll[4] = 0; // Len-1
Poll[5] = 'G'; // Poll
CRCStuffAndSend(TNC, Poll, 6);
TNC->InternalCmd = FALSE;
TNC->Timeout = 5; // 1/2 sec - In case missed
}
else
{
// Send to TNC
memcpy(&Poll[0], buffptr->Data, buffptr->Len);
TNC->TXLen = buffptr->Len;;
WriteCommBlock(TNC);
}
ReleaseBuffer(buffptr);
}
return;
}
if (TNC->MinLevelTimer)
{
TNC->MinLevelTimer--;
@ -1721,6 +1822,10 @@ VOID SCSPoll(int Port)
// But we cant set digipeated bit in call, so if we find one, skip message
// This doesn't seem to work
/*
ConvFromAX25(Buffer + 7, ICall); // Origin
strlop(ICall, ' ');
@ -1762,7 +1867,7 @@ VOID SCSPoll(int Port)
1, Buffer, // Flag CmdSet as Data
2, TNC->NodeCall); // Flag as Chan 0 Command
}
*/
ReleaseBuffer((UINT *)buffptr);
return;
}
@ -2006,6 +2111,24 @@ VOID SCSPoll(int Port)
return;
}
if ((Stream == 0) && memcmp(Buffer, "EXITHOST", 8) == 0)
{
UCHAR * Poll = TNC->TXBuffer;
TNC->UsingTermMode = 1;
ExitHost(TNC);
// Send CR to get prompt from TNC
Poll[0] = 13;
TNC->TXLen = 1;
WriteCommBlock(TNC);
ReleaseBuffer(buffptr);
return;
}
if (Stream == 0 && Buffer[0] == 'C' && datalen > 2) // Pactor Connect
Poll[2] = TNC->Streams[0].DEDStream = 31; // Pactor Channel
@ -2087,7 +2210,6 @@ VOID SCSPoll(int Port)
}
}
// Anything else send to tnc.
Poll[4] = datalen - 1;
memcpy(&Poll[5], buffptr->Data, datalen);

View File

@ -290,6 +290,9 @@ ConfigLine:
if (_memicmp(buf, "UPDATEMAP", 9) == 0)
TNC->PktUpdateMap = TRUE;
else
if (_memicmp(buf, "TeensyRPR", 9) == 0)
TNC->TeensyRPR = TRUE;
else
if (_memicmp(buf, "WL2KREPORT", 10) == 0)
TNC->WL2K = DecodeWL2KReportLine(buf);
else
@ -1423,7 +1426,7 @@ reinit:
buffptr = Q_REM(&TNC->PortRecord->UI_Q);
datalen = buffptr->LENGTH - 7;
datalen = buffptr->LENGTH - MSGHDDRLEN;
Buffer = &buffptr->DEST[0]; // Raw Frame
Buffer[datalen] = 0;
@ -1655,10 +1658,12 @@ VOID TrkExitHost(struct TNCINFO * TNC)
TNC->TXBuffer[0] = 1;
TNC->TXBuffer[1] = 1;
TNC->TXBuffer[2] = 1;
memcpy(&TNC->TXBuffer[3], "%R", 2);
StuffAndSend(TNC, Poll, 5);
if (!TNC->TeensyRPR) // %R puts TNC into Program Mode.
{
memcpy(&TNC->TXBuffer[3], "%R", 2);
StuffAndSend(TNC, Poll, 5);
}
return;
}

View File

@ -342,7 +342,7 @@ BOOL SendAndCheck(struct ConnectionInfo * sockptr, unsigned char * MsgPtr, int l
VOID SendPortsForMonitor(SOCKET sock, int Secure)
{
UCHAR PortInfo[1500] = {0xff, 0xff};
UCHAR PortInfo[3000] = {0xff, 0xff};
UCHAR * ptr = &PortInfo[2];
char ID[31] = "";
struct PORTCONTROL * PORT;

View File

@ -32,14 +32,14 @@ static char MAILMYCALL[7];
#pragma pack(1)
UINT UIPortMask = 0;
BOOL UIEnabled[33];
BOOL UIMF[33];
BOOL UIHDDR[33];
BOOL UINull[33];
char * UIDigi[33];
char * UIDigiAX[33]; // ax.25 version of digistring
int UIDigiLen[33]; // Length of AX string
uint64_t UIPortMask = 0;
BOOL UIEnabled[MaxBPQPortNo + 1];
BOOL UIMF[MaxBPQPortNo + 1];
BOOL UIHDDR[MaxBPQPortNo + 1];
BOOL UINull[MaxBPQPortNo + 1];
char * UIDigi[MaxBPQPortNo + 1];
char * UIDigiAX[MaxBPQPortNo + 1]; // ax.25 version of digistring
int UIDigiLen[MaxBPQPortNo + 1]; // Length of AX string
@ -52,14 +52,13 @@ struct SEM DGSemaphore = {0, 0}; // For locking access to DG_Q;
VOID UnQueueRaw(void * Param);
static VOID Send_AX_Datagram(UCHAR * Msg, DWORD Len, UCHAR Port, UCHAR * HWADDR, BOOL Queue);
DllExport char * APIENTRY GetApplName(int Appl);
int APIENTRY SendRaw(int port, char * msg, int len);
char * APIENTRY GetApplName(int Appl);
int APIENTRY GetNumberofPorts();
int APIENTRY GetPortNumber(int portslot);
VOID SetupUIInterface()
{
int i, NumPorts = GetNumberofPorts();
int i;
#ifndef LINBPQ
struct _EXCEPTION_POINTERS exinfo;
#endif
@ -70,13 +69,13 @@ VOID SetupUIInterface()
UIPortMask = 0;
for (i = 1; i <= NumPorts; i++)
for (i = 1; i <= MaxBPQPortNo; i++)
{
if (UIEnabled[i])
{
char DigiString[100], * DigiLeft;
UIPortMask |= 1 << (i-1);
UIPortMask |= (uint64_t)1 << (i-1);
UIDigiLen[i] = 0;
if (UIDigi[i])
@ -122,7 +121,7 @@ VOID Free_UI()
int i;
PMESSAGEX AXMSG;
for (i = 1; i <= 32; i++)
for (i = 1; i <= MaxBPQPortNo; i++)
{
if (UIDigi[i])
{
@ -179,18 +178,25 @@ VOID SendMsgUI(struct MsgInfo * Msg)
{
char msg[200];
int len, i;
int Mask = UIPortMask;
int NumPorts = GetNumberofPorts();
uint64_t Mask = UIPortMask;
//12345 B 2053 TEST@ALL F6FBB 920325 This is the subject
char Via[80] = "";
struct tm *tm = gmtime((time_t *)&Msg->datecreated);
len = sprintf_s(msg, sizeof(msg),"%-6d %c %6d %-13s %-6s %02d%02d%02d %s\r",
Msg->number, Msg->type, Msg->length, Msg->to,
if (Msg->via[0])
{
Via[0] = '@';
strcpy(&Via[1], Msg->via);
strlop(Via, '.'); // Only show first part of via
}
len = sprintf_s(msg, sizeof(msg),"%-6d %c %6d %-6s%-7s %-6s %02d%02d%02d %s\r",
Msg->number, Msg->type, Msg->length, Msg->to, Via,
Msg->from, tm->tm_year-100, tm->tm_mon+1, tm->tm_mday, Msg->title);
for (i=1; i <= NumPorts; i++)
for (i=1; i <= MaxBPQPortNo; i++)
{
if ((Mask & 1) && UIHDDR[i])
Send_AX_Datagram(msg, len, i, AXDEST, TRUE);
@ -212,10 +218,19 @@ VOID SendHeaders(int Number, int Port)
while (Number <= LatestMsg)
{
char Via[80] = "";
Msg = FindMessageByNumber(Number);
if (Msg)
{
if (Msg->via[0])
{
Via[0] = '@';
strcpy(&Via[1], Msg->via);
strlop(Via, '.'); // Only show first part of via
}
if (len > (200 - strlen(Msg->title)))
{
Send_AX_Datagram(msg, len, Port, AXDEST, FALSE);
@ -224,8 +239,8 @@ VOID SendHeaders(int Number, int Port)
tm = gmtime((time_t *)&Msg->datecreated);
len += sprintf(&msg[len], "%-6d %c %6d %-13s %-6s %02d%02d%02d %s\r",
Msg->number, Msg->type, Msg->length, Msg->to,
len += sprintf(&msg[len], "%-6d %c %6d %-6s%-7s %-6s %02d%02d%02d %s\r",
Msg->number, Msg->type, Msg->length, Msg->to, Via,
Msg->from, tm->tm_year-100, tm->tm_mon+1, tm->tm_mday, Msg->title);
}
else
@ -248,12 +263,11 @@ VOID SendDummyUI(int num)
{
char msg[100];
int len, i;
int Mask = UIPortMask;
int NumPorts = GetNumberofPorts()
;
uint64_t Mask = UIPortMask;
len = sprintf_s(msg, sizeof(msg),"%-6d #\r", num);
for (i=1; i <= NumPorts; i++)
for (i=1; i <= MaxBPQPortNo; i++)
{
if (Mask & 1)
Send_AX_Datagram(msg, len, i, AXDEST, TRUE);
@ -266,8 +280,7 @@ VOID SendLatestUI(int Port)
{
char msg[20];
int len, i;
int Mask = UIPortMask;
int NumPorts = GetNumberofPorts();
uint64_t Mask = UIPortMask;
len = sprintf_s(msg, sizeof(msg),"%-6d !!\r", LatestMsg);
@ -277,12 +290,12 @@ VOID SendLatestUI(int Port)
return;
}
for (i=1; i <= NumPorts; i++)
for (i = 1; i <= MaxBPQPortNo; i++)
{
if ((Mask & 1) && UIHDDR[i])
if ((Mask & (uint64_t)1) && UIHDDR[i])
Send_AX_Datagram(msg, len, i, AXDEST, TRUE);
Mask>>=1;
Mask >>= 1;
}
}
@ -325,8 +338,6 @@ static VOID Send_AX_Datagram(UCHAR * Msg, DWORD Len, UCHAR Port, UCHAR * HWADDR,
else
SendRaw(Port, (char *)&AXMSG.DEST, Len + 16);
return;
}
VOID UnQueueRaw(void * Param)
@ -366,6 +377,20 @@ VOID ProcessUItoFBB(char * msg, int len, int Port)
int Number, Sum, Sent = 0;
char cksum[3];
int n, i;
// Send_AX_Datagram uses Port Slot, not Port Number
for (n = 1 ; n <= GetNumberofPorts(); n++)
{
i = GetPortNumber(n);
if (i == Port)
{
Port = n;
break;
}
}
if (msg[0] == '?')
{
@ -523,8 +548,7 @@ VOID ExpandMailFor()
VOID SendMailFor(char * Msg, BOOL HaveCalls)
{
int Mask = UIPortMask;
int NumPorts = GetNumberofPorts();
uint64_t Mask = UIPortMask;
int i;
if (!HaveCalls)
@ -532,7 +556,7 @@ VOID SendMailFor(char * Msg, BOOL HaveCalls)
Sleep(1000);
for (i=1; i <= NumPorts; i++)
for (i=1; i <= MaxBPQPortNo; i++)
{
if (Mask & 1)
{

View File

@ -840,7 +840,7 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff)
Sock = TNCInfo[MasterPort[port]]->TCPSock;
MsgLen = buffptr->LENGTH - 6; // 7 Header, need extra Null
MsgLen = buffptr->LENGTH - (MSGHDDRLEN - 1); // Need extra Null
buffptr->LENGTH = 0; // Need a NULL on front
Buffer = &buffptr->DEST[0]; // Raw Frame
Buffer--; // Need to send an extra byte on front
@ -2914,12 +2914,14 @@ UZ7HO T GM8BPQ-2 APRS 1:Fm GM8BPQ-2 To APRS Via WIDE2-2 <UI F pid=F0 Len=28 >[1
AdjMsg = &Monframe; // Adjusted for digis
ptr = strstr(Msg, "Fm ");
if (ptr == 0) return;
ConvToAX25(&ptr[3], Monframe.ORIGIN);
memcpy(MHCall, &ptr[3], 11);
strlop(MHCall, ' ');
ptr = strstr(ptr, "To ");
if (ptr == 0) return;
ConvToAX25(&ptr[3], Monframe.DEST);
@ -2934,6 +2936,8 @@ UZ7HO T GM8BPQ-2 APRS 1:Fm GM8BPQ-2 To APRS Via WIDE2-2 <UI F pid=F0 Len=28 >[1
memcpy(Save, &ptr[4], 60);
ptr = strtok_s(Save, ", ", &context);
if (ptr == 0) return;
DigiLoop:
temp = (char *)AdjMsg;
@ -2952,6 +2956,7 @@ DigiLoop:
AdjMsg->ORIGIN[6] |= 0x80; // Set end of address
ptr = strtok_s(NULL, ", ", &context);
if (ptr == 0) return;
if (ptr[0] != '<')
goto DigiLoop;
@ -3012,18 +3017,21 @@ DigiLoop:
if (memcmp(&ptr[1], "RR", 2) == 0)
{
nrptr = strchr(&ptr[3], '>');
if (nrptr == 0) return;
AdjMsg->CTL = 0x1 | (nrptr[-2] << 5);
}
else
if (memcmp(&ptr[1], "RNR", 3) == 0)
{
nrptr = strchr(&ptr[4], '>');
if (nrptr == 0) return;
AdjMsg->CTL = 0x5 | (nrptr[-2] << 5);
}
else
if (memcmp(&ptr[1], "REJ", 3) == 0)
{
nrptr = strchr(&ptr[4], '>');
if (nrptr == 0) return;
AdjMsg->CTL = 0x9 | (nrptr[-2] << 5);
}
else
@ -3058,12 +3066,18 @@ DigiLoop:
if ((AdjMsg->CTL & 1) == 0 || AdjMsg->CTL == 3) // I or UI
{
ptr = strstr(ptr, "pid");
if (ptr == 0) return;
sscanf(&ptr[4], "%x", (unsigned int *)&AdjMsg->PID);
ptr = strstr(ptr, "Len");
if (ptr == 0) return;
ILen = atoi(&ptr[4]);
ptr = strstr(ptr, "]");
if (ptr == 0) return;
ptr += 2; // Skip ] and cr
memcpy(AdjMsg->L2DATA, ptr, ILen);
Monframe.LENGTH += ILen;
@ -3071,6 +3085,8 @@ DigiLoop:
else if (AdjMsg->CTL == 0x97) // FRMR
{
ptr = strstr(ptr, ">");
if (ptr == 0) return;
sscanf(ptr+1, "%hhx %hhx %hhx", &AdjMsg->PID, &AdjMsg->L2DATA[0], &AdjMsg->L2DATA[1]);
Monframe.LENGTH += 3;
}

7
VARA.c
View File

@ -2269,6 +2269,13 @@ VOID VARAProcessResponse(struct TNCINFO * TNC, UCHAR * Buffer, int MsgLen)
return;
}
if (_memicmp(Buffer, "ENCRYPTION ", 11) == 0)
{
strcat(Buffer, "\r");
WritetoTrace(TNC, Buffer, (int)strlen(Buffer));
return;
}
if (_memicmp(Buffer, "MISSING SOUNDCARD", 17) == 0)
{
strcat(Buffer, "\r");

View File

@ -10,14 +10,14 @@
#endif
#define KVers 6,0,23,77
#define KVerstring "6.0.23.77\0"
#define KVers 6,0,24,2
#define KVerstring "6.0.24.2\0"
#ifdef CKernel
#define Vers KVers
#define Verstring KVerstring
#define Datestring "May 2023"
#define Datestring "August 2023"
#define VerComments "G8BPQ Packet Switch (C Version)" KVerstring
#define VerCopyright "Copyright © 2001-2023 John Wiseman G8BPQ\0"
#define VerDesc "BPQ32 Switch\0"
@ -27,8 +27,8 @@
#ifdef TermTCP
#define Vers 1,0,16,1
#define Verstring "1.0.16.1\0"
#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-2023 John Wiseman G8BPQ\0"
#define VerDesc "Simple TCP Terminal Program for G8BPQ Switch\0"

View File

@ -58,7 +58,7 @@
// Add Connect Scripts
// Improve connect timeouts and add link validation polls
// Version 6.0.24.1 ??
// Version 6.0.24.1 August 23
// Restore CMD_TO_APPL flag to Applflags (13)
// Check for and remove names set to *RTL

View File

@ -34,6 +34,8 @@
#include "asmstrucs.h"
#define MaxBPQPortNo 63 // Port 64 reserved for BBS Mon
#define MAXBPQPORTS 63
#define NEWROUTING

View File

@ -2220,8 +2220,17 @@ L2Packet:
memcpy(BBuffer, Message, Message->LENGTH);
BBuffer->PORT = toPort;
BPORT = GetPortTableEntryFromPortNum(toPort);
if (BPORT)
{
if (BPORT->SmartIDInterval && BPORT->SmartIDNeeded == 0)
{
// Using Smart ID, but none scheduled
BPORT->SmartIDNeeded = time(NULL) + BPORT->SmartIDInterval;
}
PUT_ON_PORT_Q(BPORT, BBuffer);
}
else
ReleaseBuffer(BBuffer);
}

6
kiss.c
View File

@ -492,7 +492,7 @@ HANDLE OpenConnection(struct PORTCONTROL * PortVector)
ASYSEND(PortVector, ENCBUFF, 5);
}
if (KISS->KISSCMD && KISS->KISSCMDLEN)
if (KISS && KISS->KISSCMD && KISS->KISSCMDLEN)
ASYSEND(PortVector, KISS->KISSCMD, KISS->KISSCMDLEN);
@ -1890,9 +1890,7 @@ VOID ConnecttoTCPThread(NPASYINFO ASY)
ioctlsocket (sock, FIONBIO, &param);
// If configured send TNC command
if (KISS->KISSCMD && KISS->KISSCMDLEN)
if (KISS && KISS->KISSCMD && KISS->KISSCMDLEN)
send(sock, KISS->KISSCMD, KISS->KISSCMDLEN, 0);
continue;

View File

@ -626,9 +626,10 @@ typedef struct TNCINFO
HANDLE hDevice;
int ReopenTimer; // Used to reopen device if failed (eg USB port removed)
int ReopenTimer; // Used to reopen device if failed (eg USB port removed)
BOOL HostMode; // Set if in DED Host Mode
// BOOL CRCMode; // Set if using SCS Extended DED Mode (JHOST4)
BOOL UsingTermMode; // Set if tnc should be left in term mode
int Timeout; // Timeout response counter
int Retries;
int Window; // Window Size for ARQ
@ -676,6 +677,7 @@ typedef struct TNCINFO
BOOL Robust; // Set if SCS Tracker is in Robust Packet mode or WINMOR TNC is in Robust Mode
BOOL RobustDefault; // Set if SCS Tracker default is Robust Packet mode
BOOL ForceRobust; // Don't allow Normal Packet even if scan requests it.
BOOL TeensyRPR; // Teensy RPR TNC - don't send %R
char NormSpeed[8]; // Speed Param for Normal Packet on Tracker
char RobustSpeed[8]; // Speed Param for Robust Packet on Tracker
BOOL RPBEACON; // Send Beacon after each session