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/>.
20 * @author Martin Schanzenbach
23 * Plugin API for the idp database backend
25 * @defgroup identity-provider-plugin IdP service plugin API
26 * Plugin API for the idp database backend
29 #ifndef GNUNET_RECLAIM_ATTRIBUTE_PLUGIN_H
30 #define GNUNET_RECLAIM_ATTRIBUTE_PLUGIN_H
32 #include "gnunet_util_lib.h"
33 #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_ATTRIBUTE_ValueToStringFunction) (void *cls,
61 * Function called to convert human-readable version of the value @a s
62 * of an attribute of type @a type to the respective binary
66 * @param type type of the attribute
67 * @param s human-readable string
68 * @param data set to value in binary encoding (will be allocated)
69 * @param data_size set to number of bytes in @a data
70 * @return #GNUNET_OK on success
72 typedef int (*GNUNET_RECLAIM_ATTRIBUTE_StringToValueFunction) (void *cls,
80 * Function called to convert a type name to the
81 * corresponding number.
84 * @param typename name to convert
85 * @return corresponding number, UINT32_MAX on error
87 typedef uint32_t (*GNUNET_RECLAIM_ATTRIBUTE_TypenameToNumberFunction) (void *cls,
88 const char *typename);
92 * Function called to convert a type number (i.e. 1) to the
93 * corresponding type string
96 * @param type number of a type to convert
97 * @return corresponding typestring, NULL on error
99 typedef const char * (*GNUNET_RECLAIM_ATTRIBUTE_NumberToTypenameFunction) (void *cls,
104 * Each plugin is required to return a pointer to a struct of this
105 * type as the return value from its entry point.
107 struct GNUNET_RECLAIM_ATTRIBUTE_PluginFunctions
111 * Closure for all of the callbacks.
116 * Conversion to string.
118 GNUNET_RECLAIM_ATTRIBUTE_ValueToStringFunction value_to_string;
121 * Conversion to binary.
123 GNUNET_RECLAIM_ATTRIBUTE_StringToValueFunction string_to_value;
126 * Typename to number.
128 GNUNET_RECLAIM_ATTRIBUTE_TypenameToNumberFunction typename_to_number;
131 * Number to typename.
133 GNUNET_RECLAIM_ATTRIBUTE_NumberToTypenameFunction number_to_typename;
138 #if 0 /* keep Emacsens' auto-indent happy */
147 /** @} */ /* end of group */