GNUnet 0.21.1
reclaim_plugin.h File Reference
Include dependency graph for reclaim_plugin.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

enum GNUNET_GenericReturnValue REST_reclaim_process_request (void *plugin, struct GNUNET_REST_RequestHandle *conndata_handle, GNUNET_REST_ResultProcessor proc, void *proc_cls)
 Function processing the REST call. More...
 
void * REST_reclaim_init (const struct GNUNET_CONFIGURATION_Handle *c)
 Entry point for the plugin. More...
 
void REST_reclaim_done (struct GNUNET_REST_Plugin *api)
 Exit point from the plugin. More...
 

Function Documentation

◆ REST_reclaim_process_request()

enum GNUNET_GenericReturnValue REST_reclaim_process_request ( void *  plugin,
struct GNUNET_REST_RequestHandle conndata_handle,
GNUNET_REST_ResultProcessor  proc,
void *  proc_cls 
)

Function processing the REST call.

Parameters
methodHTTP method
urlURL of the HTTP request
databody of the HTTP request (optional)
data_sizelength of the body
proccallback function for the result
proc_clsclosure for proc
Returns
GNUNET_OK if request accepted

Definition at line 1404 of file reclaim_plugin.c.

1408{
1409 struct RequestHandle *handle = GNUNET_new (struct RequestHandle);
1411 static const struct GNUNET_REST_RequestHandler handlers[] =
1412 { { MHD_HTTP_METHOD_GET,
1414 { MHD_HTTP_METHOD_POST,
1416 { MHD_HTTP_METHOD_DELETE,
1418 { MHD_HTTP_METHOD_GET,
1420 { MHD_HTTP_METHOD_POST,
1422 { MHD_HTTP_METHOD_DELETE,
1424 { MHD_HTTP_METHOD_GET,
1426 { MHD_HTTP_METHOD_POST,
1428 { MHD_HTTP_METHOD_POST,
1430 { MHD_HTTP_METHOD_OPTIONS, GNUNET_REST_API_NS_RECLAIM, &options_cont },
1432
1433 handle->response_code = 0;
1435 handle->proc_cls = proc_cls;
1436 handle->proc = proc;
1437 handle->rest_handle = rest_handle;
1438
1439 handle->url = GNUNET_strdup (rest_handle->url);
1440 if (handle->url[strlen (handle->url) - 1] == '/')
1441 handle->url[strlen (handle->url) - 1] = '\0';
1442 handle->timeout_task =
1446 handle);
1447 if (GNUNET_NO ==
1448 GNUNET_REST_handle_request (handle->rest_handle, handlers, &err, handle))
1449 {
1451 return GNUNET_NO;
1452 }
1453
1454 return GNUNET_YES;
1455}
struct GNUNET_MQ_MessageHandlers handlers[]
Definition: 003.c:1
static struct GNUNET_VPN_Handle * handle
Handle to vpn service.
Definition: gnunet-vpn.c:35
#define GNUNET_CONTAINER_DLL_insert(head, tail, element)
Insert an element at the head of a DLL.
@ GNUNET_YES
@ GNUNET_NO
#define GNUNET_strdup(a)
Wrapper around GNUNET_xstrdup_.
#define GNUNET_new(type)
Allocate a struct or union of the given type.
int GNUNET_REST_handle_request(struct GNUNET_REST_RequestHandle *conn, const struct GNUNET_REST_RequestHandler *handlers, struct GNUNET_REST_RequestHandlerError *err, void *cls)
Definition: rest.c:64
#define GNUNET_REST_HANDLER_END
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_delayed(struct GNUNET_TIME_Relative delay, GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run with a specified delay.
Definition: scheduler.c:1278
#define GNUNET_TIME_UNIT_FOREVER_REL
Constant used to specify "forever".
#define GNUNET_REST_API_NS_IDENTITY_REVOKE
Revoke namespace.
#define GNUNET_REST_API_NS_RECLAIM_CREDENTIAL
Credential namespace.
static void do_timeout(void *cls)
Task run on timeout, sends error message.
#define GNUNET_REST_API_NS_IDENTITY_TICKETS
Ticket namespace.
#define GNUNET_REST_API_NS_IDENTITY_CONSUME
Revoke namespace.
#define GNUNET_REST_API_NS_RECLAIM_ATTRIBUTES
Attribute namespace.
static void delete_credential_cont(struct GNUNET_REST_RequestHandle *con_handle, const char *url, void *cls)
Deletes credential from an identity.
static void revoke_ticket_cont(struct GNUNET_REST_RequestHandle *con_handle, const char *url, void *cls)
#define GNUNET_REST_API_NS_RECLAIM
REST root namespace.
static void delete_attribute_cont(struct GNUNET_REST_RequestHandle *con_handle, const char *url, void *cls)
List attributes for identity request.
static void list_tickets_cont(struct GNUNET_REST_RequestHandle *con_handle, const char *url, void *cls)
List tickets for identity request.
static struct RequestHandle * requests_head
DLL.
static void options_cont(struct GNUNET_REST_RequestHandle *con_handle, const char *url, void *cls)
Respond to OPTIONS request.
static void list_credential_cont(struct GNUNET_REST_RequestHandle *con_handle, const char *url, void *cls)
Lists credential for identity request.
static void add_credential_cont(struct GNUNET_REST_RequestHandle *con_handle, const char *url, void *cls)
static struct RequestHandle * requests_tail
DLL.
static void add_attribute_cont(struct GNUNET_REST_RequestHandle *con_handle, const char *url, void *cls)
static void list_attribute_cont(struct GNUNET_REST_RequestHandle *con_handle, const char *url, void *cls)
List attributes for identity request.
static void consume_ticket_cont(struct GNUNET_REST_RequestHandle *con_handle, const char *url, void *cls)
static void cleanup_handle(void *cls)
Cleanup lookup handle.
void(* proc)(struct GNUNET_REST_RequestHandle *handle, const char *url, void *cls)
Namespace to handle.
The request handle.
Definition: config_plugin.c:46

References add_attribute_cont(), add_credential_cont(), cleanup_handle(), consume_ticket_cont(), delete_attribute_cont(), delete_credential_cont(), do_timeout(), GNUNET_CONTAINER_DLL_insert, GNUNET_new, GNUNET_NO, GNUNET_REST_API_NS_IDENTITY_CONSUME, GNUNET_REST_API_NS_IDENTITY_REVOKE, GNUNET_REST_API_NS_IDENTITY_TICKETS, GNUNET_REST_API_NS_RECLAIM, GNUNET_REST_API_NS_RECLAIM_ATTRIBUTES, GNUNET_REST_API_NS_RECLAIM_CREDENTIAL, GNUNET_REST_handle_request(), GNUNET_REST_HANDLER_END, GNUNET_SCHEDULER_add_delayed(), GNUNET_strdup, GNUNET_TIME_UNIT_FOREVER_REL, GNUNET_YES, handle, handlers, list_attribute_cont(), list_credential_cont(), list_tickets_cont(), options_cont(), GNUNET_REST_RequestHandler::proc, requests_head, requests_tail, revoke_ticket_cont(), and GNUNET_REST_RequestHandle::url.

Referenced by run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ REST_reclaim_init()

void * REST_reclaim_init ( const struct GNUNET_CONFIGURATION_Handle c)

Entry point for the plugin.

Parameters
clsthe "struct GNUNET_NAMESTORE_PluginEnvironment*"
Returns
NULL on error, otherwise the plugin context

◆ REST_reclaim_done()

void REST_reclaim_done ( struct GNUNET_REST_Plugin api)

Exit point from the plugin.

Parameters
clsthe plugin context (as returned by "init")
Returns
always NULL

Definition at line 1501 of file reclaim_plugin.c.

1502{
1503 struct Plugin *plugin = api->cls;
1504 struct RequestHandle *request;
1505 struct EgoEntry *ego_entry;
1506 struct EgoEntry *ego_tmp;
1507
1508 plugin->cfg = NULL;
1509 while (NULL != (request = requests_head))
1510 do_error (request);
1511 if (NULL != idp)
1513 if (NULL != identity_handle)
1515 for (ego_entry = ego_head; NULL != ego_entry;)
1516 {
1517 ego_tmp = ego_entry;
1518 ego_entry = ego_entry->next;
1519 GNUNET_free (ego_tmp->identifier);
1520 GNUNET_free (ego_tmp->keystring);
1521 GNUNET_free (ego_tmp);
1522 }
1523
1525 GNUNET_free (api);
1527 "Identity Provider REST plugin is finished\n");
1528 return NULL;
1529}
struct TestcasePlugin * plugin
The process handle to the testbed service.
static struct GNUNET_VPN_RedirectionRequest * request
Opaque redirection request handle.
Definition: gnunet-vpn.c:40
void GNUNET_IDENTITY_disconnect(struct GNUNET_IDENTITY_Handle *h)
Disconnect from identity service.
Definition: identity_api.c:732
#define GNUNET_log(kind,...)
@ GNUNET_ERROR_TYPE_DEBUG
#define GNUNET_free(ptr)
Wrapper around free.
void GNUNET_RECLAIM_disconnect(struct GNUNET_RECLAIM_Handle *h)
Disconnect from identity provider service.
Definition: reclaim_api.c:1150
static struct GNUNET_RECLAIM_Handle * idp
Identity Provider.
static struct EgoEntry * ego_head
Ego list.
static char * allow_methods
HTTP methods allows for this plugin.
static struct GNUNET_IDENTITY_Handle * identity_handle
Handle to Identity service.
static void do_error(void *cls)
Task run on error, sends error message.
The default namestore ego.
char * identifier
Ego Identifier.
char * keystring
Public key string.
struct EgoEntry * next
DLL.
void * cls
Closure for all of the callbacks.
Handle for a plugin.
Definition: block.c:38
struct GNUNET_BLOCK_PluginFunctions * api
Plugin API.
Definition: block.c:47

References allow_methods, Plugin::api, GNUNET_BLOCK_PluginFunctions::cls, do_error(), ego_head, GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_IDENTITY_disconnect(), GNUNET_log, GNUNET_RECLAIM_disconnect(), EgoEntry::identifier, identity_handle, idp, EgoEntry::keystring, EgoEntry::next, plugin, request, and requests_head.

Referenced by do_shutdown().

Here is the call graph for this function:
Here is the caller graph for this function: