{
struct TicketResultMessage *irm;
struct GNUNET_MQ_Envelope *env;
- struct GNUNET_RECLAIM_Ticket *ticket_buf;
+ env = GNUNET_MQ_msg (irm,
+ GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_RESULT);
if (NULL != ticket) {
- env = GNUNET_MQ_msg_extra (irm,
- sizeof (struct GNUNET_RECLAIM_Ticket),
- GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_RESULT);
- ticket_buf = (struct GNUNET_RECLAIM_Ticket *)&irm[1];
- *ticket_buf = *ticket;
- } else {
- env = GNUNET_MQ_msg (irm, GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_RESULT);
+ irm->ticket = *ticket;
}
// TODO add success member
irm->id = htonl (r_id);
uint16_t size;
size = ntohs (im->header.size);
- if (size <= sizeof (struct RevokeTicketMessage)) {
+ if (size != sizeof (struct RevokeTicketMessage)) {
GNUNET_break (0);
return GNUNET_SYSERR;
}
{
struct TicketRevocationOperation *rop;
struct IdpClient *idp = cls;
- struct GNUNET_RECLAIM_Ticket *ticket;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received REVOKE_TICKET message\n");
rop = GNUNET_new (struct TicketRevocationOperation);
- ticket = (struct GNUNET_RECLAIM_Ticket *)&rm[1];
rop->r_id = ntohl (rm->id);
rop->client = idp;
GNUNET_CONTAINER_DLL_insert (idp->revoke_op_head, idp->revoke_op_tail, rop);
rop->rh
- = RECLAIM_TICKETS_revoke (ticket, &rm->identity, &revoke_result_cb, rop);
+ = RECLAIM_TICKETS_revoke (&rm->ticket, &rm->identity, &revoke_result_cb, rop);
GNUNET_SERVICE_client_continue (idp->client);
}
uint16_t size;
size = ntohs (cm->header.size);
- if (size <= sizeof (struct ConsumeTicketMessage)) {
+ if (size != sizeof (struct ConsumeTicketMessage)) {
GNUNET_break (0);
return GNUNET_SYSERR;
}
handle_consume_ticket_message (void *cls, const struct ConsumeTicketMessage *cm)
{
struct ConsumeTicketOperation *cop;
- struct GNUNET_RECLAIM_Ticket *ticket;
struct IdpClient *idp = cls;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received CONSUME_TICKET message\n");
cop = GNUNET_new (struct ConsumeTicketOperation);
cop->r_id = ntohl (cm->id);
cop->client = idp;
- ticket = (struct GNUNET_RECLAIM_Ticket *)&cm[1];
cop->ch
- = RECLAIM_TICKETS_consume (&cm->identity, ticket, &consume_result_cb, cop);
+ = RECLAIM_TICKETS_consume (&cm->identity, &cm->ticket, &consume_result_cb, cop);
GNUNET_CONTAINER_DLL_insert (idp->consume_op_head, idp->consume_op_tail, cop);
GNUNET_SERVICE_client_continue (idp->client);
}
struct GNUNET_MQ_Envelope *env;
struct TicketResultMessage *trm;
+ env = GNUNET_MQ_msg (trm, GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_RESULT);
if (NULL == ticket) {
/* send empty response to indicate end of list */
- env = GNUNET_MQ_msg (trm, GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_RESULT);
GNUNET_CONTAINER_DLL_remove (ti->client->ticket_iter_head,
ti->client->ticket_iter_tail,
ti);
} else {
- env = GNUNET_MQ_msg_extra (trm,
- sizeof (struct GNUNET_RECLAIM_Ticket),
- GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_RESULT);
- memcpy (&trm[1], ticket, sizeof (struct GNUNET_RECLAIM_Ticket));
+ trm->ticket = *ticket;
}
trm->id = htonl (ti->r_id);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending TICKET_RESULT message\n");