Index: swig/abac.h
===================================================================
--- swig/abac.h	(revision 06e2fc57548a7ae3a31d287a3d5830ae72a2f86f)
+++ swig/abac.h	(revision 06e2fc57548a7ae3a31d287a3d5830ae72a2f86f)
@@ -0,0 +1,1 @@
+../libabac/abac.h
Index: swig/abac.hh
===================================================================
--- swig/abac.hh	(revision 06e2fc57548a7ae3a31d287a3d5830ae72a2f86f)
+++ swig/abac.hh	(revision 06e2fc57548a7ae3a31d287a3d5830ae72a2f86f)
@@ -0,0 +1,1 @@
+../libabac/abac.hh
Index: swig/abac.i
===================================================================
--- swig/abac.i	(revision 06e2fc57548a7ae3a31d287a3d5830ae72a2f86f)
+++ swig/abac.i	(revision 06e2fc57548a7ae3a31d287a3d5830ae72a2f86f)
@@ -0,0 +1,20 @@
+%module ABAC
+
+%{
+#include "abac.hh"
+using namespace ABAC;
+%}
+
+%include "language.i"
+
+%ignore std::vector<ABAC::Credential>::vector(size_type); 
+%ignore std::vector<ABAC::Credential>::resize(size_type);
+%ignore std::vector<ABAC::Credential>::pop(); 
+%include "std_vector.i"
+
+namespace std {
+    %template(CredentialVector) vector<ABAC::Credential>;
+};
+
+%include "abac.h"
+%include "abac.hh"
Index: swig/perl/Makefile
===================================================================
--- swig/perl/Makefile	(revision 06e2fc57548a7ae3a31d287a3d5830ae72a2f86f)
+++ swig/perl/Makefile	(revision 06e2fc57548a7ae3a31d287a3d5830ae72a2f86f)
@@ -0,0 +1,13 @@
+all: ABAC.so ABAC.py
+
+ABAC.so: abac_wrap.o
+	g++ -shared abac_wrap.o -labac -lstrongswan -o ABAC.so
+
+abac_wrap.o: abac_wrap.cxx
+	g++ -g -c abac_wrap.cxx `perl -MExtUtils::Embed -e ccopts`
+
+abac_wrap.cxx ABAC.py: abac.i language.i
+	swig -c++ -perl abac.i
+
+clean:
+	rm -f ABAC.so ABAC.pm abac_wrap.o abac_wrap.cxx
Index: swig/perl/abac.h
===================================================================
--- swig/perl/abac.h	(revision 06e2fc57548a7ae3a31d287a3d5830ae72a2f86f)
+++ swig/perl/abac.h	(revision 06e2fc57548a7ae3a31d287a3d5830ae72a2f86f)
@@ -0,0 +1,1 @@
+../abac.h
Index: swig/perl/abac.hh
===================================================================
--- swig/perl/abac.hh	(revision 06e2fc57548a7ae3a31d287a3d5830ae72a2f86f)
+++ swig/perl/abac.hh	(revision 06e2fc57548a7ae3a31d287a3d5830ae72a2f86f)
@@ -0,0 +1,1 @@
+../abac.hh
Index: swig/perl/abac.i
===================================================================
--- swig/perl/abac.i	(revision 06e2fc57548a7ae3a31d287a3d5830ae72a2f86f)
+++ swig/perl/abac.i	(revision 06e2fc57548a7ae3a31d287a3d5830ae72a2f86f)
@@ -0,0 +1,1 @@
+../abac.i
Index: swig/perl/language.i
===================================================================
--- swig/perl/language.i	(revision 06e2fc57548a7ae3a31d287a3d5830ae72a2f86f)
+++ swig/perl/language.i	(revision 06e2fc57548a7ae3a31d287a3d5830ae72a2f86f)
@@ -0,0 +1,15 @@
+%typemap(argout) bool &success {
+    --argvi;
+    SV *array = $result;
+
+    $result = sv_newmortal();
+    sv_setiv($result, *$1);
+    ++argvi;
+
+    $result = array;
+    ++argvi;
+}
+
+%typemap(in,numinputs=0) bool &success(bool temp) {
+    $1 = &temp;
+}
Index: swig/perl/prover.pl
===================================================================
--- swig/perl/prover.pl	(revision 06e2fc57548a7ae3a31d287a3d5830ae72a2f86f)
+++ swig/perl/prover.pl	(revision 06e2fc57548a7ae3a31d287a3d5830ae72a2f86f)
@@ -0,0 +1,30 @@
+#!/usr/bin/perl
+
+use strict;
+use ABAC;
+use Data::Dumper;
+$Data::Dumper::Indent = 1;
+
+my $keystore = shift || die "Usage: prover.pl <keystore>\n";
+
+ABAC::libabac_init();
+
+my $ctx = ABAC::Context->new;
+$ctx->load_directory($keystore);
+
+my ($success, $credentials) = $ctx->query(
+    "3f1aca4c5911b345d81c5f1a77675dce13249d0c.fed_create",
+    "5839d714b16bbe108642c5eb586c2173420bed19"
+);
+
+if ($success) {
+    print "Success\n";
+}
+
+foreach my $credential (@$credentials) {
+    printf "credential %s <- %s\n",
+        $credential->head->string,
+        $credential->tail->string;
+}
+
+ABAC::libabac_deinit();
Index: swig/python/Makefile
===================================================================
--- swig/python/Makefile	(revision 06e2fc57548a7ae3a31d287a3d5830ae72a2f86f)
+++ swig/python/Makefile	(revision 06e2fc57548a7ae3a31d287a3d5830ae72a2f86f)
@@ -0,0 +1,13 @@
+all: _ABAC.so ABAC.py
+
+_ABAC.so: abac_wrap.o
+	g++ -shared abac_wrap.o -labac -lstrongswan -o _ABAC.so
+
+abac_wrap.o: abac_wrap.cxx
+	g++ -g -c abac_wrap.cxx -I/usr/include/python2.6
+
+abac_wrap.cxx ABAC.py: abac.i language.i
+	swig -c++ -python abac.i
+
+clean:
+	rm -f _ABAC.so ABAC.py ABAC.pyc abac_wrap.o abac_wrap.cxx
Index: swig/python/abac.h
===================================================================
--- swig/python/abac.h	(revision 06e2fc57548a7ae3a31d287a3d5830ae72a2f86f)
+++ swig/python/abac.h	(revision 06e2fc57548a7ae3a31d287a3d5830ae72a2f86f)
@@ -0,0 +1,1 @@
+../abac.h
Index: swig/python/abac.hh
===================================================================
--- swig/python/abac.hh	(revision 06e2fc57548a7ae3a31d287a3d5830ae72a2f86f)
+++ swig/python/abac.hh	(revision 06e2fc57548a7ae3a31d287a3d5830ae72a2f86f)
@@ -0,0 +1,1 @@
+../abac.hh
Index: swig/python/abac.i
===================================================================
--- swig/python/abac.i	(revision 06e2fc57548a7ae3a31d287a3d5830ae72a2f86f)
+++ swig/python/abac.i	(revision 06e2fc57548a7ae3a31d287a3d5830ae72a2f86f)
@@ -0,0 +1,1 @@
+../abac.i
Index: swig/python/language.i
===================================================================
--- swig/python/language.i	(revision 06e2fc57548a7ae3a31d287a3d5830ae72a2f86f)
+++ swig/python/language.i	(revision 06e2fc57548a7ae3a31d287a3d5830ae72a2f86f)
@@ -0,0 +1,21 @@
+%typemap(argout) bool &success {
+    PyObject *o, *o2, *o3;
+    o = PyBool_FromLong(*$1);
+    if ((!$result) || ($result == Py_None)) {
+        $result = o;
+    } else {
+        if (!PyTuple_Check($result)) {
+            PyObject *o2 = $result;
+            $result = PyTuple_New(1);
+            PyTuple_SetItem($result,0,o2);
+        }
+        o3 = PyTuple_New(2);
+        PyTuple_SetItem(o3,0,o);
+        PyTuple_SetItem(o3,1,$result);
+        $result = o3;
+    }
+}
+
+%typemap(in,numinputs=0) bool &success(bool temp) {
+    $1 = &temp;
+}
Index: swig/python/prover.py
===================================================================
--- swig/python/prover.py	(revision 06e2fc57548a7ae3a31d287a3d5830ae72a2f86f)
+++ swig/python/prover.py	(revision 06e2fc57548a7ae3a31d287a3d5830ae72a2f86f)
@@ -0,0 +1,29 @@
+#!/usr/bin/python
+
+import sys
+from ABAC import *
+import pprint
+
+pp = pprint.PrettyPrinter(indent=4)
+
+if len(sys.argv) < 2:
+    print "Usage: prover.py <keystore>"
+    exit(1)
+
+keystore = sys.argv[1]
+
+libabac_init()
+
+ctx = Context()
+ctx.load_directory(keystore)
+
+(success, credentials) = ctx.query(
+    "3f1aca4c5911b345d81c5f1a77675dce13249d0c.fed_create",
+    "5839d714b16bbe108642c5eb586c2173420bed19",
+)
+
+for credential in credentials:
+    print "credential %s <- %s" % (credential.head().string(), credential.tail().string())
+    # pp.pprint(credential)
+
+libabac_deinit()
