removed all possible configure.h defined values

pull/1/head
Tom Early 3 years ago
parent c21521eb10
commit f4aab8cfc1

@ -27,6 +27,7 @@
bool CBMProtocol::Initialize(const char *type, const EProtocol ptype, const uint16_t port, const bool has_ipv4, const bool has_ipv6) bool CBMProtocol::Initialize(const char *type, const EProtocol ptype, const uint16_t port, const bool has_ipv4, const bool has_ipv6)
{ {
m_HasTranscoder = g_Conf.IsString(g_Keys.modules.tcmodules);
if (! CProtocol::Initialize(type, ptype, port, has_ipv4, has_ipv6)) if (! CProtocol::Initialize(type, ptype, port, has_ipv4, has_ipv6))
return false; return false;
@ -225,11 +226,10 @@ void CBMProtocol::HandleQueue(void)
break; break;
case EProtoRev::ambe: case EProtoRev::ambe:
default: default:
#ifdef TRANSCODED_MODULES if (m_HasTranscoder)
Send(buffer, client->GetIp()); Send(buffer, client->GetIp());
#else else
Send(bufferLegacy, client->GetIp()); Send(bufferLegacy, client->GetIp());
#endif
break; break;
} }
} }

@ -73,4 +73,6 @@ protected:
// time // time
CTimer m_LastKeepaliveTime; CTimer m_LastKeepaliveTime;
CTimer m_LastPeersLinkTime; CTimer m_LastPeersLinkTime;
// config data;
bool m_HasTranscoder;
}; };

@ -92,9 +92,7 @@ bool CGateKeeper::MayLink(const CCallsign &callsign, const CIp &ip, EProtocol pr
case EProtocol::p25: case EProtocol::p25:
case EProtocol::usrp: case EProtocol::usrp:
case EProtocol::nxdn: case EProtocol::nxdn:
#ifndef NO_G3
case EProtocol::g3: case EProtocol::g3:
#endif
// first check is IP & callsigned listed OK // first check is IP & callsigned listed OK
ok &= IsNodeListedOk(callsign, ip); ok &= IsNodeListedOk(callsign, ip);
// todo: then apply any protocol specific authorisation for the operation // todo: then apply any protocol specific authorisation for the operation
@ -141,9 +139,7 @@ bool CGateKeeper::MayTransmit(const CCallsign &callsign, const CIp &ip, const EP
case EProtocol::p25: case EProtocol::p25:
case EProtocol::nxdn: case EProtocol::nxdn:
case EProtocol::usrp: case EProtocol::usrp:
#ifndef NO_G3
case EProtocol::g3: case EProtocol::g3:
#endif
// first check is IP & callsigned listed OK // first check is IP & callsigned listed OK
ok = ok && IsNodeListedOk(callsign, ip, module); ok = ok && IsNodeListedOk(callsign, ip, module);
// todo: then apply any protocol specific authorisation for the operation // todo: then apply any protocol specific authorisation for the operation
@ -300,10 +296,8 @@ const std::string CGateKeeper::ProtocolName(const EProtocol p) const
return "USRP"; return "USRP";
case EProtocol::bm: case EProtocol::bm:
return "Brandmeister"; return "Brandmeister";
#ifndef NO_G3
case EProtocol::g3: case EProtocol::g3:
return "Icom G3"; return "Icom G3";
#endif
default: default:
return "NONE"; return "NONE";
} }

@ -25,7 +25,7 @@ INICHECK = inicheck
include configure.mk include configure.mk
ifeq ($(debug), true) ifeq ($(debug), true)
CFLAGS = -ggdb3 -W -Werror -c -std=c++11 -MMD -MD CFLAGS = -ggdb3 -DDEBUG -W -Werror -c -std=c++11 -MMD -MD
else else
CFLAGS = -W -Werror -std=c++11 -MMD -MD CFLAGS = -W -Werror -std=c++11 -MMD -MD
endif endif

@ -22,11 +22,7 @@
//////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////
// constructor // constructor
#ifdef TRANSCODED_MODULES
CPacketStream::CPacketStream(std::shared_ptr<CUnixDgramReader> reader)
#else
CPacketStream::CPacketStream() CPacketStream::CPacketStream()
#endif
{ {
m_bOpen = false; m_bOpen = false;
m_uiStreamId = 0; m_uiStreamId = 0;

@ -25,6 +25,9 @@
#include "YSFProtocol.h" #include "YSFProtocol.h"
#include "Global.h" #include "Global.h"
#define REG_NAME_SIZE 16
#define REG_DESC_SIZE 14
//////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////
// constructor // constructor
CYsfProtocol::CYsfProtocol() CYsfProtocol::CYsfProtocol()
@ -39,6 +42,11 @@ bool CYsfProtocol::Initialize(const char *type, const EProtocol ptype, const uin
{ {
// config data // config data
m_AutolinkModule = g_Conf.GetAutolinkModule(g_Keys.ysf.autolinkmod); m_AutolinkModule = g_Conf.GetAutolinkModule(g_Keys.ysf.autolinkmod);
m_RegistrationId = g_Conf.GetUnsigned(g_Keys.ysf.ysfreflectordb.id);
m_RegistrationName.assign(g_Conf.GetString(g_Keys.ysf.ysfreflectordb.name));
m_RegistrationDesc.assign(g_Conf.GetString(g_Keys.ysf.ysfreflectordb.description));
m_RegistrationName.resize(REG_NAME_SIZE, ' ');
m_RegistrationDesc.resize(REG_DESC_SIZE, ' ');
// base class // base class
if (! CProtocol::Initialize(type, ptype, port, has_ipv4, has_ipv6)) if (! CProtocol::Initialize(type, ptype, port, has_ipv4, has_ipv6))
@ -982,32 +990,20 @@ bool CYsfProtocol::IsValidOptionsPacket(const CBuffer &Buffer) const
bool CYsfProtocol::EncodeServerStatusPacket(CBuffer *Buffer) const bool CYsfProtocol::EncodeServerStatusPacket(CBuffer *Buffer) const
{ {
uint8_t tag[] = { 'Y','S','F','S' }; uint8_t tag[] = { 'Y','S','F','S' };
uint8_t description[14]; uint8_t description[REG_DESC_SIZE];
uint8_t callsign[16]; uint8_t callsign[REG_NAME_SIZE];
#ifdef YSF_REFLECTOR_DESCRIPTION
const std::string desc = YSF_REFLECTOR_DESCRIPTION;
#else
const std::string desc("URF Reflector");
#endif
// tag // tag
Buffer->Set(tag, sizeof(tag)); Buffer->Set(tag, sizeof(tag));
// hash // hash
memset(callsign, ' ', sizeof(callsign)); memcpy(callsign, m_RegistrationName.c_str(), 16);
#ifdef YSF_REFLECTOR_NAME
const std::string cs = YSF_REFLECTOR_NAME;
memcpy(callsign, cs.c_str(), cs.size() > 16 ? 16 : cs.size());
#else
g_Refl.GetCallsign().GetCallsign(callsign);
#endif
char sz[16]; char sz[16];
::sprintf(sz, "%05u", CalcHash(callsign, 16) % 100000U); ::sprintf(sz, "%05u", CalcHash(callsign, REG_NAME_SIZE) % 100000U);
Buffer->Append((uint8_t *)sz, 5); Buffer->Append((uint8_t *)sz, 5);
// name // name
Buffer->Append(callsign, 16); Buffer->Append(callsign, REG_NAME_SIZE);
// description // description
memset(description, ' ', sizeof(description)); memcpy(description, m_RegistrationDesc.c_str(), REG_DESC_SIZE);
memcpy(description, desc.c_str(), desc.size() > 14 ? 14 : desc.size()); Buffer->Append(description, REG_DESC_SIZE);
Buffer->Append(description, 14);
// connected clients // connected clients
CClients *clients = g_Refl.GetClients(); CClients *clients = g_Refl.GetClients();
int count = MIN(999, clients->GetSize()); int count = MIN(999, clients->GetSize());
@ -1021,10 +1017,7 @@ bool CYsfProtocol::EncodeServerStatusPacket(CBuffer *Buffer) const
uint32_t CYsfProtocol::CalcHash(const uint8_t *buffer, int len) const uint32_t CYsfProtocol::CalcHash(const uint8_t *buffer, int len) const
{ {
#ifdef YSF_REFLECTOR_ID uint32_t hash = m_RegistrationId;
uint32_t hash = YSF_REFLECTOR_ID;
#else
uint32_t hash = 0U;
for ( int i = 0; i < len; i++) for ( int i = 0; i < len; i++)
{ {
@ -1032,7 +1025,6 @@ uint32_t CYsfProtocol::CalcHash(const uint8_t *buffer, int len) const
hash += (hash << 10); hash += (hash << 10);
hash ^= (hash >> 6); hash ^= (hash >> 6);
} }
#endif
hash += (hash << 3); hash += (hash << 3);
hash ^= (hash >> 11); hash ^= (hash >> 11);

@ -133,4 +133,6 @@ protected:
// config data // config data
char m_AutolinkModule; char m_AutolinkModule;
unsigned m_RegistrationId;
std::string m_RegistrationName, m_RegistrationDesc;
}; };

Loading…
Cancel
Save

Powered by TurnKey Linux.