[PATCH 0/1] mmsd: error management

2012-05-02 Thread Sébastien Bianti
Hi,

This patch updates the TODO file with regard to lastest commit applied

Sébastien Bianti (1):
  TODO: task complete

 TODO |   14 --
 1 files changed, 0 insertions(+), 14 deletions(-)

-- 
1.7.4.4

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH 1/1] TODO: task complete

2012-05-02 Thread Sébastien Bianti
---
 TODO |   14 --
 1 files changed, 0 insertions(+), 14 deletions(-)

diff --git a/TODO b/TODO
index 95a40c7..8d82b90 100644
--- a/TODO
+++ b/TODO
@@ -16,20 +16,6 @@ Background
   once the task is better understood.
 
 
-MMS Submission
-==
-
-- Add MMS submit support.
-  In case of error (HTTP communication error, MMSC rejection of the submit
-  request), the SendMessage Request asynchronous reply should also be sent with
-  the appropriate DBus error status (see __mms_error_).
-
-  Priority: High
-  Complexity: C4
-  Depends: MMS M-Send.Req PDU encoding support, META file support,
-  org.ofono.mms.Message interface implementation.
-  Owner: Sebastien Bianti sebastien.bia...@linux.intel.com
-
 D-Bus API
 =
 
-- 
1.7.4.4

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH 0/2] mmsd: error management

2012-04-27 Thread Sébastien Bianti
Hi,
The first patch removes the MMS reception part from TODO file which
has been done some times ago.
This model of error management applies also for MMS emission, except that
it shouldn't be silent because initiated by the user.

Sébastien Bianti (2):
  TODO: MMS reception error management done
  service: emit signal when send has failed

 TODO  |   13 -
 src/service.c |   32 
 2 files changed, 20 insertions(+), 25 deletions(-)

-- 
1.7.4.4

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH 1/2] TODO: MMS reception error management done

2012-04-27 Thread Sébastien Bianti
---
 TODO |   13 -
 1 files changed, 0 insertions(+), 13 deletions(-)

diff --git a/TODO b/TODO
index c75468d..95a40c7 100644
--- a/TODO
+++ b/TODO
@@ -30,19 +30,6 @@ MMS Submission
   org.ofono.mms.Message interface implementation.
   Owner: Sebastien Bianti sebastien.bia...@linux.intel.com
 
-MMS Reception
-=
-
-- Add MMS Automatic Retrieval support.
-  Error cases should handled and reported to the application layer.
-
-  Priority: High
-  Complexity: C4
-  Depends: META file support, MMS M-Retrieve.conf PDU decoding support,
-  org.ofono.mms.Message interface implementation, HTTP GWeb POST request
-  support.
-  Owner: Ronald Tessier ronald.tess...@linux.intel.com
-
 D-Bus API
 =
 
-- 
1.7.4.4

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH 2/2] service: emit signal when send has failed

2012-04-27 Thread Sébastien Bianti
Event if status doesn't really change, we need to alert the application
by sending the same value draft which means the message hasn't been received.
---
 src/service.c |   32 
 1 files changed, 20 insertions(+), 12 deletions(-)

diff --git a/src/service.c b/src/service.c
index f89fd3f..8dd0a2e 100644
--- a/src/service.c
+++ b/src/service.c
@@ -596,16 +596,23 @@ static gboolean result_request_send_conf(struct 
mms_request *request)
size_t len;
char *path;
 
-   if (request-status != 200)
+   if (request-msg == NULL)
return FALSE;
 
+   uuid = request-msg-uuid;
+
+   path = g_strdup_printf(%s/%s/%s, MMS_PATH, service-identity, uuid);
+
+   if (request-status != 200)
+   goto error;
+
msg = g_try_new0(struct mms_message, 1);
if (msg == NULL)
-   return FALSE;
+   goto error;
 
if (mmap_file(request-data_path, pdu, len) == FALSE) {
mms_message_free(msg);
-   return FALSE;
+   goto error;
}
 
if (mms_message_decode(pdu, len, msg) == FALSE) {
@@ -615,7 +622,7 @@ static gboolean result_request_send_conf(struct mms_request 
*request)
 
mms_message_free(msg);
 
-   return FALSE;
+   goto error;
}
 
mms_debug(response status : %d, msg-sc.rsp_status);
@@ -626,26 +633,27 @@ static gboolean result_request_send_conf(struct 
mms_request *request)
 
unlink(request-data_path);
 
-   if (request-msg == NULL)
-   return FALSE;
-
-   uuid = request-msg-uuid;
-
meta = mms_store_meta_open(service-identity, uuid);
if (meta == NULL)
-   return FALSE;
+   goto error;
 
g_key_file_set_string(meta, info, state, sent);
 
mms_store_meta_close(service-identity, uuid, meta, TRUE);
 
-   path = g_strdup_printf(%s/%s/%s, MMS_PATH, service-identity, uuid);
-
emit_msg_status_changed(path, sent);
 
g_free(path);
 
return TRUE;
+
+error:
+   if (request-attempt == MAX_ATTEMPTS)
+   emit_msg_status_changed(path, draft);
+
+   g_free(path);
+
+   return FALSE;
 }
 
 static void append_message(const char *path, const struct mms_service *service,
-- 
1.7.4.4

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH v2 0/2] mmsd: bug fix

2012-04-23 Thread Sébastien Bianti
Sébastien Bianti (2):
  mmsutil: add mms_message_status_get_string API
  service: use proper status value string

 src/mmsutil.c |   18 ++
 src/mmsutil.h |1 +
 src/service.c |2 +-
 3 files changed, 20 insertions(+), 1 deletions(-)

-- 
1.7.4.4

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH v2 1/2] mmsutil: add mms_message_status_get_string API

2012-04-23 Thread Sébastien Bianti
---
 src/mmsutil.c |   18 ++
 src/mmsutil.h |1 +
 2 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/src/mmsutil.c b/src/mmsutil.c
index c507d6f..8809f54 100644
--- a/src/mmsutil.c
+++ b/src/mmsutil.c
@@ -1661,3 +1661,21 @@ gboolean mms_message_encode(struct mms_message *msg, int 
fd)
 
return FALSE;
 }
+
+char *mms_message_status_get_string(enum mms_message_status status)
+{
+   switch (status) {
+   case MMS_MESSAGE_STATUS_DOWNLOADED:
+   return downloaded;
+   case MMS_MESSAGE_STATUS_RECEIVED:
+   return received;
+   case MMS_MESSAGE_STATUS_READ:
+   return read;
+   case MMS_MESSAGE_STATUS_SENT:
+   return sent;
+   case MMS_MESSAGE_STATUS_DRAFT:
+   return draft;
+   }
+
+   return NULL;
+}
diff --git a/src/mmsutil.h b/src/mmsutil.h
index b2a0418..d3b507f 100644
--- a/src/mmsutil.h
+++ b/src/mmsutil.h
@@ -146,3 +146,4 @@ gboolean mms_message_decode(const unsigned char *pdu,
unsigned int len, struct mms_message *out);
 gboolean mms_message_encode(struct mms_message *msg, int fd);
 void mms_message_free(struct mms_message *msg);
+char *mms_message_status_get_string(enum mms_message_status status);
-- 
1.7.4.4

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH v2 2/2] service: use proper status value string

2012-04-23 Thread Sébastien Bianti
---
 src/service.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/service.c b/src/service.c
index 469393a..f89fd3f 100644
--- a/src/service.c
+++ b/src/service.c
@@ -1502,7 +1502,7 @@ static void append_sr_msg_properties(DBusMessageIter 
*dict,
struct mms_message *msg)
 {
const char *date = time_to_str(msg-rc.date);
-   const char *status = draft;
+   const char *status = mms_message_status_get_string(msg-sr.status);
 
mms_dbus_dict_append_basic(dict, Status,
DBUS_TYPE_STRING, status);
-- 
1.7.4.4

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH v3 0/2] mmsd: bug fix

2012-04-23 Thread Sébastien Bianti
Sébastien Bianti (2):
  mmsutil: add mms_message_status_get_string API
  service: use proper status value string

 src/mmsutil.c |   18 ++
 src/mmsutil.h |1 +
 src/service.c |2 +-
 3 files changed, 20 insertions(+), 1 deletions(-)

-- 
1.7.4.4

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH v3 1/2] mmsutil: add mms_message_status_get_string API

2012-04-23 Thread Sébastien Bianti
---
 src/mmsutil.c |   18 ++
 src/mmsutil.h |1 +
 2 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/src/mmsutil.c b/src/mmsutil.c
index c507d6f..89f1c29 100644
--- a/src/mmsutil.c
+++ b/src/mmsutil.c
@@ -1661,3 +1661,21 @@ gboolean mms_message_encode(struct mms_message *msg, int 
fd)
 
return FALSE;
 }
+
+const char *mms_message_status_get_string(enum mms_message_status status)
+{
+   switch (status) {
+   case MMS_MESSAGE_STATUS_DOWNLOADED:
+   return downloaded;
+   case MMS_MESSAGE_STATUS_RECEIVED:
+   return received;
+   case MMS_MESSAGE_STATUS_READ:
+   return read;
+   case MMS_MESSAGE_STATUS_SENT:
+   return sent;
+   case MMS_MESSAGE_STATUS_DRAFT:
+   return draft;
+   }
+
+   return NULL;
+}
diff --git a/src/mmsutil.h b/src/mmsutil.h
index b2a0418..79c74db 100644
--- a/src/mmsutil.h
+++ b/src/mmsutil.h
@@ -146,3 +146,4 @@ gboolean mms_message_decode(const unsigned char *pdu,
unsigned int len, struct mms_message *out);
 gboolean mms_message_encode(struct mms_message *msg, int fd);
 void mms_message_free(struct mms_message *msg);
+const char *mms_message_status_get_string(enum mms_message_status status);
-- 
1.7.4.4

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH v3 2/2] service: use proper status value string

2012-04-23 Thread Sébastien Bianti
---
 src/service.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/service.c b/src/service.c
index 469393a..f89fd3f 100644
--- a/src/service.c
+++ b/src/service.c
@@ -1502,7 +1502,7 @@ static void append_sr_msg_properties(DBusMessageIter 
*dict,
struct mms_message *msg)
 {
const char *date = time_to_str(msg-rc.date);
-   const char *status = draft;
+   const char *status = mms_message_status_get_string(msg-sr.status);
 
mms_dbus_dict_append_basic(dict, Status,
DBUS_TYPE_STRING, status);
-- 
1.7.4.4

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH 0/3] mmsd: bug fix

2012-04-20 Thread Sébastien Bianti
This set concerns mmsd for ofono mailing list.

Sébastien Bianti (3):
  mmsutil: add mms_message_status_get_string API
  service: use proper status value string
  service: fix for message_delete bug

 src/mmsutil.c |   25 +
 src/mmsutil.h |1 +
 src/service.c |9 +++--
 3 files changed, 33 insertions(+), 2 deletions(-)

-- 
1.7.4.4

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH 1/3] mmsutil: add mms_message_status_get_string API

2012-04-20 Thread Sébastien Bianti
---
 src/mmsutil.c |   25 +
 src/mmsutil.h |1 +
 2 files changed, 26 insertions(+), 0 deletions(-)

diff --git a/src/mmsutil.c b/src/mmsutil.c
index c507d6f..725849b 100644
--- a/src/mmsutil.c
+++ b/src/mmsutil.c
@@ -1661,3 +1661,28 @@ gboolean mms_message_encode(struct mms_message *msg, int 
fd)
 
return FALSE;
 }
+
+char *mms_message_status_get_string(enum mms_message_status status)
+{
+   char *status_str;
+
+   switch (status) {
+   case MMS_MESSAGE_STATUS_DOWNLOADED:
+   status_str = downloaded;
+   break;
+   case MMS_MESSAGE_STATUS_RECEIVED:
+   status_str = received;
+   break;
+   case MMS_MESSAGE_STATUS_READ:
+   status_str = read;
+   break;
+   case MMS_MESSAGE_STATUS_SENT:
+   status_str = sent;
+   break;
+   case MMS_MESSAGE_STATUS_DRAFT:
+   status_str = draft;
+   break;
+   }
+
+   return status_str;
+}
diff --git a/src/mmsutil.h b/src/mmsutil.h
index b2a0418..d3b507f 100644
--- a/src/mmsutil.h
+++ b/src/mmsutil.h
@@ -146,3 +146,4 @@ gboolean mms_message_decode(const unsigned char *pdu,
unsigned int len, struct mms_message *out);
 gboolean mms_message_encode(struct mms_message *msg, int fd);
 void mms_message_free(struct mms_message *msg);
+char *mms_message_status_get_string(enum mms_message_status status);
-- 
1.7.4.4

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH 2/3] service: use proper status value string

2012-04-20 Thread Sébastien Bianti
---
 src/service.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/service.c b/src/service.c
index 907b581..5520012 100644
--- a/src/service.c
+++ b/src/service.c
@@ -1497,7 +1497,7 @@ static void append_sr_msg_properties(DBusMessageIter 
*dict,
struct mms_message *msg)
 {
const char *date = time_to_str(msg-rc.date);
-   const char *status = draft;
+   const char *status = mms_message_status_get_string(msg-sr.status);
 
mms_dbus_dict_append_basic(dict, Status,
DBUS_TYPE_STRING, status);
-- 
1.7.4.4

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH 3/3] service: fix for message_delete bug

2012-04-20 Thread Sébastien Bianti
mms_message_unregister destroyes the message
---
 src/service.c |7 ++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/src/service.c b/src/service.c
index 5520012..f89fd3f 100644
--- a/src/service.c
+++ b/src/service.c
@@ -134,6 +134,7 @@ static DBusMessage *msg_delete(DBusConnection *conn,
struct mms_service *service = user_data;
struct mms_message *mms;
const char *path;
+   char *uuid;
 
path = dbus_message_get_path(msg);
 
@@ -143,10 +144,14 @@ static DBusMessage *msg_delete(DBusConnection *conn,
if (mms == NULL)
return __mms_error_invalid_args(msg);
 
+   uuid = g_strdup(mms-uuid);
+
if (mms_message_unregister(service, path)  0)
return __mms_error_invalid_args(msg);
 
-   mms_store_remove(service-identity, mms-uuid);
+   mms_store_remove(service-identity, uuid);
+
+   g_free(uuid);
 
return g_dbus_create_reply(msg, DBUS_TYPE_INVALID);
 }
-- 
1.7.4.4

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH v2 00/10] mmsd: error management

2012-04-13 Thread Sébastien Bianti
Hi,

This series concerns mmsd for ofono mailing list.

This is essentially a rework of Ronald's patches.

Was:
 Hi,

 These patches concern mmsd and are related to error handling while
 receiving message.
 The main idea is to try to recover error internally when possible and
 drop messages that are not decodable.


Ronald Tessier (1):
  service: remove files when unable to decode received msg

Sébastien Bianti (9):
  service: add debug prints
  service: remove useless variable
  service: add attempts counter variable
  service: move destroy request into process_request
  service: refactoring file closure
  service: callbacks should return a boolean
  service: refactoring error code
  service: add requeue functionality
  service: bearer activity needs to be checked

 src/service.c |  134 ++---
 1 files changed, 90 insertions(+), 44 deletions(-)

-- 
1.7.4.4

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH 0/2] complete storage task

2012-03-30 Thread Sébastien Bianti
Hi, 

These patches concern mmsd for ofono mailing list.


Sébastien Bianti (2):
  service: transaction id should'nt be NULL
  TODO: storage task complete

 TODO  |   14 --
 src/service.c |6 --
 2 files changed, 4 insertions(+), 16 deletions(-)

-- 
1.7.4.4

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH 1/2] service: transaction id should'nt be NULL

2012-03-30 Thread Sébastien Bianti
It is not contained in an automatic retrieve_conf pdu.
---
 src/service.c |6 --
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/service.c b/src/service.c
index 755ebc3..f148252 100644
--- a/src/service.c
+++ b/src/service.c
@@ -998,9 +998,11 @@ static gboolean load_message_from_store(const char 
*service_id,
else
msg-rc.status = MMS_MESSAGE_STATUS_RECEIVED;
} else if (strcmp(state, downloaded) == 0
-msg-type == MMS_MESSAGE_TYPE_RETRIEVE_CONF)
+msg-type == MMS_MESSAGE_TYPE_RETRIEVE_CONF) {
msg-rc.status = MMS_MESSAGE_STATUS_DOWNLOADED;
-   else if (strcmp(state, sent) == 0
+   if (msg-transaction_id == NULL)
+   msg-transaction_id = ;
+   } else if (strcmp(state, sent) == 0
 msg-type == MMS_MESSAGE_TYPE_SEND_REQ)
msg-sr.status = MMS_MESSAGE_STATUS_SENT;
else if (strcmp(state, draft) == 0
-- 
1.7.4.4

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH 2/2] TODO: storage task complete

2012-03-30 Thread Sébastien Bianti
---
 TODO |   14 --
 1 files changed, 0 insertions(+), 14 deletions(-)

diff --git a/TODO b/TODO
index 42e25a6..c75468d 100644
--- a/TODO
+++ b/TODO
@@ -43,20 +43,6 @@ MMS Reception
   support.
   Owner: Ronald Tessier ronald.tess...@linux.intel.com
 
-MMS Storage
-===
-
-- Add pending/incompleted transactions recovery on mmsd restart.
-  In the case of a restart of the mmsd, all the incomplete/pending MMS
-  transactions identified thanks to the META file information
-  (status key value) should be re-processed (i.e.: added to the mms_service 
-  structure request_queue).
-
-  Priority: Medium
-  Complexity: C2
-  Depends: META file support, MMS submit support.
-  Owner: Sebastien Bianti sebastien.bia...@linux.intel.com
-
 D-Bus API
 =
 
-- 
1.7.4.4

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH v3 1/3] service: factorize error code

2012-03-26 Thread Sébastien Bianti
---
 src/service.c |   55 +++
 1 files changed, 19 insertions(+), 36 deletions(-)

diff --git a/src/service.c b/src/service.c
index 5fda8a1..25a4fc4 100644
--- a/src/service.c
+++ b/src/service.c
@@ -733,30 +733,16 @@ static DBusMessage *send_message(DBusConnection *conn,
}
 
msg-transaction_id = create_transaction_id();
-   if (msg-transaction_id == NULL) {
-   release_attachement_data(msg-attachments);
-   mms_message_free(msg);
-
-   return __mms_error_trans_failure(dbus_msg);
-   }
+   if (msg-transaction_id == NULL)
+   goto release_msg;
 
request = create_request(MMS_REQUEST_TYPE_POST,
result_request_send_conf, NULL, service, msg);
-   if (request == NULL) {
-   release_attachement_data(msg-attachments);
-   mms_message_free(msg);
-
-   return __mms_error_trans_failure(dbus_msg);
-   }
-
-   if (mms_message_encode(msg, request-fd) == FALSE) {
-   release_attachement_data(msg-attachments);
-   mms_message_free(msg);
-
-   mms_request_destroy(request);
+   if (request == NULL)
+   goto release_msg;
 
-   return __mms_error_trans_failure(dbus_msg);
-   }
+   if (mms_message_encode(msg, request-fd) == FALSE)
+   goto release_request;
 
close(request-fd);
 
@@ -766,27 +752,15 @@ static DBusMessage *send_message(DBusConnection *conn,
request-data_path));
 
meta = mms_store_meta_open(service-identity, msg-uuid);
-   if (meta == NULL) {
-   release_attachement_data(msg-attachments);
-   mms_message_free(msg);
-
-   mms_request_destroy(request);
-
-   return __mms_error_trans_failure(dbus_msg);
-   }
+   if (meta == NULL)
+   goto release_request;
 
g_key_file_set_string(meta, info, state, draft);
 
mms_store_meta_close(service-identity, msg-uuid, meta, TRUE);
 
-   if (mms_message_register(service, msg)  0) {
-   release_attachement_data(msg-attachments);
-   mms_message_free(msg);
-
-   mms_request_destroy(request);
-
-   return __mms_error_trans_failure(dbus_msg);
-   }
+   if (mms_message_register(service, msg)  0)
+   goto release_request;
 
emit_message_added(service, msg);
 
@@ -811,6 +785,15 @@ static DBusMessage *send_message(DBusConnection *conn,
msg-path);
 
return reply;
+
+release_request:
+   mms_request_destroy(request);
+
+release_msg:
+   release_attachement_data(msg-attachments);
+   mms_message_free(msg);
+
+   return __mms_error_trans_failure(dbus_msg);
 }
 
 static GDBusMethodTable service_methods[] = {
-- 
1.7.4.4

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH v3 0/3] bug fixing in send message recovery

2012-03-26 Thread Sébastien Bianti
This series concerns mmsd for ofono mailing list.

Patch 1 to 3 fix some leaks when a problem arises when a send request is
created.


Sébastien Bianti (3):
  service: factorize error code
  service: NULL uuid here is an error
  service: remove orphan file

 src/service.c |   66 ++--
 1 files changed, 26 insertions(+), 40 deletions(-)

-- 
1.7.4.4

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH v3 3/3] service: remove orphan file

2012-03-26 Thread Sébastien Bianti
---
 src/service.c |   11 ++-
 1 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/src/service.c b/src/service.c
index 25a2563..755ebc3 100644
--- a/src/service.c
+++ b/src/service.c
@@ -753,6 +753,11 @@ static DBusMessage *send_message(DBusConnection *conn,
if (msg-uuid == NULL)
goto release_request;
 
+   g_free(request-data_path);
+
+   request-data_path = g_strdup_printf(%s/.mms/%s/%s, g_get_home_dir(),
+   service-identity, msg-uuid);
+
meta = mms_store_meta_open(service-identity, msg-uuid);
if (meta == NULL)
goto release_request;
@@ -768,11 +773,6 @@ static DBusMessage *send_message(DBusConnection *conn,
 
release_attachement_data(msg-attachments);
 
-   g_free(request-data_path);
-
-   request-data_path = g_strdup_printf(%s/.mms/%s/%s, g_get_home_dir(),
-   service-identity, msg-uuid);
-
g_queue_push_tail(service-request_queue, request);
 
activate_bearer(service);
@@ -789,6 +789,7 @@ static DBusMessage *send_message(DBusConnection *conn,
return reply;
 
 release_request:
+   unlink(request-data_path);
mms_request_destroy(request);
 
 release_msg:
-- 
1.7.4.4

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH v2 0/6] mmsd: bug fixing in send message recovery

2012-03-23 Thread Sébastien Bianti
This series concerns mmsd for ofono mailing list.

Patch 1 to 3 fix some leaks when a problem arises when a send request is
created.
Patch 4 to 6 fix some mistakes in send message recovery.

Sébastien Bianti (6):
  service: remove dead file
  service: fixed possible meta with NULL uuid
  service: remove pdu without meta
  service: request_post_file opens the pdu itself
  service: fix some leaks
  service: request needs to keep msg

 src/service.c |   29 +++--
 1 files changed, 23 insertions(+), 6 deletions(-)

-- 
1.7.4.4

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH v2 1/6] service: remove dead file

2012-03-23 Thread Sébastien Bianti
---
 src/service.c |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/src/service.c b/src/service.c
index ef6b544..3fdf4e0 100644
--- a/src/service.c
+++ b/src/service.c
@@ -755,6 +755,7 @@ static DBusMessage *send_message(DBusConnection *conn,
release_attachement_data(msg-attachments);
mms_message_free(msg);
 
+   unlink(request-data_path);
mms_request_destroy(request);
 
return __mms_error_trans_failure(dbus_msg);
-- 
1.7.4.4

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH v2 2/6] service: fixed possible meta with NULL uuid

2012-03-23 Thread Sébastien Bianti
If mms_store_file fails.
---
 src/service.c |9 +
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/src/service.c b/src/service.c
index 3fdf4e0..0161ec0 100644
--- a/src/service.c
+++ b/src/service.c
@@ -767,6 +767,15 @@ static DBusMessage *send_message(DBusConnection *conn,
 
msg-uuid = g_strdup(mms_store_file(service-identity,
request-data_path));
+   if (msg-uuid == NULL) {
+   release_attachement_data(msg-attachments);
+   mms_message_free(msg);
+
+   unlink(request-data_path);
+   mms_request_destroy(request);
+
+   return __mms_error_trans_failure(dbus_msg);
+   }
 
meta = mms_store_meta_open(service-identity, msg-uuid);
if (meta == NULL) {
-- 
1.7.4.4

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH v2 3/6] service: remove pdu without meta

2012-03-23 Thread Sébastien Bianti
---
 src/service.c |   11 ++-
 1 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/src/service.c b/src/service.c
index 0161ec0..8dbee12 100644
--- a/src/service.c
+++ b/src/service.c
@@ -777,11 +777,17 @@ static DBusMessage *send_message(DBusConnection *conn,
return __mms_error_trans_failure(dbus_msg);
}
 
+   g_free(request-data_path);
+
+   request-data_path = g_strdup_printf(%s/.mms/%s/%s, g_get_home_dir(),
+   service-identity, msg-uuid);
+
meta = mms_store_meta_open(service-identity, msg-uuid);
if (meta == NULL) {
release_attachement_data(msg-attachments);
mms_message_free(msg);
 
+   unlink(request-data_path);
mms_request_destroy(request);
 
return __mms_error_trans_failure(dbus_msg);
@@ -804,11 +810,6 @@ static DBusMessage *send_message(DBusConnection *conn,
 
release_attachement_data(msg-attachments);
 
-   g_free(request-data_path);
-
-   request-data_path = g_strdup_printf(%s/.mms/%s/%s, g_get_home_dir(),
-   service-identity, msg-uuid);
-
g_queue_push_tail(service-request_queue, request);
 
activate_bearer(service);
-- 
1.7.4.4

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH v2 4/6] service: request_post_file opens the pdu itself

2012-03-23 Thread Sébastien Bianti
---
 src/service.c |1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/src/service.c b/src/service.c
index 8dbee12..2047008 100644
--- a/src/service.c
+++ b/src/service.c
@@ -1137,7 +1137,6 @@ static void process_message_on_start(struct mms_service 
*service,
 
request-data_path = mms_store_get_path(service_id,
uuid);
-   request-fd = open(request-data_path, O_RDONLY);
} else
request = NULL;
 register_sr:
-- 
1.7.4.4

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH v2 5/6] service: fix some leaks

2012-03-23 Thread Sébastien Bianti
---
 src/service.c |5 +
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/src/service.c b/src/service.c
index 2047008..a68516d 100644
--- a/src/service.c
+++ b/src/service.c
@@ -1135,6 +1135,11 @@ static void process_message_on_start(struct mms_service 
*service,
if (request == NULL)
goto register_sr;
 
+   close(request-fd);
+   request-fd = -1;
+
+   unlink(request-data_path);
+   g_free(request-data_path);
request-data_path = mms_store_get_path(service_id,
uuid);
} else
-- 
1.7.4.4

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH 0/3] mmsd: removing dead files

2012-03-20 Thread Sébastien Bianti
These patches concern mmsd for ofono mailing list.

Sébastien Bianti (3):
  service: remove dead file
  service: fixed possible meta with NULL uuid
  service: remove pdu without meta

 src/service.c |   21 -
 1 files changed, 16 insertions(+), 5 deletions(-)

-- 
1.7.4.4

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH 1/3] service: remove dead file

2012-03-20 Thread Sébastien Bianti
---
 src/service.c |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/src/service.c b/src/service.c
index ef6b544..3fdf4e0 100644
--- a/src/service.c
+++ b/src/service.c
@@ -755,6 +755,7 @@ static DBusMessage *send_message(DBusConnection *conn,
release_attachement_data(msg-attachments);
mms_message_free(msg);
 
+   unlink(request-data_path);
mms_request_destroy(request);
 
return __mms_error_trans_failure(dbus_msg);
-- 
1.7.4.4

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH 2/3] service: fixed possible meta with NULL uuid

2012-03-20 Thread Sébastien Bianti
If mms_store_file fails.
---
 src/service.c |9 +
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/src/service.c b/src/service.c
index 3fdf4e0..0161ec0 100644
--- a/src/service.c
+++ b/src/service.c
@@ -767,6 +767,15 @@ static DBusMessage *send_message(DBusConnection *conn,
 
msg-uuid = g_strdup(mms_store_file(service-identity,
request-data_path));
+   if (msg-uuid == NULL) {
+   release_attachement_data(msg-attachments);
+   mms_message_free(msg);
+
+   unlink(request-data_path);
+   mms_request_destroy(request);
+
+   return __mms_error_trans_failure(dbus_msg);
+   }
 
meta = mms_store_meta_open(service-identity, msg-uuid);
if (meta == NULL) {
-- 
1.7.4.4

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH 3/3] service: remove pdu without meta

2012-03-20 Thread Sébastien Bianti
---
 src/service.c |   11 ++-
 1 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/src/service.c b/src/service.c
index 0161ec0..8dbee12 100644
--- a/src/service.c
+++ b/src/service.c
@@ -777,11 +777,17 @@ static DBusMessage *send_message(DBusConnection *conn,
return __mms_error_trans_failure(dbus_msg);
}
 
+   g_free(request-data_path);
+
+   request-data_path = g_strdup_printf(%s/.mms/%s/%s, g_get_home_dir(),
+   service-identity, msg-uuid);
+
meta = mms_store_meta_open(service-identity, msg-uuid);
if (meta == NULL) {
release_attachement_data(msg-attachments);
mms_message_free(msg);
 
+   unlink(request-data_path);
mms_request_destroy(request);
 
return __mms_error_trans_failure(dbus_msg);
@@ -804,11 +810,6 @@ static DBusMessage *send_message(DBusConnection *conn,
 
release_attachement_data(msg-attachments);
 
-   g_free(request-data_path);
-
-   request-data_path = g_strdup_printf(%s/.mms/%s/%s, g_get_home_dir(),
-   service-identity, msg-uuid);
-
g_queue_push_tail(service-request_queue, request);
 
activate_bearer(service);
-- 
1.7.4.4

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH 0/1] mmsd TODO

2012-03-13 Thread Sébastien Bianti
The following patch concerns mmsd (for ofono mailing list).

Sébastien Bianti (1):
  TODO: remove completed tasks

 TODO |   59 ---
 1 files changed, 0 insertions(+), 59 deletions(-)

-- 
1.7.4.4

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH 1/1] TODO: remove completed tasks

2012-03-13 Thread Sébastien Bianti
---
 TODO |   59 ---
 1 files changed, 0 insertions(+), 59 deletions(-)

diff --git a/TODO b/TODO
index c202d13..42e25a6 100644
--- a/TODO
+++ b/TODO
@@ -19,42 +19,7 @@ Background
 MMS Submission
 ==
 
-- Add HTTP GWeb POST request support.
-  This feature integration should be consistent with what has already be done
-  for the HTTP GWeb GET request support.
-
-  Priority: High
-  Complexity: C2
-  Owner: Sebastien Bianti sebastien.bia...@linux.intel.com
-
-- Add MMS M-Send.Req PDU encoding support.
-  The M-Send.Req PDU has to be encoded from the data retrieved in the
-  mms_message structure into a temporary file. The encoding has to be
-  consistent with the encoding of the already existing M-NotifyResp.Ind PDU
-  encoding implementation.
-
-  Priority: High
-  Complexity: C2
-  Owner: Ronald Tessier ronald.tess...@linux.intel.com
-
 - Add MMS submit support.
-  Upon the reception of a Dbus Service: SendMessage Request, the mms_message
-  structure is filled with the information extracted from the D-Bus request.
-  A new D-Bus MMS message object is registered, and a Dbus Service Signal
-  “MessageAdded” is emitted. This implementation needs to be completed with the
-  the encoding of a M-Send-Req PDU (requires to generate a transaction id),
-  its addition to the store and the creation of a new entry in the META file
-  (status: draft). A HTTP POST request must be initiated to send the M-Send-Req
-  PDU to the MMSC. The HTTP POST request callback has to be implemented to
-  process the request result.
-  If the HTTP POST request is completed successfully, the HTTP POST response
-  result file (M-Send.Conf) PDU must be decoded to get the request result
-  (a message id should also be provided in this case, and may be stored in the
-  META information), if the submit request has been accepted by the MMSC the
-  META file entry for the M-Send-Req must be updated (status: draft - sent),
-  the MMS message object status property changed (status: draft - sent) and
-  the Dbus Service: SendMessage Request asynchronous reply sent back to the
-  caller.
   In case of error (HTTP communication error, MMSC rejection of the submit
   request), the SendMessage Request asynchronous reply should also be sent with
   the appropriate DBus error status (see __mms_error_).
@@ -69,23 +34,6 @@ MMS Reception
 =
 
 - Add MMS Automatic Retrieval support.
-  Add the M-Notify.Ind PDU entry to the META file (status: notify.ind).
-  Initiate a HTTP GET Request with the Content Location URI provided in the
-  M-Notify.Ind PDU.
-  Implement the HTTP GET request callback to process the request result.
-  if the the HTTP GET operation is completed successfully, the retrieved
-  M-Retrieve.Conf PDU file has to be parsed and added to the store.
-  META file has to be updated too: the M-Notify.Ind PDU entry has to be removed
-  and a new entry for the M-Retrieve.Conf PDU has to be created
-  (status: retrieve.conf).
-  In order to complete the transaction a M-NotifyResp.ind PDU must be encoded
-  with the retrieved status and the M-Notify.Ind PDU transaction ID.
-  This PDU has to be temporarily stored.
-  A HTTP POST request must be initiated to send the M-NotifyResp.ind PDU to the
-  MMSC. If the HTTP POST request is completed successfully the META file entry
-  for the M-Retrieve.Conf PDU has to be updated (status: retrieve.conf -
-  received), a DBus Message object has to be registered (see 
-  mms_message_register()) and the Dbus Service Signal “MessageAdded” emitted.
   Error cases should handled and reported to the application layer.
 
   Priority: High
@@ -112,13 +60,6 @@ MMS Storage
 D-Bus API
 =
 
-- Add the org.ofono.mms.Message interface implementation.
-  The D-Bus Message API documentation is available under /doc/message-api.txt.
-
-  Priority: High
-  Complexity: C2
-  Owner: Ronald Tessier ronald.tess...@linux.intel.com
-
 - Add the org.ofono.mms.Service interface GetConversation method 
   implementation.
   The D-Bus Message API documentation is available under /doc/service-api.txt.
-- 
1.7.4.4

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH 0/1] mmsd

2012-03-09 Thread Sébastien Bianti
This patch concerns mmsd (for ofono mailing list) and fixes a double free.

Sébastien Bianti (1):
  service: mms_request_destroy shouldn't free msg

 src/service.c |7 ---
 1 files changed, 4 insertions(+), 3 deletions(-)

-- 
1.7.4.4

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH 1/1] service: mms_request_destroy shouldn't free msg

2012-03-09 Thread Sébastien Bianti
mms_message is referenced in the hash table mms_service-messages
---
 src/service.c |7 ---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/service.c b/src/service.c
index affe454..ef6b544 100644
--- a/src/service.c
+++ b/src/service.c
@@ -115,9 +115,6 @@ static void mms_request_destroy(struct mms_request *request)
 {
g_free(request-data_path);
g_free(request-location);
-   if (request-msg != NULL)
-   mms_message_free(request-msg);
-
g_free(request);
 }
 
@@ -756,6 +753,8 @@ static DBusMessage *send_message(DBusConnection *conn,
 
if (mms_message_encode(msg, request-fd) == FALSE) {
release_attachement_data(msg-attachments);
+   mms_message_free(msg);
+
mms_request_destroy(request);
 
return __mms_error_trans_failure(dbus_msg);
@@ -771,6 +770,8 @@ static DBusMessage *send_message(DBusConnection *conn,
meta = mms_store_meta_open(service-identity, msg-uuid);
if (meta == NULL) {
release_attachement_data(msg-attachments);
+   mms_message_free(msg);
+
mms_request_destroy(request);
 
return __mms_error_trans_failure(dbus_msg);
-- 
1.7.4.4

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono