GNUnet 0.21.1
copying_plugin.h File Reference
Include dependency graph for copying_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_copying_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_copying_init (const struct GNUNET_CONFIGURATION_Handle *c)
 Entry point for the plugin. More...
 
void REST_copying_done (struct GNUNET_REST_Plugin *api)
 Exit point from the plugin. More...
 

Function Documentation

◆ REST_copying_process_request()

enum GNUNET_GenericReturnValue REST_copying_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 161 of file copying_plugin.c.

165{
166 static const struct GNUNET_REST_RequestHandler handlers[] = {
167 { MHD_HTTP_METHOD_GET, GNUNET_REST_API_NS_COPYING, &get_cont },
168 { MHD_HTTP_METHOD_OPTIONS, GNUNET_REST_API_NS_COPYING, &options_cont },
170 };
171 struct RequestHandle *handle = GNUNET_new (struct RequestHandle);
173
174 handle->proc_cls = proc_cls;
175 handle->proc = proc;
176 handle->rest_handle = conndata_handle;
179 handle);
180 return GNUNET_REST_handle_request (conndata_handle,
181 handlers,
182 &err,
183 handle);
184}
struct GNUNET_MQ_MessageHandlers handlers[]
Definition: 003.c:1
static struct RequestHandle * requests_head
DLL.
static void options_cont(struct GNUNET_REST_RequestHandle *con_handle, const char *url, void *cls)
Handle rest request.
#define GNUNET_REST_API_NS_COPYING
static struct RequestHandle * requests_tail
DLL.
static void get_cont(struct GNUNET_REST_RequestHandle *con_handle, const char *url, void *cls)
Handle rest request.
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.
#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
The request handle.
Definition: config_plugin.c:46

References get_cont(), GNUNET_CONTAINER_DLL_insert, GNUNET_new, GNUNET_REST_API_NS_COPYING, GNUNET_REST_handle_request(), GNUNET_REST_HANDLER_END, handle, handlers, options_cont(), requests_head, and requests_tail.

Referenced by run().

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

◆ REST_copying_init()

void * REST_copying_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

Definition at line 194 of file copying_plugin.c.

195{
196 static struct Plugin plugin;
197
198 struct GNUNET_REST_Plugin *api;
199
200 if (NULL != plugin.cfg)
201 return NULL; /* can only initialize once! */
202 memset (&plugin, 0, sizeof(struct Plugin));
203 plugin.cfg = c;
204 api = GNUNET_new (struct GNUNET_REST_Plugin);
205 api->cls = &plugin;
208 _ ("COPYING REST API initialized\n"));
209 return api;
210}
struct TestcasePlugin * plugin
The process handle to the testbed service.
#define GNUNET_log(kind,...)
@ GNUNET_ERROR_TYPE_INFO
#define _(String)
GNU gettext support macro.
Definition: platform.h:178
struct returned by the initialization function of the plugin
char * name
Plugin name.
void * cls
The closure of the plugin.
Handle for a plugin.
Definition: block.c:38

References _, GNUNET_REST_Plugin::cls, GNUNET_ERROR_TYPE_INFO, GNUNET_log, GNUNET_new, GNUNET_REST_API_NS_COPYING, GNUNET_REST_Plugin::name, and plugin.

Referenced by run().

Here is the caller graph for this function:

◆ REST_copying_done()

void REST_copying_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 220 of file copying_plugin.c.

221{
222 struct Plugin *plugin = api->cls;
223
224 while (NULL != requests_head)
226 plugin->cfg = NULL;
229 "COPYING REST plugin is finished\n");
230}
static void cleanup_handle(struct RequestHandle *handle)
Cleanup request handle.
@ GNUNET_ERROR_TYPE_DEBUG
#define GNUNET_free(ptr)
Wrapper around free.
void * cls
Closure for all of the callbacks.
struct GNUNET_BLOCK_PluginFunctions * api
Plugin API.
Definition: block.c:47

References Plugin::api, cleanup_handle(), GNUNET_BLOCK_PluginFunctions::cls, GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_log, plugin, and requests_head.

Referenced by do_shutdown().

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