3 #include "storage_number.h"
5 #ifndef NETDATA_WEB_BUFFER_H
6 #define NETDATA_WEB_BUFFER_H 1
8 #define WEB_DATA_LENGTH_INCREASE_STEP 65536
11 long size; // allocation size of buffer
12 long bytes; // current data length in buffer
13 long sent; // current data length sent to output
14 char *buffer; // the buffer
16 long rbytes; // if non-zero, the excepted size of ifd
17 time_t date; // the date this content has been generated
21 #define CT_APPLICATION_JSON 1
22 #define CT_TEXT_PLAIN 2
23 #define CT_TEXT_HTML 3
24 #define CT_APPLICATION_X_JAVASCRIPT 4
27 #define CT_APPLICATION_XML 7
29 #define CT_APPLICATION_OCTET_STREAM 9
30 #define CT_APPLICATION_X_FONT_TRUETYPE 10
31 #define CT_APPLICATION_X_FONT_OPENTYPE 11
32 #define CT_APPLICATION_FONT_WOFF 12
33 #define CT_APPLICATION_VND_MS_FONTOBJ 13
34 #define CT_IMAGE_SVG_XML 14
36 #define web_buffer_printf(wb, args...) wb->bytes += snprintf(&wb->buffer[wb->bytes], (wb->size - wb->bytes), ##args)
37 #define web_buffer_reset(wb) wb->buffer[wb->bytes = 0] = '\0'
39 void web_buffer_strcpy(struct web_buffer *wb, const char *txt);
40 int print_calculated_number(char *str, calculated_number value);
41 void web_buffer_rrd_value(struct web_buffer *wb, calculated_number value);
43 void web_buffer_jsdate(struct web_buffer *wb, int year, int month, int day, int hours, int minutes, int seconds);
45 struct web_buffer *web_buffer_create(long size);
46 void web_buffer_free(struct web_buffer *b);
47 void web_buffer_increase(struct web_buffer *b, long free_size_required);
49 #endif /* NETDATA_WEB_BUFFER_H */