rename constants

This commit is contained in:
Christian Grothoff 2020-04-07 13:09:22 +02:00
parent aa65247662
commit 64a8bb6a86
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC

View File

@ -39,18 +39,18 @@
* Which version of the Taler protocol is implemented * Which version of the Taler protocol is implemented
* by this library? Used to determine compatibility. * by this library? Used to determine compatibility.
*/ */
#define TALER_PROTOCOL_CURRENT 7 #define EXCHANGE_PROTOCOL_CURRENT 7
/** /**
* How many versions are we backwards compatible with? * How many versions are we backwards compatible with?
*/ */
#define TALER_PROTOCOL_AGE 0 #define EXCHANGE_PROTOCOL_AGE 0
/** /**
* Current version for (local) JSON serialization of persisted * Current version for (local) JSON serialization of persisted
* /keys data. * /keys data.
*/ */
#define TALER_SERIALIZATION_FORMAT_VERSION 0 #define EXCHANGE_SERIALIZATION_FORMAT_VERSION 0
/** /**
@ -816,9 +816,6 @@ decode_keys_json (const json_t *resp_obj,
struct TALER_ExchangeSignatureP sig; struct TALER_ExchangeSignatureP sig;
struct GNUNET_HashContext *hash_context; struct GNUNET_HashContext *hash_context;
struct TALER_ExchangePublicKeyP pub; struct TALER_ExchangePublicKeyP pub;
unsigned int age;
unsigned int revision;
unsigned int current;
struct GNUNET_JSON_Specification mspec[] = { struct GNUNET_JSON_Specification mspec[] = {
GNUNET_JSON_spec_fixed_auto ("eddsa_sig", GNUNET_JSON_spec_fixed_auto ("eddsa_sig",
&sig), &sig),
@ -843,6 +840,9 @@ decode_keys_json (const json_t *resp_obj,
/* check the version */ /* check the version */
{ {
const char *ver; const char *ver;
unsigned int age;
unsigned int revision;
unsigned int current;
struct GNUNET_JSON_Specification spec[] = { struct GNUNET_JSON_Specification spec[] = {
GNUNET_JSON_spec_string ("version", GNUNET_JSON_spec_string ("version",
&ver), &ver),
@ -867,16 +867,16 @@ decode_keys_json (const json_t *resp_obj,
return GNUNET_SYSERR; return GNUNET_SYSERR;
} }
*vc = TALER_EXCHANGE_VC_MATCH; *vc = TALER_EXCHANGE_VC_MATCH;
if (TALER_PROTOCOL_CURRENT < current) if (EXCHANGE_PROTOCOL_CURRENT < current)
{ {
*vc |= TALER_EXCHANGE_VC_NEWER; *vc |= TALER_EXCHANGE_VC_NEWER;
if (TALER_PROTOCOL_CURRENT < current - age) if (EXCHANGE_PROTOCOL_CURRENT < current - age)
*vc |= TALER_EXCHANGE_VC_INCOMPATIBLE; *vc |= TALER_EXCHANGE_VC_INCOMPATIBLE;
} }
if (TALER_PROTOCOL_CURRENT > current) if (EXCHANGE_PROTOCOL_CURRENT > current)
{ {
*vc |= TALER_EXCHANGE_VC_OLDER; *vc |= TALER_EXCHANGE_VC_OLDER;
if (TALER_PROTOCOL_CURRENT - TALER_PROTOCOL_AGE > current) if (EXCHANGE_PROTOCOL_CURRENT - EXCHANGE_PROTOCOL_AGE > current)
*vc |= TALER_EXCHANGE_VC_INCOMPATIBLE; *vc |= TALER_EXCHANGE_VC_INCOMPATIBLE;
} }
key_data->version = GNUNET_strdup (ver); key_data->version = GNUNET_strdup (ver);
@ -1317,8 +1317,8 @@ keys_completed_cb (void *cls,
aold->num_denom_keys); aold->num_denom_keys);
memcpy (anew->denom_keys, memcpy (anew->denom_keys,
aold->denom_keys, aold->denom_keys,
aold->num_denom_keys * sizeof (struct aold->num_denom_keys
TALER_EXCHANGE_AuditorDenominationInfo)); * sizeof (struct TALER_EXCHANGE_AuditorDenominationInfo));
} }
/* Old auditors got just copied into new ones. */ /* Old auditors got just copied into new ones. */
@ -1868,7 +1868,7 @@ TALER_EXCHANGE_serialize_data (struct TALER_EXCHANGE_Handle *exchange)
} }
return json_pack ("{s:I, s:o, s:s, s:o}", return json_pack ("{s:I, s:o, s:s, s:o}",
"version", "version",
(json_int_t) TALER_SERIALIZATION_FORMAT_VERSION, (json_int_t) EXCHANGE_SERIALIZATION_FORMAT_VERSION,
"expire", "expire",
GNUNET_JSON_from_time_abs (exchange->key_data_expiration), GNUNET_JSON_from_time_abs (exchange->key_data_expiration),
"exchange_url", "exchange_url",