diff options
author | Martin Willi <martin@strongswan.org> | 2008-07-07 14:56:04 +0000 |
---|---|---|
committer | Martin Willi <martin@strongswan.org> | 2008-07-07 14:56:04 +0000 |
commit | 02a608363393df08a3153ac779e08ab903ce27c4 (patch) | |
tree | cf7b4437e7b1e7eb7bb7d4a34da6ba4444f59eae /src/dumm/guest.c | |
parent | 36beca7cef3187c123ff70fa166c0191e1ffd726 (diff) | |
download | strongswan-02a608363393df08a3153ac779e08ab903ce27c4.tar.bz2 strongswan-02a608363393df08a3153ac779e08ab903ce27c4.tar.xz |
guest interface/address management using hackish mconsole exec patch, ruby bindings
Diffstat (limited to 'src/dumm/guest.c')
-rw-r--r-- | src/dumm/guest.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/dumm/guest.c b/src/dumm/guest.c index 75d0245d8..6aad15058 100644 --- a/src/dumm/guest.c +++ b/src/dumm/guest.c @@ -25,6 +25,7 @@ #include <signal.h> #include <dirent.h> #include <termios.h> +#include <stdarg.h> #include <debug.h> #include <utils/linked_list.h> @@ -325,6 +326,29 @@ static bool load_template(private_guest_t *this, char *path) } /** + * Implementation of gues_t.exec + */ +static int exec(private_guest_t *this, char *cmd, ...) +{ + char buf[512]; + size_t len; + va_list args; + + if (this->mconsole) + { + va_start(args, cmd); + len = vsnprintf(buf, sizeof(buf), cmd, args); + va_end(args); + + if (len > 0 && len < sizeof(buf)) + { + return this->mconsole->exec(this->mconsole, buf); + } + } + return FALSE; +} + +/** * Implementation of guest_t.sigchild. */ static void sigchild(private_guest_t *this) @@ -448,6 +472,7 @@ static private_guest_t *guest_create_generic(char *parent, char *name, this->public.start = (void*)start; this->public.stop = (void*)stop; this->public.load_template = (bool(*)(guest_t*, char *path))load_template; + this->public.exec = (bool(*)(guest_t*, char *cmd, ...))exec; this->public.sigchild = (void(*)(guest_t*))sigchild; this->public.destroy = (void*)destroy; |