2 This file is part of GNUnet
3 (C) 2009 Christian Grothoff (and other contributing authors)
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 2, 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., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA.
21 * @file include/gnunet_peerinfo_service.h
22 * @brief Code to maintain the list of currently known hosts
23 * (in memory structure of data/hosts) and their trust ratings
24 * (in memory structure of data/trust)
25 * @author Christian Grothoff
28 #ifndef GNUNET_PEERINFO_SERVICE_H
29 #define GNUNET_PEERINFO_SERVICE_H
31 #include "gnunet_common.h"
32 #include "gnunet_configuration_lib.h"
33 #include "gnunet_crypto_lib.h"
34 #include "gnunet_hello_lib.h"
39 #if 0 /* keep Emacsens' auto-indent happy */
46 * Add a host to the persistent list.
48 * @param cfg configuration to use
49 * @param sched scheduler to use
50 * @param peer identity of the peer
51 * @param hello the verified (!) HELLO message
54 GNUNET_PEERINFO_add_peer (struct GNUNET_CONFIGURATION_Handle *cfg,
55 struct GNUNET_SCHEDULER_Handle *sched,
56 const struct GNUNET_PeerIdentity *peer,
57 const struct GNUNET_HELLO_Message *hello);
60 * Type of an iterator over the hosts. Note that each
61 * host will be called with each available protocol.
64 * @param peer id of the peer, NULL for last call
65 * @param hello hello message for the peer (can be NULL)
66 * @param trust amount of trust we have in the peer
69 (*GNUNET_PEERINFO_Processor) (void *cls,
70 const struct GNUNET_PeerIdentity * peer,
71 const struct GNUNET_HELLO_Message * hello,
76 * Call a method for each known matching host and change
77 * its trust value. The method will be invoked once for
78 * each host and then finally once with a NULL pointer.
79 * Note that the last call can be triggered by timeout or
80 * by simply being done; however, the trust argument will
81 * be set to zero if we are done, 1 if we timed out and
84 * @param cfg configuration to use
85 * @param sched scheduler to use
86 * @param peer restrict iteration to this peer only (can be NULL)
87 * @param trust_delta how much to change the trust in all matching peers
88 * @param timeout how long to wait until timing out
89 * @param callback the method to call for each peer
90 * @param callback_cls closure for callback
93 GNUNET_PEERINFO_for_all (struct GNUNET_CONFIGURATION_Handle *cfg,
94 struct GNUNET_SCHEDULER_Handle *sched,
95 const struct GNUNET_PeerIdentity *peer,
97 struct GNUNET_TIME_Relative timeout,
98 GNUNET_PEERINFO_Processor callback,
102 #if 0 /* keep Emacsens' auto-indent happy */
110 /* end of gnunet_peerinfo_service.h */