122 fprintf (stderr,
"%s",
_ (
"Call with name of HELLO file to modify.\n"));
129 _ (
"Error accessing file `%s': %s\n"),
136 fprintf (stderr,
_ (
"File `%s' is too big to be a HELLO\n"), argv[1]);
141 fprintf (stderr,
_ (
"File `%s' is too small to be a HELLO\n"), argv[1]);
150 _ (
"Error opening file `%s': %s\n"),
165 _ (
"Did not find well-formed HELLO in file `%s'\n"),
173 fprintf (stdout,
"Processing HELLO for peer `%s'\n", pids);
189 _ (
"Error opening file `%s': %s\n"),
199 _ (
"Error writing HELLO to file `%s': %s\n"),
208 _ (
"Modified %u addresses, wrote %u bytes\n"),
210 (
unsigned int) fsize);
static char * expiration
Credential TTL.
static int ret
Return value of the commandline.
static char * address
GNS address for this phone.
int main(int argc, char *argv[])
static ssize_t add_from_hello(void *cls, size_t max, void *buf)
Add addresses from the address list to the HELLO.
static int add_to_buf(void *cls, const struct GNUNET_HELLO_Address *address, struct GNUNET_TIME_Absolute expiration)
Add the given address with infinite expiration to the buffer.
static struct GNUNET_MQ_Envelope * ac
Handle to current GNUNET_PEERINFO_add_peer() operation.
static int result
Global testing status.
static struct GNUNET_DISK_FileHandle * fh
File handle to STDIN, for reading restart/quit commands.
static struct GNUNET_PeerIdentity pid
Identity of the peer we transmit to / connect to.
Helper library for handling HELLOs.
Constants for network protocols.
struct GNUNET_DISK_FileHandle * GNUNET_DISK_file_open(const char *fn, enum GNUNET_DISK_OpenFlags flags, enum GNUNET_DISK_AccessPermissions perm)
Open a file.
ssize_t GNUNET_DISK_file_write(const struct GNUNET_DISK_FileHandle *h, const void *buffer, size_t n)
Write a buffer to a file.
enum GNUNET_GenericReturnValue GNUNET_DISK_file_size(const char *filename, uint64_t *size, int include_symbolic_links, int single_file_mode)
Get the size of the file (or directory) of the given file (in bytes).
enum GNUNET_GenericReturnValue GNUNET_DISK_file_close(struct GNUNET_DISK_FileHandle *h)
Close an open file.
ssize_t GNUNET_DISK_file_read(const struct GNUNET_DISK_FileHandle *h, void *result, size_t len)
Read the contents of a binary file into a buffer.
@ GNUNET_DISK_OPEN_READ
Open the file for reading.
@ GNUNET_DISK_OPEN_WRITE
Open the file for writing.
@ GNUNET_DISK_OPEN_TRUNCATE
Truncate file if it exists.
@ GNUNET_DISK_PERM_USER_READ
Owner can read.
@ GNUNET_DISK_PERM_USER_WRITE
Owner can write.
int GNUNET_HELLO_get_id(const struct GNUNET_HELLO_Message *hello, struct GNUNET_PeerIdentity *peer)
Get the peer identity from a HELLO message.
uint16_t GNUNET_HELLO_size(const struct GNUNET_HELLO_Message *hello)
Return the size of the given HELLO message.
struct GNUNET_HELLO_Message * GNUNET_HELLO_create(const struct GNUNET_CRYPTO_EddsaPublicKey *public_key, GNUNET_HELLO_GenerateAddressListCallback addrgen, void *addrgen_cls, int friend_only)
Construct a HELLO message given the public key, expiration time and an iterator that spews the transp...
int GNUNET_HELLO_is_friend_only(const struct GNUNET_HELLO_Message *h)
Return HELLO type.
size_t GNUNET_HELLO_add_address(const struct GNUNET_HELLO_Address *address, struct GNUNET_TIME_Absolute expiration, char *target, size_t max)
Copy the given address information into the given buffer using the format of HELLOs.
struct GNUNET_HELLO_Message * GNUNET_HELLO_iterate_addresses(const struct GNUNET_HELLO_Message *msg, int return_modified, GNUNET_HELLO_AddressIterator it, void *it_cls)
Iterate over all of the addresses in the HELLO.
char * GNUNET_CRYPTO_eddsa_public_key_to_string(const struct GNUNET_CRYPTO_EddsaPublicKey *pub)
Convert a public key to a string.
#define GNUNET_ALIGN
gcc-ism to force alignment; we use this to align char-arrays that may then be cast to 'struct's.
int GNUNET_log_setup(const char *comp, const char *loglevel, const char *logfile)
Setup logging.
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
#define GNUNET_free(ptr)
Wrapper around free.
#define GNUNET_TIME_UNIT_FOREVER_ABS
Constant used to specify "forever".
Closure for add_to_buf().
size_t ret
Number of bytes added so far.
size_t max
Maximum number of bytes left.
Handle used to access files (and pipes).
An address for communicating with a peer.
A HELLO message is used to exchange information about transports with other peers.
The identity of the host (wraps the signing key of the peer).
struct GNUNET_CRYPTO_EddsaPublicKey public_key
Time for absolute times used by GNUnet, in microseconds.