diff options
Diffstat (limited to 'src/identity')
-rw-r--r-- | src/identity/plugin_rest_identity.c | 40 |
1 files changed, 28 insertions, 12 deletions
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 | |||
86 | struct RequestHandle | 87 | struct 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 | */ |
177 | void | 178 | static void |
178 | cleanup_handle (struct RequestHandle *handle) | 179 | cleanup_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 | */ |
230 | void | 231 | static void |
231 | get_ego_for_subsys (void *cls, | 232 | get_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 | */ |
284 | void | 285 | static void |
285 | ego_info_response (struct RestConnectionDataHandle *con, | 286 | ego_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 | ||
492 | void | 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 | */ | ||
502 | static void | ||
493 | ego_edit_cont (struct RestConnectionDataHandle *con, | 503 | ego_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 | ||
645 | void | 655 | |
656 | /** | ||
657 | * Handle rest request | ||
658 | * | ||
659 | * @param handle the request handle | ||
660 | */ | ||
661 | static void | ||
646 | init_cont (struct RequestHandle *handle) | 662 | init_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 | */ |
729 | void | 745 | static void |
730 | rest_identity_process_request(struct RestConnectionDataHandle *conndata_handle, | 746 | rest_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) |