plugin_exchangedb_common.c (5125B)
1 /* 2 This file is part of TALER 3 Copyright (C) 2015, 2016, 2020, 2024 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 exchangedb/plugin_exchangedb_common.c 18 * @brief Functions shared across plugins, this file is meant to be 19 * included in each plugin. 20 * @author Christian Grothoff 21 */ 22 #include "taler/platform.h" 23 #include "plugin_exchangedb_common.h" 24 25 26 void 27 TEH_COMMON_free_reserve_history ( 28 void *cls, 29 struct TALER_EXCHANGEDB_ReserveHistory *rh) 30 { 31 (void) cls; 32 while (NULL != rh) 33 { 34 switch (rh->type) 35 { 36 case TALER_EXCHANGEDB_RO_BANK_TO_EXCHANGE: 37 { 38 struct TALER_EXCHANGEDB_BankTransfer *bt; 39 40 bt = rh->details.bank; 41 GNUNET_free (bt->sender_account_details.full_payto); 42 GNUNET_free (bt); 43 break; 44 } 45 case TALER_EXCHANGEDB_RO_WITHDRAW_COINS: 46 { 47 struct TALER_EXCHANGEDB_Withdraw *wd; 48 wd = rh->details.withdraw; 49 GNUNET_free (wd->denom_pub_hashes); 50 GNUNET_free (wd); 51 break; 52 } 53 case TALER_EXCHANGEDB_RO_RECOUP_COIN: 54 { 55 struct TALER_EXCHANGEDB_Recoup *recoup; 56 57 recoup = rh->details.recoup; 58 TALER_denom_sig_free (&recoup->coin.denom_sig); 59 GNUNET_free (recoup); 60 break; 61 } 62 case TALER_EXCHANGEDB_RO_EXCHANGE_TO_BANK: 63 { 64 struct TALER_EXCHANGEDB_ClosingTransfer *closing; 65 66 closing = rh->details.closing; 67 GNUNET_free (closing->receiver_account_details.full_payto); 68 GNUNET_free (closing); 69 break; 70 } 71 case TALER_EXCHANGEDB_RO_PURSE_MERGE: 72 { 73 struct TALER_EXCHANGEDB_PurseMerge *merge; 74 75 merge = rh->details.merge; 76 GNUNET_free (merge); 77 break; 78 } 79 case TALER_EXCHANGEDB_RO_HISTORY_REQUEST: 80 { 81 struct TALER_EXCHANGEDB_HistoryRequest *history; 82 83 history = rh->details.history; 84 GNUNET_free (history); 85 break; 86 } 87 case TALER_EXCHANGEDB_RO_OPEN_REQUEST: 88 { 89 struct TALER_EXCHANGEDB_OpenRequest *or; 90 91 or = rh->details.open_request; 92 GNUNET_free (or); 93 break; 94 } 95 case TALER_EXCHANGEDB_RO_CLOSE_REQUEST: 96 { 97 struct TALER_EXCHANGEDB_CloseRequest *cr; 98 99 cr = rh->details.close_request; 100 GNUNET_free (cr); 101 break; 102 } 103 } 104 { 105 struct TALER_EXCHANGEDB_ReserveHistory *next; 106 107 next = rh->next; 108 GNUNET_free (rh); 109 rh = next; 110 } 111 } 112 } 113 114 115 void 116 TEH_COMMON_free_coin_transaction_list ( 117 void *cls, 118 struct TALER_EXCHANGEDB_TransactionList *tl) 119 { 120 (void) cls; 121 while (NULL != tl) 122 { 123 switch (tl->type) 124 { 125 case TALER_EXCHANGEDB_TT_DEPOSIT: 126 { 127 struct TALER_EXCHANGEDB_DepositListEntry *deposit; 128 129 deposit = tl->details.deposit; 130 GNUNET_free (deposit->receiver_wire_account.full_payto); 131 GNUNET_free (deposit); 132 break; 133 } 134 case TALER_EXCHANGEDB_TT_MELT: 135 GNUNET_free (tl->details.melt); 136 break; 137 case TALER_EXCHANGEDB_TT_OLD_COIN_RECOUP: 138 { 139 struct TALER_EXCHANGEDB_RecoupRefreshListEntry *rr; 140 141 rr = tl->details.old_coin_recoup; 142 TALER_denom_sig_free (&rr->coin.denom_sig); 143 GNUNET_free (rr); 144 break; 145 } 146 case TALER_EXCHANGEDB_TT_REFUND: 147 GNUNET_free (tl->details.refund); 148 break; 149 case TALER_EXCHANGEDB_TT_RECOUP: 150 GNUNET_free (tl->details.recoup); 151 break; 152 case TALER_EXCHANGEDB_TT_RECOUP_REFRESH: 153 { 154 struct TALER_EXCHANGEDB_RecoupRefreshListEntry *rr; 155 156 rr = tl->details.recoup_refresh; 157 TALER_denom_sig_free (&rr->coin.denom_sig); 158 GNUNET_free (rr); 159 break; 160 } 161 case TALER_EXCHANGEDB_TT_PURSE_DEPOSIT: 162 { 163 struct TALER_EXCHANGEDB_PurseDepositListEntry *deposit; 164 165 deposit = tl->details.purse_deposit; 166 GNUNET_free (deposit->exchange_base_url); 167 GNUNET_free (deposit); 168 break; 169 } 170 case TALER_EXCHANGEDB_TT_PURSE_REFUND: 171 { 172 struct TALER_EXCHANGEDB_PurseRefundListEntry *prefund; 173 174 prefund = tl->details.purse_refund; 175 GNUNET_free (prefund); 176 break; 177 } 178 case TALER_EXCHANGEDB_TT_RESERVE_OPEN: 179 { 180 struct TALER_EXCHANGEDB_ReserveOpenListEntry *role; 181 182 role = tl->details.reserve_open; 183 GNUNET_free (role); 184 break; 185 } 186 } 187 { 188 struct TALER_EXCHANGEDB_TransactionList *next; 189 190 next = tl->next; 191 GNUNET_free (tl); 192 tl = next; 193 } 194 } 195 } 196 197 198 /* end of plugin_exchangedb_common.c */