address API stability FIXMEs in taler_exchange_service

This commit is contained in:
Christian Grothoff 2023-06-04 14:10:54 +02:00
parent 809300158c
commit 0ad3de938e
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC
16 changed files with 237 additions and 146 deletions

View File

@ -388,14 +388,15 @@ load_offline_key (int do_create)
* add operation result. * add operation result.
* *
* @param cls closure with a `struct DenominationAddRequest` * @param cls closure with a `struct DenominationAddRequest`
* @param hr HTTP response data * @param adr response data
*/ */
static void static void
denomination_add_cb ( denomination_add_cb (
void *cls, void *cls,
const struct TALER_EXCHANGE_HttpResponse *hr) const struct TALER_EXCHANGE_AuditorAddDenominationResponse *adr)
{ {
struct DenominationAddRequest *dar = cls; struct DenominationAddRequest *dar = cls;
const struct TALER_EXCHANGE_HttpResponse *hr = &adr->hr;
if (MHD_HTTP_NO_CONTENT != hr->http_status) if (MHD_HTTP_NO_CONTENT != hr->http_status)
{ {

View File

@ -1301,13 +1301,15 @@ upload_signkey_revocation (const char *exchange_url,
* Function called with information about the post auditor add operation result. * Function called with information about the post auditor add operation result.
* *
* @param cls closure with a `struct AuditorAddRequest` * @param cls closure with a `struct AuditorAddRequest`
* @param hr HTTP response data * @param mer response data
*/ */
static void static void
auditor_add_cb (void *cls, auditor_add_cb (
const struct TALER_EXCHANGE_HttpResponse *hr) void *cls,
const struct TALER_EXCHANGE_ManagementAuditorEnableResponse *mer)
{ {
struct AuditorAddRequest *aar = cls; struct AuditorAddRequest *aar = cls;
const struct TALER_EXCHANGE_HttpResponse *hr = &mer->hr;
if (MHD_HTTP_NO_CONTENT != hr->http_status) if (MHD_HTTP_NO_CONTENT != hr->http_status)
{ {
@ -1401,13 +1403,15 @@ upload_auditor_add (const char *exchange_url,
* Function called with information about the post auditor del operation result. * Function called with information about the post auditor del operation result.
* *
* @param cls closure with a `struct AuditorDelRequest` * @param cls closure with a `struct AuditorDelRequest`
* @param hr HTTP response data * @param mdr response data
*/ */
static void static void
auditor_del_cb (void *cls, auditor_del_cb (void *cls,
const struct TALER_EXCHANGE_HttpResponse *hr) const struct
TALER_EXCHANGE_ManagementAuditorDisableResponse *mdr)
{ {
struct AuditorDelRequest *adr = cls; struct AuditorDelRequest *adr = cls;
const struct TALER_EXCHANGE_HttpResponse *hr = &mdr->hr;
if (MHD_HTTP_NO_CONTENT != hr->http_status) if (MHD_HTTP_NO_CONTENT != hr->http_status)
{ {
@ -1726,14 +1730,15 @@ upload_wire_del (const char *exchange_url,
* Function called with information about the post wire fee operation result. * Function called with information about the post wire fee operation result.
* *
* @param cls closure with a `struct WireFeeRequest` * @param cls closure with a `struct WireFeeRequest`
* @param hr HTTP response data * @param swr response data
*/ */
static void static void
wire_fee_cb ( wire_fee_cb (
void *cls, void *cls,
const struct TALER_EXCHANGE_HttpResponse *hr) const struct TALER_EXCHANGE_ManagementSetWireFeeResponse *swr)
{ {
struct WireFeeRequest *wfr = cls; struct WireFeeRequest *wfr = cls;
const struct TALER_EXCHANGE_HttpResponse *hr = &swr->hr;
if (MHD_HTTP_NO_CONTENT != hr->http_status) if (MHD_HTTP_NO_CONTENT != hr->http_status)
{ {
@ -1831,14 +1836,15 @@ upload_wire_fee (const char *exchange_url,
* Function called with information about the post global fee operation result. * Function called with information about the post global fee operation result.
* *
* @param cls closure with a `struct WireFeeRequest` * @param cls closure with a `struct WireFeeRequest`
* @param hr HTTP response data * @param gr response data
*/ */
static void static void
global_fee_cb ( global_fee_cb (
void *cls, void *cls,
const struct TALER_EXCHANGE_HttpResponse *hr) const struct TALER_EXCHANGE_ManagementSetGlobalFeeResponse *gr)
{ {
struct GlobalFeeRequest *gfr = cls; struct GlobalFeeRequest *gfr = cls;
const struct TALER_EXCHANGE_HttpResponse *hr = &gr->hr;
if (MHD_HTTP_NO_CONTENT != hr->http_status) if (MHD_HTTP_NO_CONTENT != hr->http_status)
{ {
@ -2358,14 +2364,15 @@ upload_extensions (const char *exchange_url,
* Function called with information about the add partner operation. * Function called with information about the add partner operation.
* *
* @param cls closure with a `struct PartnerAddRequest` * @param cls closure with a `struct PartnerAddRequest`
* @param hr HTTP response data * @param apr response data
*/ */
static void static void
add_partner_cb ( add_partner_cb (
void *cls, void *cls,
const struct TALER_EXCHANGE_HttpResponse *hr) const struct TALER_EXCHANGE_ManagementAddPartnerResponse *apr)
{ {
struct PartnerAddRequest *par = cls; struct PartnerAddRequest *par = cls;
const struct TALER_EXCHANGE_HttpResponse *hr = &apr->hr;
if (MHD_HTTP_NO_CONTENT != hr->http_status) if (MHD_HTTP_NO_CONTENT != hr->http_status)
{ {

View File

@ -4548,7 +4548,7 @@ struct TALER_EXCHANGE_ManagementPostExtensionsHandle *
TALER_EXCHANGE_management_post_extensions ( TALER_EXCHANGE_management_post_extensions (
struct GNUNET_CURL_Context *ctx, struct GNUNET_CURL_Context *ctx,
const char *url, const char *url,
struct TALER_EXCHANGE_ManagementPostExtensionsData *ped, const struct TALER_EXCHANGE_ManagementPostExtensionsData *ped,
TALER_EXCHANGE_ManagementPostExtensionsCallback cb, TALER_EXCHANGE_ManagementPostExtensionsCallback cb,
void *cb_cls); void *cb_cls);
@ -5091,7 +5091,7 @@ TALER_EXCHANGE_lookup_aml_decision (
/** /**
* Cancel #TALER_EXCHANGE_add_aml_decision() operation. * Cancel #TALER_EXCHANGE_lookup_aml_decision() operation.
* *
* @param rh handle of the operation to cancel * @param rh handle of the operation to cancel
*/ */
@ -5105,18 +5105,30 @@ TALER_EXCHANGE_lookup_aml_decision_cancel (
*/ */
struct TALER_EXCHANGE_AddAmlDecision; struct TALER_EXCHANGE_AddAmlDecision;
/**
* Response when making an AML decision.
*/
struct TALER_EXCHANGE_AddAmlDecisionResponse
{
/**
* HTTP response data.
*/
struct TALER_EXCHANGE_HttpResponse hr;
};
/** /**
* Function called with information about storing an * Function called with information about storing an
* an AML decision. * an AML decision.
* *
* @param cls closure * @param cls closure
* @param hr HTTP response data * @param adr response data
*/ */
// FIXME: bad API
typedef void typedef void
(*TALER_EXCHANGE_AddAmlDecisionCallback) ( (*TALER_EXCHANGE_AddAmlDecisionCallback) (
void *cls, void *cls,
const struct TALER_EXCHANGE_HttpResponse *hr); const struct TALER_EXCHANGE_AddAmlDecisionResponse *adr);
/** /**
* Inform the exchange that an AML decision has been taken. * Inform the exchange that an AML decision has been taken.
@ -5161,18 +5173,28 @@ TALER_EXCHANGE_add_aml_decision_cancel (
struct TALER_EXCHANGE_AddAmlDecision *rh); struct TALER_EXCHANGE_AddAmlDecision *rh);
/**
* Response when adding a partner exchange.
*/
struct TALER_EXCHANGE_ManagementAddPartnerResponse
{
/**
* HTTP response data.
*/
struct TALER_EXCHANGE_HttpResponse hr;
};
/** /**
* Function called with information about the change to * Function called with information about the change to
* an AML officer status. * an AML officer status.
* *
* @param cls closure * @param cls closure
* @param hr HTTP response data * @param apr response data
*/ */
// FIXME: bad API
typedef void typedef void
(*TALER_EXCHANGE_ManagementAddPartnerCallback) ( (*TALER_EXCHANGE_ManagementAddPartnerCallback) (
void *cls, void *cls,
const struct TALER_EXCHANGE_HttpResponse *hr); const struct TALER_EXCHANGE_ManagementAddPartnerResponse *apr);
/** /**
@ -5223,17 +5245,27 @@ TALER_EXCHANGE_management_add_partner_cancel (
struct TALER_EXCHANGE_ManagementAddPartner *rh); struct TALER_EXCHANGE_ManagementAddPartner *rh);
/**
* Response when enabling an auditor.
*/
struct TALER_EXCHANGE_ManagementAuditorEnableResponse
{
/**
* HTTP response data.
*/
struct TALER_EXCHANGE_HttpResponse hr;
};
/** /**
* Function called with information about the auditor setup operation result. * Function called with information about the auditor setup operation result.
* *
* @param cls closure * @param cls closure
* @param hr HTTP response data * @param aer response data
*/ */
// FIXME: bad API
typedef void typedef void
(*TALER_EXCHANGE_ManagementAuditorEnableCallback) ( (*TALER_EXCHANGE_ManagementAuditorEnableCallback) (
void *cls, void *cls,
const struct TALER_EXCHANGE_HttpResponse *hr); const struct TALER_EXCHANGE_ManagementAuditorEnableResponse *aer);
/** /**
@ -5278,18 +5310,27 @@ void
TALER_EXCHANGE_management_enable_auditor_cancel ( TALER_EXCHANGE_management_enable_auditor_cancel (
struct TALER_EXCHANGE_ManagementAuditorEnableHandle *ah); struct TALER_EXCHANGE_ManagementAuditorEnableHandle *ah);
/**
* Response when disabling an auditor.
*/
struct TALER_EXCHANGE_ManagementAuditorDisableResponse
{
/**
* HTTP response data.
*/
struct TALER_EXCHANGE_HttpResponse hr;
};
/** /**
* Function called with information about the auditor disable operation result. * Function called with information about the auditor disable operation result.
* *
* @param cls closure * @param cls closure
* @param hr HTTP response data * @param adr HTTP response data
*/ */
// FIXME: bad API
typedef void typedef void
(*TALER_EXCHANGE_ManagementAuditorDisableCallback) ( (*TALER_EXCHANGE_ManagementAuditorDisableCallback) (
void *cls, void *cls,
const struct TALER_EXCHANGE_HttpResponse *hr); const struct TALER_EXCHANGE_ManagementAuditorDisableResponse *adr);
/** /**
@ -5467,17 +5508,27 @@ TALER_EXCHANGE_management_disable_wire_cancel (
struct TALER_EXCHANGE_ManagementWireDisableHandle *wh); struct TALER_EXCHANGE_ManagementWireDisableHandle *wh);
/**
* Response when setting wire fees.
*/
struct TALER_EXCHANGE_ManagementSetWireFeeResponse
{
/**
* HTTP response data.
*/
struct TALER_EXCHANGE_HttpResponse hr;
};
/** /**
* Function called with information about the wire enable operation result. * Function called with information about the wire enable operation result.
* *
* @param cls closure * @param cls closure
* @param hr HTTP response data * @param wfr response data
*/ */
// FIXME: bad API
typedef void typedef void
(*TALER_EXCHANGE_ManagementSetWireFeeCallback) ( (*TALER_EXCHANGE_ManagementSetWireFeeCallback) (
void *cls, void *cls,
const struct TALER_EXCHANGE_HttpResponse *hr); const struct TALER_EXCHANGE_ManagementSetWireFeeResponse *wfr);
/** /**
@ -5524,17 +5575,28 @@ TALER_EXCHANGE_management_set_wire_fees_cancel (
struct TALER_EXCHANGE_ManagementSetWireFeeHandle *swfh); struct TALER_EXCHANGE_ManagementSetWireFeeHandle *swfh);
/**
* Response when setting global fees.
*/
struct TALER_EXCHANGE_ManagementSetGlobalFeeResponse
{
/**
* HTTP response data.
*/
struct TALER_EXCHANGE_HttpResponse hr;
};
/** /**
* Function called with information about the global fee setting operation result. * Function called with information about the global fee setting operation result.
* *
* @param cls closure * @param cls closure
* @param hr HTTP response data * @param gfr HTTP response data
*/ */
// FIXME: bad API
typedef void typedef void
(*TALER_EXCHANGE_ManagementSetGlobalFeeCallback) ( (*TALER_EXCHANGE_ManagementSetGlobalFeeCallback) (
void *cls, void *cls,
const struct TALER_EXCHANGE_HttpResponse *hr); const struct TALER_EXCHANGE_ManagementSetGlobalFeeResponse *gfr);
/** /**
@ -5585,18 +5647,29 @@ TALER_EXCHANGE_management_set_global_fees_cancel (
struct TALER_EXCHANGE_ManagementSetGlobalFeeHandle *sgfh); struct TALER_EXCHANGE_ManagementSetGlobalFeeHandle *sgfh);
/**
* Response when adding denomination signature by auditor.
*/
struct TALER_EXCHANGE_AuditorAddDenominationResponse
{
/**
* HTTP response data.
*/
struct TALER_EXCHANGE_HttpResponse hr;
};
/** /**
* Function called with information about the POST * Function called with information about the POST
* /auditor/$AUDITOR_PUB/$H_DENOM_PUB operation result. * /auditor/$AUDITOR_PUB/$H_DENOM_PUB operation result.
* *
* @param cls closure * @param cls closure
* @param hr HTTP response data * @param adr HTTP response data
*/ */
// FIXME: bad API
typedef void typedef void
(*TALER_EXCHANGE_AuditorAddDenominationCallback) ( (*TALER_EXCHANGE_AuditorAddDenominationCallback) (
void *cls, void *cls,
const struct TALER_EXCHANGE_HttpResponse *hr); const struct TALER_EXCHANGE_AuditorAddDenominationResponse *adr);
/** /**

View File

@ -79,9 +79,9 @@ handle_add_aml_decision_finished (void *cls,
{ {
struct TALER_EXCHANGE_AddAmlDecision *wh = cls; struct TALER_EXCHANGE_AddAmlDecision *wh = cls;
const json_t *json = response; const json_t *json = response;
struct TALER_EXCHANGE_HttpResponse hr = { struct TALER_EXCHANGE_AddAmlDecisionResponse adr = {
.http_status = (unsigned int) response_code, .hr.http_status = (unsigned int) response_code,
.reply = json .hr.reply = json
}; };
wh->job = NULL; wh->job = NULL;
@ -89,34 +89,34 @@ handle_add_aml_decision_finished (void *cls,
{ {
case 0: case 0:
/* no reply */ /* no reply */
hr.ec = TALER_EC_GENERIC_INVALID_RESPONSE; adr.hr.ec = TALER_EC_GENERIC_INVALID_RESPONSE;
hr.hint = "server offline?"; adr.hr.hint = "server offline?";
break; break;
case MHD_HTTP_NO_CONTENT: case MHD_HTTP_NO_CONTENT:
break; break;
case MHD_HTTP_FORBIDDEN: case MHD_HTTP_FORBIDDEN:
hr.ec = TALER_JSON_get_error_code (json); adr.hr.ec = TALER_JSON_get_error_code (json);
hr.hint = TALER_JSON_get_error_hint (json); adr.hr.hint = TALER_JSON_get_error_hint (json);
break; break;
case MHD_HTTP_CONFLICT: case MHD_HTTP_CONFLICT:
hr.ec = TALER_JSON_get_error_code (json); adr.hr.ec = TALER_JSON_get_error_code (json);
hr.hint = TALER_JSON_get_error_hint (json); adr.hr.hint = TALER_JSON_get_error_hint (json);
break; break;
default: default:
/* unexpected response code */ /* unexpected response code */
GNUNET_break_op (0); GNUNET_break_op (0);
hr.ec = TALER_JSON_get_error_code (json); adr.hr.ec = TALER_JSON_get_error_code (json);
hr.hint = TALER_JSON_get_error_hint (json); adr.hr.hint = TALER_JSON_get_error_hint (json);
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Unexpected response code %u/%d for exchange AML decision\n", "Unexpected response code %u/%d for exchange AML decision\n",
(unsigned int) response_code, (unsigned int) response_code,
(int) hr.ec); (int) adr.hr.ec);
break; break;
} }
if (NULL != wh->cb) if (NULL != wh->cb)
{ {
wh->cb (wh->cb_cls, wh->cb (wh->cb_cls,
&hr); &adr);
wh->cb = NULL; wh->cb = NULL;
} }
TALER_EXCHANGE_add_aml_decision_cancel (wh); TALER_EXCHANGE_add_aml_decision_cancel (wh);

View File

@ -79,9 +79,9 @@ handle_auditor_add_denomination_finished (void *cls,
{ {
struct TALER_EXCHANGE_AuditorAddDenominationHandle *ah = cls; struct TALER_EXCHANGE_AuditorAddDenominationHandle *ah = cls;
const json_t *json = response; const json_t *json = response;
struct TALER_EXCHANGE_HttpResponse hr = { struct TALER_EXCHANGE_AuditorAddDenominationResponse adr = {
.http_status = (unsigned int) response_code, .hr.http_status = (unsigned int) response_code,
.reply = json .hr.reply = json
}; };
ah->job = NULL; ah->job = NULL;
@ -90,37 +90,37 @@ handle_auditor_add_denomination_finished (void *cls,
case MHD_HTTP_NO_CONTENT: case MHD_HTTP_NO_CONTENT:
break; break;
case MHD_HTTP_FORBIDDEN: case MHD_HTTP_FORBIDDEN:
hr.ec = TALER_JSON_get_error_code (json); adr.hr.ec = TALER_JSON_get_error_code (json);
hr.hint = TALER_JSON_get_error_hint (json); adr.hr.hint = TALER_JSON_get_error_hint (json);
break; break;
case MHD_HTTP_NOT_FOUND: case MHD_HTTP_NOT_FOUND:
hr.ec = TALER_JSON_get_error_code (json); adr.hr.ec = TALER_JSON_get_error_code (json);
hr.hint = TALER_JSON_get_error_hint (json); adr.hr.hint = TALER_JSON_get_error_hint (json);
break; break;
case MHD_HTTP_GONE: case MHD_HTTP_GONE:
hr.ec = TALER_JSON_get_error_code (json); adr.hr.ec = TALER_JSON_get_error_code (json);
hr.hint = TALER_JSON_get_error_hint (json); adr.hr.hint = TALER_JSON_get_error_hint (json);
break; break;
case MHD_HTTP_PRECONDITION_FAILED: case MHD_HTTP_PRECONDITION_FAILED:
hr.ec = TALER_JSON_get_error_code (json); adr.hr.ec = TALER_JSON_get_error_code (json);
hr.hint = TALER_JSON_get_error_hint (json); adr.hr.hint = TALER_JSON_get_error_hint (json);
break; break;
default: default:
/* unexpected response code */ /* unexpected response code */
if (NULL != json) if (NULL != json)
{ {
hr.ec = TALER_JSON_get_error_code (json); adr.hr.ec = TALER_JSON_get_error_code (json);
hr.hint = TALER_JSON_get_error_hint (json); adr.hr.hint = TALER_JSON_get_error_hint (json);
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Unexpected response code %u/%d for exchange auditor-add-denomination at URL `%s'\n", "Unexpected response code %u/%d for exchange auditor-add-denomination at URL `%s'\n",
(unsigned int) response_code, (unsigned int) response_code,
(int) hr.ec, (int) adr.hr.ec,
ah->url); ah->url);
} }
else else
{ {
hr.ec = TALER_EC_GENERIC_INVALID_RESPONSE; adr.hr.ec = TALER_EC_GENERIC_INVALID_RESPONSE;
hr.hint = NULL; adr.hr.hint = NULL;
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Unexpected HTTP response code %u (no JSON returned) at URL `%s'\n", "Unexpected HTTP response code %u (no JSON returned) at URL `%s'\n",
(unsigned int) response_code, (unsigned int) response_code,
@ -131,7 +131,7 @@ handle_auditor_add_denomination_finished (void *cls,
if (NULL != ah->cb) if (NULL != ah->cb)
{ {
ah->cb (ah->cb_cls, ah->cb (ah->cb_cls,
&hr); &adr);
ah->cb = NULL; ah->cb = NULL;
} }
TALER_EXCHANGE_add_auditor_denomination_cancel (ah); TALER_EXCHANGE_add_auditor_denomination_cancel (ah);

View File

@ -79,9 +79,9 @@ handle_add_partner_finished (void *cls,
{ {
struct TALER_EXCHANGE_ManagementAddPartner *wh = cls; struct TALER_EXCHANGE_ManagementAddPartner *wh = cls;
const json_t *json = response; const json_t *json = response;
struct TALER_EXCHANGE_HttpResponse hr = { struct TALER_EXCHANGE_ManagementAddPartnerResponse apr = {
.http_status = (unsigned int) response_code, .hr.http_status = (unsigned int) response_code,
.reply = json .hr.reply = json
}; };
wh->job = NULL; wh->job = NULL;
@ -89,34 +89,34 @@ handle_add_partner_finished (void *cls,
{ {
case 0: case 0:
/* no reply */ /* no reply */
hr.ec = TALER_EC_GENERIC_INVALID_RESPONSE; apr.hr.ec = TALER_EC_GENERIC_INVALID_RESPONSE;
hr.hint = "server offline?"; apr.hr.hint = "server offline?";
break; break;
case MHD_HTTP_NO_CONTENT: case MHD_HTTP_NO_CONTENT:
break; break;
case MHD_HTTP_FORBIDDEN: case MHD_HTTP_FORBIDDEN:
hr.ec = TALER_JSON_get_error_code (json); apr.hr.ec = TALER_JSON_get_error_code (json);
hr.hint = TALER_JSON_get_error_hint (json); apr.hr.hint = TALER_JSON_get_error_hint (json);
break; break;
case MHD_HTTP_CONFLICT: case MHD_HTTP_CONFLICT:
hr.ec = TALER_JSON_get_error_code (json); apr.hr.ec = TALER_JSON_get_error_code (json);
hr.hint = TALER_JSON_get_error_hint (json); apr.hr.hint = TALER_JSON_get_error_hint (json);
break; break;
default: default:
/* unexpected response code */ /* unexpected response code */
GNUNET_break_op (0); GNUNET_break_op (0);
hr.ec = TALER_JSON_get_error_code (json); apr.hr.ec = TALER_JSON_get_error_code (json);
hr.hint = TALER_JSON_get_error_hint (json); apr.hr.hint = TALER_JSON_get_error_hint (json);
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Unexpected response code %u/%d for adding exchange partner\n", "Unexpected response code %u/%d for adding exchange partner\n",
(unsigned int) response_code, (unsigned int) response_code,
(int) hr.ec); (int) apr.hr.ec);
break; break;
} }
if (NULL != wh->cb) if (NULL != wh->cb)
{ {
wh->cb (wh->cb_cls, wh->cb (wh->cb_cls,
&hr); &apr);
wh->cb = NULL; wh->cb = NULL;
} }
TALER_EXCHANGE_management_add_partner_cancel (wh); TALER_EXCHANGE_management_add_partner_cancel (wh);

View File

@ -81,9 +81,9 @@ handle_auditor_disable_finished (void *cls,
{ {
struct TALER_EXCHANGE_ManagementAuditorDisableHandle *ah = cls; struct TALER_EXCHANGE_ManagementAuditorDisableHandle *ah = cls;
const json_t *json = response; const json_t *json = response;
struct TALER_EXCHANGE_HttpResponse hr = { struct TALER_EXCHANGE_ManagementAuditorDisableResponse adr = {
.http_status = (unsigned int) response_code, .hr.http_status = (unsigned int) response_code,
.reply = json .hr.reply = json
}; };
ah->job = NULL; ah->job = NULL;
@ -92,32 +92,32 @@ handle_auditor_disable_finished (void *cls,
case MHD_HTTP_NO_CONTENT: case MHD_HTTP_NO_CONTENT:
break; break;
case MHD_HTTP_FORBIDDEN: case MHD_HTTP_FORBIDDEN:
hr.ec = TALER_JSON_get_error_code (json); adr.hr.ec = TALER_JSON_get_error_code (json);
hr.hint = TALER_JSON_get_error_hint (json); adr.hr.hint = TALER_JSON_get_error_hint (json);
break; break;
case MHD_HTTP_NOT_FOUND: case MHD_HTTP_NOT_FOUND:
hr.ec = TALER_JSON_get_error_code (json); adr.hr.ec = TALER_JSON_get_error_code (json);
hr.hint = TALER_JSON_get_error_hint (json); adr.hr.hint = TALER_JSON_get_error_hint (json);
break; break;
case MHD_HTTP_CONFLICT: case MHD_HTTP_CONFLICT:
hr.ec = TALER_JSON_get_error_code (json); adr.hr.ec = TALER_JSON_get_error_code (json);
hr.hint = TALER_JSON_get_error_hint (json); adr.hr.hint = TALER_JSON_get_error_hint (json);
break; break;
default: default:
/* unexpected response code */ /* unexpected response code */
GNUNET_break_op (0); GNUNET_break_op (0);
hr.ec = TALER_JSON_get_error_code (json); adr.hr.ec = TALER_JSON_get_error_code (json);
hr.hint = TALER_JSON_get_error_hint (json); adr.hr.hint = TALER_JSON_get_error_hint (json);
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Unexpected response code %u/%d for exchange management auditor disable\n", "Unexpected response code %u/%d for exchange management auditor disable\n",
(unsigned int) response_code, (unsigned int) response_code,
(int) hr.ec); (int) adr.hr.ec);
break; break;
} }
if (NULL != ah->cb) if (NULL != ah->cb)
{ {
ah->cb (ah->cb_cls, ah->cb (ah->cb_cls,
&hr); &adr);
ah->cb = NULL; ah->cb = NULL;
} }
TALER_EXCHANGE_management_disable_auditor_cancel (ah); TALER_EXCHANGE_management_disable_auditor_cancel (ah);

View File

@ -82,9 +82,9 @@ handle_auditor_enable_finished (void *cls,
{ {
struct TALER_EXCHANGE_ManagementAuditorEnableHandle *ah = cls; struct TALER_EXCHANGE_ManagementAuditorEnableHandle *ah = cls;
const json_t *json = response; const json_t *json = response;
struct TALER_EXCHANGE_HttpResponse hr = { struct TALER_EXCHANGE_ManagementAuditorEnableResponse aer = {
.http_status = (unsigned int) response_code, .hr.http_status = (unsigned int) response_code,
.reply = json .hr.reply = json
}; };
ah->job = NULL; ah->job = NULL;
@ -93,28 +93,28 @@ handle_auditor_enable_finished (void *cls,
case MHD_HTTP_NO_CONTENT: case MHD_HTTP_NO_CONTENT:
break; break;
case MHD_HTTP_FORBIDDEN: case MHD_HTTP_FORBIDDEN:
hr.ec = TALER_JSON_get_error_code (json); aer.hr.ec = TALER_JSON_get_error_code (json);
hr.hint = TALER_JSON_get_error_hint (json); aer.hr.hint = TALER_JSON_get_error_hint (json);
break; break;
case MHD_HTTP_CONFLICT: case MHD_HTTP_CONFLICT:
hr.ec = TALER_JSON_get_error_code (json); aer.hr.ec = TALER_JSON_get_error_code (json);
hr.hint = TALER_JSON_get_error_hint (json); aer.hr.hint = TALER_JSON_get_error_hint (json);
break; break;
default: default:
/* unexpected response code */ /* unexpected response code */
GNUNET_break_op (0); GNUNET_break_op (0);
hr.ec = TALER_JSON_get_error_code (json); aer.hr.ec = TALER_JSON_get_error_code (json);
hr.hint = TALER_JSON_get_error_hint (json); aer.hr.hint = TALER_JSON_get_error_hint (json);
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Unexpected response code %u/%d for exchange management auditor enable\n", "Unexpected response code %u/%d for exchange management auditor enable\n",
(unsigned int) response_code, (unsigned int) response_code,
(int) hr.ec); (int) aer.hr.ec);
break; break;
} }
if (NULL != ah->cb) if (NULL != ah->cb)
{ {
ah->cb (ah->cb_cls, ah->cb (ah->cb_cls,
&hr); &aer);
ah->cb = NULL; ah->cb = NULL;
} }
TALER_EXCHANGE_management_enable_auditor_cancel (ah); TALER_EXCHANGE_management_enable_auditor_cancel (ah);

View File

@ -126,7 +126,7 @@ struct TALER_EXCHANGE_ManagementPostExtensionsHandle *
TALER_EXCHANGE_management_post_extensions ( TALER_EXCHANGE_management_post_extensions (
struct GNUNET_CURL_Context *ctx, struct GNUNET_CURL_Context *ctx,
const char *url, const char *url,
struct TALER_EXCHANGE_ManagementPostExtensionsData *ped, const struct TALER_EXCHANGE_ManagementPostExtensionsData *ped,
TALER_EXCHANGE_ManagementPostExtensionsCallback cb, TALER_EXCHANGE_ManagementPostExtensionsCallback cb,
void *cb_cls) void *cb_cls)
{ {
@ -151,7 +151,7 @@ TALER_EXCHANGE_management_post_extensions (
body = GNUNET_JSON_PACK ( body = GNUNET_JSON_PACK (
GNUNET_JSON_pack_object_steal ("extensions", GNUNET_JSON_pack_object_steal ("extensions",
ped->extensions), (json_t *) ped->extensions),
GNUNET_JSON_pack_data_auto ("extensions_sig", GNUNET_JSON_pack_data_auto ("extensions_sig",
&ped->extensions_sig)); &ped->extensions_sig));

View File

@ -79,9 +79,9 @@ handle_set_global_fee_finished (void *cls,
{ {
struct TALER_EXCHANGE_ManagementSetGlobalFeeHandle *sgfh = cls; struct TALER_EXCHANGE_ManagementSetGlobalFeeHandle *sgfh = cls;
const json_t *json = response; const json_t *json = response;
struct TALER_EXCHANGE_HttpResponse hr = { struct TALER_EXCHANGE_ManagementSetGlobalFeeResponse sfr = {
.http_status = (unsigned int) response_code, .hr.http_status = (unsigned int) response_code,
.reply = json .hr.reply = json
}; };
sgfh->job = NULL; sgfh->job = NULL;
@ -90,32 +90,32 @@ handle_set_global_fee_finished (void *cls,
case MHD_HTTP_NO_CONTENT: case MHD_HTTP_NO_CONTENT:
break; break;
case MHD_HTTP_FORBIDDEN: case MHD_HTTP_FORBIDDEN:
hr.ec = TALER_JSON_get_error_code (json); sfr.hr.ec = TALER_JSON_get_error_code (json);
hr.hint = TALER_JSON_get_error_hint (json); sfr.hr.hint = TALER_JSON_get_error_hint (json);
break; break;
case MHD_HTTP_CONFLICT: case MHD_HTTP_CONFLICT:
hr.ec = TALER_JSON_get_error_code (json); sfr.hr.ec = TALER_JSON_get_error_code (json);
hr.hint = TALER_JSON_get_error_hint (json); sfr.hr.hint = TALER_JSON_get_error_hint (json);
break; break;
case MHD_HTTP_PRECONDITION_FAILED: case MHD_HTTP_PRECONDITION_FAILED:
hr.ec = TALER_JSON_get_error_code (json); sfr.hr.ec = TALER_JSON_get_error_code (json);
hr.hint = TALER_JSON_get_error_hint (json); sfr.hr.hint = TALER_JSON_get_error_hint (json);
break; break;
default: default:
/* unexpected response code */ /* unexpected response code */
GNUNET_break_op (0); GNUNET_break_op (0);
hr.ec = TALER_JSON_get_error_code (json); sfr.hr.ec = TALER_JSON_get_error_code (json);
hr.hint = TALER_JSON_get_error_hint (json); sfr.hr.hint = TALER_JSON_get_error_hint (json);
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Unexpected response code %u/%d for exchange management set global fee\n", "Unexpected response code %u/%d for exchange management set global fee\n",
(unsigned int) response_code, (unsigned int) response_code,
(int) hr.ec); (int) sfr.hr.ec);
break; break;
} }
if (NULL != sgfh->cb) if (NULL != sgfh->cb)
{ {
sgfh->cb (sgfh->cb_cls, sgfh->cb (sgfh->cb_cls,
&hr); &sfr);
sgfh->cb = NULL; sgfh->cb = NULL;
} }
TALER_EXCHANGE_management_set_global_fees_cancel (sgfh); TALER_EXCHANGE_management_set_global_fees_cancel (sgfh);

View File

@ -79,9 +79,9 @@ handle_set_wire_fee_finished (void *cls,
{ {
struct TALER_EXCHANGE_ManagementSetWireFeeHandle *swfh = cls; struct TALER_EXCHANGE_ManagementSetWireFeeHandle *swfh = cls;
const json_t *json = response; const json_t *json = response;
struct TALER_EXCHANGE_HttpResponse hr = { struct TALER_EXCHANGE_ManagementSetWireFeeResponse swr = {
.http_status = (unsigned int) response_code, .hr.http_status = (unsigned int) response_code,
.reply = json .hr.reply = json
}; };
swfh->job = NULL; swfh->job = NULL;
@ -90,32 +90,32 @@ handle_set_wire_fee_finished (void *cls,
case MHD_HTTP_NO_CONTENT: case MHD_HTTP_NO_CONTENT:
break; break;
case MHD_HTTP_FORBIDDEN: case MHD_HTTP_FORBIDDEN:
hr.ec = TALER_JSON_get_error_code (json); swr.hr.ec = TALER_JSON_get_error_code (json);
hr.hint = TALER_JSON_get_error_hint (json); swr.hr.hint = TALER_JSON_get_error_hint (json);
break; break;
case MHD_HTTP_CONFLICT: case MHD_HTTP_CONFLICT:
hr.ec = TALER_JSON_get_error_code (json); swr.hr.ec = TALER_JSON_get_error_code (json);
hr.hint = TALER_JSON_get_error_hint (json); swr.hr.hint = TALER_JSON_get_error_hint (json);
break; break;
case MHD_HTTP_PRECONDITION_FAILED: case MHD_HTTP_PRECONDITION_FAILED:
hr.ec = TALER_JSON_get_error_code (json); swr.hr.ec = TALER_JSON_get_error_code (json);
hr.hint = TALER_JSON_get_error_hint (json); swr.hr.hint = TALER_JSON_get_error_hint (json);
break; break;
default: default:
/* unexpected response code */ /* unexpected response code */
GNUNET_break_op (0); GNUNET_break_op (0);
hr.ec = TALER_JSON_get_error_code (json); swr.hr.ec = TALER_JSON_get_error_code (json);
hr.hint = TALER_JSON_get_error_hint (json); swr.hr.hint = TALER_JSON_get_error_hint (json);
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Unexpected response code %u/%d for exchange management set wire fee\n", "Unexpected response code %u/%d for exchange management set wire fee\n",
(unsigned int) response_code, (unsigned int) response_code,
(int) hr.ec); (int) swr.hr.ec);
break; break;
} }
if (NULL != swfh->cb) if (NULL != swfh->cb)
{ {
swfh->cb (swfh->cb_cls, swfh->cb (swfh->cb_cls,
&hr); &swr);
swfh->cb = NULL; swfh->cb = NULL;
} }
TALER_EXCHANGE_management_set_wire_fees_cancel (swfh); TALER_EXCHANGE_management_set_wire_fees_cancel (swfh);

View File

@ -62,13 +62,15 @@ struct AuditorAddState
* if the response code is acceptable. * if the response code is acceptable.
* *
* @param cls closure. * @param cls closure.
* @param hr HTTP response details * @param aer response details
*/ */
static void static void
auditor_add_cb (void *cls, auditor_add_cb (
const struct TALER_EXCHANGE_HttpResponse *hr) void *cls,
const struct TALER_EXCHANGE_ManagementAuditorEnableResponse *aer)
{ {
struct AuditorAddState *ds = cls; struct AuditorAddState *ds = cls;
const struct TALER_EXCHANGE_HttpResponse *hr = &aer->hr;
ds->dh = NULL; ds->dh = NULL;
if (ds->expected_response_code != hr->http_status) if (ds->expected_response_code != hr->http_status)

View File

@ -67,13 +67,15 @@ struct AuditorAddDenomSigState
* if the response code is acceptable. * if the response code is acceptable.
* *
* @param cls closure. * @param cls closure.
* @param hr HTTP response details * @param adr response details
*/ */
static void static void
denom_sig_add_cb (void *cls, denom_sig_add_cb (
const struct TALER_EXCHANGE_HttpResponse *hr) void *cls,
const struct TALER_EXCHANGE_AuditorAddDenominationResponse *adr)
{ {
struct AuditorAddDenomSigState *ds = cls; struct AuditorAddDenomSigState *ds = cls;
const struct TALER_EXCHANGE_HttpResponse *hr = &adr->hr;
ds->dh = NULL; ds->dh = NULL;
if (ds->expected_response_code != hr->http_status) if (ds->expected_response_code != hr->http_status)

View File

@ -62,13 +62,16 @@ struct AuditorDelState
* if the response code is acceptable. * if the response code is acceptable.
* *
* @param cls closure. * @param cls closure.
* @param hr HTTP response details * @param adr response details
*/ */
static void static void
auditor_del_cb (void *cls, auditor_del_cb (
const struct TALER_EXCHANGE_HttpResponse *hr) void *cls,
const struct TALER_EXCHANGE_ManagementAuditorDisableResponse *adr)
{ {
struct AuditorDelState *ds = cls; struct AuditorDelState *ds = cls;
const struct TALER_EXCHANGE_HttpResponse *hr = &adr->hr;
ds->dh = NULL; ds->dh = NULL;
if (ds->expected_response_code != hr->http_status) if (ds->expected_response_code != hr->http_status)

View File

@ -77,13 +77,14 @@ struct WireFeeState
* if the response code is acceptable. * if the response code is acceptable.
* *
* @param cls closure. * @param cls closure.
* @param hr HTTP response details * @param sfr response details
*/ */
static void static void
wire_add_cb (void *cls, wire_add_cb (void *cls,
const struct TALER_EXCHANGE_HttpResponse *hr) const struct TALER_EXCHANGE_ManagementSetWireFeeResponse *sfr)
{ {
struct WireFeeState *ds = cls; struct WireFeeState *ds = cls;
const struct TALER_EXCHANGE_HttpResponse *hr = &sfr->hr;
ds->dh = NULL; ds->dh = NULL;
if (ds->expected_response_code != hr->http_status) if (ds->expected_response_code != hr->http_status)

View File

@ -90,17 +90,19 @@ struct AmlDecisionState
/** /**
* Callback to analyze the /management/XXX response, just used to check * Callback to analyze the /aml-decision/$OFFICER_PUB response, just used to check
* if the response code is acceptable. * if the response code is acceptable.
* *
* @param cls closure. * @param cls closure.
* @param hr HTTP response details * @param adr response details
*/ */
static void static void
take_aml_decision_cb (void *cls, take_aml_decision_cb (
const struct TALER_EXCHANGE_HttpResponse *hr) void *cls,
const struct TALER_EXCHANGE_AddAmlDecisionResponse *adr)
{ {
struct AmlDecisionState *ds = cls; struct AmlDecisionState *ds = cls;
const struct TALER_EXCHANGE_HttpResponse *hr = &adr->hr;
ds->dh = NULL; ds->dh = NULL;
if (ds->expected_response != hr->http_status) if (ds->expected_response != hr->http_status)