GNUnet 0.22.2
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;
84 plugin->library_name = GNUNET_strdup (library_name);
86}
87
88
92static void
94{
96 return;
99 "libgnunet_plugin_reclaim_credential_",
100 NULL,
101 &add_plugin,
102 NULL);
103}
104
105
106void
108
112void __attribute__ ((destructor))
114{
115 struct Plugin *plugin;
116
117 for (unsigned int i = 0; i < num_plugins; i++)
118 {
120 GNUNET_break (NULL ==
121 GNUNET_PLUGIN_unload (plugin->library_name,
122 plugin->api));
123 GNUNET_free (plugin->library_name);
125 }
127 credential_plugins = NULL;
128}
129
130
137uint32_t
139{
140 unsigned int i;
141 struct Plugin *plugin;
142 uint32_t ret;
143 init ();
144 for (i = 0; i < num_plugins; i++)
145 {
147 if (UINT32_MAX !=
148 (ret = plugin->api->typename_to_number (plugin->api->cls,
149 typename)))
150 return ret;
151 }
152 return UINT32_MAX;
153}
154
155
162const char *
164{
165 unsigned int i;
166 struct Plugin *plugin;
167 const char *ret;
168
169 init ();
170 for (i = 0; i < num_plugins; i++)
171 {
173 if (NULL !=
174 (ret = plugin->api->number_to_typename (plugin->api->cls, type)))
175 return ret;
176 }
177 return NULL;
178}
179
180
191int
193 const char *s,
194 void **data,
195 size_t *data_size)
196{
197 unsigned int i;
198 struct Plugin *plugin;
199
200 init ();
201 for (i = 0; i < num_plugins; i++)
202 {
204 if (GNUNET_OK == plugin->api->string_to_value (plugin->api->cls,
205 type,
206 s,
207 data,
208 data_size))
209 return GNUNET_OK;
210 }
211 return GNUNET_SYSERR;
212}
213
214
223char *
225 const void *data,
226 size_t data_size)
227{
228 unsigned int i;
229 struct Plugin *plugin;
230 char *ret;
231
232 init ();
233 for (i = 0; i < num_plugins; i++)
234 {
236 if (NULL != (ret = plugin->api->value_to_string (plugin->api->cls,
237 type,
238 data,
239 data_size)))
240 return ret;
241 }
242 return NULL;
243}
244
245
248 uint32_t type,
249 const void *data,
250 size_t data_size)
251{
252 struct GNUNET_RECLAIM_Credential *attr;
253 char *write_ptr;
254 char *attr_name_tmp = GNUNET_strdup (attr_name);
255
256 GNUNET_STRINGS_utf8_tolower (attr_name, attr_name_tmp);
257
258 attr = GNUNET_malloc (sizeof(struct GNUNET_RECLAIM_Credential)
259 + strlen (attr_name_tmp) + 1 + data_size);
260 attr->type = type;
261 attr->data_size = data_size;
262 attr->flag = 0;
263 write_ptr = (char *) &attr[1];
264 GNUNET_memcpy (write_ptr, attr_name_tmp, strlen (attr_name_tmp) + 1);
265 attr->name = write_ptr;
266 write_ptr += strlen (attr->name) + 1;
267 GNUNET_memcpy (write_ptr, data, data_size);
268 attr->data = write_ptr;
269 GNUNET_free (attr_name_tmp);
270 return attr;
271}
272
273
280size_t
282 const struct GNUNET_RECLAIM_CredentialList *credentials)
283{
285 size_t len = 0;
286
287 for (le = credentials->list_head; NULL != le; le = le->next)
288 {
289 GNUNET_assert (NULL != le->credential);
291 len += sizeof(struct GNUNET_RECLAIM_CredentialListEntry);
292 }
293 return len;
294}
295
296
297size_t
299 const struct GNUNET_RECLAIM_CredentialList *credentials,
300 char *result)
301{
303 size_t len;
304 size_t total_len;
305 char *write_ptr;
306 write_ptr = result;
307 total_len = 0;
308 for (le = credentials->list_head; NULL != le; le = le->next)
309 {
310 GNUNET_assert (NULL != le->credential);
311 len = GNUNET_RECLAIM_credential_serialize (le->credential, write_ptr);
312 total_len += len;
313 write_ptr += len;
314 }
315 return total_len;
316}
317
318
321{
324 size_t att_len;
325 const char *read_ptr;
326
328
329 if ((data_size < sizeof(struct
331 + sizeof(struct GNUNET_RECLAIM_CredentialListEntry)))
332 return al;
333
334 read_ptr = data;
335 while (((data + data_size) - read_ptr) >= sizeof(struct Credential))
336 {
338 ale->credential =
340 data_size - (read_ptr - data));
341 if (NULL == ale->credential)
342 {
344 "Failed to deserialize malformed credential.\n");
345 GNUNET_free (ale);
346 return al;
347 }
350 read_ptr += att_len;
351 }
352 return al;
353}
354
355
358 const struct GNUNET_RECLAIM_CredentialList *al)
359{
361 struct GNUNET_RECLAIM_CredentialListEntry *result_ale;
363
365 for (ale = al->list_head; NULL != ale; ale = ale->next)
366 {
368 GNUNET_assert (NULL != ale->credential);
369 result_ale->credential =
371 ale->credential->type,
372 ale->credential->data,
373 ale->credential->data_size);
374 result_ale->credential->id = ale->credential->id;
376 result->list_tail,
377 result_ale);
378 }
379 return result;
380}
381
382
383void
385 struct GNUNET_RECLAIM_CredentialList *credentials)
386{
389
390 for (ale = credentials->list_head; NULL != ale;)
391 {
392 if (NULL != ale->credential)
393 GNUNET_free (ale->credential);
394 tmp_ale = ale;
395 ale = ale->next;
396 GNUNET_free (tmp_ale);
397 }
398 GNUNET_free (credentials);
399}
400
401
408size_t
411{
412 return sizeof(struct Credential) + strlen (credential->name)
414}
415
416
417size_t
420 char *result)
421{
422 size_t data_len_ser;
423 size_t name_len;
424 struct Credential *atts;
425 char *write_ptr;
426
427 atts = (struct Credential *) result;
428 atts->credential_type = htonl (credential->type);
429 atts->credential_flag = htonl (credential->flag);
430 atts->credential_id = credential->id;
431 name_len = strlen (credential->name);
432 atts->name_len = htons (name_len);
433 write_ptr = (char *) &atts[1];
434 GNUNET_memcpy (write_ptr, credential->name, name_len);
435 write_ptr += name_len;
436 // TODO plugin-ize
437 // data_len_ser = plugin->serialize_attribute_value (attr,
438 // &attr_ser[1]);
439 data_len_ser = credential->data_size;
440 GNUNET_memcpy (write_ptr, credential->data, credential->data_size);
441 atts->data_size = htons (data_len_ser);
442
443 return sizeof(struct Credential) + strlen (credential->name)
445}
446
447
458{
460 struct Credential *atts;
461 size_t data_len;
462 size_t name_len;
463 char *write_ptr;
464
465 if (data_size < sizeof(struct Credential))
466 return NULL;
467
468 atts = (struct Credential *) data;
469 data_len = ntohs (atts->data_size);
470 name_len = ntohs (atts->name_len);
471 if (data_size < sizeof(struct Credential) + data_len + name_len)
472 {
474 "Buffer too small to deserialize\n");
475 return NULL;
476 }
478 + data_len + name_len + 1);
479 credential->type = ntohl (atts->credential_type);
480 credential->flag = ntohl (atts->credential_flag);
481 credential->id = atts->credential_id;
482 credential->data_size = data_len;
483
484 write_ptr = (char *) &credential[1];
485 GNUNET_memcpy (write_ptr, &atts[1], name_len);
486 write_ptr[name_len] = '\0';
487 credential->name = write_ptr;
488
489 write_ptr += name_len + 1;
490 GNUNET_memcpy (write_ptr, (char *) &atts[1] + name_len,
491 credential->data_size);
492 credential->data = write_ptr;
493 return credential;
494}
495
496
500{
501 unsigned int i;
502 struct Plugin *plugin;
504 init ();
505 for (i = 0; i < num_plugins; i++)
506 {
508 if (NULL !=
509 (ret = plugin->api->get_attributes (plugin->api->cls,
510 credential)))
511 return ret;
512 }
513 return NULL;
514}
515
516
517char*
520{
521 unsigned int i;
522 struct Plugin *plugin;
523 char *ret;
524 init ();
525 for (i = 0; i < num_plugins; i++)
526 {
528 if (NULL !=
529 (ret = plugin->api->get_issuer (plugin->api->cls,
530 credential)))
531 return ret;
532 }
533 return NULL;
534}
535
536
537int
540 struct GNUNET_TIME_Absolute*exp)
541{
542 unsigned int i;
543 struct Plugin *plugin;
544 init ();
545 for (i = 0; i < num_plugins; i++)
546 {
548 if (GNUNET_OK != plugin->api->get_expiration (plugin->api->cls,
550 exp))
551 continue;
552 return GNUNET_OK;
553 }
554 return GNUNET_SYSERR;
555}
556
557
558uint32_t
560{
561 unsigned int i;
562 struct Plugin *plugin;
563 uint32_t ret;
564 init ();
565 for (i = 0; i < num_plugins; i++)
566 {
568 if (UINT32_MAX !=
569 (ret = plugin->api->typename_to_number_p (plugin->api->cls,
570 typename)))
571 return ret;
572 }
573 return UINT32_MAX;
574}
575
576
577const char *
579{
580 unsigned int i;
581 struct Plugin *plugin;
582 const char *ret;
583
584 init ();
585 for (i = 0; i < num_plugins; i++)
586 {
588 if (NULL !=
589 (ret = plugin->api->number_to_typename_p (plugin->api->cls, type)))
590 return ret;
591 }
592 return NULL;
593}
594
595
606int
608 const char *s,
609 void **data,
610 size_t *data_size)
611{
612 unsigned int i;
613 struct Plugin *plugin;
614
615 init ();
616 for (i = 0; i < num_plugins; i++)
617 {
619 if (GNUNET_OK == plugin->api->string_to_value_p (plugin->api->cls,
620 type,
621 s,
622 data,
623 data_size))
624 return GNUNET_OK;
625 }
626 return GNUNET_SYSERR;
627}
628
629
638char *
640 const void *data,
641 size_t data_size)
642{
643 unsigned int i;
644 struct Plugin *plugin;
645 char *ret;
646
647 init ();
648 for (i = 0; i < num_plugins; i++)
649 {
651 if (NULL != (ret = plugin->api->value_to_string_p (plugin->api->cls,
652 type,
653 data,
654 data_size)))
655 return ret;
656 }
657 return NULL;
658}
659
660
663 const void *data,
664 size_t data_size)
665{
666 struct GNUNET_RECLAIM_Presentation *attr;
667 char *write_ptr;
668
669 attr = GNUNET_malloc (sizeof(struct GNUNET_RECLAIM_Presentation)
670 + data_size);
671 attr->type = type;
672 attr->data_size = data_size;
673 write_ptr = (char *) &attr[1];
674 GNUNET_memcpy (write_ptr, data, data_size);
675 attr->data = write_ptr;
676 return attr;
677}
678
679
686size_t
688 const struct GNUNET_RECLAIM_PresentationList *presentations)
689{
691 size_t len = 0;
692
693 for (le = presentations->list_head; NULL != le; le = le->next)
694 {
695 GNUNET_assert (NULL != le->presentation);
697 }
698 return len;
699}
700
701
702size_t
704 const struct GNUNET_RECLAIM_PresentationList *presentations,
705 char *result)
706{
708 size_t len;
709 size_t total_len;
710 char *write_ptr;
711 write_ptr = result;
712 total_len = 0;
713 for (le = presentations->list_head; NULL != le; le = le->next)
714 {
715 GNUNET_assert (NULL != le->presentation);
717 total_len += len;
718 write_ptr += len;
719 }
720 return total_len;
721}
722
723
733 data_size)
734{
737 size_t att_len;
738 const char *read_ptr;
739
741
742 if (data_size < sizeof(struct Presentation))
743 return al;
744
745 read_ptr = data;
746 while (((data + data_size) - read_ptr) >= sizeof(struct Presentation))
747 {
749 ale->presentation =
751 data_size - (read_ptr - data));
752 if (NULL == ale->presentation)
753 {
755 "Failed to deserialize malformed presentation.\n");
756 GNUNET_free (ale);
757 return al;
758 }
761 ale->presentation);
762 read_ptr += att_len;
763 }
764 return al;
765}
766
767
770 const struct GNUNET_RECLAIM_PresentationList *al)
771{
773 struct GNUNET_RECLAIM_PresentationListEntry *result_ale;
775
777 for (ale = al->list_head; NULL != ale; ale = ale->next)
778 {
780 GNUNET_assert (NULL != ale->presentation);
781 result_ale->presentation =
783 ale->presentation->data,
784 ale->presentation->data_size);
787 result->list_tail,
788 result_ale);
789 }
790 return result;
791}
792
793
794void
796 struct GNUNET_RECLAIM_PresentationList *presentations)
797{
800
801 for (ale = presentations->list_head; NULL != ale;)
802 {
803 if (NULL != ale->presentation)
805 tmp_ale = ale;
806 ale = ale->next;
807 GNUNET_free (tmp_ale);
808 }
809 GNUNET_free (presentations);
810}
811
812
819size_t
822{
823 return sizeof(struct Presentation) + presentation->data_size;
824}
825
826
827size_t
829 const struct GNUNET_RECLAIM_Presentation *presentation,
830 char *result)
831{
832 struct Presentation *atts;
833 char *write_ptr;
834
835 atts = (struct Presentation *) result;
836 atts->presentation_type = htonl (presentation->type);
837 atts->credential_id = presentation->credential_id;
838 write_ptr = (char *) &atts[1];
839 GNUNET_memcpy (write_ptr, presentation->data, presentation->data_size);
840 atts->data_size = htons (presentation->data_size);
841
842 return sizeof(struct Presentation) + presentation->data_size;
843}
844
845
856{
857 struct GNUNET_RECLAIM_Presentation *presentation;
858 struct Presentation *atts;
859 size_t data_len;
860 char *write_ptr;
861
862 if (data_size < sizeof(struct Presentation))
863 return NULL;
864
865 atts = (struct Presentation *) data;
866 data_len = ntohs (atts->data_size);
867 if (data_size < sizeof(struct Presentation) + data_len)
868 {
870 "Buffer too small to deserialize\n");
871 return NULL;
872 }
873 presentation = GNUNET_malloc (sizeof(struct GNUNET_RECLAIM_Presentation)
874 + data_len);
875 presentation->type = ntohl (atts->presentation_type);
876 presentation->credential_id = atts->credential_id;
877 presentation->data_size = data_len;
878
879 write_ptr = (char *) &presentation[1];
880 GNUNET_memcpy (write_ptr, &atts[1], data_len);
881 presentation->data = write_ptr;
882 return presentation;
883}
884
885
889 presentation)
890{
891 unsigned int i;
892 struct Plugin *plugin;
894 init ();
895 for (i = 0; i < num_plugins; i++)
896 {
898 if (NULL !=
899 (ret = plugin->api->get_attributes_p (plugin->api->cls,
900 presentation)))
901 return ret;
902 }
903 return NULL;
904}
905
906
907char*
910 presentation)
911{
912 unsigned int i;
913 struct Plugin *plugin;
914 char *ret;
915 init ();
916 for (i = 0; i < num_plugins; i++)
917 {
919 if (NULL !=
920 (ret = plugin->api->get_issuer_p (plugin->api->cls,
921 presentation)))
922 return ret;
923 }
924 return NULL;
925}
926
927
928int
931 presentation,
932 struct GNUNET_TIME_Absolute*exp)
933{
934 unsigned int i;
935 struct Plugin *plugin;
936 init ();
937 for (i = 0; i < num_plugins; i++)
938 {
940 if (GNUNET_OK != plugin->api->get_expiration_p (plugin->api->cls,
941 presentation,
942 exp))
943 continue;
944 return GNUNET_OK;
945 }
946 return GNUNET_SYSERR;
947}
948
949
960int
962 const struct GNUNET_RECLAIM_Credential *cred,
963 const struct GNUNET_RECLAIM_AttributeList *attrs,
964 struct GNUNET_RECLAIM_Presentation **presentation)
965{
966 unsigned int i;
967 struct Plugin *plugin;
968 init ();
969 for (i = 0; i < num_plugins; i++)
970 {
972 if (GNUNET_OK != plugin->api->create_presentation (plugin->api->cls,
973 cred,
974 attrs,
975 presentation))
976 continue;
977 (*presentation)->credential_id = cred->id;
978 return GNUNET_OK;
979 }
980 return GNUNET_SYSERR;
981}
static int ret
Final status code.
Definition: gnunet-arm.c:93
static struct GNUNET_TESTING_PluginFunctions * plugin
Plugin to dynamically load a test case.
static gnutls_certificate_credentials_t cred
The credential.
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_gnunet(void)
Return default project data used by 'libgnunetutil' for GNUnet.
void GNUNET_PLUGIN_load_all(const struct GNUNET_OS_ProjectData *pd, const char *basename, void *arg, GNUNET_PLUGIN_LoaderCallback cb, void *cb_cls)
Load all compatible plugins with the given base name.
Definition: plugin.c:401
void * GNUNET_PLUGIN_unload(const char *library_name, void *arg)
Unload plugin (runs the "done" callback and returns whatever "done" returned).
Definition: plugin.c:277
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.
uint32_t GNUNET_RECLAIM_presentation_typename_to_number(const char *typename)
Convert an presentation type name to the corresponding number.
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.
struct GNUNET_RECLAIM_PresentationList * GNUNET_RECLAIM_presentation_list_dup(const struct GNUNET_RECLAIM_PresentationList *al)
Make a (deep) copy of the presentation list.
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.
struct GNUNET_RECLAIM_CredentialList * GNUNET_RECLAIM_credential_list_dup(const struct GNUNET_RECLAIM_CredentialList *al)
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:459
static void add_plugin(void *cls, const char *library_name, void *lib_ret)
Add a plugin.
void RECLAIM_CREDENTIAL_fini(void)
static unsigned int num_plugins
Number of plugins.
static int initialized
Init canary.
void __attribute__((destructor))
Dual function to init().
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.
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.
void * cls
Closure to pass to start_testcase.
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.