GNUnet  0.11.x
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_crypto_lib.h"
31 #include "gnunet_container_lib.h"
33 #include "gnunet_time_lib.h"
34 
36 
37 #include "messenger_api_contact.h"
38 
41 
44 
46 
49 
52 
54 
55  int closed;
56  int completed;
57 };
58 
71  const struct GNUNET_IDENTITY_PublicKey *pubkey);
72 
87  const struct GNUNET_MESSENGER_Message *message,
88  const struct GNUNET_HashCode *hash);
89 
95 void
97 
108 int
110  const struct GNUNET_HashCode *hash);
111 
121 void
123 
130 int
132 
142 int
144 
153 
160 const struct GNUNET_HashCode*
162 
169 const struct GNUNET_ShortHashCode*
171 
178 const struct GNUNET_IDENTITY_PublicKey*
180 
187 const struct GNUNET_HashCode*
189 
198 
211 int
213  const struct GNUNET_MESSENGER_Message *message,
214  const struct GNUNET_HashCode *hash);
215 
226 int
228  const struct GNUNET_HashCode *hash, 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
265 load_member_session (struct GNUNET_MESSENGER_Member *member, const char *directory);
266 
275 void
276 load_member_session_next (struct GNUNET_MESSENGER_MemberSession *session, const char *directory);
277 
285 void
286 save_member_session (struct GNUNET_MESSENGER_MemberSession *session, const char *directory);
287 
288 #endif //GNUNET_SERVICE_MESSENGER_MEMBER_SESSION_H
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.
struct GNUNET_MESSENGER_MemberSession * next
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...
void destroy_member_session(struct GNUNET_MESSENGER_MemberSession *session)
Destroys a member session and frees its memory fully.
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 * 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...
const struct GNUNET_ShortHashCode * get_member_session_id(const struct GNUNET_MESSENGER_MemberSession *session)
Returns the member id of a given member session.
Internal representation of the hash map.
A 256-bit hashcode.
cryptographic primitives for GNUnet
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.
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.
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_Contact * get_member_session_contact(struct GNUNET_MESSENGER_MemberSession *session)
Returns the contact which is connected to a given member session.
GNUnet MESSENGER service.
static struct GNUNET_IDENTITY_PublicKey pubkey
Public key of the zone to look in.
messenger api: client implementation of GNUnet MESSENGER service
A 512-bit hashcode.
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_CONTAINER_MultiHashMap * history
struct GNUNET_TIME_Absolute get_member_session_start(const struct GNUNET_MESSENGER_MemberSession *session)
Returns the timestamp of the member session&#39;s start.
int is_member_session_completed(const struct GNUNET_MESSENGER_MemberSession *session)
Returns if the given member session has been completed.
struct GNUNET_MESSENGER_ListMessages messages
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.
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.
An identity key as per LSD0001.
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.
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.
int is_member_session_closed(const struct GNUNET_MESSENGER_MemberSession *session)
Returns if the given member session has been closed.
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...
Time for absolute times used by GNUnet, in microseconds.
const struct GNUNET_HashCode * get_member_session_context(const struct GNUNET_MESSENGER_MemberSession *session)
Returns the member context of a given member session.
struct GNUNET_MESSENGER_MemberSession * prev