sync-httpd_config.c (2233B)
1 /* 2 This file is part of Sync 3 Copyright (C) 2020,2024 Taler Systems SA 4 5 Sync is free software; you can redistribute it and/or modify it under the 6 terms of the GNU Lesser General Public License as published by the Free Software 7 Foundation; either version 3, or (at your option) any later version. 8 9 Sync 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 Sync; see the file COPYING.GPL. If not, see <http://www.gnu.org/licenses/> 15 */ 16 /** 17 * @file sync/sync-httpd_config.c 18 * @brief headers for /config handler 19 * @author Christian Grothoff 20 */ 21 #include "platform.h" 22 #include "sync-httpd_config.h" 23 #include <taler/taler_json_lib.h> 24 25 26 /* 27 * Protocol version history: 28 * 29 * 0: original design 30 * 1: adds ?fresh=y to POST backup operation to force fresh contract 31 * to be created 32 */ 33 34 enum MHD_Result 35 SH_handler_config (struct SH_RequestHandler *rh, 36 struct MHD_Connection *connection, 37 void **connection_cls, 38 const char *upload_data, 39 size_t *upload_data_size) 40 { 41 static struct MHD_Response *response; 42 43 (void) connection_cls; 44 (void) upload_data; 45 (void) upload_data_size; 46 if (NULL == response) 47 { 48 response = TALER_MHD_MAKE_JSON_PACK ( 49 GNUNET_JSON_pack_string ("name", 50 "sync"), 51 GNUNET_JSON_pack_string ("implementation", 52 "urn:net:taler:specs:sync:c-reference"), 53 GNUNET_JSON_pack_uint64 ("storage_limit_in_megabytes", 54 SH_upload_limit_mb), 55 TALER_JSON_pack_amount ("liability_limit", 56 &SH_insurance), 57 TALER_JSON_pack_amount ("annual_fee", 58 &SH_annual_fee), 59 GNUNET_JSON_pack_string ("version", 60 "2:3:0")); 61 } 62 return MHD_queue_response (connection, 63 MHD_HTTP_OK, 64 response); 65 } 66 67 68 /* end of sync-httpd_config.c */