Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mms-engine
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
mer-core
mms-engine
Commits
99d617c3
Commit
99d617c3
authored
Mar 14, 2016
by
Slava Monich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[mms-engine] Added transfer progress API. Contributes to JB#34534
parent
e63539b9
Changes
49
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
49 changed files
with
1818 additions
and
135 deletions
+1818
-135
mms-engine/Makefile
mms-engine/Makefile
+30
-2
mms-engine/mms-engine.pro
mms-engine/mms-engine.pro
+4
-0
mms-engine/mms_engine.c
mms-engine/mms_engine.c
+4
-1
mms-lib/Makefile
mms-lib/Makefile
+1
-0
mms-lib/include/mms_dispatcher.h
mms-lib/include/mms_dispatcher.h
+4
-2
mms-lib/include/mms_lib_log.h
mms-lib/include/mms_lib_log.h
+2
-1
mms-lib/include/mms_lib_types.h
mms-lib/include/mms_lib_types.h
+1
-0
mms-lib/include/mms_transfer_list.h
mms-lib/include/mms_transfer_list.h
+98
-0
mms-lib/mms-lib.pro
mms-lib/mms-lib.pro
+3
-1
mms-lib/src/mms_dispatcher.c
mms-lib/src/mms_dispatcher.c
+13
-7
mms-lib/src/mms_task.h
mms-lib/src/mms_task.h
+19
-1
mms-lib/src/mms_task_ack.c
mms-lib/src/mms_task_ack.c
+4
-2
mms-lib/src/mms_task_decode.c
mms-lib/src/mms_task_decode.c
+10
-4
mms-lib/src/mms_task_encode.c
mms-lib/src/mms_task_encode.c
+26
-20
mms-lib/src/mms_task_http.c
mms-lib/src/mms_task_http.c
+129
-47
mms-lib/src/mms_task_http.h
mms-lib/src/mms_task_http.h
+4
-1
mms-lib/src/mms_task_notification.c
mms-lib/src/mms_task_notification.c
+11
-5
mms-lib/src/mms_task_notifyresp.c
mms-lib/src/mms_task_notifyresp.c
+5
-3
mms-lib/src/mms_task_read.c
mms-lib/src/mms_task_read.c
+3
-1
mms-lib/src/mms_task_retrieve.c
mms-lib/src/mms_task_retrieve.c
+8
-5
mms-lib/src/mms_task_send.c
mms-lib/src/mms_task_send.c
+7
-5
mms-lib/src/mms_transfer_list.c
mms-lib/src/mms_transfer_list.c
+130
-0
mms-lib/test/common/test_transfer_list.c
mms-lib/test/common/test_transfer_list.c
+105
-0
mms-lib/test/common/test_transfer_list.h
mms-lib/test/common/test_transfer_list.h
+24
-0
mms-lib/test/test_delivery_ind/Makefile
mms-lib/test/test_delivery_ind/Makefile
+2
-1
mms-lib/test/test_delivery_ind/test_delivery_ind.c
mms-lib/test/test_delivery_ind/test_delivery_ind.c
+3
-3
mms-lib/test/test_read_ind/Makefile
mms-lib/test/test_read_ind/Makefile
+2
-1
mms-lib/test/test_read_ind/test_read_ind.c
mms-lib/test/test_read_ind/test_read_ind.c
+3
-3
mms-lib/test/test_read_report/Makefile
mms-lib/test/test_read_report/Makefile
+1
-1
mms-lib/test/test_read_report/test_read_report.c
mms-lib/test/test_read_report/test_read_report.c
+1
-1
mms-lib/test/test_retrieve/Makefile
mms-lib/test/test_retrieve/Makefile
+1
-1
mms-lib/test/test_retrieve/test_retrieve.c
mms-lib/test/test_retrieve/test_retrieve.c
+5
-1
mms-lib/test/test_retrieve_cancel/Makefile
mms-lib/test/test_retrieve_cancel/Makefile
+1
-1
mms-lib/test/test_retrieve_cancel/test_retrieve_cancel.c
mms-lib/test/test_retrieve_cancel/test_retrieve_cancel.c
+3
-2
mms-lib/test/test_retrieve_no_proxy/Makefile
mms-lib/test/test_retrieve_no_proxy/Makefile
+1
-1
mms-lib/test/test_retrieve_no_proxy/test_retrieve_no_proxy.c
mms-lib/test/test_retrieve_no_proxy/test_retrieve_no_proxy.c
+3
-3
mms-lib/test/test_retrieve_order/Makefile
mms-lib/test/test_retrieve_order/Makefile
+1
-1
mms-lib/test/test_retrieve_order/test_retrieve_order.c
mms-lib/test/test_retrieve_order/test_retrieve_order.c
+1
-1
mms-lib/test/test_send/Makefile
mms-lib/test/test_send/Makefile
+1
-1
mms-lib/test/test_send/test_send.c
mms-lib/test/test_send/test_send.c
+5
-5
mms-transfer-list-dbus/Makefile
mms-transfer-list-dbus/Makefile
+126
-0
mms-transfer-list-dbus/include/mms_transfer_list_dbus.h
mms-transfer-list-dbus/include/mms_transfer_list_dbus.h
+33
-0
mms-transfer-list-dbus/mms-transfer-list-dbus.pro
mms-transfer-list-dbus/mms-transfer-list-dbus.pro
+47
-0
mms-transfer-list-dbus/spec/org.nemomobile.MmsEngine.TransferList.xml
...-list-dbus/spec/org.nemomobile.MmsEngine.TransferList.xml
+71
-0
mms-transfer-list-dbus/src/mms_transfer_dbus.c
mms-transfer-list-dbus/src/mms_transfer_dbus.c
+435
-0
mms-transfer-list-dbus/src/mms_transfer_dbus.h
mms-transfer-list-dbus/src/mms_transfer_dbus.h
+74
-0
mms-transfer-list-dbus/src/mms_transfer_list_dbus.c
mms-transfer-list-dbus/src/mms_transfer_list_dbus.c
+321
-0
mms-transfer-list-dbus/src/mms_transfer_list_dbus_log.h
mms-transfer-list-dbus/src/mms_transfer_list_dbus_log.h
+31
-0
mms.pro
mms.pro
+1
-0
No files found.
mms-engine/Makefile
View file @
99d617c3
...
...
@@ -4,6 +4,7 @@
.PHONY
:
mms_lib_debug_lib mms_lib_release_lib
.PHONY
:
mms_connman_debug_lib mms_connman_release_lib
.PHONY
:
mms_handler_debug_lib mms_handler_release_lib
.PHONY
:
mms_transfers_debug_lib mms_transfers_release_lib
.PHONY
:
mms_settings_debug_lib mms_settings_release_lib
#
...
...
@@ -84,6 +85,16 @@ MMS_HANDLER_BUILD_DIR = $(MMS_HANDLER_DIR)/build
MMS_HANDLER_DEBUG_LIB
=
$(MMS_HANDLER_BUILD_DIR)
/debug/
$(MMS_HANDLER_LIB)
MMS_HANDLER_RELEASE_LIB
=
$(MMS_HANDLER_BUILD_DIR)
/release/
$(MMS_HANDLER_LIB)
#
# mms-transfer-list-dbus
#
MMS_TRANSFERS_LIB
=
libmms-transfer-list-dbus.a
MMS_TRANSFERS_DIR
=
../mms-transfer-list-dbus
MMS_TRANSFERS_BUILD_DIR
=
$(MMS_TRANSFERS_DIR)
/build
MMS_TRANSFERS_DEBUG_LIB
=
$(MMS_TRANSFERS_BUILD_DIR)
/debug/
$(MMS_TRANSFERS_LIB)
MMS_TRANSFERS_RELEASE_LIB
=
$(MMS_TRANSFERS_BUILD_DIR)
/release/
$(MMS_TRANSFERS_LIB)
#
# mms-settings-dconf
#
...
...
@@ -108,8 +119,8 @@ WARN = -Wall
BASE_FLAGS
=
-fPIC
$(CFLAGS)
FULL_CFLAGS
=
$(BASE_FLAGS)
-I
.
-I
$(GEN_DIR)
-I
$(MMS_LIB_DIR)
/include
\
-I
$(MMS_CONNMAN_DIR)
/include
-I
$(MMS_HANDLER_DIR)
/include
\
-I
$(MMS_SETTINGS_DIR)
/include
-
MMD
-MP
\
$(
shell
pkg-config
--cflags
$(PKGS)
)
-I
$(MMS_SETTINGS_DIR)
/include
-
I
$(MMS_TRANSFERS_DIR)
/include
\
-MMD
-MP
$(
shell
pkg-config
--cflags
$(PKGS)
)
ifndef
KEEP_SYMBOLS
KEEP_SYMBOLS
=
0
...
...
@@ -137,12 +148,14 @@ LIBS = $(shell pkg-config --libs $(LIB_PKGS)) -lmagic -ljpeg $(RESIZE_LIBS)
DEBUG_LIBS
=
\
$(MMS_CONNMAN_DEBUG_LIB)
\
$(MMS_HANDLER_DEBUG_LIB)
\
$(MMS_TRANSFERS_DEBUG_LIB)
\
$(MMS_SETTINGS_DEBUG_LIB)
\
$(MMS_LIB_DEBUG_LIB)
\
$(LIBS)
RELEASE_LIBS
=
\
$(MMS_CONNMAN_RELEASE_LIB)
\
$(MMS_HANDLER_RELEASE_LIB)
\
$(MMS_TRANSFERS_RELEASE_LIB)
\
$(MMS_SETTINGS_RELEASE_LIB)
\
$(MMS_LIB_RELEASE_LIB)
\
$(LIBS)
...
...
@@ -168,21 +181,25 @@ DEBUG_DEPS = \
mms_lib_debug_lib
\
mms_connman_debug_lib
\
mms_handler_debug_lib
\
mms_transfers_debug_lib
\
mms_settings_debug_lib
RELEASE_DEPS
=
\
mms_lib_release_lib
\
mms_connman_release_lib
\
mms_handler_release_lib
\
mms_transfers_release_lib
\
mms_settings_release_lib
DEBUG_EXE_DEPS
=
\
$(MMS_LIB_DEBUG_LIB)
\
$(MMS_CONNMAN_DEBUG_LIB)
\
$(MMS_HANDLER_DEBUG_LIB)
\
$(MMS_TRANSFERS_DEBUG_LIB)
\
$(MMS_SETTINGS_DEBUG_LIB)
RELEASE_EXE_DEPS
=
\
$(MMS_LIB_RELEASE_LIB)
\
$(MMS_CONNMAN_RELEASE_LIB)
\
$(MMS_HANDLER_RELEASE_LIB)
\
$(MMS_TRANSFERS_RELEASE_LIB)
\
$(MMS_SETTINGS_RELEASE_LIB)
DEPS
=
$(DEBUG_OBJS:%.o=%.d)
$(RELEASE_OBJS:%.o=%.d)
ifneq
($(MAKECMDGOALS),clean)
...
...
@@ -214,6 +231,7 @@ cleaner: clean
make
-C
$(MMS_LIB_DIR)
$(SUBMAKE_OPTS)
clean
make
-C
$(MMS_CONNMAN_DIR)
$(SUBMAKE_OPTS)
clean
make
-C
$(MMS_HANDLER_DIR)
$(SUBMAKE_OPTS)
clean
make
-C
$(MMS_TRANSFERS_DIR)
$(SUBMAKE_OPTS)
clean
make
-C
$(MMS_SETTINGS_DIR)
$(SUBMAKE_OPTS)
clean
$(GEN_DIR)
:
...
...
@@ -243,6 +261,12 @@ mms_handler_debug_lib:
mms_handler_release_lib
:
make
-C
$(MMS_HANDLER_DIR)
$(SUBMAKE_OPTS)
release
mms_transfers_debug_lib
:
make
-C
$(MMS_TRANSFERS_DIR)
$(SUBMAKE_OPTS)
debug
mms_transfers_release_lib
:
make
-C
$(MMS_TRANSFERS_DIR)
$(SUBMAKE_OPTS)
release
mms_settings_debug_lib
:
make
-C
$(MMS_SETTINGS_DIR)
$(SUBMAKE_OPTS)
debug
...
...
@@ -261,6 +285,10 @@ $(MMS_HANDLER_DEBUG_LIB): mms_handler_debug_lib
$(MMS_HANDLER_RELEASE_LIB)
:
mms_handler_release_lib
$(MMS_TRANSFERS_DEBUG_LIB)
:
mms_transfers_debug_lib
$(MMS_TRANSFERS_RELEASE_LIB)
:
mms_transfers_release_lib
$(MMS_SETTINGS_DEBUG_LIB)
:
mms_settings_debug_lib
$(MMS_SETTINGS_RELEASE_LIB)
:
mms_settings_release_lib
...
...
mms-engine/mms-engine.pro
View file @
99d617c3
...
...
@@ -23,12 +23,14 @@ DBUS_INTERFACE_DIR = $$_PRO_FILE_PWD_
MMS_LIB_DIR
=
$$
_PRO_FILE_PWD_
/../
mms
-
lib
MMS_HANDLER_DIR
=
$$
_PRO_FILE_PWD_
/../
mms
-
handler
-
dbus
MMS_SETTINGS_DIR
=
$$
_PRO_FILE_PWD_
/../
mms
-
settings
-
dconf
MMS_TRANSFER_LIST_DIR
=
$$
_PRO_FILE_PWD_
/../
mms
-
transfer
-
list
-
dbus
MMS_CONNMAN_DIR
=
$$
_PRO_FILE_PWD_
/../
$$
MMS_CONNMAN
INCLUDEPATH
+=
$$
MMS_LIB_DIR
/
include
INCLUDEPATH
+=
$$
MMS_HANDLER_DIR
/
include
INCLUDEPATH
+=
$$
MMS_SETTINGS_DIR
/
include
INCLUDEPATH
+=
$$
MMS_CONNMAN_DIR
/
include
INCLUDEPATH
+=
$$
MMS_TRANSFER_LIST_DIR
/
include
SOURCES
+=
\
main
.
c
\
...
...
@@ -47,12 +49,14 @@ CONFIG(debug, debug|release) {
DESTDIR
=
$$
_PRO_FILE_PWD_
/
build
/
debug
LIBS
+=
$$
MMS_CONNMAN_DIR
/
build
/
debug
/
lib
$$
{
MMS_CONNMAN
}.
a
LIBS
+=
$$
MMS_HANDLER_DIR
/
build
/
debug
/
libmms
-
handler
-
dbus
.
a
LIBS
+=
$$
MMS_TRANSFER_LIST_DIR
/
build
/
debug
/
libmms
-
transfer
-
list
-
dbus
.
a
LIBS
+=
$$
MMS_LIB_DIR
/
build
/
debug
/
libmms
-
lib
.
a
LIBS
+=
$$
MMS_SETTINGS_DIR
/
build
/
debug
/
libmms
-
settings
-
dconf
.
a
}
else
{
DESTDIR
=
$$
_PRO_FILE_PWD_
/
build
/
release
LIBS
+=
$$
MMS_CONNMAN_DIR
/
build
/
release
/
lib
$$
{
MMS_CONNMAN
}.
a
LIBS
+=
$$
MMS_HANDLER_DIR
/
build
/
release
/
libmms
-
handler
-
dbus
.
a
LIBS
+=
$$
MMS_TRANSFER_LIST_DIR
/
build
/
release
/
libmms
-
transfer
-
list
-
dbus
.
a
LIBS
+=
$$
MMS_LIB_DIR
/
build
/
release
/
libmms
-
lib
.
a
LIBS
+=
$$
MMS_SETTINGS_DIR
/
build
/
release
/
libmms
-
settings
-
dconf
.
a
}
...
...
mms-engine/mms_engine.c
View file @
99d617c3
...
...
@@ -19,6 +19,7 @@
#include "mms_lib_util.h"
#include "mms_handler_dbus.h"
#include "mms_settings_dconf.h"
#include "mms_transfer_list_dbus.h"
#include "mms_log.h"
#include <gutil_misc.h>
...
...
@@ -472,6 +473,7 @@ mms_engine_new(
MMSEngine
*
mms
=
g_object_new
(
MMS_TYPE_ENGINE
,
NULL
);
MMSHandler
*
handler
=
mms_handler_dbus_new
();
MMSSettings
*
settings
=
mms_settings_dconf_new
(
config
);
MMSTransferList
*
txlist
=
mms_transfer_list_dbus_new
();
if
(
flags
&
MMS_ENGINE_FLAG_OVERRIDE_USER_AGENT
)
{
settings
->
flags
|=
MMS_SETTINGS_FLAG_OVERRIDE_USER_AGENT
;
...
...
@@ -494,8 +496,9 @@ mms_engine_new(
settings
->
sim_defaults
.
data
.
max_pixels
=
override
->
max_pixels
;
}
mms
->
dispatcher
=
mms_dispatcher_new
(
settings
,
cm
,
handler
);
mms
->
dispatcher
=
mms_dispatcher_new
(
settings
,
cm
,
handler
,
txlist
);
mms_handler_unref
(
handler
);
mms_transfer_list_unref
(
txlist
);
mms_dispatcher_set_delegate
(
mms
->
dispatcher
,
&
mms
->
dispatcher_delegate
);
...
...
mms-lib/Makefile
View file @
99d617c3
...
...
@@ -49,6 +49,7 @@ SRC = \
mms_task_read.c
\
mms_task_retrieve.c
\
mms_task_send.c
\
mms_transfer_list.c
\
mms_util.c
ifeq
($(MMS_RESIZE),Qt)
...
...
mms-lib/include/mms_dispatcher.h
View file @
99d617c3
/*
* Copyright (C) 2013-2014 Jolla Ltd.
* Copyright (C) 2013-2016 Jolla Ltd.
* Contact: Slava Monich <slava.monich@jolla.com>
*
* 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
...
...
@@ -30,7 +31,8 @@ MMSDispatcher*
mms_dispatcher_new
(
MMSSettings
*
settings
,
MMSConnMan
*
cm
,
MMSHandler
*
handler
);
MMSHandler
*
handler
,
MMSTransferList
*
transfers
);
MMSDispatcher
*
mms_dispatcher_ref
(
...
...
mms-lib/include/mms_lib_log.h
View file @
99d617c3
/*
* Copyright (C) 2013-201
5
Jolla Ltd.
* Copyright (C) 2013-201
6
Jolla Ltd.
* Contact: Slava Monich <slava.monich@jolla.com>
*
* This program is free software; you can redistribute it and/or modify
...
...
@@ -21,6 +21,7 @@
#define MMS_LIB_LOG_MODULES(log) \
log(mms_dispatcher_log)\
log(mms_settings_log)\
log(mms_transfer_list_log)\
log(mms_handler_log)\
log(mms_message_log)\
log(mms_attachment_log)\
...
...
mms-lib/include/mms_lib_types.h
View file @
99d617c3
...
...
@@ -60,6 +60,7 @@ typedef struct mms_handler MMSHandler;
typedef
struct
mms_connman
MMSConnMan
;
typedef
struct
mms_dispatcher
MMSDispatcher
;
typedef
struct
mms_connection
MMSConnection
;
typedef
struct
mms_transfer_list
MMSTransferList
;
typedef
struct
mms_message
MMSPdu
;
typedef
struct
_mms_message
MMSMessage
;
typedef
struct
_mms_attachment
MMSAttachment
;
...
...
mms-lib/include/mms_transfer_list.h
0 → 100644
View file @
99d617c3
/*
* Copyright (C) 2016 Jolla Ltd.
* Contact: Slava Monich <slava.monich@jolla.com>
*
* 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_TRANSFER_LIST_H
#define JOLLA_MMS_TRANSFER_LIST_H
#include "mms_message.h"
/* Instance */
struct
mms_transfer_list
{
GObject
object
;
};
/* Class */
typedef
struct
mms_transfer_list_class
{
GObjectClass
parent
;
void
(
*
fn_transfer_started
)(
MMSTransferList
*
list
,
/* Instance */
char
*
id
,
/* Message ID */
char
*
type
);
/* Transfer type */
void
(
*
fn_transfer_finished
)(
MMSTransferList
*
list
,
/* Instance */
char
*
id
,
/* Message ID */
char
*
type
);
/* Transfer type */
void
(
*
fn_send_progress
)(
MMSTransferList
*
list
,
/* Instance */
char
*
id
,
/* Message ID */
char
*
type
,
/* Transfer type */
guint
bytes_sent
,
/* Bytes sent so far */
guint
bytes_total
);
/* Total bytes to send */
void
(
*
fn_receive_progress
)(
MMSTransferList
*
list
,
/* Instance */
char
*
id
,
/* Message ID */
char
*
type
,
/* Transfer type */
guint
bytes_received
,
/* Bytes received so far */
guint
bytes_total
);
/* Total bytes to receive*/
}
MMSTransferListClass
;
GType
mms_transfer_list_get_type
(
void
);
#define MMS_TYPE_TRANSFER_LIST (mms_transfer_list_get_type())
MMSTransferList
*
mms_transfer_list_ref
(
MMSTransferList
*
list
);
void
mms_transfer_list_unref
(
MMSTransferList
*
list
);
void
mms_transfer_list_transfer_started
(
MMSTransferList
*
list
,
/* Instance */
char
*
id
,
/* Message ID */
char
*
type
);
/* Transfer type */
void
mms_transfer_list_transfer_finished
(
MMSTransferList
*
list
,
/* Instance */
char
*
id
,
/* Message ID */
char
*
type
);
/* Transfer type */
void
mms_transfer_list_transfer_send_progress
(
MMSTransferList
*
list
,
/* Instance */
char
*
id
,
/* Message ID */
char
*
type
,
/* Transfer type */
guint
bytes_sent
,
/* Bytes sent so far */
guint
bytes_total
);
/* Total bytes to send */
void
mms_transfer_list_transfer_receive_progress
(
MMSTransferList
*
list
,
/* Instance */
char
*
id
,
/* Message ID */
char
*
type
,
/* Transfer type */
guint
bytes_received
,
/* Bytes received so far */
guint
bytes_total
);
/* Total bytes to receive*/
#endif
/* JOLLA_MMS_TRANSFER_LIST_H */
/*
* Local Variables:
* mode: C
* c-basic-offset: 4
* indent-tabs-mode: nil
* End:
*/
mms-lib/mms-lib.pro
View file @
99d617c3
...
...
@@ -50,6 +50,7 @@ SOURCES += \
src
/
mms_task_read
.
c
\
src
/
mms_task_retrieve
.
c
\
src
/
mms_task_send
.
c
\
src
/
mms_transfer_list
.
c
\
src
/
mms_util
.
c
HEADERS
+=
\
...
...
@@ -72,4 +73,5 @@ HEADERS += \
include
/
mms_lib_util
.
h
\
include
/
mms_log
.
h
\
include
/
mms_message
.
h
\
include
/
mms_settings
.
h
include
/
mms_settings
.
h
\
include
/
mms_transfer_list
.
h
mms-lib/src/mms_dispatcher.c
View file @
99d617c3
...
...
@@ -18,6 +18,7 @@
#include "mms_settings.h"
#include "mms_connection.h"
#include "mms_connman.h"
#include "mms_transfer_list.h"
#include "mms_file_util.h"
#include "mms_codec.h"
#include "mms_util.h"
...
...
@@ -39,6 +40,7 @@ struct mms_dispatcher {
MMSHandler
*
handler
;
MMSConnMan
*
cm
;
MMSConnection
*
connection
;
MMSTransferList
*
transfers
;
MMSDispatcherDelegate
*
delegate
;
GQueue
*
tasks
;
guint
next_run_id
;
...
...
@@ -570,7 +572,7 @@ mms_dispatcher_handle_push(
{
return
mms_dispatcher_queue_and_unref_task
(
disp
,
mms_task_notification_new
(
disp
->
settings
,
disp
->
handler
,
imsi
,
push
,
error
));
disp
->
transfers
,
imsi
,
push
,
error
));
}
/**
...
...
@@ -593,8 +595,9 @@ mms_dispatcher_receive_message(
const
MMSConfig
*
config
=
disp
->
settings
->
config
;
ok
=
mms_dispatcher_queue_and_unref_task
(
disp
,
mms_task_retrieve_new
(
disp
->
settings
,
disp
->
handler
,
id
,
imsi
,
pdu
,
automatic
?
MMS_CONNECTION_TYPE_AUTO
:
MMS_CONNECTION_TYPE_USER
,
error
));
disp
->
transfers
,
id
,
imsi
,
pdu
,
automatic
?
MMS_CONNECTION_TYPE_AUTO
:
MMS_CONNECTION_TYPE_USER
,
error
));
if
(
config
->
keep_temp_files
)
{
char
*
dir
=
mms_message_dir
(
config
,
id
);
mms_write_bytes
(
dir
,
MMS_NOTIFICATION_IND_FILE
,
bytes
,
NULL
);
...
...
@@ -624,7 +627,7 @@ mms_dispatcher_send_read_report(
GError
**
error
)
{
return
mms_dispatcher_queue_and_unref_task
(
disp
,
mms_task_read_new
(
disp
->
settings
,
disp
->
handler
,
mms_task_read_new
(
disp
->
settings
,
disp
->
handler
,
disp
->
transfers
,
id
,
imsi
,
message_id
,
to
,
status
,
error
));
}
...
...
@@ -652,8 +655,8 @@ mms_dispatcher_send_message(
}
if
(
imsi
)
{
if
(
mms_dispatcher_queue_and_unref_task
(
disp
,
mms_task_encode_new
(
disp
->
settings
,
disp
->
handler
,
id
,
imsi
,
to
,
cc
,
bcc
,
subject
,
flags
,
parts
,
nparts
,
error
)))
{
mms_task_encode_new
(
disp
->
settings
,
disp
->
handler
,
disp
->
transfers
,
id
,
imsi
,
to
,
cc
,
bcc
,
subject
,
flags
,
parts
,
nparts
,
error
)))
{
return
default_imsi
?
default_imsi
:
g_strdup
(
imsi
);
}
}
else
{
...
...
@@ -754,7 +757,8 @@ MMSDispatcher*
mms_dispatcher_new
(
MMSSettings
*
settings
,
MMSConnMan
*
cm
,
MMSHandler
*
handler
)
MMSHandler
*
handler
,
MMSTransferList
*
transfers
)
{
MMSDispatcher
*
disp
=
g_new0
(
MMSDispatcher
,
1
);
disp
->
ref_count
=
1
;
...
...
@@ -762,6 +766,7 @@ mms_dispatcher_new(
disp
->
tasks
=
g_queue_new
();
disp
->
handler
=
mms_handler_ref
(
handler
);
disp
->
cm
=
mms_connman_ref
(
cm
);
disp
->
transfers
=
mms_transfer_list_ref
(
transfers
);
disp
->
task_delegate
.
fn_task_queue
=
mms_dispatcher_delegate_task_queue
;
disp
->
task_delegate
.
fn_task_state_changed
=
...
...
@@ -794,6 +799,7 @@ mms_dispatcher_finalize(
mms_task_unref
(
task
);
}
g_queue_free
(
disp
->
tasks
);
mms_transfer_list_unref
(
disp
->
transfers
);
mms_settings_unref
(
disp
->
settings
);
mms_handler_unref
(
disp
->
handler
);
mms_connman_unref
(
disp
->
cm
);
...
...
mms-lib/src/mms_task.h
View file @
99d617c3
...
...
@@ -37,6 +37,16 @@ typedef enum _MMS_TASK_STATE {
MMS_TASK_STATE_COUNT
/* Number of valid states */
}
MMS_TASK_STATE
;
/*
* Transfer types which double as task names. These are part of the D-Bus API,
* don't change them just because you don't like them
*/
#define MMS_TRANSFER_TYPE_ACK "Ack"
#define MMS_TRANSFER_TYPE_NOTIFY_RESP "NotifyResp"
#define MMS_TRANSFER_TYPE_READ_REPORT "ReadReport"
#define MMS_TRANSFER_TYPE_RETRIEVE "Retrieve"
#define MMS_TRANSFER_TYPE_SEND "Send"
/* Task priority */
typedef
enum
_MMS_TASK_PRIORITY
{
MMS_TASK_PRIORITY_NORMAL
,
/* Default priority */
...
...
@@ -176,6 +186,7 @@ MMSTask*
mms_task_notification_new
(
MMSSettings
*
settings
,
MMSHandler
*
handler
,
MMSTransferList
*
transfers
,
const
char
*
imsi
,
GBytes
*
bytes
,
GError
**
error
);
...
...
@@ -184,6 +195,7 @@ MMSTask*
mms_task_retrieve_new
(
MMSSettings
*
settings
,
MMSHandler
*
handler
,
MMSTransferList
*
transfers
,
const
char
*
id
,
const
char
*
imsi
,
const
MMSPdu
*
pdu
,
...
...
@@ -193,24 +205,28 @@ mms_task_retrieve_new(
MMSTask
*
mms_task_decode_new
(
MMSTask
*
parent
,
MMSTransferList
*
transfers
,
const
char
*
transaction_id
,
const
char
*
file
);
MMSTask
*
mms_task_notifyresp_new
(
MMSTask
*
parent
,
MMSTransferList
*
transfers
,
const
char
*
transaction_id
,
MMSNotifyStatus
status
);
MMSTask
*
mms_task_ack_new
(
MMSTask
*
parent
,
MMSTransferList
*
transfers
,
const
char
*
transaction_id
);
MMSTask
*
mms_task_read_new
(
MMSSettings
*
settings
,
MMSHandler
*
handler
,
MMSTransferList
*
transfers
,
const
char
*
id
,
const
char
*
imsi
,
const
char
*
message_id
,
...
...
@@ -228,6 +244,7 @@ MMSTask*
mms_task_encode_new
(
MMSSettings
*
settings
,
MMSHandler
*
handler
,
MMSTransferList
*
transfers
,
const
char
*
id
,
const
char
*
imsi
,
const
char
*
to
,
...
...
@@ -241,7 +258,8 @@ mms_task_encode_new(
MMSTask
*
mms_task_send_new
(
MMSTask
*
parent
);
MMSTask
*
parent
,
MMSTransferList
*
transfers
);
#endif
/* JOLLA_MMS_TASK_H */
...
...
mms-lib/src/mms_task_ack.c
View file @
99d617c3
/*
* Copyright (C) 2013-2016 Jolla Ltd.
* Contact: Slava Monich <slava.monich@jolla.com>
*
* 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
...
...
@@ -49,14 +50,15 @@ mms_task_ack_encode(
MMSTask
*
mms_task_ack_new
(
MMSTask
*
parent
,
MMSTransferList
*
transfers
,
const
char
*
tx_id
)
{
MMSTask
*
task
=
NULL
;
const
char
*
file
=
mms_task_ack_encode
(
task_config
(
parent
),
mms_task_sim_settings
(
parent
),
parent
->
id
,
tx_id
);
if
(
file
)
{
task
=
mms_task_http_alloc_with_parent
(
0
,
parent
,
"Ack"
,
NULL
,
NULL
,
file
);
task
=
mms_task_http_alloc_with_parent
(
0
,
parent
,
transfers
,
MMS_TRANSFER_TYPE_ACK
,
NULL
,
NULL
,
file
);
task
->
priority
=
MMS_TASK_PRIORITY_POST_PROCESS
;
}
return
task
;
...
...
mms-lib/src/mms_task_decode.c
View file @
99d617c3
/*
* Copyright (C) 2013-201
5
Jolla Ltd.
* Copyright (C) 2013-201
6
Jolla Ltd.
* Contact: Slava Monich <slava.monich@jolla.com>
*
* This program is free software; you can redistribute it and/or modify
...
...
@@ -19,6 +19,7 @@
#include "mms_handler.h"
#include "mms_message.h"
#include "mms_file_util.h"
#include "mms_transfer_list.h"
/* Logging */
#define MMS_LOG_MODULE_NAME mms_task_decode_log
...
...
@@ -29,12 +30,13 @@ MMS_LOG_MODULE_DEFINE2("mms-task-decode", MMS_TASK_LOG);
typedef
MMSTaskClass
MMSTaskDecodeClass
;
typedef
struct
mms_task_decode
{
MMSTask
task
;
MMSTransferList
*
transfers
;
GMappedFile
*
map
;
char
*
transaction_id
;
char
*
file
;
}
MMSTaskDecode
;
G_DEFINE_TYPE
(
MMSTaskDecode
,
mms_task_decode
,
MMS_TYPE_TASK
)
;
G_DEFINE_TYPE
(
MMSTaskDecode
,
mms_task_decode
,
MMS_TYPE_TASK
)
#define MMS_TYPE_TASK_DECODE (mms_task_decode_get_type())
#define MMS_TASK_DECODE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),\
MMS_TYPE_TASK_DECODE, MMSTaskDecode))
...
...
@@ -268,7 +270,8 @@ mms_task_decode_process_pdu(
if
(
msg
)
{
/* Successfully received and decoded MMS message */
mms_task_queue_and_unref
(
task
->
delegate
,
mms_task_ack_new
(
task
,
dec
->
transaction_id
));
mms_task_ack_new
(
task
,
dec
->
transfers
,
dec
->
transaction_id
));
mms_task_queue_and_unref
(
task
->
delegate
,
mms_task_publish_new
(
task
->
settings
,
task
->
handler
,
msg
));
...
...
@@ -293,7 +296,7 @@ mms_task_decode_process_pdu(
/* Tell MMS server that we didn't understand this PDU */
mms_task_queue_and_unref
(
task
->
delegate
,
mms_task_notifyresp_new
(
task
,
dec
->
transaction_id
,
mms_task_notifyresp_new
(
task
,
dec
->
trans
fers
,
dec
->
trans
action_id
,
MMS_MESSAGE_NOTIFY_STATUS_UNRECOGNISED
));
mms_handler_message_receive_state_changed
(
task
->
handler
,
task
->
id
,
MMS_RECEIVE_STATE_DECODING_ERROR
);
...
...
@@ -319,6 +322,7 @@ mms_task_decode_finalize(
if
(
!
task_config
(
&
dec
->
task
)
->
keep_temp_files
)
{
mms_remove_file_and_dir
(
dec
->
file
);
}
mms_transfer_list_unref
(
dec
->
transfers
);
g_mapped_file_unref
(
dec
->
map
);
g_free
(
dec
->
transaction_id
);
g_free
(
dec
->
file
);
...
...
@@ -345,6 +349,7 @@ mms_task_decode_init(
MMSTask
*
mms_task_decode_new
(
MMSTask
*
parent
,
MMSTransferList
*
transfers
,
const
char
*
transaction_id
,
const
char
*
file
)
{
...
...
@@ -355,6 +360,7 @@ mms_task_decode_new(
GError
*
error
=
NULL
;
dec
->
map
=
g_mapped_file_new
(
file
,
FALSE
,
&
error
);
if
(
dec
->
map
)
{
dec
->
transfers
=
mms_transfer_list_ref
(
transfers
);
dec
->
transaction_id
=
g_strdup
(
transaction_id
);
dec
->
file
=
g_strdup
(
file
);
dec
->
task
.
priority
=
MMS_TASK_PRIORITY_POST_PROCESS
;
...
...
mms-lib/src/mms_task_encode.c
View file @
99d617c3
/*
* Copyright (C) 2013-201
5
Jolla Ltd.
* Copyright (C) 2013-201
6
Jolla Ltd.
* Contact: Slava Monich <slava.monich@jolla.com>
*
* This program is free software; you can redistribute it and/or modify
...
...
@@ -19,6 +19,7 @@
#include "mms_settings.h"
#include "mms_handler.h"
#include "mms_file_util.h"
#include "mms_transfer_list.h"
#include "mms_util.h"
#include "mms_codec.h"
...
...
@@ -43,6 +44,7 @@ typedef struct mms_task_encode {
MMSAttachment
**
parts
;
int
nparts
;
MMSEncodeJob
*
active_job
;
MMSTransferList
*
transfers
;
}
MMSTaskEncode
;
G_DEFINE_TYPE
(
MMSTaskEncode
,
mms_task_encode
,
MMS_TYPE_TASK
);
...
...
@@ -322,7 +324,8 @@ mms_task_encode_job_done(
MMS_VERBOSE_
(
"Encoding completion state %d"
,
job
->
state
);
enc
->
active_job
=
NULL
;
if
(
job
->
state
==
MMS_ENCODE_STATE_DONE
)
{
mms_task_queue_and_unref
(
task
->
delegate
,
mms_task_send_new
(
task
));
mms_task_queue_and_unref
(
task
->
delegate
,
mms_task_send_new
(
task
,
enc
->
transfers
));
}
else
{
mms_handler_message_send_state_changed
(
task
->
handler
,
task
->
id
,
(
job
->
state
==
MMS_ENCODE_STATE_TOO_BIG
)
?
...
...
@@ -376,24 +379,6 @@ mms_task_encode_cancel(
MMS_TASK_CLASS
(
mms_task_encode_parent_class
)
->
fn_cancel
(
task
);
}
static
void
mms_task_encode_finalize
(
GObject
*
object
)
{
MMSTaskEncode
*
enc
=
MMS_TASK_ENCODE
(
object
);
if
(
enc
->
parts
)
{
int
i
;
for
(
i
=
0
;
i
<
enc
->
nparts
;
i
++
)
mms_attachment_unref
(
enc
->
parts
[
i
]);
g_free
(
enc
->
parts
);
}
g_free
(
enc
->
to
);
g_free
(
enc
->
cc
);
g_free
(
enc
->
bcc
);
g_free
(
enc
->
subject
);
G_OBJECT_CLASS
(
mms_task_encode_parent_class
)
->
finalize
(
object
);
}
static
char
*
mms_task_encode_generate_path
(
...
...
@@ -562,6 +547,25 @@ mms_task_encode_prepare_address_list(
return
NULL
;
}
static
void
mms_task_encode_finalize
(
GObject
*
object
)
{
MMSTaskEncode
*
enc
=
MMS_TASK_ENCODE
(
object
);
if
(
enc
->
parts
)
{
int
i
;
for
(
i
=
0
;
i
<
enc
->
nparts
;
i
++
)
mms_attachment_unref
(
enc
->
parts
[
i
]);
g_free
(
enc
->
parts
);
}
g_free
(
enc
->
to
);
g_free
(
enc
->
cc
);
g_free
(
enc
->
bcc
);
g_free
(
enc
->
subject
);
mms_transfer_list_unref
(
enc
->
transfers
);
G_OBJECT_CLASS
(
mms_task_encode_parent_class
)
->
finalize
(
object
);
}
static
void
mms_task_encode_class_init
(
...
...
@@ -584,6 +588,7 @@ MMSTask*
mms_task_encode_new
(
MMSSettings
*
settings
,
MMSHandler
*
handler
,
MMSTransferList
*
transfers
,
const
char
*
id
,
const
char
*
imsi
,
const
char
*
to
,
...
...
@@ -617,6 +622,7 @@ mms_task_encode_new(
enc
->
bcc
=
mms_task_encode_prepare_address_list
(
bcc
);
enc
->
subject
=
g_strdup
(
subject
);
enc
->
flags
=
flags
;
enc
->
transfers
=
mms_transfer_list_ref
(
transfers
);
MMS_ASSERT
(
!
error
||
!*
error
);
g_free
(
dir
);
...
...
mms-lib/src/mms_task_http.c
View file @
99d617c3
This diff is collapsed.
Click to expand it.
mms-lib/src/mms_task_http.h
View file @
99d617c3
...
...
@@ -36,6 +36,7 @@ typedef struct mms_task_http_priv MMSTaskHttpPriv;
typedef
struct
mms_task_http
{
MMSTask
task
;
/* Parent object */
MMSTaskHttpPriv
*
priv
;
/* Private data */
MMSTransferList
*
transfers
;
/* Transfer list */
}
MMSTaskHttp
;
typedef
struct
mms_task_http_class
{
...
...
@@ -57,18 +58,20 @@ mms_task_http_alloc(
GType
type
,
/* Zero for MMS_TYPE_TASK_HTTP */
MMSSettings
*
settings
,
/* Settings */
MMSHandler
*
handler
,
/* MMS handler */
MMSTransferList
*
transfers
,
/* Transfer list */
const
char
*
name
,
/* Task name */
const
char
*
id
,
/* Database message id */
const
char
*
imsi
,
/* IMSI associated with the message */
const
char
*
uri
,
/* NULL to use MMSC URL */
const
char
*
receive_file
,
/* File to write data to (optional) */
const
char
*
send_file
,
/* File to read data from (optional) */
const
char
*
send_file
,
/* File to read data from (optional) */
MMS_CONNECTION_TYPE
ct
);
void
*
mms_task_http_alloc_with_parent
(
GType
type
,
/* Zero for MMS_TYPE_TASK_HTTP */
MMSTask
*
parent
,
/* Parent task */
MMSTransferList
*
transfers
,
/* Transfer list */
const
char
*
name
,
/* Task name */
const
char
*
uri
,
/* NULL to use MMSC URL */
const
char
*
receive_file
,
/* File to write data to (optional) */
...
...
mms-lib/src/mms_task_notification.c
View file @
99d617c3
...
...
@@ -18,6 +18,7 @@
#include "mms_codec.h"
#include "mms_handler.h"
#include "mms_file_util.h"
#include "mms_transfer_list.h"
/* Logging */
#define MMS_LOG_MODULE_NAME mms_task_notification_log
...
...
@@ -32,9 +33,10 @@ typedef struct mms_task_notification {
MMSPdu
*
pdu
;
GBytes
*
push
;
MMSHandlerMessageNotifyCall
*
notify
;
MMSTransferList
*
transfers
;
}
MMSTaskNotification
;
G_DEFINE_TYPE
(
MMSTaskNotification
,
mms_task_notification
,
MMS_TYPE_TASK
)
;
G_DEFINE_TYPE
(
MMSTaskNotification
,
mms_task_notification
,
MMS_TYPE_TASK
)
#define MMS_TYPE_TASK_NOTIFICATION (mms_task_notification_get_type())
#define MMS_TASK_NOTIFICATION(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),\
MMS_TYPE_TASK_NOTIFICATION, MMSTaskNotification))
...
...
@@ -67,8 +69,8 @@ mms_task_notification_reject(
{
mms_task_make_id
(
&
ind
->
task
);
mms_task_queue_and_unref
(
ind
->
task
.
delegate
,
mms_task_notifyresp_new
(
&
ind
->
task
,
ind
->
pdu
->
transaction_id
,
MMS_MESSAGE_NOTIFY_STATUS_REJECTED
));
mms_task_notifyresp_new
(
&
ind
->
task
,
ind
->
transfers
,