/*
This file is part of GNUnet.
- Copyright (C) 2010-2015 Christian Grothoff (and other contributing authors)
+ Copyright (C) 2010-2015 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
You should have received a copy of the GNU General Public License
along with GNUnet; see the file COPYING. If not, write to the
- Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA.
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
*/
/**
* @file transport/gnunet-service-transport.c
/**
* Information we need for an asynchronous session kill.
*/
-struct SessionKiller
+struct GNUNET_ATS_SessionKiller
{
/**
* Kept in a DLL.
*/
- struct SessionKiller *next;
+ struct GNUNET_ATS_SessionKiller *next;
/**
* Kept in a DLL.
*/
- struct SessionKiller *prev;
+ struct GNUNET_ATS_SessionKiller *prev;
/**
* Session to kill.
*/
- struct Session *session;
+ struct GNUNET_ATS_Session *session;
/**
* Plugin for the session.
/**
* Head of DLL of asynchronous tasks to kill sessions.
*/
-static struct SessionKiller *sk_head;
+static struct GNUNET_ATS_SessionKiller *sk_head;
/**
* Tail of DLL of asynchronous tasks to kill sessions.
*/
-static struct SessionKiller *sk_tail;
+static struct GNUNET_ATS_SessionKiller *sk_tail;
/**
* Interface scanner determines our LAN address range(s).
*/
static struct GNUNET_TIME_Relative
process_payload (const struct GNUNET_HELLO_Address *address,
- struct Session *session,
+ struct GNUNET_ATS_Session *session,
const struct GNUNET_MessageHeader *message)
{
struct GNUNET_TIME_Relative ret;
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Discarded %u bytes type %u payload from peer `%s'\n",
- msg_size,
+ (unsigned int) msg_size,
ntohs (message->type),
GNUNET_i2s (&address->peer));
GNUNET_STATISTICS_update (GST_stats, gettext_noop
/**
* Task to asynchronously terminate a session.
*
- * @param cls the `struct SessionKiller` with the information for the kill
- * @param tc scheduler context
+ * @param cls the `struct GNUNET_ATS_SessionKiller` with the information for the kill
*/
static void
-kill_session_task (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+kill_session_task (void *cls)
{
- struct SessionKiller *sk = cls;
+ struct GNUNET_ATS_SessionKiller *sk = cls;
sk->task = NULL;
GNUNET_CONTAINER_DLL_remove (sk_head, sk_tail, sk);
*/
static void
kill_session (const char *plugin_name,
- struct Session *session)
+ struct GNUNET_ATS_Session *session)
{
struct GNUNET_TRANSPORT_PluginFunctions *plugin;
- struct SessionKiller *sk;
+ struct GNUNET_ATS_SessionKiller *sk;
for (sk = sk_head; NULL != sk; sk = sk->next)
if (sk->session == session)
return;
}
/* need to issue disconnect asynchronously */
- sk = GNUNET_new (struct SessionKiller);
+ sk = GNUNET_new (struct GNUNET_ATS_SessionKiller);
sk->session = session;
sk->plugin = plugin;
sk->task = GNUNET_SCHEDULER_add_now (&kill_session_task, sk);
connect_bl_check_cont (void *cls,
const struct GNUNET_PeerIdentity *peer,
const struct GNUNET_HELLO_Address *address,
- struct Session *session,
+ struct GNUNET_ATS_Session *session,
int result)
{
struct GNUNET_MessageHeader *msg = cls;
struct GNUNET_TIME_Relative
GST_receive_callback (void *cls,
const struct GNUNET_HELLO_Address *address,
- struct Session *session,
+ struct GNUNET_ATS_Session *session,
const struct GNUNET_MessageHeader *message)
{
const char *plugin_name = cls;
if (GNUNET_YES == add_remove)
{
addresses ++;
- GNUNET_STATISTICS_update (cfg, "# transport addresses", 1, GNUNET_NO);
+ GNUNET_STATISTICS_update (cfg,
+ "# transport addresses",
+ 1,
+ GNUNET_NO);
}
else if (GNUNET_NO == add_remove)
{
if (0 == addresses)
+ {
GNUNET_break (0);
+ }
else
{
addresses --;
- GNUNET_STATISTICS_update (cfg, "# transport addresses", -1, GNUNET_NO);
+ GNUNET_STATISTICS_update (cfg,
+ "# transport addresses",
+ -1,
+ GNUNET_NO);
}
}
-
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Transport now has %u addresses to communicate\n",
addresses);
- GST_hello_modify_addresses (add_remove, address);
+ GST_hello_modify_addresses (add_remove,
+ address);
}
static void
plugin_env_session_end (void *cls,
const struct GNUNET_HELLO_Address *address,
- struct Session *session)
+ struct GNUNET_ATS_Session *session)
{
- struct SessionKiller *sk;
+ struct GNUNET_ATS_SessionKiller *sk;
if (NULL == address)
{
GST_plugins_a2s (address));
GST_neighbours_session_terminated (&address->peer, session);
- GST_ats_del_session (address, session);
+ GST_ats_del_session (address,
+ session);
GST_blacklist_abort_matching (address, session);
for (sk = sk_head; NULL != sk; sk = sk->next)
plugin_env_session_start_bl_check_cont (void *cls,
const struct GNUNET_PeerIdentity *peer,
const struct GNUNET_HELLO_Address *address,
- struct Session *session,
+ struct GNUNET_ATS_Session *session,
int result)
{
if (GNUNET_OK != result)
static void
plugin_env_session_start (void *cls,
const struct GNUNET_HELLO_Address *address,
- struct Session *session,
+ struct GNUNET_ATS_Session *session,
enum GNUNET_ATS_Network_Type scope)
{
struct GNUNET_ATS_Properties prop;
ats_request_address_change (void *cls,
const struct GNUNET_PeerIdentity *peer,
const struct GNUNET_HELLO_Address *address,
- struct Session *session,
+ struct GNUNET_ATS_Session *session,
struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out,
struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in)
{
* and cancels pending validations.
*
* @param cls closure, unused
- * @param tc task context (unused)
*/
static void
-shutdown_task (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+shutdown_task (void *cls)
{
GST_neighbours_stop ();
GST_plugins_unload ();
"My identity is `%4s'\n",
GNUNET_i2s_full (&GST_my_identity));
- GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL,
- &shutdown_task,
- NULL);
+ GNUNET_SCHEDULER_add_shutdown (&shutdown_task,
+ NULL);
if (NULL == GST_peerinfo)
{
GNUNET_log(GNUNET_ERROR_TYPE_ERROR,
{
max_fd_rlimit = r_file.rlim_cur;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Maximum number of open files was: %u/%u\n",
- r_file.rlim_cur,
- r_file.rlim_max);
+ "Maximum number of open files was: %u/%u\n",
+ (unsigned int) r_file.rlim_cur,
+ (unsigned int) r_file.rlim_max);
}
max_fd_rlimit = (9 * max_fd_rlimit) / 10; /* Keep 10% for rest of transport */
#endif