upload tizen1.0 source
authorKim Kibum <kb0929.kim@samsung.com>
Sun, 29 Apr 2012 08:01:42 +0000 (17:01 +0900)
committerKim Kibum <kb0929.kim@samsung.com>
Sun, 29 Apr 2012 08:01:42 +0000 (17:01 +0900)
23 files changed:
client/ftp.c
client/main.c
client/manager.c
client/map.c
client/pbap.c
client/session.c
client/sync.c
client/transfer.c
debian/changelog
debian/obexd-doc.debhelper.log
gobex/gobex-transfer.c
gobex/gobex.c
packaging/obexd.spec
plugins/bmessage-parser.h [new file with mode: 0644]
plugins/mas.c
plugins/messages-tizen.c
plugins/messages.h
plugins/pcsuite.c
plugins/phonebook-tizen.c
src/manager.c
src/map_ap.c
src/map_ap.h
src/obexd.service.in

index 20d363d..336fc26 100644 (file)
@@ -515,11 +515,7 @@ int ftp_init(void)
 
        DBG("");
 
-#ifdef TIZEN_PATCH
-       conn = dbus_bus_get(DBUS_BUS_SYSTEM, NULL);
-#else
        conn = dbus_bus_get(DBUS_BUS_SESSION, NULL);
-#endif
        if (!conn)
                return -EIO;
 
index 9ca7656..80f9413 100644 (file)
 #include <glib.h>
 #include <gdbus.h>
 
-#ifdef TIZEN_PATCH
-#include <sys/types.h>
-#include <grp.h>
-#include <pwd.h>
-#include <unistd.h>
-#endif
 #include "log.h"
 #include "manager.h"
 
@@ -91,49 +85,6 @@ int main(int argc, char *argv[])
 
        g_option_context_free(context);
 
-#ifdef TIZEN_PATCH
-       if (getuid() == 0) {
-               /* current user is 'root' */
-               #define INHOUSE_USER "app"
-               #define INHOUSE_GROUP "app"
-               #define BUFFER_SIZE 200
-
-               char buffer[BUFFER_SIZE] = {0};
-
-               struct group gr;
-               struct group *gr_result;
-               struct passwd pw;
-               struct passwd *pw_result;
-
-               if (getpwnam_r(INHOUSE_USER, &pw, buffer, BUFFER_SIZE, &pw_result) != 0) {
-                   DBG("Failed to find user '%s'.", INHOUSE_USER);
-               }
-
-               memset(buffer, 0x00, BUFFER_SIZE);
-
-               if (getgrnam_r(INHOUSE_GROUP, &gr, buffer, BUFFER_SIZE, &gr_result) != 0) {
-                   DBG("Failed to find group '%s'.", INHOUSE_GROUP);
-               }
-
-               if (pw_result && gr_result) {
-                       DBG("Found user '%s' (UID %lu) and group '%s' (GID %lu).",
-                                   INHOUSE_USER, (unsigned long) pw.pw_uid,
-                                   INHOUSE_GROUP, (unsigned long) gr.gr_gid);
-
-                       if (pw.pw_gid != gr.gr_gid)
-                           DBG("GID of user '%s' and of group '%s' don't match.", INHOUSE_USER, INHOUSE_GROUP);
-
-                       if (initgroups(INHOUSE_USER, gr.gr_gid) != 0)
-                           DBG("Failed to change group list");
-
-                       if(setgid(gr.gr_gid) != 0)
-                               DBG("[ERR] fail to execute setgid().\n");
-
-                       if(setuid(pw.pw_uid) != 0)
-                               DBG("[ERR] fail to execute setuid().\n");
-               }
-       }
-#endif
        event_loop = g_main_loop_new(NULL, FALSE);
 
        __obex_log_init("obex-client", option_debug, !option_stderr);
index 88b0d5c..54fea72 100644 (file)
@@ -632,11 +632,7 @@ int manager_init(void)
 
        dbus_error_init(&derr);
 
-#ifdef TIZEN_PATCH
-       conn = g_dbus_setup_bus(DBUS_BUS_SYSTEM, CLIENT_SERVICE, &derr);
-#else
        conn = g_dbus_setup_bus(DBUS_BUS_SESSION, CLIENT_SERVICE, &derr);
-#endif
        if (dbus_error_is_set(&derr) == TRUE) {
                error("%s: %s", derr.name, derr.message);
                dbus_error_free(&derr);
index 5c8deb7..cdd2725 100644 (file)
@@ -248,11 +248,7 @@ int map_init(void)
 
        DBG("");
 
-#ifdef TIZEN_PATCH
-       conn = dbus_bus_get(DBUS_BUS_SYSTEM, NULL);
-#else
        conn = dbus_bus_get(DBUS_BUS_SESSION, NULL);
-#endif
        if (!conn)
                return -EIO;
 
index 580f30c..fc19ac8 100644 (file)
@@ -1106,11 +1106,7 @@ int pbap_init(void)
        int err;
 
        DBG("");
-#ifdef TIZEN_PATCH
-       conn = dbus_bus_get(DBUS_BUS_SYSTEM, NULL);
-#else
        conn = dbus_bus_get(DBUS_BUS_SESSION, NULL);
-#endif
        if (!conn)
                return -EIO;
 
index e9f8d03..395829a 100644 (file)
@@ -806,11 +806,7 @@ struct obc_session *obc_session_create(const char *source,
 
        session->refcount = 1;
        session->channel = channel;
-#ifdef TIZEN_PATCH
-       session->conn = dbus_bus_get(DBUS_BUS_SYSTEM, NULL);
-#else
        session->conn = dbus_bus_get(DBUS_BUS_SESSION, NULL);
-#endif
        if (session->conn == NULL) {
                session_free(session);
                return NULL;
index 85f792d..7675b23 100644 (file)
@@ -222,11 +222,7 @@ int sync_init(void)
 
        DBG("");
 
-#ifdef TIZEN_PATCH
-       conn = dbus_bus_get(DBUS_BUS_SYSTEM, NULL);
-#else
        conn = dbus_bus_get(DBUS_BUS_SESSION, NULL);
-#endif
        if (!conn)
                return -EIO;
 
index 4388529..bd9870d 100644 (file)
@@ -140,7 +140,6 @@ static void obc_transfer_abort(struct obc_transfer *transfer)
        g_obex_cancel_transfer(transfer->xfer);
        transfer->xfer = 0;
 
-#ifndef TIZEN_PATCH
        if (callback) {
                GError *err;
 
@@ -150,7 +149,6 @@ static void obc_transfer_abort(struct obc_transfer *transfer)
                                                        callback->data);
                g_error_free(err);
        }
-#endif
 }
 
 static DBusMessage *obc_transfer_cancel(DBusConnection *connection,
@@ -241,11 +239,7 @@ struct obc_transfer *obc_transfer_register(DBusConnection *conn,
 
        transfer->path = g_strdup_printf("%s/transfer%ju",
                        TRANSFER_BASEPATH, counter++);
-#ifdef TIZEN_PATCH
-       transfer->conn = dbus_bus_get(DBUS_BUS_SYSTEM, NULL);
-#else
        transfer->conn = dbus_bus_get(DBUS_BUS_SESSION, NULL);
-#endif
        if (transfer->conn == NULL) {
                obc_transfer_free(transfer);
                return NULL;
index 9e7238b..65b716e 100644 (file)
@@ -1,3 +1,11 @@
+obexd (0.44-slp2+1-4) unstable; urgency=low
+
+  * Tizen 1.0 release
+  * Git: slp/pkgs/o/obexd
+  * Tag: obexd_0.44-slp2+1-4
+
+ -- DoHyun Pyun <dh79.pyun@samsung.com>  Tue, 20 Mar 2012 17:02:56 +0900
+
 obexd (0.44-slp2+1-3) unstable; urgency=low
 
   * samsung -> tizen
@@ -31,7 +39,7 @@ obexd (0.38-0maemo4) unstable; urgency=low
   * Added fix with removing unnecessary ?_key variable from queries
   * Added fix with new handling addresses and emails
   * Added fix with query cleanups (reduce number of columns)
+
  -- Radoslaw Jablonski <ext-jablonski.radoslaw@nokia.com>  Wed, 05 Jan 2011 16:35:45 +0200
 
 obexd (0.38-0maemo3) unstable; urgency=low
index 47a1ecc..77de4ac 100644 (file)
@@ -10,3 +10,4 @@ dh_installdocs
 dh_installdocs
 dh_installdocs
 dh_installdocs
+dh_installdocs
index 0a1339a..a779e4f 100644 (file)
@@ -633,14 +633,6 @@ gboolean g_obex_cancel_transfer(guint id)
        if (transfer == NULL)
                return FALSE;
 
-#ifdef TIZEN_PATCH
-       if (transfer->req_id > 0)
-               g_obex_cancel_req(transfer->obex, transfer->req_id, FALSE);
-       else
-               transfer_free(transfer);
-#else
        transfer_free(transfer);
-#endif
-
        return TRUE;
 }
index aa86f9e..4afc21b 100644 (file)
@@ -1316,7 +1316,11 @@ GObex *g_obex_ref(GObex *obex)
 
 void g_obex_unref(GObex *obex)
 {
+#ifdef TIZEN_PATCH
+       gboolean last_ref, ret;
+#else
        gboolean last_ref;
+#endif
 
        last_ref = g_atomic_int_dec_and_test(&obex->ref_count);
 
@@ -1327,6 +1331,14 @@ void g_obex_unref(GObex *obex)
 
        g_slist_free_full(obex->req_handlers, g_free);
 
+#ifdef TIZEN_PATCH
+       do {
+               ret = write_data(obex->io, G_IO_OUT, obex);
+               if (obex->pending_req && obex->pending_req->cancelled)
+                       break;
+       } while(ret);
+#endif
+
        g_queue_foreach(obex->tx_queue, (GFunc) pending_pkt_free, NULL);
        g_queue_free(obex->tx_queue);
 
index 245f399..0e37697 100644 (file)
@@ -1,10 +1,9 @@
-
 Name:       obexd
 Summary:    OBEX Server A basic OBEX server implementation
-Version:    0.40
+Version:    0.44
 Release:    1
 Group:      TO_BE/FILLED_IN
-License:    TO BE FILLED IN
+License:    GPL-2.0
 Source0:    obexd-%{version}.tar.gz
 BuildRequires:  pkgconfig(bluez) 
 BuildRequires:  pkgconfig(dbus-1)
@@ -16,14 +15,12 @@ BuildRequires:  pkgconfig(dbus-glib-1)
 OBEX Server A basic OBEX server implementation.
 
 
-
-
 %prep
-%setup -q -n %{name}-%{version}
+%setup -q
 
 
 %build
-export CFLAGS+="   -DDEBUG -DTIZEN_PATCH"
+export CFLAGS+=" -DDEBUG -DTIZEN_PATCH -DOPENSOURCE_PATCH"
 chmod +x bootstrap
 ./bootstrap && \
     ./configure \
@@ -34,17 +31,16 @@ chmod +x bootstrap
                 --mandir=/usr/share/man \
                 --sysconfdir=/etc \
                --with-phonebook=tizen \
-               --with-message=tizen
+               --with-messages=tizen
 make %{?jobs:-j%jobs}
 
+
 %install
-rm -rf %{buildroot}
 %make_install
 
+
 %files
 /usr/lib/obex/obex-client
 /usr/lib/obex/obexd
 /usr/share/dbus-1/services/obex-client.service
 /usr/share/dbus-1/services/obexd.service
-
-
diff --git a/plugins/bmessage-parser.h b/plugins/bmessage-parser.h
new file mode 100644 (file)
index 0000000..03da076
--- /dev/null
@@ -0,0 +1,95 @@
+/*
+ *
+ *  Bmessage parser.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ */
+
+#define BMESSAGE_VERSION "VERSION:1.0"
+
+enum bmessage_read_status {
+       BMESSAGE_STATUS_READ,
+       BMESSAGE_STATUS_UNREAD
+};
+
+enum bmessage_type {
+       BMESSAGE_TYPE_EMAIL,
+       BMESSAGE_TYPE_SMS_GSM,
+       BMESSAGE_TYPE_SMS_CDMA,
+       BMESSAGE_TYPE_MMS
+};
+
+enum bmessage_charset {
+       BMESSAGE_CHAR_UTF8,
+       BMESSAGE_CHAR_NONE
+};
+
+enum bmessage_encoding {
+       BMESSAGE_ENCODE_8BIT,
+       BMESSAGE_ENCODE_G_7BIT,
+       BMESSAGE_ENCODE_G_7BITEXT,
+       BMESSAGE_ENCODE_G_UCS2,
+       BMESSAGE_ENCODE_G_8BIT,
+       BMESSAGE_ENCODE_C_8BIT,
+       BMESSAGE_ENCODE_C_EPM,
+       BMESSAGE_ENCODE_C_7ASCII,
+       BMESSAGE_ENCODE_C_IA5,
+       BMESSAGE_ENCODE_C_UNICODE,
+       BMESSAGE_ENCODE_C_SJIS,
+       BMESSAGE_ENCODE_C_KOREAN,
+       BMESSAGE_ENCODE_C_LATINHEB,
+       BMESSAGE_ENCODE_C_LATIN,
+       BMESSAGE_ENCODE_NONE
+};
+
+enum bmessage_language {
+       BMESSAGE_LANGUAGE_TURKISH,
+       BMESSAGE_LANGUAGE_SPANISH,
+       BMESSAGE_LANGUAGE_PORTUGUESE,
+       BMESSAGE_LANGUAGE_ENGLISH,
+       BMESSAGE_LANGUAGE_FRENCH,
+       BMESSAGE_LANGUAGE_JAPANESE,
+       BMESSAGE_LANGUAGE_KOREAN,
+       BMESSAGE_LANGUAGE_CHINESE,
+       BMESSAGE_LANGUAGE_HEBREW,
+       BMESSAGE_LANGUAGE_UNKNOWN
+};
+
+enum bmessage_vcard_version {
+       BMSG_VCARD_21,
+       BMSG_VCARD_30
+};
+
+struct bmessage_vcard {
+       enum bmessage_vcard_version version;
+       char *n;
+       char *fn;
+       char *tel;
+       char *email;
+};
+
+struct bmessage_property {
+       GList *originators;
+       GList *recipients;
+       enum bmessage_read_status read_status;
+       enum bmessage_type type;
+       char *folder;
+       long int part_id;
+       enum bmessage_charset charset;
+       enum bmessage_encoding encoding;
+       enum bmessage_language language;
+       int body_length;
+};
index 8e470c1..9466039 100644 (file)
@@ -28,9 +28,6 @@
 #include <errno.h>
 #include <glib.h>
 #include <fcntl.h>
-#ifdef TIZEN_PATCH
-#include <string.h>
-#endif
 #include <inttypes.h>
 
 #include "obexd.h"
 #include "manager.h"
 
 #include "messages.h"
+#ifdef TIZEN_PATCH
+#include "map_ap.h"
+#include "bmessage-parser.h"
+#endif
 
 /* Channel number according to bluez doc/assigned-numbers.txt */
 #define MAS_CHANNEL    16
 #define ML_BODY_BEGIN "<MAP-msg-listing version=\"1.0\">"
 #define ML_BODY_END "</MAP-msg-listing>"
 
-#ifdef TIZEN_PATCH
-enum mas_apparam_tag {
-       MAXLISTCOUNT_T = 0x01,
-       STARTOFFSET_T = 0x02,
-       FILTERMESSAGETYPE_T = 0x03,
-       FILTERPERIODBEGIN_T = 0x04,
-       FILTERPERIODEND_T = 0x05,
-       FILTERREADSTATUS_T = 0x06,
-       FILTERRECIPIENT_T = 0x07,
-       FILTERORIGINATOR_T = 0x08,
-       FILTERPRIORITY_T = 0x09,
-       ATTACHMENT_T = 0x0A,
-       TRANSPARENT_T = 0x0B,
-       RETRY_T = 0x0C,
-       NEWMESSAGE_T = 0x0D,
-       NOTIFICATIONSTATUS_T = 0x0E,
-       MASINSTANCEID_T = 0x0F,
-       PARAMETERMASK_T = 0x10,
-       FOLDERLISTINGSIZE_T = 0x11,
-       MESSAGESLISTINGSIZE_T = 0x12,
-       SUBJECTLENGTH_T = 0x13,
-       CHARSET_T = 0x14,
-       FRACTIONREQUEST_T = 0x15,
-       FRACTIONDELIVER_T = 0x16,
-       STATUSINDICATOR_T = 0x17,
-       STATUSVALUE_T = 0x18,
-       MSETIME_T = 0x19,
-       INVALID_T = 0x99,
-};
-
-#define MAXLISTCOUNT_L 2
-#define STARTOFFSET_L 2
-#define FILTERMESSAGETYPE_L 1
-#define FILTERREADSTATUS_L 1
-#define FILTERPRIORITY_L 1
-#define ATTACHMENT_L 1
-#define TRANSPARENT_L 1
-#define RETRY_L 1
-#define NEWMESSAGE_L 1
-#define NOTIFICATIONSTATUS_L 1
-#define MASINSTANCEID_L 1
-#define PARAMETERMASK_L 4
-#define FOLDERLISTINGSIZE_L 2
-#define MESSAGESLISTINGSIZE_L 2
-#define SUBJECTLENGTH_L 1
-#define CHARSET_L 1
-#define FRACTIONREQUEST_L 1
-#define FRACTIONDELIVER_L 1
-#define STATUSINDICATOR_L 1
-#define STATUSVALUE_L 1
-
-#define MAS_MAXLISTCOUNT 1024
-#endif
-
 struct mas_session {
        struct mas_request *request;
        void *backend_data;
@@ -166,8 +113,7 @@ struct mas_session {
        gboolean nth_call;
        GString *buffer;
 #ifdef TIZEN_PATCH
-       struct apparam_field *apparams;
-       GByteArray *outparams;
+       map_ap_t *ap;
 #endif
 };
 
@@ -176,212 +122,11 @@ static const uint8_t MAS_TARGET[TARGET_SIZE] = {
                        0xb0, 0xde, 0x08, 0x00, 0x20, 0x0c, 0x9a, 0x66  };
 
 #ifdef TIZEN_PATCH
-struct aparam_header {
-       uint8_t tag;
-       uint8_t len;
-       uint8_t val[0];
-} __attribute__ ((packed));
-
-static void apparam_free(struct apparam_field *apparams);
-
-static struct apparam_field *msg_parse_apparam(const uint8_t *buffer,
-                                                       uint32_t hlen)
+static void bmessage_parser(struct mas_session *mas,
+                          struct bmessage_property *bmessage)
 {
-       struct apparam_field *param = NULL;
-       struct aparam_header *hdr = NULL;
-       uint32_t len = 0;
-       uint16_t val16;
-       uint32_t val32;
-
-       param = g_new0(struct apparam_field, 1);
-       param->filter = g_new0(struct messages_filter, 1);
-       param->maxlistcount = MAS_MAXLISTCOUNT;
-
-       while (len < hlen) {
-               hdr = (void *)(buffer + len);
-
-               switch (hdr->tag) {
-               case MAXLISTCOUNT_T:
-                       if (hdr->len != MAXLISTCOUNT_L)
-                               goto failed;
-
-                       memcpy(&val16, hdr->val, sizeof(val16));
-                       param->maxlistcount = GUINT16_FROM_BE(val16);
-                       break;
-
-               case STARTOFFSET_T:
-                       if (hdr->len != STARTOFFSET_L)
-                               goto failed;
-
-                       memcpy(&val16, hdr->val, sizeof(val16));
-                       param->offset = GUINT16_FROM_BE(val16);
-                       break;
-
-               case SUBJECTLENGTH_T:
-                       if (hdr->len != SUBJECTLENGTH_L)
-                               goto failed;
-
-                       param->subject_length = hdr->val[0];
-                       break;
-
-               case PARAMETERMASK_T:
-                       if (hdr->len != PARAMETERMASK_L)
-                               goto failed;
-
-                       memcpy(&val32, hdr->val, sizeof(val32));
-                       param->filter->parameter_mask = GUINT32_FROM_BE(val32);
-                       break;
-
-               case FILTERMESSAGETYPE_T:
-                       if (hdr->len != FILTERMESSAGETYPE_L)
-                               goto failed;
-
-                       param->filter->type = hdr->val[0];
-                       break;
-
-               case FILTERPERIODBEGIN_T:
-                       param->filter->period_begin = g_malloc0(hdr->len + 1);
-                       memcpy(param->filter->period_begin, hdr->val, hdr->len);
-                       break;
-
-               case FILTERPERIODEND_T:
-                       param->filter->period_end = g_malloc0(hdr->len + 1);
-                       memcpy(param->filter->period_end, hdr->val, hdr->len);
-                       break;
-
-               case FILTERREADSTATUS_T:
-                       if (hdr->len != FILTERREADSTATUS_L)
-                               goto failed;
-
-                       param->filter->read_status = hdr->val[0];
-                       break;
-
-               case FILTERRECIPIENT_T:
-                       param->filter->recipient = g_malloc0(hdr->len + 1);
-                       memcpy(param->filter->recipient, hdr->val, hdr->len);
-                       break;
-
-               case FILTERORIGINATOR_T:
-                       param->filter->originator = g_malloc0(hdr->len + 1);
-                       memcpy(param->filter->originator, hdr->val, hdr->len);
-                       break;
-
-               case FILTERPRIORITY_T:
-                       if (hdr->len != FILTERPRIORITY_L)
-                               goto failed;
-
-                       param->filter->priority = hdr->val[0];
-                       break;
-
-               case ATTACHMENT_T:
-                       if (hdr->len != ATTACHMENT_L)
-                               goto failed;
-
-                       param->attachment = hdr->val[0];
-                       break;
-
-               case CHARSET_T:
-                       if (hdr->len != CHARSET_L)
-                               goto failed;
-
-                       param->charset = hdr->val[0];
-                       break;
-
-               case STATUSINDICATOR_T:
-                       if (hdr->len != STATUSINDICATOR_L)
-                               goto failed;
-
-                       param->status_indicator = hdr->val[0];
-                       break;
-
-               case STATUSVALUE_T:
-                       if (hdr->len != STATUSVALUE_L)
-                               goto failed;
-
-                       param->status_value = hdr->val[0];
-                       break;
-
-               case FRACTIONREQUEST_T:
-                       if (hdr->len != FRACTIONREQUEST_L)
-                               goto failed;
-
-                       param->fraction_request = hdr->val[0];
-                       break;
-
-               case TRANSPARENT_T:
-                       if (hdr->len != TRANSPARENT_L)
-                               goto failed;
-
-                       param->transparent = hdr->val[0];
-                       break;
-
-               case RETRY_T:
-                       if (hdr->len != RETRY_L)
-                               goto failed;
-
-                       param->retry = hdr->val[0];
-                       break;
-
-               case NOTIFICATIONSTATUS_T:
-                       if (hdr->len != NOTIFICATIONSTATUS_L)
-                               goto failed;
-
-                       param->notification_status = hdr->val[0];
-                       break;
-
-               case MASINSTANCEID_T:
-                       if (hdr->len != MASINSTANCEID_L)
-                               goto failed;
-
-                       param->mas_instance = hdr->val[0];
-                       break;
-
-               default:
-                       goto failed;
-               }
-
-               len += hdr->len + sizeof(struct aparam_header);
-       }
-
-       return param;
-
-failed:
-       apparam_free(param);
-
-       return NULL;
-}
-
-static void apparam_free(struct apparam_field *apparams)
-{
-       if (apparams->filter) {
-               g_free(apparams->filter->period_begin);
-               g_free(apparams->filter->period_end);
-               g_free(apparams->filter->recipient);
-               g_free(apparams->filter->originator);
-               g_free(apparams->filter);
-       }
-       g_free(apparams->msetime);
-       g_free(apparams);
-}
-
-static GByteArray *append_apparam_header(GByteArray *buf, uint8_t tag,
-                                                       const void *val)
-{
-       uint8_t outparam[sizeof(struct aparam_header) + FOLDERLISTINGSIZE_L];
-       struct aparam_header *hdr = (struct aparam_header *) outparam;
-
-       switch (tag) {
-       case FOLDERLISTINGSIZE_T:
-               hdr->tag = FOLDERLISTINGSIZE_T;
-               hdr->len = FOLDERLISTINGSIZE_L;
-               memcpy(hdr->val, val, FOLDERLISTINGSIZE_L);
-
-               return g_byte_array_append(buf, outparam,
-                       sizeof(struct aparam_header) + FOLDERLISTINGSIZE_L);
-
-       default:
-               return buf;
-       }
+       /* STRING PARSER : Under implementation */
+       DBG("%s", mas->buffer->str);
 }
 #endif
 
@@ -392,10 +137,8 @@ static void reset_request(struct mas_session *mas)
                mas->buffer = NULL;
        }
 #ifdef TIZEN_PATCH
-       if (mas->apparams) {
-               apparam_free(mas->apparams);
-               mas->apparams = NULL;
-       }
+       map_ap_free(mas->ap);
+       mas->ap = NULL;
 #endif
        mas->nth_call = FALSE;
        mas->finished = FALSE;
@@ -448,7 +191,6 @@ static int mas_get(struct obex_session *os, void *user_data)
        const char *name = obex_get_name(os);
        int ret;
 #ifdef TIZEN_PATCH
-       struct apparam_field *apparams = NULL;
        const uint8_t *buffer = NULL;
        ssize_t rsize = 0;
 #endif
@@ -460,13 +202,6 @@ static int mas_get(struct obex_session *os, void *user_data)
                return -EBADR;
 
 #ifdef TIZEN_PATCH
-       if (mas->apparams) {
-               apparam_free(mas->apparams);
-               mas->apparams = NULL;
-       }
-
-       DBG("GET: name %s type %s mas %p", name, type, mas);
-
        rsize = obex_get_apparam(os, &buffer);
 
        if (rsize < 0) {
@@ -475,14 +210,11 @@ static int mas_get(struct obex_session *os, void *user_data)
                        goto failed;
                }
        } else {
-               apparams = msg_parse_apparam(buffer, rsize);
-
-               if (apparams == NULL) {
+               mas->ap = map_ap_decode(buffer, rsize);
+               if (mas->ap == NULL) {
                        ret = -EBADR;
                        goto failed;
                }
-
-               mas->apparams = apparams;
        }
 #endif
        ret = obex_get_stream_start(os, name);
@@ -504,7 +236,6 @@ static int mas_put(struct obex_session *os, void *user_data)
        const char *name = obex_get_name(os);
        int ret;
 #ifdef TIZEN_PATCH
-       struct apparam_field *apparams = NULL;
        const uint8_t *buffer = NULL;
        ssize_t rsize = 0;
 #endif
@@ -515,13 +246,6 @@ static int mas_put(struct obex_session *os, void *user_data)
                return -EBADR;
 
 #ifdef TIZEN_PATCH
-       if (mas->apparams) {
-               apparam_free(mas->apparams);
-               mas->apparams = NULL;
-       }
-
-       DBG("PUT: name %s type %s mas %p", name, type, mas);
-
        rsize = obex_get_apparam(os, &buffer);
        if (rsize < 0) {
                if (g_ascii_strcasecmp(type, "x-bt/messageStatus") == 0 ||
@@ -530,14 +254,11 @@ static int mas_put(struct obex_session *os, void *user_data)
                        goto failed;
                }
        } else {
-               apparams = msg_parse_apparam(buffer, rsize);
-
-               if (apparams == NULL) {
+               mas->ap = map_ap_decode(buffer, rsize);
+               if (mas->ap == NULL) {
                        ret = -EBADR;
                        goto failed;
                }
-
-               mas->apparams = apparams;
        }
 #endif
        ret = obex_put_stream_start(os, name);
@@ -757,8 +478,8 @@ static void update_inbox_cb(void *session, int err, void *user_data)
        else
                obex_object_set_io_flags(mas, G_IO_OUT, 0);
 }
-#ifdef TIZEN_PATCH
 
+#ifdef TIZEN_PATCH
 static void message_status_cb(void *session, int err, void *user_data)
 {
        struct mas_session *mas = user_data;
@@ -778,9 +499,8 @@ static void folder_size_result_cb(void *session, int err, uint16_t size,
 {
        struct mas_session *mas = user_data;
 
-       mas->outparams = g_byte_array_new();
-       mas->outparams = append_apparam_header(mas->outparams,
-                                       FOLDERLISTINGSIZE_T, &size);
+       map_ap_set_u16(mas->ap, MAP_AP_FOLDERLISTINGSIZE,
+                                       GUINT16_FROM_BE(size));
 
        if (err < 0)
                obex_object_set_io_flags(mas, G_IO_ERR, err);
@@ -818,6 +538,8 @@ static void *folder_listing_open(const char *name, int oflag, mode_t mode,
        struct mas_session *mas = driver_data;
 #ifdef TIZEN_PATCH
        messages_folder_listing_cb cb;
+       uint16_t maxlistcount = 1024;
+       uint16_t offset = 0;
 #endif
 
        if (oflag != O_RDONLY) {
@@ -828,15 +550,20 @@ static void *folder_listing_open(const char *name, int oflag, mode_t mode,
        DBG("name = %s", name);
 
 #ifdef TIZEN_PATCH
-       if (mas->apparams->maxlistcount == 0)
+       if (mas->ap != NULL) {
+               map_ap_get_u16(mas->ap, MAP_AP_MAXLISTCOUNT, &maxlistcount);
+               map_ap_get_u16(mas->ap, MAP_AP_STARTOFFSET, &offset);
+       }
+
+       DBG("Maxlistcount = %d \n offset = %d\n", maxlistcount, offset);
+
+       if (maxlistcount == 0)
                cb = folder_size_result_cb;
        else
                cb = get_folder_listing_cb;
 
        *err = messages_get_folder_listing(mas->backend_data, name,
-                                       mas->apparams->maxlistcount,
-                                       mas->apparams->offset,
-                                       cb, mas);
+                                               maxlistcount, offset, cb, mas);
 #else
        /* 1024 is the default when there was no MaxListCount sent */
        *err = messages_get_folder_listing(mas->backend_data, name, 1024, 0,
@@ -876,6 +603,28 @@ static void *msg_listing_open(const char *name, int oflag, mode_t mode,
                return mas;
 }
 
+#ifdef TIZEN_PATCH
+static void message_get(struct mas_session *mas, const char *name, int *err)
+{
+       DBG("");
+
+       /* TODO: check for Mandatory application parameter
+       * Attachment and Charset and optional parameter fraction request */
+       *err = messages_get_message(mas->backend_data, name, 0,
+                       get_message_cb, mas);
+       mas->buffer = g_string_new("");
+}
+
+static void message_put(struct mas_session *mas, const char *name, int *err)
+{
+       DBG("");
+
+       /* TODO: check for Mandatory application parameter
+       * Charset and optional parameter transparent and retry */
+       mas->buffer = g_string_new("");
+}
+#endif
+
 static void *message_open(const char *name, int oflag, mode_t mode,
                                void *driver_data, size_t *size, int *err)
 {
@@ -883,6 +632,12 @@ static void *message_open(const char *name, int oflag, mode_t mode,
 
        DBG("");
 
+#ifdef TIZEN_PATCH
+       if (oflag == O_RDONLY)
+               message_get(mas, name, err);
+       else
+               message_put(mas, name, err);
+#else
        if (oflag != O_RDONLY) {
                DBG("Message pushing unsupported");
                *err = -EINVAL;
@@ -894,7 +649,7 @@ static void *message_open(const char *name, int oflag, mode_t mode,
                        get_message_cb, mas);
 
        mas->buffer = g_string_new("");
-
+#endif
        if (*err < 0)
                return NULL;
        else
@@ -920,6 +675,7 @@ static void *message_update_open(const char *name, int oflag, mode_t mode,
        else
                return mas;
 }
+
 #ifdef TIZEN_PATCH
 static void *message_status_open(const char *name, int oflag, mode_t mode,
                                        void *driver_data, size_t *size,
@@ -935,11 +691,8 @@ static void *message_status_open(const char *name, int oflag, mode_t mode,
                return NULL;
         }
 
-       if (mas->apparams == NULL)
-               return NULL;
-
-       indicator = mas->apparams->status_indicator;
-       value = mas->apparams->status_value;
+       map_ap_get_u8(mas->ap, MAP_AP_STATUSINDICATOR, &indicator);
+       map_ap_get_u8(mas->ap, MAP_AP_STATUSVALUE, &value);
 
        DBG("Indicator = %d \n value = %d\n", indicator, value);
 
@@ -951,6 +704,36 @@ static void *message_status_open(const char *name, int oflag, mode_t mode,
        else
                return mas;
 }
+
+static ssize_t message_write(void *object, const void *buf, size_t count)
+{
+       struct mas_session *mas = object;
+       GString *string;
+
+       DBG("");
+
+       string = g_string_append_len(mas->buffer, buf, count);
+
+       return string->len;
+}
+
+static int message_close(void *obj)
+{
+       struct mas_session *mas = obj;
+       struct bmessage_property bmessage = { 0, };
+
+       DBG("");
+
+       /* Bmessage body parsing */
+       bmessage_parser(mas, &bmessage);
+
+       if (!mas->finished)
+               messages_abort(mas->backend_data);
+
+       reset_request(mas);
+
+       return 0;
+}
 #endif
 
 static void *any_open(const char *name, int oflag, mode_t mode,
@@ -1029,9 +812,17 @@ static struct obex_mime_type_driver mime_message = {
        .target_size = TARGET_SIZE,
        .mimetype = "x-bt/message",
        .open = message_open,
+#ifdef TIZEN_PATCH
+       .close = message_close,
+#else
        .close = any_close,
+#endif
        .read = any_read,
+#ifdef TIZEN_PATCH
+       .write = message_write,
+#else
        .write = any_write,
+#endif
 };
 
 static struct obex_mime_type_driver mime_folder_listing = {
@@ -1082,11 +873,7 @@ static struct obex_mime_type_driver mime_message_update = {
        .target = MAS_TARGET,
        .target_size = TARGET_SIZE,
        .mimetype = "x-bt/MAP-messageUpdate",
-#ifdef TIZEN_PATCH
        .open = message_update_open,
-#else
-       .open = any_open,
-#endif
        .close = any_close,
        .read = any_read,
        .write = any_write,
index a8a8882..74baf41 100644 (file)
@@ -307,11 +307,10 @@ int messages_connect(void **s)
        DBusPendingCall *call;
        DBusMessage *message;
 
-       DBG("messages_connect 123\n");
 
-       conn = dbus_bus_get(DBUS_BUS_SYSTEM, NULL);
+       conn = dbus_bus_get(DBUS_BUS_SESSION, NULL);
        if (!conn) {
-               error("Can't get on system bus");
+               error("Can't get on session bus");
                return -1;
        }
 
@@ -499,9 +498,9 @@ int messages_get_messages_listing(void *data,
 
        DBG("messages_get_messages_listing \n");
 
-       conn = dbus_bus_get(DBUS_BUS_SYSTEM, NULL);
+       conn = dbus_bus_get(DBUS_BUS_SESSION, NULL);
        if (!conn) {
-               error("Can't get on system bus");
+               error("Can't get on session bus");
                g_free(folder_name);
                g_free(request->name);
                return -1;
@@ -562,9 +561,9 @@ int messages_get_message(void *session,
 
        DBG("messages_get_message \n");
 
-       conn = dbus_bus_get(DBUS_BUS_SYSTEM, NULL);
+       conn = dbus_bus_get(DBUS_BUS_SESSION, NULL);
        if (!conn) {
-               error("Can't get on system bus");
+               error("Can't get on session bus");
                g_free(message_name);
                return -1;
        }
@@ -636,9 +635,9 @@ int messages_update_inbox(void *session,
 
        DBG("messages_update_inbox 123\n");
 
-       conn = dbus_bus_get(DBUS_BUS_SYSTEM, NULL);
+       conn = dbus_bus_get(DBUS_BUS_SESSION, NULL);
        if (!conn) {
-               error("Can't get on system bus");
+               error("Can't get on session bus");
                return -1;
        }
 
@@ -718,9 +717,9 @@ int messages_set_message_status(void *session, const char *handle,
        s->msg_status_cb = callback;
        s->user_data = user_data;
 
-       conn = dbus_bus_get(DBUS_BUS_SYSTEM, NULL);
+       conn = dbus_bus_get(DBUS_BUS_SESSION, NULL);
        if (!conn) {
-               error("Can't get on system bus");
+               error("Can't get on session bus");
                g_free(message_name);
                return -1;
        }
index c47abc7..9a42e86 100644 (file)
@@ -119,55 +119,6 @@ struct messages_filter {
        uint8_t priority;
 };
 
-#ifdef TIZEN_PATCH
-/* To store Application parameters.
- * See MAP specification for the details.
- * filter - Parameters on which we filter the message list to be sent.
- * maxlistcount - Maximum number of Messages or folders to be sent,
- *             if not mentioned it is 1024.
- * offset - Offset from where the list is to be sent, if not mentioned it is 0.
- * attachment - Indicates if any attachment i.e. ON or OFF.
- * transparent -To tell MSE that no copy shall me kept in Sent folder.
- * retry -To indicate if successive attempts to be made, incase network is not
- *              accessible.
- * newmessage -To indicate unread messages in message listing.
- * notification_status -Indicates Incoming message notification On/Off.
- * mas_instance -Indicate corresponding 'MASInstanceID', as only one MNS
- *                       connection can be made with an MSE.
- * folderlisting_size -Used in response if the value of maxlistcount is 0.
- * messagelisting_size -Used in response if the value of maxlistcount is 0.
- * subject_length -Maximum length of the Subject in Messages-Listing.
- * fraction_request -Used only if the message is fractioned.
- * fraction_delivery -Used only if fraction_request is present in Get Message
- *                               Request.
- * charset - Determines trans-coding of the text i.e. "Native" or "UTF-8".
- * status_indicator - Indicates which status information is to be modified
- *             i.e. "readStatus" or "deletedStatus".
- * status_value - Indicates value to status_indicator i.e. "yes" or "no".
- * msetime -To report the local time of MSE and its UTC Offset.
- */
-struct apparam_field {
-       struct messages_filter *filter;
-       uint16_t maxlistcount;
-       uint16_t offset;
-       uint8_t attachment;
-       uint8_t transparent;
-       uint8_t retry;
-       uint8_t newmessage;
-       uint8_t notification_status;
-       uint8_t mas_instance;
-       uint16_t folderlisting_size;
-       uint16_t messagelisting_size;
-       uint8_t subject_length;
-       uint8_t charset;
-       uint8_t fraction_request;
-       uint8_t fraction_delivery;
-       uint8_t status_indicator;
-       uint8_t status_value;
-       char *msetime;
-};
-#endif
-
 /* This is called once after server starts.
  *
  * Returns value less than zero if error. This will prevent MAP plugin from
index 36f2751..f3d0b1a 100644 (file)
@@ -332,11 +332,7 @@ static gboolean send_backup_dbus_message(const char *oper,
 
        file_size = size ? *size : 0;
 
-#ifdef TIZEN_PATCH
-       conn = g_dbus_setup_bus(DBUS_BUS_SYSTEM, NULL, NULL);
-#else
        conn = g_dbus_setup_bus(DBUS_BUS_SESSION, NULL, NULL);
-#endif
 
        if (conn == NULL)
                return FALSE;
index 3414c18..f08ddf7 100644 (file)
@@ -512,9 +512,9 @@ int get_phonebook_data(const char *query, const char *call_type,
 
        DBG("call_type:%s", call_type);
 
-       conn = dbus_bus_get(DBUS_BUS_SYSTEM, NULL);
+       conn = dbus_bus_get(DBUS_BUS_SESSION, NULL);
        if (!conn) {
-               error("Can't get on system bus");
+               error("Can't get on session bus");
                return -1;
        }
 
index 3c6bba5..90ccbe2 100644 (file)
@@ -466,12 +466,8 @@ gboolean manager_init(void)
        DBG("");
 
        dbus_error_init(&err);
-#ifdef TIZEN_PATCH
-       connection = g_dbus_setup_bus(DBUS_BUS_SYSTEM, OPENOBEX_SERVICE, &err);
-#else
        connection = g_dbus_setup_bus(DBUS_BUS_SESSION, OPENOBEX_SERVICE,
                                                                        &err);
-#endif
        if (connection == NULL) {
                if (dbus_error_is_set(&err) == TRUE) {
                        fprintf(stderr, "%s\n", err.message);
index 9d13adf..aa5938c 100644 (file)
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
+#ifdef OPENSOURCE_PATCH
+#include <string.h>
 
+#include "log.h"
+#endif
 #include "map_ap.h"
 
+#ifdef OPENSOURCE_PATCH
+enum ap_type {
+       APT_UINT8,
+       APT_UINT16,
+       APT_UINT32,
+       APT_STR
+};
+
+/* NOTE: ap_defs array has to be kept in sync with map_ap_tag. */
+static const struct ap_def {
+       const char *name;
+       enum ap_type type;
+} ap_defs[] = {
+       { "MAXLISTCOUNT",               APT_UINT16 },
+       { "STARTOFFSET",                APT_UINT16 },
+       { "FILTERMESSAGETYPE",          APT_UINT8  },
+       { "FILTERPERIODBEGIN",          APT_STR    },
+       { "FILTERPERIODEND",            APT_STR    },
+       { "FILTERREADSTATUS",           APT_UINT8  },
+       { "FILTERRECIPIENT",            APT_STR    },
+       { "FILTERORIGINATOR",           APT_STR    },
+       { "FILTERPRIORITY",             APT_UINT8  },
+       { "ATTACHMENT",                 APT_UINT8  },
+       { "TRANSPARENT",                APT_UINT8  },
+       { "RETRY",                      APT_UINT8  },
+       { "NEWMESSAGE",                 APT_UINT8  },
+       { "NOTIFICATIONSTATUS",         APT_UINT8  },
+       { "MASINSTANCEID",              APT_UINT8  },
+       { "PARAMETERMASK",              APT_UINT32 },
+       { "FOLDERLISTINGSIZE",          APT_UINT16 },
+       { "MESSAGESLISTINGSIZE",        APT_UINT16 },
+       { "SUBJECTLENGTH",              APT_UINT8  },
+       { "CHARSET",                    APT_UINT8  },
+       { "FRACTIONREQUEST",            APT_UINT8  },
+       { "FRACTIONDELIVER",            APT_UINT8  },
+       { "STATUSINDICATOR",            APT_UINT8  },
+       { "STATUSVALUE",                APT_UINT8  },
+       { "MSETIME",                    APT_STR    },
+};
+
+struct ap_entry {
+       enum map_ap_tag tag;
+       union {
+               uint32_t u32;
+               uint16_t u16;
+               uint8_t u8;
+               char *str;
+       } val;
+};
+
+/* This comes from OBEX specs */
+struct obex_ap_header {
+       uint8_t tag;
+       uint8_t len;
+       uint8_t val[0];
+} __attribute__ ((packed));
+
+static int find_ap_def_offset(uint8_t tag)
+{
+       if (tag == 0 || tag > G_N_ELEMENTS(ap_defs))
+               return -1;
+
+       return tag - 1;
+}
+
+static void ap_entry_dump(gpointer tag, gpointer val, gpointer user_data)
+{
+       struct ap_entry *entry = val;
+       int offset;
+
+       offset = find_ap_def_offset(GPOINTER_TO_INT(tag));
+
+       switch (ap_defs[offset].type) {
+       case APT_UINT8:
+               DBG("%-30s %08x", ap_defs[offset].name, entry->val.u8);
+               break;
+       case APT_UINT16:
+               DBG("%-30s %08x", ap_defs[offset].name, entry->val.u16);
+               break;
+       case APT_UINT32:
+               DBG("%-30s %08x", ap_defs[offset].name, entry->val.u32);
+               break;
+       case APT_STR:
+               DBG("%-30s %s", ap_defs[offset].name, entry->val.str);
+               break;
+       }
+}
+
+static void ap_entry_free(gpointer val)
+{
+       struct ap_entry *entry = val;
+       int offset;
+
+       offset = find_ap_def_offset(entry->tag);
+
+       if (offset >= 0 && ap_defs[offset].type == APT_STR)
+               g_free(entry->val.str);
+
+       g_free(entry);
+}
+#endif
+
 map_ap_t *map_ap_new(void)
 {
+#ifdef OPENSOURCE_PATCH
+       return g_hash_table_new_full(g_direct_hash, g_direct_equal, NULL,
+                                                               ap_entry_free);
+#else
        return NULL;
+#endif
 }
 
 void map_ap_free(map_ap_t *ap)
 {
+#ifdef OPENSOURCE_PATCH
+       if (!ap)
+               return;
+
+       g_hash_table_destroy(ap);
+#endif
+}
+
+#ifdef OPENSOURCE_PATCH
+static void ap_decode_u8(map_ap_t *ap, const struct obex_ap_header *hdr)
+{
+       if (hdr->len != 1) {
+               DBG("Value of tag %u is %u byte(s) long instead of expected "
+                               "1 byte - skipped!", hdr->tag, hdr->len);
+               return;
+       }
+
+       map_ap_set_u8(ap, hdr->tag, hdr->val[0]);
+}
+
+static void ap_decode_u16(map_ap_t *ap, const struct obex_ap_header *hdr)
+{
+       uint16_t val;
+
+       if (hdr->len != 2) {
+               DBG("Value of tag %u is %u byte(s) long instead of expected "
+                               "2 bytes - skipped!", hdr->tag, hdr->len);
+               return;
+       }
+
+       memcpy(&val, hdr->val, sizeof(val));
+       map_ap_set_u16(ap, hdr->tag, GUINT16_FROM_BE(val));
+}
+
+static void ap_decode_u32(map_ap_t *ap, const struct obex_ap_header *hdr)
+{
+       uint32_t val;
+
+       if (hdr->len != 4) {
+               DBG("Value of tag %u is %u byte(s) long instead of expected "
+                               "4 bytes - skipped!", hdr->tag, hdr->len);
+               return;
+       }
+
+       memcpy(&val, hdr->val, sizeof(val));
+       map_ap_set_u32(ap, hdr->tag, GUINT32_FROM_BE(val));
+}
+
+static void ap_decode_str(map_ap_t *ap, const struct obex_ap_header *hdr)
+{
+       char *val = g_malloc0(hdr->len + 1);
+
+       memcpy(val, hdr->val, hdr->len);
+       map_ap_set_string(ap, hdr->tag, val);
+
+       g_free(val);
 }
+#endif
 
 map_ap_t *map_ap_decode(const uint8_t *buffer, size_t length)
 {
+#ifdef OPENSOURCE_PATCH
+       map_ap_t *ap;
+       struct obex_ap_header *hdr;
+       uint32_t done;
+       int offset;
+
+       ap = map_ap_new();
+       if (!ap)
+               return NULL;
+
+       for (done = 0; done < length; done += hdr->len + sizeof(*hdr)) {
+               hdr = (struct obex_ap_header *)(buffer + done);
+
+               offset = find_ap_def_offset(hdr->tag);
+
+               if (offset < 0) {
+                       DBG("Unknown tag %u (length %u) - skipped.",
+                                                       hdr->tag, hdr->len);
+                       continue;
+               }
+
+               switch (ap_defs[offset].type) {
+               case APT_UINT8:
+                       ap_decode_u8(ap, hdr);
+                       break;
+               case APT_UINT16:
+                       ap_decode_u16(ap, hdr);
+                       break;
+               case APT_UINT32:
+                       ap_decode_u32(ap, hdr);
+                       break;
+               case APT_STR:
+                       ap_decode_str(ap, hdr);
+                       break;
+               }
+       }
+
+       g_hash_table_foreach(ap, ap_entry_dump, NULL);
+
+       return ap;
+#else
        return NULL;
+#endif
 }
 
 uint8_t *map_ap_encode(map_ap_t *ap, size_t *length)
@@ -50,40 +260,170 @@ uint8_t *map_ap_encode(map_ap_t *ap, size_t *length)
 
 gboolean map_ap_get_u8(map_ap_t *ap, enum map_ap_tag tag, uint8_t *val)
 {
+#ifdef TIZEN_PATCH
+       struct ap_entry *entry;
+       int offset = find_ap_def_offset(tag);
+
+       if (offset < 0 || ap_defs[offset].type != APT_UINT8)
+               return FALSE;
+
+       entry = g_hash_table_lookup(ap, GINT_TO_POINTER(tag));
+
+       if (!entry)
+               return FALSE;
+
+       *val = entry->val.u8;
+
+       return TRUE;
+#else
        return FALSE;
+#endif
 }
 
 gboolean map_ap_get_u16(map_ap_t *ap, enum map_ap_tag tag, uint16_t *val)
 {
+#ifdef TIZEN_PATCH
+       struct ap_entry *entry;
+       int offset = find_ap_def_offset(tag);
+
+       if (offset < 0 || ap_defs[offset].type != APT_UINT16)
+               return FALSE;
+
+       entry = g_hash_table_lookup(ap, GINT_TO_POINTER(tag));
+
+       if (!entry)
+               return FALSE;
+
+       *val = entry->val.u16;
+
+       return TRUE;
+#else
        return FALSE;
+#endif
 }
 
 gboolean map_ap_get_u32(map_ap_t *ap, enum map_ap_tag tag, uint32_t *val)
 {
+#ifdef TIZEN_PATCH
+       struct ap_entry *entry;
+       int offset = find_ap_def_offset(tag);
+
+       if (offset < 0 || ap_defs[offset].type != APT_UINT32)
+               return FALSE;
+
+       entry = g_hash_table_lookup(ap, GINT_TO_POINTER(tag));
+
+       if (!entry)
+               return FALSE;
+
+       *val = entry->val.u32;
+
+       return TRUE;
+#else
        return FALSE;
+#endif
 }
 
 const char *map_ap_get_string(map_ap_t *ap, enum map_ap_tag tag)
 {
+#ifdef TIZEN_PATCH
+       struct ap_entry *entry;
+       int offset = find_ap_def_offset(tag);
+
+       if (offset < 0 || ap_defs[offset].type != APT_STR)
+               return NULL;
+
+       entry = g_hash_table_lookup(ap, GINT_TO_POINTER(tag));
+
+       if (!entry)
+               return NULL;
+
+       return g_strdup(entry->val.str);
+#else
        return NULL;
+#endif
 }
 
 gboolean map_ap_set_u8(map_ap_t *ap, enum map_ap_tag tag, uint8_t val)
 {
+#ifdef OPENSOURCE_PATCH
+       struct ap_entry *entry;
+       int offset = find_ap_def_offset(tag);
+
+       if (offset < 0 || ap_defs[offset].type != APT_UINT8)
+               return FALSE;
+
+       entry = g_new0(struct ap_entry, 1);
+       entry->tag = tag;
+       entry->val.u8 = val;
+
+       g_hash_table_insert(ap, GINT_TO_POINTER(tag), entry);
+
+       return TRUE;
+#else
        return FALSE;
+#endif
 }
 
 gboolean map_ap_set_u16(map_ap_t *ap, enum map_ap_tag tag, uint16_t val)
 {
+#ifdef OPENSOURCE_PATCH
+       struct ap_entry *entry;
+       int offset = find_ap_def_offset(tag);
+
+       if (offset < 0 || ap_defs[offset].type != APT_UINT16)
+               return FALSE;
+
+       entry = g_new0(struct ap_entry, 1);
+       entry->tag = tag;
+       entry->val.u16 = val;
+
+       g_hash_table_insert(ap, GINT_TO_POINTER(tag), entry);
+
+       return TRUE;
+#else
        return FALSE;
+#endif
 }
 
 gboolean map_ap_set_u32(map_ap_t *ap, enum map_ap_tag tag, uint32_t val)
 {
+#ifdef OPENSOURCE_PATCH
+       struct ap_entry *entry;
+       int offset = find_ap_def_offset(tag);
+
+       if (offset < 0 || ap_defs[offset].type != APT_UINT32)
+               return FALSE;
+
+       entry = g_new0(struct ap_entry, 1);
+       entry->tag = tag;
+       entry->val.u32 = val;
+
+       g_hash_table_insert(ap, GINT_TO_POINTER(tag), entry);
+
+       return TRUE;
+#else
        return FALSE;
+#endif
 }
 
 gboolean map_ap_set_string(map_ap_t *ap, enum map_ap_tag tag, const char *val)
 {
+#ifdef OPENSOURCE_PATCH
+       struct ap_entry *entry;
+       int offset = find_ap_def_offset(tag);
+
+       if (offset < 0 || ap_defs[offset].type != APT_STR)
+               return FALSE;
+
+       entry = g_new0(struct ap_entry, 1);
+       entry->tag = tag;
+       entry->val.str = g_strdup(val);
+
+       g_hash_table_insert(ap, GINT_TO_POINTER(tag), entry);
+
+       return TRUE;
+#else
        return FALSE;
+#endif
 }
index c0fb79a..2d18a82 100644 (file)
@@ -51,7 +51,9 @@ enum map_ap_tag {
        MAP_AP_STATUSINDICATOR          = 0x17,         /* uint8_t      */
        MAP_AP_STATUSVALUE              = 0x18,         /* uint8_t      */
        MAP_AP_MSETIME                  = 0x19,         /* char *       */
+#ifndef OPENSOURCE_PATCH
        MAP_AP_INVALID                  = 0x100,
+#endif
 };
 
 /* Data type representing MAP application parameters. Consider opaque. */
index 3d807a7..74de50f 100644 (file)
@@ -1,3 +1,3 @@
 [D-BUS Service]
 Name=org.openobex
-Exec=@libexecdir@/obexd -d --symlinks -r /opt/share/bt-ftp
+Exec=@libexecdir@/obexd -d --symlinks -r /opt/media