in progress use DDF to serialise names
[moonshot.git] / mech_eap / util_shib.cpp
index 4da9a31..a53a476 100644 (file)
@@ -385,61 +385,44 @@ gss_eap_shib_attr_provider::releaseAnyNameMapping(gss_buffer_t type_id GSSEAP_UN
 }
 
 const char *
+<<<<<<< HEAD
 gss_eap_shib_attr_provider::prefix(void) const
 {
     return NULL;
+=======
+gss_eap_shib_attr_provider::marshallingKey(void) const
+{
+    return "local";
+>>>>>>> eef7b3b... get DDF marshalling working
 }
 
-void
-gss_eap_shib_attr_provider::exportToBuffer(gss_buffer_t buffer) const
+DDF
+gss_eap_shib_attr_provider::marshall(void) const
 {
     DDF obj(NULL);
-    DDF attrs(NULL);
-
-    buffer->length = 0;
-    buffer->value = NULL;
 
-    obj.addmember("version").integer(1);
     obj.addmember("authenticated").integer(m_authenticated);
 
-    attrs = obj.addmember("attributes").list();
+    DDF attrs = obj.addmember("attributes").list();
     for (vector<Attribute*>::const_iterator a = m_attributes.begin();
          a != m_attributes.end(); ++a) {
         DDF attr = (*a)->marshall();
         attrs.add(attr);
     }
 
-    ostringstream sink;
-    sink << obj;
-    string str = sink.str();
-
-    duplicateBuffer(str, buffer);
-
-    attrs.destroy();
+    return obj;
 }
 
 bool
-gss_eap_shib_attr_provider::initFromBuffer(const gss_eap_attr_ctx *ctx,
-                                           const gss_buffer_t buffer)
+gss_eap_shib_attr_provider::unmarshallAndInit(const gss_eap_attr_ctx *ctx,
+                                              DDF &obj)
 {
-    if (!gss_eap_attr_provider::initFromBuffer(ctx, buffer))
+    if (!gss_eap_attr_provider::unmarshallAndInit(ctx, obj))
         return false;
 
-    if (buffer->length == 0)
-        return true;
-
     assert(m_authenticated == false);
     assert(m_attributes.size() == 0);
 
-    DDF obj(NULL);
-    string str((const char *)buffer->value, buffer->length);
-    istringstream source(str);
-
-    source >> obj;
-
-    if (obj["version"].integer() != 1)
-        return false;
-
     m_authenticated = (obj["authenticated"].integer() != 0);
 
     DDF attrs = obj["attributes"];
@@ -450,8 +433,6 @@ gss_eap_shib_attr_provider::initFromBuffer(const gss_eap_attr_ctx *ctx,
         attr = attrs.next();
     }
 
-    attrs.destroy();
-
     return true;
 }