Added support for multiple overlays to the copy-on-write filesystem.
[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 * dumm - Dynamic Uml Mesh Modeler
32 *
33 * Controls a group of UML guests and their networks.
34 */
35 struct dumm_t {
36
37 /**
38 * 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 args additional args to pass to kernel
44 * @return guest if started, NULL if failed
45 */
46 guest_t* (*create_guest) (dumm_t *this, char *name, char *kernel,
47 char *master, char *args);
48
49 /**
50 * 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 * 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 * 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 * 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 * Delete a bridge.
80 *
81 * @param bridge bridge to destroy
82 */
83 void (*delete_bridge) (dumm_t *this, bridge_t *bridge);
84
85 /**
86 * 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 * Create an enumerator over all available templates.
95 *
96 * @return enumerator over char*
97 */
98 enumerator_t* (*create_template_enumerator)(dumm_t *this);
99
100 /**
101 * stop all guests and destroy the modeler
102 */
103 void (*destroy) (dumm_t *this);
104 };
105
106 /**
107 * Create a group of UML hosts and networks.
108 *
109 * @param dir directory to create guests/load from, NULL for cwd
110 * @return created UML group, or NULL if failed.
111 */
112 dumm_t *dumm_create(char *dir);
113
114 #endif /* DUMM_H */
115