aboutsummaryrefslogtreecommitdiff
path: root/src/transport/gnunet-service-tng.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2019-04-22 11:08:13 +0200
committerChristian Grothoff <christian@grothoff.org>2019-04-22 11:08:13 +0200
commit2429db6e434feff044cafc71bd25efe104799b47 (patch)
tree39674070872e99abc8051fe81e2f2fe2d303a9f0 /src/transport/gnunet-service-tng.c
parentcd58bcd814dde6c2b6269bb93c4e6232ddb5e2a6 (diff)
downloadgnunet-2429db6e434feff044cafc71bd25efe104799b47.tar.gz
gnunet-2429db6e434feff044cafc71bd25efe104799b47.zip
renaming
Diffstat (limited to 'src/transport/gnunet-service-tng.c')
-rw-r--r--src/transport/gnunet-service-tng.c183
1 files changed, 95 insertions, 88 deletions
diff --git a/src/transport/gnunet-service-tng.c b/src/transport/gnunet-service-tng.c
index 2b512555c..c4974ca23 100644
--- a/src/transport/gnunet-service-tng.c
+++ b/src/transport/gnunet-service-tng.c
@@ -257,12 +257,12 @@ GNUNET_NETWORK_STRUCT_BEGIN
257/** 257/**
258 * Unique identifier we attach to a message. 258 * Unique identifier we attach to a message.
259 */ 259 */
260struct MessageUUID 260struct MessageUUIDP
261{ 261{
262 /** 262 /**
263 * Unique value. 263 * Unique value.
264 */ 264 */
265 struct GNUNET_ShortHashCode uuid; 265 struct GNUNET_ShortHashCode uuid; // FIXME: change to 8 bytes
266}; 266};
267 267
268 268
@@ -274,14 +274,14 @@ struct FragmentUUIDP
274 /** 274 /**
275 * Unique value identifying a fragment, in NBO. 275 * Unique value identifying a fragment, in NBO.
276 */ 276 */
277 uint32_t uuid GNUNET_PACKED; 277 uint32_t uuid GNUNET_PACKED; // FIXME: change to 2x 2 bytes?
278}; 278};
279 279
280 280
281/** 281/**
282 * Type of a nonce used for challenges. 282 * Type of a nonce used for challenges.
283 */ 283 */
284struct ChallengeNonce 284struct ChallengeNonceP
285{ 285{
286 /** 286 /**
287 * The value of the nonce. Note that this is NOT a hash. 287 * The value of the nonce. Note that this is NOT a hash.
@@ -378,7 +378,7 @@ struct EphemeralConfirmationPS
378 * Plaintext of the variable-size payload that is encrypted 378 * Plaintext of the variable-size payload that is encrypted
379 * within a `struct TransportBackchannelEncapsulationMessage` 379 * within a `struct TransportBackchannelEncapsulationMessage`
380 */ 380 */
381struct TransportBackchannelRequestPayload 381struct TransportBackchannelRequestPayloadP
382{ 382{
383 383
384 /** 384 /**
@@ -432,7 +432,7 @@ struct TransportBackchannelRequestPayload
432 * Outer layer of an encapsulated unfragmented application message sent 432 * Outer layer of an encapsulated unfragmented application message sent
433 * over an unreliable channel. 433 * over an unreliable channel.
434 */ 434 */
435struct TransportReliabilityBox 435struct TransportReliabilityBoxMessage
436{ 436{
437 /** 437 /**
438 * Type is #GNUNET_MESSAGE_TYPE_TRANSPORT_RELIABILITY_BOX 438 * Type is #GNUNET_MESSAGE_TYPE_TRANSPORT_RELIABILITY_BOX
@@ -452,7 +452,7 @@ struct TransportReliabilityBox
452 * messages sent over possibly unreliable channels. Should 452 * messages sent over possibly unreliable channels. Should
453 * be a random. 453 * be a random.
454 */ 454 */
455 struct MessageUUID msg_uuid; 455 struct MessageUUIDP msg_uuid;
456}; 456};
457 457
458 458
@@ -483,7 +483,7 @@ struct TransportReliabilityAckMessage
483 */ 483 */
484 struct GNUNET_TIME_RelativeNBO avg_ack_delay; 484 struct GNUNET_TIME_RelativeNBO avg_ack_delay;
485 485
486 /* followed by any number of `struct MessageUUID` 486 /* followed by any number of `struct MessageUUIDP`
487 messages providing ACKs */ 487 messages providing ACKs */
488}; 488};
489 489
@@ -491,7 +491,7 @@ struct TransportReliabilityAckMessage
491/** 491/**
492 * Outer layer of an encapsulated fragmented application message. 492 * Outer layer of an encapsulated fragmented application message.
493 */ 493 */
494struct TransportFragmentBox 494struct TransportFragmentBoxMessage
495{ 495{
496 /** 496 /**
497 * Type is #GNUNET_MESSAGE_TYPE_TRANSPORT_FRAGMENT 497 * Type is #GNUNET_MESSAGE_TYPE_TRANSPORT_FRAGMENT
@@ -512,7 +512,7 @@ struct TransportFragmentBox
512 * Original message ID for of the message that all the 512 * Original message ID for of the message that all the
513 * fragments belong to. Must be the same for all fragments. 513 * fragments belong to. Must be the same for all fragments.
514 */ 514 */
515 struct MessageUUID msg_uuid; 515 struct MessageUUIDP msg_uuid;
516 516
517 /** 517 /**
518 * Offset of this fragment in the overall message. 518 * Offset of this fragment in the overall message.
@@ -556,7 +556,7 @@ struct TransportFragmentAckMessage
556 * Original message ID for of the message that all the 556 * Original message ID for of the message that all the
557 * fragments belong to. 557 * fragments belong to.
558 */ 558 */
559 struct MessageUUID msg_uuid; 559 struct MessageUUIDP msg_uuid;
560 560
561 /** 561 /**
562 * How long was the ACK delayed relative to the average time of 562 * How long was the ACK delayed relative to the average time of
@@ -615,7 +615,7 @@ struct DvInitPS
615 /** 615 /**
616 * Challenge value used by the initiator to re-identify the path. 616 * Challenge value used by the initiator to re-identify the path.
617 */ 617 */
618 struct ChallengeNonce challenge; 618 struct ChallengeNonceP challenge;
619}; 619};
620 620
621 621
@@ -655,13 +655,13 @@ struct DvHopPS
655 /** 655 /**
656 * Challenge value used by the initiator to re-identify the path. 656 * Challenge value used by the initiator to re-identify the path.
657 */ 657 */
658 struct ChallengeNonce challenge; 658 struct ChallengeNonceP challenge;
659}; 659};
660 660
661 661
662/** 662/**
663 * An entry describing a peer on a path in a 663 * An entry describing a peer on a path in a
664 * `struct TransportDVLearn` message. 664 * `struct TransportDVLearnMessage` message.
665 */ 665 */
666struct DVPathEntryP 666struct DVPathEntryP
667{ 667{
@@ -691,7 +691,7 @@ struct DVPathEntryP
691 * zero, peers that can forward to the initator should always try to 691 * zero, peers that can forward to the initator should always try to
692 * forward to the initiator. 692 * forward to the initiator.
693 */ 693 */
694struct TransportDVLearn 694struct TransportDVLearnMessage
695{ 695{
696 /** 696 /**
697 * Type is #GNUNET_MESSAGE_TYPE_TRANSPORT_DV_LEARN 697 * Type is #GNUNET_MESSAGE_TYPE_TRANSPORT_DV_LEARN
@@ -735,7 +735,7 @@ struct TransportDVLearn
735 /** 735 /**
736 * Challenge value used by the initiator to re-identify the path. 736 * Challenge value used by the initiator to re-identify the path.
737 */ 737 */
738 struct ChallengeNonce challenge; 738 struct ChallengeNonceP challenge;
739 739
740 /* Followed by @e num_hops `struct DVPathEntryP` values, 740 /* Followed by @e num_hops `struct DVPathEntryP` values,
741 excluding the initiator of the DV trace; the last entry is the 741 excluding the initiator of the DV trace; the last entry is the
@@ -758,7 +758,7 @@ struct TransportDVLearn
758 * 758 *
759 * If a peer finds itself still on the list, it must drop the message. 759 * If a peer finds itself still on the list, it must drop the message.
760 */ 760 */
761struct TransportDVBox 761struct TransportDVBoxMessage
762{ 762{
763 /** 763 /**
764 * Type is #GNUNET_MESSAGE_TYPE_TRANSPORT_DV_BOX 764 * Type is #GNUNET_MESSAGE_TYPE_TRANSPORT_DV_BOX
@@ -796,7 +796,7 @@ struct TransportDVBox
796 * Message send to another peer to validate that it can indeed 796 * Message send to another peer to validate that it can indeed
797 * receive messages at a particular address. 797 * receive messages at a particular address.
798 */ 798 */
799struct TransportValidationChallenge 799struct TransportValidationChallengeMessage
800{ 800{
801 801
802 /** 802 /**
@@ -812,7 +812,7 @@ struct TransportValidationChallenge
812 /** 812 /**
813 * Challenge to be signed by the receiving peer. 813 * Challenge to be signed by the receiving peer.
814 */ 814 */
815 struct ChallengeNonce challenge; 815 struct ChallengeNonceP challenge;
816 816
817 /** 817 /**
818 * Timestamp of the sender, to be copied into the reply 818 * Timestamp of the sender, to be copied into the reply
@@ -843,7 +843,7 @@ struct TransportValidationPS
843 /** 843 /**
844 * Challenge signed by the receiving peer. 844 * Challenge signed by the receiving peer.
845 */ 845 */
846 struct ChallengeNonce challenge; 846 struct ChallengeNonceP challenge;
847}; 847};
848 848
849 849
@@ -851,7 +851,7 @@ struct TransportValidationPS
851 * Message send to a peer to respond to a 851 * Message send to a peer to respond to a
852 * #GNUNET_MESSAGE_TYPE_ADDRESS_VALIDATION_CHALLENGE 852 * #GNUNET_MESSAGE_TYPE_ADDRESS_VALIDATION_CHALLENGE
853 */ 853 */
854struct TransportValidationResponse 854struct TransportValidationResponseMessage
855{ 855{
856 856
857 /** 857 /**
@@ -873,7 +873,7 @@ struct TransportValidationResponse
873 /** 873 /**
874 * The challenge that was signed by the receiving peer. 874 * The challenge that was signed by the receiving peer.
875 */ 875 */
876 struct ChallengeNonce challenge; 876 struct ChallengeNonceP challenge;
877 877
878 /** 878 /**
879 * Original timestamp of the sender (was @code{sender_time}), 879 * Original timestamp of the sender (was @code{sender_time}),
@@ -943,7 +943,7 @@ struct LearnLaunchEntry
943 /** 943 /**
944 * Challenge that uniquely identifies this activity. 944 * Challenge that uniquely identifies this activity.
945 */ 945 */
946 struct ChallengeNonce challenge; 946 struct ChallengeNonceP challenge;
947 947
948 /** 948 /**
949 * When did we transmit the DV learn message (used to calculate RTT) and 949 * When did we transmit the DV learn message (used to calculate RTT) and
@@ -1267,7 +1267,8 @@ struct Queue
1267 struct GNUNET_TIME_Absolute validated_until; 1267 struct GNUNET_TIME_Absolute validated_until;
1268 1268
1269 /** 1269 /**
1270 * Message ID generator for transmissions on this queue. 1270 * Message ID generator for transmissions on this queue to the
1271 * communicator.
1271 */ 1272 */
1272 uint64_t mid_gen; 1273 uint64_t mid_gen;
1273 1274
@@ -1328,7 +1329,7 @@ struct ReassemblyContext
1328 * Original message ID for of the message that all the 1329 * Original message ID for of the message that all the
1329 * fragments belong to. 1330 * fragments belong to.
1330 */ 1331 */
1331 struct MessageUUID msg_uuid; 1332 struct MessageUUIDP msg_uuid;
1332 1333
1333 /** 1334 /**
1334 * Which neighbour is this context for? 1335 * Which neighbour is this context for?
@@ -1685,7 +1686,7 @@ struct PendingMessage
1685 * UUID to use for this message (used for reassembly of fragments, only 1686 * UUID to use for this message (used for reassembly of fragments, only
1686 * initialized if @e msg_uuid_set is #GNUNET_YES). 1687 * initialized if @e msg_uuid_set is #GNUNET_YES).
1687 */ 1688 */
1688 struct MessageUUID msg_uuid; 1689 struct MessageUUIDP msg_uuid;
1689 1690
1690 /** 1691 /**
1691 * Counter incremented per generated fragment. 1692 * Counter incremented per generated fragment.
@@ -1984,7 +1985,7 @@ struct ValidationState
1984 * (We must not rotate more often as otherwise we may discard valid answers 1985 * (We must not rotate more often as otherwise we may discard valid answers
1985 * due to packet losses, latency and reorderings on the network). 1986 * due to packet losses, latency and reorderings on the network).
1986 */ 1987 */
1987 struct ChallengeNonce challenge; 1988 struct ChallengeNonceP challenge;
1988 1989
1989 /** 1990 /**
1990 * Claimed address of the peer. 1991 * Claimed address of the peer.
@@ -3237,7 +3238,7 @@ check_communicator_backchannel (
3237 msize = ntohs (cb->header.size) - sizeof (*cb); 3238 msize = ntohs (cb->header.size) - sizeof (*cb);
3238 if (UINT16_MAX - msize > 3239 if (UINT16_MAX - msize >
3239 sizeof (struct TransportBackchannelEncapsulationMessage) + 3240 sizeof (struct TransportBackchannelEncapsulationMessage) +
3240 sizeof (struct TransportBackchannelRequestPayload)) 3241 sizeof (struct TransportBackchannelRequestPayloadP))
3241 { 3242 {
3242 GNUNET_break (0); 3243 GNUNET_break (0);
3243 return GNUNET_SYSERR; 3244 return GNUNET_SYSERR;
@@ -3524,10 +3525,10 @@ forward_via_dvh (const struct DistanceVectorHop *dvh,
3524 enum RouteMessageOptions options) 3525 enum RouteMessageOptions options)
3525{ 3526{
3526 uint16_t mlen = ntohs (payload->size); 3527 uint16_t mlen = ntohs (payload->size);
3527 char boxram[sizeof (struct TransportDVBox) + 3528 char boxram[sizeof (struct TransportDVBoxMessage) +
3528 (dvh->distance + 1) * sizeof (struct GNUNET_PeerIdentity) + 3529 (dvh->distance + 1) * sizeof (struct GNUNET_PeerIdentity) +
3529 mlen] GNUNET_ALIGN; 3530 mlen] GNUNET_ALIGN;
3530 struct TransportDVBox *box = (struct TransportDVBox *) boxram; 3531 struct TransportDVBoxMessage *box = (struct TransportDVBoxMessage *) boxram;
3531 struct GNUNET_PeerIdentity *path = (struct GNUNET_PeerIdentity *) &box[1]; 3532 struct GNUNET_PeerIdentity *path = (struct GNUNET_PeerIdentity *) &box[1];
3532 3533
3533 box->header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_DV_BOX); 3534 box->header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_DV_BOX);
@@ -3868,14 +3869,14 @@ handle_communicator_backchannel (
3868 struct GNUNET_CRYPTO_EcdhePrivateKey private_key; 3869 struct GNUNET_CRYPTO_EcdhePrivateKey private_key;
3869 struct GNUNET_TIME_Absolute ephemeral_validity; 3870 struct GNUNET_TIME_Absolute ephemeral_validity;
3870 struct TransportBackchannelEncapsulationMessage *enc; 3871 struct TransportBackchannelEncapsulationMessage *enc;
3871 struct TransportBackchannelRequestPayload ppay; 3872 struct TransportBackchannelRequestPayloadP ppay;
3872 struct BackchannelKeyState key; 3873 struct BackchannelKeyState key;
3873 char *mpos; 3874 char *mpos;
3874 uint16_t msize; 3875 uint16_t msize;
3875 3876
3876 /* encapsulate and encrypt message */ 3877 /* encapsulate and encrypt message */
3877 msize = ntohs (cb->header.size) - sizeof (*cb) + 3878 msize = ntohs (cb->header.size) - sizeof (*cb) +
3878 sizeof (struct TransportBackchannelRequestPayload); 3879 sizeof (struct TransportBackchannelRequestPayloadP);
3879 enc = GNUNET_malloc (sizeof (*enc) + msize); 3880 enc = GNUNET_malloc (sizeof (*enc) + msize);
3880 enc->header.type = 3881 enc->header.type =
3881 htons (GNUNET_MESSAGE_TYPE_TRANSPORT_BACKCHANNEL_ENCAPSULATION); 3882 htons (GNUNET_MESSAGE_TYPE_TRANSPORT_BACKCHANNEL_ENCAPSULATION);
@@ -4186,7 +4187,7 @@ handle_raw_message (void *cls, const struct GNUNET_MessageHeader *mh)
4186 * @return #GNUNET_YES if message is well-formed 4187 * @return #GNUNET_YES if message is well-formed
4187 */ 4188 */
4188static int 4189static int
4189check_fragment_box (void *cls, const struct TransportFragmentBox *fb) 4190check_fragment_box (void *cls, const struct TransportFragmentBoxMessage *fb)
4190{ 4191{
4191 uint16_t size = ntohs (fb->header.size); 4192 uint16_t size = ntohs (fb->header.size);
4192 uint16_t bsize = size - sizeof (*fb); 4193 uint16_t bsize = size - sizeof (*fb);
@@ -4248,7 +4249,7 @@ send_fragment_ack (struct ReassemblyContext *rc)
4248 * @param fb the message that was received 4249 * @param fb the message that was received
4249 */ 4250 */
4250static void 4251static void
4251handle_fragment_box (void *cls, const struct TransportFragmentBox *fb) 4252handle_fragment_box (void *cls, const struct TransportFragmentBoxMessage *fb)
4252{ 4253{
4253 struct CommunicatorMessageContext *cmc = cls; 4254 struct CommunicatorMessageContext *cmc = cls;
4254 struct Neighbour *n; 4255 struct Neighbour *n;
@@ -4432,8 +4433,8 @@ check_ack_against_pm (struct PendingMessage *pm,
4432 match = GNUNET_NO; 4433 match = GNUNET_NO;
4433 for (struct PendingMessage *frag = pm->head_frag; NULL != frag; frag = nxt) 4434 for (struct PendingMessage *frag = pm->head_frag; NULL != frag; frag = nxt)
4434 { 4435 {
4435 const struct TransportFragmentBox *tfb = 4436 const struct TransportFragmentBoxMessage *tfb =
4436 (const struct TransportFragmentBox *) &pm[1]; 4437 (const struct TransportFragmentBoxMessage *) &pm[1];
4437 uint32_t fu = ntohl (tfb->frag_uuid.uuid); 4438 uint32_t fu = ntohl (tfb->frag_uuid.uuid);
4438 4439
4439 GNUNET_assert (PMT_FRAGMENT_BOX == frag->pmt); 4440 GNUNET_assert (PMT_FRAGMENT_BOX == frag->pmt);
@@ -4541,7 +4542,8 @@ handle_fragment_ack (void *cls, const struct TransportFragmentAckMessage *fa)
4541 * @return #GNUNET_YES if message is well-formed 4542 * @return #GNUNET_YES if message is well-formed
4542 */ 4543 */
4543static int 4544static int
4544check_reliability_box (void *cls, const struct TransportReliabilityBox *rb) 4545check_reliability_box (void *cls,
4546 const struct TransportReliabilityBoxMessage *rb)
4545{ 4547{
4546 GNUNET_MQ_check_boxed_message (rb); 4548 GNUNET_MQ_check_boxed_message (rb);
4547 return GNUNET_YES; 4549 return GNUNET_YES;
@@ -4556,7 +4558,8 @@ check_reliability_box (void *cls, const struct TransportReliabilityBox *rb)
4556 * @param rb the message that was received 4558 * @param rb the message that was received
4557 */ 4559 */
4558static void 4560static void
4559handle_reliability_box (void *cls, const struct TransportReliabilityBox *rb) 4561handle_reliability_box (void *cls,
4562 const struct TransportReliabilityBoxMessage *rb)
4560{ 4563{
4561 struct CommunicatorMessageContext *cmc = cls; 4564 struct CommunicatorMessageContext *cmc = cls;
4562 const struct GNUNET_MessageHeader *inbox = 4565 const struct GNUNET_MessageHeader *inbox =
@@ -4568,10 +4571,10 @@ handle_reliability_box (void *cls, const struct TransportReliabilityBox *rb)
4568 4571
4569 /* FIXME-OPTIMIZE: implement cummulative ACKs and ack_countdown, 4572 /* FIXME-OPTIMIZE: implement cummulative ACKs and ack_countdown,
4570 then setting the avg_ack_delay field below: */ 4573 then setting the avg_ack_delay field below: */
4571 ack = GNUNET_malloc (sizeof (*ack) + sizeof (struct MessageUUID)); 4574 ack = GNUNET_malloc (sizeof (*ack) + sizeof (struct MessageUUIDP));
4572 ack->header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_RELIABILITY_ACK); 4575 ack->header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_RELIABILITY_ACK);
4573 ack->header.size = htons (sizeof (*ack) + sizeof (struct MessageUUID)); 4576 ack->header.size = htons (sizeof (*ack) + sizeof (struct MessageUUIDP));
4574 memcpy (&ack[1], &rb->msg_uuid, sizeof (struct MessageUUID)); 4577 memcpy (&ack[1], &rb->msg_uuid, sizeof (struct MessageUUIDP));
4575 route_message (&cmc->im.sender, &ack->header, RMO_DV_ALLOWED); 4578 route_message (&cmc->im.sender, &ack->header, RMO_DV_ALLOWED);
4576 } 4579 }
4577 /* continue with inner message */ 4580 /* continue with inner message */
@@ -4593,7 +4596,7 @@ handle_reliability_ack (void *cls,
4593 struct CommunicatorMessageContext *cmc = cls; 4596 struct CommunicatorMessageContext *cmc = cls;
4594 struct Neighbour *n; 4597 struct Neighbour *n;
4595 unsigned int n_acks; 4598 unsigned int n_acks;
4596 const struct MessageUUID *msg_uuids; 4599 const struct MessageUUIDP *msg_uuids;
4597 struct PendingMessage *nxt; 4600 struct PendingMessage *nxt;
4598 int matched; 4601 int matched;
4599 4602
@@ -4608,8 +4611,8 @@ handle_reliability_ack (void *cls,
4608 return; 4611 return;
4609 } 4612 }
4610 n_acks = 4613 n_acks =
4611 (ntohs (ra->header.size) - sizeof (*ra)) / sizeof (struct MessageUUID); 4614 (ntohs (ra->header.size) - sizeof (*ra)) / sizeof (struct MessageUUIDP);
4612 msg_uuids = (const struct MessageUUID *) &ra[1]; 4615 msg_uuids = (const struct MessageUUIDP *) &ra[1];
4613 4616
4614 /* FIXME-OPTIMIZE: maybe use another hash map here? */ 4617 /* FIXME-OPTIMIZE: maybe use another hash map here? */
4615 matched = GNUNET_NO; 4618 matched = GNUNET_NO;
@@ -4675,7 +4678,7 @@ check_backchannel_encapsulation (
4675 4678
4676 (void) cls; 4679 (void) cls;
4677 if ((size - sizeof (*be)) < 4680 if ((size - sizeof (*be)) <
4678 (sizeof (struct TransportBackchannelRequestPayload) + 4681 (sizeof (struct TransportBackchannelRequestPayloadP) +
4679 sizeof (struct GNUNET_MessageHeader))) 4682 sizeof (struct GNUNET_MessageHeader)))
4680 { 4683 {
4681 GNUNET_break_op (0); 4684 GNUNET_break_op (0);
@@ -4978,7 +4981,7 @@ handle_backchannel_encapsulation (
4978 { 4981 {
4979 struct Backtalker *b; 4982 struct Backtalker *b;
4980 struct GNUNET_TIME_Absolute monotime; 4983 struct GNUNET_TIME_Absolute monotime;
4981 struct TransportBackchannelRequestPayload ppay; 4984 struct TransportBackchannelRequestPayloadP ppay;
4982 char body[hdr_len - sizeof (ppay)]; 4985 char body[hdr_len - sizeof (ppay)];
4983 4986
4984 GNUNET_assert (hdr_len >= 4987 GNUNET_assert (hdr_len >=
@@ -5325,7 +5328,7 @@ learn_dv_path (const struct GNUNET_PeerIdentity *path,
5325 * @return #GNUNET_YES if message is well-formed 5328 * @return #GNUNET_YES if message is well-formed
5326 */ 5329 */
5327static int 5330static int
5328check_dv_learn (void *cls, const struct TransportDVLearn *dvl) 5331check_dv_learn (void *cls, const struct TransportDVLearnMessage *dvl)
5329{ 5332{
5330 uint16_t size = ntohs (dvl->header.size); 5333 uint16_t size = ntohs (dvl->header.size);
5331 uint16_t num_hops = ntohs (dvl->num_hops); 5334 uint16_t num_hops = ntohs (dvl->num_hops);
@@ -5372,22 +5375,22 @@ check_dv_learn (void *cls, const struct TransportDVLearn *dvl)
5372 */ 5375 */
5373static void 5376static void
5374forward_dv_learn (const struct GNUNET_PeerIdentity *next_hop, 5377forward_dv_learn (const struct GNUNET_PeerIdentity *next_hop,
5375 const struct TransportDVLearn *msg, 5378 const struct TransportDVLearnMessage *msg,
5376 uint16_t bi_history, 5379 uint16_t bi_history,
5377 uint16_t nhops, 5380 uint16_t nhops,
5378 const struct DVPathEntryP *hops, 5381 const struct DVPathEntryP *hops,
5379 struct GNUNET_TIME_Absolute in_time) 5382 struct GNUNET_TIME_Absolute in_time)
5380{ 5383{
5381 struct DVPathEntryP *dhops; 5384 struct DVPathEntryP *dhops;
5382 struct TransportDVLearn *fwd; 5385 struct TransportDVLearnMessage *fwd;
5383 struct GNUNET_TIME_Relative nnd; 5386 struct GNUNET_TIME_Relative nnd;
5384 5387
5385 /* compute message for forwarding */ 5388 /* compute message for forwarding */
5386 GNUNET_assert (nhops < MAX_DV_HOPS_ALLOWED); 5389 GNUNET_assert (nhops < MAX_DV_HOPS_ALLOWED);
5387 fwd = GNUNET_malloc (sizeof (struct TransportDVLearn) + 5390 fwd = GNUNET_malloc (sizeof (struct TransportDVLearnMessage) +
5388 (nhops + 1) * sizeof (struct DVPathEntryP)); 5391 (nhops + 1) * sizeof (struct DVPathEntryP));
5389 fwd->header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_DV_LEARN); 5392 fwd->header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_DV_LEARN);
5390 fwd->header.size = htons (sizeof (struct TransportDVLearn) + 5393 fwd->header.size = htons (sizeof (struct TransportDVLearnMessage) +
5391 (nhops + 1) * sizeof (struct DVPathEntryP)); 5394 (nhops + 1) * sizeof (struct DVPathEntryP));
5392 fwd->num_hops = htons (nhops + 1); 5395 fwd->num_hops = htons (nhops + 1);
5393 fwd->bidirectional = htons (bi_history); 5396 fwd->bidirectional = htons (bi_history);
@@ -5429,7 +5432,7 @@ forward_dv_learn (const struct GNUNET_PeerIdentity *next_hop,
5429static int 5432static int
5430validate_dv_initiator_signature ( 5433validate_dv_initiator_signature (
5431 const struct GNUNET_PeerIdentity *init, 5434 const struct GNUNET_PeerIdentity *init,
5432 const struct ChallengeNonce *challenge, 5435 const struct ChallengeNonceP *challenge,
5433 const struct GNUNET_CRYPTO_EddsaSignature *init_sig) 5436 const struct GNUNET_CRYPTO_EddsaSignature *init_sig)
5434{ 5437{
5435 struct DvInitPS ip = {.purpose.purpose = htonl ( 5438 struct DvInitPS ip = {.purpose.purpose = htonl (
@@ -5459,7 +5462,7 @@ validate_dv_initiator_signature (
5459 * @param dvl the message that was received 5462 * @param dvl the message that was received
5460 */ 5463 */
5461static void 5464static void
5462handle_dv_learn (void *cls, const struct TransportDVLearn *dvl) 5465handle_dv_learn (void *cls, const struct TransportDVLearnMessage *dvl)
5463{ 5466{
5464 struct CommunicatorMessageContext *cmc = cls; 5467 struct CommunicatorMessageContext *cmc = cls;
5465 enum GNUNET_TRANSPORT_CommunicatorCharacteristics cc; 5468 enum GNUNET_TRANSPORT_CommunicatorCharacteristics cc;
@@ -5657,7 +5660,7 @@ handle_dv_learn (void *cls, const struct TransportDVLearn *dvl)
5657 * @return #GNUNET_YES if message is well-formed 5660 * @return #GNUNET_YES if message is well-formed
5658 */ 5661 */
5659static int 5662static int
5660check_dv_box (void *cls, const struct TransportDVBox *dvb) 5663check_dv_box (void *cls, const struct TransportDVBoxMessage *dvb)
5661{ 5664{
5662 uint16_t size = ntohs (dvb->header.size); 5665 uint16_t size = ntohs (dvb->header.size);
5663 uint16_t num_hops = ntohs (dvb->num_hops); 5666 uint16_t num_hops = ntohs (dvb->num_hops);
@@ -5719,17 +5722,17 @@ forward_dv_box (struct Neighbour *next_hop,
5719 const void *payload, 5722 const void *payload,
5720 uint16_t payload_size) 5723 uint16_t payload_size)
5721{ 5724{
5722 struct TransportDVBox *dvb; 5725 struct TransportDVBoxMessage *dvb;
5723 struct GNUNET_PeerIdentity *dhops; 5726 struct GNUNET_PeerIdentity *dhops;
5724 5727
5725 GNUNET_assert (UINT16_MAX < sizeof (struct TransportDVBox) + 5728 GNUNET_assert (UINT16_MAX < sizeof (struct TransportDVBoxMessage) +
5726 sizeof (struct GNUNET_PeerIdentity) * num_hops + 5729 sizeof (struct GNUNET_PeerIdentity) * num_hops +
5727 payload_size); 5730 payload_size);
5728 dvb = GNUNET_malloc (sizeof (struct TransportDVBox) + 5731 dvb = GNUNET_malloc (sizeof (struct TransportDVBoxMessage) +
5729 sizeof (struct GNUNET_PeerIdentity) * num_hops + 5732 sizeof (struct GNUNET_PeerIdentity) * num_hops +
5730 payload_size); 5733 payload_size);
5731 dvb->header.size = 5734 dvb->header.size =
5732 htons (sizeof (struct TransportDVBox) + 5735 htons (sizeof (struct TransportDVBoxMessage) +
5733 sizeof (struct GNUNET_PeerIdentity) * num_hops + payload_size); 5736 sizeof (struct GNUNET_PeerIdentity) * num_hops + payload_size);
5734 dvb->header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_DV_BOX); 5737 dvb->header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_DV_BOX);
5735 dvb->total_hops = htons (total_hops); 5738 dvb->total_hops = htons (total_hops);
@@ -5750,7 +5753,7 @@ forward_dv_box (struct Neighbour *next_hop,
5750 * @param dvb the message that was received 5753 * @param dvb the message that was received
5751 */ 5754 */
5752static void 5755static void
5753handle_dv_box (void *cls, const struct TransportDVBox *dvb) 5756handle_dv_box (void *cls, const struct TransportDVBoxMessage *dvb)
5754{ 5757{
5755 struct CommunicatorMessageContext *cmc = cls; 5758 struct CommunicatorMessageContext *cmc = cls;
5756 uint16_t size = ntohs (dvb->header.size) - sizeof (*dvb); 5759 uint16_t size = ntohs (dvb->header.size) - sizeof (*dvb);
@@ -5834,11 +5837,12 @@ check_incoming_msg (void *cls,
5834 * @param tvc the message that was received 5837 * @param tvc the message that was received
5835 */ 5838 */
5836static void 5839static void
5837handle_validation_challenge (void *cls, 5840handle_validation_challenge (
5838 const struct TransportValidationChallenge *tvc) 5841 void *cls,
5842 const struct TransportValidationChallengeMessage *tvc)
5839{ 5843{
5840 struct CommunicatorMessageContext *cmc = cls; 5844 struct CommunicatorMessageContext *cmc = cls;
5841 struct TransportValidationResponse *tvr; 5845 struct TransportValidationResponseMessage *tvr;
5842 5846
5843 if (cmc->total_hops > 0) 5847 if (cmc->total_hops > 0)
5844 { 5848 {
@@ -5847,7 +5851,7 @@ handle_validation_challenge (void *cls,
5847 finish_cmc_handling (cmc); 5851 finish_cmc_handling (cmc);
5848 return; 5852 return;
5849 } 5853 }
5850 tvr = GNUNET_new (struct TransportValidationResponse); 5854 tvr = GNUNET_new (struct TransportValidationResponseMessage);
5851 tvr->header.type = 5855 tvr->header.type =
5852 htons (GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_VALIDATION_RESPONSE); 5856 htons (GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_VALIDATION_RESPONSE);
5853 tvr->header.size = htons (sizeof (*tvr)); 5857 tvr->header.size = htons (sizeof (*tvr));
@@ -5881,7 +5885,7 @@ struct CheckKnownChallengeContext
5881 /** 5885 /**
5882 * Set to the challenge we are looking for. 5886 * Set to the challenge we are looking for.
5883 */ 5887 */
5884 const struct ChallengeNonce *challenge; 5888 const struct ChallengeNonceP *challenge;
5885 5889
5886 /** 5890 /**
5887 * Set to a matching validation state, if one was found. 5891 * Set to a matching validation state, if one was found.
@@ -6085,8 +6089,9 @@ update_neighbour_core_visibility (struct Neighbour *n)
6085 * @param tvr the message that was received 6089 * @param tvr the message that was received
6086 */ 6090 */
6087static void 6091static void
6088handle_validation_response (void *cls, 6092handle_validation_response (
6089 const struct TransportValidationResponse *tvr) 6093 void *cls,
6094 const struct TransportValidationResponseMessage *tvr)
6090{ 6095{
6091 struct CommunicatorMessageContext *cmc = cls; 6096 struct CommunicatorMessageContext *cmc = cls;
6092 struct ValidationState *vs; 6097 struct ValidationState *vs;
@@ -6247,7 +6252,7 @@ demultiplex_with_cmc (struct CommunicatorMessageContext *cmc,
6247 struct GNUNET_MQ_MessageHandler handlers[] = 6252 struct GNUNET_MQ_MessageHandler handlers[] =
6248 {GNUNET_MQ_hd_var_size (fragment_box, 6253 {GNUNET_MQ_hd_var_size (fragment_box,
6249 GNUNET_MESSAGE_TYPE_TRANSPORT_FRAGMENT, 6254 GNUNET_MESSAGE_TYPE_TRANSPORT_FRAGMENT,
6250 struct TransportFragmentBox, 6255 struct TransportFragmentBoxMessage,
6251 &cmc), 6256 &cmc),
6252 GNUNET_MQ_hd_fixed_size (fragment_ack, 6257 GNUNET_MQ_hd_fixed_size (fragment_ack,
6253 GNUNET_MESSAGE_TYPE_TRANSPORT_FRAGMENT_ACK, 6258 GNUNET_MESSAGE_TYPE_TRANSPORT_FRAGMENT_ACK,
@@ -6255,7 +6260,7 @@ demultiplex_with_cmc (struct CommunicatorMessageContext *cmc,
6255 &cmc), 6260 &cmc),
6256 GNUNET_MQ_hd_var_size (reliability_box, 6261 GNUNET_MQ_hd_var_size (reliability_box,
6257 GNUNET_MESSAGE_TYPE_TRANSPORT_RELIABILITY_BOX, 6262 GNUNET_MESSAGE_TYPE_TRANSPORT_RELIABILITY_BOX,
6258 struct TransportReliabilityBox, 6263 struct TransportReliabilityBoxMessage,
6259 &cmc), 6264 &cmc),
6260 GNUNET_MQ_hd_fixed_size (reliability_ack, 6265 GNUNET_MQ_hd_fixed_size (reliability_ack,
6261 GNUNET_MESSAGE_TYPE_TRANSPORT_RELIABILITY_ACK, 6266 GNUNET_MESSAGE_TYPE_TRANSPORT_RELIABILITY_ACK,
@@ -6267,21 +6272,21 @@ demultiplex_with_cmc (struct CommunicatorMessageContext *cmc,
6267 &cmc), 6272 &cmc),
6268 GNUNET_MQ_hd_var_size (dv_learn, 6273 GNUNET_MQ_hd_var_size (dv_learn,
6269 GNUNET_MESSAGE_TYPE_TRANSPORT_DV_LEARN, 6274 GNUNET_MESSAGE_TYPE_TRANSPORT_DV_LEARN,
6270 struct TransportDVLearn, 6275 struct TransportDVLearnMessage,
6271 &cmc), 6276 &cmc),
6272 GNUNET_MQ_hd_var_size (dv_box, 6277 GNUNET_MQ_hd_var_size (dv_box,
6273 GNUNET_MESSAGE_TYPE_TRANSPORT_DV_BOX, 6278 GNUNET_MESSAGE_TYPE_TRANSPORT_DV_BOX,
6274 struct TransportDVBox, 6279 struct TransportDVBoxMessage,
6275 &cmc), 6280 &cmc),
6276 GNUNET_MQ_hd_fixed_size ( 6281 GNUNET_MQ_hd_fixed_size (
6277 validation_challenge, 6282 validation_challenge,
6278 GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_VALIDATION_CHALLENGE, 6283 GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_VALIDATION_CHALLENGE,
6279 struct TransportValidationChallenge, 6284 struct TransportValidationChallengeMessage,
6280 &cmc), 6285 &cmc),
6281 GNUNET_MQ_hd_fixed_size ( 6286 GNUNET_MQ_hd_fixed_size (
6282 validation_response, 6287 validation_response,
6283 GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_VALIDATION_RESPONSE, 6288 GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_VALIDATION_RESPONSE,
6284 struct TransportValidationResponse, 6289 struct TransportValidationResponseMessage,
6285 &cmc), 6290 &cmc),
6286 GNUNET_MQ_handler_end ()}; 6291 GNUNET_MQ_handler_end ()};
6287 int ret; 6292 int ret;
@@ -6378,7 +6383,7 @@ fragment_message (struct PendingMessage *pm, uint16_t mtu)
6378 set_pending_message_uuid (pm); 6383 set_pending_message_uuid (pm);
6379 6384
6380 /* This invariant is established in #handle_add_queue_message() */ 6385 /* This invariant is established in #handle_add_queue_message() */
6381 GNUNET_assert (mtu > sizeof (struct TransportFragmentBox)); 6386 GNUNET_assert (mtu > sizeof (struct TransportFragmentBoxMessage));
6382 6387
6383 /* select fragment for transmission, descending the tree if it has 6388 /* select fragment for transmission, descending the tree if it has
6384 been expanded until we are at a leaf or at a fragment that is small enough 6389 been expanded until we are at a leaf or at a fragment that is small enough
@@ -6394,7 +6399,7 @@ fragment_message (struct PendingMessage *pm, uint16_t mtu)
6394 { 6399 {
6395 /* Did not yet calculate all fragments, calculate next fragment */ 6400 /* Did not yet calculate all fragments, calculate next fragment */
6396 struct PendingMessage *frag; 6401 struct PendingMessage *frag;
6397 struct TransportFragmentBox tfb; 6402 struct TransportFragmentBoxMessage tfb;
6398 const char *orig; 6403 const char *orig;
6399 char *msg; 6404 char *msg;
6400 uint16_t fragmax; 6405 uint16_t fragmax;
@@ -6406,25 +6411,27 @@ fragment_message (struct PendingMessage *pm, uint16_t mtu)
6406 msize = ff->bytes_msg; 6411 msize = ff->bytes_msg;
6407 if (pm != ff) 6412 if (pm != ff)
6408 { 6413 {
6409 const struct TransportFragmentBox *tfbo; 6414 const struct TransportFragmentBoxMessage *tfbo;
6410 6415
6411 tfbo = (const struct TransportFragmentBox *) orig; 6416 tfbo = (const struct TransportFragmentBoxMessage *) orig;
6412 orig += sizeof (struct TransportFragmentBox); 6417 orig += sizeof (struct TransportFragmentBoxMessage);
6413 msize -= sizeof (struct TransportFragmentBox); 6418 msize -= sizeof (struct TransportFragmentBoxMessage);
6414 xoff = ntohs (tfbo->frag_off); 6419 xoff = ntohs (tfbo->frag_off);
6415 } 6420 }
6416 fragmax = mtu - sizeof (struct TransportFragmentBox); 6421 fragmax = mtu - sizeof (struct TransportFragmentBoxMessage);
6417 fragsize = GNUNET_MIN (msize - ff->frag_off, fragmax); 6422 fragsize = GNUNET_MIN (msize - ff->frag_off, fragmax);
6418 frag = GNUNET_malloc (sizeof (struct PendingMessage) + 6423 frag =
6419 sizeof (struct TransportFragmentBox) + fragsize); 6424 GNUNET_malloc (sizeof (struct PendingMessage) +
6425 sizeof (struct TransportFragmentBoxMessage) + fragsize);
6420 frag->target = pm->target; 6426 frag->target = pm->target;
6421 frag->frag_parent = ff; 6427 frag->frag_parent = ff;
6422 frag->timeout = pm->timeout; 6428 frag->timeout = pm->timeout;
6423 frag->bytes_msg = sizeof (struct TransportFragmentBox) + fragsize; 6429 frag->bytes_msg = sizeof (struct TransportFragmentBoxMessage) + fragsize;
6424 frag->pmt = PMT_FRAGMENT_BOX; 6430 frag->pmt = PMT_FRAGMENT_BOX;
6425 msg = (char *) &frag[1]; 6431 msg = (char *) &frag[1];
6426 tfb.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_FRAGMENT); 6432 tfb.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_FRAGMENT);
6427 tfb.header.size = htons (sizeof (struct TransportFragmentBox) + fragsize); 6433 tfb.header.size =
6434 htons (sizeof (struct TransportFragmentBoxMessage) + fragsize);
6428 tfb.frag_uuid.uuid = htonl (pm->frag_uuidgen++); 6435 tfb.frag_uuid.uuid = htonl (pm->frag_uuidgen++);
6429 tfb.msg_uuid = pm->msg_uuid; 6436 tfb.msg_uuid = pm->msg_uuid;
6430 tfb.frag_off = htons (ff->frag_off + xoff); 6437 tfb.frag_off = htons (ff->frag_off + xoff);
@@ -6462,7 +6469,7 @@ fragment_message (struct PendingMessage *pm, uint16_t mtu)
6462static struct PendingMessage * 6469static struct PendingMessage *
6463reliability_box_message (struct PendingMessage *pm) 6470reliability_box_message (struct PendingMessage *pm)
6464{ 6471{
6465 struct TransportReliabilityBox rbox; 6472 struct TransportReliabilityBoxMessage rbox;
6466 struct PendingMessage *bpm; 6473 struct PendingMessage *bpm;
6467 char *msg; 6474 char *msg;
6468 6475
@@ -6588,7 +6595,7 @@ transmit_on_queue (void *cls)
6588 return; /* do it later */ 6595 return; /* do it later */
6589 overhead = 0; 6596 overhead = 0;
6590 if (GNUNET_TRANSPORT_CC_RELIABLE != queue->tc->details.communicator.cc) 6597 if (GNUNET_TRANSPORT_CC_RELIABLE != queue->tc->details.communicator.cc)
6591 overhead += sizeof (struct TransportReliabilityBox); 6598 overhead += sizeof (struct TransportReliabilityBoxMessage);
6592 s = pm; 6599 s = pm;
6593 if ( ( (0 != queue->mtu) && 6600 if ( ( (0 != queue->mtu) &&
6594 (pm->bytes_msg + overhead > queue->mtu) ) || 6601 (pm->bytes_msg + overhead > queue->mtu) ) ||
@@ -7032,7 +7039,7 @@ suggest_to_connect (const struct GNUNET_PeerIdentity *pid, const char *address)
7032static void 7039static void
7033validation_transmit_on_queue (struct Queue *q, struct ValidationState *vs) 7040validation_transmit_on_queue (struct Queue *q, struct ValidationState *vs)
7034{ 7041{
7035 struct TransportValidationChallenge tvc; 7042 struct TransportValidationChallengeMessage tvc;
7036 7043
7037 vs->last_challenge_use = GNUNET_TIME_absolute_get (); 7044 vs->last_challenge_use = GNUNET_TIME_absolute_get ();
7038 tvc.header.type = 7045 tvc.header.type =
@@ -7170,7 +7177,7 @@ start_dv_learn (void *cls)
7170{ 7177{
7171 struct LearnLaunchEntry *lle; 7178 struct LearnLaunchEntry *lle;
7172 struct QueueQualityContext qqc; 7179 struct QueueQualityContext qqc;
7173 struct TransportDVLearn dvl; 7180 struct TransportDVLearnMessage dvl;
7174 7181
7175 (void) cls; 7182 (void) cls;
7176 dvlearn_task = NULL; 7183 dvlearn_task = NULL;
@@ -7301,7 +7308,7 @@ handle_add_queue_message (void *cls,
7301 const char *addr; 7308 const char *addr;
7302 uint16_t addr_len; 7309 uint16_t addr_len;
7303 7310
7304 if (ntohl (aqm->mtu) <= sizeof (struct TransportFragmentBox)) 7311 if (ntohl (aqm->mtu) <= sizeof (struct TransportFragmentBoxMessage))
7305 { 7312 {
7306 /* MTU so small as to be useless for transmissions, 7313 /* MTU so small as to be useless for transmissions,
7307 required for #fragment_message()! */ 7314 required for #fragment_message()! */