2 This file is part of GNUnet.
3 Copyright (C) 2013 Christian Grothoff
5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 3, or (at your
8 option) any later version.
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
22 * @author Christian Grothoff
25 * Library to read and write the FRIENDS file
27 * @defgroup friends Friends library
28 * Library to read and write the FRIENDS file
31 #ifndef GNUNET_FRIENDS_LIB_H
32 #define GNUNET_FRIENDS_LIB_H
37 #if 0 /* keep Emacsens' auto-indent happy */
42 #include "gnunet_util_lib.h"
46 * Signature of a function called on each friend found.
49 * @param friend_id peer identity of the friend
51 typedef void (*GNUNET_FRIENDS_Callback)(void *cls,
52 const struct GNUNET_PeerIdentity *friend_id);
56 * Parse the FRIENDS file.
58 * @param cfg our configuration
59 * @param cb function to call on each friend found
60 * @param cb_cls closure for @a cb
61 * @return #GNUNET_OK on success, #GNUNET_SYSERR on parsing errors
64 GNUNET_FRIENDS_parse (const struct GNUNET_CONFIGURATION_Handle *cfg,
65 GNUNET_FRIENDS_Callback cb,
70 * Handle for writing a friends file.
72 struct GNUNET_FRIENDS_Writer;
76 * Start writing a fresh FRIENDS file. Will make a backup of the
79 * @param cfg configuration to use.
80 * @return NULL on error
82 struct GNUNET_FRIENDS_Writer *
83 GNUNET_FRIENDS_write_start (const struct GNUNET_CONFIGURATION_Handle *cfg);
87 * Finish writing out the friends file.
89 * @param w write handle
90 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
93 GNUNET_FRIENDS_write_stop (struct GNUNET_FRIENDS_Writer *w);
97 * Add a friend to the friends file.
99 * @param w write handle
100 * @param friend_id friend to add
101 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
104 GNUNET_FRIENDS_write (struct GNUNET_FRIENDS_Writer *w,
105 const struct GNUNET_PeerIdentity *friend_id);
107 /** @} */ /* end of group */
109 #if 0 /* keep Emacsens' auto-indent happy */