stream_process_reply.h (4322B)
1 /* SPDX-License-Identifier: LGPL-2.1-or-later OR (GPL-2.0-or-later WITH eCos-exception-2.0) */ 2 /* 3 This file is part of GNU libmicrohttpd. 4 Copyright (C) 2024 Evgeny Grin (Karlson2k) 5 6 GNU libmicrohttpd is free software; you can redistribute it and/or 7 modify it under the terms of the GNU Lesser General Public 8 License as published by the Free Software Foundation; either 9 version 2.1 of the License, or (at your option) any later version. 10 11 GNU libmicrohttpd is distributed in the hope that it will be useful, 12 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 Lesser General Public License for more details. 15 16 Alternatively, you can redistribute GNU libmicrohttpd and/or 17 modify it under the terms of the GNU General Public License as 18 published by the Free Software Foundation; either version 2 of 19 the License, or (at your option) any later version, together 20 with the eCos exception, as follows: 21 22 As a special exception, if other files instantiate templates or 23 use macros or inline functions from this file, or you compile this 24 file and link it with other works to produce a work based on this 25 file, this file does not by itself cause the resulting work to be 26 covered by the GNU General Public License. However the source code 27 for this file must still be made available in accordance with 28 section (3) of the GNU General Public License v2. 29 30 This exception does not invalidate any other reasons why a work 31 based on this file might be covered by the GNU General Public 32 License. 33 34 You should have received copies of the GNU Lesser General Public 35 License and the GNU General Public License along with this library; 36 if not, see <https://www.gnu.org/licenses/>. 37 */ 38 39 /** 40 * @file src/mhd2/stream_process_reply.h 41 * @brief The declarations of internal functions for forming and sending 42 * replies for requests 43 * @author Karlson2k (Evgeny Grin) 44 */ 45 46 #ifndef MHD_STREAM_PROCESS_REPLY_H 47 #define MHD_STREAM_PROCESS_REPLY_H 1 48 49 #include "mhd_sys_options.h" 50 51 #include "sys_bool_type.h" 52 53 struct MHD_Connection; /* forward declaration */ 54 55 56 /** 57 * Check whether Dynamic Content Creator cleanup callback is set and 58 * call it, if needed. 59 * Un-set cleanup callback after calling. 60 * @param c the connection to process 61 */ 62 MHD_INTERNAL void 63 mhd_stream_call_dcc_cleanup_if_needed (struct MHD_Connection *restrict c) 64 MHD_FN_PAR_NONNULL_ALL_; 65 66 /** 67 * Produce time stamp. 68 * 69 * Result is NOT null-terminated. 70 * Result is always 29 bytes long. 71 * 72 * @param[out] date where to write the time stamp, with 73 * at least 29 bytes of available space. 74 */ 75 MHD_INTERNAL bool 76 mhd_build_date_str (char date[MHD_FN_PAR_FIX_ARR_SIZE_ (29)]) 77 MHD_FN_PAR_NONNULL_ALL_ MHD_FN_PAR_OUT_ (1); 78 /** 79 * Allocate the connection's write buffer and fill it with all of the 80 * headers from the response. 81 * Required headers are added here. 82 * 83 * @param c the connection to process 84 * @return 'true' if state has been update, 85 * 'false' if connection is going to be aborted 86 */ 87 MHD_INTERNAL bool 88 mhd_stream_build_header_response (struct MHD_Connection *restrict c) 89 MHD_FN_PAR_NONNULL_ALL_; 90 91 92 /** 93 * Prepare the unchunked response content of this connection for sending. 94 * 95 * @param c the connection 96 * @return 'true' if connection new state could be processed now, 97 * 'false' if no new state processing is needed. 98 */ 99 MHD_INTERNAL bool 100 mhd_stream_prep_unchunked_body (struct MHD_Connection *restrict c) 101 MHD_FN_PAR_NONNULL_ALL_; 102 103 104 /** 105 * Prepare the chunked response content of this connection for sending. 106 * 107 * @param c the connection 108 * 109 * @return 'true' if connection new state could be processed now, 110 * 'false' if no new state processing is needed. 111 */ 112 MHD_INTERNAL bool 113 mhd_stream_prep_chunked_body (struct MHD_Connection *restrict c) 114 MHD_FN_PAR_NONNULL_ALL_; 115 116 117 /** 118 * Allocate the connection's write buffer (if necessary) and fill it 119 * with response footers. 120 * 121 * @param c the connection 122 * 123 * @return 'true' if connection new state could be processed now, 124 * 'false' if no new state processing is needed. 125 */ 126 MHD_INTERNAL bool 127 mhd_stream_prep_chunked_footer (struct MHD_Connection *restrict c) 128 MHD_FN_PAR_NONNULL_ALL_; 129 130 #endif /* ! MHD_STREAM_PROCESS_REPLY_H */