dhcpd-pools  3.0
ISC dhcpd lease usage analyser
mustach.h
Go to the documentation of this file.
1 /*
2  Author: José Bollo <jobol@nonadev.net>
3  Author: José Bollo <jose.bollo@iot.bzh>
4 
5  https://gitlab.com/jobol/mustach
6 
7  Licensed under the Apache License, Version 2.0 (the "License");
8  you may not use this file except in compliance with the License.
9  You may obtain a copy of the License at
10 
11  http://www.apache.org/licenses/LICENSE-2.0
12 
13  Unless required by applicable law or agreed to in writing, software
14  distributed under the License is distributed on an "AS IS" BASIS,
15  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  See the License for the specific language governing permissions and
17  limitations under the License.
18 */
19 
20 #ifndef _mustach_h_included_
21 #define _mustach_h_included_
22 
53 struct mustach_itf {
54  int (*start)(void *closure);
55  int (*put)(void *closure, const char *name, int escape, FILE *file);
56  int (*enter)(void *closure, const char *name);
57  int (*next)(void *closure);
58  int (*leave)(void *closure);
59 };
60 
61 #define MUSTACH_OK 0
62 #define MUSTACH_ERROR_SYSTEM -1
63 #define MUSTACH_ERROR_UNEXPECTED_END -2
64 #define MUSTACH_ERROR_EMPTY_TAG -3
65 #define MUSTACH_ERROR_TAG_TOO_LONG -4
66 #define MUSTACH_ERROR_BAD_SEPARATORS -5
67 #define MUSTACH_ERROR_TOO_DEPTH -6
68 #define MUSTACH_ERROR_CLOSING -7
69 #define MUSTACH_ERROR_BAD_UNESCAPE_TAG -8
70 
82 extern int fmustach(const char *template, struct mustach_itf *itf, void *closure, FILE *file);
83 
95 extern int fdmustach(const char *template, struct mustach_itf *itf, void *closure, int fd);
96 
109 extern int mustach(const char *template, struct mustach_itf *itf, void *closure, char **result, size_t *size);
110 
111 #endif
112 
int(* enter)(void *closure, const char *name)
Definition: mustach.h:56
static struct mustach_itf itf
Definition: mustach-dhcpd-pools.c:148
int(* start)(void *closure)
Definition: mustach.h:54
int(* leave)(void *closure)
Definition: mustach.h:58
int fmustach(const char *template, struct mustach_itf *itf, void *closure, FILE *file)
Definition: mustach.c:204
int(* next)(void *closure)
Definition: mustach.h:57
mustach_itf - interface for callbacks
Definition: mustach.h:53
int(* put)(void *closure, const char *name, int escape, FILE *file)
Definition: mustach.h:55
int mustach(const char *template, struct mustach_itf *itf, void *closure, char **result, size_t *size)
fmustach - Renders the mustache &#39;template&#39; in &#39;result&#39; for &#39;itf&#39; and &#39;closure&#39;.
Definition: mustach.c:228
int fdmustach(const char *template, struct mustach_itf *itf, void *closure, int fd)
fmustach - Renders the mustache &#39;template&#39; in &#39;fd&#39; for &#39;itf&#39; and &#39;closure&#39;.
Definition: mustach.c:212