* refactor of Contact/Client out_path_len (stored in files), from signed to unsigned byte (+2 squashed commits)

Squashed commits:
[f326e25] * misc
[fa5152e] * new 'path mode' parsing in Dispatcher
This commit is contained in:
Scott Powell
2026-02-19 14:37:51 +11:00
parent bbc5f0c11a
commit 3e76161e9c
18 changed files with 222 additions and 167 deletions

View File

@@ -10,8 +10,19 @@ Packet::Packet() {
payload_len = 0;
}
uint8_t Packet::copyPath(uint8_t* dest, const uint8_t* src, uint8_t path_len) {
uint8_t hash_count = path_len & 63;
uint8_t hash_size = (path_len >> 6) + 1;
if (hash_count*hash_size > MAX_PATH_SIZE) {
MESH_DEBUG_PRINTLN("Packet::copyPath, invalid path_len=%d", (uint32_t)path_len);
return 0; // Error
}
memcpy(dest, src, hash_count*hash_size);
return path_len;
}
int Packet::getRawLength() const {
return 2 + path_len + payload_len + (hasTransportCodes() ? 4 : 0);
return 2 + getPathByteLen() + payload_len + (hasTransportCodes() ? 4 : 0);
}
void Packet::calculatePacketHash(uint8_t* hash) const {