/**
* Unique identifier we attach to a message.
*/
-struct MessageUUID
+struct MessageUUIDP
{
/**
* Unique value.
*/
- struct GNUNET_ShortHashCode uuid;
+ struct GNUNET_ShortHashCode uuid; // FIXME: change to 8 bytes
};
/**
* Unique value identifying a fragment, in NBO.
*/
- uint32_t uuid GNUNET_PACKED;
+ uint32_t uuid GNUNET_PACKED; // FIXME: change to 2x 2 bytes?
};
/**
* Type of a nonce used for challenges.
*/
-struct ChallengeNonce
+struct ChallengeNonceP
{
/**
* The value of the nonce. Note that this is NOT a hash.
* Plaintext of the variable-size payload that is encrypted
* within a `struct TransportBackchannelEncapsulationMessage`
*/
-struct TransportBackchannelRequestPayload
+struct TransportBackchannelRequestPayloadP
{
/**
* Outer layer of an encapsulated unfragmented application message sent
* over an unreliable channel.
*/
-struct TransportReliabilityBox
+struct TransportReliabilityBoxMessage
{
/**
* Type is #GNUNET_MESSAGE_TYPE_TRANSPORT_RELIABILITY_BOX
* messages sent over possibly unreliable channels. Should
* be a random.
*/
- struct MessageUUID msg_uuid;
+ struct MessageUUIDP msg_uuid;
};
*/
struct GNUNET_TIME_RelativeNBO avg_ack_delay;
- /* followed by any number of `struct MessageUUID`
+ /* followed by any number of `struct MessageUUIDP`
messages providing ACKs */
};
/**
* Outer layer of an encapsulated fragmented application message.
*/
-struct TransportFragmentBox
+struct TransportFragmentBoxMessage
{
/**
* Type is #GNUNET_MESSAGE_TYPE_TRANSPORT_FRAGMENT
* Original message ID for of the message that all the
* fragments belong to. Must be the same for all fragments.
*/
- struct MessageUUID msg_uuid;
+ struct MessageUUIDP msg_uuid;
/**
* Offset of this fragment in the overall message.
* Original message ID for of the message that all the
* fragments belong to.
*/
- struct MessageUUID msg_uuid;
+ struct MessageUUIDP msg_uuid;
/**
* How long was the ACK delayed relative to the average time of
/**
* Challenge value used by the initiator to re-identify the path.
*/
- struct ChallengeNonce challenge;
+ struct ChallengeNonceP challenge;
};
/**
* Challenge value used by the initiator to re-identify the path.
*/
- struct ChallengeNonce challenge;
+ struct ChallengeNonceP challenge;
};
/**
* An entry describing a peer on a path in a
- * `struct TransportDVLearn` message.
+ * `struct TransportDVLearnMessage` message.
*/
struct DVPathEntryP
{
* zero, peers that can forward to the initator should always try to
* forward to the initiator.
*/
-struct TransportDVLearn
+struct TransportDVLearnMessage
{
/**
* Type is #GNUNET_MESSAGE_TYPE_TRANSPORT_DV_LEARN
/**
* Challenge value used by the initiator to re-identify the path.
*/
- struct ChallengeNonce challenge;
+ struct ChallengeNonceP challenge;
/* Followed by @e num_hops `struct DVPathEntryP` values,
excluding the initiator of the DV trace; the last entry is the
*
* If a peer finds itself still on the list, it must drop the message.
*/
-struct TransportDVBox
+struct TransportDVBoxMessage
{
/**
* Type is #GNUNET_MESSAGE_TYPE_TRANSPORT_DV_BOX
* Message send to another peer to validate that it can indeed
* receive messages at a particular address.
*/
-struct TransportValidationChallenge
+struct TransportValidationChallengeMessage
{
/**
/**
* Challenge to be signed by the receiving peer.
*/
- struct ChallengeNonce challenge;
+ struct ChallengeNonceP challenge;
/**
* Timestamp of the sender, to be copied into the reply
/**
* Challenge signed by the receiving peer.
*/
- struct ChallengeNonce challenge;
+ struct ChallengeNonceP challenge;
};
* Message send to a peer to respond to a
* #GNUNET_MESSAGE_TYPE_ADDRESS_VALIDATION_CHALLENGE
*/
-struct TransportValidationResponse
+struct TransportValidationResponseMessage
{
/**
/**
* The challenge that was signed by the receiving peer.
*/
- struct ChallengeNonce challenge;
+ struct ChallengeNonceP challenge;
/**
* Original timestamp of the sender (was @code{sender_time}),
/**
* Challenge that uniquely identifies this activity.
*/
- struct ChallengeNonce challenge;
+ struct ChallengeNonceP challenge;
/**
* When did we transmit the DV learn message (used to calculate RTT) and
struct GNUNET_TIME_Absolute validated_until;
/**
- * Message ID generator for transmissions on this queue.
+ * Message ID generator for transmissions on this queue to the
+ * communicator.
*/
uint64_t mid_gen;
* Original message ID for of the message that all the
* fragments belong to.
*/
- struct MessageUUID msg_uuid;
+ struct MessageUUIDP msg_uuid;
/**
* Which neighbour is this context for?
* UUID to use for this message (used for reassembly of fragments, only
* initialized if @e msg_uuid_set is #GNUNET_YES).
*/
- struct MessageUUID msg_uuid;
+ struct MessageUUIDP msg_uuid;
/**
* Counter incremented per generated fragment.
* (We must not rotate more often as otherwise we may discard valid answers
* due to packet losses, latency and reorderings on the network).
*/
- struct ChallengeNonce challenge;
+ struct ChallengeNonceP challenge;
/**
* Claimed address of the peer.
msize = ntohs (cb->header.size) - sizeof (*cb);
if (UINT16_MAX - msize >
sizeof (struct TransportBackchannelEncapsulationMessage) +
- sizeof (struct TransportBackchannelRequestPayload))
+ sizeof (struct TransportBackchannelRequestPayloadP))
{
GNUNET_break (0);
return GNUNET_SYSERR;
enum RouteMessageOptions options)
{
uint16_t mlen = ntohs (payload->size);
- char boxram[sizeof (struct TransportDVBox) +
+ char boxram[sizeof (struct TransportDVBoxMessage) +
(dvh->distance + 1) * sizeof (struct GNUNET_PeerIdentity) +
mlen] GNUNET_ALIGN;
- struct TransportDVBox *box = (struct TransportDVBox *) boxram;
+ struct TransportDVBoxMessage *box = (struct TransportDVBoxMessage *) boxram;
struct GNUNET_PeerIdentity *path = (struct GNUNET_PeerIdentity *) &box[1];
box->header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_DV_BOX);
struct GNUNET_CRYPTO_EcdhePrivateKey private_key;
struct GNUNET_TIME_Absolute ephemeral_validity;
struct TransportBackchannelEncapsulationMessage *enc;
- struct TransportBackchannelRequestPayload ppay;
+ struct TransportBackchannelRequestPayloadP ppay;
struct BackchannelKeyState key;
char *mpos;
uint16_t msize;
/* encapsulate and encrypt message */
msize = ntohs (cb->header.size) - sizeof (*cb) +
- sizeof (struct TransportBackchannelRequestPayload);
+ sizeof (struct TransportBackchannelRequestPayloadP);
enc = GNUNET_malloc (sizeof (*enc) + msize);
enc->header.type =
htons (GNUNET_MESSAGE_TYPE_TRANSPORT_BACKCHANNEL_ENCAPSULATION);
* @return #GNUNET_YES if message is well-formed
*/
static int
-check_fragment_box (void *cls, const struct TransportFragmentBox *fb)
+check_fragment_box (void *cls, const struct TransportFragmentBoxMessage *fb)
{
uint16_t size = ntohs (fb->header.size);
uint16_t bsize = size - sizeof (*fb);
* @param fb the message that was received
*/
static void
-handle_fragment_box (void *cls, const struct TransportFragmentBox *fb)
+handle_fragment_box (void *cls, const struct TransportFragmentBoxMessage *fb)
{
struct CommunicatorMessageContext *cmc = cls;
struct Neighbour *n;
match = GNUNET_NO;
for (struct PendingMessage *frag = pm->head_frag; NULL != frag; frag = nxt)
{
- const struct TransportFragmentBox *tfb =
- (const struct TransportFragmentBox *) &pm[1];
+ const struct TransportFragmentBoxMessage *tfb =
+ (const struct TransportFragmentBoxMessage *) &pm[1];
uint32_t fu = ntohl (tfb->frag_uuid.uuid);
GNUNET_assert (PMT_FRAGMENT_BOX == frag->pmt);
* @return #GNUNET_YES if message is well-formed
*/
static int
-check_reliability_box (void *cls, const struct TransportReliabilityBox *rb)
+check_reliability_box (void *cls,
+ const struct TransportReliabilityBoxMessage *rb)
{
GNUNET_MQ_check_boxed_message (rb);
return GNUNET_YES;
* @param rb the message that was received
*/
static void
-handle_reliability_box (void *cls, const struct TransportReliabilityBox *rb)
+handle_reliability_box (void *cls,
+ const struct TransportReliabilityBoxMessage *rb)
{
struct CommunicatorMessageContext *cmc = cls;
const struct GNUNET_MessageHeader *inbox =
/* FIXME-OPTIMIZE: implement cummulative ACKs and ack_countdown,
then setting the avg_ack_delay field below: */
- ack = GNUNET_malloc (sizeof (*ack) + sizeof (struct MessageUUID));
+ ack = GNUNET_malloc (sizeof (*ack) + sizeof (struct MessageUUIDP));
ack->header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_RELIABILITY_ACK);
- ack->header.size = htons (sizeof (*ack) + sizeof (struct MessageUUID));
- memcpy (&ack[1], &rb->msg_uuid, sizeof (struct MessageUUID));
+ ack->header.size = htons (sizeof (*ack) + sizeof (struct MessageUUIDP));
+ memcpy (&ack[1], &rb->msg_uuid, sizeof (struct MessageUUIDP));
route_message (&cmc->im.sender, &ack->header, RMO_DV_ALLOWED);
}
/* continue with inner message */
struct CommunicatorMessageContext *cmc = cls;
struct Neighbour *n;
unsigned int n_acks;
- const struct MessageUUID *msg_uuids;
+ const struct MessageUUIDP *msg_uuids;
struct PendingMessage *nxt;
int matched;
return;
}
n_acks =
- (ntohs (ra->header.size) - sizeof (*ra)) / sizeof (struct MessageUUID);
- msg_uuids = (const struct MessageUUID *) &ra[1];
+ (ntohs (ra->header.size) - sizeof (*ra)) / sizeof (struct MessageUUIDP);
+ msg_uuids = (const struct MessageUUIDP *) &ra[1];
/* FIXME-OPTIMIZE: maybe use another hash map here? */
matched = GNUNET_NO;
(void) cls;
if ((size - sizeof (*be)) <
- (sizeof (struct TransportBackchannelRequestPayload) +
+ (sizeof (struct TransportBackchannelRequestPayloadP) +
sizeof (struct GNUNET_MessageHeader)))
{
GNUNET_break_op (0);
{
struct Backtalker *b;
struct GNUNET_TIME_Absolute monotime;
- struct TransportBackchannelRequestPayload ppay;
+ struct TransportBackchannelRequestPayloadP ppay;
char body[hdr_len - sizeof (ppay)];
GNUNET_assert (hdr_len >=
* @return #GNUNET_YES if message is well-formed
*/
static int
-check_dv_learn (void *cls, const struct TransportDVLearn *dvl)
+check_dv_learn (void *cls, const struct TransportDVLearnMessage *dvl)
{
uint16_t size = ntohs (dvl->header.size);
uint16_t num_hops = ntohs (dvl->num_hops);
*/
static void
forward_dv_learn (const struct GNUNET_PeerIdentity *next_hop,
- const struct TransportDVLearn *msg,
+ const struct TransportDVLearnMessage *msg,
uint16_t bi_history,
uint16_t nhops,
const struct DVPathEntryP *hops,
struct GNUNET_TIME_Absolute in_time)
{
struct DVPathEntryP *dhops;
- struct TransportDVLearn *fwd;
+ struct TransportDVLearnMessage *fwd;
struct GNUNET_TIME_Relative nnd;
/* compute message for forwarding */
GNUNET_assert (nhops < MAX_DV_HOPS_ALLOWED);
- fwd = GNUNET_malloc (sizeof (struct TransportDVLearn) +
+ fwd = GNUNET_malloc (sizeof (struct TransportDVLearnMessage) +
(nhops + 1) * sizeof (struct DVPathEntryP));
fwd->header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_DV_LEARN);
- fwd->header.size = htons (sizeof (struct TransportDVLearn) +
+ fwd->header.size = htons (sizeof (struct TransportDVLearnMessage) +
(nhops + 1) * sizeof (struct DVPathEntryP));
fwd->num_hops = htons (nhops + 1);
fwd->bidirectional = htons (bi_history);
static int
validate_dv_initiator_signature (
const struct GNUNET_PeerIdentity *init,
- const struct ChallengeNonce *challenge,
+ const struct ChallengeNonceP *challenge,
const struct GNUNET_CRYPTO_EddsaSignature *init_sig)
{
struct DvInitPS ip = {.purpose.purpose = htonl (
* @param dvl the message that was received
*/
static void
-handle_dv_learn (void *cls, const struct TransportDVLearn *dvl)
+handle_dv_learn (void *cls, const struct TransportDVLearnMessage *dvl)
{
struct CommunicatorMessageContext *cmc = cls;
enum GNUNET_TRANSPORT_CommunicatorCharacteristics cc;
* @return #GNUNET_YES if message is well-formed
*/
static int
-check_dv_box (void *cls, const struct TransportDVBox *dvb)
+check_dv_box (void *cls, const struct TransportDVBoxMessage *dvb)
{
uint16_t size = ntohs (dvb->header.size);
uint16_t num_hops = ntohs (dvb->num_hops);
const void *payload,
uint16_t payload_size)
{
- struct TransportDVBox *dvb;
+ struct TransportDVBoxMessage *dvb;
struct GNUNET_PeerIdentity *dhops;
- GNUNET_assert (UINT16_MAX < sizeof (struct TransportDVBox) +
+ GNUNET_assert (UINT16_MAX < sizeof (struct TransportDVBoxMessage) +
sizeof (struct GNUNET_PeerIdentity) * num_hops +
payload_size);
- dvb = GNUNET_malloc (sizeof (struct TransportDVBox) +
+ dvb = GNUNET_malloc (sizeof (struct TransportDVBoxMessage) +
sizeof (struct GNUNET_PeerIdentity) * num_hops +
payload_size);
dvb->header.size =
- htons (sizeof (struct TransportDVBox) +
+ htons (sizeof (struct TransportDVBoxMessage) +
sizeof (struct GNUNET_PeerIdentity) * num_hops + payload_size);
dvb->header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_DV_BOX);
dvb->total_hops = htons (total_hops);
* @param dvb the message that was received
*/
static void
-handle_dv_box (void *cls, const struct TransportDVBox *dvb)
+handle_dv_box (void *cls, const struct TransportDVBoxMessage *dvb)
{
struct CommunicatorMessageContext *cmc = cls;
uint16_t size = ntohs (dvb->header.size) - sizeof (*dvb);
* @param tvc the message that was received
*/
static void
-handle_validation_challenge (void *cls,
- const struct TransportValidationChallenge *tvc)
+handle_validation_challenge (
+ void *cls,
+ const struct TransportValidationChallengeMessage *tvc)
{
struct CommunicatorMessageContext *cmc = cls;
- struct TransportValidationResponse *tvr;
+ struct TransportValidationResponseMessage *tvr;
if (cmc->total_hops > 0)
{
finish_cmc_handling (cmc);
return;
}
- tvr = GNUNET_new (struct TransportValidationResponse);
+ tvr = GNUNET_new (struct TransportValidationResponseMessage);
tvr->header.type =
htons (GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_VALIDATION_RESPONSE);
tvr->header.size = htons (sizeof (*tvr));
/**
* Set to the challenge we are looking for.
*/
- const struct ChallengeNonce *challenge;
+ const struct ChallengeNonceP *challenge;
/**
* Set to a matching validation state, if one was found.
* @param tvr the message that was received
*/
static void
-handle_validation_response (void *cls,
- const struct TransportValidationResponse *tvr)
+handle_validation_response (
+ void *cls,
+ const struct TransportValidationResponseMessage *tvr)
{
struct CommunicatorMessageContext *cmc = cls;
struct ValidationState *vs;
struct GNUNET_MQ_MessageHandler handlers[] =
{GNUNET_MQ_hd_var_size (fragment_box,
GNUNET_MESSAGE_TYPE_TRANSPORT_FRAGMENT,
- struct TransportFragmentBox,
+ struct TransportFragmentBoxMessage,
&cmc),
GNUNET_MQ_hd_fixed_size (fragment_ack,
GNUNET_MESSAGE_TYPE_TRANSPORT_FRAGMENT_ACK,
&cmc),
GNUNET_MQ_hd_var_size (reliability_box,
GNUNET_MESSAGE_TYPE_TRANSPORT_RELIABILITY_BOX,
- struct TransportReliabilityBox,
+ struct TransportReliabilityBoxMessage,
&cmc),
GNUNET_MQ_hd_fixed_size (reliability_ack,
GNUNET_MESSAGE_TYPE_TRANSPORT_RELIABILITY_ACK,
&cmc),
GNUNET_MQ_hd_var_size (dv_learn,
GNUNET_MESSAGE_TYPE_TRANSPORT_DV_LEARN,
- struct TransportDVLearn,
+ struct TransportDVLearnMessage,
&cmc),
GNUNET_MQ_hd_var_size (dv_box,
GNUNET_MESSAGE_TYPE_TRANSPORT_DV_BOX,
- struct TransportDVBox,
+ struct TransportDVBoxMessage,
&cmc),
GNUNET_MQ_hd_fixed_size (
validation_challenge,
GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_VALIDATION_CHALLENGE,
- struct TransportValidationChallenge,
+ struct TransportValidationChallengeMessage,
&cmc),
GNUNET_MQ_hd_fixed_size (
validation_response,
GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_VALIDATION_RESPONSE,
- struct TransportValidationResponse,
+ struct TransportValidationResponseMessage,
&cmc),
GNUNET_MQ_handler_end ()};
int ret;
set_pending_message_uuid (pm);
/* This invariant is established in #handle_add_queue_message() */
- GNUNET_assert (mtu > sizeof (struct TransportFragmentBox));
+ GNUNET_assert (mtu > sizeof (struct TransportFragmentBoxMessage));
/* select fragment for transmission, descending the tree if it has
been expanded until we are at a leaf or at a fragment that is small enough
{
/* Did not yet calculate all fragments, calculate next fragment */
struct PendingMessage *frag;
- struct TransportFragmentBox tfb;
+ struct TransportFragmentBoxMessage tfb;
const char *orig;
char *msg;
uint16_t fragmax;
msize = ff->bytes_msg;
if (pm != ff)
{
- const struct TransportFragmentBox *tfbo;
+ const struct TransportFragmentBoxMessage *tfbo;
- tfbo = (const struct TransportFragmentBox *) orig;
- orig += sizeof (struct TransportFragmentBox);
- msize -= sizeof (struct TransportFragmentBox);
+ tfbo = (const struct TransportFragmentBoxMessage *) orig;
+ orig += sizeof (struct TransportFragmentBoxMessage);
+ msize -= sizeof (struct TransportFragmentBoxMessage);
xoff = ntohs (tfbo->frag_off);
}
- fragmax = mtu - sizeof (struct TransportFragmentBox);
+ fragmax = mtu - sizeof (struct TransportFragmentBoxMessage);
fragsize = GNUNET_MIN (msize - ff->frag_off, fragmax);
- frag = GNUNET_malloc (sizeof (struct PendingMessage) +
- sizeof (struct TransportFragmentBox) + fragsize);
+ frag =
+ GNUNET_malloc (sizeof (struct PendingMessage) +
+ sizeof (struct TransportFragmentBoxMessage) + fragsize);
frag->target = pm->target;
frag->frag_parent = ff;
frag->timeout = pm->timeout;
- frag->bytes_msg = sizeof (struct TransportFragmentBox) + fragsize;
+ frag->bytes_msg = sizeof (struct TransportFragmentBoxMessage) + fragsize;
frag->pmt = PMT_FRAGMENT_BOX;
msg = (char *) &frag[1];
tfb.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_FRAGMENT);
- tfb.header.size = htons (sizeof (struct TransportFragmentBox) + fragsize);
+ tfb.header.size =
+ htons (sizeof (struct TransportFragmentBoxMessage) + fragsize);
tfb.frag_uuid.uuid = htonl (pm->frag_uuidgen++);
tfb.msg_uuid = pm->msg_uuid;
tfb.frag_off = htons (ff->frag_off + xoff);
static struct PendingMessage *
reliability_box_message (struct PendingMessage *pm)
{
- struct TransportReliabilityBox rbox;
+ struct TransportReliabilityBoxMessage rbox;
struct PendingMessage *bpm;
char *msg;
return; /* do it later */
overhead = 0;
if (GNUNET_TRANSPORT_CC_RELIABLE != queue->tc->details.communicator.cc)
- overhead += sizeof (struct TransportReliabilityBox);
+ overhead += sizeof (struct TransportReliabilityBoxMessage);
s = pm;
if ( ( (0 != queue->mtu) &&
(pm->bytes_msg + overhead > queue->mtu) ) ||
static void
validation_transmit_on_queue (struct Queue *q, struct ValidationState *vs)
{
- struct TransportValidationChallenge tvc;
+ struct TransportValidationChallengeMessage tvc;
vs->last_challenge_use = GNUNET_TIME_absolute_get ();
tvc.header.type =
{
struct LearnLaunchEntry *lle;
struct QueueQualityContext qqc;
- struct TransportDVLearn dvl;
+ struct TransportDVLearnMessage dvl;
(void) cls;
dvlearn_task = NULL;
const char *addr;
uint16_t addr_len;
- if (ntohl (aqm->mtu) <= sizeof (struct TransportFragmentBox))
+ if (ntohl (aqm->mtu) <= sizeof (struct TransportFragmentBoxMessage))
{
/* MTU so small as to be useless for transmissions,
required for #fragment_message()! */