This file is part of GNUnet.
Copyright (C) 2010-2015 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
*/
/**
* @file ats/ats_api_scheduling.c
as we communicate asynchronously with the ATS service. */
return NULL;
}
- if (0 != memcmp (peer,
- &ar->address->peer,
- sizeof (struct GNUNET_PeerIdentity)))
+ if (0 != GNUNET_memcmp (peer,
+ &ar->address->peer))
{
GNUNET_break (0);
return NULL;
static uint32_t off;
uint32_t i;
+ GNUNET_assert (0 != sh->session_array_size);
i = 0;
while ( ( (NOT_FOUND == off) ||
(NULL != sh->session_array[off % sh->session_array_size]) ) &&
(GNUNET_NO == sh->session_array[i]->in_destroy) &&
( (session == sh->session_array[i]->session) ||
(NULL == sh->session_array[i]->session) ) &&
- (0 == memcmp (&address->peer,
- &sh->session_array[i]->address->peer,
- sizeof (struct GNUNET_PeerIdentity))) &&
+ (0 == GNUNET_memcmp (&address->peer,
+ &sh->session_array[i]->address->peer)) &&
(0 == GNUNET_HELLO_address_cmp (address,
sh->session_array[i]->address)) )
return i;
if (NULL == sh->mq)
return; /* disconnected, skip for now */
- GNUNET_break (GNUNET_ATS_NET_UNSPECIFIED != ar->properties.scope);
+ GNUNET_break (GNUNET_NT_UNSPECIFIED != ar->properties.scope);
namelen = strlen (ar->address->transport_name) + 1;
msize = ar->address->address_length + namelen;
ev = GNUNET_MQ_msg_extra (m, msize, GNUNET_MESSAGE_TYPE_ATS_ADDRESS_ADD);
ar->session,
ar->slot);
pm = (char *) &m[1];
- memcpy (pm,
+ GNUNET_memcpy (pm,
ar->address->address,
ar->address->address_length);
if (NULL != ar->address->transport_name)
- memcpy (&pm[ar->address->address_length],
+ GNUNET_memcpy (&pm[ar->address->address_length],
ar->address->transport_name,
namelen);
GNUNET_MQ_send (sh->mq, ev);
static void
reconnect (struct GNUNET_ATS_SchedulingHandle *sh)
{
- GNUNET_MQ_hd_fixed_size (ats_session_release,
- GNUNET_MESSAGE_TYPE_ATS_SESSION_RELEASE,
- struct GNUNET_ATS_SessionReleaseMessage);
- GNUNET_MQ_hd_fixed_size (ats_address_suggestion,
- GNUNET_MESSAGE_TYPE_ATS_ADDRESS_SUGGESTION,
- struct AddressSuggestionMessage);
struct GNUNET_MQ_MessageHandler handlers[] = {
- make_ats_session_release_handler (sh),
- make_ats_address_suggestion_handler (sh),
+ GNUNET_MQ_hd_fixed_size (ats_session_release,
+ GNUNET_MESSAGE_TYPE_ATS_SESSION_RELEASE,
+ struct GNUNET_ATS_SessionReleaseMessage,
+ sh),
+ GNUNET_MQ_hd_fixed_size (ats_address_suggestion,
+ GNUNET_MESSAGE_TYPE_ATS_ADDRESS_SUGGESTION,
+ struct AddressSuggestionMessage,
+ sh),
GNUNET_MQ_handler_end ()
};
struct GNUNET_MQ_Envelope *ev;
struct GNUNET_ATS_AddressRecord *ar;
GNUNET_assert (NULL == sh->mq);
- sh->mq = GNUNET_CLIENT_connecT (sh->cfg,
+ sh->mq = GNUNET_CLIENT_connect (sh->cfg,
"ats",
handlers,
&error_handler,
GNUNET_break (0);
return NULL;
}
- GNUNET_break (GNUNET_ATS_NET_UNSPECIFIED != prop->scope);
+ GNUNET_break (GNUNET_NT_UNSPECIFIED != prop->scope);
namelen = strlen (address->transport_name) + 1;
msize = address->address_length + namelen;
- if ((msize + sizeof (struct AddressUpdateMessage) >= GNUNET_SERVER_MAX_MESSAGE_SIZE) ||
- (address->address_length >= GNUNET_SERVER_MAX_MESSAGE_SIZE) ||
- (namelen >= GNUNET_SERVER_MAX_MESSAGE_SIZE) )
+ if ((msize + sizeof (struct AddressUpdateMessage) >= GNUNET_MAX_MESSAGE_SIZE) ||
+ (address->address_length >= GNUNET_MAX_MESSAGE_SIZE) ||
+ (namelen >= GNUNET_MAX_MESSAGE_SIZE) )
{
/* address too large for us, this should not happen */
GNUNET_break (0);
ar->address->transport_name,
ar->session,
ar->slot);
- GNUNET_break (GNUNET_ATS_NET_UNSPECIFIED != prop->scope);
+ GNUNET_break (GNUNET_NT_UNSPECIFIED != prop->scope);
GNUNET_ATS_properties_hton (&ar->properties,
prop);
if (NULL == sh->mq)