= (const struct GNUNET_CONSENSUS_ElementMessage *) mh;
struct GNUNET_SET_Element element;
- LOG (GNUNET_ERROR_TYPE_DEBUG, "received new element\n");
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "received new element\n");
- element.type = msg->element_type;
+ element.element_type = msg->element_type;
element.size = ntohs (msg->header.size) - sizeof (struct GNUNET_CONSENSUS_ElementMessage);
element.data = &msg[1];
/**
- * Iterator for set elements.
+ * Iterator for set elements. [FIXME: bad comment]
*
* @param cls closure
* @param element the current element, NULL if all elements have been
* iterated over
- * @return GNUNET_YES to continue iterating, GNUNET_NO to stop.
+ * @return #GNUNET_YES to continue iterating, #GNUNET_NO to stop.
*/
static int
send_to_client_iter (void *cls,
{
struct GNUNET_CONSENSUS_ElementMessage *m;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "P%d: got element for client\n",
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "P%d: got element for client\n",
session->local_peer_idx);
- ev = GNUNET_MQ_msg_extra (m, element->size, GNUNET_MESSAGE_TYPE_CONSENSUS_CLIENT_RECEIVED_ELEMENT);
- m->element_type = htons (element->type);
+ ev = GNUNET_MQ_msg_extra (m, element->size,
+ GNUNET_MESSAGE_TYPE_CONSENSUS_CLIENT_RECEIVED_ELEMENT);
+ m->element_type = htons (element->element_type);
memcpy (&m[1], element->data, element->size);
GNUNET_MQ_send (session->client_mq, ev);
}
else
{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "P%d: finished iterating elements for client\n",
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "P%d: finished iterating elements for client\n",
session->local_peer_idx);
ev = GNUNET_MQ_msg_header (GNUNET_MESSAGE_TYPE_CONSENSUS_CLIENT_CONCLUDE_DONE);
GNUNET_MQ_send (session->client_mq, ev);
}
element = GNUNET_malloc (sizeof (struct GNUNET_SET_Element) + element_size);
- element->type = msg->element_type;
+ element->element_type = msg->element_type;
element->size = element_size;
memcpy (&element[1], &msg[1], element_size);
element->data = &element[1];
target = &route->target;
GNUNET_assert (ntohl (target->distance) < DEFAULT_FISHEYE_DEPTH);
element.size = sizeof (struct Target);
- element.type = htons (0); /* do we need this? */
+ element.element_type = htons (0);
element.data = target;
/* Find next non-NULL entry */
/**
* Application-specific element type.
*/
- uint16_t type;
+ uint16_t element_type;
/**
* Actual data of the element
GNUNET_CONTAINER_multihashmap_contains (revocation_map,
&hc))
{
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- _("Duplicate revocation received from peer. Ignored.\n"));
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Duplicate revocation received from peer. Ignored.\n");
return GNUNET_OK;
}
if (GNUNET_OK !=
GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY));
/* add to set for future connections */
e.size = htons (rm->header.size);
- e.type = 0;
+ e.element_type = 0;
e.data = rm;
if (GNUNET_OK !=
GNUNET_SET_add_element (revocation_set,
GNUNET_break_op (0);
return;
}
- if (0 != element->type)
+ if (0 != element->element_type)
{
GNUNET_STATISTICS_update (stats,
"# unsupported revocations received via set union",
}
set_elem.data = &elem->key;
set_elem.size = sizeof (elem->key);
- set_elem.type = 0; /* do we REALLY need this? */
+ set_elem.element_type = 0; /* do we REALLY need this? */
GNUNET_SET_add_element (s->intersection_set, &set_elem, NULL, NULL);
s->used_element_count++;
}
}
set_elem.data = &elem->key;
set_elem.size = sizeof (elem->key);
- set_elem.type = 0; /* do we REALLY need this? */
+ set_elem.element_type = 0;
GNUNET_SET_add_element (s->intersection_set, &set_elem, NULL, NULL);
s->used_element_count++;
}
element.data = (void *) &d;
element.size = sizeof (struct GNUNET_SECRETSHARING_DecryptData);
- element.type = 0;
+ element.element_type = 0;
d.ciphertext = ds->ciphertext;
d.peer = my_peer;
ee->element.size,
GNUNET_MESSAGE_TYPE_SET_ITER_ELEMENT);
memcpy (&msg[1], ee->element.data, ee->element.size);
- msg->element_type = ee->element.type;
+ msg->element_type = ee->element.element_type;
}
GNUNET_MQ_send (set->client_mq, ev);
}
}
rm->result_status = htons (GNUNET_SET_STATUS_OK);
rm->request_id = htonl (op->spec->client_request_id);
- rm->element_type = element->type;
+ rm->element_type = element->element_type;
memcpy (&rm[1], element->data, element->size);
GNUNET_MQ_send (op->spec->set->client_mq, ev);
}
rm->result_status = htons (GNUNET_SET_STATUS_OK);
rm->request_id = htonl (op->spec->client_request_id);
- rm->element_type = element->type;
+ rm->element_type = element->element_type;
memcpy (&rm[1], element->data, element->size);
GNUNET_MQ_notify_sent (ev, send_remaining_elements, op);
}
rm->result_status = htons (GNUNET_SET_STATUS_OK);
rm->request_id = htonl (op->spec->client_request_id);
- rm->element_type = element->type;
+ rm->element_type = element->element_type;
memcpy (&rm[1], element->data, element->size);
GNUNET_MQ_send (op->spec->set->client_mq, ev);
}
}
rm->result_status = htons (GNUNET_SET_STATUS_OK);
rm->request_id = htonl (op->spec->client_request_id);
- rm->element_type = element->type;
+ rm->element_type = element->element_type;
memcpy (&rm[1], element->data, element->size);
if (ke->next_colliding == NULL)
{
{
if (NULL == request)
{
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "listener failed\n");
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "listener failed\n");
return;
}
GNUNET_assert (NULL == info2.oh);
- GNUNET_log (GNUNET_ERROR_TYPE_INFO, "set listen cb called\n");
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "set listen cb called\n");
info2.oh = GNUNET_SET_accept (request, GNUNET_SET_RESULT_ADDED,
set_result_cb, &info2);
GNUNET_SET_commit (info2.oh, info2.set);
}
-
static int
set_insert_iterator (void *cls,
const struct GNUNET_HashCode *key,
struct GNUNET_SET_Handle *set = cls;
struct GNUNET_SET_Element *el;
- el = GNUNET_malloc (sizeof *el + sizeof *key);
- el->type = 0;
+ el = GNUNET_malloc (sizeof (struct GNUNET_SET_Element) +
+ sizeof (struct GNUNET_HashCode));
+ el->element_type = 0;
memcpy (&el[1], key, sizeof *key);
el->data = &el[1];
el->size = sizeof *key;
}
}
+
static void
run (void *cls, char *const *args, const char *cfgfile,
const struct GNUNET_CONFIGURATION_Handle *cfg)
return;
element.size = ntohs (mh->size) - sizeof (struct GNUNET_SET_IterResponseMessage);
- element.type = htons (msg->element_type);
+ element.element_type = htons (msg->element_type);
element.data = &msg[1];
set->iterator (set->iterator_cls, &element);
ev = GNUNET_MQ_msg (ack_msg, GNUNET_MESSAGE_TYPE_SET_ITER_ACK);
e.data = &msg[1];
e.size = ntohs (mh->size) - sizeof (struct GNUNET_SET_ResultMessage);
- e.type = msg->element_type;
+ e.element_type = msg->element_type;
if (NULL != oh->result_cb)
oh->result_cb (oh->result_cls, &e, result_status);
}
}
mqm = GNUNET_MQ_msg_extra (msg, element->size, GNUNET_MESSAGE_TYPE_SET_ADD);
- msg->element_type = element->type;
+ msg->element_type = element->element_type;
memcpy (&msg[1], element->data, element->size);
GNUNET_MQ_notify_sent (mqm, cont, cont_cls);
GNUNET_MQ_send (set->mq, mqm);
* @param set set to remove element from
* @param element element to remove from the set
* @param cont continuation called after the element has been removed
- * @param cont_cls closure for cont
- * @return GNUNET_OK on success, GNUNET_SYSERR if the
+ * @param cont_cls closure for @a cont
+ * @return #GNUNET_OK on success, #GNUNET_SYSERR if the
* set is invalid (e.g. the set service crashed)
*/
int
}
mqm = GNUNET_MQ_msg_extra (msg, element->size, GNUNET_MESSAGE_TYPE_SET_REMOVE);
- msg->element_type = element->type;
+ msg->element_type = element->element_type;
memcpy (&msg[1], element->data, element->size);
GNUNET_MQ_notify_sent (mqm, cont, cont_cls);
GNUNET_MQ_send (set->mq, mqm);
GNUNET_log (GNUNET_ERROR_TYPE_INFO, "initializing set 2\n");
- element.type = 0;
+ element.element_type = 0;
element.data = "hello";
element.size = strlen(element.data);
{
struct GNUNET_SET_Element element;
- element.type = 0;
+ element.element_type = 0;
element.data = "hello";
element.size = strlen(element.data);
iter_set = GNUNET_SET_create (config, GNUNET_SET_OPERATION_UNION);
- element.type = 0;
+ element.element_type = 0;
element.data = "hello";
element.size = strlen(element.data);
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"initializing set 2\n");
- element.type = 0;
+ element.element_type = 0;
element.data = "hello";
element.size = strlen(element.data);
GNUNET_SET_add_element (set2, &element, NULL, NULL);
{
struct GNUNET_SET_Element element;
- element.type = 0;
+ element.element_type = 0;
element.data = "hello";
element.size = strlen(element.data);
GNUNET_SET_add_element (set1, &element, NULL, NULL);
struct GNUNET_SET_Handle *iter_set;
iter_set = GNUNET_SET_create (config, GNUNET_SET_OPERATION_INTERSECTION);
- element.type = 0;
+ element.element_type = 0;
element.data = "hello";
element.size = strlen(element.data);
GNUNET_SET_add_element (iter_set, &element, NULL, NULL);
GNUNET_log (GNUNET_ERROR_TYPE_INFO, "initializing set 2\n");
- element.type = 0;
+ element.element_type = 0;
element.data = "hello";
element.size = strlen(element.data);
{
struct GNUNET_SET_Element element;
- element.type = 0;
+ element.element_type = 0;
element.data = "hello";
element.size = strlen(element.data);
iter_set = GNUNET_SET_create (config, GNUNET_SET_OPERATION_UNION);
- element.type = 0;
+ element.element_type = 0;
element.data = "hello";
element.size = strlen(element.data);