diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2011-11-29 18:04:01 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2011-11-29 18:04:01 +0000 |
commit | 56c32ea37a52b239494a7f91933e60eb7caf30f3 (patch) | |
tree | 5c8c8ef6b577da4931ec3e546b2fb60ed0e8f029 /src/transport/transport_api_address_to_string.c | |
parent | 5ca85864950a1fe92613f5ed3a69cd08d248423e (diff) | |
download | gnunet-56c32ea37a52b239494a7f91933e60eb7caf30f3.tar.gz gnunet-56c32ea37a52b239494a7f91933e60eb7caf30f3.zip |
- finale commit for the api change
Diffstat (limited to 'src/transport/transport_api_address_to_string.c')
-rw-r--r-- | src/transport/transport_api_address_to_string.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/transport/transport_api_address_to_string.c b/src/transport/transport_api_address_to_string.c index 2e5a34ce2..87ee9ad83 100644 --- a/src/transport/transport_api_address_to_string.c +++ b/src/transport/transport_api_address_to_string.c | |||
@@ -76,7 +76,7 @@ address_response_processor (void *cls, const struct GNUNET_MessageHeader *msg) | |||
76 | return; | 76 | return; |
77 | } | 77 | } |
78 | GNUNET_break (ntohs (msg->type) == | 78 | GNUNET_break (ntohs (msg->type) == |
79 | GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_ITERATE_RESPONSE); | 79 | GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_TO_STRING_REPLY); |
80 | size = ntohs (msg->size); | 80 | size = ntohs (msg->size); |
81 | if (size == sizeof (struct GNUNET_MessageHeader)) | 81 | if (size == sizeof (struct GNUNET_MessageHeader)) |
82 | { | 82 | { |
@@ -131,8 +131,7 @@ GNUNET_TRANSPORT_address_to_string (const struct GNUNET_CONFIGURATION_Handle *cf | |||
131 | char *addrbuf; | 131 | char *addrbuf; |
132 | 132 | ||
133 | GNUNET_assert (address != NULL); | 133 | GNUNET_assert (address != NULL); |
134 | alen = GNUNET_HELLO_address_get_size (address); | 134 | len = sizeof (struct AddressLookupMessage) + GNUNET_HELLO_address_get_size (address); |
135 | len = sizeof (struct AddressLookupMessage) + alen; | ||
136 | if (len >= GNUNET_SERVER_MAX_MESSAGE_SIZE) | 135 | if (len >= GNUNET_SERVER_MAX_MESSAGE_SIZE) |
137 | { | 136 | { |
138 | GNUNET_break (0); | 137 | GNUNET_break (0); |
@@ -144,6 +143,8 @@ GNUNET_TRANSPORT_address_to_string (const struct GNUNET_CONFIGURATION_Handle *cf | |||
144 | return NULL; | 143 | return NULL; |
145 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 144 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
146 | "GNUNET_TRANSPORT_address_to_string\n"); | 145 | "GNUNET_TRANSPORT_address_to_string\n"); |
146 | |||
147 | alen = address->address_length; | ||
147 | msg = GNUNET_malloc (len); | 148 | msg = GNUNET_malloc (len); |
148 | msg->header.size = htons (len); | 149 | msg->header.size = htons (len); |
149 | msg->header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_TO_STRING); | 150 | msg->header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_TO_STRING); |
@@ -151,7 +152,9 @@ GNUNET_TRANSPORT_address_to_string (const struct GNUNET_CONFIGURATION_Handle *cf | |||
151 | msg->timeout = GNUNET_TIME_relative_hton (timeout); | 152 | msg->timeout = GNUNET_TIME_relative_hton (timeout); |
152 | msg->addrlen = htonl (alen); | 153 | msg->addrlen = htonl (alen); |
153 | addrbuf = (char *) &msg[1]; | 154 | addrbuf = (char *) &msg[1]; |
154 | memcpy (addrbuf, address, alen); | 155 | memcpy (addrbuf, address->address, alen); |
156 | strcpy (&addrbuf[alen], address->transport_name); | ||
157 | |||
155 | alc = GNUNET_malloc (sizeof (struct GNUNET_TRANSPORT_AddressToStringContext)); | 158 | alc = GNUNET_malloc (sizeof (struct GNUNET_TRANSPORT_AddressToStringContext)); |
156 | alc->cb = aluc; | 159 | alc->cb = aluc; |
157 | alc->cb_cls = aluc_cls; | 160 | alc->cb_cls = aluc_cls; |
@@ -183,4 +186,4 @@ GNUNET_TRANSPORT_address_to_string_cancel (struct | |||
183 | 186 | ||
184 | 187 | ||
185 | 188 | ||
186 | /* end of transport_api_address_lookup.c */ | 189 | /* end of transport_api_address_to_string.c */ |