aboutsummaryrefslogtreecommitdiff
path: root/src/messenger/messenger_api_list_tunnels.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/messenger/messenger_api_list_tunnels.h')
-rw-r--r--src/messenger/messenger_api_list_tunnels.h137
1 files changed, 0 insertions, 137 deletions
diff --git a/src/messenger/messenger_api_list_tunnels.h b/src/messenger/messenger_api_list_tunnels.h
deleted file mode 100644
index 0e086ee5e..000000000
--- a/src/messenger/messenger_api_list_tunnels.h
+++ /dev/null
@@ -1,137 +0,0 @@
1/*
2 This file is part of GNUnet.
3 Copyright (C) 2020--2021 GNUnet e.V.
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 * @author Tobias Frisch
22 * @file src/messenger/messenger_api_list_tunnels.h
23 * @brief messenger api: client and service implementation of GNUnet MESSENGER service
24 */
25
26#ifndef GNUNET_MESSENGER_API_LIST_TUNNELS_H
27#define GNUNET_MESSENGER_API_LIST_TUNNELS_H
28
29#include "platform.h"
30#include "gnunet_peer_lib.h"
31#include "gnunet_container_lib.h"
32
33struct GNUNET_MESSENGER_ListTunnel
34{
35 struct GNUNET_MESSENGER_ListTunnel *prev;
36 struct GNUNET_MESSENGER_ListTunnel *next;
37
38 GNUNET_PEER_Id peer;
39};
40
41struct GNUNET_MESSENGER_ListTunnels
42{
43 struct GNUNET_MESSENGER_ListTunnel *head;
44 struct GNUNET_MESSENGER_ListTunnel *tail;
45};
46
47/**
48 * Initializes list of tunnels peer identities as empty list.
49 *
50 * @param[out] tunnels List of peer identities
51 */
52void
53init_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels);
54
55/**
56 * Clears the list of tunnels peer identities.
57 *
58 * @param[in/out] tunnels List of peer identities
59 */
60void
61clear_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels);
62
63/**
64 * Adds a specific <i>peer</i> from a tunnel to the end of the list.
65 *
66 * @param[in/out] tunnels List of peer identities
67 * @param[in] peer Peer identity of tunnel
68 */
69void
70add_to_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels,
71 const struct GNUNET_PeerIdentity *peer);
72
73/**
74 * Searches linearly through the list of tunnels peer identities for matching a
75 * specific <i>peer</i> identity and returns the matching element of the list.
76 *
77 * If no matching element is found, NULL gets returned.
78 *
79 * If <i>index</i> is not NULL, <i>index</i> will be overridden with the numeric index of
80 * the found element in the list. If no matching element is found, <i>index</i> will
81 * contain the total amount of elements in the list.
82 *
83 * @param[in/out] tunnels List of peer identities
84 * @param[in] peer Peer identity of tunnel
85 * @param[out] index Index of found element (optional)
86 * @return Element in the list with matching peer identity
87 */
88struct GNUNET_MESSENGER_ListTunnel*
89find_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels,
90 const struct GNUNET_PeerIdentity *peer,
91 size_t *index);
92
93/**
94 * Tests linearly if the list of tunnels peer identities contains a specific
95 * <i>peer</i> identity and returns #GNUNET_YES on success, otherwise #GNUNET_NO.
96 *
97 * @param[in/out] tunnels List of peer identities
98 * @param[in] peer Peer identity of tunnel
99 * @return #GNUNET_YES on success, otherwise #GNUNET_NO
100 */
101int
102contains_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels,
103 const struct GNUNET_PeerIdentity *peer);
104
105/**
106 * Removes a specific <i>element</i> from the list of tunnels peer identities and returns
107 * the next element in the list.
108 *
109 * @param[in/out] tunnels List of peer identities
110 * @param[in/out] element Element of the list
111 * @return Next element in the list
112 */
113struct GNUNET_MESSENGER_ListTunnel*
114remove_from_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels,
115 struct GNUNET_MESSENGER_ListTunnel *element);
116
117/**
118 * Loads the list of tunnels peer identities from a file under a given <i>path</i>.
119 *
120 * @param[out] messages List of hashes
121 * @param[in] path Path of file
122 */
123void
124load_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels,
125 const char *path);
126
127/**
128 * Saves the list of tunnels peer identities to a file under a given <i>path</i>.
129 *
130 * @param[in] messages List of hashes
131 * @param[in] path Path of file
132 */
133void
134save_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels,
135 const char *path);
136
137#endif //GNUNET_MESSENGER_API_LIST_TUNNELS_H