donau

Donation authority for GNU Taler (experimental)
Log | Files | Refs | Submodules | README | LICENSE

donau_json_lib.h (4595B)


      1 /*
      2   This file is part of TALER
      3   Copyright (C) 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 include/donau_json_lib.h
     18  * @brief helper functions for JSON processing using libjansson
     19  * @author Lukas Matyja
     20  */
     21 #ifndef DONAU_JSON_LIB_H_
     22 #define DONAU_JSON_LIB_H_
     23 
     24 #include <jansson.h>
     25 #include <gnunet/gnunet_json_lib.h>
     26 #include <gnunet/gnunet_curl_lib.h>
     27 #include <gnunet/gnunet_json_lib.h>
     28 #include <taler/taler_util.h>
     29 #include <taler/taler_error_codes.h>
     30 #include "donau_util.h"
     31 #include <taler/taler_json_lib.h>
     32 
     33 /**
     34  * Generate a parser specification for a donation unit public key.
     35  *
     36  * @param field name of the field
     37  * @param[out] pk key to fill
     38  * @return corresponding field spec
     39  */
     40 struct GNUNET_JSON_Specification
     41 DONAU_JSON_spec_donation_unit_pub (
     42   const char *field,
     43   struct DONAU_DonationUnitPublicKey *pk);
     44 
     45 
     46 /**
     47  * Generate a parser for a group of donation units.
     48  *
     49  * @param[in] field name of the field, maybe NULL
     50  * @param[in] currency name of the currency
     51  * @param[out] group donation unit group information
     52  * @return corresponding field spec
     53  */
     54 struct GNUNET_JSON_Specification
     55 DONAU_JSON_spec_donation_unit_group (const char *field,
     56                                      const char *currency,
     57                                      struct DONAU_DonationUnitGroup *group);
     58 
     59 
     60 /**
     61  * Generate line in parser specification for a
     62  * blinded unique identifier.
     63  *
     64  * @param field name of the field
     65  * @param[out] blinded_udi the blinded unique identifier to initialize
     66  * @return corresponding field spec
     67  */
     68 struct GNUNET_JSON_Specification
     69 DONAU_JSON_spec_blinded_donation_identifier (
     70   const char *field,
     71   struct DONAU_BlindedUniqueDonorIdentifier *blinded_udi);
     72 
     73 
     74 /**
     75  * Generate line in parser specification for donation unit signature.
     76  *
     77  * @param field name of the field
     78  * @param[out] sig the signature to initialize
     79  * @return corresponding field spec
     80  */
     81 struct GNUNET_JSON_Specification
     82 DONAU_JSON_spec_blinded_donation_unit_sig (const char *field,
     83                                            struct
     84                                            DONAU_BlindedDonationUnitSignature *
     85                                            sig);
     86 
     87 
     88 /**
     89  * Generate packer instruction for a JSON field of type
     90  * unsigned integer.
     91  *
     92  * @param name name of the field to add to the object
     93  * @param num numeric value
     94  * @return json pack specification
     95  */
     96 struct GNUNET_JSON_PackSpec
     97 DONAU_JSON_pack_uint32 (const char *name,
     98                         uint64_t num);
     99 
    100 /**
    101  * Generate packer instruction for a JSON field of type
    102  * denomination public key.
    103  *
    104  * @param name name of the field to add to the object
    105  * @param pk public key
    106  * @return json pack specification
    107  */
    108 struct GNUNET_JSON_PackSpec
    109 DONAU_JSON_pack_donation_unit_pub (
    110   const char *name,
    111   const struct DONAU_DonationUnitPublicKey *pk);
    112 
    113 
    114 /**
    115  * Generate packer instruction for a JSON field of type
    116  * donation unit signature.
    117  *
    118  * @param name name of the field to add to the object
    119  * @param sig signature
    120  * @return json pack specification
    121  */
    122 struct GNUNET_JSON_PackSpec
    123 DONAU_JSON_pack_donation_unit_sig (
    124   const char *name,
    125   const struct DONAU_DonationUnitSignature *sig);
    126 
    127 
    128 /**
    129  * Generate packer instruction for a JSON field of type
    130  * blinded donation unit signature (that needs to be
    131  * unblinded before it becomes valid).
    132  *
    133  * @param name name of the field to add to the object
    134  * @param sig signature
    135  * @return json pack specification
    136  */
    137 struct GNUNET_JSON_PackSpec
    138 DONAU_JSON_pack_blinded_donation_unit_sig (
    139   const char *name,
    140   const struct DONAU_BlindedDonationUnitSignature *sig);
    141 
    142 /**
    143  * Generate packer instruction for a JSON field of type
    144  * blinded udi.
    145  *
    146  * @param name name of the field to add to the object
    147  * @param blinded_udi blinded unique donation identifier
    148  * @return json pack specification
    149  */
    150 struct GNUNET_JSON_PackSpec
    151 DONAU_JSON_pack_blinded_donation_identifier (
    152   const char *name,
    153   const struct DONAU_BlindedUniqueDonorIdentifier *blinded_udi);
    154 
    155 #endif