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
24f976a1
Commit
24f976a1
authored
Feb 16, 2016
by
Slava Monich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[mms-lib] Pass "user request" flag to the connection manager.
It's not being used at the moment but we may need it soon.
parent
b70fdc33
Changes
19
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
60 additions
and
36 deletions
+60
-36
mms-connman-nemo/src/mms_connection_nemo.c
mms-connman-nemo/src/mms_connection_nemo.c
+2
-2
mms-connman-nemo/src/mms_connection_nemo.h
mms-connman-nemo/src/mms_connection_nemo.h
+1
-1
mms-connman-nemo/src/mms_connman_nemo.c
mms-connman-nemo/src/mms_connman_nemo.c
+2
-2
mms-connman-ofono/src/mms_connection_ofono.c
mms-connman-ofono/src/mms_connection_ofono.c
+2
-2
mms-connman-ofono/src/mms_connection_ofono.h
mms-connman-ofono/src/mms_connection_ofono.h
+1
-1
mms-connman-ofono/src/mms_connman_ofono.c
mms-connman-ofono/src/mms_connman_ofono.c
+3
-3
mms-lib/include/mms_connection.h
mms-lib/include/mms_connection.h
+2
-2
mms-lib/include/mms_connman.h
mms-lib/include/mms_connman.h
+3
-2
mms-lib/include/mms_lib_types.h
mms-lib/include/mms_lib_types.h
+7
-1
mms-lib/src/mms_connman.c
mms-lib/src/mms_connman.c
+3
-2
mms-lib/src/mms_dispatcher.c
mms-lib/src/mms_dispatcher.c
+5
-2
mms-lib/src/mms_task.h
mms-lib/src/mms_task.h
+2
-1
mms-lib/src/mms_task_http.c
mms-lib/src/mms_task_http.c
+11
-4
mms-lib/src/mms_task_http.h
mms-lib/src/mms_task_http.h
+4
-2
mms-lib/src/mms_task_notification.c
mms-lib/src/mms_task_notification.c
+2
-2
mms-lib/src/mms_task_read.c
mms-lib/src/mms_task_read.c
+2
-2
mms-lib/src/mms_task_retrieve.c
mms-lib/src/mms_task_retrieve.c
+4
-3
mms-lib/test/common/test_connection.c
mms-lib/test/common/test_connection.c
+1
-0
mms-lib/test/common/test_connman.c
mms-lib/test/common/test_connman.c
+3
-2
No files found.
mms-connman-nemo/src/mms_connection_nemo.c
View file @
24f976a1
...
...
@@ -512,13 +512,13 @@ MMSConnection*
mms_connection_nemo_new
(
MMSConnMan
*
cm
,
const
char
*
imsi
,
gboolean
user_request
)
MMS_CONNECTION_TYPE
type
)
{
MMSConnectionNemo
*
self
=
g_object_new
(
MMS_TYPE_CONNECTION_NEMO
,
NULL
);
MMSConnection
*
conn
=
&
self
->
connection
;
MMS_VERBOSE_
(
"%p %s"
,
self
,
imsi
);
conn
->
user_connection
=
user_request
;
conn
->
type
=
type
;
conn
->
imsi
=
self
->
imsi
=
g_strdup
(
imsi
);
conn
->
state
=
MMS_CONNECTION_STATE_OPENING
;
self
->
mm
=
ofonoext_mm_new
();
...
...
mms-connman-nemo/src/mms_connection_nemo.h
View file @
24f976a1
...
...
@@ -24,7 +24,7 @@ MMSConnection*
mms_connection_nemo_new
(
MMSConnMan
*
cm
,
const
char
*
imsi
,
gboolean
user_request
);
MMS_CONNECTION_TYPE
type
);
#endif
/* JOLLA_MMS_CONNECTION_NEMO_H */
...
...
mms-connman-nemo/src/mms_connman_nemo.c
View file @
24f976a1
...
...
@@ -166,7 +166,7 @@ MMSConnection*
mms_connman_nemo_open_connection
(
MMSConnMan
*
cm
,
const
char
*
imsi
,
gboolean
user_request
)
MMS_CONNECTION_TYPE
type
)
{
MMSConnManNemo
*
self
=
MMS_CONNMAN_NEMO
(
cm
);
if
(
self
->
conn
)
{
...
...
@@ -178,7 +178,7 @@ mms_connman_nemo_open_connection(
self
->
conn
=
NULL
;
}
}
self
->
conn
=
mms_connection_nemo_new
(
cm
,
imsi
,
user_request
);
self
->
conn
=
mms_connection_nemo_new
(
cm
,
imsi
,
type
);
g_object_weak_ref
(
G_OBJECT
(
self
->
conn
),
mms_connman_nemo_connection_weak_ref_notify
,
self
);
return
self
->
conn
;
...
...
mms-connman-ofono/src/mms_connection_ofono.c
View file @
24f976a1
...
...
@@ -211,7 +211,7 @@ MMSConnection*
mms_connection_ofono_new
(
OfonoSimMgr
*
sim
,
OfonoConnCtx
*
context
,
gboolean
user_request
)
MMS_CONNECTION_TYPE
type
)
{
MMSConnectionOfono
*
self
=
g_object_new
(
MMS_TYPE_CONNECTION_OFONO
,
NULL
);
MMSConnection
*
conn
=
&
self
->
connection
;
...
...
@@ -220,7 +220,7 @@ mms_connection_ofono_new(
MMS_ASSERT
(
sim
->
present
);
MMS_VERBOSE_
(
"%p %s"
,
self
,
sim
->
imsi
);
conn
->
user_connection
=
user_request
;
conn
->
type
=
type
;
conn
->
imsi
=
self
->
imsi
=
g_strdup
(
sim
->
imsi
);
self
->
sim
=
ofono_simmgr_ref
(
sim
);
self
->
context
=
ofono_connctx_ref
(
context
);
...
...
mms-connman-ofono/src/mms_connection_ofono.h
View file @
24f976a1
...
...
@@ -24,7 +24,7 @@ MMSConnection*
mms_connection_ofono_new
(
OfonoSimMgr
*
sim
,
OfonoConnCtx
*
context
,
gboolean
user_request
);
MMS_CONNECTION_TYPE
type
);
#endif
/* JOLLA_MMS_CONNECTION_OFONO_H */
...
...
mms-connman-ofono/src/mms_connman_ofono.c
View file @
24f976a1
...
...
@@ -194,7 +194,7 @@ MMSConnection*
mms_connman_ofono_open_connection
(
MMSConnMan
*
cm
,
const
char
*
imsi
,
gboolean
user_request
)
MMS_CONNECTION_TYPE
type
)
{
MMSConnManOfono
*
self
=
MMS_CONNMAN_OFONO
(
cm
);
MMSOfonoModem
*
modem
=
mms_connman_ofono_modem_for_imsi
(
self
,
imsi
);
...
...
@@ -205,8 +205,8 @@ mms_connman_ofono_open_connection(
if
(
modem
->
conn
)
{
mms_connection_ref
(
modem
->
conn
);
}
else
{
modem
->
conn
=
mms_connection_ofono_new
(
modem
->
simmgr
,
ctx
,
user_request
);
modem
->
conn
=
mms_connection_ofono_new
(
modem
->
simmgr
,
ctx
,
type
);
g_object_weak_ref
(
G_OBJECT
(
modem
->
conn
),
mms_connman_ofono_connection_gone
,
self
);
}
...
...
mms-lib/include/mms_connection.h
View file @
24f976a1
/*
* 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
...
...
@@ -44,7 +44,7 @@ struct mms_connection {
const
char
*
mmsc
;
const
char
*
mmsproxy
;
const
char
*
netif
;
gboolean
user_connection
;
MMS_CONNECTION_TYPE
type
;
MMS_CONNECTION_STATE
state
;
};
...
...
mms-lib/include/mms_connman.h
View file @
24f976a1
/*
* 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
...
...
@@ -28,7 +29,7 @@ typedef struct mms_connman_class {
GObjectClass
parent
;
char
*
(
*
fn_default_imsi
)(
MMSConnMan
*
cm
);
MMSConnection
*
(
*
fn_open_connection
)(
MMSConnMan
*
cm
,
const
char
*
imsi
,
gboolean
user_request
);
MMS_CONNECTION_TYPE
type
);
}
MMSConnManClass
;
GType
mms_connman_get_type
(
void
);
...
...
@@ -65,7 +66,7 @@ MMSConnection*
mms_connman_open_connection
(
MMSConnMan
*
cm
,
const
char
*
imsi
,
gboolean
user_request
);
MMS_CONNECTION_TYPE
type
);
/**
* While busy flags is on, mms-engine shouldn't exit
...
...
mms-lib/include/mms_lib_types.h
View file @
24f976a1
/*
* 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
...
...
@@ -75,6 +75,12 @@ typedef enum mms_read_status {
MMS_READ_STATUS_DELETED
/* Message deleted without reading */
}
MMSReadStatus
;
/* Connection type */
typedef
enum
_MMS_CONNECTION_TYPE
{
MMS_CONNECTION_TYPE_AUTO
,
/* Internally requested connection */
MMS_CONNECTION_TYPE_USER
/* Connection requested by user */
}
MMS_CONNECTION_TYPE
;
/* Convenience macros */
#define MMS_CAST(address,type,field) \
((type *)((guint8*)(address) - G_STRUCT_OFFSET(type,field)))
...
...
mms-lib/src/mms_connman.c
View file @
24f976a1
/*
* 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
...
...
@@ -128,12 +129,12 @@ MMSConnection*
mms_connman_open_connection
(
MMSConnMan
*
cm
,
const
char
*
imsi
,
gboolean
user_request
)
MMS_CONNECTION_TYPE
type
)
{
if
(
cm
)
{
MMSConnManClass
*
klass
=
MMS_CONNMAN_GET_CLASS
(
cm
);
if
(
klass
->
fn_open_connection
)
{
return
klass
->
fn_open_connection
(
cm
,
imsi
,
user_request
);
return
klass
->
fn_open_connection
(
cm
,
imsi
,
type
);
}
}
return
NULL
;
...
...
mms-lib/src/mms_dispatcher.c
View file @
24f976a1
...
...
@@ -366,7 +366,9 @@ mms_dispatcher_pick_next_task(
mms_dispatcher_close_connection
(
disp
);
if
(
!
disp
->
connection
)
{
disp
->
connection
=
mms_connman_open_connection
(
disp
->
cm
,
task
->
imsi
,
FALSE
);
task
->
imsi
,
(
task
->
state
==
MMS_TASK_STATE_NEED_USER_CONNECTION
)
?
MMS_CONNECTION_TYPE_USER
:
MMS_CONNECTION_TYPE_AUTO
);
if
(
disp
->
connection
)
{
MMS_ASSERT
(
!
disp
->
connection_changed_id
);
disp
->
connection_changed_id
=
...
...
@@ -543,7 +545,8 @@ mms_dispatcher_receive_message(
if
(
pdu
->
type
==
MMS_MESSAGE_TYPE_NOTIFICATION_IND
)
{
ok
=
mms_dispatcher_queue_and_unref_task
(
disp
,
mms_task_retrieve_new
(
disp
->
settings
,
disp
->
handler
,
id
,
imsi
,
pdu
,
error
));
id
,
imsi
,
pdu
,
automatic
?
MMS_CONNECTION_TYPE_AUTO
:
MMS_CONNECTION_TYPE_USER
,
error
));
}
mms_message_free
(
pdu
);
}
else
{
...
...
mms-lib/src/mms_task.h
View file @
24f976a1
/*
* 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
...
...
@@ -180,6 +180,7 @@ mms_task_retrieve_new(
const
char
*
id
,
const
char
*
imsi
,
const
MMSPdu
*
pdu
,
MMS_CONNECTION_TYPE
ct
,
GError
**
error
);
MMSTask
*
...
...
mms-lib/src/mms_task_http.c
View file @
24f976a1
/*
* 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
...
...
@@ -66,6 +66,7 @@ struct mms_task_http_private {
gsize
bytes_sent
;
guint
bytes_received
;
MMS_HTTP_STATE
transaction_state
;
MMS_CONNECTION_TYPE
connection_type
;
};
G_DEFINE_TYPE
(
MMSTaskHttp
,
mms_task_http
,
MMS_TYPE_TASK
);
...
...
@@ -511,7 +512,10 @@ void
mms_task_http_run
(
MMSTask
*
task
)
{
mms_task_set_state
(
task
,
MMS_TASK_STATE_NEED_CONNECTION
);
MMSTaskHttp
*
http
=
MMS_TASK_HTTP
(
task
);
mms_task_set_state
(
task
,
(
http
->
priv
->
connection_type
==
MMS_CONNECTION_TYPE_USER
)
?
MMS_TASK_STATE_NEED_USER_CONNECTION
:
MMS_TASK_STATE_NEED_CONNECTION
);
}
static
...
...
@@ -618,7 +622,8 @@ mms_task_http_alloc(
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
)
{
MMSTaskHttp
*
http
=
mms_task_alloc
(
type
?
type
:
MMS_TYPE_TASK_HTTP
,
settings
,
handler
,
name
,
id
,
imsi
);
...
...
@@ -626,6 +631,7 @@ mms_task_http_alloc(
http
->
priv
=
priv
;
priv
->
uri
=
g_strdup
(
uri
);
priv
->
receive_file
=
receive_file
;
/* Always static, don't strdup */
priv
->
connection_type
=
ct
;
if
(
send_file
)
{
priv
->
send_path
=
mms_task_file
(
&
http
->
task
,
send_file
);
MMS_ASSERT
(
g_file_test
(
priv
->
send_path
,
G_FILE_TEST_IS_REGULAR
));
...
...
@@ -643,7 +649,8 @@ mms_task_http_alloc_with_parent(
const
char
*
send_file
)
/* File to read data from (optional) */
{
return
mms_task_http_alloc
(
type
,
parent
->
settings
,
parent
->
handler
,
name
,
parent
->
id
,
parent
->
imsi
,
uri
,
receive_file
,
send_file
);
name
,
parent
->
id
,
parent
->
imsi
,
uri
,
receive_file
,
send_file
,
MMS_CONNECTION_TYPE_AUTO
);
}
/*
...
...
mms-lib/src/mms_task_http.h
View file @
24f976a1
/*
* 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
...
...
@@ -61,7 +62,8 @@ mms_task_http_alloc(
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
(
...
...
mms-lib/src/mms_task_notification.c
View file @
24f976a1
/*
* 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
...
...
@@ -121,7 +121,7 @@ mms_task_notification_done(
/* Schedule the download task */
if
(
!
mms_task_queue_and_unref
(
task
->
delegate
,
mms_task_retrieve_new
(
task
->
settings
,
task
->
handler
,
task
->
id
,
task
->
imsi
,
ind
->
pdu
,
NULL
)))
{
task
->
id
,
task
->
imsi
,
ind
->
pdu
,
FALSE
,
NULL
)))
{
mms_handler_message_receive_state_changed
(
task
->
handler
,
id
,
MMS_RECEIVE_STATE_DOWNLOAD_ERROR
);
}
...
...
mms-lib/src/mms_task_read.c
View file @
24f976a1
/*
* 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
...
...
@@ -127,7 +127,7 @@ mms_task_read_new(
id
,
msg_id
,
to
,
rs
,
err
);
if
(
file
)
{
return
mms_task_http_alloc
(
MMS_TYPE_TASK_READ
,
settings
,
handler
,
"Read"
,
id
,
imsi
,
NULL
,
NULL
,
file
);
"Read"
,
id
,
imsi
,
NULL
,
NULL
,
file
,
MMS_CONNECTION_TYPE_AUTO
);
}
return
NULL
;
}
...
...
mms-lib/src/mms_task_retrieve.c
View file @
24f976a1
/*
* 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
...
...
@@ -119,6 +119,7 @@ mms_task_retrieve_new(
const
char
*
id
,
const
char
*
imsi
,
const
MMSPdu
*
pdu
,
MMS_CONNECTION_TYPE
ct
,
GError
**
error
)
{
const
time_t
now
=
time
(
NULL
);
...
...
@@ -127,8 +128,8 @@ mms_task_retrieve_new(
MMS_ASSERT
(
pdu
->
transaction_id
);
if
(
pdu
->
ni
.
expiry
>
now
)
{
MMSTaskRetrieve
*
retrieve
=
mms_task_http_alloc
(
MMS_TYPE_TASK_RETRIEVE
,
settings
,
handler
,
"Retrieve"
,
id
,
imsi
,
pdu
->
ni
.
location
,
MMS_RETRIEVE_CONF_FILE
,
NULL
);
MMS_TYPE_TASK_RETRIEVE
,
settings
,
handler
,
"Retrieve"
,
id
,
imsi
,
pdu
->
ni
.
location
,
MMS_RETRIEVE_CONF_FILE
,
NULL
,
ct
);
if
(
retrieve
->
http
.
task
.
deadline
>
pdu
->
ni
.
expiry
)
{
retrieve
->
http
.
task
.
deadline
=
pdu
->
ni
.
expiry
;
}
...
...
mms-lib/test/common/test_connection.c
View file @
24f976a1
...
...
@@ -83,6 +83,7 @@ mms_connection_test_new(
test
->
mmsc
=
g_strdup_printf
(
"http://127.0.0.1:%hu"
,
port
);
}
}
test
->
type
=
MMS_CONNECTION_TYPE_AUTO
;
test
->
state
=
MMS_CONNECTION_STATE_OPENING
;
mms_connection_test_set_state
(
test
,
test
->
netif
?
MMS_CONNECTION_STATE_OPEN
:
MMS_CONNECTION_STATE_FAILED
);
...
...
mms-lib/test/common/test_connman.c
View file @
24f976a1
/*
* 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
...
...
@@ -103,7 +104,7 @@ MMSConnection*
mms_connman_test_open_connection
(
MMSConnMan
*
cm
,
const
char
*
imsi
,
gboolean
user_request
)
MMS_CONNECTION_TYPE
type
)
{
MMSConnManTest
*
test
=
MMS_CONNMAN_TEST
(
cm
);
mms_connman_test_close_connection
(
cm
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment