This file is part of GNUnet
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
- by the Free Software Foundation; either version 3, or (at your
- option) any later version.
+ GNUnet is free software: you can redistribute it and/or modify it
+ under the terms of the GNU Affero General Public License as published
+ by the Free Software Foundation, either version 3 of the License,
+ or (at your option) any later version.
GNUnet is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
+ Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
- 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., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
+ SPDX-License-Identifier: AGPL3.0-or-later
*/
/**
/**
* Message stream tokenizer for incoming data
*/
- struct GNUNET_SERVER_MessageStreamTokenizer *msg_tk;
+ struct GNUNET_MessageStreamTokenizer *msg_tk;
/**
* Session timeout task
*/
- struct GNUNET_SCHEDULER_Task * put_disconnect_task;
+ struct GNUNET_SCHEDULER_Task *put_disconnect_task;
/**
* Session timeout task
*/
- struct GNUNET_SCHEDULER_Task * timeout_task;
+ struct GNUNET_SCHEDULER_Task *timeout_task;
/**
* Task to wake up client receive handle when receiving is allowed again
*/
- struct GNUNET_SCHEDULER_Task * recv_wakeup_task;
+ struct GNUNET_SCHEDULER_Task *recv_wakeup_task;
/**
* Absolute time when to receive data again.
/**
* ATS network type.
*/
- enum GNUNET_ATS_Network_Type scope;
+ enum GNUNET_NetworkType scope;
};
GNUNET_TRANSPORT_SS_DONE);
if (NULL != s->msg_tk)
{
- GNUNET_SERVER_mst_destroy (s->msg_tk);
+ GNUNET_MST_destroy (s->msg_tk);
s->msg_tk = NULL;
}
GNUNET_HELLO_address_free (s->address);
ttype = "UNSPECIFIED";
break;
}
- memcpy (text, data, size);
+ GNUNET_memcpy (text, data, size);
if (text[size - 1] == '\n')
{
text[size] = '\0';
msg->buf = (char *) &msg[1];
msg->transmit_cont = cont;
msg->transmit_cont_cls = cont_cls;
- memcpy (msg->buf,
+ GNUNET_memcpy (msg->buf,
msgbuf,
msgbuf_size);
GNUNET_CONTAINER_DLL_insert_tail (s->msg_head,
"Session %p/request %p: nothing to send, suspending\n",
s,
s->put.easyhandle);
- s->put_disconnect_task = GNUNET_SCHEDULER_add_delayed (PUT_DISCONNECT_TIMEOUT,
- &client_put_disconnect, s);
+ s->put_disconnect_task
+ = GNUNET_SCHEDULER_add_delayed (PUT_DISCONNECT_TIMEOUT,
+ &client_put_disconnect,
+ s);
s->put.state = H_PAUSED;
return CURL_READFUNC_PAUSE;
}
/* calculate how much fits in buffer */
len = GNUNET_MIN (msg->size - msg->pos,
size * nmemb);
- memcpy (stream, &msg->buf[msg->pos], len);
+ GNUNET_memcpy (stream,
+ &msg->buf[msg->pos],
+ len);
msg->pos += len;
if (msg->pos == msg->size)
{
client_wake_up (void *cls)
{
struct GNUNET_ATS_Session *s = cls;
- const struct GNUNET_SCHEDULER_TaskContext *tc;
s->recv_wakeup_task = NULL;
- tc = GNUNET_SCHEDULER_get_task_context ();
- if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
- return;
LOG (GNUNET_ERROR_TYPE_DEBUG,
"Session %p/request %p: Waking up GET handle\n",
s, s->get.easyhandle);
* Callback for message stream tokenizer
*
* @param cls the session
- * @param client not used
* @param message the message received
* @return always #GNUNET_OK
*/
static int
client_receive_mst_cb (void *cls,
- void *client,
const struct GNUNET_MessageHeader *message)
{
struct GNUNET_ATS_Session *s = cls;
return CURL_WRITEFUNC_PAUSE;
}
if (NULL == s->msg_tk)
- s->msg_tk = GNUNET_SERVER_mst_create (&client_receive_mst_cb,
- s);
- GNUNET_SERVER_mst_receive (s->msg_tk,
- s,
- stream,
- len,
- GNUNET_NO,
- GNUNET_NO);
+ s->msg_tk = GNUNET_MST_create (&client_receive_mst_cb,
+ s);
+ GNUNET_MST_from_buffer (s->msg_tk,
+ stream,
+ len,
+ GNUNET_NO,
+ GNUNET_NO);
return len;
}
CURLMsg *msg;
int put_request; /* GNUNET_YES if easy handle is put, GNUNET_NO for get */
int msgs_left;
- const struct GNUNET_SCHEDULER_TaskContext *tc;
plugin->client_perform_task = NULL;
- tc = GNUNET_SCHEDULER_get_task_context ();
- if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
- return;
-
/* While data are available or timeouts occured */
do
{
CURLOPT_CONNECTTIMEOUT_MS,
(long) (HTTP_CLIENT_NOT_VALIDATED_TIMEOUT.rel_value_us / 1000LL));
curl_easy_setopt (s->get.easyhandle, CURLOPT_BUFFERSIZE,
- 2 * GNUNET_SERVER_MAX_MESSAGE_SIZE);
+ 2 * GNUNET_MAX_MESSAGE_SIZE);
#if CURL_TCP_NODELAY
curl_easy_setopt (ps->recv_endpoint,
CURLOPT_TCP_NODELAY,
CURLOPT_CONNECTTIMEOUT_MS,
(long) (HTTP_CLIENT_NOT_VALIDATED_TIMEOUT.rel_value_us / 1000LL));
curl_easy_setopt (s->put.easyhandle, CURLOPT_BUFFERSIZE,
- 2 * GNUNET_SERVER_MAX_MESSAGE_SIZE);
+ 2 * GNUNET_MAX_MESSAGE_SIZE);
#if CURL_TCP_NODELAY
curl_easy_setopt (s->put.easyhandle, CURLOPT_TCP_NODELAY, 1);
#endif
* @param session the session
* @return the network type
*/
-static enum GNUNET_ATS_Network_Type
+static enum GNUNET_NetworkType
http_client_plugin_get_network (void *cls,
struct GNUNET_ATS_Session *session)
{
* @param address the address
* @return the network type
*/
-static enum GNUNET_ATS_Network_Type
+static enum GNUNET_NetworkType
http_client_plugin_get_network_for_address (void *cls,
const struct GNUNET_HELLO_Address *address)
{
struct HTTP_Client_Plugin *plugin = cls;
struct GNUNET_ATS_Session *s;
struct sockaddr *sa;
- enum GNUNET_ATS_Network_Type net_type;
+ enum GNUNET_NetworkType net_type;
size_t salen = 0;
int res;
}
/* Determine network location */
- net_type = GNUNET_ATS_NET_UNSPECIFIED;
+ net_type = GNUNET_NT_UNSPECIFIED;
sa = http_common_socket_from_address (address->address,
address->address_length,
&res);
else if (GNUNET_NO == res)
{
/* Cannot convert to sockaddr -> is external hostname */
- net_type = GNUNET_ATS_NET_WAN;
+ net_type = GNUNET_NT_WAN;
}
- if (GNUNET_ATS_NET_UNSPECIFIED == net_type)
+ if (GNUNET_NT_UNSPECIFIED == net_type)
{
GNUNET_break (0);
return NULL;
if (s->recv_wakeup_task != NULL)
{
GNUNET_SCHEDULER_cancel (s->recv_wakeup_task);
- s->recv_wakeup_task = GNUNET_SCHEDULER_add_delayed (delay,
- &client_wake_up, s);
+ s->recv_wakeup_task
+ = GNUNET_SCHEDULER_add_delayed (delay,
+ &client_wake_up,
+ s);
}
}