Politician 1.0.0
WiFi Auditing Library for ESP32
Loading...
Searching...
No Matches
politician::storage::NvsBssidCache Class Reference

Helper for persistently storing captured BSSIDs in NVS memory. More...

#include <PoliticianStorage.h>

Public Member Functions

 NvsBssidCache (const char *ns="wardrive")
 
void begin ()
 Initializes the NVS memory and loads the cached BSSIDs into RAM.
 
void loadInto (Politician &engine)
 Feeds the loaded BSSIDs into the Politician engine so it knows to ignore them.
 
bool add (const uint8_t *bssid)
 Adds a newly captured BSSID to the in-RAM cache.
 
bool flush ()
 Writes any pending in-RAM changes to NVS.
 
bool isDirty () const
 Returns true if there are in-RAM changes not yet written to NVS.
 
size_t count () const
 Returns the number of BSSIDs currently stored.
 
void clear ()
 Clears the entire cache from both RAM and NVS immediately.
 

Detailed Description

Helper for persistently storing captured BSSIDs in NVS memory.

This ensures that previously captured networks aren't attacked again after a reboot.

Definition at line 333 of file PoliticianStorage.h.

Constructor & Destructor Documentation

◆ NvsBssidCache()

politician::storage::NvsBssidCache::NvsBssidCache ( const char *  ns = "wardrive")
inline

Definition at line 343 of file PoliticianStorage.h.

Member Function Documentation

◆ add()

bool politician::storage::NvsBssidCache::add ( const uint8_t *  bssid)
inline

Adds a newly captured BSSID to the in-RAM cache.

The change is not written to NVS until flush() is called.

Parameters
bssidThe 6-byte BSSID to save.
Returns
true if added, false if it already exists or the cache is full.

Definition at line 378 of file PoliticianStorage.h.

◆ begin()

void politician::storage::NvsBssidCache::begin ( )
inline

Initializes the NVS memory and loads the cached BSSIDs into RAM.

Definition at line 354 of file PoliticianStorage.h.

◆ clear()

void politician::storage::NvsBssidCache::clear ( )
inline

Clears the entire cache from both RAM and NVS immediately.

Definition at line 413 of file PoliticianStorage.h.

◆ count()

size_t politician::storage::NvsBssidCache::count ( ) const
inline

Returns the number of BSSIDs currently stored.

Definition at line 408 of file PoliticianStorage.h.

◆ flush()

bool politician::storage::NvsBssidCache::flush ( )
inline

Writes any pending in-RAM changes to NVS.

Call this periodically (e.g., in end() or on a timer) to batch flash writes.

Returns
true if data was written, false if there were no pending changes.

Definition at line 395 of file PoliticianStorage.h.

◆ isDirty()

bool politician::storage::NvsBssidCache::isDirty ( ) const
inline

Returns true if there are in-RAM changes not yet written to NVS.

Definition at line 403 of file PoliticianStorage.h.

◆ loadInto()

void politician::storage::NvsBssidCache::loadInto ( Politician engine)
inline

Feeds the loaded BSSIDs into the Politician engine so it knows to ignore them.

Parameters
engineReference to your active Politician instance

Definition at line 366 of file PoliticianStorage.h.

References engine.


The documentation for this class was generated from the following file: