diff options
author | Christian Grothoff <christian@grothoff.org> | 2019-10-05 15:09:28 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2019-10-05 15:09:28 +0200 |
commit | c4e9ba925ffd758aaa3feee2ccfc0b76f26fe207 (patch) | |
tree | cac3ce030d77b4cbe7c7dc62ed58cfe6d24f73e1 /src/identity/gnunet-service-identity.c | |
parent | fbb71d527c7d6babf269a8fefce1db291b9f7068 (diff) | |
download | gnunet-c4e9ba925ffd758aaa3feee2ccfc0b76f26fe207.tar.gz gnunet-c4e9ba925ffd758aaa3feee2ccfc0b76f26fe207.zip |
global reindent, now with uncrustify hook enabled
Diffstat (limited to 'src/identity/gnunet-service-identity.c')
-rw-r--r-- | src/identity/gnunet-service-identity.c | 1004 |
1 files changed, 503 insertions, 501 deletions
diff --git a/src/identity/gnunet-service-identity.c b/src/identity/gnunet-service-identity.c index f399b2566..98b5bde45 100644 --- a/src/identity/gnunet-service-identity.c +++ b/src/identity/gnunet-service-identity.c | |||
@@ -42,7 +42,8 @@ | |||
42 | /** | 42 | /** |
43 | * Information we keep about each ego. | 43 | * Information we keep about each ego. |
44 | */ | 44 | */ |
45 | struct Ego { | 45 | struct Ego |
46 | { | ||
46 | /** | 47 | /** |
47 | * We keep egos in a DLL. | 48 | * We keep egos in a DLL. |
48 | */ | 49 | */ |
@@ -114,15 +115,15 @@ static struct Ego *ego_tail; | |||
114 | * @return full filename for the given ego | 115 | * @return full filename for the given ego |
115 | */ | 116 | */ |
116 | static char * | 117 | static char * |
117 | get_ego_filename(struct Ego *ego) | 118 | get_ego_filename (struct Ego *ego) |
118 | { | 119 | { |
119 | char *filename; | 120 | char *filename; |
120 | 121 | ||
121 | GNUNET_asprintf(&filename, | 122 | GNUNET_asprintf (&filename, |
122 | "%s%s%s", | 123 | "%s%s%s", |
123 | ego_directory, | 124 | ego_directory, |
124 | DIR_SEPARATOR_STR, | 125 | DIR_SEPARATOR_STR, |
125 | ego->identifier); | 126 | ego->identifier); |
126 | return filename; | 127 | return filename; |
127 | } | 128 | } |
128 | 129 | ||
@@ -134,11 +135,11 @@ get_ego_filename(struct Ego *ego) | |||
134 | * @param app_ctx @a client | 135 | * @param app_ctx @a client |
135 | */ | 136 | */ |
136 | static void | 137 | static void |
137 | client_disconnect_cb(void *cls, | 138 | client_disconnect_cb (void *cls, |
138 | struct GNUNET_SERVICE_Client *client, | 139 | struct GNUNET_SERVICE_Client *client, |
139 | void *app_ctx) | 140 | void *app_ctx) |
140 | { | 141 | { |
141 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Client %p disconnected\n", client); | 142 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Client %p disconnected\n", client); |
142 | } | 143 | } |
143 | 144 | ||
144 | 145 | ||
@@ -151,9 +152,9 @@ client_disconnect_cb(void *cls, | |||
151 | * @return internal namestore client structure for this client | 152 | * @return internal namestore client structure for this client |
152 | */ | 153 | */ |
153 | static void * | 154 | static void * |
154 | client_connect_cb(void *cls, | 155 | client_connect_cb (void *cls, |
155 | struct GNUNET_SERVICE_Client *client, | 156 | struct GNUNET_SERVICE_Client *client, |
156 | struct GNUNET_MQ_Handle *mq) | 157 | struct GNUNET_MQ_Handle *mq) |
157 | { | 158 | { |
158 | return client; | 159 | return client; |
159 | } | 160 | } |
@@ -164,33 +165,33 @@ client_connect_cb(void *cls, | |||
164 | * @param cls unused | 165 | * @param cls unused |
165 | */ | 166 | */ |
166 | static void | 167 | static void |
167 | shutdown_task(void *cls) | 168 | shutdown_task (void *cls) |
168 | { | 169 | { |
169 | struct Ego *e; | 170 | struct Ego *e; |
170 | 171 | ||
171 | if (NULL != nc) | 172 | if (NULL != nc) |
172 | { | 173 | { |
173 | GNUNET_notification_context_destroy(nc); | 174 | GNUNET_notification_context_destroy (nc); |
174 | nc = NULL; | 175 | nc = NULL; |
175 | } | 176 | } |
176 | if (NULL != stats) | 177 | if (NULL != stats) |
177 | { | 178 | { |
178 | GNUNET_STATISTICS_destroy(stats, GNUNET_NO); | 179 | GNUNET_STATISTICS_destroy (stats, GNUNET_NO); |
179 | stats = NULL; | 180 | stats = NULL; |
180 | } | 181 | } |
181 | GNUNET_CONFIGURATION_destroy(subsystem_cfg); | 182 | GNUNET_CONFIGURATION_destroy (subsystem_cfg); |
182 | subsystem_cfg = NULL; | 183 | subsystem_cfg = NULL; |
183 | GNUNET_free(subsystem_cfg_file); | 184 | GNUNET_free (subsystem_cfg_file); |
184 | subsystem_cfg_file = NULL; | 185 | subsystem_cfg_file = NULL; |
185 | GNUNET_free(ego_directory); | 186 | GNUNET_free (ego_directory); |
186 | ego_directory = NULL; | 187 | ego_directory = NULL; |
187 | while (NULL != (e = ego_head)) | 188 | while (NULL != (e = ego_head)) |
188 | { | 189 | { |
189 | GNUNET_CONTAINER_DLL_remove(ego_head, ego_tail, e); | 190 | GNUNET_CONTAINER_DLL_remove (ego_head, ego_tail, e); |
190 | GNUNET_free(e->pk); | 191 | GNUNET_free (e->pk); |
191 | GNUNET_free(e->identifier); | 192 | GNUNET_free (e->identifier); |
192 | GNUNET_free(e); | 193 | GNUNET_free (e); |
193 | } | 194 | } |
194 | } | 195 | } |
195 | 196 | ||
196 | 197 | ||
@@ -202,9 +203,9 @@ shutdown_task(void *cls) | |||
202 | * @param emsg error message to include (or NULL for none) | 203 | * @param emsg error message to include (or NULL for none) |
203 | */ | 204 | */ |
204 | static void | 205 | static void |
205 | send_result_code(struct GNUNET_SERVICE_Client *client, | 206 | send_result_code (struct GNUNET_SERVICE_Client *client, |
206 | uint32_t result_code, | 207 | uint32_t result_code, |
207 | const char *emsg) | 208 | const char *emsg) |
208 | { | 209 | { |
209 | struct ResultCodeMessage *rcm; | 210 | struct ResultCodeMessage *rcm; |
210 | struct GNUNET_MQ_Envelope *env; | 211 | struct GNUNET_MQ_Envelope *env; |
@@ -213,17 +214,17 @@ send_result_code(struct GNUNET_SERVICE_Client *client, | |||
213 | if (NULL == emsg) | 214 | if (NULL == emsg) |
214 | elen = 0; | 215 | elen = 0; |
215 | else | 216 | else |
216 | elen = strlen(emsg) + 1; | 217 | elen = strlen (emsg) + 1; |
217 | env = | 218 | env = |
218 | GNUNET_MQ_msg_extra(rcm, elen, GNUNET_MESSAGE_TYPE_IDENTITY_RESULT_CODE); | 219 | GNUNET_MQ_msg_extra (rcm, elen, GNUNET_MESSAGE_TYPE_IDENTITY_RESULT_CODE); |
219 | rcm->result_code = htonl(result_code); | 220 | rcm->result_code = htonl (result_code); |
220 | if (0 < elen) | 221 | if (0 < elen) |
221 | GNUNET_memcpy(&rcm[1], emsg, elen); | 222 | GNUNET_memcpy (&rcm[1], emsg, elen); |
222 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, | 223 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
223 | "Sending result %d (%s) to client\n", | 224 | "Sending result %d (%s) to client\n", |
224 | (int)result_code, | 225 | (int) result_code, |
225 | emsg); | 226 | emsg); |
226 | GNUNET_MQ_send(GNUNET_SERVICE_client_get_mq(client), env); | 227 | GNUNET_MQ_send (GNUNET_SERVICE_client_get_mq (client), env); |
227 | } | 228 | } |
228 | 229 | ||
229 | 230 | ||
@@ -234,18 +235,18 @@ send_result_code(struct GNUNET_SERVICE_Client *client, | |||
234 | * @return corresponding update message | 235 | * @return corresponding update message |
235 | */ | 236 | */ |
236 | static struct GNUNET_MQ_Envelope * | 237 | static struct GNUNET_MQ_Envelope * |
237 | create_update_message(struct Ego *ego) | 238 | create_update_message (struct Ego *ego) |
238 | { | 239 | { |
239 | struct UpdateMessage *um; | 240 | struct UpdateMessage *um; |
240 | struct GNUNET_MQ_Envelope *env; | 241 | struct GNUNET_MQ_Envelope *env; |
241 | size_t name_len; | 242 | size_t name_len; |
242 | 243 | ||
243 | name_len = (NULL == ego->identifier) ? 0 : (strlen(ego->identifier) + 1); | 244 | name_len = (NULL == ego->identifier) ? 0 : (strlen (ego->identifier) + 1); |
244 | env = GNUNET_MQ_msg_extra(um, name_len, GNUNET_MESSAGE_TYPE_IDENTITY_UPDATE); | 245 | env = GNUNET_MQ_msg_extra (um, name_len, GNUNET_MESSAGE_TYPE_IDENTITY_UPDATE); |
245 | um->name_len = htons(name_len); | 246 | um->name_len = htons (name_len); |
246 | um->end_of_list = htons(GNUNET_NO); | 247 | um->end_of_list = htons (GNUNET_NO); |
247 | um->private_key = *ego->pk; | 248 | um->private_key = *ego->pk; |
248 | GNUNET_memcpy(&um[1], ego->identifier, name_len); | 249 | GNUNET_memcpy (&um[1], ego->identifier, name_len); |
249 | return env; | 250 | return env; |
250 | } | 251 | } |
251 | 252 | ||
@@ -258,20 +259,20 @@ create_update_message(struct Ego *ego) | |||
258 | * @return corresponding set default message | 259 | * @return corresponding set default message |
259 | */ | 260 | */ |
260 | static struct GNUNET_MQ_Envelope * | 261 | static struct GNUNET_MQ_Envelope * |
261 | create_set_default_message(struct Ego *ego, const char *servicename) | 262 | create_set_default_message (struct Ego *ego, const char *servicename) |
262 | { | 263 | { |
263 | struct SetDefaultMessage *sdm; | 264 | struct SetDefaultMessage *sdm; |
264 | struct GNUNET_MQ_Envelope *env; | 265 | struct GNUNET_MQ_Envelope *env; |
265 | size_t name_len; | 266 | size_t name_len; |
266 | 267 | ||
267 | name_len = (NULL == servicename) ? 0 : (strlen(servicename) + 1); | 268 | name_len = (NULL == servicename) ? 0 : (strlen (servicename) + 1); |
268 | env = GNUNET_MQ_msg_extra(sdm, | 269 | env = GNUNET_MQ_msg_extra (sdm, |
269 | name_len, | 270 | name_len, |
270 | GNUNET_MESSAGE_TYPE_IDENTITY_SET_DEFAULT); | 271 | GNUNET_MESSAGE_TYPE_IDENTITY_SET_DEFAULT); |
271 | sdm->name_len = htons(name_len); | 272 | sdm->name_len = htons (name_len); |
272 | sdm->reserved = htons(0); | 273 | sdm->reserved = htons (0); |
273 | sdm->private_key = *ego->pk; | 274 | sdm->private_key = *ego->pk; |
274 | GNUNET_memcpy(&sdm[1], servicename, name_len); | 275 | GNUNET_memcpy (&sdm[1], servicename, name_len); |
275 | return env; | 276 | return env; |
276 | } | 277 | } |
277 | 278 | ||
@@ -286,27 +287,27 @@ create_set_default_message(struct Ego *ego, const char *servicename) | |||
286 | * @param message the message received | 287 | * @param message the message received |
287 | */ | 288 | */ |
288 | static void | 289 | static void |
289 | handle_start_message(void *cls, const struct GNUNET_MessageHeader *message) | 290 | handle_start_message (void *cls, const struct GNUNET_MessageHeader *message) |
290 | { | 291 | { |
291 | struct GNUNET_SERVICE_Client *client = cls; | 292 | struct GNUNET_SERVICE_Client *client = cls; |
292 | struct UpdateMessage *ume; | 293 | struct UpdateMessage *ume; |
293 | struct GNUNET_MQ_Envelope *env; | 294 | struct GNUNET_MQ_Envelope *env; |
294 | struct Ego *ego; | 295 | struct Ego *ego; |
295 | 296 | ||
296 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Received START message from client\n"); | 297 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received START message from client\n"); |
297 | GNUNET_SERVICE_client_mark_monitor(client); | 298 | GNUNET_SERVICE_client_mark_monitor (client); |
298 | GNUNET_SERVICE_client_disable_continue_warning(client); | 299 | GNUNET_SERVICE_client_disable_continue_warning (client); |
299 | GNUNET_notification_context_add(nc, GNUNET_SERVICE_client_get_mq(client)); | 300 | GNUNET_notification_context_add (nc, GNUNET_SERVICE_client_get_mq (client)); |
300 | for (ego = ego_head; NULL != ego; ego = ego->next) | 301 | for (ego = ego_head; NULL != ego; ego = ego->next) |
301 | { | 302 | { |
302 | env = create_update_message(ego); | 303 | env = create_update_message (ego); |
303 | GNUNET_MQ_send(GNUNET_SERVICE_client_get_mq(client), env); | 304 | GNUNET_MQ_send (GNUNET_SERVICE_client_get_mq (client), env); |
304 | } | 305 | } |
305 | env = GNUNET_MQ_msg_extra(ume, 0, GNUNET_MESSAGE_TYPE_IDENTITY_UPDATE); | 306 | env = GNUNET_MQ_msg_extra (ume, 0, GNUNET_MESSAGE_TYPE_IDENTITY_UPDATE); |
306 | ume->end_of_list = htons(GNUNET_YES); | 307 | ume->end_of_list = htons (GNUNET_YES); |
307 | ume->name_len = htons(0); | 308 | ume->name_len = htons (0); |
308 | GNUNET_MQ_send(GNUNET_SERVICE_client_get_mq(client), env); | 309 | GNUNET_MQ_send (GNUNET_SERVICE_client_get_mq (client), env); |
309 | GNUNET_SERVICE_client_continue(client); | 310 | GNUNET_SERVICE_client_continue (client); |
310 | } | 311 | } |
311 | 312 | ||
312 | 313 | ||
@@ -319,9 +320,9 @@ handle_start_message(void *cls, const struct GNUNET_MessageHeader *message) | |||
319 | * @return #GNUNET_SYSERR if message was ill-formed | 320 | * @return #GNUNET_SYSERR if message was ill-formed |
320 | */ | 321 | */ |
321 | static int | 322 | static int |
322 | check_lookup_message(void *cls, const struct LookupMessage *message) | 323 | check_lookup_message (void *cls, const struct LookupMessage *message) |
323 | { | 324 | { |
324 | GNUNET_MQ_check_zero_termination(message); | 325 | GNUNET_MQ_check_zero_termination (message); |
325 | return GNUNET_OK; | 326 | return GNUNET_OK; |
326 | } | 327 | } |
327 | 328 | ||
@@ -334,26 +335,26 @@ check_lookup_message(void *cls, const struct LookupMessage *message) | |||
334 | * @param message the message received | 335 | * @param message the message received |
335 | */ | 336 | */ |
336 | static void | 337 | static void |
337 | handle_lookup_message(void *cls, const struct LookupMessage *message) | 338 | handle_lookup_message (void *cls, const struct LookupMessage *message) |
338 | { | 339 | { |
339 | struct GNUNET_SERVICE_Client *client = cls; | 340 | struct GNUNET_SERVICE_Client *client = cls; |
340 | const char *name; | 341 | const char *name; |
341 | struct GNUNET_MQ_Envelope *env; | 342 | struct GNUNET_MQ_Envelope *env; |
342 | struct Ego *ego; | 343 | struct Ego *ego; |
343 | 344 | ||
344 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Received LOOKUP message from client\n"); | 345 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received LOOKUP message from client\n"); |
345 | name = (const char *)&message[1]; | 346 | name = (const char *) &message[1]; |
346 | for (ego = ego_head; NULL != ego; ego = ego->next) | 347 | for (ego = ego_head; NULL != ego; ego = ego->next) |
347 | { | 348 | { |
348 | if (0 != strcasecmp(name, ego->identifier)) | 349 | if (0 != strcasecmp (name, ego->identifier)) |
349 | continue; | 350 | continue; |
350 | env = create_update_message(ego); | 351 | env = create_update_message (ego); |
351 | GNUNET_MQ_send(GNUNET_SERVICE_client_get_mq(client), env); | 352 | GNUNET_MQ_send (GNUNET_SERVICE_client_get_mq (client), env); |
352 | GNUNET_SERVICE_client_continue(client); | 353 | GNUNET_SERVICE_client_continue (client); |
353 | return; | 354 | return; |
354 | } | 355 | } |
355 | send_result_code(client, 0, "ego not found"); | 356 | send_result_code (client, 0, "ego not found"); |
356 | GNUNET_SERVICE_client_continue(client); | 357 | GNUNET_SERVICE_client_continue (client); |
357 | } | 358 | } |
358 | 359 | ||
359 | 360 | ||
@@ -366,9 +367,9 @@ handle_lookup_message(void *cls, const struct LookupMessage *message) | |||
366 | * @return #GNUNET_SYSERR if message was ill-formed | 367 | * @return #GNUNET_SYSERR if message was ill-formed |
367 | */ | 368 | */ |
368 | static int | 369 | static int |
369 | check_lookup_by_suffix_message(void *cls, const struct LookupMessage *message) | 370 | check_lookup_by_suffix_message (void *cls, const struct LookupMessage *message) |
370 | { | 371 | { |
371 | GNUNET_MQ_check_zero_termination(message); | 372 | GNUNET_MQ_check_zero_termination (message); |
372 | return GNUNET_OK; | 373 | return GNUNET_OK; |
373 | } | 374 | } |
374 | 375 | ||
@@ -381,40 +382,40 @@ check_lookup_by_suffix_message(void *cls, const struct LookupMessage *message) | |||
381 | * @param message the message received | 382 | * @param message the message received |
382 | */ | 383 | */ |
383 | static void | 384 | static void |
384 | handle_lookup_by_suffix_message(void *cls, const struct LookupMessage *message) | 385 | handle_lookup_by_suffix_message (void *cls, const struct LookupMessage *message) |
385 | { | 386 | { |
386 | struct GNUNET_SERVICE_Client *client = cls; | 387 | struct GNUNET_SERVICE_Client *client = cls; |
387 | const char *name; | 388 | const char *name; |
388 | struct GNUNET_MQ_Envelope *env; | 389 | struct GNUNET_MQ_Envelope *env; |
389 | struct Ego *lprefix; | 390 | struct Ego *lprefix; |
390 | 391 | ||
391 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, | 392 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
392 | "Received LOOKUP_BY_SUFFIX message from client\n"); | 393 | "Received LOOKUP_BY_SUFFIX message from client\n"); |
393 | name = (const char *)&message[1]; | 394 | name = (const char *) &message[1]; |
394 | lprefix = NULL; | 395 | lprefix = NULL; |
395 | for (struct Ego *ego = ego_head; NULL != ego; ego = ego->next) | 396 | for (struct Ego *ego = ego_head; NULL != ego; ego = ego->next) |
397 | { | ||
398 | if ((strlen (ego->identifier) <= strlen (name)) && | ||
399 | (0 == strcmp (ego->identifier, | ||
400 | &name[strlen (name) - strlen (ego->identifier)])) && | ||
401 | ((strlen (name) == strlen (ego->identifier)) || | ||
402 | ('.' == name[strlen (name) - strlen (ego->identifier) - 1])) && | ||
403 | ((NULL == lprefix) || | ||
404 | (strlen (ego->identifier) > strlen (lprefix->identifier)))) | ||
396 | { | 405 | { |
397 | if ((strlen(ego->identifier) <= strlen(name)) && | 406 | /* found better match, update! */ |
398 | (0 == strcmp(ego->identifier, | 407 | lprefix = ego; |
399 | &name[strlen(name) - strlen(ego->identifier)])) && | ||
400 | ((strlen(name) == strlen(ego->identifier)) || | ||
401 | ('.' == name[strlen(name) - strlen(ego->identifier) - 1])) && | ||
402 | ((NULL == lprefix) || | ||
403 | (strlen(ego->identifier) > strlen(lprefix->identifier)))) | ||
404 | { | ||
405 | /* found better match, update! */ | ||
406 | lprefix = ego; | ||
407 | } | ||
408 | } | 408 | } |
409 | } | ||
409 | if (NULL != lprefix) | 410 | if (NULL != lprefix) |
410 | { | 411 | { |
411 | env = create_update_message(lprefix); | 412 | env = create_update_message (lprefix); |
412 | GNUNET_MQ_send(GNUNET_SERVICE_client_get_mq(client), env); | 413 | GNUNET_MQ_send (GNUNET_SERVICE_client_get_mq (client), env); |
413 | GNUNET_SERVICE_client_continue(client); | 414 | GNUNET_SERVICE_client_continue (client); |
414 | return; | 415 | return; |
415 | } | 416 | } |
416 | send_result_code(client, 0, "ego not found"); | 417 | send_result_code (client, 0, "ego not found"); |
417 | GNUNET_SERVICE_client_continue(client); | 418 | GNUNET_SERVICE_client_continue (client); |
418 | } | 419 | } |
419 | 420 | ||
420 | 421 | ||
@@ -426,26 +427,26 @@ handle_lookup_by_suffix_message(void *cls, const struct LookupMessage *message) | |||
426 | * @return #GNUNET_OK if @a msg is well-formed | 427 | * @return #GNUNET_OK if @a msg is well-formed |
427 | */ | 428 | */ |
428 | static int | 429 | static int |
429 | check_get_default_message(void *cls, const struct GetDefaultMessage *msg) | 430 | check_get_default_message (void *cls, const struct GetDefaultMessage *msg) |
430 | { | 431 | { |
431 | uint16_t size; | 432 | uint16_t size; |
432 | uint16_t name_len; | 433 | uint16_t name_len; |
433 | const char *name; | 434 | const char *name; |
434 | 435 | ||
435 | size = ntohs(msg->header.size); | 436 | size = ntohs (msg->header.size); |
436 | if (size <= sizeof(struct GetDefaultMessage)) | 437 | if (size <= sizeof(struct GetDefaultMessage)) |
437 | { | 438 | { |
438 | GNUNET_break(0); | 439 | GNUNET_break (0); |
439 | return GNUNET_SYSERR; | 440 | return GNUNET_SYSERR; |
440 | } | 441 | } |
441 | name = (const char *)&msg[1]; | 442 | name = (const char *) &msg[1]; |
442 | name_len = ntohs(msg->name_len); | 443 | name_len = ntohs (msg->name_len); |
443 | if ((name_len + sizeof(struct GetDefaultMessage) != size) || | 444 | if ((name_len + sizeof(struct GetDefaultMessage) != size) || |
444 | (0 != ntohs(msg->reserved)) || ('\0' != name[name_len - 1])) | 445 | (0 != ntohs (msg->reserved)) || ('\0' != name[name_len - 1])) |
445 | { | 446 | { |
446 | GNUNET_break(0); | 447 | GNUNET_break (0); |
447 | return GNUNET_SYSERR; | 448 | return GNUNET_SYSERR; |
448 | } | 449 | } |
449 | return GNUNET_OK; | 450 | return GNUNET_OK; |
450 | } | 451 | } |
451 | 452 | ||
@@ -459,7 +460,7 @@ check_get_default_message(void *cls, const struct GetDefaultMessage *msg) | |||
459 | * @param message the message received | 460 | * @param message the message received |
460 | */ | 461 | */ |
461 | static void | 462 | static void |
462 | handle_get_default_message(void *cls, const struct GetDefaultMessage *gdm) | 463 | handle_get_default_message (void *cls, const struct GetDefaultMessage *gdm) |
463 | { | 464 | { |
464 | struct GNUNET_MQ_Envelope *env; | 465 | struct GNUNET_MQ_Envelope *env; |
465 | struct GNUNET_SERVICE_Client *client = cls; | 466 | struct GNUNET_SERVICE_Client *client = cls; |
@@ -468,41 +469,41 @@ handle_get_default_message(void *cls, const struct GetDefaultMessage *gdm) | |||
468 | char *identifier; | 469 | char *identifier; |
469 | 470 | ||
470 | 471 | ||
471 | name = GNUNET_strdup((const char *)&gdm[1]); | 472 | name = GNUNET_strdup ((const char *) &gdm[1]); |
472 | GNUNET_STRINGS_utf8_tolower((const char *)&gdm[1], name); | 473 | GNUNET_STRINGS_utf8_tolower ((const char *) &gdm[1], name); |
473 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, | 474 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
474 | "Received GET_DEFAULT for service `%s' from client\n", | 475 | "Received GET_DEFAULT for service `%s' from client\n", |
475 | name); | 476 | name); |
476 | if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_string(subsystem_cfg, | 477 | if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_string (subsystem_cfg, |
477 | name, | 478 | name, |
478 | "DEFAULT_IDENTIFIER", | 479 | "DEFAULT_IDENTIFIER", |
479 | &identifier)) | 480 | &identifier)) |
480 | { | 481 | { |
481 | send_result_code(client, 1, gettext_noop("no default known")); | 482 | send_result_code (client, 1, gettext_noop ("no default known")); |
482 | GNUNET_SERVICE_client_continue(client); | 483 | GNUNET_SERVICE_client_continue (client); |
483 | GNUNET_free(name); | 484 | GNUNET_free (name); |
484 | return; | 485 | return; |
485 | } | 486 | } |
486 | for (ego = ego_head; NULL != ego; ego = ego->next) | 487 | for (ego = ego_head; NULL != ego; ego = ego->next) |
488 | { | ||
489 | if (0 == strcmp (ego->identifier, identifier)) | ||
487 | { | 490 | { |
488 | if (0 == strcmp(ego->identifier, identifier)) | 491 | env = create_set_default_message (ego, name); |
489 | { | 492 | GNUNET_MQ_send (GNUNET_SERVICE_client_get_mq (client), env); |
490 | env = create_set_default_message(ego, name); | 493 | GNUNET_SERVICE_client_continue (client); |
491 | GNUNET_MQ_send(GNUNET_SERVICE_client_get_mq(client), env); | 494 | GNUNET_free (identifier); |
492 | GNUNET_SERVICE_client_continue(client); | 495 | GNUNET_free (name); |
493 | GNUNET_free(identifier); | 496 | return; |
494 | GNUNET_free(name); | ||
495 | return; | ||
496 | } | ||
497 | } | 497 | } |
498 | GNUNET_free(identifier); | 498 | } |
499 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Failed to find ego `%s'\n", name); | 499 | GNUNET_free (identifier); |
500 | GNUNET_free(name); | 500 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Failed to find ego `%s'\n", name); |
501 | send_result_code(client, | 501 | GNUNET_free (name); |
502 | 1, | 502 | send_result_code (client, |
503 | gettext_noop( | 503 | 1, |
504 | "default configured, but ego unknown (internal error)")); | 504 | gettext_noop ( |
505 | GNUNET_SERVICE_client_continue(client); | 505 | "default configured, but ego unknown (internal error)")); |
506 | GNUNET_SERVICE_client_continue (client); | ||
506 | } | 507 | } |
507 | 508 | ||
508 | 509 | ||
@@ -514,10 +515,10 @@ handle_get_default_message(void *cls, const struct GetDefaultMessage *gdm) | |||
514 | * @return 0 if the keys are equal | 515 | * @return 0 if the keys are equal |
515 | */ | 516 | */ |
516 | static int | 517 | static int |
517 | key_cmp(const struct GNUNET_CRYPTO_EcdsaPrivateKey *pk1, | 518 | key_cmp (const struct GNUNET_CRYPTO_EcdsaPrivateKey *pk1, |
518 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *pk2) | 519 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *pk2) |
519 | { | 520 | { |
520 | return GNUNET_memcmp(pk1, pk2); | 521 | return GNUNET_memcmp (pk1, pk2); |
521 | } | 522 | } |
522 | 523 | ||
523 | /** | 524 | /** |
@@ -528,31 +529,31 @@ key_cmp(const struct GNUNET_CRYPTO_EcdsaPrivateKey *pk1, | |||
528 | * @return #GNUNET_OK if @a msg is well-formed | 529 | * @return #GNUNET_OK if @a msg is well-formed |
529 | */ | 530 | */ |
530 | static int | 531 | static int |
531 | check_set_default_message(void *cls, const struct SetDefaultMessage *msg) | 532 | check_set_default_message (void *cls, const struct SetDefaultMessage *msg) |
532 | { | 533 | { |
533 | uint16_t size; | 534 | uint16_t size; |
534 | uint16_t name_len; | 535 | uint16_t name_len; |
535 | const char *str; | 536 | const char *str; |
536 | 537 | ||
537 | size = ntohs(msg->header.size); | 538 | size = ntohs (msg->header.size); |
538 | if (size <= sizeof(struct SetDefaultMessage)) | 539 | if (size <= sizeof(struct SetDefaultMessage)) |
539 | { | 540 | { |
540 | GNUNET_break(0); | 541 | GNUNET_break (0); |
541 | return GNUNET_SYSERR; | 542 | return GNUNET_SYSERR; |
542 | } | 543 | } |
543 | name_len = ntohs(msg->name_len); | 544 | name_len = ntohs (msg->name_len); |
544 | GNUNET_break(0 == ntohs(msg->reserved)); | 545 | GNUNET_break (0 == ntohs (msg->reserved)); |
545 | if (name_len + sizeof(struct SetDefaultMessage) != size) | 546 | if (name_len + sizeof(struct SetDefaultMessage) != size) |
546 | { | 547 | { |
547 | GNUNET_break(0); | 548 | GNUNET_break (0); |
548 | return GNUNET_SYSERR; | 549 | return GNUNET_SYSERR; |
549 | } | 550 | } |
550 | str = (const char *)&msg[1]; | 551 | str = (const char *) &msg[1]; |
551 | if ('\0' != str[name_len - 1]) | 552 | if ('\0' != str[name_len - 1]) |
552 | { | 553 | { |
553 | GNUNET_break(0); | 554 | GNUNET_break (0); |
554 | return GNUNET_SYSERR; | 555 | return GNUNET_SYSERR; |
555 | } | 556 | } |
556 | return GNUNET_OK; | 557 | return GNUNET_OK; |
557 | } | 558 | } |
558 | 559 | ||
@@ -565,43 +566,43 @@ check_set_default_message(void *cls, const struct SetDefaultMessage *msg) | |||
565 | * @param message the message received | 566 | * @param message the message received |
566 | */ | 567 | */ |
567 | static void | 568 | static void |
568 | handle_set_default_message(void *cls, const struct SetDefaultMessage *sdm) | 569 | handle_set_default_message (void *cls, const struct SetDefaultMessage *sdm) |
569 | { | 570 | { |
570 | struct Ego *ego; | 571 | struct Ego *ego; |
571 | struct GNUNET_SERVICE_Client *client = cls; | 572 | struct GNUNET_SERVICE_Client *client = cls; |
572 | char *str; | 573 | char *str; |
573 | 574 | ||
574 | str = GNUNET_strdup((const char *)&sdm[1]); | 575 | str = GNUNET_strdup ((const char *) &sdm[1]); |
575 | GNUNET_STRINGS_utf8_tolower((const char *)&sdm[1], str); | 576 | GNUNET_STRINGS_utf8_tolower ((const char *) &sdm[1], str); |
576 | 577 | ||
577 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, | 578 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
578 | "Received SET_DEFAULT for service `%s' from client\n", | 579 | "Received SET_DEFAULT for service `%s' from client\n", |
579 | str); | 580 | str); |
580 | for (ego = ego_head; NULL != ego; ego = ego->next) | 581 | for (ego = ego_head; NULL != ego; ego = ego->next) |
582 | { | ||
583 | if (0 == key_cmp (ego->pk, &sdm->private_key)) | ||
581 | { | 584 | { |
582 | if (0 == key_cmp(ego->pk, &sdm->private_key)) | 585 | GNUNET_CONFIGURATION_set_value_string (subsystem_cfg, |
583 | { | 586 | str, |
584 | GNUNET_CONFIGURATION_set_value_string(subsystem_cfg, | 587 | "DEFAULT_IDENTIFIER", |
585 | str, | 588 | ego->identifier); |
586 | "DEFAULT_IDENTIFIER", | 589 | if (GNUNET_OK != |
587 | ego->identifier); | 590 | GNUNET_CONFIGURATION_write (subsystem_cfg, subsystem_cfg_file)) |
588 | if (GNUNET_OK != | 591 | GNUNET_log ( |
589 | GNUNET_CONFIGURATION_write(subsystem_cfg, subsystem_cfg_file)) | 592 | GNUNET_ERROR_TYPE_ERROR, |
590 | GNUNET_log( | 593 | _ ("Failed to write subsystem default identifier map to `%s'.\n"), |
591 | GNUNET_ERROR_TYPE_ERROR, | 594 | subsystem_cfg_file); |
592 | _("Failed to write subsystem default identifier map to `%s'.\n"), | 595 | send_result_code (client, 0, NULL); |
593 | subsystem_cfg_file); | 596 | GNUNET_SERVICE_client_continue (client); |
594 | send_result_code(client, 0, NULL); | 597 | GNUNET_free (str); |
595 | GNUNET_SERVICE_client_continue(client); | 598 | return; |
596 | GNUNET_free(str); | ||
597 | return; | ||
598 | } | ||
599 | } | 599 | } |
600 | send_result_code(client, | 600 | } |
601 | 1, | 601 | send_result_code (client, |
602 | _("Unknown ego specified for service (internal error)")); | 602 | 1, |
603 | GNUNET_free(str); | 603 | _ ("Unknown ego specified for service (internal error)")); |
604 | GNUNET_SERVICE_client_continue(client); | 604 | GNUNET_free (str); |
605 | GNUNET_SERVICE_client_continue (client); | ||
605 | } | 606 | } |
606 | 607 | ||
607 | 608 | ||
@@ -611,21 +612,21 @@ handle_set_default_message(void *cls, const struct SetDefaultMessage *sdm) | |||
611 | * @param ego ego to send the update for | 612 | * @param ego ego to send the update for |
612 | */ | 613 | */ |
613 | static void | 614 | static void |
614 | notify_listeners(struct Ego *ego) | 615 | notify_listeners (struct Ego *ego) |
615 | { | 616 | { |
616 | struct UpdateMessage *um; | 617 | struct UpdateMessage *um; |
617 | size_t name_len; | 618 | size_t name_len; |
618 | 619 | ||
619 | name_len = (NULL == ego->identifier) ? 0 : (strlen(ego->identifier) + 1); | 620 | name_len = (NULL == ego->identifier) ? 0 : (strlen (ego->identifier) + 1); |
620 | um = GNUNET_malloc(sizeof(struct UpdateMessage) + name_len); | 621 | um = GNUNET_malloc (sizeof(struct UpdateMessage) + name_len); |
621 | um->header.type = htons(GNUNET_MESSAGE_TYPE_IDENTITY_UPDATE); | 622 | um->header.type = htons (GNUNET_MESSAGE_TYPE_IDENTITY_UPDATE); |
622 | um->header.size = htons(sizeof(struct UpdateMessage) + name_len); | 623 | um->header.size = htons (sizeof(struct UpdateMessage) + name_len); |
623 | um->name_len = htons(name_len); | 624 | um->name_len = htons (name_len); |
624 | um->end_of_list = htons(GNUNET_NO); | 625 | um->end_of_list = htons (GNUNET_NO); |
625 | um->private_key = *ego->pk; | 626 | um->private_key = *ego->pk; |
626 | GNUNET_memcpy(&um[1], ego->identifier, name_len); | 627 | GNUNET_memcpy (&um[1], ego->identifier, name_len); |
627 | GNUNET_notification_context_broadcast(nc, &um->header, GNUNET_NO); | 628 | GNUNET_notification_context_broadcast (nc, &um->header, GNUNET_NO); |
628 | GNUNET_free(um); | 629 | GNUNET_free (um); |
629 | } | 630 | } |
630 | 631 | ||
631 | /** | 632 | /** |
@@ -636,31 +637,31 @@ notify_listeners(struct Ego *ego) | |||
636 | * @return #GNUNET_OK if @a msg is well-formed | 637 | * @return #GNUNET_OK if @a msg is well-formed |
637 | */ | 638 | */ |
638 | static int | 639 | static int |
639 | check_create_message(void *cls, const struct CreateRequestMessage *msg) | 640 | check_create_message (void *cls, const struct CreateRequestMessage *msg) |
640 | { | 641 | { |
641 | uint16_t size; | 642 | uint16_t size; |
642 | uint16_t name_len; | 643 | uint16_t name_len; |
643 | const char *str; | 644 | const char *str; |
644 | 645 | ||
645 | size = ntohs(msg->header.size); | 646 | size = ntohs (msg->header.size); |
646 | if (size <= sizeof(struct CreateRequestMessage)) | 647 | if (size <= sizeof(struct CreateRequestMessage)) |
647 | { | 648 | { |
648 | GNUNET_break(0); | 649 | GNUNET_break (0); |
649 | return GNUNET_SYSERR; | 650 | return GNUNET_SYSERR; |
650 | } | 651 | } |
651 | name_len = ntohs(msg->name_len); | 652 | name_len = ntohs (msg->name_len); |
652 | GNUNET_break(0 == ntohs(msg->reserved)); | 653 | GNUNET_break (0 == ntohs (msg->reserved)); |
653 | if (name_len + sizeof(struct CreateRequestMessage) != size) | 654 | if (name_len + sizeof(struct CreateRequestMessage) != size) |
654 | { | 655 | { |
655 | GNUNET_break(0); | 656 | GNUNET_break (0); |
656 | return GNUNET_SYSERR; | 657 | return GNUNET_SYSERR; |
657 | } | 658 | } |
658 | str = (const char *)&msg[1]; | 659 | str = (const char *) &msg[1]; |
659 | if ('\0' != str[name_len - 1]) | 660 | if ('\0' != str[name_len - 1]) |
660 | { | 661 | { |
661 | GNUNET_break(0); | 662 | GNUNET_break (0); |
662 | return GNUNET_SYSERR; | 663 | return GNUNET_SYSERR; |
663 | } | 664 | } |
664 | return GNUNET_OK; | 665 | return GNUNET_OK; |
665 | } | 666 | } |
666 | 667 | ||
@@ -673,55 +674,56 @@ check_create_message(void *cls, const struct CreateRequestMessage *msg) | |||
673 | * @param message the message received | 674 | * @param message the message received |
674 | */ | 675 | */ |
675 | static void | 676 | static void |
676 | handle_create_message(void *cls, const struct CreateRequestMessage *crm) | 677 | handle_create_message (void *cls, const struct CreateRequestMessage *crm) |
677 | { | 678 | { |
678 | struct GNUNET_SERVICE_Client *client = cls; | 679 | struct GNUNET_SERVICE_Client *client = cls; |
679 | struct Ego *ego; | 680 | struct Ego *ego; |
680 | char *str; | 681 | char *str; |
681 | char *fn; | 682 | char *fn; |
682 | 683 | ||
683 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Received CREATE message from client\n"); | 684 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received CREATE message from client\n"); |
684 | str = GNUNET_strdup((const char *)&crm[1]); | 685 | str = GNUNET_strdup ((const char *) &crm[1]); |
685 | GNUNET_STRINGS_utf8_tolower((const char *)&crm[1], str); | 686 | GNUNET_STRINGS_utf8_tolower ((const char *) &crm[1], str); |
686 | for (ego = ego_head; NULL != ego; ego = ego->next) | 687 | for (ego = ego_head; NULL != ego; ego = ego->next) |
688 | { | ||
689 | if (0 == strcmp (ego->identifier, str)) | ||
687 | { | 690 | { |
688 | if (0 == strcmp(ego->identifier, str)) | 691 | send_result_code (client, |
689 | { | 692 | 1, |
690 | send_result_code(client, | 693 | gettext_noop ( |
691 | 1, | 694 | "identifier already in use for another ego")); |
692 | gettext_noop( | 695 | GNUNET_SERVICE_client_continue (client); |
693 | "identifier already in use for another ego")); | 696 | GNUNET_free (str); |
694 | GNUNET_SERVICE_client_continue(client); | 697 | return; |
695 | GNUNET_free(str); | ||
696 | return; | ||
697 | } | ||
698 | } | 698 | } |
699 | ego = GNUNET_new(struct Ego); | 699 | } |
700 | ego->pk = GNUNET_new(struct GNUNET_CRYPTO_EcdsaPrivateKey); | 700 | ego = GNUNET_new (struct Ego); |
701 | ego->pk = GNUNET_new (struct GNUNET_CRYPTO_EcdsaPrivateKey); | ||
701 | *ego->pk = crm->private_key; | 702 | *ego->pk = crm->private_key; |
702 | ego->identifier = GNUNET_strdup(str); | 703 | ego->identifier = GNUNET_strdup (str); |
703 | GNUNET_CONTAINER_DLL_insert(ego_head, ego_tail, ego); | 704 | GNUNET_CONTAINER_DLL_insert (ego_head, ego_tail, ego); |
704 | send_result_code(client, 0, NULL); | 705 | send_result_code (client, 0, NULL); |
705 | fn = get_ego_filename(ego); | 706 | fn = get_ego_filename (ego); |
706 | (void)GNUNET_DISK_directory_create_for_file(fn); | 707 | (void) GNUNET_DISK_directory_create_for_file (fn); |
707 | if (sizeof(struct GNUNET_CRYPTO_EcdsaPrivateKey) != | 708 | if (sizeof(struct GNUNET_CRYPTO_EcdsaPrivateKey) != |
708 | GNUNET_DISK_fn_write(fn, | 709 | GNUNET_DISK_fn_write (fn, |
709 | &crm->private_key, | 710 | &crm->private_key, |
710 | sizeof(struct GNUNET_CRYPTO_EcdsaPrivateKey), | 711 | sizeof(struct GNUNET_CRYPTO_EcdsaPrivateKey), |
711 | GNUNET_DISK_PERM_USER_READ | | 712 | GNUNET_DISK_PERM_USER_READ |
712 | GNUNET_DISK_PERM_USER_WRITE)) | 713 | | GNUNET_DISK_PERM_USER_WRITE)) |
713 | GNUNET_log_strerror_file(GNUNET_ERROR_TYPE_ERROR, "write", fn); | 714 | GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR, "write", fn); |
714 | GNUNET_free(fn); | 715 | GNUNET_free (fn); |
715 | GNUNET_free(str); | 716 | GNUNET_free (str); |
716 | notify_listeners(ego); | 717 | notify_listeners (ego); |
717 | GNUNET_SERVICE_client_continue(client); | 718 | GNUNET_SERVICE_client_continue (client); |
718 | } | 719 | } |
719 | 720 | ||
720 | 721 | ||
721 | /** | 722 | /** |
722 | * Closure for 'handle_ego_rename'. | 723 | * Closure for 'handle_ego_rename'. |
723 | */ | 724 | */ |
724 | struct RenameContext { | 725 | struct RenameContext |
726 | { | ||
725 | /** | 727 | /** |
726 | * Old name. | 728 | * Old name. |
727 | */ | 729 | */ |
@@ -741,26 +743,26 @@ struct RenameContext { | |||
741 | * @param section a section in the configuration to process | 743 | * @param section a section in the configuration to process |
742 | */ | 744 | */ |
743 | static void | 745 | static void |
744 | handle_ego_rename(void *cls, const char *section) | 746 | handle_ego_rename (void *cls, const char *section) |
745 | { | 747 | { |
746 | struct RenameContext *rc = cls; | 748 | struct RenameContext *rc = cls; |
747 | char *id; | 749 | char *id; |
748 | 750 | ||
749 | if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_string(subsystem_cfg, | 751 | if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_string (subsystem_cfg, |
750 | section, | 752 | section, |
751 | "DEFAULT_IDENTIFIER", | 753 | "DEFAULT_IDENTIFIER", |
752 | &id)) | 754 | &id)) |
753 | return; | 755 | return; |
754 | if (0 != strcmp(id, rc->old_name)) | 756 | if (0 != strcmp (id, rc->old_name)) |
755 | { | 757 | { |
756 | GNUNET_free(id); | 758 | GNUNET_free (id); |
757 | return; | 759 | return; |
758 | } | 760 | } |
759 | GNUNET_CONFIGURATION_set_value_string(subsystem_cfg, | 761 | GNUNET_CONFIGURATION_set_value_string (subsystem_cfg, |
760 | section, | 762 | section, |
761 | "DEFAULT_IDENTIFIER", | 763 | "DEFAULT_IDENTIFIER", |
762 | rc->new_name); | 764 | rc->new_name); |
763 | GNUNET_free(id); | 765 | GNUNET_free (id); |
764 | } | 766 | } |
765 | 767 | ||
766 | /** | 768 | /** |
@@ -771,7 +773,7 @@ handle_ego_rename(void *cls, const char *section) | |||
771 | * @return #GNUNET_OK if @a msg is well-formed | 773 | * @return #GNUNET_OK if @a msg is well-formed |
772 | */ | 774 | */ |
773 | static int | 775 | static int |
774 | check_rename_message(void *cls, const struct RenameMessage *msg) | 776 | check_rename_message (void *cls, const struct RenameMessage *msg) |
775 | { | 777 | { |
776 | uint16_t size; | 778 | uint16_t size; |
777 | uint16_t old_name_len; | 779 | uint16_t old_name_len; |
@@ -779,23 +781,23 @@ check_rename_message(void *cls, const struct RenameMessage *msg) | |||
779 | const char *old_name; | 781 | const char *old_name; |
780 | const char *new_name; | 782 | const char *new_name; |
781 | 783 | ||
782 | size = ntohs(msg->header.size); | 784 | size = ntohs (msg->header.size); |
783 | if (size <= sizeof(struct RenameMessage)) | 785 | if (size <= sizeof(struct RenameMessage)) |
784 | { | 786 | { |
785 | GNUNET_break(0); | 787 | GNUNET_break (0); |
786 | return GNUNET_SYSERR; | 788 | return GNUNET_SYSERR; |
787 | } | 789 | } |
788 | old_name_len = ntohs(msg->old_name_len); | 790 | old_name_len = ntohs (msg->old_name_len); |
789 | new_name_len = ntohs(msg->new_name_len); | 791 | new_name_len = ntohs (msg->new_name_len); |
790 | old_name = (const char *)&msg[1]; | 792 | old_name = (const char *) &msg[1]; |
791 | new_name = &old_name[old_name_len]; | 793 | new_name = &old_name[old_name_len]; |
792 | if ((old_name_len + new_name_len + sizeof(struct RenameMessage) != size) || | 794 | if ((old_name_len + new_name_len + sizeof(struct RenameMessage) != size) || |
793 | ('\0' != old_name[old_name_len - 1]) || | 795 | ('\0' != old_name[old_name_len - 1]) || |
794 | ('\0' != new_name[new_name_len - 1])) | 796 | ('\0' != new_name[new_name_len - 1])) |
795 | { | 797 | { |
796 | GNUNET_break(0); | 798 | GNUNET_break (0); |
797 | return GNUNET_SYSERR; | 799 | return GNUNET_SYSERR; |
798 | } | 800 | } |
799 | 801 | ||
800 | return GNUNET_OK; | 802 | return GNUNET_OK; |
801 | } | 803 | } |
@@ -810,7 +812,7 @@ check_rename_message(void *cls, const struct RenameMessage *msg) | |||
810 | * @param message the message received | 812 | * @param message the message received |
811 | */ | 813 | */ |
812 | static void | 814 | static void |
813 | handle_rename_message(void *cls, const struct RenameMessage *rm) | 815 | handle_rename_message (void *cls, const struct RenameMessage *rm) |
814 | { | 816 | { |
815 | uint16_t old_name_len; | 817 | uint16_t old_name_len; |
816 | struct Ego *ego; | 818 | struct Ego *ego; |
@@ -822,65 +824,65 @@ handle_rename_message(void *cls, const struct RenameMessage *rm) | |||
822 | char *fn_new; | 824 | char *fn_new; |
823 | const char *old_name_tmp; | 825 | const char *old_name_tmp; |
824 | 826 | ||
825 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Received RENAME message from client\n"); | 827 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received RENAME message from client\n"); |
826 | old_name_len = ntohs(rm->old_name_len); | 828 | old_name_len = ntohs (rm->old_name_len); |
827 | old_name_tmp = (const char *)&rm[1]; | 829 | old_name_tmp = (const char *) &rm[1]; |
828 | old_name = GNUNET_strdup(old_name_tmp); | 830 | old_name = GNUNET_strdup (old_name_tmp); |
829 | GNUNET_STRINGS_utf8_tolower(old_name_tmp, old_name); | 831 | GNUNET_STRINGS_utf8_tolower (old_name_tmp, old_name); |
830 | new_name = GNUNET_strdup(&old_name_tmp[old_name_len]); | 832 | new_name = GNUNET_strdup (&old_name_tmp[old_name_len]); |
831 | GNUNET_STRINGS_utf8_tolower(&old_name_tmp[old_name_len], new_name); | 833 | GNUNET_STRINGS_utf8_tolower (&old_name_tmp[old_name_len], new_name); |
832 | 834 | ||
833 | /* check if new name is already in use */ | 835 | /* check if new name is already in use */ |
834 | for (ego = ego_head; NULL != ego; ego = ego->next) | 836 | for (ego = ego_head; NULL != ego; ego = ego->next) |
837 | { | ||
838 | if (0 == strcmp (ego->identifier, new_name)) | ||
835 | { | 839 | { |
836 | if (0 == strcmp(ego->identifier, new_name)) | 840 | send_result_code (client, 1, gettext_noop ("target name already exists")); |
837 | { | 841 | GNUNET_SERVICE_client_continue (client); |
838 | send_result_code(client, 1, gettext_noop("target name already exists")); | 842 | GNUNET_free (old_name); |
839 | GNUNET_SERVICE_client_continue(client); | 843 | GNUNET_free (new_name); |
840 | GNUNET_free(old_name); | 844 | return; |
841 | GNUNET_free(new_name); | ||
842 | return; | ||
843 | } | ||
844 | } | 845 | } |
846 | } | ||
845 | 847 | ||
846 | /* locate old name and, if found, perform rename */ | 848 | /* locate old name and, if found, perform rename */ |
847 | for (ego = ego_head; NULL != ego; ego = ego->next) | 849 | for (ego = ego_head; NULL != ego; ego = ego->next) |
850 | { | ||
851 | if (0 == strcmp (ego->identifier, old_name)) | ||
848 | { | 852 | { |
849 | if (0 == strcmp(ego->identifier, old_name)) | 853 | fn_old = get_ego_filename (ego); |
850 | { | 854 | GNUNET_free (ego->identifier); |
851 | fn_old = get_ego_filename(ego); | 855 | rename_ctx.old_name = old_name; |
852 | GNUNET_free(ego->identifier); | 856 | rename_ctx.new_name = new_name; |
853 | rename_ctx.old_name = old_name; | 857 | GNUNET_CONFIGURATION_iterate_sections (subsystem_cfg, |
854 | rename_ctx.new_name = new_name; | 858 | &handle_ego_rename, |
855 | GNUNET_CONFIGURATION_iterate_sections(subsystem_cfg, | 859 | &rename_ctx); |
856 | &handle_ego_rename, | 860 | if (GNUNET_OK != |
857 | &rename_ctx); | 861 | GNUNET_CONFIGURATION_write (subsystem_cfg, subsystem_cfg_file)) |
858 | if (GNUNET_OK != | 862 | GNUNET_log ( |
859 | GNUNET_CONFIGURATION_write(subsystem_cfg, subsystem_cfg_file)) | 863 | GNUNET_ERROR_TYPE_ERROR, |
860 | GNUNET_log( | 864 | _ ("Failed to write subsystem default identifier map to `%s'.\n"), |
861 | GNUNET_ERROR_TYPE_ERROR, | 865 | subsystem_cfg_file); |
862 | _("Failed to write subsystem default identifier map to `%s'.\n"), | 866 | ego->identifier = GNUNET_strdup (new_name); |
863 | subsystem_cfg_file); | 867 | fn_new = get_ego_filename (ego); |
864 | ego->identifier = GNUNET_strdup(new_name); | 868 | if (0 != rename (fn_old, fn_new)) |
865 | fn_new = get_ego_filename(ego); | 869 | GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING, "rename", fn_old); |
866 | if (0 != rename(fn_old, fn_new)) | 870 | GNUNET_free (fn_old); |
867 | GNUNET_log_strerror_file(GNUNET_ERROR_TYPE_WARNING, "rename", fn_old); | 871 | GNUNET_free (fn_new); |
868 | GNUNET_free(fn_old); | 872 | GNUNET_free (old_name); |
869 | GNUNET_free(fn_new); | 873 | GNUNET_free (new_name); |
870 | GNUNET_free(old_name); | 874 | notify_listeners (ego); |
871 | GNUNET_free(new_name); | 875 | send_result_code (client, 0, NULL); |
872 | notify_listeners(ego); | 876 | GNUNET_SERVICE_client_continue (client); |
873 | send_result_code(client, 0, NULL); | 877 | return; |
874 | GNUNET_SERVICE_client_continue(client); | ||
875 | return; | ||
876 | } | ||
877 | } | 878 | } |
879 | } | ||
878 | 880 | ||
879 | /* failed to locate old name */ | 881 | /* failed to locate old name */ |
880 | send_result_code(client, 1, gettext_noop("no matching ego found")); | 882 | send_result_code (client, 1, gettext_noop ("no matching ego found")); |
881 | GNUNET_free(old_name); | 883 | GNUNET_free (old_name); |
882 | GNUNET_free(new_name); | 884 | GNUNET_free (new_name); |
883 | GNUNET_SERVICE_client_continue(client); | 885 | GNUNET_SERVICE_client_continue (client); |
884 | } | 886 | } |
885 | 887 | ||
886 | 888 | ||
@@ -892,26 +894,26 @@ handle_rename_message(void *cls, const struct RenameMessage *rm) | |||
892 | * @param section a section in the configuration to process | 894 | * @param section a section in the configuration to process |
893 | */ | 895 | */ |
894 | static void | 896 | static void |
895 | handle_ego_delete(void *cls, const char *section) | 897 | handle_ego_delete (void *cls, const char *section) |
896 | { | 898 | { |
897 | const char *identifier = cls; | 899 | const char *identifier = cls; |
898 | char *id; | 900 | char *id; |
899 | 901 | ||
900 | if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_string(subsystem_cfg, | 902 | if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_string (subsystem_cfg, |
901 | section, | 903 | section, |
902 | "DEFAULT_IDENTIFIER", | 904 | "DEFAULT_IDENTIFIER", |
903 | &id)) | 905 | &id)) |
904 | return; | 906 | return; |
905 | if (0 != strcmp(id, identifier)) | 907 | if (0 != strcmp (id, identifier)) |
906 | { | 908 | { |
907 | GNUNET_free(id); | 909 | GNUNET_free (id); |
908 | return; | 910 | return; |
909 | } | 911 | } |
910 | GNUNET_CONFIGURATION_set_value_string(subsystem_cfg, | 912 | GNUNET_CONFIGURATION_set_value_string (subsystem_cfg, |
911 | section, | 913 | section, |
912 | "DEFAULT_IDENTIFIER", | 914 | "DEFAULT_IDENTIFIER", |
913 | NULL); | 915 | NULL); |
914 | GNUNET_free(id); | 916 | GNUNET_free (id); |
915 | } | 917 | } |
916 | 918 | ||
917 | /** | 919 | /** |
@@ -922,26 +924,26 @@ handle_ego_delete(void *cls, const char *section) | |||
922 | * @return #GNUNET_OK if @a msg is well-formed | 924 | * @return #GNUNET_OK if @a msg is well-formed |
923 | */ | 925 | */ |
924 | static int | 926 | static int |
925 | check_delete_message(void *cls, const struct DeleteMessage *msg) | 927 | check_delete_message (void *cls, const struct DeleteMessage *msg) |
926 | { | 928 | { |
927 | uint16_t size; | 929 | uint16_t size; |
928 | uint16_t name_len; | 930 | uint16_t name_len; |
929 | const char *name; | 931 | const char *name; |
930 | 932 | ||
931 | size = ntohs(msg->header.size); | 933 | size = ntohs (msg->header.size); |
932 | if (size <= sizeof(struct DeleteMessage)) | 934 | if (size <= sizeof(struct DeleteMessage)) |
933 | { | 935 | { |
934 | GNUNET_break(0); | 936 | GNUNET_break (0); |
935 | return GNUNET_SYSERR; | 937 | return GNUNET_SYSERR; |
936 | } | 938 | } |
937 | name = (const char *)&msg[1]; | 939 | name = (const char *) &msg[1]; |
938 | name_len = ntohs(msg->name_len); | 940 | name_len = ntohs (msg->name_len); |
939 | if ((name_len + sizeof(struct DeleteMessage) != size) || | 941 | if ((name_len + sizeof(struct DeleteMessage) != size) || |
940 | (0 != ntohs(msg->reserved)) || ('\0' != name[name_len - 1])) | 942 | (0 != ntohs (msg->reserved)) || ('\0' != name[name_len - 1])) |
941 | { | 943 | { |
942 | GNUNET_break(0); | 944 | GNUNET_break (0); |
943 | return GNUNET_SYSERR; | 945 | return GNUNET_SYSERR; |
944 | } | 946 | } |
945 | return GNUNET_OK; | 947 | return GNUNET_OK; |
946 | } | 948 | } |
947 | 949 | ||
@@ -955,50 +957,50 @@ check_delete_message(void *cls, const struct DeleteMessage *msg) | |||
955 | * @param message the message received | 957 | * @param message the message received |
956 | */ | 958 | */ |
957 | static void | 959 | static void |
958 | handle_delete_message(void *cls, const struct DeleteMessage *dm) | 960 | handle_delete_message (void *cls, const struct DeleteMessage *dm) |
959 | { | 961 | { |
960 | struct Ego *ego; | 962 | struct Ego *ego; |
961 | char *name; | 963 | char *name; |
962 | char *fn; | 964 | char *fn; |
963 | struct GNUNET_SERVICE_Client *client = cls; | 965 | struct GNUNET_SERVICE_Client *client = cls; |
964 | 966 | ||
965 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Received DELETE message from client\n"); | 967 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received DELETE message from client\n"); |
966 | name = GNUNET_strdup((const char *)&dm[1]); | 968 | name = GNUNET_strdup ((const char *) &dm[1]); |
967 | GNUNET_STRINGS_utf8_tolower((const char *)&dm[1], name); | 969 | GNUNET_STRINGS_utf8_tolower ((const char *) &dm[1], name); |
968 | 970 | ||
969 | for (ego = ego_head; NULL != ego; ego = ego->next) | 971 | for (ego = ego_head; NULL != ego; ego = ego->next) |
972 | { | ||
973 | if (0 == strcmp (ego->identifier, name)) | ||
970 | { | 974 | { |
971 | if (0 == strcmp(ego->identifier, name)) | 975 | GNUNET_CONTAINER_DLL_remove (ego_head, ego_tail, ego); |
972 | { | 976 | GNUNET_CONFIGURATION_iterate_sections (subsystem_cfg, |
973 | GNUNET_CONTAINER_DLL_remove(ego_head, ego_tail, ego); | 977 | &handle_ego_delete, |
974 | GNUNET_CONFIGURATION_iterate_sections(subsystem_cfg, | 978 | ego->identifier); |
975 | &handle_ego_delete, | 979 | if (GNUNET_OK != |
976 | ego->identifier); | 980 | GNUNET_CONFIGURATION_write (subsystem_cfg, subsystem_cfg_file)) |
977 | if (GNUNET_OK != | 981 | GNUNET_log ( |
978 | GNUNET_CONFIGURATION_write(subsystem_cfg, subsystem_cfg_file)) | 982 | GNUNET_ERROR_TYPE_ERROR, |
979 | GNUNET_log( | 983 | _ ("Failed to write subsystem default identifier map to `%s'.\n"), |
980 | GNUNET_ERROR_TYPE_ERROR, | 984 | subsystem_cfg_file); |
981 | _("Failed to write subsystem default identifier map to `%s'.\n"), | 985 | fn = get_ego_filename (ego); |
982 | subsystem_cfg_file); | 986 | if (0 != unlink (fn)) |
983 | fn = get_ego_filename(ego); | 987 | GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING, "unlink", fn); |
984 | if (0 != unlink(fn)) | 988 | GNUNET_free (fn); |
985 | GNUNET_log_strerror_file(GNUNET_ERROR_TYPE_WARNING, "unlink", fn); | 989 | GNUNET_free (ego->identifier); |
986 | GNUNET_free(fn); | 990 | ego->identifier = NULL; |
987 | GNUNET_free(ego->identifier); | 991 | notify_listeners (ego); |
988 | ego->identifier = NULL; | 992 | GNUNET_free (ego->pk); |
989 | notify_listeners(ego); | 993 | GNUNET_free (ego); |
990 | GNUNET_free(ego->pk); | 994 | GNUNET_free (name); |
991 | GNUNET_free(ego); | 995 | send_result_code (client, 0, NULL); |
992 | GNUNET_free(name); | 996 | GNUNET_SERVICE_client_continue (client); |
993 | send_result_code(client, 0, NULL); | 997 | return; |
994 | GNUNET_SERVICE_client_continue(client); | ||
995 | return; | ||
996 | } | ||
997 | } | 998 | } |
999 | } | ||
998 | 1000 | ||
999 | send_result_code(client, 1, gettext_noop("no matching ego found")); | 1001 | send_result_code (client, 1, gettext_noop ("no matching ego found")); |
1000 | GNUNET_free(name); | 1002 | GNUNET_free (name); |
1001 | GNUNET_SERVICE_client_continue(client); | 1003 | GNUNET_SERVICE_client_continue (client); |
1002 | } | 1004 | } |
1003 | 1005 | ||
1004 | 1006 | ||
@@ -1013,30 +1015,30 @@ handle_delete_message(void *cls, const struct DeleteMessage *dm) | |||
1013 | * #GNUNET_SYSERR to abort iteration with error! | 1015 | * #GNUNET_SYSERR to abort iteration with error! |
1014 | */ | 1016 | */ |
1015 | static int | 1017 | static int |
1016 | process_ego_file(void *cls, const char *filename) | 1018 | process_ego_file (void *cls, const char *filename) |
1017 | { | 1019 | { |
1018 | struct Ego *ego; | 1020 | struct Ego *ego; |
1019 | const char *fn; | 1021 | const char *fn; |
1020 | 1022 | ||
1021 | fn = strrchr(filename, (int)DIR_SEPARATOR); | 1023 | fn = strrchr (filename, (int) DIR_SEPARATOR); |
1022 | if (NULL == fn) | 1024 | if (NULL == fn) |
1023 | { | 1025 | { |
1024 | GNUNET_break(0); | 1026 | GNUNET_break (0); |
1025 | return GNUNET_OK; | 1027 | return GNUNET_OK; |
1026 | } | 1028 | } |
1027 | ego = GNUNET_new(struct Ego); | 1029 | ego = GNUNET_new (struct Ego); |
1028 | ego->pk = GNUNET_CRYPTO_ecdsa_key_create_from_file(filename); | 1030 | ego->pk = GNUNET_CRYPTO_ecdsa_key_create_from_file (filename); |
1029 | if (NULL == ego->pk) | 1031 | if (NULL == ego->pk) |
1030 | { | 1032 | { |
1031 | GNUNET_free(ego); | 1033 | GNUNET_free (ego); |
1032 | GNUNET_log(GNUNET_ERROR_TYPE_WARNING, | 1034 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
1033 | _("Failed to parse ego information in `%s'\n"), | 1035 | _ ("Failed to parse ego information in `%s'\n"), |
1034 | filename); | 1036 | filename); |
1035 | return GNUNET_OK; | 1037 | return GNUNET_OK; |
1036 | } | 1038 | } |
1037 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Loaded ego `%s'\n", fn + 1); | 1039 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Loaded ego `%s'\n", fn + 1); |
1038 | ego->identifier = GNUNET_strdup(fn + 1); | 1040 | ego->identifier = GNUNET_strdup (fn + 1); |
1039 | GNUNET_CONTAINER_DLL_insert(ego_head, ego_tail, ego); | 1041 | GNUNET_CONTAINER_DLL_insert (ego_head, ego_tail, ego); |
1040 | return GNUNET_OK; | 1042 | return GNUNET_OK; |
1041 | } | 1043 | } |
1042 | 1044 | ||
@@ -1049,103 +1051,103 @@ process_ego_file(void *cls, const char *filename) | |||
1049 | * @param c configuration to use | 1051 | * @param c configuration to use |
1050 | */ | 1052 | */ |
1051 | static void | 1053 | static void |
1052 | run(void *cls, | 1054 | run (void *cls, |
1053 | const struct GNUNET_CONFIGURATION_Handle *c, | 1055 | const struct GNUNET_CONFIGURATION_Handle *c, |
1054 | struct GNUNET_SERVICE_Handle *service) | 1056 | struct GNUNET_SERVICE_Handle *service) |
1055 | { | 1057 | { |
1056 | cfg = c; | 1058 | cfg = c; |
1057 | nc = GNUNET_notification_context_create(1); | 1059 | nc = GNUNET_notification_context_create (1); |
1058 | if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_filename(cfg, | 1060 | if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_filename (cfg, |
1059 | "identity", | 1061 | "identity", |
1060 | "EGODIR", | 1062 | "EGODIR", |
1061 | &ego_directory)) | 1063 | &ego_directory)) |
1062 | { | 1064 | { |
1063 | GNUNET_log_config_missing(GNUNET_ERROR_TYPE_ERROR, "identity", "EGODIR"); | 1065 | GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, "identity", "EGODIR"); |
1064 | GNUNET_SCHEDULER_shutdown(); | 1066 | GNUNET_SCHEDULER_shutdown (); |
1065 | return; | 1067 | return; |
1066 | } | 1068 | } |
1067 | if (GNUNET_OK != | 1069 | if (GNUNET_OK != |
1068 | GNUNET_CONFIGURATION_get_value_filename(cfg, | 1070 | GNUNET_CONFIGURATION_get_value_filename (cfg, |
1069 | "identity", | 1071 | "identity", |
1070 | "SUBSYSTEM_CFG", | 1072 | "SUBSYSTEM_CFG", |
1071 | &subsystem_cfg_file)) | 1073 | &subsystem_cfg_file)) |
1072 | { | 1074 | { |
1073 | GNUNET_log_config_missing(GNUNET_ERROR_TYPE_ERROR, | 1075 | GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, |
1074 | "identity", | 1076 | "identity", |
1075 | "SUBSYSTEM_CFG"); | 1077 | "SUBSYSTEM_CFG"); |
1076 | GNUNET_SCHEDULER_shutdown(); | 1078 | GNUNET_SCHEDULER_shutdown (); |
1077 | return; | 1079 | return; |
1078 | } | 1080 | } |
1079 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, | 1081 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1080 | "Loading subsystem configuration `%s'\n", | 1082 | "Loading subsystem configuration `%s'\n", |
1081 | subsystem_cfg_file); | 1083 | subsystem_cfg_file); |
1082 | subsystem_cfg = GNUNET_CONFIGURATION_create(); | 1084 | subsystem_cfg = GNUNET_CONFIGURATION_create (); |
1083 | if ((GNUNET_YES == GNUNET_DISK_file_test(subsystem_cfg_file)) && | 1085 | if ((GNUNET_YES == GNUNET_DISK_file_test (subsystem_cfg_file)) && |
1084 | (GNUNET_OK != | 1086 | (GNUNET_OK != |
1085 | GNUNET_CONFIGURATION_parse(subsystem_cfg, subsystem_cfg_file))) | 1087 | GNUNET_CONFIGURATION_parse (subsystem_cfg, subsystem_cfg_file))) |
1086 | { | 1088 | { |
1087 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, | 1089 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
1088 | _( | 1090 | _ ( |
1089 | "Failed to parse subsystem identity configuration file `%s'\n"), | 1091 | "Failed to parse subsystem identity configuration file `%s'\n"), |
1090 | subsystem_cfg_file); | 1092 | subsystem_cfg_file); |
1091 | GNUNET_SCHEDULER_shutdown(); | 1093 | GNUNET_SCHEDULER_shutdown (); |
1092 | return; | 1094 | return; |
1093 | } | 1095 | } |
1094 | stats = GNUNET_STATISTICS_create("identity", cfg); | 1096 | stats = GNUNET_STATISTICS_create ("identity", cfg); |
1095 | if (GNUNET_OK != GNUNET_DISK_directory_create(ego_directory)) | 1097 | if (GNUNET_OK != GNUNET_DISK_directory_create (ego_directory)) |
1096 | { | 1098 | { |
1097 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, | 1099 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
1098 | _("Failed to create directory `%s' for storing egos\n"), | 1100 | _ ("Failed to create directory `%s' for storing egos\n"), |
1099 | ego_directory); | 1101 | ego_directory); |
1100 | } | 1102 | } |
1101 | GNUNET_DISK_directory_scan(ego_directory, &process_ego_file, NULL); | 1103 | GNUNET_DISK_directory_scan (ego_directory, &process_ego_file, NULL); |
1102 | GNUNET_SCHEDULER_add_shutdown(&shutdown_task, NULL); | 1104 | GNUNET_SCHEDULER_add_shutdown (&shutdown_task, NULL); |
1103 | } | 1105 | } |
1104 | 1106 | ||
1105 | 1107 | ||
1106 | /** | 1108 | /** |
1107 | * Define "main" method using service macro. | 1109 | * Define "main" method using service macro. |
1108 | */ | 1110 | */ |
1109 | GNUNET_SERVICE_MAIN( | 1111 | GNUNET_SERVICE_MAIN ( |
1110 | "identity", | 1112 | "identity", |
1111 | GNUNET_SERVICE_OPTION_NONE, | 1113 | GNUNET_SERVICE_OPTION_NONE, |
1112 | &run, | 1114 | &run, |
1113 | &client_connect_cb, | 1115 | &client_connect_cb, |
1114 | &client_disconnect_cb, | 1116 | &client_disconnect_cb, |
1115 | NULL, | 1117 | NULL, |
1116 | GNUNET_MQ_hd_fixed_size(start_message, | 1118 | GNUNET_MQ_hd_fixed_size (start_message, |
1117 | GNUNET_MESSAGE_TYPE_IDENTITY_START, | 1119 | GNUNET_MESSAGE_TYPE_IDENTITY_START, |
1118 | struct GNUNET_MessageHeader, | 1120 | struct GNUNET_MessageHeader, |
1119 | NULL), | 1121 | NULL), |
1120 | GNUNET_MQ_hd_var_size(lookup_message, | 1122 | GNUNET_MQ_hd_var_size (lookup_message, |
1121 | GNUNET_MESSAGE_TYPE_IDENTITY_LOOKUP, | 1123 | GNUNET_MESSAGE_TYPE_IDENTITY_LOOKUP, |
1122 | struct LookupMessage, | 1124 | struct LookupMessage, |
1123 | NULL), | 1125 | NULL), |
1124 | GNUNET_MQ_hd_var_size(lookup_by_suffix_message, | 1126 | GNUNET_MQ_hd_var_size (lookup_by_suffix_message, |
1125 | GNUNET_MESSAGE_TYPE_IDENTITY_LOOKUP_BY_SUFFIX, | 1127 | GNUNET_MESSAGE_TYPE_IDENTITY_LOOKUP_BY_SUFFIX, |
1126 | struct LookupMessage, | 1128 | struct LookupMessage, |
1127 | NULL), | 1129 | NULL), |
1128 | GNUNET_MQ_hd_var_size(get_default_message, | 1130 | GNUNET_MQ_hd_var_size (get_default_message, |
1129 | GNUNET_MESSAGE_TYPE_IDENTITY_GET_DEFAULT, | 1131 | GNUNET_MESSAGE_TYPE_IDENTITY_GET_DEFAULT, |
1130 | struct GetDefaultMessage, | 1132 | struct GetDefaultMessage, |
1131 | NULL), | 1133 | NULL), |
1132 | GNUNET_MQ_hd_var_size(set_default_message, | 1134 | GNUNET_MQ_hd_var_size (set_default_message, |
1133 | GNUNET_MESSAGE_TYPE_IDENTITY_SET_DEFAULT, | 1135 | GNUNET_MESSAGE_TYPE_IDENTITY_SET_DEFAULT, |
1134 | struct SetDefaultMessage, | 1136 | struct SetDefaultMessage, |
1135 | NULL), | 1137 | NULL), |
1136 | GNUNET_MQ_hd_var_size(create_message, | 1138 | GNUNET_MQ_hd_var_size (create_message, |
1137 | GNUNET_MESSAGE_TYPE_IDENTITY_CREATE, | 1139 | GNUNET_MESSAGE_TYPE_IDENTITY_CREATE, |
1138 | struct CreateRequestMessage, | 1140 | struct CreateRequestMessage, |
1139 | NULL), | 1141 | NULL), |
1140 | GNUNET_MQ_hd_var_size(rename_message, | 1142 | GNUNET_MQ_hd_var_size (rename_message, |
1141 | GNUNET_MESSAGE_TYPE_IDENTITY_RENAME, | 1143 | GNUNET_MESSAGE_TYPE_IDENTITY_RENAME, |
1142 | struct RenameMessage, | 1144 | struct RenameMessage, |
1143 | NULL), | 1145 | NULL), |
1144 | GNUNET_MQ_hd_var_size(delete_message, | 1146 | GNUNET_MQ_hd_var_size (delete_message, |
1145 | GNUNET_MESSAGE_TYPE_IDENTITY_DELETE, | 1147 | GNUNET_MESSAGE_TYPE_IDENTITY_DELETE, |
1146 | struct DeleteMessage, | 1148 | struct DeleteMessage, |
1147 | NULL), | 1149 | NULL), |
1148 | GNUNET_MQ_handler_end()); | 1150 | GNUNET_MQ_handler_end ()); |
1149 | 1151 | ||
1150 | 1152 | ||
1151 | /* end of gnunet-service-identity.c */ | 1153 | /* end of gnunet-service-identity.c */ |