GNUnet  0.10.x
Data Structures | Functions | Variables
reclaim_attribute.c File Reference

helper library to manage identity attributes More...

#include "platform.h"
#include "gnunet_util_lib.h"
#include "gnunet_reclaim_attribute_plugin.h"
#include "reclaim_attribute.h"
Include dependency graph for reclaim_attribute.c:

Go to the source code of this file.

Data Structures

struct  Plugin
 Handle for a plugin. More...
 

Functions

static void add_plugin (void *cls, const char *library_name, void *lib_ret)
 Add a plugin. More...
 
static void init ()
 Load plugins. More...
 
uint32_t GNUNET_RECLAIM_ATTRIBUTE_typename_to_number (const char *typename)
 Convert a type name to the corresponding number. More...
 
const char * GNUNET_RECLAIM_ATTRIBUTE_number_to_typename (uint32_t type)
 Convert a type number to the corresponding type string. More...
 
int GNUNET_RECLAIM_ATTRIBUTE_string_to_value (uint32_t type, const char *s, void **data, size_t *data_size)
 Convert human-readable version of a 'claim' of an attribute to the binary representation. More...
 
char * GNUNET_RECLAIM_ATTRIBUTE_value_to_string (uint32_t type, const void *data, size_t data_size)
 Convert the 'claim' of an attribute to a string. More...
 
struct GNUNET_RECLAIM_ATTRIBUTE_ClaimGNUNET_RECLAIM_ATTRIBUTE_claim_new (const char *attr_name, uint32_t type, const void *data, size_t data_size)
 Create a new attribute. More...
 
void GNUNET_RECLAIM_ATTRIBUTE_list_add (struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *claim_list, const char *attr_name, uint32_t type, const void *data, size_t data_size)
 Add a new attribute to a claim list. More...
 
size_t GNUNET_RECLAIM_ATTRIBUTE_list_serialize_get_size (const struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs)
 Get required size for serialization buffer. More...
 
size_t GNUNET_RECLAIM_ATTRIBUTE_list_serialize (const struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs, char *result)
 Serialize an attribute list. More...
 
struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListGNUNET_RECLAIM_ATTRIBUTE_list_deserialize (const char *data, size_t data_size)
 Deserialize an attribute list. More...
 
struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListGNUNET_RECLAIM_ATTRIBUTE_list_dup (const struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs)
 Make a (deep) copy of a claim list. More...
 
void GNUNET_RECLAIM_ATTRIBUTE_list_destroy (struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs)
 Destroy claim list. More...
 
size_t GNUNET_RECLAIM_ATTRIBUTE_serialize_get_size (const struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr)
 Get required size for serialization buffer. More...
 
size_t GNUNET_RECLAIM_ATTRIBUTE_serialize (const struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr, char *result)
 Serialize an attribute. More...
 
struct GNUNET_RECLAIM_ATTRIBUTE_ClaimGNUNET_RECLAIM_ATTRIBUTE_deserialize (const char *data, size_t data_size)
 Deserialize an attribute. More...
 

Variables

static struct Plugin ** attr_plugins
 Plugins. More...
 
static unsigned int num_plugins
 Number of plugins. More...
 
static int initialized
 Init canary. More...
 

Detailed Description

helper library to manage identity attributes

Author
Martin Schanzenbach

Definition in file reclaim_attribute.c.

Function Documentation

◆ add_plugin()

static void add_plugin ( void *  cls,
const char *  library_name,
void *  lib_ret 
)
static

Add a plugin.

Parameters
clsclosure
library_namename of the API library
lib_retthe plugin API pointer

Definition at line 75 of file reclaim_attribute.c.

References Plugin::api, GNUNET_array_append, GNUNET_ERROR_TYPE_DEBUG, GNUNET_log, GNUNET_new, GNUNET_strdup, Plugin::library_name, num_plugins, and plugin.

Referenced by init().

76 {
77  struct GNUNET_RECLAIM_ATTRIBUTE_PluginFunctions *api = lib_ret;
78  struct Plugin *plugin;
79 
81  "Loading attribute plugin `%s'\n",
82  library_name);
83  plugin = GNUNET_new (struct Plugin);
84  plugin->api = api;
87 }
static unsigned int num_plugins
Number of plugins.
#define GNUNET_new(type)
Allocate a struct or union of the given type.
char * library_name
Name of the shared library.
Definition: block.c:42
#define GNUNET_strdup(a)
Wrapper around GNUNET_xstrdup_.
struct GNUNET_BLOCK_PluginFunctions * api
Plugin API.
Definition: block.c:47
static struct GNUNET_ATS_SolverFunctions * plugin
Our solver.
Each plugin is required to return a pointer to a struct of this type as the return value from its ent...
static struct Plugin ** attr_plugins
Plugins.
#define GNUNET_array_append(arr, size, element)
Append an element to a list (growing the list by one).
Handle for a plugin.
Definition: block.c:37
#define GNUNET_log(kind,...)
Here is the caller graph for this function:

◆ init()

static void init ( )
static

Load plugins.

Definition at line 94 of file reclaim_attribute.c.

References add_plugin(), GNUNET_PLUGIN_load_all(), GNUNET_YES, and initialized.

Referenced by GNUNET_RECLAIM_ATTRIBUTE_number_to_typename(), GNUNET_RECLAIM_ATTRIBUTE_string_to_value(), GNUNET_RECLAIM_ATTRIBUTE_typename_to_number(), and GNUNET_RECLAIM_ATTRIBUTE_value_to_string().

95 {
96  if (GNUNET_YES == initialized)
97  return;
99  GNUNET_PLUGIN_load_all ("libgnunet_plugin_reclaim_attribute_",
100  NULL,
101  &add_plugin,
102  NULL);
103 }
static void add_plugin(void *cls, const char *library_name, void *lib_ret)
Add a plugin.
void GNUNET_PLUGIN_load_all(const char *basename, void *arg, GNUNET_PLUGIN_LoaderCallback cb, void *cb_cls)
Load all compatible plugins with the given base name.
Definition: plugin.c:375
#define GNUNET_YES
Definition: gnunet_common.h:80
static int initialized
Init canary.
Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ attr_plugins

struct Plugin** attr_plugins
static

Plugins.

Definition at line 52 of file reclaim_attribute.c.

◆ num_plugins

unsigned int num_plugins
static

◆ initialized

int initialized
static

Init canary.

Definition at line 64 of file reclaim_attribute.c.

Referenced by init().