aboutsummaryrefslogtreecommitdiff
path: root/src/reclaim/plugin_gnsrecord_reclaim.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/reclaim/plugin_gnsrecord_reclaim.c')
-rw-r--r--src/reclaim/plugin_gnsrecord_reclaim.c91
1 files changed, 46 insertions, 45 deletions
diff --git a/src/reclaim/plugin_gnsrecord_reclaim.c b/src/reclaim/plugin_gnsrecord_reclaim.c
index 708142774..e4d1adfde 100644
--- a/src/reclaim/plugin_gnsrecord_reclaim.c
+++ b/src/reclaim/plugin_gnsrecord_reclaim.c
@@ -40,25 +40,25 @@
40 * @return NULL on error, otherwise human-readable representation of the value 40 * @return NULL on error, otherwise human-readable representation of the value
41 */ 41 */
42static char * 42static char *
43value_to_string(void *cls, uint32_t type, const void *data, size_t data_size) 43value_to_string (void *cls, uint32_t type, const void *data, size_t data_size)
44{ 44{
45 switch (type) 45 switch (type)
46 { 46 {
47 case GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR: 47 case GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR:
48 return GNUNET_STRINGS_data_to_string_alloc(data, data_size); 48 return GNUNET_STRINGS_data_to_string_alloc (data, data_size);
49 49
50 case GNUNET_GNSRECORD_TYPE_RECLAIM_OIDC_REDIRECT: 50 case GNUNET_GNSRECORD_TYPE_RECLAIM_OIDC_REDIRECT:
51 case GNUNET_GNSRECORD_TYPE_RECLAIM_OIDC_CLIENT: 51 case GNUNET_GNSRECORD_TYPE_RECLAIM_OIDC_CLIENT:
52 return GNUNET_strndup(data, data_size); 52 return GNUNET_strndup (data, data_size);
53 53
54 case GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR_REF: 54 case GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR_REF:
55 case GNUNET_GNSRECORD_TYPE_RECLAIM_TICKET: 55 case GNUNET_GNSRECORD_TYPE_RECLAIM_TICKET:
56 case GNUNET_GNSRECORD_TYPE_RECLAIM_MASTER: 56 case GNUNET_GNSRECORD_TYPE_RECLAIM_MASTER:
57 return GNUNET_STRINGS_data_to_string_alloc(data, data_size); 57 return GNUNET_STRINGS_data_to_string_alloc (data, data_size);
58 58
59 default: 59 default:
60 return NULL; 60 return NULL;
61 } 61 }
62} 62}
63 63
64 64
@@ -74,30 +74,30 @@ value_to_string(void *cls, uint32_t type, const void *data, size_t data_size)
74 * @return #GNUNET_OK on success 74 * @return #GNUNET_OK on success
75 */ 75 */
76static int 76static int
77string_to_value(void *cls, uint32_t type, const char *s, void **data, 77string_to_value (void *cls, uint32_t type, const char *s, void **data,
78 size_t *data_size) 78 size_t *data_size)
79{ 79{
80 if (NULL == s) 80 if (NULL == s)
81 return GNUNET_SYSERR; 81 return GNUNET_SYSERR;
82 switch (type) 82 switch (type)
83 { 83 {
84 case GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR: 84 case GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR:
85 return GNUNET_STRINGS_string_to_data(s, strlen(s), *data, *data_size); 85 return GNUNET_STRINGS_string_to_data (s, strlen (s), *data, *data_size);
86 86
87 case GNUNET_GNSRECORD_TYPE_RECLAIM_OIDC_REDIRECT: 87 case GNUNET_GNSRECORD_TYPE_RECLAIM_OIDC_REDIRECT:
88 case GNUNET_GNSRECORD_TYPE_RECLAIM_OIDC_CLIENT: 88 case GNUNET_GNSRECORD_TYPE_RECLAIM_OIDC_CLIENT:
89 *data = GNUNET_strdup(s); 89 *data = GNUNET_strdup (s);
90 *data_size = strlen(s); 90 *data_size = strlen (s);
91 return GNUNET_OK; 91 return GNUNET_OK;
92 92
93 case GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR_REF: 93 case GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR_REF:
94 case GNUNET_GNSRECORD_TYPE_RECLAIM_MASTER: 94 case GNUNET_GNSRECORD_TYPE_RECLAIM_MASTER:
95 case GNUNET_GNSRECORD_TYPE_RECLAIM_TICKET: 95 case GNUNET_GNSRECORD_TYPE_RECLAIM_TICKET:
96 return GNUNET_STRINGS_string_to_data(s, strlen(s), *data, *data_size); 96 return GNUNET_STRINGS_string_to_data (s, strlen (s), *data, *data_size);
97 97
98 default: 98 default:
99 return GNUNET_SYSERR; 99 return GNUNET_SYSERR;
100 } 100 }
101} 101}
102 102
103 103
@@ -105,7 +105,8 @@ string_to_value(void *cls, uint32_t type, const char *s, void **data,
105 * Mapping of record type numbers to human-readable 105 * Mapping of record type numbers to human-readable
106 * record type names. 106 * record type names.
107 */ 107 */
108static struct { 108static struct
109{
109 const char *name; 110 const char *name;
110 uint32_t number; 111 uint32_t number;
111} name_map[] = { 112} name_map[] = {
@@ -127,13 +128,13 @@ static struct {
127 * @return corresponding number, UINT32_MAX on error 128 * @return corresponding number, UINT32_MAX on error
128 */ 129 */
129static uint32_t 130static uint32_t
130typename_to_number(void *cls, const char *dns_typename) 131typename_to_number (void *cls, const char *dns_typename)
131{ 132{
132 unsigned int i; 133 unsigned int i;
133 134
134 i = 0; 135 i = 0;
135 while ((NULL != name_map[i].name) && 136 while ((NULL != name_map[i].name) &&
136 (0 != strcasecmp(dns_typename, name_map[i].name))) 137 (0 != strcasecmp (dns_typename, name_map[i].name)))
137 i++; 138 i++;
138 return name_map[i].number; 139 return name_map[i].number;
139} 140}
@@ -147,7 +148,7 @@ typename_to_number(void *cls, const char *dns_typename)
147 * @return corresponding typestring, NULL on error 148 * @return corresponding typestring, NULL on error
148 */ 149 */
149static const char * 150static const char *
150number_to_typename(void *cls, uint32_t type) 151number_to_typename (void *cls, uint32_t type)
151{ 152{
152 unsigned int i; 153 unsigned int i;
153 154
@@ -165,11 +166,11 @@ number_to_typename(void *cls, uint32_t type)
165 * @return the exported block API 166 * @return the exported block API
166 */ 167 */
167void * 168void *
168libgnunet_plugin_gnsrecord_reclaim_init(void *cls) 169libgnunet_plugin_gnsrecord_reclaim_init (void *cls)
169{ 170{
170 struct GNUNET_GNSRECORD_PluginFunctions *api; 171 struct GNUNET_GNSRECORD_PluginFunctions *api;
171 172
172 api = GNUNET_new(struct GNUNET_GNSRECORD_PluginFunctions); 173 api = GNUNET_new (struct GNUNET_GNSRECORD_PluginFunctions);
173 api->value_to_string = &value_to_string; 174 api->value_to_string = &value_to_string;
174 api->string_to_value = &string_to_value; 175 api->string_to_value = &string_to_value;
175 api->typename_to_number = &typename_to_number; 176 api->typename_to_number = &typename_to_number;
@@ -185,11 +186,11 @@ libgnunet_plugin_gnsrecord_reclaim_init(void *cls)
185 * @return NULL 186 * @return NULL
186 */ 187 */
187void * 188void *
188libgnunet_plugin_gnsrecord_reclaim_done(void *cls) 189libgnunet_plugin_gnsrecord_reclaim_done (void *cls)
189{ 190{
190 struct GNUNET_GNSRECORD_PluginFunctions *api = cls; 191 struct GNUNET_GNSRECORD_PluginFunctions *api = cls;
191 192
192 GNUNET_free(api); 193 GNUNET_free (api);
193 return NULL; 194 return NULL;
194} 195}
195 196