aboutsummaryrefslogtreecommitdiff
path: root/src/transport/gnunet-service-tng.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/transport/gnunet-service-tng.c')
-rw-r--r--src/transport/gnunet-service-tng.c57
1 files changed, 48 insertions, 9 deletions
diff --git a/src/transport/gnunet-service-tng.c b/src/transport/gnunet-service-tng.c
index 54e6a7a3e..e00c7d573 100644
--- a/src/transport/gnunet-service-tng.c
+++ b/src/transport/gnunet-service-tng.c
@@ -807,7 +807,7 @@ struct TransportValidationChallengeMessage
807 * response. Note that the consumption limit must still be 807 * response. Note that the consumption limit must still be
808 * below the maximum value permitted by the receiver so far. 808 * below the maximum value permitted by the receiver so far.
809 * 809 *
810 * If this is the first challenge (initial connection 810 * If this is the first challenge (initial connection
811 * establishment), this value must be zero. 811 * establishment), this value must be zero.
812 */ 812 */
813 uint32_t last_window_consum_limit_kb GNUNET_PACKED; 813 uint32_t last_window_consum_limit_kb GNUNET_PACKED;
@@ -2743,7 +2743,7 @@ free_validation_state (struct ValidationState *vs)
2743 2743
2744 2744
2745/** 2745/**
2746 * Lookup neighbour record for peer @a pid. 2746 * Lookup neighbour for peer @a pid.
2747 * 2747 *
2748 * @param pid neighbour to look for 2748 * @param pid neighbour to look for
2749 * @return NULL if we do not have this peer as a neighbour 2749 * @return NULL if we do not have this peer as a neighbour
@@ -2756,6 +2756,19 @@ lookup_neighbour (const struct GNUNET_PeerIdentity *pid)
2756 2756
2757 2757
2758/** 2758/**
2759 * Lookup virtual link for peer @a pid.
2760 *
2761 * @param pid virtual link to look for
2762 * @return NULL if we do not have this peer as a virtual link
2763 */
2764static struct VirtualLink *
2765lookup_virtual_link (const struct GNUNET_PeerIdentity *pid)
2766{
2767 return GNUNET_CONTAINER_multipeermap_get (links, pid);
2768}
2769
2770
2771/**
2759 * Details about what to notify monitors about. 2772 * Details about what to notify monitors about.
2760 */ 2773 */
2761struct MonitorEvent 2774struct MonitorEvent
@@ -3338,7 +3351,7 @@ free_queue (struct Queue *queue)
3338 notify_monitors (&neighbour->pid, queue->address, queue->nt, &me); 3351 notify_monitors (&neighbour->pid, queue->address, queue->nt, &me);
3339 GNUNET_free (queue); 3352 GNUNET_free (queue);
3340 3353
3341 vl = GNUNET_CONTAINER_multipeermap_get (links, &neighbour->pid); 3354 vl = lookup_virtual_link (&neighbour->pid);
3342 if ((NULL != vl) && (neighbour == vl->n)) 3355 if ((NULL != vl) && (neighbour == vl->n))
3343 { 3356 {
3344 GNUNET_SCHEDULER_cancel (vl->visibility_task); 3357 GNUNET_SCHEDULER_cancel (vl->visibility_task);
@@ -3768,7 +3781,7 @@ handle_client_send (void *cls, const struct OutboundMessage *obm)
3768 obmm = (const struct GNUNET_MessageHeader *) &obm[1]; 3781 obmm = (const struct GNUNET_MessageHeader *) &obm[1];
3769 bytes_msg = ntohs (obmm->size); 3782 bytes_msg = ntohs (obmm->size);
3770 pp = (enum GNUNET_MQ_PriorityPreferences) ntohl (obm->priority); 3783 pp = (enum GNUNET_MQ_PriorityPreferences) ntohl (obm->priority);
3771 vl = GNUNET_CONTAINER_multipeermap_get (links, &obm->peer); 3784 vl = lookup_virtual_link (&obm->peer);
3772 if (NULL == vl) 3785 if (NULL == vl)
3773 { 3786 {
3774 /* Failure: don't have this peer as a neighbour (anymore). 3787 /* Failure: don't have this peer as a neighbour (anymore).
@@ -3883,7 +3896,7 @@ handle_client_recv_ok (void *cls, const struct RecvOkMessage *rom)
3883 GNUNET_SERVICE_client_drop (tc->client); 3896 GNUNET_SERVICE_client_drop (tc->client);
3884 return; 3897 return;
3885 } 3898 }
3886 vl = GNUNET_CONTAINER_multipeermap_get (links, &rom->peer); 3899 vl = lookup_virtual_link (&rom->peer);
3887 if (NULL == vl) 3900 if (NULL == vl)
3888 { 3901 {
3889 GNUNET_STATISTICS_update (GST_stats, 3902 GNUNET_STATISTICS_update (GST_stats,
@@ -4489,7 +4502,7 @@ route_message (const struct GNUNET_PeerIdentity *target,
4489 struct Neighbour *n; 4502 struct Neighbour *n;
4490 struct DistanceVector *dv; 4503 struct DistanceVector *dv;
4491 4504
4492 vl = GNUNET_CONTAINER_multipeermap_get (links, target); 4505 vl = lookup_virtual_link (target);
4493 n = vl->n; 4506 n = vl->n;
4494 dv = (0 != (options & RMO_DV_ALLOWED)) ? vl->dv : NULL; 4507 dv = (0 != (options & RMO_DV_ALLOWED)) ? vl->dv : NULL;
4495 if (0 == (options & RMO_UNCONFIRMED_ALLOWED)) 4508 if (0 == (options & RMO_UNCONFIRMED_ALLOWED))
@@ -4823,7 +4836,7 @@ handle_raw_message (void *cls, const struct GNUNET_MessageHeader *mh)
4823 GNUNET_SERVICE_client_drop (client); 4836 GNUNET_SERVICE_client_drop (client);
4824 return; 4837 return;
4825 } 4838 }
4826 vl = GNUNET_CONTAINER_multipeermap_get (links, &cmc->im.sender); 4839 vl = lookup_virtual_link (&cmc->im.sender);
4827 if (NULL == vl) 4840 if (NULL == vl)
4828 { 4841 {
4829 /* FIXME: sender is giving us messages for CORE but we don't have 4842 /* FIXME: sender is giving us messages for CORE but we don't have
@@ -5655,7 +5668,7 @@ activate_core_visible_dv_path (struct DistanceVectorHop *hop)
5655 struct DistanceVector *dv = hop->dv; 5668 struct DistanceVector *dv = hop->dv;
5656 struct VirtualLink *vl; 5669 struct VirtualLink *vl;
5657 5670
5658 vl = GNUNET_CONTAINER_multipeermap_get (links, &dv->target); 5671 vl = lookup_virtual_link (&dv->target);
5659 if (NULL != vl) 5672 if (NULL != vl)
5660 { 5673 {
5661 /* Link was already up, remember dv is also now available and we are done */ 5674 /* Link was already up, remember dv is also now available and we are done */
@@ -7091,6 +7104,27 @@ handle_validation_challenge (
7091 7104
7092 7105
7093/** 7106/**
7107 * Communicator gave us a transport address validation challenge. Process the
7108 * request.
7109 *
7110 * @param cls a `struct CommunicatorMessageContext` (must call
7111 * #finish_cmc_handling() when done)
7112 * @param tvrc the message that was received
7113 */
7114static void
7115handle_validation_challenge_response (
7116 void *cls,
7117 const struct TransportValidationChallengeResponseMessage *tvrc)
7118{
7119 struct CommunicatorMessageContext *cmc = cls;
7120 struct TransportValidationResponseMessage *tvr;
7121
7122
7123 finish_cmc_handling (cmc);
7124}
7125
7126
7127/**
7094 * Closure for #check_known_challenge. 7128 * Closure for #check_known_challenge.
7095 */ 7129 */
7096struct CheckKnownChallengeContext 7130struct CheckKnownChallengeContext
@@ -7349,7 +7383,7 @@ handle_validation_response (
7349 q->validated_until = vs->validated_until; 7383 q->validated_until = vs->validated_until;
7350 q->pd.aged_rtt = vs->validation_rtt; 7384 q->pd.aged_rtt = vs->validation_rtt;
7351 n = q->neighbour; 7385 n = q->neighbour;
7352 vl = GNUNET_CONTAINER_multipeermap_get (links, &vs->pid); 7386 vl = lookup_virtual_link (&vs->pid);
7353 if (NULL != vl) 7387 if (NULL != vl)
7354 { 7388 {
7355 /* Link was already up, remember n is also now available and we are done */ 7389 /* Link was already up, remember n is also now available and we are done */
@@ -7445,6 +7479,11 @@ demultiplex_with_cmc (struct CommunicatorMessageContext *cmc,
7445 struct TransportValidationChallengeMessage, 7479 struct TransportValidationChallengeMessage,
7446 &cmc), 7480 &cmc),
7447 GNUNET_MQ_hd_fixed_size ( 7481 GNUNET_MQ_hd_fixed_size (
7482 validation_challenge_response,
7483 GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_VALIDATION_CHALLENGE_RESPONSE,
7484 struct TransportValidationChallengeResponseMessage,
7485 &cmc),
7486 GNUNET_MQ_hd_fixed_size (
7448 validation_response, 7487 validation_response,
7449 GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_VALIDATION_RESPONSE, 7488 GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_VALIDATION_RESPONSE,
7450 struct TransportValidationResponseMessage, 7489 struct TransportValidationResponseMessage,