aboutsummaryrefslogtreecommitdiff
path: root/src/include/gnunet_reclaim_attribute_plugin.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/include/gnunet_reclaim_attribute_plugin.h')
-rw-r--r--src/include/gnunet_reclaim_attribute_plugin.h147
1 files changed, 147 insertions, 0 deletions
diff --git a/src/include/gnunet_reclaim_attribute_plugin.h b/src/include/gnunet_reclaim_attribute_plugin.h
new file mode 100644
index 000000000..cf0bb141a
--- /dev/null
+++ b/src/include/gnunet_reclaim_attribute_plugin.h
@@ -0,0 +1,147 @@
1/*
2 This file is part of GNUnet
3 Copyright (C) 2012, 2013 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
19/**
20 * @author Martin Schanzenbach
21 *
22 * @file
23 * Plugin API for the idp database backend
24 *
25 * @defgroup identity-provider-plugin IdP service plugin API
26 * Plugin API for the idp database backend
27 * @{
28 */
29#ifndef GNUNET_RECLAIM_ATTRIBUTE_PLUGIN_H
30#define GNUNET_RECLAIM_ATTRIBUTE_PLUGIN_H
31
32#include "gnunet_util_lib.h"
33#include "gnunet_reclaim_attribute_lib.h"
34
35#ifdef __cplusplus
36extern "C"
37{
38#if 0 /* keep Emacsens' auto-indent happy */
39}
40#endif
41#endif
42
43
44/**
45 * Function called to convert the binary value @a data of an attribute of
46 * type @a type to a human-readable string.
47 *
48 * @param cls closure
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
53 */
54typedef char * (*GNUNET_RECLAIM_ATTRIBUTE_ValueToStringFunction) (void *cls,
55 uint32_t type,
56 const void *data,
57 size_t data_size);
58
59
60/**
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
63 * representation.
64 *
65 * @param cls closure
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
71 */
72typedef int (*GNUNET_RECLAIM_ATTRIBUTE_StringToValueFunction) (void *cls,
73 uint32_t type,
74 const char *s,
75 void **data,
76 size_t *data_size);
77
78
79/**
80 * Function called to convert a type name to the
81 * corresponding number.
82 *
83 * @param cls closure
84 * @param typename name to convert
85 * @return corresponding number, UINT32_MAX on error
86 */
87typedef uint32_t (*GNUNET_RECLAIM_ATTRIBUTE_TypenameToNumberFunction) (void *cls,
88 const char *typename);
89
90
91/**
92 * Function called to convert a type number (i.e. 1) to the
93 * corresponding type string
94 *
95 * @param cls closure
96 * @param type number of a type to convert
97 * @return corresponding typestring, NULL on error
98 */
99typedef const char * (*GNUNET_RECLAIM_ATTRIBUTE_NumberToTypenameFunction) (void *cls,
100 uint32_t type);
101
102
103/**
104 * Each plugin is required to return a pointer to a struct of this
105 * type as the return value from its entry point.
106 */
107struct GNUNET_RECLAIM_ATTRIBUTE_PluginFunctions
108{
109
110 /**
111 * Closure for all of the callbacks.
112 */
113 void *cls;
114
115 /**
116 * Conversion to string.
117 */
118 GNUNET_RECLAIM_ATTRIBUTE_ValueToStringFunction value_to_string;
119
120 /**
121 * Conversion to binary.
122 */
123 GNUNET_RECLAIM_ATTRIBUTE_StringToValueFunction string_to_value;
124
125 /**
126 * Typename to number.
127 */
128 GNUNET_RECLAIM_ATTRIBUTE_TypenameToNumberFunction typename_to_number;
129
130 /**
131 * Number to typename.
132 */
133 GNUNET_RECLAIM_ATTRIBUTE_NumberToTypenameFunction number_to_typename;
134
135};
136
137
138#if 0 /* keep Emacsens' auto-indent happy */
139{
140#endif
141#ifdef __cplusplus
142}
143#endif
144
145#endif
146
147/** @} */ /* end of group */