GNUnet debian-0.24.3-23-g589b01d60
messenger_api_epoch.h
Go to the documentation of this file.
1/*
2 This file is part of GNUnet.
3 Copyright (C) 2024--2025 GNUnet e.V.
4
5 GNUnet is free software: you can redistribute it and/or modify it
6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation, either version 3 of the License,
8 or (at your option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details.
14
15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18 SPDX-License-Identifier: AGPL3.0-or-later
19 */
26#ifndef GNUNET_MESSENGER_API_EPOCH_H
27#define GNUNET_MESSENGER_API_EPOCH_H
28
29#include "gnunet_common.h"
30#include "gnunet_time_lib.h"
31#include "gnunet_util_lib.h"
32
35
39
41{
45
47
49
54
55 uint32_t members_count;
57
60
63
66};
67
78 const struct GNUNET_HashCode *hash);
79
90 const struct GNUNET_HashCode *hash);
91
97void
99
107uint32_t
108get_epoch_size (const struct GNUNET_MESSENGER_Epoch *epoch);
109
116void
118
130 const struct GNUNET_HashCode *hash);
131
143 const struct GNUNET_TIME_Relative timeout);
144
153const struct GNUNET_TIME_Relative
155
174
192
203 const struct GNUNET_MESSENGER_Epoch *other);
204
217 identifier);
218
229const struct GNUNET_MESSENGER_EpochGroup*
232 identifier);
233
243uint32_t
245 const struct GNUNET_MESSENGER_Contact *contact);
246
256 const struct GNUNET_MESSENGER_Contact *contact);
257
268double
270 const struct GNUNET_MESSENGER_Contact *contact,
272 membership);
273
282void
284 struct GNUNET_MESSENGER_Message *message);
285
295void
298 announcement);
299
309void
311 struct GNUNET_MESSENGER_EpochGroup *group);
312
323void
325 const struct GNUNET_TIME_Relative timeout);
326
336void
338 const struct GNUNET_HashCode *hash);
339
346const struct GNUNET_MESSENGER_EpochGroup*
348
354void
356
364void
366 const struct GNUNET_MESSENGER_Contact *
367 contact);
368
369#endif // GNUNET_MESSENGER_API_EPOCH_H
static struct GNUNET_TIME_Relative timeout
User defined timestamp for completing operations.
Definition: gnunet-arm.c:118
commonly used definitions; globals in this file are exempt from the rule that the module name ("commo...
Functions related to time.
GNUNET_GenericReturnValue
Named constants for return values.
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 memb...
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.
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 usa...
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.
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.
void cancel_epoch_proposal_group(struct GNUNET_MESSENGER_Epoch *epoch)
Cancels the current proposal of a new group from a given 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.
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.
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 i...
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 ...
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 spe...
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.
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.
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 b...
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 ...
void destroy_epoch(struct GNUNET_MESSENGER_Epoch *epoch)
Destroys an epoch and frees its memory fully from the client API.
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.
void reset_epoch_size(struct GNUNET_MESSENGER_Epoch *epoch)
Resets the amount of members by a given epoch to recalculate the exact amount.
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 clie...
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 ...
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 interpret...
const struct GNUNET_MESSENGER_EpochGroup * get_epoch_proposal_group(struct GNUNET_MESSENGER_Epoch *epoch)
Returns the current group of proposal for a given 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 specifi...
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.
Internal representation of the hash map.
Internal representation of the hash map.
Private ECC key encoded for transmission.
A 512-bit hashcode.
union GNUNET_MESSENGER_EpochIdentifier identifier
enum GNUNET_GenericReturnValue valid
struct GNUNET_MESSENGER_Epoch * epoch
struct GNUNET_MESSENGER_EpochMembership * membership
union GNUNET_MESSENGER_EpochIdentifier identifier
struct GNUNET_MESSENGER_Room * room
struct GNUNET_CONTAINER_MultiHashMap * waiting
struct GNUNET_CONTAINER_MultiShortmap * announcements
struct GNUNET_MESSENGER_Epoch ** following
struct GNUNET_MESSENGER_EpochGroup * main_group
struct GNUNET_SCHEDULER_Task * proposal_timeout
struct GNUNET_CONTAINER_MultiShortmap * nonces
struct GNUNET_TIME_Absolute private_key_expiration
struct GNUNET_MESSENGER_EpochAnnouncement * main_announcement
struct GNUNET_CRYPTO_EcdhePrivateKey * private_key
struct GNUNET_CONTAINER_MultiShortmap * groups
const struct GNUNET_MESSENGER_Contact ** members
struct GNUNET_TIME_Absolute proposal_expiration
struct GNUNET_HashCode proposal_hash
struct GNUNET_HashCode hash
Entry in list of pending tasks.
Definition: scheduler.c:136
Time for absolute times used by GNUnet, in microseconds.
Time for relative time used by GNUnet, in microseconds.
An epoch identifier unifies an epoch identifier code and its 256bit hash representation.