summaryrefslogtreecommitdiff
path: root/include/asterisk/cli.h
diff options
context:
space:
mode:
authorCorey Farrell <git@cfware.com>2015-05-04 17:41:08 -0400
committerCorey Farrell <git@cfware.com>2015-05-04 20:47:18 -0400
commitdf6c1d755f39308c77f3c49ef0f5fa539e627330 (patch)
tree21f12dd8173c44ce1caa6f3797be062910db2b55 /include/asterisk/cli.h
parenta8bfa9e10445744581d18819c64729844ae837fb (diff)
CLI: Enable automatic references to modules.
* Pass module to ast_cli_register and ast_cli_register_multiple. * Add a module reference before executing any CLI callback, remove the reference when complete. ASTERISK-25049 #close Reported by: Corey Farrell Change-Id: I7aafc7c9f2b912918f28fe51d51e9e8a755750e3
Diffstat (limited to 'include/asterisk/cli.h')
-rw-r--r--include/asterisk/cli.h11
1 files changed, 8 insertions, 3 deletions
diff --git a/include/asterisk/cli.h b/include/asterisk/cli.h
index 458ebc8aa..82363c15f 100644
--- a/include/asterisk/cli.h
+++ b/include/asterisk/cli.h
@@ -177,7 +177,7 @@ struct ast_cli_entry {
const char * usage; /*!< Detailed usage information */
int inuse; /*!< For keeping track of usage */
- struct module *module; /*!< module this belongs to */
+ struct ast_module *module; /*!< module this belongs to */
char *_full_cmd; /*!< built at load time from cmda[] */
int cmdlen; /*!< len up to the first invalid char [<{% */
/*! \brief This gets set in ast_cli_register()
@@ -253,14 +253,19 @@ int ast_cli_command_multiple_full(int uid, int gid, int fd, size_t size, const c
* \retval 0 on success
* \retval -1 on failure
*/
-int ast_cli_register(struct ast_cli_entry *e);
+#define ast_cli_register(e) __ast_cli_register(e, AST_MODULE_SELF)
+
+int __ast_cli_register(struct ast_cli_entry *e, struct ast_module *mod);
/*!
* \brief Register multiple commands
* \param e pointer to first cli entry to register
* \param len number of entries to register
*/
-int ast_cli_register_multiple(struct ast_cli_entry *e, int len);
+#define ast_cli_register_multiple(e, len) \
+ __ast_cli_register_multiple(e, len, AST_MODULE_SELF)
+
+int __ast_cli_register_multiple(struct ast_cli_entry *e, int len, struct ast_module *mod);
/*!
* \brief Unregisters a command or an array of commands