All of lore.kernel.org
 help / color / mirror / Atom feed
From: Denis Kenzior <denkenz@gmail.com>
To: ofono@ofono.org
Subject: Re: [RFC PATCH 5/6] Support for concatenated SMS status report.
Date: Fri, 04 Jun 2010 17:04:33 -0500	[thread overview]
Message-ID: <201006041704.34509.denkenz@gmail.com> (raw)
In-Reply-To: <1275650257-30593-6-git-send-email-pasi.miettinen@ixonos.com>

[-- Attachment #1: Type: text/plain, Size: 3561 bytes --]

Hi Pasi,

> ---
>  include/history.h |    2 +
>  src/sms.c         |   67 ++++++++++++++++++++----
>  src/smsutil.c     |  152
>  +++++++++++++++++++++++++++++++++++++++++++++++++++++ src/smsutil.h     
| 
>   32 +++++++++++

Please break this up into at least 3 patches:
- include/history api change
- smsutil changes
- sms core atom changes

Ideally I'd also like to see a unit test for smsutil parts in the series.
> +void add_pending_status_report(GSList **pending_status_reports, const int
>  mr, +					const unsigned int msg_id,
> +					const struct sms_address *receiver);
> +
> +void free_pending_status_report(struct pending_status_report
>  *status_report, +				GSList **pending_status_reports);
> +
> +enum ofono_history_sms_status update_pending_status_report_mr_number(
> +		GSList **pending_status_reports, const guint8 mr,
> +		const struct sms_address *receiver,
> +		const enum sms_status_report_result status_report_result,
> +		unsigned int *relating_msg_id);
> +

So my first suggestion here is to make the status report assembly into its own 
class.  This way you can mess around with the internal data structures and 
optimize them later if needed without breaking the rest of the code.

This is also where unit tests come in. Once you have something working, you 
can optimize and make sure things still work... without affecting the rest of 
the code.

I suggest thinking about the data structure use some more.  In particular, 
using a list of struct mr_numbers is very inefficient.  Using a pair of bitmaps 
for mr numbers (which can only be 0..255) would be way more efficient and 
probably would make the code much easier to write.

Consider if making multi-level data structures would increase efficiency.  E.g. 
Hastable[destination_address] = list of structures mapping between message id 
and message references.  Or anything else efficient you can come up with.

Having said that, don't over-complicate it in the beginning.  Having something 
good enough and working is better.

For the object interface I suggest something like:

struct status_report_assembly;

- Creates a new assembly object, and populates pending status reports from the 
imsi-keyed store.  If imsi is NULL, no status reports are saved or loaded from 
disk.  This is useful for pseudo-modems:
struct status_report_assembly *status_report_assembly_new(const char *imsi);

- Frees the assembly:
void status_report_assembly_free(struct status_report_assembly *assembly);

- Just a thought, but some networks simply don't support status reports, so we 
need to expire status reports for messages that have lived past their validity 
period:
void status_report_assembly_expire(struct status_report_assembly *assembly,
								time_t before, (GFunc) foreach_func,
								gpointer data);

- Add a status report to the assembly and return whether this resulted in a 
message being delivered / not:
gboolean status_report_assembly_report(struct status_report_assembly 
*assembly,
										const struct sms *status_report,
										unsigned int *msg_id,
										enum sms_st *status)

- Add a message fragment to the assembly for tracking:
void status_report_assembly_add_fragment(struct status_report_assembly 
*assembly,
										unsigned int *msg_id,
										struct sms_address *to,
										unsigned char mr,
										time_t expiration);

Feel free to modify the above as needed, this is just something I came up with 
while reviewing your patch.

Regards,
-Denis

  parent reply	other threads:[~2010-06-04 22:04 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-04 11:17 Next series of delivery report patches Pasi Miettinen
2010-06-04 11:17 ` [RFC PATCH 1/6] Change in at_cds_notify for status report Pasi Miettinen
2010-06-04 11:17   ` [RFC PATCH 2/6] Add IncomingStatusReport a{sv} signal Pasi Miettinen
2010-06-04 11:17     ` [RFC PATCH 3/6] Support for basic SMS Status Report Pasi Miettinen
2010-06-04 11:17       ` [RFC PATCH 4/6] SetProperty for UseDeliveryReports Pasi Miettinen
2010-06-04 11:17         ` [RFC PATCH 5/6] Support for concatenated SMS status report Pasi Miettinen
2010-06-04 11:17           ` [RFC PATCH 6/6] Save pending SMS Status Reports to disk Pasi Miettinen
2010-06-04 22:04           ` Denis Kenzior [this message]
2010-06-05  5:57             ` VS: [RFC PATCH 5/6] Support for concatenated SMS status report Miettinen Pasi
2010-06-07 12:22             ` Miettinen Pasi
2010-06-07 13:02               ` Miettinen Pasi
2010-06-07 17:45               ` Denis Kenzior
2010-06-04 17:08         ` [RFC PATCH 4/6] SetProperty for UseDeliveryReports Denis Kenzior
2010-06-04 17:01       ` [RFC PATCH 3/6] Support for basic SMS Status Report Denis Kenzior
2010-06-04 16:58     ` [RFC PATCH 2/6] Add IncomingStatusReport a{sv} signal Denis Kenzior
2010-06-04 16:52   ` [RFC PATCH 1/6] Change in at_cds_notify for status report Denis Kenzior
2010-06-04 11:28 ` VS: Next series of delivery report patches Miettinen Pasi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201006041704.34509.denkenz@gmail.com \
    --to=denkenz@gmail.com \
    --cc=ofono@ofono.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.