aboutsummaryrefslogtreecommitdiff
path: root/src/escrow/escrow_plugin_helper.c
diff options
context:
space:
mode:
authorjospaeth <spaethj@in.tum.de>2020-09-02 11:04:57 +0200
committerjospaeth <spaethj@in.tum.de>2020-09-02 11:04:57 +0200
commit97934d24f12c1c2da627119932f27b53fc187710 (patch)
tree1c6683c62497e9dd7da28ce70e85b090773afc9c /src/escrow/escrow_plugin_helper.c
parentdb199dd2280071adafc14ff66cfa1c21399f06c2 (diff)
downloadgnunet-97934d24f12c1c2da627119932f27b53fc187710.tar.gz
gnunet-97934d24f12c1c2da627119932f27b53fc187710.zip
remove unused methods
Diffstat (limited to 'src/escrow/escrow_plugin_helper.c')
-rw-r--r--src/escrow/escrow_plugin_helper.c74
1 files changed, 0 insertions, 74 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 */
370struct GNUNET_ESCROW_Anchor *
371ESCROW_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 */
417char *
418ESCROW_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 */