NetBurner 3.5.0
PDF Version
 
htmlfiles.h
Go to the documentation of this file.
1/*NB_REVISION*/
2
3/*NB_COPYRIGHT*/
4
23/*-----------------------------------------------------------------------------
24 * These functions are satisfied by the code generated by the utility
25 * "comphtml.exe".
26 *----------------------------------------------------------------------------*/
27#ifndef NB_HTMLFILES_H
28#define NB_HTMLFILES_H
29
30#include <basictypes.h>
31#include <nettypes.h>
32
33// File compression types
34enum comp_type
35{
36 eNoCompression, // No compression, no dynamic HTML tags
37 eHuffman, // Huffman encoded without dynamic content HTML tags
38 eHuffmanHtml, // Huffman encoded with dynamic HTML tags such as CPPCALL and VARIABLE
39 eUncompHtml, // No compression, file contains dynamic HTML tags such as CPPCALL and VARIABLE
40 ePrevCompGZip // File has been compressed with gzip
41};
42
43// File type
44enum file_type
45{
46 eTypeText,
47 eTypeHtml,
48 eTypeJpg,
49 eTypeGIF,
50 eTypeClass,
51 eTypePNG,
52 eTypeJar,
53 eTypeOther,
54 eTypeMPEG,
55 eTypeCSS,
56 eTypeXML,
57 eTypeWBMP,
58 eTypeJS
59};
60
61// Each file has a record in htmldata.cpp
62struct HTML_FILE_RECORD
63{
64 const char *fname; // name of file
65 const unsigned char *file_pointer; // pointer to file in array
66 unsigned long siz; // size of file in bytes
67 comp_type cType; // file compression type
68 short fType; // file type
69 short has_calls; // file has function call tags, such as: CPPCALL or VARIABLE
70 int access_group; // security access group
71 bool no_direct; // files to be included as part of an outer file, and are not directly accessed.
72 // For example, A page with multiple repeated subelements could include the
73 // same no_direct page multiple times, but with slightly different settings,
74 // thereby eliminating the need to have the whole page as a single entry.
75};
76
77// Variables declared in auto-generated htmldata.cpp
78extern const unsigned n_file_record;
79extern const unsigned short huffman_table[];
80extern const HTML_FILE_RECORD file_record[];
81extern const char *MIME_table[];
82extern const char *html_table[];
83
95int SendEmailResponse(int sock, const char *name, const char *attachment);
96
114int SendFullResponse(char const *name, int fd);
115
136int SendFullResponse(HTML_FILE_RECORD *fr, int fd, const char *pUrl);
137
153int SendHeaderResponse(char const *name, int fd);
154
170int SendHeaderResponse(HTML_FILE_RECORD *fr, int fd);
171
191int32_t SendFileFragment(char const *name, int32_t fd, PCSTR url = NULL);
192
202HTML_FILE_RECORD *GetRecordFromName(char const *name);
203
204void SendData(HTML_FILE_RECORD *fr, int sock, PCSTR url = NULL);
205
206void WriteHtmlVariable(int fd, char c);
207void WriteHtmlVariable(int fd, int i);
208void WriteHtmlVariable(int fd, short i);
209void WriteHtmlVariable(int fd, long i);
210void WriteHtmlVariable(int fd, uint8_t b);
211void WriteHtmlVariable(int fd, uint16_t w);
212void WriteHtmlVariable(int fd, unsigned long dw);
213void WriteHtmlVariable(int fd, const char *);
214
215void WriteHtmlVariable(int fd, MACADR ip);
216
217#ifdef IPV6
218#include <ipv6/ipv6_addr.h>
219
220class IPADDR_WCLASS
221{
222 public:
223 IPADDR the_addr;
224 IPADDR_WCLASS(IPADDR ip) { the_addr = ip; }
225 IPADDR_WCLASS(IPADDR4 ip4) { the_addr = ip4; }
226};
227
228IPADDR_WCLASS IPCAST(IPADDR ip);
229
230#else
231class IPADDR_WCLASS
232{
233 public:
234 IPADDR the_addr;
235 IPADDR_WCLASS(IPADDR ip) { the_addr = ip; }
236};
237
238#endif
239IPADDR_WCLASS IPCAST(IPADDR ip);
240
241void WriteHtmlVariable(int fd, IPADDR_WCLASS ipa);
242
243class config_leaf;
244
245/*
246 * eMode values:
247 * 1 = CONFIGVALUE Value of the configuration object. For example an IP value would be a string "192.168.1.10".
248 * 2 = CONFIGINPUT HTML input element with name and value that can be used as an input for form processing. An input
249 * element can be a checkbox (boolean), text edit field, or chooser (drop down box).
250 * 3 = CONFIGFULL HTML input name, element, and hint all as one HTML string.
251 * 4 = CONFIGTABLE HTML input name, element, and hint all as one HTML string with <td> and </td> HTML tags. Note: <table>
252 * and </table> tags must be provided separately.
253 * 5 = CONFIGHINT Text value of hint associated with element.
254 *
255 */
256struct CONFIG_RENDER_OBJ
257{
258 config_leaf *pObj;
259 int eMode;
260 int len;
261 const char *extra;
262};
263
276CONFIG_RENDER_OBJ ConfigRenderFunc(int mode, const char *pobj, int len = 20, const char *extra = 0);
277
289CONFIG_RENDER_OBJ ConfigRenderFunc(int mode, config_leaf &cl, int len = 20, const char *extra = 0);
290
299void WriteHtmlVariable(int fd, CONFIG_RENDER_OBJ co);
300
302#endif
Used to store and manipulate IPv4 addresses in dual stack mode.
Definition nettypes.h:208
Used to hold and manipulate IPv4 and IPv6 addresses in dual stack mode.
Definition ipv6_addr.h:41
Used to store and manipulate MAC addresses.
Definition nettypes.h:69
CONFIG_RENDER_OBJ ConfigRenderFunc(int mode, const char *pobj, int len=20, const char *extra=0)
Render a configuration object as HTML for the specified configuration object.
int SendHeaderResponse(char const *name, int fd)
Send a HTTP header response for the specified file type.
int SendEmailResponse(int sock, const char *name, const char *attachment)
Send an email with HTML formatting.
int32_t SendFileFragment(char const *name, int32_t fd, PCSTR url=NULL)
Send a file fragment without a header.
HTML_FILE_RECORD * GetRecordFromName(char const *name)
Returns a pointer to a HTML_FILE_RECORD for the specified file name.
int SendFullResponse(char const *name, int fd)
Send a file with the proper HTTP header, file specified by file name.
NetBurner IPADDR6 Class.
NetBurner IPADDR4 Class. See the IPADDR4 Class page for complete documentation.