USRP parameters for two-way client

pull/1/head
Tom Early 3 years ago
parent 95e8c4d07a
commit 9b1df226a4

@ -12,7 +12,7 @@ Country = GB
Sponsor = My Home Club
[IpAddresses]
[IP Addresses]
# Binding addresses are usually the 'any' address
IPv4Binding = 0.0.0.0
@ -80,10 +80,11 @@ Port = 10017
[USRP]
Enable = false
Port = 32000
RxPort = 34000
TxPort = 32000
Module = A # this has to be a transcoded module!
Callsign = ALLSTAR
#FilePath = /home/usr/Clients.txt # An experimental area of development
#FilePath = /home/usr/Clients.txt
[YSF]
Port = 42000

@ -51,7 +51,7 @@
#define JG3 "G3"
#define JG3TERMINALPATH "G3TerminalPath"
#define JINTERLINKPATH "InterlinkPath"
#define JIPADDRESSES "IpAddresses"
#define JIPADDRESSES "IP Addresses"
#define JIPV4BINDING "IPv4Binding"
#define JIPV4EXTERNAL "IPv4External"
#define JIPV6BINDING "IPv6Binding"
@ -73,10 +73,12 @@
#define JREGISTRATIONDESCRIPTION "RegistrationDescription"
#define JREGISTRATIONID "RegistrationID"
#define JREGISTRATIONNAME "RegistrationName"
#define JRXPORT "RxPort"
#define JSPONSOR "Sponsor"
#define JSYSOPEMAIL "SysopEmail"
#define JTRANSCODED "Transcoded"
#define JTRANSCODER "Transcoder"
#define JTXPORT "TxPort"
#define JURF "URF"
#define JURL "URL"
#define JUSRP "USRP"
@ -396,8 +398,10 @@ bool CConfigure::ReadData(const std::string &path)
case ESection::usrp:
if (0 == key.compare(JENABLE))
data[g_Keys.usrp.enable] = IS_TRUE(value[0]);
else if (0 == key.compare(JPORT))
data[g_Keys.usrp.port] = getUnsigned(value, "USRP Port", 1024, 65535, 32000);
else if (0 == key.compare(JTXPORT))
data[g_Keys.usrp.txport] = getUnsigned(value, "USRP TxPort", 1024, 65535, 32000);
else if (0 == key.compare(JRXPORT))
data[g_Keys.usrp.rxport] = getUnsigned(value, "USRP RxPort", 1024, 65535, 34000);
else if (0 == key.compare(JMODULE))
data[g_Keys.usrp.module] = value.substr(0, 1);
else if (0 == key.compare(JCALLSIGN))
@ -684,7 +688,8 @@ bool CConfigure::ReadData(const std::string &path)
rval = true;
}
}
isDefined(ErrorLevel::fatal, JUSRP, JPORT, g_Keys.usrp.port, rval);
isDefined(ErrorLevel::fatal, JUSRP, JTXPORT, g_Keys.usrp.txport, rval);
isDefined(ErrorLevel::fatal, JUSRP, JRXPORT, g_Keys.usrp.rxport, rval);
isDefined(ErrorLevel::fatal, JUSRP, JCALLSIGN, g_Keys.usrp.callsign, rval);
//if (isDefined(ErrorLevel::fatal, JUSRP, JFILEPATH, g_Keys.usrp.filepath, rval))
if (data.contains(g_Keys.usrp.filepath))

@ -49,8 +49,8 @@ struct SJsonKeys {
modules { "Modules", "TranscodedModules",
"DescriptionA", "DescriptionB", "DescriptionC", "DescriptionD", "DescriptionE", "DescriptionF", "DescriptionG", "DescriptionH", "DescriptionI", "DescriptionJ", "DescriptionK", "DescriptionL", "DescriptionM", "DescriptionN", "DescriptionO", "DescriptionP", "DescriptionQ", "DescriptionR", "DescriptionS", "DescriptionT", "DescriptionU", "DescriptionV", "DescriptionW", "DescriptionX", "DescriptionY", "DescriptionZ" };
struct USRP { const std::string enable, port, module, callsign, filepath; }
usrp { "usrpEnable", "urspPort", "usrpModule", "usrpCallsign", "usrpFilePath" };
struct USRP { const std::string enable, txport,rxport, module, callsign, filepath; }
usrp { "usrpEnable", "urspTxPort", "usrpRxPort", "usrpModule", "usrpCallsign", "usrpFilePath" };
struct P25NXDN { const std::string port, autolinkmod, reflectorid; }
p25 { "P25Port", "P25AutolinkMod", "P25ReflectorID" },

@ -94,7 +94,7 @@ bool CProtocols::Init(void)
if (g_Conf.GetBoolean(g_Keys.usrp.enable))
{
m_Protocols.emplace_back(std::unique_ptr<CUSRPProtocol>(new CUSRPProtocol));
if (! m_Protocols.back()->Initialize("USRP", EProtocol::usrp, uint16_t(g_Conf.GetUnsigned(g_Keys.usrp.port)), USRP_IPV4, USRP_IPV6))
if (! m_Protocols.back()->Initialize("USRP", EProtocol::usrp, uint16_t(g_Conf.GetUnsigned(g_Keys.usrp.rxport)), USRP_IPV4, USRP_IPV6))
return false;
}

@ -1,4 +1,7 @@
// Copyright © 2015 Jean-Luc Deltombe (LX3JL). All rights reserved.
// urfd -- The universal reflector
// Copyright © 2023 Thomas A. Early N7TAE
// Copyright © 2023 Doug McLain AD8DP
//
// This program is free software: you can redistribute it and/or modify
@ -14,7 +17,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
#include "Defines.h"
#include <string.h>
#include "USRPClient.h"
#include "USRPProtocol.h"
@ -39,13 +42,21 @@ bool CUSRPProtocol::Initialize(const char *type, const EProtocol ptype, const ui
std::ifstream file;
std::streampos size;
// base class
// base class, create the listing port for the read-write client
if (! CProtocol::Initialize(type, ptype, port, has_ipv4, has_ipv6))
return false;
m_CStr.assign(g_Conf.GetString(g_Keys.usrp.callsign));
m_Module = g_Conf.GetString(g_Keys.usrp.module).at(0);
m_Module = g_Conf.GetAutolinkModule(g_Keys.usrp.module);
// create the one special USRP Tx/Rx client
m_Callsign.SetCallsign(g_Conf.GetString(g_Keys.usrp.callsign), false);
CIp ip(AF_INET, uint16_t(g_Conf.GetUnsigned(g_Keys.usrp.txport)), g_Conf.GetString(g_Keys.ip.ipv4bind).c_str());
auto newclient = std::make_shared<CUSRPClient>(m_Callsign, ip);
newclient->SetReflectorModule(m_Module);
g_Refl.GetClients()->AddClient(newclient);
g_Refl.ReleaseClients();
// now create "listen-only" clients, as many as specified
file.open(g_Conf.GetString(g_Keys.usrp.filepath), std::ios::in | std::ios::binary | std::ios::ate);
if ( file.is_open() )
{
@ -79,9 +90,10 @@ bool CUSRPProtocol::Initialize(const char *type, const EProtocol ptype, const ui
((port = ::strtok(nullptr, ";")) != nullptr) &&
((clientcs = ::strtok(nullptr, ";")) != nullptr) )
{
uint32_t ui = atoi(port);
uint16_t ui = atoi(port);
CIp Ip(AF_INET, ui, ip);
CCallsign cs(clientcs);
CCallsign cs;
cs.SetCallsign(clientcs, false);
auto newclient = std::make_shared<CUSRPClient>(cs, Ip);
newclient->SetReflectorModule(m_Module);
g_Refl.GetClients()->AddClient(newclient);
@ -274,14 +286,12 @@ bool CUSRPProtocol::IsValidDvPacket(const CIp &Ip, const CBuffer &Buffer, std::u
if ( !stream )
{
m_uiStreamId = static_cast<uint32_t>(::rand());
CCallsign csMY, rpt1, rpt2, csUR;
csMY.SetCallsign(m_CStr, false);
rpt1.SetCallsign(m_CStr, false);
rpt2 = m_ReflectorCallsign;
csUR.SetCallsign("CQCQCQ", false);
CCallsign csMY;
CCallsign rpt1 = m_Callsign;
CCallsign rpt2 = m_ReflectorCallsign;
rpt1.SetCSModule(m_Module);
rpt2.SetCSModule(' ');
header = std::unique_ptr<CDvHeaderPacket>(new CDvHeaderPacket(csMY, csUR, rpt1, rpt2, m_uiStreamId, true));
header = std::unique_ptr<CDvHeaderPacket>(new CDvHeaderPacket(csMY, CCallsign("CQCQCQ"), rpt1, rpt2, m_uiStreamId, true));
OnDvHeaderPacketIn(header, Ip);
}
@ -307,11 +317,9 @@ bool CUSRPProtocol::IsValidDvHeaderPacket(const CIp &Ip, const CBuffer &Buffer,
CCallsign csMY = CCallsign("", uiSrcId);
CCallsign rpt1 = CCallsign("", uiSrcId);
CCallsign rpt2 = m_ReflectorCallsign;
CCallsign csUR;
csUR.SetCallsign("CQCQCQ", false);
rpt1.SetCSModule(m_Module);
rpt2.SetCSModule(' ');
header = std::unique_ptr<CDvHeaderPacket>(new CDvHeaderPacket(csMY, csUR, rpt1, rpt2, m_uiStreamId, true));
header = std::unique_ptr<CDvHeaderPacket>(new CDvHeaderPacket(csMY, CCallsign("CQCQCQ"), rpt1, rpt2, m_uiStreamId, true));
}
return true;
}

@ -70,6 +70,7 @@ protected:
private:
// CConfigure data
std::string m_CStr;
CCallsign m_Callsign;
char m_Module;
uint16_t m_txPort;
};

Loading…
Cancel
Save

Powered by TurnKey Linux.