[Openvas-commits] r5713 - in trunk/gsa: . src

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Mon Oct 26 08:18:50 CET 2009


Author: jan
Date: 2009-10-26 08:18:50 +0100 (Mon, 26 Oct 2009)
New Revision: 5713

Added:
   trunk/gsa/src/gsad_base.c
Modified:
   trunk/gsa/ChangeLog
   trunk/gsa/src/CMakeLists.txt
Log:
* src/gsad_base.c: New.

* src/CMakeLists.txt: Added handling of module gsad_base.



Modified: trunk/gsa/ChangeLog
===================================================================
--- trunk/gsa/ChangeLog	2009-10-25 19:59:21 UTC (rev 5712)
+++ trunk/gsa/ChangeLog	2009-10-26 07:18:50 UTC (rev 5713)
@@ -1,3 +1,9 @@
+2009-10-26  Jan-Oliver Wagner <jan-oliver.wagner at greenbone.net>
+
+	* src/gsad_base.c: New.
+
+	* src/CMakeLists.txt: Added handling of module gsad_base.
+
 2009-10-25  Jan-Oliver Wagner <jan-oliver.wagner at greenbone.net>
 
 	* src/gsad_oap.h: Renamed to src/gsad_oap.h.

Modified: trunk/gsa/src/CMakeLists.txt
===================================================================
--- trunk/gsa/src/CMakeLists.txt	2009-10-25 19:59:21 UTC (rev 5712)
+++ trunk/gsa/src/CMakeLists.txt	2009-10-26 07:18:50 UTC (rev 5713)
@@ -74,6 +74,9 @@
 
 ## Libraries
 
+add_library (gsad_base gsad_base.c)
+set_target_properties (gsad_base PROPERTIES COMPILE_FLAGS "${HEADER_TEMP} ${TASKS_CFLAG} ${GLIB_THREAD_CFLAGS} ${GLIB_CFLAGS} ${LIBXML_CFLAGS}")
+
 add_library (gsad-omp gsad-omp.c)
 set_target_properties (gsad-omp PROPERTIES COMPILE_FLAGS "${HEADER_TEMP} ${TASKS_CFLAG} ${GLIB_THREAD_CFLAGS} ${GLIB_CFLAGS} ${LIBXML_CFLAGS}")
 
@@ -83,7 +86,7 @@
 ## Program
 
 add_executable (gsad gsad.c)
-target_link_libraries (gsad gsad-omp gsad-oap)
+target_link_libraries (gsad gsad_base gsad-omp gsad-oap)
 
 set_target_properties (gsad PROPERTIES LINKER_LANGUAGE C)
 

Added: trunk/gsa/src/gsad_base.c
===================================================================
--- trunk/gsa/src/gsad_base.c	2009-10-25 19:59:21 UTC (rev 5712)
+++ trunk/gsa/src/gsad_base.c	2009-10-26 07:18:50 UTC (rev 5713)
@@ -0,0 +1,71 @@
+/* Greenbone Security Assistant
+ * $Id$
+ * Description: Base functionalities of GSA.
+ *
+ * Authors:
+ * Jan-Oliver Wagner <jan-oliver.wagner at greenbone.net>
+ * Matthew Mundell <matthew.mundell at intevation.de>
+ *
+ * Copyright:
+ * Copyright (C) 2009 Greenbone Networks GmbH
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2,
+ * or, at your option, any later version as published by the Free
+ * Software Foundation
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+/**
+ * @file gsad_base.c
+ * @brief Base functionalities of GSA.
+ */
+
+#include <string.h> /* for strlen() */
+#include <libxslt/xsltInternals.h> /* for xsltStylesheetPtr */
+#include <libxslt/transform.h> /* for xsltApplyStylesheet() */
+#include <libxslt/xsltutils.h> /* for xsltSaveResultToString() */
+
+/**
+ * @brief XSL Transformation.
+ *
+ * Does the transformation from XML to HTML applying the given xsl stylesheet.
+ *
+ * @param[in]  xml_file The xml file to tranform.
+ * @param[in]  xsl_file The xsl file to apply for tranformation.
+ */
+char *
+xsl_transform (char *xml_file, char *xsl_file)
+{
+  xsltStylesheetPtr cur = NULL;
+  xmlDocPtr doc, res;
+  const xmlChar *xsl;
+  xmlChar *doc_txt_ptr = NULL;
+  int doc_txt_len;
+  const char *stream = xml_file;
+
+  xmlSubstituteEntitiesDefault (1);
+  xmlLoadExtDtdDefaultValue = 1;
+  xsl = (const xmlChar *) xsl_file;
+  cur = xsltParseStylesheetFile (xsl);
+
+  doc = xmlParseMemory (stream, strlen (xml_file));
+  res = xsltApplyStylesheet (cur, doc, NULL);
+  xsltSaveResultToString (&doc_txt_ptr, &doc_txt_len, res, cur);
+
+  xsltFreeStylesheet (cur);
+  xmlFreeDoc (res);
+  xmlFreeDoc (doc);
+
+  xsltCleanupGlobals ();
+  xmlCleanupParser ();
+  return (char *) doc_txt_ptr;
+}



More information about the Openvas-commits mailing list