get-reserves-attest-RESERVE_PUB.h (3876B)
1 /* 2 This file is part of TALER 3 Copyright (C) 2014-2026 Taler Systems SA 4 5 TALER is free software; you can redistribute it and/or modify it under the 6 terms of the GNU Affero 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 Affero General Public License for more details. 12 13 You should have received a copy of the GNU Affero General Public License along with 14 TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/> 15 */ 16 /** 17 * @file include/taler/taler-exchange/get-reserves-attest-RESERVE_PUB.h 18 * @brief C interface for GET /reserves/$RESERVE_PUB/attest 19 * @author Christian Grothoff 20 */ 21 #ifndef _TALER_EXCHANGE__GET_RESERVES_ATTEST_RESERVE_PUB_H 22 #define _TALER_EXCHANGE__GET_RESERVES_ATTEST_RESERVE_PUB_H 23 24 #include <taler/taler-exchange/common.h> 25 26 /** 27 * Handle for an operation to GET /reserves/$RESERVE_PUB/attest. 28 */ 29 struct TALER_EXCHANGE_GetReservesAttestHandle; 30 31 32 /** 33 * Response from a GET /reserves/$RESERVE_PUB/attest request. 34 */ 35 struct TALER_EXCHANGE_GetReservesAttestResponse 36 { 37 /** 38 * HTTP response data. 39 */ 40 struct TALER_EXCHANGE_HttpResponse hr; 41 42 /** 43 * Details depending on @e hr.http_status. 44 */ 45 union 46 { 47 /** 48 * Information returned on #MHD_HTTP_OK. 49 */ 50 struct 51 { 52 /** 53 * Length of the @e attributes array. 54 */ 55 size_t attributes_length; 56 57 /** 58 * NULL-terminated array of attribute names available about the user. 59 */ 60 const char **attributes; 61 62 } ok; 63 64 } details; 65 66 }; 67 68 69 #ifndef TALER_EXCHANGE_GET_RESERVES_ATTEST_RESULT_CLOSURE 70 /** 71 * Type of the closure used by 72 * the #TALER_EXCHANGE_GetReservesAttestCallback. 73 */ 74 #define TALER_EXCHANGE_GET_RESERVES_ATTEST_RESULT_CLOSURE void 75 #endif /* TALER_EXCHANGE_GET_RESERVES_ATTEST_RESULT_CLOSURE */ 76 77 /** 78 * Type of the function that receives the result of a 79 * GET /reserves/$RESERVE_PUB/attest request. 80 * 81 * @param cls closure 82 * @param result result returned by the HTTP server 83 */ 84 typedef void 85 (*TALER_EXCHANGE_GetReservesAttestCallback)( 86 TALER_EXCHANGE_GET_RESERVES_ATTEST_RESULT_CLOSURE *cls, 87 const struct TALER_EXCHANGE_GetReservesAttestResponse *result); 88 89 90 /** 91 * Set up GET /reserves/$RESERVE_PUB/attest operation. 92 * Note that you must explicitly start the operation after setup. 93 * 94 * @param ctx the context 95 * @param url base URL of the exchange 96 * @param reserve_pub public key of the reserve to get available attributes for 97 * @return handle to operation 98 */ 99 struct TALER_EXCHANGE_GetReservesAttestHandle * 100 TALER_EXCHANGE_get_reserves_attest_create ( 101 struct GNUNET_CURL_Context *ctx, 102 const char *url, 103 const struct TALER_ReservePublicKeyP *reserve_pub); 104 105 106 /** 107 * Start GET /reserves/$RESERVE_PUB/attest operation. 108 * 109 * @param[in,out] grah operation to start 110 * @param cb function to call with the exchange's result 111 * @param cb_cls closure for @a cb 112 * @return status code, #TALER_EC_NONE on success 113 */ 114 enum TALER_ErrorCode 115 TALER_EXCHANGE_get_reserves_attest_start ( 116 struct TALER_EXCHANGE_GetReservesAttestHandle *grah, 117 TALER_EXCHANGE_GetReservesAttestCallback cb, 118 TALER_EXCHANGE_GET_RESERVES_ATTEST_RESULT_CLOSURE *cb_cls); 119 120 121 /** 122 * Cancel GET /reserves/$RESERVE_PUB/attest operation. This function must 123 * not be called by clients after the TALER_EXCHANGE_GetReservesAttestCallback 124 * has been invoked (as in those cases it'll be called internally by the 125 * implementation already). 126 * 127 * @param[in] grah operation to cancel 128 */ 129 void 130 TALER_EXCHANGE_get_reserves_attest_cancel ( 131 struct TALER_EXCHANGE_GetReservesAttestHandle *grah); 132 133 134 #endif /* _TALER_EXCHANGE__GET_RESERVES_ATTEST_RESERVE_PUB_H */