/*
This file is part of GNUnet
- (C) 2002-2014 Christian Grothoff (and other contributing authors)
+ Copyright (C) 2002-2014 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.
*/
/**
/**
* Session handle for connections.
*/
-struct Session
+struct GNUNET_ATS_Session
{
/**
* To whom are we talking to (set to our identity
/**
* Stored in a linked list (or a peer map, or ...)
*/
- struct Session *next;
+ struct GNUNET_ATS_Session *next;
/**
* Pointer to the global plugin struct.
/**
* List of open sessions (or peer map, or...)
*/
- struct Session *sessions;
+ struct GNUNET_ATS_Session *sessions;
/**
* Function to call about session status changes.
*/
static void
notify_session_monitor (struct Plugin *plugin,
- struct Session *session,
+ struct GNUNET_ATS_Session *session,
enum GNUNET_TRANSPORT_SessionState state)
{
struct GNUNET_TRANSPORT_SessionInfo info;
*/
static ssize_t
template_plugin_send (void *cls,
- struct Session *session,
+ struct GNUNET_ATS_Session *session,
const char *msgbuf,
size_t msgbuf_size,
unsigned int priority,
*/
static int
template_plugin_disconnect_session (void *cls,
- struct Session *session)
+ struct GNUNET_ATS_Session *session)
{
// struct Plugin *plugin = cls;
// FIXME
*/
static enum GNUNET_ATS_Network_Type
template_plugin_get_network (void *cls,
- struct Session *session)
+ struct GNUNET_ATS_Session *session)
{
GNUNET_assert (NULL != session);
return GNUNET_ATS_NET_UNSPECIFIED; /* Change to correct network type */
}
+/**
+ * Function obtain the network type for an address.
+ *
+ * @param cls closure (`struct Plugin *`)
+ * @param address the address
+ * @return the network type
+ */
+static enum GNUNET_ATS_Network_Type
+template_plugin_get_network_for_address (void *cls,
+ const struct GNUNET_HELLO_Address *address)
+{
+ return GNUNET_ATS_NET_WAN; /* FOR NOW */
+}
+
+
/**
* Convert the transports address to a nice, human-readable
* format.
* @param address pointer to the GNUNET_HELLO_Address
* @return the session if the address is valid, NULL otherwise
*/
-static struct Session *
+static struct GNUNET_ATS_Session *
template_plugin_get_session (void *cls,
const struct GNUNET_HELLO_Address *address)
{
static void
template_plugin_update_session_timeout (void *cls,
const struct GNUNET_PeerIdentity *peer,
- struct Session *session)
+ struct GNUNET_ATS_Session *session)
{
}
*
* @param cls the `struct Plugin` with the monitor callback (`sic`)
* @param peer peer we send information about
- * @param value our `struct Session` to send information about
+ * @param value our `struct GNUNET_ATS_Session` to send information about
* @return #GNUNET_OK (continue to iterate)
*/
static int
void *value)
{
struct Plugin *plugin = cls;
- struct Session *session = value;
+ struct GNUNET_ATS_Session *session = value;
notify_session_monitor (plugin,
session,
api->string_to_address = &template_plugin_string_to_address;
api->get_session = &template_plugin_get_session;
api->get_network = &template_plugin_get_network;
+ api->get_network_for_address = &template_plugin_get_network_for_address;
api->update_session_timeout = &template_plugin_update_session_timeout;
api->setup_monitor = &template_plugin_setup_monitor;
LOG (GNUNET_ERROR_TYPE_INFO, "Template plugin successfully loaded\n");