commit e21fe54799a679dca7ca28d175c3ba8f6e6ec9b3
parent b7b74260781b203595ca77c6911ea3f72fecf1e5
Author: Jacki <jacki@thejackimonster.de>
Date: Sat, 29 Jun 2024 01:57:28 +0200
Move tagging structure into internal subdirectory
Signed-off-by: Jacki <jacki@thejackimonster.de>
Diffstat:
11 files changed, 298 insertions(+), 294 deletions(-)
diff --git a/src/gnunet_chat_contact.c b/src/gnunet_chat_contact.c
@@ -25,9 +25,10 @@
#include "gnunet_chat_contact.h"
#include "gnunet_chat_context.h"
#include "gnunet_chat_handle.h"
-#include "gnunet_chat_tagging.h"
#include "gnunet_chat_ticket.h"
+#include "internal/gnunet_chat_tagging.h"
+
#include "gnunet_chat_contact_intern.c"
#include <gnunet/gnunet_common.h>
#include <gnunet/gnunet_messenger_service.h>
@@ -252,7 +253,7 @@ skip_context_search:
contact_is_tagged(contact, NULL, tag)
);
- const struct GNUNET_CHAT_Tagging *tagging = GNUNET_CONTAINER_multihashmap_get(
+ const struct GNUNET_CHAT_InternalTagging *tagging = GNUNET_CONTAINER_multihashmap_get(
context->taggings,
hash
);
@@ -263,7 +264,7 @@ skip_context_search:
struct GNUNET_CHAT_ContactFindTag find;
find.hash = NULL;
- tagging_iterate(
+ internal_tagging_iterate(
tagging,
GNUNET_NO,
tag,
@@ -294,7 +295,7 @@ contact_untag (struct GNUNET_CHAT_Contact *contact,
if (! hash)
return;
- const struct GNUNET_CHAT_Tagging *tagging = GNUNET_CONTAINER_multihashmap_get(
+ const struct GNUNET_CHAT_InternalTagging *tagging = GNUNET_CONTAINER_multihashmap_get(
context->taggings,
hash
);
@@ -305,7 +306,7 @@ contact_untag (struct GNUNET_CHAT_Contact *contact,
struct GNUNET_CHAT_ContactFindTag find;
find.hash = NULL;
- tagging_iterate(
+ internal_tagging_iterate(
tagging,
GNUNET_NO,
tag,
@@ -340,7 +341,7 @@ contact_tag (struct GNUNET_CHAT_Contact *contact,
if (! hash)
return;
- const struct GNUNET_CHAT_Tagging *tagging = GNUNET_CONTAINER_multihashmap_get(
+ const struct GNUNET_CHAT_InternalTagging *tagging = GNUNET_CONTAINER_multihashmap_get(
context->taggings,
hash
);
@@ -351,7 +352,7 @@ contact_tag (struct GNUNET_CHAT_Contact *contact,
struct GNUNET_CHAT_ContactFindTag find;
find.hash = NULL;
- tagging_iterate(
+ internal_tagging_iterate(
tagging,
GNUNET_NO,
tag,
diff --git a/src/gnunet_chat_context.c b/src/gnunet_chat_context.c
@@ -362,7 +362,7 @@ context_delete_message (struct GNUNET_CHAT_Context *context,
}
case GNUNET_MESSENGER_KIND_TAG:
{
- struct GNUNET_CHAT_Tagging *tagging = GNUNET_CONTAINER_multihashmap_get(
+ struct GNUNET_CHAT_InternalTagging *tagging = GNUNET_CONTAINER_multihashmap_get(
context->taggings,
&(message->msg->body.tag.hash)
);
@@ -370,7 +370,7 @@ context_delete_message (struct GNUNET_CHAT_Context *context,
if (!tagging)
break;
- tagging_remove(tagging, message);
+ internal_tagging_remove(tagging, message);
break;
}
default:
diff --git a/src/gnunet_chat_context_intern.c b/src/gnunet_chat_context_intern.c
@@ -24,7 +24,8 @@
#include "gnunet_chat_invitation.h"
#include "gnunet_chat_message.h"
-#include "gnunet_chat_tagging.h"
+
+#include "internal/gnunet_chat_tagging.h"
#include <gnunet/gnunet_common.h>
#include <gnunet/gnunet_error_codes.h>
@@ -63,8 +64,8 @@ it_destroy_context_taggings (GNUNET_UNUSED void *cls,
{
GNUNET_assert(value);
- struct GNUNET_CHAT_Tagging *tagging = value;
- tagging_destroy(tagging);
+ struct GNUNET_CHAT_InternalTagging *tagging = value;
+ internal_tagging_destroy(tagging);
return GNUNET_YES;
}
diff --git a/src/gnunet_chat_handle_intern.c b/src/gnunet_chat_handle_intern.c
@@ -31,10 +31,11 @@
#include "gnunet_chat_invitation.h"
#include "gnunet_chat_lobby.h"
#include "gnunet_chat_message.h"
-#include "gnunet_chat_tagging.h"
#include "gnunet_chat_ticket.h"
#include "gnunet_chat_util.h"
+
#include "internal/gnunet_chat_accounts.h"
+#include "internal/gnunet_chat_tagging.h"
#include <gnunet/gnunet_arm_service.h>
#include <gnunet/gnunet_common.h>
@@ -792,12 +793,12 @@ on_handle_message_callback(void *cls)
}
case GNUNET_MESSENGER_KIND_TAG:
{
- struct GNUNET_CHAT_Tagging *tagging = GNUNET_CONTAINER_multihashmap_get(
+ struct GNUNET_CHAT_InternalTagging *tagging = GNUNET_CONTAINER_multihashmap_get(
context->taggings, &(message->msg->body.tag.hash));
if (!tagging)
{
- tagging = tagging_create();
+ tagging = internal_tagging_create();
if (!tagging)
break;
@@ -806,12 +807,12 @@ on_handle_message_callback(void *cls)
context->taggings, &(message->msg->body.tag.hash), tagging,
GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST))
{
- tagging_destroy(tagging);
+ internal_tagging_destroy(tagging);
break;
}
}
- tagging_add(tagging, message);
+ internal_tagging_add(tagging, message);
break;
}
default:
diff --git a/src/gnunet_chat_lib.c b/src/gnunet_chat_lib.c
@@ -48,10 +48,11 @@
#include "gnunet_chat_invitation.h"
#include "gnunet_chat_lobby.h"
#include "gnunet_chat_message.h"
-#include "gnunet_chat_tagging.h"
#include "gnunet_chat_ticket.h"
#include "gnunet_chat_util.h"
+#include "internal/gnunet_chat_tagging.h"
+
#include "gnunet_chat_lib_intern.c"
#define GNUNET_CHAT_VERSION_ASSERT() {\
@@ -2163,13 +2164,13 @@ GNUNET_CHAT_message_is_tagged (const struct GNUNET_CHAT_Message *message,
if ((!message) || (!(message->context)))
return GNUNET_SYSERR;
- const struct GNUNET_CHAT_Tagging *tagging = GNUNET_CONTAINER_multihashmap_get(
+ const struct GNUNET_CHAT_InternalTagging *tagging = GNUNET_CONTAINER_multihashmap_get(
message->context->taggings, &(message->hash));
if (!tagging)
return GNUNET_NO;
- if (tagging_iterate(tagging, GNUNET_NO, tag, NULL, NULL) > 0)
+ if (internal_tagging_iterate(tagging, GNUNET_NO, tag, NULL, NULL) > 0)
return GNUNET_YES;
else
return GNUNET_NO;
@@ -2353,13 +2354,13 @@ GNUNET_CHAT_message_iterate_tags (const struct GNUNET_CHAT_Message *message,
if ((!message) || (!(message->context)))
return GNUNET_SYSERR;
- const struct GNUNET_CHAT_Tagging *tagging = GNUNET_CONTAINER_multihashmap_get(
+ const struct GNUNET_CHAT_InternalTagging *tagging = GNUNET_CONTAINER_multihashmap_get(
message->context->taggings, &(message->hash));
if (!tagging)
return 0;
- return tagging_iterate(tagging, GNUNET_YES, NULL, callback, cls);
+ return internal_tagging_iterate(tagging, GNUNET_YES, NULL, callback, cls);
}
@@ -2854,13 +2855,13 @@ GNUNET_CHAT_invitation_is_rejected (const struct GNUNET_CHAT_Invitation *invitat
if (!invitation)
return GNUNET_NO;
- const struct GNUNET_CHAT_Tagging *tagging = GNUNET_CONTAINER_multihashmap_get(
+ const struct GNUNET_CHAT_InternalTagging *tagging = GNUNET_CONTAINER_multihashmap_get(
invitation->context->taggings, &(invitation->hash));
if (!tagging)
return GNUNET_NO;
- if (tagging_iterate(tagging, GNUNET_NO, NULL, NULL, NULL) > 0)
+ if (internal_tagging_iterate(tagging, GNUNET_NO, NULL, NULL, NULL) > 0)
return GNUNET_YES;
else
return GNUNET_NO;
diff --git a/src/gnunet_chat_tagging.c b/src/gnunet_chat_tagging.c
@@ -1,162 +0,0 @@
-/*
- 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.c
- */
-
-#include "gnunet_chat_tagging.h"
-#include "gnunet_chat_message.h"
-
-#include <gnunet/gnunet_common.h>
-#include <gnunet/gnunet_messenger_service.h>
-#include <string.h>
-
-static const unsigned int initial_map_size_of_tagging = 4;
-
-struct GNUNET_CHAT_Tagging*
-tagging_create ()
-{
- struct GNUNET_CHAT_Tagging* tagging = GNUNET_new(struct GNUNET_CHAT_Tagging);
-
- tagging->tags = GNUNET_CONTAINER_multihashmap_create(
- initial_map_size_of_tagging, GNUNET_NO);
-
- return tagging;
-}
-
-void
-tagging_destroy (struct GNUNET_CHAT_Tagging *tagging)
-{
- GNUNET_assert(
- (tagging) &&
- (tagging->tags)
- );
-
- GNUNET_CONTAINER_multihashmap_destroy(tagging->tags);
-
- GNUNET_free(tagging);
-}
-
-enum GNUNET_GenericReturnValue
-tagging_add (struct GNUNET_CHAT_Tagging *tagging,
- struct GNUNET_CHAT_Message *message)
-{
- GNUNET_assert((tagging) && (message));
-
- if ((GNUNET_YES != message_has_msg(message)) ||
- (GNUNET_MESSENGER_KIND_TAG != message->msg->header.kind))
- return GNUNET_SYSERR;
-
- const char *tag = message->msg->body.tag.tag;
- struct GNUNET_HashCode hash;
-
- if (tag)
- GNUNET_CRYPTO_hash_from_string(tag, &hash);
- else
- memset(&hash, 0, sizeof(hash));
-
- return GNUNET_CONTAINER_multihashmap_put(
- tagging->tags,
- &hash,
- message,
- GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE
- );
-}
-
-enum GNUNET_GenericReturnValue
-tagging_remove (struct GNUNET_CHAT_Tagging *tagging,
- const struct GNUNET_CHAT_Message *message)
-{
- GNUNET_assert((tagging) && (message));
-
- if ((GNUNET_YES != message_has_msg(message)) ||
- (GNUNET_MESSENGER_KIND_TAG != message->msg->header.kind))
- return GNUNET_SYSERR;
-
- const char *tag = message->msg->body.tag.tag;
- struct GNUNET_HashCode hash;
-
- if (tag)
- GNUNET_CRYPTO_hash_from_string(tag, &hash);
- else
- memset(&hash, 0, sizeof(hash));
-
- return GNUNET_CONTAINER_multihashmap_remove(
- tagging->tags,
- &hash,
- message
- );
-}
-
-struct GNUNET_CHAT_TaggingIterator
-{
- GNUNET_CHAT_TaggingCallback cb;
- void *cls;
-};
-
-static enum GNUNET_GenericReturnValue
-tagging_iterate_message (void *cls,
- const struct GNUNET_HashCode *key,
- void *value)
-{
- struct GNUNET_CHAT_TaggingIterator *it = cls;
- const struct GNUNET_CHAT_Message *message = value;
-
- if (!(it->cb))
- return GNUNET_YES;
-
- return it->cb(it->cls, message);
-}
-
-int
-tagging_iterate (const struct GNUNET_CHAT_Tagging *tagging,
- enum GNUNET_GenericReturnValue ignore_tag,
- const char *tag,
- GNUNET_CHAT_TaggingCallback cb,
- void *cls)
-{
- GNUNET_assert(tagging);
-
- struct GNUNET_CHAT_TaggingIterator it;
- it.cb = cb;
- it.cls = cls;
-
- if (GNUNET_YES == ignore_tag)
- return GNUNET_CONTAINER_multihashmap_iterate(
- tagging->tags,
- tagging_iterate_message,
- &it
- );
-
- struct GNUNET_HashCode hash;
-
- if (tag)
- GNUNET_CRYPTO_hash_from_string(tag, &hash);
- else
- memset(&hash, 0, sizeof(hash));
-
- return GNUNET_CONTAINER_multihashmap_get_multiple(
- tagging->tags,
- &hash,
- tagging_iterate_message,
- &it
- );
-}
diff --git a/src/gnunet_chat_tagging.h b/src/gnunet_chat_tagging.h
@@ -1,107 +0,0 @@
-/*
- 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_TAGGING_H_
-#define GNUNET_CHAT_TAGGING_H_
-
-#include <gnunet/gnunet_common.h>
-#include <gnunet/gnunet_util_lib.h>
-
-struct GNUNET_CHAT_Message;
-
-struct GNUNET_CHAT_Tagging
-{
- struct GNUNET_CONTAINER_MultiHashMap *tags;
-};
-
-typedef enum GNUNET_GenericReturnValue
-(*GNUNET_CHAT_TaggingCallback) (void *cls,
- const 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_Tagging*
-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
-tagging_destroy (struct GNUNET_CHAT_Tagging *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
-tagging_add (struct GNUNET_CHAT_Tagging *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
-tagging_remove (struct GNUNET_CHAT_Tagging *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
- */
-int
-tagging_iterate (const struct GNUNET_CHAT_Tagging *tagging,
- enum GNUNET_GenericReturnValue ignore_tag,
- const char *tag,
- GNUNET_CHAT_TaggingCallback cb,
- void *cls);
-
-#endif /* GNUNET_CHAT_TAGGING_H_ */
diff --git a/src/internal/gnunet_chat_tagging.c b/src/internal/gnunet_chat_tagging.c
@@ -0,0 +1,162 @@
+/*
+ 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.c
+ */
+
+#include "gnunet_chat_tagging.h"
+#include "gnunet_chat_message.h"
+
+#include <gnunet/gnunet_common.h>
+#include <gnunet/gnunet_messenger_service.h>
+#include <string.h>
+
+static const unsigned int initial_map_size_of_tagging = 4;
+
+struct GNUNET_CHAT_InternalTagging*
+internal_tagging_create ()
+{
+ struct GNUNET_CHAT_InternalTagging* tagging = GNUNET_new(struct GNUNET_CHAT_InternalTagging);
+
+ tagging->tags = GNUNET_CONTAINER_multihashmap_create(
+ initial_map_size_of_tagging, GNUNET_NO);
+
+ return tagging;
+}
+
+void
+internal_tagging_destroy (struct GNUNET_CHAT_InternalTagging *tagging)
+{
+ GNUNET_assert(
+ (tagging) &&
+ (tagging->tags)
+ );
+
+ GNUNET_CONTAINER_multihashmap_destroy(tagging->tags);
+
+ GNUNET_free(tagging);
+}
+
+enum GNUNET_GenericReturnValue
+internal_tagging_add (struct GNUNET_CHAT_InternalTagging *tagging,
+ struct GNUNET_CHAT_Message *message)
+{
+ GNUNET_assert((tagging) && (message));
+
+ if ((GNUNET_YES != message_has_msg(message)) ||
+ (GNUNET_MESSENGER_KIND_TAG != message->msg->header.kind))
+ return GNUNET_SYSERR;
+
+ const char *tag = message->msg->body.tag.tag;
+ struct GNUNET_HashCode hash;
+
+ if (tag)
+ GNUNET_CRYPTO_hash_from_string(tag, &hash);
+ else
+ memset(&hash, 0, sizeof(hash));
+
+ return GNUNET_CONTAINER_multihashmap_put(
+ tagging->tags,
+ &hash,
+ message,
+ GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE
+ );
+}
+
+enum GNUNET_GenericReturnValue
+internal_tagging_remove (struct GNUNET_CHAT_InternalTagging *tagging,
+ const struct GNUNET_CHAT_Message *message)
+{
+ GNUNET_assert((tagging) && (message));
+
+ if ((GNUNET_YES != message_has_msg(message)) ||
+ (GNUNET_MESSENGER_KIND_TAG != message->msg->header.kind))
+ return GNUNET_SYSERR;
+
+ const char *tag = message->msg->body.tag.tag;
+ struct GNUNET_HashCode hash;
+
+ if (tag)
+ GNUNET_CRYPTO_hash_from_string(tag, &hash);
+ else
+ memset(&hash, 0, sizeof(hash));
+
+ return GNUNET_CONTAINER_multihashmap_remove(
+ tagging->tags,
+ &hash,
+ message
+ );
+}
+
+struct GNUNET_CHAT_InternalTaggingIterator
+{
+ GNUNET_CHAT_TaggingCallback cb;
+ void *cls;
+};
+
+static enum GNUNET_GenericReturnValue
+internal_tagging_iterate_message (void *cls,
+ const struct GNUNET_HashCode *key,
+ void *value)
+{
+ struct GNUNET_CHAT_InternalTaggingIterator *it = cls;
+ const struct GNUNET_CHAT_Message *message = value;
+
+ if (!(it->cb))
+ return GNUNET_YES;
+
+ return it->cb(it->cls, message);
+}
+
+int
+internal_tagging_iterate (const struct GNUNET_CHAT_InternalTagging *tagging,
+ enum GNUNET_GenericReturnValue ignore_tag,
+ const char *tag,
+ GNUNET_CHAT_TaggingCallback cb,
+ void *cls)
+{
+ GNUNET_assert(tagging);
+
+ struct GNUNET_CHAT_InternalTaggingIterator it;
+ it.cb = cb;
+ it.cls = cls;
+
+ if (GNUNET_YES == ignore_tag)
+ return GNUNET_CONTAINER_multihashmap_iterate(
+ tagging->tags,
+ internal_tagging_iterate_message,
+ &it
+ );
+
+ struct GNUNET_HashCode hash;
+
+ if (tag)
+ GNUNET_CRYPTO_hash_from_string(tag, &hash);
+ else
+ memset(&hash, 0, sizeof(hash));
+
+ return GNUNET_CONTAINER_multihashmap_get_multiple(
+ tagging->tags,
+ &hash,
+ internal_tagging_iterate_message,
+ &it
+ );
+}
diff --git a/src/internal/gnunet_chat_tagging.h b/src/internal/gnunet_chat_tagging.h
@@ -0,0 +1,107 @@
+/*
+ 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,
+ const 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
+ */
+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/src/internal/meson.build b/src/internal/meson.build
@@ -21,5 +21,6 @@
gnunetchat_internal_sources = files([
'gnunet_chat_accounts.c', 'gnunet_chat_accounts.h',
'gnunet_chat_attribute_process.c', 'gnunet_chat_attribute_process.h',
+ 'gnunet_chat_tagging.c', 'gnunet_chat_tagging.h',
'gnunet_chat_ticket_process.c', 'gnunet_chat_ticket_process.h'
])
diff --git a/src/meson.build b/src/meson.build
@@ -31,7 +31,6 @@ gnunetchat_sources = files([
'gnunet_chat_invitation.c', 'gnunet_chat_invitation.h',
'gnunet_chat_lobby.c', 'gnunet_chat_lobby.h',
'gnunet_chat_message.c', 'gnunet_chat_message.h',
- 'gnunet_chat_tagging.c', 'gnunet_chat_tagging.h',
'gnunet_chat_ticket.c', 'gnunet_chat_ticket.h',
'gnunet_chat_uri.c', 'gnunet_chat_uri.h',
'gnunet_chat_util.c', 'gnunet_chat_util.h',