aboutsummaryrefslogtreecommitdiff
path: root/src/transport/gnunet-service-transport_validation.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2015-02-02 09:22:18 +0000
committerChristian Grothoff <christian@grothoff.org>2015-02-02 09:22:18 +0000
commit583fe23eac9e91896309c3d896af7541054d5e01 (patch)
tree07bdc466ac0b1d1669f0a6cceaf2369a9e8315a0 /src/transport/gnunet-service-transport_validation.c
parent0f550b188c85b709c37383dd75f0243b6222636f (diff)
downloadgnunet-583fe23eac9e91896309c3d896af7541054d5e01.tar.gz
gnunet-583fe23eac9e91896309c3d896af7541054d5e01.zip
-doxyen, comments, indentation
Diffstat (limited to 'src/transport/gnunet-service-transport_validation.c')
-rw-r--r--src/transport/gnunet-service-transport_validation.c47
1 files changed, 35 insertions, 12 deletions
diff --git a/src/transport/gnunet-service-transport_validation.c b/src/transport/gnunet-service-transport_validation.c
index 7008d2df5..8dd8e1989 100644
--- a/src/transport/gnunet-service-transport_validation.c
+++ b/src/transport/gnunet-service-transport_validation.c
@@ -393,7 +393,8 @@ validation_entry_match (void *cls,
393 struct ValidationEntryMatchContext *vemc = cls; 393 struct ValidationEntryMatchContext *vemc = cls;
394 struct ValidationEntry *ve = value; 394 struct ValidationEntry *ve = value;
395 395
396 if (0 == GNUNET_HELLO_address_cmp (ve->address, vemc->address)) 396 if (0 == GNUNET_HELLO_address_cmp (ve->address,
397 vemc->address))
397 { 398 {
398 vemc->ve = ve; 399 vemc->ve = ve;
399 return GNUNET_NO; 400 return GNUNET_NO;
@@ -587,11 +588,15 @@ transmit_ping_if_allowed (void *cls,
587 /* build message with structure: 588 /* build message with structure:
588 * [HELLO][TransportPingMessage][Transport name][Address] */ 589 * [HELLO][TransportPingMessage][Transport name][Address] */
589 memcpy (message_buf, hello, hsize); 590 memcpy (message_buf, hello, hsize);
590 memcpy (&message_buf[hsize], &ping, sizeof (struct TransportPingMessage)); 591 memcpy (&message_buf[hsize],
592 &ping,
593 sizeof (struct TransportPingMessage));
591 memcpy (&message_buf[sizeof (struct TransportPingMessage) + hsize], 594 memcpy (&message_buf[sizeof (struct TransportPingMessage) + hsize],
592 ve->address->transport_name, slen); 595 ve->address->transport_name,
596 slen);
593 memcpy (&message_buf[sizeof (struct TransportPingMessage) + slen + hsize], 597 memcpy (&message_buf[sizeof (struct TransportPingMessage) + slen + hsize],
594 ve->address->address, ve->address->address_length); 598 ve->address->address,
599 ve->address->address_length);
595 papi = GST_plugins_find (ve->address->transport_name); 600 papi = GST_plugins_find (ve->address->transport_name);
596 if (NULL == papi) 601 if (NULL == papi)
597 { 602 {
@@ -754,7 +759,8 @@ revalidate_address (void *cls,
754 GNUNET_STATISTICS_update (GST_stats, 759 GNUNET_STATISTICS_update (GST_stats,
755 gettext_noop ("# address revalidations started"), 1, 760 gettext_noop ("# address revalidations started"), 1,
756 GNUNET_NO); 761 GNUNET_NO);
757 bc = GST_blacklist_test_allowed (&ve->pid, ve->address->transport_name, 762 bc = GST_blacklist_test_allowed (&ve->pid,
763 ve->address->transport_name,
758 &transmit_ping_if_allowed, ve); 764 &transmit_ping_if_allowed, ve);
759 if (NULL != bc) 765 if (NULL != bc)
760 ve->bc = bc; /* only set 'bc' if 'transmit_ping_if_allowed' was not already 766 ve->bc = bc; /* only set 'bc' if 'transmit_ping_if_allowed' was not already
@@ -1769,22 +1775,39 @@ struct ValidationIteratorContext
1769}; 1775};
1770 1776
1771 1777
1778/**
1779 * Function called on each entry in the validation map.
1780 * Passes the information from the validation entry to
1781 * the callback given in the closure.
1782 *
1783 * @param cls the `struct ValidationIteratorContext`
1784 * @param key peer this is about
1785 * @param value the `struct ValidationEntry`
1786 * @return #GNUNET_OK (continue to iterate)
1787 */
1772static int 1788static int
1773validation_entries_iterate (void *cls, 1789validation_entries_iterate (void *cls,
1774 const struct GNUNET_PeerIdentity *key, 1790 const struct GNUNET_PeerIdentity *key,
1775 void *value) 1791 void *value)
1776{ 1792{
1777 struct ValidationIteratorContext *ic = cls; 1793 struct ValidationIteratorContext *ic = cls;
1778 struct ValidationEntry *ve = value; 1794 struct ValidationEntry *ve = value;
1779 1795
1780 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Notifying about validation entry for peer `%s' address `%s' \n", 1796 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1781 GNUNET_i2s (&ve->pid), GST_plugins_a2s (ve->address)); 1797 "Notifying about validation entry for peer `%s' address `%s' \n",
1782 ic->cb (ic->cb_cls, &ve->pid, ve->address, ve->send_time, 1798 GNUNET_i2s (&ve->pid),
1783 ve->valid_until, ve->next_validation, ve->state); 1799 GST_plugins_a2s (ve->address));
1784 1800 ic->cb (ic->cb_cls,
1801 &ve->pid,
1802 ve->address,
1803 ve->send_time,
1804 ve->valid_until,
1805 ve->next_validation,
1806 ve->state);
1785 return GNUNET_OK; 1807 return GNUNET_OK;
1786} 1808}
1787 1809
1810
1788/** 1811/**
1789 * Iterate over all iteration entries 1812 * Iterate over all iteration entries
1790 * 1813 *