| 1 | // SPDX-License-Identifier: GPL-3.0-or-later |
| 2 | |
| 3 | #ifndef NETDATA_PLUGINSD_FUNCTIONS_H |
| 4 | #define NETDATA_PLUGINSD_FUNCTIONS_H |
| 5 | |
| 6 | #include "pluginsd_internals.h" |
| 7 | |
| 8 | struct inflight_function { |
| 9 | nd_uuid_t transaction; |
| 10 | |
| 11 | int code; |
| 12 | int timeout_s; |
| 13 | STRING *function; |
| 14 | BUFFER *payload; |
| 15 | HTTP_ACCESS access; |
| 16 | const char *source; |
| 17 | |
| 18 | BUFFER *result_body_wb; |
| 19 | |
| 20 | usec_t *stop_monotonic_ut; // pointer to caller data |
| 21 | usec_t started_monotonic_ut; |
| 22 | usec_t sent_monotonic_ut; |
| 23 | PARSER *parser; |
| 24 | |
| 25 | bool sent_successfully; |
| 26 | |
| 27 | struct { |
| 28 | rrd_function_result_callback_t cb; |
| 29 | void *data; |
| 30 | } result; |
| 31 | |
| 32 | struct { |
| 33 | rrd_function_progress_cb_t cb; |
| 34 | void *data; |
| 35 | } progress; |
| 36 | }; |
| 37 | |
| 38 | PARSER_RC pluginsd_function(char **words, size_t num_words, PARSER *parser); |
| 39 | PARSER_RC pluginsd_function_result_begin(char **words, size_t num_words, PARSER *parser); |
| 40 | PARSER_RC pluginsd_function_progress(char **words, size_t num_words, PARSER *parser); |
| 41 | |
| 42 | void pluginsd_inflight_functions_init(PARSER *parser); |
| 43 | void pluginsd_inflight_functions_cleanup(PARSER *parser); |
| 44 | void pluginsd_inflight_functions_garbage_collect(PARSER *parser, usec_t now_ut); |
| 45 | |
| 46 | int pluginsd_function_execute_cb(struct rrd_function_execute *rfe, void *data); |
| 47 | |
| 48 | #endif //NETDATA_PLUGINSD_FUNCTIONS_H |