get_global_fees.h (3827B)
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 src/include/exchange-database/get_global_fees.h 18 * @brief implementation of the get_global_fees function for Postgres 19 * @author Christian Grothoff 20 */ 21 #ifndef EXCHANGE_DATABASE_GET_GLOBAL_FEES_H 22 #define EXCHANGE_DATABASE_GET_GLOBAL_FEES_H 23 24 #include "taler/taler_util.h" 25 #include "taler/taler_json_lib.h" 26 #include "exchangedb_lib.h" 27 28 29 /** 30 * Provide information about global fees. 31 * 32 * @param cls closure 33 * @param fees the global fees we charge 34 * @param purse_timeout when do purses time out 35 * @param history_expiration how long are account histories preserved 36 * @param purse_account_limit how many purses are free per account 37 * @param start_date from when are these fees valid (start date) 38 * @param end_date until when are these fees valid (end date, exclusive) 39 * @param master_sig master key signature affirming that this is the correct 40 * fee (of purpose #TALER_SIGNATURE_MASTER_GLOBAL_FEES) 41 */ 42 #ifndef TALER_EXCHANGEDB_GLOBAL_FEE_RESULT_CLOSURE 43 /** 44 * Type of the closure for #TALER_EXCHANGEDB_GlobalFeeCallback. 45 */ 46 #define TALER_EXCHANGEDB_GLOBAL_FEE_RESULT_CLOSURE void 47 #endif 48 typedef void 49 (*TALER_EXCHANGEDB_GlobalFeeCallback)( 50 TALER_EXCHANGEDB_GLOBAL_FEE_RESULT_CLOSURE *cls, 51 const struct TALER_GlobalFeeSet *fees, 52 struct GNUNET_TIME_Relative purse_timeout, 53 struct GNUNET_TIME_Relative history_expiration, 54 uint32_t purse_account_limit, 55 struct GNUNET_TIME_Timestamp start_date, 56 struct GNUNET_TIME_Timestamp end_date, 57 const struct TALER_MasterSignatureP *master_sig); 58 59 60 /* Callback typedefs */ 61 /** 62 * Provide information about global fees. 63 * 64 * @param cls closure 65 * @param fees the global fees we charge 66 * @param purse_timeout when do purses time out 67 * @param history_expiration how long are account histories preserved 68 * @param purse_account_limit how many purses are free per account 69 * @param start_date from when are these fees valid (start date) 70 * @param end_date until when are these fees valid (end date, exclusive) 71 * @param master_sig master key signature affirming that this is the correct 72 * fee (of purpose #TALER_SIGNATURE_MASTER_GLOBAL_FEES) 73 */ 74 typedef void 75 (*TALER_EXCHANGEDB_GlobalFeeCallback)( 76 TALER_EXCHANGEDB_GLOBAL_FEE_RESULT_CLOSURE *cls, 77 const struct TALER_GlobalFeeSet *fees, 78 struct GNUNET_TIME_Relative purse_timeout, 79 struct GNUNET_TIME_Relative history_expiration, 80 uint32_t purse_account_limit, 81 struct GNUNET_TIME_Timestamp start_date, 82 struct GNUNET_TIME_Timestamp end_date, 83 const struct TALER_MasterSignatureP *master_sig); 84 85 /** 86 * Obtain global fees from database. 87 * 88 * @param pg the database context 89 * @param cb function to call on each fee entry 90 * @param cb_cls closure for @a cb 91 * @return status of the transaction 92 */ 93 enum GNUNET_DB_QueryStatus 94 TALER_TALER_EXCHANGEDB_get_global_fees (struct 95 TALER_EXCHANGEDB_PostgresContext *pg, 96 TALER_EXCHANGEDB_GlobalFeeCallback cb, 97 TALER_EXCHANGEDB_GLOBAL_FEE_RESULT_CLOSURE 98 *cb_cls); 99 100 #endif