Line data Source code
1 : /*
2 : This file is part of TALER
3 : Copyright (C) 2022- Taler Systems SA
4 :
5 : TALER is free software; you can redistribute it and/or modify it under the
6 : terms of the GNU General Public License as published by the Free Software
7 : Foundation; either version 3, or (at your option) any later version.
8 :
9 : TALER is distributed in the hope that it will be useful, but WITHOUT ANY
10 : WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 : A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12 :
13 : You should have received a copy of the GNU General Public License along with
14 : TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
15 : */
16 : /**
17 : * @file age_restriction_helper.c
18 : * @brief Helper functions for age restriction
19 : * @author Özgür Kesim
20 : */
21 :
22 : #include "taler/taler_util.h"
23 : #include "taler/taler_extensions.h"
24 : #include "stdint.h"
25 :
26 :
27 : const struct TALER_AgeRestrictionConfig *
28 69 : TALER_extensions_get_age_restriction_config ()
29 : {
30 : const struct TALER_Extension *ext;
31 :
32 69 : ext = TALER_extensions_get_by_type (TALER_Extension_AgeRestriction);
33 69 : if (NULL == ext)
34 19 : return NULL;
35 :
36 50 : return ext->config;
37 : }
38 :
39 :
40 : bool
41 0 : TALER_extensions_is_age_restriction_enabled ()
42 : {
43 : const struct TALER_Extension *ext;
44 :
45 0 : ext = TALER_extensions_get_by_type (TALER_Extension_AgeRestriction);
46 0 : if (NULL == ext)
47 0 : return false;
48 :
49 0 : return ext->enabled;
50 : }
51 :
52 :
53 : struct TALER_AgeMask
54 28 : TALER_extensions_get_age_restriction_mask ()
55 : {
56 : const struct TALER_Extension *ext;
57 : const struct TALER_AgeRestrictionConfig *conf;
58 :
59 28 : ext = TALER_extensions_get_by_type (TALER_Extension_AgeRestriction);
60 :
61 28 : if ((NULL == ext) ||
62 22 : (NULL == ext->config))
63 6 : return (struct TALER_AgeMask) {0}
64 : ;
65 :
66 22 : conf = ext->config;
67 22 : return conf->mask;
68 : }
69 :
70 :
71 : /* end age_restriction_helper.c */
|