summaryrefslogtreecommitdiff
path: root/include/asterisk/res_pjsip_cli.h
diff options
context:
space:
mode:
authorMatthew Jordan <mjordan@digium.com>2013-12-20 21:32:13 +0000
committerMatthew Jordan <mjordan@digium.com>2013-12-20 21:32:13 +0000
commitb172d369c4057cddad18c0d6b1100233c07ebbd7 (patch)
tree0665c20e48161773916473a951bac27315d26d2b /include/asterisk/res_pjsip_cli.h
parenta0c288bb23164c6ff91019172980c8aff6fd8c8d (diff)
res_pjsip: Add PJSIP CLI commands
Implements the following cli commands: pjsip list aors pjsip list auths pjsip list channels pjsip list contacts pjsip list endpoints pjsip show aor(s) pjsip show auth(s) pjsip show channels pjsip show endpoint(s) Also... Minor modifications made to the AMI command implementations to facilitate reuse. New function ast_variable_list_sort added to config.c and config.h to implement variable list sorting. (issue ASTERISK-22610) patches: pjsip_cli_v2.patch uploaded by george.joseph (License 6322) ........ Merged revisions 404480 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@404507 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'include/asterisk/res_pjsip_cli.h')
-rw-r--r--include/asterisk/res_pjsip_cli.h95
1 files changed, 95 insertions, 0 deletions
diff --git a/include/asterisk/res_pjsip_cli.h b/include/asterisk/res_pjsip_cli.h
new file mode 100644
index 000000000..cd7d81ed2
--- /dev/null
+++ b/include/asterisk/res_pjsip_cli.h
@@ -0,0 +1,95 @@
+/*
+ * Asterisk -- An open source telephony toolkit.
+ *
+ * Copyright (C) 2013, Fairview 5 Engineering, LLC.
+ *
+ * George Joseph <george.joseph@fairview5.com>
+ *
+ * See http://www.asterisk.org for more information about
+ * the Asterisk project. Please do not directly contact
+ * any of the maintainers of this project for assistance;
+ * the project provides a web site, mailing lists and IRC
+ * channels for your use.
+ *
+ * This program is free software, distributed under the terms of
+ * the GNU General Public License Version 2. See the LICENSE file
+ * at the top of the source tree.
+ */
+
+#ifndef RES_PJSIP_CLI_H_
+#define RES_PJSIP_CLI_H_
+
+#define CLI_HEADER_FILLER ".........................................................................................."
+#define CLI_DETAIL_FILLER " "
+#define CLI_MAX_WIDTH 90
+#define CLI_LAST_TABSTOP 62
+#define CLI_MAX_TITLE_NAME 8
+#define CLI_INDENT_TO_SPACES(x) ((x * 2) + 1 + CLI_MAX_TITLE_NAME)
+
+/*
+ * \brief CLI Formatter Context
+ */
+struct ast_sip_cli_context {
+ int peers_mon_online;
+ int peers_mon_offline;
+ int peers_unmon_offline;
+ int peers_unmon_online;
+ struct ast_str *output_buffer;
+ const struct ast_cli_args *a;
+ const struct ast_sip_endpoint *current_endpoint;
+ const struct ast_sip_auth *current_auth;
+ const struct ast_sip_aor *current_aor;
+ char *auth_direction;
+ unsigned int print_flags;
+ int indent_level;
+ unsigned show_details : 1;
+ unsigned recurse : 1;
+ unsigned show_details_only_level_0 : 1;
+};
+
+/*
+ * \brief CLI Formatter Registry Entry
+ */
+struct ast_sip_cli_formatter_entry {
+ const char *name;
+ ao2_callback_fn *print_header;
+ ao2_callback_fn *print_body;
+ struct ao2_container *(* get_container)(struct ast_sorcery *);
+};
+
+/*!
+ * \brief Registers a CLI formatter.
+ *
+ * \param name The name of the formatter, usually the sorcery object type.
+ * \param formatter An ao2_callback_fn that outputs the formatted data.
+ * \retval 0 Success, non-zero on failure
+ */
+int ast_sip_register_cli_formatter(struct ast_sip_cli_formatter_entry *formatter);
+
+/*!
+ * \brief Unregisters a CLI formatter.
+ *
+ * \param name The name of the formatter, usually the sorcery object type.
+ * \retval 0 Success, non-zero on failure
+ */
+int ast_sip_unregister_cli_formatter(struct ast_sip_cli_formatter_entry *formatter);
+
+/*!
+ * \brief Looks up a CLI formatter by type.
+ *
+ * \param name The name of the formatter, usually the sorcery object type.
+ * \retval Pointer to formatter entry structure
+ */
+struct ast_sip_cli_formatter_entry *ast_sip_lookup_cli_formatter(const char *name);
+
+/*!
+ * \brief Prints a sorcery object's ast_variable list
+ *
+ * \param obj The sorcery object
+ * \param arg The ast_sip_cli_context.
+ * \retval 0 Success, non-zero on failure
+ */
+int ast_sip_cli_print_sorcery_objectset(void *obj, void *arg, int flags);
+
+
+#endif /* RES_PJSIP_CLI_H_ */