2 This file is part of GNUnet.
5 GNUnet is free software: you can redistribute it and/or modify it
6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation, either version 3 of the License,
8 or (at your 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 Affero General Public License for more details.
15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
20 * @file rps/gnunet-service-rps_view.h
21 * @brief wrapper around the "local view"
22 * @author Julius Bünger
24 #include "gnunet_util_lib.h"
29 * Create an empty view.
31 * @param len the maximum length for the view
34 View_create (unsigned int len);
37 * Change length of view
39 * If size is decreased, peers with higher indices are removed.
41 * @param len the (maximum) length for the view
44 View_change_len (unsigned int len);
47 * Get the view as an array
49 * @return the view in array representation
51 const struct GNUNET_PeerIdentity *
55 * Get the size of the view
57 * @return current number of actually contained peers
63 * Insert peer into the view
65 * @param peer the peer to insert
67 * @return GNUNET_OK if peer was actually inserted
68 * GNUNET_NO if peer was not inserted
71 View_put (const struct GNUNET_PeerIdentity *peer);
74 * Check whether view contains a peer
76 * @param peer the peer to check for
78 * @return GNUNET_OK if view contains peer
82 View_contains_peer (const struct GNUNET_PeerIdentity *peer);
85 * Remove peer from view
87 * @param peer the peer to remove
89 * @return GNUNET_OK if view contained peer and removed it successfully
90 * GNUNET_NO if view does not contain peer
93 View_remove_peer (const struct GNUNET_PeerIdentity *peer);
98 * @param index the index of the peer to get
100 * @return peer to the corresponding index.
101 * NULL if this index is not known
103 const struct GNUNET_PeerIdentity *
104 View_get_peer_by_index (uint32_t index);
107 * Clear the custom peer map
109 * @param c_peer_map the custom peer map to look in
111 * @return size of the map
119 * @param c_peer_map the map to destroy
124 /* end of gnunet-service-rps_view.h */