[Openvas-commits] r2490 - in trunk/openvas-client: . nessus

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Mon Feb 16 11:10:57 CET 2009


Author: felix
Date: 2009-02-16 11:10:56 +0100 (Mon, 16 Feb 2009)
New Revision: 2490

Modified:
   trunk/openvas-client/ChangeLog
   trunk/openvas-client/nessus/report_utils.c
   trunk/openvas-client/nessus/report_utils.h
Log:
Towards counting log messages in overview (~left side of the GUI).
Provided functions to count log messages.

* nessus/report_utils.c (number_of_log_messages_by_port,
number_of_log_messages_by_host, number_of_log_messages): New. Count
log messages analog to others (e.g. security notes)

* nessus/report_utils.h: Added protos.


Modified: trunk/openvas-client/ChangeLog
===================================================================
--- trunk/openvas-client/ChangeLog	2009-02-16 09:49:28 UTC (rev 2489)
+++ trunk/openvas-client/ChangeLog	2009-02-16 10:10:56 UTC (rev 2490)
@@ -1,5 +1,16 @@
 2009-02-16  Felix Wolfsteller <felix.wolfsteller at intevation.de>
 
+	Towards counting log messages in overview (~left side of the GUI).
+	Provided functions to count log messages.
+
+	* nessus/report_utils.c (number_of_log_messages_by_port,
+	number_of_log_messages_by_host, number_of_log_messages): New. Count
+	log messages analog to others (e.g. security notes)
+	
+	* nessus/report_utils.h: Added protos.
+
+2009-02-16  Felix Wolfsteller <felix.wolfsteller at intevation.de>
+
 	* nessus/prefs_dialog/prefs_scope_tree.c: Reformatted larger parts.
 
 2009-02-16  Felix Wolfsteller <felix.wolfsteller at intevation.de>

Modified: trunk/openvas-client/nessus/report_utils.c
===================================================================
--- trunk/openvas-client/nessus/report_utils.c	2009-02-16 09:49:28 UTC (rev 2489)
+++ trunk/openvas-client/nessus/report_utils.c	2009-02-16 10:10:56 UTC (rev 2490)
@@ -60,6 +60,38 @@
 /*
  * Auxilliary functions
  */
+/**
+ * @brief Recursively counts number of log messages by port.
+ * 
+ * @return Number of log messages or 0 if host argument is empty or NULL.
+ */
+int
+number_of_log_messages_by_port (struct arglist * arg)
+{
+  if (!arg || !arg->next)
+    return 0;
+  else
+    {
+      struct arglist * logs = arg_get_value (arg->value, "LOG");
+      return arglist_length(logs) + number_of_log_messages_by_port(arg->next);
+    }
+}
+
+/**
+ * @brief Recursively counts number of log messages by host.
+ * 
+ * @return Number of log messages or 0 if host argument is empty or NULL.
+ */
+int
+number_of_log_messages_by_host (struct arglist * hosts)
+{
+  if(!hosts || !hosts->next)
+    return 0;
+  else
+    return number_of_log_messages_by_port(hosts->value)
+            + number_of_log_messages_by_host(hosts->next);
+}
+
 int number_of_false_positives_by_port(struct arglist * arg)
 { 
  if(!arg || !arg->next)return 0;
@@ -125,6 +157,20 @@
   	     number_of_holes_by_host(arg->next);	     
 }
 
+/**
+ * Recursively counts up number of log messages for each host in parameter
+ * arglist hosts.
+ * 
+ * @return Number of log messages or 0 if parameter hosts is NULL or empty.
+ */
+int
+number_of_log_messages (struct arglist* hosts)
+{
+  if (!hosts || !hosts->next)
+    return 0;
+  else return number_of_log_messages_by_host (hosts->value)
+               + number_of_log_messages (hosts->next);
+}
 
 int number_of_false_positives(struct arglist *  arg)
 {

Modified: trunk/openvas-client/nessus/report_utils.h
===================================================================
--- trunk/openvas-client/nessus/report_utils.h	2009-02-16 09:49:28 UTC (rev 2489)
+++ trunk/openvas-client/nessus/report_utils.h	2009-02-16 10:10:56 UTC (rev 2490)
@@ -43,6 +43,7 @@
 int number_of_holes_by_host(struct arglist *);
 
 int number_of_false_positives(struct arglist * );
+int number_of_log_messages(struct arglist * );
 int number_of_notes(struct arglist * );
 int number_of_warnings(struct arglist * );
 int number_of_holes(struct arglist * );



More information about the Openvas-commits mailing list