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
form.h File Reference

x-www-form-urlencoded decoding and input validation for the WiFi page (pure C++20, no heap). More...

#include <cstddef>
#include <string_view>

Go to the source code of this file.

Functions

bool prov::form_field (std::string_view body, std::string_view key, char *out, size_t out_cap, size_t *out_len)
 Finds key=value in an x-www-form-urlencoded body, decodes XX and '+', writes value + NUL.
 
bool prov::form_has_key (std::string_view body, std::string_view key)
 True if the body contains key= (even with an empty or malformed value). Lets callers tell missing from invalid.
 
bool prov::valid_ssid (std::string_view s)
 SSID: 1-32 bytes.
 
bool prov::valid_password (std::string_view s)
 Password: empty, or 8-63 bytes of printable ASCII (32-126).
 
bool prov::valid_pin (std::string_view s)
 PIN: 4-8 ASCII digits.
 

Variables

constexpr size_t prov::kMaxFormBody = 256
 

Detailed Description

x-www-form-urlencoded decoding and input validation for the WiFi page (pure C++20, no heap).

Function Documentation

◆ form_field()

bool prov::form_field ( std::string_view body,
std::string_view key,
char * out,
size_t out_cap,
size_t * out_len )

Finds key=value in an x-www-form-urlencoded body, decodes XX and '+', writes value + NUL.

False if the body is longer than kMaxFormBody, the key is missing, an escape is malformed (or decodes to a NUL byte), or the decoded value (plus NUL) does not fit out_cap. out_len may be null. The views need no NUL terminator; an empty body never matches.