obsolete due to alpine policy
[oweals/gnunet.git] / src / reclaim / plugin_rest_reclaim.c
index 3f257780264b9db22315e20173159c79632252b1..fd35059d7416a1fa41f2cac20ee1bb3ebe06f6ed 100644 (file)
@@ -16,7 +16,7 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
    SPDX-License-Identifier: AGPL3.0-or-later
  */
+ */
 /**
  * @author Martin Schanzenbach
  * @author Philippe Buschmann
@@ -247,6 +247,7 @@ cleanup_handle (struct RequestHandle *handle)
   struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry *claim_tmp;
   struct EgoEntry *ego_entry;
   struct EgoEntry *ego_tmp;
+
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Cleaning up\n");
   if (NULL != handle->resp_object)
     json_decref (handle->resp_object);
@@ -382,6 +383,7 @@ static void
 collect_finished_cb (void *cls)
 {
   struct RequestHandle *handle = cls;
+
   // Done
   handle->attr_it = NULL;
   handle->ticket_it = NULL;
@@ -402,26 +404,26 @@ ticket_collect (void *cls, const struct GNUNET_RECLAIM_Ticket *ticket)
   char *tmp;
 
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Adding ticket\n");
-  tmp = GNUNET_STRINGS_data_to_string_alloc (&ticket->rnd, sizeof (uint64_t));
+  tmp = GNUNET_STRINGS_data_to_string_alloc (&ticket->rnd, sizeof(uint64_t));
   json_resource = json_object ();
   GNUNET_free (tmp);
   json_array_append (handle->resp_object, json_resource);
 
   tmp =
     GNUNET_STRINGS_data_to_string_alloc (&ticket->identity,
-                                         sizeof (struct
-                                                 GNUNET_CRYPTO_EcdsaPublicKey));
+                                         sizeof(struct
+                                                GNUNET_CRYPTO_EcdsaPublicKey));
   value = json_string (tmp);
   json_object_set_new (json_resource, "issuer", value);
   GNUNET_free (tmp);
   tmp =
     GNUNET_STRINGS_data_to_string_alloc (&ticket->audience,
-                                         sizeof (struct
-                                                 GNUNET_CRYPTO_EcdsaPublicKey));
+                                         sizeof(struct
+                                                GNUNET_CRYPTO_EcdsaPublicKey));
   value = json_string (tmp);
   json_object_set_new (json_resource, "audience", value);
   GNUNET_free (tmp);
-  tmp = GNUNET_STRINGS_data_to_string_alloc (&ticket->rnd, sizeof (uint64_t));
+  tmp = GNUNET_STRINGS_data_to_string_alloc (&ticket->rnd, sizeof(uint64_t));
   value = json_string (tmp);
   json_object_set_new (json_resource, "rnd", value);
   GNUNET_free (tmp);
@@ -499,7 +501,7 @@ add_attribute_cont (struct GNUNET_REST_RequestHandle *con_handle,
   json_t *data_json;
   json_error_t err;
   struct GNUNET_JSON_Specification attrspec[] =
-    {GNUNET_RECLAIM_JSON_spec_claim (&attribute), GNUNET_JSON_spec_end ()};
+  { GNUNET_RECLAIM_JSON_spec_claim (&attribute), GNUNET_JSON_spec_end () };
 
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "Adding an attribute for %s.\n",
@@ -596,7 +598,7 @@ attr_collect (void *cls,
   json_object_set_new (attr_obj, "name", json_string (attr->name));
   type = GNUNET_RECLAIM_ATTRIBUTE_number_to_typename (attr->type);
   json_object_set_new (attr_obj, "type", json_string (type));
-  id_str = GNUNET_STRINGS_data_to_string_alloc (&attr->id, sizeof (uint64_t));
+  id_str = GNUNET_STRINGS_data_to_string_alloc (&attr->id, sizeof(uint64_t));
   json_object_set_new (attr_obj, "id", json_string (id_str));
   json_array_append (handle->resp_object, attr_obj);
   json_decref (attr_obj);
@@ -731,8 +733,8 @@ delete_attribute_cont (struct GNUNET_REST_RequestHandle *con_handle,
   }
   priv_key = GNUNET_IDENTITY_ego_get_private_key (ego_entry->ego);
   handle->idp = GNUNET_RECLAIM_connect (cfg);
-  memset (&attr, 0, sizeof (struct GNUNET_RECLAIM_ATTRIBUTE_Claim));
-  GNUNET_STRINGS_string_to_data (id, strlen (id), &attr.id, sizeof (uint64_t));
+  memset (&attr, 0, sizeof(struct GNUNET_RECLAIM_ATTRIBUTE_Claim));
+  GNUNET_STRINGS_string_to_data (id, strlen (id), &attr.id, sizeof(uint64_t));
   attr.name = "";
   handle->idp_op = GNUNET_RECLAIM_attribute_delete (handle->idp,
                                                     priv_key,
@@ -757,7 +759,7 @@ revoke_ticket_cont (struct GNUNET_REST_RequestHandle *con_handle,
   json_t *data_json;
   json_error_t err;
   struct GNUNET_JSON_Specification tktspec[] =
-    {GNUNET_RECLAIM_JSON_spec_ticket (&ticket), GNUNET_JSON_spec_end ()};
+  { GNUNET_RECLAIM_JSON_spec_ticket (&ticket), GNUNET_JSON_spec_end () };
 
   if (0 >= handle->rest_handle->data_size)
   {
@@ -796,7 +798,7 @@ revoke_ticket_cont (struct GNUNET_REST_RequestHandle *con_handle,
     GNUNET_IDENTITY_ego_get_public_key (ego_entry->ego, &tmp_pk);
     if (0 == memcmp (&ticket->identity,
                      &tmp_pk,
-                     sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey)))
+                     sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey)))
       break;
   }
   if (NULL == ego_entry)
@@ -862,7 +864,7 @@ consume_ticket_cont (struct GNUNET_REST_RequestHandle *con_handle,
   json_t *data_json;
   json_error_t err;
   struct GNUNET_JSON_Specification tktspec[] =
-    {GNUNET_RECLAIM_JSON_spec_ticket (&ticket), GNUNET_JSON_spec_end ()};
+  { GNUNET_RECLAIM_JSON_spec_ticket (&ticket), GNUNET_JSON_spec_end () };
 
   if (0 >= handle->rest_handle->data_size)
   {
@@ -897,7 +899,7 @@ consume_ticket_cont (struct GNUNET_REST_RequestHandle *con_handle,
     GNUNET_IDENTITY_ego_get_public_key (ego_entry->ego, &tmp_pk);
     if (0 == memcmp (&ticket->audience,
                      &tmp_pk,
-                     sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey)))
+                     sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey)))
       break;
   }
   if (NULL == ego_entry)
@@ -951,26 +953,26 @@ init_cont (struct RequestHandle *handle)
 {
   struct GNUNET_REST_RequestHandlerError err;
   static const struct GNUNET_REST_RequestHandler handlers[] =
-    {{MHD_HTTP_METHOD_GET,
+  { { MHD_HTTP_METHOD_GET,
       GNUNET_REST_API_NS_RECLAIM_ATTRIBUTES,
-      &list_attribute_cont},
-     {MHD_HTTP_METHOD_POST,
+      &list_attribute_cont },
+    MHD_HTTP_METHOD_POST,
       GNUNET_REST_API_NS_RECLAIM_ATTRIBUTES,
-      &add_attribute_cont},
-     {MHD_HTTP_METHOD_DELETE,
+      &add_attribute_cont },
+    MHD_HTTP_METHOD_DELETE,
       GNUNET_REST_API_NS_RECLAIM_ATTRIBUTES,
-      &delete_attribute_cont},
-     {MHD_HTTP_METHOD_GET,
+      &delete_attribute_cont },
+    MHD_HTTP_METHOD_GET,
       GNUNET_REST_API_NS_IDENTITY_TICKETS,
-      &list_tickets_cont},
-     {MHD_HTTP_METHOD_POST,
+      &list_tickets_cont },
+    MHD_HTTP_METHOD_POST,
       GNUNET_REST_API_NS_IDENTITY_REVOKE,
-      &revoke_ticket_cont},
-     {MHD_HTTP_METHOD_POST,
+      &revoke_ticket_cont },
+    MHD_HTTP_METHOD_POST,
       GNUNET_REST_API_NS_IDENTITY_CONSUME,
-      &consume_ticket_cont},
-     {MHD_HTTP_METHOD_OPTIONS, GNUNET_REST_API_NS_RECLAIM, &options_cont},
-     GNUNET_REST_HANDLER_END};
+      &consume_ticket_cont },
+    { MHD_HTTP_METHOD_OPTIONS, GNUNET_REST_API_NS_RECLAIM, &options_cont },
+    GNUNET_REST_HANDLER_END };
 
   if (GNUNET_NO ==
       GNUNET_REST_handle_request (handle->rest_handle, handlers, &err, handle))
@@ -1048,6 +1050,7 @@ rest_identity_process_request (struct GNUNET_REST_RequestHandle *rest_handle,
                                void *proc_cls)
 {
   struct RequestHandle *handle = GNUNET_new (struct RequestHandle);
+
   handle->response_code = 0;
   handle->timeout = GNUNET_TIME_UNIT_FOREVER_REL;
   handle->proc_cls = proc_cls;
@@ -1080,7 +1083,7 @@ libgnunet_plugin_rest_reclaim_init (void *cls)
   cfg = cls;
   if (NULL != plugin.cfg)
     return NULL; /* can only initialize once! */
-  memset (&plugin, 0, sizeof (struct Plugin));
+  memset (&plugin, 0, sizeof(struct Plugin));
   plugin.cfg = cfg;
   api = GNUNET_new (struct GNUNET_REST_Plugin);
   api->cls = &plugin;
@@ -1111,6 +1114,7 @@ libgnunet_plugin_rest_reclaim_done (void *cls)
 {
   struct GNUNET_REST_Plugin *api = cls;
   struct Plugin *plugin = api->cls;
+
   plugin->cfg = NULL;
 
   GNUNET_free_non_null (allow_methods);