GNUnet  0.19.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 "platform.h"
27 #include "gnunet_util_lib.h"
28 #include "gnunet_reclaim_plugin.h"
29 #include "reclaim_credential.h"
30 
31 
35 struct Plugin
36 {
40  char *library_name;
41 
46 };
47 
48 
52 static struct Plugin **credential_plugins;
53 
54 
58 static unsigned int num_plugins;
59 
60 
64 static int initialized;
65 
66 
74 static void
75 add_plugin (void *cls, const char *library_name, void *lib_ret)
76 {
77  struct GNUNET_RECLAIM_CredentialPluginFunctions *api = lib_ret;
78  struct Plugin *plugin;
79 
81  "Loading credential plugin `%s'\n",
82  library_name);
83  plugin = GNUNET_new (struct Plugin);
84  plugin->api = api;
87 }
88 
89 
93 static void
94 init ()
95 {
96  if (GNUNET_YES == initialized)
97  return;
100  "libgnunet_plugin_reclaim_credential_",
101  NULL,
102  &add_plugin,
103  NULL);
104 }
105 
106 
110 void __attribute__ ((destructor))
111 RECLAIM_CREDENTIAL_fini ()
112 {
113  struct Plugin *plugin;
116 
117  if (pd != dpd)
118  GNUNET_OS_init (dpd);
119 
120  for (unsigned int i = 0; i < num_plugins; i++)
121  {
123  GNUNET_break (NULL ==
125  plugin->api));
128  }
130 
131  if (pd != dpd)
132  GNUNET_OS_init (pd);
133 
134  credential_plugins = NULL;
135 }
136 
137 
144 uint32_t
146 {
147  unsigned int i;
148  struct Plugin *plugin;
149  uint32_t ret;
150  init ();
151  for (i = 0; i < num_plugins; i++)
152  {
154  if (UINT32_MAX !=
155  (ret = plugin->api->typename_to_number (plugin->api->cls,
156  typename)))
157  return ret;
158  }
159  return UINT32_MAX;
160 }
161 
162 
169 const char *
171 {
172  unsigned int i;
173  struct Plugin *plugin;
174  const char *ret;
175 
176  init ();
177  for (i = 0; i < num_plugins; i++)
178  {
180  if (NULL !=
181  (ret = plugin->api->number_to_typename (plugin->api->cls, type)))
182  return ret;
183  }
184  return NULL;
185 }
186 
187 
198 int
200  const char *s,
201  void **data,
202  size_t *data_size)
203 {
204  unsigned int i;
205  struct Plugin *plugin;
206 
207  init ();
208  for (i = 0; i < num_plugins; i++)
209  {
211  if (GNUNET_OK == plugin->api->string_to_value (plugin->api->cls,
212  type,
213  s,
214  data,
215  data_size))
216  return GNUNET_OK;
217  }
218  return GNUNET_SYSERR;
219 }
220 
221 
230 char *
232  const void *data,
233  size_t data_size)
234 {
235  unsigned int i;
236  struct Plugin *plugin;
237  char *ret;
238 
239  init ();
240  for (i = 0; i < num_plugins; i++)
241  {
243  if (NULL != (ret = plugin->api->value_to_string (plugin->api->cls,
244  type,
245  data,
246  data_size)))
247  return ret;
248  }
249  return NULL;
250 }
251 
252 
255  uint32_t type,
256  const void *data,
257  size_t data_size)
258 {
259  struct GNUNET_RECLAIM_Credential *attr;
260  char *write_ptr;
261  char *attr_name_tmp = GNUNET_strdup (attr_name);
262 
263  GNUNET_STRINGS_utf8_tolower (attr_name, attr_name_tmp);
264 
265  attr = GNUNET_malloc (sizeof(struct GNUNET_RECLAIM_Credential)
266  + strlen (attr_name_tmp) + 1 + data_size);
267  attr->type = type;
268  attr->data_size = data_size;
269  attr->flag = 0;
270  write_ptr = (char *) &attr[1];
271  GNUNET_memcpy (write_ptr, attr_name_tmp, strlen (attr_name_tmp) + 1);
272  attr->name = write_ptr;
273  write_ptr += strlen (attr->name) + 1;
274  GNUNET_memcpy (write_ptr, data, data_size);
275  attr->data = write_ptr;
276  GNUNET_free (attr_name_tmp);
277  return attr;
278 }
279 
280 
287 size_t
289  const struct GNUNET_RECLAIM_CredentialList *credentials)
290 {
292  size_t len = 0;
293 
294  for (le = credentials->list_head; NULL != le; le = le->next)
295  {
296  GNUNET_assert (NULL != le->credential);
298  len += sizeof(struct GNUNET_RECLAIM_CredentialListEntry);
299  }
300  return len;
301 }
302 
303 
304 size_t
306  const struct GNUNET_RECLAIM_CredentialList *credentials,
307  char *result)
308 {
310  size_t len;
311  size_t total_len;
312  char *write_ptr;
313  write_ptr = result;
314  total_len = 0;
315  for (le = credentials->list_head; NULL != le; le = le->next)
316  {
317  GNUNET_assert (NULL != le->credential);
319  total_len += len;
320  write_ptr += len;
321  }
322  return total_len;
323 }
324 
325 
328 {
331  size_t att_len;
332  const char *read_ptr;
333 
335 
336  if ((data_size < sizeof(struct
337  Credential)
338  + sizeof(struct GNUNET_RECLAIM_CredentialListEntry)))
339  return al;
340 
341  read_ptr = data;
342  while (((data + data_size) - read_ptr) >= sizeof(struct Credential))
343  {
345  ale->credential =
347  data_size - (read_ptr - data));
348  if (NULL == ale->credential)
349  {
351  "Failed to deserialize malformed credential.\n");
352  GNUNET_free (ale);
353  return al;
354  }
357  read_ptr += att_len;
358  }
359  return al;
360 }
361 
362 
370  const struct GNUNET_RECLAIM_CredentialList *al)
371 {
373  struct GNUNET_RECLAIM_CredentialListEntry *result_ale;
375 
377  for (ale = al->list_head; NULL != ale; ale = ale->next)
378  {
379  result_ale = GNUNET_new (struct GNUNET_RECLAIM_CredentialListEntry);
380  GNUNET_assert (NULL != ale->credential);
381  result_ale->credential =
383  ale->credential->type,
384  ale->credential->data,
385  ale->credential->data_size);
386  result_ale->credential->id = ale->credential->id;
388  result->list_tail,
389  result_ale);
390  }
391  return result;
392 }
393 
394 
395 void
397  struct GNUNET_RECLAIM_CredentialList *credentials)
398 {
400  struct GNUNET_RECLAIM_CredentialListEntry *tmp_ale;
401 
402  for (ale = credentials->list_head; NULL != ale;)
403  {
404  if (NULL != ale->credential)
405  GNUNET_free (ale->credential);
406  tmp_ale = ale;
407  ale = ale->next;
408  GNUNET_free (tmp_ale);
409  }
410  GNUNET_free (credentials);
411 }
412 
413 
420 size_t
423 {
424  return sizeof(struct Credential) + strlen (credential->name)
426 }
427 
428 
429 size_t
432  char *result)
433 {
434  size_t data_len_ser;
435  size_t name_len;
436  struct Credential *atts;
437  char *write_ptr;
438 
439  atts = (struct Credential *) result;
440  atts->credential_type = htonl (credential->type);
441  atts->credential_flag = htonl (credential->flag);
442  atts->credential_id = credential->id;
443  name_len = strlen (credential->name);
444  atts->name_len = htons (name_len);
445  write_ptr = (char *) &atts[1];
446  GNUNET_memcpy (write_ptr, credential->name, name_len);
447  write_ptr += name_len;
448  // TODO plugin-ize
449  // data_len_ser = plugin->serialize_attribute_value (attr,
450  // &attr_ser[1]);
451  data_len_ser = credential->data_size;
452  GNUNET_memcpy (write_ptr, credential->data, credential->data_size);
453  atts->data_size = htons (data_len_ser);
454 
455  return sizeof(struct Credential) + strlen (credential->name)
457 }
458 
459 
470 {
472  struct Credential *atts;
473  size_t data_len;
474  size_t name_len;
475  char *write_ptr;
476 
477  if (data_size < sizeof(struct Credential))
478  return NULL;
479 
480  atts = (struct Credential *) data;
481  data_len = ntohs (atts->data_size);
482  name_len = ntohs (atts->name_len);
483  if (data_size < sizeof(struct Credential) + data_len + name_len)
484  {
486  "Buffer too small to deserialize\n");
487  return NULL;
488  }
490  + data_len + name_len + 1);
491  credential->type = ntohl (atts->credential_type);
492  credential->flag = ntohl (atts->credential_flag);
493  credential->id = atts->credential_id;
494  credential->data_size = data_len;
495 
496  write_ptr = (char *) &credential[1];
497  GNUNET_memcpy (write_ptr, &atts[1], name_len);
498  write_ptr[name_len] = '\0';
499  credential->name = write_ptr;
500 
501  write_ptr += name_len + 1;
502  GNUNET_memcpy (write_ptr, (char *) &atts[1] + name_len,
503  credential->data_size);
504  credential->data = write_ptr;
505  return credential;
506 }
507 
508 
512 {
513  unsigned int i;
514  struct Plugin *plugin;
516  init ();
517  for (i = 0; i < num_plugins; i++)
518  {
520  if (NULL !=
521  (ret = plugin->api->get_attributes (plugin->api->cls,
522  credential)))
523  return ret;
524  }
525  return NULL;
526 }
527 
528 
529 char*
532 {
533  unsigned int i;
534  struct Plugin *plugin;
535  char *ret;
536  init ();
537  for (i = 0; i < num_plugins; i++)
538  {
540  if (NULL !=
541  (ret = plugin->api->get_issuer (plugin->api->cls,
542  credential)))
543  return ret;
544  }
545  return NULL;
546 }
547 
548 
549 int
552  struct GNUNET_TIME_Absolute*exp)
553 {
554  unsigned int i;
555  struct Plugin *plugin;
556  init ();
557  for (i = 0; i < num_plugins; i++)
558  {
560  if (GNUNET_OK != plugin->api->get_expiration (plugin->api->cls,
561  credential,
562  exp))
563  continue;
564  return GNUNET_OK;
565  }
566  return GNUNET_SYSERR;
567 }
568 
569 
576 uint32_t
578 {
579  unsigned int i;
580  struct Plugin *plugin;
581  uint32_t ret;
582  init ();
583  for (i = 0; i < num_plugins; i++)
584  {
586  if (UINT32_MAX !=
587  (ret = plugin->api->typename_to_number_p (plugin->api->cls,
588  typename)))
589  return ret;
590  }
591  return UINT32_MAX;
592 }
593 
594 
595 const char *
597 {
598  unsigned int i;
599  struct Plugin *plugin;
600  const char *ret;
601 
602  init ();
603  for (i = 0; i < num_plugins; i++)
604  {
606  if (NULL !=
607  (ret = plugin->api->number_to_typename_p (plugin->api->cls, type)))
608  return ret;
609  }
610  return NULL;
611 }
612 
613 
624 int
626  const char *s,
627  void **data,
628  size_t *data_size)
629 {
630  unsigned int i;
631  struct Plugin *plugin;
632 
633  init ();
634  for (i = 0; i < num_plugins; i++)
635  {
637  if (GNUNET_OK == plugin->api->string_to_value_p (plugin->api->cls,
638  type,
639  s,
640  data,
641  data_size))
642  return GNUNET_OK;
643  }
644  return GNUNET_SYSERR;
645 }
646 
647 
656 char *
658  const void *data,
659  size_t data_size)
660 {
661  unsigned int i;
662  struct Plugin *plugin;
663  char *ret;
664 
665  init ();
666  for (i = 0; i < num_plugins; i++)
667  {
669  if (NULL != (ret = plugin->api->value_to_string_p (plugin->api->cls,
670  type,
671  data,
672  data_size)))
673  return ret;
674  }
675  return NULL;
676 }
677 
678 
681  const void *data,
682  size_t data_size)
683 {
684  struct GNUNET_RECLAIM_Presentation *attr;
685  char *write_ptr;
686 
687  attr = GNUNET_malloc (sizeof(struct GNUNET_RECLAIM_Presentation)
688  + data_size);
689  attr->type = type;
690  attr->data_size = data_size;
691  write_ptr = (char *) &attr[1];
692  GNUNET_memcpy (write_ptr, data, data_size);
693  attr->data = write_ptr;
694  return attr;
695 }
696 
697 
704 size_t
706  const struct GNUNET_RECLAIM_PresentationList *presentations)
707 {
709  size_t len = 0;
710 
711  for (le = presentations->list_head; NULL != le; le = le->next)
712  {
713  GNUNET_assert (NULL != le->presentation);
715  }
716  return len;
717 }
718 
719 
720 size_t
722  const struct GNUNET_RECLAIM_PresentationList *presentations,
723  char *result)
724 {
726  size_t len;
727  size_t total_len;
728  char *write_ptr;
729  write_ptr = result;
730  total_len = 0;
731  for (le = presentations->list_head; NULL != le; le = le->next)
732  {
733  GNUNET_assert (NULL != le->presentation);
735  total_len += len;
736  write_ptr += len;
737  }
738  return total_len;
739 }
740 
741 
751  data_size)
752 {
755  size_t att_len;
756  const char *read_ptr;
757 
759 
760  if (data_size < sizeof(struct Presentation))
761  return al;
762 
763  read_ptr = data;
764  while (((data + data_size) - read_ptr) >= sizeof(struct Presentation))
765  {
767  ale->presentation =
769  data_size - (read_ptr - data));
770  if (NULL == ale->presentation)
771  {
773  "Failed to deserialize malformed presentation.\n");
774  GNUNET_free (ale);
775  return al;
776  }
779  ale->presentation);
780  read_ptr += att_len;
781  }
782  return al;
783 }
784 
785 
793  const struct GNUNET_RECLAIM_PresentationList *al)
794 {
796  struct GNUNET_RECLAIM_PresentationListEntry *result_ale;
798 
800  for (ale = al->list_head; NULL != ale; ale = ale->next)
801  {
802  result_ale = GNUNET_new (struct GNUNET_RECLAIM_PresentationListEntry);
803  GNUNET_assert (NULL != ale->presentation);
804  result_ale->presentation =
806  ale->presentation->data,
807  ale->presentation->data_size);
810  result->list_tail,
811  result_ale);
812  }
813  return result;
814 }
815 
816 
817 void
819  struct GNUNET_RECLAIM_PresentationList *presentations)
820 {
822  struct GNUNET_RECLAIM_PresentationListEntry *tmp_ale;
823 
824  for (ale = presentations->list_head; NULL != ale;)
825  {
826  if (NULL != ale->presentation)
827  GNUNET_free (ale->presentation);
828  tmp_ale = ale;
829  ale = ale->next;
830  GNUNET_free (tmp_ale);
831  }
832  GNUNET_free (presentations);
833 }
834 
835 
842 size_t
845 {
846  return sizeof(struct Presentation) + presentation->data_size;
847 }
848 
849 
850 size_t
852  const struct GNUNET_RECLAIM_Presentation *presentation,
853  char *result)
854 {
855  struct Presentation *atts;
856  char *write_ptr;
857 
858  atts = (struct Presentation *) result;
859  atts->presentation_type = htonl (presentation->type);
860  atts->credential_id = presentation->credential_id;
861  write_ptr = (char *) &atts[1];
862  GNUNET_memcpy (write_ptr, presentation->data, presentation->data_size);
863  atts->data_size = htons (presentation->data_size);
864 
865  return sizeof(struct Presentation) + presentation->data_size;
866 }
867 
868 
879 {
880  struct GNUNET_RECLAIM_Presentation *presentation;
881  struct Presentation *atts;
882  size_t data_len;
883  char *write_ptr;
884 
885  if (data_size < sizeof(struct Presentation))
886  return NULL;
887 
888  atts = (struct Presentation *) data;
889  data_len = ntohs (atts->data_size);
890  if (data_size < sizeof(struct Presentation) + data_len)
891  {
893  "Buffer too small to deserialize\n");
894  return NULL;
895  }
896  presentation = GNUNET_malloc (sizeof(struct GNUNET_RECLAIM_Presentation)
897  + data_len);
898  presentation->type = ntohl (atts->presentation_type);
899  presentation->credential_id = atts->credential_id;
900  presentation->data_size = data_len;
901 
902  write_ptr = (char *) &presentation[1];
903  GNUNET_memcpy (write_ptr, &atts[1], data_len);
904  presentation->data = write_ptr;
905  return presentation;
906 }
907 
908 
912  presentation)
913 {
914  unsigned int i;
915  struct Plugin *plugin;
917  init ();
918  for (i = 0; i < num_plugins; i++)
919  {
921  if (NULL !=
922  (ret = plugin->api->get_attributes_p (plugin->api->cls,
923  presentation)))
924  return ret;
925  }
926  return NULL;
927 }
928 
929 
930 char*
933  presentation)
934 {
935  unsigned int i;
936  struct Plugin *plugin;
937  char *ret;
938  init ();
939  for (i = 0; i < num_plugins; i++)
940  {
942  if (NULL !=
943  (ret = plugin->api->get_issuer_p (plugin->api->cls,
944  presentation)))
945  return ret;
946  }
947  return NULL;
948 }
949 
950 
951 int
954  presentation,
955  struct GNUNET_TIME_Absolute*exp)
956 {
957  unsigned int i;
958  struct Plugin *plugin;
959  init ();
960  for (i = 0; i < num_plugins; i++)
961  {
963  if (GNUNET_OK != plugin->api->get_expiration_p (plugin->api->cls,
964  presentation,
965  exp))
966  continue;
967  return GNUNET_OK;
968  }
969  return GNUNET_SYSERR;
970 }
971 
972 
983 int
985  const struct GNUNET_RECLAIM_Credential *cred,
986  const struct GNUNET_RECLAIM_AttributeList *attrs,
987  struct GNUNET_RECLAIM_Presentation **presentation)
988 {
989  unsigned int i;
990  struct Plugin *plugin;
991  init ();
992  for (i = 0; i < num_plugins; i++)
993  {
995  if (GNUNET_OK != plugin->api->create_presentation (plugin->api->cls,
996  cred,
997  attrs,
998  presentation))
999  continue;
1000  (*presentation)->credential_id = cred->id;
1001  return GNUNET_OK;
1002  }
1003  return GNUNET_SYSERR;
1004 }
static int ret
Return value of the commandline.
Definition: gnunet-abd.c:81
static size_t data_size
Number of bytes in data.
Definition: gnunet-abd.c:187
struct TestcasePlugin * plugin
The process handle to the testbed service.
uint32_t data
The data value.
uint16_t len
length of data (which is always a uint32_t, but presumably this can be used to specify that fewer byt...
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.
const struct GNUNET_OS_ProjectData * GNUNET_OS_project_data_get(void)
void GNUNET_OS_init(const struct GNUNET_OS_ProjectData *pd)
Setup OS subsystem with project data.
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
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
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.
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.
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.
void GNUNET_RECLAIM_credential_list_destroy(struct GNUNET_RECLAIM_CredentialList *credentials)
Destroy credential list.
struct GNUNET_RECLAIM_Credential * GNUNET_RECLAIM_credential_deserialize(const char *data, size_t data_size)
Deserialize an 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_get_issuer(const struct GNUNET_RECLAIM_Credential *credential)
const char * GNUNET_RECLAIM_credential_number_to_typename(uint32_t type)
Convert an credential type number to the corresponding credential type string.
struct GNUNET_RECLAIM_Presentation * GNUNET_RECLAIM_presentation_deserialize(const char *data, size_t data_size)
Deserialize an presentation.
size_t GNUNET_RECLAIM_presentation_serialize(const struct GNUNET_RECLAIM_Presentation *presentation, char *result)
Serialize a presentation.
size_t GNUNET_RECLAIM_credential_list_serialize_get_size(const struct GNUNET_RECLAIM_CredentialList *credentials)
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.
char * GNUNET_RECLAIM_presentation_get_issuer(const struct GNUNET_RECLAIM_Presentation *presentation)
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.
struct GNUNET_RECLAIM_CredentialList * GNUNET_RECLAIM_credential_list_deserialize(const char *data, size_t data_size)
Deserialize an attribute list.
int GNUNET_RECLAIM_credential_get_expiration(const struct GNUNET_RECLAIM_Credential *credential, struct GNUNET_TIME_Absolute *exp)
struct GNUNET_RECLAIM_Presentation * GNUNET_RECLAIM_presentation_new(uint32_t type, const void *data, size_t data_size)
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.
const char * GNUNET_RECLAIM_presentation_number_to_typename(uint32_t type)
Convert a presentation type number to the corresponding credential type string.
struct GNUNET_RECLAIM_PresentationList * GNUNET_RECLAIM_presentation_list_deserialize(const char *data, size_t data_size)
Deserialize an presentation list.
struct GNUNET_RECLAIM_AttributeList * GNUNET_RECLAIM_credential_get_attributes(const struct GNUNET_RECLAIM_Credential *credential)
Convert an credential type name to the corresponding number.
size_t GNUNET_RECLAIM_presentation_list_serialize_get_size(const struct GNUNET_RECLAIM_PresentationList *presentations)
Get required size for serialization buffer.
struct GNUNET_RECLAIM_AttributeList * GNUNET_RECLAIM_presentation_get_attributes(const struct GNUNET_RECLAIM_Presentation *presentation)
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:449
const char * name
static void add_plugin(void *cls, const char *library_name, void *lib_ret)
Add a plugin.
struct GNUNET_RECLAIM_PresentationList * GNUNET_RECLAIM_presentation_list_dup(const struct GNUNET_RECLAIM_PresentationList *al)
Make a (deep) copy of the presentation list.
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_CredentialList * GNUNET_RECLAIM_credential_list_dup(const struct GNUNET_RECLAIM_CredentialList *al)
Make a (deep) copy of the credential list.
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.
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
enum GNUNET_TESTBED_UnderlayLinkModelType type
the type of this model