aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/gns/plugin_rest_gns.c6
-rw-r--r--src/identity/plugin_rest_identity.c40
-rw-r--r--src/namestore/plugin_rest_namestore.c8
3 files changed, 35 insertions, 19 deletions
diff --git a/src/gns/plugin_rest_gns.c b/src/gns/plugin_rest_gns.c
index 6922c7d79..d7fc31d4c 100644
--- a/src/gns/plugin_rest_gns.c
+++ b/src/gns/plugin_rest_gns.c
@@ -226,7 +226,7 @@ do_error (void *cls,
226 * 226 *
227 * @param rd the GNSRECORD_Data 227 * @param rd the GNSRECORD_Data
228 */ 228 */
229json_t * 229static json_t *
230gnsrecord_to_json (const struct GNUNET_GNSRECORD_Data *rd) 230gnsrecord_to_json (const struct GNUNET_GNSRECORD_Data *rd)
231{ 231{
232 const char *typename; 232 const char *typename;
@@ -480,7 +480,7 @@ identity_master_cb (void *cls,
480 * @param handle lookup handle to populate 480 * @param handle lookup handle to populate
481 * @return GNUNET_SYSERR on error 481 * @return GNUNET_SYSERR on error
482 */ 482 */
483int 483static int
484parse_url (const char *url, struct LookupHandle *handle) 484parse_url (const char *url, struct LookupHandle *handle)
485{ 485{
486 char *name; 486 char *name;
@@ -513,7 +513,7 @@ parse_url (const char *url, struct LookupHandle *handle)
513 * @param proc_cls closure for callback function 513 * @param proc_cls closure for callback function
514 * @return GNUNET_OK if request accepted 514 * @return GNUNET_OK if request accepted
515 */ 515 */
516void 516static void
517rest_gns_process_request(struct RestConnectionDataHandle *conndata_handle, 517rest_gns_process_request(struct RestConnectionDataHandle *conndata_handle,
518 GNUNET_REST_ResultProcessor proc, 518 GNUNET_REST_ResultProcessor proc,
519 void *proc_cls) 519 void *proc_cls)
diff --git a/src/identity/plugin_rest_identity.c b/src/identity/plugin_rest_identity.c
index b9aa8db00..53c74dcf2 100644
--- a/src/identity/plugin_rest_identity.c
+++ b/src/identity/plugin_rest_identity.c
@@ -83,6 +83,7 @@ struct EgoEntry
83 struct GNUNET_IDENTITY_Ego *ego; 83 struct GNUNET_IDENTITY_Ego *ego;
84}; 84};
85 85
86
86struct RequestHandle 87struct RequestHandle
87{ 88{
88 /** 89 /**
@@ -174,7 +175,7 @@ struct RequestHandle
174 * Cleanup lookup handle 175 * Cleanup lookup handle
175 * @param handle Handle to clean up 176 * @param handle Handle to clean up
176 */ 177 */
177void 178static void
178cleanup_handle (struct RequestHandle *handle) 179cleanup_handle (struct RequestHandle *handle)
179{ 180{
180 struct EgoEntry *ego_entry; 181 struct EgoEntry *ego_entry;
@@ -227,7 +228,7 @@ do_error (void *cls,
227 * @param ctx the context 228 * @param ctx the context
228 * @param name the id of the ego 229 * @param name the id of the ego
229 */ 230 */
230void 231static void
231get_ego_for_subsys (void *cls, 232get_ego_for_subsys (void *cls,
232 struct GNUNET_IDENTITY_Ego *ego, 233 struct GNUNET_IDENTITY_Ego *ego,
233 void **ctx, 234 void **ctx,
@@ -281,7 +282,7 @@ get_ego_for_subsys (void *cls,
281 * 282 *
282 * @param handle the RequestHandle 283 * @param handle the RequestHandle
283 */ 284 */
284void 285static void
285ego_info_response (struct RestConnectionDataHandle *con, 286ego_info_response (struct RestConnectionDataHandle *con,
286 const char *url, 287 const char *url,
287 void *cls) 288 void *cls)
@@ -425,8 +426,9 @@ ego_create_cont (struct RestConnectionDataHandle *con,
425 struct JsonApiObject *json_obj; 426 struct JsonApiObject *json_obj;
426 struct JsonApiResource *json_res; 427 struct JsonApiResource *json_res;
427 json_t *egoname_json; 428 json_t *egoname_json;
428 char term_data[handle->data_size+1];
429 const char* egoname; 429 const char* egoname;
430 char term_data[handle->data_size+1];
431
430 if (strlen (GNUNET_REST_API_NS_IDENTITY) != strlen (handle->url)) 432 if (strlen (GNUNET_REST_API_NS_IDENTITY) != strlen (handle->url))
431 { 433 {
432 GNUNET_SCHEDULER_add_now (&do_error, handle); 434 GNUNET_SCHEDULER_add_now (&do_error, handle);
@@ -489,23 +491,31 @@ ego_create_cont (struct RestConnectionDataHandle *con,
489 handle); 491 handle);
490} 492}
491 493
492void 494
495/**
496 * Handle ego edit request
497 *
498 * @param con rest connection handle
499 * @param url the url that is requested
500 * @param cls the RequestHandle
501 */
502static void
493ego_edit_cont (struct RestConnectionDataHandle *con, 503ego_edit_cont (struct RestConnectionDataHandle *con,
494 const char *url, 504 const char *url,
495 void *cls) 505 void *cls)
496{ 506{
497 struct JsonApiObject *json_obj; 507 struct JsonApiObject *json_obj;
498 struct JsonApiResource *json_res; 508 struct JsonApiResource *json_res;
499 const char *egoname;
500 const char *subsys;
501 const char *newname;
502 struct RequestHandle *handle = cls; 509 struct RequestHandle *handle = cls;
503 char term_data[handle->data_size+1];
504 struct EgoEntry *ego_entry; 510 struct EgoEntry *ego_entry;
505 struct MHD_Response *resp; 511 struct MHD_Response *resp;
506 int ego_exists = GNUNET_NO;
507 json_t *subsys_json; 512 json_t *subsys_json;
508 json_t *name_json; 513 json_t *name_json;
514 const char *egoname;
515 const char *subsys;
516 const char *newname;
517 char term_data[handle->data_size+1];
518 int ego_exists = GNUNET_NO;
509 519
510 if (strlen (GNUNET_REST_API_NS_IDENTITY) > strlen (handle->url)) 520 if (strlen (GNUNET_REST_API_NS_IDENTITY) > strlen (handle->url))
511 { 521 {
@@ -642,7 +652,13 @@ ego_delete_cont (struct RestConnectionDataHandle *con_handle,
642 652
643} 653}
644 654
645void 655
656/**
657 * Handle rest request
658 *
659 * @param handle the request handle
660 */
661static void
646init_cont (struct RequestHandle *handle) 662init_cont (struct RequestHandle *handle)
647{ 663{
648 static const struct GNUNET_REST_RestConnectionHandler handlers[] = { 664 static const struct GNUNET_REST_RestConnectionHandler handlers[] = {
@@ -726,7 +742,7 @@ list_ego (void *cls,
726 * @param proc_cls closure for callback function 742 * @param proc_cls closure for callback function
727 * @return GNUNET_OK if request accepted 743 * @return GNUNET_OK if request accepted
728 */ 744 */
729void 745static void
730rest_identity_process_request(struct RestConnectionDataHandle *conndata_handle, 746rest_identity_process_request(struct RestConnectionDataHandle *conndata_handle,
731 GNUNET_REST_ResultProcessor proc, 747 GNUNET_REST_ResultProcessor proc,
732 void *proc_cls) 748 void *proc_cls)
diff --git a/src/namestore/plugin_rest_namestore.c b/src/namestore/plugin_rest_namestore.c
index a5287b158..7f5372a33 100644
--- a/src/namestore/plugin_rest_namestore.c
+++ b/src/namestore/plugin_rest_namestore.c
@@ -220,7 +220,7 @@ struct RequestHandle
220 * Cleanup lookup handle 220 * Cleanup lookup handle
221 * @param handle Handle to clean up 221 * @param handle Handle to clean up
222 */ 222 */
223void 223static void
224cleanup_handle (struct RequestHandle *handle) 224cleanup_handle (struct RequestHandle *handle)
225{ 225{
226 struct RecordEntry *record_entry; 226 struct RecordEntry *record_entry;
@@ -274,7 +274,7 @@ cleanup_handle (struct RequestHandle *handle)
274 * 274 *
275 * @param rd the GNSRECORD_Data 275 * @param rd the GNSRECORD_Data
276 */ 276 */
277json_t * 277static json_t *
278gnsrecord_to_json (const struct GNUNET_GNSRECORD_Data *rd) 278gnsrecord_to_json (const struct GNUNET_GNSRECORD_Data *rd)
279{ 279{
280 const char *typename; 280 const char *typename;
@@ -351,7 +351,7 @@ cleanup_handle_delayed (void *cls,
351 * 351 *
352 * @param handle the RequestHandle 352 * @param handle the RequestHandle
353 */ 353 */
354void 354static void
355namestore_list_response (void *cls, 355namestore_list_response (void *cls,
356 const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone_key, 356 const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone_key,
357 const char *rname, 357 const char *rname,
@@ -967,7 +967,7 @@ testservice_id_task (void *cls, int result)
967 * @param proc_cls closure for callback function 967 * @param proc_cls closure for callback function
968 * @return GNUNET_OK if request accepted 968 * @return GNUNET_OK if request accepted
969 */ 969 */
970void 970static void
971rest_identity_process_request(struct RestConnectionDataHandle *conndata_handle, 971rest_identity_process_request(struct RestConnectionDataHandle *conndata_handle,
972 GNUNET_REST_ResultProcessor proc, 972 GNUNET_REST_ResultProcessor proc,
973 void *proc_cls) 973 void *proc_cls)