| 1234567891011121314151617181920212223242526272829303132333435363738394041 |
- /* WiFi credential records: the staged connect request written by the network
- * menu and read by `wifi connectfile <path>`, plus the saved-network list in
- * /data/WIFI.CFG (see wifi_store.c).
- *
- * The normal `wifi connect <ssid> <pass>` command arguments are limited by
- * SYS_SPAWN's VFS_PATH_MAX buffer (64 bytes), which is too small for a long
- * SSID plus a 63-character WPA2 passphrase. The menu therefore writes the
- * single fixed-size record to a /share file and spawns a helper with a short
- * path.
- *
- * /data/WIFI.CFG is a header (`struct wifi_cfg_list`) followed by `count`
- * `struct wifi_cfg` records, most recently connected first. A file that
- * starts directly with WIFI_CFG_MAGIC is the old one-record format and is
- * accepted as a one-entry list. */
- #ifndef WIFI_CFG_H
- #define WIFI_CFG_H
- #define WIFI_CFG_MAGIC 0x4E425746u /* "NBWF": one network record */
- #define WIFI_CFG_LIST_MAGIC 0x4E42574Cu /* "NBWL": saved-network list */
- #define WIFI_CFG_LIST_VER 1u
- #define WIFI_CFG_MAX 16 /* saved networks in /data/WIFI.CFG */
- #define WIFI_CFG_STAGED "/share/netmenu.wifi"
- #define WIFI_CRED_PATH "/data/WIFI.CFG"
- struct wifi_cfg {
- unsigned int magic;
- unsigned char ssid_len; /* 1..32 */
- unsigned char pass_len; /* 0..64 (64 = raw hex PSK) */
- unsigned char bssid[6];
- unsigned char ssid[32];
- char pass[65]; /* NUL terminated, pass_len used */
- };
- struct wifi_cfg_list {
- unsigned int magic;
- unsigned int version;
- unsigned int count;
- struct wifi_cfg net[WIFI_CFG_MAX];
- };
- #endif
|