summaryrefslogtreecommitdiff
path: root/src/hello
diff options
context:
space:
mode:
Diffstat (limited to 'src/hello')
-rw-r--r--src/hello/address.c40
-rw-r--r--src/hello/hello.c28
-rw-r--r--src/hello/test_hello.c8
3 files changed, 32 insertions, 44 deletions
diff --git a/src/hello/address.c b/src/hello/address.c
index b511ca9df..618aa6e6a 100644
--- a/src/hello/address.c
+++ b/src/hello/address.c
@@ -39,21 +39,20 @@
*/
struct GNUNET_HELLO_Address *
GNUNET_HELLO_address_allocate (const struct GNUNET_PeerIdentity *peer,
- const char *transport_name,
- const void *address,
- size_t address_length)
+ const char *transport_name, const void *address,
+ size_t address_length)
{
struct GNUNET_HELLO_Address *addr;
size_t slen;
char *end;
slen = strlen (transport_name) + 1;
- addr = GNUNET_malloc (sizeof (struct GNUNET_HELLO_Address) +
- address_length +
- slen);
+ addr =
+ GNUNET_malloc (sizeof (struct GNUNET_HELLO_Address) + address_length +
+ slen);
addr->peer = *peer;
addr->address = &addr[1];
- end = (char*) &addr[1];
+ end = (char *) &addr[1];
memcpy (end, address, address_length);
addr->address_length = address_length;
addr->transport_name = &end[address_length];
@@ -69,11 +68,10 @@ GNUNET_HELLO_address_allocate (const struct GNUNET_PeerIdentity *peer,
* @return the size
*/
size_t
-GNUNET_HELLO_address_get_size (const struct GNUNET_HELLO_Address *address)
+GNUNET_HELLO_address_get_size (const struct GNUNET_HELLO_Address * address)
{
- return sizeof (struct GNUNET_HELLO_Address) +
- address->address_length +
- strlen(address->transport_name) + 1;
+ return sizeof (struct GNUNET_HELLO_Address) + address->address_length +
+ strlen (address->transport_name) + 1;
}
@@ -86,10 +84,9 @@ GNUNET_HELLO_address_get_size (const struct GNUNET_HELLO_Address *address)
struct GNUNET_HELLO_Address *
GNUNET_HELLO_address_copy (const struct GNUNET_HELLO_Address *address)
{
- return GNUNET_HELLO_address_allocate (&address->peer,
- address->transport_name,
- address->address,
- address->address_length);
+ return GNUNET_HELLO_address_allocate (&address->peer, address->transport_name,
+ address->address,
+ address->address_length);
}
@@ -103,21 +100,18 @@ GNUNET_HELLO_address_copy (const struct GNUNET_HELLO_Address *address)
*/
int
GNUNET_HELLO_address_cmp (const struct GNUNET_HELLO_Address *a1,
- const struct GNUNET_HELLO_Address *a2)
+ const struct GNUNET_HELLO_Address *a2)
{
int ret;
- ret = strcmp (a1->transport_name,
- a2->transport_name);
+ ret = strcmp (a1->transport_name, a2->transport_name);
if (0 != ret)
return ret;
- if (a1->address_length < a2->address_length)
+ if (a1->address_length < a2->address_length)
return -1;
- if (a1->address_length > a2->address_length)
+ if (a1->address_length > a2->address_length)
return 1;
- return memcmp (a1->address,
- a1->address,
- a1->address_length);
+ return memcmp (a1->address, a1->address, a1->address_length);
}
diff --git a/src/hello/hello.c b/src/hello/hello.c
index 9c0c3d4ac..f7d34233c 100644
--- a/src/hello/hello.c
+++ b/src/hello/hello.c
@@ -74,8 +74,7 @@ struct GNUNET_HELLO_Message
*/
size_t
GNUNET_HELLO_add_address (const struct GNUNET_HELLO_Address *address,
- struct GNUNET_TIME_Absolute expiration,
- char *target,
+ struct GNUNET_TIME_Absolute expiration, char *target,
size_t max)
{
uint16_t alen;
@@ -232,8 +231,8 @@ GNUNET_HELLO_iterate_addresses (const struct GNUNET_HELLO_Message *msg,
wpos = 0;
woff = (ret != NULL) ? (char *) &ret[1] : NULL;
GNUNET_CRYPTO_hash (&msg->publicKey,
- sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded),
- &address.peer.hashPubKey);
+ sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded),
+ &address.peer.hashPubKey);
while (insize > 0)
{
esize = get_hello_address_size (inptr, insize, &alen);
@@ -280,14 +279,12 @@ struct ExpireContext
static int
-get_match_exp (void *cls,
- const struct GNUNET_HELLO_Address *address,
+get_match_exp (void *cls, const struct GNUNET_HELLO_Address *address,
struct GNUNET_TIME_Absolute expiration)
{
struct ExpireContext *ec = cls;
- if (0 == GNUNET_HELLO_address_cmp (address,
- ec->address))
+ if (0 == GNUNET_HELLO_address_cmp (address, ec->address))
{
ec->found = GNUNET_YES;
ec->expiration = expiration;
@@ -311,8 +308,7 @@ struct MergeContext
static int
-copy_latest (void *cls,
- const struct GNUNET_HELLO_Address *address,
+copy_latest (void *cls, const struct GNUNET_HELLO_Address *address,
struct GNUNET_TIME_Absolute expiration)
{
struct MergeContext *mc = cls;
@@ -327,9 +323,8 @@ copy_latest (void *cls,
(mc->take_equal == GNUNET_YES)))
{
mc->ret +=
- GNUNET_HELLO_add_address (address,
- expiration,
- &mc->buf[mc->ret], mc->max - mc->ret);
+ GNUNET_HELLO_add_address (address, expiration, &mc->buf[mc->ret],
+ mc->max - mc->ret);
}
return GNUNET_OK;
}
@@ -388,8 +383,7 @@ struct DeltaContext
static int
-delta_match (void *cls,
- const struct GNUNET_HELLO_Address *address,
+delta_match (void *cls, const struct GNUNET_HELLO_Address *address,
struct GNUNET_TIME_Absolute expiration)
{
struct DeltaContext *dc = cls;
@@ -547,9 +541,7 @@ find_other_matching (void *cls, const struct GNUNET_HELLO_Address *address,
if (expiration.abs_value < ec->expiration_limit.abs_value)
return GNUNET_YES;
- if (0 ==
- GNUNET_HELLO_address_cmp (address,
- ec->address))
+ if (0 == GNUNET_HELLO_address_cmp (address, ec->address))
{
ec->found = GNUNET_YES;
if (expiration.abs_value < ec->expiration.abs_value)
diff --git a/src/hello/test_hello.c b/src/hello/test_hello.c
index ca69dfc18..eb15668f4 100644
--- a/src/hello/test_hello.c
+++ b/src/hello/test_hello.c
@@ -47,8 +47,8 @@ my_addr_gen (void *cls, size_t max, void *buf)
address.transport_name = "test";
address.address_length = *i;
ret =
- GNUNET_HELLO_add_address (&address, GNUNET_TIME_absolute_get (),
- buf, max);
+ GNUNET_HELLO_add_address (&address, GNUNET_TIME_absolute_get (), buf,
+ max);
(*i)--;
return ret;
}
@@ -67,7 +67,9 @@ check_addr (void *cls, const struct GNUNET_HELLO_Address *address,
GNUNET_assert (address->address_length > 0);
GNUNET_assert (*i & (1 << (address->address_length - 1)));
*i -= (1 << (address->address_length - 1));
- GNUNET_assert (0 == strncmp ("address_information", address->address, address->address_length));
+ GNUNET_assert (0 ==
+ strncmp ("address_information", address->address,
+ address->address_length));
GNUNET_assert (0 == strcmp ("test", address->transport_name));
return GNUNET_OK;
}