summaryrefslogtreecommitdiffstats
path: root/src/lib-program-client/program-client-private.h
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 09:51:24 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 09:51:24 +0000
commitf7548d6d28c313cf80e6f3ef89aed16a19815df1 (patch)
treea3f6f2a3f247293bee59ecd28e8cd8ceb6ca064a /src/lib-program-client/program-client-private.h
parentInitial commit. (diff)
downloaddovecot-f7548d6d28c313cf80e6f3ef89aed16a19815df1.tar.xz
dovecot-f7548d6d28c313cf80e6f3ef89aed16a19815df1.zip
Adding upstream version 1:2.3.19.1+dfsg1.upstream/1%2.3.19.1+dfsg1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/lib-program-client/program-client-private.h')
-rw-r--r--src/lib-program-client/program-client-private.h85
1 files changed, 85 insertions, 0 deletions
diff --git a/src/lib-program-client/program-client-private.h b/src/lib-program-client/program-client-private.h
new file mode 100644
index 0000000..5f6260a
--- /dev/null
+++ b/src/lib-program-client/program-client-private.h
@@ -0,0 +1,85 @@
+#ifndef PROGRAM_CLIENT_PRIVATE_H
+#define PROGRAM_CLIENT_PRIVATE_H
+
+#include "program-client.h"
+
+enum program_client_error {
+ PROGRAM_CLIENT_ERROR_NONE,
+ PROGRAM_CLIENT_ERROR_CONNECT_TIMEOUT,
+ PROGRAM_CLIENT_ERROR_RUN_TIMEOUT,
+ PROGRAM_CLIENT_ERROR_IO,
+ PROGRAM_CLIENT_ERROR_OTHER
+};
+
+struct program_client_extra_fd {
+ struct program_client *pclient;
+
+ int child_fd, parent_fd;
+ struct istream *input;
+ struct io *io;
+
+ program_client_fd_callback_t *callback;
+ void *context;
+};
+
+struct program_client {
+ pool_t pool;
+ struct program_client_settings set;
+
+ const char **args;
+ ARRAY_TYPE(const_string) envs;
+
+ struct event *event;
+
+ int fd_in, fd_out;
+ struct io *io;
+ struct timeout *to;
+ struct timeval start_time;
+
+ struct istream *input, *program_input, *raw_program_input;
+ struct ostream *output, *program_output, *raw_program_output;
+
+ struct iostream_pump *pump_in, *pump_out;
+
+ ARRAY(struct program_client_extra_fd) extra_fds;
+
+ program_client_callback_t *callback;
+ void *context;
+
+ bool other_error;
+ enum program_client_error error;
+ enum program_client_exit_status exit_status;
+
+ int (*connect) (struct program_client * pclient);
+ int (*close_output) (struct program_client * pclient);
+ void (*switch_ioloop) (struct program_client * pclient);
+ void (*disconnect) (struct program_client * pclient, bool force);
+ void (*destroy) (struct program_client * pclient);
+
+ bool debug:1;
+ bool disconnected:1;
+ bool output_seekable:1;
+ bool destroying:1;
+};
+
+void program_client_set_label(struct program_client *pclient,
+ const char *label);
+
+void program_client_init(struct program_client *pclient, pool_t pool,
+ const char *initial_label,
+ const char *const *args,
+ const struct program_client_settings *set)
+ ATTR_NULL(5);
+
+void program_client_init_streams(struct program_client *pclient);
+
+void program_client_connected(struct program_client *pclient);
+
+void program_client_fail(struct program_client *pclient,
+ enum program_client_error error);
+
+void program_client_program_input(struct program_client *pclient);
+
+void program_client_disconnected(struct program_client *pclient);
+
+#endif