server-connection.h revision 32c779d5d0b3dabc697408e6b5d9d2e652180b33
7185b49f58c4cdb16d035ecc45e38ec9b1cd9bd0matthew_swift#ifndef SERVER_CONNECTION_H
7185b49f58c4cdb16d035ecc45e38ec9b1cd9bd0matthew_swift#define SERVER_CONNECTION_H
7185b49f58c4cdb16d035ecc45e38ec9b1cd9bd0matthew_swift
7185b49f58c4cdb16d035ecc45e38ec9b1cd9bd0matthew_swift#define SERVER_EXIT_CODE_DISCONNECTED 1000
7185b49f58c4cdb16d035ecc45e38ec9b1cd9bd0matthew_swift
7185b49f58c4cdb16d035ecc45e38ec9b1cd9bd0matthew_swiftstruct doveadm_server;
7185b49f58c4cdb16d035ecc45e38ec9b1cd9bd0matthew_swiftstruct server_connection;
7185b49f58c4cdb16d035ecc45e38ec9b1cd9bd0matthew_swiftstruct ssl_iostream;
8cf870d281dc8c242f083d14dfef05f24aa5fceeJnRouvignac
8cf870d281dc8c242f083d14dfef05f24aa5fceeJnRouvignactypedef void server_cmd_callback_t(int exit_code, const char *error,
7185b49f58c4cdb16d035ecc45e38ec9b1cd9bd0matthew_swift void *context);
7185b49f58c4cdb16d035ecc45e38ec9b1cd9bd0matthew_swift
7185b49f58c4cdb16d035ecc45e38ec9b1cd9bd0matthew_swiftint server_connection_create(struct doveadm_server *server,
7185b49f58c4cdb16d035ecc45e38ec9b1cd9bd0matthew_swift struct server_connection **conn_r);
8cf870d281dc8c242f083d14dfef05f24aa5fceeJnRouvignacvoid server_connection_destroy(struct server_connection **conn);
8cf870d281dc8c242f083d14dfef05f24aa5fceeJnRouvignac
8cf870d281dc8c242f083d14dfef05f24aa5fceeJnRouvignac/* Return the server given to create() */
8cf870d281dc8c242f083d14dfef05f24aa5fceeJnRouvignacstruct doveadm_server *
7185b49f58c4cdb16d035ecc45e38ec9b1cd9bd0matthew_swiftserver_connection_get_server(struct server_connection *conn);
7185b49f58c4cdb16d035ecc45e38ec9b1cd9bd0matthew_swift
7185b49f58c4cdb16d035ecc45e38ec9b1cd9bd0matthew_swiftvoid server_connection_cmd(struct server_connection *conn, const char *line,
7185b49f58c4cdb16d035ecc45e38ec9b1cd9bd0matthew_swift struct istream *cmd_input,
7185b49f58c4cdb16d035ecc45e38ec9b1cd9bd0matthew_swift server_cmd_callback_t *callback, void *context);
7d0faeb83880faf1dc71748e794e0c0e31745112dugan/* Returns TRUE if no command is being processed */
fabd90e17d4e35d189afa498bef80d0bcba2293fJnRouvignacbool server_connection_is_idle(struct server_connection *conn);
7185b49f58c4cdb16d035ecc45e38ec9b1cd9bd0matthew_swift
7185b49f58c4cdb16d035ecc45e38ec9b1cd9bd0matthew_swift/* Extract iostreams from connection. Afterwards the server_connection simply
7185b49f58c4cdb16d035ecc45e38ec9b1cd9bd0matthew_swift waits for itself to be destroyed. */
e5b941d49103e60011e09ded9fc84a0752f07afematthewvoid server_connection_extract(struct server_connection *conn,
e5b941d49103e60011e09ded9fc84a0752f07afematthew struct istream **istream_r,
fabd90e17d4e35d189afa498bef80d0bcba2293fJnRouvignac struct ostream **ostream_r,
0decb9b266059a98541be4853cdb77295510b87dmatthew_swift struct ssl_iostream **ssl_iostream_r);
7185b49f58c4cdb16d035ecc45e38ec9b1cd9bd0matthew_swift
7185b49f58c4cdb16d035ecc45e38ec9b1cd9bd0matthew_swift#endif
7185b49f58c4cdb16d035ecc45e38ec9b1cd9bd0matthew_swift