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 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.
17 * @author Christian Grothoff
20 * Plugin API for GNS record types
22 * @defgroup gnsrecord-plugin GNS Record plugin API
23 * To be implemented by applications defining new record types.
25 * @see [Documentation](https://gnunet.org/gns-plugins)
29 #ifndef GNUNET_GNSRECORD_PLUGIN_H
30 #define GNUNET_GNSRECORD_PLUGIN_H
35 #if 0 /* keep Emacsens' auto-indent happy */
42 * Function called to convert the binary value @a data of a record of
43 * type @a type to a human-readable string.
46 * @param type type of the record
47 * @param data value in binary encoding
48 * @param data_size number of bytes in @a data
49 * @return NULL on error, otherwise human-readable representation of the value
52 (*GNUNET_GNSRECORD_ValueToStringFunction) (void *cls,
59 * Function called to convert human-readable version of the value @a s
60 * of a record of type @a type to the respective binary
64 * @param type type of the record
65 * @param s human-readable string
66 * @param data set to value in binary encoding (will be allocated)
67 * @param data_size set to number of bytes in @a data
68 * @return #GNUNET_OK on success
71 (*GNUNET_GNSRECORD_StringToValueFunction) (void *cls,
79 * Function called to convert a type name (i.e. "AAAA") to the
80 * corresponding number.
83 * @param dns_typename name to convert
84 * @return corresponding number, UINT32_MAX on error
87 (*GNUNET_GNSRECORD_TypenameToNumberFunction) (void *cls,
88 const char *dns_typename);
92 * Function called to convert a type number (i.e. 1) to the
93 * corresponding type string (i.e. "A")
96 * @param type number of a type to convert
97 * @return corresponding typestring, NULL on error
100 (*GNUNET_GNSRECORD_NumberToTypenameFunction) (void *cls,
105 * Each plugin is required to return a pointer to a struct of this
106 * type as the return value from its entry point.
108 struct GNUNET_GNSRECORD_PluginFunctions
112 * Closure for all of the callbacks.
117 * Conversion to string.
119 GNUNET_GNSRECORD_ValueToStringFunction value_to_string;
122 * Conversion to binary.
124 GNUNET_GNSRECORD_StringToValueFunction string_to_value;
127 * Typename to number.
129 GNUNET_GNSRECORD_TypenameToNumberFunction typename_to_number;
132 * Number to typename.
134 GNUNET_GNSRECORD_NumberToTypenameFunction number_to_typename;
138 /** @} */ /* end of group */
140 #if 0 /* keep Emacsens' auto-indent happy */