+/**
+ * Handle lookup error
+ *
+ * @param cls the request handle
+ */
+static void
+ns_lookup_error_cb (void *cls)
+{
+ struct RequestHandle *handle = cls;
+
+ handle->emsg = GNUNET_strdup (GNUNET_REST_NAMESTORE_FAILED);
+ GNUNET_SCHEDULER_add_now (&do_error, handle);
+}
+
+
+static void
+ns_get_lookup_cb (void *cls,
+ const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone,
+ const char *label,
+ unsigned int rd_len,
+ const struct GNUNET_GNSRECORD_Data *rd)
+{
+ struct RequestHandle *handle = cls;
+ struct GNUNET_GNSRECORD_Data rd_filtered[rd_len];
+ json_t *record_obj;
+ int i = 0;
+ int j = 0;
+
+ handle->ns_qe = NULL;
+ if (NULL == handle->resp_object)
+ handle->resp_object = json_array ();
+ for (i = 0; i < rd_len; i++)
+ {
+ if ((GNUNET_GNSRECORD_TYPE_ANY != handle->record_type) &&
+ (rd[i].record_type != handle->record_type))
+ continue; /* Apply filter */
+ rd_filtered[j] = rd[i];
+ rd_filtered[j].data = rd[i].data;
+ j++;
+ }
+ /** Only add if not empty **/
+ if (j > 0)
+ {
+ record_obj = GNUNET_JSON_from_gnsrecord (label,
+ rd_filtered,
+ j);
+ json_array_append_new (handle->resp_object, record_obj);
+ }
+ GNUNET_SCHEDULER_add_now (&namestore_list_finished, handle);
+}
+
+
+