{
}
-/**
- * Implementation of mconsole_t.add_iface.
- */
-static bool add_iface(private_mconsole_t *this, char *guest, char *host)
+METHOD(mconsole_t, add_iface, bool,
+ private_mconsole_t *this, char *guest, char *host)
{
int tries = 0;
return FALSE;
}
-/**
- * Implementation of mconsole_t.del_iface.
- */
-static bool del_iface(private_mconsole_t *this, char *guest)
+METHOD(mconsole_t, del_iface, bool,
+ private_mconsole_t *this, char *guest)
{
if (request(this, NULL, NULL, "remove %s", guest) != 0)
{
return TRUE;
}
-/**
- * Implementation of mconsole_t.exec
- */
-static int exec(private_mconsole_t *this, void(*cb)(void*,char*,size_t),
- void *data, char *cmd)
+METHOD(mconsole_t, exec, int,
+ private_mconsole_t *this, void(*cb)(void*,char*,size_t), void *data,
+ char *cmd)
{
return request(this, cb, data, "%s", cmd);
}
}
}
-/**
- * Implementation of mconsole_t.destroy.
- */
-static void destroy(private_mconsole_t *this)
+METHOD(mconsole_t, destroy, void,
+ private_mconsole_t *this)
{
close(this->console);
close(this->notify);
*/
mconsole_t *mconsole_create(char *notify, void(*idle)(void))
{
- private_mconsole_t *this = malloc_thing(private_mconsole_t);
-
- this->public.add_iface = (bool(*)(mconsole_t*, char *guest, char *host))add_iface;
- this->public.del_iface = (bool(*)(mconsole_t*, char *guest))del_iface;
- this->public.exec = (int(*)(mconsole_t*, void(*cb)(void*,char*,size_t), void *data, char *cmd))exec;
- this->public.destroy = (void*)destroy;
-
- this->idle = idle;
+ private_mconsole_t *this;
+
+ INIT(this,
+ .public = {
+ .add_iface = _add_iface,
+ .del_iface = _del_iface,
+ .exec = _exec,
+ .destroy = _destroy,
+ },
+ .idle = idle,
+ );
if (!wait_for_notify(this, notify))
{