#include "platform.h"
#include "microhttpd.h"
#include <inttypes.h>
#include <jansson.h>
#include <pabc/pabc.h>
#include "gnunet_reclaim_lib.h"
#include "gnunet_reclaim_service.h"
#include "gnunet_rest_lib.h"
#include "gnunet_rest_plugin.h"
#include "gnunet_signatures.h"
#include "pabc_helper.h"
Go to the source code of this file.
Data Structures | |
struct | Plugin |
Handle for a plugin. More... | |
struct | RequestHandle |
The request handle. More... | |
Macros | |
#define | GNUNET_REST_API_NS_PABC "/pabc" |
REST root namespace. More... | |
#define | GNUNET_REST_API_NS_PABC_CR "/pabc/cr" |
Credential request endpoint. More... | |
Functions | |
static void | cleanup_handle (void *cls) |
Cleanup lookup handle. More... | |
static void | do_error (void *cls) |
Task run on error, sends error message. More... | |
static void | do_timeout (void *cls) |
Task run on timeout, sends error message. More... | |
static void | return_response (void *cls) |
static enum pabc_status | set_attributes_from_idtoken (const struct pabc_context *ctx, const struct pabc_public_parameters *pp, struct pabc_user_context *usr_ctx, const char *id_token) |
static enum GNUNET_GenericReturnValue | setup_new_user_context (struct pabc_context *ctx, struct pabc_public_parameters *pp, struct pabc_user_context **usr_ctx) |
static void | cr_cont (struct GNUNET_REST_RequestHandle *con_handle, const char *url, void *cls) |
static void | options_cont (struct GNUNET_REST_RequestHandle *con_handle, const char *url, void *cls) |
Respond to OPTIONS request. More... | |
static enum GNUNET_GenericReturnValue | rest_identity_process_request (struct GNUNET_REST_RequestHandle *rest_handle, GNUNET_REST_ResultProcessor proc, void *proc_cls) |
void * | libgnunet_plugin_rest_pabc_init (void *cls) |
Entry point for the plugin. More... | |
void * | libgnunet_plugin_rest_reclaim_done (void *cls) |
Exit point from the plugin. More... | |
Variables | |
const struct GNUNET_CONFIGURATION_Handle * | cfg |
The configuration handle. More... | |
static char * | allow_methods |
HTTP methods allows for this plugin. More... | |
static struct RequestHandle * | requests_head |
DLL. More... | |
static struct RequestHandle * | requests_tail |
DLL. More... | |
#define GNUNET_REST_API_NS_PABC "/pabc" |
REST root namespace.
Definition at line 41 of file pabc_plugin.c.
#define GNUNET_REST_API_NS_PABC_CR "/pabc/cr" |
Credential request endpoint.
Definition at line 46 of file pabc_plugin.c.
|
static |
Cleanup lookup handle.
handle | Handle to clean up |
Definition at line 141 of file pabc_plugin.c.
References GNUNET_CONTAINER_DLL_remove, GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_log, GNUNET_SCHEDULER_cancel(), handle, requests_head, and requests_tail.
Referenced by do_error(), options_cont(), rest_identity_process_request(), and return_response().
|
static |
Task run on error, sends error message.
Cleans up everything.
cls | the struct RequestHandle |
Definition at line 167 of file pabc_plugin.c.
References cleanup_handle(), GNUNET_asprintf(), GNUNET_free, GNUNET_REST_create_response(), handle, and MHD_HTTP_BAD_REQUEST.
Referenced by cr_cont(), do_timeout(), and libgnunet_plugin_rest_reclaim_done().
|
static |
Task run on timeout, sends error message.
Cleans up everything.
cls | the struct RequestHandle |
Definition at line 192 of file pabc_plugin.c.
References do_error(), and handle.
Referenced by rest_identity_process_request().
|
static |
Definition at line 202 of file pabc_plugin.c.
References allow_methods, cleanup_handle(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_log, GNUNET_REST_create_response(), handle, and MHD_HTTP_OK.
Referenced by cr_cont().
|
static |
Definition at line 219 of file pabc_plugin.c.
References ctx, GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_ERROR, GNUNET_ERROR_TYPE_WARNING, GNUNET_free, GNUNET_log, GNUNET_strdup, GNUNET_STRINGS_base64url_decode(), GNUNET_strndup, key, status, and value.
Referenced by cr_cont().
|
static |
Definition at line 291 of file pabc_plugin.c.
References ctx, GNUNET_OK, and GNUNET_SYSERR.
Referenced by cr_cont().
|
static |
Definition at line 308 of file pabc_plugin.c.
References ctx, do_error(), GNUNET_assert, GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_ERROR, GNUNET_free, GNUNET_log, GNUNET_memcpy, GNUNET_OK, GNUNET_SCHEDULER_add_now(), handle, PABC_read_usr_ctx(), PABC_write_public_parameters(), PABC_write_usr_ctx(), return_response(), set_attributes_from_idtoken(), setup_new_user_context(), and status.
Referenced by rest_identity_process_request().
|
static |
Respond to OPTIONS request.
con_handle | the connection handle |
url | the url |
cls | the RequestHandle |
Definition at line 556 of file pabc_plugin.c.
References allow_methods, cleanup_handle(), GNUNET_REST_create_response(), handle, and MHD_HTTP_OK.
Referenced by rest_identity_process_request().
|
static |
Definition at line 573 of file pabc_plugin.c.
References cleanup_handle(), cr_cont(), do_timeout(), GNUNET_CONTAINER_DLL_insert, GNUNET_new, GNUNET_NO, GNUNET_REST_API_NS_PABC, GNUNET_REST_API_NS_PABC_CR, GNUNET_REST_handle_request(), GNUNET_REST_HANDLER_END, GNUNET_SCHEDULER_add_delayed(), GNUNET_strdup, GNUNET_TIME_UNIT_FOREVER_REL, GNUNET_YES, handle, handlers, options_cont(), GNUNET_REST_RequestHandler::proc, requests_head, requests_tail, and GNUNET_REST_RequestHandle::url.
Referenced by libgnunet_plugin_rest_pabc_init().
void * libgnunet_plugin_rest_pabc_init | ( | void * | cls | ) |
Entry point for the plugin.
cls | Config info |
Definition at line 618 of file pabc_plugin.c.
References _, allow_methods, cfg, GNUNET_REST_Plugin::cls, GNUNET_asprintf(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_log, GNUNET_new, GNUNET_REST_API_NS_PABC, GNUNET_REST_Plugin::name, plugin, and rest_identity_process_request().
void * libgnunet_plugin_rest_reclaim_done | ( | void * | cls | ) |
Exit point from the plugin.
cls | the plugin context (as returned by "init") |
Definition at line 649 of file pabc_plugin.c.
References allow_methods, Plugin::api, GNUNET_BLOCK_PluginFunctions::cls, GNUNET_REST_Plugin::cls, do_error(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_log, plugin, request, and requests_head.
const struct GNUNET_CONFIGURATION_Handle* cfg |
The configuration handle.
Handle to our configuration.
Definition at line 51 of file pabc_plugin.c.
Referenced by libgnunet_plugin_rest_pabc_init().
|
static |
HTTP methods allows for this plugin.
Definition at line 56 of file pabc_plugin.c.
Referenced by libgnunet_plugin_rest_pabc_init(), libgnunet_plugin_rest_reclaim_done(), options_cont(), and return_response().
|
static |
DLL.
Definition at line 128 of file pabc_plugin.c.
Referenced by cleanup_handle(), libgnunet_plugin_rest_reclaim_done(), and rest_identity_process_request().
|
static |
DLL.
Definition at line 133 of file pabc_plugin.c.
Referenced by cleanup_handle(), and rest_identity_process_request().