diff options
Diffstat (limited to 'src/dumm/guest.h')
-rw-r--r-- | src/dumm/guest.h | 61 |
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. |