diff options
author | Schanzenbach, Martin <martin.schanzenbach@aisec.fraunhofer.de> | 2017-12-02 22:32:28 +0100 |
---|---|---|
committer | Schanzenbach, Martin <martin.schanzenbach@aisec.fraunhofer.de> | 2017-12-02 22:32:28 +0100 |
commit | a9a7ac802811e76e33b54040bf31f00ea9438cea (patch) | |
tree | 7f9a22daca2b95e7308d8877c668fc878a39ae4c /src/identity-attribute | |
parent | 14c62ed969ace8843154d10b55d4c3571383dc37 (diff) | |
download | gnunet-a9a7ac802811e76e33b54040bf31f00ea9438cea.tar.gz gnunet-a9a7ac802811e76e33b54040bf31f00ea9438cea.zip |
-refactored
Diffstat (limited to 'src/identity-attribute')
-rw-r--r-- | src/identity-attribute/Makefile.am | 44 | ||||
-rw-r--r-- | src/identity-attribute/identity_attribute.c | 245 | ||||
-rw-r--r-- | src/identity-attribute/identity_attribute.h | 56 | ||||
-rw-r--r-- | src/identity-attribute/plugin_identity_attribute_gnuid.c | 184 |
4 files changed, 529 insertions, 0 deletions
diff --git a/src/identity-attribute/Makefile.am b/src/identity-attribute/Makefile.am new file mode 100644 index 000000000..770bc2ead --- /dev/null +++ b/src/identity-attribute/Makefile.am | |||
@@ -0,0 +1,44 @@ | |||
1 | # This Makefile.am is in the public domain | ||
2 | AM_CPPFLAGS = -I$(top_srcdir)/src/include | ||
3 | |||
4 | plugindir = $(libdir)/gnunet | ||
5 | |||
6 | pkgcfgdir= $(pkgdatadir)/config.d/ | ||
7 | |||
8 | libexecdir= $(pkglibdir)/libexec/ | ||
9 | |||
10 | if MINGW | ||
11 | WINFLAGS = -Wl,--no-undefined -Wl,--export-all-symbols | ||
12 | endif | ||
13 | |||
14 | if USE_COVERAGE | ||
15 | AM_CFLAGS = --coverage -O0 | ||
16 | XLIBS = -lgcov | ||
17 | endif | ||
18 | |||
19 | lib_LTLIBRARIES = \ | ||
20 | libgnunetidentityattribute.la | ||
21 | |||
22 | libgnunetidentityattribute_la_SOURCES = \ | ||
23 | identity_attribute.c | ||
24 | libgnunetidentityattribute_la_LIBADD = \ | ||
25 | $(top_builddir)/src/util/libgnunetutil.la \ | ||
26 | $(GN_LIBINTL) | ||
27 | libgnunetidentityattribute_la_LDFLAGS = \ | ||
28 | $(GN_LIB_LDFLAGS) $(WINFLAGS) \ | ||
29 | -version-info 0:0:0 | ||
30 | |||
31 | |||
32 | plugin_LTLIBRARIES = \ | ||
33 | libgnunet_plugin_identity_attribute_gnuid.la | ||
34 | |||
35 | |||
36 | libgnunet_plugin_identity_attribute_gnuid_la_SOURCES = \ | ||
37 | plugin_identity_attribute_gnuid.c | ||
38 | libgnunet_plugin_identity_attribute_gnuid_la_LIBADD = \ | ||
39 | $(top_builddir)/src/util/libgnunetutil.la \ | ||
40 | $(LTLIBINTL) | ||
41 | libgnunet_plugin_gnsrecord_dns_la_LDFLAGS = \ | ||
42 | $(GN_PLUGIN_LDFLAGS) | ||
43 | |||
44 | |||
diff --git a/src/identity-attribute/identity_attribute.c b/src/identity-attribute/identity_attribute.c new file mode 100644 index 000000000..377eb3211 --- /dev/null +++ b/src/identity-attribute/identity_attribute.c | |||
@@ -0,0 +1,245 @@ | |||
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 | ||
6 | it under the terms of the GNU General Public License as published | ||
7 | by the Free Software Foundation; either version 3, or (at your | ||
8 | 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 | General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU General Public License | ||
16 | along with GNUnet; see the file COPYING. If not, write to the | ||
17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301, USA. | ||
19 | */ | ||
20 | |||
21 | /** | ||
22 | * @file identity-provider/identity_attribute.c | ||
23 | * @brief helper library to manage identity attributes | ||
24 | * @author Martin Schanzenbach | ||
25 | */ | ||
26 | #include "platform.h" | ||
27 | #include "gnunet_util_lib.h" | ||
28 | #include "identity_attribute.h" | ||
29 | |||
30 | /** | ||
31 | * Create a new attribute. | ||
32 | * | ||
33 | * @param name the attribute name | ||
34 | * @param type the attribute type | ||
35 | * @param data the attribute value | ||
36 | * @param data_size the attribute value size | ||
37 | * @return the new attribute | ||
38 | */ | ||
39 | struct GNUNET_IDENTITY_ATTRIBUTE_Claim * | ||
40 | GNUNET_IDENTITY_ATTRIBUTE_claim_new (const char* attr_name, | ||
41 | uint32_t attr_type, | ||
42 | const void* data, | ||
43 | size_t data_size) | ||
44 | { | ||
45 | struct GNUNET_IDENTITY_ATTRIBUTE_Claim *attr; | ||
46 | char *write_ptr; | ||
47 | |||
48 | attr = GNUNET_malloc (sizeof (struct GNUNET_IDENTITY_ATTRIBUTE_Claim) + | ||
49 | strlen (attr_name) + 1 + | ||
50 | data_size); | ||
51 | attr->type = attr_type; | ||
52 | attr->data_size = data_size; | ||
53 | attr->version = 0; | ||
54 | write_ptr = (char*)&attr[1]; | ||
55 | GNUNET_memcpy (write_ptr, | ||
56 | attr_name, | ||
57 | strlen (attr_name) + 1); | ||
58 | attr->name = write_ptr; | ||
59 | write_ptr += strlen (attr->name) + 1; | ||
60 | GNUNET_memcpy (write_ptr, | ||
61 | data, | ||
62 | data_size); | ||
63 | attr->data = write_ptr; | ||
64 | return attr; | ||
65 | } | ||
66 | |||
67 | size_t | ||
68 | GNUNET_IDENTITY_ATTRIBUTE_list_serialize_get_size (const struct GNUNET_IDENTITY_ATTRIBUTE_ClaimList *attrs) | ||
69 | { | ||
70 | struct GNUNET_IDENTITY_ATTRIBUTE_ClaimListEntry *le; | ||
71 | size_t len = 0; | ||
72 | for (le = attrs->list_head; NULL != le; le = le->next) | ||
73 | len += GNUNET_IDENTITY_ATTRIBUTE_serialize_get_size (le->claim); | ||
74 | return len; | ||
75 | } | ||
76 | |||
77 | size_t | ||
78 | GNUNET_IDENTITY_ATTRIBUTE_list_serialize (const struct GNUNET_IDENTITY_ATTRIBUTE_ClaimList *attrs, | ||
79 | char *result) | ||
80 | { | ||
81 | struct GNUNET_IDENTITY_ATTRIBUTE_ClaimListEntry *le; | ||
82 | size_t len; | ||
83 | size_t total_len; | ||
84 | char* write_ptr; | ||
85 | |||
86 | write_ptr = result; | ||
87 | total_len = 0; | ||
88 | for (le = attrs->list_head; NULL != le; le = le->next) | ||
89 | { | ||
90 | len = GNUNET_IDENTITY_ATTRIBUTE_serialize (le->claim, | ||
91 | write_ptr); | ||
92 | total_len += len; | ||
93 | write_ptr += len; | ||
94 | } | ||
95 | return total_len; | ||
96 | } | ||
97 | |||
98 | struct GNUNET_IDENTITY_ATTRIBUTE_ClaimList * | ||
99 | GNUNET_IDENTITY_ATTRIBUTE_list_deserialize (const char* data, | ||
100 | size_t data_size) | ||
101 | { | ||
102 | struct GNUNET_IDENTITY_ATTRIBUTE_ClaimList *attrs; | ||
103 | struct GNUNET_IDENTITY_ATTRIBUTE_ClaimListEntry *le; | ||
104 | size_t attr_len; | ||
105 | const char* read_ptr; | ||
106 | |||
107 | if (data_size < sizeof (struct Attribute)) | ||
108 | return NULL; | ||
109 | |||
110 | attrs = GNUNET_new (struct GNUNET_IDENTITY_ATTRIBUTE_ClaimList); | ||
111 | read_ptr = data; | ||
112 | while (((data + data_size) - read_ptr) >= sizeof (struct Attribute)) | ||
113 | { | ||
114 | |||
115 | le = GNUNET_new (struct GNUNET_IDENTITY_ATTRIBUTE_ClaimListEntry); | ||
116 | le->claim = GNUNET_IDENTITY_ATTRIBUTE_deserialize (read_ptr, | ||
117 | data_size - (read_ptr - data)); | ||
118 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
119 | "Deserialized attribute %s\n", le->claim->name); | ||
120 | GNUNET_CONTAINER_DLL_insert (attrs->list_head, | ||
121 | attrs->list_tail, | ||
122 | le); | ||
123 | attr_len = GNUNET_IDENTITY_ATTRIBUTE_serialize_get_size (le->claim); | ||
124 | read_ptr += attr_len; | ||
125 | } | ||
126 | return attrs; | ||
127 | } | ||
128 | |||
129 | struct GNUNET_IDENTITY_ATTRIBUTE_ClaimList* | ||
130 | GNUNET_IDENTITY_ATTRIBUTE_list_dup (const struct GNUNET_IDENTITY_ATTRIBUTE_ClaimList *attrs) | ||
131 | { | ||
132 | struct GNUNET_IDENTITY_ATTRIBUTE_ClaimListEntry *le; | ||
133 | struct GNUNET_IDENTITY_ATTRIBUTE_ClaimListEntry *result_le; | ||
134 | struct GNUNET_IDENTITY_ATTRIBUTE_ClaimList *result; | ||
135 | size_t len; | ||
136 | |||
137 | result = GNUNET_new (struct GNUNET_IDENTITY_ATTRIBUTE_ClaimList); | ||
138 | for (le = attrs->list_head; NULL != le; le = le->next) | ||
139 | { | ||
140 | result_le = GNUNET_new (struct GNUNET_IDENTITY_ATTRIBUTE_ClaimListEntry); | ||
141 | len = sizeof (struct GNUNET_IDENTITY_ATTRIBUTE_Claim) + le->claim->data_size; | ||
142 | result_le->claim = GNUNET_malloc (len); | ||
143 | GNUNET_memcpy (result_le->claim, | ||
144 | le->claim, | ||
145 | len); | ||
146 | result_le->claim->name = (const char*)&result_le->claim[1]; | ||
147 | GNUNET_CONTAINER_DLL_insert (result->list_head, | ||
148 | result->list_tail, | ||
149 | result_le); | ||
150 | } | ||
151 | return result; | ||
152 | } | ||
153 | |||
154 | |||
155 | void | ||
156 | GNUNET_IDENTITY_ATTRIBUTE_list_destroy (struct GNUNET_IDENTITY_ATTRIBUTE_ClaimList *attrs) | ||
157 | { | ||
158 | struct GNUNET_IDENTITY_ATTRIBUTE_ClaimListEntry *le; | ||
159 | struct GNUNET_IDENTITY_ATTRIBUTE_ClaimListEntry *tmp_le; | ||
160 | |||
161 | for (le = attrs->list_head; NULL != le;) | ||
162 | { | ||
163 | GNUNET_free (le->claim); | ||
164 | tmp_le = le; | ||
165 | le = le->next; | ||
166 | GNUNET_free (tmp_le); | ||
167 | } | ||
168 | GNUNET_free (attrs); | ||
169 | |||
170 | } | ||
171 | |||
172 | size_t | ||
173 | GNUNET_IDENTITY_ATTRIBUTE_serialize_get_size (const struct GNUNET_IDENTITY_ATTRIBUTE_Claim *attr) | ||
174 | { | ||
175 | return sizeof (struct Attribute) | ||
176 | + strlen (attr->name) | ||
177 | + attr->data_size; | ||
178 | } | ||
179 | |||
180 | size_t | ||
181 | GNUNET_IDENTITY_ATTRIBUTE_serialize (const struct GNUNET_IDENTITY_ATTRIBUTE_Claim *attr, | ||
182 | char *result) | ||
183 | { | ||
184 | size_t data_len_ser; | ||
185 | size_t name_len; | ||
186 | struct Attribute *attr_ser; | ||
187 | char* write_ptr; | ||
188 | |||
189 | attr_ser = (struct Attribute*)result; | ||
190 | attr_ser->attribute_type = htons (attr->type); | ||
191 | attr_ser->attribute_version = htonl (attr->version); | ||
192 | name_len = strlen (attr->name); | ||
193 | attr_ser->name_len = htons (name_len); | ||
194 | write_ptr = (char*)&attr_ser[1]; | ||
195 | GNUNET_memcpy (write_ptr, attr->name, name_len); | ||
196 | write_ptr += name_len; | ||
197 | //TODO plugin-ize | ||
198 | //data_len_ser = plugin->serialize_attribute_value (attr, | ||
199 | // &attr_ser[1]); | ||
200 | data_len_ser = attr->data_size; | ||
201 | GNUNET_memcpy (write_ptr, attr->data, attr->data_size); | ||
202 | attr_ser->data_size = htons (data_len_ser); | ||
203 | |||
204 | return sizeof (struct Attribute) + strlen (attr->name) + attr->data_size; | ||
205 | } | ||
206 | |||
207 | struct GNUNET_IDENTITY_ATTRIBUTE_Claim * | ||
208 | GNUNET_IDENTITY_ATTRIBUTE_deserialize (const char* data, | ||
209 | size_t data_size) | ||
210 | { | ||
211 | struct GNUNET_IDENTITY_ATTRIBUTE_Claim *attr; | ||
212 | struct Attribute *attr_ser; | ||
213 | size_t data_len; | ||
214 | size_t name_len; | ||
215 | char* write_ptr; | ||
216 | |||
217 | if (data_size < sizeof (struct Attribute)) | ||
218 | return NULL; | ||
219 | |||
220 | attr_ser = (struct Attribute*)data; | ||
221 | data_len = ntohs (attr_ser->data_size); | ||
222 | name_len = ntohs (attr_ser->name_len); | ||
223 | attr = GNUNET_malloc (sizeof (struct GNUNET_IDENTITY_ATTRIBUTE_Claim) | ||
224 | + data_len + name_len + 1); | ||
225 | attr->type = ntohs (attr_ser->attribute_type); | ||
226 | attr->version = ntohl (attr_ser->attribute_version); | ||
227 | attr->data_size = ntohs (attr_ser->data_size); | ||
228 | |||
229 | write_ptr = (char*)&attr[1]; | ||
230 | GNUNET_memcpy (write_ptr, | ||
231 | &attr_ser[1], | ||
232 | name_len); | ||
233 | write_ptr[name_len] = '\0'; | ||
234 | attr->name = write_ptr; | ||
235 | |||
236 | write_ptr += name_len + 1; | ||
237 | GNUNET_memcpy (write_ptr, | ||
238 | (char*)&attr_ser[1] + name_len, | ||
239 | attr->data_size); | ||
240 | attr->data = write_ptr; | ||
241 | return attr; | ||
242 | |||
243 | } | ||
244 | |||
245 | /* end of identity_attribute.c */ | ||
diff --git a/src/identity-attribute/identity_attribute.h b/src/identity-attribute/identity_attribute.h new file mode 100644 index 000000000..046321807 --- /dev/null +++ b/src/identity-attribute/identity_attribute.h | |||
@@ -0,0 +1,56 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet. | ||
3 | Copyright (C) 2012-2015 GNUnet e.V. | ||
4 | |||
5 | GNUnet is free software; you can redistribute it and/or modify | ||
6 | it under the terms of the GNU General Public License as published | ||
7 | by the Free Software Foundation; either version 3, or (at your | ||
8 | 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 | General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU General Public License | ||
16 | along with GNUnet; see the file COPYING. If not, write to the | ||
17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301, USA. | ||
19 | */ | ||
20 | /** | ||
21 | * @author Martin Schanzenbach | ||
22 | * @file identity-provider/identity_attribute.h | ||
23 | * @brief GNUnet Identity Provider library | ||
24 | * | ||
25 | */ | ||
26 | #ifndef IDENTITY_ATTRIBUTE_H | ||
27 | #define IDENTITY_ATTRIBUTE_H | ||
28 | |||
29 | #include "gnunet_identity_provider_service.h" | ||
30 | |||
31 | struct Attribute | ||
32 | { | ||
33 | /** | ||
34 | * Attribute type | ||
35 | */ | ||
36 | uint32_t attribute_type; | ||
37 | |||
38 | /** | ||
39 | * Attribute version | ||
40 | */ | ||
41 | uint32_t attribute_version; | ||
42 | |||
43 | /** | ||
44 | * Name length | ||
45 | */ | ||
46 | uint32_t name_len; | ||
47 | |||
48 | /** | ||
49 | * Data size | ||
50 | */ | ||
51 | uint32_t data_size; | ||
52 | |||
53 | //followed by data_size Attribute value data | ||
54 | }; | ||
55 | |||
56 | #endif | ||
diff --git a/src/identity-attribute/plugin_identity_attribute_gnuid.c b/src/identity-attribute/plugin_identity_attribute_gnuid.c new file mode 100644 index 000000000..ba460d0a5 --- /dev/null +++ b/src/identity-attribute/plugin_identity_attribute_gnuid.c | |||
@@ -0,0 +1,184 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet | ||
3 | Copyright (C) 2013, 2014, 2016 GNUnet e.V. | ||
4 | |||
5 | GNUnet is free software; you can redistribute it and/or modify | ||
6 | it under the terms of the GNU General Public License as published | ||
7 | by the Free Software Foundation; either version 3, or (at your | ||
8 | 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 | General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU General Public License | ||
16 | along with GNUnet; see the file COPYING. If not, write to the | ||
17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301, USA. | ||
19 | */ | ||
20 | |||
21 | /** | ||
22 | * @file identity-provider/plugin_identity_attribute_gnuid.c | ||
23 | * @brief identity attribute plugin to provide the API for fundamental | ||
24 | * attribute types. | ||
25 | * | ||
26 | * @author Martin Schanzenbach | ||
27 | */ | ||
28 | #include "platform.h" | ||
29 | #include "gnunet_util_lib.h" | ||
30 | #include "gnunet_identity_attribute_plugin.h" | ||
31 | #include <inttypes.h> | ||
32 | |||
33 | |||
34 | /** | ||
35 | * Convert the 'value' of an attribute to a string. | ||
36 | * | ||
37 | * @param cls closure, unused | ||
38 | * @param type type of the attribute | ||
39 | * @param data value in binary encoding | ||
40 | * @param data_size number of bytes in @a data | ||
41 | * @return NULL on error, otherwise human-readable representation of the value | ||
42 | */ | ||
43 | static char * | ||
44 | gnuid_value_to_string (void *cls, | ||
45 | uint32_t type, | ||
46 | const void *data, | ||
47 | size_t data_size) | ||
48 | { | ||
49 | |||
50 | switch (type) | ||
51 | { | ||
52 | case GNUNET_IDENTITY_ATTRIBUTE_TYPE_STRING: | ||
53 | return GNUNET_strndup (data, data_size); | ||
54 | default: | ||
55 | return NULL; | ||
56 | } | ||
57 | } | ||
58 | |||
59 | |||
60 | /** | ||
61 | * Convert human-readable version of a 'value' of an attribute to the binary | ||
62 | * representation. | ||
63 | * | ||
64 | * @param cls closure, unused | ||
65 | * @param type type of the attribute | ||
66 | * @param s human-readable string | ||
67 | * @param data set to value in binary encoding (will be allocated) | ||
68 | * @param data_size set to number of bytes in @a data | ||
69 | * @return #GNUNET_OK on success | ||
70 | */ | ||
71 | static int | ||
72 | gnuid_string_to_value (void *cls, | ||
73 | uint32_t type, | ||
74 | const char *s, | ||
75 | void **data, | ||
76 | size_t *data_size) | ||
77 | { | ||
78 | if (NULL == s) | ||
79 | return GNUNET_SYSERR; | ||
80 | switch (type) | ||
81 | { | ||
82 | |||
83 | case GNUNET_IDENTITY_ATTRIBUTE_TYPE_STRING: | ||
84 | *data = GNUNET_strdup (s); | ||
85 | *data_size = strlen (s); | ||
86 | return GNUNET_OK; | ||
87 | default: | ||
88 | return GNUNET_SYSERR; | ||
89 | } | ||
90 | } | ||
91 | |||
92 | |||
93 | /** | ||
94 | * Mapping of attribute type numbers to human-readable | ||
95 | * attribute type names. | ||
96 | */ | ||
97 | static struct { | ||
98 | const char *name; | ||
99 | uint32_t number; | ||
100 | } gnuid_name_map[] = { | ||
101 | { "STRING", GNUNET_IDENTITY_ATTRIBUTE_TYPE_STRING }, | ||
102 | { NULL, UINT32_MAX } | ||
103 | }; | ||
104 | |||
105 | |||
106 | /** | ||
107 | * Convert a type name to the corresponding number. | ||
108 | * | ||
109 | * @param cls closure, unused | ||
110 | * @param gnuid_typename name to convert | ||
111 | * @return corresponding number, UINT32_MAX on error | ||
112 | */ | ||
113 | static uint32_t | ||
114 | gnuid_typename_to_number (void *cls, | ||
115 | const char *gnuid_typename) | ||
116 | { | ||
117 | unsigned int i; | ||
118 | |||
119 | i=0; | ||
120 | while ( (NULL != gnuid_name_map[i].name) && | ||
121 | (0 != strcasecmp (gnuid_typename, | ||
122 | gnuid_name_map[i].name)) ) | ||
123 | i++; | ||
124 | return gnuid_name_map[i].number; | ||
125 | } | ||
126 | |||
127 | |||
128 | /** | ||
129 | * Convert a type number (i.e. 1) to the corresponding type string | ||
130 | * | ||
131 | * @param cls closure, unused | ||
132 | * @param type number of a type to convert | ||
133 | * @return corresponding typestring, NULL on error | ||
134 | */ | ||
135 | static const char * | ||
136 | gnuid_number_to_typename (void *cls, | ||
137 | uint32_t type) | ||
138 | { | ||
139 | unsigned int i; | ||
140 | |||
141 | i=0; | ||
142 | while ( (NULL != gnuid_name_map[i].name) && | ||
143 | (type != gnuid_name_map[i].number) ) | ||
144 | i++; | ||
145 | return gnuid_name_map[i].name; | ||
146 | } | ||
147 | |||
148 | |||
149 | /** | ||
150 | * Entry point for the plugin. | ||
151 | * | ||
152 | * @param cls NULL | ||
153 | * @return the exported block API | ||
154 | */ | ||
155 | void * | ||
156 | libgnunet_plugin_attribute_type_gnuid_init (void *cls) | ||
157 | { | ||
158 | struct GNUNET_IDENTITY_ATTRIBUTE_PluginFunctions *api; | ||
159 | |||
160 | api = GNUNET_new (struct GNUNET_IDENTITY_ATTRIBUTE_PluginFunctions); | ||
161 | api->value_to_string = &gnuid_value_to_string; | ||
162 | api->string_to_value = &gnuid_string_to_value; | ||
163 | api->typename_to_number = &gnuid_typename_to_number; | ||
164 | api->number_to_typename = &gnuid_number_to_typename; | ||
165 | return api; | ||
166 | } | ||
167 | |||
168 | |||
169 | /** | ||
170 | * Exit point from the plugin. | ||
171 | * | ||
172 | * @param cls the return value from #libgnunet_plugin_block_test_init() | ||
173 | * @return NULL | ||
174 | */ | ||
175 | void * | ||
176 | libgnunet_plugin_attribute_type_gnuid_done (void *cls) | ||
177 | { | ||
178 | struct GNUNET_IDENTITY_ATTRIBUTE_PluginFunctions *api = cls; | ||
179 | |||
180 | GNUNET_free (api); | ||
181 | return NULL; | ||
182 | } | ||
183 | |||
184 | /* end of plugin_identity_attribute_type_gnuid.c */ | ||