diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/exchange/taler-exchange-httpd.c | 29 | ||||
| -rw-r--r-- | src/exchange/taler-exchange-httpd_link.c | 4 | ||||
| -rw-r--r-- | src/exchange/taler-exchange-httpd_link.h | 4 | ||||
| -rw-r--r-- | src/exchange/taler-exchange-httpd_refreshes_reveal.c | 2 | ||||
| -rw-r--r-- | src/exchange/taler-exchange-httpd_refreshes_reveal.h | 6 | ||||
| -rw-r--r-- | src/include/taler_exchange_service.h | 8 | ||||
| -rw-r--r-- | src/lib/exchange_api_refresh_common.h | 18 | ||||
| -rw-r--r-- | src/lib/exchange_api_withdraw.c | 2 | ||||
| -rw-r--r-- | src/testing/testing_api_cmd_twister_exec_client.c | 14 | ||||
| -rw-r--r-- | src/testing/testing_api_twister_helpers.c | 2 | ||||
| -rw-r--r-- | src/util/amount.c | 34 | 
11 files changed, 59 insertions, 64 deletions
diff --git a/src/exchange/taler-exchange-httpd.c b/src/exchange/taler-exchange-httpd.c index d353a796..153bb19f 100644 --- a/src/exchange/taler-exchange-httpd.c +++ b/src/exchange/taler-exchange-httpd.c @@ -148,6 +148,20 @@ static unsigned long long req_max;  /** + * Signature of functions that handle operations on coins. + * + * @param connection the MHD connection to handle + * @param coin_pub the public key of the coin + * @param root uploaded JSON data + * @return MHD result code + */ +typedef int +(*CoinOpHandler)(struct MHD_Connection *connection, +                 const struct TALER_CoinSpendPublicKeyP *coin_pub, +                 const json_t *root); + + +/**   * Handle a "/coins/$COIN_PUB/$OP" POST request.  Parses the "coin_pub"   * EdDSA key of the coin and demultiplexes based on $OP.   * @@ -174,16 +188,9 @@ handle_post_coins (const struct TEH_RequestHandler *rh,      /**       * Function to call to perform the operation. -     * -     * @param connection the MHD connection to handle -     * @param coin_pub the public key of the coin -     * @param root uploaded JSON data -     * @return MHD result code -     */// -    int -    (*handler)(struct MHD_Connection *connection, -               const struct TALER_CoinSpendPublicKeyP *coin_pub, -               const json_t *root); +     */ +    CoinOpHandler handler; +    } h[] = {      {        .op = "deposit", @@ -301,7 +308,7 @@ is_valid_correlation_id (const char *correlation_id)   * @param url rest of the URL to parse   * @param inner_cls closure for the handler, if needed   * @param upload_data upload data to parse (if available) - * @param upload_data_size[in,out] number of bytes in @a upload_data + * @param[in,out] upload_data_size number of bytes in @a upload_data   * @return MHD result code   */  static int diff --git a/src/exchange/taler-exchange-httpd_link.c b/src/exchange/taler-exchange-httpd_link.c index 83d7f6a0..eaffa558 100644 --- a/src/exchange/taler-exchange-httpd_link.c +++ b/src/exchange/taler-exchange-httpd_link.c @@ -14,8 +14,8 @@    TALER; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>  */  /** - * @file taler-exchange-httpd_refresh_link.c - * @brief Handle /refresh/link requests + * @file taler-exchange-httpd_link.c + * @brief Handle /coins/$COIN_PUB/link requests   * @author Florian Dold   * @author Benedikt Mueller   * @author Christian Grothoff diff --git a/src/exchange/taler-exchange-httpd_link.h b/src/exchange/taler-exchange-httpd_link.h index 9469c471..7a39e21d 100644 --- a/src/exchange/taler-exchange-httpd_link.h +++ b/src/exchange/taler-exchange-httpd_link.h @@ -14,8 +14,8 @@    TALER; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>  */  /** - * @file taler-exchange-httpd_refresh_link.h - * @brief Handle /refresh/link requests + * @file taler-exchange-httpd_link.h + * @brief Handle /coins/$COIN_PUB/link requests   * @author Florian Dold   * @author Benedikt Mueller   * @author Christian Grothoff diff --git a/src/exchange/taler-exchange-httpd_refreshes_reveal.c b/src/exchange/taler-exchange-httpd_refreshes_reveal.c index e7e5b97d..ff5718fc 100644 --- a/src/exchange/taler-exchange-httpd_refreshes_reveal.c +++ b/src/exchange/taler-exchange-httpd_refreshes_reveal.c @@ -893,7 +893,7 @@ handle_refresh_reveal_json (struct MHD_Connection *connection,   * refreshed coins.   *   * @param rh context of the handler - * @param coin_pub public key of the coin + * @param connection MHD request handle   * @param root uploaded JSON data   * @param args array of additional options (length: 2, session hash and the string "reveal")   * @return MHD result code diff --git a/src/exchange/taler-exchange-httpd_refreshes_reveal.h b/src/exchange/taler-exchange-httpd_refreshes_reveal.h index afc9adce..04b46b1f 100644 --- a/src/exchange/taler-exchange-httpd_refreshes_reveal.h +++ b/src/exchange/taler-exchange-httpd_refreshes_reveal.h @@ -14,8 +14,8 @@    TALER; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>  */  /** - * @file taler-exchange-httpd_refresh_reveal.h - * @brief Handle /refresh/reveal requests + * @file taler-exchange-httpd_refreshes_reveal.h + * @brief Handle /refreshes/$RCH/reveal requests   * @author Florian Dold   * @author Benedikt Mueller   * @author Christian Grothoff @@ -38,7 +38,7 @@   * refreshed coins.   *   * @param rh context of the handler - * @param coin_pub public key of the coin + * @param connection MHD request handle   * @param root uploaded JSON data   * @param args array of additional options (length: 2, session hash and the string "reveal")   * @return MHD result code diff --git a/src/include/taler_exchange_service.h b/src/include/taler_exchange_service.h index 4e917df8..175f08f1 100644 --- a/src/include/taler_exchange_service.h +++ b/src/include/taler_exchange_service.h @@ -930,7 +930,7 @@ TALER_EXCHANGE_refund_cancel (struct TALER_EXCHANGE_RefundHandle *refund);  /** - * @brief A /reserve/status Handle + * @brief A /reserves/ GET Handle   */  struct TALER_EXCHANGE_ReservesGetHandle; @@ -1140,14 +1140,14 @@ TALER_EXCHANGE_reserves_get (struct TALER_EXCHANGE_Handle *exchange,  /** - * Cancel a reserve status request.  This function cannot be used + * Cancel a reserve GET request.  This function cannot be used   * on a request handle if a response is already served for it.   * - * @param rsh the reserve status request handle + * @param rgh the reserve request handle   */  void  TALER_EXCHANGE_reserves_get_cancel (struct -                                    TALER_EXCHANGE_ReservesGetHandle *rhh); +                                    TALER_EXCHANGE_ReservesGetHandle *rgh);  /* ********************* POST /reserves/$RESERVE_PUB/withdraw *********************** */ diff --git a/src/lib/exchange_api_refresh_common.h b/src/lib/exchange_api_refresh_common.h index 05988e65..9f2715a1 100644 --- a/src/lib/exchange_api_refresh_common.h +++ b/src/lib/exchange_api_refresh_common.h @@ -15,8 +15,8 @@    <http://www.gnu.org/licenses/>  */  /** - * @file lib/exchange_api_refresh.c - * @brief Implementation of the /refresh/melt+reveal requests of the exchange's HTTP API + * @file lib/exchange_api_refresh_common.h + * @brief shared (serialization) logic for refresh protocol   * @author Christian Grothoff   */  #ifndef REFRESH_COMMON_H @@ -202,18 +202,6 @@ struct MeltData  /** - * Serialize melt data. - * - * @param md data to serialize - * @param[out] res_size size of buffer returned - * @return serialized melt data - */ -char * -TALER_EXCHANGE_serialize_melt_data_ (const struct MeltData *md, -                                     size_t *res_size); - - -/**   * Deserialize melt data.   *   * @param buf serialized data @@ -229,7 +217,7 @@ TALER_EXCHANGE_deserialize_melt_data_ (const char *buf,   * Free all information associated with a melting session.  Note   * that we allow the melting session to be only partially initialized,   * as we use this function also when freeing melt data that was not - * fully initialized (i.e. due to failures in #deserialize_melt_data()). + * fully initialized (i.e. due to failures in #TALER_EXCHANGE_deserialize_melt_data_()).   *   * @param md melting data to release, the pointer itself is NOT   *           freed (as it is typically not allocated by itself) diff --git a/src/lib/exchange_api_withdraw.c b/src/lib/exchange_api_withdraw.c index e7be4153..47c05082 100644 --- a/src/lib/exchange_api_withdraw.c +++ b/src/lib/exchange_api_withdraw.c @@ -594,7 +594,7 @@ TALER_EXCHANGE_withdraw2 (struct TALER_EXCHANGE_Handle *exchange,   * Cancel a withdraw status request.  This function cannot be used   * on a request handle if a response is already served for it.   * - * @param sign the withdraw sign request handle + * @param wh the withdraw sign request handle   */  void  TALER_EXCHANGE_withdraw_cancel (struct TALER_EXCHANGE_WithdrawHandle *wh) diff --git a/src/testing/testing_api_cmd_twister_exec_client.c b/src/testing/testing_api_cmd_twister_exec_client.c index 6350d1d5..bfcfe459 100644 --- a/src/testing/testing_api_cmd_twister_exec_client.c +++ b/src/testing/testing_api_cmd_twister_exec_client.c @@ -18,7 +18,7 @@  */  /** - * @file include/testing_api_cmd_exec_client.h + * @file testing_api_cmd_twister_exec_client.c   * @brief test commands aimed to call the CLI twister client   *        to drive its behaviour.   * @author Christian Grothoff <christian@grothoff.org> @@ -189,7 +189,7 @@ hack_response_code_cleanup   * to other commands.   *   * @param cls closure - * @param ret[out] result (could be anything) + * @param[out] ret result (could be anything)   * @param trait name of the trait   * @param index index number of the object to offer.   * @return #GNUNET_OK on success @@ -316,7 +316,7 @@ delete_object_cleanup   * to other commands.   *   * @param cls closure - * @param ret[out] result (could be anything) + * @param[out] ret result (could be anything)   * @param trait name of the trait   * @param index index number of the object to offer.   * @return #GNUNET_OK on success @@ -404,7 +404,7 @@ modify_object_cleanup   * to other commands.   *   * @param cls closure - * @param ret[out] result (could be anything) + * @param[out] ret result (could be anything)   * @param trait name of the trait   * @param index index number of the object to offer.   * @return #GNUNET_OK on success @@ -559,7 +559,7 @@ flip_object_cleanup   * to other commands.   *   * @param cls closure - * @param ret[out] result (could be anything) + * @param[out] ret result (could be anything)   * @param trait name of the trait   * @param index index number of the object to offer.   * @return #GNUNET_OK on success @@ -742,7 +742,7 @@ malform_request_cleanup (void *cls,   * to other commands.   *   * @param cls closure - * @param ret[out] result (could be anything) + * @param[out] ret result (could be anything)   * @param trait name of the trait   * @param index index number of the object to offer.   * @return #GNUNET_OK on success @@ -829,7 +829,7 @@ malform_response_cleanup   * to other commands.   *   * @param cls closure - * @param ret[out] result (could be anything) + * @param[out] ret result (could be anything)   * @param trait name of the trait   * @param index index number of the object to offer.   * @return #GNUNET_OK on success diff --git a/src/testing/testing_api_twister_helpers.c b/src/testing/testing_api_twister_helpers.c index 6fab02c3..0406d798 100644 --- a/src/testing/testing_api_twister_helpers.c +++ b/src/testing/testing_api_twister_helpers.c @@ -18,7 +18,7 @@  */  /** - * @file twister/testing_api_helpers.c + * @file testing_api_twister_helpers.c   * @brief helper functions for test library.   * @author Christian Grothoff   * @author Marcello Stanisci diff --git a/src/util/amount.c b/src/util/amount.c index e50d9ad1..e443a0d2 100644 --- a/src/util/amount.c +++ b/src/util/amount.c @@ -54,7 +54,7 @@ invalidate (struct TALER_Amount *a)   */  int  TALER_string_to_amount (const char *str, -                        struct TALER_Amount *denom) +                        struct TALER_Amount *amount)  {    int n;    uint32_t b; @@ -68,7 +68,7 @@ TALER_string_to_amount (const char *str,    {      GNUNET_log (GNUNET_ERROR_TYPE_WARNING,                  "Null before currency\n"); -    invalidate (denom); +    invalidate (amount);      return GNUNET_SYSERR;    } @@ -80,16 +80,16 @@ TALER_string_to_amount (const char *str,      GNUNET_log (GNUNET_ERROR_TYPE_WARNING,                  "Invalid currency specified before colon: `%s'\n",                  str); -    invalidate (denom); +    invalidate (amount);      return GNUNET_SYSERR;    }    GNUNET_assert (TALER_CURRENCY_LEN > (colon - str)); -  memcpy (denom->currency, +  memcpy (amount->currency,            str,            colon - str);    /* 0-terminate *and* normalize buffer by setting everything to '\0' */ -  memset (&denom->currency [colon - str], +  memset (&amount->currency [colon - str],            0,            TALER_CURRENCY_LEN - (colon - str)); @@ -100,12 +100,12 @@ TALER_string_to_amount (const char *str,      GNUNET_log (GNUNET_ERROR_TYPE_WARNING,                  "Actual value missing in amount `%s'\n",                  str); -    invalidate (denom); +    invalidate (amount);      return GNUNET_SYSERR;    } -  denom->value = 0; -  denom->fraction = 0; +  amount->value = 0; +  amount->fraction = 0;    /* parse value */    while ('.' != *value) @@ -122,20 +122,20 @@ TALER_string_to_amount (const char *str,                    "Invalid character `%c' in amount `%s'\n",                    (int) *value,                    str); -      invalidate (denom); +      invalidate (amount);        return GNUNET_SYSERR;      }      n = *value - '0'; -    if ( (denom->value * 10 + n < denom->value) || -         (denom->value > MAX_AMOUNT_VALUE) ) +    if ( (amount->value * 10 + n < amount->value) || +         (amount->value > MAX_AMOUNT_VALUE) )      {        GNUNET_log (GNUNET_ERROR_TYPE_WARNING,                    "Value specified in amount `%s' is too large\n",                    str); -      invalidate (denom); +      invalidate (amount);        return GNUNET_SYSERR;      } -    denom->value = (denom->value * 10) + n; +    amount->value = (amount->value * 10) + n;      value++;    } @@ -148,7 +148,7 @@ TALER_string_to_amount (const char *str,      GNUNET_log (GNUNET_ERROR_TYPE_WARNING,                  "Amount `%s' ends abruptly after `.'\n",                  str); -    invalidate (denom); +    invalidate (amount);      return GNUNET_SYSERR;    }    b = TALER_AMOUNT_FRAC_BASE / 10; @@ -160,7 +160,7 @@ TALER_string_to_amount (const char *str,                    "Fractional value too small (only %u digits supported) in amount `%s'\n",                    (unsigned int) TALER_AMOUNT_FRAC_LEN,                    str); -      invalidate (denom); +      invalidate (amount);        return GNUNET_SYSERR;      }      if ( (*value < '0') || @@ -168,11 +168,11 @@ TALER_string_to_amount (const char *str,      {        GNUNET_log (GNUNET_ERROR_TYPE_WARNING,                    "Error after dot\n"); -      invalidate (denom); +      invalidate (amount);        return GNUNET_SYSERR;      }      n = *value - '0'; -    denom->fraction += n * b; +    amount->fraction += n * b;      b /= 10;      value++;    }  | 
