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