[prelude-cvslog] r10203 - libprelude/branches/libprelude-easy-bindings/bindings

noreply at prelude-ids.org noreply at prelude-ids.org
Fri Feb 15 10:07:00 CET 2008


Author: yoann
Date: 2008-02-15 10:06:59 +0100 (Fri, 15 Feb 2008)
New Revision: 10203

Modified:
   libprelude/branches/libprelude-easy-bindings/bindings/libprelude-easy.i
Log:
Handle Get() for value of type data.


Modified: libprelude/branches/libprelude-easy-bindings/bindings/libprelude-easy.i
===================================================================
--- libprelude/branches/libprelude-easy-bindings/bindings/libprelude-easy.i	2008-02-15 09:06:52 UTC (rev 10202)
+++ libprelude/branches/libprelude-easy-bindings/bindings/libprelude-easy.i	2008-02-15 09:06:59 UTC (rev 10203)
@@ -107,6 +107,24 @@
                 $result = SWIG_NewPointerObj(time, SWIGTYPE_p_IDMEFTime, 0);
         }
 
+        else if ( type == IDMEF_VALUE_TYPE_DATA ) {
+                idmef_data_t *d = idmef_value_get_data(value);
+                idmef_data_type_t t = idmef_data_get_type(d);
+
+                if ( t == IDMEF_DATA_TYPE_CHAR || t == IDMEF_DATA_TYPE_CHAR_STRING ||
+                     t == IDMEF_DATA_TYPE_BYTE || t == IDMEF_DATA_TYPE_BYTE_STRING )
+                        $result = SWIG_FromCharPtrAndSize((const char *)idmef_data_get_data(d), idmef_data_get_len(d));
+
+                else if ( t == IDMEF_DATA_TYPE_FLOAT )
+                        $result = SWIG_From_float(idmef_data_get_float(d));
+
+                else if ( t == IDMEF_DATA_TYPE_UINT32 )
+                        $result = SWIG_From_unsigned_SS_int(idmef_data_get_uint32(d));
+
+                else if ( t == IDMEF_DATA_TYPE_UINT64 )
+                        $result = SWIG_From_unsigned_SS_long_SS_long(idmef_data_get_uint64(d));
+        }
+
         else {
                 std::stringstream s;
                 s << "Typemap does not handle value type " << type;
@@ -118,15 +136,6 @@
 #if defined(SWIGPERL)
        argvi++;
 #endif
-
-#if 0
-        else if ( result->GetType() == IDMEF_VALUE_TYPE_CLASS )
-                $result = SWIG_NewPointerObj(idmef_value_get_object($1->GetValue()), , 0);
-
-        else if ( result->GetType() == IDMEF_VALUE_TYPE_LIST ||
-                  result->GetType() == IDMEF_VALUE_TYPE_DATA )
-                  printf("FIXME\n");
-#endif
 };
 
 %newobject ClientProfile::GetConfigFilename;




More information about the Prelude-cvslog mailing list