implement support for low-level TCP sockets; deprecate and remove new_unique macro and use appropriate std::make_unique; apply various clang linting;

pull/48/head
Bryan Biedenkapp 2 years ago
parent 68bfae72bb
commit d9e2458722

@ -179,7 +179,7 @@ execute_process(COMMAND git describe --abbrev=8 --always WORKING_DIRECTORY ${CMA
add_definitions(-D__GIT_VER__="${GIT_VER}")
add_definitions(-D__GIT_VER_HASH__="${GIT_VER_HASH}")
project(dvmcore)
project(dvm)
include(src/CMakeLists.txt)
if (ENABLE_TESTS)

@ -31,8 +31,7 @@
#if !defined(__COMMON_DEFINES_H__)
#define __COMMON_DEFINES_H__
#include <stdint.h>
#include <cstdint>
#include <memory>
#include <sstream>
#include <ios>

@ -70,7 +70,7 @@ bool g_disableTimeDisplay = false;
static struct tm m_tm;
static std::ostream m_outStream{std::cerr.rdbuf()};
static std::ostream m_outStream { std::cerr.rdbuf() };
static char LEVELS[] = " DMIWEF";

@ -80,7 +80,7 @@ ulong64_t StopWatch::start()
}
/// <summary>
/// Gets the elpased time since the stopwatch started.
/// Gets the elapsed time since the stopwatch started.
/// </summary>
/// <returns></returns>
uint32_t StopWatch::elapsed()

@ -51,7 +51,7 @@ public:
/// <summary>Starts the stopwatch.</summary>
ulong64_t start();
/// <summary>Gets the elpased time since the stopwatch started.</summary>
/// <summary>Gets the elapsed time since the stopwatch started.</summary>
uint32_t elapsed();
private:

@ -30,7 +30,6 @@
*/
#include "Thread.h"
#include <sys/prctl.h>
#include <signal.h>
#include <unistd.h>
@ -51,10 +50,7 @@ Thread::Thread() :
/// <summary>
/// Finalizes a instance of the Thread class.
/// </summary>
Thread::~Thread()
{
/* stub */
}
Thread::~Thread() = default;
/// <summary>
/// Starts the thread execution.

@ -50,7 +50,7 @@ public:
}
/// <summary>User-defined function to run for the thread main.</summary>
virtual void entry()
void entry() override
{
if (m_entry != nullptr)
m_entry();

@ -74,10 +74,7 @@ Timer::Timer(uint32_t ticksPerSec, uint32_t secs, uint32_t msecs) :
/// <summary>
/// Finalizes a instance of the Timer class.
/// </summary>
Timer::~Timer()
{
/* stub */
}
Timer::~Timer() = default;
/// <summary>
/// Sets the timeout for the timer.

@ -57,7 +57,7 @@ public:
/// <summary>Gets the currently remaining time for the timer.</summary>
/// <returns>Amount of time remaining before the timeout.</returns>
uint32_t getRemaining()
uint32_t getRemaining() const
{
if (m_timeout == 0U || m_timer == 0U)
return 0U;
@ -70,14 +70,14 @@ public:
/// <summary>Flag indicating whether the timer is running.</summary>
/// <returns>True, if the timer is still running, otherwise false.</returns>
bool isRunning()
bool isRunning() const
{
return m_timer > 0U;
}
/// <summary>Flag indicating whether the timer is paused.</summary>
/// <returns>True, if the timer is paused, otherwise false.</returns>
bool isPaused()
bool isPaused() const
{
return m_paused;
}
@ -121,7 +121,7 @@ public:
/// <summary>Flag indicating whether or not the timer has reached timeout and expired.</summary>
/// <returns>True, if the timer is expired, otherwise false.</returns>
bool hasExpired()
bool hasExpired() const
{
if (m_timeout == 0U || m_timer == 0U)
return false;

@ -171,8 +171,6 @@ inline std::string strtoupper(const std::string value) {
((buffer[offset + 0U] << 8) & 0xFF00U) | \
((buffer[offset + 1U] << 0) & 0x00FFU);
#define new_unique(type, ...) std::unique_ptr<type>(new type(__VA_ARGS__))
/// <summary>Unique uint8_t array.</summary>
typedef std::unique_ptr<uint8_t[]> UInt8Array;

@ -52,10 +52,7 @@ SlotType::SlotType() :
/// <summary>
/// Finalizes a instance of the SlotType class.
/// </summary>
SlotType::~SlotType()
{
/* stub */
}
SlotType::~SlotType() = default;
/// <summary>
/// Decodes DMR slot type.

@ -30,14 +30,9 @@
*/
#include "Defines.h"
#include "dmr/acl/AccessControl.h"
#include "Log.h"
using namespace dmr::acl;
#include <algorithm>
#include <vector>
#include <cstring>
// ---------------------------------------------------------------------------
// Static Class Members
// ---------------------------------------------------------------------------
@ -64,7 +59,7 @@ void AccessControl::init(RadioIdLookup* ridLookup, TalkgroupRulesLookup* tidLook
bool AccessControl::validateSrcId(uint32_t id)
{
// check if RID ACLs are enabled
if (m_ridLookup->getACL() == false) {
if (!m_ridLookup->getACL()) {
RadioId rid = m_ridLookup->find(id);
if (!rid.radioDefault() && !rid.radioEnabled()) {
return false;
@ -94,7 +89,7 @@ bool AccessControl::validateTGId(uint32_t slotNo, uint32_t id)
return false;
// check if TID ACLs are enabled
if (m_tidLookup->getACL() == false) {
if (!m_tidLookup->getACL()) {
return true;
}

@ -25,12 +25,10 @@
#include "Defines.h"
#include "dmr/DMRDefines.h"
#include "dmr/data/Data.h"
#include "Utils.h"
using namespace dmr::data;
using namespace dmr;
#include <cstdio>
#include <cstring>
#include <cassert>

@ -33,14 +33,12 @@
#include "dmr/DMRDefines.h"
#include "dmr/data/DataHeader.h"
#include "edac/BPTC19696.h"
#include "edac/RS129.h"
#include "edac/CRC.h"
#include "Utils.h"
using namespace dmr::data;
using namespace dmr;
#include <cstdio>
#include <cassert>
#include <cstring>

@ -55,10 +55,7 @@ EMB::EMB() :
/// <summary>
/// Finalizes a instance of the EMB class.
/// </summary>
EMB::~EMB()
{
/* stub */
}
EMB::~EMB() = default;
/// <summary>
/// Decodes DMR embedded signalling data.

@ -37,9 +37,9 @@
using namespace dmr::data;
using namespace dmr;
#include <cstdio>
#include <cassert>
#include <cstring>
#include <memory>
// ---------------------------------------------------------------------------
// Public Class Members
@ -85,49 +85,49 @@ bool EmbeddedData::addData(const uint8_t* data, uint8_t lcss)
Utils::byteToBitsBE(data[17U], rawData + 24U);
Utils::byteToBitsBE(data[18U], rawData + 32U);
// Is this the first block of a 4 block embedded LC ?
// is this the first block of a 4 block embedded LC ?
if (lcss == 1U) {
for (uint32_t a = 0U; a < 32U; a++)
m_raw[a] = rawData[a + 4U];
// Show we are ready for the next LC block
// show we are ready for the next LC block
m_state = LCS_FIRST;
m_valid = false;
return false;
}
// Is this the 2nd block of a 4 block embedded LC ?
// is this the 2nd block of a 4 block embedded LC ?
if (lcss == 3U && m_state == LCS_FIRST) {
for (uint32_t a = 0U; a < 32U; a++)
m_raw[a + 32U] = rawData[a + 4U];
// Show we are ready for the next LC block
// show we are ready for the next LC block
m_state = LCS_SECOND;
return false;
}
// Is this the 3rd block of a 4 block embedded LC ?
// is this the 3rd block of a 4 block embedded LC ?
if (lcss == 3U && m_state == LCS_SECOND) {
for (uint32_t a = 0U; a < 32U; a++)
m_raw[a + 64U] = rawData[a + 4U];
// Show we are ready for the final LC block
// show we are ready for the final LC block
m_state = LCS_THIRD;
return false;
}
// Is this the final block of a 4 block embedded LC ?
// is this the final block of a 4 block embedded LC ?
if (lcss == 2U && m_state == LCS_THIRD) {
for (uint32_t a = 0U; a < 32U; a++)
m_raw[a + 96U] = rawData[a + 4U];
// Show that we're not ready for any more data
// show that we're not ready for any more data
m_state = LCS_NONE;
// Process the complete data block
// process the complete data block
decodeEmbeddedData();
if (m_valid)
encodeEmbeddedData();
@ -188,7 +188,9 @@ uint8_t EmbeddedData::getData(uint8_t* data, uint8_t n) const
}
}
/// <summary>Sets link control data.</summary>
/// <summary>
/// Sets link control data.
/// </summary>
/// <param name="lc"></param>
void EmbeddedData::setLC(const lc::LC& lc)
{
@ -200,7 +202,9 @@ void EmbeddedData::setLC(const lc::LC& lc)
encodeEmbeddedData();
}
/// <summary>Gets link control data.</summary>
/// <summary>
/// Gets link control data.
/// </summary>
/// <returns></returns>
std::unique_ptr<lc::LC> EmbeddedData::getLC() const
{
@ -210,7 +214,7 @@ std::unique_ptr<lc::LC> EmbeddedData::getLC() const
if (m_FLCO != FLCO_GROUP && m_FLCO != FLCO_PRIVATE)
return nullptr;
return std::unique_ptr<lc::LC>(new lc::LC(m_data));
return std::make_unique<lc::LC>(m_data);
}
/// <summary>
@ -256,7 +260,7 @@ void EmbeddedData::reset()
/// </summary>
void EmbeddedData::decodeEmbeddedData()
{
// The data is unpacked downwards in columns
// the data is unpacked downwards in columns
bool data[128U];
::memset(data, 0x00U, 128U * sizeof(bool));
@ -274,14 +278,14 @@ void EmbeddedData::decodeEmbeddedData()
return;
}
// Check the parity bits
// check the parity bits
for (uint32_t a = 0U; a < 16U; a++) {
bool parity = data[a + 0U] ^ data[a + 16U] ^ data[a + 32U] ^ data[a + 48U] ^ data[a + 64U] ^ data[a + 80U] ^ data[a + 96U] ^ data[a + 112U];
if (parity)
return;
}
// We have passed the Hamming check so extract the actual payload
// we have passed the Hamming check so extract the actual payload
b = 0U;
for (uint32_t a = 0U; a < 11U; a++, b++)
m_data[b] = data[a];
@ -298,7 +302,7 @@ void EmbeddedData::decodeEmbeddedData()
for (uint32_t a = 96U; a < 106U; a++, b++)
m_data[b] = data[a];
// Extract the 5 bit CRC
// extract the 5 bit CRC
uint32_t crc = 0U;
if (data[42]) crc += 16U;
if (data[58]) crc += 8U;
@ -306,13 +310,13 @@ void EmbeddedData::decodeEmbeddedData()
if (data[90]) crc += 2U;
if (data[106]) crc += 1U;
// Now CRC check this
// now CRC check this
if (!edac::CRC::checkFiveBit(m_data, crc))
return;
m_valid = true;
// Extract the FLCO
// extract the FLCO
uint8_t flco;
Utils::bitsToByteBE(m_data + 0U, flco);
m_FLCO = flco & 0x3FU;
@ -355,11 +359,11 @@ void EmbeddedData::encodeEmbeddedData()
for (uint32_t a = 0U; a < 112U; a += 16U)
edac::Hamming::encode16114(data + a);
// Add the parity bits for each column
// add the parity bits for each column
for (uint32_t a = 0U; a < 16U; a++)
data[a + 112U] = data[a + 0U] ^ data[a + 16U] ^ data[a + 32U] ^ data[a + 48U] ^ data[a + 64U] ^ data[a + 80U] ^ data[a + 96U];
// The data is packed downwards in columns
// the data is packed downwards in columns
b = 0U;
for (uint32_t a = 0U; a < 128U; a++) {
m_raw[a] = data[b];

@ -70,7 +70,7 @@ namespace dmr
/// <summary>Gets link control data.</summary>
std::unique_ptr<lc::LC> getLC() const;
/// <summary>Get raw embeded data buffer.</summary>
/// <summary>Get raw embedded data buffer.</summary>
bool getRawData(uint8_t* data) const;
/// <summary>Helper to reset data values to defaults.</summary>

@ -38,7 +38,6 @@
using namespace dmr::lc;
using namespace dmr;
#include <cstdio>
#include <cassert>
// ---------------------------------------------------------------------------
@ -97,10 +96,7 @@ CSBK::CSBK() :
/// <summary>
/// Finalizes a instance of the CSBK class.
/// </summary>
CSBK::~CSBK()
{
/* stub */
}
CSBK::~CSBK() = default;
/// <summary>
/// Returns a string that represents the current CSBK.

@ -63,7 +63,7 @@ namespace dmr
virtual std::string toString();
/// <summary>Regenerate a DMR CSBK without decoding.</summary>
/// <remarks>This is because the DMR archeticture allows fall-thru of unsupported CSBKs.</remarks>
/// <remarks>This is because the DMR architecture allows fall-thru of unsupported CSBKs.</remarks>
static bool regenerate(uint8_t* data, uint8_t dataType);
/// <summary>Gets the flag indicating verbose log output.</summary>

@ -35,13 +35,12 @@
#include "edac/RS129.h"
#include "edac/CRC.h"
#include "Log.h"
#include "Utils.h"
using namespace dmr::lc;
using namespace dmr;
#include <cstdio>
#include <cassert>
#include <memory>
// ---------------------------------------------------------------------------
// Public Class Members
@ -59,10 +58,7 @@ FullLC::FullLC() :
/// <summary>
/// Finalizes a instance of the FullLC class.
/// </summary>
FullLC::~FullLC()
{
/* stub */
}
FullLC::~FullLC() = default;
/// <summary>
/// Decode DMR full-link control data.
@ -100,7 +96,7 @@ std::unique_ptr<LC> FullLC::decode(const uint8_t* data, uint8_t type)
if (!edac::RS129::check(lcData))
return nullptr;
return std::unique_ptr<LC>(new LC(lcData));
return std::make_unique<LC>(lcData);
}
/// <summary>
@ -170,7 +166,7 @@ std::unique_ptr<PrivacyLC> FullLC::decodePI(const uint8_t* data)
lcData[11U] ^= PI_HEADER_CRC_MASK[1U];
}
return std::unique_ptr<PrivacyLC>(new PrivacyLC(lcData));
return std::make_unique<PrivacyLC>(lcData);
}
/// <summary>

@ -36,7 +36,6 @@
using namespace dmr::lc;
using namespace dmr;
#include <cstdio>
#include <cassert>
// ---------------------------------------------------------------------------
@ -171,10 +170,7 @@ LC::LC() :
/// <summary>
/// Finalizes a instance of the LC class.
/// </summary>
LC::~LC()
{
/* stub */
}
LC::~LC() = default;
/// <summary>
///

@ -74,18 +74,18 @@ bool ShortLC::decode(const uint8_t* in, uint8_t* out)
assert(in != nullptr);
assert(out != nullptr);
// Get the raw binary
// get the raw binary
decodeExtractBinary(in);
// Deinterleave
// deinterleave
decodeDeInterleave();
// Error check
// error check
bool ret = decodeErrorCheck();
if (!ret)
return false;
// Extract Data
// extract Data
decodeExtractData(out);
return true;
@ -101,16 +101,16 @@ void ShortLC::encode(const uint8_t* in, uint8_t* out)
assert(in != nullptr);
assert(out != nullptr);
// Extract Data
// extract Data
encodeExtractData(in);
// Error check
// error check
encodeErrorCheck();
// Deinterleave
// interleave
encodeInterleave();
// Get the raw binary
// get the raw binary
encodeExtractBinary(out);
}
@ -146,9 +146,9 @@ void ShortLC::decodeDeInterleave()
m_deInterData[i] = false;
for (uint32_t a = 0U; a < 67U; a++) {
// Calculate the interleave sequence
// calculate the interleave sequence
uint32_t interleaveSequence = (a * 4U) % 67U;
// Shuffle the data
// shuffle the data
m_deInterData[a] = m_rawData[interleaveSequence];
}
@ -161,12 +161,12 @@ void ShortLC::decodeDeInterleave()
/// <returns></returns>
bool ShortLC::decodeErrorCheck()
{
// Run through each of the 3 rows containing data
// run through each of the 3 rows containing data
edac::Hamming::decode17123(m_deInterData + 0U);
edac::Hamming::decode17123(m_deInterData + 17U);
edac::Hamming::decode17123(m_deInterData + 34U);
// Run through each of the 17 columns
// run through each of the 17 columns
for (uint32_t c = 0U; c < 17U; c++) {
bool bit = m_deInterData[c + 0U] ^ m_deInterData[c + 17U] ^ m_deInterData[c + 34U];
if (bit != m_deInterData[c + 51U])
@ -240,12 +240,12 @@ void ShortLC::encodeExtractData(const uint8_t* in) const
/// </summary>
void ShortLC::encodeErrorCheck()
{
// Run through each of the 3 rows containing data
// run through each of the 3 rows containing data
edac::Hamming::encode17123(m_deInterData + 0U);
edac::Hamming::encode17123(m_deInterData + 17U);
edac::Hamming::encode17123(m_deInterData + 34U);
// Run through each of the 17 columns
// run through each of the 17 columns
for (uint32_t c = 0U; c < 17U; c++)
m_deInterData[c + 51U] = m_deInterData[c + 0U] ^ m_deInterData[c + 17U] ^ m_deInterData[c + 34U];
}
@ -259,10 +259,10 @@ void ShortLC::encodeInterleave()
m_rawData[i] = false;
for (uint32_t a = 0U; a < 67U; a++) {
// Calculate the interleave sequence
// calculate the interleave sequence
uint32_t interleaveSequence = (a * 4U) % 67U;
// Unshuffle the data
// unshuffle the data
m_rawData[interleaveSequence] = m_deInterData[a];
}

@ -43,18 +43,12 @@ using namespace dmr;
/// <summary>
/// Initializes a new instance of the CSBKFactory class.
/// </summary>
CSBKFactory::CSBKFactory()
{
/* stub */
}
CSBKFactory::CSBKFactory() = default;
/// <summary>
/// Finalizes a instance of CSBKFactory class.
/// </summary>
CSBKFactory::~CSBKFactory()
{
/* stub */
}
CSBKFactory::~CSBKFactory() = default;
/// <summary>
/// Create an instance of a CSBK.

@ -25,15 +25,12 @@
*/
#include "Defines.h"
#include "dmr/lc/csbk/CSBK_ACK_RSP.h"
#include "Log.h"
#include "Utils.h"
using namespace dmr::lc::csbk;
using namespace dmr::lc;
using namespace dmr;
#include <cassert>
#include <cmath>
// ---------------------------------------------------------------------------
// Public Class Members
@ -54,7 +51,7 @@ CSBK_ACK_RSP::CSBK_ACK_RSP() : CSBK()
/// <returns>True, if CSBK was decoded, otherwise false.</returns>
bool CSBK_ACK_RSP::decode(const uint8_t* data)
{
assert(data != NULL);
assert(data != nullptr);
uint8_t csbk[DMR_CSBK_LENGTH_BYTES];
::memset(csbk, 0x00U, DMR_CSBK_LENGTH_BYTES);
@ -79,7 +76,7 @@ bool CSBK_ACK_RSP::decode(const uint8_t* data)
/// <param name="data"></param>
void CSBK_ACK_RSP::encode(uint8_t* data)
{
assert(data != NULL);
assert(data != nullptr);
ulong64_t csbkValue = 0U;

@ -51,7 +51,7 @@ namespace dmr
void encode(uint8_t* data) override;
/// <summary>Returns a string that represents the current CSBK.</summary>
virtual std::string toString() override;
std::string toString() override;
};
} // namespace csbk
} // namespace lc

@ -25,15 +25,12 @@
*/
#include "Defines.h"
#include "dmr/lc/csbk/CSBK_ALOHA.h"
#include "Log.h"
#include "Utils.h"
using namespace dmr::lc::csbk;
using namespace dmr::lc;
using namespace dmr;
#include <cassert>
#include <cmath>
// ---------------------------------------------------------------------------
// Public Class Members
@ -58,7 +55,7 @@ CSBK_ALOHA::CSBK_ALOHA() : CSBK(),
/// <returns>True, if CSBK was decoded, otherwise false.</returns>
bool CSBK_ALOHA::decode(const uint8_t* data)
{
assert(data != NULL);
assert(data != nullptr);
/* stub */
@ -71,7 +68,7 @@ bool CSBK_ALOHA::decode(const uint8_t* data)
/// <param name="data"></param>
void CSBK_ALOHA::encode(uint8_t* data)
{
assert(data != NULL);
assert(data != nullptr);
ulong64_t csbkValue = 0U;

@ -51,7 +51,7 @@ namespace dmr
void encode(uint8_t* data) override;
/// <summary>Returns a string that represents the current CSBK.</summary>
virtual std::string toString() override;
std::string toString() override;
public:
/// <summary>Aloha Site Time Slot Synchronization.</summary>

@ -25,15 +25,12 @@
*/
#include "Defines.h"
#include "dmr/lc/csbk/CSBK_BROADCAST.h"
#include "Log.h"
#include "Utils.h"
using namespace dmr::lc::csbk;
using namespace dmr::lc;
using namespace dmr;
#include <cassert>
#include <cmath>
// ---------------------------------------------------------------------------
// Public Class Members
@ -59,7 +56,7 @@ CSBK_BROADCAST::CSBK_BROADCAST() : CSBK(),
/// <returns>True, if CSBK was decoded, otherwise false.</returns>
bool CSBK_BROADCAST::decode(const uint8_t* data)
{
assert(data != NULL);
assert(data != nullptr);
/* stub */
@ -72,7 +69,7 @@ bool CSBK_BROADCAST::decode(const uint8_t* data)
/// <param name="data"></param>
void CSBK_BROADCAST::encode(uint8_t* data)
{
assert(data != NULL);
assert(data != nullptr);
ulong64_t csbkValue = 0U;
@ -83,7 +80,7 @@ void CSBK_BROADCAST::encode(uint8_t* data)
switch (m_anncType)
{
case BCAST_ANNC_ANN_WD_TSCC:
// Broadcast Parms 1
// Broadcast Params 1
csbkValue = (csbkValue << 4) + 0U; // Reserved
csbkValue = (csbkValue << 4) + (m_colorCode & 0x0FU); // Color Code 1
csbkValue = (csbkValue << 4) + (m_colorCode & 0x0FU); // Color Code 2
@ -94,7 +91,7 @@ void CSBK_BROADCAST::encode(uint8_t* data)
csbkValue = (csbkValue << 4) + (m_backoffNo & 0x0FU); // Backoff Number
csbkValue = (csbkValue << 16) + m_siteData.systemIdentity(); // Site Identity
// Broadcast Parms 2
// Broadcast Params 2
csbkValue = (csbkValue << 12) + (m_logicalCh1 & 0xFFFU); // Logical Channel 1
csbkValue = (csbkValue << 12) + (m_logicalCh2 & 0xFFFU); // Logical Channel 2
break;
@ -136,17 +133,17 @@ void CSBK_BROADCAST::encode(uint8_t* data)
}
break;
case BCAST_ANNC_SITE_PARMS:
// Broadcast Parms 1
csbkValue = (csbkValue << 14) + m_siteData.systemIdentity(true); // Site Identity (Broadcast Parms 1)
// Broadcast Params 1
csbkValue = (csbkValue << 14) + m_siteData.systemIdentity(true); // Site Identity (Broadcast Params 1)
csbkValue = (csbkValue << 1) + ((m_siteData.requireReg()) ? 1U : 0U); // Require Registration
csbkValue = (csbkValue << 4) + (m_backoffNo & 0x0FU); // Backoff Number
csbkValue = (csbkValue << 16) + m_siteData.systemIdentity(); // Site Identity
// Broadcast Parms 2
// Broadcast Params 2
csbkValue = (csbkValue << 1) + 0U; // Roaming TG Subscription/Attach
csbkValue = (csbkValue << 1) + ((m_hibernating) ? 1U : 0U); // TSCC Hibernating
csbkValue = (csbkValue << 22) + 0U; // Broadcast Parms 2 (Reserved)
csbkValue = (csbkValue << 22) + 0U; // Broadcast Params 2 (Reserved)
break;
}

@ -51,7 +51,7 @@ namespace dmr
void encode(uint8_t* data) override;
/// <summary>Returns a string that represents the current CSBK.</summary>
virtual std::string toString() override;
std::string toString() override;
public:
/// <summary>Broadcast Announcment Type.</summary>

@ -25,15 +25,12 @@
*/
#include "Defines.h"
#include "dmr/lc/csbk/CSBK_BSDWNACT.h"
#include "Log.h"
#include "Utils.h"
using namespace dmr::lc::csbk;
using namespace dmr::lc;
using namespace dmr;
#include <cassert>
#include <cmath>
// ---------------------------------------------------------------------------
// Public Class Members
@ -55,7 +52,7 @@ CSBK_BSDWNACT::CSBK_BSDWNACT() : CSBK(),
/// <returns>True, if CSBK was decoded, otherwise false.</returns>
bool CSBK_BSDWNACT::decode(const uint8_t* data)
{
assert(data != NULL);
assert(data != nullptr);
uint8_t csbk[DMR_CSBK_LENGTH_BYTES];
::memset(csbk, 0x00U, DMR_CSBK_LENGTH_BYTES);
@ -78,7 +75,7 @@ bool CSBK_BSDWNACT::decode(const uint8_t* data)
/// <param name="data"></param>
void CSBK_BSDWNACT::encode(uint8_t* data)
{
assert(data != NULL);
assert(data != nullptr);
/* stub */
}

@ -51,7 +51,7 @@ namespace dmr
void encode(uint8_t* data) override;
/// <summary>Returns a string that represents the current CSBK.</summary>
virtual std::string toString() override;
std::string toString() override;
public:
/// <summary>Base Station ID.</summary>

@ -25,15 +25,12 @@
*/
#include "Defines.h"
#include "dmr/lc/csbk/CSBK_CALL_ALRT.h"
#include "Log.h"
#include "Utils.h"
using namespace dmr::lc::csbk;
using namespace dmr::lc;
using namespace dmr;
#include <cassert>
#include <cmath>
// ---------------------------------------------------------------------------
// Public Class Members
@ -55,7 +52,7 @@ CSBK_CALL_ALRT::CSBK_CALL_ALRT() : CSBK()
/// <returns>True, if CSBK was decoded, otherwise false.</returns>
bool CSBK_CALL_ALRT::decode(const uint8_t* data)
{
assert(data != NULL);
assert(data != nullptr);
uint8_t csbk[DMR_CSBK_LENGTH_BYTES];
::memset(csbk, 0x00U, DMR_CSBK_LENGTH_BYTES);
@ -79,7 +76,7 @@ bool CSBK_CALL_ALRT::decode(const uint8_t* data)
/// <param name="data"></param>
void CSBK_CALL_ALRT::encode(uint8_t* data)
{
assert(data != NULL);
assert(data != nullptr);
ulong64_t csbkValue = 0U;

@ -51,7 +51,7 @@ namespace dmr
void encode(uint8_t* data) override;
/// <summary>Returns a string that represents the current CSBK.</summary>
virtual std::string toString() override;
std::string toString() override;
};
} // namespace csbk
} // namespace lc

@ -25,15 +25,12 @@
*/
#include "Defines.h"
#include "dmr/lc/csbk/CSBK_EXT_FNCT.h"
#include "Log.h"
#include "Utils.h"
using namespace dmr::lc::csbk;
using namespace dmr::lc;
using namespace dmr;
#include <cassert>
#include <cmath>
// ---------------------------------------------------------------------------
// Public Class Members
@ -56,7 +53,7 @@ CSBK_EXT_FNCT::CSBK_EXT_FNCT() : CSBK(),
/// <returns>True, if CSBK was decoded, otherwise false.</returns>
bool CSBK_EXT_FNCT::decode(const uint8_t* data)
{
assert(data != NULL);
assert(data != nullptr);
uint8_t csbk[DMR_CSBK_LENGTH_BYTES];
::memset(csbk, 0x00U, DMR_CSBK_LENGTH_BYTES);
@ -81,7 +78,7 @@ bool CSBK_EXT_FNCT::decode(const uint8_t* data)
/// <param name="data"></param>
void CSBK_EXT_FNCT::encode(uint8_t* data)
{
assert(data != NULL);
assert(data != nullptr);
ulong64_t csbkValue = 0U;

@ -51,7 +51,7 @@ namespace dmr
void encode(uint8_t* data) override;
/// <summary>Returns a string that represents the current CSBK.</summary>
virtual std::string toString() override;
std::string toString() override;
public:
/// <summary>Extended function opcode.</summary>

@ -25,15 +25,12 @@
*/
#include "Defines.h"
#include "dmr/lc/csbk/CSBK_MAINT.h"
#include "Log.h"
#include "Utils.h"
using namespace dmr::lc::csbk;
using namespace dmr::lc;
using namespace dmr;
#include <cassert>
#include <cmath>
// ---------------------------------------------------------------------------
// Public Class Members
@ -55,7 +52,7 @@ CSBK_MAINT::CSBK_MAINT() : CSBK(),
/// <returns>True, if CSBK was decoded, otherwise false.</returns>
bool CSBK_MAINT::decode(const uint8_t* data)
{
assert(data != NULL);
assert(data != nullptr);
uint8_t csbk[DMR_CSBK_LENGTH_BYTES];
::memset(csbk, 0x00U, DMR_CSBK_LENGTH_BYTES);
@ -79,7 +76,7 @@ bool CSBK_MAINT::decode(const uint8_t* data)
/// <param name="data"></param>
void CSBK_MAINT::encode(uint8_t* data)
{
assert(data != NULL);
assert(data != nullptr);
ulong64_t csbkValue = 0U;

@ -51,7 +51,7 @@ namespace dmr
void encode(uint8_t* data) override;
/// <summary>Returns a string that represents the current CSBK.</summary>
virtual std::string toString() override;
std::string toString() override;
public:
/// <summary>Maintainence Kind.</summary>

@ -25,15 +25,12 @@
*/
#include "Defines.h"
#include "dmr/lc/csbk/CSBK_NACK_RSP.h"
#include "Log.h"
#include "Utils.h"
using namespace dmr::lc::csbk;
using namespace dmr::lc;
using namespace dmr;
#include <cassert>
#include <cmath>
// ---------------------------------------------------------------------------
// Public Class Members
@ -55,7 +52,7 @@ CSBK_NACK_RSP::CSBK_NACK_RSP() : CSBK(),
/// <returns>True, if CSBK was decoded, otherwise false.</returns>
bool CSBK_NACK_RSP::decode(const uint8_t* data)
{
assert(data != NULL);
assert(data != nullptr);
uint8_t csbk[DMR_CSBK_LENGTH_BYTES];
::memset(csbk, 0x00U, DMR_CSBK_LENGTH_BYTES);
@ -81,7 +78,7 @@ bool CSBK_NACK_RSP::decode(const uint8_t* data)
/// <param name="data"></param>
void CSBK_NACK_RSP::encode(uint8_t* data)
{
assert(data != NULL);
assert(data != nullptr);
ulong64_t csbkValue = 0U;

@ -51,7 +51,7 @@ namespace dmr
void encode(uint8_t* data) override;
/// <summary>Returns a string that represents the current CSBK.</summary>
virtual std::string toString() override;
std::string toString() override;
public:
/// <summary>Service Kind.</summary>

@ -25,15 +25,12 @@
*/
#include "Defines.h"
#include "dmr/lc/csbk/CSBK_PD_GRANT.h"
#include "Log.h"
#include "Utils.h"
using namespace dmr::lc::csbk;
using namespace dmr::lc;
using namespace dmr;
#include <cassert>
#include <cmath>
// ---------------------------------------------------------------------------
// Public Class Members
@ -54,7 +51,7 @@ CSBK_PD_GRANT::CSBK_PD_GRANT() : CSBK()
/// <returns>True, if CSBK was decoded, otherwise false.</returns>
bool CSBK_PD_GRANT::decode(const uint8_t* data)
{
assert(data != NULL);
assert(data != nullptr);
/* stub */
@ -67,7 +64,7 @@ bool CSBK_PD_GRANT::decode(const uint8_t* data)
/// <param name="data"></param>
void CSBK_PD_GRANT::encode(uint8_t* data)
{
assert(data != NULL);
assert(data != nullptr);
ulong64_t csbkValue = 0U;

@ -51,7 +51,7 @@ namespace dmr
void encode(uint8_t* data) override;
/// <summary>Returns a string that represents the current CSBK.</summary>
virtual std::string toString() override;
std::string toString() override;
};
} // namespace csbk
} // namespace lc

@ -25,15 +25,12 @@
*/
#include "Defines.h"
#include "dmr/lc/csbk/CSBK_PRECCSBK.h"
#include "Log.h"
#include "Utils.h"
using namespace dmr::lc::csbk;
using namespace dmr::lc;
using namespace dmr;
#include <cassert>
#include <cmath>
// ---------------------------------------------------------------------------
// Public Class Members
@ -54,7 +51,7 @@ CSBK_PRECCSBK::CSBK_PRECCSBK() : CSBK()
/// <returns>True, if CSBK was decoded, otherwise false.</returns>
bool CSBK_PRECCSBK::decode(const uint8_t* data)
{
assert(data != NULL);
assert(data != nullptr);
uint8_t csbk[DMR_CSBK_LENGTH_BYTES];
::memset(csbk, 0x00U, DMR_CSBK_LENGTH_BYTES);
@ -80,7 +77,7 @@ bool CSBK_PRECCSBK::decode(const uint8_t* data)
/// <param name="data"></param>
void CSBK_PRECCSBK::encode(uint8_t* data)
{
assert(data != NULL);
assert(data != nullptr);
/* stub */
}

@ -51,7 +51,7 @@ namespace dmr
void encode(uint8_t* data) override;
/// <summary>Returns a string that represents the current CSBK.</summary>
virtual std::string toString() override;
std::string toString() override;
};
} // namespace csbk
} // namespace lc

@ -25,15 +25,12 @@
*/
#include "Defines.h"
#include "dmr/lc/csbk/CSBK_PV_GRANT.h"
#include "Log.h"
#include "Utils.h"
using namespace dmr::lc::csbk;
using namespace dmr::lc;
using namespace dmr;
#include <cassert>
#include <cmath>
// ---------------------------------------------------------------------------
// Public Class Members
@ -54,7 +51,7 @@ CSBK_PV_GRANT::CSBK_PV_GRANT() : CSBK()
/// <returns>True, if CSBK was decoded, otherwise false.</returns>
bool CSBK_PV_GRANT::decode(const uint8_t* data)
{
assert(data != NULL);
assert(data != nullptr);
/* stub */
@ -67,7 +64,7 @@ bool CSBK_PV_GRANT::decode(const uint8_t* data)
/// <param name="data"></param>
void CSBK_PV_GRANT::encode(uint8_t* data)
{
assert(data != NULL);
assert(data != nullptr);
ulong64_t csbkValue = 0U;

@ -51,7 +51,7 @@ namespace dmr
void encode(uint8_t* data) override;
/// <summary>Returns a string that represents the current CSBK.</summary>
virtual std::string toString() override;
std::string toString() override;
};
} // namespace csbk
} // namespace lc

@ -25,15 +25,12 @@
*/
#include "Defines.h"
#include "dmr/lc/csbk/CSBK_P_CLEAR.h"
#include "Log.h"
#include "Utils.h"
using namespace dmr::lc::csbk;
using namespace dmr::lc;
using namespace dmr;
#include <cassert>
#include <cmath>
// ---------------------------------------------------------------------------
// Public Class Members
@ -54,7 +51,7 @@ CSBK_P_CLEAR::CSBK_P_CLEAR() : CSBK()
/// <returns>True, if CSBK was decoded, otherwise false.</returns>
bool CSBK_P_CLEAR::decode(const uint8_t* data)
{
assert(data != NULL);
assert(data != nullptr);
/* stub */
@ -67,7 +64,7 @@ bool CSBK_P_CLEAR::decode(const uint8_t* data)
/// <param name="data"></param>
void CSBK_P_CLEAR::encode(uint8_t* data)
{
assert(data != NULL);
assert(data != nullptr);
ulong64_t csbkValue = 0U;

@ -51,7 +51,7 @@ namespace dmr
void encode(uint8_t* data) override;
/// <summary>Returns a string that represents the current CSBK.</summary>
virtual std::string toString() override;
std::string toString() override;
};
} // namespace csbk
} // namespace lc

@ -25,15 +25,12 @@
*/
#include "Defines.h"
#include "dmr/lc/csbk/CSBK_P_GRANT.h"
#include "Log.h"
#include "Utils.h"
using namespace dmr::lc::csbk;
using namespace dmr::lc;
using namespace dmr;
#include <cassert>
#include <cmath>
// ---------------------------------------------------------------------------
// Public Class Members
@ -54,7 +51,7 @@ CSBK_P_GRANT::CSBK_P_GRANT() : CSBK()
/// <returns>True, if CSBK was decoded, otherwise false.</returns>
bool CSBK_P_GRANT::decode(const uint8_t* data)
{
assert(data != NULL);
assert(data != nullptr);
/* stub */
@ -67,7 +64,7 @@ bool CSBK_P_GRANT::decode(const uint8_t* data)
/// <param name="data"></param>
void CSBK_P_GRANT::encode(uint8_t* data)
{
assert(data != NULL);
assert(data != nullptr);
ulong64_t csbkValue = 0U;

@ -51,7 +51,7 @@ namespace dmr
void encode(uint8_t* data) override;
/// <summary>Returns a string that represents the current CSBK.</summary>
virtual std::string toString() override;
std::string toString() override;
};
} // namespace csbk
} // namespace lc

@ -25,15 +25,12 @@
*/
#include "Defines.h"
#include "dmr/lc/csbk/CSBK_RAND.h"
#include "Log.h"
#include "Utils.h"
using namespace dmr::lc::csbk;
using namespace dmr::lc;
using namespace dmr;
#include <cassert>
#include <cmath>
// ---------------------------------------------------------------------------
// Public Class Members
@ -57,7 +54,7 @@ CSBK_RAND::CSBK_RAND() : CSBK(),
/// <returns>True, if CSBK was decoded, otherwise false.</returns>
bool CSBK_RAND::decode(const uint8_t* data)
{
assert(data != NULL);
assert(data != nullptr);
uint8_t csbk[DMR_CSBK_LENGTH_BYTES];
::memset(csbk, 0x00U, DMR_CSBK_LENGTH_BYTES);
@ -84,7 +81,7 @@ bool CSBK_RAND::decode(const uint8_t* data)
/// <param name="data"></param>
void CSBK_RAND::encode(uint8_t* data)
{
assert(data != NULL);
assert(data != nullptr);
ulong64_t csbkValue = 0U;

@ -51,7 +51,7 @@ namespace dmr
void encode(uint8_t* data) override;
/// <summary>Returns a string that represents the current CSBK.</summary>
virtual std::string toString() override;
std::string toString() override;
public:
/// <summary>Service Options.</summary>

@ -25,15 +25,12 @@
*/
#include "Defines.h"
#include "dmr/lc/csbk/CSBK_RAW.h"
#include "Log.h"
#include "Utils.h"
using namespace dmr::lc::csbk;
using namespace dmr::lc;
using namespace dmr;
#include <cassert>
#include <cmath>
// ---------------------------------------------------------------------------
// Public Class Members
@ -65,7 +62,7 @@ CSBK_RAW::~CSBK_RAW()
/// <returns>True, if CSBK was decoded, otherwise false.</returns>
bool CSBK_RAW::decode(const uint8_t* data)
{
assert(data != NULL);
assert(data != nullptr);
/* stub */
@ -78,8 +75,8 @@ bool CSBK_RAW::decode(const uint8_t* data)
/// <param name="data"></param>
void CSBK_RAW::encode(uint8_t* data)
{
assert(data != NULL);
assert(m_csbk != NULL);
assert(data != nullptr);
assert(m_csbk != nullptr);
/* stub */
@ -92,7 +89,7 @@ void CSBK_RAW::encode(uint8_t* data)
/// <param name="csbk"></param>
void CSBK_RAW::setCSBK(const uint8_t* csbk)
{
assert(csbk != NULL);
assert(csbk != nullptr);
m_CSBKO = csbk[0U] & 0x3FU; // CSBKO
m_lastBlock = (csbk[0U] & 0x80U) == 0x80U; // Last Block Marker

@ -25,15 +25,12 @@
*/
#include "Defines.h"
#include "dmr/lc/csbk/CSBK_TD_GRANT.h"
#include "Log.h"
#include "Utils.h"
using namespace dmr::lc::csbk;
using namespace dmr::lc;
using namespace dmr;
#include <cassert>
#include <cmath>
// ---------------------------------------------------------------------------
// Public Class Members
@ -54,7 +51,7 @@ CSBK_TD_GRANT::CSBK_TD_GRANT() : CSBK()
/// <returns>True, if CSBK was decoded, otherwise false.</returns>
bool CSBK_TD_GRANT::decode(const uint8_t* data)
{
assert(data != NULL);
assert(data != nullptr);
/* stub */
@ -67,7 +64,7 @@ bool CSBK_TD_GRANT::decode(const uint8_t* data)
/// <param name="data"></param>
void CSBK_TD_GRANT::encode(uint8_t* data)
{
assert(data != NULL);
assert(data != nullptr);
ulong64_t csbkValue = 0U;

@ -51,7 +51,7 @@ namespace dmr
void encode(uint8_t* data) override;
/// <summary>Returns a string that represents the current CSBK.</summary>
virtual std::string toString() override;
std::string toString() override;
};
} // namespace csbk
} // namespace lc

@ -25,15 +25,12 @@
*/
#include "Defines.h"
#include "dmr/lc/csbk/CSBK_TV_GRANT.h"
#include "Log.h"
#include "Utils.h"
using namespace dmr::lc::csbk;
using namespace dmr::lc;
using namespace dmr;
#include <cassert>
#include <cmath>
// ---------------------------------------------------------------------------
// Public Class Members
@ -55,7 +52,7 @@ CSBK_TV_GRANT::CSBK_TV_GRANT() : CSBK(),
/// <returns>True, if CSBK was decoded, otherwise false.</returns>
bool CSBK_TV_GRANT::decode(const uint8_t* data)
{
assert(data != NULL);
assert(data != nullptr);
/* stub */
@ -68,7 +65,7 @@ bool CSBK_TV_GRANT::decode(const uint8_t* data)
/// <param name="data"></param>
void CSBK_TV_GRANT::encode(uint8_t* data)
{
assert(data != NULL);
assert(data != nullptr);
ulong64_t csbkValue = 0U;

@ -51,7 +51,7 @@ namespace dmr
void encode(uint8_t* data) override;
/// <summary>Returns a string that represents the current CSBK.</summary>
virtual std::string toString() override;
std::string toString() override;
public:
/// <summary>Flag indicating whether the grant is a late entry.</summary>

@ -25,15 +25,12 @@
*/
#include "Defines.h"
#include "dmr/lc/csbk/CSBK_UU_ANS_RSP.h"
#include "Log.h"
#include "Utils.h"
using namespace dmr::lc::csbk;
using namespace dmr::lc;
using namespace dmr;
#include <cassert>
#include <cmath>
// ---------------------------------------------------------------------------
// Public Class Members
@ -54,7 +51,7 @@ CSBK_UU_ANS_RSP::CSBK_UU_ANS_RSP() : CSBK()
/// <returns>True, if CSBK was decoded, otherwise false.</returns>
bool CSBK_UU_ANS_RSP::decode(const uint8_t* data)
{
assert(data != NULL);
assert(data != nullptr);
uint8_t csbk[DMR_CSBK_LENGTH_BYTES];
::memset(csbk, 0x00U, DMR_CSBK_LENGTH_BYTES);
@ -77,7 +74,7 @@ bool CSBK_UU_ANS_RSP::decode(const uint8_t* data)
/// <param name="data"></param>
void CSBK_UU_ANS_RSP::encode(uint8_t* data)
{
assert(data != NULL);
assert(data != nullptr);
/* stub */
}

@ -51,7 +51,7 @@ namespace dmr
void encode(uint8_t* data) override;
/// <summary>Returns a string that represents the current CSBK.</summary>
virtual std::string toString() override;
std::string toString() override;
};
} // namespace csbk
} // namespace lc

@ -25,15 +25,12 @@
*/
#include "Defines.h"
#include "dmr/lc/csbk/CSBK_UU_V_REQ.h"
#include "Log.h"
#include "Utils.h"
using namespace dmr::lc::csbk;
using namespace dmr::lc;
using namespace dmr;
#include <cassert>
#include <cmath>
// ---------------------------------------------------------------------------
// Public Class Members
@ -54,7 +51,7 @@ CSBK_UU_V_REQ::CSBK_UU_V_REQ() : CSBK()
/// <returns>True, if CSBK was decoded, otherwise false.</returns>
bool CSBK_UU_V_REQ::decode(const uint8_t* data)
{
assert(data != NULL);
assert(data != nullptr);
uint8_t csbk[DMR_CSBK_LENGTH_BYTES];
::memset(csbk, 0x00U, DMR_CSBK_LENGTH_BYTES);
@ -77,7 +74,7 @@ bool CSBK_UU_V_REQ::decode(const uint8_t* data)
/// <param name="data"></param>
void CSBK_UU_V_REQ::encode(uint8_t* data)
{
assert(data != NULL);
assert(data != nullptr);
/* stub */
}

@ -51,7 +51,7 @@ namespace dmr
void encode(uint8_t* data) override;
/// <summary>Returns a string that represents the current CSBK.</summary>
virtual std::string toString() override;
std::string toString() override;
};
} // namespace csbk
} // namespace lc

@ -48,21 +48,15 @@ using namespace edac;
/// <summary>
/// Initializes a new instance of the AMBEFEC class.
/// </summary>
AMBEFEC::AMBEFEC()
{
/* stub */
}
AMBEFEC::AMBEFEC() = default;
/// <summary>
/// Finalizes a instance of the AMBEFEC class.
/// </summary>
AMBEFEC::~AMBEFEC()
{
/* stub */
}
AMBEFEC::~AMBEFEC() = default;
/// <summary>
/// Regnerates the DMR AMBE FEC for the input bytes.
/// Regenerates the DMR AMBE FEC for the input bytes.
/// </summary>
/// <param name="bytes"></param>
/// <returns>Count of errors.</returns>

@ -471,7 +471,7 @@ namespace edac
// ---------------------------------------------------------------------------
// Class Declaration
// Implements routines to regenerate DMR/IMBE data using forward error
// Implements routines to regenerate AMBE/IMBE data using forward error
// correction.
// ---------------------------------------------------------------------------

@ -109,18 +109,12 @@ const int g[] = {
/// <summary>
/// Initializes a new instance of the BCH class.
/// </summary>
BCH::BCH()
{
/* stub */
}
BCH::BCH() = default;
/// <summary>
/// Finalizes a instance of the BCH class.
/// </summary>
BCH::~BCH()
{
/* stub */
}
BCH::~BCH() = default;
/// <summary>
/// Encodes input data with BCH.
@ -151,7 +145,7 @@ void BCH::encode(uint8_t* nid)
///
/// </summary>
/// <remarks>
/// Compute redundacy bb[], the coefficients of b(x). The redundancy
/// Compute redundancy bb[], the coefficients of b(x). The redundancy
/// polynomial b(x) is the remainder after dividing x^(length-k)*data(x)
/// by the generator polynomial g(x).
/// </remarks>

@ -36,7 +36,7 @@ namespace edac
{
// ---------------------------------------------------------------------------
// Class Declaration
// Implements Bose<EFBFBD>Chaudhuri<EFBFBD>Hocquenghem codes for protecting P25 NID
// Implements Bose/Chaudhuri/Hocquenghem codes for protecting P25 NID
// data.
// ---------------------------------------------------------------------------

@ -35,9 +35,7 @@
using namespace edac;
#include <cstdio>
#include <cassert>
#include <cstring>
// ---------------------------------------------------------------------------
// Public Class Members
@ -73,16 +71,16 @@ void BPTC19696::decode(const uint8_t* in, uint8_t* out)
assert(in != nullptr);
assert(out != nullptr);
// Get the raw binary
// get the raw binary
decodeExtractBinary(in);
// Deinterleave
// deinterleave
decodeDeInterleave();
// Error check
// error check
decodeErrorCheck();
// Extract Data
// extract Data
decodeExtractData(out);
}
@ -96,16 +94,16 @@ void BPTC19696::encode(const uint8_t* in, uint8_t* out)
assert(in != nullptr);
assert(out != nullptr);
// Extract Data
// extract Data
encodeExtractData(in);
// Error check
// error check
encodeErrorCheck();
// Deinterleave
// interleave
encodeInterleave();
// Get the raw binary
// get the raw binary
encodeExtractBinary(out);
}
@ -119,7 +117,7 @@ void BPTC19696::encode(const uint8_t* in, uint8_t* out)
/// <param name="in"></param>
void BPTC19696::decodeExtractBinary(const uint8_t* in)
{
// First block
// first block
Utils::byteToBitsBE(in[0U], m_rawData + 0U);
Utils::byteToBitsBE(in[1U], m_rawData + 8U);
Utils::byteToBitsBE(in[2U], m_rawData + 16U);
@ -134,13 +132,13 @@ void BPTC19696::decodeExtractBinary(const uint8_t* in)
Utils::byteToBitsBE(in[11U], m_rawData + 88U);
Utils::byteToBitsBE(in[12U], m_rawData + 96U);
// Handle the two bits
// handle the two bits
bool bits[8U];
Utils::byteToBitsBE(in[20U], bits);
m_rawData[98U] = bits[6U];
m_rawData[99U] = bits[7U];
// Second block
// second block
Utils::byteToBitsBE(in[21U], m_rawData + 100U);
Utils::byteToBitsBE(in[22U], m_rawData + 108U);
Utils::byteToBitsBE(in[23U], m_rawData + 116U);
@ -163,11 +161,11 @@ void BPTC19696::decodeDeInterleave()
for (uint32_t i = 0U; i < 196U; i++)
m_deInterData[i] = false;
// The first bit is R(3) which is not used so can be ignored
// the first bit is R(3) which is not used so can be ignored
for (uint32_t a = 0U; a < 196U; a++) {
// Calculate the interleave sequence
// calculate the interleave sequence
uint32_t interleaveSequence = (a * 181U) % 196U;
// Shuffle the data
// shuffle the data
m_deInterData[a] = m_rawData[interleaveSequence];
}
}
@ -182,7 +180,7 @@ void BPTC19696::decodeErrorCheck()
do {
fixing = false;
// Run through each of the 15 columns
// run through each of the 15 columns
bool col[13U];
for (uint32_t c = 0U; c < 15U; c++) {
uint32_t pos = c + 1U;
@ -202,7 +200,7 @@ void BPTC19696::decodeErrorCheck()
}
}
// Run through each of the 9 rows containing data
// run through each of the 9 rows containing data
for (uint32_t r = 0U; r < 9U; r++) {
uint32_t pos = (r * 15U) + 1U;
if (Hamming::decode15113_2(m_deInterData + pos))
@ -319,13 +317,13 @@ void BPTC19696::encodeExtractData(const uint8_t* in) const
/// </summary>
void BPTC19696::encodeErrorCheck()
{
// Run through each of the 9 rows containing data
// run through each of the 9 rows containing data
for (uint32_t r = 0U; r < 9U; r++) {
uint32_t pos = (r * 15U) + 1U;
Hamming::encode15113_2(m_deInterData + pos);
}
// Run through each of the 15 columns
// run through each of the 15 columns
bool col[13U];
for (uint32_t c = 0U; c < 15U; c++) {
uint32_t pos = c + 1U;
@ -352,11 +350,11 @@ void BPTC19696::encodeInterleave()
for (uint32_t i = 0U; i < 196U; i++)
m_rawData[i] = false;
// The first bit is R(3) which is not used so can be ignored
// the first bit is R(3) which is not used so can be ignored
for (uint32_t a = 0U; a < 196U; a++) {
// Calculate the interleave sequence
// calculate the interleave sequence
uint32_t interleaveSequence = (a * 181U) % 196U;
// Unshuffle the data
// unshuffle the data
m_rawData[interleaveSequence] = m_deInterData[a];
}
}
@ -367,7 +365,7 @@ void BPTC19696::encodeInterleave()
/// <param name="data"></param>
void BPTC19696::encodeExtractBinary(uint8_t* data)
{
// First block
// first block
Utils::bitsToByteBE(m_rawData + 0U, data[0U]);
Utils::bitsToByteBE(m_rawData + 8U, data[1U]);
Utils::bitsToByteBE(m_rawData + 16U, data[2U]);
@ -381,13 +379,13 @@ void BPTC19696::encodeExtractBinary(uint8_t* data)
Utils::bitsToByteBE(m_rawData + 80U, data[10U]);
Utils::bitsToByteBE(m_rawData + 88U, data[11U]);
// Handle the two bits
// handle the two bits
uint8_t byte;
Utils::bitsToByteBE(m_rawData + 96U, byte);
data[12U] = (data[12U] & 0x3FU) | ((byte >> 0) & 0xC0U);
data[20U] = (data[20U] & 0xFCU) | ((byte >> 4) & 0x03U);
// Second block
// second block
Utils::bitsToByteBE(m_rawData + 100U, data[21U]);
Utils::bitsToByteBE(m_rawData + 108U, data[22U]);
Utils::bitsToByteBE(m_rawData + 116U, data[23U]);

@ -35,10 +35,7 @@
using namespace edac;
#include <cstdint>
#include <cstdio>
#include <cassert>
#include <cmath>
// ---------------------------------------------------------------------------
// Constants

@ -226,7 +226,7 @@ const uint32_t DECODING_TABLE_1987[] = {
#define X18 0x00040000 /* vector representation of X^{18} */
#define X11 0x00000800 /* vector representation of X^{11} */
#define MASK8 0xfffff800 /* auxiliary vector for testing */
#define GENPOL 0x00000c75 /* generator polinomial, g(x) */
#define GENPOL 0x00000c75 /* generator polynomial, g(x) */
// ---------------------------------------------------------------------------
// Static Class Members
@ -278,7 +278,7 @@ void Golay2087::encode(uint8_t* data)
/// Compute the syndrome corresponding to the given pattern, i.e., the
/// remainder after dividing the pattern (when considering it as the vector
/// representation of a polynomial) by the generator polynomial, GENPOL.
/// In the program this pattern has several meanings: (1) pattern = infomation
/// In the program this pattern has several meanings: (1) pattern = information
/// bits, when constructing the encoding table; (2) pattern = error pattern,
/// when constructing the decoding table; and (3) pattern = received vector, to
/// obtain its syndrome in decoding.

@ -35,7 +35,6 @@
using namespace edac;
#include <cstdio>
#include <cassert>
// ---------------------------------------------------------------------------
@ -1076,7 +1075,7 @@ static const uint32_t DECODING_TABLE_23127[] = {
#define X22 0x00400000 /* vector representation of X^{22} */
#define X11 0x00000800 /* vector representation of X^{11} */
#define MASK12 0xfffff800 /* auxiliary vector for testing */
#define GENPOL 0x00000c75 /* generator polinomial, g(x) */
#define GENPOL 0x00000c75 /* generator polynomial, g(x) */
// ---------------------------------------------------------------------------
// Static Class Members
@ -1287,7 +1286,7 @@ void Golay24128::encode24128(uint8_t* data, const uint8_t* raw, uint32_t msglen)
/// Compute the syndrome corresponding to the given pattern, i.e., the
/// remainder after dividing the pattern (when considering it as the vector
/// representation of a polynomial) by the generator polynomial, GENPOL.
/// In the program this pattern has several meanings: (1) pattern = infomation
/// In the program this pattern has several meanings: (1) pattern = information
/// bits, when constructing the encoding table; (2) pattern = error pattern,
/// when constructing the decoding table; and (3) pattern = received vector, to
/// obtain its syndrome in decoding.

@ -32,7 +32,6 @@
using namespace edac;
#include <cstdio>
#include <cassert>
// ---------------------------------------------------------------------------
@ -79,7 +78,7 @@ const uint32_t DECODING_TABLE_1576[] = {
#define X14 0x00004000 /* vector representation of X^{14} */
#define X8 0x00000100 /* vector representation of X^{8} */
#define MASK7 0xffffff00 /* auxiliary vector for testing */
#define GENPOL 0x00000139 /* generator polinomial, g(x) */
#define GENPOL 0x00000139 /* generator polynomial, g(x) */
// ---------------------------------------------------------------------------
// Static Class Members
@ -130,7 +129,7 @@ void QR1676::encode(uint8_t* data)
/// Compute the syndrome corresponding to the given pattern, i.e., the
/// remainder after dividing the pattern (when considering it as the vector
/// representation of a polynomial) by the generator polynomial, GENPOL.
/// In the program this pattern has several meanings: (1) pattern = infomation
/// In the program this pattern has several meanings: (1) pattern = information
/// bits, when constructing the encoding table; (2) pattern = error pattern,
/// when constructing the decoding table; and (3) pattern = received vector, to
/// obtain its syndrome in decoding.

@ -32,9 +32,7 @@
using namespace edac;
#include <cstdio>
#include <cassert>
#include <cstring>
// ---------------------------------------------------------------------------
// Constants

@ -36,9 +36,7 @@
using namespace edac;
#include <cstdio>
#include <cassert>
#include <cstring>
#include <vector>
// ---------------------------------------------------------------------------
@ -145,18 +143,12 @@ RS6355 rs24169; // 8 bit / 4 bit corrections max / 2 bytes total
/// <summary>
/// Initializes a new instance of the RS634717 class.
/// </summary>
RS634717::RS634717()
{
/* stub */
}
RS634717::RS634717() = default;
/// <summary>
/// Finalizes a instance of the RS634717 class.
/// </summary>
RS634717::~RS634717()
{
/* stub */
}
RS634717::~RS634717() = default;
/// <summary>
/// Decode RS (24,12,13) FEC.

@ -33,7 +33,6 @@
using namespace edac;
#include <cstdio>
#include <cstring>
#include <cassert>
@ -114,7 +113,7 @@ static inline void set_uint32(uint8_t* cp, uint32_t v)
/// </summary>
/// <remarks>
/// Takes a pointer to a 256 bit block of data (eight 32 bit ints) and
/// intializes it to the start constants of the SHA256 algorithm. This
/// initializes it to the start constants of the SHA256 algorithm. This
/// must be called before using hash in the call to sha256_hash
/// </remarks>
SHA256::SHA256() :
@ -332,7 +331,7 @@ void SHA256::processBytes(const uint8_t* buffer, uint32_t len)
}
/// <summary>
/// Process the remaining bytes in the bufferand put result from context
/// Process the remaining bytes in the buffer and put result from context
/// in first 32 bytes following buffer. The result is always in little
/// endian byte order, so that a byte - wise output yields to the wanted
/// ASCII representation of the message digest.

@ -67,7 +67,7 @@ namespace edac
/// that LEN is a multiple of 64.</summary>
void processBytes(const uint8_t* buffer, uint32_t len);
/// <summary>Process the remaining bytes in the bufferand put result from context in first 32
/// <summary>Process the remaining bytes in the buffer and put result from context in first 32
/// bytes following buffer. The result is always in little endian byte order, so that a byte-wise
/// output yields to the wanted ASCII representation of the message digest.</summary>
uint8_t* finish(uint8_t* buffer);

@ -30,7 +30,6 @@
using namespace edac;
#include <cstdio>
#include <cassert>
// ---------------------------------------------------------------------------
@ -66,18 +65,12 @@ const uint8_t ENCODE_TABLE_12[] = {
/// <summary>
/// Initializes a new instance of the Trellis class.
/// </summary>
Trellis::Trellis()
{
/* stub */
}
Trellis::Trellis() = default;
/// <summary>
/// Finalizes a instance of the Trellis class.
/// </summary>
Trellis::~Trellis()
{
/* stub */
}
Trellis::~Trellis() = default;
/// <summary>
/// Decodes 3/4 rate Trellis.

@ -140,9 +140,9 @@ namespace edac
virtual int load() const = 0;
/// <summary>Initializes a new instance of the reed_solomon_base class.</summary>
reed_solomon_base() { /* stub */ }
reed_solomon_base() = default;
/// <summary>Finalizes a instance of the reed_solomon_base class.</summary>
virtual ~reed_solomon_base() { /* stub */ }
virtual ~reed_solomon_base() = default;
/// <summary></summary>
virtual std::ostream &output(std::ostream &lhs) const { return lhs << "RS(" << this->size() << "," << this->load() << ")"; }
@ -378,7 +378,7 @@ namespace edac
}
/// <summary>Finalizes a instance of the reed_solomon_tabs class.</summary>
virtual ~reed_solomon_tabs() { /* stub */ }
~reed_solomon_tabs() override = default;
//
// modnn -- modulo replacement for galois field arithmetics, optionally w/ table acceleration
@ -415,7 +415,6 @@ namespace edac
}
};
// ---------------------------------------------------------------------------
// Class Declaration
// Reed-Solomon codec.
@ -509,7 +508,7 @@ namespace edac
}
}
/// <summary>Finalizes a instance of the reed_solomon class.</summary>
virtual ~reed_solomon() { /* stub */ }
virtual ~reed_solomon() = default;
/// <summary>A data element's bits.</summary>
virtual size_t datum() const { return DATUM; }
@ -743,7 +742,6 @@ namespace edac
return corrects;
}
int encode(const TYP* data, int len, TYP* parity) const
{
// Check length parameter for validity

@ -28,11 +28,6 @@
using namespace lookups;
#include <cassert>
#include <cstdio>
#include <cstring>
#include <ctime>
// ---------------------------------------------------------------------------
// Public Class Members
// ---------------------------------------------------------------------------

@ -87,9 +87,9 @@ namespace lookups
}
/// <summary>Helper to determine if the channel identity is valid.</summary>
bool isValidChId() { return m_chId != 0U; }
bool isValidChId() const { return m_chId != 0U; }
/// <summary>Helper to determine if the channel is valid.</summary>
bool isValidCh() { return m_chNo != 0U; }
bool isValidCh() const { return m_chNo != 0U; }
public:
/// <summary>Voice Channel Identity.</summary>

@ -25,14 +25,10 @@
*/
#include "lookups/IdenTableLookup.h"
#include "Log.h"
#include "Timer.h"
using namespace lookups;
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <string>
#include <vector>
#include <fstream>
@ -51,14 +47,6 @@ IdenTableLookup::IdenTableLookup(const std::string& filename, uint32_t reloadTim
/* stub */
}
/// <summary>
/// Finalizes a instance of the IdenTableLookup class.
/// </summary>
IdenTableLookup::~IdenTableLookup()
{
/* stub */
}
/// <summary>
/// Finds a table entry in this lookup table.
/// </summary>
@ -116,7 +104,7 @@ std::vector<IdenTable> IdenTableLookup::list()
/// <returns>True, if lookup table was loaded, otherwise false.</returns>
bool IdenTableLookup::load()
{
if (m_filename.length() <= 0) {
if (m_filename.empty()) {
return false;
}

@ -42,7 +42,7 @@ namespace lookups
class HOST_SW_API IdenTable {
public:
/// <summary>Initializes a new insatnce of the IdenTable class.</summary>
/// <summary>Initializes a new instance of the IdenTable class.</summary>
IdenTable() :
m_channelId(0U),
m_baseFrequency(0U),
@ -52,7 +52,7 @@ namespace lookups
{
/* stub */
}
/// <summary>Initializes a new insatnce of the IdenTable class.</summary>
/// <summary>Initializes a new instance of the IdenTable class.</summary>
/// <param name="channelId"></param>
/// <param name="baseFrequency"></param>
/// <param name="chSpaceKhz"></param>
@ -107,18 +107,16 @@ namespace lookups
public:
/// <summary>Initializes a new instance of the IdenTableLookup class.</summary>
IdenTableLookup(const std::string& filename, uint32_t reloadTime);
/// <summary>Finalizes a instance of the IdenTableLookup class.</summary>
virtual ~IdenTableLookup();
/// <summary>Finds a table entry in this lookup table.</summary>
virtual IdenTable find(uint32_t id);
IdenTable find(uint32_t id) override;
/// <summary>Returns the list of entries in this lookup table.</summary>
std::vector<IdenTable> list();
protected:
/// <summary>Loads the table from the passed lookup table file.</summary>
/// <returns>True, if lookup table was loaded, otherwise false.</returns>
virtual bool load();
bool load() override;
};
} // namespace lookups

@ -26,10 +26,6 @@
#if !defined(__LOOKUP_TABLE_H__)
#define __LOOKUP_TABLE_H__
#if _MSC_VER > 1910
#pragma warning(disable : 4834) // [[nodiscard]] warning -- we don't care about this here
#endif
#include "common/Defines.h"
#include "common/Thread.h"
#include "common/Timer.h"
@ -59,18 +55,14 @@ namespace lookups
Thread(),
m_filename(filename),
m_reloadTime(reloadTime),
m_table()
{
/* stub */
}
/// <summary>Finalizes a instance of the LookupTable class.</summary>
virtual ~LookupTable()
m_table(),
m_stop(false)
{
/* stub */
}
/// <summary></summary>
virtual void entry()
void entry() override
{
if (m_reloadTime == 0U) {
return;
@ -161,8 +153,6 @@ namespace lookups
std::mutex m_mutex;
bool m_stop;
bool m_acl;
/// <summary>Loads the table from the passed lookup table file.</summary>
/// <returns>True, if lookup table was loaded, otherwise false.</returns>
virtual bool load() = 0;

@ -35,7 +35,6 @@ using namespace lookups;
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
// ---------------------------------------------------------------------------
// Public Class Members
@ -94,7 +93,7 @@ bool RSSIInterpolator::load(const std::string& filename)
}
/// <summary>
/// Interoplates the given raw RSSI value with the lookup map.
/// Interpolates the given raw RSSI value with the lookup map.
/// </summary>
/// <param name="val">Raw RSSI value from modem DSP.</param>
/// <returns>Interpolated RSSI value.</returns>

@ -53,7 +53,7 @@ namespace lookups
/// <summary>Loads the table from the passed RSSI mapping file.</summary>
bool load(const std::string& filename);
/// <summary>Interoplates the given raw RSSI value with the lookup map.</summary>
/// <summary>Interpolates the given raw RSSI value with the lookup map.</summary>
int interpolate(uint16_t raw) const;
private:

@ -31,14 +31,10 @@
#include "lookups/RadioIdLookup.h"
#include "p25/P25Defines.h"
#include "Log.h"
#include "Timer.h"
using namespace lookups;
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <string>
#include <vector>
#include <fstream>
@ -59,14 +55,6 @@ RadioIdLookup::RadioIdLookup(const std::string& filename, uint32_t reloadTime, b
/* stub */
}
/// <summary>
/// Finalizes a instance of the RadioIdLookup class.
/// </summary>
RadioIdLookup::~RadioIdLookup()
{
/* stub */
}
/// <summary>
/// Toggles the specified radio ID enabled or disabled.
/// </summary>
@ -75,7 +63,7 @@ RadioIdLookup::~RadioIdLookup()
void RadioIdLookup::toggleEntry(uint32_t id, bool enabled)
{
RadioId rid = find(id);
if (rid.radioEnabled() == false && rid.radioDefault() == true) {
if (!rid.radioEnabled() && rid.radioDefault()) {
if (enabled) {
LogMessage(LOG_HOST, "Added enabled RID %u to RID ACL table", id);
}
@ -84,7 +72,7 @@ void RadioIdLookup::toggleEntry(uint32_t id, bool enabled)
}
}
if (rid.radioEnabled() == false && rid.radioDefault() == false) {
if (!rid.radioEnabled() && !rid.radioDefault()) {
if (enabled) {
LogMessage(LOG_HOST, "Enabled RID %u in RID ACL table", id);
}
@ -171,7 +159,7 @@ bool RadioIdLookup::getACL()
/// <returns>True, if lookup table was loaded, otherwise false.</returns>
bool RadioIdLookup::load()
{
if (m_filename.length() <= 0) {
if (m_filename.empty()) {
return false;
}

@ -46,14 +46,14 @@ namespace lookups
class HOST_SW_API RadioId {
public:
/// <summary>Initializes a new insatnce of the RadioId class.</summary>
/// <summary>Initializes a new instance of the RadioId class.</summary>
RadioId() :
m_radioEnabled(false),
m_radioDefault(false)
{
/* stub */
}
/// <summary>Initializes a new insatnce of the RadioId class.</summary>
/// <summary>Initializes a new instance of the RadioId class.</summary>
/// <param name="radioEnabled"></param>
/// <param name="radioDefault"></param>
RadioId(bool radioEnabled, bool radioDefault) :
@ -100,8 +100,6 @@ namespace lookups
public:
/// <summary>Initializes a new instance of the RadioIdLookup class.</summary>
RadioIdLookup(const std::string& filename, uint32_t reloadTime, bool ridAcl);
/// <summary>Finalizes a instance of the RadioIdLookup class.</summary>
virtual ~RadioIdLookup();
/// <summary>Toggles the specified radio ID enabled or disabled.</summary>
void toggleEntry(uint32_t id, bool enabled);
@ -109,7 +107,7 @@ namespace lookups
/// <summary>Adds a new entry to the lookup table by the specified unique ID.</summary>
void addEntry(uint32_t id, bool enabled);
/// <summary>Finds a table entry in this lookup table.</summary>
virtual RadioId find(uint32_t id);
RadioId find(uint32_t id) override;
/// <summary>Flag indicating whether radio ID access control is enabled or not.</summary>
bool getACL();
@ -119,7 +117,7 @@ namespace lookups
/// <summary>Loads the table from the passed lookup table file.</summary>
/// <returns>True, if lookup table was loaded, otherwise false.</returns>
virtual bool load();
bool load() override;
};
} // namespace lookups

@ -29,13 +29,8 @@
using namespace lookups;
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <string>
#include <vector>
#include <fstream>
// ---------------------------------------------------------------------------
// Public Class Members
@ -62,10 +57,7 @@ TalkgroupRulesLookup::TalkgroupRulesLookup(const std::string& filename, uint32_t
/// <summary>
/// Finalizes a instance of the TalkgroupRulesLookup class.
/// </summary>
TalkgroupRulesLookup::~TalkgroupRulesLookup()
{
/* stub */
}
TalkgroupRulesLookup::~TalkgroupRulesLookup() = default;
/// <summary>
///

@ -44,14 +44,14 @@ namespace lookups
class HOST_SW_API TalkgroupRuleGroupVoiceSource {
public:
/// <summary>Initializes a new insatnce of the TalkgroupRuleGroupVoiceSource class.</summary>
/// <summary>Initializes a new instance of the TalkgroupRuleGroupVoiceSource class.</summary>
TalkgroupRuleGroupVoiceSource() :
m_tgId(0U),
m_tgSlot(0U)
{
/* stub */
}
/// <summary>Initializes a new insatnce of the TalkgroupRuleGroupVoiceSource class.</summary>
/// <summary>Initializes a new instance of the TalkgroupRuleGroupVoiceSource class.</summary>
/// <param name="node"></param>
TalkgroupRuleGroupVoiceSource(yaml::Node& node) :
TalkgroupRuleGroupVoiceSource()
@ -61,7 +61,7 @@ namespace lookups
}
/// <summary>Equals operator. Copies this TalkgroupRuleGroupVoiceSource to another TalkgroupRuleGroupVoiceSource.</summary>
virtual TalkgroupRuleGroupVoiceSource& operator=(const TalkgroupRuleGroupVoiceSource& data)
virtual TalkgroupRuleGroupVoiceSource& operator= (const TalkgroupRuleGroupVoiceSource& data)
{
if (this != &data) {
m_tgId = data.m_tgId;
@ -85,7 +85,7 @@ namespace lookups
class HOST_SW_API TalkgroupRuleRewrite {
public:
/// <summary>Initializes a new insatnce of the TalkgroupRuleRewrite class.</summary>
/// <summary>Initializes a new instance of the TalkgroupRuleRewrite class.</summary>
TalkgroupRuleRewrite() :
m_peerId(0U),
m_tgId(0U),
@ -93,7 +93,7 @@ namespace lookups
{
/* stub */
}
/// <summary>Initializes a new insatnce of the TalkgroupRuleRewrite class.</summary>
/// <summary>Initializes a new instance of the TalkgroupRuleRewrite class.</summary>
/// <param name="node"></param>
TalkgroupRuleRewrite(yaml::Node& node) :
TalkgroupRuleRewrite()
@ -104,7 +104,7 @@ namespace lookups
}
/// <summary>Equals operator. Copies this TalkgroupRuleRewrite to another TalkgroupRuleRewrite.</summary>
virtual TalkgroupRuleRewrite& operator=(const TalkgroupRuleRewrite& data)
virtual TalkgroupRuleRewrite& operator= (const TalkgroupRuleRewrite& data)
{
if (this != &data) {
m_peerId = data.m_peerId;
@ -131,7 +131,7 @@ namespace lookups
class HOST_SW_API TalkgroupRuleConfig {
public:
/// <summary>Initializes a new insatnce of the TalkgroupRuleConfig class.</summary>
/// <summary>Initializes a new instance of the TalkgroupRuleConfig class.</summary>
TalkgroupRuleConfig() :
m_active(false),
m_parrot(false),
@ -141,7 +141,7 @@ namespace lookups
{
/* stub */
}
/// <summary>Initializes a new insatnce of the TalkgroupRuleConfig class.</summary>
/// <summary>Initializes a new instance of the TalkgroupRuleConfig class.</summary>
/// <param name="node"></param>
TalkgroupRuleConfig(yaml::Node& node) :
TalkgroupRuleConfig()
@ -175,7 +175,7 @@ namespace lookups
}
/// <summary>Equals operator. Copies this TalkgroupRuleConfig to another TalkgroupRuleConfig.</summary>
virtual TalkgroupRuleConfig& operator=(const TalkgroupRuleConfig& data)
virtual TalkgroupRuleConfig& operator= (const TalkgroupRuleConfig& data)
{
if (this != &data) {
m_active = data.m_active;
@ -207,7 +207,7 @@ namespace lookups
class HOST_SW_API TalkgroupRuleGroupVoice {
public:
/// <summary>Initializes a new insatnce of the TalkgroupRuleGroupVoice class.</summary>
/// <summary>Initializes a new instance of the TalkgroupRuleGroupVoice class.</summary>
TalkgroupRuleGroupVoice() :
m_name(),
m_config(),
@ -215,7 +215,7 @@ namespace lookups
{
/* stub */
}
/// <summary>Initializes a new insatnce of the TalkgroupRuleGroupVoice class.</summary>
/// <summary>Initializes a new instance of the TalkgroupRuleGroupVoice class.</summary>
/// <param name="node"></param>
TalkgroupRuleGroupVoice(yaml::Node& node) :
TalkgroupRuleGroupVoice()
@ -226,7 +226,7 @@ namespace lookups
}
/// <summary>Equals operator. Copies this TalkgroupRuleGroupVoice to another TalkgroupRuleGroupVoice.</summary>
virtual TalkgroupRuleGroupVoice& operator=(const TalkgroupRuleGroupVoice& data)
virtual TalkgroupRuleGroupVoice& operator= (const TalkgroupRuleGroupVoice& data)
{
if (this != &data) {
m_name = data.m_name;
@ -265,10 +265,10 @@ namespace lookups
/// <summary>Initializes a new instance of the TalkgroupRulesLookup class.</summary>
TalkgroupRulesLookup(const std::string& filename, uint32_t reloadTime, bool acl);
/// <summary>Finalizes a instance of the TalkgroupRulesLookup class.</summary>
virtual ~TalkgroupRulesLookup();
~TalkgroupRulesLookup() override;
/// <summary></summary>
void entry();
void entry() override;
/// <summary>Stops and unloads this lookup table.</summary>
void stop();

@ -33,17 +33,13 @@
#include "common/nxdn/NXDNDefines.h"
#include "common/p25/dfsi/DFSIDefines.h"
#include "common/p25/dfsi/LC.h"
#include "edac/SHA256.h"
#include "network/BaseNetwork.h"
#include "Log.h"
#include "Utils.h"
using namespace network;
using namespace network::frame;
#include <cstdio>
#include <cassert>
#include <cstdlib>
// ---------------------------------------------------------------------------
// Public Class Members

@ -36,9 +36,7 @@
using namespace network;
using namespace network::frame;
#include <cstdio>
#include <cassert>
#include <cstdlib>
#include <cstring>
// ---------------------------------------------------------------------------
@ -57,14 +55,6 @@ FrameQueue::FrameQueue(UDPSocket* socket, uint32_t peerId, bool debug) : RawFram
assert(peerId < 999999999U);
}
/// <summary>
/// Finalizes a instance of the FrameQueue class.
/// </summary>
FrameQueue::~FrameQueue()
{
/* stub */
}
/// <summary>
/// Read message from the received UDP packet.
/// </summary>

@ -52,8 +52,6 @@ namespace network
public:
/// <summary>Initializes a new instance of the FrameQueue class.</summary>
FrameQueue(UDPSocket* socket, uint32_t peerId, bool debug);
/// <summary>Finalizes a instance of the FrameQueue class.</summary>
virtual ~FrameQueue();
/// <summary>Read message from the received UDP packet.</summary>
UInt8Array read(int& messageLength, sockaddr_storage& address, uint32_t& addrLen,

@ -46,10 +46,7 @@ RTPExtensionHeader::RTPExtensionHeader() :
/// <summary>
/// Finalizes a instance of the RTPExtensionHeader class.
/// </summary>
RTPExtensionHeader::~RTPExtensionHeader()
{
/* stub */
}
RTPExtensionHeader::~RTPExtensionHeader() = default;
/// <summary>
/// Decode a RTP header.

@ -50,12 +50,9 @@ RTPFNEHeader::RTPFNEHeader() :
}
/// <summary>
/// Finalizes a instance of the RTPExtensionHeader class.
/// Finalizes a instance of the RTPFNEHeader class.
/// </summary>
RTPFNEHeader::~RTPFNEHeader()
{
/* stub */
}
RTPFNEHeader::~RTPFNEHeader() = default;
/// <summary>
/// Decode a RTP header.

@ -65,9 +65,9 @@ namespace network
~RTPFNEHeader();
/// <summary>Decode a RTP header.</summary>
virtual bool decode(const uint8_t* data);
bool decode(const uint8_t* data) override;
/// <summary>Encode a RTP header.</summary>
virtual void encode(uint8_t* data);
void encode(uint8_t* data) override;
public:
/// <summary>Traffic payload packet CRC-16.</summary>

@ -62,10 +62,7 @@ RTPHeader::RTPHeader() :
/// <summary>
/// Finalizes a instance of the RTPHeader class.
/// </summary>
RTPHeader::~RTPHeader()
{
/* stub */
}
RTPHeader::~RTPHeader() = default;
/// <summary>
/// Decode a RTP header.

@ -69,7 +69,7 @@ namespace network
__READONLY_PROPERTY(uint8_t, version, Version);
/// <summary>Flag indicating if the packet has trailing padding.</summary>
__READONLY_PROPERTY(bool, padding, Padding);
/// <summary>Flag indicating the presense of an extension header.</summary>
/// <summary>Flag indicating the presence of an extension header.</summary>
__PROPERTY(bool, extension, Extension);
/// <summary>Count of contributing source IDs that follow the SSRC.</summary>
__READONLY_PROPERTY(uint8_t, cc, CSRCCount);

@ -31,9 +31,7 @@
using namespace network;
#include <cstdio>
#include <cassert>
#include <cstdlib>
#include <cstring>
// ---------------------------------------------------------------------------
@ -58,7 +56,7 @@ RawFrameQueue::RawFrameQueue(UDPSocket* socket, bool debug) :
/// </summary>
RawFrameQueue::~RawFrameQueue()
{
/* stub */
deleteBuffers();
}
/// <summary>
@ -149,6 +147,20 @@ bool RawFrameQueue::flushQueue()
ret = false;
}
deleteBuffers();
return ret;
}
// ---------------------------------------------------------------------------
// Private Class Members
// ---------------------------------------------------------------------------
/// <summary>
/// Helper to ensure buffers are deleted.
/// </summary>
void RawFrameQueue::deleteBuffers()
{
for (auto& buffer : m_buffers) {
if (buffer != nullptr) {
// LogDebug(LOG_NET, "deleting buffer, addr %p len %u", buffer->buffer, buffer->length);
@ -163,6 +175,4 @@ bool RawFrameQueue::flushQueue()
}
}
m_buffers.clear();
return ret;
}

@ -67,6 +67,10 @@ namespace network
BufferVector m_buffers;
bool m_debug;
private:
/// <summary>Helper to ensure buffers are deleted.</summary>
void deleteBuffers();
};
} // namespace network

@ -62,11 +62,17 @@ enum IPMATCHTYPE {
namespace network
{
#if defined(HAVE_SENDMSG) && !defined(HAVE_SENDMMSG)
/* For `sendmmsg'. */
struct mmsghdr {
struct msghdr msg_hdr;
unsigned int msg_len;
struct msghdr msg_hdr; /* Actual message header. */
unsigned int msg_len; /* Number of received or sent bytes for the entry. */
};
/* Send a VLEN messages as described by VMESSAGES to socket FD.
Returns the number of datagrams successfully written or -1 for errors.
This function is a cancellation point and therefore not marked with
__THROW. */
static inline int sendmmsg(int sockfd, struct mmsghdr* msgvec, unsigned int vlen, int flags)
{
ssize_t n = 0;

@ -66,6 +66,7 @@ namespace network
explicit ClientConnection(asio::ip::tcp::socket socket, RequestHandlerType& handler) :
m_socket(std::move(socket)),
m_requestHandler(handler),
m_buffer(),
m_lexer(HTTPLexer(true))
{
/* stub */

@ -75,7 +75,7 @@ namespace network
/// <summary>Initializes a copy instance of the HTTPClient class.</summary>
HTTPClient(const HTTPClient&) = delete;
/// <summary>Finalizes a instance of the HTTPClient class.</summary>
~HTTPClient()
~HTTPClient() override
{
if (m_connection != nullptr) {
close();
@ -136,7 +136,7 @@ namespace network
private:
/// <summary></summary>
virtual void entry()
void entry() override
{
if (m_completed) {
return;
@ -164,7 +164,7 @@ namespace network
{
asio::connect(m_socket, endpoints);
m_connection = new_unique(ConnectionType, std::move(m_socket), m_requestHandler);
m_connection = std::make_unique<ConnectionType>(std::move(m_socket), m_requestHandler);
m_connection->start();
}

@ -77,6 +77,7 @@ namespace network
m_socket(std::move(socket)),
m_connectionManager(manager),
m_requestHandler(handler),
m_buffer(),
m_lexer(HTTPLexer(false)),
m_persistent(persistent)
{

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save

Powered by TurnKey Linux.