paivana-httpd_helper.h (1961B)
1 /* 2 This file is part of GNUnet. 3 Copyright (C) 2026 Taler Systems SA 4 5 Paivana is free software; you can redistribute it and/or 6 modify it under the terms of the GNU General Public License 7 as published by the Free Software Foundation; either version 8 3, or (at your option) any later version. 9 10 Paivana is distributed in the hope that it will be useful, 11 but WITHOUT ANY WARRANTY; without even the implied warranty 12 of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See 13 the GNU General Public License for more details. 14 15 You should have received a copy of the GNU General Public 16 License along with Paivana; see the file COPYING. If not, 17 write to the Free Software Foundation, Inc., 51 Franklin 18 Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 */ 20 21 /** 22 * @author Christian Grothoff 23 * @file paivana-httpd_helper.h 24 * @brief helper functions 25 */ 26 #ifndef PAIVANA_HTTPD_HELPER_H 27 #define PAIVANA_HTTPD_HELPER_H 28 29 #include <stdbool.h> 30 #include <microhttpd.h> 31 #include <gnunet/gnunet_util_lib.h> 32 33 34 /** 35 * Obtain the client address of @a connection 36 * 37 * @param connection HTTP client connection 38 * @param[out] ca where to write the client address 39 * @param[out] ca_len number of bytes in @a ca 40 * @return true on success 41 */ 42 bool 43 PAIVANA_HTTPD_get_client_address (struct MHD_Connection *connection, 44 void **ca, 45 size_t *ca_len); 46 47 /** 48 * Determine the Base URL that the client made the HTTP request to. 49 * The URL returned will be without the trailing '/'. 50 * 51 * @param connection client connection used 52 * @param[out] buf where to write the base URL; buffer will be cleared 53 * and must be reaped by caller. 54 * @return false on error (no suitable HTTP headers found and nothing 55 * configured) 56 */ 57 bool 58 PAIVANA_HTTPD_get_base_url (struct MHD_Connection *connection, 59 struct GNUNET_Buffer *buf); 60 61 62 #endif