child-delete: Reply as usual when concurrently rekeying the IKE_SA
[strongswan.git] / src / dumm / dumm.h
1 /*
2 * Copyright (C) 2008-2009 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 <collections/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 * Add an overlay to all guests.
87 *
88 * Directories named after the guests are created, if they do not exist
89 * in the given overlay directory.
90 *
91 * If adding the overlay on at lest one guest fails, FALSE is returned and
92 * the overlay is again removed from all guests.
93 *
94 * @param dir dir to the overlay
95 * @return FALSE, on failure
96 */
97 bool (*add_overlay)(dumm_t *this, char *dir);
98
99 /**
100 * Removes an overlay from all guests.
101 *
102 * @param dir dir to the overlay
103 * @return FALSE, if the overlay was not found on any guest
104 */
105 bool (*del_overlay)(dumm_t *this, char *dir);
106
107 /**
108 * Remove the latest overlay from all guests.
109 *
110 * @return FALSE, if no overlay was found on any guest
111 */
112 bool (*pop_overlay)(dumm_t *this);
113
114 /**
115 * Loads a template, create a new one if it does not exist.
116 *
117 * This is basically a wrapper around add/del_overlay to simplify working
118 * with overlays. Templates are located in a predefined directory, so that
119 * only a name for the template has to be specified here. Only one template
120 * can be loaded at any one time (but other overlays can be added on top or
121 * below a template).
122 *
123 * @param name name of the template to load, NULL to unload
124 * @return FALSE if load/create failed
125 */
126 bool (*load_template)(dumm_t *this, char *name);
127
128 /**
129 * Create an enumerator over all available templates.
130 *
131 * @return enumerator over char*
132 */
133 enumerator_t* (*create_template_enumerator)(dumm_t *this);
134
135 /**
136 * stop all guests and destroy the modeler
137 */
138 void (*destroy) (dumm_t *this);
139 };
140
141 /**
142 * Create a group of UML hosts and networks.
143 *
144 * @param dir directory to create guests/load from, NULL for cwd
145 * @return created UML group, or NULL if failed.
146 */
147 dumm_t *dumm_create(char *dir);
148
149 #endif /* DUMM_H */
150