Index: doc/API
===================================================================
--- doc/API	(revision 9f73492ca3312bf4772e393741666037f3f44b68)
+++ doc/API	(revision 7f04233d4b7bc622252e9bff1d247e2203b4ad36)
@@ -8,4 +8,12 @@
      -unsigned char *data
      -int len
+
+ABAC::dump_yap_db()
+   Dump the complete yap prolog database
+   (C:show_yap_db)
+
+ABAC::dump_debug_info()
+   Dump debug info on whole session
+   (C:show_debug_info)
 
 ABAC::Constraint
@@ -22,7 +30,9 @@
    Constraint(const Constraint &)
      copy constructor, used for cloning a constraint
+     (C:abac_condition_dup)
 
    ~Constraint()
      default destructor
+     (C:abac_condition_free)
 
    Constraint(Role &)
@@ -124,4 +134,5 @@
      "principal"
      "anonymous"
+     "this"
 
    DataTerm()
@@ -130,23 +141,27 @@
    DataTerm(const DataTerm &)
      copy constructor, used for cloning a data term
+     (C:abac_term_dup)
 
    ~DataTerm()
      default destructor
+     (C:abac_term_free)
 
    DataTerm(char*)
      constructor to make named principal data term for the oset RHS 
-     (C: abac_term_named_create)
+     if "this" is supplied, a term with tyep=e_TERM_THIS is created
+     if "anonymous" is supplied, a term with type=e_TERM_ANONYMOUS is created
+     (C:abac_term_named_create)
 
    DataTerm(const ID&)
      constructor to make named principal data term for parameter term
-     (C: abac_term_id_create)
+     (C:abac_term_id_create)
 
    DataTerm(char*, char*, Constraint*)
      constructor for making a variable data term 
-     (C: abac_term_create)
+     (C:abac_term_create)
 
    DataTerm(char*, char*)
      constructor for making an instantiated data term
-     (C: abac_term_create)
+     (C:abac_term_create)
 
    char *string() const
@@ -188,7 +203,9 @@
    Role(const Role &)
      copy constructor, used for cloning a role
+     (C:abac_aspect_dup)
 
    ~Role()
      default destructor
+     (C:abac_aspect_free)
 
    Role(char*) 
@@ -257,4 +274,5 @@
      return the data terms bound to this role's linking role.
      (C:abac_role_get_linked_data_terms)
+     (C::abac_terms_free)
 
 ABAC::Oset
@@ -266,15 +284,17 @@
    Oset(const Oset &)
      copy constructor, used for cloning an oset
+     (C:abac_aspect_dup)
 
    ~Oset()
      default destructor
+     (C:abac_aspect_free)
 
    Oset(char *)
      constructor that makes a principal oset, ie [keyid:B]
-     (C:abac_role_principal_create)
+     (C:abac_oset_principal_create)
 
    Oset(char *, char *)
      constructor that makes a regular oset, ie. [keyid:B].oset:o
-     (C:abac_role_create)
+     (C:abac_oset_create)
 
    Oset(char *, char*, char *)
@@ -338,4 +358,5 @@
      returns the data terms bound to this oset.  
      (C:abac_oset_get_data_terms)
+     (C::abac_terms_free)
 
    void oset_add_linked_data_term(DataTerm&)
@@ -346,4 +367,5 @@
      returns the data terms bound to this oset's linking role.  
      (C:abac_oset_get_linked_data_terms)
+     (C::abac_terms_free)
 
 ABAC::ID
@@ -357,7 +379,9 @@
    ID(const ID &)
      copy constructor, used for cloning an ID
+     (C:abac_id_dup)
 
    ~ID()
      default destructor
+     (C:abac_id_free)
 
    ID(char *)
@@ -383,4 +407,5 @@
      - CN must be alphanumeric and begin with a letter
      - validity must be at least one second
+     - optional passphrase is when the keyfile is encrypted
      will throw an exception if either of the above is violated 
      (C:abac_id_generate_with_key)
@@ -458,7 +483,9 @@
    Attribute(const Attribute &)
      copy constructor, used for cloning an attribute
+     (C:abac_attribute_dup)
 
    ~Attribute()
      default destructor
+     (C:abac_attribute_free)
 
    Attribute(Role&, int)
@@ -493,4 +520,10 @@
      (C:abac_attribute_add_tail)
 
+   void attribute_set_using_this()
+      Allow user set whether this attribute has '?This' in its
+      attribute rule
+     (C:abac_attribute_set_using_this)
+/***
+
    char *head_string()
      returns literal string of head of the attribute
@@ -519,15 +552,21 @@
    const Role &role_head()
      returns the head role
+     (C:abac_attribute_head)
 
    const Oset &oset_head()
      returns the oset head
+     (C:abac_attribute_head)
 
    std::vector<Role> role_tails(bool &)
      retrieve tail role which maybe more than 1 if intersecting
      (C:abac_attribute_role_tails)
+     (C::abac_attribute_is_role)
+     (C::abac_aspects_free)
 
    std::vector<Oset> oset_tails(bool &)
      retrieve tail oset which maybe more than 1 if intersecting
      (C:abac_attribute_oset_tails)
+     (C::abac_attribute_is_role)
+     (C::abac_aspects_free)
 
    bool attribute_bake()
@@ -563,18 +602,13 @@
    Context()
      default constructor
+     (C:abac_context_new)
 
    Context(const Context &)
      copy constructor, used for cloning the context
+     (C:abac_context_dup)
 
    ~Context()
      default destructor
-
-   void free_context_now()
-     Explicitly freeing the the context. This is to prevent libstrongswan's 
-     mainthread from GC'ed by Java. Used with Java/Swig/JNI combination only. 
-
-   void dump_yap_db()
-     dump the complete yap prolog database
-     (C:show_yap_db)
+     (C:abac_context_free)
 
    int load_id(ABAC::ID&)
@@ -585,5 +619,5 @@
      load id cert from an idkey combo file. key retrieval will be attempted
      but won't fail if not found
-     (C:abac_context_load_id_file)
+     (C:abac_context_load_id_idkey_file)
 
    int load_id_encrypted_file(char *, char *)
@@ -661,9 +695,12 @@
      in non ABAC_CN mode  
      (C:abac_context_query)
+     (C::abac_free_credentials)
 
    std::vector<Attribute> query(Role &, Role &, bool &)
      (C:abac_context_query_with_structure)
+     (C::abac_free_credentials)
    std::vector<Attribute> query(Oset &, Oset &, bool &)
      (C:abac_context_query_with_structure)
+     (C::abac_free_credentials)
      runs the query:
        role <-?- principal
@@ -675,4 +712,5 @@
    std::vector<Attribute> next_proof(bool &)
      (C:abac_context_query_again)
+     (C::abac_free_credentials)
      force backtrack and try to get next solution proof:
      returns true/false in success
@@ -683,4 +721,9 @@
      extracted from the internal data structure
      (C:abac_context_credentials)
+     (C::abac_free_credentials)
+
+   int credential_count()
+     returns the number of credentials loaded in the context currently
+     (C:abac_context_credential_count()
 
    std::vector<Attribute> context_principals(bool &)
@@ -688,7 +731,13 @@
      extracted from the internal data structure
      (C:abac_context_principals)
+     (C::abac_free_principals)
+
+   int principal_count()
+     returns the number of principals loaded in the context currently
+     (C:abac_context_principal_count()
 
    ID lookup_principal(char *)
      find a particular principal from the context
+     (C:abac_context_principal_lookup)
 
    char *version()
@@ -708,10 +757,10 @@
     or 
     C++:    ctxt.load_attribute_file("test_attr.der")
-    C:      abac_context_load_attribute_file(ctx, "test_attr.der")
+    C:      abac_context_load_attribute_file(ctxt, "test_attr.der")
 
 Instead of copy constructors, the C API uses _dup.  Therefore,
 to copy a role use abac_aspect_dup(m_role), 
 to copy a oset use abac_aspect_dup(m_oset),
-to copy a context use abac_context_dup(m_ctx),
+to copy a context use abac_context_dup(m_ctxt),
 to copy a constraint use abac_condition_dup(m_constraint),
 to copy a data term use abac_term_dup(m_term),
@@ -725,5 +774,5 @@
 
 When you are done with them, you must free the whole array at once using
-abac_context_credentials_free() and abac_context_principals_free() respectively.
+abac_free_credentials() and abac_free_principals() respectively.
 
 PERL, PYTHON AND JAVA API
@@ -737,5 +786,5 @@
         - String instead of char * 
         - Context::query returns a vector of Credentials:
-            credentials = ctx.query(role, principal)
+            credentials = ctxt.query(role, principal)
             success if credentials' size is > 0
 
@@ -744,5 +793,5 @@
         - string instead of chunk_t
         - Context::query returns a list of two elements:
-            my ($success, $credentials) = $ctx->query($role, $principal)
+            my ($success, $credentials) = $ctxt->query($role, $principal)
             $success is a boolean
             $credentials is an arrayref of Credential objects
@@ -753,5 +802,5 @@
         - string instead of chunk_t (< 2.6)
         - Context::query returns a tuple with two elements:
-            (success, credentials) = ctx.query(role, principal)
+            (success, credentials) = ctxt.query(role, principal)
             success is a boolean
             credentials is a tuple of Credential objects
Index: doc/ChangeLog
===================================================================
--- doc/ChangeLog	(revision 9f73492ca3312bf4772e393741666037f3f44b68)
+++ doc/ChangeLog	(revision 7f04233d4b7bc622252e9bff1d247e2203b4ad36)
@@ -1,2 +1,36 @@
+= 0.2.4 =
+
+    2013-0Y-0Y
+        * Included compress/decompress from libZ to make 
+          abac_encode_string() and abac_decode_string() more space 
+          conscious
+        * Expanded '?This' from just principal type to any other valid
+          type when accepting RT2 syntax
+        * Added a new attribute_now option to creddy that will take
+          a whole typed attribute policy input string and generate 
+          a credential
+        * Changed m64 encoding/decoding to use libstrongswan chunk
+          utility
+          (libstrongswan's IETF_GROUP_ATTR is size limited)
+        * Allow role/oset constraining condition to be linked role
+          or linked oset
+        * Supplemented query processing to work with YAP 6.3 series.
+          There was a change in YAP's result format.
+        * Modularized parts of libabac to plan for enabling 
+          threading (more to come)
+        * Added regression test suites for multiple contexts
+          (python_tests/Y_ctxt_Y)
+        * Added support for multiple contexts within a session and
+          enabled context duplication
+
+    (branch mei_rt2_fix_1)
+        * Moved insertion of ID credentials to ID constructors. This
+          code is going to change in multi-context version because 
+          some sanity checks got voided by this change (Jeff)  
+        * Updated ax_check_jni.m4, configure.ac and creddy.c for Mac
+          (supplied by Victor)
+        * Took out /usr/local/lib dependency from java regression tests
+          example/example_scripts/java, swig/java (Anddrew)
+
 = 0.2.3 =
 
Index: doc/INSTALL
===================================================================
--- doc/INSTALL	(revision 9f73492ca3312bf4772e393741666037f3f44b68)
+++ doc/INSTALL	(revision 7f04233d4b7bc622252e9bff1d247e2203b4ad36)
@@ -17,4 +17,5 @@
    $make library
    $sudo make install_library
+   $sudo make install
 
    (Note: If you ever run into the OOOPS message when installing Yap, 
@@ -39,4 +40,10 @@
        --with-ipseclibdir and --with-plugindir are set otherwise.
 
+   Mac OS X users: (Victor) add
+       --enable-kernel-pfkey --enable-kernel-pfroute 
+       --disable-kernel-netlink --disable-tools --disable-scripts                            --disable-pluto --with-group=wheel
+       and also prepend with following if applicable,
+       env CPPFLAGS="-I/opt/local/include" LDFLAGS="-L/opt/local/lib" 
+
    $tar xjvf strongswan-4.6.4.tar.bz2
    $cd strongswan-4.6.4
@@ -49,13 +56,21 @@
    strongswan-4.6.4.tar.bz2. You will use this in the next step.
 
+
 BUILDING LIBABAC
 
    FreeBSD users will need to install flex-2.5.35 or greater from 
-   ports and add 
-   --with-flex=/usr/local/bin/flex --with-extra-includes=/usr/local/include
-   on ./configure line in addition to --with-strongswan=...
+       ports and add 
+       --with-extra-includes=/usr/local/include
+       --with-flex=/usr/local/bin/flex, adjust as needed 
+       on ./configure line in addition to --with-strongswan=...
+
+   MAC OS X (victor) users needs to add these flags
+       CFLAGS="-I/opt/local/include" CXXFLAGS="-I/opt/local/include"
+       CPPFLAGS="-I/opt/local/include" LDFLAGS="-L/opt/local/lib" 
+       and --with-flex=/usr/bin/flex, adjust as needed 
 
    $STRONGSWAN_SRC_DIR=path/to/strongswan-4.6.4
    $STRONGSWAN_LIB_DIR=/usr/local/lib/ipsec
+   $./autogen.sh
    $./configure --with-strongswan=$STRONGSWAN_SRC_DIR 
                  --with-strongswan-ld-path=$STRONSWAN_LIB_DIR
Index: doc/dependencies
===================================================================
--- doc/dependencies	(revision 9f73492ca3312bf4772e393741666037f3f44b68)
+++ doc/dependencies	(revision 7f04233d4b7bc622252e9bff1d247e2203b4ad36)
@@ -85,2 +85,21 @@
 swig
 automake
+
+
+BUILDING ON MAC OS X 
+
+(Thanks to Victor J. Orlikowski <vjo@duke.edu>)
+The following is a list of pkgs necessary to build from MacPorts
+vstr
+swig
+swig-python
+swig-perl
+swig-java
+bison
+flex
+readline
+
+**It appears that vstr on MAC is rather troublesome, if anyone
+is successful in running on MAC OS X, please let us know.
+
+
Index: doc/design
===================================================================
--- doc/design	(revision 9f73492ca3312bf4772e393741666037f3f44b68)
+++ doc/design	(revision 7f04233d4b7bc622252e9bff1d247e2203b4ad36)
@@ -209,5 +209,5 @@
 In our notation:
 
-[keyid:A].oset:r <- ["urn:file://P"]
+[keyid:A].oset:r <- [urn:"file://P"]
 
 Similarly derivation rules like:
Index: doc/extract_doc.c
===================================================================
--- doc/extract_doc.c	(revision 9f73492ca3312bf4772e393741666037f3f44b68)
+++ doc/extract_doc.c	(revision 7f04233d4b7bc622252e9bff1d247e2203b4ad36)
@@ -4,7 +4,17 @@
    extract_doc.c,
 
-   This program extract API doc file from libabac/abac.hh
-   This program assume abac.hh is local or linked locally
+   This program extracts API doc from libabac/abac.hh and
+   generates header file ABAC_HH
+   This program assumes abac.hh is local or linked locally
   
+rules:
+1) Enclosed lines within slashes with triple stars(/***,***SLASH/) need 
+to be extracted
+2) line start with 'f', add a new line
+3) Enclosed lines with tripple stars and 2 i's (/*ii**. **ii*SLASH/)
+are internal functions, no need to put in API file
+   
+   cc extract_doc.c
+
 ***/
 #include <stdio.h>
@@ -139,10 +149,10 @@
     or 
     C++:    ctxt.load_attribute_file("test_attr.der")
-    C:      abac_context_load_attribute_file(ctx, "test_attr.der")
+    C:      abac_context_load_attribute_file(ctxt, "test_attr.der")
 
 Instead of copy constructors, the C API uses _dup.  Therefore,
 to copy a role use abac_aspect_dup(m_role), 
 to copy a oset use abac_aspect_dup(m_oset),
-to copy a context use abac_context_dup(m_ctx),
+to copy a context use abac_context_dup(m_ctxt),
 to copy a constraint use abac_condition_dup(m_constraint),
 to copy a data term use abac_term_dup(m_term),
@@ -156,5 +166,5 @@
 
 When you are done with them, you must free the whole array at once using
-abac_context_credentials_free() and abac_context_principals_free() respectively.
+abac_free_credentials() and abac_free_principals() respectively.
 
 PERL, PYTHON AND JAVA API
@@ -168,5 +178,5 @@
         - String instead of char * 
         - Context::query returns a vector of Credentials:
-            credentials = ctx.query(role, principal)
+            credentials = ctxt.query(role, principal)
             success if credentials' size is > 0
 
@@ -175,5 +185,5 @@
         - string instead of chunk_t
         - Context::query returns a list of two elements:
-            my ($success, $credentials) = $ctx->query($role, $principal)
+            my ($success, $credentials) = $ctxt->query($role, $principal)
             $success is a boolean
             $credentials is an arrayref of Credential objects
@@ -184,5 +194,5 @@
         - string instead of chunk_t (< 2.6)
         - Context::query returns a tuple with two elements:
-            (success, credentials) = ctx.query(role, principal)
+            (success, credentials) = ctxt.query(role, principal)
             success is a boolean
             credentials is a tuple of Credential objects
Index: doc/yap6_2_2_patch_1
===================================================================
--- doc/yap6_2_2_patch_1	(revision 9f73492ca3312bf4772e393741666037f3f44b68)
+++ doc/yap6_2_2_patch_1	(revision 7f04233d4b7bc622252e9bff1d247e2203b4ad36)
@@ -10,4 +10,12 @@
 @@ -1100,0 +1101 @@ dnl Linux has both elf and a.out, in thi
 +        YAPLIB_LD=$SHLIB_LD
+diff -Naur -p0 yap-6.2.2/include/YapInterface.h nyap-6.2.2/include/YapInterface.h
+--- yap-6.2.2/include/YapInterface.h	2010-12-04 16:04:48.000000000 -0800
++++ nyap-6.2.2/include/YapInterface.h	2013-01-19 09:14:35.134626453 -0800
+@@ -300,2 +300,2 @@ extern X_API void PROTO(YAP_Write,(YAP_T
+-/*  void YAP_WriteBufffer(YAP_Term,char *,unsgined int,int) */
+-extern X_API void PROTO(YAP_WriteBuffer,(YAP_Term,char *,unsigned int,int));
++/*  YAP_Term YAP_WriteBufffer(YAP_Term,char *,unsgined int,int) */
++extern X_API YAP_Term PROTO(YAP_WriteBuffer,(YAP_Term,char *,unsigned int,int));
 diff -Naur -p0 yap-6.2.2/library/dialect/swi/fli/blobs.c nyap-6.2.2/library/dialect/swi/fli/blobs.c
 --- yap-6.2.2/library/dialect/swi/fli/blobs.c	2010-12-02 03:47:28.000000000 -0800
