File: gdmaps.h

package info (click to toggle)
gdnsd 3.8.3-2.1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 4,584 kB
  • sloc: ansic: 30,669; sh: 4,872; perl: 1,047; makefile: 401; pascal: 108
file content (53 lines) | stat: -rw-r--r-- 1,968 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/* Copyright © 2012 Brandon L Black <blblack@gmail.com>
 *
 * This file is part of gdnsd.
 *
 * gdnsd-plugin-geoip is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * gdnsd-plugin-geoip is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with gdnsd.  If not, see <http://www.gnu.org/licenses/>.
 *
 */

#ifndef GDMAPS_H
#define GDMAPS_H

#include <gdnsd/vscf.h>
#include <gdnsd/net.h>

#include <inttypes.h>

typedef struct gdmaps_t gdmaps_t;

typedef unsigned(*monreg_func_t)(const char* desc);

F_NONNULLX(1) F_WUNUSED F_RETNN
gdmaps_t* gdmaps_new(const vscf_data_t* maps_cfg, monreg_func_t mrf);
F_NONNULL
void gdmaps_load_databases(const gdmaps_t* gdmaps);
F_NONNULL F_PURE
int gdmaps_name2idx(const gdmaps_t* gdmaps, const char* map_name);
F_NONNULL F_PURE
const char* gdmaps_idx2name(const gdmaps_t* gdmaps, const unsigned gdmap_idx);
F_NONNULL F_PURE
unsigned gdmaps_get_dc_count(const gdmaps_t* gdmaps, const unsigned gdmap_idx);
F_NONNULL F_PURE
unsigned gdmaps_dcname2num(const gdmaps_t* gdmaps, const unsigned gdmap_idx, const char* dcname);
F_NONNULL F_PURE
unsigned gdmaps_map_mon_idx(const gdmaps_t* gdmaps, const unsigned gdmap_idx, const unsigned dcnum);
F_NONNULL F_RETNN F_COLD
const char* gdmaps_logf_dclist(const gdmaps_t* gdmaps, const unsigned gdmap_idx, const uint8_t* dclist);
F_NONNULL
const uint8_t* gdmaps_lookup(const gdmaps_t* gdmaps, const unsigned gdmap_idx, const client_info_t* client, unsigned* scope_mask);
F_NONNULL
void gdmaps_setup_watchers(gdmaps_t* gdmaps);

#endif // GDMAPS_H