diff options
author | Christian Grothoff <christian@grothoff.org> | 2019-01-21 14:14:42 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2019-01-21 14:14:42 +0100 |
commit | 634aea297cc983c3d70f65a004f698f215abe590 (patch) | |
tree | c337abee0cf6e15b14785efcfc6cec49883a92b7 /src/hello | |
parent | 7ed02994541af600b0d080829e944ab414445dcc (diff) | |
download | gnunet-634aea297cc983c3d70f65a004f698f215abe590.tar.gz gnunet-634aea297cc983c3d70f65a004f698f215abe590.zip |
more work on tng
Diffstat (limited to 'src/hello')
-rw-r--r-- | src/hello/hello-ng.c | 20 |
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 | */ | ||
206 | char * | ||
207 | GNUNET_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 | } | ||