aboutsummaryrefslogtreecommitdiff
path: root/src/hello
diff options
context:
space:
mode:
Diffstat (limited to 'src/hello')
-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,
194 *nt = (enum GNUNET_NetworkType) raw_nt; 194 *nt = (enum GNUNET_NetworkType) raw_nt;
195 return GNUNET_strdup (raw_addr); 195 return GNUNET_strdup (raw_addr);
196} 196}
197
198
199/**
200 * Given an address as a string, extract the prefix that identifies
201 * the communicator offering transmissions to that address.
202 *
203 * @param address a peer's address
204 * @return NULL if the address is mal-formed, otherwise the prefix
205 */
206char *
207GNUNET_HELLO_address_to_prefix (const char *address)
208{
209 const char *dash;
210
211 dash = strchr (address, '-');
212 if (NULL == dash)
213 return NULL;
214 return GNUNET_strndup (address,
215 dash - address);
216}