aboutsummaryrefslogtreecommitdiff
path: root/src/transport/plugin_transport_udp_new_broadcasting.c
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2012-01-30 12:27:14 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2012-01-30 12:27:14 +0000
commit5cc2c89cdcb6d8fb2b848f61e3caf001dfd40fb4 (patch)
tree48bb0a488d25c100013e2d4c8a5cea76c83a5481 /src/transport/plugin_transport_udp_new_broadcasting.c
parent02702760aa5a9b695b11244a54142209759c908b (diff)
downloadgnunet-5cc2c89cdcb6d8fb2b848f61e3caf001dfd40fb4.tar.gz
gnunet-5cc2c89cdcb6d8fb2b848f61e3caf001dfd40fb4.zip
- changes
Diffstat (limited to 'src/transport/plugin_transport_udp_new_broadcasting.c')
-rw-r--r--src/transport/plugin_transport_udp_new_broadcasting.c25
1 files changed, 18 insertions, 7 deletions
diff --git a/src/transport/plugin_transport_udp_new_broadcasting.c b/src/transport/plugin_transport_udp_new_broadcasting.c
index 849cdd15f..3c2d82675 100644
--- a/src/transport/plugin_transport_udp_new_broadcasting.c
+++ b/src/transport/plugin_transport_udp_new_broadcasting.c
@@ -105,12 +105,12 @@ broadcast_ipv6_mst_cb (void *cls, void *client,
105 if (GNUNET_MESSAGE_TYPE_TRANSPORT_BROADCAST_BEACON != 105 if (GNUNET_MESSAGE_TYPE_TRANSPORT_BROADCAST_BEACON !=
106 ntohs (msg->header.type)) 106 ntohs (msg->header.type))
107 return; 107 return;
108 108#if DEBUG_UDP_BROADCASTING
109 LOG (GNUNET_ERROR_TYPE_DEBUG, 109 LOG (GNUNET_ERROR_TYPE_DEBUG,
110 "Received beacon with %u bytes from peer `%s' via address `%s'\n", 110 "Received beacon with %u bytes from peer `%s' via address `%s'\n",
111 ntohs (msg->header.size), GNUNET_i2s (&msg->sender), 111 ntohs (msg->header.size), GNUNET_i2s (&msg->sender),
112 udp_address_to_string (NULL, &mc->addr, sizeof (mc->addr))); 112 udp_address_to_string (NULL, &mc->addr, sizeof (mc->addr)));
113 113#endif
114 struct GNUNET_ATS_Information atsi[2]; 114 struct GNUNET_ATS_Information atsi[2];
115 115
116 /* setup ATS */ 116 /* setup ATS */
@@ -146,11 +146,12 @@ broadcast_ipv4_mst_cb (void *cls, void *client,
146 if (GNUNET_MESSAGE_TYPE_TRANSPORT_BROADCAST_BEACON != 146 if (GNUNET_MESSAGE_TYPE_TRANSPORT_BROADCAST_BEACON !=
147 ntohs (msg->header.type)) 147 ntohs (msg->header.type))
148 return; 148 return;
149 149#if DEBUG_UDP_BROADCASTING
150 LOG (GNUNET_ERROR_TYPE_DEBUG, 150 LOG (GNUNET_ERROR_TYPE_DEBUG,
151 "Received beacon with %u bytes from peer `%s' via address `%s'\n", 151 "Received beacon with %u bytes from peer `%s' via address `%s'\n",
152 ntohs (msg->header.size), GNUNET_i2s (&msg->sender), 152 ntohs (msg->header.size), GNUNET_i2s (&msg->sender),
153 udp_address_to_string (NULL, &mc->addr, sizeof (mc->addr))); 153 udp_address_to_string (NULL, &mc->addr, sizeof (mc->addr)));
154#endif
154 155
155 struct GNUNET_ATS_Information atsi[2]; 156 struct GNUNET_ATS_Information atsi[2];
156 157
@@ -180,10 +181,11 @@ udp_broadcast_receive (struct Plugin *plugin, const char * buf, ssize_t size, st
180 181
181 if (addrlen == sizeof (struct sockaddr_in)) 182 if (addrlen == sizeof (struct sockaddr_in))
182 { 183 {
184#if DEBUG_UDP_BROADCASTING
183 LOG (GNUNET_ERROR_TYPE_DEBUG, 185 LOG (GNUNET_ERROR_TYPE_DEBUG,
184 "Received IPv4 HELLO beacon broadcast with %i bytes from address %s\n", 186 "Received IPv4 HELLO beacon broadcast with %i bytes from address %s\n",
185 size, GNUNET_a2s ((const struct sockaddr *) addr, addrlen)); 187 size, GNUNET_a2s ((const struct sockaddr *) addr, addrlen));
186 188#endif
187 struct Mstv4Context *mc; 189 struct Mstv4Context *mc;
188 190
189 mc = GNUNET_malloc (sizeof (struct Mstv4Context)); 191 mc = GNUNET_malloc (sizeof (struct Mstv4Context));
@@ -200,10 +202,11 @@ udp_broadcast_receive (struct Plugin *plugin, const char * buf, ssize_t size, st
200 } 202 }
201 else if (addrlen == sizeof (struct sockaddr_in6)) 203 else if (addrlen == sizeof (struct sockaddr_in6))
202 { 204 {
205#if DEBUG_UDP_BROADCASTING
203 LOG (GNUNET_ERROR_TYPE_DEBUG, 206 LOG (GNUNET_ERROR_TYPE_DEBUG,
204 "Received IPv6 HELLO beacon broadcast with %i bytes from address %s\n", 207 "Received IPv6 HELLO beacon broadcast with %i bytes from address %s\n",
205 size, GNUNET_a2s ((const struct sockaddr *) &addr, addrlen)); 208 size, GNUNET_a2s ((const struct sockaddr *) &addr, addrlen));
206 209#endif
207 struct Mstv6Context *mc; 210 struct Mstv6Context *mc;
208 211
209 mc = GNUNET_malloc (sizeof (struct Mstv6Context)); 212 mc = GNUNET_malloc (sizeof (struct Mstv6Context));
@@ -267,9 +270,13 @@ udp_ipv4_broadcast_send (void *cls,
267 if (sent == GNUNET_SYSERR) 270 if (sent == GNUNET_SYSERR)
268 GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "sendto"); 271 GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "sendto");
269 else 272 else
273 {
274#if DEBUG_UDP_BROADCASTING
270 LOG (GNUNET_ERROR_TYPE_DEBUG, 275 LOG (GNUNET_ERROR_TYPE_DEBUG,
271 "Sent HELLO beacon broadcast with %i bytes to address %s\n", sent, 276 "Sent HELLO beacon broadcast with %i bytes to address %s\n", sent,
272 GNUNET_a2s (baddr->addr, baddr->addrlen)); 277 GNUNET_a2s (baddr->addr, baddr->addrlen));
278#endif
279 }
273 baddr = baddr->next; 280 baddr = baddr->next;
274 } 281 }
275 282
@@ -316,12 +323,15 @@ udp_ipv6_broadcast_send (void *cls,
316 if (sent == GNUNET_SYSERR) 323 if (sent == GNUNET_SYSERR)
317 GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "sendto"); 324 GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "sendto");
318 else 325 else
326 {
327#if DEBUG_UDP_BROADCASTING
319 LOG (GNUNET_ERROR_TYPE_DEBUG, 328 LOG (GNUNET_ERROR_TYPE_DEBUG,
320 "Sending IPv6 HELLO beacon broadcast with %i bytes to address %s\n", 329 "Sending IPv6 HELLO beacon broadcast with %i bytes to address %s\n",
321 sent, 330 sent,
322 GNUNET_a2s ((const struct sockaddr *) &plugin->ipv6_multicast_address, 331 GNUNET_a2s ((const struct sockaddr *) &plugin->ipv6_multicast_address,
323 sizeof (struct sockaddr_in6))); 332 sizeof (struct sockaddr_in6)));
324 333#endif
334 }
325 335
326 336
327 plugin->send_ipv6_broadcast_task = 337 plugin->send_ipv6_broadcast_task =
@@ -339,6 +349,7 @@ iface_proc (void *cls, const char *name, int isDefault,
339 349
340 if (addr != NULL) 350 if (addr != NULL)
341 { 351 {
352#if DEBUG_UDP_BROADCASTING
342 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "address %s for interface %s %p\n ", 353 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "address %s for interface %s %p\n ",
343 GNUNET_a2s (addr, addrlen), name, addr); 354 GNUNET_a2s (addr, addrlen), name, addr);
344 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 355 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -346,7 +357,7 @@ iface_proc (void *cls, const char *name, int isDefault,
346 GNUNET_a2s (broadcast_addr, addrlen), name, broadcast_addr); 357 GNUNET_a2s (broadcast_addr, addrlen), name, broadcast_addr);
347 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "netmask %s for interface %s %p\n ", 358 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "netmask %s for interface %s %p\n ",
348 GNUNET_a2s (netmask, addrlen), name, netmask); 359 GNUNET_a2s (netmask, addrlen), name, netmask);
349 360#endif
350 361
351 /* Collecting broadcast addresses */ 362 /* Collecting broadcast addresses */
352 if (broadcast_addr != NULL) 363 if (broadcast_addr != NULL)