GNUnet  0.11.x
Data Structures | Macros | Functions
reclaim attributes

Data Structures

struct  GNUNET_RECLAIM_ATTRIBUTE_Claim
 An attribute. More...
 
struct  GNUNET_RECLAIM_ATTRIBUTE_ClaimList
 A list of GNUNET_RECLAIM_ATTRIBUTE_Claim structures. More...
 
struct  GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry
 

Macros

#define GNUNET_RECLAIM_ATTRIBUTE_TYPE_NONE   0
 No value attribute. More...
 
#define GNUNET_RECLAIM_ATTRIBUTE_TYPE_STRING   1
 String attribute. More...
 

Functions

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 claim. More...
 
size_t GNUNET_RECLAIM_ATTRIBUTE_list_serialize_get_size (const struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs)
 Get required size for serialization buffer. More...
 
void GNUNET_RECLAIM_ATTRIBUTE_list_destroy (struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs)
 Destroy claim list. More...
 
void GNUNET_RECLAIM_ATTRIBUTE_list_add (struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs, 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 (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...
 
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...
 
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...
 
uint32_t GNUNET_RECLAIM_ATTRIBUTE_typename_to_number (const char *typename)
 Convert a type name to the corresponding number. 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...
 
const char * GNUNET_RECLAIM_ATTRIBUTE_number_to_typename (uint32_t type)
 Convert a type number to the corresponding type string. More...
 

Detailed Description

Macro Definition Documentation

◆ GNUNET_RECLAIM_ATTRIBUTE_TYPE_NONE

#define GNUNET_RECLAIM_ATTRIBUTE_TYPE_NONE   0

No value attribute.

Definition at line 46 of file gnunet_reclaim_attribute_lib.h.

◆ GNUNET_RECLAIM_ATTRIBUTE_TYPE_STRING

#define GNUNET_RECLAIM_ATTRIBUTE_TYPE_STRING   1

String attribute.

Definition at line 51 of file gnunet_reclaim_attribute_lib.h.

Referenced by gnuid_string_to_value(), gnuid_value_to_string(), and iter_finished().

Function Documentation

◆ GNUNET_RECLAIM_ATTRIBUTE_claim_new()

struct GNUNET_RECLAIM_ATTRIBUTE_Claim* GNUNET_RECLAIM_ATTRIBUTE_claim_new ( const char *  attr_name,
uint32_t  type,
const void *  data,
size_t  data_size 
)

Create a new attribute claim.

Parameters
attr_namethe attribute name
typethe attribute type
datathe attribute value
data_sizethe attribute value size
Returns
the new attribute

Create a new attribute claim.

Parameters
attr_namethe attribute name
typethe attribute type
datathe attribute value
data_sizethe attribute value size
Returns
the new attribute

Definition at line 231 of file reclaim_attribute.c.

References GNUNET_RECLAIM_ATTRIBUTE_Claim::data, GNUNET_RECLAIM_ATTRIBUTE_Claim::data_size, data_size, GNUNET_free, GNUNET_malloc, GNUNET_memcpy, GNUNET_strdup, GNUNET_STRINGS_utf8_tolower(), GNUNET_RECLAIM_ATTRIBUTE_Claim::name, GNUNET_RECLAIM_ATTRIBUTE_Claim::type, type, and GNUNET_RECLAIM_ATTRIBUTE_Claim::version.

Referenced by GNUNET_RECLAIM_ATTRIBUTE_list_add(), GNUNET_RECLAIM_ATTRIBUTE_list_dup(), iter_cb(), iter_finished(), oidc_attr_collect(), and parse_attr().

235 {
236  struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr;
237  char *write_ptr;
238  char *attr_name_tmp = GNUNET_strdup (attr_name);
239 
240  GNUNET_STRINGS_utf8_tolower (attr_name, attr_name_tmp);
241 
242  attr = GNUNET_malloc (sizeof(struct GNUNET_RECLAIM_ATTRIBUTE_Claim)
243  + strlen (attr_name_tmp) + 1 + data_size);
244  attr->type = type;
245  attr->data_size = data_size;
246  attr->version = 0;
247  write_ptr = (char *) &attr[1];
248  GNUNET_memcpy (write_ptr, attr_name_tmp, strlen (attr_name_tmp) + 1);
249  attr->name = write_ptr;
250  write_ptr += strlen (attr->name) + 1;
251  GNUNET_memcpy (write_ptr, data, data_size);
252  attr->data = write_ptr;
253  GNUNET_free (attr_name_tmp);
254  return attr;
255 }
const char * name
The name of the attribute.
size_t data_size
Number of bytes in data.
static size_t data_size
Number of bytes in data.
Definition: gnunet-abd.c:187
#define GNUNET_memcpy(dst, src, n)
Call memcpy() but check for n being 0 first.
#define GNUNET_strdup(a)
Wrapper around GNUNET_xstrdup_.
const void * data
Binary value stored as attribute value.
static char * attr_name
The attribute.
enum GNUNET_TESTBED_UnderlayLinkModelType type
the type of this model
uint32_t data
The data value.
#define GNUNET_malloc(size)
Wrapper around malloc.
#define GNUNET_free(ptr)
Wrapper around free.
void GNUNET_STRINGS_utf8_tolower(const char *input, char *output)
Convert the utf-8 input string to lower case.
Definition: strings.c:553
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_RECLAIM_ATTRIBUTE_list_serialize_get_size()

size_t GNUNET_RECLAIM_ATTRIBUTE_list_serialize_get_size ( const struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList attrs)

Get required size for serialization buffer.

Parameters
attrsthe attribute list to serialize
Returns
the required buffer size

Definition at line 292 of file reclaim_attribute.c.

References GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry::claim, GNUNET_RECLAIM_ATTRIBUTE_serialize_get_size(), len, GNUNET_RECLAIM_ATTRIBUTE_ClaimList::list_head, and GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry::next.

Referenced by consume_result_cb(), GNUNET_RECLAIM_ticket_issue(), and OIDC_build_authz_code().

294 {
296  size_t len = 0;
297 
298  for (le = attrs->list_head; NULL != le; le = le->next)
300  return len;
301 }
struct GNUNET_RECLAIM_ATTRIBUTE_Claim * claim
The attribute claim.
size_t GNUNET_RECLAIM_ATTRIBUTE_serialize_get_size(const struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr)
Get required size for serialization buffer.
struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry * next
DLL.
struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry * list_head
List head.
uint16_t len
length of data (which is always a uint32_t, but presumably this can be used to specify that fewer byt...
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_RECLAIM_ATTRIBUTE_list_destroy()

void GNUNET_RECLAIM_ATTRIBUTE_list_destroy ( struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList attrs)

Destroy claim list.

Parameters
attrslist to destroy

Definition at line 408 of file reclaim_attribute.c.

References GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry::claim, GNUNET_free, GNUNET_RECLAIM_ATTRIBUTE_ClaimList::list_head, and GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry::next.

Referenced by cleanup_cth(), handle_consume_ticket_result(), handle_issue_ticket_message(), and token_endpoint().

410 {
413 
414  for (le = attrs->list_head; NULL != le;)
415  {
416  GNUNET_free (le->claim);
417  tmp_le = le;
418  le = le->next;
419  GNUNET_free (tmp_le);
420  }
421  GNUNET_free (attrs);
422 }
struct GNUNET_RECLAIM_ATTRIBUTE_Claim * claim
The attribute claim.
struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry * next
DLL.
struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry * list_head
List head.
#define GNUNET_free(ptr)
Wrapper around free.
Here is the caller graph for this function:

◆ GNUNET_RECLAIM_ATTRIBUTE_list_add()

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.

Parameters
attr_namethe name of the new attribute claim
typethe type of the claim
dataclaim payload
data_sizeclaim payload size

Definition at line 267 of file reclaim_attribute.c.

References GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry::claim, GNUNET_CONTAINER_DLL_insert, GNUNET_new, GNUNET_RECLAIM_ATTRIBUTE_claim_new(), GNUNET_RECLAIM_ATTRIBUTE_ClaimList::list_head, and GNUNET_RECLAIM_ATTRIBUTE_ClaimList::list_tail.

273 {
275 
277  le->claim =
280  claim_list->list_tail,
281  le);
282 }
struct GNUNET_RECLAIM_ATTRIBUTE_Claim * claim
The attribute claim.
#define GNUNET_CONTAINER_DLL_insert(head, tail, element)
Insert an element at the head of a DLL.
struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry * list_tail
List tail.
static size_t data_size
Number of bytes in data.
Definition: gnunet-abd.c:187
#define GNUNET_new(type)
Allocate a struct or union of the given type.
static char * attr_name
The attribute.
struct GNUNET_RECLAIM_ATTRIBUTE_Claim * GNUNET_RECLAIM_ATTRIBUTE_claim_new(const char *attr_name, uint32_t type, const void *data, size_t data_size)
Create a new attribute.
enum GNUNET_TESTBED_UnderlayLinkModelType type
the type of this model
uint32_t data
The data value.
struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry * list_head
List head.
Here is the call graph for this function:

◆ GNUNET_RECLAIM_ATTRIBUTE_list_serialize()

size_t GNUNET_RECLAIM_ATTRIBUTE_list_serialize ( const struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList attrs,
char *  result 
)

Serialize an attribute list.

Parameters
attrsthe attribute list to serialize
resultthe serialized attribute
Returns
length of serialized data

Definition at line 312 of file reclaim_attribute.c.

References GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry::claim, GNUNET_RECLAIM_ATTRIBUTE_serialize(), len, GNUNET_RECLAIM_ATTRIBUTE_ClaimList::list_head, GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry::next, and result.

Referenced by consume_result_cb(), GNUNET_RECLAIM_ticket_issue(), and OIDC_build_authz_code().

315 {
317  size_t len;
318  size_t total_len;
319  char *write_ptr;
320 
321  write_ptr = result;
322  total_len = 0;
323  for (le = attrs->list_head; NULL != le; le = le->next)
324  {
325  len = GNUNET_RECLAIM_ATTRIBUTE_serialize (le->claim, write_ptr);
326  total_len += len;
327  write_ptr += len;
328  }
329  return total_len;
330 }
struct GNUNET_RECLAIM_ATTRIBUTE_Claim * claim
The attribute claim.
static int result
Global testing status.
size_t GNUNET_RECLAIM_ATTRIBUTE_serialize(const struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr, char *result)
Serialize an attribute.
struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry * next
DLL.
struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry * list_head
List head.
uint16_t len
length of data (which is always a uint32_t, but presumably this can be used to specify that fewer byt...
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_RECLAIM_ATTRIBUTE_list_deserialize()

struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList* GNUNET_RECLAIM_ATTRIBUTE_list_deserialize ( const char *  data,
size_t  data_size 
)

Deserialize an attribute list.

Parameters
datathe serialized attribute list
data_sizethe length of the serialized data
Returns
a GNUNET_IDENTITY_PROVIDER_AttributeList, must be free'd by caller

Definition at line 341 of file reclaim_attribute.c.

References GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry::claim, data, GNUNET_CONTAINER_DLL_insert, GNUNET_ERROR_TYPE_DEBUG, GNUNET_log, GNUNET_new, GNUNET_RECLAIM_ATTRIBUTE_deserialize(), GNUNET_RECLAIM_ATTRIBUTE_serialize_get_size(), GNUNET_RECLAIM_ATTRIBUTE_ClaimList::list_head, GNUNET_RECLAIM_ATTRIBUTE_ClaimList::list_tail, and GNUNET_RECLAIM_ATTRIBUTE_Claim::name.

Referenced by handle_consume_ticket_result(), handle_issue_ticket_message(), and OIDC_parse_authz_code().

342 {
345  size_t attr_len;
346  const char *read_ptr;
347 
348  if (data_size < sizeof(struct Attribute))
349  return NULL;
350 
352  read_ptr = data;
353  while (((data + data_size) - read_ptr) >= sizeof(struct Attribute))
354  {
356  le->claim =
358  data_size - (read_ptr - data));
360  "Deserialized attribute %s\n",
361  le->claim->name);
362  GNUNET_CONTAINER_DLL_insert (attrs->list_head, attrs->list_tail, le);
364  read_ptr += attr_len;
365  }
366  return attrs;
367 }
const char * name
The name of the attribute.
struct GNUNET_RECLAIM_ATTRIBUTE_Claim * claim
The attribute claim.
#define GNUNET_CONTAINER_DLL_insert(head, tail, element)
Insert an element at the head of a DLL.
struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry * list_tail
List tail.
static size_t data_size
Number of bytes in data.
Definition: gnunet-abd.c:187
#define GNUNET_new(type)
Allocate a struct or union of the given type.
Serialized claim.
size_t GNUNET_RECLAIM_ATTRIBUTE_serialize_get_size(const struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr)
Get required size for serialization buffer.
A list of GNUNET_RECLAIM_ATTRIBUTE_Claim structures.
#define GNUNET_log(kind,...)
uint32_t data
The data value.
struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry * list_head
List head.
struct GNUNET_RECLAIM_ATTRIBUTE_Claim * GNUNET_RECLAIM_ATTRIBUTE_deserialize(const char *data, size_t data_size)
Deserialize an attribute.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_RECLAIM_ATTRIBUTE_serialize_get_size()

size_t GNUNET_RECLAIM_ATTRIBUTE_serialize_get_size ( const struct GNUNET_RECLAIM_ATTRIBUTE_Claim attr)

Get required size for serialization buffer.

Parameters
attrthe attribute to serialize
Returns
the required buffer size

Definition at line 432 of file reclaim_attribute.c.

Referenced by attr_store_task(), GNUNET_RECLAIM_attribute_delete(), GNUNET_RECLAIM_ATTRIBUTE_list_deserialize(), GNUNET_RECLAIM_ATTRIBUTE_list_serialize_get_size(), GNUNET_RECLAIM_attribute_store(), and rvk_move_attr_cb().

434 {
435  return sizeof(struct Attribute) + strlen (attr->name) + attr->data_size;
436 }
static size_t data_size
Number of bytes in data.
Definition: gnunet-abd.c:187
Serialized claim.
const char * name
Here is the caller graph for this function:

◆ GNUNET_RECLAIM_ATTRIBUTE_serialize()

size_t GNUNET_RECLAIM_ATTRIBUTE_serialize ( const struct GNUNET_RECLAIM_ATTRIBUTE_Claim attr,
char *  result 
)

Serialize an attribute.

Parameters
attrthe attribute to serialize
resultthe serialized attribute
Returns
length of serialized data

Definition at line 447 of file reclaim_attribute.c.

References Attribute::attribute_id, Attribute::attribute_type, Attribute::attribute_version, GNUNET_RECLAIM_ATTRIBUTE_Claim::data, Attribute::data_size, GNUNET_RECLAIM_ATTRIBUTE_Claim::data_size, GNUNET_htonll(), GNUNET_memcpy, GNUNET_RECLAIM_ATTRIBUTE_Claim::id, GNUNET_RECLAIM_ATTRIBUTE_Claim::name, Attribute::name_len, GNUNET_RECLAIM_ATTRIBUTE_Claim::type, and GNUNET_RECLAIM_ATTRIBUTE_Claim::version.

Referenced by attr_store_task(), GNUNET_RECLAIM_attribute_delete(), GNUNET_RECLAIM_ATTRIBUTE_list_serialize(), GNUNET_RECLAIM_attribute_store(), and rvk_move_attr_cb().

450 {
451  size_t data_len_ser;
452  size_t name_len;
453  struct Attribute *attr_ser;
454  char *write_ptr;
455 
456  attr_ser = (struct Attribute *) result;
457  attr_ser->attribute_type = htons (attr->type);
458  attr_ser->attribute_version = htonl (attr->version);
459  attr_ser->attribute_id = GNUNET_htonll (attr->id);
460  name_len = strlen (attr->name);
461  attr_ser->name_len = htons (name_len);
462  write_ptr = (char *) &attr_ser[1];
463  GNUNET_memcpy (write_ptr, attr->name, name_len);
464  write_ptr += name_len;
465  // TODO plugin-ize
466  // data_len_ser = plugin->serialize_attribute_value (attr,
467  // &attr_ser[1]);
468  data_len_ser = attr->data_size;
469  GNUNET_memcpy (write_ptr, attr->data, attr->data_size);
470  attr_ser->data_size = htons (data_len_ser);
471 
472  return sizeof(struct Attribute) + strlen (attr->name) + attr->data_size;
473 }
const char * name
The name of the attribute.
size_t data_size
Number of bytes in data.
static size_t data_size
Number of bytes in data.
Definition: gnunet-abd.c:187
#define GNUNET_memcpy(dst, src, n)
Call memcpy() but check for n being 0 first.
Serialized claim.
const void * data
Binary value stored as attribute value.
uint32_t data_size
Data size.
static int result
Global testing status.
uint32_t attribute_version
Attribute version.
uint64_t GNUNET_htonll(uint64_t n)
Convert unsigned 64-bit integer to network byte order.
Definition: common_endian.c:35
uint64_t attribute_id
Attribute ID.
const char * name
uint32_t name_len
Name length.
uint32_t attribute_type
Attribute type.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_RECLAIM_ATTRIBUTE_deserialize()

struct GNUNET_RECLAIM_ATTRIBUTE_Claim* GNUNET_RECLAIM_ATTRIBUTE_deserialize ( const char *  data,
size_t  data_size 
)

Deserialize an attribute.

Parameters
datathe serialized attribute
data_sizethe length of the serialized data
Returns
a GNUNET_IDENTITY_PROVIDER_Attribute, must be free'd by caller

Definition at line 485 of file reclaim_attribute.c.

References Attribute::attribute_id, Attribute::attribute_type, Attribute::attribute_version, GNUNET_RECLAIM_ATTRIBUTE_Claim::data, Attribute::data_size, GNUNET_RECLAIM_ATTRIBUTE_Claim::data_size, GNUNET_ERROR_TYPE_ERROR, GNUNET_log, GNUNET_malloc, GNUNET_memcpy, GNUNET_ntohll(), GNUNET_RECLAIM_ATTRIBUTE_Claim::id, GNUNET_RECLAIM_ATTRIBUTE_Claim::name, Attribute::name_len, GNUNET_RECLAIM_ATTRIBUTE_Claim::type, and GNUNET_RECLAIM_ATTRIBUTE_Claim::version.

Referenced by GNUNET_RECLAIM_ATTRIBUTE_list_deserialize(), handle_attribute_delete_message(), handle_attribute_result(), handle_attribute_store_message(), process_parallel_lookup_result(), and rvk_move_attr_cb().

486 {
487  struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr;
488  struct Attribute *attr_ser;
489  size_t data_len;
490  size_t name_len;
491  char *write_ptr;
492 
493  if (data_size < sizeof(struct Attribute))
494  return NULL;
495 
496  attr_ser = (struct Attribute *) data;
497  data_len = ntohs (attr_ser->data_size);
498  name_len = ntohs (attr_ser->name_len);
499  if (data_size < sizeof(struct Attribute) + data_len + name_len)
500  {
502  "Buffer too small to deserialize\n");
503  return NULL;
504  }
505  attr = GNUNET_malloc (sizeof(struct GNUNET_RECLAIM_ATTRIBUTE_Claim)
506  + data_len + name_len + 1);
507  attr->type = ntohs (attr_ser->attribute_type);
508  attr->version = ntohl (attr_ser->attribute_version);
509  attr->id = GNUNET_ntohll (attr_ser->attribute_id);
510  attr->data_size = data_len;
511 
512  write_ptr = (char *) &attr[1];
513  GNUNET_memcpy (write_ptr, &attr_ser[1], name_len);
514  write_ptr[name_len] = '\0';
515  attr->name = write_ptr;
516 
517  write_ptr += name_len + 1;
518  GNUNET_memcpy (write_ptr, (char *) &attr_ser[1] + name_len, attr->data_size);
519  attr->data = write_ptr;
520  return attr;
521 }
const char * name
The name of the attribute.
size_t data_size
Number of bytes in data.
static size_t data_size
Number of bytes in data.
Definition: gnunet-abd.c:187
#define GNUNET_memcpy(dst, src, n)
Call memcpy() but check for n being 0 first.
Serialized claim.
const void * data
Binary value stored as attribute value.
uint32_t data_size
Data size.
uint32_t attribute_version
Attribute version.
uint64_t attribute_id
Attribute ID.
#define GNUNET_log(kind,...)
uint32_t name_len
Name length.
uint32_t data
The data value.
uint32_t attribute_type
Attribute type.
#define GNUNET_malloc(size)
Wrapper around malloc.
uint64_t GNUNET_ntohll(uint64_t n)
Convert unsigned 64-bit integer to host byte order.
Definition: common_endian.c:48
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_RECLAIM_ATTRIBUTE_list_dup()

struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList* GNUNET_RECLAIM_ATTRIBUTE_list_dup ( const struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList attrs)

Make a (deep) copy of a claim list.

Parameters
attrsclaim list to copy
Returns
copied claim list

Definition at line 376 of file reclaim_attribute.c.

References GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry::claim, GNUNET_RECLAIM_ATTRIBUTE_Claim::data, GNUNET_RECLAIM_ATTRIBUTE_Claim::data_size, GNUNET_CONTAINER_DLL_insert, GNUNET_new, GNUNET_RECLAIM_ATTRIBUTE_claim_new(), GNUNET_RECLAIM_ATTRIBUTE_Claim::id, GNUNET_RECLAIM_ATTRIBUTE_ClaimList::list_head, GNUNET_RECLAIM_ATTRIBUTE_ClaimList::list_tail, GNUNET_RECLAIM_ATTRIBUTE_Claim::name, GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry::next, result, GNUNET_RECLAIM_ATTRIBUTE_Claim::type, and GNUNET_RECLAIM_ATTRIBUTE_Claim::version.

Referenced by RECLAIM_TICKETS_issue().

378 {
380  struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry *result_le;
382 
384  for (le = attrs->list_head; NULL != le; le = le->next)
385  {
387  result_le->claim =
389  le->claim->type,
390  le->claim->data,
391  le->claim->data_size);
392  result_le->claim->version = le->claim->version;
393  result_le->claim->id = le->claim->id;
395  result->list_tail,
396  result_le);
397  }
398  return result;
399 }
const char * name
The name of the attribute.
struct GNUNET_RECLAIM_ATTRIBUTE_Claim * claim
The attribute claim.
#define GNUNET_CONTAINER_DLL_insert(head, tail, element)
Insert an element at the head of a DLL.
size_t data_size
Number of bytes in data.
struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry * list_tail
List tail.
#define GNUNET_new(type)
Allocate a struct or union of the given type.
const void * data
Binary value stored as attribute value.
static int result
Global testing status.
struct GNUNET_RECLAIM_ATTRIBUTE_Claim * GNUNET_RECLAIM_ATTRIBUTE_claim_new(const char *attr_name, uint32_t type, const void *data, size_t data_size)
Create a new attribute.
A list of GNUNET_RECLAIM_ATTRIBUTE_Claim structures.
struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry * next
DLL.
struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry * list_head
List head.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_RECLAIM_ATTRIBUTE_typename_to_number()

uint32_t GNUNET_RECLAIM_ATTRIBUTE_typename_to_number ( const char *  typename)

Convert a type name to the corresponding number.

Parameters
typenamename to convert
Returns
corresponding number, UINT32_MAX on error

Definition at line 113 of file reclaim_attribute.c.

References Plugin::api, GNUNET_BLOCK_PluginFunctions::cls, init(), num_plugins, plugin, and ret.

Referenced by iter_finished(), and parse_attr().

114 {
115  unsigned int i;
116  struct Plugin *plugin;
117  uint32_t ret;
118 
119  init ();
120  for (i = 0; i < num_plugins; i++)
121  {
122  plugin = attr_plugins[i];
123  if (UINT32_MAX !=
124  (ret = plugin->api->typename_to_number (plugin->api->cls, typename)))
125  return ret;
126  }
127  return UINT32_MAX;
128 }
static unsigned int num_plugins
Number of plugins.
static int ret
Return value of the commandline.
Definition: gnunet-abd.c:81
static void init()
Load plugins.
struct GNUNET_BLOCK_PluginFunctions * api
Plugin API.
Definition: block.c:47
static char * plugin
Solver plugin name as string.
static struct Plugin ** attr_plugins
Plugins.
Handle for a plugin.
Definition: block.c:37
void * cls
Closure for all of the callbacks.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_RECLAIM_ATTRIBUTE_string_to_value()

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.

Parameters
typetype of the claim
shuman-readable string
dataset to value in binary encoding (will be allocated)
data_sizeset to number of bytes in data
Returns
GNUNET_OK on success

Definition at line 167 of file reclaim_attribute.c.

References Plugin::api, GNUNET_BLOCK_PluginFunctions::cls, GNUNET_OK, GNUNET_SYSERR, init(), num_plugins, and plugin.

Referenced by iter_finished(), and parse_attr().

171 {
172  unsigned int i;
173  struct Plugin *plugin;
174 
175  init ();
176  for (i = 0; i < num_plugins; i++)
177  {
178  plugin = attr_plugins[i];
179  if (GNUNET_OK == plugin->api->string_to_value (plugin->api->cls,
180  type,
181  s,
182  data,
183  data_size))
184  return GNUNET_OK;
185  }
186  return GNUNET_SYSERR;
187 }
static unsigned int num_plugins
Number of plugins.
static size_t data_size
Number of bytes in data.
Definition: gnunet-abd.c:187
static void init()
Load plugins.
#define GNUNET_OK
Named constants for return values.
Definition: gnunet_common.h:75
struct GNUNET_BLOCK_PluginFunctions * api
Plugin API.
Definition: block.c:47
static char * plugin
Solver plugin name as string.
#define GNUNET_SYSERR
Definition: gnunet_common.h:76
static struct Plugin ** attr_plugins
Plugins.
Handle for a plugin.
Definition: block.c:37
enum GNUNET_TESTBED_UnderlayLinkModelType type
the type of this model
void * cls
Closure for all of the callbacks.
uint32_t data
The data value.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_RECLAIM_ATTRIBUTE_value_to_string()

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.

Parameters
typethe type of attribute
dataclaim in binary encoding
data_sizenumber of bytes in data
Returns
NULL on error, otherwise human-readable representation of the claim

Definition at line 199 of file reclaim_attribute.c.

References Plugin::api, GNUNET_BLOCK_PluginFunctions::cls, init(), num_plugins, plugin, and ret.

Referenced by attr_collect(), consume_cont(), consume_ticket(), iter_cb(), OIDC_id_token_new(), and process_attrs().

202 {
203  unsigned int i;
204  struct Plugin *plugin;
205  char *ret;
206 
207  init ();
208  for (i = 0; i < num_plugins; i++)
209  {
210  plugin = attr_plugins[i];
211  if (NULL != (ret = plugin->api->value_to_string (plugin->api->cls,
212  type,
213  data,
214  data_size)))
215  return ret;
216  }
217  return NULL;
218 }
static unsigned int num_plugins
Number of plugins.
static size_t data_size
Number of bytes in data.
Definition: gnunet-abd.c:187
static int ret
Return value of the commandline.
Definition: gnunet-abd.c:81
static void init()
Load plugins.
struct GNUNET_BLOCK_PluginFunctions * api
Plugin API.
Definition: block.c:47
static char * plugin
Solver plugin name as string.
static struct Plugin ** attr_plugins
Plugins.
Handle for a plugin.
Definition: block.c:37
enum GNUNET_TESTBED_UnderlayLinkModelType type
the type of this model
void * cls
Closure for all of the callbacks.
uint32_t data
The data value.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_RECLAIM_ATTRIBUTE_number_to_typename()

const char* GNUNET_RECLAIM_ATTRIBUTE_number_to_typename ( uint32_t  type)

Convert a type number to the corresponding type string.

Parameters
typenumber of a type
Returns
corresponding typestring, NULL on error

Definition at line 138 of file reclaim_attribute.c.

References Plugin::api, GNUNET_BLOCK_PluginFunctions::cls, init(), num_plugins, plugin, and ret.

Referenced by attr_collect(), iter_cb(), and process_attrs().

139 {
140  unsigned int i;
141  struct Plugin *plugin;
142  const char *ret;
143 
144  init ();
145  for (i = 0; i < num_plugins; i++)
146  {
147  plugin = attr_plugins[i];
148  if (NULL !=
149  (ret = plugin->api->number_to_typename (plugin->api->cls, type)))
150  return ret;
151  }
152  return NULL;
153 }
static unsigned int num_plugins
Number of plugins.
static int ret
Return value of the commandline.
Definition: gnunet-abd.c:81
static void init()
Load plugins.
struct GNUNET_BLOCK_PluginFunctions * api
Plugin API.
Definition: block.c:47
static char * plugin
Solver plugin name as string.
static struct Plugin ** attr_plugins
Plugins.
Handle for a plugin.
Definition: block.c:37
enum GNUNET_TESTBED_UnderlayLinkModelType type
the type of this model
void * cls
Closure for all of the callbacks.
Here is the call graph for this function:
Here is the caller graph for this function: