/*
* This file is part of GNUnet
- * Copyright (C) 2013 Christian Grothoff (and other contributing authors)
+ * Copyright (C) 2013 GNUnet e.V.
*
* GNUnet is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published
/**
* Handle for task for timeout termination.
*/
-static struct GNUNET_SCHEDULER_Task * end_badly_task;
+static struct GNUNET_SCHEDULER_Task *end_badly_task;
static struct GNUNET_CRYPTO_EddsaPrivateKey *channel_key;
static struct GNUNET_CRYPTO_EcdsaPrivateKey *slave_key;
size_t value_size[16];
} scls;
-static struct GNUNET_ENV_Modifier modifiers[16];
+static struct GNUNET_PSYC_Modifier modifiers[16];
/**
* Clean up all resources used.
* Terminate the testcase (failure).
*
* @param cls NULL
- * @param tc scheduler context
*/
static void
-end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+end_badly (void *cls)
{
res = 1;
cleanup ();
* Terminate the testcase (success).
*
* @param cls NULL
- * @param tc scheduler context
*/
static void
-end_normally (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+end_normally (void *cls)
{
res = 0;
cleanup ();
static void
end ()
{
- if (end_badly_task != NULL)
+ if (NULL != end_badly_task)
{
GNUNET_SCHEDULER_cancel (end_badly_task);
end_badly_task = NULL;
}
-void
-state_reset_result (void *cls, int64_t result,
- const char *err_msg, uint16_t err_msg_size)
+static void
+state_reset_result (void *cls,
+ int64_t result,
+ const char *err_msg,
+ uint16_t err_msg_size)
{
op = NULL;
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "state_reset_result:\t%d\n", result);
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ "state_reset_result:\t%d\n",
+ (int) result);
GNUNET_assert (GNUNET_OK == result);
op = GNUNET_PSYCSTORE_state_reset (h, &channel_pub_key,
static int
-state_result (void *cls, const char *name, const void *value, uint32_t value_size)
+state_result (void *cls,
+ const char *name,
+ const void *value,
+ uint32_t value_size)
{
struct StateClosure *scls = cls;
const char *nam = scls->name[scls->n];
&& 0 == memcmp (value, val, val_size)
&& 0 == strcmp (name, nam))
{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " variable %s matches\n", name);
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ " variable %s matches\n",
+ name);
return GNUNET_YES;
}
else
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
" variable %s differs\nReceived: %.*s\nExpected: %.*s\n",
- name, value_size, value, val_size, val);
+ name, (int) value_size, (char*) value, (int) val_size, (char*) val);
GNUNET_assert (0);
return GNUNET_SYSERR;
}
}
-void
+static void
state_get_prefix_result (void *cls, int64_t result,
const char *err_msg, uint16_t err_msg_size)
{
struct StateClosure *scls = cls;
op = NULL;
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "state_get_prefix_result:\t%d\n", result);
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "state_get_prefix_result:\t%ld\n", (long int) result);
GNUNET_assert (GNUNET_OK == result && 2 == scls->n);
op = GNUNET_PSYCSTORE_state_reset (h, &channel_pub_key,
}
-void
+static void
state_get_result (void *cls, int64_t result,
const char *err_msg, uint16_t err_msg_size)
{
op = NULL;
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "state_get_result:\t%d\n", result);
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "state_get_result:\t%ld\n", (long int) result);
GNUNET_assert (GNUNET_OK == result);
scls.n = 0;
}
-void
+static void
counters_result (void *cls, int status, uint64_t max_fragment_id,
uint64_t max_message_id, uint64_t max_group_generation,
uint64_t max_state_message_id)
}
-void
+static void
state_modify_result (void *cls, int64_t result,
const char *err_msg, uint16_t err_msg_size)
{
op = NULL;
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "state_modify_result:\t%d\n", result);
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "state_modify_result:\t%ld\n", (long int) result);
GNUNET_assert (GNUNET_OK == result);
op = GNUNET_PSYCSTORE_counters_get (h, &channel_pub_key,
}
-void
+static void
state_sync_result (void *cls, int64_t result,
const char *err_msg, uint16_t err_msg_size)
{
struct FragmentClosure *fcls = cls;
op = NULL;
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "state_sync_result:\t%d\n", result);
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "state_sync_result:\t%ld\n", (long int) result);
GNUNET_assert (GNUNET_OK == result);
op = GNUNET_PSYCSTORE_state_modify (h, &channel_pub_key,
}
-int
+static int
fragment_result (void *cls,
struct GNUNET_MULTICAST_MessageHeader *msg,
enum GNUNET_PSYCSTORE_MessageFlags flags)
}
-void
+static void
message_get_latest_result (void *cls, int64_t result,
const char *err_msg, uint16_t err_msg_size)
{
struct FragmentClosure *fcls = cls;
op = NULL;
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "message_get_latest:\t%d\n", result);
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "message_get_latest:\t%ld\n", (long int) result);
GNUNET_assert (0 < result && fcls->n == fcls->n_expected);
- modifiers[0] = (struct GNUNET_ENV_Modifier) {
+ modifiers[0] = (struct GNUNET_PSYC_Modifier) {
.oper = '=',
.name = "_sync_foo",
.value = "three two one",
.value_size = sizeof ("three two one") - 1
};
- modifiers[1] = (struct GNUNET_ENV_Modifier) {
+ modifiers[1] = (struct GNUNET_PSYC_Modifier) {
.oper = '=',
.name = "_sync_bar",
.value = "ten eleven twelve",
}
-void
+static void
message_get_result (void *cls, int64_t result,
const char *err_msg, uint16_t err_msg_size)
{
struct FragmentClosure *fcls = cls;
op = NULL;
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "message_get:\t%d\n", result);
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "message_get:\t%ld\n", (long int) result);
GNUNET_assert (0 < result && fcls->n == fcls->n_expected);
fcls->n = 0;
}
-void
+static void
message_get_fragment_result (void *cls, int64_t result,
const char *err_msg, uint16_t err_msg_size)
{
struct FragmentClosure *fcls = cls;
op = NULL;
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "message_get_fragment:\t%d\n", result);
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "message_get_fragment:\t%ld\n", (long int) result);
GNUNET_assert (0 < result && fcls->n == fcls->n_expected);
fcls->n = 0;
}
-void
+static void
fragment_get_latest_result (void *cls, int64_t result,
const char *err_msg, uint16_t err_msg_size)
{
struct FragmentClosure *fcls = cls;
op = NULL;
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "fragment_get_latest:\t%d\n", result);
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "fragment_get_latest:\t%ld\n", (long int) result);
GNUNET_assert (0 < result && fcls->n == fcls->n_expected);
fcls->n = 1;
}
-void
+static void
fragment_get_result (void *cls, int64_t result,
const char *err_msg, uint16_t err_msg_size)
{
struct FragmentClosure *fcls = cls;
op = NULL;
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "fragment_get:\t%d\n", result);
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ "fragment_get:\t%d\n",
+ (int) result);
GNUNET_assert (0 < result && fcls->n == fcls->n_expected);
fcls->n = 0;
}
-void
+static void
fragment_store_result (void *cls, int64_t result,
const char *err_msg, uint16_t err_msg_size)
{
op = NULL;
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "fragment_store:\t%d\n", result);
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "fragment_store:\t%ld\n", (long int) result);
GNUNET_assert (GNUNET_OK == result);
if ((intptr_t) cls == GNUNET_YES)
}
-void
+static void
fragment_store ()
{
struct GNUNET_MULTICAST_MessageHeader *msg;
msg->group_generation = GNUNET_htonll (INT64_MAX - 3);
msg->flags = htonl (GNUNET_MULTICAST_MESSAGE_LAST_FRAGMENT);
- memcpy (&msg[1], &channel_pub_key, sizeof (channel_pub_key));
+ GNUNET_memcpy (&msg[1], &channel_pub_key, sizeof (channel_pub_key));
msg->purpose.size = htonl (ntohs (msg->header.size)
- sizeof (msg->header)
fcls.flags[1] = GNUNET_PSYCSTORE_MESSAGE_STATE_APPLIED;
fcls.msg[1] = msg = GNUNET_malloc (sizeof (*msg) + sizeof (channel_pub_key));
- memcpy (msg, fcls.msg[0], sizeof (*msg) + sizeof (channel_pub_key));
+ GNUNET_memcpy (msg, fcls.msg[0], sizeof (*msg) + sizeof (channel_pub_key));
msg->fragment_id = GNUNET_htonll (INT64_MAX - 4);
msg->fragment_offset = GNUNET_htonll (1024);
fcls.flags[2] = GNUNET_PSYCSTORE_MESSAGE_STATE_HASH;
fcls.msg[2] = msg = GNUNET_malloc (sizeof (*msg) + sizeof (channel_pub_key));
- memcpy (msg, fcls.msg[1], sizeof (*msg) + sizeof (channel_pub_key));
+ GNUNET_memcpy (msg, fcls.msg[1], sizeof (*msg) + sizeof (channel_pub_key));
msg->fragment_id = GNUNET_htonll (INT64_MAX);
msg->fragment_offset = GNUNET_htonll (16384);
}
-void
+static void
membership_test_result (void *cls, int64_t result,
const char *err_msg, uint16_t err_msg_size)
{
op = NULL;
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "membership_test:\t%d\n", result);
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "membership_test:\t%ld\n", (long int) result);
GNUNET_assert (GNUNET_OK == result);
fragment_store ();
}
-void
+static void
membership_store_result (void *cls, int64_t result,
const char *err_msg, uint16_t err_msg_size)
{
op = NULL;
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "membership_store:\t%d\n", result);
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "membership_store:\t%ld\n", (long int) result);
GNUNET_assert (GNUNET_OK == result);
op = GNUNET_PSYCSTORE_membership_test (h, &channel_pub_key, &slave_pub_key,