|
ESP RFID Webui
Architecture and call graph
|
#include <AuthSync.h>
Public Member Functions | |
| AuthSync (const String &serverBase) | |
| ~AuthSync () | |
| bool | begin () |
| bool | update () |
| bool | preloadOffline () |
| bool | isAuthorized (const String &uid) |
| void | dumpMemoryStats () const |
| void | setServerProbeResult (bool ok, unsigned long probeMillis) |
| uint32_t | getCardCount () const |
| size_t | getMemoryUsed () const |
Static Public Attributes | |
| static constexpr size_t | MAX_SAFE_CARDS = 200000UL |
| static constexpr size_t | MAX_SAFE_BYTES = (MAX_SAFE_CARDS + 7) / 8 |
Private Member Functions | |
| bool | syncFromServer () |
| bool | getCardAuthFromServer (const String &uid, int &card_id, bool &authorized) |
| void | addKnownAuth (const String &uid, bool allowed) |
| void | saveETagToNVS () |
| void | loadETagFromNVS () |
| bool | saveBitsetToFS (size_t bytes) |
| bool | loadBitsetFromFS () |
| bool | saveAllowDenyToFS () const |
| bool | loadAllowDenyFromFS () |
| bool | isBitSet (uint32_t id) const |
| void | setBit (uint32_t id) const |
| void | clearBit (uint32_t id) const |
| bool | writeByteAt (size_t idx, uint8_t val) const |
| bool | readByteAt (size_t idx, uint8_t &out) const |
Static Private Member Functions | |
| static uint64_t | hashUid (const String &s) |
| static size_t | calcBitsetBytes (uint32_t maxId) |
Private Attributes | |
| String | server_base |
| uint8_t * | authorized_bits = nullptr |
| uint32_t | max_card_id = 0 |
| unsigned long | last_sync = 0 |
| unsigned long | SYNC_INTERVAL = 60000 |
| unsigned long | last_server_probe = 0 |
| bool | server_last_ok = false |
| bool | serverPreviouslyUnreachable = false |
| Preferences | prefs_ |
| bool | prefsOpen_ = false |
| std::vector< uint64_t > | allowHashes_ |
| std::vector< uint64_t > | denyHashes_ |
| String | last_etag |
Definition at line 9 of file AuthSync.h.
|
explicit |
Definition at line 49 of file AuthSync.cpp.
References authorized_bits, anonymous_namespace{AuthSync.cpp}::authorized_bits_storage, and server_base.
Referenced by setup().
| AuthSync::~AuthSync | ( | ) |
Definition at line 54 of file AuthSync.cpp.
References authorized_bits, prefs_, and prefsOpen_.
|
private |
Definition at line 471 of file AuthSync.cpp.
References hashUid(), and saveETagToNVS().
Referenced by isAuthorized().
| bool AuthSync::begin | ( | ) |
Definition at line 120 of file AuthSync.cpp.
References loadBitsetFromFS(), loadETagFromNVS(), prefs_, prefsOpen_, and syncFromServer().
Referenced by setup().
|
staticprivate |
Definition at line 64 of file AuthSync.cpp.
Referenced by dumpMemoryStats(), getMemoryUsed(), readByteAt(), syncFromServer(), and writeByteAt().
|
private |
Definition at line 111 of file AuthSync.cpp.
References authorized_bits, and max_card_id.
| void AuthSync::dumpMemoryStats | ( | ) | const |
Definition at line 649 of file AuthSync.cpp.
References calcBitsetBytes(), max_card_id, and MAX_SAFE_BYTES.
Referenced by setup().
|
private |
Definition at line 193 of file AuthSync.cpp.
References last_server_probe, server_base, and server_last_ok.
Referenced by isAuthorized().
|
inline |
|
inline |
Definition at line 41 of file AuthSync.h.
References calcBitsetBytes(), and max_card_id.
|
staticprivate |
Definition at line 40 of file AuthSync.cpp.
References HashUtils::hashUid().
Referenced by addKnownAuth(), and isAuthorized().
| bool AuthSync::isAuthorized | ( | const String & | uid | ) |
Definition at line 158 of file AuthSync.cpp.
References addKnownAuth(), getCardAuthFromServer(), hashUid(), and server_base.
Referenced by loop().
|
private |
Definition at line 93 of file AuthSync.cpp.
References authorized_bits, and max_card_id.
|
private |
Definition at line 516 of file AuthSync.cpp.
Referenced by loadETagFromNVS().
|
private |
Definition at line 595 of file AuthSync.cpp.
References authorized_bits, max_card_id, MAX_SAFE_BYTES, prefs_, and prefsOpen_.
Referenced by begin(), and preloadOffline().
|
private |
Definition at line 556 of file AuthSync.cpp.
References last_etag, loadAllowDenyFromFS(), prefs_, and prefsOpen_.
Referenced by begin(), and preloadOffline().
| bool AuthSync::preloadOffline | ( | ) |
Definition at line 136 of file AuthSync.cpp.
References loadBitsetFromFS(), loadETagFromNVS(), prefs_, and prefsOpen_.
Referenced by setup().
|
private |
Definition at line 83 of file AuthSync.cpp.
References authorized_bits, calcBitsetBytes(), and max_card_id.
|
private |
Definition at line 494 of file AuthSync.cpp.
Referenced by saveETagToNVS().
|
private |
Definition at line 568 of file AuthSync.cpp.
References authorized_bits, max_card_id, prefs_, and prefsOpen_.
Referenced by syncFromServer().
|
private |
Definition at line 542 of file AuthSync.cpp.
References last_etag, prefs_, prefsOpen_, and saveAllowDenyToFS().
Referenced by addKnownAuth(), and syncFromServer().
|
private |
Definition at line 102 of file AuthSync.cpp.
References authorized_bits, and max_card_id.
| void AuthSync::setServerProbeResult | ( | bool | ok, |
| unsigned long | probeMillis ) |
Definition at line 669 of file AuthSync.cpp.
References last_server_probe, and server_last_ok.
Referenced by serverCheckTimerCallback().
|
private |
Definition at line 288 of file AuthSync.cpp.
References authorized_bits, calcBitsetBytes(), last_etag, last_server_probe, last_sync, max_card_id, MAX_SAFE_BYTES, prefs_, prefsOpen_, saveBitsetToFS(), saveETagToNVS(), server_base, server_last_ok, and writeByteAt().
Referenced by begin(), and update().
| bool AuthSync::update | ( | ) |
Definition at line 151 of file AuthSync.cpp.
References last_sync, SYNC_INTERVAL, and syncFromServer().
Referenced by NetworkTask().
|
private |
Definition at line 73 of file AuthSync.cpp.
References authorized_bits, calcBitsetBytes(), and max_card_id.
Referenced by syncFromServer().
|
private |
Definition at line 71 of file AuthSync.h.
|
private |
Definition at line 48 of file AuthSync.h.
Referenced by AuthSync(), clearBit(), isBitSet(), loadBitsetFromFS(), readByteAt(), saveBitsetToFS(), setBit(), syncFromServer(), writeByteAt(), and ~AuthSync().
|
private |
Definition at line 72 of file AuthSync.h.
|
private |
Definition at line 74 of file AuthSync.h.
Referenced by loadETagFromNVS(), saveETagToNVS(), and syncFromServer().
|
private |
Definition at line 53 of file AuthSync.h.
Referenced by getCardAuthFromServer(), setServerProbeResult(), and syncFromServer().
|
private |
Definition at line 50 of file AuthSync.h.
Referenced by syncFromServer(), and update().
|
private |
Definition at line 49 of file AuthSync.h.
Referenced by clearBit(), dumpMemoryStats(), getCardCount(), getMemoryUsed(), isBitSet(), loadBitsetFromFS(), readByteAt(), saveBitsetToFS(), setBit(), syncFromServer(), and writeByteAt().
|
staticconstexpr |
Definition at line 19 of file AuthSync.h.
Referenced by dumpMemoryStats(), loadBitsetFromFS(), and syncFromServer().
|
staticconstexpr |
Definition at line 17 of file AuthSync.h.
|
private |
Definition at line 69 of file AuthSync.h.
Referenced by begin(), loadBitsetFromFS(), loadETagFromNVS(), preloadOffline(), saveBitsetToFS(), saveETagToNVS(), syncFromServer(), and ~AuthSync().
|
private |
Definition at line 70 of file AuthSync.h.
Referenced by begin(), loadBitsetFromFS(), loadETagFromNVS(), preloadOffline(), saveBitsetToFS(), saveETagToNVS(), syncFromServer(), and ~AuthSync().
|
private |
Definition at line 44 of file AuthSync.h.
Referenced by AuthSync(), getCardAuthFromServer(), isAuthorized(), and syncFromServer().
|
private |
Definition at line 54 of file AuthSync.h.
Referenced by getCardAuthFromServer(), setServerProbeResult(), and syncFromServer().
|
private |
Definition at line 55 of file AuthSync.h.
|
private |
Definition at line 51 of file AuthSync.h.
Referenced by update().