time to piss everyone off, this commit changes logging to move things to a async queue when using file logging for performance; it also removes the .activity.log files, activity logging is still created however instead of being stored locally to conserve disk space on lower-end machines they are transmitted from peer to FNE and the FNE will either log them or store them to the metrics db;

r05a06_dev
Bryan Biedenkapp 3 days ago
parent a0536d2c34
commit dd4d050cdb

@ -45,8 +45,6 @@ log:
useSyslog: true
# Full path for the directory to store the log files.
filePath: .
# Full path for the directory to store the activity log files.
activityFilePath: .
# Log filename prefix.
fileRoot: dvmbridge

@ -68,8 +68,6 @@ log:
useSyslog: true
# Full path for the directory to store the log files.
filePath: .
# Full path for the directory to store the activity log files.
activityFilePath: .
# Log filename prefix.
fileRoot: DVM

@ -58,8 +58,6 @@ log:
filePath: .
# Flag indicating file logs should be sent to syslog instead of a file.
useSyslog: true
# Full path for the directory to store the activity log files.
activityFilePath: .
# Log filename prefix.
fileRoot: DVM
@ -446,6 +444,10 @@ system:
# Flag indicating whether or not the host diagnostic log will be sent to the network.
allowDiagnosticTransfer: true
# Flag indicating whether or not activity logs from peers are written to the log file.
# (NOTE: This only disables logging to the actual log file, console logging will still occur based on the
# displayLevel setting, and metrics logging will still occur if metrics is configured.)
logActivityToLog: false
# Flag indicating whether or not REST API is enabled.
restEnable: false

@ -45,8 +45,6 @@ log:
useSyslog: false
# Full path for the directory to store the log files.
filePath: .
# Full path for the directory to store the activity log files.
activityFilePath: .
# Log filename prefix.
fileRoot: SYSVIEW

@ -45,8 +45,6 @@ log:
useSyslog: true
# Full path for the directory to store the log files.
filePath: .
# Full path for the directory to store the activity log files.
activityFilePath: .
# Log filename prefix.
fileRoot: dvmpatch

@ -1,127 +0,0 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Digital Voice Modem - Bridge
* GPLv2 Open Source. Use is subject to license terms.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright (C) 2024-2025 Bryan Biedenkapp, N2PLL
*
*/
#include "ActivityLog.h"
#include "common/network/BaseNetwork.h"
#include "common/Log.h" // for CurrentLogFileLevel() and LogGetNetwork()
#if defined(CATCH2_TEST_COMPILATION)
#include <catch2/catch_test_macros.hpp>
#endif
#include <cstdio>
#include <cstdarg>
#include <ctime>
#include <cassert>
#include <cstring>
// ---------------------------------------------------------------------------
// Constants
// ---------------------------------------------------------------------------
#define EOL "\r\n"
const uint32_t ACT_LOG_BUFFER_LEN = 501U;
// ---------------------------------------------------------------------------
// Global Variables
// ---------------------------------------------------------------------------
static std::string g_actFilePath;
static std::string g_actFileRoot;
static FILE* g_actFpLog = nullptr;
static struct tm g_actTm;
// ---------------------------------------------------------------------------
// Global Functions
// ---------------------------------------------------------------------------
/* Helper to open the activity log file, file handle. */
static bool ActivityLogOpen()
{
if (CurrentLogFileLevel() == 0U)
return true;
time_t now;
::time(&now);
struct tm* tm = ::gmtime(&now);
if (tm->tm_mday == g_actTm.tm_mday && tm->tm_mon == g_actTm.tm_mon && tm->tm_year == g_actTm.tm_year) {
if (g_actFpLog != nullptr)
return true;
}
else {
if (g_actFpLog != nullptr)
::fclose(g_actFpLog);
}
char filename[200U];
::sprintf(filename, "%s/%s-%04d-%02d-%02d.activity.log", LogGetFilePath().c_str(), LogGetFileRoot().c_str(), tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday);
g_actFpLog = ::fopen(filename, "a+t");
g_actTm = *tm;
return g_actFpLog != nullptr;
}
/* Initializes the activity log. */
bool ActivityLogInitialise(const std::string& filePath, const std::string& fileRoot)
{
#if defined(CATCH2_TEST_COMPILATION)
return true;
#endif
g_actFilePath = filePath;
g_actFileRoot = fileRoot;
return ::ActivityLogOpen();
}
/* Finalizes the activity log. */
void ActivityLogFinalise()
{
#if defined(CATCH2_TEST_COMPILATION)
return;
#endif
if (g_actFpLog != nullptr)
::fclose(g_actFpLog);
}
/* Writes a new entry to the activity log. */
void log_internal::ActivityLogInternal(const std::string& log)
{
#if defined(CATCH2_TEST_COMPILATION)
return;
#endif
bool ret = ::ActivityLogOpen();
if (!ret)
return;
if (CurrentLogFileLevel() == 0U)
return;
if (LogGetNetwork() != nullptr) {
network::BaseNetwork* network = (network::BaseNetwork*)LogGetNetwork();
network->writeActLog(log.c_str());
}
::fprintf(g_actFpLog, "%s\n", log.c_str());
::fflush(g_actFpLog);
if (2U >= g_logDisplayLevel && g_logDisplayLevel != 0U) {
::fprintf(stdout, "%s" EOL, log.c_str());
::fflush(stdout);
}
}

@ -1,94 +0,0 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Digital Voice Modem - Bridge
* GPLv2 Open Source. Use is subject to license terms.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright (C) 2024-2025 Bryan Biedenkapp, N2PLL
*
*/
/**
* @file ActivityLog.h
* @ingroup bridge
* @file ActivityLog.cpp
* @ingroup bridge
*/
#if !defined(__ACTIVITY_LOG_H__)
#define __ACTIVITY_LOG_H__
#include "Defines.h"
#if defined(_WIN32)
#include "common/Clock.h"
#else
#include <sys/time.h>
#endif // defined(_WIN32)
#include <string>
// ---------------------------------------------------------------------------
// Global Functions
// ---------------------------------------------------------------------------
namespace log_internal
{
/**
* @brief Writes a new entry to the diagnostics log.
* @param level Log level for entry.
* @param log Fully formatted log message.
*/
extern HOST_SW_API void ActivityLogInternal(const std::string& log);
} // namespace log_internal
/**
* @brief Initializes the activity log.
* @param filePath File path for the log file.
* @param fileRoot Root name for log file.
*/
extern HOST_SW_API bool ActivityLogInitialise(const std::string& filePath, const std::string& fileRoot);
/**
* @brief Finalizes the activity log.
*/
extern HOST_SW_API void ActivityLogFinalise();
/**
* @brief Writes a new entry to the diagnostics log.
* @param fmt String format.
*
* This is a variable argument function. This shouldn't be called directly, utilize the LogXXXX macros above, instead.
*/
template<typename ... Args>
HOST_SW_API void ActivityLog(const std::string& fmt, Args... args)
{
using namespace log_internal;
int size_s = std::snprintf(nullptr, 0, fmt.c_str(), args...) + 1; // Extra space for '\0'
if (size_s <= 0) {
throw std::runtime_error("Error during formatting.");
}
int prefixLen = 0;
char prefixBuf[256];
time_t now;
::time(&now);
struct tm* tm = ::localtime(&now);
struct timeval nowMillis;
::gettimeofday(&nowMillis, NULL);
prefixLen = ::sprintf(prefixBuf, "A: %04d-%02d-%02d %02d:%02d:%02d.%03lu ",
tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec, nowMillis.tv_usec / 1000U);
auto size = static_cast<size_t>(size_s);
auto buf = std::make_unique<char[]>(size);
std::snprintf(buf.get(), size, fmt.c_str(), args ...);
std::string prefix = std::string(prefixBuf, prefixBuf + prefixLen);
std::string msg = std::string(buf.get(), buf.get() + size - 1);
ActivityLogInternal(std::string(prefix + msg));
}
#endif // __ACTIVITY_LOG_H__

@ -9,7 +9,6 @@
*/
#include "Defines.h"
#include "common/Log.h"
#include "bridge/ActivityLog.h"
#include "BridgeMain.h"
#include "HostBridge.h"
@ -318,7 +317,6 @@ int main(int argc, char** argv)
} while (g_signal == SIGHUP);
::LogFinalise();
::ActivityLogFinalise();
return ret;
}

@ -15,7 +15,6 @@
#include "common/analog/data/NetData.h"
#include "common/Log.h"
#include "common/Utils.h"
#include "bridge/ActivityLog.h"
#include "HostBridge.h"
#include "BridgeMain.h"

@ -20,7 +20,6 @@
#include "common/dmr/Sync.h"
#include "common/Log.h"
#include "common/Utils.h"
#include "bridge/ActivityLog.h"
#include "HostBridge.h"
#include "BridgeMain.h"

@ -22,7 +22,6 @@
#include "common/nxdn/lc/RTCH.h"
#include "common/Log.h"
#include "common/Utils.h"
#include "bridge/ActivityLog.h"
#include "HostBridge.h"
#include "BridgeMain.h"

@ -21,7 +21,6 @@
#include "common/p25/P25Utils.h"
#include "common/Log.h"
#include "common/Utils.h"
#include "bridge/ActivityLog.h"
#include "HostBridge.h"
#include "BridgeMain.h"

@ -35,7 +35,6 @@
#include "common/Thread.h"
#include "common/Log.h"
#include "common/Utils.h"
#include "bridge/ActivityLog.h"
#include "HostBridge.h"
#include "BridgeMain.h"
@ -379,11 +378,6 @@ int HostBridge::run()
::fatal("unable to open the log file\n");
}
ret = ::ActivityLogInitialise(logConf["activityFilePath"].as<std::string>(), logConf["fileRoot"].as<std::string>());
if (!ret) {
::fatal("unable to open the activity log file\n");
}
#if !defined(_WIN32)
// handle POSIX process forking
if (m_daemon) {

@ -10,6 +10,7 @@
*/
#include "Log.h"
#include "network/BaseNetwork.h"
#include "LogAsync.h"
#if defined(CATCH2_TEST_COMPILATION)
#include <catch2/catch_test_macros.hpp>
@ -58,10 +59,22 @@ static std::ostream g_outStream { std::cerr.rdbuf() };
bool log_stacktrace::SignalHandling::s_foreground = false;
log_internal::LogAsync g_logAsync;
// ---------------------------------------------------------------------------
// Global Functions
// ---------------------------------------------------------------------------
/* Helper function to log messages asynchronously using the LogAsync instance. */
void LogAsyncSink(const char* message)
{
if (g_fpLog != nullptr) {
::fprintf(g_fpLog, "%s" EOL, message);
::fflush(g_fpLog);
}
}
/* Helper to get the current log file level. */
uint32_t CurrentLogFileLevel() { return g_fileLevel; }
@ -95,8 +108,11 @@ static bool LogOpen()
return true;
}
else {
if (g_fpLog != nullptr)
if (g_fpLog != nullptr) {
g_logAsync.stop();
::fclose(g_fpLog);
g_fpLog = nullptr;
}
}
char filename[200U];
@ -105,6 +121,9 @@ static bool LogOpen()
g_fpLog = ::fopen(filename, "a+t");
g_tm = *tm;
if (g_fpLog != nullptr)
g_logAsync.start();
return g_fpLog != nullptr;
}
else {
@ -148,9 +167,6 @@ void* LogGetNetwork()
void LogSetNetwork(void* network)
{
#if defined(CATCH2_TEST_COMPILATION)
return;
#endif
// note: The Network class is passed here as a void so we can avoid including the Network.h
// header in Log.h. This is dirty and probably terrible...
g_network = (network::BaseNetwork*)network;
@ -182,6 +198,7 @@ void LogFinalise()
return;
#endif
if (g_fpLog != nullptr) {
g_logAsync.stop();
::fclose(g_fpLog);
g_fpLog = nullptr;
}
@ -224,10 +241,7 @@ void log_internal::LogInternal(uint32_t level, const std::string& log)
if (!ret)
return;
if (g_fpLog != nullptr) {
::fprintf(g_fpLog, "%s\n", log.c_str());
::fflush(g_fpLog);
}
g_logAsync.log(log, LogAsyncSink);
} else {
#if !defined(_WIN32)
// convert our log level into syslog level
@ -263,8 +277,11 @@ void log_internal::LogInternal(uint32_t level, const std::string& log)
// fatal error (specially allow any log levels above 9999)
if (level >= 5U && level < 9999U) {
if (g_fpLog != nullptr)
if (g_fpLog != nullptr) {
g_logAsync.stop();
::fclose(g_fpLog);
g_fpLog = nullptr;
}
#if !defined(_WIN32)
if (g_useSyslog)
::closelog();
@ -273,6 +290,25 @@ void log_internal::LogInternal(uint32_t level, const std::string& log)
}
}
/* Writes a new entry to the activity log. */
void log_internal::ActivityLogInternal(const std::string& log)
{
if (CurrentLogFileLevel() == 0U)
return;
if (LogGetNetwork() != nullptr) {
network::BaseNetwork* network = (network::BaseNetwork*)LogGetNetwork();
network->writeActLog(log.c_str());
}
#if defined(CATCH2_TEST_COMPILATION)
return;
#endif
// activity only logs to network -- nothing local
}
/* Internal helper to get the log file path. */
std::string log_internal::GetLogFilePath()

@ -34,6 +34,7 @@
#include <ctime>
#include <string>
#include <cstring>
/**
* @addtogroup logging
@ -199,6 +200,13 @@ namespace log_internal
*/
extern DVM_COMMON_API void LogInternal(uint32_t level, const std::string& log);
/**
* @brief Writes a new entry to the activity log.
* @param level Log level for entry.
* @param log Fully formatted log message.
*/
extern DVM_COMMON_API void ActivityLogInternal(const std::string& log);
/**
* @brief Internal helper to get the log file path.
* @returns std::string Configured log file path.
@ -367,7 +375,7 @@ namespace log_stacktrace
p.snippet = false;
p.color_mode = backward::ColorMode::never;
log_internal::LogInternal(2U, "UNRECOVERABLE FATAL ERROR!");
log_internal::LogInternal(5U, "UNRECOVERABLE FATAL ERROR!");
if (s_foreground > 0) {
p.print(st, stderr);
}
@ -951,5 +959,93 @@ void Log(uint32_t level, log_internal::SourceLocation sourceLoc, const std::stri
LogInternal(level, std::string(prefix + msg));
}
/**
* @brief Writes a new entry to the activity log.
* @param fmt String format.
*
* This is a variable argument function. This shouldn't be called directly, utilize the LogXXXX macros above, instead.
*/
template<typename ... Args>
void ActivityLog(const std::string& fmt, Args... args)
{
using namespace log_internal;
int size_s = std::snprintf(nullptr, 0, fmt.c_str(), args...) + 1; // Extra space for '\0'
if (size_s <= 0) {
throw std::runtime_error("Error during formatting.");
}
int prefixLen = 0;
char prefixBuf[256];
time_t now;
::time(&now);
struct tm* tm = ::localtime(&now);
struct timeval nowMillis;
::gettimeofday(&nowMillis, NULL);
prefixLen = ::sprintf(prefixBuf, "A: %04d-%02d-%02d %02d:%02d:%02d.%03lu ",
tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec, nowMillis.tv_usec / 1000U);
auto size = static_cast<size_t>(size_s);
auto buf = std::make_unique<char[]>(size);
std::snprintf(buf.get(), size, fmt.c_str(), args ...);
std::string prefix = std::string(prefixBuf, prefixBuf + prefixLen);
std::string msg = std::string(buf.get(), buf.get() + size - 1);
ActivityLogInternal(std::string(prefix + msg));
}
/**
* @brief Writes a new entry to the activity log.
* @param mode Activity mode.
* @param sourceRf Flag indicating whether or not the activity entry came from RF.
* @param fmt String format.
*
* This is a variable argument function. This shouldn't be called directly, utilize the LogXXXX macros above, instead.
*/
template<typename ... Args>
void ActivityLogEx(const char* mode, const bool sourceRf, const std::string& fmt, Args... args)
{
using namespace log_internal;
int size_s = std::snprintf(nullptr, 0, fmt.c_str(), args...) + 1; // Extra space for '\0'
if (size_s <= 0) {
throw std::runtime_error("Error during formatting.");
}
int prefixLen = 0;
char prefixBuf[256];
time_t now;
::time(&now);
struct tm* tm = ::localtime(&now);
struct timeval nowMillis;
::gettimeofday(&nowMillis, NULL);
if (strcmp(mode, "") == 0) {
prefixLen = ::sprintf(prefixBuf, "A: %04d-%02d-%02d %02d:%02d:%02d.%03lu ",
tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec, nowMillis.tv_usec / 1000U);
}
else {
prefixLen = ::sprintf(prefixBuf, "A: %04d-%02d-%02d %02d:%02d:%02d.%03lu %s %s ",
tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec, nowMillis.tv_usec / 1000U, mode, (sourceRf) ? "RF" : "Net");
}
auto size = static_cast<size_t>(size_s);
auto buf = std::make_unique<char[]>(size);
std::snprintf(buf.get(), size, fmt.c_str(), args ...);
std::string prefix = std::string(prefixBuf, prefixBuf + prefixLen);
std::string msg = std::string(buf.get(), buf.get() + size - 1);
ActivityLogInternal(std::string(prefix + msg));
}
/** @} */
#endif // __LOG_H__

@ -0,0 +1,225 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Digital Voice Modem - Common Library
* GPLv2 Open Source. Use is subject to license terms.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright (C) 2026 Bryan Biedenkapp, N2PLL
*
*/
/**
* @file LogAsync.h
* @ingroup logging
*/
#if !defined(__LOG_ASYNC_H__)
#define __LOG_ASYNC_H__
#include "common/Defines.h"
#if defined(_WIN32)
#include "common/Clock.h"
#else
#include <sys/time.h>
#endif // defined(_WIN32)
#include "common/Thread.h"
#include <ctime>
#include <string>
#include <condition_variable>
#include <cstring>
#include <mutex>
#include <array>
/**
* @addtogroup logging
* @{
*/
namespace log_internal
{
/**
* @brief Function pointer type for log sinks.
* @param[in] message The log message.
*/
typedef void (*LogSink)(const char*);
// ---------------------------------------------------------------------------
// Constants
// ---------------------------------------------------------------------------
#define LOG_ASYNC_MAX_QUEUE 64U
#define LOG_ASYNC_LENGTH 8192U
// ---------------------------------------------------------------------------
// Structure Declaration
// ---------------------------------------------------------------------------
/**
* @brief Structure representing an asynchronous log entry.
* @ingroup logger
*/
struct LogAsyncEntry {
public:
std::array<char, LOG_ASYNC_LENGTH> msg{}; //!< The log message text.
log_internal::LogSink sink = nullptr; //!< The log sink function.
};
// ---------------------------------------------------------------------------
// Class Declaration
// ---------------------------------------------------------------------------
/**
* @brief Class for managing asynchronous logging.
* @ingroup logger
*/
class DVM_COMMON_API LogAsync {
public:
/**
* @brief Finalizes the LogAsync class.
*/
~LogAsync()
{
stop();
}
/**
* @brief Starts the asynchronous logging.
* @return True if the logging was successfully started, false otherwise.
*/
bool start()
{
std::lock_guard<std::mutex> lifetime(lifecycle);
std::lock_guard<std::mutex> lock(mutex);
if (started)
return true;
stopping = false;
head = 0U;
entryCount = 0U;
if (!Thread::runAsThread(this, threadLogger, &worker))
return false;
accepting = true;
started = true;
return true;
}
/**
* @brief Stops the asynchronous logging and finalizes the log worker thread.
*/
void stop()
{
std::lock_guard<std::mutex> lifetime(lifecycle);
{
std::lock_guard<std::mutex> lock(mutex);
if (!started)
return;
accepting = false;
stopping = true;
}
changed.notify_all();
#if defined(_WIN32)
::WaitForSingleObject(worker.thread, INFINITE);
::CloseHandle(worker.thread);
#else
::pthread_join(worker.thread, nullptr);
#endif // defined(_WIN32)
started = false;
}
/**
* @brief Logs a message asynchronously.
* @param msg The log message text.
* @param sink The log sink function to use for this message.
*/
void log(const std::string& msg, log_internal::LogSink sink)
{
if (msg.size() >= LOG_ASYNC_LENGTH)
return;
std::unique_lock<std::mutex> lock(mutex);
if (!accepting || sink == nullptr)
return;
if (entryCount == LOG_ASYNC_MAX_QUEUE)
return;
auto& entry = entries[(head + entryCount) % LOG_ASYNC_MAX_QUEUE];
::memcpy(entry.msg.data(), msg.data(), msg.size());
entry.msg[msg.size()] = '\0';
entry.sink = sink;
++entryCount;
lock.unlock();
changed.notify_one();
}
private:
std::array<LogAsyncEntry, LOG_ASYNC_MAX_QUEUE> entries;
size_t head = 0;
size_t entryCount = 0;
std::mutex mutex;
std::condition_variable changed;
bool accepting = false;
bool stopping = false;
bool started = false;
thread_t worker {};
std::mutex lifecycle;
/**
* @brief The main function for the log worker thread.
* @param arg Pointer to the LogAsync instance.
* @return Always returns nullptr.
*/
static void* threadLogger(void* arg)
{
thread_t* th = (thread_t*)arg;
if (th != nullptr) {
LogAsync* logger = static_cast<LogAsync*>(th->obj);
if (logger == nullptr)
return nullptr;
while (true) {
LogAsyncEntry entry;
// scope is intentional
{
std::unique_lock<std::mutex> lock(logger->mutex);
logger->changed.wait(lock, [logger] { return logger->entryCount != 0U || logger->stopping; });
if (logger->entryCount == 0U && logger->stopping) {
lock.unlock();
break;
}
entry = logger->entries[logger->head];
logger->head = (logger->head + 1U) % LOG_ASYNC_MAX_QUEUE;
--logger->entryCount;
}
entry.sink(entry.msg.data());
if (entry.sink != nullptr) {
std::lock_guard<std::mutex> lock(logger->mutex);
logger->changed.notify_all();
}
}
}
return nullptr;
}
};
} // namespace log_internal
/** @} */
#endif // __LOG_ASYNC_H__

@ -1,120 +0,0 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Digital Voice Modem - Converged FNE Software
* GPLv2 Open Source. Use is subject to license terms.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright (C) 2024-2025 Bryan Biedenkapp, N2PLL
*
*/
#include "ActivityLog.h"
#include "common/Log.h" // for CurrentLogFileLevel() and LogGetNetwork()
#if defined(CATCH2_TEST_COMPILATION)
#include <catch2/catch_test_macros.hpp>
#endif
#include <cstdio>
#include <cstdarg>
#include <ctime>
#include <cassert>
// ---------------------------------------------------------------------------
// Constants
// ---------------------------------------------------------------------------
#define EOL "\r\n"
const uint32_t ACT_LOG_BUFFER_LEN = 501U;
// ---------------------------------------------------------------------------
// Global Variables
// ---------------------------------------------------------------------------
static std::string g_actFilePath;
static std::string g_aclFileRoot;
static FILE* g_actFpLog = nullptr;
static struct tm g_actTm;
// ---------------------------------------------------------------------------
// Global Functions
// ---------------------------------------------------------------------------
/* Helper to open the activity log file, file handle. */
static bool ActivityLogOpen()
{
if (CurrentLogFileLevel() == 0U)
return true;
time_t now;
::time(&now);
struct tm* tm = ::localtime(&now);
if (tm->tm_mday == g_actTm.tm_mday && tm->tm_mon == g_actTm.tm_mon && tm->tm_year == g_actTm.tm_year) {
if (g_actFpLog != nullptr)
return true;
}
else {
if (g_actFpLog != nullptr)
::fclose(g_actFpLog);
}
char filename[200U];
::sprintf(filename, "%s/%s-%04d-%02d-%02d.activity.log", g_actFilePath.c_str(), g_aclFileRoot.c_str(), tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday);
g_actFpLog = ::fopen(filename, "a+t");
g_actTm = *tm;
return g_actFpLog != nullptr;
}
/* Initializes the activity log. */
bool ActivityLogInitialise(const std::string& filePath, const std::string& fileRoot)
{
#if defined(CATCH2_TEST_COMPILATION)
return true;
#endif
g_actFilePath = filePath;
g_aclFileRoot = fileRoot;
return ::ActivityLogOpen();
}
/* Finalizes the activity log. */
void ActivityLogFinalise()
{
#if defined(CATCH2_TEST_COMPILATION)
return;
#endif
if (g_actFpLog != nullptr)
::fclose(g_actFpLog);
}
/* Writes a new entry to the activity log. */
void log_internal::ActivityLogInternal(const std::string& log)
{
#if defined(CATCH2_TEST_COMPILATION)
return;
#endif
bool ret = ::ActivityLogOpen();
if (!ret)
return;
if (CurrentLogFileLevel() == 0U)
return;
::fprintf(g_actFpLog, "%s\n", log.c_str());
::fflush(g_actFpLog);
if (2U >= g_logDisplayLevel && g_logDisplayLevel != 0U) {
::fprintf(stdout, "%s" EOL, log.c_str());
::fflush(stdout);
}
}

@ -1,74 +0,0 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Digital Voice Modem - Converged FNE Software
* GPLv2 Open Source. Use is subject to license terms.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright (C) 2024-2025 Bryan Biedenkapp, N2PLL
*
*/
/**
* @file ActivityLog.h
* @ingroup fne
* @file ActivityLog.cpp
* @ingroup fne
*/
#if !defined(__ACTIVITY_LOG_H__)
#define __ACTIVITY_LOG_H__
#include "fne/Defines.h"
#include <string>
// ---------------------------------------------------------------------------
// Global Functions
// ---------------------------------------------------------------------------
namespace log_internal
{
/**
* @brief Writes a new entry to the diagnostics log.
* @param level Log level for entry.
* @param log Fully formatted log message.
*/
extern HOST_SW_API void ActivityLogInternal(const std::string& log);
} // namespace log_internal
/**
* @brief Initializes the activity log.
* @param filePath File path for the log file.
* @param fileRoot Root name for log file.
*/
extern HOST_SW_API bool ActivityLogInitialise(const std::string& filePath, const std::string& fileRoot);
/**
* @brief Finalizes the activity log.
*/
extern HOST_SW_API void ActivityLogFinalise();
/**
* @brief Writes a new entry to the diagnostics log.
* @param fmt String format.
*
* This is a variable argument function. This shouldn't be called directly, utilize the LogXXXX macros above, instead.
*/
template<typename ... Args>
HOST_SW_API void ActivityLog(const std::string& fmt, Args... args)
{
using namespace log_internal;
int size_s = std::snprintf(nullptr, 0, fmt.c_str(), args...) + 1; // Extra space for '\0'
if (size_s <= 0) {
throw std::runtime_error("Error during formatting.");
}
auto size = static_cast<size_t>(size_s);
auto buf = std::make_unique<char[]>(size);
std::snprintf(buf.get(), size, fmt.c_str(), args ...);
std::string msg = std::string(buf.get(), buf.get() + size - 1);
ActivityLogInternal(std::string(msg));
}
#endif // __ACTIVITY_LOG_H__

@ -9,7 +9,6 @@
*/
#include "Defines.h"
#include "common/Log.h"
#include "ActivityLog.h"
#include "FNEMain.h"
#include "HostFNE.h"
@ -249,7 +248,6 @@ int main(int argc, char** argv)
} while (g_signal == SIGHUP);
::LogFinalise();
::ActivityLogFinalise();
#if defined(_WIN32)
::WSACleanup();

@ -17,7 +17,6 @@
#include "network/callhandler/TagP25P2Data.h"
#include "network/callhandler/TagNXDNData.h"
#include "network/callhandler/TagAnalogData.h"
#include "ActivityLog.h"
#include "HostFNE.h"
#include "FNEMain.h"
@ -124,11 +123,6 @@ int HostFNE::run()
::fatal("unable to open the log file\n");
}
ret = ::ActivityLogInitialise(logConf["activityFilePath"].as<std::string>(), logConf["fileRoot"].as<std::string>());
if (!ret) {
::fatal("unable to open the activity log file\n");
}
#if !defined(_WIN32)
// handle POSIX process forking
if (m_daemon) {
@ -387,6 +381,7 @@ bool HostFNE::readParams()
m_allowActivityTransfer = systemConf["allowActivityTransfer"].as<bool>(true);
m_allowDiagnosticTransfer = systemConf["allowDiagnosticTransfer"].as<bool>(true);
m_logActivityToLog = systemConf["logActivityToLog"].as<bool>(false);
if (!m_allowActivityTransfer) {
LogWarning(LOG_HOST, "Peer activity logging is disabled, this severely limits functionality and can prevent proper operations by prohibiting activity logging to this FNE!");
@ -413,6 +408,7 @@ bool HostFNE::readParams()
else
LogInfo(" !! Allow Activity Log Transfer: no");
LogInfo(" Allow Diagnostic Log Transfer: %s", m_allowDiagnosticTransfer ? "yes" : "no");
LogInfo(" Log Activity to Log: %s", m_logActivityToLog ? "yes" : "no");
// attempt to load and populate routing rules
yaml::Node masterConf = m_conf["master"];
@ -678,7 +674,7 @@ bool HostFNE::createMasterNetwork()
m_network = new TrafficNetwork(this, address, port, id, password, identity, debug, kmfDebug, verbose, reportPeerPing,
m_dmrEnabled, m_p25Enabled, m_p25P2Enabled, m_nxdnEnabled, m_analogEnabled,
parrotDelay, parrotGrantDemand, m_allowActivityTransfer, m_allowDiagnosticTransfer,
m_pingTime, m_updateLookupTime, workerCnt);
m_logActivityToLog, m_pingTime, m_updateLookupTime, workerCnt);
yaml::Node vtunConf = m_conf["vtun"];
m_network->setPacketDataOptions(vtunConf);
m_network->setOptions(masterConf, true);

@ -135,6 +135,7 @@ private:
bool m_allowActivityTransfer;
bool m_allowDiagnosticTransfer;
bool m_logActivityToLog;
friend class fne_restapi::RESTAPI;
fne_restapi::RESTAPI* m_RESTAPI;

@ -13,7 +13,6 @@
#include "common/Utils.h"
#include "network/MetadataNetwork.h"
#include "common/json/json.h"
#include "fne/ActivityLog.h"
#include "HostFNE.h"
using namespace network;

@ -20,7 +20,6 @@
#include "network/callhandler/TagNXDNData.h"
#include "network/callhandler/TagAnalogData.h"
#include "network/P25OTARService.h"
#include "fne/ActivityLog.h"
#include "HostFNE.h"
#include "FNEMain.h"
@ -64,7 +63,7 @@ TrafficNetwork::TrafficNetwork(HostFNE* host, const std::string& address, uint16
std::string identity, bool debug, bool kmfDebug, bool verbose, bool reportPeerPing,
bool dmr, bool p25, bool p25P2, bool nxdn, bool analog,
uint32_t parrotDelay, bool parrotGrantDemand, bool allowActivityTransfer, bool allowDiagnosticTransfer,
uint32_t pingTime, uint32_t updateLookupTime, uint16_t workerCnt) :
bool logActivityToLog, uint32_t pingTime, uint32_t updateLookupTime, uint16_t workerCnt) :
BaseNetwork(peerId, true, debug, true, true, allowActivityTransfer, allowDiagnosticTransfer),
m_tagDMR(nullptr),
m_tagP25(nullptr),
@ -189,6 +188,7 @@ TrafficNetwork::TrafficNetwork(HostFNE* host, const std::string& address, uint16
m_verbosePacketData(false),
m_vtunQueueMaxFrames(128U),
m_vtunQueueMaxBytes(262144U),
m_logActivityToLog(logActivityToLog),
m_logDenials(false),
m_logUpstreamCallStartEnd(true),
m_reportPeerPing(reportPeerPing),

@ -196,15 +196,16 @@ namespace network
* @param parrotGrantDemand Flag indicating whether a parrot TG will generate a grant demand.
* @param allowActivityTransfer Flag indicating that the system activity logs will be sent to the network.
* @param allowDiagnosticTransfer Flag indicating that the system diagnostic logs will be sent to the network.
* @param pingTime
* @param updateLookupTime
* @param logActivityToLog Flag indicating whether activity logs should be written to the log file.
* @param pingTime Peer ping time in seconds.
* @param updateLookupTime ACL rule update time in minutes.
* @param workerCnt Number of worker threads.
*/
TrafficNetwork(HostFNE* host, const std::string& address, uint16_t port, uint32_t peerId, const std::string& password,
std::string identity, bool debug, bool kmfDebug, bool verbose, bool reportPeerPing,
bool dmr, bool p25, bool p25P2, bool nxdn, bool analog,
uint32_t parrotDelay, bool parrotGrantDemand, bool allowActivityTransfer, bool allowDiagnosticTransfer,
uint32_t pingTime, uint32_t updateLookupTime, uint16_t workerCnt);
bool logActivityToLog, uint32_t pingTime, uint32_t updateLookupTime, uint16_t workerCnt);
/**
* @brief Finalizes a instance of the TrafficNetwork class.
*/
@ -541,6 +542,7 @@ namespace network
uint32_t m_vtunQueueMaxFrames;
uint32_t m_vtunQueueMaxBytes;
bool m_logActivityToLog;
bool m_logDenials;
bool m_logUpstreamCallStartEnd;
bool m_reportPeerPing;

@ -10,7 +10,6 @@
#include "fne/Defines.h"
#include "common/Log.h"
#include "network/MetadataNetwork.h"
#include "fne/ActivityLog.h"
#include "HostFNE.h"
using namespace network;

@ -13,7 +13,6 @@
#include "network/callhandler/TagDMRData.h"
#include "network/callhandler/TagP25Data.h"
#include "network/callhandler/TagNXDNData.h"
#include "fne/ActivityLog.h"
#include "HostFNE.h"
using namespace network;

@ -10,7 +10,6 @@
#include "fne/Defines.h"
#include "common/Log.h"
#include "network/TrafficNetwork.h"
#include "fne/ActivityLog.h"
#include "HostFNE.h"
using namespace network;

@ -12,7 +12,6 @@
#include "common/AESCrypto.h"
#include "common/Log.h"
#include "network/TrafficNetwork.h"
#include "fne/ActivityLog.h"
#include "HostFNE.h"
using namespace network;

@ -12,7 +12,6 @@
#include "common/AESCrypto.h"
#include "common/Log.h"
#include "network/TrafficNetwork.h"
#include "fne/ActivityLog.h"
#include "HostFNE.h"
using namespace network;

@ -11,7 +11,6 @@
#include "common/edac/SHA256.h"
#include "common/Log.h"
#include "network/MetadataNetwork.h"
#include "fne/ActivityLog.h"
#include "HostFNE.h"
#include <fstream>

@ -11,7 +11,6 @@
#include "common/edac/SHA256.h"
#include "common/Log.h"
#include "network/MetadataNetwork.h"
#include "fne/ActivityLog.h"
#include "HostFNE.h"
#include <cstdio>

@ -10,7 +10,6 @@
#include "fne/Defines.h"
#include "common/Log.h"
#include "network/MetadataNetwork.h"
#include "fne/ActivityLog.h"
#include "HostFNE.h"
using namespace network;

@ -10,7 +10,6 @@
#include "fne/Defines.h"
#include "common/Log.h"
#include "network/TrafficNetwork.h"
#include "fne/ActivityLog.h"
#include "HostFNE.h"
using namespace network;

@ -16,7 +16,6 @@
#include "network/callhandler/TagNXDNData.h"
#include "common/nxdn/NXDNDefines.h"
#include "network/callhandler/TagAnalogData.h"
#include "fne/ActivityLog.h"
#include "HostFNE.h"
using namespace network;

@ -10,7 +10,6 @@
#include "fne/Defines.h"
#include "common/Log.h"
#include "network/MetadataNetwork.h"
#include "fne/ActivityLog.h"
#include "HostFNE.h"
using namespace network;

@ -11,7 +11,6 @@
#include "common/edac/SHA256.h"
#include "common/Log.h"
#include "network/TrafficNetwork.h"
#include "fne/ActivityLog.h"
#include "HostFNE.h"
using namespace network;

@ -10,7 +10,6 @@
#include "fne/Defines.h"
#include "common/Log.h"
#include "network/TrafficNetwork.h"
#include "fne/ActivityLog.h"
#include "HostFNE.h"
using namespace network;

@ -10,7 +10,6 @@
#include "fne/Defines.h"
#include "common/Log.h"
#include "network/TrafficNetwork.h"
#include "fne/ActivityLog.h"
#include "HostFNE.h"
using namespace network;

@ -10,7 +10,6 @@
#include "fne/Defines.h"
#include "common/Log.h"
#include "network/TrafficNetwork.h"
#include "fne/ActivityLog.h"
#include "HostFNE.h"
using namespace network;

@ -10,7 +10,6 @@
#include "fne/Defines.h"
#include "common/Log.h"
#include "network/MetadataNetwork.h"
#include "fne/ActivityLog.h"
#include "HostFNE.h"
using namespace network;

@ -11,7 +11,6 @@
#include "common/Log.h"
#include "common/json/json.h"
#include "network/MetadataNetwork.h"
#include "fne/ActivityLog.h"
#include "HostFNE.h"
using namespace network;
@ -63,7 +62,9 @@ void MetadataNetwork::PacketHandler::transfer(TrafficNetwork* network, MetadataN
const size_t payloadLength = (size_t)(req->length - TRANSFER_PCKT_HDR_LEN);
std::string payload((const char *)(req->buffer + TRANSFER_PCKT_HDR_LEN), payloadLength);
::ActivityLog("%.9u (%8s) %s", pktPeerId, connection->identWithQualifier().c_str(), payload.c_str());
if (network->m_logActivityToLog) {
::Log(9999U, {nullptr, nullptr, 0U, nullptr}, "%.9u (%8s) %s", pktPeerId, connection->identWithQualifier().c_str(), payload.c_str());
}
// report activity log to metrics
TrafficNetwork::MetricsLogging::logActivity(network, pktPeerId, connection->identity(), payload);

@ -1,127 +0,0 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Digital Voice Modem - Modem Host Software
* GPLv2 Open Source. Use is subject to license terms.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright (C) 2024-2025 Bryan Biedenkapp, N2PLL
*
*/
#include "ActivityLog.h"
#include "common/network/BaseNetwork.h"
#include "common/Log.h" // for CurrentLogFileLevel() and LogGetNetwork()
#if defined(CATCH2_TEST_COMPILATION)
#include <catch2/catch_test_macros.hpp>
#endif
#include <cstdio>
#include <cstdlib>
#include <cstdarg>
#include <ctime>
#include <cassert>
// ---------------------------------------------------------------------------
// Constants
// ---------------------------------------------------------------------------
#define EOL "\r\n"
const uint32_t ACT_LOG_BUFFER_LEN = 501U;
// ---------------------------------------------------------------------------
// Global Variables
// ---------------------------------------------------------------------------
static std::string g_actFilePath;
static std::string g_actFileRoot;
static FILE* g_actFpLog = nullptr;
static struct tm g_actTm;
// ---------------------------------------------------------------------------
// Global Functions
// ---------------------------------------------------------------------------
/* Helper to open the activity log file, file handle. */
static bool ActivityLogOpen()
{
if (CurrentLogFileLevel() == 0U)
return true;
time_t now;
::time(&now);
struct tm* tm = ::localtime(&now);
if (tm->tm_mday == g_actTm.tm_mday && tm->tm_mon == g_actTm.tm_mon && tm->tm_year == g_actTm.tm_year) {
if (g_actFpLog != nullptr)
return true;
}
else {
if (g_actFpLog != nullptr)
::fclose(g_actFpLog);
}
char filename[200U];
::sprintf(filename, "%s/%s-%04d-%02d-%02d.activity.log", g_actFilePath.c_str(), g_actFileRoot.c_str(), tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday);
g_actFpLog = ::fopen(filename, "a+t");
g_actTm = *tm;
return g_actFpLog != nullptr;
}
/* Initializes the activity log. */
bool ActivityLogInitialise(const std::string& filePath, const std::string& fileRoot)
{
#if defined(CATCH2_TEST_COMPILATION)
return true;
#endif
g_actFilePath = filePath;
g_actFileRoot = fileRoot;
return ::ActivityLogOpen();
}
/* Finalizes the activity log. */
void ActivityLogFinalise()
{
#if defined(CATCH2_TEST_COMPILATION)
return;
#endif
if (g_actFpLog != nullptr)
::fclose(g_actFpLog);
}
/* Writes a new entry to the activity log. */
void log_internal::ActivityLogInternal(const std::string& log)
{
#if defined(CATCH2_TEST_COMPILATION)
return;
#endif
bool ret = ::ActivityLogOpen();
if (!ret)
return;
if (CurrentLogFileLevel() == 0U)
return;
if (LogGetNetwork() != nullptr) {
network::BaseNetwork* network = (network::BaseNetwork*)LogGetNetwork();
network->writeActLog(log.c_str());
}
::fprintf(g_actFpLog, "%s\n", log.c_str());
::fflush(g_actFpLog);
if (2U >= g_logDisplayLevel && g_logDisplayLevel != 0U) {
::fprintf(stdout, "%s" EOL, log.c_str());
::fflush(stdout);
}
}

@ -1,103 +0,0 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Digital Voice Modem - Modem Host Software
* GPLv2 Open Source. Use is subject to license terms.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright (C) 2024-2025 Bryan Biedenkapp, N2PLL
*
*/
/**
* @file ActivityLog.h
* @ingroup host
* @file ActivityLog.cpp
* @ingroup host
*/
#if !defined(__ACTIVITY_LOG_H__)
#define __ACTIVITY_LOG_H__
#include "Defines.h"
#if defined(_WIN32)
#include "common/Clock.h"
#else
#include <sys/time.h>
#endif // defined(_WIN32)
#include <string>
#include <cstring>
// ---------------------------------------------------------------------------
// Global Functions
// ---------------------------------------------------------------------------
namespace log_internal
{
/**
* @brief Writes a new entry to the diagnostics log.
* @param level Log level for entry.
* @param log Fully formatted log message.
*/
extern HOST_SW_API void ActivityLogInternal(const std::string& log);
} // namespace log_internal
/**
* @brief Initializes the activity log.
* @param filePath File path for the log file.
* @param fileRoot Root name for log file.
*/
extern HOST_SW_API bool ActivityLogInitialise(const std::string& filePath, const std::string& fileRoot);
/**
* @brief Finalizes the activity log.
*/
extern HOST_SW_API void ActivityLogFinalise();
/**
* @brief Writes a new entry to the diagnostics log.
* @param mode Activity mode.
* @param sourceRf Flag indicating whether or not the activity entry came from RF.
* @param fmt String format.
*
* This is a variable argument function. This shouldn't be called directly, utilize the LogXXXX macros above, instead.
*/
template<typename ... Args>
HOST_SW_API void ActivityLog(const char* mode, const bool sourceRf, const std::string& fmt, Args... args)
{
using namespace log_internal;
int size_s = std::snprintf(nullptr, 0, fmt.c_str(), args...) + 1; // Extra space for '\0'
if (size_s <= 0) {
throw std::runtime_error("Error during formatting.");
}
int prefixLen = 0;
char prefixBuf[256];
time_t now;
::time(&now);
struct tm* tm = ::localtime(&now);
struct timeval nowMillis;
::gettimeofday(&nowMillis, NULL);
if (strcmp(mode, "") == 0) {
prefixLen = ::sprintf(prefixBuf, "A: %04d-%02d-%02d %02d:%02d:%02d.%03lu ",
tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec, nowMillis.tv_usec / 1000U);
}
else {
prefixLen = ::sprintf(prefixBuf, "A: %04d-%02d-%02d %02d:%02d:%02d.%03lu %s %s ",
tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec, nowMillis.tv_usec / 1000U, mode, (sourceRf) ? "RF" : "Net");
}
auto size = static_cast<size_t>(size_s);
auto buf = std::make_unique<char[]>(size);
std::snprintf(buf.get(), size, fmt.c_str(), args ...);
std::string prefix = std::string(prefixBuf, prefixBuf + prefixLen);
std::string msg = std::string(buf.get(), buf.get() + size - 1);
ActivityLogInternal(std::string(prefix + msg));
}
#endif // __ACTIVITY_LOG_H__

@ -18,7 +18,6 @@
#include "common/Utils.h"
#include "modem/port/specialized/V24UDPPort.h"
#include "host/Host.h"
#include "ActivityLog.h"
#include "HostMain.h"
using namespace modem;
@ -208,11 +207,6 @@ int Host::run()
::fatal("unable to open the log file\n");
}
ret = ::ActivityLogInitialise(logConf["activityFilePath"].as<std::string>(), logConf["fileRoot"].as<std::string>());
if (!ret) {
::fatal("unable to open the activity log file\n");
}
#if !defined(_WIN32)
// handle POSIX process forking
if (m_daemon) {
@ -221,12 +215,10 @@ int Host::run()
if (pid == -1) {
::fprintf(stderr, "%s: Couldn't fork() , exiting\n", g_progExe.c_str());
::LogFinalise();
::ActivityLogFinalise();
return EXIT_FAILURE;
}
else if (pid != 0) {
::LogFinalise();
::ActivityLogFinalise();
exit(EXIT_SUCCESS);
}
@ -234,7 +226,6 @@ int Host::run()
if (::setsid() == -1) {
::fprintf(stderr, "%s: Couldn't setsid(), exiting\n", g_progExe.c_str());
::LogFinalise();
::ActivityLogFinalise();
return EXIT_FAILURE;
}
@ -242,7 +233,6 @@ int Host::run()
if (::chdir("/") == -1) {
::fprintf(stderr, "%s: Couldn't cd /, exiting\n", g_progExe.c_str());
::LogFinalise();
::ActivityLogFinalise();
return EXIT_FAILURE;
}

@ -14,7 +14,6 @@
#include "Host.h"
#include "calibrate/HostCal.h"
#include "setup/HostSetup.h"
#include "ActivityLog.h"
using namespace network;
using namespace modem;
@ -341,7 +340,6 @@ int main(int argc, char** argv)
} while (g_signal == SIGHUP);
::LogFinalise();
::ActivityLogFinalise();
return ret;
}

@ -19,7 +19,6 @@
#include "common/Utils.h"
#include "dmr/Slot.h"
#include "common/dmr/acl/AccessControl.h"
#include "ActivityLog.h"
#include "HostMain.h"
#include "Host.h"
@ -819,12 +818,12 @@ void Slot::clock()
if (m_netState == RS_NET_AUDIO) {
// We've received the voice header haven't we?
m_netFrames += 1U;
::ActivityLog("DMR", false, "Slot %u network watchdog has expired, %.1f seconds, %u%% packet loss, BER: %.1f%%",
::ActivityLogEx(LOG_DMR, false, "Slot %u network watchdog has expired, %.1f seconds, %u%% packet loss, BER: %.1f%%",
m_slotNo, float(m_netFrames) / 16.667F, (m_netLost * 100U) / m_netFrames, float(m_netErrs * 100U) / float(m_netBits));
writeEndNet(true);
}
else {
::ActivityLog("DMR", false, "Slot %u network watchdog has expired", m_slotNo);
::ActivityLogEx(LOG_DMR, false, "Slot %u network watchdog has expired", m_slotNo);
writeEndNet();
}
}
@ -1376,11 +1375,11 @@ void Slot::processFrameLoss(RPT_RF_LOSS_TYPE type)
if (m_rfState == RS_RF_AUDIO) {
if (m_rssi != 0U) {
::ActivityLog("DMR", true, "Slot %u RF voice transmission lost, %s, %.1f seconds, BER: %.1f%%, RSSI: -%u/-%u/-%u dBm, loss count: %u",
::ActivityLogEx(LOG_DMR, true, "Slot %u RF voice transmission lost, %s, %.1f seconds, BER: %.1f%%, RSSI: -%u/-%u/-%u dBm, loss count: %u",
m_slotNo, typeStr.c_str(), float(m_rfFrames) / 16.667F, float(m_rfErrs * 100U) / float(m_rfBits), m_minRSSI, m_maxRSSI, m_aveRSSI / m_rssiCount, m_frameLossCnt);
}
else {
::ActivityLog("DMR", true, "Slot %u RF voice transmission lost, %s, %.1f seconds, BER: %.1f%%, loss count: %u",
::ActivityLogEx(LOG_DMR, true, "Slot %u RF voice transmission lost, %s, %.1f seconds, BER: %.1f%%, loss count: %u",
m_slotNo, typeStr.c_str(), float(m_rfFrames) / 16.667F, float(m_rfErrs * 100U) / float(m_rfBits), m_frameLossCnt);
}
@ -1414,7 +1413,7 @@ void Slot::processFrameLoss(RPT_RF_LOSS_TYPE type)
}
if (m_rfState == RS_RF_DATA) {
::ActivityLog("DMR", true, "Slot %u, RF data transmission lost", m_slotNo);
::ActivityLogEx(LOG_DMR, true, "Slot %u, RF data transmission lost", m_slotNo);
writeEndRF();
}

@ -19,7 +19,6 @@
#include "dmr/lc/csbk/CSBK_DVM_GIT_HASH.h"
#include "dmr/packet/ControlSignaling.h"
#include "dmr/Slot.h"
#include "ActivityLog.h"
#include "Host.h"
using namespace dmr;
@ -184,7 +183,7 @@ bool ControlSignaling::process(uint8_t* data, uint32_t len)
m_slot->m_slotNo, csbk->toString().c_str(), srcId, dstId);
}
::ActivityLog("DMR", true, "Slot %u call alert request from %u to %u", m_slot->m_slotNo, srcId, dstId);
::ActivityLogEx(LOG_DMR, true, "Slot %u call alert request from %u to %u", m_slot->m_slotNo, srcId, dstId);
} else {
handled = true;
@ -323,7 +322,7 @@ bool ControlSignaling::process(uint8_t* data, uint32_t len)
{
VERBOSE_LOG_CSBK(csbk->toString(), srcId, dstId);
::ActivityLog("DMR", true, "Slot %u ack response from %u to %u", m_slot->m_slotNo, srcId, dstId);
::ActivityLogEx(LOG_DMR, true, "Slot %u ack response from %u to %u", m_slot->m_slotNo, srcId, dstId);
CSBK_ACK_RSP* ack = static_cast<CSBK_ACK_RSP*>(csbk.get());
if (csbk->getCSBKO() == CSBKO::ACK_RSP_U && ack->getReason() == ReasonCode::MS_ACK_RSN_AUTH_RESP)
@ -345,22 +344,22 @@ bool ControlSignaling::process(uint8_t* data, uint32_t len)
// generate activity log entry
switch (isp->getExtendedFunction()) {
case ExtendedFunctions::CHECK:
::ActivityLog("DMR", true, "Slot %u radio check request from %u to %u", m_slot->m_slotNo, dstId, srcId);
::ActivityLogEx(LOG_DMR, true, "Slot %u radio check request from %u to %u", m_slot->m_slotNo, dstId, srcId);
break;
case ExtendedFunctions::INHIBIT:
::ActivityLog("DMR", true, "Slot %u radio inhibit request from %u to %u", m_slot->m_slotNo, dstId, srcId);
::ActivityLogEx(LOG_DMR, true, "Slot %u radio inhibit request from %u to %u", m_slot->m_slotNo, dstId, srcId);
break;
case ExtendedFunctions::UNINHIBIT:
::ActivityLog("DMR", true, "Slot %u radio uninhibit request from %u to %u", m_slot->m_slotNo, dstId, srcId);
::ActivityLogEx(LOG_DMR, true, "Slot %u radio uninhibit request from %u to %u", m_slot->m_slotNo, dstId, srcId);
break;
case ExtendedFunctions::CHECK_ACK:
::ActivityLog("DMR", true, "Slot %u radio check response from %u to %u", m_slot->m_slotNo, dstId, srcId);
::ActivityLogEx(LOG_DMR, true, "Slot %u radio check response from %u to %u", m_slot->m_slotNo, dstId, srcId);
break;
case ExtendedFunctions::INHIBIT_ACK:
::ActivityLog("DMR", true, "Slot %u radio inhibit response from %u to %u", m_slot->m_slotNo, dstId, srcId);
::ActivityLogEx(LOG_DMR, true, "Slot %u radio inhibit response from %u to %u", m_slot->m_slotNo, dstId, srcId);
break;
case ExtendedFunctions::UNINHIBIT_ACK:
::ActivityLog("DMR", true, "Slot %u radio uninhibit response from %u to %u", m_slot->m_slotNo, dstId, srcId);
::ActivityLogEx(LOG_DMR, true, "Slot %u radio uninhibit response from %u to %u", m_slot->m_slotNo, dstId, srcId);
break;
default:
LogWarning(LOG_RF, "DMR Slot %u, CSBK, %s, unhandled op, op = $%02X", m_slot->m_slotNo, csbk->toString().c_str(), isp->getExtendedFunction());
@ -561,7 +560,7 @@ void ControlSignaling::processNetwork(const data::NetData& dmrData)
m_slot->m_slotNo, csbk->toString().c_str(), srcId, dstId);
}
::ActivityLog("DMR", false, "Slot %u call alert request from %u to %u", m_slot->m_slotNo, srcId, dstId);
::ActivityLogEx(LOG_DMR, false, "Slot %u call alert request from %u to %u", m_slot->m_slotNo, srcId, dstId);
} else {
CSBK_RAND* isp = static_cast<CSBK_RAND*>(csbk.get());
if (m_verbose) {
@ -613,7 +612,7 @@ void ControlSignaling::processNetwork(const data::NetData& dmrData)
{
VERBOSE_LOG_CSBK_NET(csbk->toString(), srcId, dstId);
::ActivityLog("DMR", false, "Slot %u ack response from %u to %u", m_slot->m_slotNo, srcId, dstId);
::ActivityLogEx(LOG_DMR, false, "Slot %u ack response from %u to %u", m_slot->m_slotNo, srcId, dstId);
CSBK_ACK_RSP* ack = static_cast<CSBK_ACK_RSP*>(csbk.get());
if (csbk->getCSBKO() == CSBKO::ACK_RSP_U && ack->getReason() == ReasonCode::MS_ACK_RSN_MSG)
@ -631,22 +630,22 @@ void ControlSignaling::processNetwork(const data::NetData& dmrData)
// generate activity log entry
switch (isp->getExtendedFunction()) {
case ExtendedFunctions::CHECK:
::ActivityLog("DMR", false, "Slot %u radio check request from %u to %u", m_slot->m_slotNo, dstId, srcId);
::ActivityLogEx(LOG_DMR, false, "Slot %u radio check request from %u to %u", m_slot->m_slotNo, dstId, srcId);
break;
case ExtendedFunctions::INHIBIT:
::ActivityLog("DMR", false, "Slot %u radio inhibit request from %u to %u", m_slot->m_slotNo, dstId, srcId);
::ActivityLogEx(LOG_DMR, false, "Slot %u radio inhibit request from %u to %u", m_slot->m_slotNo, dstId, srcId);
break;
case ExtendedFunctions::UNINHIBIT:
::ActivityLog("DMR", false, "Slot %u radio uninhibit request from %u to %u", m_slot->m_slotNo, dstId, srcId);
::ActivityLogEx(LOG_DMR, false, "Slot %u radio uninhibit request from %u to %u", m_slot->m_slotNo, dstId, srcId);
break;
case ExtendedFunctions::CHECK_ACK:
::ActivityLog("DMR", false, "Slot %u radio check response from %u to %u", m_slot->m_slotNo, dstId, srcId);
::ActivityLogEx(LOG_DMR, false, "Slot %u radio check response from %u to %u", m_slot->m_slotNo, dstId, srcId);
break;
case ExtendedFunctions::INHIBIT_ACK:
::ActivityLog("DMR", false, "Slot %u radio inhibit response from %u to %u", m_slot->m_slotNo, dstId, srcId);
::ActivityLogEx(LOG_DMR, false, "Slot %u radio inhibit response from %u to %u", m_slot->m_slotNo, dstId, srcId);
break;
case ExtendedFunctions::UNINHIBIT_ACK:
::ActivityLog("DMR", false, "Slot %u radio uninhibit response from %u to %u", m_slot->m_slotNo, dstId, srcId);
::ActivityLogEx(LOG_DMR, false, "Slot %u radio uninhibit response from %u to %u", m_slot->m_slotNo, dstId, srcId);
break;
default:
LogWarning(LOG_NET, "DMR Slot %u, CSBK, %s, unhandled op, op = $%02X", m_slot->m_slotNo, csbk->toString().c_str(), isp->getExtendedFunction());
@ -744,13 +743,13 @@ void ControlSignaling::writeRF_Ext_Func(uint32_t func, uint32_t arg, uint32_t ds
// generate activity log entry
if (func == ExtendedFunctions::CHECK) {
::ActivityLog("DMR", true, "Slot %u radio check request from %u to %u", m_slot->m_slotNo, arg, dstId);
::ActivityLogEx(LOG_DMR, true, "Slot %u radio check request from %u to %u", m_slot->m_slotNo, arg, dstId);
}
else if (func == ExtendedFunctions::INHIBIT) {
::ActivityLog("DMR", true, "Slot %u radio inhibit request from %u to %u", m_slot->m_slotNo, arg, dstId);
::ActivityLogEx(LOG_DMR, true, "Slot %u radio inhibit request from %u to %u", m_slot->m_slotNo, arg, dstId);
}
else if (func == ExtendedFunctions::UNINHIBIT) {
::ActivityLog("DMR", true, "Slot %u radio uninhibit request from %u to %u", m_slot->m_slotNo, arg, dstId);
::ActivityLogEx(LOG_DMR, true, "Slot %u radio uninhibit request from %u to %u", m_slot->m_slotNo, arg, dstId);
}
writeRF_CSBK(csbk.get());
@ -766,7 +765,7 @@ void ControlSignaling::writeRF_Call_Alrt(uint32_t srcId, uint32_t dstId)
csbk->setDstId(dstId);
VERBOSE_LOG_CSBK(csbk->toString(), srcId, dstId);
::ActivityLog("DMR", true, "Slot %u call alert request from %u to %u", m_slot->m_slotNo, srcId, dstId);
::ActivityLogEx(LOG_DMR, true, "Slot %u call alert request from %u to %u", m_slot->m_slotNo, srcId, dstId);
writeRF_CSBK(csbk.get());
}
@ -956,7 +955,7 @@ bool ControlSignaling::writeRF_CSBK_Grant(uint32_t srcId, uint32_t dstId, uint8_
tscc->m_slotNo, srcId, dstId);
if (!net) {
writeRF_CSBK_ACK_RSP(srcId, ReasonCode::TS_DENY_RSN_TGT_GROUP_NOT_VALID, 1U);
::ActivityLog("DMR", true, "Slot %u group grant request rejection from %u to TG %u", tscc->m_slotNo, srcId, dstId);
::ActivityLogEx(LOG_DMR, true, "Slot %u group grant request rejection from %u to TG %u", tscc->m_slotNo, srcId, dstId);
m_slot->m_rfState = RS_RF_REJECTED;
}
return false;
@ -969,7 +968,7 @@ bool ControlSignaling::writeRF_CSBK_Grant(uint32_t srcId, uint32_t dstId, uint8_
LogWarning(LOG_RF, "DMR Slot %u, CSBK, RAND (Random Access, VOICE_CALL (Voice Call) denied, traffic in progress, dstId = %u", tscc->m_slotNo, dstId);
writeRF_CSBK_ACK_RSP(srcId, ReasonCode::TS_DENY_RSN_TGT_BUSY, (grp) ? 1U : 0U);
::ActivityLog("DMR", true, "Slot %u group grant request %u to TG %u denied", tscc->m_slotNo, srcId, dstId);
::ActivityLogEx(LOG_DMR, true, "Slot %u group grant request %u to TG %u denied", tscc->m_slotNo, srcId, dstId);
m_slot->m_rfState = RS_RF_REJECTED;
}
@ -981,7 +980,7 @@ bool ControlSignaling::writeRF_CSBK_Grant(uint32_t srcId, uint32_t dstId, uint8_
LogWarning(LOG_RF, "DMR Slot %u, CSBK, RAND (Random Access, VOICE_CALL (Voice Call) denied, traffic in progress, dstId = %u", tscc->m_slotNo, dstId);
writeRF_CSBK_ACK_RSP(srcId, ReasonCode::TS_DENY_RSN_TGT_BUSY, (grp) ? 1U : 0U);
::ActivityLog("DMR", true, "Slot %u group grant request %u to TG %u denied", tscc->m_slotNo, srcId, dstId);
::ActivityLogEx(LOG_DMR, true, "Slot %u group grant request %u to TG %u denied", tscc->m_slotNo, srcId, dstId);
m_slot->m_rfState = RS_RF_REJECTED;
}
@ -1040,7 +1039,7 @@ bool ControlSignaling::writeRF_CSBK_Grant(uint32_t srcId, uint32_t dstId, uint8_
LogWarning(LOG_RF, "DMR Slot %u, CSBK, RAND (Random Access, GRP_VOICE_CALL (Group Voice Call) denial, TGID enc. strapping rejection, srcId = %u, dstId = %u", tscc->m_slotNo, srcId, dstId);
writeRF_CSBK_ACK_RSP(srcId, ReasonCode::TS_DENY_RSN_TGT_GROUP_NOT_VALID, (grp) ? 1U : 0U);
::ActivityLog("DMR", true, "Slot %u group grant request rejection from %u to TG %u ", tscc->m_slotNo, srcId, dstId);
::ActivityLogEx(LOG_DMR, true, "Slot %u group grant request rejection from %u to TG %u ", tscc->m_slotNo, srcId, dstId);
m_slot->m_rfState = RS_RF_REJECTED;
return false;
}
@ -1060,7 +1059,7 @@ bool ControlSignaling::writeRF_CSBK_Grant(uint32_t srcId, uint32_t dstId, uint8_
LogWarning(LOG_RF, "DMR Slot %u, CSBK, RAND (Random Access, GRP_VOICE_CALL (Group Voice Call) queued, no channels available, dstId = %u", tscc->m_slotNo, dstId);
writeRF_CSBK_ACK_RSP(srcId, ReasonCode::TS_QUEUED_RSN_NO_RESOURCE, (grp) ? 1U : 0U);
::ActivityLog("DMR", true, "Slot %u group grant request %u to TG %u queued", tscc->m_slotNo, srcId, dstId);
::ActivityLogEx(LOG_DMR, true, "Slot %u group grant request %u to TG %u queued", tscc->m_slotNo, srcId, dstId);
m_slot->m_rfState = RS_RF_REJECTED;
}
@ -1071,7 +1070,7 @@ bool ControlSignaling::writeRF_CSBK_Grant(uint32_t srcId, uint32_t dstId, uint8_
LogWarning(LOG_RF, "DMR Slot %u, CSBK, RAND (Random Access, IND_VOICE_CALL (Individual Voice Call) queued, no channels available, dstId = %u", tscc->m_slotNo, dstId);
writeRF_CSBK_ACK_RSP(srcId, ReasonCode::TS_QUEUED_RSN_NO_RESOURCE, (grp) ? 1U : 0U);
::ActivityLog("DMR", true, "Slot %u group grant request %u to TG %u queued", tscc->m_slotNo, srcId, dstId);
::ActivityLogEx(LOG_DMR, true, "Slot %u group grant request %u to TG %u queued", tscc->m_slotNo, srcId, dstId);
m_slot->m_rfState = RS_RF_REJECTED;
}
@ -1099,7 +1098,7 @@ bool ControlSignaling::writeRF_CSBK_Grant(uint32_t srcId, uint32_t dstId, uint8_
LogWarning(LOG_RF, "DMR Slot %u, CSBK, RAND (Random Access, VOICE_CALL (Voice Call) denied, traffic in progress, dstId = %u", tscc->m_slotNo, dstId);
writeRF_CSBK_ACK_RSP(srcId, ReasonCode::TS_DENY_RSN_TGT_BUSY, (grp) ? 1U : 0U);
::ActivityLog("DMR", true, "Slot %u group grant request %u to TG %u denied", tscc->m_slotNo, srcId, dstId);
::ActivityLogEx(LOG_DMR, true, "Slot %u group grant request %u to TG %u denied", tscc->m_slotNo, srcId, dstId);
m_slot->m_rfState = RS_RF_REJECTED;
}
@ -1127,7 +1126,7 @@ bool ControlSignaling::writeRF_CSBK_Grant(uint32_t srcId, uint32_t dstId, uint8_
if (grp) {
if (!net) {
::ActivityLog("DMR", true, "Slot %u group grant request from %u to TG %u", tscc->m_slotNo, srcId, dstId);
::ActivityLogEx(LOG_DMR, true, "Slot %u group grant request from %u to TG %u", tscc->m_slotNo, srcId, dstId);
}
// callback RPC to permit the granted TG on the specified voice channel
@ -1221,7 +1220,7 @@ bool ControlSignaling::writeRF_CSBK_Grant(uint32_t srcId, uint32_t dstId, uint8_
}
else {
if (!net) {
::ActivityLog("DMR", true, "Slot %u individual grant request from %u to TG %u", tscc->m_slotNo, srcId, dstId);
::ActivityLogEx(LOG_DMR, true, "Slot %u individual grant request from %u to TG %u", tscc->m_slotNo, srcId, dstId);
}
// callback RPC to permit the granted TG on the specified voice channel
@ -1346,7 +1345,7 @@ bool ControlSignaling::writeRF_CSBK_Data_Grant(uint32_t srcId, uint32_t dstId, u
LogWarning(LOG_RF, "DMR Slot %u, CSBK, RAND (Random Access, DATA_CALL (Data Call) denied, traffic in progress, dstId = %u", tscc->m_slotNo, dstId);
writeRF_CSBK_ACK_RSP(srcId, ReasonCode::TS_DENY_RSN_TGT_BUSY, (grp) ? 1U : 0U);
::ActivityLog("DMR", true, "Slot %u group grant request %u to TG %u denied", tscc->m_slotNo, srcId, dstId);
::ActivityLogEx(LOG_DMR, true, "Slot %u group grant request %u to TG %u denied", tscc->m_slotNo, srcId, dstId);
m_slot->m_rfState = RS_RF_REJECTED;
}
@ -1358,7 +1357,7 @@ bool ControlSignaling::writeRF_CSBK_Data_Grant(uint32_t srcId, uint32_t dstId, u
LogWarning(LOG_RF, "DMR Slot %u, CSBK, RAND (Random Access, DATA_CALL (Data Call) denied, traffic in progress, dstId = %u", tscc->m_slotNo, dstId);
writeRF_CSBK_ACK_RSP(srcId, ReasonCode::TS_DENY_RSN_TGT_BUSY, (grp) ? 1U : 0U);
::ActivityLog("DMR", true, "Slot %u group grant request %u to TG %u denied", tscc->m_slotNo, srcId, dstId);
::ActivityLogEx(LOG_DMR, true, "Slot %u group grant request %u to TG %u denied", tscc->m_slotNo, srcId, dstId);
m_slot->m_rfState = RS_RF_REJECTED;
}
@ -1388,7 +1387,7 @@ bool ControlSignaling::writeRF_CSBK_Data_Grant(uint32_t srcId, uint32_t dstId, u
LogWarning(LOG_RF, "DMR Slot %u, CSBK, RAND (Random Access, GRP_DATA_CALL (Group Data Call) queued, no channels available, dstId = %u", tscc->m_slotNo, dstId);
writeRF_CSBK_ACK_RSP(srcId, ReasonCode::TS_QUEUED_RSN_NO_RESOURCE, (grp) ? 1U : 0U);
::ActivityLog("DMR", true, "Slot %u group grant request %u to TG %u queued", tscc->m_slotNo, srcId, dstId);
::ActivityLogEx(LOG_DMR, true, "Slot %u group grant request %u to TG %u queued", tscc->m_slotNo, srcId, dstId);
m_slot->m_rfState = RS_RF_REJECTED;
}
@ -1399,7 +1398,7 @@ bool ControlSignaling::writeRF_CSBK_Data_Grant(uint32_t srcId, uint32_t dstId, u
LogWarning(LOG_RF, "DMR Slot %u, CSBK, RAND (Random Access, IND_DATA_CALL (Individual Data Call) queued, no channels available, dstId = %u", tscc->m_slotNo, dstId);
writeRF_CSBK_ACK_RSP(srcId, ReasonCode::TS_QUEUED_RSN_NO_RESOURCE, (grp) ? 1U : 0U);
::ActivityLog("DMR", true, "Slot %u group grant request %u to TG %u queued", tscc->m_slotNo, srcId, dstId);
::ActivityLogEx(LOG_DMR, true, "Slot %u group grant request %u to TG %u queued", tscc->m_slotNo, srcId, dstId);
m_slot->m_rfState = RS_RF_REJECTED;
}
@ -1429,7 +1428,7 @@ bool ControlSignaling::writeRF_CSBK_Data_Grant(uint32_t srcId, uint32_t dstId, u
if (grp) {
if (!net) {
::ActivityLog("DMR", true, "Slot %u group grant request from %u to TG %u", tscc->m_slotNo, srcId, dstId);
::ActivityLogEx(LOG_DMR, true, "Slot %u group grant request from %u to TG %u", tscc->m_slotNo, srcId, dstId);
}
writeRF_CSBK_ACK_RSP(srcId, ReasonCode::TS_ACK_RSN_MSG, (grp) ? 1U : 0U);
@ -1477,7 +1476,7 @@ bool ControlSignaling::writeRF_CSBK_Data_Grant(uint32_t srcId, uint32_t dstId, u
}
else {
if (!net) {
::ActivityLog("DMR", true, "Slot %u individual grant request from %u to TG %u", tscc->m_slotNo, srcId, dstId);
::ActivityLogEx(LOG_DMR, true, "Slot %u individual grant request from %u to TG %u", tscc->m_slotNo, srcId, dstId);
}
writeRF_CSBK_ACK_RSP(srcId, ReasonCode::TS_ACK_RSN_MSG, (grp) ? 1U : 0U);
@ -1576,7 +1575,7 @@ void ControlSignaling::writeRF_CSBK_U_Reg_Rsp(uint32_t srcId, uint8_t serviceOpt
// validate the source RID
if (!acl::AccessControl::validateSrcId(srcId)) {
LogWarning(LOG_RF, "DMR Slot %u, CSBK, %s, denial, RID rejection, srcId = %u", tscc->m_slotNo, csbk->toString().c_str(), srcId);
::ActivityLog("DMR", true, "unit registration request from %u denied", srcId);
::ActivityLogEx(LOG_DMR, true, "unit registration request from %u denied", srcId);
csbk->setReason(ReasonCode::TS_DENY_RSN_REG_DENIED);
}
@ -1585,7 +1584,7 @@ void ControlSignaling::writeRF_CSBK_U_Reg_Rsp(uint32_t srcId, uint8_t serviceOpt
LogInfoEx(LOG_RF, "DMR Slot %u, CSBK, %s, srcId = %u, serviceOptions = $%02X", tscc->m_slotNo, csbk->toString().c_str(), srcId, serviceOptions);
}
::ActivityLog("DMR", true, "unit registration request from %u", srcId);
::ActivityLogEx(LOG_DMR, true, "unit registration request from %u", srcId);
// update dynamic unit registration table
if (!m_slot->s_affiliations->isUnitReg(srcId)) {

@ -21,7 +21,6 @@
#include "common/Utils.h"
#include "dmr/packet/Data.h"
#include "dmr/Slot.h"
#include "ActivityLog.h"
#include "HostMain.h"
using namespace dmr;
@ -90,12 +89,12 @@ bool Data::process(uint8_t* data, uint32_t len)
}
if (m_slot->m_rssi != 0U) {
::ActivityLog("DMR", true, "Slot %u RF end of voice transmission, %.1f seconds, BER: %.1f%%, RSSI: -%u/-%u/-%u dBm",
::ActivityLogEx(LOG_DMR, true, "Slot %u RF end of voice transmission, %.1f seconds, BER: %.1f%%, RSSI: -%u/-%u/-%u dBm",
m_slot->m_slotNo, float(m_slot->m_rfFrames) / 16.667F, float(m_slot->m_rfErrs * 100U) / float(m_slot->m_rfBits),
m_slot->m_minRSSI, m_slot->m_maxRSSI, m_slot->m_aveRSSI / m_slot->m_rssiCount);
}
else {
::ActivityLog("DMR", true, "Slot %u RF end of voice transmission, %.1f seconds, BER: %.1f%%",
::ActivityLogEx(LOG_DMR, true, "Slot %u RF end of voice transmission, %.1f seconds, BER: %.1f%%",
m_slot->m_slotNo, float(m_slot->m_rfFrames) / 16.667F, float(m_slot->m_rfErrs * 100U) / float(m_slot->m_rfBits));
}
@ -260,7 +259,7 @@ bool Data::process(uint8_t* data, uint32_t len)
m_slot->setShortLC(m_slot->m_slotNo, dstId, gi ? FLCO::GROUP : FLCO::PRIVATE, Slot::SLCO_ACT_TYPE::DATA);
}
::ActivityLog("DMR", true, "Slot %u RF data header from %u to %s%u, %u blocks", m_slot->m_slotNo, srcId, gi ? "TG " : "", dstId, m_slot->m_rfFrames);
::ActivityLogEx(LOG_DMR, true, "Slot %u RF data header from %u to %s%u, %u blocks", m_slot->m_slotNo, srcId, gi ? "TG " : "", dstId, m_slot->m_rfFrames);
LogInfoEx(LOG_RF, "DMR Data Call, slot = %u, srcId = %u, dstId = %u", m_slot->m_slotNo, srcId, dstId);
::memset(m_pduUserData, 0x00U, MAX_PDU_COUNT * DMR_PDU_UNCODED_LENGTH_BYTES + 2U);
@ -271,7 +270,7 @@ bool Data::process(uint8_t* data, uint32_t len)
m_slot->completeUDT(m_rfUDTSource);
}
::ActivityLog("DMR", true, "Slot %u ended RF data transmission", m_slot->m_slotNo);
::ActivityLogEx(LOG_DMR, true, "Slot %u ended RF data transmission", m_slot->m_slotNo);
m_slot->writeEndRF();
}
@ -419,7 +418,7 @@ void Data::processNetwork(const data::NetData& dmrData)
// We've received the voice header and terminator haven't we?
m_slot->m_netFrames += 2U;
::ActivityLog("DMR", false, "Slot %u network end of voice transmission, %.1f seconds, %u%% packet loss, BER: %.1f%%",
::ActivityLogEx(LOG_DMR, false, "Slot %u network end of voice transmission, %.1f seconds, %u%% packet loss, BER: %.1f%%",
m_slot->m_slotNo, float(m_slot->m_netFrames) / 16.667F, (m_slot->m_netLost * 100U) / m_slot->m_netFrames, float(m_slot->m_netErrs * 100U) / float(m_slot->m_netBits));
m_slot->s_dmr->tsccClearActivatedSlot(m_slot->m_slotNo);
@ -536,7 +535,7 @@ void Data::processNetwork(const data::NetData& dmrData)
m_netDataHeader.getFSN(), dstId, srcId, gi);
}
::ActivityLog("DMR", false, "Slot %u network data header from %u to %s%u, %u blocks",
::ActivityLogEx(LOG_DMR, false, "Slot %u network data header from %u to %s%u, %u blocks",
m_slot->m_slotNo, srcId, gi ? "TG " : "", dstId, m_slot->m_netFrames);
LogInfoEx(LOG_NET, "DMR Data Call, slot = %u, srcId = %u, dstId = %u", m_slot->m_slotNo, srcId, dstId);
@ -544,7 +543,7 @@ void Data::processNetwork(const data::NetData& dmrData)
m_pduDataOffset = 0U;
if (m_slot->m_netFrames == 0U) {
::ActivityLog("DMR", false, "Slot %u ended network data transmission", m_slot->m_slotNo);
::ActivityLogEx(LOG_DMR, false, "Slot %u ended network data transmission", m_slot->m_slotNo);
m_slot->writeEndNet();
}
}

@ -19,7 +19,6 @@
#include "common/Utils.h"
#include "dmr/packet/Voice.h"
#include "dmr/Slot.h"
#include "ActivityLog.h"
#include "HostMain.h"
using namespace dmr;
@ -97,7 +96,7 @@ bool Voice::process(uint8_t* data, uint32_t len)
if (!acl::AccessControl::validateSrcId(srcId)) {
if (m_slot->m_data->m_lastRejectId == 0U || m_slot->m_data->m_lastRejectId == srcId) {
LogWarning(LOG_RF, "DMR Slot %u, VOICE_LC_HEADER denial, RID rejection, srcId = %u", m_slot->m_slotNo, srcId);
::ActivityLog("DMR", true, "Slot %u RF voice rejection from %u to %s%u ", m_slot->m_slotNo, srcId, flco == FLCO::GROUP ? "TG " : "", dstId);
::ActivityLogEx(LOG_DMR, true, "Slot %u RF voice rejection from %u to %s%u ", m_slot->m_slotNo, srcId, flco == FLCO::GROUP ? "TG " : "", dstId);
}
m_slot->m_rfLastDstId = 0U;
@ -113,7 +112,7 @@ bool Voice::process(uint8_t* data, uint32_t len)
if (!acl::AccessControl::validateTGId(m_slot->m_slotNo, dstId) || !acl::AccessControl::validateTGAccess(m_slot->m_slotNo, srcId, dstId)) {
if (m_slot->m_data->m_lastRejectId == 0U || m_slot->m_data->m_lastRejectId == dstId) {
LogWarning(LOG_RF, "DMR Slot %u, VOICE_LC_HEADER denial, TGID/RID admission rejection, srcId = %u, dstId = %u", m_slot->m_slotNo, srcId, dstId);
::ActivityLog("DMR", true, "Slot %u RF voice rejection from %u to TG %u ", m_slot->m_slotNo, srcId, dstId);
::ActivityLogEx(LOG_DMR, true, "Slot %u RF voice rejection from %u to TG %u ", m_slot->m_slotNo, srcId, dstId);
}
m_slot->m_rfLastDstId = 0U;
@ -146,7 +145,7 @@ bool Voice::process(uint8_t* data, uint32_t len)
else if (!acl::AccessControl::validateSrcId(dstId)) {
LogWarning(LOG_RF, "DMR Slot %u, VOICE_LC_HEADER denial, destination RID rejection, srcId = %u, dstId = %u", m_slot->m_slotNo, srcId, dstId);
::ActivityLog("DMR", true, "Slot %u RF private voice rejection from %u to %u ", m_slot->m_slotNo, srcId, dstId);
::ActivityLogEx(LOG_DMR, true, "Slot %u RF private voice rejection from %u to %u ", m_slot->m_slotNo, srcId, dstId);
m_slot->m_rfLastDstId = 0U;
m_slot->m_rfLastSrcId = 0U;
@ -228,7 +227,7 @@ bool Voice::process(uint8_t* data, uint32_t len)
m_slot->m_rfLC->getSrcId(), m_slot->m_rfLC->getDstId(), m_slot->m_rfLC->getFLCO(), m_slot->m_rfLC->getFID(), m_slot->m_rfLC->getPF());
}
::ActivityLog("DMR", true, "Slot %u RF %svoice header from %u to %s%u", m_slot->m_slotNo, encrypted ? "encrypted " : "", srcId, flco == FLCO::GROUP ? "TG " : "", dstId);
::ActivityLogEx(LOG_DMR, true, "Slot %u RF %svoice header from %u to %s%u", m_slot->m_slotNo, encrypted ? "encrypted " : "", srcId, flco == FLCO::GROUP ? "TG " : "", dstId);
LogInfoEx(LOG_RF, "DMR Voice Call, slot = %u, srcId = %u, dstId = %u", m_slot->m_slotNo, srcId, dstId);
return true;
}
@ -305,7 +304,7 @@ bool Voice::process(uint8_t* data, uint32_t len)
if (!encrypted) {
LogWarning(LOG_RF, "DMR Slot %u, VOICE_SYNC denial, TGID enc. strapping rejection, srcId = %u, dstId = %u", m_slot->m_slotNo, m_slot->m_rfLC->getSrcId(), m_slot->m_rfLC->getDstId());
::ActivityLog("DMR", true, "Slot %u RF voice rejection from %u to TG %u ", m_slot->m_slotNo, m_slot->m_rfLC->getSrcId(), m_slot->m_rfLC->getDstId());
::ActivityLogEx(LOG_DMR, true, "Slot %u RF voice rejection from %u to TG %u ", m_slot->m_slotNo, m_slot->m_rfLC->getSrcId(), m_slot->m_rfLC->getDstId());
m_slot->m_rfLastDstId = 0U;
m_slot->m_rfLastSrcId = 0U;
@ -408,7 +407,7 @@ bool Voice::process(uint8_t* data, uint32_t len)
if (!encrypted) {
LogWarning(LOG_RF, "DMR Slot %u, VOICE_SYNC denial, TGID enc. strapping rejection, srcId = %u, dstId = %u", m_slot->m_slotNo, m_slot->m_rfLC->getSrcId(), m_slot->m_rfLC->getDstId());
::ActivityLog("DMR", true, "Slot %u RF voice rejection from %u to TG %u ", m_slot->m_slotNo, m_slot->m_rfLC->getSrcId(), m_slot->m_rfLC->getDstId());
::ActivityLogEx(LOG_DMR, true, "Slot %u RF voice rejection from %u to TG %u ", m_slot->m_slotNo, m_slot->m_rfLC->getSrcId(), m_slot->m_rfLC->getDstId());
m_slot->m_rfLastDstId = 0U;
m_slot->m_rfLastSrcId = 0U;
@ -747,7 +746,7 @@ bool Voice::process(uint8_t* data, uint32_t len)
m_slot->setShortLC(m_slot->m_slotNo, dstId, flco, Slot::SLCO_ACT_TYPE::VOICE);
}
::ActivityLog("DMR", true, "Slot %u RF late entry from %u to %s%u", m_slot->m_slotNo, srcId, flco == FLCO::GROUP ? "TG " : "", dstId);
::ActivityLogEx(LOG_DMR, true, "Slot %u RF late entry from %u to %s%u", m_slot->m_slotNo, srcId, flco == FLCO::GROUP ? "TG " : "", dstId);
LogInfoEx(LOG_RF, "DMR Voice Call, slot = %u, srcId = %u, dstId = %u", m_slot->m_slotNo, srcId, dstId);
return true;
}
@ -870,7 +869,7 @@ void Voice::processNetwork(const data::NetData& dmrData)
m_slot->m_netLC->getSrcId(), m_slot->m_netLC->getDstId(), m_slot->m_netLC->getFLCO(), m_slot->m_netLC->getFID(), m_slot->m_netLC->getPF());
}
::ActivityLog("DMR", false, "Slot %u network voice header from %u to %s%u", m_slot->m_slotNo, srcId, flco == FLCO::GROUP ? "TG " : "", dstId);
::ActivityLogEx(LOG_DMR, false, "Slot %u network voice header from %u to %s%u", m_slot->m_slotNo, srcId, flco == FLCO::GROUP ? "TG " : "", dstId);
LogInfoEx(LOG_NET, "DMR Voice Call, slot = %u, srcId = %u, dstId = %u", m_slot->m_slotNo, srcId, dstId);
}
else if (dataType == DataType::VOICE_PI_HEADER) {
@ -941,7 +940,7 @@ void Voice::processNetwork(const data::NetData& dmrData)
m_slot->setShortLC(m_slot->m_slotNo, dstId, m_slot->m_netLC->getFLCO(), Slot::SLCO_ACT_TYPE::VOICE);
::ActivityLog("DMR", false, "Slot %u network late entry from %u to %s%u",
::ActivityLogEx(LOG_DMR, false, "Slot %u network late entry from %u to %s%u",
m_slot->m_slotNo, srcId, m_slot->m_netLC->getFLCO() == FLCO::GROUP ? "TG " : "", dstId);
LogInfoEx(LOG_NET, "DMR Voice Call, slot = %u, srcId = %u, dstId = %u", m_slot->m_slotNo, srcId, dstId);
}
@ -1058,7 +1057,7 @@ void Voice::processNetwork(const data::NetData& dmrData)
m_slot->setShortLC(m_slot->m_slotNo, dstId, m_slot->m_netLC->getFLCO(), Slot::SLCO_ACT_TYPE::VOICE);
::ActivityLog("DMR", false, "Slot %u network late entry from %u to %s%u",
::ActivityLogEx(LOG_DMR, false, "Slot %u network late entry from %u to %s%u",
m_slot->m_slotNo, srcId, m_slot->m_netLC->getFLCO() == FLCO::GROUP ? "TG " : "", dstId);
LogInfoEx(LOG_NET, "DMR Voice Call, slot = %u, srcId = %u, dstId = %u", m_slot->m_slotNo, srcId, dstId);
}

@ -20,7 +20,6 @@
#include "common/Log.h"
#include "common/Utils.h"
#include "nxdn/Control.h"
#include "ActivityLog.h"
#include "Host.h"
using namespace nxdn;
@ -748,15 +747,15 @@ void Control::clock()
if (m_networkWatchdog.hasExpired()) {
if (m_netState == RS_NET_AUDIO) {
if (m_voice->m_netFrames > 0U) {
::ActivityLog("NXDN", false, "network watchdog has expired, %.1f seconds, %u%% packet loss",
::ActivityLogEx(LOG_NXDN, false, "network watchdog has expired, %.1f seconds, %u%% packet loss",
float(m_voice->m_netFrames) / 50.0F, (m_voice->m_netLost * 100U) / m_voice->m_netFrames);
}
else {
::ActivityLog("NXDN", false, "network watchdog has expired");
::ActivityLogEx(LOG_NXDN, false, "network watchdog has expired");
}
}
else {
::ActivityLog("NXDN", false, "network watchdog has expired");
::ActivityLogEx(LOG_NXDN, false, "network watchdog has expired");
}
m_networkWatchdog.stop();
@ -1086,11 +1085,11 @@ void Control::processFrameLoss(RPT_RF_LOSS_TYPE type)
if (m_rfState == RS_RF_AUDIO) {
if (m_rssi != 0U) {
::ActivityLog("NXDN", true, "transmission lost, %s, %.1f seconds, BER: %.1f%%, RSSI: -%u/-%u/-%u dBm, loss count: %u",
::ActivityLogEx(LOG_NXDN, true, "transmission lost, %s, %.1f seconds, BER: %.1f%%, RSSI: -%u/-%u/-%u dBm, loss count: %u",
typeStr.c_str(), float(m_voice->m_rfFrames) / 12.5F, float(m_voice->m_rfErrs * 100U) / float(m_voice->m_rfBits), m_minRSSI, m_maxRSSI, m_aveRSSI / m_rssiCount, m_frameLossCnt);
}
else {
::ActivityLog("NXDN", true, "transmission lost, %s, %.1f seconds, BER: %.1f%%, loss count: %u",
::ActivityLogEx(LOG_NXDN, true, "transmission lost, %s, %.1f seconds, BER: %.1f%%, loss count: %u",
typeStr.c_str(), float(m_voice->m_rfFrames) / 12.5F, float(m_voice->m_rfErrs * 100U) / float(m_voice->m_rfBits), m_frameLossCnt);
}

@ -17,7 +17,6 @@
#include "common/Log.h"
#include "common/Utils.h"
#include "nxdn/packet/ControlSignaling.h"
#include "ActivityLog.h"
#include "Host.h"
using namespace nxdn;
@ -586,7 +585,7 @@ bool ControlSignaling::writeRF_Message_Grant(uint32_t srcId, uint32_t dstId,
rcch->toString().c_str(), srcId, dstId);
if (!net) {
writeRF_Message_Deny(0U, srcId, CauseResponse::VD_GRP_NOT_PERM, MessageType::RTCH_VCALL);
::ActivityLog("NXDN", true, "group grant request rejection from %u to TG %u", srcId, dstId);
::ActivityLogEx(LOG_NXDN, true, "group grant request rejection from %u to TG %u", srcId, dstId);
m_nxdn->m_rfState = RS_RF_REJECTED;
}
return false;
@ -599,7 +598,7 @@ bool ControlSignaling::writeRF_Message_Grant(uint32_t srcId, uint32_t dstId,
LogWarning(LOG_RF, "NXDN, %s denied, traffic in progress, dstId = %u", rcch->toString().c_str(), dstId);
writeRF_Message_Deny(0U, srcId, CauseResponse::VD_QUE_GRP_BUSY, MessageType::RTCH_VCALL);
::ActivityLog("NXDN", true, "group grant request from %u to TG %u denied", srcId, dstId);
::ActivityLogEx(LOG_NXDN, true, "group grant request from %u to TG %u denied", srcId, dstId);
m_nxdn->m_rfState = RS_RF_REJECTED;
}
@ -611,7 +610,7 @@ bool ControlSignaling::writeRF_Message_Grant(uint32_t srcId, uint32_t dstId,
LogWarning(LOG_RF, "NXDN, %s denied, traffic in progress, dstId = %u", rcch->toString().c_str(), dstId);
writeRF_Message_Deny(0U, srcId, CauseResponse::VD_QUE_GRP_BUSY, MessageType::RTCH_VCALL);
::ActivityLog("NXDN", true, "group grant request from %u to TG %u denied", srcId, dstId);
::ActivityLogEx(LOG_NXDN, true, "group grant request from %u to TG %u denied", srcId, dstId);
m_nxdn->m_rfState = RS_RF_REJECTED;
}
@ -655,7 +654,7 @@ bool ControlSignaling::writeRF_Message_Grant(uint32_t srcId, uint32_t dstId,
LogWarning(LOG_RF, "NXDN, %s denial, TGID enc. strapping rejection, srcId = %u, dstId = %u", rcch->toString().c_str(), srcId, dstId);
writeRF_Message_Deny(0U, srcId, CauseResponse::VD_GRP_NOT_PERM, MessageType::RTCH_VCALL);
::ActivityLog("NXDN", true, "group grant request rejection from %u to TG %u ", srcId, dstId);
::ActivityLogEx(LOG_NXDN, true, "group grant request rejection from %u to TG %u ", srcId, dstId);
m_nxdn->m_rfState = RS_RF_REJECTED;
return false;
}
@ -679,7 +678,7 @@ bool ControlSignaling::writeRF_Message_Grant(uint32_t srcId, uint32_t dstId,
LogWarning(LOG_RF, "NXDN, %s queued, no channels available, dstId = %u", rcch->toString().c_str(), dstId);
writeRF_Message_Deny(0U, srcId, CauseResponse::VD_QUE_CHN_RESOURCE_NOT_AVAIL, MessageType::RTCH_VCALL);
::ActivityLog("NXDN", true, "group grant request from %u to TG %u queued", srcId, dstId);
::ActivityLogEx(LOG_NXDN, true, "group grant request from %u to TG %u queued", srcId, dstId);
m_nxdn->m_rfState = RS_RF_REJECTED;
}
@ -690,7 +689,7 @@ bool ControlSignaling::writeRF_Message_Grant(uint32_t srcId, uint32_t dstId,
LogWarning(LOG_RF, "NXDN, %s queued, no channels available, dstId = %u", rcch->toString().c_str(), dstId);
writeRF_Message_Deny(0U, srcId, CauseResponse::VD_QUE_CHN_RESOURCE_NOT_AVAIL, MessageType::RTCH_VCALL);
::ActivityLog("NXDN", true, "unit-to-unit grant request from %u to %u queued", srcId, dstId);
::ActivityLogEx(LOG_NXDN, true, "unit-to-unit grant request from %u to %u queued", srcId, dstId);
m_nxdn->m_rfState = RS_RF_REJECTED;
}
@ -713,7 +712,7 @@ bool ControlSignaling::writeRF_Message_Grant(uint32_t srcId, uint32_t dstId,
LogWarning(LOG_RF, "NXDN, %s denied, traffic in progress, dstId = %u", rcch->toString().c_str(), dstId);
writeRF_Message_Deny(0U, srcId, CauseResponse::VD_QUE_GRP_BUSY, MessageType::RTCH_VCALL);
::ActivityLog("NXDN", true, "group grant request from %u to TG %u denied", srcId, dstId);
::ActivityLogEx(LOG_NXDN, true, "group grant request from %u to TG %u denied", srcId, dstId);
m_nxdn->m_rfState = RS_RF_REJECTED;
}
@ -738,7 +737,7 @@ bool ControlSignaling::writeRF_Message_Grant(uint32_t srcId, uint32_t dstId,
if (grp) {
if (!net) {
::ActivityLog("NXDN", true, "group grant request from %u to TG %u", srcId, dstId);
::ActivityLogEx(LOG_NXDN, true, "group grant request from %u to TG %u", srcId, dstId);
}
rcch->setCallType(CallType::CONFERENCE);
@ -747,7 +746,7 @@ bool ControlSignaling::writeRF_Message_Grant(uint32_t srcId, uint32_t dstId,
}
else {
if (!net) {
::ActivityLog("NXDN", true, "unit-to-unit grant request from %u to %u", srcId, dstId);
::ActivityLogEx(LOG_NXDN, true, "unit-to-unit grant request from %u to %u", srcId, dstId);
}
rcch->setCallType(CallType::INDIVIDUAL);
@ -857,21 +856,21 @@ bool ControlSignaling::writeRF_Message_Grp_Reg_Rsp(uint32_t srcId, uint32_t dstI
// validate the location ID
if (locId != m_nxdn->m_siteData.locId()) {
LogWarning(LOG_RF, "NXDN, %s denial, LOCID rejection, locId = $%06X", rcch->toString().c_str(), locId);
::ActivityLog("NXDN", true, "group affiliation request from %u denied", srcId);
::ActivityLogEx(LOG_NXDN, true, "group affiliation request from %u denied", srcId);
rcch->setCauseResponse(CauseResponse::MM_REG_FAILED);
}
// validate the source RID
if (!acl::AccessControl::validateSrcId(srcId)) {
LogWarning(LOG_RF, "NXDN, %s denial, RID rejection, srcId = %u", rcch->toString().c_str(), srcId);
::ActivityLog("NXDN", true, "group affiliation request from %u to %s %u denied", srcId, "TG ", dstId);
::ActivityLogEx(LOG_NXDN, true, "group affiliation request from %u to %s %u denied", srcId, "TG ", dstId);
rcch->setCauseResponse(CauseResponse::MM_REG_FAILED);
}
// validate the source RID is registered
if (!m_nxdn->m_affiliations->isUnitReg(srcId) && m_verifyReg) {
LogWarning(LOG_RF, "NXDN, %s denial, RID not registered, srcId = %u", rcch->toString().c_str(), srcId);
::ActivityLog("NXDN", true, "group affiliation request from %u to %s %u denied", srcId, "TG ", dstId);
::ActivityLogEx(LOG_NXDN, true, "group affiliation request from %u to %s %u denied", srcId, "TG ", dstId);
rcch->setCauseResponse(CauseResponse::MM_REG_REFUSED);
}
@ -882,7 +881,7 @@ bool ControlSignaling::writeRF_Message_Grp_Reg_Rsp(uint32_t srcId, uint32_t dstI
else {
if (!acl::AccessControl::validateTGId(dstId)) {
LogWarning(LOG_RF, "NXDN, %s denial, TGID rejection, dstId = %u", rcch->toString().c_str(), dstId);
::ActivityLog("NXDN", true, "group affiliation request from %u to %s %u denied", srcId, "TG ", dstId);
::ActivityLogEx(LOG_NXDN, true, "group affiliation request from %u to %s %u denied", srcId, "TG ", dstId);
rcch->setCauseResponse(CauseResponse::MM_LOC_ACPT_GRP_REFUSE);
}
}
@ -890,7 +889,7 @@ bool ControlSignaling::writeRF_Message_Grp_Reg_Rsp(uint32_t srcId, uint32_t dstI
if (rcch->getCauseResponse() == CauseResponse::MM_REG_ACCEPTED) {
VERBOSE_LOG_MSG(rcch->toString(), srcId, dstId);
::ActivityLog("NXDN", true, "group affiliation request from %u to %s %u", srcId, "TG ", dstId);
::ActivityLogEx(LOG_NXDN, true, "group affiliation request from %u to %s %u", srcId, "TG ", dstId);
ret = true;
// update dynamic affiliation table
@ -914,14 +913,14 @@ void ControlSignaling::writeRF_Message_U_Reg_Rsp(uint32_t srcId, uint32_t dstId,
// validate the location ID
if (locId != ((m_nxdn->m_siteData.locId() >> 12U) << 7U)) {
LogWarning(LOG_RF, "NXDN, %s denial, LOCID rejection, locId = $%06X", rcch->toString().c_str(), locId);
::ActivityLog("NXDN", true, "unit registration request from %u denied", srcId);
::ActivityLogEx(LOG_NXDN, true, "unit registration request from %u denied", srcId);
rcch->setCauseResponse(CauseResponse::MM_REG_FAILED);
}
// validate the source RID
if (!acl::AccessControl::validateSrcId(srcId)) {
LogWarning(LOG_RF, "NXDN, %s denial, RID rejection, srcId = %u", rcch->toString().c_str(), srcId);
::ActivityLog("NXDN", true, "unit registration request from %u denied", srcId);
::ActivityLogEx(LOG_NXDN, true, "unit registration request from %u denied", srcId);
rcch->setCauseResponse(CauseResponse::MM_REG_FAILED);
}
@ -932,7 +931,7 @@ void ControlSignaling::writeRF_Message_U_Reg_Rsp(uint32_t srcId, uint32_t dstId,
else {
if (!acl::AccessControl::validateTGId(dstId)) {
LogWarning(LOG_RF, "NXDN, %s denial, TGID rejection, dstId = %u", rcch->toString().c_str(), dstId);
::ActivityLog("NXDN", true, "unit registration request from %u to %s %u denied", srcId, "TG ", dstId);
::ActivityLogEx(LOG_NXDN, true, "unit registration request from %u to %s %u denied", srcId, "TG ", dstId);
rcch->setCauseResponse(CauseResponse::MM_REG_FAILED);
}
}
@ -943,7 +942,7 @@ void ControlSignaling::writeRF_Message_U_Reg_Rsp(uint32_t srcId, uint32_t dstId,
rcch->toString().c_str(), srcId, locId);
}
::ActivityLog("NXDN", true, "unit registration request from %u", srcId);
::ActivityLogEx(LOG_NXDN, true, "unit registration request from %u", srcId);
// update dynamic unit registration table
if (!m_nxdn->m_affiliations->isUnitReg(srcId)) {

@ -16,7 +16,6 @@
#include "common/nxdn/NXDNUtils.h"
#include "common/Log.h"
#include "nxdn/packet/Data.h"
#include "ActivityLog.h"
using namespace nxdn;
using namespace nxdn::defines;
@ -103,7 +102,7 @@ bool Data::process(ChOption::E option, uint8_t* data, uint32_t len)
if (!acl::AccessControl::validateSrcId(srcId)) {
if (m_lastRejectId == 0U || m_lastRejectId != srcId) {
LogWarning(LOG_RF, "NXDN, " NXDN_RTCH_MSG_TYPE_DCALL_HDR " denial, RID rejection, srcId = %u", srcId);
::ActivityLog("NXDN", true, "RF data rejection from %u to %s%u ", srcId, group ? "TG " : "", dstId);
::ActivityLogEx(LOG_NXDN, true, "RF data rejection from %u to %s%u ", srcId, group ? "TG " : "", dstId);
m_lastRejectId = srcId;
}
@ -119,7 +118,7 @@ bool Data::process(ChOption::E option, uint8_t* data, uint32_t len)
if (!acl::AccessControl::validateSrcId(dstId)) {
if (m_lastRejectId == 0 || m_lastRejectId != dstId) {
LogWarning(LOG_RF, "NXDN, " NXDN_RTCH_MSG_TYPE_DCALL_HDR " denial, RID rejection, dstId = %u", dstId);
::ActivityLog("NXDN", true, "RF data rejection from %u to %s%u ", srcId, group? "TG " : "", dstId);
::ActivityLogEx(LOG_NXDN, true, "RF data rejection from %u to %s%u ", srcId, group? "TG " : "", dstId);
m_lastRejectId = dstId;
}
@ -134,7 +133,7 @@ bool Data::process(ChOption::E option, uint8_t* data, uint32_t len)
if (!acl::AccessControl::validateTGId(dstId) || !acl::AccessControl::validateTGAccess(srcId, dstId)) {
if (m_lastRejectId == 0 || m_lastRejectId != dstId) {
LogWarning(LOG_RF, "NXDN, " NXDN_RTCH_MSG_TYPE_DCALL_HDR " denial, TGID/RID admission rejection, srcId = %u, dstId = %u", srcId, dstId);
::ActivityLog("NXDN", true, "RF data rejection from %u to %s%u ", srcId, group ? "TG " : "", dstId);
::ActivityLogEx(LOG_NXDN, true, "RF data rejection from %u to %s%u ", srcId, group ? "TG " : "", dstId);
m_lastRejectId = dstId;
}
@ -151,7 +150,7 @@ bool Data::process(ChOption::E option, uint8_t* data, uint32_t len)
srcId, dstId, lc.getPacketInfo().getDelivery(), lc.getPacketInfo().getBlockCount(), lc.getPacketInfo().getPadCount(), lc.getPacketInfo().getStart(), lc.getPacketInfo().getFragmentCount());
}
::ActivityLog("NXDN", true, "RF data transmission from %u to %s%u", srcId, group ? "TG " : "", dstId);
::ActivityLogEx(LOG_NXDN, true, "RF data transmission from %u to %s%u", srcId, group ? "TG " : "", dstId);
LogInfoEx(LOG_RF, "NXDN Data Call, srcId = %u, dstId = %u", srcId, dstId);
m_nxdn->m_rfLC = lc;
@ -197,7 +196,7 @@ bool Data::process(ChOption::E option, uint8_t* data, uint32_t len)
m_nxdn->m_voice->m_rfFrames++;
if (data[0U] == modem::TAG_EOT) {
::ActivityLog("NXDN", true, "RF ended RF data transmission");
::ActivityLogEx(LOG_NXDN, true, "RF ended RF data transmission");
LogInfoEx(LOG_RF, "NXDN, " NXDN_RTCH_MSG_TYPE_TX_REL ", total frames: %d",
m_nxdn->m_voice->m_rfFrames);
@ -290,7 +289,7 @@ bool Data::processNetwork(ChOption::E option, lc::RTCH& netLC, uint8_t* data, ui
if (!acl::AccessControl::validateSrcId(srcId)) {
if (m_lastRejectId == 0U || m_lastRejectId != srcId) {
LogWarning(LOG_NET, "NXDN, " NXDN_RTCH_MSG_TYPE_DCALL_HDR " denial, RID rejection, srcId = %u", srcId);
::ActivityLog("NXDN", true, "network data rejection from %u to %s%u ", srcId, group ? "TG " : "", dstId);
::ActivityLogEx(LOG_NXDN, true, "network data rejection from %u to %s%u ", srcId, group ? "TG " : "", dstId);
m_lastRejectId = srcId;
}
@ -303,7 +302,7 @@ bool Data::processNetwork(ChOption::E option, lc::RTCH& netLC, uint8_t* data, ui
if (!acl::AccessControl::validateSrcId(dstId)) {
if (m_lastRejectId == 0 || m_lastRejectId != dstId) {
LogWarning(LOG_NET, "NXDN, " NXDN_RTCH_MSG_TYPE_DCALL_HDR " denial, RID rejection, dstId = %u", dstId);
::ActivityLog("NXDN", true, "network data rejection from %u to %s%u ", srcId, group? "TG " : "", dstId);
::ActivityLogEx(LOG_NXDN, true, "network data rejection from %u to %s%u ", srcId, group? "TG " : "", dstId);
m_lastRejectId = dstId;
}
@ -315,7 +314,7 @@ bool Data::processNetwork(ChOption::E option, lc::RTCH& netLC, uint8_t* data, ui
if (!acl::AccessControl::validateTGId(dstId)) {
if (m_lastRejectId == 0 || m_lastRejectId != dstId) {
LogWarning(LOG_NET, "NXDN, " NXDN_RTCH_MSG_TYPE_DCALL_HDR " denial, TGID rejection, dstId = %u", dstId);
::ActivityLog("NXDN", true, "network data rejection from %u to %s%u ", srcId, group ? "TG " : "", dstId);
::ActivityLogEx(LOG_NXDN, true, "network data rejection from %u to %s%u ", srcId, group ? "TG " : "", dstId);
m_lastRejectId = dstId;
}
@ -329,7 +328,7 @@ bool Data::processNetwork(ChOption::E option, lc::RTCH& netLC, uint8_t* data, ui
srcId, dstId, lc.getPacketInfo().getDelivery(), lc.getPacketInfo().getBlockCount(), lc.getPacketInfo().getPadCount(), lc.getPacketInfo().getStart(), lc.getPacketInfo().getFragmentCount());
}
::ActivityLog("NXDN", false, "network data transmission from %u to %s%u", srcId, group ? "TG " : "", dstId);
::ActivityLogEx(LOG_NXDN, false, "network data transmission from %u to %s%u", srcId, group ? "TG " : "", dstId);
LogInfoEx(LOG_NET, "NXDN Data Call, srcId = %u, dstId = %u", srcId, dstId);
m_nxdn->m_netLC = lc;
@ -371,7 +370,7 @@ bool Data::processNetwork(ChOption::E option, lc::RTCH& netLC, uint8_t* data, ui
m_nxdn->m_voice->m_netFrames++;
if (data[0U] == modem::TAG_EOT) {
::ActivityLog("NXDN", true, "network ended RF data transmission");
::ActivityLogEx(LOG_NXDN, true, "network ended RF data transmission");
LogInfoEx(LOG_NET, "NXDN, " NXDN_RTCH_MSG_TYPE_TX_REL ", total frames: %d",
m_nxdn->m_voice->m_netFrames);

@ -17,7 +17,6 @@
#include "common/nxdn/NXDNUtils.h"
#include "common/Log.h"
#include "nxdn/packet/Voice.h"
#include "ActivityLog.h"
#include "HostMain.h"
using namespace nxdn;
@ -113,7 +112,7 @@ bool Voice::process(FuncChannelType::E fct, ChOption::E option, uint8_t* data, u
if (!acl::AccessControl::validateSrcId(srcId)) {
if (m_lastRejectId == 0U || m_lastRejectId != srcId) {
LogWarning(LOG_RF, "NXDN, " NXDN_RTCH_MSG_TYPE_VCALL " denial, RID rejection, srcId = %u", srcId);
::ActivityLog("NXDN", true, "RF voice rejection from %u to %s%u ", srcId, group ? "TG " : "", dstId);
::ActivityLogEx(LOG_NXDN, true, "RF voice rejection from %u to %s%u ", srcId, group ? "TG " : "", dstId);
m_lastRejectId = srcId;
}
@ -129,7 +128,7 @@ bool Voice::process(FuncChannelType::E fct, ChOption::E option, uint8_t* data, u
if (!acl::AccessControl::validateSrcId(dstId)) {
if (m_lastRejectId == 0 || m_lastRejectId != dstId) {
LogWarning(LOG_RF, "NXDN, " NXDN_RTCH_MSG_TYPE_VCALL " denial, RID rejection, dstId = %u", dstId);
::ActivityLog("NXDN", true, "RF voice rejection from %u to %s%u ", srcId, group? "TG " : "", dstId);
::ActivityLogEx(LOG_NXDN, true, "RF voice rejection from %u to %s%u ", srcId, group? "TG " : "", dstId);
m_lastRejectId = dstId;
}
@ -144,7 +143,7 @@ bool Voice::process(FuncChannelType::E fct, ChOption::E option, uint8_t* data, u
if (!acl::AccessControl::validateTGId(dstId) || !acl::AccessControl::validateTGAccess(srcId, dstId)) {
if (m_lastRejectId == 0 || m_lastRejectId != dstId) {
LogWarning(LOG_RF, "NXDN, " NXDN_RTCH_MSG_TYPE_VCALL " denial, TGID/RID admission rejection, srcId = %u, dstId = %u", srcId, dstId);
::ActivityLog("NXDN", true, "RF voice rejection from %u to %s%u ", srcId, group ? "TG " : "", dstId);
::ActivityLogEx(LOG_NXDN, true, "RF voice rejection from %u to %s%u ", srcId, group ? "TG " : "", dstId);
m_lastRejectId = dstId;
}
@ -162,7 +161,7 @@ bool Voice::process(FuncChannelType::E fct, ChOption::E option, uint8_t* data, u
if (groupVoice.config().strapping() == ::lookups::TG_STRAPPING_STRAPPED) {
if (lc.getAlgId() == NXDDEF::CIPHER_TYPE_NONE) {
LogWarning(LOG_RF, "NXDN, " NXDN_RTCH_MSG_TYPE_VCALL " denial, TGID enc. strapping rejection, srcId = %u, dstId = %u", srcId, dstId);
::ActivityLog("NXDN", true, "RF voice rejection from %u to %s%u ", srcId, group ? "TG " : "", dstId);
::ActivityLogEx(LOG_NXDN, true, "RF voice rejection from %u to %s%u ", srcId, group ? "TG " : "", dstId);
m_nxdn->m_rfLastDstId = 0U;
m_nxdn->m_rfLastSrcId = 0U;
@ -279,12 +278,12 @@ bool Voice::process(FuncChannelType::E fct, ChOption::E option, uint8_t* data, u
if (data[0U] == modem::TAG_EOT) {
m_rfFrames++;
if (m_nxdn->m_rssi != 0U) {
::ActivityLog("NXDN", true, "RF end of transmission, %.1f seconds, BER: %.1f%%, RSSI : -%u / -%u / -%u dBm",
::ActivityLogEx(LOG_NXDN, true, "RF end of transmission, %.1f seconds, BER: %.1f%%, RSSI : -%u / -%u / -%u dBm",
float(m_rfFrames) / 12.5F, float(m_rfErrs * 100U) / float(m_rfBits), m_nxdn->m_minRSSI, m_nxdn->m_maxRSSI,
m_nxdn->m_aveRSSI / m_nxdn->m_rssiCount);
}
else {
::ActivityLog("NXDN", true, "RF end of transmission, %.1f seconds, BER: %.1f%%",
::ActivityLogEx(LOG_NXDN, true, "RF end of transmission, %.1f seconds, BER: %.1f%%",
float(m_rfFrames) / 12.5F, float(m_rfErrs * 100U) / float(m_rfBits));
}
@ -310,7 +309,7 @@ bool Voice::process(FuncChannelType::E fct, ChOption::E option, uint8_t* data, u
srcId, dstId, group, lc.getEmergency(), encrypted, lc.getPriority(), lc.getAlgId(), lc.getKId());
}
::ActivityLog("NXDN", true, "RF %svoice transmission from %u to %s%u", encrypted ? "encrypted " : "", srcId, group ? "TG " : "", dstId);
::ActivityLogEx(LOG_NXDN, true, "RF %svoice transmission from %u to %s%u", encrypted ? "encrypted " : "", srcId, group ? "TG " : "", dstId);
LogInfoEx(LOG_RF, "NXDN Voice Call, srcId = %u, dstId = %u", srcId, dstId);
}
@ -399,7 +398,7 @@ bool Voice::process(FuncChannelType::E fct, ChOption::E option, uint8_t* data, u
if (!acl::AccessControl::validateSrcId(srcId)) {
if (m_lastRejectId == 0U || m_lastRejectId != srcId) {
LogWarning(LOG_RF, "NXDN, " NXDN_RTCH_MSG_TYPE_VCALL " denial, RID rejection, srcId = %u", srcId);
::ActivityLog("NXDN", true, "RF voice rejection from %u to %s%u ", srcId, group ? "TG " : "", dstId);
::ActivityLogEx(LOG_NXDN, true, "RF voice rejection from %u to %s%u ", srcId, group ? "TG " : "", dstId);
m_lastRejectId = srcId;
}
@ -415,7 +414,7 @@ bool Voice::process(FuncChannelType::E fct, ChOption::E option, uint8_t* data, u
if (!acl::AccessControl::validateSrcId(dstId)) {
if (m_lastRejectId == 0 || m_lastRejectId != dstId) {
LogWarning(LOG_RF, "NXDN, " NXDN_RTCH_MSG_TYPE_VCALL " denial, RID rejection, dstId = %u", dstId);
::ActivityLog("NXDN", true, "RF voice rejection from %u to %s%u ", srcId, group? "TG " : "", dstId);
::ActivityLogEx(LOG_NXDN, true, "RF voice rejection from %u to %s%u ", srcId, group? "TG " : "", dstId);
m_lastRejectId = dstId;
}
@ -430,7 +429,7 @@ bool Voice::process(FuncChannelType::E fct, ChOption::E option, uint8_t* data, u
if (!acl::AccessControl::validateTGId(dstId)) {
if (m_lastRejectId == 0 || m_lastRejectId != dstId) {
LogWarning(LOG_RF, "NXDN, " NXDN_RTCH_MSG_TYPE_VCALL " denial, TGID rejection, dstId = %u", dstId);
::ActivityLog("NXDN", true, "RF voice rejection from %u to %s%u ", srcId, group ? "TG " : "", dstId);
::ActivityLogEx(LOG_NXDN, true, "RF voice rejection from %u to %s%u ", srcId, group ? "TG " : "", dstId);
m_lastRejectId = dstId;
}
@ -462,7 +461,7 @@ bool Voice::process(FuncChannelType::E fct, ChOption::E option, uint8_t* data, u
srcId, dstId, group, m_nxdn->m_rfLC.getEmergency(), encrypted, m_nxdn->m_rfLC.getPriority(), m_nxdn->m_rfLC.getAlgId(), m_nxdn->m_rfLC.getKId());
}
::ActivityLog("NXDN", true, "RF %slate entry from %u to %s%u", encrypted ? "encrypted ": "", srcId, group ? "TG " : "", dstId);
::ActivityLogEx(LOG_NXDN, true, "RF %slate entry from %u to %s%u", encrypted ? "encrypted ": "", srcId, group ? "TG " : "", dstId);
LogInfoEx(LOG_RF, "NXDN Voice Call, srcId = %u, dstId = %u", srcId, dstId);
// create a dummy start message
@ -740,7 +739,7 @@ bool Voice::processNetwork(FuncChannelType::E fct, ChOption::E option, lc::RTCH&
if (!acl::AccessControl::validateSrcId(srcId)) {
if (m_lastRejectId == 0U || m_lastRejectId != srcId) {
LogWarning(LOG_NET, "NXDN, " NXDN_RTCH_MSG_TYPE_VCALL " denial, RID rejection, srcId = %u", srcId);
::ActivityLog("NXDN", true, "network voice rejection from %u to %s%u ", srcId, group ? "TG " : "", dstId);
::ActivityLogEx(LOG_NXDN, true, "network voice rejection from %u to %s%u ", srcId, group ? "TG " : "", dstId);
m_lastRejectId = srcId;
}
@ -753,7 +752,7 @@ bool Voice::processNetwork(FuncChannelType::E fct, ChOption::E option, lc::RTCH&
if (!acl::AccessControl::validateSrcId(dstId)) {
if (m_lastRejectId == 0 || m_lastRejectId != dstId) {
LogWarning(LOG_NET, "NXDN, " NXDN_RTCH_MSG_TYPE_VCALL " denial, RID rejection, dstId = %u", dstId);
::ActivityLog("NXDN", true, "network voice rejection from %u to %s%u ", srcId, group? "TG " : "", dstId);
::ActivityLogEx(LOG_NXDN, true, "network voice rejection from %u to %s%u ", srcId, group? "TG " : "", dstId);
m_lastRejectId = dstId;
}
@ -765,7 +764,7 @@ bool Voice::processNetwork(FuncChannelType::E fct, ChOption::E option, lc::RTCH&
if (!acl::AccessControl::validateTGId(dstId)) {
if (m_lastRejectId == 0 || m_lastRejectId != dstId) {
LogWarning(LOG_NET, "NXDN, " NXDN_RTCH_MSG_TYPE_VCALL " denial, TGID rejection, dstId = %u", dstId);
::ActivityLog("NXDN", true, "network voice rejection from %u to %s%u ", srcId, group ? "TG " : "", dstId);
::ActivityLogEx(LOG_NXDN, true, "network voice rejection from %u to %s%u ", srcId, group ? "TG " : "", dstId);
m_lastRejectId = dstId;
}
@ -853,7 +852,7 @@ bool Voice::processNetwork(FuncChannelType::E fct, ChOption::E option, lc::RTCH&
if (type == MessageType::RTCH_TX_REL || type == MessageType::RTCH_TX_REL_EX) {
m_netFrames++;
::ActivityLog("NXDN", false, "network end of transmission, %.1f seconds",
::ActivityLogEx(LOG_NXDN, false, "network end of transmission, %.1f seconds",
float(m_netFrames) / 12.5F);
LogInfoEx(LOG_NET, "NXDN, " NXDN_RTCH_MSG_TYPE_TX_REL ", total frames: %d", m_netFrames);
@ -870,7 +869,7 @@ bool Voice::processNetwork(FuncChannelType::E fct, ChOption::E option, lc::RTCH&
srcId, dstId, group, lc.getEmergency(), encrypted, lc.getPriority(), lc.getAlgId(), lc.getKId());
}
::ActivityLog("NXDN", false, "network %svoice transmission from %u to %s%u", encrypted ? "encrypted " : "", srcId, group ? "TG " : "", dstId);
::ActivityLogEx(LOG_NXDN, false, "network %svoice transmission from %u to %s%u", encrypted ? "encrypted " : "", srcId, group ? "TG " : "", dstId);
LogInfoEx(LOG_NET, "NXDN Voice Call, srcId = %u, dstId = %u", srcId, dstId);
}
@ -959,7 +958,7 @@ bool Voice::processNetwork(FuncChannelType::E fct, ChOption::E option, lc::RTCH&
if (!acl::AccessControl::validateSrcId(srcId)) {
if (m_lastRejectId == 0U || m_lastRejectId != srcId) {
LogWarning(LOG_NET, "NXDN, " NXDN_RTCH_MSG_TYPE_VCALL " denial, RID rejection, srcId = %u", srcId);
::ActivityLog("NXDN", true, "network voice rejection from %u to %s%u ", srcId, group ? "TG " : "", dstId);
::ActivityLogEx(LOG_NXDN, true, "network voice rejection from %u to %s%u ", srcId, group ? "TG " : "", dstId);
m_lastRejectId = srcId;
}
@ -972,7 +971,7 @@ bool Voice::processNetwork(FuncChannelType::E fct, ChOption::E option, lc::RTCH&
if (!acl::AccessControl::validateSrcId(dstId)) {
if (m_lastRejectId == 0 || m_lastRejectId != dstId) {
LogWarning(LOG_NET, "NXDN, " NXDN_RTCH_MSG_TYPE_VCALL " denial, RID rejection, dstId = %u", dstId);
::ActivityLog("NXDN", true, "network voice rejection from %u to %s%u ", srcId, group? "TG " : "", dstId);
::ActivityLogEx(LOG_NXDN, true, "network voice rejection from %u to %s%u ", srcId, group? "TG " : "", dstId);
m_lastRejectId = dstId;
}
@ -984,7 +983,7 @@ bool Voice::processNetwork(FuncChannelType::E fct, ChOption::E option, lc::RTCH&
if (!acl::AccessControl::validateTGId(dstId)) {
if (m_lastRejectId == 0 || m_lastRejectId != dstId) {
LogWarning(LOG_NET, "NXDN, " NXDN_RTCH_MSG_TYPE_VCALL " denial, TGID rejection, dstId = %u", dstId);
::ActivityLog("NXDN", true, "network voice rejection from %u to %s%u ", srcId, group ? "TG " : "", dstId);
::ActivityLogEx(LOG_NXDN, true, "network voice rejection from %u to %s%u ", srcId, group ? "TG " : "", dstId);
m_lastRejectId = dstId;
}
@ -1008,7 +1007,7 @@ bool Voice::processNetwork(FuncChannelType::E fct, ChOption::E option, lc::RTCH&
srcId, dstId, group, m_nxdn->m_netLC.getEmergency(), encrypted, m_nxdn->m_netLC.getPriority(), m_nxdn->m_netLC.getAlgId(), m_nxdn->m_netLC.getKId());
}
::ActivityLog("NXDN", false, "network %slate entry from %u to %s%u", encrypted ? "encrypted ": "", srcId, group ? "TG " : "", dstId);
::ActivityLogEx(LOG_NXDN, false, "network %slate entry from %u to %s%u", encrypted ? "encrypted ": "", srcId, group ? "TG " : "", dstId);
LogInfoEx(LOG_NET, "NXDN Voice Call, srcId = %u, dstId = %u", srcId, dstId);
// create a dummy start message

@ -19,7 +19,6 @@
#include "common/Utils.h"
#include "p25/Control.h"
#include "modem/ModemV24.h"
#include "ActivityLog.h"
#include "HostMain.h"
#include "Host.h"
@ -1064,13 +1063,13 @@ void Control::clock()
if (m_voice->m_netFrames > 0.0F) {
::LogWarning(LOG_NET, "network watchdog has expired, %.1f seconds, %u%% packet loss",
float(m_voice->m_netFrames) / 50.0F, (m_voice->m_netLost * 100U) / m_voice->m_netFrames);
::ActivityLog("P25", false, "network watchdog has expired, %.1f seconds, %u%% packet loss",
::ActivityLogEx(LOG_P25, false, "network watchdog has expired, %.1f seconds, %u%% packet loss",
float(m_voice->m_netFrames) / 50.0F, (m_voice->m_netLost * 100U) / m_voice->m_netFrames);
}
}
else {
::LogWarning(LOG_NET, "network watchdog has expired");
::ActivityLog("P25", false, "network watchdog has expired");
::ActivityLogEx(LOG_P25, false, "network watchdog has expired");
}
m_networkWatchdog.stop();
@ -1869,11 +1868,11 @@ void Control::processFrameLoss(RPT_RF_LOSS_TYPE type)
if (m_rfState == RS_RF_AUDIO) {
if (m_rssi != 0U) {
::ActivityLog("P25", true, "transmission lost, %s, %.1f seconds, BER: %.1f%%, RSSI: -%u/-%u/-%u dBm, loss count: %u",
::ActivityLogEx(LOG_P25, true, "transmission lost, %s, %.1f seconds, BER: %.1f%%, RSSI: -%u/-%u/-%u dBm, loss count: %u",
typeStr.c_str(), float(m_voice->m_rfFrames) / 5.56F, float(m_voice->m_rfErrs * 100U) / float(m_voice->m_rfBits), m_minRSSI, m_maxRSSI, m_aveRSSI / m_rssiCount, m_frameLossCnt);
}
else {
::ActivityLog("P25", true, "transmission lost, %s, %.1f seconds, BER: %.1f%%, loss count: %u",
::ActivityLogEx(LOG_P25, true, "transmission lost, %s, %.1f seconds, BER: %.1f%%, loss count: %u",
typeStr.c_str(), float(m_voice->m_rfFrames) / 5.56F, float(m_voice->m_rfErrs * 100U) / float(m_voice->m_rfBits), m_frameLossCnt);
}

@ -23,7 +23,6 @@
#include "p25/packet/Voice.h"
#include "p25/packet/ControlSignaling.h"
#include "p25/lookups/P25AffiliationLookup.h"
#include "ActivityLog.h"
#include "HostMain.h"
#include "Host.h"
@ -421,7 +420,7 @@ bool ControlSignaling::process(uint8_t* data, uint32_t len, std::unique_ptr<lc::
tsbk->toString(true).c_str(), isp->getPSTNAddress(), srcId);
}
::ActivityLog("P25", true, "telephone interconnect request from %u to PSTN address %u", srcId, isp->getPSTNAddress());
::ActivityLogEx(LOG_P25, true, "telephone interconnect request from %u to PSTN address %u", srcId, isp->getPSTNAddress());
// the telephone interconnect gateway places the call and demands the channel grant
RF_TO_WRITE_NET(isp);
@ -449,7 +448,7 @@ bool ControlSignaling::process(uint8_t* data, uint32_t len, std::unique_ptr<lc::
tsbk->toString(true).c_str(), iosp->getResponse(), srcId);
}
::ActivityLog("P25", true, "telephone interconnect answer response from %u", srcId);
::ActivityLogEx(LOG_P25, true, "telephone interconnect answer response from %u", srcId);
// forward the received frame as-is; re-encoding would produce the OSP (answer request) layout
writeNetworkRF(iosp, data + 2U, true);
@ -533,7 +532,7 @@ bool ControlSignaling::process(uint8_t* data, uint32_t len, std::unique_ptr<lc::
}
RF_TO_WRITE_NET(response);
::ActivityLog("P25", true, "status query response from %u", srcId);
::ActivityLogEx(LOG_P25, true, "status query response from %u", srcId);
}
break;
case TSBKO::IOSP_STS_UPDT:
@ -553,7 +552,7 @@ bool ControlSignaling::process(uint8_t* data, uint32_t len, std::unique_ptr<lc::
writeRF_TSDU_ACK_FNE(srcId, TSBKO::IOSP_STS_UPDT, false, false);
}
::ActivityLog("P25", true, "status update from %u", srcId);
::ActivityLogEx(LOG_P25, true, "status update from %u", srcId);
}
break;
case TSBKO::IOSP_MSG_UPDT:
@ -573,7 +572,7 @@ bool ControlSignaling::process(uint8_t* data, uint32_t len, std::unique_ptr<lc::
writeRF_TSDU_ACK_FNE(srcId, TSBKO::IOSP_MSG_UPDT, false, false);
}
::ActivityLog("P25", true, "message update from %u", srcId);
::ActivityLogEx(LOG_P25, true, "message update from %u", srcId);
}
break;
case TSBKO::IOSP_RAD_MON:
@ -604,7 +603,7 @@ bool ControlSignaling::process(uint8_t* data, uint32_t len, std::unique_ptr<lc::
VALID_DSTID(tsbk->toString(true), TSBKO::IOSP_CALL_ALRT, srcId, dstId);
VERBOSE_LOG_TSBK(tsbk->toString(true), srcId, dstId);
::ActivityLog("P25", true, "call alert request from %u to %u", srcId, dstId);
::ActivityLogEx(LOG_P25, true, "call alert request from %u to %u", srcId, dstId);
writeRF_TSDU_Call_Alrt(srcId, dstId);
}
@ -623,7 +622,7 @@ bool ControlSignaling::process(uint8_t* data, uint32_t len, std::unique_ptr<lc::
tsbk->toString(true).c_str(), iosp->getAIV(), iosp->getService(), srcId, dstId);
}
::ActivityLog("P25", true, "ack response from %u to %u", srcId, dstId);
::ActivityLogEx(LOG_P25, true, "ack response from %u to %u", srcId, dstId);
// ACK_RSP_U defines AIV and EX as zero; preserve its target and
// source addresses while transporting the response to the FNE.
@ -638,7 +637,7 @@ bool ControlSignaling::process(uint8_t* data, uint32_t len, std::unique_ptr<lc::
tsbk->toString(true).c_str(), isp->getAIV(), isp->getService(), isp->getResponse(), srcId, dstId);
}
::ActivityLog("P25", true, "cancel service request from %u", srcId);
::ActivityLogEx(LOG_P25, true, "cancel service request from %u", srcId);
// the telephone interconnect gateway must release the call
uint8_t service = isp->getService();
@ -673,7 +672,7 @@ bool ControlSignaling::process(uint8_t* data, uint32_t len, std::unique_ptr<lc::
writeRF_TSDU_ACK_FNE(srcId, TSBKO::ISP_EMERG_ALRM_REQ, false, true);
::ActivityLog("P25", true, "emergency alarm cancellation from %u for TG %u", srcId, groupId);
::ActivityLogEx(LOG_P25, true, "emergency alarm cancellation from %u for TG %u", srcId, groupId);
break;
}
@ -718,26 +717,26 @@ bool ControlSignaling::process(uint8_t* data, uint32_t len, std::unique_ptr<lc::
switch (iosp->getExtendedFunction()) {
// Standard
case ExtendedFunctions::CHECK_ACK:
::ActivityLog("P25", true, "radio check response from %u to %u", srcId, dstId);
::ActivityLogEx(LOG_P25, true, "radio check response from %u to %u", srcId, dstId);
break;
case ExtendedFunctions::INHIBIT_ACK:
::ActivityLog("P25", true, "radio inhibit response from %u to %u", srcId, dstId);
::ActivityLogEx(LOG_P25, true, "radio inhibit response from %u to %u", srcId, dstId);
break;
case ExtendedFunctions::UNINHIBIT_ACK:
::ActivityLog("P25", true, "radio uninhibit response from %u to %u", srcId, dstId);
::ActivityLogEx(LOG_P25, true, "radio uninhibit response from %u to %u", srcId, dstId);
break;
// Dynamic Regroup
case ExtendedFunctions::DYN_REGRP_REQ_ACK:
::ActivityLog("P25", true, "radio dynamic regroup response from %u to TG%u", srcId, dstId);
::ActivityLogEx(LOG_P25, true, "radio dynamic regroup response from %u to TG%u", srcId, dstId);
break;
case ExtendedFunctions::DYN_REGRP_CANCEL_ACK:
::ActivityLog("P25", true, "radio dynamic regroup cancel response from %u to TG%u", srcId, dstId);
::ActivityLogEx(LOG_P25, true, "radio dynamic regroup cancel response from %u to TG%u", srcId, dstId);
break;
case ExtendedFunctions::DYN_REGRP_LOCK_ACK:
::ActivityLog("P25", true, "radio dynamic regroup selector lock response from %u", srcId);
::ActivityLogEx(LOG_P25, true, "radio dynamic regroup selector lock response from %u", srcId);
break;
case ExtendedFunctions::DYN_REGRP_UNLOCK_ACK:
::ActivityLog("P25", true, "radio dynamic regroup selector unlock response from %u", srcId);
::ActivityLogEx(LOG_P25, true, "radio dynamic regroup selector unlock response from %u", srcId);
break;
}
@ -782,7 +781,7 @@ bool ControlSignaling::process(uint8_t* data, uint32_t len, std::unique_ptr<lc::
writeRF_TSDU_ACK_FNE(srcId, TSBKO::ISP_EMERG_ALRM_REQ, false, true);
::ActivityLog("P25", true, "emergency alarm request from %u for TG %u, specialInfo1 = $%02X, specialInfo2 = $%02X",
::ActivityLogEx(LOG_P25, true, "emergency alarm request from %u for TG %u, specialInfo1 = $%02X, specialInfo2 = $%02X",
srcId, dstId, isp->getSpecialInfo1(), isp->getSpecialInfo2());
}
break;
@ -858,7 +857,7 @@ bool ControlSignaling::process(uint8_t* data, uint32_t len, std::unique_ptr<lc::
m_p25->m_affiliations->touchUnitReg(srcId);
::ActivityLog("P25", true, "group affiliation query response from %u to %s %u", srcId, "TG ", dstId);
::ActivityLogEx(LOG_P25, true, "group affiliation query response from %u to %s %u", srcId, "TG ", dstId);
}
break;
case TSBKO::ISP_U_DEREG_REQ:
@ -925,7 +924,7 @@ bool ControlSignaling::process(uint8_t* data, uint32_t len, std::unique_ptr<lc::
tsbk->toString(true).c_str(), srcId);
}
::ActivityLog("P25", true, "authentication response from %u", srcId);
::ActivityLogEx(LOG_P25, true, "authentication response from %u", srcId);
DECLARE_UINT8_ARRAY(ks, AUTH_KEY_LENGTH_BYTES);
if (m_p25->getLLA_AM1_Parameters(srcId, nullptr, nullptr, ks)) {
@ -974,12 +973,12 @@ bool ControlSignaling::process(uint8_t* data, uint32_t len, std::unique_ptr<lc::
}
else {
LogWarning(LOG_RF, P25_TSDU_STR ", %s denial, AUTH failed, src = %u", isp->toString().c_str(), srcId);
::ActivityLog("P25", true, "unit registration request from %u denied, authentication failure", srcId);
::ActivityLogEx(LOG_P25, true, "unit registration request from %u denied, authentication failure", srcId);
writeRF_TSDU_Deny(srcId, WUID_FNE, ReasonCode::DENY_SU_FAILED_AUTH, TSBKO::IOSP_U_REG);
}
} else {
LogWarning(LOG_RF, P25_TSDU_STR ", %s denial, AUTH failed, src = %u", isp->toString().c_str(), srcId);
::ActivityLog("P25", true, "unit registration request from %u denied, authentication failure, LLA keys not found", srcId);
::ActivityLogEx(LOG_P25, true, "unit registration request from %u denied, authentication failure, LLA keys not found", srcId);
writeRF_TSDU_Deny(srcId, WUID_FNE, ReasonCode::DENY_SU_FAILED_AUTH, TSBKO::IOSP_U_REG);
}
}
@ -1276,7 +1275,7 @@ bool ControlSignaling::processNetwork(uint8_t* data, uint32_t len, lc::LC& contr
tsbk->toString().c_str(), iosp->getDigits().c_str(), dstId);
}
::ActivityLog("P25", false, "telephone interconnect answer request to %u", dstId);
::ActivityLogEx(LOG_P25, false, "telephone interconnect answer request to %u", dstId);
}
break;
case TSBKO::IOSP_STS_UPDT:
@ -1290,7 +1289,7 @@ bool ControlSignaling::processNetwork(uint8_t* data, uint32_t len, lc::LC& contr
tsbk->toString(true).c_str(), iosp->getStatus(), srcId);
}
::ActivityLog("P25", false, "status update from %u", srcId);
::ActivityLogEx(LOG_P25, false, "status update from %u", srcId);
}
break;
case TSBKO::IOSP_MSG_UPDT:
@ -1304,7 +1303,7 @@ bool ControlSignaling::processNetwork(uint8_t* data, uint32_t len, lc::LC& contr
tsbk->toString(true).c_str(), iosp->getMessage(), srcId, dstId);
}
::ActivityLog("P25", false, "message update from %u", srcId);
::ActivityLogEx(LOG_P25, false, "message update from %u", srcId);
}
break;
case TSBKO::IOSP_RAD_MON:
@ -1336,7 +1335,7 @@ bool ControlSignaling::processNetwork(uint8_t* data, uint32_t len, lc::LC& contr
}
VERBOSE_LOG_TSBK_NET(tsbk->toString(true), srcId, dstId);
::ActivityLog("P25", false, "call alert request from %u to %u", srcId, dstId);
::ActivityLogEx(LOG_P25, false, "call alert request from %u to %u", srcId, dstId);
}
break;
case TSBKO::IOSP_ACK_RSP:
@ -1353,7 +1352,7 @@ bool ControlSignaling::processNetwork(uint8_t* data, uint32_t len, lc::LC& contr
tsbk->toString(true).c_str(), iosp->getAIV(), iosp->getService(), srcId, dstId);
}
::ActivityLog("P25", false, "ack response from %u to %u", srcId, dstId);
::ActivityLogEx(LOG_P25, false, "ack response from %u to %u", srcId, dstId);
}
break;
case TSBKO::IOSP_EXT_FNCT:
@ -1371,26 +1370,26 @@ bool ControlSignaling::processNetwork(uint8_t* data, uint32_t len, lc::LC& contr
switch (iosp->getExtendedFunction()) {
// Standard
case ExtendedFunctions::CHECK_ACK:
::ActivityLog("P25", false, "radio check response from %u to %u", srcId, dstId);
::ActivityLogEx(LOG_P25, false, "radio check response from %u to %u", srcId, dstId);
break;
case ExtendedFunctions::INHIBIT_ACK:
::ActivityLog("P25", false, "radio inhibit response from %u to %u", srcId, dstId);
::ActivityLogEx(LOG_P25, false, "radio inhibit response from %u to %u", srcId, dstId);
break;
case ExtendedFunctions::UNINHIBIT_ACK:
::ActivityLog("P25", false, "radio uninhibit response from %u to %u", srcId, dstId);
::ActivityLogEx(LOG_P25, false, "radio uninhibit response from %u to %u", srcId, dstId);
break;
// Dynamic Regroup
case ExtendedFunctions::DYN_REGRP_REQ_ACK:
::ActivityLog("P25", false, "radio dynamic regroup response from %u to TG%u", srcId, dstId);
::ActivityLogEx(LOG_P25, false, "radio dynamic regroup response from %u to TG%u", srcId, dstId);
break;
case ExtendedFunctions::DYN_REGRP_CANCEL_ACK:
::ActivityLog("P25", false, "radio dynamic regroup cancel response from %u to TG%u", srcId, dstId);
::ActivityLogEx(LOG_P25, false, "radio dynamic regroup cancel response from %u to TG%u", srcId, dstId);
break;
case ExtendedFunctions::DYN_REGRP_LOCK_ACK:
::ActivityLog("P25", false, "radio dynamic regroup selector lock response from %u", srcId);
::ActivityLogEx(LOG_P25, false, "radio dynamic regroup selector lock response from %u", srcId);
break;
case ExtendedFunctions::DYN_REGRP_UNLOCK_ACK:
::ActivityLog("P25", false, "radio dynamic regroup selector unlock response from %u", srcId);
::ActivityLogEx(LOG_P25, false, "radio dynamic regroup selector unlock response from %u", srcId);
break;
}
}
@ -1516,7 +1515,7 @@ void ControlSignaling::writeRF_TSDU_Call_Alrt(uint32_t srcId, uint32_t dstId)
}
VERBOSE_LOG_TSBK(iosp->toString(), srcId, dstId);
::ActivityLog("P25", true, "call alert request from %u to %u", srcId, dstId);
::ActivityLogEx(LOG_P25, true, "call alert request from %u to %u", srcId, dstId);
writeRF_TSDU_SBF_Imm(iosp.get(), false);
}
@ -1534,7 +1533,7 @@ void ControlSignaling::writeRF_TSDU_Radio_Mon(uint32_t srcId, uint32_t dstId, ui
LogInfoEx(LOG_RF, P25_TSDU_STR ", %s, srcId = %u, dstId = %u, txMult = %u", iosp->toString().c_str(), srcId, dstId, txMult);
}
::ActivityLog("P25", true, "Radio Unit Monitor request from %u to %u", srcId, dstId);
::ActivityLogEx(LOG_P25, true, "Radio Unit Monitor request from %u to %u", srcId, dstId);
writeRF_TSDU_SBF_Imm(iosp.get(), false);
}
@ -1570,26 +1569,26 @@ void ControlSignaling::writeRF_TSDU_Ext_Func(uint32_t func, uint32_t arg, uint32
switch (func) {
// Standard
case ExtendedFunctions::CHECK:
::ActivityLog("P25", true, "radio check request from %u to %u", arg, dstId);
::ActivityLogEx(LOG_P25, true, "radio check request from %u to %u", arg, dstId);
break;
case ExtendedFunctions::INHIBIT:
::ActivityLog("P25", true, "radio inhibit request from %u to %u", arg, dstId);
::ActivityLogEx(LOG_P25, true, "radio inhibit request from %u to %u", arg, dstId);
break;
case ExtendedFunctions::UNINHIBIT:
::ActivityLog("P25", true, "radio uninhibit request from %u to %u", arg, dstId);
::ActivityLogEx(LOG_P25, true, "radio uninhibit request from %u to %u", arg, dstId);
break;
// Dynamic Regroup
case ExtendedFunctions::DYN_REGRP_REQ:
::ActivityLog("P25", true, "radio dynamic regroup request TG%u for %u", arg, dstId);
::ActivityLogEx(LOG_P25, true, "radio dynamic regroup request TG%u for %u", arg, dstId);
break;
case ExtendedFunctions::DYN_REGRP_CANCEL:
::ActivityLog("P25", true, "radio dynamic regroup cancel for %u", dstId);
::ActivityLogEx(LOG_P25, true, "radio dynamic regroup cancel for %u", dstId);
break;
case ExtendedFunctions::DYN_REGRP_LOCK:
::ActivityLog("P25", true, "radio dynamic regroup selector lock for %u", dstId);
::ActivityLogEx(LOG_P25, true, "radio dynamic regroup selector lock for %u", dstId);
break;
case ExtendedFunctions::DYN_REGRP_UNLOCK:
::ActivityLog("P25", true, "radio dynamic regroup selector unlock for %u", dstId);
::ActivityLogEx(LOG_P25, true, "radio dynamic regroup selector unlock for %u", dstId);
break;
}
@ -1631,7 +1630,7 @@ void ControlSignaling::writeRF_TSDU_Grp_Aff_Q_Once(uint32_t dstId)
}
VERBOSE_LOG_TSBK_DST(osp->toString(), dstId);
::ActivityLog("P25", true, "group affiliation query command from %u to %u", WUID_FNE, dstId);
::ActivityLogEx(LOG_P25, true, "group affiliation query command from %u to %u", WUID_FNE, dstId);
writeRF_TSDU_SBF_Imm(osp.get(), true);
}
@ -1653,7 +1652,7 @@ void ControlSignaling::writeRF_TSDU_U_Reg_Cmd(uint32_t dstId)
}
VERBOSE_LOG_TSBK_DST(osp->toString(), dstId);
::ActivityLog("P25", true, "unit registration command from %u to %u", WUID_FNE, dstId);
::ActivityLogEx(LOG_P25, true, "unit registration command from %u to %u", WUID_FNE, dstId);
writeRF_TSDU_SBF_Imm(osp.get(), true);
}
@ -1989,11 +1988,11 @@ void ControlSignaling::writeNet_TDULC(lc::TDULC* lc)
}
if (m_p25->m_voice->m_netFrames > 0) {
::ActivityLog("P25", false, "network end of transmission, %.1f seconds, %u%% packet loss",
::ActivityLogEx(LOG_P25, false, "network end of transmission, %.1f seconds, %u%% packet loss",
float(m_p25->m_voice->m_netFrames) / 50.0F, (m_p25->m_voice->m_netLost * 100U) / m_p25->m_voice->m_netFrames);
}
else {
::ActivityLog("P25", false, "network end of transmission, %u frames", m_p25->m_voice->m_netFrames);
::ActivityLogEx(LOG_P25, false, "network end of transmission, %u frames", m_p25->m_voice->m_netFrames);
}
if (m_p25->m_network != nullptr)
@ -2734,7 +2733,7 @@ bool ControlSignaling::writeRF_TSDU_Grant(uint32_t srcId, uint32_t dstId, uint8_
LogWarning(net ? LOG_NET : LOG_RF, P25_TSDU_STR ", TSBKO, IOSP_GRP_VCH (Group Voice Channel Request) denied, RID not admitted to TGID, srcId = %u, dstId = %u", srcId, dstId);
if (!net) {
writeRF_TSDU_Deny(srcId, dstId, ReasonCode::DENY_REQ_UNIT_NOT_AUTH, TSBKO::IOSP_GRP_VCH, true, true);
::ActivityLog("P25", true, "group grant request from %u to TG %u denied", srcId, dstId);
::ActivityLogEx(LOG_P25, true, "group grant request from %u to TG %u denied", srcId, dstId);
m_p25->m_rfState = RS_RF_REJECTED;
}
return false;
@ -2747,7 +2746,7 @@ bool ControlSignaling::writeRF_TSDU_Grant(uint32_t srcId, uint32_t dstId, uint8_
LogWarning(LOG_RF, P25_TSDU_STR ", TSBKO, IOSP_GRP_VCH (Group Voice Channel Request) denied, traffic in progress, dstId = %u", dstId);
writeRF_TSDU_Deny(srcId, dstId, ReasonCode::DENY_PTT_COLLIDE, (grp) ? TSBKO::IOSP_GRP_VCH : TSBKO::IOSP_UU_VCH, grp, true);
::ActivityLog("P25", true, "group grant request from %u to TG %u denied", srcId, dstId);
::ActivityLogEx(LOG_P25, true, "group grant request from %u to TG %u denied", srcId, dstId);
m_p25->m_rfState = RS_RF_REJECTED;
}
else {
@ -2765,7 +2764,7 @@ bool ControlSignaling::writeRF_TSDU_Grant(uint32_t srcId, uint32_t dstId, uint8_
LogWarning(LOG_RF, P25_TSDU_STR ", TSBKO, IOSP_GRP_VCH (Group Voice Channel Request) denied, RF grant active, grantedDstId = %u, dstId = %u",
activeGrantDstId, dstId);
writeRF_TSDU_Deny(srcId, dstId, ReasonCode::DENY_PTT_COLLIDE, TSBKO::IOSP_GRP_VCH, true, true);
::ActivityLog("P25", true, "group grant request from %u to TG %u denied", srcId, dstId);
::ActivityLogEx(LOG_P25, true, "group grant request from %u to TG %u denied", srcId, dstId);
m_p25->m_rfState = RS_RF_REJECTED;
return false;
}
@ -2774,7 +2773,7 @@ bool ControlSignaling::writeRF_TSDU_Grant(uint32_t srcId, uint32_t dstId, uint8_
// matching network traffic retains ownership to avoid treating a duplicate as a new RF call
LogWarning(LOG_RF, P25_TSDU_STR ", TSBKO, IOSP_GRP_VCH (Group Voice Channel Request) denied, matching network grant active, dstId = %u", dstId);
writeRF_TSDU_Deny(srcId, dstId, ReasonCode::DENY_PTT_COLLIDE, TSBKO::IOSP_GRP_VCH, true, true);
::ActivityLog("P25", true, "group grant request from %u to TG %u denied", srcId, dstId);
::ActivityLogEx(LOG_P25, true, "group grant request from %u to TG %u denied", srcId, dstId);
m_p25->m_rfState = RS_RF_REJECTED;
return false;
}
@ -2790,7 +2789,7 @@ bool ControlSignaling::writeRF_TSDU_Grant(uint32_t srcId, uint32_t dstId, uint8_
LogWarning(LOG_RF, P25_TSDU_STR ", TSBKO, IOSP_GRP_VCH (Group Voice Channel Request) denied, traffic in progress, dstId = %u", dstId);
writeRF_TSDU_Deny(srcId, dstId, ReasonCode::DENY_PTT_COLLIDE, (grp) ? TSBKO::IOSP_GRP_VCH : TSBKO::IOSP_UU_VCH, grp, true);
::ActivityLog("P25", true, "group grant request from %u to TG %u denied", srcId, dstId);
::ActivityLogEx(LOG_P25, true, "group grant request from %u to TG %u denied", srcId, dstId);
m_p25->m_rfState = RS_RF_REJECTED;
}
else {
@ -2839,7 +2838,7 @@ bool ControlSignaling::writeRF_TSDU_Grant(uint32_t srcId, uint32_t dstId, uint8_
LogWarning(LOG_RF, "P25, " P25_TSDU_STR ", TSBKO, IOSP_GRP_VCH (Group Voice Channel Request) denial, TGID enc. strapping rejection, srcId = %u, dstId = %u", srcId, dstId);
writeRF_TSDU_Deny(srcId, dstId, ReasonCode::DENY_TGT_GROUP_NOT_VALID, TSBKO::IOSP_GRP_VCH, grp, true);
::ActivityLog("P25", true, "group grant request from %u to TG %u denied", srcId, dstId);
::ActivityLogEx(LOG_P25, true, "group grant request from %u to TG %u denied", srcId, dstId);
m_p25->m_rfState = RS_RF_REJECTED;
return false;
}
@ -2884,7 +2883,7 @@ bool ControlSignaling::writeRF_TSDU_Grant(uint32_t srcId, uint32_t dstId, uint8_
LogWarning(LOG_RF, P25_TSDU_STR ", TSBKO, IOSP_GRP_VCH (Group Voice Channel Request) denied, no channels available, dstId = %u", dstId);
writeRF_TSDU_Deny(srcId, dstId, ReasonCode::DENY_NO_RF_RSRC_AVAIL, TSBKO::IOSP_UU_VCH, grp, true);
::ActivityLog("P25", true, "group grant request from %u to TG %u denied", srcId, dstId);
::ActivityLogEx(LOG_P25, true, "group grant request from %u to TG %u denied", srcId, dstId);
m_p25->m_rfState = RS_RF_REJECTED;
}
else {
@ -2898,7 +2897,7 @@ bool ControlSignaling::writeRF_TSDU_Grant(uint32_t srcId, uint32_t dstId, uint8_
LogWarning(LOG_RF, P25_TSDU_STR ", TSBKO, IOSP_UU_VCH (Unit-to-Unit Voice Channel Request) denied, no channels available, dstId = %u", dstId);
writeRF_TSDU_Deny(srcId, dstId, ReasonCode::DENY_NO_RF_RSRC_AVAIL, TSBKO::IOSP_GRP_VCH, grp, true);
::ActivityLog("P25", true, "unit-to-unit grant request from %u to %u denied", srcId, dstId);
::ActivityLogEx(LOG_P25, true, "unit-to-unit grant request from %u to %u denied", srcId, dstId);
m_p25->m_rfState = RS_RF_REJECTED;
}
else {
@ -2926,7 +2925,7 @@ bool ControlSignaling::writeRF_TSDU_Grant(uint32_t srcId, uint32_t dstId, uint8_
LogWarning(LOG_RF, P25_TSDU_STR ", TSBKO, IOSP_GRP_VCH (Group Voice Channel Request) denied, traffic collision, dstId = %u", dstId);
writeRF_TSDU_Deny(srcId, dstId, ReasonCode::DENY_PTT_COLLIDE, (grp) ? TSBKO::IOSP_GRP_VCH : TSBKO::IOSP_UU_VCH, grp, true);
::ActivityLog("P25", true, "group grant request from %u to TG %u denied", srcId, dstId);
::ActivityLogEx(LOG_P25, true, "group grant request from %u to TG %u denied", srcId, dstId);
m_p25->m_rfState = RS_RF_REJECTED;
}
else {
@ -3004,7 +3003,7 @@ bool ControlSignaling::writeRF_TSDU_Grant(uint32_t srcId, uint32_t dstId, uint8_
}
if (!net) {
::ActivityLog("P25", true, "group grant request from %u to TG %u", srcId, dstId);
::ActivityLogEx(LOG_P25, true, "group grant request from %u to TG %u", srcId, dstId);
}
if (voiceChData.isExplicitCh()) {
@ -3117,7 +3116,7 @@ bool ControlSignaling::writeRF_TSDU_Grant(uint32_t srcId, uint32_t dstId, uint8_
}
if (telInt) {
::ActivityLog("P25", !net, "telephone interconnect grant to %u", dstId);
::ActivityLogEx(LOG_P25, !net, "telephone interconnect grant to %u", dstId);
// the grant is held for the whole call (message trunking) instead of per transmission
m_telIntGrants.insert(dstId);
@ -3177,7 +3176,7 @@ bool ControlSignaling::writeRF_TSDU_Grant(uint32_t srcId, uint32_t dstId, uint8_
}
if (!net) {
::ActivityLog("P25", true, "unit-to-unit grant request from %u to %u", srcId, dstId);
::ActivityLogEx(LOG_P25, true, "unit-to-unit grant request from %u to %u", srcId, dstId);
}
if (voiceChData.isExplicitCh()) {
@ -3360,7 +3359,7 @@ bool ControlSignaling::writeRF_TSDU_SNDCP_Grant(uint32_t srcId, bool skip, uint3
LogWarning(LOG_RF, P25_TSDU_STR ", TSBKO, ISP_SNDCP_CH_REQ (SNDCP Data Channel Request) denied, traffic in progress, srcId = %u", srcId);
writeRF_TSDU_Deny(WUID_FNE, srcId, ReasonCode::DENY_PTT_COLLIDE, TSBKO::ISP_SNDCP_CH_REQ, false, true);
::ActivityLog("P25", true, "SNDCP grant request from %u denied", srcId);
::ActivityLogEx(LOG_P25, true, "SNDCP grant request from %u denied", srcId);
m_p25->m_rfState = RS_RF_REJECTED;
return false;
@ -3371,7 +3370,7 @@ bool ControlSignaling::writeRF_TSDU_SNDCP_Grant(uint32_t srcId, bool skip, uint3
LogWarning(LOG_RF, P25_TSDU_STR ", TSBKO, ISP_SNDCP_CH_REQ (SNDCP Data Channel Request) denied, no channels available, srcId = %u", srcId);
writeRF_TSDU_Deny(WUID_FNE, srcId, ReasonCode::DENY_NO_RF_RSRC_AVAIL, TSBKO::ISP_SNDCP_CH_REQ, false, true);
::ActivityLog("P25", true, "SNDCP grant request from %u denied", srcId);
::ActivityLogEx(LOG_P25, true, "SNDCP grant request from %u denied", srcId);
m_p25->m_rfState = RS_RF_REJECTED;
return false;
}
@ -3447,7 +3446,7 @@ bool ControlSignaling::writeRF_TSDU_SNDCP_Grant(uint32_t srcId, bool skip, uint3
}
}
::ActivityLog("P25", true, "SNDCP grant request from %u", srcId);
::ActivityLogEx(LOG_P25, true, "SNDCP grant request from %u", srcId);
if (m_verbose) {
LogInfoEx(LOG_RF, P25_TSDU_STR ", %s, chNo = %u-%u, srcId = %u",
@ -3556,7 +3555,7 @@ uint8_t ControlSignaling::writeRF_TSDU_Grp_Aff_Rsp(uint32_t srcId, uint32_t dstI
// validate the source RID
if (!acl::AccessControl::validateSrcId(srcId)) {
LogWarning(LOG_RF, P25_TSDU_STR ", %s denial, RID rejection, srcId = %u", iosp->toString().c_str(), srcId);
::ActivityLog("P25", true, "group affiliation request from %u to %s %u denied", srcId, "TG ", dstId);
::ActivityLogEx(LOG_P25, true, "group affiliation request from %u to %s %u denied", srcId, "TG ", dstId);
if (m_p25->m_affiliations->groupUnaff(srcId) && m_p25->m_network != nullptr)
m_p25->m_network->announceGroupAffiliationRemoval(srcId);
@ -3571,7 +3570,7 @@ uint8_t ControlSignaling::writeRF_TSDU_Grp_Aff_Rsp(uint32_t srcId, uint32_t dstI
// validate the source RID
if (!acl::AccessControl::validateSrcId(srcId)) {
LogWarning(LOG_RF, P25_TSDU_STR ", %s denial, RID rejection, srcId = %u", iosp->toString().c_str(), srcId);
::ActivityLog("P25", true, "unit registration request from %u denied", srcId);
::ActivityLogEx(LOG_P25, true, "unit registration request from %u denied", srcId);
iosp->setResponse(ResponseCode::REFUSED);
noNet = true;
}
@ -3589,7 +3588,7 @@ uint8_t ControlSignaling::writeRF_TSDU_Grp_Aff_Rsp(uint32_t srcId, uint32_t dstI
// validate the source RID is registered
if (!m_p25->m_affiliations->isUnitReg(srcId) && m_verifyReg) {
LogWarning(LOG_RF, P25_TSDU_STR ", %s denial, RID not registered, srcId = %u", iosp->toString().c_str(), srcId);
::ActivityLog("P25", true, "group affiliation request from %u to %s %u denied", srcId, "TG ", dstId);
::ActivityLogEx(LOG_P25, true, "group affiliation request from %u to %s %u denied", srcId, "TG ", dstId);
if (m_p25->m_affiliations->groupUnaff(srcId) && m_p25->m_network != nullptr)
m_p25->m_network->announceGroupAffiliationRemoval(srcId);
@ -3606,7 +3605,7 @@ uint8_t ControlSignaling::writeRF_TSDU_Grp_Aff_Rsp(uint32_t srcId, uint32_t dstI
else {
if (!acl::AccessControl::validateTGId(dstId)) {
LogWarning(LOG_RF, P25_TSDU_STR ", %s denial, TGID rejection, dstId = %u", iosp->toString().c_str(), dstId);
::ActivityLog("P25", true, "group affiliation request from %u to %s %u denied", srcId, "TG ", dstId);
::ActivityLogEx(LOG_P25, true, "group affiliation request from %u to %s %u denied", srcId, "TG ", dstId);
iosp->setResponse(ResponseCode::DENY);
noNet = true;
}
@ -3614,7 +3613,7 @@ uint8_t ControlSignaling::writeRF_TSDU_Grp_Aff_Rsp(uint32_t srcId, uint32_t dstI
// check if the source RID has access to the specified talkgroup ID
if (!acl::AccessControl::validateTGAccess(srcId, dstId)) {
LogWarning(LOG_RF, P25_TSDU_STR ", %s denial, RID not admitted to TGID, srcId = %u, dstId = %u", iosp->toString().c_str(), srcId, dstId);
::ActivityLog("P25", true, "group affiliation request from %u to TG %u denied", srcId, dstId);
::ActivityLogEx(LOG_P25, true, "group affiliation request from %u to TG %u denied", srcId, dstId);
iosp->setResponse(ResponseCode::DENY);
noNet = true;
}
@ -3622,7 +3621,7 @@ uint8_t ControlSignaling::writeRF_TSDU_Grp_Aff_Rsp(uint32_t srcId, uint32_t dstI
// deny affiliation if the TG is non-preferred on this site/CC
if (acl::AccessControl::tgidNonPreferred(dstId)) {
LogWarning(LOG_RF, P25_TSDU_STR ", %s non-preferred on this site, TGID rejection, dstId = %u", iosp->toString().c_str(), dstId);
::ActivityLog("P25", true, "group affiliation request from %u to %s %u denied", srcId, "TG ", dstId);
::ActivityLogEx(LOG_P25, true, "group affiliation request from %u to %s %u denied", srcId, "TG ", dstId);
iosp->setResponse(ResponseCode::DENY);
noNet = true;
}
@ -3634,7 +3633,7 @@ uint8_t ControlSignaling::writeRF_TSDU_Grp_Aff_Rsp(uint32_t srcId, uint32_t dstI
iosp->toString().c_str(), m_announcementGroup, srcId, dstId);
}
::ActivityLog("P25", true, "group affiliation request from %u to %s %u", srcId, "TG ", dstId);
::ActivityLogEx(LOG_P25, true, "group affiliation request from %u to %s %u", srcId, "TG ", dstId);
// update dynamic affiliation table
m_p25->m_affiliations->groupAff(srcId, dstId);
@ -3674,14 +3673,14 @@ void ControlSignaling::writeRF_TSDU_U_Reg_Rsp(uint32_t srcId, uint32_t sysId)
// validate the system ID
if (sysId != m_p25->m_siteData.sysId()) {
LogWarning(LOG_RF, P25_TSDU_STR ", %s denial, SYSID rejection, sysId = $%03X", iosp->toString().c_str(), sysId);
::ActivityLog("P25", true, "unit registration request from %u denied", srcId);
::ActivityLogEx(LOG_P25, true, "unit registration request from %u denied", srcId);
iosp->setResponse(ResponseCode::DENY);
}
// validate the source RID
if (!acl::AccessControl::validateSrcId(srcId)) {
LogWarning(LOG_RF, P25_TSDU_STR ", %s denial, RID rejection, srcId = %u", iosp->toString().c_str(), srcId);
::ActivityLog("P25", true, "unit registration request from %u denied", srcId);
::ActivityLogEx(LOG_P25, true, "unit registration request from %u denied", srcId);
iosp->setResponse(ResponseCode::REFUSED);
}
@ -3690,7 +3689,7 @@ void ControlSignaling::writeRF_TSDU_U_Reg_Rsp(uint32_t srcId, uint32_t sysId)
LogInfoEx(LOG_RF, P25_TSDU_STR ", %s, srcId = %u, sysId = $%03X", iosp->toString().c_str(), srcId, sysId);
}
::ActivityLog("P25", true, "unit registration request from %u", srcId);
::ActivityLogEx(LOG_P25, true, "unit registration request from %u", srcId);
// update dynamic unit registration table
if (!m_p25->m_affiliations->isUnitReg(srcId)) {
@ -3728,7 +3727,7 @@ void ControlSignaling::writeRF_TSDU_U_Dereg_Ack(uint32_t srcId)
LogInfoEx(LOG_RF, P25_TSDU_STR ", %s, srcId = %u", osp->toString().c_str(), srcId);
}
::ActivityLog("P25", true, "unit deregistration request from %u", srcId);
::ActivityLogEx(LOG_P25, true, "unit deregistration request from %u", srcId);
writeRF_TSDU_SBF_Imm(osp.get(), false);
@ -3779,7 +3778,7 @@ bool ControlSignaling::writeRF_TSDU_Loc_Reg_Rsp(uint32_t srcId, uint32_t dstId,
// validate the source RID
if (!acl::AccessControl::validateSrcId(srcId)) {
LogWarning(LOG_RF, P25_TSDU_STR ", %s denial, RID rejection, srcId = %u", osp->toString().c_str(), srcId);
::ActivityLog("P25", true, "location registration request from %u denied", srcId);
::ActivityLogEx(LOG_P25, true, "location registration request from %u denied", srcId);
osp->setResponse(ResponseCode::REFUSED);
noNet = true;
}
@ -3787,7 +3786,7 @@ bool ControlSignaling::writeRF_TSDU_Loc_Reg_Rsp(uint32_t srcId, uint32_t dstId,
// validate the source RID is registered
if (!m_p25->m_affiliations->isUnitReg(srcId)) {
LogWarning(LOG_RF, P25_TSDU_STR ", %s denial, RID not registered, srcId = %u", osp->toString().c_str(), srcId);
::ActivityLog("P25", true, "location registration request from %u denied", srcId);
::ActivityLogEx(LOG_P25, true, "location registration request from %u denied", srcId);
writeRF_TSDU_U_Reg_Cmd(srcId);
return false;
}
@ -3800,7 +3799,7 @@ bool ControlSignaling::writeRF_TSDU_Loc_Reg_Rsp(uint32_t srcId, uint32_t dstId,
else {
if (!acl::AccessControl::validateTGId(dstId)) {
LogWarning(LOG_RF, P25_TSDU_STR ", %s denial, TGID rejection, dstId = %u", osp->toString().c_str(), dstId);
::ActivityLog("P25", true, "location registration request from %u to %s %u denied", srcId, "TG ", dstId);
::ActivityLogEx(LOG_P25, true, "location registration request from %u to %s %u denied", srcId, "TG ", dstId);
osp->setResponse(ResponseCode::DENY);
noNet = true;
}
@ -3808,7 +3807,7 @@ bool ControlSignaling::writeRF_TSDU_Loc_Reg_Rsp(uint32_t srcId, uint32_t dstId,
// check if the source RID has access to the specified talkgroup ID
if (!acl::AccessControl::validateTGAccess(srcId, dstId)) {
LogWarning(LOG_RF, P25_TSDU_STR ", %s denial, RID not admitted to TGID, srcId = %u, dstId = %u", osp->toString().c_str(), srcId, dstId);
::ActivityLog("P25", true, "location registration request from %u to TG %u denied", srcId, dstId);
::ActivityLogEx(LOG_P25, true, "location registration request from %u to TG %u denied", srcId, dstId);
osp->setResponse(ResponseCode::DENY);
noNet = true;
}
@ -3816,7 +3815,7 @@ bool ControlSignaling::writeRF_TSDU_Loc_Reg_Rsp(uint32_t srcId, uint32_t dstId,
// deny affiliation if the TG is non-preferred on this site/CC
if (acl::AccessControl::tgidNonPreferred(dstId)) {
LogWarning(LOG_RF, P25_TSDU_STR ", %s non-preferred on this site, TGID rejection, dstId = %u", osp->toString().c_str(), dstId);
::ActivityLog("P25", true, "location registration request from %u to %s %u denied", srcId, "TG ", dstId);
::ActivityLogEx(LOG_P25, true, "location registration request from %u to %s %u denied", srcId, "TG ", dstId);
osp->setResponse(ResponseCode::DENY);
noNet = true;
}
@ -3828,7 +3827,7 @@ bool ControlSignaling::writeRF_TSDU_Loc_Reg_Rsp(uint32_t srcId, uint32_t dstId,
LogInfoEx(LOG_RF, P25_TSDU_STR ", %s, srcId = %u, dstId = %u", osp->toString().c_str(), srcId, dstId);
}
::ActivityLog("P25", true, "location registration request from %u", srcId);
::ActivityLogEx(LOG_P25, true, "location registration request from %u", srcId);
// update dynamic affiliation table
m_p25->m_affiliations->groupAff(srcId, dstId);

@ -20,7 +20,6 @@
#include "common/Log.h"
#include "common/Utils.h"
#include "p25/packet/Data.h"
#include "ActivityLog.h"
using namespace p25;
using namespace p25::defines;
@ -389,7 +388,7 @@ bool Data::process(uint8_t* data, uint32_t len)
// only repeat the PDU locally if the packet isn't for the FNE
if (m_repeatPDU && m_rfAssembler->dataHeader.getLLId() != WUID_FNE) {
::ActivityLog("P25", true, "RF data transmission from %u to %u, %u blocks", srcId, dstId, m_rfAssembler->dataHeader.getBlocksToFollow());
::ActivityLogEx(LOG_P25, true, "RF data transmission from %u to %u, %u blocks", srcId, dstId, m_rfAssembler->dataHeader.getBlocksToFollow());
LogInfoEx(LOG_RF, "P25 Data Call (Local Repeat), srcId = %u, dstId = %u", srcId, dstId);
if (m_verbose) {
@ -397,7 +396,7 @@ bool Data::process(uint8_t* data, uint32_t len)
}
writeRF_PDU_Buffered(); // re-generate buffered PDU and send it on
::ActivityLog("P25", true, "end of RF data transmission");
::ActivityLogEx(LOG_P25, true, "end of RF data transmission");
}
break;
}
@ -599,7 +598,7 @@ bool Data::processNetwork(uint8_t* data, uint32_t len, uint8_t currentBlock, uin
}
break;
default:
::ActivityLog("P25", false, "Net data transmission from %u to %u, %u blocks", srcId, dstId, m_netAssembler->dataHeader.getBlocksToFollow());
::ActivityLogEx(LOG_P25, false, "Net data transmission from %u to %u, %u blocks", srcId, dstId, m_netAssembler->dataHeader.getBlocksToFollow());
LogInfoEx(LOG_NET, "P25 Data Call, srcId = %u, dstId = %u", srcId, dstId);
if (m_verbose) {
@ -608,7 +607,7 @@ bool Data::processNetwork(uint8_t* data, uint32_t len, uint8_t currentBlock, uin
rfAccepted = writeNet_PDU_Buffered(); // re-generate buffered PDU and send it on
::ActivityLog("P25", false, "end of Net data transmission");
::ActivityLogEx(LOG_P25, false, "end of Net data transmission");
break;
}

@ -20,7 +20,6 @@
#include "common/Log.h"
#include "common/Utils.h"
#include "p25/packet/Voice.h"
#include "ActivityLog.h"
#include "HostMain.h"
using namespace p25;
@ -295,7 +294,7 @@ bool Voice::process(uint8_t* data, uint32_t len)
m_p25->m_control->denialInhibit(srcId);
}
::ActivityLog("P25", true, "RF voice rejection from %u to %s%u ", srcId, group ? "TG " : "", dstId);
::ActivityLogEx(LOG_P25, true, "RF voice rejection from %u to %s%u ", srcId, group ? "TG " : "", dstId);
m_lastRejectId = srcId;
}
@ -316,7 +315,7 @@ bool Voice::process(uint8_t* data, uint32_t len)
m_p25->m_control->writeRF_TSDU_Deny(srcId, dstId, ReasonCode::DENY_TGT_UNIT_NOT_VALID, TSBKO::IOSP_UU_VCH, false, true);
}
::ActivityLog("P25", true, "RF voice rejection from %u to %s%u ", srcId, group ? "TG " : "", dstId);
::ActivityLogEx(LOG_P25, true, "RF voice rejection from %u to %s%u ", srcId, group ? "TG " : "", dstId);
m_lastRejectId = dstId;
}
@ -336,7 +335,7 @@ bool Voice::process(uint8_t* data, uint32_t len)
m_p25->m_control->writeRF_TSDU_Deny(srcId, dstId, ReasonCode::DENY_TGT_GROUP_NOT_VALID, TSBKO::IOSP_GRP_VCH, true, true);
}
::ActivityLog("P25", true, "RF voice rejection from %u to %s%u ", srcId, group ? "TG " : "", dstId);
::ActivityLogEx(LOG_P25, true, "RF voice rejection from %u to %s%u ", srcId, group ? "TG " : "", dstId);
m_lastRejectId = dstId;
}
@ -353,7 +352,7 @@ bool Voice::process(uint8_t* data, uint32_t len)
if (groupVoice.config().strapping() == ::lookups::TG_STRAPPING_STRAPPED) {
if (!lc.getEncrypted()) {
LogWarning(LOG_RF, "P25, " P25_HDU_STR " denial, TGID enc. strapping rejection, srcId = %u, dstId = %u", srcId, dstId);
::ActivityLog("P25", true, "RF voice rejection from %u to %s%u ", srcId, group ? "TG " : "", dstId);
::ActivityLogEx(LOG_P25, true, "RF voice rejection from %u to %s%u ", srcId, group ? "TG " : "", dstId);
m_p25->m_rfLastDstId = 0U;
m_p25->m_rfLastSrcId = 0U;
@ -380,7 +379,7 @@ bool Voice::process(uint8_t* data, uint32_t len)
m_p25->m_control->writeRF_TSDU_Deny(srcId, dstId, ReasonCode::DENY_REQ_UNIT_NOT_AUTH, TSBKO::IOSP_GRP_VCH, true, true);
m_p25->m_control->writeRF_TSDU_U_Reg_Cmd(srcId);
::ActivityLog("P25", true, "RF voice rejection from %u to %s%u ", srcId, group ? "TG " : "", dstId);
::ActivityLogEx(LOG_P25, true, "RF voice rejection from %u to %s%u ", srcId, group ? "TG " : "", dstId);
m_lastRejectId = srcId;
}
@ -417,7 +416,7 @@ bool Voice::process(uint8_t* data, uint32_t len)
hduEncrypt = encrypted;
m_lastRejectId = 0U;
::ActivityLog("P25", true, "RF %svoice transmission from %u to %s%u", encrypted ? "encrypted ": "", srcId, group ? "TG " : "", dstId);
::ActivityLogEx(LOG_P25, true, "RF %svoice transmission from %u to %s%u", encrypted ? "encrypted ": "", srcId, group ? "TG " : "", dstId);
LogInfoEx(LOG_RF, "P25 Voice Call, srcId = %u, dstId = %u", srcId, dstId);
uint8_t serviceOptions = (m_rfLC.getEmergency() ? 0x80U : 0x00U) + // Emergency Flag
@ -1011,7 +1010,7 @@ bool Voice::process(uint8_t* data, uint32_t len)
m_inbound = true;
m_lastRejectId = 0U;
::ActivityLog("P25", true, "RF VSELP voice transmission");
::ActivityLogEx(LOG_P25, true, "RF VSELP voice transmission");
m_hadVoice = true;
@ -1192,12 +1191,12 @@ bool Voice::process(uint8_t* data, uint32_t len)
if (m_p25->m_rfState == RS_RF_AUDIO) {
if (m_p25->m_rssi != 0U) {
::ActivityLog("P25", true, "RF end of transmission, %.1f seconds, BER: %.1f%%, RSSI : -%u / -%u / -%u dBm",
::ActivityLogEx(LOG_P25, true, "RF end of transmission, %.1f seconds, BER: %.1f%%, RSSI : -%u / -%u / -%u dBm",
float(m_rfFrames) / 5.56F, float(m_rfErrs * 100U) / float(m_rfBits), m_p25->m_minRSSI, m_p25->m_maxRSSI,
m_p25->m_aveRSSI / m_p25->m_rssiCount);
}
else {
::ActivityLog("P25", true, "RF end of transmission, %.1f seconds, BER: %.1f%%",
::ActivityLogEx(LOG_P25, true, "RF end of transmission, %.1f seconds, BER: %.1f%%",
float(m_rfFrames) / 5.56F, float(m_rfErrs * 100U) / float(m_rfBits));
}
@ -1760,11 +1759,11 @@ void Voice::writeNet_TDU()
}
if (m_netFrames > 0) {
::ActivityLog("P25", false, "network end of transmission, %.1f seconds, %u%% packet loss",
::ActivityLogEx(LOG_P25, false, "network end of transmission, %.1f seconds, %u%% packet loss",
float(m_netFrames) / 50.0F, (m_netLost * 100U) / m_netFrames);
}
else {
::ActivityLog("P25", false, "network end of transmission, %u frames", m_netFrames);
::ActivityLogEx(LOG_P25, false, "network end of transmission, %u frames", m_netFrames);
}
if (m_p25->m_network != nullptr)
@ -1915,7 +1914,7 @@ void Voice::writeNet_LDU1()
m_p25->writeRF_Preamble();
::ActivityLog("P25", false, "network %svoice transmission from %u to %s%u", m_netLC.getEncrypted() ? "encrypted " : "", srcId, group ? "TG " : "", dstId);
::ActivityLogEx(LOG_P25, false, "network %svoice transmission from %u to %s%u", m_netLC.getEncrypted() ? "encrypted " : "", srcId, group ? "TG " : "", dstId);
LogInfoEx(LOG_NET, "P25 Voice Call, srcId = %u, dstId = %u", srcId, dstId);
// conventional registration or DVRS support?

@ -14,7 +14,6 @@
#include "common/Utils.h"
#include "p25/phase2/Slot.h"
#include "p25/phase2/Control.h"
#include "ActivityLog.h"
using namespace p25::phase2;
using namespace p25::defines;

@ -1,127 +0,0 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Digital Voice Modem - TG Patch
* GPLv2 Open Source. Use is subject to license terms.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright (C) 2025 Bryan Biedenkapp, N2PLL
*
*/
#include "ActivityLog.h"
#include "common/network/BaseNetwork.h"
#include "common/Log.h" // for CurrentLogFileLevel() and LogGetNetwork()
#if defined(CATCH2_TEST_COMPILATION)
#include <catch2/catch_test_macros.hpp>
#endif
#include <cstdio>
#include <cstdarg>
#include <ctime>
#include <cassert>
#include <cstring>
// ---------------------------------------------------------------------------
// Constants
// ---------------------------------------------------------------------------
#define EOL "\r\n"
const uint32_t ACT_LOG_BUFFER_LEN = 501U;
// ---------------------------------------------------------------------------
// Global Variables
// ---------------------------------------------------------------------------
static std::string g_actFilePath;
static std::string g_actFileRoot;
static FILE* g_actFpLog = nullptr;
static struct tm g_actTm;
// ---------------------------------------------------------------------------
// Global Functions
// ---------------------------------------------------------------------------
/* Helper to open the activity log file, file handle. */
static bool ActivityLogOpen()
{
if (CurrentLogFileLevel() == 0U)
return true;
time_t now;
::time(&now);
struct tm* tm = ::gmtime(&now);
if (tm->tm_mday == g_actTm.tm_mday && tm->tm_mon == g_actTm.tm_mon && tm->tm_year == g_actTm.tm_year) {
if (g_actFpLog != nullptr)
return true;
}
else {
if (g_actFpLog != nullptr)
::fclose(g_actFpLog);
}
char filename[200U];
::sprintf(filename, "%s/%s-%04d-%02d-%02d.activity.log", LogGetFilePath().c_str(), LogGetFileRoot().c_str(), tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday);
g_actFpLog = ::fopen(filename, "a+t");
g_actTm = *tm;
return g_actFpLog != nullptr;
}
/* Initializes the activity log. */
bool ActivityLogInitialise(const std::string& filePath, const std::string& fileRoot)
{
#if defined(CATCH2_TEST_COMPILATION)
return true;
#endif
g_actFilePath = filePath;
g_actFileRoot = fileRoot;
return ::ActivityLogOpen();
}
/* Finalizes the activity log. */
void ActivityLogFinalise()
{
#if defined(CATCH2_TEST_COMPILATION)
return;
#endif
if (g_actFpLog != nullptr)
::fclose(g_actFpLog);
}
/* Writes a new entry to the activity log. */
void log_internal::ActivityLogInternal(const std::string& log)
{
#if defined(CATCH2_TEST_COMPILATION)
return;
#endif
bool ret = ::ActivityLogOpen();
if (!ret)
return;
if (CurrentLogFileLevel() == 0U)
return;
if (LogGetNetwork() != nullptr) {
network::BaseNetwork* network = (network::BaseNetwork*)LogGetNetwork();
network->writeActLog(log.c_str());
}
::fprintf(g_actFpLog, "%s\n", log.c_str());
::fflush(g_actFpLog);
if (2U >= g_logDisplayLevel && g_logDisplayLevel != 0U) {
::fprintf(stdout, "%s" EOL, log.c_str());
::fflush(stdout);
}
}

@ -1,94 +0,0 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Digital Voice Modem - TG Patch
* GPLv2 Open Source. Use is subject to license terms.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright (C) 2025 Bryan Biedenkapp, N2PLL
*
*/
/**
* @file ActivityLog.h
* @ingroup patch
* @file ActivityLog.cpp
* @ingroup patch
*/
#if !defined(__ACTIVITY_LOG_H__)
#define __ACTIVITY_LOG_H__
#include "Defines.h"
#if defined(_WIN32)
#include "common/Clock.h"
#else
#include <sys/time.h>
#endif // defined(_WIN32)
#include <string>
// ---------------------------------------------------------------------------
// Global Functions
// ---------------------------------------------------------------------------
namespace log_internal
{
/**
* @brief Writes a new entry to the diagnostics log.
* @param level Log level for entry.
* @param log Fully formatted log message.
*/
extern HOST_SW_API void ActivityLogInternal(const std::string& log);
} // namespace log_internal
/**
* @brief Initializes the activity log.
* @param filePath File path for the log file.
* @param fileRoot Root name for log file.
*/
extern HOST_SW_API bool ActivityLogInitialise(const std::string& filePath, const std::string& fileRoot);
/**
* @brief Finalizes the activity log.
*/
extern HOST_SW_API void ActivityLogFinalise();
/**
* @brief Writes a new entry to the diagnostics log.
* @param fmt String format.
*
* This is a variable argument function. This shouldn't be called directly, utilize the LogXXXX macros above, instead.
*/
template<typename ... Args>
HOST_SW_API void ActivityLog(const std::string& fmt, Args... args)
{
using namespace log_internal;
int size_s = std::snprintf(nullptr, 0, fmt.c_str(), args...) + 1; // Extra space for '\0'
if (size_s <= 0) {
throw std::runtime_error("Error during formatting.");
}
int prefixLen = 0;
char prefixBuf[256];
time_t now;
::time(&now);
struct tm* tm = ::localtime(&now);
struct timeval nowMillis;
::gettimeofday(&nowMillis, NULL);
prefixLen = ::sprintf(prefixBuf, "A: %04d-%02d-%02d %02d:%02d:%02d.%03lu ",
tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec, nowMillis.tv_usec / 1000U);
auto size = static_cast<size_t>(size_s);
auto buf = std::make_unique<char[]>(size);
std::snprintf(buf.get(), size, fmt.c_str(), args ...);
std::string prefix = std::string(prefixBuf, prefixBuf + prefixLen);
std::string msg = std::string(buf.get(), buf.get() + size - 1);
ActivityLogInternal(std::string(prefix + msg));
}
#endif // __ACTIVITY_LOG_H__

@ -27,7 +27,6 @@
#include "common/Thread.h"
#include "common/Log.h"
#include "common/Utils.h"
#include "patch/ActivityLog.h"
#include "HostPatch.h"
#include "PatchMain.h"
@ -160,11 +159,6 @@ int HostPatch::run()
::fatal("unable to open the log file\n");
}
ret = ::ActivityLogInitialise(logConf["activityFilePath"].as<std::string>(), logConf["fileRoot"].as<std::string>());
if (!ret) {
::fatal("unable to open the activity log file\n");
}
#if !defined(_WIN32)
// handle POSIX process forking
if (m_daemon) {

@ -9,7 +9,6 @@
*/
#include "Defines.h"
#include "common/Log.h"
#include "patch/ActivityLog.h"
#include "PatchMain.h"
#include "HostPatch.h"
@ -225,7 +224,6 @@ int main(int argc, char** argv)
} while (g_signal == SIGHUP);
::LogFinalise();
::ActivityLogFinalise();
return ret;
}

@ -8,6 +8,7 @@
*
*/
#include "Defines.h"
#include "common/LogAsync.h"
#include "common/Thread.h"
#include <catch2/catch_test_macros.hpp>
@ -16,6 +17,34 @@
#include <chrono>
#include <condition_variable>
#include <mutex>
#include <string>
#include <vector>
using namespace log_internal;
// ---------------------------------------------------------------------------
// Global Variables
// ---------------------------------------------------------------------------
static std::mutex g_logSinkMutex;
static std::condition_variable g_logSinkChanged;
static std::vector<std::string> g_logSinkMessages;
// ---------------------------------------------------------------------------
// Global Functions
// ---------------------------------------------------------------------------
/* Captures an asynchronous log message for verification. */
static void captureLogMessage(const char* message)
{
{
std::lock_guard<std::mutex> lock(g_logSinkMutex);
g_logSinkMessages.emplace_back(message);
}
g_logSinkChanged.notify_all();
}
// ---------------------------------------------------------------------------
// Class Declaration
@ -122,6 +151,62 @@ bool waitForFlag(std::mutex& mutex, std::condition_variable& cond, bool& flag, u
return cond.wait_for(lock, std::chrono::milliseconds(timeoutMs), [&flag]() { return flag; });
}
TEST_CASE("LogAsync delivers queued messages in order", "[common][logging]")
{
{
std::lock_guard<std::mutex> lock(g_logSinkMutex);
g_logSinkMessages.clear();
}
LogAsync logger;
REQUIRE(logger.start());
logger.log("first", captureLogMessage);
logger.log("second", captureLogMessage);
logger.log("third", captureLogMessage);
std::unique_lock<std::mutex> lock(g_logSinkMutex);
REQUIRE(g_logSinkChanged.wait_for(lock, std::chrono::seconds(1), []() { return g_logSinkMessages.size() == 3U; }));
REQUIRE(g_logSinkMessages == std::vector<std::string> { "first", "second", "third" });
}
TEST_CASE("LogAsync stop drains accepted messages", "[common][logging]")
{
{
std::lock_guard<std::mutex> lock(g_logSinkMutex);
g_logSinkMessages.clear();
}
LogAsync logger;
REQUIRE(logger.start());
logger.log("before-stop-1", captureLogMessage);
logger.log("before-stop-2", captureLogMessage);
logger.stop();
std::lock_guard<std::mutex> lock(g_logSinkMutex);
REQUIRE(g_logSinkMessages == std::vector<std::string> { "before-stop-1", "before-stop-2" });
}
TEST_CASE("LogAsync rejects invalid messages and ignores logging while stopped", "[common][logging]")
{
{
std::lock_guard<std::mutex> lock(g_logSinkMutex);
g_logSinkMessages.clear();
}
LogAsync logger;
logger.log("not-started", captureLogMessage);
REQUIRE(logger.start());
logger.log(std::string(LOG_ASYNC_LENGTH, 'x'), captureLogMessage);
logger.log("null-sink", nullptr);
logger.stop();
logger.log("already-stopped", captureLogMessage);
std::lock_guard<std::mutex> lock(g_logSinkMutex);
REQUIRE(g_logSinkMessages.empty());
}
TEST_CASE("Thread runs entry once and wait joins", "[common][thread]")
{
std::atomic<uint32_t> entryCount { 0U };
@ -203,4 +288,4 @@ TEST_CASE("Thread sleep delays execution", "[common][thread]")
const auto elapsedMs = std::chrono::duration_cast<std::chrono::milliseconds>(end - begin).count();
REQUIRE(elapsedMs >= 5);
}
}

@ -48,7 +48,7 @@ public:
talkgroups("", 0U, true, false),
traffic(&host, "127.0.0.1", 62031U, 999999U, "test-password", "test-fne",
false, false, false, false, true, true, true, true, true,
0U, false, true, true, 5U, 10U, 2U),
0U, false, true, true, true, 5U, 10U, 2U),
metadata(&host, &traffic, "127.0.0.1", 62032U, 2U)
{
traffic.setLookups(&radios, nullptr, &talkgroups, nullptr, nullptr, nullptr);

@ -35,7 +35,7 @@ public:
host("p25-telephone-fne-test.yml"),
traffic(&host, "127.0.0.1", 62041U, 999999U, "test-password", "test-fne",
false, false, false, false, true, true, true, true, true,
0U, false, true, true, 5U, 10U, 2U),
0U, false, true, true, true, 5U, 10U, 2U),
peers("p25-telephone-peers.dat", 0U, true, false)
{
traffic.setLookups(nullptr, nullptr, nullptr, &peers, nullptr, nullptr);

@ -8,6 +8,7 @@
*
*/
#include "Defines.h"
#include "common/Log.h"
#include "common/network/FrameQueue.h"
#include "common/network/Network.h"
#include "common/network/RTPFNEHeader.h"
@ -19,6 +20,8 @@
#include <array>
#include <chrono>
#include <cstdio>
#include <ctime>
#include <cstring>
#include <string>
#include <thread>
@ -839,6 +842,40 @@ TEST_CASE("BaseNetwork emits transfer and status frames over the metadata path w
REQUIRE(fneHeader.getSubFunction() == NET_SUBFUNC::TRANSFER_SUBFUNC_DIAG);
REQUIRE(payload.find("diagnostic-test") != std::string::npos);
const auto uniqueLogId = std::chrono::steady_clock::now().time_since_epoch().count();
const std::string logRoot = "dvm-log-transfer-test-" + std::to_string(uniqueLogId);
REQUIRE(LogInitialise(".", logRoot, 1U, 0U, false, false));
LogSetNetwork(&network);
ActivityLog("activity-wrapper-%u", 42U);
REQUIRE(waitForFrameMessage(metadataReceiverQueue, payload, rtpHeader, fneHeader));
REQUIRE(fneHeader.getFunction() == NET_FUNC::TRANSFER);
REQUIRE(fneHeader.getSubFunction() == NET_SUBFUNC::TRANSFER_SUBFUNC_ACTIVITY);
REQUIRE(payload.find("activity-wrapper-42") != std::string::npos);
ActivityLogEx("P25", true, "activity-ex-wrapper-%u", 24U);
REQUIRE(waitForFrameMessage(metadataReceiverQueue, payload, rtpHeader, fneHeader));
REQUIRE(fneHeader.getFunction() == NET_FUNC::TRANSFER);
REQUIRE(fneHeader.getSubFunction() == NET_SUBFUNC::TRANSFER_SUBFUNC_ACTIVITY);
REQUIRE(payload.find("P25 RF activity-ex-wrapper-24") != std::string::npos);
log_internal::LogInternal(2U, "diagnostic-wrapper-test");
REQUIRE(waitForFrameMessage(metadataReceiverQueue, payload, rtpHeader, fneHeader));
REQUIRE(fneHeader.getFunction() == NET_FUNC::TRANSFER);
REQUIRE(fneHeader.getSubFunction() == NET_SUBFUNC::TRANSFER_SUBFUNC_DIAG);
REQUIRE(payload.find("diagnostic-wrapper-test") != std::string::npos);
LogSetNetwork(nullptr);
LogFinalise();
time_t now;
::time(&now);
struct tm* tm = ::localtime(&now);
char logFilename[256U];
::snprintf(logFilename, sizeof(logFilename), "./%s-%04d-%02d-%02d.log", logRoot.c_str(),
tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday);
REQUIRE(::remove(logFilename) == 0);
json::object statusObj;
REQUIRE(network.writePeerStatus(statusObj));
REQUIRE(waitForFrameMessage(metadataReceiverQueue, payload, rtpHeader, fneHeader));

@ -56,7 +56,7 @@ public:
rid("", 0U, false, false),
traffic(&host, "127.0.0.1", 62031U, 999999U, "test-password", "test-fne",
false, false, false, false, true, true, true, true, true,
0U, false, true, true, 5U, 10U, 2U)
0U, false, true, true, true, 5U, 10U, 2U)
{
traffic.setLookups(&rid, nullptr, nullptr, nullptr, &crypto, nullptr);
}

Loading…
Cancel
Save

Powered by TurnKey Linux.