/*
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");
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 );
}
* 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 one of the names for the host, NULL on last callback
- * @param res #GNUNET_OK if conversion was successful, #GNUNET_SYSERR on failure,
- * #GNUNET_OK on last callback
+ * @param cls closure
+ * @param address the address to print
+ * @param res result code
*/
static void
-address_pretty_printer_cb (void *cls,
- const char *buf,
- int res)
+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
{
- if ( (GNUNET_OK == res) &&
- (GNUNET_NO == got_reply) )
+ if (GNUNET_NO == got_reply)
{
pretty_printers_running--;
- GNUNET_break (0);
+ GNUNET_break(0);
end_badly_now ();
}
}
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)
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;
}