Void Sentry
An AI-driven, real-time Sentry Turret platform leveraging asynchronous I/O and computer vision to deliver high-precision autonomous motion tracking on resource-constrained embedded hardware.
Loading...
Searching...
No Matches
blobs.h File Reference

Versioned, CRC-checked byte layouts for the saved networks and the PIN record (pure C++20, no heap). More...

#include "network_list.h"
#include <array>
#include <optional>
#include <span>

Go to the source code of this file.

Functions

std::array< uint8_t, kNetsBlobSize > prov::serialize_nets (const NetworkList &list)
 Packs the list into the nets blob.
 
std::optional< NetworkList > prov::deserialize_nets (std::span< const uint8_t > blob)
 Parses a nets blob; empty on wrong length, magic, version, CRC, count, unterminated or invalid fields.
 
std::array< uint8_t, kPinBlobSize > prov::serialize_pin (const PinRecord &rec)
 Packs the PIN record into the pin blob.
 
std::optional< PinRecord > prov::deserialize_pin (std::span< const uint8_t > blob)
 Parses a pin blob; empty on wrong length, magic, version, CRC or set byte.
 

Variables

constexpr size_t prov::kNetsBlobSize = 4 + 1 + 1 + kMaxNetworks * (kSsidMax + 1 + kPassMax + 1 + 4) + 4
 
constexpr size_t prov::kPinBlobSize = 4 + 1 + 1 + kSaltLen + kHashLen + 4
 

Detailed Description

Versioned, CRC-checked byte layouts for the saved networks and the PIN record (pure C++20, no heap).

Little-endian: magic (u32; "VSWN" nets, "VSWP" pin), version (u8 = 1), count (nets) or set (pin) (u8), fixed-size fields with unused entries zeroed, then CRC-32 of everything before it. Anything that fails a check deserializes to nothing.