2007-07-25 13:23:45 +00:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2007 Martin Willi
|
|
|
|
* Hochschule fuer Technik Rapperswil
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify it
|
|
|
|
* under the terms of the GNU General Public License as published by the
|
|
|
|
* Free Software Foundation; either version 2 of the License, or (at your
|
|
|
|
* option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
2007-07-24 14:22:56 +00:00
|
|
|
#ifndef DUMM_H
|
|
|
|
#define DUMM_H
|
|
|
|
|
2007-07-27 07:37:15 +00:00
|
|
|
#include <signal.h>
|
|
|
|
|
2007-07-24 14:22:56 +00:00
|
|
|
#include <library.h>
|
|
|
|
#include <utils/linked_list.h>
|
|
|
|
|
|
|
|
#include "guest.h"
|
|
|
|
|
|
|
|
#define HOST_DIR "host"
|
|
|
|
#define MOUNT_DIR "mount"
|
|
|
|
#define RUN_DIR "run"
|
|
|
|
|
|
|
|
|
|
|
|
typedef struct dumm_t dumm_t;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief dumm - Dynamic Uml Mesh Modeler
|
|
|
|
*
|
|
|
|
* Controls a group of UML guests and their networks.
|
|
|
|
*/
|
|
|
|
struct dumm_t {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Starts a new UML guest
|
|
|
|
*
|
|
|
|
* @param name name of the guest
|
|
|
|
* @param master mounted read only master filesystem
|
|
|
|
* @param mem amount of memory for guest, in MB
|
|
|
|
* @return guest if started, NULL if failed
|
|
|
|
*/
|
2007-07-26 13:21:06 +00:00
|
|
|
guest_t* (*create_guest) (dumm_t *this, char *name, char *master, int mem);
|
2007-07-24 14:22:56 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Create an iterator over all guests.
|
|
|
|
*
|
|
|
|
* @return iteraotor over guest_t's
|
|
|
|
*/
|
|
|
|
iterator_t* (*create_guest_iterator) (dumm_t *this);
|
|
|
|
|
2007-07-27 07:37:15 +00:00
|
|
|
/**
|
|
|
|
* @brief Handler for received SIG_CHILD signals.
|
|
|
|
*
|
|
|
|
* Dumm spans children, UML kernels. To track and cleanup these kernel
|
|
|
|
* processes, it is required that this method is called whenever a SIG_CHILD
|
|
|
|
* is received. The user is responsible to call sigchild_handler on each
|
|
|
|
* dumm_t instance with the signals siginfo_t.
|
|
|
|
*
|
|
|
|
* @param info siginfo associated to the SIG_CHILD signal
|
|
|
|
*/
|
|
|
|
void (*sigchild_handler)(dumm_t *this, siginfo_t *info);
|
|
|
|
|
2007-07-24 14:22:56 +00:00
|
|
|
/**
|
|
|
|
* @brief stop all guests and destroy the modeler
|
|
|
|
*/
|
|
|
|
void (*destroy) (dumm_t *this);
|
|
|
|
};
|
|
|
|
|
2007-07-25 13:23:45 +00:00
|
|
|
/**
|
|
|
|
* @brief Create a new group of UML hosts and networks.
|
|
|
|
*
|
|
|
|
* Dumm uses its working dir to create folders and files it works with.
|
|
|
|
*
|
|
|
|
* @return created UML group, or NULL if failed.
|
|
|
|
*/
|
2007-07-24 14:22:56 +00:00
|
|
|
dumm_t *dumm_create();
|
|
|
|
|
|
|
|
#endif /* DUMM_H */
|
2007-07-25 13:23:45 +00:00
|
|
|
|