2 * Copyright (C) 2007 Martin Willi
3 * Hochschule fuer Technik Rapperswil
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>.
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
21 typedef struct mconsole_t mconsole_t
;
24 * @brief UML mconsole, change running UML configuration using mconsole.
29 * @brief Create a guest interface and connect it to tap host interface.
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
35 bool (*add_iface
)(mconsole_t
*this, char *guest
, char *host
);
38 * @brief Delete a guest interface.
40 * @param guest name of the interface to delete on the guest
41 * @return TRUE if interface deleted
43 bool (*del_iface
)(mconsole_t
*this, char *guest
);
46 * Execute a command on the mconsole.
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
53 int (*exec
)(mconsole_t
*this, void(*cb
)(void*,char*,size_t), void *data
,
57 * @brief Destroy the mconsole instance
59 void (*destroy
) (mconsole_t
*this);
63 * @brief Create a new mconsole connection to a guest.
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.
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
72 mconsole_t
*mconsole_create(char *notify
, void(*idle
)(void));
74 #endif /* MCONSOLE_H */