frosix_util_lib.h (2435B)
1 /* 2 This file is part of Frosix 3 Copyright (C) 2020 Anastasis SARL 4 5 Frosix 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 Frosix 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 Frosix; see the file COPYING.GPL. If not, see <http://www.gnu.org/licenses/> 15 */ 16 /** 17 * @file include/frosix_util_lib.h 18 * @brief frosix client api 19 * @author Christian Grothoff 20 * @author Dominik Meister 21 * @author Dennis Neufeld 22 */ 23 #ifndef FROSIX_UTIL_LIB_H 24 #define FROSIX_UTIL_LIB_H 25 26 // FIXME 27 // #include "frosix_error_codes.h" 28 // #define GNU_TALER_ERROR_CODES_H 1 29 #include "frost_low.h" 30 #include <gnunet/gnunet_util_lib.h> 31 #include <taler/taler_util.h> 32 33 34 /** 35 * Maximum value allowed for PINs. Limited to 10^15 < 2^52 to ensure the 36 * numeric value survives a conversion to float by JavaScript. 37 * 38 * NOTE: Do not change this value, we map it to a string like 39 * 42353-256-6521-241 and that mapping fails if the number 40 * does not have exactly 15 digits! 41 */ 42 #define FROSIX_PIN_MAX_VALUE 1000000000000000 43 44 45 /** 46 * Return default project data used by Frosix. 47 */ 48 const struct GNUNET_OS_ProjectData * 49 FROSIX_project_data_default (void); 50 51 52 /** 53 * Initialize libfrosixsutil. 54 */ 55 void 56 FROSIX_OS_init (void); 57 58 59 /*** FOR DEBUGGING ***/ 60 void 61 FROSIX_debug_print_point (const struct FROST_Point *pt); 62 63 void 64 FROSIX_debug_print_scalar (const struct FROST_Scalar *scal); 65 66 void 67 FROSIX_debug_print_crockford32 (const void *data, 68 size_t length, 69 const char *title); 70 71 72 /*** NOT IN USE AT THE MOMENT ***/ 73 /** 74 * Convert input string @a as into @a pin. 75 * 76 * @param as input of the form 42355-256-2262-265 77 * @param[out] pin set to numeric pin 78 * @return false if @as is malformed 79 */ 80 bool 81 FROSIX_scan_pin (const char *as, 82 unsigned long long *pin); 83 84 85 /** 86 * Convert numeric pin to human-readable number for display. 87 * 88 * @param pin number to convert 89 * @return static (!) buffer with the text to show 90 */ 91 const char * 92 FROSIX_pin2s (uint64_t pin); 93 94 95 #endif