![]() |
GNUnet
0.11.x
|
Library to read and write the FRIENDS file. More...
Typedefs | |
typedef void(* | GNUNET_FRIENDS_Callback) (void *cls, const struct GNUNET_PeerIdentity *friend_id) |
Signature of a function called on each friend found. More... | |
Functions | |
int | GNUNET_FRIENDS_parse (const struct GNUNET_CONFIGURATION_Handle *cfg, GNUNET_FRIENDS_Callback cb, void *cb_cls) |
Parse the FRIENDS file. More... | |
struct GNUNET_FRIENDS_Writer * | GNUNET_FRIENDS_write_start (const struct GNUNET_CONFIGURATION_Handle *cfg) |
Start writing a fresh FRIENDS file. More... | |
int | GNUNET_FRIENDS_write_stop (struct GNUNET_FRIENDS_Writer *w) |
Finish writing out the friends file. More... | |
int | GNUNET_FRIENDS_write (struct GNUNET_FRIENDS_Writer *w, const struct GNUNET_PeerIdentity *friend_id) |
Add a friend to the friends file. More... | |
Library to read and write the FRIENDS file.
typedef void(* GNUNET_FRIENDS_Callback) (void *cls, const struct GNUNET_PeerIdentity *friend_id) |
Signature of a function called on each friend found.
cls | closure |
friend_id | peer identity of the friend |
Definition at line 51 of file gnunet_friends_lib.h.
int GNUNET_FRIENDS_parse | ( | const struct GNUNET_CONFIGURATION_Handle * | cfg, |
GNUNET_FRIENDS_Callback | cb, | ||
void * | cb_cls | ||
) |
Parse the FRIENDS file.
cfg | our configuration |
cb | function to call on each friend found |
cb_cls | closure for cb |
Definition at line 39 of file friends.c.
References _, data, fn, GNUNET_CONFIGURATION_get_value_filename(), GNUNET_CRYPTO_eddsa_public_key_from_string(), GNUNET_DISK_file_size(), GNUNET_DISK_file_test(), GNUNET_DISK_fn_read(), GNUNET_DISK_fn_write(), GNUNET_DISK_OPEN_CREATE, GNUNET_DISK_PERM_USER_READ, GNUNET_DISK_PERM_USER_WRITE, GNUNET_ERROR_TYPE_ERROR, GNUNET_ERROR_TYPE_WARNING, GNUNET_free, GNUNET_log, GNUNET_log_config_missing(), GNUNET_log_strerror, GNUNET_log_strerror_file, GNUNET_malloc_large, GNUNET_NO, GNUNET_OK, GNUNET_SYSERR, GNUNET_YES, GNUNET_PeerIdentity::public_key, and start.
Referenced by read_friends_file().
struct GNUNET_FRIENDS_Writer* GNUNET_FRIENDS_write_start | ( | const struct GNUNET_CONFIGURATION_Handle * | cfg | ) |
Start writing a fresh FRIENDS file.
Will make a backup of the old one.
cfg | configuration to use. |
Definition at line 156 of file friends.c.
References _, GNUNET_FRIENDS_Writer::fh, fn, GNUNET_CONFIGURATION_get_value_filename(), GNUNET_DISK_directory_create_for_file(), GNUNET_DISK_file_backup(), GNUNET_DISK_file_open(), GNUNET_DISK_file_test(), GNUNET_DISK_OPEN_CREATE, GNUNET_DISK_OPEN_FAILIFEXISTS, GNUNET_DISK_OPEN_WRITE, GNUNET_DISK_PERM_USER_READ, GNUNET_ERROR_TYPE_ERROR, GNUNET_ERROR_TYPE_WARNING, GNUNET_free, GNUNET_log, GNUNET_log_config_missing(), GNUNET_new, and GNUNET_OK.
int GNUNET_FRIENDS_write_stop | ( | struct GNUNET_FRIENDS_Writer * | w | ) |
Finish writing out the friends file.
w | write handle |
Definition at line 202 of file friends.c.
References GNUNET_FRIENDS_Writer::fh, GNUNET_DISK_file_close(), GNUNET_free, and ret.
int GNUNET_FRIENDS_write | ( | struct GNUNET_FRIENDS_Writer * | w, |
const struct GNUNET_PeerIdentity * | friend_id | ||
) |
Add a friend to the friends file.
w | write handle |
friend_id | friend to add |
Definition at line 220 of file friends.c.
References buf, GNUNET_FRIENDS_Writer::fh, GNUNET_asprintf(), GNUNET_CRYPTO_eddsa_public_key_to_string(), GNUNET_DISK_file_write(), GNUNET_free, GNUNET_OK, GNUNET_SYSERR, GNUNET_PeerIdentity::public_key, and ret.