aboutsummaryrefslogtreecommitdiff
path: root/src/rps/gnunet-service-rps_view.h
diff options
context:
space:
mode:
authorMartin Schanzenbach <schanzen@gnunet.org>2023-10-18 14:46:22 +0200
committerMartin Schanzenbach <schanzen@gnunet.org>2023-10-18 14:46:22 +0200
commit76299f0b66a3f8ce86df90171b450da6b9cd9b7c (patch)
tree381f49fb3208a4b9ae19781372ffd6c492eae19c /src/rps/gnunet-service-rps_view.h
parent2f93ff3b6d3524e1e6dc23f70966fbae3ca9d3af (diff)
downloadgnunet-76299f0b66a3f8ce86df90171b450da6b9cd9b7c.tar.gz
gnunet-76299f0b66a3f8ce86df90171b450da6b9cd9b7c.zip
BUILD: Move experimental components to contrib
Diffstat (limited to 'src/rps/gnunet-service-rps_view.h')
-rw-r--r--src/rps/gnunet-service-rps_view.h145
1 files changed, 0 insertions, 145 deletions
diff --git a/src/rps/gnunet-service-rps_view.h b/src/rps/gnunet-service-rps_view.h
deleted file mode 100644
index 4d42272c1..000000000
--- a/src/rps/gnunet-service-rps_view.h
+++ /dev/null
@@ -1,145 +0,0 @@
1/*
2 This file is part of GNUnet.
3 Copyright (C)
4
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.
9
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.
14
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/>.
17
18 SPDX-License-Identifier: AGPL3.0-or-later
19 */
20
21/**
22 * @file rps/gnunet-service-rps_view.h
23 * @brief wrapper around the "local view"
24 * @author Julius Bünger
25 */
26#include "gnunet_util_lib.h"
27#include <inttypes.h>
28
29struct View;
30
31/**
32 * Create an empty view.
33 *
34 * @param len the maximum length for the view
35 * @return The newly created view
36 */
37struct View *
38View_create (unsigned int len);
39
40
41/**
42 * Change length of view
43 *
44 * If size is decreased, peers with higher indices are removed.
45 *
46 * @param view The view that is changed
47 * @param len the (maximum) length for the view
48 */
49void
50View_change_len (struct View *view,
51 unsigned int len);
52
53/**
54 * Get the view as an array
55 *
56 * @return the view in array representation
57 */
58const struct GNUNET_PeerIdentity *
59View_get_as_array (const struct View *view);
60
61
62/**
63 * Get the size of the view
64 *
65 * @param view The view of which the size should be returned
66 * @return current number of actually contained peers
67 */
68unsigned int
69View_size (const struct View *view);
70
71
72/**
73 * Insert peer into the view
74 *
75 * @param view The view to put the peer into
76 * @param peer the peer to insert
77 *
78 * @return GNUNET_OK if peer was actually inserted
79 * GNUNET_NO if peer was not inserted
80 */
81int
82View_put (struct View *view,
83 const struct GNUNET_PeerIdentity *peer);
84
85
86/**
87 * Check whether view contains a peer
88 *
89 * @param view The which is checked for a peer
90 * @param peer the peer to check for
91 *
92 * @return GNUNET_OK if view contains peer
93 * GNUNET_NO otherwise
94 */
95int
96View_contains_peer (const struct View *view,
97 const struct GNUNET_PeerIdentity *peer);
98
99
100/**
101 * Remove peer from view
102 *
103 * @param view The view of which to remove the peer
104 * @param peer the peer to remove
105 *
106 * @return GNUNET_OK if view contained peer and removed it successfully
107 * GNUNET_NO if view does not contain peer
108 */
109int
110View_remove_peer (struct View *view,
111 const struct GNUNET_PeerIdentity *peer);
112
113
114/**
115 * Get a peer by index
116 *
117 * @param view the view of which to get the peer
118 * @param index the index of the peer to get
119 *
120 * @return peer to the corresponding index.
121 * NULL if this index is not known
122 */
123const struct GNUNET_PeerIdentity *
124View_get_peer_by_index (const struct View *view,
125 uint32_t index);
126
127
128/**
129 * Clear the view
130 *
131 * @param view The view to clear
132 */
133void
134View_clear (struct View *view);
135
136
137/**
138 * Destroy view.
139 *
140 * @param view the view to destroy
141 */
142void
143View_destroy (struct View *view);
144
145/* end of gnunet-service-rps_view.h */