summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorEliel C. Sardanons <eliels@gmail.com>2009-05-22 17:52:35 +0000
committerEliel C. Sardanons <eliels@gmail.com>2009-05-22 17:52:35 +0000
commit2c882626a0ebbfe6dfe9d89cb495765a218e978d (patch)
treee1c6ca80d913c0e0aa3166a40d7b8e4461cd62d1 /include
parent3c7db3b7e84c8dbf1f561f8e37b23add5332d456 (diff)
Implement a new element in AstXML for AMI actions documentation.
A new xml element was created to manage the AMI actions documentation, using AstXML. To register a manager action using XML documentation it is now possible using ast_manager_register_xml(). The CLI command 'manager show command' can be used to show the parsed documentation. Example manager xml documentation: <manager name="ami action name" language="en_US"> <synopsis> AMI action synopsis. </synopsis> <syntax> <xi:include xpointer="xpointer(...)" /> <-- for ActionID <parameter name="header1" required="true"> <para>Description</para> </parameter> ... </syntax> <description> <para>AMI action description</para> </description> <see-also> ... </see-also> </manager> git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@196308 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'include')
-rw-r--r--include/asterisk/manager.h16
-rw-r--r--include/asterisk/pbx.h7
-rw-r--r--include/asterisk/xmldoc.h7
3 files changed, 20 insertions, 10 deletions
diff --git a/include/asterisk/manager.h b/include/asterisk/manager.h
index d9e33e538..33eb52c04 100644
--- a/include/asterisk/manager.h
+++ b/include/asterisk/manager.h
@@ -22,6 +22,7 @@
#include "asterisk/network.h"
#include "asterisk/lock.h"
#include "asterisk/datastore.h"
+#include "asterisk/xmldoc.h"
/*!
\file
@@ -116,14 +117,19 @@ struct message {
struct manager_action {
/*! Name of the action */
const char *action;
- /*! Short description of the action */
- const char *synopsis;
- /*! Detailed description of the action */
- const char *description;
+ AST_DECLARE_STRING_FIELDS(
+ AST_STRING_FIELD(synopsis); /*!< Synopsis text (short description). */
+ AST_STRING_FIELD(description); /*!< Description (help text) */
+ AST_STRING_FIELD(syntax); /*!< Syntax text */
+ AST_STRING_FIELD(arguments); /*!< Description of each argument. */
+ AST_STRING_FIELD(seealso); /*!< See also */
+ );
/*! Permission required for action. EVENT_FLAG_* */
int authority;
/*! Function to be called */
int (*func)(struct mansession *s, const struct message *m);
+ /*! Where the documentation come from. */
+ enum ast_doc_src docsrc;
/*! For easy linking */
AST_RWLIST_ENTRY(manager_action) list;
};
@@ -132,6 +138,8 @@ struct manager_action {
* \note Use ast_manager_register2() to register with help text for new manager commands */
#define ast_manager_register(a, b, c, d) ast_manager_register2(a, b, c, d, NULL)
+/*! \brief Register a manager callback using XML documentation to describe the manager. */
+#define ast_manager_register_xml(a, b, c) ast_manager_register2(a, b, c, NULL, NULL)
/*! \brief Register a manager command with the manager interface
\param action Name of the requested Action:
diff --git a/include/asterisk/pbx.h b/include/asterisk/pbx.h
index c2f999eb6..d086416d8 100644
--- a/include/asterisk/pbx.h
+++ b/include/asterisk/pbx.h
@@ -27,6 +27,7 @@
#include "asterisk/chanvars.h"
#include "asterisk/hashtab.h"
#include "asterisk/stringfields.h"
+#include "asterisk/xmldoc.h"
#if defined(__cplusplus) || defined(c_plusplus)
extern "C" {
@@ -73,12 +74,6 @@ struct ast_sw;
/*! \brief Typedef for devicestate and hint callbacks */
typedef int (*ast_state_cb_type)(char *context, char* id, enum ast_extension_states state, void *data);
-/*! \brief From where the documentation come from */
-enum ast_doc_src {
- AST_XML_DOC, /*!< From XML documentation */
- AST_STATIC_DOC /*!< From application/function registration */
-};
-
/*! \brief Data structure associated with a custom dialplan function */
struct ast_custom_function {
const char *name; /*!< Name */
diff --git a/include/asterisk/xmldoc.h b/include/asterisk/xmldoc.h
index d781e8043..c876b46da 100644
--- a/include/asterisk/xmldoc.h
+++ b/include/asterisk/xmldoc.h
@@ -23,6 +23,13 @@
#include "asterisk/xml.h"
+/*! \brief From where the documentation come from, this structure is useful for
+ * use it inside application/functions/manager actions structure. */
+enum ast_doc_src {
+ AST_XML_DOC, /*!< From XML documentation */
+ AST_STATIC_DOC /*!< From application/function registration */
+};
+
#ifdef AST_XML_DOCS
/*!