summaryrefslogtreecommitdiff
path: root/src/hello/hello-ng.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2019-01-21 14:14:42 +0100
committerChristian Grothoff <christian@grothoff.org>2019-01-21 14:14:42 +0100
commit634aea297cc983c3d70f65a004f698f215abe590 (patch)
treec337abee0cf6e15b14785efcfc6cec49883a92b7 /src/hello/hello-ng.c
parent7ed02994541af600b0d080829e944ab414445dcc (diff)
more work on tng
Diffstat (limited to 'src/hello/hello-ng.c')
-rw-r--r--src/hello/hello-ng.c20
1 files changed, 20 insertions, 0 deletions
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);
+}