Added support for multiple overlays to the copy-on-write filesystem.
[strongswan.git] / src / dumm / mconsole.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 MCONSOLE_H
17 #define MCONSOLE_H
18
19 #include <library.h>
20
21 typedef struct mconsole_t mconsole_t;
22
23 /**
24 * UML mconsole, change running UML configuration using mconsole.
25 */
26 struct mconsole_t {
27
28 /**
29 * Create a guest interface and connect it to tap host interface.
30 *
31 * @param guest name of the interface to create in the guest
32 * @param host name of the tap device to connect guest to
33 * @return TRUE if interface created
34 */
35 bool (*add_iface)(mconsole_t *this, char *guest, char *host);
36
37 /**
38 * Delete a guest interface.
39 *
40 * @param guest name of the interface to delete on the guest
41 * @return TRUE if interface deleted
42 */
43 bool (*del_iface)(mconsole_t *this, char *guest);
44
45 /**
46 * Execute a command on the mconsole.
47 *
48 * @param cb callback function to invoke for each line
49 * @param data data to pass to callback
50 * @param cmd command to invoke
51 * @return return value of command
52 */
53 int (*exec)(mconsole_t *this, void(*cb)(void*,char*,size_t), void *data,
54 char *cmd);
55
56 /**
57 * Destroy the mconsole instance
58 */
59 void (*destroy) (mconsole_t *this);
60 };
61
62 /**
63 * Create a new mconsole connection to a guest.
64 *
65 * Waits for a notification from the guest through the notify socket and tries
66 * to connect to the mconsole socket supplied in the received notification.
67 *
68 * @param notify unix notify socket path
69 * @param idle idle function to call while waiting for responses
70 * @return mconsole instance, or NULL if failed
71 */
72 mconsole_t *mconsole_create(char *notify, void(*idle)(void));
73
74 #endif /* MCONSOLE_H */
75