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_operation_store.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_operation_store.h')
-rw-r--r-- | src/messenger/gnunet-service-messenger_operation_store.h | 131 |
1 files changed, 131 insertions, 0 deletions
diff --git a/src/messenger/gnunet-service-messenger_operation_store.h b/src/messenger/gnunet-service-messenger_operation_store.h new file mode 100644 index 000000000..2fd604340 --- /dev/null +++ b/src/messenger/gnunet-service-messenger_operation_store.h | |||
@@ -0,0 +1,131 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet. | ||
3 | Copyright (C) 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_operation_store.h | ||
23 | * @brief GNUnet MESSENGER service | ||
24 | */ | ||
25 | |||
26 | #ifndef GNUNET_SERVICE_MESSENGER_OPERATION_STORE_H | ||
27 | #define GNUNET_SERVICE_MESSENGER_OPERATION_STORE_H | ||
28 | |||
29 | #include "platform.h" | ||
30 | #include "gnunet_container_lib.h" | ||
31 | #include "gnunet_crypto_lib.h" | ||
32 | #include "gnunet_scheduler_lib.h" | ||
33 | #include "gnunet_time_lib.h" | ||
34 | |||
35 | struct GNUNET_MESSENGER_SrvRoom; | ||
36 | |||
37 | struct GNUNET_MESSENGER_OperationStore | ||
38 | { | ||
39 | struct GNUNET_MESSENGER_SrvRoom *room; | ||
40 | |||
41 | struct GNUNET_CONTAINER_MultiHashMap *operations; | ||
42 | }; | ||
43 | |||
44 | /** | ||
45 | * Initializes an operation <i>store</i> as fully empty with a given <i>room</i>. | ||
46 | * | ||
47 | * @param[out] store Operation store | ||
48 | * @param[in/out] room Room | ||
49 | */ | ||
50 | void | ||
51 | init_operation_store (struct GNUNET_MESSENGER_OperationStore *store, struct GNUNET_MESSENGER_SrvRoom *room); | ||
52 | |||
53 | /** | ||
54 | * Clears an operation <i>store</i>, stops all operations and deallocates its memory. | ||
55 | * | ||
56 | * @param[in/out] store Operation store | ||
57 | */ | ||
58 | void | ||
59 | clear_operation_store (struct GNUNET_MESSENGER_OperationStore *store); | ||
60 | |||
61 | /** | ||
62 | * Loads operations from a <i>directory</i> into an operation <i>store</i>. | ||
63 | * | ||
64 | * @param[out] store Operation store | ||
65 | * @param[in] directory Path to a directory | ||
66 | */ | ||
67 | void | ||
68 | load_operation_store (struct GNUNET_MESSENGER_OperationStore *store, | ||
69 | const char *directory); | ||
70 | |||
71 | /** | ||
72 | * Saves operations from an operation <i>store</i> into a <i>directory</i>. | ||
73 | * | ||
74 | * @param[in] store Operation store | ||
75 | * @param[in] directory Path to a directory | ||
76 | */ | ||
77 | void | ||
78 | save_operation_store (const struct GNUNET_MESSENGER_OperationStore *store, | ||
79 | const char *directory); | ||
80 | |||
81 | /** | ||
82 | * Retruns the type of the active operation under a given <i>hash</i> in | ||
83 | * a specific operation <i>store</i>. If there is no active operation under | ||
84 | * the given <i>hash</i>, #GNUNET_MESSENGER_OP_UNKNOWN gets returned instead. | ||
85 | * | ||
86 | * @param[in] store Operation store | ||
87 | * @param[in] hash Hash of message | ||
88 | * @return Type of operation or #GNUNET_MESSENGER_OP_UNKNOWN | ||
89 | */ | ||
90 | enum GNUNET_MESSENGER_OperationType | ||
91 | get_store_operation_type (const struct GNUNET_MESSENGER_OperationStore *store, | ||
92 | const struct GNUNET_HashCode *hash); | ||
93 | |||
94 | /** | ||
95 | * Tries to use an operation under a given <i>hash</i> in a specific | ||
96 | * operation <i>store</i>. The operation will use the selected <i>type</i> | ||
97 | * if successful. The operation will be delayed by a given <i>delay</i>. | ||
98 | * | ||
99 | * If the selected type is #GNUNET_MESSENGER_OP_DELETE any active operation | ||
100 | * under the given hash will be stopped and replaced. | ||
101 | * | ||
102 | * If the new operation could be started successfully the method returns | ||
103 | * #GNUNET_OK, otherwise #GNUNET_SYSERR. | ||
104 | * | ||
105 | * @param[in/out] store Operation store | ||
106 | * @param[in] hash Hash of message | ||
107 | * @param[in] type Operation type | ||
108 | * @param[in] delay Delay | ||
109 | * @return #GNUNET_OK on success, otherwise #GNUNET_SYSERR | ||
110 | */ | ||
111 | int | ||
112 | use_store_operation (struct GNUNET_MESSENGER_OperationStore *store, | ||
113 | const struct GNUNET_HashCode *hash, | ||
114 | enum GNUNET_MESSENGER_OperationType type, | ||
115 | struct GNUNET_TIME_Relative delay); | ||
116 | |||
117 | /** | ||
118 | * Stops any active operation under a given <i>hash</i> in a specific | ||
119 | * operation <i>store</i>. | ||
120 | * | ||
121 | * Beware that calling this method will also implicitly free the memory | ||
122 | * of any active operation under the given hash! | ||
123 | * | ||
124 | * @param[in/out] store Operation store | ||
125 | * @param[in] hash Hash of message | ||
126 | */ | ||
127 | void | ||
128 | cancel_store_operation (struct GNUNET_MESSENGER_OperationStore *store, | ||
129 | const struct GNUNET_HashCode *hash); | ||
130 | |||
131 | #endif //GNUNET_SERVICE_MESSENGER_OPERATION_STORE_H | ||