projects
/
oweals
/
gnunet.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
indentation fixes
[oweals/gnunet.git]
/
src
/
hello
/
gnunet-hello.c
diff --git
a/src/hello/gnunet-hello.c
b/src/hello/gnunet-hello.c
index d18ae6a4e28070277740ebe38f9858f9b935e0bb..6fd5756ba96c6d82259431d53cab7cea8311457a 100644
(file)
--- a/
src/hello/gnunet-hello.c
+++ b/
src/hello/gnunet-hello.c
@@
-1,6
+1,6
@@
/*
This file is part of GNUnet
/*
This file is part of GNUnet
- (C) 2012 Christian Grothoff (and other contributing authors)
+ Copyright (C) 2012 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
GNUnet is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published
@@
-14,8
+14,8
@@
You should have received a copy of the GNU General Public License
along with GNUnet; see the file COPYING. If not, write to the
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., 5
9 Temple Place - Suite 330
,
- Boston, MA 0211
1-1307
, USA.
+ Free Software Foundation, Inc., 5
1 Franklin Street, Fifth Floor
,
+ Boston, MA 0211
0-1301
, USA.
*/
/**
* @file hello/gnunet-hello.c
*/
/**
* @file hello/gnunet-hello.c
@@
-27,7
+27,7
@@
#include "gnunet_hello_lib.h"
/**
#include "gnunet_hello_lib.h"
/**
- * Closure for
'add_to_buf'
.
+ * Closure for
#add_to_buf()
.
*/
struct AddContext
{
*/
struct AddContext
{
@@
-114,7
+114,7
@@
main (int argc, char *argv[])
struct GNUNET_DISK_FileHandle *fh;
struct GNUNET_HELLO_Message *orig;
struct GNUNET_HELLO_Message *result;
struct GNUNET_DISK_FileHandle *fh;
struct GNUNET_HELLO_Message *orig;
struct GNUNET_HELLO_Message *result;
- struct GNUNET_
CRYPTO_EddsaPublicKey pk
;
+ struct GNUNET_
PeerIdentity pid
;
uint64_t fsize;
address_count = 0;
uint64_t fsize;
address_count = 0;
@@
-166,8
+166,9
@@
main (int argc, char *argv[])
GNUNET_DISK_file_read (fh, buf, fsize));
GNUNET_assert (GNUNET_OK == GNUNET_DISK_file_close (fh));
orig = (struct GNUNET_HELLO_Message *) buf;
GNUNET_DISK_file_read (fh, buf, fsize));
GNUNET_assert (GNUNET_OK == GNUNET_DISK_file_close (fh));
orig = (struct GNUNET_HELLO_Message *) buf;
- if ( (fsize != GNUNET_HELLO_size (orig)) ||
- (GNUNET_OK != GNUNET_HELLO_get_key (orig, &pk)) )
+ if ( (fsize < GNUNET_HELLO_size (orig)) ||
+ (GNUNET_OK != GNUNET_HELLO_get_id (orig,
+ &pid)) )
{
FPRINTF (stderr,
_("Did not find well-formed HELLO in file `%s'\n"),
{
FPRINTF (stderr,
_("Did not find well-formed HELLO in file `%s'\n"),
@@
-175,20
+176,21
@@
main (int argc, char *argv[])
return 1;
}
{
return 1;
}
{
- char *pid;
+ char *pid
s
;
- pid
= GNUNET_CRYPTO_eddsa_public_key_to_string (&pk
);
+ pid
s = GNUNET_CRYPTO_eddsa_public_key_to_string (&pid.public_key
);
fprintf (stdout,
"Processing HELLO for peer `%s'\n",
fprintf (stdout,
"Processing HELLO for peer `%s'\n",
- pid);
- GNUNET_free (pid);
+ pid
s
);
+ GNUNET_free (pid
s
);
}
}
- result = GNUNET_HELLO_create (&pk, &add_from_hello,
+ result = GNUNET_HELLO_create (&pid.public_key,
+ &add_from_hello,
&orig,
GNUNET_HELLO_is_friend_only (orig));
GNUNET_assert (NULL != result);
fh = GNUNET_DISK_file_open (argv[1],
&orig,
GNUNET_HELLO_is_friend_only (orig));
GNUNET_assert (NULL != result);
fh = GNUNET_DISK_file_open (argv[1],
- GNUNET_DISK_OPEN_WRITE,
+ GNUNET_DISK_OPEN_WRITE
| GNUNET_DISK_OPEN_TRUNCATE
,
GNUNET_DISK_PERM_USER_READ | GNUNET_DISK_PERM_USER_WRITE);
if (NULL == fh)
{
GNUNET_DISK_PERM_USER_READ | GNUNET_DISK_PERM_USER_WRITE);
if (NULL == fh)
{
@@
-213,7
+215,10
@@
main (int argc, char *argv[])
}
GNUNET_assert (GNUNET_OK == GNUNET_DISK_file_close (fh));
}
}
GNUNET_assert (GNUNET_OK == GNUNET_DISK_file_close (fh));
}
- FPRINTF (stderr, _("Modified %u addresses \n"), address_count);
+ FPRINTF (stderr,
+ _("Modified %u addresses, wrote %u bytes\n"),
+ address_count,
+ (unsigned int) fsize);
return 0;
}
return 0;
}