use JSON instead of DDF marshalling
[mech_eap.git] / util_attr.h
index 6af4cf3..1a427f7 100644 (file)
@@ -41,6 +41,8 @@
 #include <string>
 #include <new>
 
+#include <jansson.h>
+
 struct gss_eap_attr_provider;
 struct gss_eap_attr_ctx;
 
@@ -121,26 +123,36 @@ public:
     {
         return NULL;
     }
+
     virtual void releaseAnyNameMapping(gss_buffer_t type_id GSSEAP_UNUSED,
                                        gss_any_t input GSSEAP_UNUSED) const
     {
     }
 
+    /* prefix to be prepended to attributes emitted by gss_get_name_attribute */
     virtual const char *prefix(void) const
     {
         return NULL;
     }
 
-    virtual void exportToBuffer(gss_buffer_t buffer GSSEAP_UNUSED) const
+    /* optional key for storing JSON dictionary */
+    virtual const char *name(void) const
     {
+        return NULL;
     }
 
-    virtual bool initFromBuffer(const gss_eap_attr_ctx *manager,
-                                const gss_buffer_t buffer GSSEAP_UNUSED)
+    virtual bool initWithJsonObject(const gss_eap_attr_ctx *manager,
+                                    json_t *object GSSEAP_UNUSED)
     {
         return initWithManager(manager);
     }
 
+
+    virtual json_t *jsonRepresentation(void) const
+    {
+        return NULL;
+    }
+
     virtual time_t getExpiryTime(void) const { return 0; }
 
     virtual OM_uint32 mapException(OM_uint32 *minor GSSEAP_UNUSED,
@@ -242,6 +254,9 @@ private:
     unsigned int attributePrefixToType(const gss_buffer_t prefix) const;
     gss_buffer_desc attributeTypeToPrefix(unsigned int type) const;
 
+    bool initWithJsonObject(json_t *object);
+    json_t *jsonRepresentation(void) const;
+
     gss_eap_attr_provider *getPrimaryProvider(void) const;
 
     /* make non-copyable */