1 /* Copyright © 2012 Brandon L Black <blblack@gmail.com>
2  *
3  * This file is part of gdnsd.
4  *
5  * gdnsd-plugin-geoip is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation, either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * gdnsd-plugin-geoip is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with gdnsd.  If not, see <http://www.gnu.org/licenses/>.
17  *
18  */
19 
20 #ifndef DCMAP_H
21 #define DCMAP_H
22 
23 #include "dclists.h"
24 
25 #include <gdnsd/compiler.h>
26 #include <gdnsd/vscf.h>
27 
28 #include <inttypes.h>
29 #include <stdbool.h>
30 
31 typedef struct _dcmap dcmap_t;
32 
33 F_NONNULL F_WUNUSED
34 dcmap_t* dcmap_new(vscf_data_t* map_cfg, dclists_t* dclists, const unsigned parent_def, const unsigned true_depth, const char* map_name, const bool allow_auto);
35 
36 F_NONNULL F_PURE
37 uint32_t dcmap_lookup_loc(const dcmap_t* dcmap, const char* locstr);
38 
39 // size of "lookup" storage below, including terminal NUL
40 #define DCMAP_LOOKUP_MAXLEN 128
41 typedef void (*dcmap_lookup_cb_t)(void* data, char* lookup, const unsigned level);
42 F_NONNULL
43 uint32_t dcmap_lookup_loc_callback(const dcmap_t* dcmap, dcmap_lookup_cb_t cb, void* data);
44 
45 F_NONNULL
46 void dcmap_destroy(dcmap_t* dcmap);
47 
48 #endif // DCMAP_H
49