[gbx] - more generalized routing info in cw msg
[oscam.git] / module-webif-tpl.h
blobf6e0435785d3468558213fe6f0913350e10e0dc9
1 #ifndef MODULE_WEBIF_TPL_H_
2 #define MODULE_WEBIF_TPL_H_
4 #ifdef WEBIF
6 /* Templates: Adds a variable. The variable can be used as often as wanted. */
7 #define TPLADD 0
8 /* Templates: Appends a variable or adds it if doesn't exist yet. The variable can be used as often as wanted. */
9 #define TPLAPPEND 1
10 /* Templates: Adds a variable which will be reset to "" after being used once, either through tpl_getVar or when used in a template.
11 tpl_addVar/tpl_printf don't do a reset and will overwrite the appendmode with a new value. */
12 #define TPLADDONCE 2
13 /* Templates: Appends a variable or adds it if doesn't exist yet. The variable will be reset to "" after being used once. See TPLADDONCE for details. */
14 #define TPLAPPENDONCE 3
16 #define TOUCH_SUBDIR "touch/"
18 struct templatevars
20 uint32_t varscnt;
21 uint32_t varsalloc;
22 uint32_t tmpcnt;
23 uint32_t tmpalloc;
24 char **names;
25 char **values;
26 uint8_t *vartypes;
27 char **tmp;
28 uint8_t messages;
31 void webif_tpls_prepare(void);
32 void webif_tpls_free(void);
34 struct templatevars *tpl_create(void);
35 void tpl_clear(struct templatevars *vars);
37 void tpl_addVar(struct templatevars *vars, uint8_t addmode, const char *name, const char *value);
38 void tpl_addMsg(struct templatevars *vars, const char *value);
39 void tpl_printf(struct templatevars *vars, uint8_t addmode, const char *varname, const char *fmtstring, ...) __attribute__((format(printf, 4, 5)));
41 char *tpl_getVar(struct templatevars *vars, const char *name);
42 char *tpl_getFilePathInSubdir(const char *path, const char *subdir, const char *name, const char *ext, char *result, uint32_t resultsize);
43 char *tpl_getTplPath(const char *name, const char *path, char *result, uint32_t resultsize);
44 char *tpl_getTpl(struct templatevars *vars, const char *name);
45 char *tpl_getUnparsedTpl(const char *name, int8_t removeHeader, const char *subdir);
47 int32_t tpl_saveIncludedTpls(const char *path);
49 void tpl_checkOneDirDiskRevisions(const char *subdir);
50 void tpl_checkDiskRevisions(void);
52 char *urlencode(struct templatevars *vars, const char *str);
53 char *xml_encode(struct templatevars *vars, const char *chartoencode);
54 char *sec2timeformat(struct templatevars *vars, int32_t seconds);
56 #else
57 static inline void webif_tpls_free(void)
59 return;
61 #endif
63 #endif