Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp4606055ybv; Mon, 10 Feb 2020 23:32:36 -0800 (PST) X-Google-Smtp-Source: APXvYqwZ2s4SI+j9p69y1paWgrL3Twuns5yz2qEj7+FBEVpRQbfx9cQDHbwDe+oQtWttO8jaVsum X-Received: by 2002:a05:6808:aac:: with SMTP id r12mr2089884oij.59.1581406356083; Mon, 10 Feb 2020 23:32:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581406356; cv=none; d=google.com; s=arc-20160816; b=s2NAg/iVm99ZFdf6+U89JpBwKEHYY5XnJi4IBZrPVRqHTkuLv5FamHXV6LO8spNedK VnP+dPJSldwqax8PScyznd0cjHBQWAsF4kF6q2YRnZ1Esq7iqKbF2P/ajy58SfRYapmv KLBtoBqcbjw6C4T/Zu5m04ZKfqp0ter+3IA6cbmfBYMv0AvkMgvxefLbCoBTBXHLsin1 nBH8+klxs2kdc0Fq2z5TZgPrv1lJxYYj4ajzTnfyoFUV9AIA5aYkBNaCJhCTsjgtKxv3 9bYTRCCsPxe04mR78jc6xKtKzG8oq5CImBaLdRZu5jEA/ZSp2sRW30sMNM6TJlbPeas4 7gHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:to:from; bh=efFwjOh6f8KFyhF/Z6yxaUKLzfHJH5Ah/1Oo41XK3E4=; b=PWj6g49Qtv2eP4Lkii8UP+GdLM/A1myEK1ueFqevOtwlbch9+ixlZshnDqorQPx+Mg uQeBFBMe1Jk4fPFMNompBfyFwzRi+aWIQIhR5z2WJZyiUK8juttPgKEHehaTXZuI04IS YUXrzH5BQjmAXwUe9btnOfQgDXUNN/gkhHZW9A/vEvwxxZcTTaL72Qlm7NfqH+z79FBk dDpsMkjEPfYZ/Dh7kcQEjCKjFPrQDf/sUwZkb1nWyynvrH5weu213ynIKAegmTHEeSrr Rd9IihkX5nhMjbMQMIdO0AYQbd978/e/XJSjeiCeHHX2JghqBlHsXFRtNEgP0J7RsBgE UXuA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e77si1616436ote.153.2020.02.10.23.32.24; Mon, 10 Feb 2020 23:32:36 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727994AbgBKG7F (ORCPT + 99 others); Tue, 11 Feb 2020 01:59:05 -0500 Received: from mga05.intel.com ([192.55.52.43]:10653 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727784AbgBKG7F (ORCPT ); Tue, 11 Feb 2020 01:59:05 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 10 Feb 2020 22:59:03 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,427,1574150400"; d="scan'208";a="405849858" Received: from unknown (HELO ajay-desktop.iind.intel.com) ([10.223.96.133]) by orsmga005.jf.intel.com with ESMTP; 10 Feb 2020 22:59:02 -0800 From: Ajay Kishore To: linux-bluetooth@vger.kernel.org Subject: [PATCH v2 2/6] obexd: Add parsers for conversation filters Date: Tue, 11 Feb 2020 12:06:06 +0530 Message-Id: <1581402970-1781-2-git-send-email-ajay.kishore@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1581402970-1781-1-git-send-email-ajay.kishore@intel.com> References: <1581402970-1781-1-git-send-email-ajay.kishore@intel.com> Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org Changes made to add a new method to parse the map conversation filters. Filters LastActivityBegin and LastActivityEnd is used to filter the conversations that are returned in the Conversation-Listing object by LastActivity. --- obexd/client/map.c | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++++-- obexd/src/map_ap.h | 3 +++ 2 files changed, 67 insertions(+), 2 deletions(-) diff --git a/obexd/client/map.c b/obexd/client/map.c index adf62d9..6e84a73 100644 --- a/obexd/client/map.c +++ b/obexd/client/map.c @@ -1369,6 +1369,21 @@ static GObexApparam *parse_filter_type(GObexApparam *apparam, types); } +static GObexApparam *parse_la_begin(GObexApparam *apparam, + DBusMessageIter *iter) +{ + const char *string; + + if (dbus_message_iter_get_arg_type(iter) != DBUS_TYPE_STRING) + return NULL; + + dbus_message_iter_get_basic(iter, &string); + + return g_obex_apparam_set_string(apparam, + MAP_AP_FILTERLASTACTIVITYBEGIN, + string); +} + static GObexApparam *parse_period_begin(GObexApparam *apparam, DBusMessageIter *iter) { @@ -1397,6 +1412,20 @@ static GObexApparam *parse_period_end(GObexApparam *apparam, string); } +static GObexApparam *parse_la_end(GObexApparam *apparam, + DBusMessageIter *iter) +{ + const char *string; + + if (dbus_message_iter_get_arg_type(iter) != DBUS_TYPE_STRING) + return NULL; + + dbus_message_iter_get_basic(iter, &string); + + return g_obex_apparam_set_string(apparam, MAP_AP_FILTERLASTACTIVITYEND, + string); +} + static GObexApparam *parse_filter_read(GObexApparam *apparam, DBusMessageIter *iter) { @@ -1560,6 +1589,19 @@ static DBusMessage *map_list_messages(DBusConnection *connection, return get_message_listing(map, message, folder, apparam); } +static GObexApparam *parse_filter_conv_id(GObexApparam *apparam, + DBusMessageIter *iter) +{ + guint8 id; + + if (dbus_message_iter_get_arg_type(iter) != DBUS_TYPE_BYTE) + return NULL; + + dbus_message_iter_get_basic(iter, &id); + + return g_obex_apparam_set_uint8(apparam, MAP_AP_CONVERSATIONID, id); +} + static GObexApparam *parse_conversation_filters(GObexApparam *apparam, DBusMessageIter *iter) { @@ -1582,8 +1624,28 @@ static GObexApparam *parse_conversation_filters(GObexApparam *apparam, dbus_message_iter_next(&entry); dbus_message_iter_recurse(&entry, &value); - /* TODO: Parse conversation filters */ - + if (strcasecmp(key, "Offset") == 0) { + if (parse_offset(apparam, &value) == NULL) + return NULL; + } else if (strcasecmp(key, "MaxCount") == 0) { + if (parse_max_count(apparam, &value) == NULL) + return NULL; + } else if (strcasecmp(key, "LastActivityBegin") == 0) { + if (parse_la_begin(apparam, &value) == NULL) + return NULL; + } else if (strcasecmp(key, "FilterLastActivityEnd") == 0) { + if (parse_la_end(apparam, &value) == NULL) + return NULL; + } else if (strcasecmp(key, "Read") == 0) { + if (parse_filter_read(apparam, &value) == NULL) + return NULL; + } else if (strcasecmp(key, "Recipient") == 0) { + if (parse_filter_recipient(apparam, &value) == NULL) + return NULL; + } else if (strcasecmp(key, "ConversationId") == 0) { + if (parse_filter_conv_id(apparam, &value) == NULL) + return NULL; + } dbus_message_iter_next(&array); } return apparam; diff --git a/obexd/src/map_ap.h b/obexd/src/map_ap.h index da108fe..3773859 100644 --- a/obexd/src/map_ap.h +++ b/obexd/src/map_ap.h @@ -31,6 +31,8 @@ enum map_ap_tag { MAP_AP_FILTERREADSTATUS = 0x06, /* uint8_t */ MAP_AP_FILTERRECIPIENT = 0x07, /* char * */ MAP_AP_FILTERORIGINATOR = 0x08, /* char * */ + MAP_AP_FILTERLASTACTIVITYBEGIN = 0x08, /* char * */ + MAP_AP_FILTERLASTACTIVITYEND = 0x09, /* char * */ MAP_AP_FILTERPRIORITY = 0x09, /* uint8_t */ MAP_AP_ATTACHMENT = 0x0A, /* uint8_t */ MAP_AP_TRANSPARENT = 0x0B, /* uint8_t */ @@ -48,4 +50,5 @@ enum map_ap_tag { MAP_AP_STATUSINDICATOR = 0x17, /* uint8_t */ MAP_AP_STATUSVALUE = 0x18, /* uint8_t */ MAP_AP_MSETIME = 0x19, /* char * */ + MAP_AP_CONVERSATIONID = 0x1C, /* uint32_t */ }; -- 2.7.4