2 This file is part of GNUnet
3 Copyright (C) 2012, 2013 GNUnet e.V.
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.
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.
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/>.
18 SPDX-License-Identifier: AGPL3.0-or-later
22 * @author Martin Schanzenbach
25 * Plugin API for reclaim attribute types
27 * @defgroup reclaim-attribute-plugin reclaim plugin API for attributes/claims
30 #ifndef GNUNET_RECLAIM_AttributePLUGIN_H
31 #define GNUNET_RECLAIM_AttributePLUGIN_H
33 #include "gnunet_util_lib.h"
34 #include "gnunet_reclaim_attribute_lib.h"
38 #if 0 /* keep Emacsens' auto-indent happy */
45 * Function called to convert the binary value @a data of an attribute of
46 * type @a type to a human-readable string.
49 * @param type type of the attribute
50 * @param data value in binary encoding
51 * @param data_size number of bytes in @a data
52 * @return NULL on error, otherwise human-readable representation of the value
54 typedef char *(*GNUNET_RECLAIM_AttributeValueToStringFunction) (
62 * Function called to convert human-readable version of the value @a s
63 * of an attribute of type @a type to the respective binary
67 * @param type type of the attribute
68 * @param s human-readable string
69 * @param data set to value in binary encoding (will be allocated)
70 * @param data_size set to number of bytes in @a data
71 * @return #GNUNET_OK on success
73 typedef int (*GNUNET_RECLAIM_AttributeStringToValueFunction) (
82 * Function called to convert a type name to the
83 * corresponding number.
86 * @param typename name to convert
87 * @return corresponding number, UINT32_MAX on error
89 typedef uint32_t (*GNUNET_RECLAIM_AttributeTypenameToNumberFunction) (
91 const char *typename);
95 * Function called to convert a type number (i.e. 1) to the
96 * corresponding type string
99 * @param type number of a type to convert
100 * @return corresponding typestring, NULL on error
102 typedef const char *(*GNUNET_RECLAIM_AttributeNumberToTypenameFunction) (
107 * Function called to convert the binary value @a data of an attribute of
108 * type @a type to a human-readable string.
111 * @param type type of the attribute
112 * @param data value in binary encoding
113 * @param data_size number of bytes in @a data
114 * @return NULL on error, otherwise human-readable representation of the value
116 typedef char *(*GNUNET_RECLAIM_AttestationValueToStringFunction) (
124 * Function called to convert human-readable version of the value @a s
125 * of an attribute of type @a type to the respective binary
129 * @param type type of the attribute
130 * @param s human-readable string
131 * @param data set to value in binary encoding (will be allocated)
132 * @param data_size set to number of bytes in @a data
133 * @return #GNUNET_OK on success
135 typedef int (*GNUNET_RECLAIM_AttestationStringToValueFunction) (
144 * Function called to convert a type name to the
145 * corresponding number.
148 * @param typename name to convert
149 * @return corresponding number, UINT32_MAX on error
151 typedef uint32_t (*GNUNET_RECLAIM_AttestationTypenameToNumberFunction) (
153 const char *typename);
157 * Function called to convert a type number (i.e. 1) to the
158 * corresponding type string
161 * @param type number of a type to convert
162 * @return corresponding typestring, NULL on error
164 typedef const char *(*GNUNET_RECLAIM_AttestationNumberToTypenameFunction) (
171 * Each plugin is required to return a pointer to a struct of this
172 * type as the return value from its entry point.
174 struct GNUNET_RECLAIM_AttributePluginFunctions
177 * Closure for all of the callbacks.
182 * Conversion to string.
184 GNUNET_RECLAIM_AttributeValueToStringFunction value_to_string;
187 * Conversion to binary.
189 GNUNET_RECLAIM_AttributeStringToValueFunction string_to_value;
192 * Typename to number.
194 GNUNET_RECLAIM_AttributeTypenameToNumberFunction typename_to_number;
197 * Number to typename.
199 GNUNET_RECLAIM_AttributeNumberToTypenameFunction number_to_typename;
204 * Each plugin is required to return a pointer to a struct of this
205 * type as the return value from its entry point.
207 struct GNUNET_RECLAIM_AttestationPluginFunctions
210 * Closure for all of the callbacks.
215 * Conversion to string.
217 GNUNET_RECLAIM_AttestationValueToStringFunction value_to_string;
220 * Conversion to binary.
222 GNUNET_RECLAIM_AttestationStringToValueFunction string_to_value;
225 * Typename to number.
227 GNUNET_RECLAIM_AttestationTypenameToNumberFunction typename_to_number;
230 * Number to typename.
232 GNUNET_RECLAIM_AttestationNumberToTypenameFunction number_to_typename;
238 #if 0 /* keep Emacsens' auto-indent happy */
247 /** @} */ /* end of group */