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_message_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_message_store.h')
-rw-r--r-- | src/messenger/gnunet-service-messenger_message_store.h | 92 |
1 files changed, 67 insertions, 25 deletions
diff --git a/src/messenger/gnunet-service-messenger_message_store.h b/src/messenger/gnunet-service-messenger_message_store.h index e58459b21..87305826a 100644 --- a/src/messenger/gnunet-service-messenger_message_store.h +++ b/src/messenger/gnunet-service-messenger_message_store.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2020 GNUnet e.V. | 3 | Copyright (C) 2020--2021 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software: you can redistribute it and/or modify it | 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 | 6 | under the terms of the GNU Affero General Public License as published |
@@ -36,85 +36,127 @@ struct GNUNET_MESSENGER_MessageEntry | |||
36 | uint16_t length; | 36 | uint16_t length; |
37 | }; | 37 | }; |
38 | 38 | ||
39 | struct GNUNET_MESSENGER_Message; | ||
40 | |||
41 | struct GNUNET_MESSENGER_MessageLink | ||
42 | { | ||
43 | uint8_t multiple; | ||
44 | |||
45 | struct GNUNET_HashCode first; | ||
46 | struct GNUNET_HashCode second; | ||
47 | }; | ||
48 | |||
39 | struct GNUNET_MESSENGER_MessageStore | 49 | struct GNUNET_MESSENGER_MessageStore |
40 | { | 50 | { |
41 | struct GNUNET_DISK_FileHandle *storage_messages; | 51 | struct GNUNET_DISK_FileHandle *storage_messages; |
42 | 52 | ||
43 | struct GNUNET_CONTAINER_MultiHashMap *entries; | 53 | struct GNUNET_CONTAINER_MultiHashMap *entries; |
44 | struct GNUNET_CONTAINER_MultiHashMap *messages; | 54 | struct GNUNET_CONTAINER_MultiHashMap *messages; |
55 | struct GNUNET_CONTAINER_MultiHashMap *links; | ||
56 | |||
57 | int rewrite_entries; | ||
58 | int write_links; | ||
45 | }; | 59 | }; |
46 | 60 | ||
47 | /** | 61 | /** |
48 | * Initializes a message store as fully empty. | 62 | * Initializes a message <i>store</i> as fully empty. |
49 | * | 63 | * |
50 | * @param store Message store | 64 | * @param[out] store Message store |
51 | */ | 65 | */ |
52 | void | 66 | void |
53 | init_message_store (struct GNUNET_MESSENGER_MessageStore *store); | 67 | init_message_store (struct GNUNET_MESSENGER_MessageStore *store); |
54 | 68 | ||
55 | /** | 69 | /** |
56 | * Clears a message store, wipes its content and deallocates its memory. | 70 | * Clears a message <i>store</i>, wipes its content and deallocates its memory. |
57 | * | 71 | * |
58 | * @param store Message store | 72 | * @param[in/out] store Message store |
59 | */ | 73 | */ |
60 | void | 74 | void |
61 | clear_message_store (struct GNUNET_MESSENGER_MessageStore *store); | 75 | clear_message_store (struct GNUNET_MESSENGER_MessageStore *store); |
62 | 76 | ||
63 | /** | 77 | /** |
64 | * Loads messages from a directory into a message store. | 78 | * Loads messages from a <i>directory</i> into a message <i>store</i>. |
65 | * | 79 | * |
66 | * @param store Message store | 80 | * @param[out] store Message store |
67 | * @param directory Path to a directory | 81 | * @param[in] directory Path to a directory |
68 | */ | 82 | */ |
69 | void | 83 | void |
70 | load_message_store (struct GNUNET_MESSENGER_MessageStore *store, const char *directory); | 84 | load_message_store (struct GNUNET_MESSENGER_MessageStore *store, const char *directory); |
71 | 85 | ||
72 | /** | 86 | /** |
73 | * Saves messages from a message store into a directory. | 87 | * Saves messages from a message <i>store</i> into a <i>directory</i>. |
74 | * | 88 | * |
75 | * @param store Message store | 89 | * @param[in] store Message store |
76 | * @param directory Path to a directory | 90 | * @param[in] directory Path to a directory |
77 | */ | 91 | */ |
78 | void | 92 | void |
79 | save_message_store (struct GNUNET_MESSENGER_MessageStore *store, const char *directory); | 93 | save_message_store (struct GNUNET_MESSENGER_MessageStore *store, const char *directory); |
80 | 94 | ||
81 | /** | 95 | /** |
82 | * Checks if a message matching a given <i>hash</i> is stored in a message store. The function returns | 96 | * Checks if a message matching a given <i>hash</i> is stored in a message <i>store</i>. |
83 | * GNUNET_YES if a match is found, GNUNET_NO otherwise. | 97 | * The function returns #GNUNET_YES if a match is found, #GNUNET_NO otherwise. |
84 | * | 98 | * |
85 | * The message has not to be loaded from disk into memory for this check! | 99 | * The message has not to be loaded from disk into memory for this check! |
86 | * | 100 | * |
87 | * @param store Message store | 101 | * @param[in] store Message store |
88 | * @param hash Hash of message | 102 | * @param[in] hash Hash of message |
89 | * @return GNUNET_YES on match, otherwise GNUNET_NO | 103 | * @return #GNUNET_YES on match, otherwise #GNUNET_NO |
90 | */ | 104 | */ |
91 | int | 105 | int |
92 | contains_store_message (struct GNUNET_MESSENGER_MessageStore *store, const struct GNUNET_HashCode *hash); | 106 | contains_store_message (const struct GNUNET_MESSENGER_MessageStore *store, const struct GNUNET_HashCode *hash); |
93 | 107 | ||
94 | /** | 108 | /** |
95 | * Returns the message from a message store matching a given <i>hash</i>. If no matching message is found, | 109 | * Returns the message from a message <i>store</i> matching a given <i>hash</i>. If no matching |
96 | * NULL gets returned. | 110 | * message is found, NULL gets returned. |
97 | * | 111 | * |
98 | * This function requires the message to be loaded into memory! | 112 | * This function requires the message to be loaded into memory! |
99 | * @see contains_store_message() | 113 | * @see contains_store_message() |
100 | * | 114 | * |
101 | * @param store Message store | 115 | * @param[in/out] store Message store |
102 | * @param hash Hash of message | 116 | * @param[in] hash Hash of message |
103 | * @return Message or NULL | 117 | * @return Message or NULL |
104 | */ | 118 | */ |
105 | const struct GNUNET_MESSENGER_Message* | 119 | const struct GNUNET_MESSENGER_Message* |
106 | get_store_message (struct GNUNET_MESSENGER_MessageStore *store, const struct GNUNET_HashCode *hash); | 120 | get_store_message (struct GNUNET_MESSENGER_MessageStore *store, const struct GNUNET_HashCode *hash); |
107 | 121 | ||
108 | /** | 122 | /** |
123 | * Returns the message link from a message <i>store</i> matching a given <i>hash</i>. If the | ||
124 | * flag is set to #GNUNET_YES, only links from deleted messages will be returned or NULL. | ||
125 | * | ||
126 | * Otherwise message links will also returned for messages found in the store under the given | ||
127 | * hash. The link which will be returned copies link information from the message for | ||
128 | * temporary usage. | ||
129 | * | ||
130 | * @param[in/out] store Message store | ||
131 | * @param[in] hash Hash of message | ||
132 | * @param[in] deleted_only Flag | ||
133 | * @return Message link or NULL | ||
134 | */ | ||
135 | const struct GNUNET_MESSENGER_MessageLink* | ||
136 | get_store_message_link (struct GNUNET_MESSENGER_MessageStore *store, const struct GNUNET_HashCode *hash, | ||
137 | int deleted_only); | ||
138 | |||
139 | /** | ||
109 | * Stores a message into the message store. The result indicates if the operation was successful. | 140 | * Stores a message into the message store. The result indicates if the operation was successful. |
110 | * | 141 | * |
111 | * @param store Message store | 142 | * @param[in/out] store Message store |
112 | * @param hash Hash of message | 143 | * @param[in] hash Hash of message |
113 | * @param message Message | 144 | * @param[in/out] message Message |
114 | * @return GNUNET_OK on success, otherwise GNUNET_NO | 145 | * @return #GNUNET_OK on success, otherwise #GNUNET_NO |
115 | */ | 146 | */ |
116 | int | 147 | int |
117 | put_store_message (struct GNUNET_MESSENGER_MessageStore *store, const struct GNUNET_HashCode *hash, | 148 | put_store_message (struct GNUNET_MESSENGER_MessageStore *store, const struct GNUNET_HashCode *hash, |
118 | struct GNUNET_MESSENGER_Message *message); | 149 | struct GNUNET_MESSENGER_Message *message); |
119 | 150 | ||
151 | /** | ||
152 | * Deletes a message in the message store. It will be removed from disk space and memory. The result | ||
153 | * indicates if the operation was successful. | ||
154 | * | ||
155 | * @param[in/out] store Message store | ||
156 | * @param[in] hash Hash of message | ||
157 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on failure | ||
158 | */ | ||
159 | int | ||
160 | delete_store_message (struct GNUNET_MESSENGER_MessageStore *store, const struct GNUNET_HashCode *hash); | ||
161 | |||
120 | #endif //GNUNET_SERVICE_MESSENGER_MESSAGE_STORE_H | 162 | #endif //GNUNET_SERVICE_MESSENGER_MESSAGE_STORE_H |