mirror of git://vps1.g8bpq.net/linbpq
parent
3103c10e81
commit
1571be31c2
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,126 @@
|
||||
|
||||
#ifdef Kernel
|
||||
|
||||
#define Vers 5,2,9,2
|
||||
#define Verstring "5.2.9.2\0"
|
||||
#define Datestring "September 2012"
|
||||
#define VerComments "G8BPQ Packet Switch V5.2.9.2\0"
|
||||
#define VerCopyright "Copyright © 2001-2012 John Wiseman G8BPQ\0"
|
||||
#define VerDesc "BPQ32 Switch\0"
|
||||
|
||||
#endif
|
||||
|
||||
#define KVers 6,0,24,78
|
||||
#define KVerstring "6.0.24.78\0"
|
||||
|
||||
|
||||
#ifdef CKernel
|
||||
|
||||
#define Vers KVers
|
||||
#define Verstring KVerstring
|
||||
#define Datestring "July 2025"
|
||||
#define VerComments "G8BPQ Packet Switch (C Version)" KVerstring
|
||||
#define VerCopyright "Copyright © 2001-2025 John Wiseman G8BPQ\0"
|
||||
#define VerDesc "BPQ32 Switch\0"
|
||||
#define VerProduct "BPQ32"
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef TermTCP
|
||||
|
||||
#define Vers 1,0,16,2
|
||||
#define Verstring "1.0.16.2\0"
|
||||
#define VerComments "Internet Terminal for G8BPQ Packet Switch\0"
|
||||
#define VerCopyright "Copyright © 2011-2025 John Wiseman G8BPQ\0"
|
||||
#define VerDesc "Simple TCP Terminal Program for G8BPQ Switch\0"
|
||||
#define VerProduct "BPQTermTCP"
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef BPQTerm
|
||||
|
||||
#define Vers 2,2,5,2
|
||||
#define Verstring "2.2.5.2\0"
|
||||
#define VerComments "Simple Terminal for G8BPQ Packet Switch\0"
|
||||
#define VerCopyright "Copyright © 1999-2025 John Wiseman G8BPQ\0"
|
||||
#define VerDesc "Simple Terminal Program for G8BPQ Switch\0"
|
||||
#define VerProduct "BPQTerminal"
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef BPQTermMDI
|
||||
|
||||
#define Vers 2,2,0,3
|
||||
#define Verstring "2.2.0.3\0"
|
||||
#define VerComments "MDI Terminal for G8BPQ Packet Switch\0"
|
||||
#define VerCopyright "Copyright © 1999-2025 John Wiseman G8BPQ\0"
|
||||
#define VerDesc "MDI Terminal Program for G8BPQ Switch\0"
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef MAIL
|
||||
|
||||
#define Vers KVers
|
||||
#define Verstring KVerstring
|
||||
#define VerComments "Mail server for G8BPQ Packet Switch\0"
|
||||
#define VerCopyright "Copyright © 2009-2025 John Wiseman G8BPQ\0"
|
||||
#define VerDesc "Mail server for G8BPQ's 32 Bit Switch\0"
|
||||
#define VerProduct "BPQMail"
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef HOSTMODES
|
||||
|
||||
#define Vers 1,1,8,1
|
||||
#define Verstring "1.1.8.1\0"
|
||||
//#define SPECIALVERSION "Test 3"
|
||||
#define VerComments "Host Modes Emulator for G8BPQ Packet Switch\0"
|
||||
#define VerCopyright "Copyright © 2009-2019 John Wiseman G8BPQ\0"
|
||||
#define VerDesc "Host Modes Emulator for G8BPQ's 32 Bit Switch\0"
|
||||
#define VerProduct "BPQHostModes"
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef UIUTIL
|
||||
|
||||
#define Vers 0,1,3,1
|
||||
#define Verstring "0.1.3.1\0"
|
||||
#define VerComments "Beacon Utility for G8BPQ Packet Switch\0"
|
||||
#define VerCopyright "Copyright © 2011-2019 John Wiseman G8BPQ\0"
|
||||
#define VerDesc "Beacon Utility for G8BPQ Switch\0"
|
||||
#define VerProduct "BPQUIUtil"
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef AUTH
|
||||
|
||||
#define Vers 0,1,0,0
|
||||
#define Verstring "0.1.0.0\0"
|
||||
#define VerComments "Password Generation Utility for G8BPQ Packet Switch\0"
|
||||
#define VerCopyright "Copyright © 2011-2025 John Wiseman G8BPQ\0"
|
||||
#define VerDesc "Password Generation Utility for G8BPQ Switch\0"
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef APRS
|
||||
|
||||
#define Vers KVers
|
||||
#define Verstring KVerstring
|
||||
#define VerComments "APRS Client for G8BPQ Switch\0"
|
||||
#define VerCopyright "Copyright © 2012-2025 John Wiseman G8BPQ\0"
|
||||
#define VerDesc "APRS Client for G8BPQ Switch\0"
|
||||
#define VerProduct "BPQAPRS"
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef CHAT
|
||||
|
||||
#define Vers KVers
|
||||
#define Verstring KVerstring
|
||||
#define VerComments "Chat server for G8BPQ Packet Switch\0"
|
||||
#define VerCopyright "Copyright © 2009-2025 John Wiseman G8BPQ\0"
|
||||
#define VerDesc "Chat server for G8BPQ's 32 Bit Switch\0"
|
||||
#define VerProduct "BPQChat"
|
||||
|
||||
#endif
|
||||
@ -0,0 +1,210 @@
|
||||
// Includes code from MiniUPnPc, used subject to the following conditions:
|
||||
|
||||
/*
|
||||
|
||||
MiniUPnPc
|
||||
Copyright (c) 2005-2020, Thomas BERNARD
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
* The name of the author may not be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
|
||||
#define MINIUPNP_STATICLIB
|
||||
|
||||
#include <stdio.h>
|
||||
#ifdef _WIN32
|
||||
#include "upnpcommands.h"
|
||||
#include "miniupnpc.h"
|
||||
#include "upnperrors.h"
|
||||
#include <winsock2.h>
|
||||
#endif
|
||||
#ifdef LINBPQ
|
||||
#ifndef WIN32
|
||||
#include <miniupnpc/upnpcommands.h>
|
||||
#include <miniupnpc/miniupnpc.h>
|
||||
#include <miniupnpc/upnperrors.h>
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
int AddMap(char * controlURL, char * eport, char * iport, char * proto);
|
||||
int DeleteMap(char * controlURL, char * eport, char * iport, char * proto);
|
||||
|
||||
void Consoleprintf(const char * format, ...);
|
||||
|
||||
struct UPNP
|
||||
{
|
||||
struct UPNP * Next;
|
||||
char * Protocol;
|
||||
char * LANport;
|
||||
char * WANPort;
|
||||
};
|
||||
|
||||
extern struct UPNP * UPNPConfig;
|
||||
|
||||
char * controlURL = 0;
|
||||
char * servicetype = 0;
|
||||
char iaddr[] = "IP";
|
||||
char * inClient = NULL;
|
||||
#ifdef LINBPQ
|
||||
char desc[] = "LinBPQ ";
|
||||
#else
|
||||
char desc[] = "BPQ32 ";
|
||||
#endif
|
||||
char * remoteHost = NULL;
|
||||
char * leaseDuration = NULL;
|
||||
|
||||
struct UPNPDev * devlist = 0;
|
||||
char lanaddr[64] = "unset"; /* my ip address on the LAN */
|
||||
char wanaddr[64] = "unset"; /* my ip address on the LAN */
|
||||
struct UPNPUrls urls;
|
||||
struct IGDdatas data;
|
||||
|
||||
int i;
|
||||
const char * rootdescurl = 0;
|
||||
const char * multicastif = 0;
|
||||
const char * minissdpdpath = 0;
|
||||
#ifdef UPNP_LOCAL_PORT_ANY
|
||||
int localport = UPNP_LOCAL_PORT_ANY;
|
||||
#else
|
||||
int localport = 0;
|
||||
#endif
|
||||
int retcode = 0;
|
||||
int error = 0;
|
||||
int ipv6 = 0;
|
||||
int ignore = 0;
|
||||
unsigned char ttl = 2;
|
||||
|
||||
|
||||
int upnpInit()
|
||||
{
|
||||
struct UPNP * Config = UPNPConfig;
|
||||
int i;
|
||||
#ifdef WIN32
|
||||
WSADATA wsaData;
|
||||
int nResult = WSAStartup(MAKEWORD(2,2), &wsaData);
|
||||
if(nResult != NO_ERROR)
|
||||
{
|
||||
fprintf(stderr, "WSAStartup() failed.\n");
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
|
||||
while (Config)
|
||||
{
|
||||
if (devlist == NULL)
|
||||
{
|
||||
#if MINIUPNPC_API_VERSION == 10
|
||||
devlist = upnpDiscover(2000, multicastif, minissdpdpath, localport, ipv6, &error);
|
||||
#else
|
||||
devlist = upnpDiscover(2000, multicastif, minissdpdpath, localport, ipv6, ttl, &error);
|
||||
#endif
|
||||
if (devlist == NULL)
|
||||
{
|
||||
Consoleprintf("Failed to find a UPNP device");
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if MINIUPNPC_API_VERSION >= 18
|
||||
i = UPNP_GetValidIGD(devlist, &urls, &data, lanaddr, sizeof(lanaddr), wanaddr, sizeof(wanaddr));
|
||||
#else
|
||||
i = UPNP_GetValidIGD(devlist, &urls, &data, lanaddr, sizeof(lanaddr));
|
||||
#endif
|
||||
}
|
||||
|
||||
AddMap(devlist->descURL, Config->LANport, Config->WANPort, Config->Protocol);
|
||||
Config = Config->Next;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int upnpClose()
|
||||
{
|
||||
struct UPNP * Config = UPNPConfig;
|
||||
int i;
|
||||
|
||||
while (Config)
|
||||
{
|
||||
if (devlist == NULL)
|
||||
{
|
||||
#if MINIUPNPC_API_VERSION == 10
|
||||
devlist = upnpDiscover(2000, multicastif, minissdpdpath, localport, ipv6, &error);
|
||||
#else
|
||||
devlist = upnpDiscover(2000, multicastif, minissdpdpath, localport, ipv6, ttl, &error);
|
||||
#endif
|
||||
if (devlist == NULL)
|
||||
{
|
||||
Consoleprintf("Failed to find a UPNP device");
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if MINIUPNPC_API_VERSION >= 18
|
||||
i = UPNP_GetValidIGD(devlist, &urls, &data, lanaddr, sizeof(lanaddr), wanaddr, sizeof(wanaddr));
|
||||
#else
|
||||
i = UPNP_GetValidIGD(devlist, &urls, &data, lanaddr, sizeof(lanaddr));
|
||||
#endif
|
||||
}
|
||||
|
||||
DeleteMap(devlist->descURL, Config->LANport, Config->WANPort, Config->Protocol);
|
||||
Config = Config->Next;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int AddMap(char * controlURL, char * eport, char * iport, char * proto)
|
||||
{
|
||||
int r = UPNP_AddPortMapping(urls.controlURL, data.first.servicetype,
|
||||
eport, iport, lanaddr, desc,
|
||||
proto, remoteHost, leaseDuration);
|
||||
|
||||
if (r != UPNPCOMMAND_SUCCESS)
|
||||
{
|
||||
Consoleprintf("UPNP AddPortMapping(%s, %s, %s) failed with code %d (%s)", eport, iport, lanaddr, r, strupnperror(r));
|
||||
return -2;
|
||||
}
|
||||
Consoleprintf("UPNP AddPortMapping(%s, %s, %s) Succeeded", eport, iport, lanaddr, r);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int DeleteMap(char * controlURL, char * eport, char * iport, char * proto)
|
||||
{
|
||||
int r = UPNP_DeletePortMapping(urls.controlURL, data.first.servicetype, eport, proto, remoteHost);
|
||||
|
||||
if(r != UPNPCOMMAND_SUCCESS)
|
||||
{
|
||||
Consoleprintf("UPNP DeletePortMapping(%s, %s, %s) failed with code %d (%s)", eport, iport, lanaddr, r, strupnperror(r));
|
||||
return -2;
|
||||
}
|
||||
Consoleprintf("UPNP DeletePortMapping(%s, %s, %s) Succeeded", eport, iport, lanaddr, r);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,85 @@
|
||||
# LinBPQ Makefile
|
||||
|
||||
# To exclude i2c support run make noi2c
|
||||
|
||||
OBJS = pngwtran.o pngrtran.o pngset.o pngrio.o pngwio.o pngtrans.o pngrutil.o pngwutil.o\
|
||||
pngread.o pngwrite.o png.o pngerror.o pngget.o pngmem.o APRSIconData.o AISCommon.o\
|
||||
upnp.o APRSStdPages.o HSMODEM.o WinRPR.o KISSHF.o TNCEmulators.o bpqhdlc.o SerialPort.o\
|
||||
adif.o WebMail.o utf8Routines.o VARA.o LzFind.o Alloc.o LzmaDec.o LzmaEnc.o LzmaLib.o \
|
||||
Multicast.o ARDOP.o IPCode.o FLDigi.o linether.o CMSAuth.o APRSCode.o BPQtoAGW.o KAMPactor.o\
|
||||
AEAPactor.o HALDriver.o MULTIPSK.o BBSHTMLConfig.o ChatHTMLConfig.o BBSUtilities.o bpqaxip.o\
|
||||
BPQINP3.o BPQNRR.o cMain.o Cmd.o CommonCode.o HTMLCommonCode.o compatbits.o config.o datadefs.o \
|
||||
FBBRoutines.o HFCommon.o Housekeeping.o HTTPcode.o kiss.o L2Code.o L3Code.o L4Code.o lzhuf32.o \
|
||||
MailCommands.o MailDataDefs.o LinBPQ.o MailRouting.o MailTCP.o MBLRoutines.o md5.o Moncode.o \
|
||||
NNTPRoutines.o RigControl.o TelnetV6.o WINMOR.o TNCCode.o UZ7HODrv.o WPRoutines.o \
|
||||
SCSTrackeMulti.o SCSPactor.o SCSTracker.o HanksRT.o UIRoutines.o AGWAPI.o AGWMoncode.o \
|
||||
DRATS.o FreeDATA.o base64.o Events.o nodeapi.o mailapi.o mqtt.o RHP.o
|
||||
|
||||
# Configuration:
|
||||
|
||||
#Default to Linux
|
||||
CC = gcc
|
||||
LDFLAGS = -Xlinker -Map=output.map -lrt
|
||||
|
||||
all: CFLAGS = -DLINBPQ -MMD -g -fcommon -fasynchronous-unwind-tables $(EXTRA_CFLAGS)
|
||||
all: LIBS = -lpaho-mqtt3a -ljansson -lminiupnpc -lm -lz -lpthread -lconfig -lpcap
|
||||
all: linbpq
|
||||
|
||||
#other OS
|
||||
|
||||
OS_NAME = $(shell uname -s)
|
||||
ifeq ($(OS_NAME),NetBSD)
|
||||
CC = cc
|
||||
EXTRA_CFLAGS = -DFREEBSD -DNOMQTT -I/usr/pkg/include
|
||||
LDFLAGS = -Xlinker -Map=output.map -Wl,-R/usr/pkg/lib -L/usr/pkg/lib -lrt -lutil -lexecinfo
|
||||
|
||||
all: CFLAGS = -DLINBPQ -MMD -g -fcommon -fasynchronous-unwind-tables $(EXTRA_CFLAGS)
|
||||
all: LIBS = -lminiupnpc -lm -lz -lpthread -lconfig -lpcap
|
||||
all: linbpq
|
||||
|
||||
|
||||
endif
|
||||
ifeq ($(OS_NAME),FreeBSD)
|
||||
CC = cc
|
||||
EXTRA_CFLAGS = -DFREEBSD -DNOMQTT -I/usr/local/include
|
||||
LDFLAGS = -Xlinker -Map=output.map -L/usr/local/lib -lrt -liconv -lutil -lexecinfo
|
||||
|
||||
all: CFLAGS = -DLINBPQ -MMD -g -fcommon -fasynchronous-unwind-tables $(EXTRA_CFLAGS)
|
||||
all: LIBS = -lminiupnpc -lm -lz -lpthread -lconfig -lpcap
|
||||
all: linbpq
|
||||
|
||||
endif
|
||||
|
||||
ifeq ($(OS_NAME),Darwin)
|
||||
CC = gcc
|
||||
EXTRA_CFLAGS = -DMACBPQ -DNOMQTT
|
||||
LDFLAGS = -liconv
|
||||
|
||||
all: CFLAGS = -DLINBPQ -MMD -g -fcommon -fasynchronous-unwind-tables $(EXTRA_CFLAGS)
|
||||
all: LIBS = -lminiupnpc -lm -lz -lpthread -lconfig -lpcap
|
||||
all: linbpq
|
||||
endif
|
||||
|
||||
$(info OS_NAME is $(OS_NAME))
|
||||
|
||||
|
||||
|
||||
nomqtt: CFLAGS = -DLINBPQ -MMD -fcommon -g -rdynamic -DNOMQTT -fasynchronous-unwind-tables
|
||||
nomqtt: LIBS = -lminiupnpc -lm -lz -lpthread -lconfig -lpcap
|
||||
nomqtt: linbpq
|
||||
|
||||
noi2c: CFLAGS = -DLINBPQ -MMD -DNOI2C -g -rdynamic -fcommon -fasynchronous-unwind-tables
|
||||
noi2c: LIBS = -lpaho-mqtt3a -ljansson -lminiupnpc -lm -lz -lpthread -lconfig -lpcap
|
||||
noi2c: linbpq
|
||||
|
||||
|
||||
linbpq: $(OBJS)
|
||||
cc $(OBJS) $(CFLAGS) $(LDFLAGS) $(LIBS) -o linbpq
|
||||
sudo setcap "CAP_NET_ADMIN=ep CAP_NET_RAW=ep CAP_NET_BIND_SERVICE=ep" linbpq
|
||||
|
||||
-include *.d
|
||||
|
||||
clean :
|
||||
rm *.d
|
||||
rm linbpq $(OBJS)
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Loading…
Reference in new issue