summaryrefslogtreecommitdiffstats
path: root/plugins/push-notification.c
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2010-12-24 10:48:30 -0800
committerMarcel Holtmann <marcel@holtmann.org>2010-12-24 10:48:30 -0800
commit3950052dfcaf07d35306801a9d6563705f3cdf59 (patch)
tree1f76183f17baef3990069b156ed8d4d853f178f2 /plugins/push-notification.c
parentc7963f1c00b93e68795ff88de989705cc4ec17ae (diff)
downloadofono-3950052dfcaf07d35306801a9d6563705f3cdf59.tar.bz2
push-notification: Handle notifications with source port 0
It seesm that some networks send the push notifications with a source port of 0 instead of 9200. Instead of accepting any source port, add an additional datagram handler for the source port 0.
Diffstat (limited to 'plugins/push-notification.c')
-rw-r--r--plugins/push-notification.c25
1 files changed, 19 insertions, 6 deletions
diff --git a/plugins/push-notification.c b/plugins/push-notification.c
index 5832933f..d910f709 100644
--- a/plugins/push-notification.c
+++ b/plugins/push-notification.c
@@ -40,6 +40,7 @@
#define PUSH_NOTIFICATION_INTERFACE "org.ofono.PushNotification"
#define AGENT_INTERFACE "org.ofono.PushNotificationAgent"
+
#define WAP_PUSH_SRC_PORT 9200
#define WAP_PUSH_DST_PORT 2948
@@ -49,16 +50,21 @@ struct push_notification {
struct ofono_modem *modem;
struct ofono_sms *sms;
struct sms_agent *agent;
- unsigned int push_watch;
+ unsigned int push_watch[2];
};
static void agent_exited(void *userdata)
{
struct push_notification *pn = userdata;
- if (pn->push_watch > 0) {
- __ofono_sms_datagram_watch_remove(pn->sms, pn->push_watch);
- pn->push_watch = 0;
+ if (pn->push_watch[0] > 0) {
+ __ofono_sms_datagram_watch_remove(pn->sms, pn->push_watch[0]);
+ pn->push_watch[0] = 0;
+ }
+
+ if (pn->push_watch[1] > 0) {
+ __ofono_sms_datagram_watch_remove(pn->sms, pn->push_watch[1]);
+ pn->push_watch[1] = 0;
}
pn->agent = NULL;
@@ -107,11 +113,17 @@ static DBusMessage *push_notification_register_agent(DBusConnection *conn,
sms_agent_set_removed_notify(pn->agent, agent_exited, pn);
- pn->push_watch = __ofono_sms_datagram_watch_add(pn->sms, push_received,
+ pn->push_watch[0] = __ofono_sms_datagram_watch_add(pn->sms,
+ push_received,
WAP_PUSH_DST_PORT,
WAP_PUSH_SRC_PORT,
pn, NULL);
+ pn->push_watch[1] = __ofono_sms_datagram_watch_add(pn->sms,
+ push_received,
+ WAP_PUSH_DST_PORT,
+ 0, pn, NULL);
+
return dbus_message_new_method_return(msg);
}
@@ -151,7 +163,8 @@ static void push_notification_cleanup(gpointer user)
DBG("%p", pn);
/* The push watch was already cleaned up */
- pn->push_watch = 0;
+ pn->push_watch[0] = 0;
+ pn->push_watch[1] = 0;
pn->sms = NULL;
sms_agent_free(pn->agent);