diff --git a/AEAPactor.c b/AEAPactor.c index f6add0f..62f9cfa 100644 --- a/AEAPactor.c +++ b/AEAPactor.c @@ -68,10 +68,6 @@ char OverMsg[3] = " \x1a"; static RECT Rect; -extern struct TNCINFO * TNCInfo[41]; // Records are Malloc'd - - - static char status[8][8] = {"STANDBY", "PHASING", "CHGOVER", "IDLE", "TRAFFIC", "ERROR", "RQ", "XXXX"}; struct TNCINFO * CreateTTYInfo(int port, int speed); diff --git a/AGWAPI.c b/AGWAPI.c index ba406d5..dd85c48 100644 --- a/AGWAPI.c +++ b/AGWAPI.c @@ -108,7 +108,7 @@ extern int SemHeldByAPI; char szBuff[80]; -static int VisiblePortToRealPort[32]; +static int VisiblePortToRealPort[MaxBPQPortNo + 1]; int SetUpHostSessions(); int DisplaySessions(); diff --git a/APRSCode.c b/APRSCode.c index cda7bb5..1749795 100644 --- a/APRSCode.c +++ b/APRSCode.c @@ -64,7 +64,7 @@ VOID __cdecl Consoleprintf(const char * format, ...); BOOL APIENTRY Send_AX(PMESSAGE Block, DWORD Len, UCHAR Port); VOID Send_AX_Datagram(PDIGIMESSAGE Block, DWORD Len, UCHAR Port); char * strlop(char * buf, char delim); -int APRSDecodeFrame(char * msg, char * buffer, time_t Stamp, UINT Mask); // Unsemaphored DecodeFrame +int APRSDecodeFrame(char * msg, char * buffer, time_t Stamp, uint64_t Mask); // Unsemaphored DecodeFrame APRSHEARDRECORD * UpdateHeard(UCHAR * Call, int Port); BOOL CheckforDups(char * Call, char * Msg, int Len); VOID ProcessQuery(char * Query); @@ -123,7 +123,6 @@ extern int MONDECODE(); extern VOID * zalloc(int len); extern BOOL StartMinimized; -extern char * PortConfig[]; extern char TextVerstring[]; extern HWND hConsWnd; @@ -140,7 +139,7 @@ BOOL APRSWeb = FALSE; void * APPL_Q = 0; // Queue of frames for APRS Appl void * APPLTX_Q = 0; // Queue of frames from APRS Appl -UINT APRSPortMask = 0; +uint64_t APRSPortMask = 0; char APRSCall[10] = ""; char APRSDest[10] = "APBPQ1"; @@ -169,7 +168,7 @@ int WXCounter = 29 * 60; char APRSCall[10]; char LoppedAPRSCall[10]; -BOOL WXPort[32]; // Ports to send WX to +BOOL WXPort[MaxBPQPortNo + 1]; // Ports to send WX to BOOL GPSOK = 0; @@ -230,16 +229,16 @@ extern BOOL IGateEnabled; char StatusMsg[256] = ""; // Must be in shared segment int StatusMsgLen = 0; -char * BeaconPath[33] = {0}; +char * BeaconPath[65] = {0}; -char CrossPortMap[33][33] = {0}; -char APRSBridgeMap[33][33] = {0}; +char CrossPortMap[65][65] = {0}; +char APRSBridgeMap[65][65] = {0}; -UCHAR BeaconHeader[33][10][7] = {""}; // Dest, Source and up to 8 digis -int BeaconHddrLen[33] = {0}; // Actual Length used +UCHAR BeaconHeader[65][10][7] = {""}; // Dest, Source and up to 8 digis +int BeaconHddrLen[65] = {0}; // Actual Length used -UCHAR GatedHeader[33][10][7] = {""}; // Dest, Source and up to 8 digis for messages gated from IS -int GatedHddrLen[33] = {0}; // Actual Length used +UCHAR GatedHeader[65][10][7] = {""}; // Dest, Source and up to 8 digis for messages gated from IS +int GatedHddrLen[65] = {0}; // Actual Length used char CFGSYMBOL = 'a'; @@ -371,7 +370,7 @@ struct OBJECT UCHAR Path[10][7]; // Dest, Source and up to 8 digis int PathLen; // Actual Length used char Message[81]; - char PortMap[33]; + char PortMap[MaxBPQPortNo + 1]; int Interval; int Timer; }; @@ -1221,7 +1220,7 @@ Dll VOID APIENTRY Poll_APRS() continue; } - if ((APRSPortMask & (1 << (Port - 1))) == 0)// Port in use for APRS? + if ((APRSPortMask & ((uint64_t)1 << (Port - 1))) == 0)// Port in use for APRS? { ReleaseBuffer(monbuff); continue; @@ -1296,7 +1295,7 @@ Dll VOID APIENTRY Poll_APRS() // Bridge if requested - for (toPort = 1; toPort <= 32; toPort++) + for (toPort = 1; toPort <= MaxBPQPortNo; toPort++) { if (APRSBridgeMap[Port][toPort]) { @@ -1735,7 +1734,7 @@ static VOID SendtoDigiPorts(PDIGIMESSAGE Block, DWORD Len, UCHAR Port) // Block->CTL = 3; //UI - for (toPort = 1; toPort <= 32; toPort++) + for (toPort = 1; toPort <= MaxBPQPortNo; toPort++) { if (CrossPortMap[Port][toPort]) Send_AX((PMESSAGE)Block, Len, toPort); @@ -1782,7 +1781,7 @@ static BOOL APRSReadConfigFile() char buf[256],errbuf[256]; - Config = PortConfig[34]; // Config fnom bpq32.cfg + Config = PortConfig[APRSConfigSlot]; // Config from bpq32.cfg sprintf(StatusMsg, "BPQ32 Igate V %s", VersionString); // Set Default Status Message @@ -2081,7 +2080,7 @@ static int APRSProcessLine(char * buf) if (GetPortTableEntryFromPortNum(Port) == NULL) return FALSE; - APRSPortMask |= 1 << (Port - 1); + APRSPortMask |= (uint64_t)1 << (Port - 1); if (Context == NULL || Context[0] == 0) return TRUE; // No dest - a receive-only port @@ -2481,7 +2480,7 @@ static int APRSProcessLine(char * buf) char * ptr; int index = 0; - for (index = 0; index < 32; index++) + for (index = 0; index < MaxBPQPortNo; index++) WXPort[index] = FALSE; if (strlen(p_value) > 79) @@ -2536,7 +2535,7 @@ VOID SendAPRSMessageEx(char * Message, int toPort, char * FromCall, int Gated) if (toPort == -1) { - for (Port = 1; Port <= 32; Port++) + for (Port = 1; Port <= MaxBPQPortNo; Port++) { if (Gated && GatedHddrLen[Port]) memcpy(Msg.DEST, &GatedHeader[Port][0][0], 10 * 7); @@ -2757,7 +2756,7 @@ void SendBeaconThread(void * Param) return; } - for (Port = 1; Port <= 32; Port++) // Check all ports + for (Port = 1; Port <= MaxBPQPortNo; Port++) // Check all ports { if (BeaconHddrLen[Port]) // Only send to ports with a DEST defined { @@ -2800,7 +2799,7 @@ VOID SendObject(struct OBJECT * Object) CheckforDups(APRSCall, Object->Message, (int)strlen(Object->Message)); - for (Port = 1; Port <= 32; Port++) + for (Port = 1; Port <= MaxBPQPortNo; Port++) { if (Object->PortMap[Port]) { @@ -2869,7 +2868,7 @@ VOID SendIStatus() Len = sprintf(Msg.L2DATA, " #endif -extern char * PortConfig[33]; extern int SemHeldByAPI; static RECT Rect; -extern struct TNCINFO * TNCInfo[41]; // Records are Malloc'd - static int ProcessLine(char * buf, int Port); @@ -575,9 +572,6 @@ VOID ReleaseOtherPorts(struct TNCINFO * ThisTNC); VOID WritetoTrace(struct TNCINFO * TNC, char * Msg, int Len); - -#define MAXBPQPORTS 32 - static time_t ltime; diff --git a/BBSUtilities.c b/BBSUtilities.c index 255aa97..87d21f0 100644 --- a/BBSUtilities.c +++ b/BBSUtilities.c @@ -302,7 +302,7 @@ void WriteLogLine(CIRCUIT * conn, int Flag, char * Msg, int MsgLen, int Flags) MESSAGE Monframe; memset(&Monframe, 0, sizeof(Monframe)); - Monframe.PORT = 33; + Monframe.PORT = 64; Monframe.LENGTH = 12 + MsgLen; Monframe.DEST[0] = 1; // Plain Text Monitor diff --git a/BPQMail.c b/BPQMail.c index 23b02d3..a4eecaf 100644 --- a/BPQMail.c +++ b/BPQMail.c @@ -1113,8 +1113,11 @@ // Dont drop empty lines inm 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) + #include "bpqmail.h" +#include "winstdint.h" #define MAIL #include "Versions.h" diff --git a/BPQTermMDI.c b/BPQTermMDI.c index 9f80062..9626dc2 100644 --- a/BPQTermMDI.c +++ b/BPQTermMDI.c @@ -158,7 +158,7 @@ int DoStateChange(int Stream); int ToggleFlags(HWND hWnd, int Item, int mask); int CopyScreentoBuffer(char * buff); int DoMonData(int Stream); -int TogglePort(HWND hWnd, int Item, int mask); +int TogglePort(HWND hWnd, int Item, uint64_t mask); int ToggleMTX(HWND hWnd); int ToggleMCOM(HWND hWnd); int ToggleParam(HMENU hMenu, BOOL * Param, int Item); @@ -175,6 +175,7 @@ struct ConsoleInfo * CreateChildWindow(int Stream, BOOL DuringInit); BOOL CreateMonitorWindow(char * MonSize); VOID SaveMDIWindowPos(HWND hWnd, char * RegKey, char * Value, BOOL Minimized); int ToggleMON_UI_ONLY(HWND hWnd); +IntSetTraceOptionsEx(portmask,mtxparam,mcomparam, monUI); COLORREF Colours[256] = {0, RGB(0,0,0), RGB(0,0,128), RGB(0,0,192), RGB(0,0,255), // 1 - 4 @@ -260,7 +261,7 @@ SOCKET sock; BOOL MonData = FALSE; static char Key[80]; -int portmask=1; +uint64_t portmask = 1; int mtxparam=1; int mcomparam=1; int monUI=0; @@ -332,7 +333,7 @@ extern HANDLE hInstance; extern byte MCOM; extern char MTX; -extern ULONG MMASK; +extern uint64_t MMASK; extern byte MUIONLY; HMENU hPopMenu1; @@ -461,7 +462,8 @@ extern int SessHandle; VOID CALLBACK SetupTermSessions(HWND hwnd, UINT uMsg, UINT idEvent, DWORD dwTime) { - int i, n, tempmask=0xffff; + int i, n; + uint64_t tempmask = 0xffff; char msg[50]; int retCode,Type,Vallen; HKEY hKey=0; @@ -529,7 +531,7 @@ VOID CALLBACK SetupTermSessions(HWND hwnd, UINT uMsg, UINT idEvent, DWORD dw retCode = RegQueryValueEx(hKey,"MONUIONLY",0, (ULONG *)&Type,(UCHAR *)&monUI,(ULONG *)&Vallen); - Vallen=4; + Vallen=8; retCode = RegQueryValueEx(hKey,"PortMask",0, (ULONG *)&Type,(UCHAR *)&tempmask,(ULONG *)&Vallen); @@ -612,7 +614,7 @@ VOID CALLBACK SetupTermSessions(HWND hwnd, UINT uMsg, UINT idEvent, DWORD dw sprintf(msg,"Port %d %s ",i, PORT->PORTDESCRIPTION); - if (tempmask & (1<<(i-1))) + if (tempmask & ((uint64_t)1 << (i-1))) AppendMenu(hMonCfgMenu,MF_STRING | MF_CHECKED,BPQBASE + i,msg); else AppendMenu(hMonCfgMenu,MF_STRING | MF_UNCHECKED,BPQBASE + i,msg); @@ -722,7 +724,7 @@ SaveHostSessions() RegCreateKeyEx(REGTREE, Key, 0, 0, 0, KEY_ALL_ACCESS, NULL, &hKey, &disp); RegSetValueEx(hKey,"ChatMode",0,REG_DWORD,(BYTE *)&ChatMode,4); - RegSetValueEx(hKey,"PortMask",0,REG_DWORD,(BYTE *)&portmask,4); + RegSetValueEx(hKey,"PortMask", 0, REG_DWORD, (BYTE *)&portmask, 8); RegSetValueEx(hKey,"Bells",0,REG_DWORD,(BYTE *)&Bells,4); RegSetValueEx(hKey,"StripLF",0,REG_DWORD,(BYTE *)&StripLF,4); RegSetValueEx(hKey,"SendDisconnected",0,REG_DWORD,(BYTE *)&SendDisconnected,4); @@ -1123,7 +1125,7 @@ BOOL InitInstance(HINSTANCE hInstance, int nCmdShow) SetAppl(Stream, applflags, APPLMASK); - SetTraceOptionsEx(portmask,mtxparam,mcomparam, monUI); + IntSetTraceOptionsEx(portmask,mtxparam,mcomparam, monUI); if (MinimizetoTray) { @@ -1501,7 +1503,7 @@ BOOL InitInstancex(HINSTANCE hInstance, int nCmdShow) SetAppl(Stream, applflags, APPLMASK); - SetTraceOptionsEx(portmask,mtxparam,mcomparam, monUI); + IntSetTraceOptionsEx(portmask,mtxparam,mcomparam, monUI); @@ -1682,9 +1684,9 @@ LRESULT CALLBACK MonWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPara wmEvent = HIWORD(wParam); // ...different for Win32! - if (wmId > BPQBASE && wmId < BPQBASE + 33) + if (wmId > BPQBASE && wmId < BPQBASE + 64) { - TogglePort(hWnd, wmId, 0x1 << (wmId - (BPQBASE + 1))); + TogglePort(hWnd, wmId, (uint64_t)1 << (wmId - (BPQBASE + 1))); break; } @@ -4233,7 +4235,7 @@ static CopyScreentoBuffer(char * buff) return (0); } -int TogglePort(HWND hWnd, int Item, int mask) +int TogglePort(HWND hWnd, int Item, uint64_t mask) { portmask ^= mask; @@ -4249,7 +4251,7 @@ int TogglePort(HWND hWnd, int Item, int mask) SetAppl(Stream,applflags,APPLMASK); - SetTraceOptionsEx(portmask,mtxparam,mcomparam, monUI); + IntSetTraceOptionsEx(portmask,mtxparam,mcomparam, monUI); return (0); @@ -4266,7 +4268,7 @@ int ToggleMTX(HWND hWnd) CheckMenuItem(hMonCfgMenu,BPQMTX,MF_UNCHECKED); - SetTraceOptionsEx(portmask,mtxparam,mcomparam, monUI); + IntSetTraceOptionsEx(portmask,mtxparam,mcomparam, monUI); return (0); @@ -4283,7 +4285,7 @@ int ToggleMCOM(HWND hWnd) CheckMenuItem(hMonCfgMenu,BPQMCOM,MF_UNCHECKED); - SetTraceOptionsEx(portmask,mtxparam,mcomparam, monUI); + IntSetTraceOptionsEx(portmask,mtxparam,mcomparam, monUI); return (0); @@ -4300,7 +4302,7 @@ int ToggleMON_UI_ONLY(HWND hWnd) CheckMenuItem(hMonCfgMenu,MON_UI_ONLY,MF_UNCHECKED); - SetTraceOptionsEx(portmask,mtxparam,mcomparam, monUI); + IntSetTraceOptionsEx(portmask,mtxparam,mcomparam, monUI); return (0); diff --git a/BPQtoAGW.c b/BPQtoAGW.c index 9a5f075..247ee03 100644 --- a/BPQtoAGW.c +++ b/BPQtoAGW.c @@ -78,7 +78,6 @@ along with LinBPQ/BPQ32. If not, see http://www.gnu.org/licenses //uintptr_t _beginthread(void( *start_address )( int ), unsigned stack_size, int arglist); //int ResetExtDriver(int num); -extern char * PortConfig[33]; void ConnecttoAGWThread(void * portptr); @@ -117,8 +116,6 @@ static struct AGWHEADER RXHeader; #pragma pack() - -#define MAXBPQPORTS 32 #define MAXAGWPORTS 16 //LOGFONT LFTTYFONT ; diff --git a/Bpq32.c b/Bpq32.c index fcbf015..ba8a8d2 100644 --- a/Bpq32.c +++ b/Bpq32.c @@ -1161,6 +1161,10 @@ along with LinBPQ/BPQ32. If not, see http://www.gnu.org/licenses // Trap NODES messages with empty From Call (65) // Add RigControl for SDRConsole (66) // Fix FLRig crash (66) +// Fix VARA disconnect handling (67) +// Support 64 ports (69) +// Fix Node commands for setting UZ7HO Modem (70) + #define CKernel @@ -1566,7 +1570,7 @@ char PopupText[30][100] = {""}; UCHAR MCOM; UCHAR MTX; -ULONG MMASK; +uint64_t MMASK; UCHAR MUIONLY; UCHAR AuthorisedProgram; // Local Variable. Set if Program is on secure list @@ -2019,7 +2023,7 @@ VOID TimerProcX() GetWindowRect(FrameWnd, &FRect); - SaveWindowPos(40); // Rigcontrol + SaveWindowPos(64); // Rigcontrol for (i=0;i PROTOCOL == 10 && PORT->UICAPABLE == 0) + if (PORT->PROTOCOL == 10 && PORT->UICAPABLE == 0) { Bufferptr = Cmdprintf(Session, Bufferptr, "Sorry, port %d is not an ax.25 port\r", Port); continue; @@ -1763,15 +1762,14 @@ VOID LISTENCMD(TRANSPORTENTRY * Session, char * Bufferptr, char * CmdTail, CMDX sprintf(ListenPortList, "%s %d", ListenPortList, Port); - - ListenMask |= (1 << (Port - 1)); + ListenMask |= ((uint64_t)1 << (Port - 1)); } Session->LISTEN = ListenMask; if (ListenMask) { - if (CountBits(ListenMask) == 1) + if (CountBits64(ListenMask) == 1) Bufferptr = Cmdprintf(Session, Bufferptr, "Listening on port%s. Use CQ to send a beacon, LIS to disable\r", ListenPortList); else Bufferptr = Cmdprintf(Session, Bufferptr, "Listening on ports%s. Use LIS to disable\r", ListenPortList); @@ -1911,7 +1909,7 @@ VOID CQCMD(TRANSPORTENTRY * Session, char * Bufferptr, char * CmdTail, CMDX * CM DIGIMESSAGE Msg; int Port = 0; int OneBits = 0; - unsigned int MaskCopy = Session->LISTEN; + uint64_t MaskCopy = Session->LISTEN; int Len; UCHAR CQCALL[7]; char Empty[] = ""; @@ -4904,8 +4902,6 @@ VOID AXMHEARD(TRANSPORTENTRY * Session, char * Bufferptr, char * CmdTail, CMDX * #pragma pack() -extern struct TNCINFO * TNCInfo[41]; - extern char WL2KCall[10]; extern char WL2KLoc[7]; @@ -5638,6 +5634,8 @@ VOID UZ7HOCMD(TRANSPORTENTRY * Session, char * Bufferptr, char * CmdTail, CMDX * PDATAMESSAGE buff; PMSGWITHLEN buffptr; + CmdTail = CmdTail + (OrigCmdBuffer - COMMANDBUFFER); // Replace with original case version + Cmd = strlop(CmdTail, ' '); port = atoi(CmdTail); @@ -5674,6 +5672,8 @@ VOID UZ7HOCMD(TRANSPORTENTRY * Session, char * Bufferptr, char * CmdTail, CMDX * return; } + + buff->LENGTH = sprintf(buff->L2DATA, "%s\r", Cmd) + MSGHDDRLEN + 1; if (_memicmp(Cmd, "FREQ", 4) == 0) @@ -5688,7 +5688,7 @@ VOID UZ7HOCMD(TRANSPORTENTRY * Session, char * Bufferptr, char * CmdTail, CMDX * ReleaseBuffer(buffptr); } else - Bufferptr = Cmdprintf(Session, Bufferptr, "Invalid UZ7HO Command (not Freq Mode Modem)\r"); + Bufferptr = Cmdprintf(Session, Bufferptr, "Invalid UZ7HO Command (not Freq or Modem)\r"); SendCommandReply(Session, REPLYBUFFER, (int)(Bufferptr - (char *)REPLYBUFFER)); return; diff --git a/CommonCode.c b/CommonCode.c index 1ec3989..1a1dfd6 100644 --- a/CommonCode.c +++ b/CommonCode.c @@ -49,7 +49,7 @@ extern struct CONFIGTABLE xxcfg; #endif -struct TNCINFO * TNCInfo[41]; // Records are Malloc'd +struct TNCINFO * TNCInfo[70]; // Records are Malloc'd extern int ReportTimer; @@ -897,9 +897,6 @@ VOID SetApplPorts() } -extern struct TNCINFO * TNCInfo[41]; // Records are Malloc'd - - char Modenames[19][10] = {"WINMOR", "SCS", "KAM", "AEA", "HAL", "TELNET", "TRK", "V4", "UZ7HO", "MPSK", "FLDIGI", "UIARQ", "ARDOP", "VARA", "SERIAL", "KISSHF", "WINRPR", "HSMODEM", "FREEDATA"}; @@ -3761,23 +3758,23 @@ typedef struct _MESSAGEX #pragma pack() -int PortNum[33] = {0}; // Tab nunber to port +int PortNum[MaxBPQPortNo + 1] = {0}; // Tab nunber to port -char * UIUIDigi[33]= {0}; -char * UIUIDigiAX[33] = {0}; // ax.25 version of digistring -int UIUIDigiLen[33] = {0}; // Length of AX string +char * UIUIDigi[MaxBPQPortNo + 1]= {0}; +char * UIUIDigiAX[MaxBPQPortNo + 1] = {0}; // ax.25 version of digistring +int UIUIDigiLen[MaxBPQPortNo + 1] = {0}; // Length of AX string -char UIUIDEST[33][11] = {0}; // Dest for Beacons +char UIUIDEST[MaxBPQPortNo + 1][11] = {0}; // Dest for Beacons -char UIAXDEST[33][7] = {0}; +char UIAXDEST[MaxBPQPortNo + 1][7] = {0}; -UCHAR FN[33][256]; // Filename -int Interval[33]; // Beacon Interval (Mins) -int MinCounter[33]; // Interval Countdown +UCHAR FN[MaxBPQPortNo + 1][256]; // Filename +int Interval[MaxBPQPortNo + 1]; // Beacon Interval (Mins) +int MinCounter[MaxBPQPortNo + 1]; // Interval Countdown -BOOL SendFromFile[33]; -char Message[33][1000]; // Beacon Text +BOOL SendFromFile[MaxBPQPortNo + 1]; +char Message[MaxBPQPortNo + 1][1000]; // Beacon Text VOID SendUIBeacon(int Port); @@ -3945,7 +3942,7 @@ typedef struct tag_dlghdr HWND hwndDisplay; // current child dialog box RECT rcDisplay; // display rectangle for the tab control - DLGTEMPLATE *apRes[33]; + DLGTEMPLATE *apRes[MaxBPQPortNo + 1]; } DLGHDR; diff --git a/FLDigi.c b/FLDigi.c index 31c8926..555c41c 100644 --- a/FLDigi.c +++ b/FLDigi.c @@ -62,11 +62,9 @@ extern int (WINAPI FAR *EnumProcessesPtr)(); extern int (WINAPI FAR *GetModuleFileNameExPtr)(); //int ResetExtDriver(int num); -extern char * PortConfig[33]; +; int SemHeldByAPI; -extern struct TNCINFO * TNCInfo[41]; // Records are Malloc'd - static void ConnecttoFLDigiThread(void * portptr); void CreateMHWindow(); @@ -107,7 +105,6 @@ char * strlop(char * buf, char delim); extern UCHAR BPQDirectory[]; -#define MAXBPQPORTS 32 #define MAXMPSKPORTS 16 //LOGFONT LFTTYFONT ; diff --git a/FreeDATA.c b/FreeDATA.c index 7065eeb..75c7128 100644 --- a/FreeDATA.c +++ b/FreeDATA.c @@ -88,13 +88,11 @@ static int RigControlRow = 205; #include #endif -extern char * PortConfig[33]; + extern int SemHeldByAPI; static RECT Rect; -extern struct TNCINFO * TNCInfo[41]; // Records are Malloc'd - static int ProcessLine(char * buf, int Port); VOID WritetoTrace(struct TNCINFO * TNC, char * Msg, int Len); @@ -391,8 +389,6 @@ VOID WritetoTrace(struct TNCINFO * TNC, char * Msg, int Len); -#define MAXBPQPORTS 32 - static time_t ltime; diff --git a/HALDriver.c b/HALDriver.c index 69c573d..f7231e7 100644 --- a/HALDriver.c +++ b/HALDriver.c @@ -47,8 +47,6 @@ static char ClassName[]="HALSTATUS"; static char WindowTitle[] = "HAL"; static int RigControlRow = 185; -extern struct TNCINFO * TNCInfo[41]; // Records are Malloc'd - #define SOH 0x01 // CONTROL CODES #define ETB 0x17 #define DLE 0x10 diff --git a/HFCommon.c b/HFCommon.c index 0b18dcf..295a418 100644 --- a/HFCommon.c +++ b/HFCommon.c @@ -39,7 +39,6 @@ along with LinBPQ/BPQ32. If not, see http://www.gnu.org/licenses #include "bpq32.h" #include "adif.h" -extern char * PortConfig[33]; HANDLE hInstance; extern HBRUSH bgBrush; @@ -70,8 +69,6 @@ char * stristr (char *ch1, char *ch2); static RECT Rect; -extern struct TNCINFO * TNCInfo[41]; // Records are Malloc'd - #define WSA_ACCEPT WM_USER + 1 #define WSA_DATA WM_USER + 2 #define WSA_CONNECT WM_USER + 3 diff --git a/HSMODEM.c b/HSMODEM.c index 1787d8a..0529e4e 100644 --- a/HSMODEM.c +++ b/HSMODEM.c @@ -149,13 +149,10 @@ static int RigControlRow = 205; #include #endif -extern char * PortConfig[33]; extern int SemHeldByAPI; static RECT Rect; -extern struct TNCINFO * TNCInfo[41]; // Records are Malloc'd - static int ProcessLine(char * buf, int Port); VOID WritetoTrace(struct TNCINFO * TNC, char * Msg, int Len); @@ -353,9 +350,6 @@ VOID ReleaseOtherPorts(struct TNCINFO * ThisTNC); VOID WritetoTrace(struct TNCINFO * TNC, char * Msg, int Len); - -#define MAXBPQPORTS 32 - static time_t ltime; diff --git a/HTTPcode.c b/HTTPcode.c index 783e55a..6a50eb9 100644 --- a/HTTPcode.c +++ b/HTTPcode.c @@ -90,15 +90,6 @@ extern BOOL IncludesChat; extern BOOL APRSWeb; extern BOOL RigActive; -extern char * UIUIDigi[33]; -extern char UIUIDEST[33][11]; // Dest for Beacons -extern UCHAR FN[33][256]; // Filename -extern int Interval[33]; // Beacon Interval (Mins) -extern char Message[33][1000]; // Beacon Text - -extern int MinCounter[33]; // Interval Countdown -extern BOOL SendFromFile[33]; - extern HKEY REGTREE; extern BOOL APRSActive; @@ -1288,10 +1279,7 @@ int RefreshTermWindow(struct TCPINFO * TCP, struct HTTPConnectionInfo * Session, } else return 0; -} - - -extern struct TNCINFO * TNCInfo[41]; +} int SetupNodeMenu(char * Buff, int LOCAL) { @@ -2298,7 +2286,7 @@ doHeader: input += 4; - if (port > 0 && port < 33) + if (port > 0 && port <= MaxBPQPortNo) { struct TNCINFO * TNC = TNCInfo[port]; char value[6]; @@ -2327,7 +2315,7 @@ doHeader: input += 4; - if (port > 0 && port < 33) + if (port > 0 && port <= MaxBPQPortNo) { struct TNCINFO * TNC = TNCInfo[port]; @@ -2431,14 +2419,6 @@ doHeader: GetParam(input, "Every", &Param[0]); Interval[Slot] = atoi(&Param[1]); - - //extern char * UIUIDigi[33]; - //extern char UIUIDEST[33][11]; // Dest for Beacons - //extern UCHAR FN[33][256]; // Filename - //extern int [33]; // Beacon Interval (Mins) - //extern char Message[33][1000]; // Beacon Text - - GetParam(input, "Dest", &Param[0]); _strupr(Param); strcpy(UIUIDEST[Slot], &Param[1]); @@ -2525,7 +2505,7 @@ doHeader: { int port = atoi(Context); - if (port > 0 && port < 33) + if (port > 0 && port <= MaxBPQPortNo) { struct TNCINFO * TNC = TNCInfo[port]; @@ -2718,7 +2698,7 @@ doHeader: { int port = atoi(Context); - if (port > 0 && port < 33) + if (port > 0 && port <= MaxBPQPortNo) { struct TNCINFO * TNC = TNCInfo[port]; @@ -2736,7 +2716,7 @@ doHeader: { int port = atoi(Context); - if (port > 0 && port < 33) + if (port > 0 && port <= MaxBPQPortNo) { struct TNCINFO * TNC = TNCInfo[port]; @@ -3235,7 +3215,7 @@ doHeader: } if (RigActive) - ReplyLen += sprintf(&_REPLYBUFFER[ReplyLen], RigControlLine, 33, "Rig Control", "Rig Control", 600, 350, 200, 200); + ReplyLen += sprintf(&_REPLYBUFFER[ReplyLen], RigControlLine, 64, "Rig Control", "Rig Control", 600, 350, 200, 200); } diff --git a/IPCode.c b/IPCode.c index c95c47e..716c846 100644 --- a/IPCode.c +++ b/IPCode.c @@ -128,11 +128,10 @@ VOID RecalcUDPChecksum(PIPMSG IPptr); BOOL Send_ETH(VOID * Block, DWORD len, BOOL SendToTAP); VOID ProcessEthARPMsg(PETHARP arpptr, BOOL FromTAP); VOID WriteIPRLine(PROUTEENTRY RouteRecord, FILE * file); -int CountBits(uint64_t in); +int CountBits(uint32_t in); VOID SendARPMsg(PARPDATA ARPptr, BOOL ToTAP);; BOOL DecodeCallString(char * Calls, BOOL * Stay, BOOL * Spy, UCHAR * AXCalls); int C_Q_ADD_NP(VOID *PQ, VOID *PBUFF); -int CountBits(uint64_t in); #define ARPTIMEOUT 3600 @@ -196,8 +195,6 @@ int FramesDropped = 0; int ARPTimeouts = 0; int SecTimer = 10; -extern char * PortConfig[]; - int baseline=0; unsigned char hostaddr[64]; @@ -556,9 +553,11 @@ Dll BOOL APIENTRY Init_IP() //#ifdef WIN32 - if (Adapter[0]) - if (GetPCAP() == FALSE) - return FALSE; + if (Adapter[0] == 0) + return FALSE; + + if (GetPCAP() == FALSE) + return FALSE; // on Windows create a NAT entry for IPADDR. // on linux enable the TAP device (on Linux you can't use pcap to talk to @@ -3228,7 +3227,7 @@ static BOOL ReadConfigFile() BOOL Found; char buf[256],errbuf[256]; - Config = PortConfig[33]; // Config fnom bpq32.cfg + Config = PortConfig[IPConfigSlot]; // Config fnom bpq32.cfg if (Config) { @@ -4856,7 +4855,18 @@ VOID SHOWNAT(TRANSPORTENTRY * Session, char * Bufferptr, char * CmdTail, CMDX * SendCommandReply(Session, REPLYBUFFER, (int)(Bufferptr - (char *)REPLYBUFFER)); } -int CountBits(uint64_t in) +int CountBits64(uint64_t in) +{ + int n = 0; + while (in) + { + if (in & 1) n ++; + in >>=1; + } + return n; +} + +int CountBits(uint32_t in) { int n = 0; while (in) @@ -4993,8 +5003,8 @@ int sysNameLen = 8; extern time_t TimeLoaded; -int InOctets[32] = {0}; -int OutOctets[32] = {0}; +int InOctets[64] = {0}; +int OutOctets[64] = {0}; // ASN PDUs have to be constructed backwards, as each header included a length diff --git a/KAMPactor.c b/KAMPactor.c index e629351..08e475c 100644 --- a/KAMPactor.c +++ b/KAMPactor.c @@ -68,8 +68,6 @@ static int RigControlRow = 165; extern UCHAR LogDirectory[]; static RECT Rect; -extern struct TNCINFO * TNCInfo[41]; // Records are Malloc'd - int DoScanLine(struct TNCINFO * TNC, char * Buff, int Len); VOID WritetoTrace(struct TNCINFO * TNC, char * Msg, int Len); diff --git a/KISSHF.c b/KISSHF.c index 09db1b5..884fb28 100644 --- a/KISSHF.c +++ b/KISSHF.c @@ -68,13 +68,10 @@ static int RigControlRow = 165; #include #endif -extern char * PortConfig[33]; extern int SemHeldByAPI; static RECT Rect; -extern struct TNCINFO * TNCInfo[41]; // Records are Malloc'd - static int ProcessLine(char * buf, int Port); VOID WritetoTrace(struct TNCINFO * TNC, char * Msg, int Len); @@ -225,8 +222,6 @@ VOID SuspendOtherPorts(struct TNCINFO * ThisTNC); VOID ReleaseOtherPorts(struct TNCINFO * ThisTNC); VOID WritetoTrace(struct TNCINFO * TNC, char * Msg, int Len); -#define MAXBPQPORTS 32 - static time_t ltime; static VOID SendToTNC(struct TNCINFO * TNC, int Stream, UCHAR * Encoded, int EncLen) diff --git a/L2Code.c b/L2Code.c index 78c58c7..ecf0de8 100644 --- a/L2Code.c +++ b/L2Code.c @@ -132,8 +132,6 @@ extern UCHAR * ALIASPTR; UCHAR QSTCALL[7] = {'Q'+'Q','S'+'S','T'+'T',0x40,0x40,0x40,0xe0}; // QST IN AX25 UCHAR NODECALL[7] = {0x9C, 0x9E, 0x88, 0x8A, 0xA6, 0x40, 0xE0}; // 'NODES' IN AX25 FORMAT -extern struct TNCINFO * TNCInfo[41]; // Records are Malloc'd - extern BOOL LogAllConnects; APPLCALLS * APPL; @@ -3856,7 +3854,7 @@ BOOL CheckForListeningSession(struct PORTCONTROL * PORT, MESSAGE * Msg) while (i--) { - if ((CountBits(L4->LISTEN) == 1) && ((1 << ((Msg->PORT & 0x7f) - 1) && L4->LISTEN))) + if ((CountBits64(L4->LISTEN) == 1) && ((1 << ((Msg->PORT & 0x7f) - 1) && L4->LISTEN))) { // See if he is calling our call @@ -3900,7 +3898,7 @@ BOOL CheckForListeningSession(struct PORTCONTROL * PORT, MESSAGE * Msg) // SET UP NEW SESSION (OR RESET EXISTING ONE) - FindLink(Msg->ORIGIN, ourcall, L4->LISTEN, &LINK); + FindLink(Msg->ORIGIN, ourcall, PORT->PORTNUMBER, &LINK); if (LINK == NULL) return FALSE; diff --git a/L3Code.c b/L3Code.c index 6e14c2d..65db56e 100644 --- a/L3Code.c +++ b/L3Code.c @@ -65,8 +65,6 @@ extern BOOL NODESINPROGRESS ;; PPORTCONTROL L3CURRENTPORT; extern dest_list * CURRENTNODE; -extern struct TNCINFO * TNCInfo[41]; - int L3_10SECS = 10; diff --git a/MULTIPSK.c b/MULTIPSK.c index 89e2e3b..91ba1a0 100644 --- a/MULTIPSK.c +++ b/MULTIPSK.c @@ -54,9 +54,6 @@ along with LinBPQ/BPQ32. If not, see http://www.gnu.org/licenses extern int (WINAPI FAR *GetModuleFileNameExPtr)(); //int ResetExtDriver(int num); -extern char * PortConfig[33]; - -extern struct TNCINFO * TNCInfo[41]; // Records are Malloc'd static void ConnecttoMPSKThread(void * portptr); @@ -78,7 +75,6 @@ char * strlop(char * buf, char delim); extern UCHAR BPQDirectory[]; -#define MAXBPQPORTS 32 #define MAXMPSKPORTS 16 //LOGFONT LFTTYFONT ; diff --git a/Moncode.c b/Moncode.c index 701686f..47de2ce 100644 --- a/Moncode.c +++ b/Moncode.c @@ -65,7 +65,7 @@ UCHAR * DisplayINP3RIF(UCHAR * ptr1, UCHAR * ptr2, int msglen); char * DISPLAY_NETROM(MESSAGE * ADJBUFFER, UCHAR * Output, int MsgLen); UCHAR * DISPLAYIPDATAGRAM(IPMSG * IP, UCHAR * Output, int MsgLen); char * DISPLAYARPDATAGRAM(UCHAR * Datagram, UCHAR * Output); -int CountBits(uint64_t in); + DllExport int APIENTRY SetTraceOptions(int mask, int mtxparam, int mcomparam) { @@ -76,6 +76,8 @@ DllExport int APIENTRY SetTraceOptions(int mask, int mtxparam, int mcomparam) // enables monitoring of protocol control frames (eg SABM, UA, RR), // as well as info frames. +// *** For external use only, supports portnum up to 31 *** + MMASK = mask; MTX = mtxparam; MCOM = mcomparam; @@ -83,9 +85,29 @@ DllExport int APIENTRY SetTraceOptions(int mask, int mtxparam, int mcomparam) return (0); } +DllExport int APIENTRY SetTraceOptions64(uint64_t mask, int mtxparam, int mcomparam, int monUIOnly) +{ + +// Sets the tracing options for DecodeFrame. Mask is a bit +// mask of ports to monitor (ie 101 binary will monitor ports +// 1 and 3). MTX enables monitoring on transmitted frames. MCOM +// enables monitoring of protocol control frames (eg SABM, UA, RR), +// as well as info frames. + +// *** For external use only, supports portnum up to 63 *** + + MMASK = mask; + MTX = mtxparam; + MCOM = mcomparam; + MUIONLY = monUIOnly; + + return (0); +} DllExport int APIENTRY SetTraceOptionsEx(int mask, int mtxparam, int mcomparam, int monUIOnly) { +// *** For external use only, supports portnum up to 31 *** + // Sets the tracing options for DecodeFrame. Mask is a bit // mask of ports to monitor (ie 101 binary will monitor ports // 1 and 3). MTX enables monitoring on transmitted frames. MCOM @@ -118,9 +140,8 @@ int IntSetTraceOptionsEx(uint64_t mask, int mtxparam, int mcomparam, int monUIOn return 0; } -int IntDecodeFrame(MESSAGE * msg, char * buffer, time_t Stamp, unsigned long long Mask, BOOL APRS, BOOL MCTL); -int APRSDecodeFrame(MESSAGE * msg, char * buffer, time_t Stamp, UINT Mask) +int APRSDecodeFrame(MESSAGE * msg, char * buffer, time_t Stamp, uint64_t Mask) { return IntDecodeFrame(msg, buffer, Stamp, Mask, TRUE, FALSE); } @@ -129,7 +150,7 @@ DllExport int APIENTRY DecodeFrame(MESSAGE * msg, char * buffer, int Stamp) return IntDecodeFrame(msg, buffer, Stamp, MMASK, FALSE, FALSE); } -int IntDecodeFrame(MESSAGE * msg, char * buffer, time_t Stamp, unsigned long long Mask, BOOL APRS, BOOL MINI) +int IntDecodeFrame(MESSAGE * msg, char * buffer, time_t Stamp, uint64_t Mask, BOOL APRS, BOOL MINI) { UCHAR * ptr; int n; @@ -177,7 +198,7 @@ KC6OAR*>ID: Port &= 0x7F; - if (((1 << (Port - 1)) & Mask) == 0) // Check MMASK + if ((((uint64_t)1 << (Port - 1)) & Mask) == 0) // Check MMASK return 0; @@ -201,7 +222,7 @@ KC6OAR*>ID: SS = (int)(Stamp - MM * 60); - // Add Port: unless Mail Mon (port 33) + // Add Port: unless Mail Mon (port 64) Output += sprintf((char *)Output, "%02d:%02d:%02d%c ", HH, MM, SS, TR); @@ -211,7 +232,7 @@ KC6OAR*>ID: if (buffer[strlen(buffer) -1] == '\r') Output--; - if (Port == 33) + if (Port == 64) Output += sprintf((char *)Output, " \r"); else Output += sprintf((char *)Output, " Port=%d\r", Port); @@ -278,7 +299,7 @@ KC6OAR*>ID: if (MINI == 0) Output += sprintf((char *)Output, "%02d:%02d:%02d%c ", HH, MM, SS, TR); else - if (CountBits(Mask) > 1) + if (CountBits64(Mask) > 1) Output += sprintf((char *)Output, "%d:", Port); From[ConvFromAX25(msg->ORIGIN, From)] = 0; diff --git a/PortMapper.c b/PortMapper.c index 65bc269..7ec25fd 100644 --- a/PortMapper.c +++ b/PortMapper.c @@ -163,8 +163,6 @@ HWND hIPResWnd = 0; BOOL IPMinimized; -extern char * PortConfig[]; - static int baseline=0; static unsigned char hostaddr[64]; @@ -1237,7 +1235,7 @@ static BOOL ReadConfigFile() map_table_len = 0; // For reread - Config = PortConfig[35]; // Config fnom bpq32.cfg + Config = PortConfig[PortMapConfigSlot]; // Config from bpq32.cfg if (Config) { diff --git a/RigControl.c b/RigControl.c index 9314705..090816a 100644 --- a/RigControl.c +++ b/RigControl.c @@ -62,8 +62,6 @@ char *fcvt(double number, int ndigits, int *decpt, int *sign); #include "hidapi.h" -extern struct TNCINFO * TNCInfo[41]; // Records are Malloc'd - int Row = -20; extern struct PORTCONTROL * PORTTABLE; @@ -1838,7 +1836,10 @@ int Rig_CommandEx(struct RIGPORTINFO * PORT, struct RIGINFO * RIG, TRANSPORTENTR return TRUE; - case SDRRADIO: + case KENWOOD: + case FT2000: + case FT991A: + case FLEX: if (n < 3) { @@ -1846,49 +1847,6 @@ int Rig_CommandEx(struct RIGPORTINFO * PORT, struct RIGINFO * RIG, TRANSPORTENTR return FALSE; } - for (ModeNo = 0; ModeNo < 16; ModeNo++) - { - if (_stricmp(KenwoodModes[ModeNo], Mode) == 0) - break; - } - - if (ModeNo > 15) - { - sprintf(Command, "Sorry -Invalid Mode\r"); - return FALSE; - } - - buffptr = GetBuff(); - - if (buffptr == 0) - { - sprintf(Command, "Sorry - No Buffers available\r"); - return FALSE; - } - - // Build a ScanEntry in the buffer - - FreqPtr = (struct ScanEntry *)buffptr->Data; - memset(FreqPtr, 0, sizeof(struct ScanEntry)); - - FreqPtr->Freq = Freq; - FreqPtr->Bandwidth = Bandwidth; - FreqPtr->Antenna = Antenna; - - Poll = FreqPtr->Cmd1 = FreqPtr->Cmd1Msg; - - FreqPtr->Cmd1Len = sprintf(Poll, "F%c00%s;MD%d;F%c;MD;", RIG->RigAddr, FreqString, ModeNo, RIG->RigAddr); - - C_Q_ADD(&RIG->BPQtoRADIO_Q, buffptr); - - return TRUE; - - if (n < 3) - { - strcpy(Command, "Sorry - Invalid Format - should be Port Freq Mode\r"); - return FALSE; - } - for (ModeNo = 0; ModeNo < 16; ModeNo++) { if (PORT->PortType == FT2000) @@ -1952,6 +1910,51 @@ int Rig_CommandEx(struct RIGPORTINFO * PORT, struct RIGINFO * RIG, TRANSPORTENTR return TRUE; + case SDRRADIO: + + if (n < 3) + { + strcpy(Command, "Sorry - Invalid Format - should be Port Freq Mode\r"); + return FALSE; + } + + for (ModeNo = 0; ModeNo < 16; ModeNo++) + { + if (_stricmp(KenwoodModes[ModeNo], Mode) == 0) + break; + } + + if (ModeNo > 15) + { + sprintf(Command, "Sorry -Invalid Mode\r"); + return FALSE; + } + + buffptr = GetBuff(); + + if (buffptr == 0) + { + sprintf(Command, "Sorry - No Buffers available\r"); + return FALSE; + } + + // Build a ScanEntry in the buffer + + FreqPtr = (struct ScanEntry *)buffptr->Data; + memset(FreqPtr, 0, sizeof(struct ScanEntry)); + + FreqPtr->Freq = Freq; + FreqPtr->Bandwidth = Bandwidth; + FreqPtr->Antenna = Antenna; + + Poll = FreqPtr->Cmd1 = FreqPtr->Cmd1Msg; + + FreqPtr->Cmd1Len = sprintf(Poll, "F%c00%s;MD%d;F%c;MD;", RIG->RigAddr, FreqString, ModeNo, RIG->RigAddr); + + C_Q_ADD(&RIG->BPQtoRADIO_Q, buffptr); + + return TRUE; + case NMEA: @@ -4432,8 +4435,6 @@ VOID ProcessSDRRadioFrame(struct RIGPORTINFO * PORT, int Length) Msg[Length] = 0; - Debugprintf(Msg); - if (PORT->PORTOK == FALSE) { // Just come up diff --git a/SCSPactor.c b/SCSPactor.c index 5e57b91..8c2081b 100644 --- a/SCSPactor.c +++ b/SCSPactor.c @@ -103,12 +103,8 @@ static int RigControlRow = 185; extern UCHAR LogDirectory[]; -extern char * PortConfig[33]; - static RECT Rect; -extern struct TNCINFO * TNCInfo[41]; // Records are Malloc'd - VOID __cdecl Debugprintf(const char * format, ...); char NodeCall[11]; // Nodecall, Null Terminated diff --git a/SCSTrackeMulti.c b/SCSTrackeMulti.c index ddf4b07..fd96d6a 100644 --- a/SCSTrackeMulti.c +++ b/SCSTrackeMulti.c @@ -45,12 +45,8 @@ static int RigControlRow = 140; extern UCHAR BPQDirectory[]; -extern char * PortConfig[33]; - static RECT Rect; -extern struct TNCINFO * TNCInfo[41]; // Records are Malloc'd - VOID __cdecl Debugprintf(const char * format, ...); char * strlop(char * buf, char delim); BOOL KAMStartPort(struct PORTCONTROL * PORT); diff --git a/SCSTracker.c b/SCSTracker.c index bda8c21..8ca38b4 100644 --- a/SCSTracker.c +++ b/SCSTracker.c @@ -46,13 +46,11 @@ static int RigControlRow = 140; extern UCHAR LogDirectory[]; extern APPLCALLS APPLCALLTABLE[]; -extern char * PortConfig[33]; + extern char LOC[]; static RECT Rect; -extern struct TNCINFO * TNCInfo[41]; // Records are Malloc'd - VOID __cdecl Debugprintf(const char * format, ...); char * strlop(char * buf, char delim); diff --git a/SerialPort.c b/SerialPort.c index 02afba7..713ab4e 100644 --- a/SerialPort.c +++ b/SerialPort.c @@ -70,13 +70,11 @@ static int RigControlRow = 165; #include #endif -extern char * PortConfig[33]; + extern int SemHeldByAPI; static RECT Rect; -extern struct TNCINFO * TNCInfo[41]; // Records are Malloc'd - static int ProcessLine(char * buf, int Port); VOID WritetoTrace(struct TNCINFO * TNC, char * Msg, int Len); @@ -184,14 +182,8 @@ VOID SuspendOtherPorts(struct TNCINFO * ThisTNC); VOID ReleaseOtherPorts(struct TNCINFO * ThisTNC); VOID WritetoTrace(struct TNCINFO * TNC, char * Msg, int Len); - - -#define MAXBPQPORTS 32 - static time_t ltime; - - static VOID SendToTNC(struct TNCINFO * TNC, int Stream, UCHAR * Encoded, int EncLen) { if (TNC->hDevice) diff --git a/TNCEmulators.c b/TNCEmulators.c index 7ecb200..b8fb2e2 100644 --- a/TNCEmulators.c +++ b/TNCEmulators.c @@ -59,7 +59,6 @@ VOID DOMONITORING(int NeedTrace); int APIENTRY DecodeFrame(MESSAGE * msg, char * buffer, time_t Stamp); time_t APIENTRY GetRaw(int stream, char * msg, int * len, int * count); BOOL TfPut(struct TNCDATA * TNC, UCHAR character); -int IntDecodeFrame(MESSAGE * msg, char * buffer, time_t Stamp, unsigned long long Mask, BOOL APRS, BOOL MCTL); int DATAPOLL(struct TNCDATA * TNC, struct StreamInfo * Channel); int STATUSPOLL(struct TNCDATA * TNC, struct StreamInfo * Channel); int DEDPROCESSHOSTPACKET(struct StreamInfo * Channel, struct TNCDATA * TNC); @@ -2214,9 +2213,6 @@ void CheckForDataFromTerminal(struct TNCDATA * TNC) } -int APIENTRY SetTraceOptionsEx(int mask, int mtxparam, int mcomparam, int monUIOnly); - - VOID DOMONITORING(int NeedTrace) { // IF ANY PORTS HAVE MONITOR ENABLED, SET MONITOR BIT ON FIRST PORT @@ -2224,7 +2220,7 @@ VOID DOMONITORING(int NeedTrace) struct TNCDATA * TNC = TNC2TABLE; // malloc'ed int Tracebit = 0, len, count, n; time_t Stamp; - ULONG SaveMMASK = MMASK; + uint64_t SaveMMASK = MMASK; BOOL SaveMTX = MTX; BOOL SaveMCOM = MCOM; BOOL SaveMUI = MUIONLY; @@ -2259,10 +2255,10 @@ VOID DOMONITORING(int NeedTrace) { if (TNC->Mode == TNC2 && TNC->TRACEFLAG) { - SetTraceOptionsEx(TNC->MMASK, TNC->MTX, TNC->MCOM, 0); + IntSetTraceOptionsEx(TNC->MMASK, TNC->MTX, TNC->MCOM, 0); len = IntDecodeFrame(&MONITORDATA, MONBUFFER, Stamp, TNC->MMASK, FALSE, FALSE); // printf("%d %d %d %d %d\n", len, MMASK, MTX, MCOM, MUIONLY); - SetTraceOptionsEx(SaveMMASK, SaveMTX, SaveMCOM, SaveMUI); + IntSetTraceOptionsEx(SaveMMASK, SaveMTX, SaveMCOM, SaveMUI); if (len) { @@ -3160,7 +3156,6 @@ unsigned char ALREADYCONMSG[]="You are already connected on another port\r"; byte * EncodeCall(byte * Call); VOID SENDENFORCINGPACLEN(struct StreamInfo * Channel, char * Msg, int Len); VOID SENDCMDREPLY(struct TNCDATA * TNC, char * Msg, int Len); -int APIENTRY SetTraceOptionsEx(int mask, int mtxparam, int mcomparam, int monUIOnly); int DOCOMMAND(struct TNCDATA * conn); int PROCESSPOLL(struct TNCDATA * TNC, struct StreamInfo * Channel); @@ -4977,15 +4972,15 @@ NOMONITOR: { // Use Normal Decode, then reformat to DED standard - ULONG SaveMMASK = MMASK; + uint64_t SaveMMASK = MMASK; BOOL SaveMTX = MTX; BOOL SaveMCOM = MCOM; BOOL SaveMUI = MUIONLY; unsigned char Decoded[1000]; - SetTraceOptionsEx(TNC->MMASK, TNC->MTX, TNC->MCOM, 0); + IntSetTraceOptionsEx(TNC->MMASK, TNC->MTX, TNC->MCOM, 0); Len = IntDecodeFrame(&MONITORDATA, Decoded, stamp, TNC->MMASK, FALSE, FALSE); - SetTraceOptionsEx(SaveMMASK, SaveMTX, SaveMCOM, SaveMUI); + IntSetTraceOptionsEx(SaveMMASK, SaveMTX, SaveMCOM, SaveMUI); if (Len) { diff --git a/TelnetV6.c b/TelnetV6.c index 98fd395..fb55720 100644 --- a/TelnetV6.c +++ b/TelnetV6.c @@ -56,8 +56,7 @@ along with LinBPQ/BPQ32. If not, see http://www.gnu.org/licenses extern UCHAR LogDirectory[]; -extern char * PortConfig[]; - + static char ClassName[]="TELNETSERVER"; static char WindowTitle[] = "Telnet Server"; static int RigControlRow = 190; @@ -67,8 +66,6 @@ static BOOL OpenSockets(struct TNCINFO * TNC); static BOOL OpenSockets6(struct TNCINFO * TNC); void ProcessHTTPMessage(void * conn); static VOID SetupListenSet(struct TNCINFO * TNC); -int IntDecodeFrame(MESSAGE * msg, char * buffer, time_t Stamp, unsigned long long Mask, BOOL APRS, BOOL MCTL); -DllExport int APIENTRY SetTraceOptionsEx(int mask, int mtxparam, int mcomparam, int monUIOnly); int WritetoConsoleLocal(char * buff); BOOL TelSendPacket(int Stream, struct STREAMINFO * STREAM, PMSGWITHLEN buffptr, struct ADIF * ADIF); int GetCMSHash(char * Challenge, char * Password); @@ -106,8 +103,6 @@ static RECT Rect; extern int REALTIMETICKS; -extern struct TNCINFO * TNCInfo[41]; // Records are Malloc'd - #define MaxSockets 26 struct UserRec RelayUser; @@ -2216,7 +2211,7 @@ nosocks: IntSetTraceOptionsEx(sockptr->MMASK, sockptr->MTX, sockptr->MCOM, sockptr->MUIOnly); len = IntDecodeFrame((MESSAGE *)monbuff, &buffer[3], stamp, sockptr->MMASK, FALSE, FALSE); - SetTraceOptionsEx(SaveMMASK, SaveMTX, SaveMCOM, SaveMUI); + IntSetTraceOptionsEx(SaveMMASK, SaveMTX, SaveMCOM, SaveMUI); if (len) { diff --git a/UIARQ.c b/UIARQ.c index d6671ab..05eface 100644 --- a/UIARQ.c +++ b/UIARQ.c @@ -57,10 +57,8 @@ extern int (WINAPI FAR *EnumProcessesPtr)(); extern int (WINAPI FAR *GetModuleFileNameExPtr)(); //int ResetExtDriver(int num); -extern char * PortConfig[33]; -int SemHeldByAPI; -extern struct TNCINFO * TNCInfo[41]; // Records are Malloc'd +int SemHeldByAPI; static int ProcessReceivedData(int bpqport); static int ProcessLine(char * buf, int Port); @@ -86,7 +84,6 @@ extern UCHAR BPQDirectory[]; extern char MYALIASLOPPED[10]; -#define MAXBPQPORTS 32 #define MAXMPSKPORTS 16 static BOOL GotMsg; diff --git a/UZ7HODrv.c b/UZ7HODrv.c index 1814ba6..119d48e 100644 --- a/UZ7HODrv.c +++ b/UZ7HODrv.c @@ -57,11 +57,6 @@ along with LinBPQ/BPQ32. If not, see http://www.gnu.org/licenses extern int (WINAPI FAR *GetModuleFileNameExPtr)(); -//int ResetExtDriver(int num); -extern char * PortConfig[33]; - -extern struct TNCINFO * TNCInfo[41]; // Records are Malloc'd - void ConnecttoUZ7HOThread(void * portptr); void CreateMHWindow(); @@ -85,7 +80,6 @@ int standardParams(struct TNCINFO * TNC, char * buf); extern UCHAR BPQDirectory[]; -#define MAXBPQPORTS 32 #define MAXUZ7HOPORTS 16 static char ClassName[]="ARDOPSTATUS"; diff --git a/V4.c b/V4.c index af14636..106446f 100644 --- a/V4.c +++ b/V4.c @@ -72,8 +72,6 @@ extern int SemHeldByAPI; static RECT Rect; -extern struct TNCINFO * TNCInfo[41]; // Records are Malloc'd - static int ProcessLine(char * buf, int Port); // RIGCONTROL COM60 19200 ICOM IC706 5e 4 14.103/U1w 14.112/u1 18.1/U1n 10.12/l1 @@ -206,8 +204,6 @@ VOID SuspendOtherPorts(struct TNCINFO * ThisTNC); VOID ReleaseOtherPorts(struct TNCINFO * ThisTNC); VOID WritetoTrace(struct TNCINFO * TNC, char * Msg, int Len); -#define MAXBPQPORTS 32 - static time_t ltime; #pragma pack() diff --git a/VARA.c b/VARA.c index 5273ac9..1cccc44 100644 --- a/VARA.c +++ b/VARA.c @@ -89,13 +89,9 @@ static int RigControlRow = 165; #include #endif -extern char * PortConfig[33]; extern int SemHeldByAPI; static RECT Rect; - -extern struct TNCINFO * TNCInfo[41]; // Records are Malloc'd - extern void * TRACE_Q; BOOL VARAStopPort(struct PORTCONTROL * PORT) @@ -300,9 +296,6 @@ VOID SuspendOtherPorts(struct TNCINFO * ThisTNC); VOID ReleaseOtherPorts(struct TNCINFO * ThisTNC); VOID WritetoTrace(struct TNCINFO * TNC, char * Msg, int Len); - -#define MAXBPQPORTS 32 - static time_t ltime; @@ -339,8 +332,6 @@ static size_t ExtProc(int fn, int port, PDATAMESSAGE buff) } } - TNC->Streams[0].Disconnecting = FALSE; - switch (fn) { case 8: diff --git a/Versions.h b/Versions.h index d334e6a..1e5575e 100644 --- a/Versions.h +++ b/Versions.h @@ -10,14 +10,14 @@ #endif -#define KVers 6,0,23,66 -#define KVerstring "6.0.23.66\0" +#define KVers 6,0,23,70 +#define KVerstring "6.0.23.70\0" #ifdef CKernel #define Vers KVers #define Verstring KVerstring -#define Datestring "April 2023" +#define Datestring "May 2023" #define VerComments "G8BPQ Packet Switch (C Version)" KVerstring #define VerCopyright "Copyright © 2001-2023 John Wiseman G8BPQ\0" #define VerDesc "BPQ32 Switch\0" @@ -38,8 +38,8 @@ #ifdef BPQTerm -#define Vers 2,2,5,1 -#define Verstring "2.2.5.1\0" +#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-2023 John Wiseman G8BPQ\0" #define VerDesc "Simple Terminal Program for G8BPQ Switch\0" diff --git a/WINMOR.c b/WINMOR.c index 6bdc70d..33dd3a6 100644 --- a/WINMOR.c +++ b/WINMOR.c @@ -117,13 +117,10 @@ static int RigControlRow = 165; #include #endif -extern char * PortConfig[33]; extern int SemHeldByAPI; static RECT Rect; -extern struct TNCINFO * TNCInfo[41]; // Records are Malloc'd - static int ProcessLine(char * buf, int Port); // RIGCONTROL COM60 19200 ICOM IC706 5e 4 14.103/U1w 14.112/u1 18.1/U1n 10.12/l1 @@ -519,9 +516,6 @@ VOID SuspendOtherPorts(struct TNCINFO * ThisTNC); VOID ReleaseOtherPorts(struct TNCINFO * ThisTNC); VOID WritetoTrace(struct TNCINFO * TNC, char * Msg, int Len); - -#define MAXBPQPORTS 32 - static time_t ltime; diff --git a/WinRPR.c b/WinRPR.c index a7f22f1..391edc9 100644 --- a/WinRPR.c +++ b/WinRPR.c @@ -57,13 +57,11 @@ static int RigControlRow = 140; extern UCHAR LogDirectory[]; extern APPLCALLS APPLCALLTABLE[]; -extern char * PortConfig[33]; + extern char LOC[]; static RECT Rect; -extern struct TNCINFO * TNCInfo[41]; // Records are Malloc'd - VOID __cdecl Debugprintf(const char * format, ...); char * strlop(char * buf, char delim); diff --git a/asmstrucs.h b/asmstrucs.h index a849dc3..5d11572 100644 --- a/asmstrucs.h +++ b/asmstrucs.h @@ -9,6 +9,7 @@ #include "winsock2.h" #include "ws2tcpip.h" +#include "winstdint.h" #endif @@ -164,7 +165,7 @@ typedef struct _TRANSPORTENTRY int UAddrLen; // char UADDRESS[64]; // Unproto Address String - Dest + Digis - UINT LISTEN; // Port Mask if in Listen Mode + uint64_t LISTEN; // Port Mask if in Listen Mode char APPL[16]; // Set if session initiated by an APPL int L4LIMIT; // Idle time for this Session @@ -1161,7 +1162,7 @@ struct TNCDATA BOOL BBSMON; // SPECIAL SHORT MONITOR FOR BBS BOOL MTX; // MONITOR TRANSMITTED FRAMES BOOL MTXFORCE; // MONITOR TRANSMITTED FRAMES EVEN IF M OFF - unsigned long long MMASK; // MONITOR PORT MASK + uint64_t MMASK; // MONITOR PORT MASK BOOL HEADERLN; // PUT MONITORED DATA ON NEW LINE FLAG BOOL InEscape; // PASS Char received (treat next char as normal char not ctrl char) BOOL InStreamSW; // StreamSW Char received (treat next char as new stream) diff --git a/bpq32.h b/bpq32.h index 642d634..dd06288 100644 --- a/bpq32.h +++ b/bpq32.h @@ -158,8 +158,8 @@ int APIENTRY DecodeFrame(char * msg, char * buffer, time_t Stamp); // as well as info frames. int APIENTRY SetTraceOptions(long mask, int mtxparam, int mcomparam); -int APIENTRY SetTraceOptionsEx(long mask, int mtxparam, int mcomparam, int monUIOnly); - +int APIENTRY SetTraceOptionsEx(uint64_t mask, int mtxparam, int mcomparam, int monUIOnly); +int APIENTRY SetTraceOptions64(uint64_t mask, int mtxparam, int mcomparam, int monUIOnly); // Returns number of first unused BPQHOST stream. If none available, // returns 255. See API function 13. diff --git a/bpqaxip.c b/bpqaxip.c index 785338a..d4f6579 100644 --- a/bpqaxip.c +++ b/bpqaxip.c @@ -186,7 +186,6 @@ VOID * zalloc(int len); int ResetExtDriver(int num); BOOL ProcessConfig(); VOID FreeConfig(); -extern char * PortConfig[35]; extern UCHAR BPQDirectory[]; @@ -308,7 +307,7 @@ char CantReplyList[512] = ""; // To suppress duplicate "Can't Reply" messages DWORD n; -struct AXIPPORTINFO * Portlist[33]; +struct AXIPPORTINFO * Portlist[MaxBPQPortNo + 1]; int InitAXIP(int Port); diff --git a/bpqether.c b/bpqether.c index 5578c31..91804c0 100644 --- a/bpqether.c +++ b/bpqether.c @@ -61,8 +61,6 @@ along with LinBPQ/BPQ32. If not, see http://www.gnu.org/licenses //#include "packet32.h" //#include "ntddndis.h" -extern char * PortConfig[33]; - typedef struct PCAPStruct { pcap_t *adhandle; diff --git a/bpqvkiss.c b/bpqvkiss.c index a72859b..760326b 100644 --- a/bpqvkiss.c +++ b/bpqvkiss.c @@ -60,7 +60,7 @@ PVCOMINFO CreateInfo( int port,int speed, int bpqport ) ; static BOOL Win98 = FALSE; -struct PORTCONTROL * PORTVEC[33]; +struct PORTCONTROL * PORTVEC[MaxBPQPortNo + 1]; static size_t ExtProc(int fn, int port, PMESSAGE buff) { diff --git a/cMain.c b/cMain.c index a0a0e24..22a8fa2 100644 --- a/cMain.c +++ b/cMain.c @@ -238,7 +238,7 @@ int BTLENGTH = 9; // DW 9 ; LENGTH // DB 0F0H ; PID char BTEXTFLD[256] ="\r"; -char BridgeMap[33][33] = {0}; +char BridgeMap[MaxBPQPortNo + 1][MaxBPQPortNo + 1] = {0}; // Keep Buffers at end @@ -261,9 +261,6 @@ extern int NUMBEROFTNCPORTS; extern APPLCALLS APPLCALLTABLE[]; -int IntDecodeFrame(MESSAGE * msg, char * buffer, time_t Stamp, unsigned long long Mask, BOOL APRS, BOOL MINI); -DllExport int APIENTRY SetTraceOptionsEx(int mask, int mtxparam, int mcomparam, int monUIOnly); - // LOOPBACK PORT ROUTINES VOID LINKINIT(PEXTPORTDATA PORTVEC) @@ -2233,11 +2230,11 @@ L2Packet: { MESSAGE * Buffer = (PMESSAGE)Q_REM((void *)&PORT->PORTTX_Q); - Debugprintf("Busy but not connected - discard message"); - if (Buffer == 0) break; // WOT!! +// Debugprintf("Busy but not connected - discard message %s", Buffer->L2DATA); + ReleaseBuffer(Buffer); break; } @@ -2372,7 +2369,7 @@ ENDOFLIST: VOID DoListenMonitor(TRANSPORTENTRY * L4, MESSAGE * Msg) { - unsigned long long SaveMMASK = MMASK; + uint64_t SaveMMASK = MMASK; BOOL SaveMTX = MTX; BOOL SaveMCOM = MCOM; BOOL SaveMUI = MUIONLY; @@ -2388,11 +2385,11 @@ VOID DoListenMonitor(TRANSPORTENTRY * L4, MESSAGE * Msg) if (monchars[21] == 3 && monchars[22] == 0xcf && monchars[23] == 0xff) // Netrom Nodes return; - SetTraceOptionsEx(L4->LISTEN, 1, 0, 0); + IntSetTraceOptionsEx(L4->LISTEN, 1, 0, 0); len = IntDecodeFrame(Msg, MonBuffer, Msg->Timestamp, L4->LISTEN, FALSE, TRUE); - SetTraceOptionsEx(SaveMMASK, SaveMTX, SaveMCOM, SaveMUI); + IntSetTraceOptionsEx(SaveMMASK, SaveMTX, SaveMCOM, SaveMUI); if (len == 0) return; @@ -2472,7 +2469,7 @@ int BPQTRACE(MESSAGE * Msg, BOOL TOAPRS) while (i--) { if (L4->LISTEN) - if (((1 << ((Msg->PORT & 0x7f) - 1)) & L4->LISTEN)) + if ((((uint64_t)1 << ((Msg->PORT & 0x7f) - 1)) & L4->LISTEN)) // if ((Msg->PORT & 0x7f) == L4->LISTEN) DoListenMonitor(L4, Msg); diff --git a/compatbits.c b/compatbits.c index c485a81..f93b2e5 100644 --- a/compatbits.c +++ b/compatbits.c @@ -69,7 +69,7 @@ int memicmp(unsigned char *a, unsigned char *b, int n) { if (n) { - while (n && toupper(*a) == toupper(*b)) + while (n && (toupper(*a) == toupper(*b))) n--, a++, b++; if (n) diff --git a/config.c b/config.c index 5cf02d5..5a10ab3 100644 --- a/config.c +++ b/config.c @@ -151,14 +151,14 @@ struct WL2KInfo * DecodeWL2KReportLine(char * buf); // Dummy file routines - write to buffer instead -char * PortConfig[36]; -char * RadioConfigMsg[36]; -char * WL2KReportLine[36]; +char * PortConfig[70]; +char * RadioConfigMsg[70]; +char * WL2KReportLine[70]; int nextRadioPort = 0; int nextDummyInterlock = 233; -BOOL PortDefined[36]; +BOOL PortDefined[70]; extern BOOL IncludesMail; extern BOOL IncludesChat; @@ -457,7 +457,7 @@ BOOL ProcessConfig() routeindex = 0; portindex = 0; - for (i = 0; i < 35; i++) + for (i = 0; i < 70; i++) { if (PortConfig[i]) { @@ -710,7 +710,7 @@ int decode_rec(char * rec) char * ptr; - PortConfig[33] = ptr = malloc(50000); + PortConfig[IPConfigSlot] = ptr = malloc(50000); *ptr = 0; @@ -720,7 +720,7 @@ int decode_rec(char * rec) { if (_memicmp(rec, "****", 3) == 0) { - PortConfig[33] = realloc(PortConfig[33], (strlen(ptr) + 1)); + PortConfig[IPConfigSlot] = realloc(PortConfig[IPConfigSlot], (strlen(ptr) + 1)); xxcfg.C_IP = 1; return 0; } @@ -744,7 +744,7 @@ int decode_rec(char * rec) char * ptr; - PortConfig[35] = ptr = malloc(50000); + PortConfig[PortMapConfigSlot] = ptr = malloc(50000); *ptr = 0; @@ -754,7 +754,7 @@ int decode_rec(char * rec) { if (_memicmp(rec, "****", 3) == 0) { - PortConfig[35] = realloc(PortConfig[35], (strlen(ptr) + 1)); + PortConfig[PortMapConfigSlot] = realloc(PortConfig[PortMapConfigSlot], (strlen(ptr) + 1)); xxcfg.C_PM = 1; return 0; } @@ -778,7 +778,7 @@ int decode_rec(char * rec) char * ptr; - PortConfig[34] = ptr = malloc(50000); + PortConfig[APRSConfigSlot] = ptr = malloc(50000); *ptr = 0; @@ -791,7 +791,7 @@ int decode_rec(char * rec) { if (_memicmp(rec, "****", 3) == 0) { - PortConfig[34] = realloc(PortConfig[34], (strlen(ptr) + 1)); + PortConfig[APRSConfigSlot] = realloc(PortConfig[APRSConfigSlot], (strlen(ptr) + 1)); return 0; } if (strlen(rec) > 1) @@ -963,7 +963,7 @@ NextAPRS: Port = atoi(p_value); - if (Port > 32) + if (Port > MaxBPQPortNo) return FALSE; if (Context == NULL) @@ -975,7 +975,7 @@ NextAPRS: { DigiTo = atoi(ptr); - if (DigiTo > 32) + if (DigiTo > MaxBPQPortNo) return 0; if (Port != DigiTo) // Not to our port! @@ -1556,9 +1556,9 @@ int routes(int i) err_flag = 1; } - if (Route->port < 1 || Route->port > 32) + if (Route->port < 1 || Route->port > MaxBPQPortNo) { - Consoleprintf("Port number must be between 1 and 32"); + Consoleprintf("Port number must be between 1 and 64"); Consoleprintf("%s\r\n",rec); err_flag = 1; } @@ -1617,6 +1617,12 @@ int ports(int i) LogicalPortNum = portnum; + if (LogicalPortNum > MaxBPQPortNo) + { + Consoleprintf("Port Number must be between 1 and %d", MaxBPQPortNo); + heading = 1; + } + while (endport == 0 && !feof(fp1)) { GetNextLine(rec); @@ -1957,7 +1963,7 @@ int decode_port_rec(char * rec) char * ptr; int i; - if (LogicalPortNum > 32) + if (LogicalPortNum > 64) { Consoleprintf("Portnum %d is invalid", LogicalPortNum); LogicalPortNum = 0; diff --git a/configstructs.h b/configstructs.h index 0ccfb13..605d2e1 100644 --- a/configstructs.h +++ b/configstructs.h @@ -152,10 +152,10 @@ struct CONFIGTABLE char C_IDMSG[512]; char C_CTEXT[512]; char C_INFOMSG[2048]; - UCHAR CfgBridgeMap[33][33]; + UCHAR CfgBridgeMap[MaxBPQPortNo][MaxBPQPortNo]; struct ROUTECONFIG C_ROUTE[MaxLockedRoutes]; struct APPLCONFIG C_APPL[NumberofAppls]; - struct PORTCONFIG C_PORT[36]; + struct PORTCONFIG C_PORT[MaxBPQPortNo + 4]; //#define ApplOffset 80000 // Applications offset in config buffer //#define InfoOffset 85000 // Infomsg offset in buffer diff --git a/linether.c b/linether.c index f156917..bede180 100644 --- a/linether.c +++ b/linether.c @@ -33,8 +33,6 @@ along with LinBPQ/BPQ32. If not, see http://www.gnu.org/licenses #include #include -extern char * PortConfig[33]; - extern int tap_fd; typedef struct PCAPStruct