GNUnet 0.21.1
reclaim_credential.c
Go to the documentation of this file.
1/*
2 This file is part of GNUnet
3 Copyright (C) 2010-2015 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
26#include "gnunet_util_lib.h"
28#include "reclaim_credential.h"
29
30
34struct Plugin
35{
39 char *library_name;
40
45};
46
47
51static struct Plugin **credential_plugins;
52
53
57static unsigned int num_plugins;
58
59
63static int initialized;
64
65
73static void
74add_plugin (void *cls, const char *library_name, void *lib_ret)
75{
76 struct GNUNET_RECLAIM_CredentialPluginFunctions *api = lib_ret;
77 struct Plugin *plugin;
78
80 "Loading credential plugin `%s'\n",
82 plugin = GNUNET_new (struct Plugin);
83 plugin->api = api;
86}
87
88
92static void
94{
96 return;
99 "libgnunet_plugin_reclaim_credential_",
100 NULL,
101 &add_plugin,
102 NULL);
103}
104
105
109void __attribute__ ((destructor))
110RECLAIM_CREDENTIAL_fini ()
111{
112 struct Plugin *plugin;
115
116 if (pd != dpd)
117 GNUNET_OS_init (dpd);
118
119 for (unsigned int i = 0; i < num_plugins; i++)
120 {
122 GNUNET_break (NULL ==
124 plugin->api));
127 }
129
130 if (pd != dpd)
131 GNUNET_OS_init (pd);
132
133 credential_plugins = NULL;
134}
135
136
143uint32_t
145{
146 unsigned int i;
147 struct Plugin *plugin;
148 uint32_t ret;
149 init ();
150 for (i = 0; i < num_plugins; i++)
151 {
153 if (UINT32_MAX !=
154 (ret = plugin->api->typename_to_number (plugin->api->cls,
155 typename)))
156 return ret;
157 }
158 return UINT32_MAX;
159}
160
161
168const char *
170{
171 unsigned int i;
172 struct Plugin *plugin;
173 const char *ret;
174
175 init ();
176 for (i = 0; i < num_plugins; i++)
177 {
179 if (NULL !=
180 (ret = plugin->api->number_to_typename (plugin->api->cls, type)))
181 return ret;
182 }
183 return NULL;
184}
185
186
197int
199 const char *s,
200 void **data,
201 size_t *data_size)
202{
203 unsigned int i;
204 struct Plugin *plugin;
205
206 init ();
207 for (i = 0; i < num_plugins; i++)
208 {
210 if (GNUNET_OK == plugin->api->string_to_value (plugin->api->cls,
211 type,
212 s,
213 data,
214 data_size))
215 return GNUNET_OK;
216 }
217 return GNUNET_SYSERR;
218}
219
220
229char *
231 const void *data,
232 size_t data_size)
233{
234 unsigned int i;
235 struct Plugin *plugin;
236 char *ret;
237
238 init ();
239 for (i = 0; i < num_plugins; i++)
240 {
242 if (NULL != (ret = plugin->api->value_to_string (plugin->api->cls,
243 type,
244 data,
245 data_size)))
246 return ret;
247 }
248 return NULL;
249}
250
251
254 uint32_t type,
255 const void *data,
256 size_t data_size)
257{
258 struct GNUNET_RECLAIM_Credential *attr;
259 char *write_ptr;
260 char *attr_name_tmp = GNUNET_strdup (attr_name);
261
262 GNUNET_STRINGS_utf8_tolower (attr_name, attr_name_tmp);
263
264 attr = GNUNET_malloc (sizeof(struct GNUNET_RECLAIM_Credential)
265 + strlen (attr_name_tmp) + 1 + data_size);
266 attr->type = type;
267 attr->data_size = data_size;
268 attr->flag = 0;
269 write_ptr = (char *) &attr[1];
270 GNUNET_memcpy (write_ptr, attr_name_tmp, strlen (attr_name_tmp) + 1);
271 attr->name = write_ptr;
272 write_ptr += strlen (attr->name) + 1;
273 GNUNET_memcpy (write_ptr, data, data_size);
274 attr->data = write_ptr;
275 GNUNET_free (attr_name_tmp);
276 return attr;
277}
278
279
286size_t
288 const struct GNUNET_RECLAIM_CredentialList *credentials)
289{
291 size_t len = 0;
292
293 for (le = credentials->list_head; NULL != le; le = le->next)
294 {
295 GNUNET_assert (NULL != le->credential);
297 len += sizeof(struct GNUNET_RECLAIM_CredentialListEntry);
298 }
299 return len;
300}
301
302
303size_t
305 const struct GNUNET_RECLAIM_CredentialList *credentials,
306 char *result)
307{
309 size_t len;
310 size_t total_len;
311 char *write_ptr;
312 write_ptr = result;
313 total_len = 0;
314 for (le = credentials->list_head; NULL != le; le = le->next)
315 {
316 GNUNET_assert (NULL != le->credential);
317 len = GNUNET_RECLAIM_credential_serialize (le->credential, write_ptr);
318 total_len += len;
319 write_ptr += len;
320 }
321 return total_len;
322}
323
324
327{
330 size_t att_len;
331 const char *read_ptr;
332
334
335 if ((data_size < sizeof(struct
337 + sizeof(struct GNUNET_RECLAIM_CredentialListEntry)))
338 return al;
339
340 read_ptr = data;
341 while (((data + data_size) - read_ptr) >= sizeof(struct Credential))
342 {
344 ale->credential =
346 data_size - (read_ptr - data));
347 if (NULL == ale->credential)
348 {
350 "Failed to deserialize malformed credential.\n");
351 GNUNET_free (ale);
352 return al;
353 }
356 read_ptr += att_len;
357 }
358 return al;
359}
360
361
369 const struct GNUNET_RECLAIM_CredentialList *al)
370{
372 struct GNUNET_RECLAIM_CredentialListEntry *result_ale;
374
376 for (ale = al->list_head; NULL != ale; ale = ale->next)
377 {
379 GNUNET_assert (NULL != ale->credential);
380 result_ale->credential =
382 ale->credential->type,
383 ale->credential->data,
384 ale->credential->data_size);
385 result_ale->credential->id = ale->credential->id;
387 result->list_tail,
388 result_ale);
389 }
390 return result;
391}
392
393
394void
396 struct GNUNET_RECLAIM_CredentialList *credentials)
397{
400
401 for (ale = credentials->list_head; NULL != ale;)
402 {
403 if (NULL != ale->credential)
404 GNUNET_free (ale->credential);
405 tmp_ale = ale;
406 ale = ale->next;
407 GNUNET_free (tmp_ale);
408 }
409 GNUNET_free (credentials);
410}
411
412
419size_t
422{
423 return sizeof(struct Credential) + strlen (credential->name)
425}
426
427
428size_t
431 char *result)
432{
433 size_t data_len_ser;
434 size_t name_len;
435 struct Credential *atts;
436 char *write_ptr;
437
438 atts = (struct Credential *) result;
439 atts->credential_type = htonl (credential->type);
440 atts->credential_flag = htonl (credential->flag);
441 atts->credential_id = credential->id;
442 name_len = strlen (credential->name);
443 atts->name_len = htons (name_len);
444 write_ptr = (char *) &atts[1];
445 GNUNET_memcpy (write_ptr, credential->name, name_len);
446 write_ptr += name_len;
447 // TODO plugin-ize
448 // data_len_ser = plugin->serialize_attribute_value (attr,
449 // &attr_ser[1]);
450 data_len_ser = credential->data_size;
451 GNUNET_memcpy (write_ptr, credential->data, credential->data_size);
452 atts->data_size = htons (data_len_ser);
453
454 return sizeof(struct Credential) + strlen (credential->name)
456}
457
458
469{
471 struct Credential *atts;
472 size_t data_len;
473 size_t name_len;
474 char *write_ptr;
475
476 if (data_size < sizeof(struct Credential))
477 return NULL;
478
479 atts = (struct Credential *) data;
480 data_len = ntohs (atts->data_size);
481 name_len = ntohs (atts->name_len);
482 if (data_size < sizeof(struct Credential) + data_len + name_len)
483 {
485 "Buffer too small to deserialize\n");
486 return NULL;
487 }
489 + data_len + name_len + 1);
490 credential->type = ntohl (atts->credential_type);
491 credential->flag = ntohl (atts->credential_flag);
492 credential->id = atts->credential_id;
493 credential->data_size = data_len;
494
495 write_ptr = (char *) &credential[1];
496 GNUNET_memcpy (write_ptr, &atts[1], name_len);
497 write_ptr[name_len] = '\0';
498 credential->name = write_ptr;
499
500 write_ptr += name_len + 1;
501 GNUNET_memcpy (write_ptr, (char *) &atts[1] + name_len,
502 credential->data_size);
503 credential->data = write_ptr;
504 return credential;
505}
506
507
511{
512 unsigned int i;
513 struct Plugin *plugin;
515 init ();
516 for (i = 0; i < num_plugins; i++)
517 {
519 if (NULL !=
520 (ret = plugin->api->get_attributes (plugin->api->cls,
521 credential)))
522 return ret;
523 }
524 return NULL;
525}
526
527
528char*
531{
532 unsigned int i;
533 struct Plugin *plugin;
534 char *ret;
535 init ();
536 for (i = 0; i < num_plugins; i++)
537 {
539 if (NULL !=
540 (ret = plugin->api->get_issuer (plugin->api->cls,
541 credential)))
542 return ret;
543 }
544 return NULL;
545}
546
547
548int
551 struct GNUNET_TIME_Absolute*exp)
552{
553 unsigned int i;
554 struct Plugin *plugin;
555 init ();
556 for (i = 0; i < num_plugins; i++)
557 {
559 if (GNUNET_OK != plugin->api->get_expiration (plugin->api->cls,
561 exp))
562 continue;
563 return GNUNET_OK;
564 }
565 return GNUNET_SYSERR;
566}
567
568
575uint32_t
577{
578 unsigned int i;
579 struct Plugin *plugin;
580 uint32_t ret;
581 init ();
582 for (i = 0; i < num_plugins; i++)
583 {
585 if (UINT32_MAX !=
586 (ret = plugin->api->typename_to_number_p (plugin->api->cls,
587 typename)))
588 return ret;
589 }
590 return UINT32_MAX;
591}
592
593
594const char *
596{
597 unsigned int i;
598 struct Plugin *plugin;
599 const char *ret;
600
601 init ();
602 for (i = 0; i < num_plugins; i++)
603 {
605 if (NULL !=
606 (ret = plugin->api->number_to_typename_p (plugin->api->cls, type)))
607 return ret;
608 }
609 return NULL;
610}
611
612
623int
625 const char *s,
626 void **data,
627 size_t *data_size)
628{
629 unsigned int i;
630 struct Plugin *plugin;
631
632 init ();
633 for (i = 0; i < num_plugins; i++)
634 {
636 if (GNUNET_OK == plugin->api->string_to_value_p (plugin->api->cls,
637 type,
638 s,
639 data,
640 data_size))
641 return GNUNET_OK;
642 }
643 return GNUNET_SYSERR;
644}
645
646
655char *
657 const void *data,
658 size_t data_size)
659{
660 unsigned int i;
661 struct Plugin *plugin;
662 char *ret;
663
664 init ();
665 for (i = 0; i < num_plugins; i++)
666 {
668 if (NULL != (ret = plugin->api->value_to_string_p (plugin->api->cls,
669 type,
670 data,
671 data_size)))
672 return ret;
673 }
674 return NULL;
675}
676
677
680 const void *data,
681 size_t data_size)
682{
683 struct GNUNET_RECLAIM_Presentation *attr;
684 char *write_ptr;
685
686 attr = GNUNET_malloc (sizeof(struct GNUNET_RECLAIM_Presentation)
687 + data_size);
688 attr->type = type;
689 attr->data_size = data_size;
690 write_ptr = (char *) &attr[1];
691 GNUNET_memcpy (write_ptr, data, data_size);
692 attr->data = write_ptr;
693 return attr;
694}
695
696
703size_t
705 const struct GNUNET_RECLAIM_PresentationList *presentations)
706{
708 size_t len = 0;
709
710 for (le = presentations->list_head; NULL != le; le = le->next)
711 {
712 GNUNET_assert (NULL != le->presentation);
714 }
715 return len;
716}
717
718
719size_t
721 const struct GNUNET_RECLAIM_PresentationList *presentations,
722 char *result)
723{
725 size_t len;
726 size_t total_len;
727 char *write_ptr;
728 write_ptr = result;
729 total_len = 0;
730 for (le = presentations->list_head; NULL != le; le = le->next)
731 {
732 GNUNET_assert (NULL != le->presentation);
734 total_len += len;
735 write_ptr += len;
736 }
737 return total_len;
738}
739
740
750 data_size)
751{
754 size_t att_len;
755 const char *read_ptr;
756
758
759 if (data_size < sizeof(struct Presentation))
760 return al;
761
762 read_ptr = data;
763 while (((data + data_size) - read_ptr) >= sizeof(struct Presentation))
764 {
766 ale->presentation =
768 data_size - (read_ptr - data));
769 if (NULL == ale->presentation)
770 {
772 "Failed to deserialize malformed presentation.\n");
773 GNUNET_free (ale);
774 return al;
775 }
778 ale->presentation);
779 read_ptr += att_len;
780 }
781 return al;
782}
783
784
792 const struct GNUNET_RECLAIM_PresentationList *al)
793{
795 struct GNUNET_RECLAIM_PresentationListEntry *result_ale;
797
799 for (ale = al->list_head; NULL != ale; ale = ale->next)
800 {
802 GNUNET_assert (NULL != ale->presentation);
803 result_ale->presentation =
805 ale->presentation->data,
806 ale->presentation->data_size);
809 result->list_tail,
810 result_ale);
811 }
812 return result;
813}
814
815
816void
818 struct GNUNET_RECLAIM_PresentationList *presentations)
819{
822
823 for (ale = presentations->list_head; NULL != ale;)
824 {
825 if (NULL != ale->presentation)
827 tmp_ale = ale;
828 ale = ale->next;
829 GNUNET_free (tmp_ale);
830 }
831 GNUNET_free (presentations);
832}
833
834
841size_t
844{
845 return sizeof(struct Presentation) + presentation->data_size;
846}
847
848
849size_t
851 const struct GNUNET_RECLAIM_Presentation *presentation,
852 char *result)
853{
854 struct Presentation *atts;
855 char *write_ptr;
856
857 atts = (struct Presentation *) result;
858 atts->presentation_type = htonl (presentation->type);
859 atts->credential_id = presentation->credential_id;
860 write_ptr = (char *) &atts[1];
861 GNUNET_memcpy (write_ptr, presentation->data, presentation->data_size);
862 atts->data_size = htons (presentation->data_size);
863
864 return sizeof(struct Presentation) + presentation->data_size;
865}
866
867
878{
879 struct GNUNET_RECLAIM_Presentation *presentation;
880 struct Presentation *atts;
881 size_t data_len;
882 char *write_ptr;
883
884 if (data_size < sizeof(struct Presentation))
885 return NULL;
886
887 atts = (struct Presentation *) data;
888 data_len = ntohs (atts->data_size);
889 if (data_size < sizeof(struct Presentation) + data_len)
890 {
892 "Buffer too small to deserialize\n");
893 return NULL;
894 }
895 presentation = GNUNET_malloc (sizeof(struct GNUNET_RECLAIM_Presentation)
896 + data_len);
897 presentation->type = ntohl (atts->presentation_type);
898 presentation->credential_id = atts->credential_id;
899 presentation->data_size = data_len;
900
901 write_ptr = (char *) &presentation[1];
902 GNUNET_memcpy (write_ptr, &atts[1], data_len);
903 presentation->data = write_ptr;
904 return presentation;
905}
906
907
911 presentation)
912{
913 unsigned int i;
914 struct Plugin *plugin;
916 init ();
917 for (i = 0; i < num_plugins; i++)
918 {
920 if (NULL !=
921 (ret = plugin->api->get_attributes_p (plugin->api->cls,
922 presentation)))
923 return ret;
924 }
925 return NULL;
926}
927
928
929char*
932 presentation)
933{
934 unsigned int i;
935 struct Plugin *plugin;
936 char *ret;
937 init ();
938 for (i = 0; i < num_plugins; i++)
939 {
941 if (NULL !=
942 (ret = plugin->api->get_issuer_p (plugin->api->cls,
943 presentation)))
944 return ret;
945 }
946 return NULL;
947}
948
949
950int
953 presentation,
954 struct GNUNET_TIME_Absolute*exp)
955{
956 unsigned int i;
957 struct Plugin *plugin;
958 init ();
959 for (i = 0; i < num_plugins; i++)
960 {
962 if (GNUNET_OK != plugin->api->get_expiration_p (plugin->api->cls,
963 presentation,
964 exp))
965 continue;
966 return GNUNET_OK;
967 }
968 return GNUNET_SYSERR;
969}
970
971
982int
984 const struct GNUNET_RECLAIM_Credential *cred,
985 const struct GNUNET_RECLAIM_AttributeList *attrs,
986 struct GNUNET_RECLAIM_Presentation **presentation)
987{
988 unsigned int i;
989 struct Plugin *plugin;
990 init ();
991 for (i = 0; i < num_plugins; i++)
992 {
994 if (GNUNET_OK != plugin->api->create_presentation (plugin->api->cls,
995 cred,
996 attrs,
997 presentation))
998 continue;
999 (*presentation)->credential_id = cred->id;
1000 return GNUNET_OK;
1001 }
1002 return GNUNET_SYSERR;
1003}
static int ret
Final status code.
Definition: gnunet-arm.c:94
struct TestcasePlugin * plugin
The process handle to the testbed service.
static char * data
The data to insert into the dht.
static char * name
Name (label) of the records to list.
static uint32_t type
Type string converted to DNS type value.
static size_t data_size
Number of bytes in data.
static char * attr_name
The attribute.
static struct GNUNET_RECLAIM_Identifier credential
Credential ID.
static int result
Global testing status.
Plugin API for reclaim attribute types.
#define GNUNET_CONTAINER_DLL_insert(head, tail, element)
Insert an element at the head of a DLL.
#define GNUNET_log(kind,...)
#define GNUNET_memcpy(dst, src, n)
Call memcpy() but check for n being 0 first.
@ GNUNET_OK
@ GNUNET_YES
@ GNUNET_SYSERR
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur.
@ GNUNET_ERROR_TYPE_WARNING
@ GNUNET_ERROR_TYPE_ERROR
@ GNUNET_ERROR_TYPE_DEBUG
#define GNUNET_strdup(a)
Wrapper around GNUNET_xstrdup_.
#define GNUNET_new(type)
Allocate a struct or union of the given type.
#define GNUNET_malloc(size)
Wrapper around malloc.
#define GNUNET_array_append(arr, len, element)
Append an element to an array (growing the array by one).
#define GNUNET_free(ptr)
Wrapper around free.
const struct GNUNET_OS_ProjectData * GNUNET_OS_project_data_default(void)
Return default project data used by 'libgnunetutil' for GNUnet.
void GNUNET_OS_init(const struct GNUNET_OS_ProjectData *pd)
Setup OS subsystem with project data.
const struct GNUNET_OS_ProjectData * GNUNET_OS_project_data_get(void)
void GNUNET_PLUGIN_load_all_in_context(const struct GNUNET_OS_ProjectData *ctx, const char *basename, void *arg, GNUNET_PLUGIN_LoaderCallback cb, void *cb_cls)
Load all compatible plugins with the given base name while inside the given context (i....
Definition: plugin.c:386
void * GNUNET_PLUGIN_unload(const char *library_name, void *arg)
Unload plugin (runs the "done" callback and returns whatever "done" returned).
Definition: plugin.c:242
struct GNUNET_RECLAIM_Presentation * GNUNET_RECLAIM_presentation_new(uint32_t type, const void *data, size_t data_size)
int GNUNET_RECLAIM_credential_string_to_value(uint32_t type, const char *s, void **data, size_t *data_size)
Convert human-readable version of a 'claim' of an credential to the binary representation.
char * GNUNET_RECLAIM_presentation_get_issuer(const struct GNUNET_RECLAIM_Presentation *presentation)
struct GNUNET_RECLAIM_Presentation * GNUNET_RECLAIM_presentation_deserialize(const char *data, size_t data_size)
Deserialize an presentation.
void GNUNET_RECLAIM_credential_list_destroy(struct GNUNET_RECLAIM_CredentialList *credentials)
Destroy credential list.
struct GNUNET_RECLAIM_PresentationList * GNUNET_RECLAIM_presentation_list_deserialize(const char *data, size_t data_size)
Deserialize an presentation list.
char * GNUNET_RECLAIM_credential_get_issuer(const struct GNUNET_RECLAIM_Credential *credential)
size_t GNUNET_RECLAIM_presentation_serialize_get_size(const struct GNUNET_RECLAIM_Presentation *presentation)
Get required size for serialization buffer.
int GNUNET_RECLAIM_credential_get_presentation(const struct GNUNET_RECLAIM_Credential *cred, const struct GNUNET_RECLAIM_AttributeList *attrs, struct GNUNET_RECLAIM_Presentation **presentation)
Create a presentation from a credential and a lift of (selected) attributes in the credential.
char * GNUNET_RECLAIM_credential_value_to_string(uint32_t type, const void *data, size_t data_size)
Convert the 'claim' of an credential to a string.
const char * GNUNET_RECLAIM_credential_number_to_typename(uint32_t type)
Convert an credential type number to the corresponding credential type string.
size_t GNUNET_RECLAIM_presentation_serialize(const struct GNUNET_RECLAIM_Presentation *presentation, char *result)
Serialize a presentation.
struct GNUNET_RECLAIM_AttributeList * GNUNET_RECLAIM_presentation_get_attributes(const struct GNUNET_RECLAIM_Presentation *presentation)
size_t GNUNET_RECLAIM_credential_list_serialize_get_size(const struct GNUNET_RECLAIM_CredentialList *credentials)
Get required size for serialization buffer.
struct GNUNET_RECLAIM_AttributeList * GNUNET_RECLAIM_credential_get_attributes(const struct GNUNET_RECLAIM_Credential *credential)
Convert an credential type name to the corresponding number.
void GNUNET_RECLAIM_presentation_list_destroy(struct GNUNET_RECLAIM_PresentationList *presentations)
Destroy presentations list.
int GNUNET_RECLAIM_presentation_get_expiration(const struct GNUNET_RECLAIM_Presentation *presentation, struct GNUNET_TIME_Absolute *exp)
size_t GNUNET_RECLAIM_credential_list_serialize(const struct GNUNET_RECLAIM_CredentialList *credentials, char *result)
Serialize a credential list.
int GNUNET_RECLAIM_credential_get_expiration(const struct GNUNET_RECLAIM_Credential *credential, struct GNUNET_TIME_Absolute *exp)
const char * GNUNET_RECLAIM_presentation_number_to_typename(uint32_t type)
Convert a presentation type number to the corresponding credential type string.
uint32_t GNUNET_RECLAIM_credential_typename_to_number(const char *typename)
Convert an credential type name to the corresponding number.
size_t GNUNET_RECLAIM_presentation_list_serialize(const struct GNUNET_RECLAIM_PresentationList *presentations, char *result)
Serialize a presentation list.
size_t GNUNET_RECLAIM_credential_serialize(const struct GNUNET_RECLAIM_Credential *credential, char *result)
Serialize an credential.
int GNUNET_RECLAIM_presentation_string_to_value(uint32_t type, const char *s, void **data, size_t *data_size)
Convert human-readable version of a 'claim' of an presentation to the binary representation.
struct GNUNET_RECLAIM_CredentialList * GNUNET_RECLAIM_credential_list_deserialize(const char *data, size_t data_size)
Deserialize an attribute list.
struct GNUNET_RECLAIM_Credential * GNUNET_RECLAIM_credential_deserialize(const char *data, size_t data_size)
Deserialize an credential.
size_t GNUNET_RECLAIM_presentation_list_serialize_get_size(const struct GNUNET_RECLAIM_PresentationList *presentations)
Get required size for serialization buffer.
char * GNUNET_RECLAIM_presentation_value_to_string(uint32_t type, const void *data, size_t data_size)
Convert the 'claim' of an presentation to a string.
struct GNUNET_RECLAIM_Credential * GNUNET_RECLAIM_credential_new(const char *attr_name, uint32_t type, const void *data, size_t data_size)
Create a new credential.
size_t GNUNET_RECLAIM_credential_serialize_get_size(const struct GNUNET_RECLAIM_Credential *credential)
Get required size for serialization buffer.
enum GNUNET_GenericReturnValue GNUNET_STRINGS_utf8_tolower(const char *input, char *output)
Convert the utf-8 input string to lower case.
Definition: strings.c:450
static void add_plugin(void *cls, const char *library_name, void *lib_ret)
Add a plugin.
uint32_t GNUNET_RECLAIM_presentation_typename_to_number(const char *typename)
Convert an presentation type name to the corresponding number.
static unsigned int num_plugins
Number of plugins.
struct GNUNET_RECLAIM_PresentationList * GNUNET_RECLAIM_presentation_list_dup(const struct GNUNET_RECLAIM_PresentationList *al)
Make a (deep) copy of the presentation list.
static int initialized
Init canary.
void __attribute__((destructor))
Dual function to init().
struct GNUNET_RECLAIM_CredentialList * GNUNET_RECLAIM_credential_list_dup(const struct GNUNET_RECLAIM_CredentialList *al)
Make a (deep) copy of the credential list.
static void init()
Load plugins.
static struct Plugin ** credential_plugins
Plugins.
GNUnet reclaim identity attribute credentials.
Serialized credential claim.
uint16_t name_len
Name length.
struct GNUNET_RECLAIM_Identifier credential_id
Credential ID.
uint32_t credential_type
Credential type.
uint32_t credential_flag
Credential flag.
uint16_t data_size
Data size.
Project-specific data used to help the OS subsystem find installation paths.
A list of GNUNET_RECLAIM_Attribute structures.
struct GNUNET_RECLAIM_CredentialListEntry * next
DLL.
struct GNUNET_RECLAIM_Credential * credential
The credential.
A list of GNUNET_RECLAIM_Credential structures.
struct GNUNET_RECLAIM_CredentialListEntry * list_head
List head.
struct GNUNET_RECLAIM_CredentialListEntry * list_tail
List tail.
Each plugin is required to return a pointer to a struct of this type as the return value from its ent...
uint32_t type
Type/Format of Claim.
const char * name
The name of the credential.
const void * data
Binary value stored as credential value.
size_t data_size
Number of bytes in data.
struct GNUNET_RECLAIM_Identifier id
ID.
struct GNUNET_RECLAIM_Presentation * presentation
The credential.
struct GNUNET_RECLAIM_PresentationListEntry * next
DLL.
A list of GNUNET_RECLAIM_Presentation structures.
struct GNUNET_RECLAIM_PresentationListEntry * list_head
List head.
struct GNUNET_RECLAIM_PresentationListEntry * list_tail
List tail.
A credential presentation.
const void * data
Binary value stored as presentation value.
uint32_t type
Type/Format of Claim.
size_t data_size
Number of bytes in data.
struct GNUNET_RECLAIM_Identifier credential_id
The credential id of which this is a presentation.
Time for absolute times used by GNUnet, in microseconds.
Handle for a plugin.
Definition: block.c:38
struct GNUNET_BLOCK_PluginFunctions * api
Plugin API.
Definition: block.c:47
struct GNUNET_RECLAIM_CredentialPluginFunctions * api
Plugin API.
char * library_name
Name of the shared library.
Definition: block.c:42
Serialized presentation claim.
struct GNUNET_RECLAIM_Identifier credential_id
Credential ID.
uint16_t data_size
Data size.
uint32_t presentation_type
Presentation type.
char * library_name
Name of the shared library.
Definition: testing.h:98
struct GNUNET_TESTING_PluginFunctions * api
Plugin API.
Definition: testing.h:103