aboutsummaryrefslogtreecommitdiff
path: root/src/application.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/application.h')
-rw-r--r--src/application.h83
1 files changed, 83 insertions, 0 deletions
diff --git a/src/application.h b/src/application.h
new file mode 100644
index 0000000..6e35bf6
--- /dev/null
+++ b/src/application.h
@@ -0,0 +1,83 @@
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 */
20/*
21 * @author Tobias Frisch
22 * @file application.h
23 */
24
25#ifndef APPLICATION_H_
26#define APPLICATION_H_
27
28#include <pthread.h>
29
30#include "chat/messenger.h"
31
32#include "ui/messenger.h"
33
34#include "util.h"
35
36typedef enum MESSENGER_ApplicationSignal
37{
38 MESSENGER_NONE = 0,
39 MESSENGER_QUIT = 1,
40 MESSENGER_FAIL = 2
41} MESSENGER_ApplicationSignal;
42
43typedef struct MESSENGER_Application
44{
45 char** argv;
46 int argc;
47
48 struct {
49 int status;
50 pthread_t tid;
51
52 MESSENGER_ApplicationSignal signal;
53
54 CHAT_MESSENGER_Handle messenger;
55 } chat;
56
57 struct {
58 UI_MESSENGER_Handle messenger;
59 } ui;
60} MESSENGER_Application;
61
62void
63application_init(MESSENGER_Application *app,
64 int argc,
65 char **argv);
66
67void
68application_start(MESSENGER_Application *app);
69
70typedef void (*MESSENGER_ApplicationEvent) (MESSENGER_Application *app);
71
72void
73application_call_event(MESSENGER_Application *app,
74 MESSENGER_ApplicationEvent event);
75
76void
77application_exit(MESSENGER_Application *app,
78 MESSENGER_ApplicationSignal signal);
79
80int
81application_status(MESSENGER_Application *app);
82
83#endif /* APPLICATION_H_ */