* allow to load templates from arbitrary places
[strongswan.git] / src / dumm / dumm.h
1 /*
2 * Copyright (C) 2008 Tobias Brunner
3 * Copyright (C) 2007 Martin Willi
4 * Hochschule fuer Technik Rapperswil
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * for more details.
15 */
16
17 #ifndef DUMM_H
18 #define DUMM_H
19
20 #include <signal.h>
21
22 #include <library.h>
23 #include <utils/enumerator.h>
24
25 #include "guest.h"
26 #include "bridge.h"
27
28 typedef struct dumm_t dumm_t;
29
30 /**
31 * @brief dumm - Dynamic Uml Mesh Modeler
32 *
33 * Controls a group of UML guests and their networks.
34 */
35 struct dumm_t {
36
37 /**
38 * @brief Starts a new UML guest
39 *
40 * @param name name of the guest
41 * @param kernel UML kernel to use for guest
42 * @param master mounted read only master filesystem
43 * @param mem amount of memory for guest, in MB
44 * @return guest if started, NULL if failed
45 */
46 guest_t* (*create_guest) (dumm_t *this, char *name, char *kernel,
47 char *master, int mem);
48
49 /**
50 * @brief Create an enumerator over all guests.
51 *
52 * @return enumerator over guest_t's
53 */
54 enumerator_t* (*create_guest_enumerator) (dumm_t *this);
55
56 /**
57 * @brief Delete a guest from disk.
58 *
59 * @param guest guest to destroy
60 */
61 void (*delete_guest) (dumm_t *this, guest_t *guest);
62
63 /**
64 * @brief Create a new bridge.
65 *
66 * @param name name of the bridge to create
67 * @return created bridge
68 */
69 bridge_t* (*create_bridge)(dumm_t *this, char *name);
70
71 /**
72 * @brief Create an enumerator over all bridges.
73 *
74 * @return enumerator over bridge_t's
75 */
76 enumerator_t* (*create_bridge_enumerator)(dumm_t *this);
77
78 /**
79 * @brief Delete a bridge.
80 *
81 * @param bridge bridge to destroy
82 */
83 void (*delete_bridge) (dumm_t *this, bridge_t *bridge);
84
85 /**
86 * @brief Loads a template, create a new one if it does not exist.
87 *
88 * @param name dir to the template, NULL to close
89 * @return FALSE if load/create failed
90 */
91 bool (*load_template)(dumm_t *this, char *dir);
92
93 /**
94 * @brief stop all guests and destroy the modeler
95 */
96 void (*destroy) (dumm_t *this);
97 };
98
99 /**
100 * @brief Create a group of UML hosts and networks.
101 *
102 * @param dir directory to create guests/load from, NULL for cwd
103 * @return created UML group, or NULL if failed.
104 */
105 dumm_t *dumm_create(char *dir);
106
107 #endif /* DUMM_H */
108