/*
This file is part of GNUnet.
- (C) 2009 Christian Grothoff (and other contributing authors)
+ Copyright (C) 2009 Christian Grothoff (and other contributing authors)
GNUnet is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published
/**
* Timeout task
*/
-static GNUNET_SCHEDULER_TaskIdentifier timeout_endbadly;
+static struct GNUNET_SCHEDULER_Task * timeout_endbadly;
/**
* Timeout task
*/
-static GNUNET_SCHEDULER_TaskIdentifier timeout_wait;
+static struct GNUNET_SCHEDULER_Task * timeout_wait;
/**
* Library name
int c = 0;
ok = 0;
- if (GNUNET_SCHEDULER_NO_TASK != timeout_endbadly)
+ if (NULL != timeout_endbadly)
{
GNUNET_SCHEDULER_cancel (timeout_endbadly);
- timeout_endbadly = GNUNET_SCHEDULER_NO_TASK;
+ timeout_endbadly = NULL;
}
if (NULL != api)
GNUNET_PLUGIN_unload (libname, api);
struct AddressWrapper *w;
int c = 0;
- timeout_endbadly = GNUNET_SCHEDULER_NO_TASK;
- if (GNUNET_SCHEDULER_NO_TASK != timeout_wait)
+ timeout_endbadly = NULL;
+ if (NULL != timeout_wait)
{
GNUNET_SCHEDULER_cancel (timeout_wait);
- timeout_wait = GNUNET_SCHEDULER_NO_TASK;
+ timeout_wait = NULL;
}
if (pretty_printers_running > 0)
static void
wait_end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
- timeout_wait = GNUNET_SCHEDULER_NO_TASK;
+ timeout_wait = NULL;
if (0 == addresses_reported)
GNUNET_log(GNUNET_ERROR_TYPE_WARNING,
"Plugin did not report any addresses, could not check address conversion functions\n");
end ();
}
+
static void
end_badly_now ()
{
- if (GNUNET_SCHEDULER_NO_TASK != timeout_wait)
+ if (NULL != timeout_wait)
{
GNUNET_SCHEDULER_cancel (timeout_wait);
- timeout_wait = GNUNET_SCHEDULER_NO_TASK;
+ timeout_wait = NULL;
}
- if (GNUNET_SCHEDULER_NO_TASK != timeout_endbadly)
+ if (NULL != timeout_endbadly)
{
GNUNET_SCHEDULER_cancel (timeout_endbadly);
- timeout_endbadly = GNUNET_SCHEDULER_NO_TASK;
+ timeout_endbadly = NULL;
}
timeout_endbadly = GNUNET_SCHEDULER_add_now (&end_badly, NULL );
}
+
static struct GNUNET_TIME_Relative
env_receive (void *cls,
- const struct GNUNET_HELLO_Address *address,
- struct Session *session,
- const struct GNUNET_MessageHeader *message)
+ const struct GNUNET_HELLO_Address *address,
+ struct Session *session,
+ const struct GNUNET_MessageHeader *message)
{
/* do nothing */
return GNUNET_TIME_relative_get_zero_ ();
static int got_reply;
+
/**
* Take the given address and append it to the set of results sent back to
* the client.
*
- * @param cls the transmission context used ('struct GNUNET_SERVER_TransmitContext*')
- * @param buf text to transmit
+ * @param cls closure
+ * @param address the address to print
+ * @param res result code
*/
static void
-address_pretty_printer_cb (void *cls, const char *buf)
+address_pretty_printer_cb (void *cls, const char *address, int res)
{
- if (NULL != buf)
+ if (NULL != address)
{
got_reply = GNUNET_YES;
- GNUNET_log(GNUNET_ERROR_TYPE_INFO, "Pretty address : `%s'\n", buf);
+ GNUNET_log(GNUNET_ERROR_TYPE_INFO, "Pretty address : `%s'\n", address);
pretty_printers_running--;
}
else
}
}
+
static void
-env_notify_address (void *cls, int add_remove,
- const struct GNUNET_HELLO_Address *address)
+env_notify_address (void *cls,
+ int add_remove,
+ const struct GNUNET_HELLO_Address *address)
{
struct AddressWrapper *w;
struct AddressWrapper *wtmp;
GNUNET_CONTAINER_DLL_insert(head, tail, w);
got_reply = GNUNET_NO;
GNUNET_log(GNUNET_ERROR_TYPE_INFO, "Testing: address_to_string \n");
- w->addrstring = strdup (
+ w->addrstring = GNUNET_strdup (
api->address_to_string (api, w->address->address,
w->address->address_length));
if (NULL == w->addrstring)
GNUNET_free(s2a);
pretty_printers_running++;
- api->address_pretty_printer (api->cls, address->transport_name, address->address, address->address_length, GNUNET_YES,
+ api->address_pretty_printer (api->cls, address->transport_name,
+ address->address, address->address_length, GNUNET_YES,
GNUNET_TIME_UNIT_MINUTES, &address_pretty_printer_cb, w);
if (GNUNET_OK != api->check_address (api->cls, w->address->address, w->address->address_length))
end_badly_now ();
return;
}
- if (GNUNET_SCHEDULER_NO_TASK != timeout_wait)
+ if (NULL != timeout_wait)
{
GNUNET_SCHEDULER_cancel (timeout_wait);
- timeout_wait = GNUNET_SCHEDULER_NO_TASK;
+ timeout_wait = NULL;
}
timeout_wait = GNUNET_SCHEDULER_add_delayed (WAIT, &wait_end, NULL );
}
}
-static struct GNUNET_ATS_Information
-env_get_address_type (void *cls, const struct sockaddr *addr, size_t addrlen)
+
+static enum GNUNET_ATS_Network_Type
+env_get_address_type (void *cls,
+ const struct sockaddr *addr,
+ size_t addrlen)
{
- struct GNUNET_ATS_Information ats;
- ats.type = htonl (GNUNET_ATS_NETWORK_TYPE);
- ats.value = htonl (GNUNET_ATS_NET_LOOPBACK);
- return ats;
+ return GNUNET_ATS_NET_LOOPBACK;
}
+
static const struct GNUNET_MessageHeader *
env_get_our_hello ()
{
return (const struct GNUNET_MessageHeader *) hello;
}
+
static void
env_session_end (void *cls,
const struct GNUNET_HELLO_Address *address,
}
+
static void
env_update_metrics (void *cls,
- const struct GNUNET_HELLO_Address *address,
- struct Session *session,
- const struct GNUNET_ATS_Information *ats,
- uint32_t ats_count)
+ const struct GNUNET_HELLO_Address *address,
+ struct Session *session,
+ const struct GNUNET_ATS_Information *ats,
+ uint32_t ats_count)
{
}
+
static void
setup_plugin_environment ()
{
env.session_end = &env_session_end;
}
+
static int
handle_helper_message (void *cls, void *client,
- const struct GNUNET_MessageHeader *hdr)
+ const struct GNUNET_MessageHeader *hdr)
{
return GNUNET_OK;
}
+
/**
* Runs the test.
*