[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnunet] branch master updated: - more dep fixes
From: |
gnunet |
Subject: |
[gnunet] branch master updated: - more dep fixes |
Date: |
Thu, 15 Oct 2020 15:56:38 +0200 |
This is an automated email from the git hooks/post-receive script.
martin-schanzenbach pushed a commit to branch master
in repository gnunet.
The following commit(s) were added to refs/heads/master by this push:
new cd1c45b00 - more dep fixes
cd1c45b00 is described below
commit cd1c45b00ae4ba98ad3b365c2db67d82bdc0843d
Author: Martin Schanzenbach <mschanzenbach@posteo.de>
AuthorDate: Thu Oct 15 15:49:38 2020 +0200
- more dep fixes
---
po/POTFILES.in | 2 +-
src/gns/Makefile.am | 1 +
src/gns/plugin_rest_gns.c | 3 +-
src/gnsrecord/Makefile.am | 14 +++-
src/{json => gnsrecord}/json_gnsrecord.c | 114 ++++++++++++++++++++++++++++++-
src/include/gnunet_json_lib.h | 25 -------
src/json/Makefile.am | 7 +-
src/json/json_generator.c | 108 -----------------------------
src/namestore/Makefile.am | 1 +
src/namestore/plugin_rest_namestore.c | 16 ++---
10 files changed, 141 insertions(+), 150 deletions(-)
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 5c379eed8..6aab56d14 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -185,6 +185,7 @@ src/gnsrecord/gnsrecord_crypto.c
src/gnsrecord/gnsrecord_misc.c
src/gnsrecord/gnsrecord_serialization.c
src/gnsrecord/gnunet-gnsrecord-tvg.c
+src/gnsrecord/json_gnsrecord.c
src/gnsrecord/plugin_gnsrecord_dns.c
src/hello/address.c
src/hello/gnunet-hello.c
@@ -201,7 +202,6 @@ src/identity/identity_api_suffix_lookup.c
src/identity/plugin_rest_identity.c
src/json/json.c
src/json/json_generator.c
-src/json/json_gnsrecord.c
src/json/json_helper.c
src/json/json_mhd.c
src/my/my.c
diff --git a/src/gns/Makefile.am b/src/gns/Makefile.am
index 5a9c70997..47941b8ef 100644
--- a/src/gns/Makefile.am
+++ b/src/gns/Makefile.am
@@ -109,6 +109,7 @@ libgnunet_plugin_rest_gns_la_SOURCES = \
plugin_rest_gns.c
libgnunet_plugin_rest_gns_la_LIBADD = \
$(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
+ $(top_builddir)/src/gnsrecord/libgnunetgnsrecordjson.la \
libgnunetgns.la \
$(top_builddir)/src/rest/libgnunetrest.la \
$(top_builddir)/src/identity/libgnunetidentity.la \
diff --git a/src/gns/plugin_rest_gns.c b/src/gns/plugin_rest_gns.c
index 6ec921f70..2ccb5be2b 100644
--- a/src/gns/plugin_rest_gns.c
+++ b/src/gns/plugin_rest_gns.c
@@ -28,6 +28,7 @@
#include "gnunet_rest_lib.h"
#include "gnunet_json_lib.h"
#include "gnunet_gnsrecord_lib.h"
+#include "gnunet_gnsrecord_json_lib.h"
#include "gnunet_gns_service.h"
#include "microhttpd.h"
#include <jansson.h>
@@ -264,7 +265,7 @@ handle_gns_response (void *cls,
return;
}
- result_obj = GNUNET_JSON_from_gnsrecord (handle->name, rd, rd_count);
+ result_obj = GNUNET_GNSRECORD_JSON_from_gnsrecord (handle->name, rd,
rd_count);
result = json_dumps (result_obj, 0);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Result %s\n", result);
diff --git a/src/gnsrecord/Makefile.am b/src/gnsrecord/Makefile.am
index 02a50973b..36be13c8d 100644
--- a/src/gnsrecord/Makefile.am
+++ b/src/gnsrecord/Makefile.am
@@ -30,7 +30,8 @@ TESTS = \
endif
lib_LTLIBRARIES = \
- libgnunetgnsrecord.la
+ libgnunetgnsrecord.la \
+ libgnunetgnsrecordjson.la
gnunet_gnsrecord_tvg_SOURCES = \
gnunet-gnsrecord-tvg.c
@@ -56,6 +57,17 @@ libgnunetgnsrecord_la_LDFLAGS = \
$(GN_LIB_LDFLAGS) \
-version-info 0:0:0
+libgnunetgnsrecordjson_la_SOURCES = \
+ json_gnsrecord.c
+libgnunetgnsrecordjson_la_LIBADD = \
+ $(top_builddir)/src/util/libgnunetutil.la \
+ $(top_builddir)/src/identity/libgnunetidentity.la \
+ libgnunetgnsrecord.la \
+ -ljansson \
+ $(GN_LIBINTL)
+libgnunetgnsrecordjson_la_LDFLAGS = \
+ $(GN_LIB_LDFLAGS) \
+ -version-info 0:0:0
plugin_LTLIBRARIES = \
libgnunet_plugin_gnsrecord_dns.la
diff --git a/src/json/json_gnsrecord.c b/src/gnsrecord/json_gnsrecord.c
similarity index 72%
rename from src/json/json_gnsrecord.c
rename to src/gnsrecord/json_gnsrecord.c
index 7e11aba94..068ff48c1 100644
--- a/src/json/json_gnsrecord.c
+++ b/src/gnsrecord/json_gnsrecord.c
@@ -26,6 +26,7 @@
#include "platform.h"
#include "gnunet_util_lib.h"
#include "gnunet_json_lib.h"
+#include "gnunet_gnsrecord_lib.h"
#define GNUNET_JSON_GNSRECORD_VALUE "value"
#define GNUNET_JSON_GNSRECORD_RECORD_DATA "data"
@@ -258,7 +259,7 @@ clean_gnsrecordobject (void *cls, struct
GNUNET_JSON_Specification *spec)
* @return JSON Specification
*/
struct GNUNET_JSON_Specification
-GNUNET_JSON_spec_gnsrecord (struct GNUNET_GNSRECORD_Data **rd,
+GNUNET_GNSRECORD_JSON_spec_gnsrecord (struct GNUNET_GNSRECORD_Data **rd,
unsigned int *rd_count,
char **name)
{
@@ -277,3 +278,114 @@ GNUNET_JSON_spec_gnsrecord (struct GNUNET_GNSRECORD_Data
**rd,
.size_ptr = NULL };
return ret;
}
+
+
+/**
+ * Convert GNS record to JSON.
+ *
+ * @param rname name of record
+ * @param rd record data
+ * @return corresponding JSON encoding
+ */
+json_t *
+GNUNET_GNSRECORD_JSON_from_gnsrecord (const char*rname,
+ const struct GNUNET_GNSRECORD_Data *rd,
+ unsigned int rd_count)
+{
+ struct GNUNET_TIME_Absolute abs_exp;
+ struct GNUNET_TIME_Relative rel_exp;
+ const char *expiration_time_str;
+ const char *record_type_str;
+ char *value_str;
+ json_t *data;
+ json_t *record;
+ json_t *records;
+
+ data = json_object ();
+ if (NULL == data)
+ {
+ GNUNET_break (0);
+ return NULL;
+ }
+ if (0 !=
+ json_object_set_new (data,
+ "record_name",
+ json_string (rname)))
+ {
+ GNUNET_break (0);
+ json_decref (data);
+ return NULL;
+ }
+ records = json_array ();
+ if (NULL == records)
+ {
+ GNUNET_break (0);
+ json_decref (data);
+ return NULL;
+ }
+ for (int i = 0; i < rd_count; i++)
+ {
+ value_str = GNUNET_GNSRECORD_value_to_string (rd[i].record_type,
+ rd[i].data,
+ rd[i].data_size);
+ if (GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION & rd[i].flags)
+ {
+ rel_exp.rel_value_us = rd[i].expiration_time;
+ expiration_time_str = GNUNET_STRINGS_relative_time_to_string (rel_exp,
+ GNUNET_NO);
+ }
+ else
+ {
+ abs_exp.abs_value_us = rd[i].expiration_time;
+ expiration_time_str = GNUNET_STRINGS_absolute_time_to_string (abs_exp);
+ }
+ record_type_str = GNUNET_GNSRECORD_number_to_typename (rd[i].record_type);
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Packing %s %s %s %d\n",
+ value_str, record_type_str, expiration_time_str, rd[i].flags);
+ record = json_pack ("{s:s,s:s,s:s,s:b,s:b,s:b,s:b}",
+ "value",
+ value_str,
+ "record_type",
+ record_type_str,
+ "expiration_time",
+ expiration_time_str,
+ "private",
+ rd[i].flags & GNUNET_GNSRECORD_RF_PRIVATE,
+ "relative_expiration",
+ rd[i].flags & GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION,
+ "supplemental",
+ rd[i].flags & GNUNET_GNSRECORD_RF_SUPPLEMENTAL,
+ "shadow",
+ rd[i].flags & GNUNET_GNSRECORD_RF_SHADOW_RECORD);
+ GNUNET_free (value_str);
+ if (NULL == record)
+ {
+ GNUNET_break (0);
+ json_decref (records);
+ json_decref (data);
+ return NULL;
+ }
+ if (0 !=
+ json_array_append_new (records,
+ record))
+ {
+ GNUNET_break (0);
+ json_decref (records);
+ json_decref (data);
+ return NULL;
+ }
+ }
+ if (0 !=
+ json_object_set_new (data,
+ "data",
+ records))
+ {
+ GNUNET_break (0);
+ json_decref (data);
+ return NULL;
+ }
+ return data;
+}
+
+
diff --git a/src/include/gnunet_json_lib.h b/src/include/gnunet_json_lib.h
index 07a14d329..92597d3dd 100644
--- a/src/include/gnunet_json_lib.h
+++ b/src/include/gnunet_json_lib.h
@@ -28,7 +28,6 @@
#define GNUNET_JSON_LIB_H
#include "gnunet_util_lib.h"
-#include "gnunet_gnsrecord_lib.h"
#include <jansson.h>
#include <microhttpd.h>
@@ -359,18 +358,6 @@ GNUNET_JSON_spec_rsa_signature (const char *name,
struct GNUNET_CRYPTO_RsaSignature **sig);
-/**
- * JSON Specification for GNS Records.
- *
- * @param gnsrecord_object struct of GNUNET_GNSRECORD_Data to fill
- * @return JSON Specification
- */
-struct GNUNET_JSON_Specification
-GNUNET_JSON_spec_gnsrecord (struct GNUNET_GNSRECORD_Data **rd,
- unsigned int *rd_count,
- char **name);
-
-
/* ****************** Generic generator interface ******************* */
@@ -446,18 +433,6 @@ GNUNET_JSON_from_rsa_public_key (const struct
GNUNET_CRYPTO_RsaPublicKey *pk);
json_t *
GNUNET_JSON_from_rsa_signature (const struct GNUNET_CRYPTO_RsaSignature *sig);
-/**
- * Convert Gns record to JSON.
- *
- * @param rname name of record
- * @param rd record data
- * @return corresponding JSON encoding
- */
-json_t *
-GNUNET_JSON_from_gnsrecord (const char *rname,
- const struct GNUNET_GNSRECORD_Data *rd,
- unsigned int rd_count);
-
/* ******************* Helpers for MHD upload handling ******************* */
/**
diff --git a/src/json/Makefile.am b/src/json/Makefile.am
index 2ed05c35a..d4ea38adf 100644
--- a/src/json/Makefile.am
+++ b/src/json/Makefile.am
@@ -18,18 +18,15 @@ libgnunetjson_la_SOURCES = \
json.c \
json_mhd.c \
json_generator.c \
- json_helper.c \
- json_gnsrecord.c
+ json_helper.c
libgnunetjson_la_LIBADD = \
$(top_builddir)/src/util/libgnunetutil.la \
- $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
-ljansson \
$(MHD_LIBS) \
$(XLIB) \
$(Z_LIBS)
libgnunetjson_la_DEPENDENCIES = \
- $(top_builddir)/src/util/libgnunetutil.la \
- $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la
+ $(top_builddir)/src/util/libgnunetutil.la
check_PROGRAMS = \
diff --git a/src/json/json_generator.c b/src/json/json_generator.c
index 3f82a5f17..5806eb174 100644
--- a/src/json/json_generator.c
+++ b/src/json/json_generator.c
@@ -201,113 +201,5 @@ GNUNET_JSON_from_rsa_signature (const struct
GNUNET_CRYPTO_RsaSignature *sig)
}
-/**
- * Convert GNS record to JSON.
- *
- * @param rname name of record
- * @param rd record data
- * @return corresponding JSON encoding
- */
-json_t *
-GNUNET_JSON_from_gnsrecord (const char*rname,
- const struct GNUNET_GNSRECORD_Data *rd,
- unsigned int rd_count)
-{
- struct GNUNET_TIME_Absolute abs_exp;
- struct GNUNET_TIME_Relative rel_exp;
- const char *expiration_time_str;
- const char *record_type_str;
- char *value_str;
- json_t *data;
- json_t *record;
- json_t *records;
-
- data = json_object ();
- if (NULL == data)
- {
- GNUNET_break (0);
- return NULL;
- }
- if (0 !=
- json_object_set_new (data,
- "record_name",
- json_string (rname)))
- {
- GNUNET_break (0);
- json_decref (data);
- return NULL;
- }
- records = json_array ();
- if (NULL == records)
- {
- GNUNET_break (0);
- json_decref (data);
- return NULL;
- }
- for (int i = 0; i < rd_count; i++)
- {
- value_str = GNUNET_GNSRECORD_value_to_string (rd[i].record_type,
- rd[i].data,
- rd[i].data_size);
- if (GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION & rd[i].flags)
- {
- rel_exp.rel_value_us = rd[i].expiration_time;
- expiration_time_str = GNUNET_STRINGS_relative_time_to_string (rel_exp,
- GNUNET_NO);
- }
- else
- {
- abs_exp.abs_value_us = rd[i].expiration_time;
- expiration_time_str = GNUNET_STRINGS_absolute_time_to_string (abs_exp);
- }
- record_type_str = GNUNET_GNSRECORD_number_to_typename (rd[i].record_type);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Packing %s %s %s %d\n",
- value_str, record_type_str, expiration_time_str, rd[i].flags);
- record = json_pack ("{s:s,s:s,s:s,s:b,s:b,s:b,s:b}",
- "value",
- value_str,
- "record_type",
- record_type_str,
- "expiration_time",
- expiration_time_str,
- "private",
- rd[i].flags & GNUNET_GNSRECORD_RF_PRIVATE,
- "relative_expiration",
- rd[i].flags & GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION,
- "supplemental",
- rd[i].flags & GNUNET_GNSRECORD_RF_SUPPLEMENTAL,
- "shadow",
- rd[i].flags & GNUNET_GNSRECORD_RF_SHADOW_RECORD);
- GNUNET_free (value_str);
- if (NULL == record)
- {
- GNUNET_break (0);
- json_decref (records);
- json_decref (data);
- return NULL;
- }
- if (0 !=
- json_array_append_new (records,
- record))
- {
- GNUNET_break (0);
- json_decref (records);
- json_decref (data);
- return NULL;
- }
- }
- if (0 !=
- json_object_set_new (data,
- "data",
- records))
- {
- GNUNET_break (0);
- json_decref (data);
- return NULL;
- }
- return data;
-}
-
/* End of json/json_generator.c */
diff --git a/src/namestore/Makefile.am b/src/namestore/Makefile.am
index 40ac64197..d057a0a99 100644
--- a/src/namestore/Makefile.am
+++ b/src/namestore/Makefile.am
@@ -131,6 +131,7 @@ libgnunet_plugin_rest_namestore_la_LIBADD = \
$(top_builddir)/src/identity/libgnunetidentity.la \
$(top_builddir)/src/json/libgnunetjson.la \
$(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
+ $(top_builddir)/src/gnsrecord/libgnunetgnsrecordjson.la \
$(top_builddir)/src/util/libgnunetutil.la $(XLIBS) \
$(LTLIBINTL) -ljansson $(MHD_LIBS)
libgnunet_plugin_rest_namestore_la_LDFLAGS = \
diff --git a/src/namestore/plugin_rest_namestore.c
b/src/namestore/plugin_rest_namestore.c
index f295951bc..edcbeb874 100644
--- a/src/namestore/plugin_rest_namestore.c
+++ b/src/namestore/plugin_rest_namestore.c
@@ -30,7 +30,7 @@
#include "gnunet_namestore_service.h"
#include "gnunet_identity_service.h"
#include "gnunet_rest_lib.h"
-#include "gnunet_json_lib.h"
+#include "gnunet_gnsrecord_json_lib.h"
#include "microhttpd.h"
#include <jansson.h>
@@ -535,9 +535,9 @@ namestore_list_iteration (void *cls,
/** Only add if not empty **/
if (j > 0)
{
- record_obj = GNUNET_JSON_from_gnsrecord (rname,
- rd_filtered,
- j);
+ record_obj = GNUNET_GNSRECORD_JSON_from_gnsrecord (rname,
+ rd_filtered,
+ j);
json_array_append_new (handle->resp_object, record_obj);
}
GNUNET_NAMESTORE_zone_iterator_next (handle->list_it, 1);
@@ -587,9 +587,9 @@ ns_get_lookup_cb (void *cls,
/** Only add if not empty **/
if (j > 0)
{
- record_obj = GNUNET_JSON_from_gnsrecord (label,
- rd_filtered,
- j);
+ record_obj = GNUNET_GNSRECORD_JSON_from_gnsrecord (label,
+ rd_filtered,
+ j);
json_array_append_new (handle->resp_object, record_obj);
}
GNUNET_SCHEDULER_add_now (&namestore_list_finished, handle);
@@ -755,7 +755,7 @@ namestore_add_or_update (struct GNUNET_REST_RequestHandle
*con_handle,
handle->rest_handle->data_size);
data_js = json_loads (term_data, JSON_DECODE_ANY, &err);
struct GNUNET_JSON_Specification gnsspec[] =
- { GNUNET_JSON_spec_gnsrecord (&handle->rd, &handle->rd_count,
+ { GNUNET_GNSRECORD_JSON_spec_gnsrecord (&handle->rd, &handle->rd_count,
&handle->record_name),
GNUNET_JSON_spec_end () };
if (GNUNET_OK != GNUNET_JSON_parse (data_js, gnsspec, NULL, NULL))
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gnunet] branch master updated: - more dep fixes,
gnunet <=