RECLAIM/OIDC: code cleanup
[oweals/gnunet.git] / src / include / gnunet_json_lib.h
index 6340d1f41c3a40f889741e1e346d709385adcd2e..640ffa35a66ce6a6d70e61d80b7b66ce5e07c6d3 100644 (file)
@@ -14,6 +14,8 @@
  
   You should have received a copy of the GNU Affero General Public License
   along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+     SPDX-License-Identifier: AGPL3.0-or-later
 */
 /**
  * @file gnunet_json_lib.h
@@ -26,6 +28,7 @@
 #define GNUNET_JSON_LIB_H
 
 #include "gnunet_util_lib.h"
+#include "gnunet_gnsrecord_lib.h"
 #include <jansson.h>
 
 
@@ -318,6 +321,17 @@ 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_data (struct GNUNET_GNSRECORD_Data **gnsrecord_object);
+
+
 /* ****************** Generic generator interface ******************* */
 
 
@@ -393,6 +407,16 @@ 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_gns_record (const char* rname,
+                               const struct GNUNET_GNSRECORD_Data *rd);
 
 /* ******************* Helpers for MHD upload handling ******************* */
 
@@ -479,71 +503,6 @@ GNUNET_JSON_getopt (char shortName,
                     const char *description,
                     json_t **json);
 
-/* ****************** GETOPT JSON parser ******************* */
-
-struct GNUNET_REST_JSON_Data
-{
-  /**
-   * Public key of an identity
-   */
-  char *pubkey;
-
-  /**
-   * Name
-   */
-  char *name;
-
-  /**
-   * Nickname
-   */
-  char *nickname;
-
-  /**
-   * New name
-   */
-  char *new_name;
-
-  /**
-   * Name of subsystem
-   */
-  char *subsystem;
-
-  /**
-   * Should data be handled as public (GNUNET_YES or GNUNET_NO)
-   */
-  int is_public;
-
-  /**
-   * Expiration date of data
-   */
-  char *expiration_time;
-
-  /**
-   * Type of data
-   */
-  char *type;
-
-  /**
-   * Value of data
-   */
-  char *value;
-
-  /**
-   * Zone
-   */
-  char *zone;
-};
-/*
- * Test
- */
-int
-GNUNET_REST_JSON_parse (struct GNUNET_REST_JSON_Data** rest_json_data,
-                       json_t *json_data);
-
-int
-GNUNET_REST_JSON_free (struct GNUNET_REST_JSON_Data* rest_json_data);
-
-
 #endif
 
 /* end of gnunet_json_lib.h */