diff options
author | Christian Grothoff <christian@grothoff.org> | 2011-08-15 21:54:06 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2011-08-15 21:54:06 +0000 |
commit | 5746309cb4be2073d550ad7a6885e918631dbc38 (patch) | |
tree | 89455bc4aadf977816b38df13f990372cd81d71a /src/dv/plugin_transport_dv.c | |
parent | 6fd3e715cae09fa6e657c96f1c6f9711ee51f42f (diff) | |
download | gnunet-5746309cb4be2073d550ad7a6885e918631dbc38.tar.gz gnunet-5746309cb4be2073d550ad7a6885e918631dbc38.zip |
indentation
Diffstat (limited to 'src/dv/plugin_transport_dv.c')
-rw-r--r-- | src/dv/plugin_transport_dv.c | 50 |
1 files changed, 17 insertions, 33 deletions
diff --git a/src/dv/plugin_transport_dv.c b/src/dv/plugin_transport_dv.c index 2803e347e..bd73e7e20 100644 --- a/src/dv/plugin_transport_dv.c +++ b/src/dv/plugin_transport_dv.c | |||
@@ -145,11 +145,8 @@ struct Plugin | |||
145 | * Handler for messages received from the DV service. | 145 | * Handler for messages received from the DV service. |
146 | */ | 146 | */ |
147 | void | 147 | void |
148 | handle_dv_message_received (void *cls, | 148 | handle_dv_message_received (void *cls, struct GNUNET_PeerIdentity *sender, |
149 | struct GNUNET_PeerIdentity *sender, | 149 | char *msg, size_t msg_len, uint32_t distance, |
150 | char *msg, | ||
151 | size_t msg_len, | ||
152 | uint32_t distance, | ||
153 | char *sender_address, size_t sender_address_len) | 150 | char *sender_address, size_t sender_address_len) |
154 | { | 151 | { |
155 | struct Plugin *plugin = cls; | 152 | struct Plugin *plugin = cls; |
@@ -158,8 +155,7 @@ handle_dv_message_received (void *cls, | |||
158 | char *my_id; | 155 | char *my_id; |
159 | 156 | ||
160 | my_id = GNUNET_strdup (GNUNET_i2s (plugin->env->my_identity)); | 157 | my_id = GNUNET_strdup (GNUNET_i2s (plugin->env->my_identity)); |
161 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, | 158 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "plugin_transport_dv", |
162 | "plugin_transport_dv", | ||
163 | _("%s Received message from %s of type %d, distance %u!\n"), | 159 | _("%s Received message from %s of type %d, distance %u!\n"), |
164 | my_id, GNUNET_i2s (sender), | 160 | my_id, GNUNET_i2s (sender), |
165 | ntohs (((struct GNUNET_MessageHeader *) msg)->type), | 161 | ntohs (((struct GNUNET_MessageHeader *) msg)->type), |
@@ -173,8 +169,7 @@ handle_dv_message_received (void *cls, | |||
173 | ats[1].type = htonl (GNUNET_TRANSPORT_ATS_ARRAY_TERMINATOR); | 169 | ats[1].type = htonl (GNUNET_TRANSPORT_ATS_ARRAY_TERMINATOR); |
174 | ats[1].value = htonl (0); | 170 | ats[1].value = htonl (0); |
175 | 171 | ||
176 | plugin->env->receive (plugin->env->cls, | 172 | plugin->env->receive (plugin->env->cls, sender, |
177 | sender, | ||
178 | (struct GNUNET_MessageHeader *) msg, | 173 | (struct GNUNET_MessageHeader *) msg, |
179 | (const struct GNUNET_TRANSPORT_ATS_Information *) &ats, | 174 | (const struct GNUNET_TRANSPORT_ATS_Information *) &ats, |
180 | 2, NULL, sender_address, sender_address_len); | 175 | 2, NULL, sender_address, sender_address_len); |
@@ -214,26 +209,18 @@ handle_dv_message_received (void *cls, | |||
214 | * and does NOT mean that the message was not transmitted (DV) | 209 | * and does NOT mean that the message was not transmitted (DV) |
215 | */ | 210 | */ |
216 | static ssize_t | 211 | static ssize_t |
217 | dv_plugin_send (void *cls, | 212 | dv_plugin_send (void *cls, const struct GNUNET_PeerIdentity *target, |
218 | const struct GNUNET_PeerIdentity *target, | 213 | const char *msgbuf, size_t msgbuf_size, unsigned int priority, |
219 | const char *msgbuf, | 214 | struct GNUNET_TIME_Relative timeout, struct Session *session, |
220 | size_t msgbuf_size, | 215 | const void *addr, size_t addrlen, int force_address, |
221 | unsigned int priority, | ||
222 | struct GNUNET_TIME_Relative timeout, | ||
223 | struct Session *session, | ||
224 | const void *addr, | ||
225 | size_t addrlen, | ||
226 | int force_address, | ||
227 | GNUNET_TRANSPORT_TransmitContinuation cont, void *cont_cls) | 216 | GNUNET_TRANSPORT_TransmitContinuation cont, void *cont_cls) |
228 | { | 217 | { |
229 | int ret = 0; | 218 | int ret = 0; |
230 | struct Plugin *plugin = cls; | 219 | struct Plugin *plugin = cls; |
231 | 220 | ||
232 | ret = GNUNET_DV_send (plugin->dv_handle, | 221 | ret = |
233 | target, | 222 | GNUNET_DV_send (plugin->dv_handle, target, msgbuf, msgbuf_size, priority, |
234 | msgbuf, | 223 | timeout, addr, addrlen, cont, cont_cls); |
235 | msgbuf_size, | ||
236 | priority, timeout, addr, addrlen, cont, cont_cls); | ||
237 | return ret; | 224 | return ret; |
238 | } | 225 | } |
239 | 226 | ||
@@ -270,14 +257,11 @@ dv_plugin_disconnect (void *cls, const struct GNUNET_PeerIdentity *target) | |||
270 | * @param asc_cls closure for asc | 257 | * @param asc_cls closure for asc |
271 | */ | 258 | */ |
272 | static void | 259 | static void |
273 | dv_plugin_address_pretty_printer (void *cls, | 260 | dv_plugin_address_pretty_printer (void *cls, const char *type, const void *addr, |
274 | const char *type, | 261 | size_t addrlen, int numeric, |
275 | const void *addr, | ||
276 | size_t addrlen, | ||
277 | int numeric, | ||
278 | struct GNUNET_TIME_Relative timeout, | 262 | struct GNUNET_TIME_Relative timeout, |
279 | GNUNET_TRANSPORT_AddressStringCallback | 263 | GNUNET_TRANSPORT_AddressStringCallback asc, |
280 | asc, void *asc_cls) | 264 | void *asc_cls) |
281 | { | 265 | { |
282 | char *dest_peer; | 266 | char *dest_peer; |
283 | char *via_peer; | 267 | char *via_peer; |
@@ -337,8 +321,8 @@ address_to_string (void *cls, const void *addr, size_t addrlen) | |||
337 | peer_hash.encoding[4] = '\0'; | 321 | peer_hash.encoding[4] = '\0'; |
338 | GNUNET_CRYPTO_hash_to_enc (&via->hashPubKey, &via_hash); | 322 | GNUNET_CRYPTO_hash_to_enc (&via->hashPubKey, &via_hash); |
339 | via_hash.encoding[4] = '\0'; | 323 | via_hash.encoding[4] = '\0'; |
340 | GNUNET_snprintf (return_buffer, | 324 | GNUNET_snprintf (return_buffer, sizeof (return_buffer), "%s:%s", &peer_hash, |
341 | sizeof (return_buffer), "%s:%s", &peer_hash, &via_hash); | 325 | &via_hash); |
342 | } | 326 | } |
343 | else | 327 | else |
344 | return NULL; | 328 | return NULL; |