/
mms_engine.h
108 lines (89 loc) · 3 KB
/
mms_engine.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
/*
* Copyright (C) 2013-2020 Jolla Ltd.
* Copyright (C) 2013-2020 Slava Monich <slava.monich@jolla.com>
* Copyright (C) 2019-2020 Open Mobile Platform LLC.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#ifndef JOLLA_MMS_ENGINE_H
#define JOLLA_MMS_ENGINE_H
#include <gio/gio.h>
#include <dbusaccess_types.h>
#include "mms_settings.h"
#include "mms_version.h"
#define MMS_APP_LOG_PREFIX "mms-engine"
#define MMS_ENGINE_SERVICE "org.nemomobile.MmsEngine"
#define MMS_ENGINE_PATH "/"
#define MMS_ENGINE_FLAG_KEEP_RUNNING (0x01)
#define MMS_ENGINE_FLAG_OVERRIDE_USER_AGENT (0x02)
#define MMS_ENGINE_FLAG_OVERRIDE_SIZE_LIMIT (0x04)
#define MMS_ENGINE_FLAG_OVERRIDE_MAX_PIXELS (0x08)
#define MMS_ENGINE_FLAG_OVERRIDE_UAPROF (0x10)
#define MMS_ENGINE_FLAG_DISABLE_DBUS_LOG (0x20)
#ifndef MMS_ENGINE_CONFIG_FILE
/* Default config file */
# define MMS_ENGINE_CONFIG_FILE "/etc/mms-engine.conf"
#endif /* MMS_ENGINE_CONFIG_FILE */
#define MMS_ENGINE_DBUS_METHODS(m) \
m(CANCEL,cancel,"cancel") \
m(RECEIVE_MESSAGE,receive_message,"receive-message") \
m(SEND_READ_REPORT,send_read_report,"send-read-report") \
m(SEND_MESSAGE,send_message,"send-message") \
m(SEND_MESSAGE_FD,send_message_fd,"send-message-fd") \
m(PUSH,push,"push") \
m(PUSH_NOTIFY,push_notify,"push-notify") \
m(SET_LOG_LEVEL,set_log_level,"set-log-level") \
m(SET_LOG_TYPE,set_log_type,"set-log-type") \
m(GET_VERSION,get_version,"get-version") \
m(MIGRATE_SETTINGS,migrate_settings,"migrate-settings") \
m(EXIT,exit,"exit")
typedef enum mms_engine_action {
/* Action ids must be non-zero, shift those by one */
MMS_ENGINE_ACTION_NONE = 0,
#define MMS_ENGINE_ACTION_(ID,id,name) MMS_ENGINE_ACTION_##ID,
MMS_ENGINE_DBUS_METHODS(MMS_ENGINE_ACTION_)
#undef MMS_ENGINE_ACTION_
} MMS_ENGINE_ACTION;
typedef struct mms_engine MMSEngine;
typedef struct engine_dbus_config {
GBusType type;
DAPolicy* engine_access;
DAPolicy* tx_list_access;
DAPolicy* tx_access;
} MMSEngineDbusConfig;
MMSEngine*
mms_engine_new(
const MMSConfig* config,
const MMSSettingsSimData* defaults,
const MMSEngineDbusConfig* dbus_config,
MMSLogModule* log_modules[], /* NULL terminated */
unsigned int flags);
MMSEngine*
mms_engine_ref(
MMSEngine* engine);
void
mms_engine_unref(
MMSEngine* engine);
void
mms_engine_run(
MMSEngine* engine,
GMainLoop* loop);
void
mms_engine_stop(
MMSEngine* engine);
gboolean
mms_engine_register(
MMSEngine* engine,
GDBusConnection* bus,
GError** error);
void
mms_engine_unregister(
MMSEngine* engine);
#endif /* JOLLA_MMS_ENGINE_H */