From 634aea297cc983c3d70f65a004f698f215abe590 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Mon, 21 Jan 2019 14:14:42 +0100 Subject: more work on tng --- src/hello/hello-ng.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'src/hello/hello-ng.c') diff --git a/src/hello/hello-ng.c b/src/hello/hello-ng.c index c088abf35..2d60b04f3 100644 --- a/src/hello/hello-ng.c +++ b/src/hello/hello-ng.c @@ -194,3 +194,23 @@ GNUNET_HELLO_extract_address (const void *raw, *nt = (enum GNUNET_NetworkType) raw_nt; return GNUNET_strdup (raw_addr); } + + +/** + * Given an address as a string, extract the prefix that identifies + * the communicator offering transmissions to that address. + * + * @param address a peer's address + * @return NULL if the address is mal-formed, otherwise the prefix + */ +char * +GNUNET_HELLO_address_to_prefix (const char *address) +{ + const char *dash; + + dash = strchr (address, '-'); + if (NULL == dash) + return NULL; + return GNUNET_strndup (address, + dash - address); +} -- cgit v1.2.3