[Openvas-commits] r9523 - in trunk/openvas-manager: . doc src/schema_formats/HTML src/schema_formats/XML
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Thu Nov 25 23:38:07 CET 2010
Author: mattm
Date: 2010-11-25 23:38:01 +0100 (Thu, 25 Nov 2010)
New Revision: 9523
Modified:
trunk/openvas-manager/ChangeLog
trunk/openvas-manager/doc/omp.html
trunk/openvas-manager/src/schema_formats/HTML/HTML.xsl
trunk/openvas-manager/src/schema_formats/XML/OMP.xml
Log:
* src/schema_formats/HTML/HTML.xsl (func:string-left-trim-nl)
(func:string-right-trim-nl, func:string-trim-nl): New function.
(pretty): Special case help_response to preserve formatting.
* src/schema_formats/XML/OMP.xml: Add HELP example.
* doc/omp.html: Update from source.
Modified: trunk/openvas-manager/ChangeLog
===================================================================
--- trunk/openvas-manager/ChangeLog 2010-11-25 11:46:25 UTC (rev 9522)
+++ trunk/openvas-manager/ChangeLog 2010-11-25 22:38:01 UTC (rev 9523)
@@ -1,3 +1,13 @@
+2010-11-25 Matthew Mundell <matthew.mundell at greenbone.net>
+
+ * src/schema_formats/HTML/HTML.xsl (func:string-left-trim-nl)
+ (func:string-right-trim-nl, func:string-trim-nl): New function.
+ (pretty): Special case help_response to preserve formatting.
+
+ * src/schema_formats/XML/OMP.xml: Add HELP example.
+
+ * doc/omp.html: Update from source.
+
2010-11-24 Matthew Mundell <matthew.mundell at greenbone.net>
* src/ompd.c (serve_omp): Make the second timeout check like the first.
Modified: trunk/openvas-manager/doc/omp.html
===================================================================
--- trunk/openvas-manager/doc/omp.html 2010-11-25 11:46:25 UTC (rev 9522)
+++ trunk/openvas-manager/doc/omp.html 2010-11-25 22:38:01 UTC (rev 9523)
@@ -8890,7 +8890,69 @@
}
</pre></div>
</div>
+<h4>4.41.1 Example: Get the help text</h4>
+<div style="margin-left: 5%; margin-right: 5%;">
+<i>Client</i><div style="margin-left: 2%; margin-right: 2%;"><pre> <help/>
+</pre></div>
+<i>Manager</i><div style="margin-left: 2%; margin-right: 2%;"><pre> <help_response status="200"
+ status_text="OK">
+ AUTHENTICATE Authenticate with the manager.
+ COMMANDS Run a list of commands.
+ CREATE_AGENT Create an agent.
+ CREATE_CONFIG Create a config.
+ CREATE_ESCALATOR Create an escalator.
+ CREATE_LSC_CREDENTIAL Create a local security check credential.
+ CREATE_NOTE Create a note.
+ CREATE_OVERRIDE Create an override.
+ CREATE_SCHEDULE Create a schedule.
+ CREATE_TARGET Create a target.
+ CREATE_TASK Create a task.
+ DELETE_AGENT Delete an agent.
+ DELETE_CONFIG Delete a config.
+ DELETE_ESCALATOR Delete an escalator.
+ DELETE_LSC_CREDENTIAL Delete a local security check credential.
+ DELETE_NOTE Delete a note.
+ DELETE_OVERRIDE Delete an override.
+ DELETE_REPORT Delete a report.
+ DELETE_SCHEDULE Delete a schedule.
+ DELETE_TARGET Delete a target.
+ DELETE_TASK Delete a task.
+ GET_AGENTS Get all agents.
+ GET_CONFIGS Get all configs.
+ GET_DEPENDENCIES Get dependencies for all available NVTs.
+ GET_ESCALATORS Get all escalators.
+ GET_LSC_CREDENTIALS Get all local security check credentials.
+ GET_NOTES Get all notes.
+ GET_NVTS Get one or all available NVTs.
+ GET_NVT_FAMILIES Get a list of all NVT families.
+ GET_NVT_FEED_CHECKSUM Get checksum for entire NVT collection.
+ GET_OVERRIDES Get all overrides.
+ GET_PREFERENCES Get preferences for all available NVTs.
+ GET_REPORTS Get all reports.
+ GET_RESULTS Get results.
+ GET_SCHEDULES Get all schedules.
+ GET_SYSTEM_REPORTS Get all system reports.
+ GET_TARGET_LOCATORS Get configured target locators.
+ GET_TARGETS Get all targets.
+ GET_TASKS Get all tasks.
+ GET_VERSION Get the OpenVAS Manager Protocol version.
+ HELP Get this help text.
+ MODIFY_CONFIG Update an existing config.
+ MODIFY_NOTE Modify an existing note.
+ MODIFY_OVERRIDE Modify an existing override.
+ MODIFY_REPORT Modify an existing report.
+ MODIFY_TASK Update an existing task.
+ PAUSE_TASK Pause a running task.
+ RESUME_OR_START_TASK Resume task if stopped, else start task.
+ RESUME_PAUSED_TASK Resume a paused task.
+ RESUME_STOPPED_TASK Resume a stopped task.
+ START_TASK Manually start an existing task.
+ STOP_TASK Stop a running task.
+ TEST_ESCALATOR Run an escalator.
+ </help_response>
+</pre></div>
</div>
+</div>
<div>
<div><h3 id="command_modify_config">4.42
Command <tt>modify_config</tt>
Modified: trunk/openvas-manager/src/schema_formats/HTML/HTML.xsl
===================================================================
--- trunk/openvas-manager/src/schema_formats/HTML/HTML.xsl 2010-11-25 11:46:25 UTC (rev 9522)
+++ trunk/openvas-manager/src/schema_formats/HTML/HTML.xsl 2010-11-25 22:38:01 UTC (rev 9523)
@@ -3,7 +3,8 @@
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:str="http://exslt.org/strings"
- extension-element-prefixes="str">
+ xmlns:func = "http://exslt.org/functions"
+ extension-element-prefixes="str func">
<xsl:output method="html"
doctype-system="http://www.w3.org/TR/html4/strict.dtd"
doctype-public="-//W3C//DTD HTML 4.01//EN"
@@ -46,6 +47,53 @@
</xsl:text>
</xsl:template>
+ <!-- Remove leading newlines, leaving other newlines intact. -->
+ <func:function name="func:string-left-trim-nl">
+ <xsl:param name="string"/>
+ <xsl:choose>
+ <xsl:when test="string-length($string) = 0">
+ <func:result select="''"/>
+ </xsl:when>
+ <xsl:when test="starts-with($string,' ')">
+ <func:result select="func:string-left-trim-nl(substring($string,2))"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <func:result select="$string"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </func:function>
+
+ <!-- Remove trailing newlines, leaving other newlines intact. -->
+ <func:function name="func:string-right-trim-nl">
+ <xsl:param name="string"/>
+ <xsl:choose>
+ <xsl:when test="string-length($string) = 0">
+ <func:result select="''"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="last"
+ select="substring($string, string-length($string))"/>
+ <xsl:choose>
+ <xsl:when test="$last = ' ' or $last = ' '">
+ <func:result
+ select="func:string-right-trim-nl(substring($string,1,string-length($string) - 1))"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <func:result select="$string"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </func:function>
+
+ <!-- Remove leading and trailing newlines, leaving other newlines
+ intact. -->
+ <func:function name="func:string-trim-nl">
+ <xsl:param name="string"/>
+ <func:result
+ select="func:string-left-trim-nl(func:string-right-trim-nl($string))"/>
+ </func:function>
+
<xsl:template match="description">
<xsl:choose>
<xsl:when test="(count(*) = 0) and (string-length(normalize-space(text())) > 0)">
@@ -153,13 +201,25 @@
</xsl:call-template>
<xsl:text>></xsl:text>
<xsl:call-template name="newline"/>
- <xsl:if test="string-length(normalize-space(text())) > 0">
- <xsl:call-template name="print-space">
- <xsl:with-param name="count" select="$level * 2 + 2"/>
- </xsl:call-template>
- <xsl:value-of select="normalize-space(text())"/>
- <xsl:call-template name="newline"/>
- </xsl:if>
+ <xsl:choose>
+ <xsl:when test="name() = 'help_response'">
+ <!-- Special case the help response to preserve whitespace. -->
+ <xsl:variable name="string" select="func:string-trim-nl(text())"/>
+ <xsl:if test="string-length($string) > 0">
+ <xsl:value-of select="$string"/>
+ <xsl:call-template name="newline"/>
+ </xsl:if>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:if test="string-length(normalize-space(text())) > 0">
+ <xsl:call-template name="print-space">
+ <xsl:with-param name="count" select="$level * 2 + 2"/>
+ </xsl:call-template>
+ <xsl:value-of select="normalize-space(text())"/>
+ <xsl:call-template name="newline"/>
+ </xsl:if>
+ </xsl:otherwise>
+ </xsl:choose>
<xsl:for-each select="*">
<xsl:call-template name="pretty">
<xsl:with-param name="level" select="$level + 1"/>
Modified: trunk/openvas-manager/src/schema_formats/XML/OMP.xml
===================================================================
--- trunk/openvas-manager/src/schema_formats/XML/OMP.xml 2010-11-25 11:46:25 UTC (rev 9522)
+++ trunk/openvas-manager/src/schema_formats/XML/OMP.xml 2010-11-25 22:38:01 UTC (rev 9523)
@@ -6023,6 +6023,69 @@
</attrib>
</pattern>
</response>
+ <example>
+ <summary>Get the help text</summary>
+ <request>
+ <help></help>
+ </request>
+ <response>
+ <help_response status="200" status_text="OK">
+ AUTHENTICATE Authenticate with the manager.
+ COMMANDS Run a list of commands.
+ CREATE_AGENT Create an agent.
+ CREATE_CONFIG Create a config.
+ CREATE_ESCALATOR Create an escalator.
+ CREATE_LSC_CREDENTIAL Create a local security check credential.
+ CREATE_NOTE Create a note.
+ CREATE_OVERRIDE Create an override.
+ CREATE_SCHEDULE Create a schedule.
+ CREATE_TARGET Create a target.
+ CREATE_TASK Create a task.
+ DELETE_AGENT Delete an agent.
+ DELETE_CONFIG Delete a config.
+ DELETE_ESCALATOR Delete an escalator.
+ DELETE_LSC_CREDENTIAL Delete a local security check credential.
+ DELETE_NOTE Delete a note.
+ DELETE_OVERRIDE Delete an override.
+ DELETE_REPORT Delete a report.
+ DELETE_SCHEDULE Delete a schedule.
+ DELETE_TARGET Delete a target.
+ DELETE_TASK Delete a task.
+ GET_AGENTS Get all agents.
+ GET_CONFIGS Get all configs.
+ GET_DEPENDENCIES Get dependencies for all available NVTs.
+ GET_ESCALATORS Get all escalators.
+ GET_LSC_CREDENTIALS Get all local security check credentials.
+ GET_NOTES Get all notes.
+ GET_NVTS Get one or all available NVTs.
+ GET_NVT_FAMILIES Get a list of all NVT families.
+ GET_NVT_FEED_CHECKSUM Get checksum for entire NVT collection.
+ GET_OVERRIDES Get all overrides.
+ GET_PREFERENCES Get preferences for all available NVTs.
+ GET_REPORTS Get all reports.
+ GET_RESULTS Get results.
+ GET_SCHEDULES Get all schedules.
+ GET_SYSTEM_REPORTS Get all system reports.
+ GET_TARGET_LOCATORS Get configured target locators.
+ GET_TARGETS Get all targets.
+ GET_TASKS Get all tasks.
+ GET_VERSION Get the OpenVAS Manager Protocol version.
+ HELP Get this help text.
+ MODIFY_CONFIG Update an existing config.
+ MODIFY_NOTE Modify an existing note.
+ MODIFY_OVERRIDE Modify an existing override.
+ MODIFY_REPORT Modify an existing report.
+ MODIFY_TASK Update an existing task.
+ PAUSE_TASK Pause a running task.
+ RESUME_OR_START_TASK Resume task if stopped, else start task.
+ RESUME_PAUSED_TASK Resume a paused task.
+ RESUME_STOPPED_TASK Resume a stopped task.
+ START_TASK Manually start an existing task.
+ STOP_TASK Stop a running task.
+ TEST_ESCALATOR Run an escalator.
+ </help_response>
+ </response>
+ </example>
</command>
<command>
<name>modify_config</name>
More information about the Openvas-commits
mailing list