/* Saved WiFi networks in /data/WIFI.CFG, shared by the `wifi` command and the * network menu. The file is a wifi_cfg_list header + record array; the old * one-record format is still read. See wifi_cfg.h for the layout. */ #ifndef WIFI_STORE_H #define WIFI_STORE_H #include "wifi_cfg.h" /* Read the saved list into `out` (most recently used first), dropping * malformed and duplicate records. Returns 0..max, or 0 when the file is * absent, empty or unreadable. */ int wifi_store_load(struct wifi_cfg *out, int max); /* Rewrite the list. An empty list removes the file. -> 0 / -1 */ int wifi_store_save(const struct wifi_cfg *list, int count); /* Move `rec` to the front (replacing a record with the same SSID, dropping * the least recently used entry when the list is full) and write it. */ int wifi_store_remember(const struct wifi_cfg *rec); /* Index of the record whose SSID matches, or -1. */ int wifi_store_find(const struct wifi_cfg *list, int count, const unsigned char *ssid, unsigned int ssid_len); /* Remove one network: 1 removed, 0 not found, -1 write error. */ int wifi_store_forget(const unsigned char *ssid, unsigned int ssid_len); #endif