GNUnet  0.11.x
gnunet-service-rps_view.h
Go to the documentation of this file.
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 
26 #include "gnunet_util_lib.h"
27 #include <inttypes.h>
28 
29 struct View;
30 
37 struct View *
38 View_create (unsigned int len);
39 
40 
49 void
50 View_change_len (struct View *view,
51  unsigned int len);
52 
58 const struct GNUNET_PeerIdentity *
59 View_get_as_array (const struct View *view);
60 
61 
68 unsigned int
69 View_size (const struct View *view);
70 
71 
81 int
82 View_put (struct View *view,
83  const struct GNUNET_PeerIdentity *peer);
84 
85 
95 int
96 View_contains_peer (const struct View *view,
97  const struct GNUNET_PeerIdentity *peer);
98 
99 
109 int
110 View_remove_peer (struct View *view,
111  const struct GNUNET_PeerIdentity *peer);
112 
113 
123 const struct GNUNET_PeerIdentity *
124 View_get_peer_by_index (const struct View *view,
125  uint32_t index);
126 
127 
133 void
134 View_clear (struct View *view);
135 
136 
142 void
143 View_destroy (struct View *view);
144 
145 /* end of gnunet-service-rps_view.h */
struct View * View_create(unsigned int len)
Create an empty view.
void View_clear(struct View *view)
Clear the view.
void View_change_len(struct View *view, unsigned int len)
Change length of view.
int View_contains_peer(const struct View *view, const struct GNUNET_PeerIdentity *peer)
Check whether view contains a peer.
struct GNUNET_TESTBED_Peer * peer
The peer associated with this model.
int View_remove_peer(struct View *view, const struct GNUNET_PeerIdentity *peer)
Remove peer from view.
unsigned int View_size(const struct View *view)
Get the size of the view.
const struct GNUNET_PeerIdentity * View_get_as_array(const struct View *view)
Get the view as an array.
The identity of the host (wraps the signing key of the peer).
void View_destroy(struct View *view)
Destroy view.
int View_put(struct View *view, const struct GNUNET_PeerIdentity *peer)
Insert peer into the view.
uint16_t len
length of data (which is always a uint32_t, but presumably this can be used to specify that fewer byt...
const struct GNUNET_PeerIdentity * View_get_peer_by_index(const struct View *view, uint32_t index)
Get a peer by index.