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 1409 of file reclaim_plugin.c.

1413{
1414 struct RequestHandle *handle = GNUNET_new (struct RequestHandle);
1416 static const struct GNUNET_REST_RequestHandler handlers[] =
1417 { { MHD_HTTP_METHOD_GET,
1419 { MHD_HTTP_METHOD_POST,
1421 { MHD_HTTP_METHOD_DELETE,
1423 { MHD_HTTP_METHOD_GET,
1425 { MHD_HTTP_METHOD_POST,
1427 { MHD_HTTP_METHOD_DELETE,
1429 { MHD_HTTP_METHOD_GET,
1431 { MHD_HTTP_METHOD_POST,
1433 { MHD_HTTP_METHOD_POST,
1435 { MHD_HTTP_METHOD_OPTIONS, GNUNET_REST_API_NS_RECLAIM, &options_cont },
1437
1438 handle->response_code = 0;
1440 handle->proc_cls = proc_cls;
1441 handle->proc = proc;
1442 handle->rest_handle = rest_handle;
1443
1444 handle->url = GNUNET_strdup (rest_handle->url);
1445 if (handle->url[strlen (handle->url) - 1] == '/')
1446 handle->url[strlen (handle->url) - 1] = '\0';
1447 handle->timeout_task =
1451 handle);
1452 if (GNUNET_NO ==
1453 GNUNET_REST_handle_request (handle->rest_handle, handlers, &err, handle))
1454 {
1456 return GNUNET_NO;
1457 }
1458
1459 return GNUNET_YES;
1460}
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 1506 of file reclaim_plugin.c.

1507{
1508 struct Plugin *plugin = api->cls;
1509 struct RequestHandle *request;
1510 struct EgoEntry *ego_entry;
1511 struct EgoEntry *ego_tmp;
1512
1513 plugin->cfg = NULL;
1514 while (NULL != (request = requests_head))
1515 do_error (request);
1516 if (NULL != idp)
1518 if (NULL != identity_handle)
1520 for (ego_entry = ego_head; NULL != ego_entry;)
1521 {
1522 ego_tmp = ego_entry;
1523 ego_entry = ego_entry->next;
1524 GNUNET_free (ego_tmp->identifier);
1525 GNUNET_free (ego_tmp->keystring);
1526 GNUNET_free (ego_tmp);
1527 }
1528
1530 GNUNET_free (api);
1532 "Identity Provider REST plugin is finished\n");
1533 return NULL;
1534}
static struct GNUNET_TESTING_PluginFunctions * plugin
Plugin to dynamically load a test case.
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: