NetBurner 3.1
SSL/HttpsUploadCert/src/serialburnerdata.h
1 /*NB_REVISION*/
2 
3 /*NB_COPYRIGHT*/
4 
5 #ifndef _SERIALBURNERDATA_H_
6 #define _SERIALBURNERDATA_H_
7 
8 #include <config_obj.h>
9 extern MonitorRecord monitor_config;
10 
11 #define DEVICE_NAME_LENGTH (15)
12 
13 /*
14  ******************************************************************************
15  * Key or certificate size
16  * SSL Certificate size 2200 (empirical)
17  * OpenSSL format is Privacy-enhanced Electronic Mail (PEM) encoded
18  * NULL terminated for conversion
19  *
20  ******************************************************************************
21  */
22 #define SERIAL_BURNER_CERTIFICATE_SIZE_MAX ((2 * 1024) - 1)
23 #define SERIAL_BURNER_CERTIFICATE_SIZE_MAX_PEM ((3 * 1024) - 1)
24 
25 /* Certificate and key status */
26 #define SERIAL_BURNER_LIBRARY_DEFAULT ((uint8_t)0x00)
27 #define SERIAL_BURNER_DEFAULT ((uint8_t)0x01)
28 #define SERIAL_BURNER_USER_INSTALLED ((uint8_t)0x02)
29 
30 /*
31  ******************************************************************************
32  * Key size
33  * SSL key size (PEM) < 4K (empirical)
34  * NULL terminated for conversion
35  *
36  ******************************************************************************
37  */
38 #define SERIAL_BURNER_KEY_SIZE_MAX_PEM ((4 * 1024) - 1)
39 
40 /*
41  ******************************************************************************
42  * Booting support
43  ******************************************************************************
44  */
45 #define boot_iprintf(...) \
46  { \
47  if (monitor_config.Quiet == 0) \
48  { \
49  iprintf("%s : ", NV_Settings.DeviceName); \
50  iprintf(__VA_ARGS__); \
51  iprintf("\r\n"); \
52  } \
53  }
54 
55 /*
56  ******************************************************************************
57  * Debug support
58  ******************************************************************************
59  */
60 #define debug_iprintf(...) \
61  { \
62  if (bShowDebug == TRUE) \
63  { \
64  iprintf("%s : ", NV_Settings.DeviceName); \
65  iprintf(__VA_ARGS__); \
66  iprintf("\r\n"); \
67  } \
68  }
69 
70 /*
71  ******************************************************************************
72  *
73  * Structures
74  *
75  ******************************************************************************
76  */
77 
78 /*
79  Configuration Settings
80 
81  DeviceName - Device name for DHCP
82  NetBIOSName - NetBIOS name
83 
84  * SSL *
85  CertificateRsaLength - Certificate length
86  CertificateData - Certificate
87  KeyHttpsRsaLength - RSA key for HTTPS length, 0 is none
88  KeyHttpsRsaData - RSA key for HTTPS
89  KeyRsaLength - RSA key length, 0 is none
90  KeyRsaData - RSA key
91  KeyDsaLength - DSA key length, 0 is none
92  KeyDsaData - DSA key
93 
94  * Version change key *
95  VerifyKey - Version change key
96 
97 */
98 struct NV_SettingsStruct
99 {
100  /* NetBurner address configuration */
101  char DeviceName[(DEVICE_NAME_LENGTH + 1)];
102  char NetBIOSName[(NETBIOS_NAME_SIZE_IN_CHARS + 1)];
103 
104  /* SSL certificate and keys file lengths */
105  uint8_t SslCertificateSource;
106  uint16_t SslCertificateLength;
107  uint16_t SslKeyLength;
108 
109  /* Version verification key */
110  uint32_t VerifyKey;
111  /* Flash File System Version verification key */
112  uint32_t STDEFFSVerifyKey;
113 };
114 
115 /*
116  ******************************************************************************
117  *
118  * Global Data Declarations
119  *
120  ******************************************************************************
121  */
122 
123 /* User parameters */
124 extern NV_SettingsStruct NV_Settings;
125 
126 /* User parameters change candidate */
127 extern NV_SettingsStruct gNV_SettingsChangeCopy;
128 
129 /* User parameters change flag */
130 extern volatile BOOL gChangedUserParameters;
131 
132 /* Debugging flag */
133 extern BOOL bShowDebug;
134 
135 /*
136  ******************************************************************************
137  *
138  * Routines
139  *
140  ******************************************************************************
141  */
142 
143 extern void RegisterPost(void);
144 
145 /* Save data to file */
146 extern BOOL UserSaveData(char *dataPtr, int dataSize, const char *fileName);
147 
148 /* Get saved data */
149 extern BOOL UserGetData(char *dataPtr, char *fileName, int dataSize);
150 
151 extern void CheckNVSettings(BOOL returnToFactory = FALSE);
152 
153 extern void SetAndSaveDefaults(void);
154 
155 /* For processing hexadecimal break key value */
156 extern char GetHexByte(const char *cp);
157 
158 #endif /* _SERIALBURNERDATA_H_ */
Configuration object header file.
void CheckNVSettings()
Definition: webif.cpp:40