libgnunetchat

library for GNUnet Messenger
Log | Files | Refs | README | LICENSE

gnunet_chat_lobby.h (2386B)


      1 /*
      2    This file is part of GNUnet.
      3    Copyright (C) 2022--2024 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  */
     20 /*
     21  * @author Tobias Frisch
     22  * @file gnunet_chat_lobby.h
     23  */
     24 
     25 #ifndef GNUNET_CHAT_LOBBY_H_
     26 #define GNUNET_CHAT_LOBBY_H_
     27 
     28 #include <gnunet/gnunet_identity_service.h>
     29 #include <gnunet/gnunet_util_lib.h>
     30 
     31 #include "gnunet_chat_lib.h"
     32 
     33 struct GNUNET_CHAT_Handle;
     34 struct GNUNET_CHAT_Context;
     35 struct GNUNET_CHAT_Uri;
     36 
     37 struct GNUNET_CHAT_Lobby
     38 {
     39   struct GNUNET_CHAT_Handle *handle;
     40 
     41   struct GNUNET_SCHEDULER_Task *destruction;
     42 
     43   struct GNUNET_CHAT_Context *context;
     44   struct GNUNET_CHAT_Uri *uri;
     45 
     46   struct GNUNET_IDENTITY_Operation *op;
     47   struct GNUNET_NAMESTORE_QueueEntry *query;
     48 
     49   struct GNUNET_TIME_Absolute expiration;
     50   GNUNET_CHAT_LobbyCallback callback;
     51   void *cls;
     52 };
     53 
     54 /**
     55  * Creates a new chat lobby using a given chat <i>handle</i>.
     56  *
     57  * @param[in,out] handle Chat handle
     58  * @return New chat lobby
     59  */
     60 struct GNUNET_CHAT_Lobby*
     61 lobby_create (struct GNUNET_CHAT_Handle *handle);
     62 
     63 /**
     64  * Destroys a chat <i>lobby</i> and frees its memory.
     65  *
     66  * @param[in,out] lobby Chat lobby
     67  */
     68 void
     69 lobby_destroy (struct GNUNET_CHAT_Lobby *lobby);
     70 
     71 /**
     72  * Opens a chat <i>lobby</i> and closes it automatically
     73  * after a selected <i>delay</i>. Once the lobby is open
     74  * a given <i>callback</i> will be called with a custom
     75  * closure.
     76  *
     77  * @param[in,out] lobby Chat lobby
     78  * @param[in] delay Delay to close down the lobby again
     79  * @param[in] callback Lobby opening callback
     80  * @param[in,out] cls Closure
     81  */
     82 void
     83 lobby_open (struct GNUNET_CHAT_Lobby *lobby,
     84             struct GNUNET_TIME_Relative delay,
     85             GNUNET_CHAT_LobbyCallback callback,
     86             void *cls);
     87 
     88 #endif /* GNUNET_CHAT_LOBBY_H_ */