From 074dc5d118e26d370b56441048d94b9cb6b39426 Mon Sep 17 00:00:00 2001 From: Bryan Biedenkapp Date: Tue, 24 Nov 2026 10:41:58 -0500 Subject: [PATCH] preserve 32-bit subscriber operation request and result values across metadata and REST responses, retain explicit P25 message field narrowing, and add regression coverage for values above 16 bits; --- src/fne/network/packet/SubscriberOperation.cpp | 14 +++++++------- src/fne/restapi/RESTAPI.cpp | 8 ++++---- tests/fne/FNENetwork_Tests.cpp | 2 +- tests/fne/SubscriberOperationStore_Tests.cpp | 12 +++++++----- 4 files changed, 19 insertions(+), 17 deletions(-) diff --git a/src/fne/network/packet/SubscriberOperation.cpp b/src/fne/network/packet/SubscriberOperation.cpp index d365a7ab..fedb6225 100644 --- a/src/fne/network/packet/SubscriberOperation.cpp +++ b/src/fne/network/packet/SubscriberOperation.cpp @@ -124,7 +124,7 @@ void MetadataNetwork::PacketHandler::subscriberOperation(TrafficNetwork* network SubscriberOperationStore::Protocol protocol; SubscriberOperationStore::Kind kind; - uint16_t requestValue = 0U; + uint32_t requestValue = 0U; if (protocolName == SOP_P25) { protocol = SubscriberOperationStore::Protocol::P25; @@ -204,7 +204,7 @@ void MetadataNetwork::PacketHandler::subscriberOperation(TrafficNetwork* network network->p25TrafficHandler()->write_TSDU_Status_Query(operationPeerId, targetId); break; case SubscriberOperationStore::Kind::MESSAGE_UPDATE: - network->p25TrafficHandler()->write_TSDU_Message_Update(operationPeerId, targetId, requestValue); + network->p25TrafficHandler()->write_TSDU_Message_Update(operationPeerId, targetId, static_cast(requestValue)); break; case SubscriberOperationStore::Kind::INHIBIT: network->p25TrafficHandler()->write_TSDU_Ext_Func(operationPeerId, @@ -239,7 +239,7 @@ void MetadataNetwork::PacketHandler::subscriberOperation(TrafficNetwork* network response["state"].set("pending"); response["targetId"].set(targetId); response["peerId"].set(operationPeerId); - response["requestValue"].set(requestValue); + response["requestValue"].set(requestValue); } break; @@ -269,8 +269,8 @@ void MetadataNetwork::PacketHandler::subscriberOperation(TrafficNetwork* network response["state"].set(SubscriberOperationStore::stateName(operation.state)); response["targetId"].set(operation.targetId); response["peerId"].set(operation.peerId); - response["requestValue"].set(operation.requestValue); - response["resultValue"].set(operation.resultValue); + response["requestValue"].set(operation.requestValue); + response["resultValue"].set(operation.resultValue); response["createdAt"].set(operation.createdAt); response["completedAt"].set(operation.completedAt); } @@ -287,8 +287,8 @@ void MetadataNetwork::PacketHandler::subscriberOperation(TrafficNetwork* network operationObj["state"].set(SubscriberOperationStore::stateName(historyOperation.state)); operationObj["targetId"].set(historyOperation.targetId); operationObj["peerId"].set(historyOperation.peerId); - operationObj["requestValue"].set(historyOperation.requestValue); - operationObj["resultValue"].set(historyOperation.resultValue); + operationObj["requestValue"].set(historyOperation.requestValue); + operationObj["resultValue"].set(historyOperation.resultValue); operationObj["createdAt"].set(historyOperation.createdAt); operationObj["completedAt"].set(historyOperation.completedAt); operationHistory.push_back(json::value(operationObj)); diff --git a/src/fne/restapi/RESTAPI.cpp b/src/fne/restapi/RESTAPI.cpp index 39cc90ce..d6b19f0d 100644 --- a/src/fne/restapi/RESTAPI.cpp +++ b/src/fne/restapi/RESTAPI.cpp @@ -3111,8 +3111,8 @@ void RESTAPI::restAPI_GetRIDOperation(const HTTPPayload& request, HTTPPayload& r response["state"].set(SubscriberOperationStore::stateName(operation.state)); response["targetId"].set(operation.targetId); response["peerId"].set(operation.peerId); - response["requestValue"].set(operation.requestValue); - response["resultValue"].set(operation.resultValue); + response["requestValue"].set(operation.requestValue); + response["resultValue"].set(operation.resultValue); response["createdAt"].set(operation.createdAt); response["completedAt"].set(operation.completedAt); @@ -3142,8 +3142,8 @@ void RESTAPI::restAPI_GetRIDOperationHistory(const HTTPPayload& request, HTTPPay operationObj["state"].set(SubscriberOperationStore::stateName(operation.state)); operationObj["targetId"].set(operation.targetId); operationObj["peerId"].set(operation.peerId); - operationObj["requestValue"].set(operation.requestValue); - operationObj["resultValue"].set(operation.resultValue); + operationObj["requestValue"].set(operation.requestValue); + operationObj["resultValue"].set(operation.resultValue); operationObj["createdAt"].set(operation.createdAt); operationObj["completedAt"].set(operation.completedAt); operationHistory.push_back(json::value(operationObj)); diff --git a/tests/fne/FNENetwork_Tests.cpp b/tests/fne/FNENetwork_Tests.cpp index 70fd253c..a891cd4b 100644 --- a/tests/fne/FNENetwork_Tests.cpp +++ b/tests/fne/FNENetwork_Tests.cpp @@ -124,7 +124,7 @@ TEST_CASE("FNE metadata returns subscriber operation and P25 status results", CHECK(operationResponse["found"].get()); CHECK(operationResponse["operationId"].get() == operationId); CHECK(operationResponse["state"].get() == "succeeded"); - CHECK(operationResponse["resultValue"].get() == 0x1234U); + CHECK(operationResponse["resultValue"].get() == 0x1234U); REQUIRE(operationResponse["operations"].is()); json::array& operations = operationResponse["operations"].get(); REQUIRE(operations.size() == 1U); diff --git a/tests/fne/SubscriberOperationStore_Tests.cpp b/tests/fne/SubscriberOperationStore_Tests.cpp index 8cd4cb35..23bddc18 100644 --- a/tests/fne/SubscriberOperationStore_Tests.cpp +++ b/tests/fne/SubscriberOperationStore_Tests.cpp @@ -18,7 +18,7 @@ using namespace network; TEST_CASE("FNE subscriber operations correlate protocol results", "[fne][subscriber-operations]") { - SubscriberOperationStore store; + SubscriberOperationStore store(5U, 10U); const uint32_t targetId = 0x123456U; uint64_t operationId = store.start(SubscriberOperationStore::Protocol::P25, @@ -42,7 +42,7 @@ TEST_CASE("FNE subscriber operations correlate protocol results", "[fne][subscri TEST_CASE("FNE subscriber operations isolate protocols and kinds", "[fne][subscriber-operations]") { - SubscriberOperationStore store; + SubscriberOperationStore store(5U, 10U); const uint32_t targetId = 0x654321U; const uint64_t dmrId = store.start(SubscriberOperationStore::Protocol::DMR, SubscriberOperationStore::Kind::RADIO_CHECK, targetId, 0U); @@ -65,7 +65,7 @@ TEST_CASE("FNE subscriber operations isolate protocols and kinds", "[fne][subscr TEST_CASE("FNE subscriber operations return recent history newest first", "[fne][subscriber-operations]") { - SubscriberOperationStore store; + SubscriberOperationStore store(5U, 10U); const uint64_t firstId = store.start(SubscriberOperationStore::Protocol::DMR, SubscriberOperationStore::Kind::RADIO_CHECK, 1001U, 0U); const uint64_t secondId = store.start(SubscriberOperationStore::Protocol::P25, @@ -86,10 +86,10 @@ TEST_CASE("FNE subscriber operations return recent history newest first", "[fne] TEST_CASE("FNE subscriber one-shot operations retain every occurrence", "[fne][subscriber-operations]") { - SubscriberOperationStore store; + SubscriberOperationStore store(5U, 10U); const uint32_t targetId = 0x2345U; const uint64_t operationId = store.oneShot(SubscriberOperationStore::Protocol::NXDN, - SubscriberOperationStore::Kind::EMERG_CALL, targetId, 42U); + SubscriberOperationStore::Kind::EMERG_CALL, targetId, 42U, 0x123456U, 0xFEDCBAU); REQUIRE(operationId != 0U); const uint64_t duplicateId = store.oneShot(SubscriberOperationStore::Protocol::NXDN, @@ -106,6 +106,8 @@ TEST_CASE("FNE subscriber one-shot operations retain every occurrence", "[fne][s SubscriberOperationStore::Operation operation; REQUIRE(store.get(operationId, operation)); CHECK(operation.state == SubscriberOperationStore::State::SUCCEEDED); + CHECK(operation.requestValue == 0x123456U); + CHECK(operation.resultValue == 0xFEDCBAU); CHECK(operation.completedAt == operation.createdAt); CHECK(std::string(SubscriberOperationStore::protocolName(operation.protocol)) == "nxdn"); CHECK(std::string(SubscriberOperationStore::kindName(operation.kind)) == "emerg-call");