size = ntohs (message->size);
type = ntohs (message->type);
- /* Allocate a copy of the message on the stack, so we can modify it as needed,
- * adding the Connection ID, PID, and other data the Tunnel layer doesn't
- * have access to.
- */
- char cbuf[size];
- struct GNUNET_MessageHeader *copy = (struct GNUNET_MessageHeader *)cbuf;
-
- if (GNUNET_MESSAGE_TYPE_CADET_AX == type
- || GNUNET_MESSAGE_TYPE_CADET_KX == type)
- {
- GNUNET_memcpy (copy, message, size);
- if (GNUNET_MESSAGE_TYPE_CADET_AX == type)
- {
- struct GNUNET_CADET_AX *axmsg;
-
- axmsg = (struct GNUNET_CADET_AX *) copy;
- axmsg->cid = c->id;
- axmsg->pid = htonl (GCC_get_pid (c, fwd));
- }
- else /* case GNUNET_MESSAGE_TYPE_CADET_KX */
- {
- struct GNUNET_CADET_KX *kmsg;
-
- GNUNET_assert (GNUNET_MESSAGE_TYPE_CADET_KX == type);
- kmsg = (struct GNUNET_CADET_KX *) copy;
- kmsg->reserved = htonl (0);
- kmsg->cid = c->id;
- }
- message = copy;
- }
-
GCC_check_connections ();
fc = fwd ? &c->fwd_fc : &c->bck_fc;
if (0 == fc->queue_max)
return NULL;
}
- size = ntohs (message->size);
- type = ntohs (message->type);
LOG (GNUNET_ERROR_TYPE_INFO,
"--> %s (%s %4u) on conn %s (%p) %s [%5u]\n",
GC_m2s (type), GC_m2s (payload_type), payload_id, GCC_2s (c), c,
}
return NULL; /* Drop... */
}
+ fwd = GCC_is_origin (c, GNUNET_YES);
+ ax_msg->cid = *GCC_get_id (c);
+ ax_msg->pid = htonl (GCC_get_pid (c, fwd));
mid = 0;
type = ntohs (message->type);
}
LOG (GNUNET_ERROR_TYPE_DEBUG, "type %s\n", GC_m2s (type));
- fwd = GCC_is_origin (c, GNUNET_YES);
-
if (NULL == cont)
{
GNUNET_break (NULL == GCC_send_prebuilt_message (msg, type, mid, c, fwd,
msg = (struct GNUNET_CADET_KX *) cbuf;
msg->header.type = htons (GNUNET_MESSAGE_TYPE_CADET_KX);
msg->header.size = htons (sizeof (struct GNUNET_CADET_KX) + size);
+ msg->reserved = htonl (0);
c = tunnel_get_connection (t);
if (NULL == c)
{
}
return NULL;
}
+ msg->cid = *GCC_get_id (c);
switch (type)
{
case GNUNET_MESSAGE_TYPE_CADET_AX_KX: