/*
This file is part of GNUnet.
- Copyright (C) 2009, 2015 Christian Grothoff (and other contributing authors)
+ Copyright (C) 2009, 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
#include "gnunet_util_lib.h"
#include "gnunet_transport_plugin.h"
-GNUNET_NETWORK_STRUCT_BEGIN
-
-/**
- * A HELLO message is used to exchange information about
- * transports with other peers. This struct is always
- * followed by the actual network addresses which have
- * the format:
- *
- * 1) transport-name (0-terminated)
- * 2) address-length (uint16_t, network byte order; possibly
- * unaligned!)
- * 3) address expiration (`struct GNUNET_TIME_AbsoluteNBO`); possibly
- * unaligned!)
- * 4) address (address-length bytes; possibly unaligned!)
- */
-struct GNUNET_HELLO_Message
-{
- /**
- * Type will be #GNUNET_MESSAGE_TYPE_HELLO.
- */
- struct GNUNET_MessageHeader header;
-
- /**
- * Use in F2F mode: Do not gossip this HELLO message
- */
- uint32_t friend_only GNUNET_PACKED;
-
- /**
- * The public key of the peer.
- */
- struct GNUNET_CRYPTO_EddsaPublicKey publicKey;
-
-};
-GNUNET_NETWORK_STRUCT_END
-
-
/**
* Context used for building our own URI.
*/
return 0;
exp = GNUNET_TIME_absolute_hton (expiration);
alen = htons ((uint16_t) address->address_length);
- memcpy (target, address->transport_name, slen);
- memcpy (&target[slen], &alen, sizeof (uint16_t));
+ GNUNET_memcpy (target, address->transport_name, slen);
+ GNUNET_memcpy (&target[slen], &alen, sizeof (uint16_t));
slen += sizeof (uint16_t);
- memcpy (&target[slen], &exp, sizeof (struct GNUNET_TIME_AbsoluteNBO));
+ GNUNET_memcpy (&target[slen], &exp, sizeof (struct GNUNET_TIME_AbsoluteNBO));
slen += sizeof (struct GNUNET_TIME_AbsoluteNBO);
- memcpy (&target[slen], address->address, address->address_length);
+ GNUNET_memcpy (&target[slen], address->address, address->address_length);
slen += address->address_length;
return slen;
}
GNUNET_break_op (0);
return 0;
}
- memcpy (&alen, pos, sizeof (uint16_t));
+ GNUNET_memcpy (&alen, pos, sizeof (uint16_t));
alen = ntohs (alen);
*ralen = alen;
slen += alen + sizeof (uint16_t) + sizeof (struct GNUNET_TIME_AbsoluteNBO);
hello->header.size = htons (sizeof (struct GNUNET_HELLO_Message) + used);
hello->friend_only = htonl (friend_only);
hello->publicKey = *public_key;
- memcpy (&hello[1],
+ GNUNET_memcpy (&hello[1],
buffer,
used);
return hello;
if (return_modified)
{
ret = GNUNET_malloc (msize);
- memcpy (ret,
+ GNUNET_memcpy (ret,
msg,
msize);
}
GNUNET_free_non_null (ret);
return NULL;
}
- /* need memcpy() due to possibility of misalignment */
- memcpy (&expire,
+ /* need GNUNET_memcpy() due to possibility of misalignment */
+ GNUNET_memcpy (&expire,
&inptr[esize - alen - sizeof (struct GNUNET_TIME_AbsoluteNBO)],
sizeof (struct GNUNET_TIME_AbsoluteNBO));
address.address = &inptr[esize - alen];
(NULL != ret) )
{
/* copy address over */
- memcpy (woff,
+ GNUNET_memcpy (woff,
inptr,
esize);
woff += esize;
addr_dup = GNUNET_strdup (addr);
if (NULL != (pos = strstr (addr_dup, "_server")))
- memcpy (pos,
+ GNUNET_memcpy (pos,
client_str,
strlen (client_str)); /* Replace all server addresses with client addresses */