diff options
author | TheJackiMonster <thejackimonster@gmail.com> | 2020-11-01 22:57:28 +0100 |
---|---|---|
committer | TheJackiMonster <thejackimonster@gmail.com> | 2021-03-06 01:30:37 +0100 |
commit | 2925310d67483aca6e055e1ce0593c6463cd6c72 (patch) | |
tree | 2cc8aacafc25563cdccde2eee9a90f9ca257d405 /src/messenger/gnunet-service-messenger_member.h | |
parent | 82b864a64679b0a735201724907cdf2b7e4e16c3 (diff) | |
download | gnunet-2925310d67483aca6e055e1ce0593c6463cd6c72.tar.gz gnunet-2925310d67483aca6e055e1ce0593c6463cd6c72.zip |
-added core functionality of the messenger service
Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
formatting messenger code
Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
-completed core functionality of messenger service
Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
-code cleanup and reuse
Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
+added structure to memberships of rooms
Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
-implemented member permission checks and deletion of messages
Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
-moved solving requests out of updating last messages (also forward before update)
Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
-reduced complexity of permisson check and changed load/save of rooms
Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
-added save/load for accessed keys and basement peers of a room
Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
-implemented save/load for members with their history and session
Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
-abstracted management of egos and contacts
Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
-fix warning
Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
-abstracted management of members
Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
-fixed and adjusted test case
Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
-separated handling of direct and anonymous contacts
Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
-messenger added member-sessions which fix multiple edge cases, also additional cleanup
Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
-updated docs and fixed memory leak
Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
-changed info messages and added protocol version exchange
Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
-adjusted client api to use contacts from sessions
Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
-added more logging and fixed wrong session usage
Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
-adjusted comm0 test case and removed adding members from checking messages
Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
-fixed test-case for peer exchange
Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
-getting multiple peers connected in test-case with cadet
Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
-fixed wrong assert and added tunnel version check
-simplified handling and forwarding
Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
-fixed merging last messages and cycling info messages
Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
-automated adding sessions and members
Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
-corrected use of identity keys and signatures
Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
-adding local joining on entering external room
Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
-fixed test-case comm0
Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
-added more test-cases with generic setup
Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
-fixed multiple simultaneous channels blocking each other
Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
-making test-cases more precise
Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
-added check of members in test-cases, reduced merge messages
Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
-unified delayed operations: requests, deletions and merges
Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
-finished handling of operations
Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
-fixed member session historystorage, added request permission check and padding for transmission
Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
-improved padding and removed automatic recursive requests
Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
-implemented filter for sending messages and added private messages to API level
Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
-wrong setups fixed with proper ego lookups
Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
-fixed problem with anonymous ego and changed to discrete-level padding
Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
-added links to replace deleted messages, added local deletion and fixed anonymous id changing
Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
-added session completion and removal through completion process
Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
Diffstat (limited to 'src/messenger/gnunet-service-messenger_member.h')
-rw-r--r-- | src/messenger/gnunet-service-messenger_member.h | 170 |
1 files changed, 170 insertions, 0 deletions
diff --git a/src/messenger/gnunet-service-messenger_member.h b/src/messenger/gnunet-service-messenger_member.h new file mode 100644 index 000000000..fb2e57cfb --- /dev/null +++ b/src/messenger/gnunet-service-messenger_member.h | |||
@@ -0,0 +1,170 @@ | |||
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/gnunet-service-messenger_member.h | ||
23 | * @brief GNUnet MESSENGER service | ||
24 | */ | ||
25 | |||
26 | #ifndef GNUNET_SERVICE_MESSENGER_MEMBER_H | ||
27 | #define GNUNET_SERVICE_MESSENGER_MEMBER_H | ||
28 | |||
29 | #include "messenger_api_contact.h" | ||
30 | |||
31 | #include "gnunet-service-messenger_list_messages.h" | ||
32 | #include "gnunet-service-messenger_member_store.h" | ||
33 | #include "messenger_api_message.h" | ||
34 | #include "messenger_api_util.h" | ||
35 | |||
36 | struct GNUNET_MESSENGER_Member | ||
37 | { | ||
38 | struct GNUNET_MESSENGER_MemberStore *store; | ||
39 | struct GNUNET_ShortHashCode id; | ||
40 | |||
41 | struct GNUNET_CONTAINER_MultiHashMap *sessions; | ||
42 | }; | ||
43 | |||
44 | /** | ||
45 | * Creates and allocates a new member of a <i>room</i> with an optionally defined or | ||
46 | * random <i>id</i>. | ||
47 | * | ||
48 | * If the creation fails, NULL gets returned. | ||
49 | * | ||
50 | * @param[in/out] store Member store | ||
51 | * @param[in] id Member id or NULL | ||
52 | * @return New member or NULL | ||
53 | */ | ||
54 | struct GNUNET_MESSENGER_Member* | ||
55 | create_member (struct GNUNET_MESSENGER_MemberStore *store, const struct GNUNET_ShortHashCode *id); | ||
56 | |||
57 | /** | ||
58 | * Destroys a member and frees its memory fully. | ||
59 | * | ||
60 | * @param[in/out] member Member | ||
61 | */ | ||
62 | void | ||
63 | destroy_member (struct GNUNET_MESSENGER_Member *member); | ||
64 | |||
65 | /** | ||
66 | * Returns the current id of a given <i>member</i>. | ||
67 | * | ||
68 | * @param[in] member Member | ||
69 | * @return Member id | ||
70 | */ | ||
71 | const struct GNUNET_ShortHashCode* | ||
72 | get_member_id (const struct GNUNET_MESSENGER_Member *member); | ||
73 | |||
74 | /** | ||
75 | * Loads data from a <i>directory</i> into a new allocated and created member | ||
76 | * of a <i>store</i> if the required information can be read from the content | ||
77 | * of the given directory. | ||
78 | * | ||
79 | * @param[out] store Member store | ||
80 | * @param[in] directory Path to a directory | ||
81 | */ | ||
82 | void | ||
83 | load_member (struct GNUNET_MESSENGER_MemberStore *store, const char *directory); | ||
84 | |||
85 | /** | ||
86 | * Loads data about next sessions from a <i>directory</i> into an empty loaded | ||
87 | * <i>member</i> which does not contain a fully built session graph yet. | ||
88 | * | ||
89 | * @param[in/out] member Member | ||
90 | * @param[in] directory Path to a directory | ||
91 | */ | ||
92 | void | ||
93 | load_member_next_sessions (const struct GNUNET_MESSENGER_Member *member, const char *directory); | ||
94 | |||
95 | /** | ||
96 | * Saves data from a <i>member</i> into a directory which | ||
97 | * can be load to restore the member completely. | ||
98 | * | ||
99 | * @param[in] member Member | ||
100 | * @param[in] directory Path to a directory | ||
101 | */ | ||
102 | void | ||
103 | save_member (struct GNUNET_MESSENGER_Member *member, const char *directory); | ||
104 | |||
105 | /** | ||
106 | * Synchronizes contacts between all sessions from a given <i>member</i> | ||
107 | * and other sessions which are linked to them. | ||
108 | * | ||
109 | * @param[in/out] member Member | ||
110 | */ | ||
111 | void | ||
112 | sync_member_contacts (struct GNUNET_MESSENGER_Member *member); | ||
113 | |||
114 | /** | ||
115 | * Returns the member session of a <i>member</i> identified by a given public key. | ||
116 | * If the member does not provide a session with the given key, NULL gets returned. | ||
117 | * | ||
118 | * @param[in] member Member | ||
119 | * @param[in] public_key Public key of EGO | ||
120 | * @return Member session | ||
121 | */ | ||
122 | struct GNUNET_MESSENGER_MemberSession* | ||
123 | get_member_session (const struct GNUNET_MESSENGER_Member *member, const struct GNUNET_IDENTITY_PublicKey *public_key); | ||
124 | |||
125 | /** | ||
126 | * Returns the member session of a <i>member</i> using a public key which can verify | ||
127 | * the signature of a given <i>message</i> and its <i>hash</i>. If the member does | ||
128 | * not provide a matching session, NULL gets returned. | ||
129 | * | ||
130 | * @param[in] member Member | ||
131 | * @param[in] message Message | ||
132 | * @param[in] hash Hash of message | ||
133 | * @return Member session | ||
134 | */ | ||
135 | struct GNUNET_MESSENGER_MemberSession* | ||
136 | get_member_session_of (struct GNUNET_MESSENGER_Member *member, const struct GNUNET_MESSENGER_Message *message, | ||
137 | const struct GNUNET_HashCode *hash); | ||
138 | |||
139 | /** | ||
140 | * Adds a given member <i>session</i> to its <i>member</i>. | ||
141 | * | ||
142 | * @param[in/out] member Member | ||
143 | * @param[in/out] session Member session | ||
144 | */ | ||
145 | void | ||
146 | add_member_session (struct GNUNET_MESSENGER_Member *member, struct GNUNET_MESSENGER_MemberSession *session); | ||
147 | |||
148 | /** | ||
149 | * Removes a given member <i>session</i> from its <i>member</i>. | ||
150 | * | ||
151 | * @param[in/out] member Member | ||
152 | * @param[in/out] session Member session | ||
153 | */ | ||
154 | void | ||
155 | remove_member_session (struct GNUNET_MESSENGER_Member *member, struct GNUNET_MESSENGER_MemberSession *session); | ||
156 | |||
157 | /** | ||
158 | * Iterate through all member sessions currently connected to a given <i>member</i> | ||
159 | * and call the provided iterator callback with a selected closure. The function | ||
160 | * will return the amount of member sessions it iterated through. | ||
161 | * | ||
162 | * @param[in/out] member Member | ||
163 | * @param[in] it Iterator callback | ||
164 | * @param[in/out] cls Closure | ||
165 | * @return Amount of sessions iterated through | ||
166 | */ | ||
167 | int | ||
168 | iterate_member_sessions (struct GNUNET_MESSENGER_Member *member, GNUNET_MESSENGER_MemberIteratorCallback it, void* cls); | ||
169 | |||
170 | #endif //GNUNET_SERVICE_MESSENGER_MEMBER_H | ||