aboutsummaryrefslogtreecommitdiff
path: root/src/transport/gnunet-service-transport_plugins.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2011-11-08 23:20:42 +0000
committerChristian Grothoff <christian@grothoff.org>2011-11-08 23:20:42 +0000
commita983a0267109b1b6a8e16e476e2f2956a8771b94 (patch)
tree79bcae73cdb7b87b4f55d4396e79baea76ef53a6 /src/transport/gnunet-service-transport_plugins.c
parenta3f8ef5b89dc44fc3acfb8f081a502f3409e4224 (diff)
downloadgnunet-a983a0267109b1b6a8e16e476e2f2956a8771b94.tar.gz
gnunet-a983a0267109b1b6a8e16e476e2f2956a8771b94.zip
refactoring how we handle peer addresses in peerinfo/ats/transport/hello subsystems -- use a struct instead of 3--4 arguments
Diffstat (limited to 'src/transport/gnunet-service-transport_plugins.c')
-rw-r--r--src/transport/gnunet-service-transport_plugins.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/src/transport/gnunet-service-transport_plugins.c b/src/transport/gnunet-service-transport_plugins.c
index 52fcf661d..3c4466753 100644
--- a/src/transport/gnunet-service-transport_plugins.c
+++ b/src/transport/gnunet-service-transport_plugins.c
@@ -189,22 +189,20 @@ GST_plugins_find (const char *name)
189 * Convert a given address to a human-readable format. Note that the 189 * Convert a given address to a human-readable format. Note that the
190 * return value will be overwritten on the next call to this function. 190 * return value will be overwritten on the next call to this function.
191 * 191 *
192 * @param name plugin name 192 * @param address the address to convert
193 * @param addr binary address in plugin-specific format
194 * @param addrlen number of bytes in 'addr'
195 * @return statically allocated (!) human-readable address 193 * @return statically allocated (!) human-readable address
196 */ 194 */
197const char * 195const char *
198GST_plugins_a2s (const char *name, const void *addr, size_t addrlen) 196GST_plugins_a2s (const struct GNUNET_HELLO_Address *address)
199{ 197{
200 struct GNUNET_TRANSPORT_PluginFunctions *api; 198 struct GNUNET_TRANSPORT_PluginFunctions *api;
201 199
202 if (name == NULL) 200 if (address == NULL)
201 return "<inbound>";
202 api = GST_plugins_find (address->transport_name);
203 if ((api == NULL) || (address->address_length == 0) || (address->address == NULL))
203 return NULL; 204 return NULL;
204 api = GST_plugins_find (name); 205 return api->address_to_string (NULL, address->address, address->address_length);
205 if ((api == NULL) || (addrlen == 0) || (addr == NULL))
206 return NULL;
207 return api->address_to_string (NULL, addr, addrlen);
208} 206}
209 207
210 208