aboutsummaryrefslogtreecommitdiff
path: root/src/transport/gnunet-service-transport_clients.c
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2011-09-29 14:44:24 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2011-09-29 14:44:24 +0000
commit8377aa60c8714fcec4967e1652c4628032b55bf6 (patch)
tree89968302123369aedbcab440d57b4889d6091ce6 /src/transport/gnunet-service-transport_clients.c
parent46dfa72665e1fcd10c1e98957de6a732f5991c13 (diff)
downloadgnunet-8377aa60c8714fcec4967e1652c4628032b55bf6.tar.gz
gnunet-8377aa60c8714fcec4967e1652c4628032b55bf6.zip
fixing list-connections to show correct peer id
extending neighbour-iterate to return plugin, addr and addresslen
Diffstat (limited to 'src/transport/gnunet-service-transport_clients.c')
-rw-r--r--src/transport/gnunet-service-transport_clients.c34
1 files changed, 24 insertions, 10 deletions
diff --git a/src/transport/gnunet-service-transport_clients.c b/src/transport/gnunet-service-transport_clients.c
index 9936c1137..650efc8dd 100644
--- a/src/transport/gnunet-service-transport_clients.c
+++ b/src/transport/gnunet-service-transport_clients.c
@@ -317,12 +317,18 @@ client_disconnect_notification (void *cls, struct GNUNET_SERVER_Client *client)
317 * @param peer identity of the neighbour 317 * @param peer identity of the neighbour
318 * @param ats performance data 318 * @param ats performance data
319 * @param ats_count number of entries in ats (excluding 0-termination) 319 * @param ats_count number of entries in ats (excluding 0-termination)
320 * @param transport plugin
321 * @param addr address
322 * @param addrlen address length
320 */ 323 */
321static void 324static void
322notify_client_about_neighbour (void *cls, 325notify_client_about_neighbour (void *cls,
323 const struct GNUNET_PeerIdentity *peer, 326 const struct GNUNET_PeerIdentity *peer,
324 const struct GNUNET_TRANSPORT_ATS_Information 327 const struct GNUNET_TRANSPORT_ATS_Information
325 *ats, uint32_t ats_count) 328 *ats, uint32_t ats_count,
329 const char * transport,
330 const void * addr,
331 size_t addrlen)
326{ 332{
327 struct TransportClient *tc = cls; 333 struct TransportClient *tc = cls;
328 struct ConnectInfoMessage *cim; 334 struct ConnectInfoMessage *cim;
@@ -803,24 +809,32 @@ clients_handle_peer_address_lookup (void *cls,
803 * @param neighbour identity of the neighbour 809 * @param neighbour identity of the neighbour
804 * @param ats performance data 810 * @param ats performance data
805 * @param ats_count number of entries in ats (excluding 0-termination) 811 * @param ats_count number of entries in ats (excluding 0-termination)
812 * @param transport plugin
813 * @param addr address
814 * @param addrlen address length
806 */ 815 */
807static void 816static void
808output_addresses (void *cls, const struct GNUNET_PeerIdentity *peer, 817output_addresses (void *cls, const struct GNUNET_PeerIdentity *peer,
809 const struct GNUNET_TRANSPORT_ATS_Information *ats, 818 const struct GNUNET_TRANSPORT_ATS_Information *ats,
810 uint32_t ats_count) 819 uint32_t ats_count,
820 const char * transport,
821 const void * addr,
822 size_t addrlen)
811{ 823{
812 struct GNUNET_SERVER_TransmitContext *tc = cls; 824 struct GNUNET_SERVER_TransmitContext *tc = cls;
813 struct AddressIterateResponseMessage msg; 825 struct AddressIterateResponseMessage * msg;
814 size_t size; 826 size_t size;
815 827
816 size = 828 size =
817 sizeof (struct AddressIterateResponseMessage) - 829 (sizeof (struct AddressIterateResponseMessage) + strlen(transport) + 1);
818 sizeof (struct GNUNET_MessageHeader); 830 msg = GNUNET_malloc (size);
819 memcpy (&msg.peer, peer, sizeof (struct GNUNET_PeerIdentity)); 831 memcpy (&msg->peer, peer, sizeof (struct GNUNET_PeerIdentity));
820 msg.addrlen = ntohs (0); 832 memcpy (&msg[0], transport, strlen(transport)+1);
821 msg.pluginlen = ntohs (0); 833 msg->addrlen = ntohs (addrlen);
822 834 msg->pluginlen = ntohs (strlen(transport)+1);
823 transmit_binary_to_client (tc, &msg, size); 835
836 transmit_binary_to_client (tc, msg, size);
837 GNUNET_free(msg);
824} 838}
825 839
826 840