Merge pull request #1 from g4klx/master

updating to head
This commit is contained in:
ku-mi 2020-06-11 20:26:58 +02:00 committed by GitHub
commit 4756b92c58
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 227 additions and 31 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2015-2019 by Jonathan Naylor G4KLX
* Copyright (C) 2015-2020 by Jonathan Naylor G4KLX
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -32,7 +32,8 @@ enum SECTION {
SECTION_ID_LOOKUP,
SECTION_VOICE,
SECTION_LOG,
SECTION_NETWORK
SECTION_NETWORK,
SECTION_REMOTE_COMMANDS
};
CConf::CConf(const std::string& file) :
@ -57,7 +58,9 @@ m_networkParrotAddress("127.0.0.1"),
m_networkParrotPort(0U),
m_networkStartup(9999U),
m_networkInactivityTimeout(0U),
m_networkDebug(false)
m_networkDebug(false),
m_remoteCommandsEnabled(false),
m_remoteCommandsPort(6074U)
{
}
@ -91,6 +94,8 @@ bool CConf::read()
section = SECTION_LOG;
else if (::strncmp(buffer, "[Network]", 9U) == 0)
section = SECTION_NETWORK;
else if (::strncmp(buffer, "[Remote Commands]", 17U) == 0)
section = SECTION_REMOTE_COMMANDS;
else
section = SECTION_NONE;
@ -152,6 +157,11 @@ bool CConf::read()
m_networkInactivityTimeout = (unsigned int)::atoi(value);
else if (::strcmp(key, "Debug") == 0)
m_networkDebug = ::atoi(value) == 1;
} else if (section == SECTION_REMOTE_COMMANDS) {
if (::strcmp(key, "Enable") == 0)
m_remoteCommandsEnabled = ::atoi(value) == 1;
else if (::strcmp(key, "Port") == 0)
m_remoteCommandsPort = (unsigned int)::atoi(value);
}
}
@ -264,3 +274,13 @@ bool CConf::getNetworkDebug() const
{
return m_networkDebug;
}
bool CConf::getRemoteCommandsEnabled() const
{
return m_remoteCommandsEnabled;
}
unsigned int CConf::getRemoteCommandsPort() const
{
return m_remoteCommandsPort;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2015-2019 by Jonathan Naylor G4KLX
* Copyright (C) 2015-2020 by Jonathan Naylor G4KLX
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -61,6 +61,10 @@ public:
unsigned int getNetworkInactivityTimeout() const;
bool getNetworkDebug() const;
// The Remote Commands section
bool getRemoteCommandsEnabled() const;
unsigned int getRemoteCommandsPort() const;
private:
std::string m_file;
std::string m_callsign;
@ -88,6 +92,9 @@ private:
unsigned int m_networkStartup;
unsigned int m_networkInactivityTimeout;
bool m_networkDebug;
bool m_remoteCommandsEnabled;
unsigned int m_remoteCommandsPort;
};
#endif

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2016-2019 by Jonathan Naylor G4KLX
* Copyright (C) 2016-2020 by Jonathan Naylor G4KLX
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -25,6 +25,7 @@
#include "Thread.h"
#include "Voice.h"
#include "Timer.h"
#include "Utils.h"
#include "Log.h"
#if defined(_WIN32) || defined(_WIN64)
@ -169,6 +170,16 @@ void CP25Gateway::run()
in_addr rptAddr = CUDPSocket::lookup(m_conf.getRptAddress());
unsigned int rptPort = m_conf.getRptPort();
CUDPSocket* remoteSocket = NULL;
if (m_conf.getRemoteCommandsEnabled()) {
remoteSocket = new CUDPSocket(m_conf.getRemoteCommandsPort());
ret = remoteSocket->open();
if (!ret) {
delete remoteSocket;
remoteSocket = NULL;
}
}
CNetwork localNetwork(m_conf.getMyPort(), m_conf.getCallsign(), false);
ret = localNetwork.open();
if (!ret) {
@ -360,6 +371,79 @@ void CP25Gateway::run()
reflectors.clock(ms);
if (remoteSocket != NULL) {
int res = remoteSocket->read(buffer, 200U, address, port);
if (res > 0) {
buffer[res] = '\0';
if (::memcmp(buffer + 0U, "TalkGroup", 9U) == 0) {
unsigned int tg = (unsigned int)::atoi((char*)(buffer + 9U));
CP25Reflector* reflector = NULL;
if (tg != 9999U)
reflector = reflectors.find(tg);
if (reflector == NULL && currentId != 9999U) {
LogMessage("Unlinked from reflector %u by remote command", currentId);
if (voice != NULL)
voice->unlinked();
remoteNetwork.writeUnlink(currentAddr, currentPort);
remoteNetwork.writeUnlink(currentAddr, currentPort);
remoteNetwork.writeUnlink(currentAddr, currentPort);
inactivityTimer.stop();
pollTimer.stop();
lostTimer.stop();
currentId = 9999U;
} else if (reflector != NULL && currentId == 9999U) {
currentId = tg;
currentAddr = reflector->m_address;
currentPort = reflector->m_port;
LogMessage("Linked to reflector %u by remote command", currentId);
if (voice != NULL)
voice->linkedTo(currentId);
remoteNetwork.writePoll(currentAddr, currentPort);
remoteNetwork.writePoll(currentAddr, currentPort);
remoteNetwork.writePoll(currentAddr, currentPort);
inactivityTimer.start();
pollTimer.start();
lostTimer.start();
} else if (reflector != NULL && currentId != 9999U) {
LogMessage("Unlinked from reflector %u by remote command", currentId);
remoteNetwork.writeUnlink(currentAddr, currentPort);
remoteNetwork.writeUnlink(currentAddr, currentPort);
remoteNetwork.writeUnlink(currentAddr, currentPort);
currentId = tg;
currentAddr = reflector->m_address;
currentPort = reflector->m_port;
LogMessage("Linked to reflector %u by remote command", currentId);
if (voice != NULL)
voice->linkedTo(currentId);
remoteNetwork.writePoll(currentAddr, currentPort);
remoteNetwork.writePoll(currentAddr, currentPort);
remoteNetwork.writePoll(currentAddr, currentPort);
inactivityTimer.start();
pollTimer.start();
lostTimer.start();
}
} else {
CUtils::dump("Invalid remote command received", buffer, res);
}
}
}
if (voice != NULL)
voice->clock(ms);
@ -437,6 +521,11 @@ void CP25Gateway::run()
delete voice;
if (remoteSocket != NULL) {
remoteSocket->close();
delete remoteSocket;
}
localNetwork.close();
remoteNetwork.close();

View File

@ -28,3 +28,7 @@ ParrotPort=42011
# Startup=10100
InactivityTimeout=10
Debug=0
[Remote Commands]
Enable=0
Port=6074

View File

@ -22,32 +22,32 @@
<ProjectGuid>{8B7A5406-8560-4B40-ADDA-9B8EBF93E232}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>P25Gateway</RootNamespace>
<WindowsTargetPlatformVersion>10.0.15063.0</WindowsTargetPlatformVersion>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>

View File

@ -2,8 +2,6 @@
#
# The format of this file is the number of the Talk Group followed by the host name or address and port
#
# HELLAS Zone P25 TG202
202 hellaszone.com 41000
# 4 Wires-x,NXDN,YSF,XLX(D-Star & DMR),BM Bridge
4 p25.duckdns.org 41004
@ -11,8 +9,14 @@
# XLX045E P25 <-> DMR/DSTAR/YSF/NXDN
6 70.44.20.24 41000
# HELLAS Zone P25 TG202
202 hellaszone.com 41000
# HBLink Poland P25 TG260
260 p25.hblink.pl 41000
# 420 Super Freq
420 p25.evsuperfreqs.com 41000
420 hb.superfreqdigital.com 41000
# 530 NZ
530 zldigitalreflectors.hopto.org 41000
@ -20,6 +24,9 @@
# 707 Rural Minnesota - Bridge to TGIF707, YSF US RuralMN-707
707 707p25.kd0ioe.com 41000
# 858 San Diego, CA
858 nz6d.dx40.com 41000
# 927 Southern California
927 927.org 41000
@ -32,6 +39,9 @@
# 3023 Ontario Crosslink
3023 ontxlink.hopto.org 41000
# 3142 Pennsylvania
3142 3.215.215.169 41002
# 5057 VK7 TAS
5057 45.248.50.37 41000
@ -44,21 +54,51 @@
# 10100 World Wide http://www.george-smart.co.uk/p25/
10100 m1geo.com 41000
# 10101 World Wide TAC 1 (Bridged to the P25NX Network).
10101 44.98.254.131 41000
# 10102 World Wide TAC 2 (Bridged to the P25NX Network).
10102 44.98.254.131 41001
# 10103 World Wide TAC 3 (Bridged to the P25NX Network).
10103 44.98.254.131 41002
# 10200 North America
10200 dvswitch.org 41000
# 10201 North America TAC 1
10201 dvswitch.org 41010
# 10202 North America TAC 2 (Bridged to the P25NX Network).
10202 44.98.254.131 41003
# 10203 North America TAC 3 (Bridged to the P25NX Network).
10203 44.98.254.131 41004
# P25 France
10208 m55.evxonline.net 41000
# P25 Fun Machine WE0FUN Bridge to C4FM, DMR, DStar, NXDN and AllStarLink (Analog) http://www.we0fun.com
10209 p25.we0fun.com 41000
# 10216 Northeast Ohio
10216 xlx216.km8v.com 41000
# 10260 Poland
10260 31.0.161.238 41000
# 10200 North America TAC 1
10201 dvswitch.org 41010
# 10300 Europe https://p25-eu.n18.de/
10300 176.9.1.168 41000
# 10301 Europe
# 10301 Europe TAC 1
10301 ea5gvk.duckdns.org 41000
# 10302 Europe TAC 2 (Bridged to the P25NX Network).
10302 44.98.254.131 41005
# 10303 Europe TAC 3 (Bridged to the P25NX Network).
10303 44.98.254.131 41006
# 10310 Germany HAMNET (Bridge to 10320) http://44.148.230.100/
10310 44.148.230.100 41000
@ -98,9 +138,18 @@
# 10700 Australia NSW Bridge to AU NSW YSF
10700 p25nsw.gustotech.net 41000
# 10945 Deutschland DL1BH
10945 dl1bh.ddns.net 41000
# 22200 IT HBLINK REFLECTOR
22200 p25.hblink.it 41000
# 22212 IT PIEDMONT GDO
22212 p25gdo.duckdns.org 41000
# 22220 IT ECHOLINK REFLECTOR
22220 dagobah.hblink.it 41000
# 23225 Austria
23225 94.199.173.123 41000
@ -116,6 +165,9 @@
# 31010 Alabama Link
31010 p25.alabamalink.info 41000
# 31057 AF5XP Sulphur,Louisiana
31057 af5xp.ddns.net 41000
# 31062 Mountain West
31062 p25.mw-dmr.net 41000
@ -129,7 +181,7 @@
31092 p25.alecwasserman.com 41000
# 31161 Virginia
31161 24.53.67.238 41000
31161 24.49.15.69 41000
# 31171 Illinois
31171 74.208.235.115 41000
@ -137,6 +189,9 @@
# 31188 Southern Indiana
31188 w9windigital.org 41000
# 31264 XLX625 The BROniverse www.wa8bro.com
31264 p25.dudetronics.com 41000
# 31340 Central New Jersey
31340 cnjham.msmts.com 41000
@ -149,21 +204,39 @@
# XLX045A P25 <-> DMR/DSTAR/YSF/NXDN <-> BM TG31425 PA Wide Cross Mode
31425 70.44.20.24 41001
# PA Cross Mode (alt), 31426
31426 3.215.215.169 41001
# 31444 RI DIGITAL LINK TG#31444
31444 149.28.54.153 41000
# 31620 Kings of Digital
31620 wb5ekup25.duckdns.org 41000
# 31665 TGIF Network, http://tgif.network
31665 tgif.network 41000
# 31672 P25 Pi-Star chat
31672 p25-31672.pistar.uk 41000
# 31691 US Midwest P25 Reflector
31691 net.w3axl.com 43169
# 31777 DX-LINK
31777 8.9.4.102 41000
# 31888 KG4JPL North-Central Florida
31888 p25.kg4jpl.com 41000
# 31983 K8JTK Hub Multimode ILS/DVMIS (K8JTK.org)
31983 P25Reflector31983.K8JTK.org 41000
# 32103 CW-Ops Academy
32103 cwops.dyndns.org 41000
# 33581 OMISS Group
33581 omiss.dyndns.org 41000
# 40721 Fusion Canada Fr
40721 38.110.97.161 41000
@ -173,7 +246,7 @@
# 50525 Bridge to YSF, NXDN and DMR
50525 50525.p25dvm.com 41000
# 51575 PH-Dumaguete Link to YSF and DMR (BM 51575)
# 51575 PH-Dumaguete Link (Multimode)
51575 140.82.14.24 41000
# 53099 New Zealand bridge to D-Star, DMR and NXDN

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2015-2019 by Jonathan Naylor G4KLX
* Copyright (C) 2015-2020 by Jonathan Naylor G4KLX
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -19,6 +19,6 @@
#if !defined(VERSION_H)
#define VERSION_H
const char* VERSION = "20190304";
const char* VERSION = "20200403";
#endif

View File

@ -22,32 +22,32 @@
<ProjectGuid>{2AE94EAA-FD57-45C9-8555-6425CFA777A3}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>P25Parrot</RootNamespace>
<WindowsTargetPlatformVersion>10.0.15063.0</WindowsTargetPlatformVersion>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>

View File

@ -50,32 +50,32 @@
<ProjectGuid>{C68ABEB3-5CDD-4B26-8D66-77FE81EC6BB5}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>P25Reflector</RootNamespace>
<WindowsTargetPlatformVersion>10.0.16299.0</WindowsTargetPlatformVersion>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>

View File

@ -1,3 +1,6 @@
# 22200 HBLINK Italy
22200 p25.hbink.it 41000
# 2221 IT PIEDMONT GDO
2221 iz1zpj.duckdns.org 41000