Files
MeshCore/src/helpers/TransportKeyStore.h
Scott Powell d9ff3a4d02 * Mesh: new sendFlood() overload with transport codes.
* BaseChatMesh:  sendFloodScoped(), for overriding with some outbound 'scope' / TransportKey
* companion: new 'send_scope' variable.
2025-11-04 01:21:56 +11:00

32 lines
820 B
C++

#pragma once
#include <Arduino.h> // needed for PlatformIO
#include <Packet.h>
#include <helpers/IdentityStore.h>
struct TransportKey {
uint8_t key[16];
uint16_t calcTransportCode(const mesh::Packet* packet) const;
bool isNull() const;
};
#define MAX_TKS_ENTRIES 16
class TransportKeyStore {
uint16_t cache_ids[MAX_TKS_ENTRIES];
TransportKey cache_keys[MAX_TKS_ENTRIES];
int num_cache;
void putCache(uint16_t id, const TransportKey& key);
void invalidateCache() { num_cache = 0; }
public:
TransportKeyStore() { num_cache = 0; }
void getAutoKeyFor(uint16_t id, const char* name, TransportKey& dest);
int loadKeysFor(uint16_t id, TransportKey keys[], int max_num);
bool saveKeysFor(uint16_t id, const TransportKey keys[], int num);
bool removeKeys(uint16_t id);
bool clear();
};