diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/escrow/escrow_plugin_helper.c | 74 | ||||
-rw-r--r-- | src/escrow/escrow_plugin_helper.h | 25 |
2 files changed, 0 insertions, 99 deletions
diff --git a/src/escrow/escrow_plugin_helper.c b/src/escrow/escrow_plugin_helper.c index 154195e7e..36acae049 100644 --- a/src/escrow/escrow_plugin_helper.c +++ b/src/escrow/escrow_plugin_helper.c | |||
@@ -358,78 +358,4 @@ ESCROW_get_escrow_status (struct GNUNET_ESCROW_Handle *h, | |||
358 | } | 358 | } |
359 | 359 | ||
360 | 360 | ||
361 | /** | ||
362 | * Deserialize an escrow anchor string into a GNUNET_ESCROW_Anchor struct | ||
363 | * | ||
364 | * @param anchorString the encoded escrow anchor string | ||
365 | * @param method the escrow plugin calling this function | ||
366 | * | ||
367 | * @return the deserialized data packed into a GNUNET_ESCROW_Anchor struct, | ||
368 | * NULL if we failed to parse the string | ||
369 | */ | ||
370 | struct GNUNET_ESCROW_Anchor * | ||
371 | ESCROW_anchor_string_to_data (char *anchorString, | ||
372 | enum GNUNET_ESCROW_Key_Escrow_Method method) | ||
373 | { | ||
374 | struct GNUNET_ESCROW_Anchor *anchor; | ||
375 | uint32_t data_size; | ||
376 | char *anchorStringCopy, *ptr, *egoNameCopy; | ||
377 | char delimiter[] = ":"; | ||
378 | |||
379 | anchorStringCopy = GNUNET_strdup (anchorString); | ||
380 | |||
381 | // split the string at the first occurrence of the delimiter | ||
382 | ptr = strtok (anchorStringCopy, delimiter); | ||
383 | egoNameCopy = GNUNET_strdup (ptr); | ||
384 | ptr = strtok (NULL, delimiter); | ||
385 | |||
386 | if (NULL == ptr) | ||
387 | { | ||
388 | // delimiter was not found | ||
389 | GNUNET_free (egoNameCopy); | ||
390 | GNUNET_free (anchorStringCopy); | ||
391 | return NULL; | ||
392 | } | ||
393 | |||
394 | data_size = strlen (ptr) + 1; | ||
395 | anchor = GNUNET_malloc (sizeof (struct GNUNET_ESCROW_Anchor) + data_size); | ||
396 | anchor->size = data_size; | ||
397 | anchor->egoName = egoNameCopy; | ||
398 | anchor->method = method; | ||
399 | |||
400 | // TODO: deserialize? | ||
401 | GNUNET_memcpy (&anchor[1], ptr, data_size); | ||
402 | |||
403 | GNUNET_free (anchorStringCopy); | ||
404 | |||
405 | return anchor; | ||
406 | } | ||
407 | |||
408 | |||
409 | /** | ||
410 | * Serialize an escrow anchor struct into a string | ||
411 | * | ||
412 | * @param escrowAnchor the escrow anchor struct | ||
413 | * @param method the escrow plugin calling this function | ||
414 | * | ||
415 | * @return the encoded escrow anchor string | ||
416 | */ | ||
417 | char * | ||
418 | ESCROW_anchor_data_to_string (struct GNUNET_ESCROW_Anchor *escrowAnchor, | ||
419 | enum GNUNET_ESCROW_Key_Escrow_Method method) | ||
420 | { | ||
421 | char *anchorString; | ||
422 | size_t egoNameSize; | ||
423 | |||
424 | egoNameSize = strlen (escrowAnchor->egoName); | ||
425 | |||
426 | anchorString = GNUNET_malloc (egoNameSize + 1 + escrowAnchor->size); | ||
427 | GNUNET_memcpy (anchorString, escrowAnchor->egoName, egoNameSize); | ||
428 | anchorString[egoNameSize] = ':'; | ||
429 | GNUNET_memcpy (anchorString + egoNameSize + 1, &escrowAnchor[1], escrowAnchor->size); | ||
430 | |||
431 | return anchorString; | ||
432 | } | ||
433 | |||
434 | |||
435 | /* end of escrow_plugin.c */ | 361 | /* end of escrow_plugin.c */ |
diff --git a/src/escrow/escrow_plugin_helper.h b/src/escrow/escrow_plugin_helper.h index dd03522fe..f2a54eb6b 100644 --- a/src/escrow/escrow_plugin_helper.h +++ b/src/escrow/escrow_plugin_helper.h | |||
@@ -106,28 +106,3 @@ ESCROW_update_escrow_status (struct GNUNET_ESCROW_Handle *h, | |||
106 | struct GNUNET_ESCROW_Status * | 106 | struct GNUNET_ESCROW_Status * |
107 | ESCROW_get_escrow_status (struct GNUNET_ESCROW_Handle *h, | 107 | ESCROW_get_escrow_status (struct GNUNET_ESCROW_Handle *h, |
108 | struct GNUNET_IDENTITY_Ego *ego); | 108 | struct GNUNET_IDENTITY_Ego *ego); |
109 | |||
110 | /** | ||
111 | * Deserialize an escrow anchor string into a GNUNET_ESCROW_Anchor struct | ||
112 | * | ||
113 | * @param anchorString the encoded escrow anchor string | ||
114 | * @param method the escrow plugin calling this function | ||
115 | * | ||
116 | * @return the deserialized data packed into a GNUNET_ESCROW_Anchor struct, | ||
117 | * NULL if we failed to parse the string | ||
118 | */ | ||
119 | struct GNUNET_ESCROW_Anchor * | ||
120 | ESCROW_anchor_string_to_data (char *anchorString, | ||
121 | enum GNUNET_ESCROW_Key_Escrow_Method method); | ||
122 | |||
123 | /** | ||
124 | * Serialize an escrow anchor struct into a string | ||
125 | * | ||
126 | * @param escrowAnchor the escrow anchor struct | ||
127 | * @param method the escrow plugin calling this function | ||
128 | * | ||
129 | * @return the encoded escrow anchor string | ||
130 | */ | ||
131 | char * | ||
132 | ESCROW_anchor_data_to_string (struct GNUNET_ESCROW_Anchor *escrowAnchor, | ||
133 | enum GNUNET_ESCROW_Key_Escrow_Method method); | ||