anastasis-httpd_truth.h (2941B)
1 /* 2 This file is part of Anastasis 3 Copyright (C) 2020-2022 Anastasis SARL 4 5 Anastasis 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 Anastasis 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 Anastasis; see the file COPYING. If not, see <http://www.gnu.org/licenses/> 15 */ 16 /** 17 * @file anastasis-httpd_truth.h 18 * @brief functions to handle incoming requests on /truth 19 * @author Dennis Neufeld 20 * @author Dominik Meister 21 * @author Christian Grothoff 22 */ 23 #ifndef ANASTASIS_HTTPD_TRUTH_H 24 #define ANASTASIS_HTTPD_TRUTH_H 25 #include <microhttpd.h> 26 27 /** 28 * Prepare all active POST truth solve requests for system shutdown. 29 */ 30 void 31 AH_truth_solve_shutdown (void); 32 33 34 /** 35 * Prepare all active POST truth challenge requests for system shutdown. 36 */ 37 void 38 AH_truth_challenge_shutdown (void); 39 40 /** 41 * Prepare all active POST truth requests for system shutdown. 42 */ 43 void 44 AH_truth_upload_shutdown (void); 45 46 47 /** 48 * Handle a POST to /truth/$UUID. 49 * 50 * @param[in,out] connection the MHD connection to handle 51 * @param[in,out] hc connection context 52 * @param truth_uuid the truth UUID 53 * @param truth_data truth data 54 * @param truth_data_size number of bytes (left) in @a truth_data 55 * @return MHD result code 56 */ 57 MHD_RESULT 58 AH_handler_truth_post ( 59 struct MHD_Connection *connection, 60 struct TM_HandlerContext *hc, 61 const struct ANASTASIS_CRYPTO_TruthUUIDP *truth_uuid, 62 const char *truth_data, 63 size_t *truth_data_size); 64 65 66 /** 67 * Handle a POST to /truth/$UUID/solve. 68 * 69 * @param[in,out] connection the MHD connection to handle 70 * @param[in,out] hc connection context 71 * @param truth_uuid the truth UUID 72 * @param truth_data truth data 73 * @param truth_data_size number of bytes (left) in @a truth_data 74 * @return MHD result code 75 */ 76 MHD_RESULT 77 AH_handler_truth_solve ( 78 struct MHD_Connection *connection, 79 struct TM_HandlerContext *hc, 80 const struct ANASTASIS_CRYPTO_TruthUUIDP *truth_uuid, 81 const char *upload_data, 82 size_t *upload_data_size); 83 84 85 /** 86 * Handle a POST to /truth/$UUID/challenge. 87 * 88 * @param[in,out] connection the MHD connection to handle 89 * @param[in,out] hc connection context 90 * @param truth_uuid the truth UUID 91 * @param truth_data truth data 92 * @param truth_data_size number of bytes (left) in @a truth_data 93 * @return MHD result code 94 */ 95 MHD_RESULT 96 AH_handler_truth_challenge ( 97 struct MHD_Connection *connection, 98 struct TM_HandlerContext *hc, 99 const struct ANASTASIS_CRYPTO_TruthUUIDP *truth_uuid, 100 const char *upload_data, 101 size_t *upload_data_size); 102 103 104 #endif