gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-anastasis] 01/03: started with wrapper for de-/serialization


From: gnunet
Subject: [taler-anastasis] 01/03: started with wrapper for de-/serialization
Date: Mon, 07 Sep 2020 15:45:43 +0200

This is an automated email from the git hooks/post-receive script.

dennis-neufeld pushed a commit to branch master
in repository anastasis.

commit 32a41d78b7c9d0e8f8f2f5eaad8d90a0a18861ef
Author: Dennis Neufeld <dennis.neufeld@students.bfh.ch>
AuthorDate: Mon Sep 7 15:33:57 2020 +0200

    started with wrapper for de-/serialization
---
 src/include/anastasis_json.h | 185 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 185 insertions(+)

diff --git a/src/include/anastasis_json.h b/src/include/anastasis_json.h
new file mode 100644
index 0000000..3aff042
--- /dev/null
+++ b/src/include/anastasis_json.h
@@ -0,0 +1,185 @@
+/*
+  This file is part of Anastasis
+  Copyright (C) 2020 Taler Systems SA
+
+  Anastasis is free software; you can redistribute it and/or modify it under 
the
+  terms of the GNU Lesser General Public License as published by the Free 
Software
+  Foundation; either version 3, or (at your option) any later version.
+
+  Anastasis is distributed in the hope that it will be useful, but WITHOUT ANY
+  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+  A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License along with
+  Anastasis; see the file COPYING.GPL.  If not, see 
<http://www.gnu.org/licenses/>
+*/
+/**
+ * @file lib/anastasis_json.h
+ * @brief anastasis de-/serialization api
+ * @author Christian Grothoff
+ * @author Dominik Meister
+ * @author Dennis Neufeld
+ */
+#ifndef ANASTASIS_JSON_H
+#define ANASTASIS_JSON_H
+
+#include <jansson.h>
+#include <gnunet/gnunet_util_lib.h>
+
+/**
+ * Defines a user with all possible attributes.
+ */
+struct UserData
+{
+  /**
+   * First name of user
+   */
+  char *first_name;
+
+  /**
+   * Last name of user
+   */
+  char *last_name;
+
+  /**
+   * Birthdate of user
+   */
+  struct GNUNET_TIME_Absolute date;
+
+  /**
+   * Social security number for swiss citizens (AHV number)
+   */
+  char *AHV_number;
+
+  // FIXME: more attributes following here
+};
+
+/**
+ * Defines a state of a policy object.
+ */
+struct PolicyState
+{
+  // FIXME add attributes here
+};
+
+/**
+ * Defines a state of a truth object.
+ */
+struct TruthState
+{
+  // FIXME add attributes here
+};
+
+
+/**
+ * Parses the country config file for the country code and
+ * returns a json object containing the country-specific
+ * attributes needed to create the user identifier.
+ *
+ * @param conf_filename name of config file
+ * @param country_code country code (Alpha-2 code)
+ * @return reference to json object
+ */
+json_t *
+ANASTASIS_JSON_get_country_conf (
+  const char *conf_filename,
+  const char *country_code);
+
+
+/**
+ * Returns default providers.
+ *
+ * @param prov_filename filename which contains the default providers
+ * @return reference to json object containing the default providers
+ */
+json_t *
+ANASTASIS_JSON_get_default_providers (const char *prov_filename);
+
+
+/**
+ * Loads user attributes from a json object.
+ *
+ * @param state_memory json object containing all stored states
+ * @return reference to user data
+ */
+struct UserData *
+ANASTASIS_JSON_user_deserialize (json_t *state_memory);
+
+
+/**
+ * Stores user attributes into a json object.
+ *
+ * @param user user data
+ * @return json object representing user data
+ */
+json_t *
+ANASTASIS_JSON_user_serialize (struct UserData *user);
+
+
+/**
+ * Restores states of policies from a json object.
+ * Used during backup process.
+ *
+ * @param state_memory json object containing all stored states (backup 
process)
+ * @return array of policy states
+ */
+struct PolicyState **
+ANASTASIS_JSON_policies_deserialize (json_t *state_memory);
+
+
+/**
+ * Stores states of policies into a json object.
+ * Used during backup process.
+ *
+ * @param policy_states array of policy states
+ * @return json object containing policy states
+ */
+json_t *
+ANASTASIS_JSON_policies_serialize (struct PolicyState **policy_states);
+
+
+/**
+ * Restores states of truths from a json object.
+ * Used during backup process.
+ *
+ * @param state_memory json object containing all stored states (backup 
process)
+ * @return array of truth states
+ */
+struct TruthState **
+ANASTASIS_JSON_truths_deserialize (json_t *state_memory);
+
+
+/**
+ * Stores states of truths into a json object.
+ * Used during backup process.
+ *
+ * @param truth_states array of truth states
+ * @return json object containing all truth states
+ */
+json_t *
+ANASTASIS_JSON_truths_serialize (struct TruthState **truth_states);
+
+
+/**
+ * Restores states of challenges from a json object.
+ * Used during recovery process.
+ *
+ * @param state_memory json object containing all stored states (recovery 
process)
+ * @return array of truth states
+ */
+struct ChallengeState **
+ANASTASIS_JSON_challenges_deserialize (json_t *state_memory);
+
+
+/**
+ * Stores states of challenges into a json object.
+ * Used during recovery process.
+ *
+ * @param challenge_states array of challenge states
+ * @return json object containing all truth states
+ */
+json_t *
+ANASTASIS_JSON_challenges_serialize (struct ChallengeState **challenge_states);
+
+
+#endif  /* _ANASTASIS_JSON_H */
\ No newline at end of file

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]