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