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 "platform.h" 23 : #include "taler_util.h" 24 : #include "taler_signatures.h" 25 : #include "taler_extensions.h" 26 : #include "stdint.h" 27 : 28 : 29 : const struct TALER_AgeRestrictionConfig * 30 79 : TALER_extensions_get_age_restriction_config () 31 : { 32 : const struct TALER_Extension *ext; 33 : 34 79 : ext = TALER_extensions_get_by_type (TALER_Extension_AgeRestriction); 35 79 : if (NULL == ext) 36 29 : return NULL; 37 : 38 50 : return ext->config; 39 : } 40 : 41 : 42 : bool 43 0 : TALER_extensions_is_age_restriction_enabled () 44 : { 45 : const struct TALER_Extension *ext; 46 : 47 0 : ext = TALER_extensions_get_by_type (TALER_Extension_AgeRestriction); 48 0 : if (NULL == ext) 49 0 : return false; 50 : 51 0 : return ext->enabled; 52 : } 53 : 54 : 55 : struct TALER_AgeMask 56 28 : TALER_extensions_get_age_restriction_mask () 57 : { 58 : const struct TALER_Extension *ext; 59 : const struct TALER_AgeRestrictionConfig *conf; 60 : 61 28 : ext = TALER_extensions_get_by_type (TALER_Extension_AgeRestriction); 62 : 63 28 : if ((NULL == ext) || 64 22 : (NULL == ext->config)) 65 6 : return (struct TALER_AgeMask) {0} 66 : ; 67 : 68 22 : conf = ext->config; 69 22 : return conf->mask; 70 : } 71 : 72 : 73 : /* end age_restriction_helper.c */