diff options
author | Martin Schanzenbach <schanzen@gnunet.org> | 2023-10-19 12:53:29 +0200 |
---|---|---|
committer | Martin Schanzenbach <schanzen@gnunet.org> | 2023-10-19 12:53:29 +0200 |
commit | 7ef64b65a42cdb65ef2e36649ff84fcf4bb00c66 (patch) | |
tree | 975a7cebf0ed685ab776152db1be67d01171c6e5 /src/messenger/messenger_api_list_tunnels.h | |
parent | 39e327905f421c470b9cbd5c1ea548261bcae026 (diff) | |
download | gnunet-7ef64b65a42cdb65ef2e36649ff84fcf4bb00c66.tar.gz gnunet-7ef64b65a42cdb65ef2e36649ff84fcf4bb00c66.zip |
BUILD: Move messenger to service
Diffstat (limited to 'src/messenger/messenger_api_list_tunnels.h')
-rw-r--r-- | src/messenger/messenger_api_list_tunnels.h | 136 |
1 files changed, 0 insertions, 136 deletions
diff --git a/src/messenger/messenger_api_list_tunnels.h b/src/messenger/messenger_api_list_tunnels.h deleted file mode 100644 index d2ceeafc2..000000000 --- a/src/messenger/messenger_api_list_tunnels.h +++ /dev/null | |||
@@ -1,136 +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_util_lib.h" | ||
31 | |||
32 | struct GNUNET_MESSENGER_ListTunnel | ||
33 | { | ||
34 | struct GNUNET_MESSENGER_ListTunnel *prev; | ||
35 | struct GNUNET_MESSENGER_ListTunnel *next; | ||
36 | |||
37 | GNUNET_PEER_Id peer; | ||
38 | }; | ||
39 | |||
40 | struct GNUNET_MESSENGER_ListTunnels | ||
41 | { | ||
42 | struct GNUNET_MESSENGER_ListTunnel *head; | ||
43 | struct GNUNET_MESSENGER_ListTunnel *tail; | ||
44 | }; | ||
45 | |||
46 | /** | ||
47 | * Initializes list of tunnels peer identities as empty list. | ||
48 | * | ||
49 | * @param[out] tunnels List of peer identities | ||
50 | */ | ||
51 | void | ||
52 | init_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels); | ||
53 | |||
54 | /** | ||
55 | * Clears the list of tunnels peer identities. | ||
56 | * | ||
57 | * @param[in,out] tunnels List of peer identities | ||
58 | */ | ||
59 | void | ||
60 | clear_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels); | ||
61 | |||
62 | /** | ||
63 | * Adds a specific <i>peer</i> from a tunnel to the end of the list. | ||
64 | * | ||
65 | * @param[in,out] tunnels List of peer identities | ||
66 | * @param[in] peer Peer identity of tunnel | ||
67 | */ | ||
68 | void | ||
69 | add_to_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels, | ||
70 | const struct GNUNET_PeerIdentity *peer); | ||
71 | |||
72 | /** | ||
73 | * Searches linearly through the list of tunnels peer identities for matching a | ||
74 | * specific <i>peer</i> identity and returns the matching element of the list. | ||
75 | * | ||
76 | * If no matching element is found, NULL gets returned. | ||
77 | * | ||
78 | * If <i>index</i> is not NULL, <i>index</i> will be overridden with the numeric index of | ||
79 | * the found element in the list. If no matching element is found, <i>index</i> will | ||
80 | * contain the total amount of elements in the list. | ||
81 | * | ||
82 | * @param[in,out] tunnels List of peer identities | ||
83 | * @param[in] peer Peer identity of tunnel | ||
84 | * @param[out] index Index of found element (optional) | ||
85 | * @return Element in the list with matching peer identity | ||
86 | */ | ||
87 | struct GNUNET_MESSENGER_ListTunnel* | ||
88 | find_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels, | ||
89 | const struct GNUNET_PeerIdentity *peer, | ||
90 | size_t *index); | ||
91 | |||
92 | /** | ||
93 | * Tests linearly if the list of tunnels peer identities contains a specific | ||
94 | * <i>peer</i> identity and returns #GNUNET_YES on success, otherwise #GNUNET_NO. | ||
95 | * | ||
96 | * @param[in,out] tunnels List of peer identities | ||
97 | * @param[in] peer Peer identity of tunnel | ||
98 | * @return #GNUNET_YES on success, otherwise #GNUNET_NO | ||
99 | */ | ||
100 | int | ||
101 | contains_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels, | ||
102 | const struct GNUNET_PeerIdentity *peer); | ||
103 | |||
104 | /** | ||
105 | * Removes a specific <i>element</i> from the list of tunnels peer identities and returns | ||
106 | * the next element in the list. | ||
107 | * | ||
108 | * @param[in,out] tunnels List of peer identities | ||
109 | * @param[in,out] element Element of the list | ||
110 | * @return Next element in the list | ||
111 | */ | ||
112 | struct GNUNET_MESSENGER_ListTunnel* | ||
113 | remove_from_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels, | ||
114 | struct GNUNET_MESSENGER_ListTunnel *element); | ||
115 | |||
116 | /** | ||
117 | * Loads the list of tunnels peer identities from a file under a given <i>path</i>. | ||
118 | * | ||
119 | * @param[out] tunnels List of hashes | ||
120 | * @param[in] path Path of file | ||
121 | */ | ||
122 | void | ||
123 | load_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels, | ||
124 | const char *path); | ||
125 | |||
126 | /** | ||
127 | * Saves the list of tunnels peer identities to a file under a given <i>path</i>. | ||
128 | * | ||
129 | * @param[in] tunnels List of hashes | ||
130 | * @param[in] path Path of file | ||
131 | */ | ||
132 | void | ||
133 | save_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels, | ||
134 | const char *path); | ||
135 | |||
136 | #endif //GNUNET_MESSENGER_API_LIST_TUNNELS_H | ||