GNUnet  0.11.x
gnunet_reclaim_attribute_lib.h
Go to the documentation of this file.
1 /*
2  This file is part of GNUnet.
3  Copyright (C) 2017 GNUnet e.V.
4 
5  GNUnet is free software: you can redistribute it and/or modify it
6  under the terms of the GNU Affero General Public License as published
7  by the Free Software Foundation, either version 3 of the License,
8  or (at your option) any later version.
9 
10  GNUnet is distributed in the hope that it will be useful, but
11  WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  Affero General Public License for more details.
14 
15  You should have received a copy of the GNU Affero General Public License
16  along with this program. If not, see <http://www.gnu.org/licenses/>.
17 
18  SPDX-License-Identifier: AGPL3.0-or-later
19  */
20 
30 #ifndef GNUNET_RECLAIM_ATTRIBUTE_LIB_H
31 #define GNUNET_RECLAIM_ATTRIBUTE_LIB_H
32 
33 #ifdef __cplusplus
34 extern "C" {
35 #if 0 /* keep Emacsens' auto-indent happy */
36 }
37 #endif
38 #endif
39 
40 #include "gnunet_util_lib.h"
41 
42 
46 #define GNUNET_RECLAIM_ATTRIBUTE_TYPE_NONE 0
47 
51 #define GNUNET_RECLAIM_ATTRIBUTE_TYPE_STRING 1
52 
56 #define GNUNET_RECLAIM_ATTESTATION_TYPE_NONE 10
57 
61 #define GNUNET_RECLAIM_ATTESTATION_TYPE_JWT 11
62 
67 {
71  uint64_t id;
72 
76  uint32_t type;
77 
81  uint32_t flag;
86  const char *name;
87 
91  size_t data_size;
92 
98  const void *data;
99 };
100 
105 {
109  uint64_t id;
110 
114  uint32_t type;
115 
119  uint32_t version;
120 
125  const char *name;
126 
130  size_t data_size;
131 
137  const void *data;
138 };
139 
144 {
148  uint64_t id;
149 
153  uint64_t id_attest;
154 
159  const char *name;
160 
165  const char *reference_value;
166 };
167 
172 {
177 
182 };
183 
184 
186 {
191 
196 
205 
210 };
211 
213 {
214  uint32_t type;
215 };
216 
217 
229  uint32_t type,
230  const void *data,
231  size_t data_size);
232 
233 
240 size_t
242  const struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs);
243 
244 
250 void
252  struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs);
253 
254 
263 void
266  const char *attr_name,
267  uint32_t type,
268  const void *data,
269  size_t data_size);
270 
271 
279 size_t
281  const struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs,
282  char *result);
283 
284 
294 
300 int
302  const struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs);
303 
310 size_t
312  const struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr);
313 
314 
322 size_t
324  const struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr,
325  char *result);
326 
327 
338 
339 
347  const struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs);
348 
349 
356 uint32_t
357 GNUNET_RECLAIM_ATTRIBUTE_typename_to_number (const char *typename);
358 
369 int
371  const char *s,
372  void **data,
373  size_t *data_size);
374 
375 
384 char *
386  const void *data,
387  size_t data_size);
388 
389 
396 const char *
398 
411 size_t
413  const struct GNUNET_RECLAIM_ATTESTATION_Claim *attr);
414 
415 
423 size_t
425  const struct GNUNET_RECLAIM_ATTESTATION_Claim *attr,
426  char *result);
427 
428 
439 
440 
452  uint32_t type,
453  const void *data,
454  size_t data_size);
455 
464 char *
466  const void *data,
467  size_t data_size);
468 
479 int
481  const char *s,
482  void **data,
483  size_t *data_size);
484 
491 const char *
493 
500 uint32_t
501 GNUNET_RECLAIM_ATTESTATION_typename_to_number (const char *typename);
502 
512  const char *ref_value);
513 
514 
521 size_t
523  const struct GNUNET_RECLAIM_ATTESTATION_REFERENCE *attr);
524 
532 size_t
534  const struct GNUNET_RECLAIM_ATTESTATION_REFERENCE *attr,
535  char *result);
536 
547 
548 #if 0 /* keep Emacsens' auto-indent happy */
549 {
550 #endif
551 #ifdef __cplusplus
552 }
553 #endif
554 
555 
556 /* ifndef GNUNET_RECLAIM_ATTRIBUTE_LIB_H */
557 #endif
558  /* end of group reclaim-attribute */
560 
561 /* end of gnunet_reclaim_attribute_lib.h */
const char * name
The name of the attribute.
struct GNUNET_RECLAIM_ATTRIBUTE_Claim * claim
The attribute claim.
struct GNUNET_RECLAIM_ATTESTATION_Claim * GNUNET_RECLAIM_ATTESTATION_claim_new(const char *attr_name, uint32_t type, const void *data, size_t data_size)
Create a new attestation.
char * GNUNET_RECLAIM_ATTRIBUTE_value_to_string(uint32_t type, const void *data, size_t data_size)
Convert the &#39;claim&#39; of an attribute to a string.
size_t GNUNET_RECLAIM_ATTESTATION_serialize_get_size(const struct GNUNET_RECLAIM_ATTESTATION_Claim *attr)
Get required size for serialization buffer FIXME:
size_t data_size
Number of bytes in data.
struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry * list_tail
List tail.
struct GNUNET_RECLAIM_ATTESTATION_REFERENCE * reference
The reference.
struct GNUNET_RECLAIM_ATTESTATION_REFERENCE * GNUNET_RECLAIM_ATTESTATION_REF_deserialize(const char *data, size_t data_size)
Deserialize a reference.
uint32_t GNUNET_RECLAIM_ATTRIBUTE_typename_to_number(const char *typename)
Convert a type name to the corresponding number.
const char * reference_value
The name of the attribute/attestation reference value.
int GNUNET_RECLAIM_ATTESTATION_string_to_value(uint32_t type, const char *s, void **data, size_t *data_size)
Convert human-readable version of a &#39;claim&#39; of an attestation to the binary representation.
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 &#39;claim&#39; of an attribute to the binary representation.
uint64_t id_attest
Referenced ID of Attestation.
size_t GNUNET_RECLAIM_ATTESTATION_REF_serialize(const struct GNUNET_RECLAIM_ATTESTATION_REFERENCE *attr, char *result)
Serialize a reference.
struct GNUNET_RECLAIM_ATTESTATION_Claim * attest
The attestation claim.
const void * data
Binary value stored as attribute value.
int GNUNET_RECLAIM_ATTRIBUTE_list_count_attest(const struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs)
Count attestations in claim list.
void GNUNET_RECLAIM_ATTRIBUTE_list_destroy(struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs)
Destroy claim list.
struct GNUNET_RECLAIM_ATTESTATION_REFERENCE * GNUNET_RECLAIM_ATTESTATION_reference_new(const char *attr_name, const char *ref_value)
Create a new attestation reference.
const char * GNUNET_RECLAIM_ATTRIBUTE_number_to_typename(uint32_t type)
Convert a type number to the corresponding type string.
const char * GNUNET_RECLAIM_ATTESTATION_number_to_typename(uint32_t type)
Convert an attestation type number to the corresponding attestation type string.
static char * attr_name
The attribute.
struct GNUNET_RECLAIM_ATTESTATION_Claim * GNUNET_RECLAIM_ATTESTATION_deserialize(const char *data, size_t data_size)
Deserialize an attestation.
size_t data_size
Number of bytes in data.
static int result
Global testing status.
size_t GNUNET_RECLAIM_ATTESTATION_serialize(const struct GNUNET_RECLAIM_ATTESTATION_Claim *attr, char *result)
Serialize an attestation.
struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry * prev
DLL.
char * GNUNET_RECLAIM_ATTESTATION_value_to_string(uint32_t type, const void *data, size_t data_size)
Convert the &#39;claim&#39; of an attestation to a string.
size_t GNUNET_RECLAIM_ATTRIBUTE_serialize_get_size(const struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr)
Get required size for serialization buffer.
const char * name
The name of 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 claim.
const char * name
The name of the attribute/attestation reference value.
A list of GNUNET_RECLAIM_ATTRIBUTE_Claim structures.
size_t GNUNET_RECLAIM_ATTRIBUTE_serialize(const struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr, char *result)
Serialize an attribute.
size_t GNUNET_RECLAIM_ATTESTATION_REF_serialize_get_size(const struct GNUNET_RECLAIM_ATTESTATION_REFERENCE *attr)
Get required size for serialization buffer.
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.
struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry * next
DLL.
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.
struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry * list_head
List head.
size_t GNUNET_RECLAIM_ATTRIBUTE_list_serialize_get_size(const struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs)
Get required size for serialization buffer.
struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList * GNUNET_RECLAIM_ATTRIBUTE_list_deserialize(const char *data, size_t data_size)
Deserialize an attribute list.
size_t GNUNET_RECLAIM_ATTRIBUTE_list_serialize(const struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs, char *result)
Serialize an attribute list.
struct GNUNET_RECLAIM_ATTRIBUTE_Claim * GNUNET_RECLAIM_ATTRIBUTE_deserialize(const char *data, size_t data_size)
Deserialize an attribute.
uint32_t GNUNET_RECLAIM_ATTESTATION_typename_to_number(const char *typename)
Convert an attestation type name to the corresponding number.
const void * data
Binary value stored as attribute value.