gnunet-android

GNUnet for Android
Log | Files | Refs | README

commit 45571e721065047feab6b1ce425fc877255daa6d
parent 259a1691a0e11c77d81be3c8ea183f663082fec5
Author: t3sserakt <t3ss@posteo.de>
Date:   Wed, 10 Dec 2025 19:51:40 +0100

Update libgnunetchat dependency to v0.6.1 and added missing header files.

Diffstat:
Aandroid_studio/distribution/libgnunetchat/lib/arm64-v8a/include/gnunet_chat_account.h | 114+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Aandroid_studio/distribution/libgnunetchat/lib/arm64-v8a/include/gnunet_chat_accounts.h | 111+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Aandroid_studio/distribution/libgnunetchat/lib/arm64-v8a/include/gnunet_chat_attribute_process.h | 156+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Aandroid_studio/distribution/libgnunetchat/lib/arm64-v8a/include/gnunet_chat_contact.h | 197+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Aandroid_studio/distribution/libgnunetchat/lib/arm64-v8a/include/gnunet_chat_context.h | 194+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Aandroid_studio/distribution/libgnunetchat/lib/arm64-v8a/include/gnunet_chat_discourse.h | 121+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Aandroid_studio/distribution/libgnunetchat/lib/arm64-v8a/include/gnunet_chat_file.h | 241+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Aandroid_studio/distribution/libgnunetchat/lib/arm64-v8a/include/gnunet_chat_group.h | 78++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Aandroid_studio/distribution/libgnunetchat/lib/arm64-v8a/include/gnunet_chat_handle.h | 398+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Aandroid_studio/distribution/libgnunetchat/lib/arm64-v8a/include/gnunet_chat_invitation.h | 75+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mandroid_studio/distribution/libgnunetchat/lib/arm64-v8a/include/gnunet_chat_lib.h | 56++++++++++++++++++++++++++++++++++++++++++++------------
Aandroid_studio/distribution/libgnunetchat/lib/arm64-v8a/include/gnunet_chat_lobby.h | 88+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Aandroid_studio/distribution/libgnunetchat/lib/arm64-v8a/include/gnunet_chat_message.h | 143+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Aandroid_studio/distribution/libgnunetchat/lib/arm64-v8a/include/gnunet_chat_tagging.h | 108+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Aandroid_studio/distribution/libgnunetchat/lib/arm64-v8a/include/gnunet_chat_ticket.h | 84+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Aandroid_studio/distribution/libgnunetchat/lib/arm64-v8a/include/gnunet_chat_ticket_process.h | 115+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Aandroid_studio/distribution/libgnunetchat/lib/arm64-v8a/include/gnunet_chat_uri.h | 107+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Aandroid_studio/distribution/libgnunetchat/lib/arm64-v8a/include/gnunet_chat_util.h | 244+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mandroid_studio/distribution/libgnunetchat/lib/arm64-v8a/libgnunetchat.so | 0
19 files changed, 2618 insertions(+), 12 deletions(-)

diff --git a/android_studio/distribution/libgnunetchat/lib/arm64-v8a/include/gnunet_chat_account.h b/android_studio/distribution/libgnunetchat/lib/arm64-v8a/include/gnunet_chat_account.h @@ -0,0 +1,114 @@ +/* + This file is part of GNUnet. + Copyright (C) 2022--2025 GNUnet e.V. + + GNUnet is free software: you can redistribute it and/or modify it + under the terms of the GNU Affero General Public License as published + by the Free Software Foundation, either version 3 of the License, + or (at your option) any later version. + + GNUnet is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + + SPDX-License-Identifier: AGPL3.0-or-later + */ +/* + * @author Tobias Frisch + * @file gnunet_chat_account.h + */ + +#ifndef GNUNET_CHAT_ACCOUNT_H_ +#define GNUNET_CHAT_ACCOUNT_H_ + +#include <gnunet/gnunet_common.h> +#include <gnunet/gnunet_identity_service.h> +#include <gnunet/gnunet_util_lib.h> + +struct GNUNET_CHAT_Handle; + +struct GNUNET_CHAT_Account +{ + struct GNUNET_IDENTITY_Ego *ego; + enum GNUNET_GenericReturnValue created; + + char *name; + + void *user_pointer; +}; + +/** + * Creates a chat account using a given <i>name</i>. + * + * @param[in] name Name + * @return New chat account + */ +struct GNUNET_CHAT_Account* +account_create (const char *name); + +/** + * Creates a chat account using a given <i>ego</i> and + * a matching <i>name</i>. + * + * @param[in] ego EGO + * @param[in] name Name + * @return New chat account + */ +struct GNUNET_CHAT_Account* +account_create_from_ego (struct GNUNET_IDENTITY_Ego *ego, + const char *name); + +/** + * Returns the private key from a given chat + * <i>account</i>. + * + * @param[in] account Chat account + * @return EGOs private key or NULL + */ +const struct GNUNET_CRYPTO_BlindablePrivateKey* +account_get_key (const struct GNUNET_CHAT_Account *account); + +/** + * Returns the name from a given chat <i>account</i>. + * + * @param[in] account Chat account + * @return Name or NULL + */ +const char* +account_get_name (const struct GNUNET_CHAT_Account *account); + +/** + * Updates the key from a given chat <i>account</i> using + * the chat <i>handle</i> and a specific <i>ego</i> matching + * the accounts name. + * + * @param[in,out] account Chat account + * @param[in,out] handle Chat handle + * @param[in] ego EGO + */ +void +account_update_ego (struct GNUNET_CHAT_Account *account, + struct GNUNET_CHAT_Handle *handle, + struct GNUNET_IDENTITY_Ego *ego); + +/** + * Deletes all data remaining a given chat <i>account</i>. + * + * @param[in,out] account Chat account + */ +void +account_delete (struct GNUNET_CHAT_Account *account); + +/** + * Destroys a chat <i>account</i> and frees its memory. + * + * @param[in,out] account Chat account + */ +void +account_destroy (struct GNUNET_CHAT_Account *account); + +#endif /* GNUNET_CHAT_ACCOUNT_H_ */ diff --git a/android_studio/distribution/libgnunetchat/lib/arm64-v8a/include/gnunet_chat_accounts.h b/android_studio/distribution/libgnunetchat/lib/arm64-v8a/include/gnunet_chat_accounts.h @@ -0,0 +1,111 @@ +/* + This file is part of GNUnet. + Copyright (C) 2024 GNUnet e.V. + + GNUnet is free software: you can redistribute it and/or modify it + under the terms of the GNU Affero General Public License as published + by the Free Software Foundation, either version 3 of the License, + or (at your option) any later version. + + GNUnet is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + + SPDX-License-Identifier: AGPL3.0-or-later + */ +/* + * @author Tobias Frisch + * @file gnunet_chat_accounts.h + */ + +#ifndef GNUNET_CHAT_INTERNAL_ACCOUNTS_H_ +#define GNUNET_CHAT_INTERNAL_ACCOUNTS_H_ + +#include <gnunet/gnunet_identity_service.h> + +enum GNUNET_CHAT_AccountMethod +{ + GNUNET_CHAT_ACCOUNT_CREATION = 1, + GNUNET_CHAT_ACCOUNT_DELETION = 2, + GNUNET_CHAT_ACCOUNT_RENAMING = 3, + GNUNET_CHAT_ACCOUNT_UPDATING = 4, + + GNUNET_CHAT_ACCOUNT_NONE = 0 +}; + +struct GNUNET_CHAT_Handle; +struct GNUNET_CHAT_Account; + +struct GNUNET_CHAT_InternalAccounts +{ + struct GNUNET_CHAT_Handle *handle; + struct GNUNET_CHAT_Account *account; + + char *identifier; + struct GNUNET_IDENTITY_Operation *op; + enum GNUNET_CHAT_AccountMethod method; + + struct GNUNET_CHAT_InternalAccounts *next; + struct GNUNET_CHAT_InternalAccounts *prev; +}; + +/** + * Creates a new internal account resource to + * manage accounts for a given chat <i>handle</i>. + * + * The internal account gets appended to the + * list of accounts from the handle implicitly. + * + * An internal account might represent only an + * operation regarding a certain account while not + * representing the actual account. In most cases + * however this will be equivalent + * (for example iteration). + * + * @param[in,out] handle Chat handle + * @param[in,out] account Chat account or NULL + * @return New internal account resource + */ +struct GNUNET_CHAT_InternalAccounts* +internal_accounts_create(struct GNUNET_CHAT_Handle *handle, + struct GNUNET_CHAT_Account *account); + +/** + * Destroys and frees an internal <i>accounts</i> + * resource while implicitly removing it from its + * chat handles list of accounts. + * + * @param[out] accounts Internal account resource + */ +void +internal_accounts_destroy(struct GNUNET_CHAT_InternalAccounts *accounts); + +/** + * Initializes a given internal <i>accounts</i> + * resource with a selected account <i>method</i> + * to start further internal operations. + * + * @param[in,out] accounts Internal account resource + * @param[in] method Account method + * @param[in] identifier Account identifier or NULL + */ +void +internal_accounts_start_method(struct GNUNET_CHAT_InternalAccounts *accounts, + enum GNUNET_CHAT_AccountMethod method, + const char *identifier); + +/** + * Resets a given internal <i>accounts</i> + * resource to a neutral method state and stops + * its current operation. + * + * @param[in,out] accounts Internal account resource + */ +void +internal_accounts_stop_method(struct GNUNET_CHAT_InternalAccounts *accounts); + +#endif /* GNUNET_CHAT_ACCOUNTS_H_ */ diff --git a/android_studio/distribution/libgnunetchat/lib/arm64-v8a/include/gnunet_chat_attribute_process.h b/android_studio/distribution/libgnunetchat/lib/arm64-v8a/include/gnunet_chat_attribute_process.h @@ -0,0 +1,156 @@ +/* + This file is part of GNUnet. + Copyright (C) 2024 GNUnet e.V. + + GNUnet is free software: you can redistribute it and/or modify it + under the terms of the GNU Affero General Public License as published + by the Free Software Foundation, either version 3 of the License, + or (at your option) any later version. + + GNUnet is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + + SPDX-License-Identifier: AGPL3.0-or-later + */ +/* + * @author Tobias Frisch + * @file gnunet_chat_attribute_process.h + */ + +#ifndef GNUNET_CHAT_INTERNAL_ATTRIBUTE_PROCESS_H_ +#define GNUNET_CHAT_INTERNAL_ATTRIBUTE_PROCESS_H_ + +#include <gnunet/gnunet_reclaim_service.h> + +#include "gnunet_chat_lib.h" + +struct GNUNET_CHAT_Handle; +struct GNUNET_CHAT_Account; +struct GNUNET_CHAT_Contact; + +struct GNUNET_CHAT_AttributeProcess +{ + struct GNUNET_CHAT_Handle *handle; + + struct GNUNET_CHAT_Account *account; + struct GNUNET_CHAT_Contact *contact; + + struct GNUNET_RECLAIM_Attribute *attribute; + struct GNUNET_TIME_Relative expires; + char *name; + void *data; + + GNUNET_CHAT_AttributeCallback callback; + GNUNET_CHAT_AccountAttributeCallback account_callback; + + void *closure; + + struct GNUNET_RECLAIM_AttributeIterator *iter; + struct GNUNET_RECLAIM_Operation *op; + + struct GNUNET_CHAT_AttributeProcess *next; + struct GNUNET_CHAT_AttributeProcess *prev; +}; + +/** + * Creates a new attribute process resource to + * handle general attribute management using + * a given chat <i>handle</i>. + * + * The attribute process gets appended to the + * list of processes from the handle implicitly. + * + * @param[in,out] handle Chat handle + * @param[in] name Attribute name or NULL + * @return New attribute process + */ +struct GNUNET_CHAT_AttributeProcess* +internal_attributes_create(struct GNUNET_CHAT_Handle *handle, + const char *name); + +/** + * Creates a new attribute process resource to + * handle attribute storage of an attribute with + * a specific <i>name</i> using a given chat + * <i>handle</i> and a relative datetime it + * <i>expires</i>. + * + * @see internal_attributes_create() + * + * @param[in,out] handle Chat handle + * @param[in] Attribute name + * @param[in] expires Relative time for expiration + * @return New attribute storage process + */ +struct GNUNET_CHAT_AttributeProcess* +internal_attributes_create_store(struct GNUNET_CHAT_Handle *handle, + const char *name, + struct GNUNET_TIME_Relative expires); + +/** + * Creates a new attribute process resource to + * handle attribute sharing of an attribute with + * a specific <i>name</i> for a certain chat + * <i>contact</i> using a given chat <i>handle</i>. + * + * @see internal_attributes_create() + * + * @param[in,out] handle Chat handle + * @param[in,out] contact Chat contact + * @param[in] Attribute name + * @return New attribute sharing process + */ +struct GNUNET_CHAT_AttributeProcess* +internal_attributes_create_share(struct GNUNET_CHAT_Handle *handle, + struct GNUNET_CHAT_Contact *contact, + const char *name); + +/** + * Creates a new attribute process resource to + * request attributes from a specific chat + * <i>account</i> using a given chat <i>handle</i>. + * + * @see internal_attributes_create() + * + * @param[in,out] handle Chat handle + * @param[in,out] account Chat account + * @return New attribute request process + */ +struct GNUNET_CHAT_AttributeProcess* +internal_attributes_create_request(struct GNUNET_CHAT_Handle *handle, + struct GNUNET_CHAT_Account *account); + +/** + * Destroys and frees a given <i>attributes</i> + * process resource. This will implicitly remove + * it from its chat handles list of processes. + * + * @param[out] attributes Attribute process + */ +void +internal_attributes_destroy(struct GNUNET_CHAT_AttributeProcess *attributes); + +/** + * Continues the iteration of a given <i>attributes</i> + * process resource to its next step. + * + * @param[in,out] attributes Attribute process + */ +void +internal_attributes_next_iter(struct GNUNET_CHAT_AttributeProcess *attributes); + +/** + * Stops the iteration of a given <i>attributes</i> + * process resource. + * + * @param[in,out] attributes Attribute process + */ +void +internal_attributes_stop_iter(struct GNUNET_CHAT_AttributeProcess *attributes); + +#endif /* GNUNET_CHAT_INTERNAL_ATTRIBUTE_PROCESS_H_ */ diff --git a/android_studio/distribution/libgnunetchat/lib/arm64-v8a/include/gnunet_chat_contact.h b/android_studio/distribution/libgnunetchat/lib/arm64-v8a/include/gnunet_chat_contact.h @@ -0,0 +1,197 @@ +/* + This file is part of GNUnet. + Copyright (C) 2021--2025 GNUnet e.V. + + GNUnet is free software: you can redistribute it and/or modify it + under the terms of the GNU Affero General Public License as published + by the Free Software Foundation, either version 3 of the License, + or (at your option) any later version. + + GNUnet is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + + SPDX-License-Identifier: AGPL3.0-or-later + */ +/* + * @author Tobias Frisch + * @file gnunet_chat_contact.h + */ + +#ifndef GNUNET_CHAT_CONTACT_H_ +#define GNUNET_CHAT_CONTACT_H_ + +#include <gnunet/gnunet_common.h> +#include <gnunet/gnunet_messenger_service.h> +#include <gnunet/gnunet_util_lib.h> + +#include "gnunet_chat_lib.h" + +struct GNUNET_CHAT_Handle; +struct GNUNET_CHAT_Contact; +struct GNUNET_CHAT_Context; +struct GNUNET_CHAT_Ticket; + +struct GNUNET_CHAT_InternalTickets +{ + struct GNUNET_CHAT_Ticket *ticket; + + struct GNUNET_CHAT_InternalTickets *next; + struct GNUNET_CHAT_InternalTickets *prev; +}; + +struct GNUNET_CHAT_Contact +{ + struct GNUNET_CHAT_Handle *handle; + struct GNUNET_CHAT_Context *context; + + struct GNUNET_SCHEDULER_Task *destruction; + + const struct GNUNET_MESSENGER_Contact *member; + struct GNUNET_CONTAINER_MultiHashMap *joined; + + struct GNUNET_CHAT_InternalTickets *tickets_head; + struct GNUNET_CHAT_InternalTickets *tickets_tail; + + char *public_key; + void *user_pointer; + + enum GNUNET_GenericReturnValue owned; +}; + +/** + * Creates a chat contact using a given messenger <i>contact</i> + * with a selected chat <i>handle</i>. + * + * @param[in,out] handle Chat handle + * @param[in] member Messenger contact + * @return New chat contact + */ +struct GNUNET_CHAT_Contact* +contact_create_from_member (struct GNUNET_CHAT_Handle *handle, + const struct GNUNET_MESSENGER_Contact *member); + +/** + * Updates the latest <i>hash</i> of a join message from a given + * chat <i>contact</i> in a current chat <i>context</i>. + * + * @param[in,out] contact Chat contact + * @param[in,out] context Chat context + * @param[in] hash Join message hash + * @param[in] flags Join message flags + */ +void +contact_update_join (struct GNUNET_CHAT_Contact *contact, + struct GNUNET_CHAT_Context *context, + const struct GNUNET_HashCode *hash, + enum GNUNET_MESSENGER_MessageFlags flags); + +/** + * Removes local chat <i>contact</i> from a given chat + * <i>context</i>. + * + * @param[in,out] contact Chat contact + * @param[in,out] context Chat context + */ +void +contact_leave (struct GNUNET_CHAT_Contact *contact, + struct GNUNET_CHAT_Context *context); + +/** + * Updates the string representation of the public key from + * a given chat <i>contact</i>. + * + * @param[in,out] contact Chat contact + */ +void +contact_update_key (struct GNUNET_CHAT_Contact *contact); + +/** + * Returns the public key from a given chat <i>contact</i>. + * + * @param[in] contact Chat contact + */ +const struct GNUNET_CRYPTO_BlindablePublicKey* +contact_get_key (const struct GNUNET_CHAT_Contact *contact); + +/** + * Searches for a chat context containing a given chat + * <i>contact</i> and the least amount of other members. + * + * @param[in] contact Chat contact + * @param[in] room_required Flag to suggest a room is required + * @return Chat context or NULL + */ +struct GNUNET_CHAT_Context* +contact_find_context (const struct GNUNET_CHAT_Contact *contact, + enum GNUNET_GenericReturnValue room_required); + +/** + * Returns whether a chat <i>contact</i> is tagged in + * a given chat <i>context</i> with a specific <i>tag</i>. + * + * @param[in] contact Chat contact + * @param[in] context Chat context or NULL (optional) + * @param[in] tag Tag or NULL + * @return #GNUNET_YES if tagged, otherwise #GNUNET_NO + */ +enum GNUNET_GenericReturnValue +contact_is_tagged (const struct GNUNET_CHAT_Contact *contact, + const struct GNUNET_CHAT_Context *context, + const char *tag); + +/** + * Untags a given chat <i>contact</i> in + * a given chat <i>context</i> from a specific <i>tag</i>. + * + * @param[in,out] contact Chat contact + * @param[in,out] context Chat context + */ +void +contact_untag (struct GNUNET_CHAT_Contact *contact, + struct GNUNET_CHAT_Context *context, + const char *tag); + +/** + * Tags a given chat <i>contact</i> in + * a given chat <i>context</i> with a specific <i>tag</i>. + * + * @param[in,out] contact Chat contact + * @param[in,out] context Chat context + * @param[in] tag Tag or NULL + */ +void +contact_tag (struct GNUNET_CHAT_Contact *contact, + struct GNUNET_CHAT_Context *context, + const char *tag); + +/** + * Iterate through all tags of a given chat <i>contact</i> + * in a specific chat <i>context</i> (or all of them) using + * an optional <i>callback</i> with its closure. + * + * @param[in,out] contact Chat contact + * @param[in,out] context Chat context or NULL + * @param[in] callback Callback for tag iteration or NULL + * @param[in,out] cls Closure for tag iteration or NULL + * @return Amount of tags iterated or #GNUNET_SYSERR on error + */ +int +contact_iterate_tags (struct GNUNET_CHAT_Contact *contact, + struct GNUNET_CHAT_Context *context, + GNUNET_CHAT_ContactTagCallback callback, + void *cls); + +/** + * Destroys a chat <i>contact</i> and frees its memory. + * + * @param[in,out] contact Chat contact + */ +void +contact_destroy (struct GNUNET_CHAT_Contact* contact); + +#endif /* GNUNET_CHAT_CONTACT_H_ */ diff --git a/android_studio/distribution/libgnunetchat/lib/arm64-v8a/include/gnunet_chat_context.h b/android_studio/distribution/libgnunetchat/lib/arm64-v8a/include/gnunet_chat_context.h @@ -0,0 +1,194 @@ +/* + This file is part of GNUnet. + Copyright (C) 2021--2025 GNUnet e.V. + + GNUnet is free software: you can redistribute it and/or modify it + under the terms of the GNU Affero General Public License as published + by the Free Software Foundation, either version 3 of the License, + or (at your option) any later version. + + GNUnet is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + + SPDX-License-Identifier: AGPL3.0-or-later + */ +/* + * @author Tobias Frisch + * @file gnunet_chat_context.h + */ + +#ifndef GNUNET_CHAT_CONTEXT_H_ +#define GNUNET_CHAT_CONTEXT_H_ + +#include <gnunet/gnunet_common.h> +#include <gnunet/gnunet_gnsrecord_lib.h> +#include <gnunet/gnunet_messenger_service.h> +#include <gnunet/gnunet_util_lib.h> +#include <stdint.h> + +#include "gnunet_chat_util.h" + +struct GNUNET_CHAT_Handle; +struct GNUNET_CHAT_Message; + +struct GNUNET_CHAT_Context +{ + struct GNUNET_CHAT_Handle *handle; + + union GNUNET_MESSENGER_RoomKey key; + enum GNUNET_CHAT_ContextType type; + uint32_t flags; + char *nick; + char *topic; + int deleted; + + struct GNUNET_SCHEDULER_Task *request_task; + + struct GNUNET_CONTAINER_MultiShortmap *timestamps; + struct GNUNET_CONTAINER_MultiHashMap *dependencies; + struct GNUNET_CONTAINER_MultiHashMap *messages; + struct GNUNET_CONTAINER_MultiHashMap *requests; + struct GNUNET_CONTAINER_MultiHashMap *taggings; + struct GNUNET_CONTAINER_MultiHashMap *invites; + struct GNUNET_CONTAINER_MultiHashMap *files; + struct GNUNET_CONTAINER_MultiShortmap *discourses; + + struct GNUNET_MESSENGER_Room *room; + const struct GNUNET_MESSENGER_Contact *contact; + + void *user_pointer; + + struct GNUNET_CONTAINER_MultiShortmap *member_pointers; + + struct GNUNET_NAMESTORE_QueueEntry *query; +}; + +/** + * Creates a chat context from a messenger <i>room</i> + * with a selected chat <i>handle</i>. + * + * @param[in,out] handle Chat handle + * @param[in,out] room Messenger room + * @return New chat context + */ +struct GNUNET_CHAT_Context* +context_create_from_room (struct GNUNET_CHAT_Handle *handle, + struct GNUNET_MESSENGER_Room *room); + +/** + * Creates a chat context from a messenger <i>contact</i> + * with a selected chat <i>handle</i>. + * + * @param[in,out] handle Chat handle + * @param[in] contact Messenger contact + * @return New chat context + */ +struct GNUNET_CHAT_Context* +context_create_from_contact (struct GNUNET_CHAT_Handle *handle, + const struct GNUNET_MESSENGER_Contact *contact); + +/** + * Destroys a chat <i>context</i> and frees its memory. + * + * @param[in,out] context Chat context + */ +void +context_destroy (struct GNUNET_CHAT_Context* context); + +/** + * Request a message from a chat <i>context</i> with a + * given <i>hash</i>. + * + * @param[in,out] context Chat context + * @param[in] hash Message hash + */ +void +context_request_message (struct GNUNET_CHAT_Context* context, + const struct GNUNET_HashCode *hash); + +/** + * Updates a message with a given <i>hash</i> inside a + * given chat <i>context</i>. + * + * @param[in,out] context Chat context + * @param[in] hash Message hash + */ +void +context_update_message (struct GNUNET_CHAT_Context* context, + const struct GNUNET_HashCode *hash); + +/** + * Updates the connected messenger <i>room</i> of a + * selected chat <i>context</i>. + * + * @param[in,out] context Chat context + * @param[in,out] room Messenger room + * @param[in] record Write changes to records + */ +void +context_update_room (struct GNUNET_CHAT_Context *context, + struct GNUNET_MESSENGER_Room *room, + enum GNUNET_GenericReturnValue record); + +/** + * Updates the <i>nick</i> of a selected chat <i>context</i>. + * + * @param[in,out] context Chat context + * @param[in] nick Nick name + */ +void +context_update_nick (struct GNUNET_CHAT_Context *context, + const char *nick); + +/** + * Deletes linked content from a given chat <i>context</i> + * of a specific chat <i>message</i>. + * + * @param[in,out] context Chat context + * @param[in] message Chat message + */ +void +context_delete_message (struct GNUNET_CHAT_Context *context, + const struct GNUNET_CHAT_Message *message); + +/** + * Reads the <i>data</i> of records under a given <i>label</i> + * and updates the chat <i>context</i> with it. + * + * @param[in,out] context Chat context + * @param[in] label Label + * @param[in] count Count of data + * @param[in] data Records data + */ +void +context_read_records (struct GNUNET_CHAT_Context *context, + const char *label, + unsigned int count, + const struct GNUNET_GNSRECORD_Data *data); + +/** + * Writes the data from a selected chat <i>context</i> into + * the namestore as private records. + * + * @param[in,out] context Chat context + */ +void +context_write_records (struct GNUNET_CHAT_Context *context); + +/** + * Removes the data from a selected chat <i>context</i> from + * the namestore and closes its room optionally. + * + * @param[in,out] context Chat context + * @param[in] exit Closing its room + */ +void +context_delete (struct GNUNET_CHAT_Context *context, + enum GNUNET_GenericReturnValue exit); + +#endif /* GNUNET_CHAT_CONTEXT_H_ */ diff --git a/android_studio/distribution/libgnunetchat/lib/arm64-v8a/include/gnunet_chat_discourse.h b/android_studio/distribution/libgnunetchat/lib/arm64-v8a/include/gnunet_chat_discourse.h @@ -0,0 +1,121 @@ +/* + This file is part of GNUnet. + Copyright (C) 2024 GNUnet e.V. + + GNUnet is free software: you can redistribute it and/or modify it + under the terms of the GNU Affero General Public License as published + by the Free Software Foundation, either version 3 of the License, + or (at your option) any later version. + + GNUnet is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + + SPDX-License-Identifier: AGPL3.0-or-later + */ +/* + * @author Tobias Frisch + * @file gnunet_chat_discourse.h + */ + +#ifndef GNUNET_CHAT_DISCOURSE_H_ +#define GNUNET_CHAT_DISCOURSE_H_ + +#include "gnunet_chat_util.h" + +#include <gnunet/gnunet_common.h> +#include <gnunet/gnunet_messenger_service.h> +#include <gnunet/gnunet_time_lib.h> +#include <gnunet/gnunet_util_lib.h> + +struct GNUNET_CHAT_Contact; +struct GNUNET_CHAT_Context; + +struct GNUNET_CHAT_DiscourseSubscription +{ + struct GNUNET_CHAT_DiscourseSubscription *prev; + struct GNUNET_CHAT_DiscourseSubscription *next; + + struct GNUNET_CHAT_Discourse *discourse; + + struct GNUNET_TIME_Absolute start; + struct GNUNET_TIME_Absolute end; + + struct GNUNET_CHAT_Contact *contact; + struct GNUNET_SCHEDULER_Task *task; +}; + +struct GNUNET_CHAT_Discourse +{ + struct GNUNET_CHAT_Context *context; + + struct GNUNET_CHAT_DiscourseId id; + int pipe [2]; + + struct GNUNET_CHAT_DiscourseSubscription *head; + struct GNUNET_CHAT_DiscourseSubscription *tail; + + struct GNUNET_SCHEDULER_Task *pipe_task; + + void *user_pointer; +}; + +/** + * Creates a chat discourse within a chat <i>context</i> + * with a selected discourse <i>id</i>. + * + * @param[in,out] context Chat context + * @param[in] id Discourse id + * @return New chat discourse + */ +struct GNUNET_CHAT_Discourse* +discourse_create (struct GNUNET_CHAT_Context *context, + const struct GNUNET_CHAT_DiscourseId *id); + +/** + * Destroys a chat <i>discourse</i> and frees its memory. + * + * @param[in,out] discourse Chat discourse + */ +void +discourse_destroy (struct GNUNET_CHAT_Discourse *discourse); + +/** + * Updates the subscription of a specific chat <i>contact</i> + * to a given chat <i>discourse</i> with a selected + * <i>timestamp</i> and relative <i>time</i> window. + * + * @param[in,out] discourse Chat discourse + * @param[in,out] contact Chat contact + * @param[in] timestamp Timestamp + * @param[in] time Time window + * @return #GNUNET_YES on updating an existing subscription, + * #GNUNET_SYSERR on failure, otherwise #GNUNET_NO + */ +enum GNUNET_GenericReturnValue +discourse_subscribe (struct GNUNET_CHAT_Discourse *discourse, + struct GNUNET_CHAT_Contact *contact, + const struct GNUNET_TIME_Absolute timestamp, + const struct GNUNET_TIME_Relative time); + +/** + * Ends the subscription of a specific chat <i>contact</i> + * to a given chat <i>discourse</i> at a selected + * <i>timestamp</i> with a potential <i>delay</i>. + * + * @param[in,out] discourse Chat discourse + * @param[in,out] contact Chat contact + * @param[in] timestamp Timestamp + * @param[in] delay Delay + */ +void +discourse_unsubscribe (struct GNUNET_CHAT_Discourse *discourse, + struct GNUNET_CHAT_Contact *contact, + const struct GNUNET_TIME_Absolute timestamp, + const struct GNUNET_TIME_Relative delay); + +#endif /* GNUNET_CHAT_DISCOURSE_H_ */ diff --git a/android_studio/distribution/libgnunetchat/lib/arm64-v8a/include/gnunet_chat_file.h b/android_studio/distribution/libgnunetchat/lib/arm64-v8a/include/gnunet_chat_file.h @@ -0,0 +1,241 @@ +/* + This file is part of GNUnet. + Copyright (C) 2021--2024 GNUnet e.V. + + GNUnet is free software: you can redistribute it and/or modify it + under the terms of the GNU Affero General Public License as published + by the Free Software Foundation, either version 3 of the License, + or (at your option) any later version. + + GNUnet is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + + SPDX-License-Identifier: AGPL3.0-or-later + */ +/* + * @author Tobias Frisch + * @file gnunet_chat_file.h + */ + +#ifndef GNUNET_CHAT_FILE_H_ +#define GNUNET_CHAT_FILE_H_ + +#include <gnunet/gnunet_fs_service.h> +#include <gnunet/gnunet_messenger_service.h> +#include <gnunet/gnunet_util_lib.h> + +#include "gnunet_chat_lib.h" + +struct GNUNET_CHAT_FileUpload +{ + struct GNUNET_CHAT_FileUpload *prev; + struct GNUNET_CHAT_FileUpload *next; + + struct GNUNET_CHAT_Context *context; + GNUNET_CHAT_FileUploadCallback callback; + + void *cls; +}; + +struct GNUNET_CHAT_FileDownload +{ + struct GNUNET_CHAT_FileDownload *prev; + struct GNUNET_CHAT_FileDownload *next; + + GNUNET_CHAT_FileDownloadCallback callback; + + void *cls; +}; + +struct GNUNET_CHAT_FileUnindex +{ + struct GNUNET_CHAT_FileUnindex *prev; + struct GNUNET_CHAT_FileUnindex *next; + + GNUNET_CHAT_FileUnindexCallback callback; + + void *cls; +}; + +struct GNUNET_CHAT_Handle; + +#define GNUNET_CHAT_FILE_STATUS_DOWNLOAD 0x1 +#define GNUNET_CHAT_FILE_STATUS_PUBLISH 0x2 +#define GNUNET_CHAT_FILE_STATUS_UNINDEX 0x4 +#define GNUNET_CHAT_FILE_STATUS_MASK 0x7 + +struct GNUNET_CHAT_File +{ + struct GNUNET_CHAT_Handle *handle; + + char *name; + + struct GNUNET_HashCode hash; + struct GNUNET_CRYPTO_SymmetricSessionKey *key; + struct GNUNET_FS_MetaData *meta; + struct GNUNET_FS_Uri *uri; + + struct GNUNET_FS_DownloadContext *download; + struct GNUNET_FS_PublishContext *publish; + struct GNUNET_FS_UnindexContext *unindex; + + struct GNUNET_CHAT_FileUpload *upload_head; + struct GNUNET_CHAT_FileUpload *upload_tail; + + struct GNUNET_CHAT_FileDownload *download_head; + struct GNUNET_CHAT_FileDownload *download_tail; + + struct GNUNET_CHAT_FileUnindex *unindex_head; + struct GNUNET_CHAT_FileUnindex *unindex_tail; + + int status; + char *preview; + + void *user_pointer; +}; + +/** + * Creates a chat file handle from a file body in a + * <i>message</i> with a selected chat <i>handle</i>. + * + * @param[in,out] handle Chat handle + * @param[in] message File message body + * @return New chat file handle + */ +struct GNUNET_CHAT_File* +file_create_from_message (struct GNUNET_CHAT_Handle *handle, + const struct GNUNET_MESSENGER_MessageFile *message); + +/** + * Creates a chat file handle from a FS CHK URI and + * with a selected chat <i>handle</i>. + * + * @param[in,out] handle Chat handle + * @param[in] uri FS CHK URI + * @return New chat file handle + */ +struct GNUNET_CHAT_File* +file_create_from_chk_uri (struct GNUNET_CHAT_Handle *handle, + const struct GNUNET_FS_Uri *uri); + +/** + * Creates a chat file handle from a local file on disk + * under a given <i>name</i> using a <i>hash</i> and a + * selected symmetric <i>key</i> with a selected chat + * <i>handle</i>. + * + * @param[in,out] handle Chat handle + * @param[in] name File name + * @param[in] hash File hash + * @param[in] key Symmetric key + * @return New chat file handle + */ +struct GNUNET_CHAT_File* +file_create_from_disk (struct GNUNET_CHAT_Handle *handle, + const char *name, + const struct GNUNET_HashCode *hash, + const struct GNUNET_CRYPTO_SymmetricSessionKey *key); + +/** + * Destroys a chat <i>file</i> handle and frees its memory. + * + * @param[in,out] file Chat file handle + */ +void +file_destroy (struct GNUNET_CHAT_File *file); + +/** + * Binds a chat <i>context</i>, a callback and a closure + * to a given chat <i>file</i> handle to be called on any + * progress uploading the regarding file. + * + * @param[in,out] file Chat file handle + * @param[in,out] context Chat context + * @param[in] cb Callback for upload progress + * @param[in,out] cls Closure + */ +void +file_bind_upload (struct GNUNET_CHAT_File *file, + struct GNUNET_CHAT_Context *context, + GNUNET_CHAT_FileUploadCallback cb, + void *cls); + +/** + * Binds a callback and a closure to a given chat <i>file</i> + * handle to be called on any progress downloading the + * regarding file. + * + * @param[in,out] file Chat file handle + * @param[in] cb Callback for download progress + * @param[in,out] cls Closure + */ +void +file_bind_downlaod (struct GNUNET_CHAT_File *file, + GNUNET_CHAT_FileDownloadCallback cb, + void *cls); + +/** + * Binds a callback and a closure to a given chat <i>file</i> + * handle to be called on any progress unindexing the + * regarding file. + * + * @param[in,out] file Chat file handle + * @param[in] cb Callback for unindex progress + * @param[in,out] cls Closure + */ +void +file_bind_unindex (struct GNUNET_CHAT_File *file, + GNUNET_CHAT_FileUnindexCallback cb, + void *cls); + +/** + * Calls the regarding events and bound callback of a given + * chat <i>file</i> handle to a file upload progress using + * the provided state of <i>completed</i> bytes and its file + * <i>size</i>. + * + * @param[in,out] file Chat file handle + * @param[in] completed Amount of uploaded bytes + * @param[in] size Full file size + */ +void +file_update_upload (struct GNUNET_CHAT_File *file, + uint64_t completed, + uint64_t size); + +/** + * Calls the regarding events and bound callback of a given + * chat <i>file</i> handle to a file download progress using + * the provided state of <i>completed</i> bytes and its file + * <i>size</i>. + * + * @param[in,out] file Chat file handle + * @param[in] completed Amount of downloaded bytes + * @param[in] size Full file size + */ +void +file_update_download (struct GNUNET_CHAT_File *file, + uint64_t completed, + uint64_t size); + +/** + * Calls the regarding events and bound callback of a given + * chat <i>file</i> handle to a file unindex progress using + * the provided state of <i>completed</i> bytes and its file + * <i>size</i>. + * + * @param[in,out] file Chat file handle + * @param[in] completed Amount of unindexed bytes + * @param[in] size Full file size + */ +void +file_update_unindex (struct GNUNET_CHAT_File *file, + uint64_t completed, + uint64_t size); + +#endif /* GNUNET_CHAT_FILE_H_ */ diff --git a/android_studio/distribution/libgnunetchat/lib/arm64-v8a/include/gnunet_chat_group.h b/android_studio/distribution/libgnunetchat/lib/arm64-v8a/include/gnunet_chat_group.h @@ -0,0 +1,78 @@ +/* + This file is part of GNUnet. + Copyright (C) 2021--2024 GNUnet e.V. + + GNUnet is free software: you can redistribute it and/or modify it + under the terms of the GNU Affero General Public License as published + by the Free Software Foundation, either version 3 of the License, + or (at your option) any later version. + + GNUnet is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + + SPDX-License-Identifier: AGPL3.0-or-later + */ +/* + * @author Tobias Frisch + * @file gnunet_chat_group.h + */ + +#ifndef GNUNET_CHAT_GROUP_H_ +#define GNUNET_CHAT_GROUP_H_ + +#include <gnunet/gnunet_regex_service.h> +#include <gnunet/gnunet_util_lib.h> + +struct GNUNET_CHAT_Handle; +struct GNUNET_CHAT_Context; + +struct GNUNET_CHAT_Group +{ + struct GNUNET_CHAT_Handle *handle; + struct GNUNET_CHAT_Context *context; + + struct GNUNET_SCHEDULER_Task *destruction; + + struct GNUNET_REGEX_Announcement *announcement; + struct GNUNET_REGEX_Search *search; + + struct GNUNET_CONTAINER_MultiPeerMap *registry; + + void *user_pointer; +}; + +/** + * Creates a chat group from a chat <i>context</i> + * with a selected chat <i>handle</i>. + * + * @param[in,out] handle Chat handle + * @param[in,out] context Chat context + * @return New chat group + */ +struct GNUNET_CHAT_Group* +group_create_from_context (struct GNUNET_CHAT_Handle *handle, + struct GNUNET_CHAT_Context *context); + +/** + * Destroys a chat <i>group</i> and frees its memory. + * + * @param[in,out] group Chat group + */ +void +group_destroy (struct GNUNET_CHAT_Group* group); + +/** + * Publishes a selected chat <i>group</i> under the + * topic of its context. + * + * @param[in,out] group Chat group + */ +void +group_publish (struct GNUNET_CHAT_Group* group); + +#endif /* GNUNET_CHAT_GROUP_H_ */ diff --git a/android_studio/distribution/libgnunetchat/lib/arm64-v8a/include/gnunet_chat_handle.h b/android_studio/distribution/libgnunetchat/lib/arm64-v8a/include/gnunet_chat_handle.h @@ -0,0 +1,398 @@ +/* + This file is part of GNUnet. + Copyright (C) 2021--2025 GNUnet e.V. + + GNUnet is free software: you can redistribute it and/or modify it + under the terms of the GNU Affero General Public License as published + by the Free Software Foundation, either version 3 of the License, + or (at your option) any later version. + + GNUnet is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + + SPDX-License-Identifier: AGPL3.0-or-later + */ +/* + * @author Tobias Frisch + * @file gnunet_chat_handle.h + */ + +#ifndef GNUNET_CHAT_HANDLE_H_ +#define GNUNET_CHAT_HANDLE_H_ + +#include "gnunet_chat_lib.h" +#include "gnunet_chat_account.h" +#include "gnunet_chat_contact.h" +#include "gnunet_chat_lobby.h" +#include "gnunet_chat_message.h" +#include "gnunet_chat_uri.h" + +#include "internal/gnunet_chat_accounts.h" +#include "internal/gnunet_chat_attribute_process.h" +#include "internal/gnunet_chat_ticket_process.h" + +#include <gnunet/gnunet_common.h> +#include <gnunet/gnunet_arm_service.h> +#include <gnunet/gnunet_fs_service.h> +#include <gnunet/gnunet_gns_service.h> +#include <gnunet/gnunet_identity_service.h> +#include <gnunet/gnunet_messenger_service.h> +#include <gnunet/gnunet_namestore_service.h> +#include <gnunet/gnunet_reclaim_lib.h> +#include <gnunet/gnunet_reclaim_service.h> +#include <gnunet/gnunet_time_lib.h> +#include <gnunet/gnunet_util_lib.h> + +struct GNUNET_CHAT_Handle; + +struct GNUNET_CHAT_InternalServices +{ + struct GNUNET_CHAT_Handle *chat; + struct GNUNET_ARM_Operation *op; + struct GNUNET_CHAT_InternalServices *next; + struct GNUNET_CHAT_InternalServices *prev; +}; + +struct GNUNET_CHAT_InternalMessages +{ + struct GNUNET_CHAT_Handle *chat; + struct GNUNET_CHAT_Message *msg; + struct GNUNET_SCHEDULER_Task *task; + struct GNUNET_CHAT_InternalMessages *next; + struct GNUNET_CHAT_InternalMessages *prev; +}; + +struct GNUNET_CHAT_InternalLobbies +{ + struct GNUNET_CHAT_Lobby *lobby; + struct GNUNET_CHAT_InternalLobbies *next; + struct GNUNET_CHAT_InternalLobbies *prev; +}; + +struct GNUNET_CHAT_UriLookups +{ + struct GNUNET_CHAT_Handle *handle; + + struct GNUNET_GNS_LookupRequest *request; + struct GNUNET_CHAT_Uri *uri; + + struct GNUNET_CHAT_UriLookups *next; + struct GNUNET_CHAT_UriLookups *prev; +}; + +struct GNUNET_CHAT_Handle +{ + const struct GNUNET_CONFIGURATION_Handle* cfg; + struct GNUNET_SCHEDULER_Task *shutdown_hook; + struct GNUNET_SCHEDULER_Task *destruction; + struct GNUNET_SCHEDULER_Task *connection; + struct GNUNET_SCHEDULER_Task *refresh; + + struct GNUNET_CHAT_InternalServices *services_head; + struct GNUNET_CHAT_InternalServices *services_tail; + + struct GNUNET_CHAT_InternalMessages *internal_head; + struct GNUNET_CHAT_InternalMessages *internal_tail; + + char *directory; + + GNUNET_CHAT_ContextMessageCallback msg_cb; + void *msg_cls; + + struct GNUNET_CHAT_InternalAccounts *accounts_head; + struct GNUNET_CHAT_InternalAccounts *accounts_tail; + + enum GNUNET_GenericReturnValue refreshing; + struct GNUNET_CHAT_Contact *own_contact; + + struct GNUNET_CHAT_Account *next; + struct GNUNET_CHAT_Account *current; + struct GNUNET_NAMESTORE_ZoneMonitor *monitor; + + struct GNUNET_CHAT_InternalLobbies *lobbies_head; + struct GNUNET_CHAT_InternalLobbies *lobbies_tail; + + struct GNUNET_CHAT_UriLookups *lookups_head; + struct GNUNET_CHAT_UriLookups *lookups_tail; + + struct GNUNET_CHAT_AttributeProcess *attributes_head; + struct GNUNET_CHAT_AttributeProcess *attributes_tail; + + struct GNUNET_CHAT_TicketProcess *tickets_head; + struct GNUNET_CHAT_TicketProcess *tickets_tail; + + struct GNUNET_CONTAINER_MultiHashMap *files; + struct GNUNET_CONTAINER_MultiHashMap *contexts; + struct GNUNET_CONTAINER_MultiShortmap *contacts; + struct GNUNET_CONTAINER_MultiHashMap *groups; + struct GNUNET_CONTAINER_MultiHashMap *invitations; + + struct GNUNET_ARM_Handle *arm; + struct GNUNET_FS_Handle *fs; + struct GNUNET_GNS_Handle *gns; + struct GNUNET_IDENTITY_Handle *identity; + struct GNUNET_MESSENGER_Handle *messenger; + struct GNUNET_NAMESTORE_Handle *namestore; + struct GNUNET_RECLAIM_Handle *reclaim; + + char *public_key; + void *user_pointer; +}; + +/** + * Creates a chat handle with a selected configuration, + * a custom message callback and a custom closure for + * the callback. + * + * @param[in] cfg Configuration + * @param[in] msg_cb Message callback + * @param[in,out] msg_cls Closure + * @return New chat handle + */ +struct GNUNET_CHAT_Handle* +handle_create_from_config (const struct GNUNET_CONFIGURATION_Handle* cfg, + GNUNET_CHAT_ContextMessageCallback msg_cb, + void *msg_cls); + +/** + * Updates the string representation of the public key from + * a given chat <i>handle</i>. + * + * @param[in,out] handle Chat handle + */ +void +handle_update_key (struct GNUNET_CHAT_Handle *handle); + +/** + * Destroys a chat <i>handle</i> and frees its memory. + * + * @param[in,out] handle Chat handle + */ +void +handle_destroy (struct GNUNET_CHAT_Handle *handle); + +/** + * Connects a given chat <i>handle</i> to a selected + * chat <i>account</i> using it for further operations. + * + * @param[in,out] handle Chat handle + * @param[in] account Chat account + */ +void +handle_connect (struct GNUNET_CHAT_Handle *handle, + struct GNUNET_CHAT_Account *account); + +/** + * Disconnects a given chat <i>handle</i> from its current + * connected chat account. + * + * @param[in,out] handle Chat handle + */ +void +handle_disconnect (struct GNUNET_CHAT_Handle *handle); + +/** + * Searches for an existing chat account by <i>name</i> as + * identifier for a given chat <i>handle</i>. + * + * @param[in] handle Chat handle + * @param[in] name Chat account name + * @param[in] skip_op Whether to skip accounts with active operation + * @return Chat account + */ +struct GNUNET_CHAT_Account* +handle_get_account_by_name (const struct GNUNET_CHAT_Handle *handle, + const char *name, + enum GNUNET_GenericReturnValue skip_op); + +/** + * Enqueues a creation for a chat account with a specific + * <i>name</i> as identifier for a given chat <i>handle</i>. + * + * @param[in,out] handle Chat handle + * @param[in] name Chat account name + * @return #GNUNET_OK on success, otherwise #GNUNET_SYSERR + */ +enum GNUNET_GenericReturnValue +handle_create_account (struct GNUNET_CHAT_Handle *handle, + const char *name); + +/** + * Enqueues a deletion for a chat <i>account</i> of a + * given chat <i>handle</i>. + * + * @param[in,out] handle Chat handle + * @param[in] account Chat account + * @return #GNUNET_OK on success, otherwise #GNUNET_SYSERR + */ +enum GNUNET_GenericReturnValue +handle_delete_account (struct GNUNET_CHAT_Handle *handle, + const struct GNUNET_CHAT_Account *account); + +/** + * Renames a chat <i>account</i> of a given chat + * <i>handle</i> to another specific <i>new_name</i>. + * + * @param[in,out] handle Chat handle + * @param[in] account Chat account + * @param[in] new_name New chat account name + * @return #GNUNET_OK on success, otherwise #GNUNET_SYSERR + */ +enum GNUNET_GenericReturnValue +handle_rename_account (struct GNUNET_CHAT_Handle *handle, + const struct GNUNET_CHAT_Account *account, + const char *new_name); + +/** + * Enqueues a deletion for a chat <i>lobby</i> for a + * given chat <i>handle</i>. + * + * @param[in,out] handle Chat handle + * @param[in] lobby Chat lobby + * @return #GNUNET_OK on success, otherwise #GNUNET_SYSERR + */ +enum GNUNET_GenericReturnValue +handle_delete_lobby (struct GNUNET_CHAT_Handle *handle, + const struct GNUNET_CHAT_Lobby *lobby); + +/** + * Returns the main directory path to store information + * of a given chat <i>handle</i>. + * + * @param[in] handle Chat handle + * @return Directory path + */ +const char* +handle_get_directory (const struct GNUNET_CHAT_Handle *handle); + +/** + * Returns an allocated string providing the full path to + * a file stored by a chat <i>handle</i> with a given + * <i>hash</i>. + * + * @param[in] handle Chat handle + * @param[in] hash File hash + * @return File path + */ +char* +handle_create_file_path (const struct GNUNET_CHAT_Handle *handle, + const struct GNUNET_HashCode *hash); + +/** + * Updates the used private key by creating a new identity + * using the same identifier as currently in use, replacing + * the old identity. + * + * @param[in,out] handle Chat handle + * @return #GNUNET_OK on success, #GNUNET_SYSERR on failure + */ +enum GNUNET_GenericReturnValue +handle_update (struct GNUNET_CHAT_Handle *handle); + +/** + * Returns the private key from the current connected chat + * account of a given chat <i>handle</i>. + * + * @param[in] handle Chat handle + * @return EGOs private key or NULL + */ +const struct GNUNET_CRYPTO_BlindablePrivateKey* +handle_get_key (const struct GNUNET_CHAT_Handle *handle); + +/** + * Sends an internal chat message from a given chat + * <i>handle</i> with an optional chat <i>account</i> or + * <i>context</i>, a custom <i>flag</i> and an optional + * <i>warning</i> text. + * + * You can select whether the callback for the internal + * message should be scheduled dynamically or be called + * as instant feedback. + * + * @param[in,out] handle Chat handle + * @param[in,out] account Chat account or NULL + * @param[in,out] context Chat context or NULL + * @param[in] flag Chat message flag + * @param[in] warning Warning text + * @param[in] feedback Instant feedback + */ +void +handle_send_internal_message (struct GNUNET_CHAT_Handle *handle, + struct GNUNET_CHAT_Account *account, + struct GNUNET_CHAT_Context *context, + enum GNUNET_CHAT_MessageFlag flag, + const char *warning, + enum GNUNET_GenericReturnValue feedback); + +/** + * Sends a name message to a messenger <i>room</i> with + * a selected chat <i>handle</i>. + * + * @param[in,out] handle Chat handle + * @param[in,out] room Messenger room + */ +void +handle_send_room_name (struct GNUNET_CHAT_Handle *handle, + struct GNUNET_MESSENGER_Room *room); + +/** + * Checks a given chat <i>handle</i> for any chat context + * connected with a messenger <i>room</i>, creates it if + * necessary and manages its context type. + * + * @param[in,out] handle Chat handle + * @param[in,out] room Messenger room + * @return #GNUNET_OK on success, otherwise #GNUNET_SYSERR + */ +enum GNUNET_GenericReturnValue +handle_request_context_by_room (struct GNUNET_CHAT_Handle *handle, + struct GNUNET_MESSENGER_Room *room); + +/** + * Returns the chat contact registered for a given messenger + * <i>contact</i> by a selected chat <i>handle</i>. + * + * @param[in] handle Chat handle + * @param[in] contact Messenger contact + * @return Chat contact or NULL + */ +struct GNUNET_CHAT_Contact* +handle_get_contact_from_messenger (const struct GNUNET_CHAT_Handle *handle, + const struct GNUNET_MESSENGER_Contact *contact); + +/** + * Returns the chat group registered for a given messenger + * <i>room</i> by a selected chat <i>handle</i>. + * + * @param[in] handle Chat handle + * @param[in] room Messenger room + * @return Chat group or NULL + */ +struct GNUNET_CHAT_Group* +handle_get_group_from_messenger (const struct GNUNET_CHAT_Handle *handle, + const struct GNUNET_MESSENGER_Room *room); + +/** + * Processes the <i>data</i> of records under a given + * <i>label</i> and creates a matching chat <i>context</i> + * with it if it does not exist already, registered by a chat + * <i>handle</i>, to be updated. + * + * @param[in,out] handle Chat handle + * @param[in] label Namestore label + * @param[in] count Count of data + * @param[in] data Records data + * @return Chat context or NULL + */ +struct GNUNET_CHAT_Context* +handle_process_records (struct GNUNET_CHAT_Handle *handle, + const char *label, + unsigned int count, + const struct GNUNET_GNSRECORD_Data *data); + +#endif /* GNUNET_CHAT_HANDLE_H_ */ diff --git a/android_studio/distribution/libgnunetchat/lib/arm64-v8a/include/gnunet_chat_invitation.h b/android_studio/distribution/libgnunetchat/lib/arm64-v8a/include/gnunet_chat_invitation.h @@ -0,0 +1,75 @@ +/* + This file is part of GNUnet. + Copyright (C) 2021--2025 GNUnet e.V. + + GNUnet is free software: you can redistribute it and/or modify it + under the terms of the GNU Affero General Public License as published + by the Free Software Foundation, either version 3 of the License, + or (at your option) any later version. + + GNUnet is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + + SPDX-License-Identifier: AGPL3.0-or-later + */ +/* + * @author Tobias Frisch + * @file gnunet_chat_invitation.h + */ + +#ifndef GNUNET_CHAT_INVITATION_H_ +#define GNUNET_CHAT_INVITATION_H_ + +#include <gnunet/gnunet_messenger_service.h> +#include <gnunet/gnunet_scheduler_lib.h> +#include <gnunet/gnunet_util_lib.h> + +struct GNUNET_CHAT_Context; + +struct GNUNET_CHAT_Invitation +{ + struct GNUNET_CHAT_Context *context; + struct GNUNET_SCHEDULER_Task *task; + + struct GNUNET_HashCode hash; + + union GNUNET_MESSENGER_RoomKey key; + GNUNET_PEER_Id door; +}; + +/** + * Creates a chat invitation from an invite body in a + * <i>message</i> with a selected chat <i>context</i>. + * + * @param[in,out] context Chat context + * @param[in] message Invite message body + * @return New chat invitation + */ +struct GNUNET_CHAT_Invitation* +invitation_create_from_message (struct GNUNET_CHAT_Context *context, + const struct GNUNET_HashCode *hash, + const struct GNUNET_MESSENGER_MessageInvite *message); + +/** + * Destroys a chat <i>invitation</i> and frees its memory. + * + * @param[in,out] invitation Chat invitation + */ +void +invitation_destroy (struct GNUNET_CHAT_Invitation *invitation); + +/** + * Updates a chat <i>invitation</i> for applications to + * notice any status changes. + * + * @param[in,out] invitation Chat invitation + */ +void +invitation_update (struct GNUNET_CHAT_Invitation *invitation); + +#endif /* GNUNET_CHAT_INVITATION_H_ */ diff --git a/android_studio/distribution/libgnunetchat/lib/arm64-v8a/include/gnunet_chat_lib.h b/android_studio/distribution/libgnunetchat/lib/arm64-v8a/include/gnunet_chat_lib.h @@ -34,18 +34,8 @@ */ /**@{*/ -#ifndef __cplusplus #include <gnunet/gnunet_util_lib.h> -#else -enum GNUNET_GenericReturnValue { - GNUNET_SYSERR = -1, - GNUNET_NO = 0, - GNUNET_OK = 1, - GNUNET_YES = 1, -}; -struct GNUNET_CONFIGURATION_Handle; -#endif #include <stdint.h> #include <time.h> @@ -55,7 +45,7 @@ struct GNUNET_CONFIGURATION_Handle; * the #GNUNET_MESSENGER_VERSION of the GNUnet Messenger * service while the patch version is independent. */ -#define GNUNET_CHAT_VERSION 0x000000050003L +#define GNUNET_CHAT_VERSION 0x000000060001L #define GNUNET_CHAT_VERSION_MAJOR ((GNUNET_CHAT_VERSION >> 32L) & 0xFFFFL) #define GNUNET_CHAT_VERSION_MINOR ((GNUNET_CHAT_VERSION >> 16L) & 0xFFFFL) @@ -897,6 +887,16 @@ GNUNET_CHAT_iterate_contacts (struct GNUNET_CHAT_Handle *handle, void *cls); /** + * Returns the chat contact matching a given chat <i>handle</i>'s current + * account. + * + * @param[in,out] handle Chat handle + * @return Chat contact or NULL + */ +struct GNUNET_CHAT_Contact* +GNUNET_CHAT_get_own_contact (struct GNUNET_CHAT_Handle *handle); + +/** * Returns the provided name of a given <i>account</i> or NULL on failure. * * @param[in] account Chat account @@ -1256,7 +1256,7 @@ GNUNET_CHAT_group_get_context (struct GNUNET_CHAT_Group *group); * #GNUNET_SYSERR otherwise. */ enum GNUNET_GenericReturnValue -GNUNET_CHAT_context_get_status (const struct GNUNET_CHAT_Context *context); +GNUNET_CHAT_context_get_status (struct GNUNET_CHAT_Context *context); /** * Requests a <i>context</i> to get established between all required contacts. @@ -1559,6 +1559,27 @@ const char* GNUNET_CHAT_message_get_text (const struct GNUNET_CHAT_Message *message); /** + * Sets a custom <i>user pointer</i> to a given <i>message</i> so it can + * be accessed in message related callbacks. + * + * @param[in,out] message Message + * @param[in] user_pointer Custom user pointer + */ +void +GNUNET_CHAT_message_set_user_pointer (struct GNUNET_CHAT_Message *message, + void *user_pointer); + +/** + * Returns the custom user pointer of a given <i>message</i> or NULL if it + * was not set any. + * + * @param[in] message Message + * @return Custom user pointer + */ +void* +GNUNET_CHAT_message_get_user_pointer (const struct GNUNET_CHAT_Message *message); + +/** * Returns the account of a given <i>message</i> which is either * its sender or target of the message depending on the kind of * the message, otherwise it returns NULL. @@ -1899,6 +1920,17 @@ enum GNUNET_GenericReturnValue GNUNET_CHAT_invitation_is_rejected (const struct GNUNET_CHAT_Invitation *invitation); /** + * Returns whether the intend from a given + * <i>invitation</i>. is to open a direct chat or + * a group chat. + * + * @param[in] invitation Chat invitation + * @return #GNUNET_YES if it is a direct chat request, #GNUNET_NO otherwise + */ +enum GNUNET_GenericReturnValue +GNUNET_CHAT_invitation_is_direct (const struct GNUNET_CHAT_Invitation *invitation); + +/** * Returns the discourse id of a given chat <i>discourse</i>. * * @param[in] discourse Chat discourse diff --git a/android_studio/distribution/libgnunetchat/lib/arm64-v8a/include/gnunet_chat_lobby.h b/android_studio/distribution/libgnunetchat/lib/arm64-v8a/include/gnunet_chat_lobby.h @@ -0,0 +1,88 @@ +/* + This file is part of GNUnet. + Copyright (C) 2022--2024 GNUnet e.V. + + GNUnet is free software: you can redistribute it and/or modify it + under the terms of the GNU Affero General Public License as published + by the Free Software Foundation, either version 3 of the License, + or (at your option) any later version. + + GNUnet is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + + SPDX-License-Identifier: AGPL3.0-or-later + */ +/* + * @author Tobias Frisch + * @file gnunet_chat_lobby.h + */ + +#ifndef GNUNET_CHAT_LOBBY_H_ +#define GNUNET_CHAT_LOBBY_H_ + +#include <gnunet/gnunet_identity_service.h> +#include <gnunet/gnunet_util_lib.h> + +#include "gnunet_chat_lib.h" + +struct GNUNET_CHAT_Handle; +struct GNUNET_CHAT_Context; +struct GNUNET_CHAT_Uri; + +struct GNUNET_CHAT_Lobby +{ + struct GNUNET_CHAT_Handle *handle; + + struct GNUNET_SCHEDULER_Task *destruction; + + struct GNUNET_CHAT_Context *context; + struct GNUNET_CHAT_Uri *uri; + + struct GNUNET_IDENTITY_Operation *op; + struct GNUNET_NAMESTORE_QueueEntry *query; + + struct GNUNET_TIME_Absolute expiration; + GNUNET_CHAT_LobbyCallback callback; + void *cls; +}; + +/** + * Creates a new chat lobby using a given chat <i>handle</i>. + * + * @param[in,out] handle Chat handle + * @return New chat lobby + */ +struct GNUNET_CHAT_Lobby* +lobby_create (struct GNUNET_CHAT_Handle *handle); + +/** + * Destroys a chat <i>lobby</i> and frees its memory. + * + * @param[in,out] lobby Chat lobby + */ +void +lobby_destroy (struct GNUNET_CHAT_Lobby *lobby); + +/** + * Opens a chat <i>lobby</i> and closes it automatically + * after a selected <i>delay</i>. Once the lobby is open + * a given <i>callback</i> will be called with a custom + * closure. + * + * @param[in,out] lobby Chat lobby + * @param[in] delay Delay to close down the lobby again + * @param[in] callback Lobby opening callback + * @param[in,out] cls Closure + */ +void +lobby_open (struct GNUNET_CHAT_Lobby *lobby, + struct GNUNET_TIME_Relative delay, + GNUNET_CHAT_LobbyCallback callback, + void *cls); + +#endif /* GNUNET_CHAT_LOBBY_H_ */ diff --git a/android_studio/distribution/libgnunetchat/lib/arm64-v8a/include/gnunet_chat_message.h b/android_studio/distribution/libgnunetchat/lib/arm64-v8a/include/gnunet_chat_message.h @@ -0,0 +1,143 @@ +/* + This file is part of GNUnet. + Copyright (C) 2021--2024 GNUnet e.V. + + GNUnet is free software: you can redistribute it and/or modify it + under the terms of the GNU Affero General Public License as published + by the Free Software Foundation, either version 3 of the License, + or (at your option) any later version. + + GNUnet is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + + SPDX-License-Identifier: AGPL3.0-or-later + */ +/* + * @author Tobias Frisch + * @file gnunet_chat_message.h + */ + +#ifndef GNUNET_CHAT_MESSAGE_H_ +#define GNUNET_CHAT_MESSAGE_H_ + +#include <gnunet/gnunet_common.h> +#include <gnunet/gnunet_messenger_service.h> +#include <gnunet/gnunet_util_lib.h> + +struct GNUNET_CHAT_Context; +struct GNUNET_CHAT_Message; + +struct GNUNET_CHAT_MessageList +{ + struct GNUNET_CHAT_Message *message; + + struct GNUNET_CHAT_MessageList *prev; + struct GNUNET_CHAT_MessageList *next; +}; + +enum GNUNET_CHAT_MessageFlag +{ + GNUNET_CHAT_FLAG_NONE = 0, + GNUNET_CHAT_FLAG_WARNING = 1, + GNUNET_CHAT_FLAG_REFRESH = 2, + GNUNET_CHAT_FLAG_LOGIN = 3, + GNUNET_CHAT_FLAG_LOGOUT = 4, + GNUNET_CHAT_FLAG_CREATE_ACCOUNT = 5, + GNUNET_CHAT_FLAG_DELETE_ACCOUNT = 6, + GNUNET_CHAT_FLAG_UPDATE_ACCOUNT = 7, + GNUNET_CHAT_FLAG_UPDATE_CONTEXT = 8, + GNUNET_CHAT_FLAG_ATTRIBUTES = 9, + GNUNET_CHAT_FLAG_SHARE_ATTRIBUTES = 10 +}; + +struct GNUNET_CHAT_Message +{ + struct GNUNET_CHAT_Account *account; + + struct GNUNET_CHAT_Context *context; + struct GNUNET_SCHEDULER_Task *task; + + union { + const struct GNUNET_MESSENGER_Message *msg; + const char *warning; + const char *attr; + }; + + struct GNUNET_HashCode hash; + enum GNUNET_MESSENGER_MessageFlags flags; + enum GNUNET_CHAT_MessageFlag flag; + + void *user_pointer; +}; + +/** + * Creates a chat message representing an actual message + * from the messenger service in a given chat <i>context</i> + * with a valid <i>hash</i> and message <i>flags</i> + * + * @param[in,out] context Chat context + * @param[in] hash Message hash + * @param[in] flags Message flags + * @param[in] msg Messenger message + * @return New chat message + */ +struct GNUNET_CHAT_Message* +message_create_from_msg (struct GNUNET_CHAT_Context *context, + const struct GNUNET_HashCode *hash, + enum GNUNET_MESSENGER_MessageFlags flags, + const struct GNUNET_MESSENGER_Message *msg); + +/** + * Creates an internal chat message with an optional chat + * <i>account</i> or <i>context</i>, a custom <i>flag</i> + * and an optional <i>warning</i> text. + * + * @param[in,out] account Chat account or NULL + * @param[in,out] context Chat context or NULL + * @param[in] flag Chat message flag + * @param[in] warning Warning text + * @return New internal chat message + */ +struct GNUNET_CHAT_Message* +message_create_internally (struct GNUNET_CHAT_Account *account, + struct GNUNET_CHAT_Context *context, + enum GNUNET_CHAT_MessageFlag flag, + const char *warning); + +/** + * Returns whether a chat <i>message</i> contains an actual + * message from the messenger service. + * + * @param[in] message Chat message + * @return #GNUNET_YES if it contains message content, #GNUNET_NO otherwise + */ +enum GNUNET_GenericReturnValue +message_has_msg (const struct GNUNET_CHAT_Message* message); + +/** + * Updates a chat message representing an actual message + * from the messenger service. + * + * @param[in,out] message Chat message + * @param[in] flags Message flags + * @param[in] msg Messenger message + */ +void +message_update_msg (struct GNUNET_CHAT_Message* message, + enum GNUNET_MESSENGER_MessageFlags flags, + const struct GNUNET_MESSENGER_Message *msg); + +/** + * Destroys a chat <i>message</i> and frees its memory. + * + * @param[in,out] message Chat message + */ +void +message_destroy (struct GNUNET_CHAT_Message* message); + +#endif /* GNUNET_CHAT_MESSAGE_H_ */ diff --git a/android_studio/distribution/libgnunetchat/lib/arm64-v8a/include/gnunet_chat_tagging.h b/android_studio/distribution/libgnunetchat/lib/arm64-v8a/include/gnunet_chat_tagging.h @@ -0,0 +1,108 @@ +/* + This file is part of GNUnet. + Copyright (C) 2024 GNUnet e.V. + + GNUnet is free software: you can redistribute it and/or modify it + under the terms of the GNU Affero General Public License as published + by the Free Software Foundation, either version 3 of the License, + or (at your option) any later version. + + GNUnet is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + + SPDX-License-Identifier: AGPL3.0-or-later + */ +/* + * @author Tobias Frisch + * @file gnunet_chat_tagging.h + */ + +#ifndef GNUNET_CHAT_INTERNAL_TAGGING_H_ +#define GNUNET_CHAT_INTERNAL_TAGGING_H_ + +#include <gnunet/gnunet_common.h> +#include <gnunet/gnunet_util_lib.h> + +struct GNUNET_CHAT_Message; + +struct GNUNET_CHAT_InternalTagging +{ + struct GNUNET_CONTAINER_MultiHashMap *tags; +}; + +typedef enum GNUNET_GenericReturnValue +(*GNUNET_CHAT_TaggingCallback) (void *cls, + struct GNUNET_CHAT_Message *message); + +/** + * Creates a tagging structure to manage different tag messages + * mapped by its custom tag value. + * + * @return New chat tagging + */ +struct GNUNET_CHAT_InternalTagging* +internal_tagging_create (); + +/** + * Destroys a <i>tagging</i> structure to manage different tag + * messages mapped by its custom tag value. + * + * @param[out] tagging Chat tagging + */ +void +internal_tagging_destroy (struct GNUNET_CHAT_InternalTagging *tagging); + +/** + * Adds a tag <i>message</i> to a selected <i>tagging</i> + * structure for later iterations. + * + * @param[in,out] tagging Chat tagging + * @param[in,out] message Tag message + * @return #GNUNET_OK on success, otherwise #GNUNET_SYSERR + */ +enum GNUNET_GenericReturnValue +internal_tagging_add (struct GNUNET_CHAT_InternalTagging *tagging, + struct GNUNET_CHAT_Message *message); + +/** + * Removes a tag <i>message</i> from a selected <i>tagging</i> + * structure. + * + * @param[in,out] tagging Chat tagging + * @param[in] message Tag message + * @return #GNUNET_YES on success, #GNUNET_SYSERR on failure and + * otherwise #GNUNET_NO + */ +enum GNUNET_GenericReturnValue +internal_tagging_remove (struct GNUNET_CHAT_InternalTagging *tagging, + const struct GNUNET_CHAT_Message *message); + +/** + * Iterates through a selected <i>tagging</i> structure forwarding + * tag messages with a specific <i>tag</i> to a custom callback with + * its closure. + * + * If <i>ignore_tag</i> is set to #GNUNET_YES all tag messages of the + * <i>tagging</i> structure will be iterated, otherwise only with matching + * tag value. + * + * @param[in] tagging Chat tagging + * @param[in] ignore_tag Flag to set tag filtering of the iteration + * @param[in] tag Tag value for filtering the iteration + * @param[in] cb Callback for iteration + * @param[in,out] cls Closure for iteration + * @return Amount of tags iterated or #GNUNET_SYSERR on error + */ +int +internal_tagging_iterate (const struct GNUNET_CHAT_InternalTagging *tagging, + enum GNUNET_GenericReturnValue ignore_tag, + const char *tag, + GNUNET_CHAT_TaggingCallback cb, + void *cls); + +#endif /* GNUNET_CHAT_INTERNAL_TAGGING_H_ */ diff --git a/android_studio/distribution/libgnunetchat/lib/arm64-v8a/include/gnunet_chat_ticket.h b/android_studio/distribution/libgnunetchat/lib/arm64-v8a/include/gnunet_chat_ticket.h @@ -0,0 +1,84 @@ +/* + This file is part of GNUnet. + Copyright (C) 2024 GNUnet e.V. + + GNUnet is free software: you can redistribute it and/or modify it + under the terms of the GNU Affero General Public License as published + by the Free Software Foundation, either version 3 of the License, + or (at your option) any later version. + + GNUnet is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + + SPDX-License-Identifier: AGPL3.0-or-later + */ +/* + * @author Tobias Frisch + * @file gnunet_chat_ticket.h + */ + +#ifndef GNUNET_CHAT_TICKET_H_ +#define GNUNET_CHAT_TICKET_H_ + +#include <gnunet/gnunet_messenger_service.h> +#include <gnunet/gnunet_reclaim_service.h> +#include <gnunet/gnunet_util_lib.h> + +#include "gnunet_chat_lib.h" + +struct GNUNET_CHAT_Ticket +{ + struct GNUNET_CHAT_Handle *handle; + struct GNUNET_CHAT_Contact *issuer; + + GNUNET_CHAT_ContactAttributeCallback callback; + void *closure; + + struct GNUNET_RECLAIM_Operation *op; + + struct GNUNET_RECLAIM_Ticket ticket; +}; + +/** + * Creates a chat ticket from a ticket body in a + * <i>message</i> received by a chat <i>handle</i> + * from a given <i>issuer</i>. + * + * @param[in,out] handle Chat handle + * @param[in,out] issuer Messenger contact + * @param[in] message Ticket message body + * @return New chat ticket + */ +struct GNUNET_CHAT_Ticket* +ticket_create_from_message (struct GNUNET_CHAT_Handle *handle, + struct GNUNET_CHAT_Contact *issuer, + const struct GNUNET_MESSENGER_MessageTicket *message); + +/** + * Consumes a chat <i>ticket</i> and calls a selected + * <i>callback</i> for each of its attributes using + * a custom closure. + * + * @param[in,out] ticket Chat ticket + * @param[in] callback Attribute callback + * @param[in,out] cls Closure + */ +void +ticket_consume(struct GNUNET_CHAT_Ticket *ticket, + GNUNET_CHAT_ContactAttributeCallback callback, + void *cls); + +/** + * Destroys a chat <i>ticket</i> and frees its memory. + * + * @param[in,out] ticket Chat ticket + */ +void +ticket_destroy (struct GNUNET_CHAT_Ticket *ticket); + +#endif /* GNUNET_CHAT_TICKET_H_ */ diff --git a/android_studio/distribution/libgnunetchat/lib/arm64-v8a/include/gnunet_chat_ticket_process.h b/android_studio/distribution/libgnunetchat/lib/arm64-v8a/include/gnunet_chat_ticket_process.h @@ -0,0 +1,115 @@ +/* + This file is part of GNUnet. + Copyright (C) 2024 GNUnet e.V. + + GNUnet is free software: you can redistribute it and/or modify it + under the terms of the GNU Affero General Public License as published + by the Free Software Foundation, either version 3 of the License, + or (at your option) any later version. + + GNUnet is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + + SPDX-License-Identifier: AGPL3.0-or-later + */ +/* + * @author Tobias Frisch + * @file gnunet_chat_ticket_process.h + */ + +#ifndef GNUNET_CHAT_INTERNAL_TICKET_PROCESS_H_ +#define GNUNET_CHAT_INTERNAL_TICKET_PROCESS_H_ + +#include <gnunet/gnunet_reclaim_service.h> + +#include "gnunet_chat_lib.h" + +struct GNUNET_CHAT_Handle; +struct GNUNET_CHAT_Contact; + +struct GNUNET_CHAT_TicketProcess +{ + struct GNUNET_CHAT_Handle *handle; + struct GNUNET_CHAT_Contact *contact; + + struct GNUNET_RECLAIM_Ticket *ticket; + char *name; + + GNUNET_CHAT_ContactAttributeCallback callback; + void *closure; + + struct GNUNET_RECLAIM_TicketIterator *iter; + struct GNUNET_RECLAIM_Operation *op; + + struct GNUNET_CHAT_TicketProcess *next; + struct GNUNET_CHAT_TicketProcess *prev; +}; + +/** + * Creates a new ticket process resource to + * handle general ticket management from + * a specific char <i>contact</i> using + * a given chat <i>handle</i>. + * + * The ticket process gets appended to the + * list of processes from the handle implicitly. + * + * @param[in,out] handle Chat handle + * @param[in,out] contact Chat contact + * @param[in] name Attribute name or NULL + * @return New ticket process + */ +struct GNUNET_CHAT_TicketProcess* +internal_tickets_create(struct GNUNET_CHAT_Handle *handle, + struct GNUNET_CHAT_Contact *contact, + const char *name); + +/** + * Creates a new copy of a given <i>tickets</i> + * process with additional information about a + * valid reclaim <i>ticket</i>. + * + * @see internal_tickets_create() + * + * @param[in] tickets Original ticket process + * @param[in] ticket Reclaim ticket or NULL + * @return New ticket process + */ +struct GNUNET_CHAT_TicketProcess* +internal_tickets_copy(const struct GNUNET_CHAT_TicketProcess* tickets, + const struct GNUNET_RECLAIM_Ticket *ticket); + +/** + * Destroys and frees a given <i>tickets</i> + * process resource. This will implicitly remove + * it from its chat handles list of processes. + * + * @param[out] tickets Ticket process + */ +void +internal_tickets_destroy(struct GNUNET_CHAT_TicketProcess *tickets); + +/** + * Continues the iteration of a given <i>tickets</i> + * process resource to its next step. + * + * @param[in,out] tickets Ticket process + */ +void +internal_tickets_next_iter(struct GNUNET_CHAT_TicketProcess *tickets); + +/** + * Stops the iteration of a given <i>tickets</i> + * process resource. + * + * @param[in,out] tickets Ticket process + */ +void +internal_tickets_stop_iter(struct GNUNET_CHAT_TicketProcess *tickets); + +#endif /* GNUNET_CHAT_INTERNAL_TICKET_PROCESS_H_ */ diff --git a/android_studio/distribution/libgnunetchat/lib/arm64-v8a/include/gnunet_chat_uri.h b/android_studio/distribution/libgnunetchat/lib/arm64-v8a/include/gnunet_chat_uri.h @@ -0,0 +1,107 @@ +/* + This file is part of GNUnet. + Copyright (C) 2022--2025 GNUnet e.V. + + GNUnet is free software: you can redistribute it and/or modify it + under the terms of the GNU Affero General Public License as published + by the Free Software Foundation, either version 3 of the License, + or (at your option) any later version. + + GNUnet is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + + SPDX-License-Identifier: AGPL3.0-or-later + */ +/* + * @author Tobias Frisch + * @file gnunet_chat_uri.h + */ + +#ifndef GNUNET_CHAT_URI_H_ +#define GNUNET_CHAT_URI_H_ + +#include <gnunet/gnunet_fs_service.h> +#include <gnunet/gnunet_util_lib.h> +#include <gnunet/gnunet_messenger_service.h> + +#include "gnunet_chat_util.h" + +struct GNUNET_CHAT_UriChat +{ + struct GNUNET_CRYPTO_BlindablePublicKey zone; + char *label; +}; + +struct GNUNET_CHAT_UriFile +{ + struct GNUNET_FS_Uri *uri; +}; + +struct GNUNET_CHAT_Uri +{ + enum GNUNET_CHAT_UriType type; + + union { + struct GNUNET_CHAT_UriChat chat; + struct GNUNET_CHAT_UriFile fs; + }; +}; + +/** + * Creates a chat uri with a selected key as <i>zone</i> + * and a <i>label</i> of type #GNUNET_CHAT_URI_TYPE_CHAT. + * + * @param[in] zone URI zone + * @param[in] label URI label + * @return New chat uri + */ +struct GNUNET_CHAT_Uri* +uri_create_chat (const struct GNUNET_CRYPTO_BlindablePublicKey *zone, + const char *label); + +/** + * Creates a chat uri from a selected FS <i>uri</i> + * setting the type to #GNUNET_CHAT_URI_TYPE_FS. + * + * @param[in] uri FS URI + * @return New chat uri + */ +struct GNUNET_CHAT_Uri* +uri_create_file (const struct GNUNET_FS_Uri *uri); + +/** + * Destroys a chat <i>uri</i> and frees its memory. + * + * @param[in,out] uri Chat uri + */ +void +uri_destroy (struct GNUNET_CHAT_Uri *uri); + +/** + * Parses an UTF-8 string to a chat URI which will + * be newly allocated. + * + * @param[in] string UTF-8 string to parse + * @param[out] emsg Where to store the parser error message (if any) + * @return URI on success, NULL on error + */ +struct GNUNET_CHAT_Uri* +uri_parse_from_string (const char *string, + char **emsg); + +/** + * Returns an allocated UTF-8 string representing + * a given chat <i>uri</i>. + * + * @param[in] uri Chat uri + * @return The UTF-8 string representing the URI + */ +char* +uri_to_string (const struct GNUNET_CHAT_Uri *uri); + +#endif /* GNUNET_CHAT_URI_H_ */ diff --git a/android_studio/distribution/libgnunetchat/lib/arm64-v8a/include/gnunet_chat_util.h b/android_studio/distribution/libgnunetchat/lib/arm64-v8a/include/gnunet_chat_util.h @@ -0,0 +1,244 @@ +/* + This file is part of GNUnet. + Copyright (C) 2021--2024 GNUnet e.V. + + GNUnet is free software: you can redistribute it and/or modify it + under the terms of the GNU Affero General Public License as published + by the Free Software Foundation, either version 3 of the License, + or (at your option) any later version. + + GNUnet is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + + SPDX-License-Identifier: AGPL3.0-or-later + */ +/* + * @author Tobias Frisch + * @file gnunet_chat_util.h + */ + +#ifndef GNUNET_CHAT_UTIL_H_ +#define GNUNET_CHAT_UTIL_H_ + +#include <gnunet/gnunet_messenger_service.h> +#include <gnunet/gnunet_util_lib.h> + +#include "gnunet_chat_lib.h" + +/** + * Enum for the types of chat contexts. + */ +enum GNUNET_CHAT_ContextType +{ + /** + * Contact context type + */ + GNUNET_CHAT_CONTEXT_TYPE_CONTACT = 1,/**< GNUNET_CHAT_CONTEXT_TYPE_CONTACT */ + + /** + * Group context type + */ + GNUNET_CHAT_CONTEXT_TYPE_GROUP = 2,/**< GNUNET_CHAT_CONTEXT_TYPE_GROUP */ + + /** + * Unknown context type + */ + GNUNET_CHAT_CONTEXT_TYPE_UNKNOWN = 0 /**< GNUNET_CHAT_CONTEXT_TYPE_UNKNOWN */ +}; + +/** + * Converts a unique messenger contact, being consistent <i>member</i> + * of multiple messenger rooms via memory consistency, into a short + * hash variant for map access as key. + * + * @param[in] member Messenger contact + * @param[out] shorthash Short hash + */ +void +util_shorthash_from_member (const struct GNUNET_MESSENGER_Contact *member, + struct GNUNET_ShortHashCode *shorthash); + +/** + * Converts a discourse id into a short hash variant for map access + * as key. + * + * @param[in] id Discourse id + * @param[out] shorthash Short hash + */ +void +util_shorthash_from_discourse_id (const struct GNUNET_CHAT_DiscourseId *id, + struct GNUNET_ShortHashCode *shorthash); + +/** + * Converts a short hash variant into a discourse id. + * + * @param[in] shorthash Short hash + * @param[out] id Discourse id + */ +void +util_discourse_id_from_shorthash (const struct GNUNET_ShortHashCode *shorthash, + struct GNUNET_CHAT_DiscourseId *id); + +/** + * Updates the stored content of a <i>field</i> with + * a given <i>name</i>. + * + * @param[in] name Name + * @param[out] field String field + */ +void +util_set_name_field (const char *name, + char **field); + +/** + * Generates the <i>hash</i> of a file under a given + * <i>filename</i>. + * + * @param[in] filename File name + * @param[out] hash Hash of file + * @return #GNUNET_OK on success, otherwise #GNUNET_SYSERR + */ +enum GNUNET_GenericReturnValue +util_hash_file (const char *filename, + struct GNUNET_HashCode *hash); + +/** + * Encrypts a file inplace under a given <i>filename</i> + * with a selected symmetric <i>key</i> and its <i>hash</i> + * as initialization vector. + * + * @param[in] filename File name + * @param[in] hash Hash of file + * @param[in] key Symmetric key + * @return #GNUNET_OK on success, otherwise #GNUNET_SYSERR + */ +enum GNUNET_GenericReturnValue +util_encrypt_file (const char *filename, + const struct GNUNET_HashCode *hash, + const struct GNUNET_CRYPTO_SymmetricSessionKey *key); + +/** + * Decrypts a file inplace under a given <i>filename</i> + * with a selected symmetric <i>key</i> and its <i>hash</i> + * as parameter for the initialization vector and comparison + * to verify success. + * + * @param[in] filename File name + * @param[in] hash Hash of file + * @param[in] key Symmetric key + * @return #GNUNET_OK on success, otherwise #GNUNET_SYSERR + */ +enum GNUNET_GenericReturnValue +util_decrypt_file (const char *filename, + const struct GNUNET_HashCode *hash, + const struct GNUNET_CRYPTO_SymmetricSessionKey *key); + +/** + * Append the path of a <i>directory</i> and a custom + * subdirectory name to a composed <i>filename</i>. + * + * @param[in] directory Directory path + * @param[in] subdir Subdirectory name + * @param[out] filename Filename + * @return Number of bytes in filename excluding 0-termination + */ +int +util_get_dirname (const char *directory, + const char *subdir, + char **filename); + +/** + * Append the path of a <i>directory</i>, a custom + * subdirectory name and a <i>hash</i> to a composed + * <i>filename</i>. + * + * @param[in] directory Directory path + * @param[in] subdir Subdirectory name + * @param[in] hash Hash + * @param[out] filename Filename + * @return Number of bytes in filename excluding 0-termination + */ +int +util_get_filename (const char *directory, + const char *subdir, + const struct GNUNET_HashCode *hash, + char **filename); + +/** + * Allocates a new string representing the lower case versionn + * of a given <i>name</i> to work properly with the EGO naming + * scheme for example. + * + * @param[in] name Name + * @return Lower case name + */ +char* +util_get_lower(const char *name); + +/** + * Construct a composed <i>label</i> from a given context + * <i>type</i> and the <i>hash</i> of the contexts room. + * + * @param[in] type Chat context type + * @param[in] hash Hash of room + * @param[out] label Namestore label + * @return Number of bytes in label excluding 0-termination + */ +int +util_get_context_label (enum GNUNET_CHAT_ContextType type, + const struct GNUNET_HashCode *hash, + char **label); + +/** + * Extract the chat context type from a used <i>label</i> by + * a given context with a certain <i>hash</i> of its room. + * + * @param[in] label Namestore label + * @param[in] hash Hash of room + * @return Chat context type or #GNUNET_CHAT_CONTEXT_TYPE_UNKNOWN + */ +enum GNUNET_CHAT_ContextType +util_get_context_label_type (const char *label, + const struct GNUNET_HashCode *hash); + +/** + * Provide a standardized <i>name</i> for a lobby using + * a given <i>hash</i> of its internal room. + * + * @param[in] hash Hash of room + * @param[out] name Name of lobby + * @return Number of bytes in name excluding 0-termination + */ +int +util_lobby_name (const struct GNUNET_HashCode *hash, + char **name); + +/** + * Check whether an identity <i>name</i> could be a + * standardized name for a lobby. + * @see util_lobby_name() + * + * @param[in] name Identity name + * @return #GNUNET_YES if it might be a lobby name, + * otherwise #GNUNET_NO + */ +enum GNUNET_GenericReturnValue +util_is_lobby_name(const char *name); + +/** + * Return the chat related kind for a messages original kind + * from the service. It will return #GNUNET_CHAT_KIND_UNKNOWN + * in case the message kind is not supported. + * + * @param[in] kind Messenger service message kind + * @return Chat message kind or #GNUNET_CHAT_KIND_UNKNOWN_ + */ +enum GNUNET_CHAT_MessageKind +util_message_kind_from_kind (enum GNUNET_MESSENGER_MessageKind kind); + +#endif /* GNUNET_CHAT_UTIL_H_ */ diff --git a/android_studio/distribution/libgnunetchat/lib/arm64-v8a/libgnunetchat.so b/android_studio/distribution/libgnunetchat/lib/arm64-v8a/libgnunetchat.so Binary files differ.