NetBurner 3.1
system.h
Go to the documentation of this file.
1 /*NB_REVISION*/
2 
3 /*NB_COPYRIGHT*/
4 
14 // The system maintains a configuration record for initialization
15 
16 #ifndef _SYSTEM_STORAGE_H
17 #define _SYSTEM_STORAGE_H
18 #include <nettypes.h>
19 
20 // Exceptions
21 #define EXCPT_REBOOT (0) /* Reboot after an exception */
22 #define EXCPT_HALT (1) /* Halt after an exception */
23 #define EXCPT_QUIET (2) /* Reboot quietly after an exception */
24 #define EXCPT_RESET (3) /* Reboot quietly after an exception */
25 #define EXCPT_REBOOT_TO_MON (4) /* Reboot to (Alt)monitor after an exception */
26 
27 // MAC-48 Media Access Control address in bytes (nettypes.h)
28 #ifndef MACADDRESS_OCTETS_48
29 #define MACADDRESS_OCTETS_48 (6)
30 #endif
31 
32 /*
33  IEEE 802.11 identifier and key parameters
34 
35  m_FileName member is used to save service set identity (SSID) and
36  either Wired Equivalent Privacy, Wi-Fi Protected Access (WPA) or WPA2
37  Pre Shared Key (PSK) on platforms that support the interface.
38 
39  SSID is restricted to printable ASCII characters, 1 to 32 in length.
40 
41  WEP Key is 10 or 26 hexadecimal ASCII characters.
42  WPA(2) PSK is printable ASCII 8 to 63 characters in length.
43 
44  The total length of SSID and the key must not exceed 68 characters.
45 
46  It is stored as a concatenated null terminate string for example:
47  "SSID:NetBurner,WPA:XJrLy4GbZe1/3wORx5ja4bBC74284OqbhWwVa3+-"
48 
49 */
50 #define SYSTEM_CONFIG_RECORD_SSID_SIZE_MIN (1)
51 #define SYSTEM_CONFIG_RECORD_SSID_SIZE_MAX (32)
52 #define SYSTEM_CONFIG_RECORD_SSID_TAG ("SSID:")
53 #define SYSTEM_CONFIG_RECORD_SSID_TAG_LENGTH (5)
54 
55 #define SYSTEM_CONFIC_RECORD_SEPERATOR (",")
56 #define SYSTEM_CONFIC_RECORD_SEPERATOR_LENGTH (1)
57 
58 #define SYSTEM_CONFIG_RECORD_WEP_KEY_SIZE_64 (10)
59 #define SYSTEM_CONFIG_RECORD_WEP_KEY_SIZE_104 (26)
60 #define SYSTEM_CONFIG_RECORD_WPA_PSK_SIZE_MIN (8)
61 #define SYSTEM_CONFIG_RECORD_WPA_PSK_SIZE_MAX (63)
62 #define SYSTEM_CONFIG_RECORD_WEP_KEY_TAG ("WEP:")
63 #define SYSTEM_CONFIG_RECORD_WPA_PSK_TAG ("WPA:")
64 #define SYSTEM_CONFIG_RECORD_WPA2_PSK_TAG ("WP2:")
65 #define SYSTEM_CONFIG_RECORD_KEY_TAG_LENGTH (4)
66 
67 #define SYSTEM_CONFIG_RECORD_M_FILENAME_SIZE (80)
68 
69 #define SYSTEM_CONFIG_RECORD_SSID_KEY_LENGTH_MAX \
70  (SYSTEM_CONFIG_RECORD_M_FILENAME_SIZE - \
71  (SYSTEM_CONFIG_RECORD_SSID_TAG_LENGTH + SYSTEM_CONFIC_RECORD_SEPERATOR_LENGTH + SYSTEM_CONFIG_RECORD_KEY_TAG_LENGTH + 1))
72 
73 // These functions replace the system config record with the one that is passed
74 // in. It calculates a new checksum, and it ignores the MAC address.
75 
76 // Callback function when config record changes
77 extern void (*NotifyUpdatePtr)(void);
78 
79 class UDPPacket; // Forward declaration
80 extern int (*pLegacyUdp)(UDPPacket &p, int ifn);
81 
99 int SaveUserParameters(void *pCopyFrom, int len);
100 
116 void *GetUserParameters(void);
117 
123 const char *GetReleaseTag();
124 
125 // Get starting memory pointer into config record.
126 uint8_t *GetConfigRecordStart();
127 
128 // Get ending config record storage
129 uint8_t *GetConfigRecordEnd();
130 
131 // Erase the config record and fixup any legacy records as required....
132 void EraseWholeConfigRecord();
133 
134 uint32_t GetDefaultBaud();
135 uint32_t GetDefaultSerialPort();
136 bool ShowBootMessages();
137 
138 #endif /* _SYSTEM_STORAGE_H */
139 
int SaveUserParameters(void *pCopyFrom, int len)
Save data to the on-chip flash memory User Parameter area.
Definition: userparam.cpp:27
const char * GetReleaseTag()
Returns the NNDK release tag information.
Definition: release_tag.cpp:8
UDP Packet Class.
Definition: udp.h:70
void * GetUserParameters(void)
Returns a void pointer to the user parameter area.
Definition: userparam.cpp:44