aboutsummaryrefslogtreecommitdiffstats
path: root/src/dumm/ext
diff options
context:
space:
mode:
authorMartin Willi <martin@strongswan.org>2008-10-15 14:47:52 +0000
committerMartin Willi <martin@strongswan.org>2008-10-15 14:47:52 +0000
commit61508be2f5ff02c037148d0c899c98e31422b9e3 (patch)
tree6a25bb0844975cc5176f6c23b5e0c5730cf5ab06 /src/dumm/ext
parent1df106bf391855202ed55c8d15e70c68bac5a06e (diff)
downloadstrongswan-61508be2f5ff02c037148d0c899c98e31422b9e3.tar.bz2
strongswan-61508be2f5ff02c037148d0c899c98e31422b9e3.tar.xz
added a guest.mconsole() method to script mconsole (e.g. add additional conX=)
Diffstat (limited to 'src/dumm/ext')
-rw-r--r--src/dumm/ext/dumm.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/dumm/ext/dumm.c b/src/dumm/ext/dumm.c
index 3cc256fda..adb89d632 100644
--- a/src/dumm/ext/dumm.c
+++ b/src/dumm/ext/dumm.c
@@ -207,6 +207,22 @@ static VALUE guest_exec(VALUE self, VALUE cmd)
block = rb_block_given_p();
Data_Get_Struct(self, guest_t, guest);
if ((ret = guest->exec_str(guest, block ? (void*)exec_cb : NULL, TRUE, NULL,
+ "exec %s", StringValuePtr(cmd))) != 0)
+ {
+ rb_raise(rb_eRuntimeError, "executing command failed (%d)", ret);
+ }
+ return self;
+}
+
+static VALUE guest_mconsole(VALUE self, VALUE cmd)
+{
+ guest_t *guest;
+ bool block;
+ int ret;
+
+ block = rb_block_given_p();
+ Data_Get_Struct(self, guest_t, guest);
+ if ((ret = guest->exec_str(guest, block ? (void*)exec_cb : NULL, TRUE, NULL,
"%s", StringValuePtr(cmd))) != 0)
{
rb_raise(rb_eRuntimeError, "executing command failed (%d)", ret);
@@ -310,6 +326,7 @@ static void guest_init()
rb_define_method(rbc_guest, "stop", guest_stop, 0);
rb_define_method(rbc_guest, "running?", guest_running, 0);
rb_define_method(rbc_guest, "exec", guest_exec, 1);
+ rb_define_method(rbc_guest, "mconsole", guest_mconsole, 1);
rb_define_method(rbc_guest, "add", guest_add_iface, 1);
rb_define_method(rbc_guest, "[]", guest_get_iface, 1);
rb_define_method(rbc_guest, "each", guest_each_iface, -1);