[Openvas-commits] r6187 - in trunk/openvas-libraries: . omp

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Fri Dec 18 12:56:21 CET 2009


Author: mattm
Date: 2009-12-18 12:56:19 +0100 (Fri, 18 Dec 2009)
New Revision: 6187

Modified:
   trunk/openvas-libraries/ChangeLog
   trunk/openvas-libraries/omp/omp.c
   trunk/openvas-libraries/omp/omp.h
Log:
	* omp/omp.c (omp_create_agent, omp_delete_agent): New functions.

	* omp/omp.h: Added protos accordingly.

Modified: trunk/openvas-libraries/ChangeLog
===================================================================
--- trunk/openvas-libraries/ChangeLog	2009-12-18 11:52:40 UTC (rev 6186)
+++ trunk/openvas-libraries/ChangeLog	2009-12-18 11:56:19 UTC (rev 6187)
@@ -1,3 +1,9 @@
+2009-12-18  Jan-Oliver Wagner <jan-oliver.wagner at greenbone.net>
+
+	* omp/omp.c (omp_create_agent, omp_delete_agent): New functions.
+
+	* omp/omp.h: Added protos accordingly.
+
 2009-12-18  Michael Wiegand <michael.wiegand at intevation.de>
 
 	* base/settings.c (get_all_settings): Make sure hash table contents are

Modified: trunk/openvas-libraries/omp/omp.c
===================================================================
--- trunk/openvas-libraries/omp/omp.c	2009-12-18 11:52:40 UTC (rev 6186)
+++ trunk/openvas-libraries/omp/omp.c	2009-12-18 11:56:19 UTC (rev 6187)
@@ -1642,6 +1642,78 @@
 }
 
 /**
+ * @brief Create an agent.
+ *
+ * @param[in]   session     Pointer to GNUTLS session.
+ * @param[in]   name        Name of agent.
+ * @param[in]   comment     Agent comment.
+ *
+ * @return 0 on success, -1 on error.
+ */
+int
+omp_create_agent (gnutls_session_t* session,
+                  const char* name,
+                  const char* comment)
+{
+  int ret;
+
+  /* Create the OMP request. */
+
+  gchar* new_task_request;
+  if (comment)
+    new_task_request = g_strdup_printf ("<create_agent>"
+                                        "<name>%s</name>"
+                                        "<comment>%s</comment>"
+                                        "</create_agent>",
+                                        name,
+                                        comment);
+  else
+    new_task_request = g_strdup_printf ("<create_agent>"
+                                        "<name>%s</name>"
+                                        "</create_agent>",
+                                        name);
+
+  /* Send the request. */
+
+  ret = openvas_server_send (session, new_task_request);
+  g_free (new_task_request);
+  if (ret) return -1;
+
+  return check_response (session);
+}
+
+/**
+ * @brief Delete an agent.
+ *
+ * @param[in]   session     Pointer to GNUTLS session.
+ * @param[in]   name        Name of agent.
+ *
+ * @return 0 on success, -1 on error.
+ */
+int
+omp_delete_agent (gnutls_session_t* session,
+                  const char* name)
+{
+  int ret;
+
+  /* Create the OMP request. */
+
+  gchar* new_task_request;
+  new_task_request = g_strdup_printf ("<delete_agent>"
+                                      "<name>%s</name>"
+                                      "</delete_agent>",
+                                      name);
+
+  /* Send the request. */
+
+  ret = openvas_server_send (session, new_task_request);
+  g_free (new_task_request);
+  if (ret) return -1;
+
+  return check_response (session);
+}
+
+/**
  * @brief Get NVT Information.
  *
  * @param[in]  session         Pointer to GNUTLS session.

Modified: trunk/openvas-libraries/omp/omp.h
===================================================================
--- trunk/openvas-libraries/omp/omp.h	2009-12-18 11:52:40 UTC (rev 6186)
+++ trunk/openvas-libraries/omp/omp.h	2009-12-18 11:56:19 UTC (rev 6187)
@@ -149,6 +149,12 @@
 omp_delete_lsc_credential (gnutls_session_t*, const char*);
 
 int
+omp_create_agent (gnutls_session_t*, const char*, const char*);
+
+int
+omp_delete_agent (gnutls_session_t*, const char*);
+
+int
 omp_get_nvt_details_503 (gnutls_session_t*, const char *, entity_t*);
 
 #endif /* not _OPENVAS_LIBRARIES_OMP_H */



More information about the Openvas-commits mailing list