GNUnet 0.22.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;
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;
118
119 if (pd != dpd)
120 GNUNET_OS_init (dpd);
121
122 for (unsigned int i = 0; i < num_plugins; i++)
123 {
125 GNUNET_break (NULL ==
126 GNUNET_PLUGIN_unload (plugin->library_name,
127 plugin->api));
128 GNUNET_free (plugin->library_name);
130 }
132
133 if (pd != dpd)
134 GNUNET_OS_init (pd);
135
136 credential_plugins = NULL;
137}
138
139
146uint32_t
148{
149 unsigned int i;
150 struct Plugin *plugin;
151 uint32_t ret;
152 init ();
153 for (i = 0; i < num_plugins; i++)
154 {
156 if (UINT32_MAX !=
157 (ret = plugin->api->typename_to_number (plugin->api->cls,
158 typename)))
159 return ret;
160 }
161 return UINT32_MAX;
162}
163
164
171const char *
173{
174 unsigned int i;
175 struct Plugin *plugin;
176 const char *ret;
177
178 init ();
179 for (i = 0; i < num_plugins; i++)
180 {
182 if (NULL !=
183 (ret = plugin->api->number_to_typename (plugin->api->cls, type)))
184 return ret;
185 }
186 return NULL;
187}
188
189
200int
202 const char *s,
203 void **data,
204 size_t *data_size)
205{
206 unsigned int i;
207 struct Plugin *plugin;
208
209 init ();
210 for (i = 0; i < num_plugins; i++)
211 {
213 if (GNUNET_OK == plugin->api->string_to_value (plugin->api->cls,
214 type,
215 s,
216 data,
217 data_size))
218 return GNUNET_OK;
219 }
220 return GNUNET_SYSERR;
221}
222
223
232char *
234 const void *data,
235 size_t data_size)
236{
237 unsigned int i;
238 struct Plugin *plugin;
239 char *ret;
240
241 init ();
242 for (i = 0; i < num_plugins; i++)
243 {
245 if (NULL != (ret = plugin->api->value_to_string (plugin->api->cls,
246 type,
247 data,
248 data_size)))
249 return ret;
250 }
251 return NULL;
252}
253
254
257 uint32_t type,
258 const void *data,
259 size_t data_size)
260{
261 struct GNUNET_RECLAIM_Credential *attr;
262 char *write_ptr;
263 char *attr_name_tmp = GNUNET_strdup (attr_name);
264
265 GNUNET_STRINGS_utf8_tolower (attr_name, attr_name_tmp);
266
267 attr = GNUNET_malloc (sizeof(struct GNUNET_RECLAIM_Credential)
268 + strlen (attr_name_tmp) + 1 + data_size);
269 attr->type = type;
270 attr->data_size = data_size;
271 attr->flag = 0;
272 write_ptr = (char *) &attr[1];
273 GNUNET_memcpy (write_ptr, attr_name_tmp, strlen (attr_name_tmp) + 1);
274 attr->name = write_ptr;
275 write_ptr += strlen (attr->name) + 1;
276 GNUNET_memcpy (write_ptr, data, data_size);
277 attr->data = write_ptr;
278 GNUNET_free (attr_name_tmp);
279 return attr;
280}
281
282
289size_t
291 const struct GNUNET_RECLAIM_CredentialList *credentials)
292{
294 size_t len = 0;
295
296 for (le = credentials->list_head; NULL != le; le = le->next)
297 {
298 GNUNET_assert (NULL != le->credential);
300 len += sizeof(struct GNUNET_RECLAIM_CredentialListEntry);
301 }
302 return len;
303}
304
305
306size_t
308 const struct GNUNET_RECLAIM_CredentialList *credentials,
309 char *result)
310{
312 size_t len;
313 size_t total_len;
314 char *write_ptr;
315 write_ptr = result;
316 total_len = 0;
317 for (le = credentials->list_head; NULL != le; le = le->next)
318 {
319 GNUNET_assert (NULL != le->credential);
320 len = GNUNET_RECLAIM_credential_serialize (le->credential, write_ptr);
321 total_len += len;
322 write_ptr += len;
323 }
324 return total_len;
325}
326
327
330{
333 size_t att_len;
334 const char *read_ptr;
335
337
338 if ((data_size < sizeof(struct
340 + sizeof(struct GNUNET_RECLAIM_CredentialListEntry)))
341 return al;
342
343 read_ptr = data;
344 while (((data + data_size) - read_ptr) >= sizeof(struct Credential))
345 {
347 ale->credential =
349 data_size - (read_ptr - data));
350 if (NULL == ale->credential)
351 {
353 "Failed to deserialize malformed credential.\n");
354 GNUNET_free (ale);
355 return al;
356 }
359 read_ptr += att_len;
360 }
361 return al;
362}
363
364
367 const struct GNUNET_RECLAIM_CredentialList *al)
368{
370 struct GNUNET_RECLAIM_CredentialListEntry *result_ale;
372
374 for (ale = al->list_head; NULL != ale; ale = ale->next)
375 {
377 GNUNET_assert (NULL != ale->credential);
378 result_ale->credential =
380 ale->credential->type,
381 ale->credential->data,
382 ale->credential->data_size);
383 result_ale->credential->id = ale->credential->id;
385 result->list_tail,
386 result_ale);
387 }
388 return result;
389}
390
391
392void
394 struct GNUNET_RECLAIM_CredentialList *credentials)
395{
398
399 for (ale = credentials->list_head; NULL != ale;)
400 {
401 if (NULL != ale->credential)
402 GNUNET_free (ale->credential);
403 tmp_ale = ale;
404 ale = ale->next;
405 GNUNET_free (tmp_ale);
406 }
407 GNUNET_free (credentials);
408}
409
410
417size_t
420{
421 return sizeof(struct Credential) + strlen (credential->name)
423}
424
425
426size_t
429 char *result)
430{
431 size_t data_len_ser;
432 size_t name_len;
433 struct Credential *atts;
434 char *write_ptr;
435
436 atts = (struct Credential *) result;
437 atts->credential_type = htonl (credential->type);
438 atts->credential_flag = htonl (credential->flag);
439 atts->credential_id = credential->id;
440 name_len = strlen (credential->name);
441 atts->name_len = htons (name_len);
442 write_ptr = (char *) &atts[1];
443 GNUNET_memcpy (write_ptr, credential->name, name_len);
444 write_ptr += name_len;
445 // TODO plugin-ize
446 // data_len_ser = plugin->serialize_attribute_value (attr,
447 // &attr_ser[1]);
448 data_len_ser = credential->data_size;
449 GNUNET_memcpy (write_ptr, credential->data, credential->data_size);
450 atts->data_size = htons (data_len_ser);
451
452 return sizeof(struct Credential) + strlen (credential->name)
454}
455
456
467{
469 struct Credential *atts;
470 size_t data_len;
471 size_t name_len;
472 char *write_ptr;
473
474 if (data_size < sizeof(struct Credential))
475 return NULL;
476
477 atts = (struct Credential *) data;
478 data_len = ntohs (atts->data_size);
479 name_len = ntohs (atts->name_len);
480 if (data_size < sizeof(struct Credential) + data_len + name_len)
481 {
483 "Buffer too small to deserialize\n");
484 return NULL;
485 }
487 + data_len + name_len + 1);
488 credential->type = ntohl (atts->credential_type);
489 credential->flag = ntohl (atts->credential_flag);
490 credential->id = atts->credential_id;
491 credential->data_size = data_len;
492
493 write_ptr = (char *) &credential[1];
494 GNUNET_memcpy (write_ptr, &atts[1], name_len);
495 write_ptr[name_len] = '\0';
496 credential->name = write_ptr;
497
498 write_ptr += name_len + 1;
499 GNUNET_memcpy (write_ptr, (char *) &atts[1] + name_len,
500 credential->data_size);
501 credential->data = write_ptr;
502 return credential;
503}
504
505
509{
510 unsigned int i;
511 struct Plugin *plugin;
513 init ();
514 for (i = 0; i < num_plugins; i++)
515 {
517 if (NULL !=
518 (ret = plugin->api->get_attributes (plugin->api->cls,
519 credential)))
520 return ret;
521 }
522 return NULL;
523}
524
525
526char*
529{
530 unsigned int i;
531 struct Plugin *plugin;
532 char *ret;
533 init ();
534 for (i = 0; i < num_plugins; i++)
535 {
537 if (NULL !=
538 (ret = plugin->api->get_issuer (plugin->api->cls,
539 credential)))
540 return ret;
541 }
542 return NULL;
543}
544
545
546int
549 struct GNUNET_TIME_Absolute*exp)
550{
551 unsigned int i;
552 struct Plugin *plugin;
553 init ();
554 for (i = 0; i < num_plugins; i++)
555 {
557 if (GNUNET_OK != plugin->api->get_expiration (plugin->api->cls,
559 exp))
560 continue;
561 return GNUNET_OK;
562 }
563 return GNUNET_SYSERR;
564}
565
566
567uint32_t
569{
570 unsigned int i;
571 struct Plugin *plugin;
572 uint32_t ret;
573 init ();
574 for (i = 0; i < num_plugins; i++)
575 {
577 if (UINT32_MAX !=
578 (ret = plugin->api->typename_to_number_p (plugin->api->cls,
579 typename)))
580 return ret;
581 }
582 return UINT32_MAX;
583}
584
585
586const char *
588{
589 unsigned int i;
590 struct Plugin *plugin;
591 const char *ret;
592
593 init ();
594 for (i = 0; i < num_plugins; i++)
595 {
597 if (NULL !=
598 (ret = plugin->api->number_to_typename_p (plugin->api->cls, type)))
599 return ret;
600 }
601 return NULL;
602}
603
604
615int
617 const char *s,
618 void **data,
619 size_t *data_size)
620{
621 unsigned int i;
622 struct Plugin *plugin;
623
624 init ();
625 for (i = 0; i < num_plugins; i++)
626 {
628 if (GNUNET_OK == plugin->api->string_to_value_p (plugin->api->cls,
629 type,
630 s,
631 data,
632 data_size))
633 return GNUNET_OK;
634 }
635 return GNUNET_SYSERR;
636}
637
638
647char *
649 const void *data,
650 size_t data_size)
651{
652 unsigned int i;
653 struct Plugin *plugin;
654 char *ret;
655
656 init ();
657 for (i = 0; i < num_plugins; i++)
658 {
660 if (NULL != (ret = plugin->api->value_to_string_p (plugin->api->cls,
661 type,
662 data,
663 data_size)))
664 return ret;
665 }
666 return NULL;
667}
668
669
672 const void *data,
673 size_t data_size)
674{
675 struct GNUNET_RECLAIM_Presentation *attr;
676 char *write_ptr;
677
678 attr = GNUNET_malloc (sizeof(struct GNUNET_RECLAIM_Presentation)
679 + data_size);
680 attr->type = type;
681 attr->data_size = data_size;
682 write_ptr = (char *) &attr[1];
683 GNUNET_memcpy (write_ptr, data, data_size);
684 attr->data = write_ptr;
685 return attr;
686}
687
688
695size_t
697 const struct GNUNET_RECLAIM_PresentationList *presentations)
698{
700 size_t len = 0;
701
702 for (le = presentations->list_head; NULL != le; le = le->next)
703 {
704 GNUNET_assert (NULL != le->presentation);
706 }
707 return len;
708}
709
710
711size_t
713 const struct GNUNET_RECLAIM_PresentationList *presentations,
714 char *result)
715{
717 size_t len;
718 size_t total_len;
719 char *write_ptr;
720 write_ptr = result;
721 total_len = 0;
722 for (le = presentations->list_head; NULL != le; le = le->next)
723 {
724 GNUNET_assert (NULL != le->presentation);
726 total_len += len;
727 write_ptr += len;
728 }
729 return total_len;
730}
731
732
742 data_size)
743{
746 size_t att_len;
747 const char *read_ptr;
748
750
751 if (data_size < sizeof(struct Presentation))
752 return al;
753
754 read_ptr = data;
755 while (((data + data_size) - read_ptr) >= sizeof(struct Presentation))
756 {
758 ale->presentation =
760 data_size - (read_ptr - data));
761 if (NULL == ale->presentation)
762 {
764 "Failed to deserialize malformed presentation.\n");
765 GNUNET_free (ale);
766 return al;
767 }
770 ale->presentation);
771 read_ptr += att_len;
772 }
773 return al;
774}
775
776
779 const struct GNUNET_RECLAIM_PresentationList *al)
780{
782 struct GNUNET_RECLAIM_PresentationListEntry *result_ale;
784
786 for (ale = al->list_head; NULL != ale; ale = ale->next)
787 {
789 GNUNET_assert (NULL != ale->presentation);
790 result_ale->presentation =
792 ale->presentation->data,
793 ale->presentation->data_size);
796 result->list_tail,
797 result_ale);
798 }
799 return result;
800}
801
802
803void
805 struct GNUNET_RECLAIM_PresentationList *presentations)
806{
809
810 for (ale = presentations->list_head; NULL != ale;)
811 {
812 if (NULL != ale->presentation)
814 tmp_ale = ale;
815 ale = ale->next;
816 GNUNET_free (tmp_ale);
817 }
818 GNUNET_free (presentations);
819}
820
821
828size_t
831{
832 return sizeof(struct Presentation) + presentation->data_size;
833}
834
835
836size_t
838 const struct GNUNET_RECLAIM_Presentation *presentation,
839 char *result)
840{
841 struct Presentation *atts;
842 char *write_ptr;
843
844 atts = (struct Presentation *) result;
845 atts->presentation_type = htonl (presentation->type);
846 atts->credential_id = presentation->credential_id;
847 write_ptr = (char *) &atts[1];
848 GNUNET_memcpy (write_ptr, presentation->data, presentation->data_size);
849 atts->data_size = htons (presentation->data_size);
850
851 return sizeof(struct Presentation) + presentation->data_size;
852}
853
854
865{
866 struct GNUNET_RECLAIM_Presentation *presentation;
867 struct Presentation *atts;
868 size_t data_len;
869 char *write_ptr;
870
871 if (data_size < sizeof(struct Presentation))
872 return NULL;
873
874 atts = (struct Presentation *) data;
875 data_len = ntohs (atts->data_size);
876 if (data_size < sizeof(struct Presentation) + data_len)
877 {
879 "Buffer too small to deserialize\n");
880 return NULL;
881 }
882 presentation = GNUNET_malloc (sizeof(struct GNUNET_RECLAIM_Presentation)
883 + data_len);
884 presentation->type = ntohl (atts->presentation_type);
885 presentation->credential_id = atts->credential_id;
886 presentation->data_size = data_len;
887
888 write_ptr = (char *) &presentation[1];
889 GNUNET_memcpy (write_ptr, &atts[1], data_len);
890 presentation->data = write_ptr;
891 return presentation;
892}
893
894
898 presentation)
899{
900 unsigned int i;
901 struct Plugin *plugin;
903 init ();
904 for (i = 0; i < num_plugins; i++)
905 {
907 if (NULL !=
908 (ret = plugin->api->get_attributes_p (plugin->api->cls,
909 presentation)))
910 return ret;
911 }
912 return NULL;
913}
914
915
916char*
919 presentation)
920{
921 unsigned int i;
922 struct Plugin *plugin;
923 char *ret;
924 init ();
925 for (i = 0; i < num_plugins; i++)
926 {
928 if (NULL !=
929 (ret = plugin->api->get_issuer_p (plugin->api->cls,
930 presentation)))
931 return ret;
932 }
933 return NULL;
934}
935
936
937int
940 presentation,
941 struct GNUNET_TIME_Absolute*exp)
942{
943 unsigned int i;
944 struct Plugin *plugin;
945 init ();
946 for (i = 0; i < num_plugins; i++)
947 {
949 if (GNUNET_OK != plugin->api->get_expiration_p (plugin->api->cls,
950 presentation,
951 exp))
952 continue;
953 return GNUNET_OK;
954 }
955 return GNUNET_SYSERR;
956}
957
958
969int
971 const struct GNUNET_RECLAIM_Credential *cred,
972 const struct GNUNET_RECLAIM_AttributeList *attrs,
973 struct GNUNET_RECLAIM_Presentation **presentation)
974{
975 unsigned int i;
976 struct Plugin *plugin;
977 init ();
978 for (i = 0; i < num_plugins; i++)
979 {
981 if (GNUNET_OK != plugin->api->create_presentation (plugin->api->cls,
982 cred,
983 attrs,
984 presentation))
985 continue;
986 (*presentation)->credential_id = cred->id;
987 return GNUNET_OK;
988 }
989 return GNUNET_SYSERR;
990}
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_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.
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.
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.
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.