GNUnet  0.20.0
gnunet-service-messenger_member_session.h
Go to the documentation of this file.
1 /*
2  This file is part of GNUnet.
3  Copyright (C) 2021 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_SERVICE_MESSENGER_MEMBER_SESSION_H
27 #define GNUNET_SERVICE_MESSENGER_MEMBER_SESSION_H
28 
29 #include "platform.h"
30 #include "gnunet_util_lib.h"
32 #include "gnunet_time_lib.h"
33 
35 
36 #include "messenger_api_contact.h"
37 
40 
42  struct GNUNET_HashCode context;
43 
45 
48 
51 
53 
54  int closed;
55  int completed;
56 };
57 
70  const struct GNUNET_IDENTITY_PublicKey *pubkey);
71 
86  const struct GNUNET_MESSENGER_Message *message,
87  const struct GNUNET_HashCode *hash);
88 
94 void
96 
107 int
109  const struct GNUNET_HashCode *hash);
110 
120 void
122 
129 int
131 
141 int
143 
152 
159 const struct GNUNET_HashCode*
161 
168 const struct GNUNET_ShortHashCode*
170 
177 const struct GNUNET_IDENTITY_PublicKey*
179 
186 const struct GNUNET_HashCode*
188 
197 
210 int
212  const struct GNUNET_MESSENGER_Message *message,
213  const struct GNUNET_HashCode *hash);
214 
225 int
227  const struct GNUNET_HashCode *hash,
228  int ownership);
229 
240 void
242  const struct GNUNET_MESSENGER_Message *message,
243  const struct GNUNET_HashCode *hash);
244 
252 void
254  const struct GNUNET_HashCode *hash);
255 
264 void
266  const char *directory);
267 
276 void
278  const char *directory);
279 
287 void
289  const char *directory);
290 
291 #endif //GNUNET_SERVICE_MESSENGER_MEMBER_SESSION_H
static struct GNUNET_IDENTITY_PublicKey pubkey
Public key of the zone to look in.
GNUnet MESSENGER service.
const struct GNUNET_HashCode * get_member_session_key(const struct GNUNET_MESSENGER_MemberSession *session)
Returns the key of the room a given member session belongs to.
const struct GNUNET_ShortHashCode * get_member_session_id(const struct GNUNET_MESSENGER_MemberSession *session)
Returns the member id of a given member session.
void clear_member_session_history(struct GNUNET_MESSENGER_MemberSession *session, const struct GNUNET_HashCode *hash)
Removes a message from the history of a session using the messages hash.
const struct GNUNET_HashCode * get_member_session_context(const struct GNUNET_MESSENGER_MemberSession *session)
Returns the member context of a given member session.
void destroy_member_session(struct GNUNET_MESSENGER_MemberSession *session)
Destroys a member session and frees its memory fully.
int check_member_session_history(const struct GNUNET_MESSENGER_MemberSession *session, const struct GNUNET_HashCode *hash, int ownership)
Checks the history of a session for a specific message which is identified by its hash and if the own...
int reset_member_session(struct GNUNET_MESSENGER_MemberSession *session, const struct GNUNET_HashCode *hash)
Resets a given member session which re-opens a member session for new usage.
void load_member_session_next(struct GNUNET_MESSENGER_MemberSession *session, const char *directory)
Loads the connection from one session to another through the next attribute.
void close_member_session(struct GNUNET_MESSENGER_MemberSession *session)
Closes a given member session which opens the request for completion of the given member session.
struct GNUNET_TIME_Absolute get_member_session_start(const struct GNUNET_MESSENGER_MemberSession *session)
Returns the timestamp of the member session's start.
void update_member_session_history(struct GNUNET_MESSENGER_MemberSession *session, const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash)
Adds a given message to the history of a session using the messages hash.
int is_member_session_completed(const struct GNUNET_MESSENGER_MemberSession *session)
Returns if the given member session has been completed.
const struct GNUNET_IDENTITY_PublicKey * get_member_session_public_key(const struct GNUNET_MESSENGER_MemberSession *session)
Returns the public key from an EGO of a given member session.
int verify_member_session_as_sender(const struct GNUNET_MESSENGER_MemberSession *session, const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash)
Verifies a given member session as sender of a selected message and its hash.
struct GNUNET_MESSENGER_MemberSession * switch_member_session(struct GNUNET_MESSENGER_MemberSession *session, const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash)
Creates and allocates a new member session closing and replacing a given other session of the same me...
void load_member_session(struct GNUNET_MESSENGER_Member *member, const char *directory)
Loads data from a directory into a new allocated and created member session of a member if the requir...
struct GNUNET_MESSENGER_Contact * get_member_session_contact(struct GNUNET_MESSENGER_MemberSession *session)
Returns the contact which is connected to a given member session.
int is_member_session_closed(const struct GNUNET_MESSENGER_MemberSession *session)
Returns if the given member session has been closed.
void save_member_session(struct GNUNET_MESSENGER_MemberSession *session, const char *directory)
Saves data from a member session into a directory which can be load to restore the member session com...
struct GNUNET_MESSENGER_MemberSession * create_member_session(struct GNUNET_MESSENGER_Member *member, const struct GNUNET_IDENTITY_PublicKey *pubkey)
Creates and allocates a new member session of a member with a given public key.
Identity service; implements identity management for GNUnet.
Functions related to time.
messenger api: client implementation of GNUnet MESSENGER service
Internal representation of the hash map.
A 512-bit hashcode.
An identity key as per LSD0001.
struct GNUNET_CONTAINER_MultiHashMap * history
struct GNUNET_MESSENGER_MemberSession * prev
struct GNUNET_MESSENGER_MemberSession * next
struct GNUNET_MESSENGER_ListMessages messages
A 256-bit hashcode.
Time for absolute times used by GNUnet, in microseconds.