summaryrefslogtreecommitdiff
path: root/src/dumm/guest.h
diff options
context:
space:
mode:
authorRene Mayrhofer <rene@mayrhofer.eu.org>2008-07-09 21:02:41 +0000
committerRene Mayrhofer <rene@mayrhofer.eu.org>2008-07-09 21:02:41 +0000
commitdb67c87db3c9089ea8d2e14f617bf3d9e2af261f (patch)
tree665c0caea83d34c11c1517c4c57137bb58cba6fb /src/dumm/guest.h
parent1c088a8b6237ec67f63c23f97a0f2dc4e99af869 (diff)
downloadvyos-strongswan-db67c87db3c9089ea8d2e14f617bf3d9e2af261f.tar.gz
vyos-strongswan-db67c87db3c9089ea8d2e14f617bf3d9e2af261f.zip
[svn-upgrade] Integrating new upstream version, strongswan (4.2.4)
Diffstat (limited to 'src/dumm/guest.h')
-rw-r--r--src/dumm/guest.h61
1 files changed, 41 insertions, 20 deletions
diff --git a/src/dumm/guest.h b/src/dumm/guest.h
index 10b37aaa7..79a47fa62 100644
--- a/src/dumm/guest.h
+++ b/src/dumm/guest.h
@@ -17,11 +17,12 @@
#define GUEST_H
#include <library.h>
-#include <utils/iterator.h>
+#include <utils/enumerator.h>
#include "iface.h"
typedef enum guest_state_t guest_state_t;
+typedef struct guest_t guest_t;
/**
* @brief State of a guest (started, stopped, ...)
@@ -44,7 +45,26 @@ enum guest_state_t {
*/
extern enum_name_t *guest_state_names;
-typedef struct guest_t guest_t;
+/**
+ * Invoke function which lauches the UML guest.
+ *
+ * Consoles are all set to NULL, you may change them by adding additional UML
+ * options to args before invocation.
+ *
+ * @param data callback data
+ * @param guest guest to start
+ * @param args args to use for guest invocation, args[0] is kernel
+ * @param argc number of elements in args
+ * @param idle
+ * @return PID of child, 0 if failed
+ */
+typedef pid_t (*invoke_function_t)(void *data, guest_t *guest,
+ char *args[], int argc);
+
+/**
+ * Idle function to pass to start().
+ */
+typedef void (*idle_function_t)(void);
/**
* @brief A guest is a UML instance running on the host.
@@ -75,27 +95,21 @@ struct guest_t {
/**
* @brief Start the guest.
*
- * @return TRUE if guest successfully started
+ * @param invoke UML guest invocation function
+ * @param data data to pass back to invoke function
+ * @param idle idle function to call while waiting on child
+ * @return TRUE if guest successfully started
*/
- bool (*start) (guest_t *this);
+ bool (*start) (guest_t *this, invoke_function_t invoke, void *data,
+ idle_function_t idle);
/**
* @brief Kill the guest.
*
- * @return TRUE if guest was running and killed
+ * @param idle idle function to call while waiting to termination
+ * @return TRUE if guest was running and killed
*/
- bool (*stop) (guest_t *this);
-
- /**
- * @brief Get a console pts device.
- *
- * Every guest has 5 consoles, numbered from 1 to 5. These are associated
- * to a unique pts device on the host.
- *
- * @param console console number to get (1-5)
- * @return pts device file name, NULL if failed
- */
- char* (*get_console) (guest_t *this, int console);
+ bool (*stop) (guest_t *this, idle_function_t idle);
/**
* @brief Create a new interface in the current scenario.
@@ -106,11 +120,18 @@ struct guest_t {
iface_t* (*create_iface)(guest_t *this, char *name);
/**
- * @brief Create an iterator over all guest interfaces.
+ * @brief Destroy an interface on guest.
+ *
+ * @param iface interface to destroy
+ */
+ void (*destroy_iface)(guest_t *this, iface_t *iface);
+
+ /**
+ * @brief Create an enumerator over all guest interfaces.
*
- * @return iterator over iface_t's
+ * @return enumerator over iface_t's
*/
- iterator_t* (*create_iface_iterator)(guest_t *this);
+ enumerator_t* (*create_iface_enumerator)(guest_t *this);
/**
* @brief Set the template COWFS overlay to use.