#include "messenger_api_epoch.h"
#include "gnunet_common.h"
#include "gnunet_messenger_service.h"
#include "gnunet_util_lib.h"
#include "messenger_api.h"
#include "messenger_api_contact.h"
#include "messenger_api_epoch_announcement.h"
#include "messenger_api_epoch_group.h"
#include "messenger_api_message.h"
#include "messenger_api_room.h"
#include <stdint.h>
Go to the source code of this file.
Functions | |
static const struct GNUNET_MESSENGER_Contact ** | get_members_of_epoch (struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *epoch, uint32_t *members_count) |
static void | add_following_epoch (struct GNUNET_MESSENGER_Epoch *epoch, struct GNUNET_MESSENGER_Epoch *follow) |
static void | setup_following_epochs_of_previous (struct GNUNET_MESSENGER_Epoch *epoch) |
struct GNUNET_MESSENGER_Epoch * | create_epoch (struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash) |
Creates and allocates an epoch in a given room which can be identified by a specific hash. More... | |
static enum GNUNET_GenericReturnValue | is_epoch_member_in_room (const struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *epoch, const struct GNUNET_MESSENGER_Contact *contact) |
static const struct GNUNET_MESSENGER_Contact ** | get_members_of_new_epoch (struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *epoch, uint32_t *members_count) |
static enum GNUNET_GenericReturnValue | it_move_epoch_groups_from_previous_epoch (void *cls, const struct GNUNET_ShortHashCode *key, void *value) |
struct GNUNET_MESSENGER_Epoch * | create_new_epoch (struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash) |
Creates and allocates a new epoch in a given room which can be identified by a specific hash. More... | |
static enum GNUNET_GenericReturnValue | iterate_destroy_group (void *cls, const struct GNUNET_ShortHashCode *key, void *value) |
static enum GNUNET_GenericReturnValue | iterate_destroy_announcement (void *cls, const struct GNUNET_ShortHashCode *key, void *value) |
void | destroy_epoch (struct GNUNET_MESSENGER_Epoch *epoch) |
Destroys an epoch and frees its memory fully from the client API. More... | |
uint32_t | get_epoch_size (const struct GNUNET_MESSENGER_Epoch *epoch) |
Returns the amount of members by a given epoch or zero as long as it's not fully initialized yet. More... | |
static enum GNUNET_GenericReturnValue | it_handle_epoch_message_delayed (void *cls, const struct GNUNET_HashCode *key, void *value) |
void | reset_epoch_size (struct GNUNET_MESSENGER_Epoch *epoch) |
Resets the amount of members by a given epoch to recalculate the exact amount. More... | |
enum GNUNET_GenericReturnValue | delay_epoch_message_for_its_members (struct GNUNET_MESSENGER_Epoch *epoch, const struct GNUNET_HashCode *hash) |
Adds a message with a given hash to a list that can be delayed in processing for the members of a specific epoch until the list of members is complete. More... | |
const struct GNUNET_CRYPTO_EcdhePrivateKey * | get_epoch_private_key (struct GNUNET_MESSENGER_Epoch *epoch, const struct GNUNET_TIME_Relative timeout) |
Returns the asymmetric private key (ECDHE) from a handle for a given epoch that can be used for HPKE key exchange until a specific timeout. More... | |
const struct GNUNET_TIME_Relative | get_epoch_private_key_timeout (const struct GNUNET_MESSENGER_Epoch *epoch) |
Returns the current relative timeout for the private key (ECDHE) of a given epoch that limits the usage for its key in terms of HPKE. More... | |
static enum GNUNET_GenericReturnValue | is_other_epoch_announcement_better (const struct GNUNET_MESSENGER_EpochAnnouncement *announcement, const struct GNUNET_MESSENGER_EpochAnnouncement *other) |
static enum GNUNET_GenericReturnValue | it_find_announcement_with_most_members (void *cls, const struct GNUNET_ShortHashCode *key, void *value) |
static enum GNUNET_GenericReturnValue | it_find_valid_announcement_with_most_members (void *cls, const struct GNUNET_ShortHashCode *key, void *value) |
struct GNUNET_MESSENGER_EpochAnnouncement * | get_epoch_announcement (struct GNUNET_MESSENGER_Epoch *epoch, const union GNUNET_MESSENGER_EpochIdentifier *identifier, enum GNUNET_GenericReturnValue valid) |
Returns the epoch announcement of a given epoch using a specific unique identifier or NULL. More... | |
static enum GNUNET_GenericReturnValue | is_other_epoch_group_better (const struct GNUNET_MESSENGER_EpochGroup *group, const struct GNUNET_MESSENGER_EpochGroup *other) |
static enum GNUNET_GenericReturnValue | it_find_group_with_most_members (void *cls, const struct GNUNET_ShortHashCode *key, void *value) |
static enum GNUNET_GenericReturnValue | it_find_valid_group_with_most_members (void *cls, const struct GNUNET_ShortHashCode *key, void *value) |
struct GNUNET_MESSENGER_EpochGroup * | get_epoch_group (struct GNUNET_MESSENGER_Epoch *epoch, const union GNUNET_MESSENGER_EpochIdentifier *identifier, enum GNUNET_GenericReturnValue valid) |
Returns the epoch group of a given epoch using a specific unique identifier or NULL. More... | |
enum GNUNET_GenericReturnValue | is_epoch_previous_of_other (const struct GNUNET_MESSENGER_Epoch *epoch, const struct GNUNET_MESSENGER_Epoch *other) |
Returns whether a given epoch is the epoch before some other epoch. More... | |
const struct GNUNET_MESSENGER_EpochAnnouncement * | get_epoch_previous_announcement (struct GNUNET_MESSENGER_Epoch *epoch, const union GNUNET_MESSENGER_EpochIdentifier *identifier) |
Returns the epoch announcement of a previous epoch from a given epoch using a specific announcement identifier. More... | |
const struct GNUNET_MESSENGER_EpochGroup * | get_epoch_previous_group (struct GNUNET_MESSENGER_Epoch *epoch, const union GNUNET_MESSENGER_EpochIdentifier *identifier) |
Returns the epoch group of a previous epoch from a given epoch using a specific group identifier. More... | |
static int | compare_member_public_keys (const char *key_string, const struct GNUNET_CRYPTO_PublicKey *key) |
uint32_t | get_epoch_member_position (const struct GNUNET_MESSENGER_Epoch *epoch, const struct GNUNET_MESSENGER_Contact *contact) |
Returns the index position of a specific contact inside a given epoch in relation to its list of members. More... | |
static enum GNUNET_GenericReturnValue | is_epoch_sender_in_room (const struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *epoch, const struct GNUNET_MESSENGER_Contact *contact) |
static enum GNUNET_GenericReturnValue | is_epoch_member_in_room_graph (const struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *epoch, const struct GNUNET_MESSENGER_Contact *contact, struct GNUNET_CONTAINER_MultiHashMap *map) |
enum GNUNET_GenericReturnValue | is_epoch_member (const struct GNUNET_MESSENGER_Epoch *epoch, const struct GNUNET_MESSENGER_Contact *contact) |
Returns whether a specific contact is member of a given epoch. More... | |
double | get_epoch_position_factor (const struct GNUNET_MESSENGER_Epoch *epoch, const struct GNUNET_MESSENGER_Contact *contact, const struct GNUNET_MESSENGER_EpochMembership *membership) |
Returns a relative member positon of a specific contact inside a given epoch in relation to its list of members. More... | |
void | send_epoch_message (const struct GNUNET_MESSENGER_Epoch *epoch, struct GNUNET_MESSENGER_Message *message) |
Sends a created and allocated message in a room of a given epoch enforcing the message gets interpreted as part of that exact epoch. More... | |
void | update_epoch_announcement (struct GNUNET_MESSENGER_Epoch *epoch, struct GNUNET_MESSENGER_EpochAnnouncement *announcement) |
Updates the main announcement of a given epoch, looking into replacing the current main announcement with a specific epoch announcement that's provided. More... | |
static void | set_epoch_proposing (struct GNUNET_MESSENGER_Epoch *epoch, struct GNUNET_TIME_Relative timeout) |
static enum GNUNET_GenericReturnValue | is_epoch_proposing (const struct GNUNET_MESSENGER_Epoch *epoch) |
void | update_epoch_group (struct GNUNET_MESSENGER_Epoch *epoch, struct GNUNET_MESSENGER_EpochGroup *group) |
Updates the main group of a given epoch, looking into replacing the current main group with a specific epoch group that's provided. More... | |
static void | on_epoch_proposal_timeout (void *cls) |
static enum GNUNET_GenericReturnValue | is_epoch_subgroup_of_any_group (struct GNUNET_MESSENGER_Epoch *epoch, const struct GNUNET_MESSENGER_EpochGroup *subgroup) |
enum GNUNET_GenericReturnValue | is_epoch_member_in_any_group (struct GNUNET_MESSENGER_Epoch *epoch, const struct GNUNET_MESSENGER_Contact *contact) |
void | propose_epoch_group (struct GNUNET_MESSENGER_Epoch *epoch, const struct GNUNET_TIME_Relative timeout) |
Tries to propose a new group inside a given epoch that will automatically be formed by using the clients own main group and another group on the same level. More... | |
void | set_epoch_proposal_group (struct GNUNET_MESSENGER_Epoch *epoch, const struct GNUNET_HashCode *hash) |
Sets the current group of proposal for a given epoch to the group specified by a message identified by its hash. More... | |
const struct GNUNET_MESSENGER_EpochGroup * | get_epoch_proposal_group (struct GNUNET_MESSENGER_Epoch *epoch) |
Returns the current group of proposal for a given epoch. More... | |
void | cancel_epoch_proposal_group (struct GNUNET_MESSENGER_Epoch *epoch) |
Cancels the current proposal of a new group from a given epoch. More... | |
static enum GNUNET_GenericReturnValue | iterate_epoch_announcement_invalidation (void *cls, const struct GNUNET_ShortHashCode *key, void *value) |
static enum GNUNET_GenericReturnValue | iterate_epoch_group_invalidation (void *cls, const struct GNUNET_ShortHashCode *key, void *value) |
void | invalidate_epoch_keys_by_member (struct GNUNET_MESSENGER_Epoch *epoch, const struct GNUNET_MESSENGER_Contact *contact) |
Invalidates all announced epoch and group keys by a specific contact inside a given epoch. More... | |
|
static |
Definition at line 40 of file messenger_api_epoch.c.
References GNUNET_MESSENGER_Message::body, GNUNET_MESSENGER_MessageJoin::epoch, GNUNET_MESSENGER_MessageLeave::epoch, GNUNET_MESSENGER_MessageMerge::epochs, get_room_epoch(), get_room_message(), get_room_sender(), GNUNET_assert, GNUNET_is_zero, GNUNET_malloc, GNUNET_MESSENGER_KIND_JOIN, GNUNET_MESSENGER_KIND_LEAVE, GNUNET_MESSENGER_KIND_MERGE, GNUNET_NO, GNUNET_YES, GNUNET_MESSENGER_Message::header, GNUNET_MESSENGER_MessageBody::join, GNUNET_MESSENGER_MessageHeader::kind, GNUNET_MESSENGER_MessageBody::leave, GNUNET_MESSENGER_Epoch::members, GNUNET_MESSENGER_Epoch::members_count, GNUNET_MESSENGER_MessageBody::merge, and GNUNET_MESSENGER_Epoch::room.
Referenced by get_members_of_new_epoch(), and reset_epoch_size().
|
static |
Definition at line 273 of file messenger_api_epoch.c.
References GNUNET_MESSENGER_Epoch::following, GNUNET_MESSENGER_Epoch::following_count, GNUNET_assert, GNUNET_free, and GNUNET_malloc.
Referenced by setup_following_epochs_of_previous().
|
static |
Definition at line 311 of file messenger_api_epoch.c.
References add_following_epoch(), GNUNET_MESSENGER_Message::body, GNUNET_MESSENGER_MessageJoin::epoch, GNUNET_MESSENGER_MessageLeave::epoch, GNUNET_MESSENGER_MessageMerge::epochs, get_room_epoch(), get_room_message(), GNUNET_assert, GNUNET_MESSENGER_KIND_JOIN, GNUNET_MESSENGER_KIND_LEAVE, GNUNET_MESSENGER_KIND_MERGE, GNUNET_NO, GNUNET_MESSENGER_Epoch::hash, GNUNET_MESSENGER_Message::header, GNUNET_MESSENGER_MessageBody::join, GNUNET_MESSENGER_MessageHeader::kind, GNUNET_MESSENGER_MessageBody::leave, GNUNET_MESSENGER_MessageBody::merge, and GNUNET_MESSENGER_Epoch::room.
Referenced by reset_epoch_size().
struct GNUNET_MESSENGER_Epoch * create_epoch | ( | struct GNUNET_MESSENGER_Room * | room, |
const struct GNUNET_HashCode * | hash | ||
) |
Creates and allocates an epoch in a given room which can be identified by a specific hash.
[in,out] | room | Room |
[in] | hash | Hash of epoch |
Definition at line 369 of file messenger_api_epoch.c.
References GNUNET_MESSENGER_Epoch::announcements, GNUNET_MESSENGER_Epoch::following, GNUNET_MESSENGER_Epoch::following_count, GNUNET_assert, GNUNET_CONTAINER_multihashmap_create(), GNUNET_CONTAINER_multishortmap_create(), GNUNET_is_zero, GNUNET_memcpy, GNUNET_new, GNUNET_NO, GNUNET_TIME_absolute_get_zero_(), GNUNET_MESSENGER_Epoch::groups, GNUNET_MESSENGER_Epoch::hash, GNUNET_MESSENGER_Epoch::main_announcement, GNUNET_MESSENGER_Epoch::main_group, GNUNET_MESSENGER_Epoch::members, GNUNET_MESSENGER_Epoch::members_count, GNUNET_MESSENGER_Epoch::nonces, GNUNET_MESSENGER_Epoch::private_key, GNUNET_MESSENGER_Epoch::private_key_expiration, GNUNET_MESSENGER_Epoch::proposal_expiration, GNUNET_MESSENGER_Epoch::proposal_hash, GNUNET_MESSENGER_Epoch::proposal_timeout, require_message_from_room(), reset_epoch_size(), GNUNET_MESSENGER_Epoch::room, and GNUNET_MESSENGER_Epoch::waiting.
Referenced by create_new_epoch(), and get_room_epoch().
|
static |
Definition at line 1279 of file messenger_api_epoch.c.
References GNUNET_assert, GNUNET_CONTAINER_multihashmap_create(), GNUNET_CONTAINER_multihashmap_destroy(), GNUNET_is_zero, GNUNET_NO, is_epoch_member_in_room_graph(), map, and result.
Referenced by get_members_of_new_epoch(), and is_epoch_member().
|
static |
Definition at line 429 of file messenger_api_epoch.c.
References get_members_of_epoch(), GNUNET_assert, GNUNET_CONTAINER_multishortmap_iterator_create(), GNUNET_CONTAINER_multishortmap_iterator_destroy(), GNUNET_CONTAINER_multishortmap_iterator_next(), GNUNET_CONTAINER_multishortmap_size(), GNUNET_malloc, GNUNET_YES, is_epoch_member_in_room(), and GNUNET_MESSENGER_Room::members.
Referenced by create_new_epoch().
|
static |
Definition at line 483 of file messenger_api_epoch.c.
References GNUNET_MESSENGER_EpochGroup::epoch, get_epoch_group(), get_epoch_group_key(), GNUNET_assert, GNUNET_YES, GNUNET_MESSENGER_EpochGroup::identifier, is_epoch_group_announced(), is_epoch_group_compatible(), GNUNET_MESSENGER_EpochGroup::valid, and value.
Referenced by create_new_epoch().
struct GNUNET_MESSENGER_Epoch * create_new_epoch | ( | struct GNUNET_MESSENGER_Room * | room, |
const struct GNUNET_HashCode * | hash | ||
) |
Creates and allocates a new epoch in a given room which can be identified by a specific hash.
[in,out] | room | Room |
[in] | hash | Hash of epoch |
Definition at line 508 of file messenger_api_epoch.c.
References create_epoch(), GNUNET_MESSENGER_EpochGroup::epoch, get_epoch_group(), get_epoch_group_key(), get_epoch_previous_group(), get_members_of_new_epoch(), GNUNET_assert, GNUNET_CONTAINER_multishortmap_iterate(), GNUNET_free, GNUNET_SYSERR, GNUNET_YES, GNUNET_MESSENGER_Epoch::groups, GNUNET_MESSENGER_Epoch::hash, GNUNET_MESSENGER_EpochGroup::identifier, is_epoch_group_compatible(), it_move_epoch_groups_from_previous_epoch(), GNUNET_MESSENGER_Epoch::main_group, GNUNET_MESSENGER_Epoch::members, GNUNET_MESSENGER_Epoch::members_count, GNUNET_MESSENGER_Epoch::room, send_epoch_group_announcement(), and GNUNET_MESSENGER_EpochGroup::valid.
Referenced by get_room_epoch().
|
static |
Definition at line 561 of file messenger_api_epoch.c.
References destroy_epoch_group(), GNUNET_assert, GNUNET_YES, and value.
Referenced by destroy_epoch().
|
static |
Definition at line 577 of file messenger_api_epoch.c.
References destroy_epoch_announcement(), GNUNET_assert, GNUNET_YES, and value.
Referenced by destroy_epoch().
void destroy_epoch | ( | struct GNUNET_MESSENGER_Epoch * | epoch | ) |
Destroys an epoch and frees its memory fully from the client API.
[in,out] | epoch | Epoch |
Definition at line 593 of file messenger_api_epoch.c.
References GNUNET_MESSENGER_Epoch::announcements, GNUNET_MESSENGER_EpochAnnouncement::epoch, GNUNET_MESSENGER_Epoch::following, GNUNET_assert, GNUNET_CONTAINER_multihashmap_destroy(), GNUNET_CONTAINER_multishortmap_destroy(), GNUNET_CONTAINER_multishortmap_iterate(), GNUNET_free, GNUNET_SCHEDULER_cancel(), GNUNET_MESSENGER_Epoch::groups, iterate_destroy_announcement(), iterate_destroy_group(), GNUNET_MESSENGER_Epoch::main_announcement, GNUNET_MESSENGER_Epoch::main_group, GNUNET_MESSENGER_Epoch::members, GNUNET_MESSENGER_Epoch::nonces, GNUNET_MESSENGER_Epoch::private_key, GNUNET_MESSENGER_Epoch::proposal_hash, GNUNET_MESSENGER_Epoch::proposal_timeout, and GNUNET_MESSENGER_Epoch::waiting.
Referenced by get_room_epoch(), and iterate_destroy_epoch().
uint32_t get_epoch_size | ( | const struct GNUNET_MESSENGER_Epoch * | epoch | ) |
Returns the amount of members by a given epoch or zero as long as it's not fully initialized yet.
[in] | epoch | Epoch |
Definition at line 646 of file messenger_api_epoch.c.
References GNUNET_MESSENGER_EpochAnnouncement::epoch, GNUNET_assert, and GNUNET_MESSENGER_Epoch::members_count.
Referenced by get_epoch_announcement_size(), get_epoch_position_factor(), and handle_message().
|
static |
Definition at line 655 of file messenger_api_epoch.c.
References GNUNET_assert, GNUNET_YES, key, GNUNET_MESSENGER_Epoch::room, and update_room_message().
Referenced by reset_epoch_size().
void reset_epoch_size | ( | struct GNUNET_MESSENGER_Epoch * | epoch | ) |
Resets the amount of members by a given epoch to recalculate the exact amount.
[in,out] | epoch | Epoch |
Definition at line 671 of file messenger_api_epoch.c.
References GNUNET_MESSENGER_Epoch::following, GNUNET_MESSENGER_Epoch::following_count, get_members_of_epoch(), GNUNET_assert, GNUNET_CONTAINER_multihashmap_clear(), GNUNET_CONTAINER_multihashmap_iterate(), GNUNET_free, GNUNET_MESSENGER_Epoch::hash, it_handle_epoch_message_delayed(), GNUNET_MESSENGER_Epoch::members, GNUNET_MESSENGER_Epoch::members_count, reset_epoch_size(), GNUNET_MESSENGER_Epoch::room, setup_following_epochs_of_previous(), and GNUNET_MESSENGER_Epoch::waiting.
Referenced by create_epoch(), handle_message(), and reset_epoch_size().
enum GNUNET_GenericReturnValue delay_epoch_message_for_its_members | ( | struct GNUNET_MESSENGER_Epoch * | epoch, |
const struct GNUNET_HashCode * | hash | ||
) |
Adds a message with a given hash to a list that can be delayed in processing for the members of a specific epoch until the list of members is complete.
[in,out] | epoch | Epoch |
[in] | hash | Hash of message |
Definition at line 703 of file messenger_api_epoch.c.
References GNUNET_assert, GNUNET_CONTAINER_multihashmap_contains(), GNUNET_CONTAINER_multihashmap_put(), GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST, GNUNET_NO, GNUNET_OK, GNUNET_SYSERR, GNUNET_YES, GNUNET_MESSENGER_Epoch::members, and GNUNET_MESSENGER_Epoch::waiting.
Referenced by get_room_availble_epoch_entry().
const struct GNUNET_CRYPTO_EcdhePrivateKey * get_epoch_private_key | ( | struct GNUNET_MESSENGER_Epoch * | epoch, |
const struct GNUNET_TIME_Relative | timeout | ||
) |
Returns the asymmetric private key (ECDHE) from a handle for a given epoch that can be used for HPKE key exchange until a specific timeout.
[in,out] | epoch | Epoch |
[in] | timeout | Timeout for the key |
Definition at line 725 of file messenger_api_epoch.c.
References GNUNET_assert, GNUNET_CRYPTO_ecdhe_key_create(), GNUNET_new, GNUNET_TIME_absolute_add(), GNUNET_TIME_absolute_get(), GNUNET_MESSENGER_Epoch::private_key, GNUNET_MESSENGER_Epoch::private_key_expiration, and timeout.
Referenced by handle_epoch_announcement_access(), handle_epoch_group_access(), send_epoch_announcement(), send_epoch_announcement_appeal(), and send_epoch_group_announcement().
const struct GNUNET_TIME_Relative get_epoch_private_key_timeout | ( | const struct GNUNET_MESSENGER_Epoch * | epoch | ) |
Returns the current relative timeout for the private key (ECDHE) of a given epoch that limits the usage for its key in terms of HPKE.
[in] | epoch | Epoch |
Definition at line 748 of file messenger_api_epoch.c.
References GNUNET_assert, GNUNET_TIME_absolute_get_remaining(), and GNUNET_TIME_relative_get_zero_().
Referenced by send_epoch_announcement(), send_epoch_announcement_appeal(), and send_epoch_group_announcement().
|
static |
Definition at line 760 of file messenger_api_epoch.c.
References get_epoch_announcement_members_count(), GNUNET_memcmp, GNUNET_NO, GNUNET_YES, GNUNET_MESSENGER_EpochAnnouncement::identifier, and max.
Referenced by it_find_announcement_with_most_members(), and update_epoch_announcement().
|
static |
Definition at line 790 of file messenger_api_epoch.c.
References GNUNET_assert, GNUNET_YES, is_other_epoch_announcement_better(), key, result, and value.
Referenced by get_epoch_announcement(), and it_find_valid_announcement_with_most_members().
|
static |
Definition at line 810 of file messenger_api_epoch.c.
References get_epoch_announcement_key(), GNUNET_assert, GNUNET_YES, it_find_announcement_with_most_members(), key, GNUNET_MESSENGER_EpochAnnouncement::valid, and value.
Referenced by get_epoch_announcement().
struct GNUNET_MESSENGER_EpochAnnouncement * get_epoch_announcement | ( | struct GNUNET_MESSENGER_Epoch * | epoch, |
const union GNUNET_MESSENGER_EpochIdentifier * | identifier, | ||
enum GNUNET_GenericReturnValue | valid | ||
) |
Returns the epoch announcement of a given epoch using a specific unique identifier or NULL.
An optional flag states whether it is important to find a valid epoch announcement for sending encrypted messages. If the identifier is NULL, the announcement with most members gets returned. If the validity flag is set to GNUNET_SYSERR, no new epoch announcement gets created automatically.
[in,out] | epoch | Epoch |
[in] | identifier | Announcement identifier or NULL |
[in] | valid | Validity flag |
Definition at line 830 of file messenger_api_epoch.c.
References GNUNET_MESSENGER_Epoch::announcements, create_epoch_announcement(), destroy_epoch_announcement(), GNUNET_MESSENGER_EpochAnnouncement::epoch, GNUNET_assert, GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST, GNUNET_CONTAINER_multishortmap_get_multiple(), GNUNET_CONTAINER_multishortmap_iterate(), GNUNET_CONTAINER_multishortmap_put(), GNUNET_OK, GNUNET_SYSERR, GNUNET_YES, GNUNET_MESSENGER_EpochIdentifier::hash, GNUNET_MESSENGER_EpochAnnouncement::identifier, it_find_announcement_with_most_members(), it_find_valid_announcement_with_most_members(), and GNUNET_MESSENGER_EpochAnnouncement::valid.
Referenced by cb_key_monitor(), get_epoch_previous_announcement(), handle_access_message(), handle_announcement_message(), handle_appeal_message(), handle_authorization_message(), handle_revolution_message(), handle_room_delayed_announcement(), handle_room_delayed_appeal(), handle_room_delayed_deletion(), handle_secret_message(), invalidate_epoch_announcement(), and send_message_to_room().
|
static |
Definition at line 884 of file messenger_api_epoch.c.
References get_epoch_group_members_count(), GNUNET_memcmp, GNUNET_NO, GNUNET_YES, GNUNET_MESSENGER_EpochGroup::identifier, and max.
Referenced by get_epoch_previous_group(), it_find_group_with_most_members(), and update_epoch_group().
|
static |
Definition at line 911 of file messenger_api_epoch.c.
References GNUNET_assert, GNUNET_YES, is_other_epoch_group_better(), key, result, and value.
Referenced by get_epoch_group(), and it_find_valid_group_with_most_members().
|
static |
Definition at line 931 of file messenger_api_epoch.c.
References get_epoch_group_key(), GNUNET_assert, GNUNET_YES, it_find_group_with_most_members(), key, GNUNET_MESSENGER_EpochGroup::valid, and value.
Referenced by get_epoch_group().
struct GNUNET_MESSENGER_EpochGroup * get_epoch_group | ( | struct GNUNET_MESSENGER_Epoch * | epoch, |
const union GNUNET_MESSENGER_EpochIdentifier * | identifier, | ||
enum GNUNET_GenericReturnValue | valid | ||
) |
Returns the epoch group of a given epoch using a specific unique identifier or NULL.
An optional flag states whether it is important to find a valid epoch group for sending encrypted messages. If the identifier is NULL, the group with most members gets returned. If the validity flag is set to GNUNET_SYSERR, no new epoch group gets created automatically.
[in,out] | epoch | Epoch |
[in] | identifier | Group identifier or NULL |
[in] | valid | Validity flag |
Definition at line 950 of file messenger_api_epoch.c.
References GNUNET_MESSENGER_EpochIdentifier::code, create_epoch_group(), destroy_epoch_group(), GNUNET_MESSENGER_EpochGroup::epoch, GNUNET_assert, GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST, GNUNET_CONTAINER_multishortmap_get_multiple(), GNUNET_CONTAINER_multishortmap_iterate(), GNUNET_CONTAINER_multishortmap_put(), GNUNET_OK, GNUNET_SYSERR, GNUNET_YES, GNUNET_MESSENGER_Epoch::groups, GNUNET_MESSENGER_EpochIdentifier::hash, GNUNET_MESSENGER_EpochGroup::identifier, it_find_group_with_most_members(), it_find_valid_group_with_most_members(), GNUNET_MESSENGER_EpochIdentifierCode::level_bits, and GNUNET_MESSENGER_EpochGroup::valid.
Referenced by cb_key_monitor(), create_new_epoch(), get_epoch_previous_group(), get_epoch_proposal_group(), handle_access_message(), handle_announcement_message(), handle_authorization_message(), handle_group_message(), handle_revolution_message(), handle_room_delayed_announcement(), invalidate_epoch_group(), it_move_epoch_groups_from_previous_epoch(), and send_epoch_group_authorization().
enum GNUNET_GenericReturnValue is_epoch_previous_of_other | ( | const struct GNUNET_MESSENGER_Epoch * | epoch, |
const struct GNUNET_MESSENGER_Epoch * | other | ||
) |
Returns whether a given epoch is the epoch before some other epoch.
[in] | epoch | Epoch |
[in] | other | Other epoch |
Definition at line 1002 of file messenger_api_epoch.c.
References GNUNET_MESSENGER_Message::body, epochs, get_room_message(), GNUNET_assert, GNUNET_CRYPTO_hash_cmp(), GNUNET_MESSENGER_KIND_JOIN, GNUNET_MESSENGER_KIND_LEAVE, GNUNET_MESSENGER_KIND_MERGE, GNUNET_NO, GNUNET_SYSERR, GNUNET_YES, GNUNET_MESSENGER_Epoch::hash, GNUNET_MESSENGER_Message::header, GNUNET_MESSENGER_MessageBody::join, GNUNET_MESSENGER_MessageHeader::kind, GNUNET_MESSENGER_MessageBody::leave, GNUNET_MESSENGER_MessageBody::merge, and GNUNET_MESSENGER_Epoch::room.
const struct GNUNET_MESSENGER_EpochAnnouncement * get_epoch_previous_announcement | ( | struct GNUNET_MESSENGER_Epoch * | epoch, |
const union GNUNET_MESSENGER_EpochIdentifier * | identifier | ||
) |
Returns the epoch announcement of a previous epoch from a given epoch using a specific announcement identifier.
This is utilized for potential key derivation.
[in,out] | epoch | Epoch |
[in] | identifier | Announcement identifier or NULL |
Definition at line 1044 of file messenger_api_epoch.c.
References GNUNET_MESSENGER_EpochAnnouncement::epoch, get_epoch_announcement(), get_room_message(), get_room_message_epoch(), GNUNET_assert, GNUNET_CRYPTO_hash_cmp(), GNUNET_MESSENGER_KIND_LEAVE, GNUNET_SYSERR, GNUNET_MESSENGER_Epoch::hash, GNUNET_MESSENGER_Message::header, GNUNET_MESSENGER_EpochAnnouncement::identifier, GNUNET_MESSENGER_MessageHeader::kind, GNUNET_MESSENGER_MessageHeader::previous, and GNUNET_MESSENGER_Epoch::room.
Referenced by create_epoch_announcement().
const struct GNUNET_MESSENGER_EpochGroup * get_epoch_previous_group | ( | struct GNUNET_MESSENGER_Epoch * | epoch, |
const union GNUNET_MESSENGER_EpochIdentifier * | identifier | ||
) |
Returns the epoch group of a previous epoch from a given epoch using a specific group identifier.
This is utilized for potential key derivation and taking over groups from one previous epoch into the current.
[in,out] | epoch | Epoch |
[in] | identifier | Group identifier or NULL |
Definition at line 1082 of file messenger_api_epoch.c.
References GNUNET_MESSENGER_Message::body, GNUNET_MESSENGER_EpochGroup::epoch, get_epoch_group(), get_room_message(), get_room_message_epoch(), GNUNET_assert, GNUNET_CRYPTO_hash_cmp(), GNUNET_MESSENGER_KIND_MERGE, GNUNET_SYSERR, GNUNET_YES, GNUNET_MESSENGER_Epoch::hash, GNUNET_MESSENGER_Message::header, GNUNET_MESSENGER_EpochGroup::identifier, is_other_epoch_group_better(), GNUNET_MESSENGER_MessageHeader::kind, GNUNET_MESSENGER_MessageBody::merge, GNUNET_MESSENGER_MessageHeader::previous, GNUNET_MESSENGER_MessageMerge::previous, and GNUNET_MESSENGER_Epoch::room.
Referenced by create_epoch_group(), create_new_epoch(), and get_epoch_group_position_factor().
|
static |
Definition at line 1142 of file messenger_api_epoch.c.
References GNUNET_assert, GNUNET_CRYPTO_public_key_to_string(), GNUNET_free, key, and result.
Referenced by get_epoch_member_position().
uint32_t get_epoch_member_position | ( | const struct GNUNET_MESSENGER_Epoch * | epoch, |
const struct GNUNET_MESSENGER_Contact * | contact | ||
) |
Returns the index position of a specific contact inside a given epoch in relation to its list of members.
Every member of an epoch gets a unique position.
[in] | epoch | Epoch |
[in] | contact | Contact |
Definition at line 1162 of file messenger_api_epoch.c.
References compare_member_public_keys(), get_contact_key(), GNUNET_assert, GNUNET_CRYPTO_public_key_to_string(), GNUNET_free, GNUNET_MESSENGER_Contact::id, key, GNUNET_MESSENGER_Epoch::members, GNUNET_MESSENGER_Epoch::members_count, and result.
Referenced by get_epoch_position_factor().
|
static |
Definition at line 1197 of file messenger_api_epoch.c.
References GNUNET_MESSENGER_RoomMessageEntry::epoch, GNUNET_assert, GNUNET_CONTAINER_multihashmap_get(), GNUNET_NO, GNUNET_SYSERR, GNUNET_YES, GNUNET_MESSENGER_Room::messages, and GNUNET_MESSENGER_RoomMessageEntry::sender.
Referenced by is_epoch_member_in_room_graph().
|
static |
Definition at line 1221 of file messenger_api_epoch.c.
References GNUNET_MESSENGER_Message::body, GNUNET_MESSENGER_MessageJoin::epoch, GNUNET_MESSENGER_MessageLeave::epoch, GNUNET_MESSENGER_MessageMerge::epochs, get_room_message(), GNUNET_assert, GNUNET_CONTAINER_multihashmap_contains(), GNUNET_CONTAINER_multihashmap_put(), GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST, GNUNET_MESSENGER_KIND_JOIN, GNUNET_MESSENGER_KIND_LEAVE, GNUNET_MESSENGER_KIND_MERGE, GNUNET_NO, GNUNET_YES, GNUNET_MESSENGER_Message::header, is_epoch_member_in_room_graph(), is_epoch_sender_in_room(), GNUNET_MESSENGER_MessageBody::join, GNUNET_MESSENGER_MessageHeader::kind, GNUNET_MESSENGER_MessageBody::leave, map, and GNUNET_MESSENGER_MessageBody::merge.
Referenced by is_epoch_member_in_room(), and is_epoch_member_in_room_graph().
enum GNUNET_GenericReturnValue is_epoch_member | ( | const struct GNUNET_MESSENGER_Epoch * | epoch, |
const struct GNUNET_MESSENGER_Contact * | contact | ||
) |
Returns whether a specific contact is member of a given epoch.
[in] | epoch | Epoch |
[in] | contact | Contact |
Definition at line 1304 of file messenger_api_epoch.c.
References GNUNET_assert, GNUNET_YES, GNUNET_MESSENGER_Epoch::hash, is_epoch_member_in_room(), GNUNET_MESSENGER_Epoch::members, GNUNET_MESSENGER_Epoch::members_count, and GNUNET_MESSENGER_Epoch::room.
Referenced by confirm_epoch_announcement_member(), confirm_epoch_group_member(), get_room_availble_epoch_entry(), handle_appeal_message(), handle_room_delayed_appeal(), invalidate_epoch_announcement(), and invalidate_epoch_group().
double get_epoch_position_factor | ( | const struct GNUNET_MESSENGER_Epoch * | epoch, |
const struct GNUNET_MESSENGER_Contact * | contact, | ||
const struct GNUNET_MESSENGER_EpochMembership * | membership | ||
) |
Returns a relative member positon of a specific contact inside a given epoch in relation to its list of members.
The position gets reduced depending on an optional active membership from a subgroup.
[in] | epoch | Epoch |
[in] | contact | Contact |
[in] | membership | Membership or NULL |
Definition at line 1320 of file messenger_api_epoch.c.
References get_epoch_member_position(), get_epoch_membership_count(), get_epoch_size(), and GNUNET_assert.
Referenced by handle_appeal_message(), and handle_epoch_announcement().
void send_epoch_message | ( | const struct GNUNET_MESSENGER_Epoch * | epoch, |
struct GNUNET_MESSENGER_Message * | message | ||
) |
Sends a created and allocated message in a room of a given epoch enforcing the message gets interpreted as part of that exact epoch.
[in] | epoch | Epoch |
[in,out] | message | Message |
Definition at line 1350 of file messenger_api_epoch.c.
References enqueue_message_to_room(), GNUNET_assert, GNUNET_YES, GNUNET_MESSENGER_Epoch::hash, and GNUNET_MESSENGER_Epoch::room.
Referenced by send_epoch_announcement(), send_epoch_announcement_access(), send_epoch_announcement_appeal(), send_epoch_announcement_authorization(), send_epoch_announcement_revolution(), send_epoch_group(), send_epoch_group_access(), send_epoch_group_announcement(), send_epoch_group_authorization(), and send_epoch_group_revolution().
void update_epoch_announcement | ( | struct GNUNET_MESSENGER_Epoch * | epoch, |
struct GNUNET_MESSENGER_EpochAnnouncement * | announcement | ||
) |
Updates the main announcement of a given epoch, looking into replacing the current main announcement with a specific epoch announcement that's provided.
The main announcement will be used for encrypting own messages in that epoch.
[in,out] | epoch | Epoch |
[in,out] | announcement | Epoch announcement |
Definition at line 1364 of file messenger_api_epoch.c.
References get_epoch_announcement_key(), GNUNET_assert, GNUNET_YES, is_other_epoch_announcement_better(), GNUNET_MESSENGER_Epoch::main_announcement, and GNUNET_MESSENGER_EpochAnnouncement::valid.
Referenced by confirm_epoch_announcement_member(), and set_epoch_announcement_key().
|
static |
Definition at line 1384 of file messenger_api_epoch.c.
References GNUNET_assert, GNUNET_TIME_absolute_add(), GNUNET_TIME_absolute_get(), GNUNET_MESSENGER_Epoch::proposal_expiration, and timeout.
Referenced by propose_epoch_group(), set_epoch_proposal_group(), and update_epoch_group().
|
static |
Definition at line 1396 of file messenger_api_epoch.c.
References GNUNET_assert, GNUNET_NO, GNUNET_TIME_absolute_get_remaining(), GNUNET_TIME_relative_is_zero(), GNUNET_YES, GNUNET_MESSENGER_Epoch::proposal_expiration, and timeout.
Referenced by propose_epoch_group().
void update_epoch_group | ( | struct GNUNET_MESSENGER_Epoch * | epoch, |
struct GNUNET_MESSENGER_EpochGroup * | group | ||
) |
Updates the main group of a given epoch, looking into replacing the current main group with a specific epoch group that's provided.
The main group will be used for encrypted key exchange.
[in,out] | epoch | Epoch |
[in,out] | group | Epoch group |
Definition at line 1413 of file messenger_api_epoch.c.
References get_epoch_group_key(), GNUNET_assert, GNUNET_SCHEDULER_cancel(), GNUNET_TIME_relative_get_zero_(), GNUNET_YES, is_epoch_group_completed(), is_epoch_group_proposal(), is_other_epoch_group_better(), GNUNET_MESSENGER_Epoch::main_group, GNUNET_MESSENGER_Epoch::proposal_hash, GNUNET_MESSENGER_Epoch::proposal_timeout, set_epoch_proposing(), and GNUNET_MESSENGER_EpochGroup::valid.
Referenced by confirm_epoch_group_member(), and set_epoch_group_key().
|
static |
Definition at line 1446 of file messenger_api_epoch.c.
References cancel_epoch_proposal_group(), GNUNET_assert, and GNUNET_MESSENGER_Epoch::proposal_timeout.
Referenced by set_epoch_proposal_group().
|
static |
Definition at line 1460 of file messenger_api_epoch.c.
References GNUNET_MESSENGER_EpochGroup::epoch, get_epoch_group_level(), GNUNET_assert, GNUNET_CONTAINER_multishortmap_iterator_create(), GNUNET_CONTAINER_multishortmap_iterator_destroy(), GNUNET_CONTAINER_multishortmap_iterator_next(), GNUNET_NO, GNUNET_YES, GNUNET_MESSENGER_Epoch::groups, is_epoch_group_subgroup_of(), and result.
Referenced by propose_epoch_group().
enum GNUNET_GenericReturnValue is_epoch_member_in_any_group | ( | struct GNUNET_MESSENGER_Epoch * | epoch, |
const struct GNUNET_MESSENGER_Contact * | contact | ||
) |
Definition at line 1501 of file messenger_api_epoch.c.
References GNUNET_MESSENGER_EpochGroup::epoch, GNUNET_assert, GNUNET_CONTAINER_multishortmap_iterator_create(), GNUNET_CONTAINER_multishortmap_iterator_destroy(), GNUNET_CONTAINER_multishortmap_iterator_next(), GNUNET_NO, GNUNET_YES, GNUNET_MESSENGER_Epoch::groups, is_epoch_group_member(), key, and result.
Referenced by propose_epoch_group().
void propose_epoch_group | ( | struct GNUNET_MESSENGER_Epoch * | epoch, |
const struct GNUNET_TIME_Relative | timeout | ||
) |
Tries to propose a new group inside a given epoch that will automatically be formed by using the clients own main group and another group on the same level.
The proposal is active until a specified timeout. Multiple groups can not be proposed in parallel by the same client.
[in,out] | epoch | Epoch |
[in] | timeout | Timeout for proposal |
Definition at line 1536 of file messenger_api_epoch.c.
References create_epoch_group(), destroy_epoch_group(), get_epoch_announcement_member_hash(), get_epoch_group_level(), get_epoch_group_member_hash(), GNUNET_assert, GNUNET_CONTAINER_multihashmap_iterator_create(), GNUNET_CONTAINER_multihashmap_iterator_destroy(), GNUNET_CONTAINER_multihashmap_iterator_next(), GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST, GNUNET_CONTAINER_multishortmap_iterator_create(), GNUNET_CONTAINER_multishortmap_iterator_destroy(), GNUNET_CONTAINER_multishortmap_iterator_next(), GNUNET_CONTAINER_multishortmap_put(), GNUNET_CONTAINER_multishortmap_remove(), GNUNET_CRYPTO_hash_cmp(), GNUNET_memcpy, GNUNET_NO, GNUNET_OK, GNUNET_YES, GNUNET_MESSENGER_Handle::group_keys, GNUNET_MESSENGER_Epoch::groups, GNUNET_MESSENGER_Room::handle, GNUNET_MESSENGER_EpochIdentifier::hash, GNUNET_MESSENGER_EpochGroup::identifier, is_epoch_announcement_announced(), is_epoch_group_completed(), is_epoch_member_in_any_group(), is_epoch_proposing(), is_epoch_subgroup_of_any_group(), GNUNET_MESSENGER_Epoch::main_announcement, GNUNET_MESSENGER_Epoch::main_group, GNUNET_MESSENGER_Epoch::members, GNUNET_MESSENGER_Epoch::proposal_timeout, GNUNET_MESSENGER_Epoch::room, send_epoch_group(), set_epoch_proposing(), and timeout.
Referenced by handle_epoch_announcement_delay(), and handle_epoch_group_announcement_delay().
void set_epoch_proposal_group | ( | struct GNUNET_MESSENGER_Epoch * | epoch, |
const struct GNUNET_HashCode * | hash | ||
) |
Sets the current group of proposal for a given epoch to the group specified by a message identified by its hash.
Timeout for the proposal and other properties will be derived from that message accordingly.
[in,out] | epoch | Epoch |
[in] | hash | Hash of message |
Definition at line 1677 of file messenger_api_epoch.c.
References GNUNET_MESSENGER_Message::body, GNUNET_MESSENGER_EpochIdentifier::code, get_message_timeout(), get_room_message(), GNUNET_assert, GNUNET_memcpy, GNUNET_MESSENGER_KIND_GROUP, GNUNET_SCHEDULER_add_delayed_with_priority(), GNUNET_SCHEDULER_PRIORITY_HIGH, GNUNET_TIME_relative_is_zero(), GNUNET_MESSENGER_MessageBody::group, GNUNET_MESSENGER_EpochIdentifierCode::group_bit, GNUNET_MESSENGER_Message::header, GNUNET_MESSENGER_MessageGroup::identifier, GNUNET_MESSENGER_MessageHeader::kind, on_epoch_proposal_timeout(), GNUNET_MESSENGER_Epoch::proposal_hash, GNUNET_MESSENGER_Epoch::proposal_timeout, GNUNET_MESSENGER_Epoch::room, set_epoch_proposing(), and timeout.
Referenced by handle_group_message().
const struct GNUNET_MESSENGER_EpochGroup * get_epoch_proposal_group | ( | struct GNUNET_MESSENGER_Epoch * | epoch | ) |
Returns the current group of proposal for a given epoch.
[in,out] | epoch | Epoch |
Definition at line 1716 of file messenger_api_epoch.c.
References GNUNET_MESSENGER_Message::body, GNUNET_MESSENGER_EpochIdentifier::code, get_epoch_group(), get_room_message(), GNUNET_assert, GNUNET_MESSENGER_KIND_GROUP, GNUNET_NO, GNUNET_MESSENGER_MessageBody::group, GNUNET_MESSENGER_EpochIdentifierCode::group_bit, GNUNET_MESSENGER_Message::header, GNUNET_MESSENGER_MessageGroup::identifier, GNUNET_MESSENGER_MessageHeader::kind, GNUNET_MESSENGER_Epoch::proposal_hash, and GNUNET_MESSENGER_Epoch::room.
Referenced by cancel_epoch_proposal_group(), handle_epoch_group_announcement(), and is_epoch_group_proposal().
void cancel_epoch_proposal_group | ( | struct GNUNET_MESSENGER_Epoch * | epoch | ) |
Cancels the current proposal of a new group from a given epoch.
[in,out] | epoch | Epoch |
Definition at line 1739 of file messenger_api_epoch.c.
References GNUNET_MESSENGER_EpochGroup::epoch, get_epoch_proposal_group(), GNUNET_assert, GNUNET_CONTAINER_multishortmap_remove(), GNUNET_SCHEDULER_cancel(), GNUNET_YES, GNUNET_MESSENGER_Epoch::groups, GNUNET_MESSENGER_EpochIdentifier::hash, GNUNET_MESSENGER_EpochGroup::identifier, is_epoch_group_completed(), GNUNET_MESSENGER_Epoch::proposal_hash, and GNUNET_MESSENGER_Epoch::proposal_timeout.
Referenced by handle_epoch_group_access(), handle_epoch_group_announcement(), and on_epoch_proposal_timeout().
|
static |
Definition at line 1766 of file messenger_api_epoch.c.
References GNUNET_assert, GNUNET_YES, invalidate_epoch_announcement(), and value.
Referenced by invalidate_epoch_keys_by_member().
|
static |
Definition at line 1784 of file messenger_api_epoch.c.
References GNUNET_assert, GNUNET_YES, invalidate_epoch_group(), and value.
Referenced by invalidate_epoch_keys_by_member().
void invalidate_epoch_keys_by_member | ( | struct GNUNET_MESSENGER_Epoch * | epoch, |
const struct GNUNET_MESSENGER_Contact * | contact | ||
) |
Invalidates all announced epoch and group keys by a specific contact inside a given epoch.
[in,out] | epoch | Epoch |
[in] | contact | Contact |
Definition at line 1802 of file messenger_api_epoch.c.
References GNUNET_MESSENGER_Epoch::announcements, GNUNET_MESSENGER_EpochGroup::epoch, GNUNET_assert, GNUNET_CONTAINER_multishortmap_iterate(), GNUNET_MESSENGER_Epoch::groups, iterate_epoch_announcement_invalidation(), and iterate_epoch_group_invalidation().
Referenced by iterate_room_epoch_member_invalidation().