-/**
- * Create a new session
- * @param cls plugin as closure
- * @param addr_in address the peer is using inbound
- * @param addr_len_in address length
- * @param addr_out address the peer is using outbound
- * @param addr_len_out address length
- * @param peer identity
- * @return created session object
- */
-static struct Session *
-create_session (void * cls,
- char * addr_in,
- size_t addrlen_in,
- char * addr_out,
- size_t addrlen_out,
- const struct GNUNET_PeerIdentity *peer)
-{
- struct Plugin *plugin = cls;
- struct Session * cs = GNUNET_malloc ( sizeof( struct Session) );
-
- GNUNET_assert(cls !=NULL);
- cs->plugin = plugin;
- memcpy(&cs->identity, peer, sizeof (struct GNUNET_PeerIdentity));
- GNUNET_CRYPTO_hash_to_enc(&cs->identity.hashPubKey,&(cs->hash));
- cs->outbound_connections_head = NULL;
- cs->outbound_connections_tail = NULL;
- return cs;
-}
-
-/**
- * Check if session for this peer is already existing, otherwise create it
- * @param cls the plugin used
- * @param p peer to get session for
- * @return session found or created
- */
-static struct Session * session_get (void * cls, const struct GNUNET_PeerIdentity *p)
-{
- struct Plugin *plugin = cls;
- struct Session *cs;
- unsigned int res;
-
- cs = GNUNET_CONTAINER_multihashmap_get (plugin->sessions, &p->hashPubKey);
- if (cs == NULL)
- {
- cs = create_session(plugin, NULL, 0, NULL, 0, p);
- res = GNUNET_CONTAINER_multihashmap_put ( plugin->sessions,
- &cs->identity.hashPubKey,
- cs,
- GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY);
- if (res == GNUNET_OK)
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "New Session `%s' inserted\n", GNUNET_i2s(p));
- }
- return cs;
-}
-
-static char * create_url(void * cls, const void * addr, size_t addrlen)