exchange

Base system with REST service to issue digital coins, run by the payment service provider
Log | Files | Refs | Submodules | README | LICENSE

taler-auditor-httpd.h (2857B)


      1 /*
      2   This file is part of TALER
      3   Copyright (C) 2014, 2015, 2018 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 taler-auditor-httpd.h
     18  * @brief Global declarations for the auditor
     19  * @author Florian Dold
     20  * @author Benedikt Mueller
     21  * @author Christian Grothoff
     22  */
     23 #ifndef TALER_AUDITOR_HTTPD_H
     24 #define TALER_AUDITOR_HTTPD_H
     25 
     26 #include <microhttpd.h>
     27 #include "auditordb_lib.h"
     28 #include "exchangedb_lib.h"
     29 
     30 
     31 /**
     32  * Our auditor database context.
     33  */
     34 extern struct TALER_AUDITORDB_PostgresContext *TAH_apg;
     35 
     36 /**
     37  * Our exchange database context.
     38  */
     39 extern struct TALER_EXCHANGEDB_PostgresContext *TAH_epg;
     40 
     41 /**
     42  * Exchange master public key (according to the
     43  * configuration).  (global)
     44  */
     45 extern struct TALER_MasterPublicKeyP TAH_master_public_key;
     46 
     47 /**
     48  * Absolute directory path where the auditor SPA data is located.
     49  *
     50  * Can be NULL.
     51  */
     52 extern char *TAH_spa_dir;
     53 
     54 /**
     55  * Our currency.
     56  */
     57 extern char *TAH_currency;
     58 
     59 /**
     60  * @brief Struct describing an URL and the handler for it.
     61  */
     62 struct TAH_RequestHandler
     63 {
     64 
     65   /**
     66    * URL the handler is for.
     67    */
     68   const char *url;
     69 
     70   /**
     71    * Method the handler is for, NULL for "all".
     72    */
     73   const char *method;
     74 
     75   /**
     76    * Mime type to use in reply (hint, can be NULL).
     77    */
     78   const char *mime_type;
     79 
     80   /**
     81    * Raw data for the @e handler
     82    */
     83   const void *data;
     84 
     85   /**
     86    * Number of bytes in @e data, 0 for 0-terminated.
     87    */
     88   size_t data_size;
     89 
     90   /**
     91    * Function to call to handle the request.
     92    *
     93    * @param rh this struct
     94    * @param connection the MHD connection to handle
     95    * @param[in,out] connection_cls the connection's closure (can be updated)
     96    * @param upload_data upload data
     97    * @param[in,out] upload_data_size number of bytes (left) in @a upload_data
     98    * @return MHD result code
     99    */
    100   enum MHD_Result (*handler)(
    101     /* const */ struct TAH_RequestHandler *rh,
    102     struct MHD_Connection *connection,
    103     void **connection_cls,
    104     const char *upload_data,
    105     size_t *upload_data_size,
    106     const char *const args[]);
    107 
    108   /**
    109    * Default response code.
    110    */
    111   unsigned int response_code;
    112 
    113   /**
    114    * Is client authentication required for this endpoint?
    115    */
    116   bool requires_auth;
    117 
    118   enum TALER_AUDITORDB_DeletableSuppressableTables table;
    119 };
    120 
    121 
    122 #endif