Announce MeshTalk identity after first chat and retry until heard
This commit is contained in:
1 parent
0a6658a47f
commit
8f2bbbab19
11 files changed
+730
-45
No files matched your search
+2
-1
@@ -498,7 +498,8 @@ bool Dispatcher::checkForeignRadioSend() {
|
||||
foreign_radio_start = _ms->getMillis();
|
||||
if (!_radio->startSendRaw(foreign_radio_bytes, foreign_radio_length)) {
|
||||
// RadioLib owns failure cleanup (including the board's FEM). Unlike
|
||||
// MeshCore reliable routing, foreign chat never retries autonomously.
|
||||
// MeshCore reliable routing, this transport never retries autonomously.
|
||||
// Companion may later submit a separately validated retained chat copy.
|
||||
finishForeignRadioFrame(false, false);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
// Bounded adaptation of MIT-licensed esp-cpp/espp wire helpers.
|
||||
// See licenses/ESPP-Meshtext-MIT.txt for the pinned source and license.
|
||||
// Meshtext is a bounded text interoperability component, not a peer firmware fork.
|
||||
// NodeInfo may only be explicitly encoded; received NodeInfo stays ignored.
|
||||
// NodeInfo is a separate GPS-free User packet; received NodeInfo stays ignored.
|
||||
namespace mesh {
|
||||
namespace mt {
|
||||
|
||||
@@ -47,7 +47,7 @@ struct DecodedText {
|
||||
|
||||
// Expanded AES-128/256 PSK only. No unencrypted-key fallback. Names are exact,
|
||||
// canonical peer channel names (<12 bytes), without local display markers.
|
||||
// Outgoing text and explicit NodeInfo permit peer MQTT upload (Data.bitfield
|
||||
// Outgoing text and NodeInfo permit peer MQTT upload (Data.bitfield
|
||||
// bit 0); this neither enables a local MQTT client nor marks traffic via_mqtt.
|
||||
// Returns 0 for invalid arguments, malformed UTF-8, embedded NUL or overflow.
|
||||
size_t encodeText(uint32_t from, uint32_t id, uint8_t hop_limit, const char* channel_name,
|
||||
@@ -59,7 +59,8 @@ size_t encodeText(uint32_t from, uint32_t id, uint8_t hop_limit, const char* cha
|
||||
// names may be empty; short names require 1..4 UTF-8 bytes (stock wire bound).
|
||||
// This can hold four ASCII characters but fewer multi-byte characters. Longer
|
||||
// names are rejected, not byte-truncated. No MAC, PSK, public key or MC identity
|
||||
// is copied. No ACK/response is requested and no automatic send is performed.
|
||||
// is copied. No GPS/position or ACK/response is requested. The caller controls
|
||||
// explicit and first-successful-chat announcements and bounded retries.
|
||||
size_t encodeNodeInfo(uint32_t from, uint32_t id, uint8_t hop_limit, const char* channel_name,
|
||||
const uint8_t* key, size_t key_len, const char* long_name, size_t long_name_len,
|
||||
const char* short_name, size_t short_name_len, uint8_t out[MaxFrameSize]);
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
#pragma once
|
||||
|
||||
#include "MeshtextChat.h"
|
||||
#include <string.h>
|
||||
|
||||
namespace mesh { namespace mt {
|
||||
|
||||
// Three retained chats and one metadata slot. No heap, packet-pool entries,
|
||||
// keys, positions or forwarding state are allocated by the delivery policy.
|
||||
struct PendingFrame {
|
||||
uint8_t bytes[MaxFrameSize] = {};
|
||||
uint8_t fingerprint[8] = {};
|
||||
uint32_t generation = 0, due = 0;
|
||||
uint16_t length = 0;
|
||||
uint8_t channel = 0, retries = 0;
|
||||
bool nodeinfo = false, sent = false, heard = false, cancelled = false;
|
||||
|
||||
void clear() { length = 0; }
|
||||
bool matchesEcho(const uint8_t* raw, size_t size) const {
|
||||
// The sender/id/channel/ciphertext are immutable. Only remaining hops
|
||||
// and next-hop/relay bytes may change. A copy at the original hop limit
|
||||
// is not evidence that another node forwarded the transmission.
|
||||
return length && sent && raw && size == length && size > HeaderSize
|
||||
&& memcmp(raw, bytes, 12) == 0 && raw[13] == bytes[13]
|
||||
&& (raw[12] & 0xf8) == (bytes[12] & 0xf8)
|
||||
&& (raw[12] & 7) < (bytes[12] & 7)
|
||||
&& memcmp(raw + HeaderSize, bytes + HeaderSize, size - HeaderSize) == 0;
|
||||
}
|
||||
};
|
||||
|
||||
static constexpr unsigned DeliverySlots = 4;
|
||||
static constexpr unsigned ChatDeliverySlots = DeliverySlots - 1;
|
||||
|
||||
} } // namespace mesh::mt
|
||||
Reference in new issue
Block a user