implement some changes suggested by CLang; fix writePeerStatus() not using RTP_END_OF_CALL_SEQ;

pull/65/head
Bryan Biedenkapp 2 years ago
parent 9f4aa44efb
commit 4f55a89201

@ -71,10 +71,10 @@ namespace dmr
m_siteId = DMRUtils::siteId(siteId, siteModel);
// parId clamping
if (parId == 0U)
parId = 3U;
if (parId > 3U)
parId = 3U;
if (m_parId == 0U)
m_parId = 3U;
if (m_parId > 3U)
m_parId = 3U;
}
/**

@ -120,9 +120,9 @@ bool BaseNetwork::writeActLog(const char* message)
char buffer[DATA_PACKET_LENGTH];
uint32_t len = ::strlen(message);
::strcpy(buffer + 11U, message);
::strncpy(buffer + 11U, message, len);
return writeMaster({ NET_FUNC::TRANSFER, NET_SUBFUNC::TRANSFER_SUBFUNC_ACTIVITY }, (uint8_t*)buffer, (uint32_t)len + 12U,
return writeMaster({ NET_FUNC::TRANSFER, NET_SUBFUNC::TRANSFER_SUBFUNC_ACTIVITY }, (uint8_t*)buffer, (uint32_t)len + 11U,
RTP_END_OF_CALL_SEQ, 0U, false, m_useAlternatePortForDiagnostics);
}
@ -141,9 +141,9 @@ bool BaseNetwork::writeDiagLog(const char* message)
char buffer[DATA_PACKET_LENGTH];
uint32_t len = ::strlen(message);
::strcpy(buffer + 11U, message);
::strncpy(buffer + 11U, message, len);
return writeMaster({ NET_FUNC::TRANSFER, NET_SUBFUNC::TRANSFER_SUBFUNC_DIAG }, (uint8_t*)buffer, (uint32_t)len + 12U,
return writeMaster({ NET_FUNC::TRANSFER, NET_SUBFUNC::TRANSFER_SUBFUNC_DIAG }, (uint8_t*)buffer, (uint32_t)len + 11U,
RTP_END_OF_CALL_SEQ, 0U, false, m_useAlternatePortForDiagnostics);
}
@ -166,10 +166,10 @@ bool BaseNetwork::writePeerStatus(json::object obj)
char buffer[DATA_PACKET_LENGTH];
uint32_t len = ::strlen(json.c_str());
::strcpy(buffer + 11U, json.c_str());
::strncpy(buffer + 11U, json.c_str(), len);
return writeMaster({ NET_FUNC::TRANSFER, NET_SUBFUNC::TRANSFER_SUBFUNC_STATUS }, (uint8_t*)buffer, (uint32_t)len + 12U,
0U, 0U, false, m_useAlternatePortForDiagnostics);
return writeMaster({ NET_FUNC::TRANSFER, NET_SUBFUNC::TRANSFER_SUBFUNC_STATUS }, (uint8_t*)buffer, (uint32_t)len + 11U,
RTP_END_OF_CALL_SEQ, 0U, false, m_useAlternatePortForDiagnostics);
}
/* Writes a group affiliation to the network. */
@ -699,10 +699,14 @@ UInt8Array BaseNetwork::createDMR_Message(uint32_t& length, const uint32_t strea
buffer[14U] = 0U; // Control Bits
// Individual slot disabling
if (slotNo == 1U && !m_slot1)
if (slotNo == 1U && !m_slot1) {
delete[] buffer;
return nullptr;
if (slotNo == 2U && !m_slot2)
}
if (slotNo == 2U && !m_slot2) {
delete[] buffer;
return nullptr;
}
buffer[15U] = slotNo == 1U ? 0x00U : 0x80U; // Slot Number

@ -566,7 +566,7 @@ std::string Socket::getLocalAddress()
int err = -1;
if ((err = getifaddrs(&ifaddr)) == -1) {
LogError(LOG_NET, "Cannot retreive system network interfaces");
LogError(LOG_NET, "Cannot retreive system network interfaces, err: %d", err);
return "0.0.0.0";
}

@ -208,8 +208,6 @@ bool TSBK::decode(const uint8_t* data, uint8_t* payload, bool rawTSBK)
if ((tsbk[P25_TSBK_LENGTH_BYTES - 2U] != 0x00U) && (tsbk[P25_TSBK_LENGTH_BYTES - 1U] != 0x00U)) {
LogWarning(LOG_P25, "TSBK::decode(), failed CRC CCITT-162 check");
}
ret = true; // ignore CRC error
}
else {
LogError(LOG_P25, "TSBK::decode(), failed CRC CCITT-162 check");

@ -565,11 +565,12 @@ bool HostFNE::createMasterNetwork()
LogError(LOG_HOST, "failed to initialize diagnostic log networking!");
m_useAlternatePortForDiagnostics = false; // this isn't fatal so just disable alternate port
}
else {
if (encrypted) {
m_diagNetwork->setPresharedKey(presharedKey);
}
}
}
return true;
}

Loading…
Cancel
Save

Powered by TurnKey Linux.