taler-auditor-httpd.h (2755B)
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 "taler/taler_auditordb_plugin.h" 28 #include "taler/taler_exchangedb_plugin.h" 29 30 31 /** 32 * Our DB plugin. 33 */ 34 extern struct TALER_AUDITORDB_Plugin *TAH_plugin; 35 36 /** 37 * Our DB plugin to talk to the *exchange* database. 38 */ 39 extern struct TALER_EXCHANGEDB_Plugin *TAH_eplugin; 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 * Our currency. 49 */ 50 extern char *TAH_currency; 51 52 /** 53 * @brief Struct describing an URL and the handler for it. 54 */ 55 struct TAH_RequestHandler 56 { 57 58 /** 59 * URL the handler is for. 60 */ 61 const char *url; 62 63 /** 64 * Method the handler is for, NULL for "all". 65 */ 66 const char *method; 67 68 /** 69 * Mime type to use in reply (hint, can be NULL). 70 */ 71 const char *mime_type; 72 73 /** 74 * Raw data for the @e handler 75 */ 76 const void *data; 77 78 /** 79 * Number of bytes in @e data, 0 for 0-terminated. 80 */ 81 size_t data_size; 82 83 /** 84 * Function to call to handle the request. 85 * 86 * @param rh this struct 87 * @param connection the MHD connection to handle 88 * @param[in,out] connection_cls the connection's closure (can be updated) 89 * @param upload_data upload data 90 * @param[in,out] upload_data_size number of bytes (left) in @a upload_data 91 * @return MHD result code 92 */ 93 MHD_RESULT (*handler)( 94 /* const */ struct TAH_RequestHandler *rh, 95 struct MHD_Connection *connection, 96 void **connection_cls, 97 const char *upload_data, 98 size_t *upload_data_size, 99 const char *const args[]); 100 101 /** 102 * Default response code. 103 */ 104 unsigned int response_code; 105 106 /** 107 * Is client authentication required for this endpoint? 108 */ 109 bool requires_auth; 110 111 enum TALER_AUDITORDB_DeletableSuppressableTables table; 112 }; 113 114 115 #endif