* Message sent by ATS service to client to confirm that it is done
* using the given session ID.
*/
-struct SessionReleaseMessage
+struct GNUNET_ATS_SessionReleaseMessage
{
/**
* Type is #GNUNET_MESSAGE_TYPE_ATS_SESSION_RELEASE.
* Session handle. NULL if we have an address but no
* active session for this address.
*/
- struct Session *session;
+ struct GNUNET_ATS_Session *session;
/**
* Performance data about the address.
*/
static uint32_t
find_session_id (struct GNUNET_ATS_SchedulingHandle *sh,
- struct Session *session,
+ struct GNUNET_ATS_Session *session,
const struct GNUNET_HELLO_Address *address)
{
uint32_t i;
const struct GNUNET_MessageHeader *msg)
{
struct GNUNET_ATS_SchedulingHandle *sh = cls;
- const struct SessionReleaseMessage *srm;
+ const struct GNUNET_ATS_SessionReleaseMessage *srm;
- srm = (const struct SessionReleaseMessage *) msg;
+ srm = (const struct GNUNET_ATS_SessionReleaseMessage *) msg;
/* Note: peer field in srm not necessary right now,
but might be good to have in the future */
release_session (sh,
static const struct GNUNET_MQ_MessageHandler handlers[] =
{ { &process_ats_session_release_message,
GNUNET_MESSAGE_TYPE_ATS_SESSION_RELEASE,
- sizeof (struct SessionReleaseMessage) },
+ sizeof (struct GNUNET_ATS_SessionReleaseMessage) },
{ &process_ats_address_suggestion_message,
GNUNET_MESSAGE_TYPE_ATS_ADDRESS_SUGGESTION,
sizeof (struct AddressSuggestionMessage) },
struct GNUNET_ATS_AddressRecord *
GNUNET_ATS_address_add (struct GNUNET_ATS_SchedulingHandle *sh,
const struct GNUNET_HELLO_Address *address,
- struct Session *session,
+ struct GNUNET_ATS_Session *session,
const struct GNUNET_ATS_Properties *prop)
{
struct GNUNET_ATS_AddressRecord *ar;
*/
void
GNUNET_ATS_address_add_session (struct GNUNET_ATS_AddressRecord *ar,
- struct Session *session)
+ struct GNUNET_ATS_Session *session)
{
GNUNET_break (NULL == ar->session);
ar->session = session;
*/
int
GNUNET_ATS_address_del_session (struct GNUNET_ATS_AddressRecord *ar,
- struct Session *session)
+ struct GNUNET_ATS_Session *session)
{
GNUNET_assert (session == ar->session);
ar->session = NULL;
const struct GNUNET_MessageHeader *message)
{
const struct AddressDestroyedMessage *m;
- struct SessionReleaseMessage srm;
+ struct GNUNET_ATS_SessionReleaseMessage srm;
m = (const struct AddressDestroyedMessage *) message;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
GAS_addresses_destroy (&m->peer,
ntohl (m->session_id));
srm.header.type = ntohs (GNUNET_MESSAGE_TYPE_ATS_SESSION_RELEASE);
- srm.header.size = ntohs (sizeof (struct SessionReleaseMessage));
+ srm.header.size = ntohs (sizeof (struct GNUNET_ATS_SessionReleaseMessage));
srm.session_id = m->session_id;
srm.peer = m->peer;
GNUNET_SERVER_notification_context_unicast (nc,
/**
* Which session were we given?
*/
- struct Session *session;
+ struct GNUNET_ATS_Session *session;
/**
* What address was assigned?
/**
* Our dummy sessions.
*/
-struct Session
+struct GNUNET_ATS_Session
{
/**
- * Field to avoid `0 == sizeof(struct Session)`.
+ * Field to avoid `0 == sizeof(struct GNUNET_ATS_Session)`.
*/
unsigned int non_empty;
};
* @param i which session number to return
* @return NULL if @a i is 0, otherwise a pointer unique to @a i
*/
-static struct Session *
+static struct GNUNET_ATS_Session *
make_session (unsigned int i)
{
- struct Session *baseptr = NULL;
+ struct GNUNET_ATS_Session *baseptr = NULL;
if (0 == i)
return NULL;
case CMD_ADD_ADDRESS:
{
struct GNUNET_HELLO_Address *addr;
- struct Session *session;
+ struct GNUNET_ATS_Session *session;
addr = make_address (cmd->details.add_address.pid,
cmd->details.add_address.addr_num,
case CMD_ADD_SESSION:
{
struct Command *add;
- struct Session *session;
+ struct GNUNET_ATS_Session *session;
add = find_command (CMD_ADD_ADDRESS,
cmd->details.add_session.add_label);
{
struct Command *add_address;
struct Command *add_session;
- struct Session *session;
+ struct GNUNET_ATS_Session *session;
add_session = find_command (CMD_ADD_SESSION,
cmd->details.del_session.add_session_label);
address_suggest_cb (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)
{
/**
* Session of this request.
*/
- struct Session *session;
+ struct GNUNET_ATS_Session *session;
/**
* Number of bytes to transmit.
/**
* Session handle for connections.
*/
-struct Session
+struct GNUNET_ATS_Session
{
/**
* Pointer to the global plugin struct.
*/
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;
* @param session session where the distance changed
*/
static void
-notify_distance_change (struct Session *session)
+notify_distance_change (struct GNUNET_ATS_Session *session)
{
struct Plugin *plugin = session->plugin;
* Function called by MST on each message from the box.
*
* @param cls closure with the `struct Plugin *`
- * @param client identification of the client (with the 'struct Session')
+ * @param client identification of the client (with the 'struct GNUNET_ATS_Session')
* @param message the actual message
* @return #GNUNET_OK on success
*/
const struct GNUNET_MessageHeader *message)
{
struct Plugin *plugin = cls;
- struct Session *session = client;
+ struct GNUNET_ATS_Session *session = client;
session->active = GNUNET_YES;
LOG (GNUNET_ERROR_TYPE_DEBUG,
const struct GNUNET_MessageHeader *msg)
{
struct Plugin *plugin = cls;
- struct Session *session;
+ struct GNUNET_ATS_Session *session;
LOG (GNUNET_ERROR_TYPE_DEBUG,
"Received DV_MESSAGE_RECEIVED message for peer `%s': new distance %u\n",
enum GNUNET_ATS_Network_Type network)
{
struct Plugin *plugin = cls;
- struct Session *session;
+ struct GNUNET_ATS_Session *session;
GNUNET_break (GNUNET_ATS_NET_UNSPECIFIED != network);
/**
return; /* nothing to do */
}
- session = GNUNET_new (struct Session);
+ session = GNUNET_new (struct GNUNET_ATS_Session);
session->address = GNUNET_HELLO_address_allocate (peer, "dv",
NULL, 0,
GNUNET_HELLO_ADDRESS_INFO_NONE);
enum GNUNET_ATS_Network_Type network)
{
struct Plugin *plugin = cls;
- struct Session *session;
+ struct GNUNET_ATS_Session *session;
GNUNET_break (GNUNET_ATS_NET_UNSPECIFIED != network);
LOG (GNUNET_ERROR_TYPE_DEBUG,
* @param session session to clean up
*/
static void
-free_session (struct Session *session)
+free_session (struct GNUNET_ATS_Session *session)
{
struct Plugin *plugin = session->plugin;
struct PendingRequest *pr;
const struct GNUNET_PeerIdentity *peer)
{
struct Plugin *plugin = cls;
- struct Session *session;
+ struct GNUNET_ATS_Session *session;
LOG (GNUNET_ERROR_TYPE_DEBUG,
"Received `%s' message for peer `%s'\n",
int ok)
{
struct PendingRequest *pr = cls;
- struct Session *session = pr->session;
+ struct GNUNET_ATS_Session *session = pr->session;
pr->th = NULL;
GNUNET_CONTAINER_DLL_remove (session->pr_head,
*/
static ssize_t
dv_plugin_send (void *cls,
- struct Session *session,
+ struct GNUNET_ATS_Session *session,
const char *msgbuf,
size_t msgbuf_size,
unsigned int priority,
const struct GNUNET_PeerIdentity *target)
{
struct Plugin *plugin = cls;
- struct Session *session;
+ struct GNUNET_ATS_Session *session;
struct PendingRequest *pr;
session = GNUNET_CONTAINER_multipeermap_get (plugin->sessions,
*/
static int
dv_plugin_disconnect_session (void *cls,
- struct Session *session)
+ struct GNUNET_ATS_Session *session)
{
struct PendingRequest *pr;
* @param address the address
* @return the session if the address is valid, NULL otherwise
*/
-static struct Session *
+static struct GNUNET_ATS_Session *
dv_get_session (void *cls,
const struct GNUNET_HELLO_Address *address)
{
struct Plugin *plugin = cls;
- struct Session *session;
+ struct GNUNET_ATS_Session *session;
if (0 != address->address_length)
return NULL;
static void
dv_plugin_update_session_timeout (void *cls,
const struct GNUNET_PeerIdentity *peer,
- struct Session *session)
+ struct GNUNET_ATS_Session *session)
{
/* DV currently doesn't time out like "normal" plugins,
so it should be safe to do nothing, right?
*/
static enum GNUNET_ATS_Network_Type
dv_get_network (void *cls,
- struct Session *session)
+ struct GNUNET_ATS_Session *session)
{
GNUNET_assert (NULL != session);
return session->network;
*
* @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;
if (GNUNET_YES != session->active)
return GNUNET_OK;
const struct GNUNET_PeerIdentity *key,
void *value)
{
- struct Session *session = value;
+ struct GNUNET_ATS_Session *session = value;
free_session (session);
return GNUNET_OK;
/**
* Opaque session handle, defined by plugins. Contents not known to ATS.
- * FIXME: This violates our naming conventions.
*/
-struct Session;
+struct GNUNET_ATS_Session;
/**
(*GNUNET_ATS_AddressSuggestionCallback) (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);
struct GNUNET_ATS_AddressRecord *
GNUNET_ATS_address_add (struct GNUNET_ATS_SchedulingHandle *sh,
const struct GNUNET_HELLO_Address *address,
- struct Session *session,
+ struct GNUNET_ATS_Session *session,
const struct GNUNET_ATS_Properties *prop);
*/
void
GNUNET_ATS_address_add_session (struct GNUNET_ATS_AddressRecord *ar,
- struct Session *session);
+ struct GNUNET_ATS_Session *session);
/**
*/
int
GNUNET_ATS_address_del_session (struct GNUNET_ATS_AddressRecord *ar,
- struct Session *session);
+ struct GNUNET_ATS_Session *session);
/**
* connection may not have an address that can be used for meaningful
* distinction between sessions to the same peer.
*
- * Each 'struct Session' MUST start with the 'struct GNUNET_PeerIdentity'
+ * Each 'struct GNUNET_ATS_Session' MUST start with the 'struct GNUNET_PeerIdentity'
* of the peer the session is for (which will be used for some error
* checking by the ATS code).
*/
-struct Session;
+struct GNUNET_ATS_Session;
/**
typedef void
(*GNUNET_TRANSPORT_SessionEnd) (void *cls,
const struct GNUNET_HELLO_Address *address,
- struct Session *session);
+ struct GNUNET_ATS_Session *session);
/**
typedef void
(*GNUNET_TRANSPORT_SessionStart) (void *cls,
const struct GNUNET_HELLO_Address *address,
- struct Session *session,
+ struct GNUNET_ATS_Session *session,
enum GNUNET_ATS_Network_Type net);
typedef struct GNUNET_TIME_Relative
(*GNUNET_TRANSPORT_PluginReceiveCallback) (void *cls,
const struct GNUNET_HELLO_Address *address,
- struct Session *session,
+ struct GNUNET_ATS_Session *session,
const struct GNUNET_MessageHeader *message);
*/
typedef ssize_t
(*GNUNET_TRANSPORT_TransmitFunction) (void *cls,
- struct Session *session,
+ struct GNUNET_ATS_Session *session,
const char *msgbuf,
size_t msgbuf_size,
unsigned int priority,
*/
typedef int
(*GNUNET_TRANSPORT_DisconnectSessionFunction) (void *cls,
- struct Session *session);
+ struct GNUNET_ATS_Session *session);
/**
* @param address the hello address
* @return the session if the address is valid, NULL otherwise
*/
-typedef struct Session *
+typedef struct GNUNET_ATS_Session *
(*GNUNET_TRANSPORT_CreateSession) (void *cls,
const struct GNUNET_HELLO_Address *address);
typedef void
(*GNUNET_TRANSPORT_UpdateSessionTimeout) (void *cls,
const struct GNUNET_PeerIdentity *peer,
- struct Session *session);
+ struct GNUNET_ATS_Session *session);
/**
typedef void
(*GNUNET_TRANSPORT_UpdateInboundDelay) (void *cls,
const struct GNUNET_PeerIdentity *peer,
- struct Session *session,
+ struct GNUNET_ATS_Session *session,
struct GNUNET_TIME_Relative delay);
*/
typedef enum GNUNET_ATS_Network_Type
(*GNUNET_TRANSPORT_GetNetworkType) (void *cls,
- struct Session *session);
+ struct GNUNET_ATS_Session *session);
/**
*/
typedef void
(*GNUNET_TRANSPORT_SessionInfoCallback) (void *cls,
- struct Session *session,
+ struct GNUNET_ATS_Session *session,
const struct GNUNET_TRANSPORT_SessionInfo *info);
/**
* Abstract representation of a plugin's session.
- * Corresponds to the `struct Session` within the TRANSPORT service.
+ * Corresponds to the `struct GNUNET_ATS_Session` within the TRANSPORT service.
*/
struct GNUNET_TRANSPORT_PluginSession;
/**
* 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;
/**
* Task to asynchronously terminate a session.
*
- * @param cls the `struct SessionKiller` with the information for the kill
+ * @param cls the `struct GNUNET_ATS_SessionKiller` with the information for the kill
* @param tc scheduler context
*/
static void
kill_session_task (void *cls,
const struct GNUNET_SCHEDULER_TaskContext *tc)
{
- 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;
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)
{
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)
{
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);
/**
* Session (can be NULL)
*/
- struct Session *session;
+ struct GNUNET_ATS_Session *session;
/**
* Record with ATS API for the address.
/**
* Session to look for (only used if the address is inbound).
*/
- struct Session *session;
+ struct GNUNET_ATS_Session *session;
/**
* Address to look for.
*/
static struct AddressInfo *
find_ai (const struct GNUNET_HELLO_Address *address,
- struct Session *session)
+ struct GNUNET_ATS_Session *session)
{
struct FindClosure fc;
*/
int
GST_ats_is_known (const struct GNUNET_HELLO_Address *address,
- struct Session *session)
+ struct GNUNET_ATS_Session *session)
{
return (NULL != find_ai (address, session)) ? GNUNET_YES : GNUNET_NO;
}
*/
void
GST_ats_block_address (const struct GNUNET_HELLO_Address *address,
- struct Session *session)
+ struct GNUNET_ATS_Session *session)
{
struct AddressInfo *ai;
*/
void
GST_ats_block_reset (const struct GNUNET_HELLO_Address *address,
- struct Session *session)
+ struct GNUNET_ATS_Session *session)
{
struct AddressInfo *ai;
*/
void
GST_ats_add_inbound_address (const struct GNUNET_HELLO_Address *address,
- struct Session *session,
+ struct GNUNET_ATS_Session *session,
const struct GNUNET_ATS_Properties *prop)
{
struct GNUNET_ATS_AddressRecord *ar;
*/
void
GST_ats_new_session (const struct GNUNET_HELLO_Address *address,
- struct Session *session)
+ struct GNUNET_ATS_Session *session)
{
struct AddressInfo *ai;
*/
void
GST_ats_del_session (const struct GNUNET_HELLO_Address *address,
- struct Session *session)
+ struct GNUNET_ATS_Session *session)
{
struct AddressInfo *ai;
*/
int
GST_ats_is_known (const struct GNUNET_HELLO_Address *address,
- struct Session *session);
+ struct GNUNET_ATS_Session *session);
/**
*/
void
GST_ats_block_address (const struct GNUNET_HELLO_Address *address,
- struct Session *session);
+ struct GNUNET_ATS_Session *session);
/**
*/
void
GST_ats_block_reset (const struct GNUNET_HELLO_Address *address,
- struct Session *session);
+ struct GNUNET_ATS_Session *session);
/**
*/
void
GST_ats_add_inbound_address (const struct GNUNET_HELLO_Address *address,
- struct Session *session,
+ struct GNUNET_ATS_Session *session,
const struct GNUNET_ATS_Properties *prop);
*/
void
GST_ats_new_session (const struct GNUNET_HELLO_Address *address,
- struct Session *session);
+ struct GNUNET_ATS_Session *session);
/**
*/
void
GST_ats_del_session (const struct GNUNET_HELLO_Address *address,
- struct Session *session);
+ struct GNUNET_ATS_Session *session);
/**
/**
* Session for #GST_blacklist_abort_matching(), can be NULL.
*/
- struct Session *session;
+ struct GNUNET_ATS_Session *session;
/**
* Current transmission request handle for this client, or NULL if no
confirm_or_drop_neighbour (void *cls,
const struct GNUNET_PeerIdentity *peer,
const struct GNUNET_HELLO_Address *address,
- struct Session *session,
+ struct GNUNET_ATS_Session *session,
int allowed)
{
if (GNUNET_OK == allowed)
*/
void
GST_blacklist_abort_matching (const struct GNUNET_HELLO_Address *address,
- struct Session *session)
+ struct GNUNET_ATS_Session *session)
{
struct GST_BlacklistCheck *bc;
struct GST_BlacklistCheck *n;
GST_BlacklistTestContinuation cont,
void *cont_cls,
const struct GNUNET_HELLO_Address *address,
- struct Session *session)
+ struct GNUNET_ATS_Session *session)
{
struct GST_BlacklistCheck *bc;
(*GST_BlacklistTestContinuation) (void *cls,
const struct GNUNET_PeerIdentity *peer,
const struct GNUNET_HELLO_Address *address,
- struct Session *session,
+ struct GNUNET_ATS_Session *session,
int result);
GST_BlacklistTestContinuation cont,
void *cont_cls,
const struct GNUNET_HELLO_Address *address,
- struct Session *session);
+ struct GNUNET_ATS_Session *session);
/**
*/
void
GST_blacklist_abort_matching (const struct GNUNET_HELLO_Address *address,
- struct Session *session);
+ struct GNUNET_ATS_Session *session);
*/
static void
plugin_session_info_cb (void *cls,
- struct Session *session,
+ struct GNUNET_ATS_Session *session,
const struct GNUNET_TRANSPORT_SessionInfo *info)
{
struct TransportPluginMonitorMessage *msg;
*/
void
GST_manipulation_manipulate_metrics (const struct GNUNET_HELLO_Address *address,
- struct Session *session,
+ struct GNUNET_ATS_Session *session,
struct GNUNET_ATS_Properties *prop)
{
const struct GNUNET_PeerIdentity *peer = &address->peer;
struct GNUNET_TIME_Relative
GST_manipulation_recv (void *cls,
const struct GNUNET_HELLO_Address *address,
- struct Session *session,
+ struct GNUNET_ATS_Session *session,
const struct GNUNET_MessageHeader *message)
{
struct TM_Peer *tmp;
struct GNUNET_TIME_Relative
GST_manipulation_recv (void *cls,
const struct GNUNET_HELLO_Address *address,
- struct Session *session,
+ struct GNUNET_ATS_Session *session,
const struct GNUNET_MessageHeader *message);
*/
void
GST_manipulation_manipulate_metrics (const struct GNUNET_HELLO_Address *address,
- struct Session *session,
+ struct GNUNET_ATS_Session *session,
struct GNUNET_ATS_Properties *prop);
* When the keep alive response with type is received, transport service
* will call the respective plugin to update the session timeout
*/
-struct SessionKeepAliveMessage
+struct GNUNET_ATS_SessionKeepAliveMessage
{
/**
* Header of type #GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_KEEPALIVE or
* the other peer should limit transmissions to the indicated
* quota.
*/
-struct SessionQuotaMessage
+struct GNUNET_ATS_SessionQuotaMessage
{
/**
* Header of type #GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_QUOTA.
* notification, peers must not rely on always receiving disconnect
* messages.
*/
-struct SessionDisconnectMessage
+struct GNUNET_ATS_SessionDisconnectMessage
{
/**
* Header of type #GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_DISCONNECT
/**
* Active session for this address.
*/
- struct Session *session;
+ struct GNUNET_ATS_Session *session;
/**
* Network-level address information.
static void
set_alternative_address (struct NeighbourMapEntry *n,
const struct GNUNET_HELLO_Address *address,
- struct Session *session,
+ struct GNUNET_ATS_Session *session,
struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in,
struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out)
{
static void
send_disconnect (struct NeighbourMapEntry *n)
{
- struct SessionDisconnectMessage disconnect_msg;
+ struct GNUNET_ATS_SessionDisconnectMessage disconnect_msg;
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Sending DISCONNECT message to peer `%4s'\n",
GNUNET_i2s (&n->id));
- disconnect_msg.header.size = htons (sizeof (struct SessionDisconnectMessage));
+ disconnect_msg.header.size = htons (sizeof (struct GNUNET_ATS_SessionDisconnectMessage));
disconnect_msg.header.type =
htons (GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_DISCONNECT);
disconnect_msg.reserved = htonl (0);
quota);
if (0 != ntohl (quota.value__))
{
- struct SessionQuotaMessage sqm;
+ struct GNUNET_ATS_SessionQuotaMessage sqm;
- sqm.header.size = htons (sizeof (struct SessionQuotaMessage));
+ sqm.header.size = htons (sizeof (struct GNUNET_ATS_SessionQuotaMessage));
sqm.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_QUOTA);
sqm.quota = quota.value__;
(void) send_with_session (n,
static void
set_primary_address (struct NeighbourMapEntry *n,
const struct GNUNET_HELLO_Address *address,
- struct Session *session,
+ struct GNUNET_ATS_Session *session,
struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in,
struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out)
{
static void
send_keepalive (struct NeighbourMapEntry *n)
{
- struct SessionKeepAliveMessage m;
+ struct GNUNET_ATS_SessionKeepAliveMessage m;
struct GNUNET_TIME_Relative timeout;
uint32_t nonce;
"Sending KEEPALIVE to peer `%s' with nonce %u\n",
GNUNET_i2s (&n->id),
nonce);
- m.header.size = htons (sizeof (struct SessionKeepAliveMessage));
+ m.header.size = htons (sizeof (struct GNUNET_ATS_SessionKeepAliveMessage));
m.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_KEEPALIVE);
m.nonce = htonl (nonce);
const struct GNUNET_MessageHeader *m)
{
struct NeighbourMapEntry *n;
- const struct SessionKeepAliveMessage *msg_in;
- struct SessionKeepAliveMessage msg;
+ const struct GNUNET_ATS_SessionKeepAliveMessage *msg_in;
+ struct GNUNET_ATS_SessionKeepAliveMessage msg;
- if (sizeof (struct SessionKeepAliveMessage) != ntohs (m->size))
+ if (sizeof (struct GNUNET_ATS_SessionKeepAliveMessage) != ntohs (m->size))
{
GNUNET_break_op (0);
return;
}
- msg_in = (const struct SessionKeepAliveMessage *) m;
+ msg_in = (const struct GNUNET_ATS_SessionKeepAliveMessage *) m;
if (NULL == (n = lookup_neighbour (neighbour)))
{
GNUNET_STATISTICS_update (GST_stats,
GNUNET_NO);
/* send reply to allow neighbour to measure latency */
- msg.header.size = htons (sizeof (struct SessionKeepAliveMessage));
+ msg.header.size = htons (sizeof (struct GNUNET_ATS_SessionKeepAliveMessage));
msg.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_KEEPALIVE_RESPONSE);
msg.nonce = msg_in->nonce;
(void) send_with_session (n,
&msg,
- sizeof (struct SessionKeepAliveMessage),
+ sizeof (struct GNUNET_ATS_SessionKeepAliveMessage),
UINT32_MAX /* priority */,
GNUNET_TIME_UNIT_FOREVER_REL,
GNUNET_YES,
const struct GNUNET_MessageHeader *m)
{
struct NeighbourMapEntry *n;
- const struct SessionKeepAliveMessage *msg;
+ const struct GNUNET_ATS_SessionKeepAliveMessage *msg;
struct GNUNET_TRANSPORT_PluginFunctions *papi;
struct GNUNET_TIME_Relative latency;
- if (sizeof (struct SessionKeepAliveMessage) != ntohs (m->size))
+ if (sizeof (struct GNUNET_ATS_SessionKeepAliveMessage) != ntohs (m->size))
{
GNUNET_break_op (0);
return;
}
- msg = (const struct SessionKeepAliveMessage *) m;
+ msg = (const struct GNUNET_ATS_SessionKeepAliveMessage *) m;
if (NULL == (n = lookup_neighbour (neighbour)))
{
GNUNET_STATISTICS_update (GST_stats,
struct GNUNET_TIME_Absolute timestamp)
{
const struct GNUNET_HELLO_Address *address = na->address;
- struct Session *session = na->session;
+ struct GNUNET_ATS_Session *session = na->session;
struct GNUNET_TRANSPORT_PluginFunctions *papi;
struct TransportSynMessage connect_msg;
struct NeighbourMapEntry *n;
try_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 BlacklistCheckSwitchContext *blc_ctx = cls;
*/
static int
try_run_fast_ats_update (const struct GNUNET_HELLO_Address *address,
- struct Session *session,
+ struct GNUNET_ATS_Session *session,
struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in,
struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out)
{
switch_address_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 BlacklistCheckSwitchContext *blc_ctx = cls;
*/
void
GST_neighbours_switch_to_address (const struct GNUNET_HELLO_Address *address,
- struct Session *session,
+ struct GNUNET_ATS_Session *session,
struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in,
struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out)
{
*/
void
GST_neighbours_notify_data_sent (const struct GNUNET_HELLO_Address *address,
- struct Session *session,
+ struct GNUNET_ATS_Session *session,
size_t size)
{
struct NeighbourMapEntry *n;
* We received a 'SESSION_SYN_ACK' message from the other peer.
* Consider switching to it.
*
- * @param message possibly a `struct SessionConnectMessage` (check format)
+ * @param message possibly a `struct GNUNET_ATS_SessionConnectMessage` (check format)
* @param peer identity of the peer to switch the address for
* @param address address of the other peer, NULL if other peer
* connected to us
int
GST_neighbours_handle_session_syn_ack (const struct GNUNET_MessageHeader *message,
const struct GNUNET_HELLO_Address *address,
- struct Session *session)
+ struct GNUNET_ATS_Session *session)
{
const struct TransportSynMessage *scm;
struct GNUNET_TIME_Absolute ts;
*/
int
GST_neighbours_session_terminated (const struct GNUNET_PeerIdentity *peer,
- struct Session *session)
+ struct GNUNET_ATS_Session *session)
{
struct NeighbourMapEntry *n;
struct BlackListCheckContext *bcc;
* If we sent a 'SYN_ACK' last, this means we are now
* connected. Otherwise, do nothing.
*
- * @param message possibly a 'struct SessionConnectMessage' (check format)
+ * @param message possibly a 'struct GNUNET_ATS_SessionConnectMessage' (check format)
* @param address address of the other peer
* @param session session to use (or NULL)
* @return #GNUNET_OK if the message was fine, #GNUNET_SYSERR on serious error
int
GST_neighbours_handle_session_ack (const struct GNUNET_MessageHeader *message,
const struct GNUNET_HELLO_Address *address,
- struct Session *session)
+ struct GNUNET_ATS_Session *session)
{
struct NeighbourMapEntry *n;
const struct GNUNET_MessageHeader *msg)
{
struct NeighbourMapEntry *n;
- const struct SessionQuotaMessage *sqm;
+ const struct GNUNET_ATS_SessionQuotaMessage *sqm;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Received QUOTA message from peer `%s'\n",
GNUNET_i2s (peer));
- if (ntohs (msg->size) != sizeof (struct SessionQuotaMessage))
+ if (ntohs (msg->size) != sizeof (struct GNUNET_ATS_SessionQuotaMessage))
{
GNUNET_break_op (0);
GNUNET_STATISTICS_update (GST_stats,
gettext_noop
("# QUOTA messages received"),
1, GNUNET_NO);
- sqm = (const struct SessionQuotaMessage *) msg;
+ sqm = (const struct GNUNET_ATS_SessionQuotaMessage *) msg;
if (NULL == (n = lookup_neighbour (peer)))
{
/* gone already */
const struct GNUNET_MessageHeader *msg)
{
struct NeighbourMapEntry *n;
- const struct SessionDisconnectMessage *sdm;
+ const struct GNUNET_ATS_SessionDisconnectMessage *sdm;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Received DISCONNECT message from peer `%s'\n",
GNUNET_i2s (peer));
- if (ntohs (msg->size) != sizeof (struct SessionDisconnectMessage))
+ if (ntohs (msg->size) != sizeof (struct GNUNET_ATS_SessionDisconnectMessage))
{
GNUNET_break_op (0);
GNUNET_STATISTICS_update (GST_stats,
gettext_noop
("# DISCONNECT messages received"),
1, GNUNET_NO);
- sdm = (const struct SessionDisconnectMessage *) msg;
+ sdm = (const struct GNUNET_ATS_SessionDisconnectMessage *) msg;
if (NULL == (n = lookup_neighbour (peer)))
{
/* gone already */
*/
int
GST_neighbours_session_terminated (const struct GNUNET_PeerIdentity *peer,
- struct Session *session);
+ struct GNUNET_ATS_Session *session);
/**
*/
void
GST_neighbours_notify_data_sent (const struct GNUNET_HELLO_Address *address,
- struct Session *session,
+ struct GNUNET_ATS_Session *session,
size_t size);
*/
void
GST_neighbours_switch_to_address (const struct GNUNET_HELLO_Address *address,
- struct Session *session,
+ struct GNUNET_ATS_Session *session,
struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in,
struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out);
* We received a 'SESSION_CONNECT' message from the other peer.
* Consider switching to it.
*
- * @param message possibly a 'struct SessionConnectMessage' (check format)
+ * @param message possibly a 'struct GNUNET_ATS_SessionConnectMessage' (check format)
* @param peer identity of the peer to switch the address for
* @return #GNUNET_OK if the message was fine, #GNUNET_SYSERR on serious error
*/
* We received a 'SESSION_CONNECT_ACK' message from the other peer.
* Consider switching to it.
*
- * @param message possibly a `struct SessionConnectMessage` (check format)
+ * @param message possibly a `struct GNUNET_ATS_SessionConnectMessage` (check format)
* @param address address of the other peer
* @param session session to use (or NULL)
* @return #GNUNET_OK if the message was fine, #GNUNET_SYSERR on serious error
int
GST_neighbours_handle_session_syn_ack (const struct GNUNET_MessageHeader *message,
const struct GNUNET_HELLO_Address *address,
- struct Session *session);
+ struct GNUNET_ATS_Session *session);
/**
* If we sent a 'CONNECT_ACK' last, this means we are now
* connected. Otherwise, do nothing.
*
- * @param message possibly a 'struct SessionConnectMessage' (check format)
+ * @param message possibly a 'struct GNUNET_ATS_SessionConnectMessage' (check format)
* @param address address of the other peer
* @param session session to use (or NULL)
* @return #GNUNET_OK if the message was fine, #GNUNET_SYSERR on serious error
int
GST_neighbours_handle_session_ack (const struct GNUNET_MessageHeader *message,
const struct GNUNET_HELLO_Address *address,
- struct Session *session);
+ struct GNUNET_ATS_Session *session);
/**
transmit_ping_if_allowed (void *cls,
const struct GNUNET_PeerIdentity *pid,
const struct GNUNET_HELLO_Address *address_null,
- struct Session *session_null,
+ struct GNUNET_ATS_Session *session_null,
int result)
{
struct ValidationEntry *ve = cls;
size_t tsize;
size_t slen;
uint16_t hsize;
- struct Session *session;
+ struct GNUNET_ATS_Session *session;
ve->bc = NULL;
if (GNUNET_OK != result)
{
struct TransportPongMessage *pong = cls;
struct GNUNET_TRANSPORT_PluginFunctions *papi;
- struct Session *session;
+ struct GNUNET_ATS_Session *session;
papi = GST_plugins_find (address->transport_name);
if (NULL == papi)
GST_validation_handle_ping (const struct GNUNET_PeerIdentity *sender,
const struct GNUNET_MessageHeader *hdr,
const struct GNUNET_HELLO_Address *sender_address,
- struct Session *session)
+ struct GNUNET_ATS_Session *session)
{
const struct TransportPingMessage *ping;
struct TransportPongMessage *pong;
GST_validation_handle_ping (const struct GNUNET_PeerIdentity *sender,
const struct GNUNET_MessageHeader *hdr,
const struct GNUNET_HELLO_Address *sender_address,
- struct Session *session);
+ struct GNUNET_ATS_Session *session);
/**
/**
* Head of linked list of open sessions.
*/
- struct Session *head;
+ struct GNUNET_ATS_Session *head;
/**
* Tail of linked list of open sessions.
*/
- struct Session *tail;
+ struct GNUNET_ATS_Session *tail;
/**
* NAT handle & address management
* A full session consists of 2 semi-connections: send and receive
* If not both directions are established the server keeps this sessions here
*/
- struct Session *server_semi_head;
+ struct GNUNET_ATS_Session *server_semi_head;
/**
* Tail of server semi connections
* A full session consists of 2 semi-connections: send and receive
* If not both directions are established the server keeps this sessions here
*/
- struct Session *server_semi_tail;
+ struct GNUNET_ATS_Session *server_semi_tail;
/**
* cURL Multihandle
/**
* The session this server connection belongs to
*/
- struct Session *session;
+ struct GNUNET_ATS_Session *session;
/**
* The MHD connection
/**
* Session handle for connections.
*/
-struct Session
+struct GNUNET_ATS_Session
{
/**
* To whom are we talking to
/**
* Stored in a linked list.
*/
- struct Session *next;
+ struct GNUNET_ATS_Session *next;
/**
* Stored in a linked list.
*/
- struct Session *prev;
+ struct GNUNET_ATS_Session *prev;
/**
* Pointer to the global plugin struct.
};
-struct Session *
+struct GNUNET_ATS_Session *
create_session (struct Plugin *plugin,
const struct GNUNET_PeerIdentity *target,
const void *addr,
int
exist_session (struct Plugin *plugin,
- struct Session *s);
+ struct GNUNET_ATS_Session *s);
void
-delete_session (struct Session *s);
+delete_session (struct GNUNET_ATS_Session *s);
int
exist_session (struct Plugin *plugin,
- struct Session *s);
+ struct GNUNET_ATS_Session *s);
struct GNUNET_TIME_Relative
http_plugin_receive (void *cls,
const struct GNUNET_PeerIdentity *peer,
const struct GNUNET_MessageHeader *message,
- struct Session *session,
+ struct GNUNET_ATS_Session *session,
const char *sender_address,
uint16_t sender_address_len);
int
-client_disconnect (struct Session *s);
+client_disconnect (struct GNUNET_ATS_Session *s);
int
-client_connect (struct Session *s);
+client_connect (struct GNUNET_ATS_Session *s);
int
-client_send (struct Session *s, struct HTTP_Message *msg);
+client_send (struct GNUNET_ATS_Session *s, struct HTTP_Message *msg);
int
int
-server_disconnect (struct Session *s);
+server_disconnect (struct GNUNET_ATS_Session *s);
int
-server_send (struct Session *s, struct HTTP_Message *msg);
+server_send (struct GNUNET_ATS_Session *s, struct HTTP_Message *msg);
int
void
notify_session_end (void *cls,
const struct GNUNET_PeerIdentity *peer,
- struct Session *s);
+ struct GNUNET_ATS_Session *s);
/*#ifndef PLUGIN_TRANSPORT_HTTP_H*/
/**
* Session handle for HTTP(S) connections.
*/
-struct Session;
+struct GNUNET_ATS_Session;
/**
/**
* The related session
*/
- struct Session *s;
+ struct GNUNET_ATS_Session *s;
};
/**
* Session handle for connections.
*/
-struct Session
+struct GNUNET_ATS_Session
{
/**
* The URL to connect to
* @return #GNUNET_OK on success, #GNUNET_SYSERR on error
*/
static int
-http_client_plugin_session_disconnect (void *cls, struct Session *s);
+http_client_plugin_session_disconnect (void *cls, struct GNUNET_ATS_Session *s);
/**
*/
static void
notify_session_monitor (struct HTTP_Client_Plugin *plugin,
- struct Session *session,
+ struct GNUNET_ATS_Session *session,
enum GNUNET_TRANSPORT_SessionState state)
{
struct GNUNET_TRANSPORT_SessionInfo info;
* @param s the session to delete
*/
static void
-client_delete_session (struct Session *s)
+client_delete_session (struct GNUNET_ATS_Session *s)
{
struct HTTP_Client_Plugin *plugin = s->plugin;
struct HTTP_Message *pos;
* @param s the session
*/
static void
-client_reschedule_session_timeout (struct Session *s)
+client_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);
* @return #GNUNET_OK on success, #GNUNET_SYSERR otherwise
*/
static int
-client_connect_get (struct Session *s);
+client_connect_get (struct GNUNET_ATS_Session *s);
/**
* @return #GNUNET_SYSERR for hard failure, #GNUNET_OK for success
*/
static int
-client_connect_put (struct Session *s);
+client_connect_put (struct GNUNET_ATS_Session *s);
/**
*/
static ssize_t
http_client_plugin_send (void *cls,
- struct Session *s,
+ struct GNUNET_ATS_Session *s,
const char *msgbuf,
size_t msgbuf_size,
unsigned int priority,
*/
static int
http_client_plugin_session_disconnect (void *cls,
- struct Session *s)
+ struct GNUNET_ATS_Session *s)
{
struct HTTP_Client_Plugin *plugin = cls;
*
* @param cls the `struct HTTP_Client_Plugin *`
* @param peer identity of the peer
- * @param value the `struct Session *`
+ * @param value the `struct GNUNET_ATS_Session *`
* @return #GNUNET_OK (continue iterating)
*/
static int
void *value)
{
struct HTTP_Client_Plugin *plugin = cls;
- struct Session *session = value;
+ struct GNUNET_ATS_Session *session = value;
http_client_plugin_session_disconnect (plugin, session);
return GNUNET_OK;
/**
* Closure for #session_lookup_client_by_address().
*/
-struct SessionClientCtx
+struct GNUNET_ATS_SessionClientCtx
{
/**
* Address we are looking for.
/**
* Session that was found.
*/
- struct Session *ret;
+ struct GNUNET_ATS_Session *ret;
};
/**
* Locate the seession object for a given address.
*
- * @param cls the `struct SessionClientCtx *`
+ * @param cls the `struct GNUNET_ATS_SessionClientCtx *`
* @param key peer identity
- * @param value the `struct Session` to check
+ * @param value the `struct GNUNET_ATS_Session` to check
* @return #GNUNET_NO if found, #GNUNET_OK if not
*/
static int
const struct GNUNET_PeerIdentity *key,
void *value)
{
- struct SessionClientCtx *sc_ctx = cls;
- struct Session *s = value;
+ struct GNUNET_ATS_SessionClientCtx *sc_ctx = cls;
+ struct GNUNET_ATS_Session *s = value;
if (0 == GNUNET_HELLO_address_cmp (sc_ctx->address,
s->address))
* @param address the address
* @return the session or NULL
*/
-static struct Session *
+static struct GNUNET_ATS_Session *
client_lookup_session (struct HTTP_Client_Plugin *plugin,
const struct GNUNET_HELLO_Address *address)
{
- struct SessionClientCtx sc_ctx;
+ struct GNUNET_ATS_SessionClientCtx sc_ctx;
sc_ctx.address = address;
sc_ctx.ret = NULL;
* after a while (so that gnurl stops asking). This task
* is the delayed task that actually disconnects the PUT.
*
- * @param cls the `struct Session *` with the put
+ * @param cls the `struct GNUNET_ATS_Session *` with the put
* @param tc scheduler context
*/
static void
client_put_disconnect (void *cls,
const struct GNUNET_SCHEDULER_TaskContext *tc)
{
- struct Session *s = cls;
+ struct GNUNET_ATS_Session *s = cls;
s->put_disconnect_task = NULL;
LOG (GNUNET_ERROR_TYPE_DEBUG,
* @param stream pointer where to write data
* @param size size of an individual element
* @param nmemb count of elements that can be written to the buffer
- * @param cls our `struct Session`
+ * @param cls our `struct GNUNET_ATS_Session`
* @return bytes written to stream, returning 0 will terminate request!
*/
static size_t
size_t nmemb,
void *cls)
{
- struct Session *s = cls;
+ struct GNUNET_ATS_Session *s = cls;
struct HTTP_Client_Plugin *plugin = s->plugin;
struct HTTP_Message *msg = s->msg_head;
size_t len;
client_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))
void *client,
const struct GNUNET_MessageHeader *message)
{
- struct Session *s = cls;
+ struct GNUNET_ATS_Session *s = cls;
struct HTTP_Client_Plugin *plugin;
struct GNUNET_TIME_Relative delay;
char *stat_txt;
size_t nmemb,
void *cls)
{
- struct Session *s = cls;
+ struct GNUNET_ATS_Session *s = cls;
struct GNUNET_TIME_Absolute now;
size_t len = size * nmemb;
while (NULL != (msg = curl_multi_info_read (plugin->curl_multi_handle, &msgs_left)))
{
CURL *easy_h = msg->easy_handle;
- struct Session *s = NULL;
+ struct GNUNET_ATS_Session *s = NULL;
char *d = NULL; /* curl requires 'd' to be a 'char *' */
GNUNET_assert (NULL != easy_h);
/* Obtain session from easy handle */
GNUNET_assert (CURLE_OK == curl_easy_getinfo (easy_h, CURLINFO_PRIVATE, &d));
- s = (struct Session *) d;
+ s = (struct GNUNET_ATS_Session *) d;
GNUNET_assert (NULL != s);
if (msg->msg != CURLMSG_DONE)
/**
* Open TCP socket with TCP STEALTH enabled.
*
- * @param clientp our `struct Session *`
+ * @param clientp our `struct GNUNET_ATS_Session *`
* @param purpose why does curl want to open a socket
* @param address what kind of socket does curl want to have opened?
* @return opened socket
curlsocktype purpose,
struct curl_sockaddr *address)
{
- struct Session *s = clientp;
+ struct GNUNET_ATS_Session *s = clientp;
int ret;
switch (purpose)
* @return #GNUNET_OK on success, #GNUNET_SYSERR otherwise
*/
static int
-client_connect_get (struct Session *s)
+client_connect_get (struct GNUNET_ATS_Session *s)
{
CURLMcode mret;
struct HttpAddress *ha;
* @return #GNUNET_SYSERR for hard failure, #GNUNET_OK for ok
*/
static int
-client_connect_put (struct Session *s)
+client_connect_put (struct GNUNET_ATS_Session *s)
{
CURLMcode mret;
struct HttpAddress *ha;
* @return #GNUNET_OK on success, #GNUNET_SYSERR otherwise
*/
static int
-client_connect (struct Session *s)
+client_connect (struct GNUNET_ATS_Session *s)
{
struct HTTP_Client_Plugin *plugin = s->plugin;
int res = GNUNET_OK;
*/
static enum GNUNET_ATS_Network_Type
http_client_plugin_get_network (void *cls,
- struct Session *session)
+ struct GNUNET_ATS_Session *session)
{
return session->scope;
}
/**
* Session was idle, so disconnect it
*
- * @param cls the `struct Session` of the idle session
+ * @param cls the `struct GNUNET_ATS_Session` of the idle session
* @param tc scheduler context
*/
static void
client_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 address the address
* @return the session or NULL of max connections exceeded
*/
-static struct Session *
+static struct GNUNET_ATS_Session *
http_client_plugin_get_session (void *cls,
const struct GNUNET_HELLO_Address *address)
{
struct HTTP_Client_Plugin *plugin = cls;
- struct Session *s;
+ struct GNUNET_ATS_Session *s;
struct sockaddr *sa;
enum GNUNET_ATS_Network_Type net_type;
size_t salen = 0;
return NULL;
}
- s = GNUNET_new (struct Session);
+ s = GNUNET_new (struct GNUNET_ATS_Session);
s->plugin = plugin;
s->address = GNUNET_HELLO_address_copy (address);
s->scope = net_type;
static void
http_client_plugin_update_session_timeout (void *cls,
const struct GNUNET_PeerIdentity *peer,
- struct Session *session)
+ struct GNUNET_ATS_Session *session)
{
client_reschedule_session_timeout (session);
}
static void
http_client_plugin_update_inbound_delay (void *cls,
const struct GNUNET_PeerIdentity *peer,
- struct Session *s,
+ struct GNUNET_ATS_Session *s,
struct GNUNET_TIME_Relative delay)
{
s->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_Client_Plugin *plugin = cls;
- struct Session *session = value;
+ struct GNUNET_ATS_Session *session = value;
notify_session_monitor (plugin,
session,
* 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;
*/
static enum GNUNET_ATS_Network_Type
http_server_plugin_get_network (void *cls,
- struct Session *session)
+ struct GNUNET_ATS_Session *session)
{
return session->scope;
}
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,
/**
* Session handle for TCP connections.
*/
-struct Session
+struct GNUNET_ATS_Session
{
/**
* To whom are we talking to (set to our identity
*/
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;
* @param client which client to find the session handle for
* @return NULL if no matching session exists
*/
-static struct Session *
+static struct GNUNET_ATS_Session *
lookup_session_by_client (struct Plugin *plugin,
struct GNUNET_SERVER_Client *client)
{
return GNUNET_SERVER_client_get_user_context (client,
- struct Session);
+ struct GNUNET_ATS_Session);
}
*/
static int
tcp_plugin_disconnect_session (void *cls,
- struct Session *session)
+ struct GNUNET_ATS_Session *session)
{
struct Plugin *plugin = cls;
struct PendingMessage *pm;
/**
* Session was idle for too long, so disconnect it
*
- * @param cls the `struct Session` of the idle session
+ * @param cls the `struct GNUNET_ATS_Session` of the idle session
* @param tc scheduler context
*/
static void
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 session to increment timeout for
*/
static void
-reschedule_session_timeout (struct Session *s)
+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);
* the session
* @return new session object
*/
-static struct Session *
+static struct GNUNET_ATS_Session *
create_session (struct Plugin *plugin,
const struct GNUNET_HELLO_Address *address,
enum GNUNET_ATS_Network_Type scope,
struct GNUNET_SERVER_Client *client,
int is_nat)
{
- struct Session *session;
+ struct GNUNET_ATS_Session *session;
struct PendingMessage *pm;
if (GNUNET_YES != is_nat)
tcp_plugin_address_to_string (plugin,
address->address,
address->address_length));
- session = GNUNET_new (struct Session);
+ session = GNUNET_new (struct GNUNET_ATS_Session);
session->last_activity = GNUNET_TIME_absolute_get ();
session->plugin = plugin;
session->is_nat = is_nat;
* @param session for which session should we do this
*/
static void
-process_pending_messages (struct Session *session);
+process_pending_messages (struct GNUNET_ATS_Session *session);
/**
size_t size,
void *buf)
{
- struct Session *session = cls;
+ struct GNUNET_ATS_Session *session = cls;
struct GNUNET_PeerIdentity pid;
struct Plugin *plugin;
struct PendingMessage *pos;
* @param session for which session should we do this
*/
static void
-process_pending_messages (struct Session *session)
+process_pending_messages (struct GNUNET_ATS_Session *session)
{
struct PendingMessage *pm;
*/
static ssize_t
tcp_plugin_send (void *cls,
- struct Session *session,
+ struct GNUNET_ATS_Session *session,
const char *msgbuf,
size_t msgbuf_size,
unsigned int priority,
/**
* Closure for #session_lookup_it().
*/
-struct SessionItCtx
+struct GNUNET_ATS_SessionItCtx
{
/**
* Address we are looking for.
/**
* Where to store the session (if we found it).
*/
- struct Session *result;
+ struct GNUNET_ATS_Session *result;
};
/**
* Look for a session by address.
*
- * @param cls the `struct SessionItCtx`
+ * @param cls the `struct GNUNET_ATS_SessionItCtx`
* @param key unused
- * @param value a `struct Session`
+ * @param value a `struct GNUNET_ATS_Session`
* @return #GNUNET_YES to continue looking, #GNUNET_NO if we found the session
*/
static int
const struct GNUNET_PeerIdentity *key,
void *value)
{
- struct SessionItCtx *si_ctx = cls;
- struct Session *session = value;
+ struct GNUNET_ATS_SessionItCtx *si_ctx = cls;
+ struct GNUNET_ATS_Session *session = value;
if (0 !=
GNUNET_HELLO_address_cmp (si_ctx->address,
/**
* Task cleaning up a NAT connection attempt after timeout
*
- * @param cls the `struct Session`
+ * @param cls the `struct GNUNET_ATS_Session`
* @param tc scheduler context (unused)
*/
static void
nat_connect_timeout (void *cls,
const struct GNUNET_SCHEDULER_TaskContext *tc)
{
- struct Session *session = cls;
+ struct GNUNET_ATS_Session *session = cls;
session->nat_connection_timeout = NULL;
LOG (GNUNET_ERROR_TYPE_DEBUG,
static void
tcp_plugin_update_session_timeout (void *cls,
const struct GNUNET_PeerIdentity *peer,
- struct Session *session)
+ struct GNUNET_ATS_Session *session)
{
reschedule_session_timeout (session);
}
* Task to signal the server that we can continue
* receiving from the TCP client now.
*
- * @param cls the `struct Session *`
+ * @param cls the `struct GNUNET_ATS_Session *`
* @param tc task context (unused)
*/
static void
delayed_done (void *cls,
const struct GNUNET_SCHEDULER_TaskContext *tc)
{
- struct Session *session = cls;
+ struct GNUNET_ATS_Session *session = cls;
session->receive_delay_task = NULL;
reschedule_session_timeout (session);
static void
tcp_plugin_update_inbound_delay (void *cls,
const struct GNUNET_PeerIdentity *peer,
- struct Session *session,
+ struct GNUNET_ATS_Session *session,
struct GNUNET_TIME_Relative delay)
{
if (NULL == session->receive_delay_task)
* @param address the address to use
* @return the session if the address is valid, NULL otherwise
*/
-static struct Session *
+static struct GNUNET_ATS_Session *
tcp_plugin_get_session (void *cls,
const struct GNUNET_HELLO_Address *address)
{
struct Plugin *plugin = cls;
- struct Session *session = NULL;
+ struct GNUNET_ATS_Session *session = NULL;
int af;
const void *sb;
size_t sbs;
GNUNET_CONTAINER_multipeermap_contains (plugin->sessionmap,
&address->peer))
{
- struct SessionItCtx si_ctx;
+ struct GNUNET_ATS_SessionItCtx si_ctx;
si_ctx.address = address;
si_ctx.result = NULL;
*
* @param cls the `struct Plugin *`
* @param key the peer which the session belongs to (unused)
- * @param value the `struct Session`
+ * @param value the `struct GNUNET_ATS_Session`
* @return #GNUNET_YES (continue to iterate)
*/
static int
void *value)
{
struct Plugin *plugin = cls;
- struct Session *session = value;
+ struct GNUNET_ATS_Session *session = value;
GNUNET_STATISTICS_update (session->plugin->env->stats,
gettext_noop ("# transport-service disconnect requests for TCP"),
const struct GNUNET_MessageHeader *message)
{
struct Plugin *plugin = cls;
- struct Session *session;
+ struct GNUNET_ATS_Session *session;
const struct TCP_NAT_ProbeMessage *tcp_nat_probe;
size_t alen;
void *vaddr;
struct Plugin *plugin = cls;
const struct WelcomeMessage *wm = (const struct WelcomeMessage *) message;
struct GNUNET_HELLO_Address *address;
- struct Session *session;
+ struct GNUNET_ATS_Session *session;
size_t alen;
void *vaddr;
struct IPv4TcpAddress t4;
const struct GNUNET_MessageHeader *message)
{
struct Plugin *plugin = cls;
- struct Session *session;
+ struct GNUNET_ATS_Session *session;
struct GNUNET_TIME_Relative delay;
uint16_t type;
struct GNUNET_SERVER_Client *client)
{
struct Plugin *plugin = cls;
- struct Session *session;
+ struct GNUNET_ATS_Session *session;
if (NULL == client)
return;
*/
static enum GNUNET_ATS_Network_Type
tcp_plugin_get_network (void *cls,
- struct Session *session)
+ struct GNUNET_ATS_Session *session)
{
return session->scope;
}
*
* @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,
/**
* 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 */
* @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,
/**
* Session with another peer.
*/
-struct Session
+struct GNUNET_ATS_Session
{
/**
* Which peer is this session for?
/**
* The session this fragmentation context belongs to
*/
- struct Session *session;
+ struct GNUNET_ATS_Session *session;
/**
* Function to call upon completion of the transmission.
/**
* Session this message belongs to
*/
- struct Session *session;
+ struct GNUNET_ATS_Session *session;
/**
* DLL of messages, previous element
*/
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;
*
* @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,
* @param s session to free
*/
static void
-free_session (struct Session *s)
+free_session (struct GNUNET_ATS_Session *s)
{
if (NULL != s->address)
{
*/
static enum GNUNET_ATS_Network_Type
udp_plugin_get_network (void *cls,
- struct Session *session)
+ struct GNUNET_ATS_Session *session)
{
return session->scope;
}
/**
* Closure for #session_cmp_it().
*/
-struct SessionCompareContext
+struct GNUNET_ATS_SessionCompareContext
{
/**
* Set to session matching the address.
*/
- struct Session *res;
+ struct GNUNET_ATS_Session *res;
/**
* Address we are looking for.
/**
* Find a session with a matching address.
*
- * @param cls the `struct SessionCompareContext *`
+ * @param cls the `struct GNUNET_ATS_SessionCompareContext *`
* @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 SessionCompareContext *cctx = cls;
- struct Session *s = value;
+ struct GNUNET_ATS_SessionCompareContext *cctx = cls;
+ struct GNUNET_ATS_Session *s = value;
if (0 == GNUNET_HELLO_address_cmp (s->address,
cctx->address))
* @param address the address we should locate the session by
* @return the session if it exists, or NULL if it is not found
*/
-static struct Session *
+static struct GNUNET_ATS_Session *
udp_plugin_lookup_session (void *cls,
const struct GNUNET_HELLO_Address *address)
{
struct Plugin *plugin = cls;
const struct IPv6UdpAddress *udp_a6;
const struct IPv4UdpAddress *udp_a4;
- struct SessionCompareContext cctx;
+ struct GNUNET_ATS_SessionCompareContext cctx;
if (NULL == address->address)
{
* @param s session to reschedule timeout activity for
*/
static void
-reschedule_session_timeout (struct Session *s)
+reschedule_session_timeout (struct GNUNET_ATS_Session *s)
{
if (GNUNET_YES == s->in_destroy)
return;
static void
udp_plugin_update_session_timeout (void *cls,
const struct GNUNET_PeerIdentity *peer,
- struct Session *session)
+ struct GNUNET_ATS_Session *session)
{
struct Plugin *plugin = cls;
dequeue (struct Plugin *plugin,
struct UDP_MessageWrapper *udpw)
{
- struct Session *session = udpw->session;
+ struct GNUNET_ATS_Session *session = udpw->session;
if (plugin->bytes_in_buffer < udpw->msg_size)
{
enqueue (struct Plugin *plugin,
struct UDP_MessageWrapper *udpw)
{
- struct Session *session = udpw->session;
+ struct GNUNET_ATS_Session *session = udpw->session;
if (GNUNET_YES == session->in_destroy)
{
int result)
{
struct Plugin *plugin = frag_ctx->plugin;
- struct Session *s = frag_ctx->session;
+ struct GNUNET_ATS_Session *s = frag_ctx->session;
struct UDP_MessageWrapper *udpw;
struct UDP_MessageWrapper *tmp;
size_t overhead;
struct UDP_FragmentationContext *frag_ctx = cls;
struct Plugin *plugin = frag_ctx->plugin;
struct UDP_MessageWrapper *udpw;
- struct Session *session = frag_ctx->session;
+ struct GNUNET_ATS_Session *session = frag_ctx->session;
size_t msg_len = ntohs (msg->size);
LOG (GNUNET_ERROR_TYPE_DEBUG,
*/
static ssize_t
udp_plugin_send (void *cls,
- struct Session *s,
+ struct GNUNET_ATS_Session *s,
const char *msgbuf,
size_t msgbuf_size,
unsigned int priority,
const struct GNUNET_MessageHeader *ack;
const struct UDP_ACK_Message *udp_ack;
struct GNUNET_HELLO_Address *address;
- struct Session *s;
+ struct GNUNET_ATS_Session *s;
struct GNUNET_TIME_Relative flow_delay;
if (ntohs (msg->size)
/**
* Session associated with this context.
*/
- struct Session *session;
+ struct GNUNET_ATS_Session *session;
/**
* Address to find.
* to the service.
*
* @param cls the `struct Plugin *`
- * @param client the `struct Session *`
+ * @param client the `struct GNUNET_ATS_Session *`
* @param hdr the actual message
* @return #GNUNET_OK (always)
*/
const struct GNUNET_MessageHeader *hdr)
{
struct Plugin *plugin = cls;
- struct Session *session = client;
+ struct GNUNET_ATS_Session *session = client;
if (GNUNET_YES == session->in_destroy)
return GNUNET_OK;
*/
static int
udp_disconnect_session (void *cls,
- struct Session *s)
+ struct GNUNET_ATS_Session *s)
{
struct Plugin *plugin = cls;
struct UDP_MessageWrapper *udpw;
/**
* Session was idle, so disconnect it.
*
- * @param cls the `struct Session` to time out
+ * @param cls the `struct GNUNET_ATS_Session` to time out
* @param tc scheduler context
*/
static void
session_timeout (void *cls,
const struct GNUNET_SCHEDULER_TaskContext *tc)
{
- struct Session *s = cls;
+ struct GNUNET_ATS_Session *s = cls;
struct Plugin *plugin = s->plugin;
struct GNUNET_TIME_Relative left;
* @param network_type network type the address belongs to
* @return NULL on error, otherwise session handle
*/
-static struct Session *
+static struct GNUNET_ATS_Session *
udp_plugin_create_session (void *cls,
const struct GNUNET_HELLO_Address *address,
enum GNUNET_ATS_Network_Type network_type)
{
struct Plugin *plugin = cls;
- struct Session *s;
+ struct GNUNET_ATS_Session *s;
- s = GNUNET_new (struct Session);
+ s = GNUNET_new (struct GNUNET_ATS_Session);
s->plugin = plugin;
s->address = GNUNET_HELLO_address_copy (address);
s->target = address->peer;
* @param address the address
* @return the session or NULL of max connections exceeded
*/
-static struct Session *
+static struct GNUNET_ATS_Session *
udp_plugin_get_session (void *cls,
const struct GNUNET_HELLO_Address *address)
{
struct Plugin *plugin = cls;
- struct Session *s;
+ struct GNUNET_ATS_Session *s;
enum GNUNET_ATS_Network_Type network_type = GNUNET_ATS_NET_UNSPECIFIED;
const struct IPv4UdpAddress *udp_v4;
const struct IPv6UdpAddress *udp_v6;
size_t udp_addr_len,
enum GNUNET_ATS_Network_Type network_type)
{
- struct Session *s;
+ struct GNUNET_ATS_Session *s;
struct GNUNET_HELLO_Address *address;
GNUNET_break (GNUNET_ATS_NET_UNSPECIFIED != network_type);
struct UDP_ACK_Message *udp_ack;
uint32_t delay;
struct UDP_MessageWrapper *udpw;
- struct Session *s;
+ struct GNUNET_ATS_Session *s;
struct GNUNET_HELLO_Address *address;
if (GNUNET_NO == rc->have_sender)
{
struct UDP_MessageWrapper *udpw;
struct GNUNET_TIME_Relative remaining;
- struct Session *session;
+ struct GNUNET_ATS_Session *session;
int removed;
removed = GNUNET_NO;
/**
* Session of peers with whom we are currently connected,
- * map of peer identity to `struct Session *`.
+ * map of peer identity to `struct GNUNET_ATS_Session *`.
*/
struct GNUNET_CONTAINER_MultiPeerMap *sessions;
/**
* Session this message belongs to.
*/
- struct Session *session;
+ struct GNUNET_ATS_Session *session;
/**
* Function to call upon transmission.
/**
* Handle for a session.
*/
-struct Session
+struct GNUNET_ATS_Session
{
/**
* Sessions with pending messages (!) are kept in a DLL.
*/
- struct Session *next;
+ struct GNUNET_ATS_Session *next;
/**
* Sessions with pending messages (!) are kept in a DLL.
*/
- struct Session *prev;
+ struct GNUNET_ATS_Session *prev;
/**
* To whom are we talking to (set to our identity
struct GNUNET_TRANSPORT_PluginEnvironment *env;
/**
- * Sessions (map from peer identity to `struct Session`)
+ * Sessions (map from peer identity to `struct GNUNET_ATS_Session`)
*/
struct GNUNET_CONTAINER_MultiPeerMap *session_map;
*/
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 int
unix_plugin_session_disconnect (void *cls,
- struct Session *session)
+ struct GNUNET_ATS_Session *session)
{
struct Plugin *plugin = cls;
struct UNIXMessageWrapper *msgw;
/**
* Session was idle for too long, so disconnect it
*
- * @param cls the `struct Session *` to disconnect
+ * @param cls the `struct GNUNET_ATS_Session *` to disconnect
* @param tc scheduler context
*/
static void
session_timeout (void *cls,
const struct GNUNET_SCHEDULER_TaskContext *tc)
{
- struct Session *session = cls;
+ struct GNUNET_ATS_Session *session = cls;
struct GNUNET_TIME_Relative left;
session->timeout_task = NULL;
* @param session session for which the timeout should be rescheduled
*/
static void
-reschedule_session_timeout (struct Session *session)
+reschedule_session_timeout (struct GNUNET_ATS_Session *session)
{
GNUNET_assert (NULL != session->timeout_task);
session->timeout = GNUNET_TIME_relative_to_absolute (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT);
/**
* Location to store the session, if found.
*/
- struct Session *res;
+ struct GNUNET_ATS_Session *res;
/**
* Address we are looking for.
void *value)
{
struct LookupCtx *lctx = cls;
- struct Session *session = value;
+ struct GNUNET_ATS_Session *session = value;
if (0 == GNUNET_HELLO_address_cmp (lctx->address,
session->address))
* @param address the address to find
* @return NULL if session was not found
*/
-static struct Session *
+static struct GNUNET_ATS_Session *
lookup_session (struct Plugin *plugin,
const struct GNUNET_HELLO_Address *address)
{
*/
static enum GNUNET_ATS_Network_Type
unix_plugin_get_network (void *cls,
- struct Session *session)
+ struct GNUNET_ATS_Session *session)
{
GNUNET_assert (NULL != session);
return GNUNET_ATS_NET_LOOPBACK;
* @param address the address
* @return the session or NULL of max connections exceeded
*/
-static struct Session *
+static struct GNUNET_ATS_Session *
unix_plugin_get_session (void *cls,
const struct GNUNET_HELLO_Address *address)
{
struct Plugin *plugin = cls;
- struct Session *session;
+ struct GNUNET_ATS_Session *session;
struct UnixAddress *ua;
char * addrstr;
uint32_t addr_str_len;
}
/* create a new session */
- session = GNUNET_new (struct Session);
+ session = GNUNET_new (struct GNUNET_ATS_Session);
session->target = address->peer;
session->address = GNUNET_HELLO_address_copy (address);
session->plugin = plugin;
static void
unix_plugin_update_session_timeout (void *cls,
const struct GNUNET_PeerIdentity *peer,
- struct Session *session)
+ struct GNUNET_ATS_Session *session)
{
struct Plugin *plugin = cls;
const struct UnixAddress *ua,
size_t ua_len)
{
- struct Session *session;
+ struct GNUNET_ATS_Session *session;
struct GNUNET_HELLO_Address *address;
GNUNET_assert (ua_len >= sizeof (struct UnixAddress));
{
ssize_t sent = 0;
struct UNIXMessageWrapper *msgw;
- struct Session *session;
+ struct GNUNET_ATS_Session *session;
int did_delete;
session = NULL;
*/
static ssize_t
unix_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 plugin
* @param key peer identity (unused)
- * @param value the `struct Session *` to disconnect
+ * @param value the `struct GNUNET_ATS_Session *` to disconnect
* @return #GNUNET_YES (always, continue to iterate)
*/
static int
void *value)
{
struct Plugin *plugin = cls;
- struct Session *session = value;
+ struct GNUNET_ATS_Session *session = value;
unix_plugin_session_disconnect (plugin, session);
return GNUNET_YES;
*
* @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,
struct UNIXMessageWrapper * msgw;
struct UnixAddress *ua;
size_t len;
- struct Session *session;
+ struct GNUNET_ATS_Session *session;
if (NULL == plugin)
{
/**
* Session handle for connections with other peers.
*/
-struct Session
+struct GNUNET_ATS_Session
{
/**
* To whom are we talking to (set to our identity
* We keep all sessions in a DLL at their respective
* `struct MACEndpoint *`.
*/
- struct Session *next;
+ struct GNUNET_ATS_Session *next;
/**
* We keep all sessions in a DLL at their respective
* `struct MACEndpoint *`.
*/
- struct Session *prev;
+ struct GNUNET_ATS_Session *prev;
/**
* MAC endpoint with the address of this peer.
/**
* Head of sessions that use this MAC.
*/
- struct Session *sessions_head;
+ struct GNUNET_ATS_Session *sessions_head;
/**
* Tail of sessions that use this MAC.
*/
- struct Session *sessions_tail;
+ struct GNUNET_ATS_Session *sessions_tail;
/**
* Head of messages we are currently sending to this MAC.
/**
* NULL if the identity of the other peer is not known.
*/
- struct Session *session;
+ struct GNUNET_ATS_Session *session;
/**
* MAC address of the other peer, NULL if not known.
*/
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 int
wlan_plugin_disconnect_session (void *cls,
- struct Session *session)
+ struct GNUNET_ATS_Session *session)
{
struct MacEndpoint *endpoint = session->mac;
struct Plugin *plugin = endpoint->plugin;
session_timeout (void *cls,
const struct GNUNET_SCHEDULER_TaskContext *tc)
{
- struct Session *session = cls;
+ struct GNUNET_ATS_Session *session = cls;
struct GNUNET_TIME_Relative left;
session->timeout_task = NULL;
* @param peer peer identity to use for this session
* @return returns the session or NULL
*/
-static struct Session *
+static struct GNUNET_ATS_Session *
lookup_session (struct MacEndpoint *endpoint,
const struct GNUNET_PeerIdentity *peer)
{
- struct Session *session;
+ struct GNUNET_ATS_Session *session;
for (session = endpoint->sessions_head; NULL != session; session = session->next)
if (0 == memcmp (peer, &session->target, sizeof (struct GNUNET_PeerIdentity)))
* @param peer peer identity to use for this session
* @return returns the session or NULL
*/
-static struct Session *
+static struct GNUNET_ATS_Session *
create_session (struct MacEndpoint *endpoint,
const struct GNUNET_PeerIdentity *peer)
{
- struct Session *session;
+ struct GNUNET_ATS_Session *session;
GNUNET_STATISTICS_update (endpoint->plugin->env->stats,
_("# Sessions allocated"),
1,
GNUNET_NO);
- session = GNUNET_new (struct Session);
+ session = GNUNET_new (struct GNUNET_ATS_Session);
GNUNET_CONTAINER_DLL_insert_tail (endpoint->sessions_head,
endpoint->sessions_tail,
session);
* @param peer peer identity to use for this session
* @return returns the session
*/
-static struct Session *
+static struct GNUNET_ATS_Session *
get_session (struct MacEndpoint *endpoint,
const struct GNUNET_PeerIdentity *peer)
{
- struct Session *session;
+ struct GNUNET_ATS_Session *session;
if (NULL != (session = lookup_session (endpoint, peer)))
return session;
{
struct Plugin *plugin = endpoint->plugin;
struct FragmentMessage *fm;
- struct Session *session;
+ struct GNUNET_ATS_Session *session;
GNUNET_STATISTICS_update (plugin->env->stats,
_("# MAC endpoints allocated"),
*/
static enum GNUNET_ATS_Network_Type
wlan_plugin_get_network (void *cls,
- struct Session *session)
+ struct GNUNET_ATS_Session *session)
{
#if BUILD_WLAN
return GNUNET_ATS_NET_WLAN;
* @param address the address
* @return the session or NULL of max connections exceeded
*/
-static struct Session *
+static struct GNUNET_ATS_Session *
wlan_plugin_get_session (void *cls,
const struct GNUNET_HELLO_Address *address)
{
const struct GNUNET_PeerIdentity *target)
{
struct Plugin *plugin = cls;
- struct Session *session;
+ struct GNUNET_ATS_Session *session;
struct MacEndpoint *endpoint;
for (endpoint = plugin->mac_head; NULL != endpoint; endpoint = endpoint->next)
*/
static ssize_t
wlan_plugin_send (void *cls,
- struct Session *session,
+ struct GNUNET_ATS_Session *session,
const char *msgbuf, size_t msgbuf_size,
unsigned int priority,
struct GNUNET_TIME_Relative to,
{
struct Plugin *plugin = cls;
struct MacEndpoint *mac;
- struct Session *session;
+ struct GNUNET_ATS_Session *session;
plugin->sic = sic;
plugin->sic_cls = sic_cls;
static void
wlan_plugin_update_session_timeout (void *cls,
const struct GNUNET_PeerIdentity *peer,
- struct Session *session)
+ struct GNUNET_ATS_Session *session)
{
GNUNET_assert (NULL != session->timeout_task);
session->timeout = GNUNET_TIME_relative_to_absolute (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT);
static void
wlan_plugin_update_inbound_delay (void *cls,
const struct GNUNET_PeerIdentity *peer,
- struct Session *session,
+ struct GNUNET_ATS_Session *session,
struct GNUNET_TIME_Relative delay)
{
/* does nothing, as inbound delay is not supported by WLAN */
static struct GNUNET_TIME_Relative
env_receive (void *cls,
const struct GNUNET_HELLO_Address *address,
- struct Session *session,
+ struct GNUNET_ATS_Session *session,
const struct GNUNET_MessageHeader *message)
{
/* do nothing */
static void
env_session_end (void *cls,
const struct GNUNET_HELLO_Address *address,
- struct Session *session)
+ struct GNUNET_ATS_Session *session)
{
}
/**
* Abstract representation of a plugin's session.
- * Corresponds to the `struct Session` within the TRANSPORT service.
+ * Corresponds to the `struct GNUNET_ATS_Session` within the TRANSPORT service.
*/
struct GNUNET_TRANSPORT_PluginSession
{