Index: swig/perl/ABAC.pm
===================================================================
--- swig/perl/ABAC.pm	(revision 80a0f3f2182a90cbb685f63c76497308dc027710)
+++ swig/perl/ABAC.pm	(revision 80a0f3f2182a90cbb685f63c76497308dc027710)
@@ -0,0 +1,501 @@
+# This file was automatically generated by SWIG (http://www.swig.org).
+# Version 3.0.10
+#
+# Do not make changes to this file unless you know what you are doing--modify
+# the SWIG interface file instead.
+
+package ABAC;
+use base qw(Exporter);
+use base qw(DynaLoader);
+package ABACc;
+bootstrap ABAC;
+package ABAC;
+@EXPORT = qw();
+
+# ---------- BASE METHODS -------------
+
+package ABAC;
+
+sub TIEHASH {
+    my ($classname,$obj) = @_;
+    return bless $obj, $classname;
+}
+
+sub CLEAR { }
+
+sub FIRSTKEY { }
+
+sub NEXTKEY { }
+
+sub FETCH {
+    my ($self,$field) = @_;
+    my $member_func = "swig_${field}_get";
+    $self->$member_func();
+}
+
+sub STORE {
+    my ($self,$field,$newval) = @_;
+    my $member_func = "swig_${field}_set";
+    $self->$member_func($newval);
+}
+
+sub this {
+    my $ptr = shift;
+    return tied(%$ptr);
+}
+
+
+# ------- FUNCTION WRAPPERS --------
+
+package ABAC;
+
+*SSL_keyid = *ABACc::SSL_keyid;
+*abac_chunk_free = *ABACc::abac_chunk_free;
+*abac_context_new = *ABACc::abac_context_new;
+*abac_context_dup = *ABACc::abac_context_dup;
+*abac_context_free = *ABACc::abac_context_free;
+*abac_context_load_id_file = *ABACc::abac_context_load_id_file;
+*abac_context_load_id_chunk = *ABACc::abac_context_load_id_chunk;
+*abac_context_load_id_id = *ABACc::abac_context_load_id_id;
+*abac_context_load_attribute_file = *ABACc::abac_context_load_attribute_file;
+*abac_context_load_attribute_chunk = *ABACc::abac_context_load_attribute_chunk;
+*abac_context_load_directory = *ABACc::abac_context_load_directory;
+*abac_context_query = *ABACc::abac_context_query;
+*abac_context_credentials = *ABACc::abac_context_credentials;
+*abac_context_principals = *ABACc::abac_context_principals;
+*abac_context_id_credentials_free = *ABACc::abac_context_id_credentials_free;
+*abac_context_credentials_free = *ABACc::abac_context_credentials_free;
+*abac_context_set_nickname = *ABACc::abac_context_set_nickname;
+*abac_context_expand_key = *ABACc::abac_context_expand_key;
+*abac_context_expand_nickname = *ABACc::abac_context_expand_nickname;
+*abac_context_get_keyid_map = *ABACc::abac_context_get_keyid_map;
+*abac_credential_head = *ABACc::abac_credential_head;
+*abac_credential_tail = *ABACc::abac_credential_tail;
+*abac_credential_attribute_cert = *ABACc::abac_credential_attribute_cert;
+*abac_credential_issuer_cert = *ABACc::abac_credential_issuer_cert;
+*abac_credential_dup = *ABACc::abac_credential_dup;
+*abac_credential_free = *ABACc::abac_credential_free;
+*abac_id_cert_keyid = *ABACc::abac_id_cert_keyid;
+*abac_id_cert_cn = *ABACc::abac_id_cert_cn;
+*abac_role_principal_new = *ABACc::abac_role_principal_new;
+*abac_role_role_new = *ABACc::abac_role_role_new;
+*abac_role_linking_new = *ABACc::abac_role_linking_new;
+*abac_role_free = *ABACc::abac_role_free;
+*abac_role_from_string = *ABACc::abac_role_from_string;
+*abac_role_dup = *ABACc::abac_role_dup;
+*abac_role_is_principal = *ABACc::abac_role_is_principal;
+*abac_role_is_role = *ABACc::abac_role_is_role;
+*abac_role_is_linking = *ABACc::abac_role_is_linking;
+*abac_role_is_intersection = *ABACc::abac_role_is_intersection;
+*abac_role_string = *ABACc::abac_role_string;
+*abac_role_short_string = *ABACc::abac_role_short_string;
+*abac_role_linked_role = *ABACc::abac_role_linked_role;
+*abac_role_linking_role = *ABACc::abac_role_linking_role;
+*abac_role_role_name = *ABACc::abac_role_role_name;
+*abac_role_principal = *ABACc::abac_role_principal;
+*abac_role_attr_key = *ABACc::abac_role_attr_key;
+*abac_id_from_file = *ABACc::abac_id_from_file;
+*abac_id_from_chunk = *ABACc::abac_id_from_chunk;
+*abac_id_privkey_from_file = *ABACc::abac_id_privkey_from_file;
+*abac_id_privkey_from_chunk = *ABACc::abac_id_privkey_from_chunk;
+*abac_id_generate = *ABACc::abac_id_generate;
+*abac_id_generate_with_key = *ABACc::abac_id_generate_with_key;
+*abac_id_keyid = *ABACc::abac_id_keyid;
+*abac_id_cn = *ABACc::abac_id_cn;
+*abac_id_issuer = *ABACc::abac_id_issuer;
+*abac_id_subject = *ABACc::abac_id_subject;
+*abac_id_still_valid = *ABACc::abac_id_still_valid;
+*abac_id_has_keyid = *ABACc::abac_id_has_keyid;
+*abac_id_has_privkey = *ABACc::abac_id_has_privkey;
+*abac_id_validity = *ABACc::abac_id_validity;
+*abac_id_cert_filename = *ABACc::abac_id_cert_filename;
+*abac_id_write_cert = *ABACc::abac_id_write_cert;
+*abac_id_privkey_filename = *ABACc::abac_id_privkey_filename;
+*abac_id_write_privkey = *ABACc::abac_id_write_privkey;
+*abac_id_cert_chunk = *ABACc::abac_id_cert_chunk;
+*abac_id_privkey_chunk = *ABACc::abac_id_privkey_chunk;
+*abac_id_dup = *ABACc::abac_id_dup;
+*abac_id_free = *ABACc::abac_id_free;
+*abac_attribute_create = *ABACc::abac_attribute_create;
+*abac_attribute_set_head = *ABACc::abac_attribute_set_head;
+*abac_attribute_get_head = *ABACc::abac_attribute_get_head;
+*abac_attribute_principal = *ABACc::abac_attribute_principal;
+*abac_attribute_role = *ABACc::abac_attribute_role;
+*abac_attribute_linking_role = *ABACc::abac_attribute_linking_role;
+*abac_attribute_bake = *ABACc::abac_attribute_bake;
+*abac_attribute_bake_context = *ABACc::abac_attribute_bake_context;
+*abac_attribute_baked = *ABACc::abac_attribute_baked;
+*abac_attribute_write = *ABACc::abac_attribute_write;
+*abac_attribute_write_file = *ABACc::abac_attribute_write_file;
+*abac_attribute_get_ntails = *ABACc::abac_attribute_get_ntails;
+*abac_attribute_get_tail_n = *ABACc::abac_attribute_get_tail_n;
+*abac_attribute_cert_chunk = *ABACc::abac_attribute_cert_chunk;
+*abac_attribute_free = *ABACc::abac_attribute_free;
+*abac_attribute_certs_from_file = *ABACc::abac_attribute_certs_from_file;
+*abac_attribute_certs_from_chunk = *ABACc::abac_attribute_certs_from_chunk;
+*abac_attribute_role_string = *ABACc::abac_attribute_role_string;
+*abac_attribute_issuer_id = *ABACc::abac_attribute_issuer_id;
+*abac_attribute_get_output_format = *ABACc::abac_attribute_get_output_format;
+*abac_attribute_set_output_format = *ABACc::abac_attribute_set_output_format;
+*abac_attribute_validity = *ABACc::abac_attribute_validity;
+*abac_attribute_get_keyid_map = *ABACc::abac_attribute_get_keyid_map;
+*abac_attribute_get_principal = *ABACc::abac_attribute_get_principal;
+*abac_attribute_still_valid = *ABACc::abac_attribute_still_valid;
+*abac_keyid_mapping_new = *ABACc::abac_keyid_mapping_new;
+*abac_keyid_mapping_free = *ABACc::abac_keyid_mapping_free;
+*abac_keyid_map_new = *ABACc::abac_keyid_map_new;
+*abac_keyid_map_dup = *ABACc::abac_keyid_map_dup;
+*abac_keyid_map_clone = *ABACc::abac_keyid_map_clone;
+*abac_keyid_map_free = *ABACc::abac_keyid_map_free;
+*abac_keyid_map_key_to_nickname = *ABACc::abac_keyid_map_key_to_nickname;
+*abac_keyid_map_nickname_to_key = *ABACc::abac_keyid_map_nickname_to_key;
+*abac_keyid_map_remove_keyid = *ABACc::abac_keyid_map_remove_keyid;
+*abac_keyid_map_add_nickname = *ABACc::abac_keyid_map_add_nickname;
+*abac_keyid_map_merge = *ABACc::abac_keyid_map_merge;
+*abac_keyid_map_expand_key = *ABACc::abac_keyid_map_expand_key;
+*abac_keyid_map_expand_nickname = *ABACc::abac_keyid_map_expand_nickname;
+
+############# Class : ABAC::CredentialVector ##############
+
+package ABAC::CredentialVector;
+use vars qw(@ISA %OWNER %ITERATORS %BLESSEDMEMBERS);
+@ISA = qw( ABAC );
+%OWNER = ();
+%ITERATORS = ();
+sub new {
+    my $pkg = shift;
+    my $self = ABACc::new_CredentialVector(@_);
+    bless $self, $pkg if defined($self);
+}
+
+*size = *ABACc::CredentialVector_size;
+*empty = *ABACc::CredentialVector_empty;
+*clear = *ABACc::CredentialVector_clear;
+*push = *ABACc::CredentialVector_push;
+*get = *ABACc::CredentialVector_get;
+*set = *ABACc::CredentialVector_set;
+sub DESTROY {
+    return unless $_[0]->isa('HASH');
+    my $self = tied(%{$_[0]});
+    return unless defined $self;
+    delete $ITERATORS{$self};
+    if (exists $OWNER{$self}) {
+        ABACc::delete_CredentialVector($self);
+        delete $OWNER{$self};
+    }
+}
+
+sub DISOWN {
+    my $self = shift;
+    my $ptr = tied(%$self);
+    delete $OWNER{$ptr};
+}
+
+sub ACQUIRE {
+    my $self = shift;
+    my $ptr = tied(%$self);
+    $OWNER{$ptr} = 1;
+}
+
+
+############# Class : ABAC::abac_chunk_t ##############
+
+package ABAC::abac_chunk_t;
+use vars qw(@ISA %OWNER %ITERATORS %BLESSEDMEMBERS);
+@ISA = qw( ABAC );
+%OWNER = ();
+%ITERATORS = ();
+*swig_ptr_get = *ABACc::abac_chunk_t_ptr_get;
+*swig_ptr_set = *ABACc::abac_chunk_t_ptr_set;
+*swig_len_get = *ABACc::abac_chunk_t_len_get;
+*swig_len_set = *ABACc::abac_chunk_t_len_set;
+sub new {
+    my $pkg = shift;
+    my $self = ABACc::new_abac_chunk_t(@_);
+    bless $self, $pkg if defined($self);
+}
+
+sub DESTROY {
+    return unless $_[0]->isa('HASH');
+    my $self = tied(%{$_[0]});
+    return unless defined $self;
+    delete $ITERATORS{$self};
+    if (exists $OWNER{$self}) {
+        ABACc::delete_abac_chunk_t($self);
+        delete $OWNER{$self};
+    }
+}
+
+sub DISOWN {
+    my $self = shift;
+    my $ptr = tied(%$self);
+    delete $OWNER{$ptr};
+}
+
+sub ACQUIRE {
+    my $self = shift;
+    my $ptr = tied(%$self);
+    $OWNER{$ptr} = 1;
+}
+
+
+############# Class : ABAC::Context ##############
+
+package ABAC::Context;
+use vars qw(@ISA %OWNER %ITERATORS %BLESSEDMEMBERS);
+@ISA = qw( ABAC );
+%OWNER = ();
+%ITERATORS = ();
+sub new {
+    my $pkg = shift;
+    my $self = ABACc::new_Context(@_);
+    bless $self, $pkg if defined($self);
+}
+
+sub DESTROY {
+    return unless $_[0]->isa('HASH');
+    my $self = tied(%{$_[0]});
+    return unless defined $self;
+    delete $ITERATORS{$self};
+    if (exists $OWNER{$self}) {
+        ABACc::delete_Context($self);
+        delete $OWNER{$self};
+    }
+}
+
+*load_id_file = *ABACc::Context_load_id_file;
+*load_id_chunk = *ABACc::Context_load_id_chunk;
+*load_id_id = *ABACc::Context_load_id_id;
+*load_attribute_file = *ABACc::Context_load_attribute_file;
+*load_attribute_chunk = *ABACc::Context_load_attribute_chunk;
+*query = *ABACc::Context_query;
+*credentials = *ABACc::Context_credentials;
+*load_directory = *ABACc::Context_load_directory;
+*set_nickname = *ABACc::Context_set_nickname;
+sub DISOWN {
+    my $self = shift;
+    my $ptr = tied(%$self);
+    delete $OWNER{$ptr};
+}
+
+sub ACQUIRE {
+    my $self = shift;
+    my $ptr = tied(%$self);
+    $OWNER{$ptr} = 1;
+}
+
+
+############# Class : ABAC::Role ##############
+
+package ABAC::Role;
+use vars qw(@ISA %OWNER %ITERATORS %BLESSEDMEMBERS);
+@ISA = qw( ABAC );
+%OWNER = ();
+%ITERATORS = ();
+sub new {
+    my $pkg = shift;
+    my $self = ABACc::new_Role(@_);
+    bless $self, $pkg if defined($self);
+}
+
+sub DESTROY {
+    return unless $_[0]->isa('HASH');
+    my $self = tied(%{$_[0]});
+    return unless defined $self;
+    delete $ITERATORS{$self};
+    if (exists $OWNER{$self}) {
+        ABACc::delete_Role($self);
+        delete $OWNER{$self};
+    }
+}
+
+*is_principal = *ABACc::Role_is_principal;
+*is_role = *ABACc::Role_is_role;
+*is_linking = *ABACc::Role_is_linking;
+*string = *ABACc::Role_string;
+*short_string = *ABACc::Role_short_string;
+*linked_role = *ABACc::Role_linked_role;
+*role_name = *ABACc::Role_role_name;
+*principal = *ABACc::Role_principal;
+sub DISOWN {
+    my $self = shift;
+    my $ptr = tied(%$self);
+    delete $OWNER{$ptr};
+}
+
+sub ACQUIRE {
+    my $self = shift;
+    my $ptr = tied(%$self);
+    $OWNER{$ptr} = 1;
+}
+
+
+############# Class : ABAC::Credential ##############
+
+package ABAC::Credential;
+use vars qw(@ISA %OWNER %ITERATORS %BLESSEDMEMBERS);
+@ISA = qw( ABAC );
+%OWNER = ();
+%ITERATORS = ();
+sub new {
+    my $pkg = shift;
+    my $self = ABACc::new_Credential(@_);
+    bless $self, $pkg if defined($self);
+}
+
+sub DESTROY {
+    return unless $_[0]->isa('HASH');
+    my $self = tied(%{$_[0]});
+    return unless defined $self;
+    delete $ITERATORS{$self};
+    if (exists $OWNER{$self}) {
+        ABACc::delete_Credential($self);
+        delete $OWNER{$self};
+    }
+}
+
+*head = *ABACc::Credential_head;
+*tail = *ABACc::Credential_tail;
+*attribute_cert = *ABACc::Credential_attribute_cert;
+*issuer_cert = *ABACc::Credential_issuer_cert;
+sub DISOWN {
+    my $self = shift;
+    my $ptr = tied(%$self);
+    delete $OWNER{$ptr};
+}
+
+sub ACQUIRE {
+    my $self = shift;
+    my $ptr = tied(%$self);
+    $OWNER{$ptr} = 1;
+}
+
+
+############# Class : ABAC::ID ##############
+
+package ABAC::ID;
+use vars qw(@ISA %OWNER %ITERATORS %BLESSEDMEMBERS);
+@ISA = qw( ABAC );
+%OWNER = ();
+%ITERATORS = ();
+sub DESTROY {
+    return unless $_[0]->isa('HASH');
+    my $self = tied(%{$_[0]});
+    return unless defined $self;
+    delete $ITERATORS{$self};
+    if (exists $OWNER{$self}) {
+        ABACc::delete_ID($self);
+        delete $OWNER{$self};
+    }
+}
+
+sub new_ID_chunk {
+    my $pkg = shift;
+    my $self = ABACc::new_ID_chunk(@_);
+    bless $self, $pkg if defined($self);
+}
+
+sub new {
+    my $pkg = shift;
+    my $self = ABACc::new_ID(@_);
+    bless $self, $pkg if defined($self);
+}
+
+*load_privkey = *ABACc::ID_load_privkey;
+*load_privkey_chunk = *ABACc::ID_load_privkey_chunk;
+*has_privkey = *ABACc::ID_has_privkey;
+*keyid = *ABACc::ID_keyid;
+*cn = *ABACc::ID_cn;
+*cert_filename = *ABACc::ID_cert_filename;
+*write_cert = *ABACc::ID_write_cert;
+*write_cert_file = *ABACc::ID_write_cert_file;
+*write_cert_name = *ABACc::ID_write_cert_name;
+*privkey_filename = *ABACc::ID_privkey_filename;
+*write_privkey = *ABACc::ID_write_privkey;
+*write_privkey_file = *ABACc::ID_write_privkey_file;
+*write_privkey_name = *ABACc::ID_write_privkey_name;
+*cert_chunk = *ABACc::ID_cert_chunk;
+*privkey_chunk = *ABACc::ID_privkey_chunk;
+sub DISOWN {
+    my $self = shift;
+    my $ptr = tied(%$self);
+    delete $OWNER{$ptr};
+}
+
+sub ACQUIRE {
+    my $self = shift;
+    my $ptr = tied(%$self);
+    $OWNER{$ptr} = 1;
+}
+
+
+############# Class : ABAC::Attribute ##############
+
+package ABAC::Attribute;
+use vars qw(@ISA %OWNER %ITERATORS %BLESSEDMEMBERS);
+@ISA = qw( ABAC );
+%OWNER = ();
+%ITERATORS = ();
+sub DESTROY {
+    return unless $_[0]->isa('HASH');
+    my $self = tied(%{$_[0]});
+    return unless defined $self;
+    delete $ITERATORS{$self};
+    if (exists $OWNER{$self}) {
+        ABACc::delete_Attribute($self);
+        delete $OWNER{$self};
+    }
+}
+
+sub new {
+    my $pkg = shift;
+    my $self = ABACc::new_Attribute(@_);
+    bless $self, $pkg if defined($self);
+}
+
+*principal = *ABACc::Attribute_principal;
+*role = *ABACc::Attribute_role;
+*linking_role = *ABACc::Attribute_linking_role;
+*bake = *ABACc::Attribute_bake;
+*baked = *ABACc::Attribute_baked;
+*set_output_format = *ABACc::Attribute_set_output_format;
+*get_output_format = *ABACc::Attribute_get_output_format;
+*write = *ABACc::Attribute_write;
+*write_file = *ABACc::Attribute_write_file;
+*write_name = *ABACc::Attribute_write_name;
+*cert_chunk = *ABACc::Attribute_cert_chunk;
+sub DISOWN {
+    my $self = shift;
+    my $ptr = tied(%$self);
+    delete $OWNER{$ptr};
+}
+
+sub ACQUIRE {
+    my $self = shift;
+    my $ptr = tied(%$self);
+    $OWNER{$ptr} = 1;
+}
+
+
+# ------- VARIABLE STUBS --------
+
+package ABAC;
+
+*ABAC_RC_SUCCESS = *ABACc::ABAC_RC_SUCCESS;
+*ABAC_RC_FAILURE = *ABACc::ABAC_RC_FAILURE;
+*ABAC_CERT_SUCCESS = *ABACc::ABAC_CERT_SUCCESS;
+*ABAC_CERT_INVALID = *ABACc::ABAC_CERT_INVALID;
+*ABAC_CERT_BAD_SIG = *ABACc::ABAC_CERT_BAD_SIG;
+*ABAC_CERT_MISSING_ISSUER = *ABACc::ABAC_CERT_MISSING_ISSUER;
+*ABAC_CERT_BAD_PRINCIPAL = *ABACc::ABAC_CERT_BAD_PRINCIPAL;
+*ABAC_CERT_INVALID_ISSUER = *ABACc::ABAC_CERT_INVALID_ISSUER;
+*ABAC_CERT_SIGNER_NOKEY = *ABACc::ABAC_CERT_SIGNER_NOKEY;
+*ABAC_SUCCESS = *ABACc::ABAC_SUCCESS;
+*ABAC_FAILURE = *ABACc::ABAC_FAILURE;
+*ABAC_GENERATE_INVALID_CN = *ABACc::ABAC_GENERATE_INVALID_CN;
+*ABAC_GENERATE_INVALID_VALIDITY = *ABACc::ABAC_GENERATE_INVALID_VALIDITY;
+*ABAC_ATTRIBUTE_ISSUER_NOKEY = *ABACc::ABAC_ATTRIBUTE_ISSUER_NOKEY;
+*ABAC_ATTRIBUTE_INVALID_ROLE = *ABACc::ABAC_ATTRIBUTE_INVALID_ROLE;
+*ABAC_ATTRIBUTE_INVALID_VALIDITY = *ABACc::ABAC_ATTRIBUTE_INVALID_VALIDITY;
+*ABAC_ATTRIBUTE_INVALID_ISSUER = *ABACc::ABAC_ATTRIBUTE_INVALID_ISSUER;
+1;
