* The session this server request belongs to
* Can be NULL, when session was disconnected and freed
*/
- struct Session *session;
+ struct GNUNET_ATS_Session *session;
/**
* The MHD connection
/**
* Session handle for connections.
*/
-struct Session
+struct GNUNET_ATS_Session
{
/**
*/
static void
notify_session_monitor (struct HTTP_Server_Plugin *plugin,
- struct Session *session,
+ struct GNUNET_ATS_Session *session,
enum GNUNET_TRANSPORT_SessionState state)
{
struct GNUNET_TRANSPORT_SessionInfo info;
server_wake_up (void *cls,
const struct GNUNET_SCHEDULER_TaskContext *tc)
{
- struct Session *s = cls;
+ struct GNUNET_ATS_Session *s = cls;
s->recv_wakeup_task = NULL;
if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
* @param s the session to delete
*/
static void
-server_delete_session (struct Session *s)
+server_delete_session (struct GNUNET_ATS_Session *s)
{
struct HTTP_Server_Plugin *plugin = s->plugin;
struct HTTP_Message *msg;
*/
static int
http_server_plugin_disconnect_session (void *cls,
- struct Session *s)
+ struct GNUNET_ATS_Session *s)
{
server_delete_session (s);
return GNUNET_OK;
server_session_timeout (void *cls,
const struct GNUNET_SCHEDULER_TaskContext *tc)
{
- struct Session *s = cls;
+ struct GNUNET_ATS_Session *s = cls;
struct GNUNET_TIME_Relative left;
s->timeout_task = NULL;
* @param s the session
*/
static void
-server_reschedule_session_timeout (struct Session *s)
+server_reschedule_session_timeout (struct GNUNET_ATS_Session *s)
{
GNUNET_assert (NULL != s->timeout_task);
s->timeout = GNUNET_TIME_relative_to_absolute (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT);
*/
static ssize_t
http_server_plugin_send (void *cls,
- struct Session *session,
+ struct GNUNET_ATS_Session *session,
const char *msgbuf,
size_t msgbuf_size,
unsigned int priority,
*
* @param cls the `struct HTTP_Server_Plugin *`
* @param peer for which this is a session
- * @param value the `struct Session` to clean up
+ * @param value the `struct GNUNET_ATS_Session` to clean up
* @return #GNUNET_OK (continue to iterate)
*/
static int
const struct GNUNET_PeerIdentity *peer,
void *value)
{
- struct Session *s = value;
+ struct GNUNET_ATS_Session *s = value;
struct ServerRequest *sc_send;
struct ServerRequest *sc_recv;
*
* @param cls the `struct HTTP_Server_Plugin *`
* @param peer for which this is a session
- * @param value the `struct Session` to clean up
+ * @param value the `struct GNUNET_ATS_Session` to clean up
* @return #GNUNET_OK (continue to iterate)
*/
static int
const struct GNUNET_PeerIdentity *peer,
void *value)
{
- struct Session *s = value;
+ struct GNUNET_ATS_Session *s = value;
server_delete_session (s);
return GNUNET_OK;
* @param address the address
* @return always NULL
*/
-static struct Session *
+static struct GNUNET_ATS_Session *
http_server_plugin_get_session (void *cls,
const struct GNUNET_HELLO_Address *address)
{
static void
http_server_plugin_update_session_timeout (void *cls,
const struct GNUNET_PeerIdentity *peer,
- struct Session *session)
+ struct GNUNET_ATS_Session *session)
{
server_reschedule_session_timeout (session);
}
*/
static void
server_mhd_connection_timeout (struct HTTP_Server_Plugin *plugin,
- struct Session *s,
+ struct GNUNET_ATS_Session *s,
unsigned int to)
{
/* Setting timeouts for other connections */
/**
* Closure for #session_tag_it().
*/
-struct SessionTagContext
+struct GNUNET_ATS_SessionTagContext
{
/**
* Set to session matching the tag.
*/
- struct Session *res;
+ struct GNUNET_ATS_Session *res;
/**
* Tag we are looking for.
/**
* Find a session with a matching tag.
*
- * @param cls the `struct SessionTagContext *`
+ * @param cls the `struct GNUNET_ATS_SessionTagContext *`
* @param key peer identity (unused)
- * @param value the `struct Session *`
+ * @param value the `struct GNUNET_ATS_Session *`
* @return #GNUNET_NO if we found the session, #GNUNET_OK if not
*/
static int
const struct GNUNET_PeerIdentity *key,
void *value)
{
- struct SessionTagContext *stc = cls;
- struct Session *s = value;
+ struct GNUNET_ATS_SessionTagContext *stc = cls;
+ struct GNUNET_ATS_Session *s = value;
if (s->tag == stc->tag)
{
const char *url,
const char *method)
{
- struct Session *s = NULL;
+ struct GNUNET_ATS_Session *s = NULL;
struct ServerRequest *sc = NULL;
const union MHD_ConnectionInfo *conn_info;
struct HttpAddress *addr;
struct GNUNET_PeerIdentity target;
size_t addr_len;
- struct SessionTagContext stc;
+ struct GNUNET_ATS_SessionTagContext stc;
uint32_t options;
int direction = GNUNET_SYSERR;
unsigned int to;
/* external host name */
return NULL;
}
- s = GNUNET_new (struct Session);
+ s = GNUNET_new (struct GNUNET_ATS_Session);
s->target = target;
s->plugin = plugin;
s->scope = scope;
size_t max)
{
struct ServerRequest *sc = cls;
- struct Session *s = sc->session;
+ struct GNUNET_ATS_Session *s = sc->session;
ssize_t bytes_read = 0;
struct HTTP_Message *msg;
char *stat_txt;
void *client,
const struct GNUNET_MessageHeader *message)
{
- struct Session *s = cls;
+ struct GNUNET_ATS_Session *s = cls;
struct HTTP_Server_Plugin *plugin = s->plugin;
struct GNUNET_TIME_Relative delay;
char *stat_txt;
{
struct HTTP_Server_Plugin *plugin = cls;
struct ServerRequest *sc = *httpSessionCache;
- struct Session *s;
+ struct GNUNET_ATS_Session *s;
struct MHD_Response *response;
int res = MHD_YES;
plugin->port,
(unsigned int) res,
(const struct sockaddr **) addrs, addrlens,
- &server_nat_port_map_callback, NULL, plugin);
+ &server_nat_port_map_callback, NULL, plugin, NULL);
while (res > 0)
{
res--;
/**
* Function obtain the network type for a session
*
- * @param cls closure ('struct HTTP_Server_Plugin*')
+ * @param cls closure (`struct HTTP_Server_Plugin *`)
* @param session the session
* @return the network type in HBO or #GNUNET_SYSERR
*/
static enum GNUNET_ATS_Network_Type
http_server_plugin_get_network (void *cls,
- struct Session *session)
+ struct GNUNET_ATS_Session *session)
{
return session->scope;
}
+/**
+ * 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
+http_server_plugin_get_network_for_address (void *cls,
+ const struct GNUNET_HELLO_Address *address)
+{
+ struct HTTP_Server_Plugin *plugin = cls;
+
+ return http_common_get_network_for_address (plugin->env,
+ address);
+}
+
+
/**
* Function that will be called whenever the transport service wants to
* notify the plugin that the inbound quota changed and that the plugin
static void
http_server_plugin_update_inbound_delay (void *cls,
const struct GNUNET_PeerIdentity *peer,
- struct Session *session,
+ struct GNUNET_ATS_Session *session,
struct GNUNET_TIME_Relative delay)
{
session->next_receive = GNUNET_TIME_relative_to_absolute (delay);
*
* @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 HTTP_Server_Plugin *plugin = cls;
- struct Session *session = value;
+ struct GNUNET_ATS_Session *session = value;
notify_session_monitor (plugin,
session,
api->string_to_address = &http_common_plugin_string_to_address;
api->address_pretty_printer = &http_common_plugin_address_pretty_printer;
api->get_network = &http_server_plugin_get_network;
+ api->get_network_for_address = &http_server_plugin_get_network_for_address;
api->update_session_timeout = &http_server_plugin_update_session_timeout;
api->update_inbound_delay = &http_server_plugin_update_inbound_delay;
api->setup_monitor = &http_server_plugin_setup_monitor;