NetBurner 3.1
htmlfiles.h
Go to the documentation of this file.
1 /*NB_REVISION*/
2 
3 /*NB_COPYRIGHT*/
4 
13 /******************************************************************************
14  * These functions are satisfied by the code generated by the utility
15  * "comphtml.exe".
16  ******************************************************************************/
17 
18 #include "basictypes.h"
19 #include "nettypes.h"
20 
21 enum comp_type
22 {
23  eNoCompression,
24  eHuffman,
25  eHuffmanHtml,
26  eUncompHtml,
27  ePrevCompGZip
28 };
29 
30 enum file_type
31 {
32  eTypeText,
33  eTypeHtml,
34  eTypeJpg,
35  eTypeGIF,
36  eTypeClass,
37  eTypePNG,
38  eTypeJar,
39  eTypeOther,
40  eTypeMPEG,
41  eTypeCSS,
42  eTypeXML,
43  eTypeWBMP,
44  eTypeJS
45 };
46 
47 //
48 // One of these records exists for each file encoded.
49 //
50 struct HTML_FILE_RECORD
51 {
52  const char *fname;
53  const unsigned char *file_pointer;
54  unsigned long siz;
55  comp_type cType;
56  short fType;
57  short has_calls;
58  int access_group;
59  bool no_direct;
60 };
61 
62 extern const unsigned n_file_record;
63 extern const unsigned short huffman_table[];
64 extern const HTML_FILE_RECORD file_record[];
65 extern const char *MIME_table[];
66 extern const char *html_table[];
67 
68 int SendEmailResponse(int sock, const char *name, const char *attachment);
69 
84 int SendFullResponse(char const *name, int fd);
85 int SendFullResponse(HTML_FILE_RECORD *fr, int fd, const char *pUrl);
86 int SendHeaderResponse(char const *name, int fd);
87 int SendHeaderResponse(HTML_FILE_RECORD *fr, int fd);
88 
105 int32_t SendFileFragment(char const *name, int32_t fd, PCSTR url = NULL);
106 
107 HTML_FILE_RECORD *GetRecordFromName(char const *name);
108 void SendData(HTML_FILE_RECORD *fr, int sock, PCSTR url = NULL);
109 
110 void WriteHtmlVariable(int fd, char c);
111 void WriteHtmlVariable(int fd, int i);
112 void WriteHtmlVariable(int fd, short i);
113 void WriteHtmlVariable(int fd, long i);
114 void WriteHtmlVariable(int fd, uint8_t b);
115 void WriteHtmlVariable(int fd, uint16_t w);
116 void WriteHtmlVariable(int fd, unsigned long dw);
117 void WriteHtmlVariable(int fd, const char *);
118 
119 void WriteHtmlVariable(int fd, MACADR ip);
120 
121 class IPADDR4_CLASS
122 {
123  public:
124  IPADDR4 the_addr;
125  IPADDR4_CLASS(IPADDR4 ip) { the_addr = ip; }
126 };
127 
128 IPADDR4_CLASS IPCAST(IPADDR4 ip);
129 
130 void WriteHtmlVariable(int fd, IPADDR4_CLASS ipa);
int32_t SendFileFragment(char const *name, int32_t fd, PCSTR url=NULL)
Send a file fragment without a header.
Definition: htmldecomp.cpp:347
int SendFullResponse(char const *name, int fd)
Send a file with the proper HTTP header.
Definition: htmldecomp.cpp:306
#define NULL
Definition: nm_bsp.h:76