doveadm-proxy.c revision 350d6194f7336f3c89d641a01b31c7417d67b08a
8aacc9e7c84f8376822823ec98c2f551d4919b2eTimo Sirainen/* Copyright (c) 2011-2016 Dovecot authors, see the included COPYING file */
3c57664b9dce82cd3e43347394b92ef3591b8901Timo Sirainenextern struct doveadm_cmd_ver2 doveadm_cmd_proxy[];
3c57664b9dce82cd3e43347394b92ef3591b8901Timo Sirainenstatic void proxy_cmd_help(doveadm_command_t *cmd) ATTR_NORETURN;
3c57664b9dce82cd3e43347394b92ef3591b8901Timo Sirainencmd_proxy_init(int argc, char *argv[], const char *getopt_args,
3c57664b9dce82cd3e43347394b92ef3591b8901Timo Sirainen socket_path = t_strconcat(doveadm_settings->base_dir, "/ipc", NULL);
3c57664b9dce82cd3e43347394b92ef3591b8901Timo Sirainen while ((c = getopt(argc, argv, getopt_args)) > 0) {
3c57664b9dce82cd3e43347394b92ef3591b8901Timo Sirainenstatic void cmd_proxy_list_callback(enum ipc_client_cmd_state state,
3c57664b9dce82cd3e43347394b92ef3591b8901Timo Sirainen const char *const *args = t_strsplit_tab(data);
3c57664b9dce82cd3e43347394b92ef3591b8901Timo Sirainenstatic void cmd_proxy_list(int argc, char *argv[])
3c57664b9dce82cd3e43347394b92ef3591b8901Timo Sirainen ctx = cmd_proxy_init(argc, argv, "a:", cmd_proxy_list);
8aacc9e7c84f8376822823ec98c2f551d4919b2eTimo Sirainen doveadm_print_header("username", "username", DOVEADM_PRINT_HEADER_FLAG_EXPAND);
e015e2f7e7f48874495f9df8b0dd192b7ffcb5ccTimo Sirainen doveadm_print_header("dest-ip", "dest ip", 0);
8aacc9e7c84f8376822823ec98c2f551d4919b2eTimo Sirainenstatic void cmd_proxy_kick_callback(enum ipc_client_cmd_state state,
8aacc9e7c84f8376822823ec98c2f551d4919b2eTimo Sirainenstatic void cmd_proxy_kick(int argc, char *argv[])
8aacc9e7c84f8376822823ec98c2f551d4919b2eTimo Sirainen ctx = cmd_proxy_init(argc, argv, "a:", cmd_proxy_kick);
8aacc9e7c84f8376822823ec98c2f551d4919b2eTimo Sirainen doveadm_print_init(DOVEADM_PRINT_TYPE_FORMATTED);
992a13add4eea0810e4db0f042a595dddf85536aTimo Sirainen doveadm_print_formatted_set_format("%{count} connections kicked");
8aacc9e7c84f8376822823ec98c2f551d4919b2eTimo Sirainen ipc_client_cmd(ctx->ipc, t_strdup_printf("proxy\t*\tKICK\t%s", argv[optind]),
e015e2f7e7f48874495f9df8b0dd192b7ffcb5ccTimo Sirainenstruct doveadm_cmd_ver2 doveadm_cmd_proxy[] = {
8aacc9e7c84f8376822823ec98c2f551d4919b2eTimo SirainenDOVEADM_CMD_PARAM('a', "socket-path", CMD_PARAM_STR, 0)
e015e2f7e7f48874495f9df8b0dd192b7ffcb5ccTimo SirainenDOVEADM_CMD_PARAM('a', "socket-path", CMD_PARAM_STR, 0)
8aacc9e7c84f8376822823ec98c2f551d4919b2eTimo SirainenDOVEADM_CMD_PARAM('\0', "user", CMD_PARAM_STR, CMD_PARAM_FLAG_POSITIONAL)
i_unreached();
void doveadm_register_proxy_commands(void)