upload tizen1.0 source
authorKim Kibum <kb0929.kim@samsung.com>
Sun, 29 Apr 2012 08:02:03 +0000 (17:02 +0900)
committerKim Kibum <kb0929.kim@samsung.com>
Sun, 29 Apr 2012 08:02:03 +0000 (17:02 +0900)
58 files changed:
AUTHORS [new file with mode: 0644]
CMakeLists.txt [new file with mode: 0644]
LICENSE [new file with mode: 0644]
common/include/sipc.h [new file with mode: 0644]
common/include/sipc_common.h [new file with mode: 0644]
common/include/sipc_log.h [new file with mode: 0644]
common/include/sipc_type.h [new file with mode: 0644]
common/include/tapi_common.h [new file with mode: 0644]
common/include/tapi_type.h [new file with mode: 0644]
common/src/sipc_channel.c [new file with mode: 0644]
common/src/sipc_marshal.c [new file with mode: 0644]
common/src/sipc_server.c [new file with mode: 0644]
libclient/CMakeLists.txt [new file with mode: 0644]
libclient/debian/changelog [new file with mode: 0644]
libclient/debian/compat [new file with mode: 0644]
libclient/debian/control [new file with mode: 0644]
libclient/debian/copyright [new file with mode: 0644]
libclient/debian/dirs [new file with mode: 0644]
libclient/debian/docs [new file with mode: 0644]
libclient/debian/libsocket-comm-client-0.install.in [new file with mode: 0644]
libclient/debian/libsocket-comm-client-dev.install.in [new file with mode: 0644]
libclient/debian/rules [new file with mode: 0755]
libclient/include/tapi_sipc.h [new file with mode: 0644]
libclient/libsocket-comm-client.pc.in [new file with mode: 0644]
libclient/src/tapi_common_sipc.c [new file with mode: 0644]
libclient/src/tapi_common_sipc.h [new file with mode: 0644]
libclient/src/tapi_log.h [new file with mode: 0644]
libclient/src/tapi_sipc.c [new file with mode: 0644]
packaging/tel-plugin-socket_communicator.spec [new file with mode: 0644]
packaging/unused [new file with mode: 0644]
plugin/CMakeLists.txt [new file with mode: 0644]
plugin/debian/changelog [new file with mode: 0644]
plugin/debian/compat [new file with mode: 0644]
plugin/debian/control [new file with mode: 0644]
plugin/debian/copyright [new file with mode: 0644]
plugin/debian/dirs [new file with mode: 0644]
plugin/debian/docs [new file with mode: 0644]
plugin/debian/rules [new file with mode: 0755]
plugin/debian/tel-plugin-socket-communicator.install.in [new file with mode: 0644]
plugin/src/desc-sipc.c [new file with mode: 0644]
plugin/src/module_req.h [new file with mode: 0644]
plugin/src/socket_call.c [new file with mode: 0644]
plugin/src/socket_custom.c [new file with mode: 0644]
plugin/src/socket_network.c [new file with mode: 0644]
plugin/src/socket_pb.c [new file with mode: 0644]
plugin/src/socket_ps.c [new file with mode: 0644]
plugin/src/socket_sap.c [new file with mode: 0644]
plugin/src/socket_sim.c [new file with mode: 0644]
plugin/src/socket_sms.c [new file with mode: 0644]
test/Makefile [new file with mode: 0644]
test/custom.c [new file with mode: 0644]
test/gprs.c [new file with mode: 0644]
test/main.c [new file with mode: 0644]
test/menu.c [new file with mode: 0644]
test/menu.h [new file with mode: 0644]
test/modem.c [new file with mode: 0644]
test/network.c [new file with mode: 0644]
test/noti.h [new file with mode: 0644]

diff --git a/AUTHORS b/AUTHORS
new file mode 100644 (file)
index 0000000..0e9faa9
--- /dev/null
+++ b/AUTHORS
@@ -0,0 +1,6 @@
+Jongman Park <jman.park@samsung.com>
+Ja-young Gu <jygu@samsung.com>
+Kyeongchul Kim <kyeongchul.kim@samsung.com>
+DongHoo Park <donghoo.park@samsung.>
+Youngman Park <youngman.park@samsung.com>
+Inho Oh <inho48.oh@samsung.com>
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644 (file)
index 0000000..997976e
--- /dev/null
@@ -0,0 +1,60 @@
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+PROJECT(socket-communicator C)
+
+SET(PREFIX ${CMAKE_INSTALL_PREFIX})
+SET(EXEC_PREFIX "\${prefix}")
+SET(LIBDIR "\${prefix}/lib")
+SET(INCLUDEDIR "\${prefix}/include")
+
+# Set required packages
+INCLUDE(FindPkgConfig)
+pkg_check_modules(pkgs REQUIRED glib-2.0 tcore security-server)
+
+FOREACH(flag ${pkgs_CFLAGS})
+       SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+ENDFOREACH(flag)
+
+SET(SOCKET_IPC_LIB_INCLUDE "${CMAKE_SOURCE_DIR}/libsocket_ipc/include/")
+SET(SOCKET_COMM_CLIENT_INCLUDE "${CMAKE_SOURCE_DIR}/libsocket_comm_client/include/")
+
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include/ ${SOCKET_IPC_LIB_INCLUDE} ${SOCKET_COMM_CLIENT_INCLUDE})
+
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
+
+MESSAGE(${CMAKE_C_FLAGS})
+MESSAGE(${CMAKE_EXE_LINKER_FLAGS})
+
+SET(SOCKET_IPC_LIB_SRCS
+               libsocket_ipc/src/sipc_server.c
+               libsocket_ipc/src/sipc_channel.c
+               libsocket_ipc/src/sipc_marshal.c
+)
+
+SET(SRCS
+               src/desc-sipc.c
+               src/socket_sim.c
+)
+
+SET(SOCKET_CMM_CLIENT
+               libsocket_comm_client/src/tapi_sipc.c
+               libsocket_comm_client/src/tapi_common_sipc.c
+)
+
+# library build
+ADD_LIBRARY(socket-communicator SHARED ${SOCKET_IPC_LIB_SRCS} ${SRCS})
+TARGET_LINK_LIBRARIES(socket-communicator ${pkgs_LDFLAGS})
+SET_TARGET_PROPERTIES(socket-communicator PROPERTIES PREFIX "" OUTPUT_NAME socket-communicator)
+
+ADD_LIBRARY(libsocket-comm-client SHARED ${SOCKET_IPC_LIB_SRCS} ${SOCKET_CMM_CLIENT})
+TARGET_LINK_LIBRARIES(libsocket-comm-client ${pkgs_LDFLAGS})
+SET_TARGET_PROPERTIES(libsocket-comm-client PROPERTIES PREFIX "" OUTPUT_NAME libsocket-comm-client)
+
+# pkgconfig file
+SET(PREFIX ${CMAKE_INSTALL_PREFIX})
+CONFIGURE_FILE(libsocket-comm-client.pc.in libsocket-comm-client.pc @ONLY)
+
+# install
+INSTALL(TARGETS socket-communicator LIBRARY DESTINATION lib/telephony/plugins)
+INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/libsocket_comm_client/include/ DESTINATION include/telephony)
+INSTALL(TARGETS libsocket-comm-client LIBRARY DESTINATION lib)
+INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/libsocket-comm-client.pc DESTINATION lib/pkgconfig)
diff --git a/LICENSE b/LICENSE
new file mode 100644 (file)
index 0000000..bae7f54
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,204 @@
+Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved.\r
+\r
+                                 Apache License\r
+                           Version 2.0, January 2004\r
+                        http://www.apache.org/licenses/\r
+\r
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\r
+\r
+   1. Definitions.\r
+\r
+      "License" shall mean the terms and conditions for use, reproduction,\r
+      and distribution as defined by Sections 1 through 9 of this document.\r
+\r
+      "Licensor" shall mean the copyright owner or entity authorized by\r
+      the copyright owner that is granting the License.\r
+\r
+      "Legal Entity" shall mean the union of the acting entity and all\r
+      other entities that control, are controlled by, or are under common\r
+      control with that entity. For the purposes of this definition,\r
+      "control" means (i) the power, direct or indirect, to cause the\r
+      direction or management of such entity, whether by contract or\r
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the\r
+      outstanding shares, or (iii) beneficial ownership of such entity.\r
+\r
+      "You" (or "Your") shall mean an individual or Legal Entity\r
+      exercising permissions granted by this License.\r
+\r
+      "Source" form shall mean the preferred form for making modifications,\r
+      including but not limited to software source code, documentation\r
+      source, and configuration files.\r
+\r
+      "Object" form shall mean any form resulting from mechanical\r
+      transformation or translation of a Source form, including but\r
+      not limited to compiled object code, generated documentation,\r
+      and conversions to other media types.\r
+\r
+      "Work" shall mean the work of authorship, whether in Source or\r
+      Object form, made available under the License, as indicated by a\r
+      copyright notice that is included in or attached to the work\r
+      (an example is provided in the Appendix below).\r
+\r
+      "Derivative Works" shall mean any work, whether in Source or Object\r
+      form, that is based on (or derived from) the Work and for which the\r
+      editorial revisions, annotations, elaborations, or other modifications\r
+      represent, as a whole, an original work of authorship. For the purposes\r
+      of this License, Derivative Works shall not include works that remain\r
+      separable from, or merely link (or bind by name) to the interfaces of,\r
+      the Work and Derivative Works thereof.\r
+\r
+      "Contribution" shall mean any work of authorship, including\r
+      the original version of the Work and any modifications or additions\r
+      to that Work or Derivative Works thereof, that is intentionally\r
+      submitted to Licensor for inclusion in the Work by the copyright owner\r
+      or by an individual or Legal Entity authorized to submit on behalf of\r
+      the copyright owner. For the purposes of this definition, "submitted"\r
+      means any form of electronic, verbal, or written communication sent\r
+      to the Licensor or its representatives, including but not limited to\r
+      communication on electronic mailing lists, source code control systems,\r
+      and issue tracking systems that are managed by, or on behalf of, the\r
+      Licensor for the purpose of discussing and improving the Work, but\r
+      excluding communication that is conspicuously marked or otherwise\r
+      designated in writing by the copyright owner as "Not a Contribution."\r
+\r
+      "Contributor" shall mean Licensor and any individual or Legal Entity\r
+      on behalf of whom a Contribution has been received by Licensor and\r
+      subsequently incorporated within the Work.\r
+\r
+   2. Grant of Copyright License. Subject to the terms and conditions of\r
+      this License, each Contributor hereby grants to You a perpetual,\r
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\r
+      copyright license to reproduce, prepare Derivative Works of,\r
+      publicly display, publicly perform, sublicense, and distribute the\r
+      Work and such Derivative Works in Source or Object form.\r
+\r
+   3. Grant of Patent License. Subject to the terms and conditions of\r
+      this License, each Contributor hereby grants to You a perpetual,\r
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\r
+      (except as stated in this section) patent license to make, have made,\r
+      use, offer to sell, sell, import, and otherwise transfer the Work,\r
+      where such license applies only to those patent claims licensable\r
+      by such Contributor that are necessarily infringed by their\r
+      Contribution(s) alone or by combination of their Contribution(s)\r
+      with the Work to which such Contribution(s) was submitted. If You\r
+      institute patent litigation against any entity (including a\r
+      cross-claim or counterclaim in a lawsuit) alleging that the Work\r
+      or a Contribution incorporated within the Work constitutes direct\r
+      or contributory patent infringement, then any patent licenses\r
+      granted to You under this License for that Work shall terminate\r
+      as of the date such litigation is filed.\r
+\r
+   4. Redistribution. You may reproduce and distribute copies of the\r
+      Work or Derivative Works thereof in any medium, with or without\r
+      modifications, and in Source or Object form, provided that You\r
+      meet the following conditions:\r
+\r
+      (a) You must give any other recipients of the Work or\r
+          Derivative Works a copy of this License; and\r
+\r
+      (b) You must cause any modified files to carry prominent notices\r
+          stating that You changed the files; and\r
+\r
+      (c) You must retain, in the Source form of any Derivative Works\r
+          that You distribute, all copyright, patent, trademark, and\r
+          attribution notices from the Source form of the Work,\r
+          excluding those notices that do not pertain to any part of\r
+          the Derivative Works; and\r
+\r
+      (d) If the Work includes a "NOTICE" text file as part of its\r
+          distribution, then any Derivative Works that You distribute must\r
+          include a readable copy of the attribution notices contained\r
+          within such NOTICE file, excluding those notices that do not\r
+          pertain to any part of the Derivative Works, in at least one\r
+          of the following places: within a NOTICE text file distributed\r
+          as part of the Derivative Works; within the Source form or\r
+          documentation, if provided along with the Derivative Works; or,\r
+          within a display generated by the Derivative Works, if and\r
+          wherever such third-party notices normally appear. The contents\r
+          of the NOTICE file are for informational purposes only and\r
+          do not modify the License. You may add Your own attribution\r
+          notices within Derivative Works that You distribute, alongside\r
+          or as an addendum to the NOTICE text from the Work, provided\r
+          that such additional attribution notices cannot be construed\r
+          as modifying the License.\r
+\r
+      You may add Your own copyright statement to Your modifications and\r
+      may provide additional or different license terms and conditions\r
+      for use, reproduction, or distribution of Your modifications, or\r
+      for any such Derivative Works as a whole, provided Your use,\r
+      reproduction, and distribution of the Work otherwise complies with\r
+      the conditions stated in this License.\r
+\r
+   5. Submission of Contributions. Unless You explicitly state otherwise,\r
+      any Contribution intentionally submitted for inclusion in the Work\r
+      by You to the Licensor shall be under the terms and conditions of\r
+      this License, without any additional terms or conditions.\r
+      Notwithstanding the above, nothing herein shall supersede or modify\r
+      the terms of any separate license agreement you may have executed\r
+      with Licensor regarding such Contributions.\r
+\r
+   6. Trademarks. This License does not grant permission to use the trade\r
+      names, trademarks, service marks, or product names of the Licensor,\r
+      except as required for reasonable and customary use in describing the\r
+      origin of the Work and reproducing the content of the NOTICE file.\r
+\r
+   7. Disclaimer of Warranty. Unless required by applicable law or\r
+      agreed to in writing, Licensor provides the Work (and each\r
+      Contributor provides its Contributions) on an "AS IS" BASIS,\r
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\r
+      implied, including, without limitation, any warranties or conditions\r
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\r
+      PARTICULAR PURPOSE. You are solely responsible for determining the\r
+      appropriateness of using or redistributing the Work and assume any\r
+      risks associated with Your exercise of permissions under this License.\r
+\r
+   8. Limitation of Liability. In no event and under no legal theory,\r
+      whether in tort (including negligence), contract, or otherwise,\r
+      unless required by applicable law (such as deliberate and grossly\r
+      negligent acts) or agreed to in writing, shall any Contributor be\r
+      liable to You for damages, including any direct, indirect, special,\r
+      incidental, or consequential damages of any character arising as a\r
+      result of this License or out of the use or inability to use the\r
+      Work (including but not limited to damages for loss of goodwill,\r
+      work stoppage, computer failure or malfunction, or any and all\r
+      other commercial damages or losses), even if such Contributor\r
+      has been advised of the possibility of such damages.\r
+\r
+   9. Accepting Warranty or Additional Liability. While redistributing\r
+      the Work or Derivative Works thereof, You may choose to offer,\r
+      and charge a fee for, acceptance of support, warranty, indemnity,\r
+      or other liability obligations and/or rights consistent with this\r
+      License. However, in accepting such obligations, You may act only\r
+      on Your own behalf and on Your sole responsibility, not on behalf\r
+      of any other Contributor, and only if You agree to indemnify,\r
+      defend, and hold each Contributor harmless for any liability\r
+      incurred by, or claims asserted against, such Contributor by reason\r
+      of your accepting any such warranty or additional liability.\r
+\r
+   END OF TERMS AND CONDITIONS\r
+\r
+   APPENDIX: How to apply the Apache License to your work.\r
+\r
+      To apply the Apache License to your work, attach the following\r
+      boilerplate notice, with the fields enclosed by brackets "[]"\r
+      replaced with your own identifying information. (Don't include\r
+      the brackets!)  The text should be enclosed in the appropriate\r
+      comment syntax for the file format. We also recommend that a\r
+      file or class name and description of purpose be included on the\r
+      same "printed page" as the copyright notice for easier\r
+      identification within third-party archives.\r
+\r
+   Copyright [yyyy] [name of copyright owner]\r
+\r
+   Licensed under the Apache License, Version 2.0 (the "License");\r
+   you may not use this file except in compliance with the License.\r
+   You may obtain a copy of the License at\r
+\r
+       http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+   Unless required by applicable law or agreed to in writing, software\r
+   distributed under the License is distributed on an "AS IS" BASIS,\r
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+   See the License for the specific language governing permissions and\r
+   limitations under the License.\r
+\r
diff --git a/common/include/sipc.h b/common/include/sipc.h
new file mode 100644 (file)
index 0000000..52da27e
--- /dev/null
@@ -0,0 +1,84 @@
+/*
+ * tel-plugin-socket-communicator
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Ja-young Gu <jygu@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __SIPC_H__
+#define __SIPC_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "sipc_type.h"
+#include "sipc_common.h"
+
+typedef struct _sipc_header                    sipc_header_t;
+typedef struct _sipc_channel           sipc_channel_t;
+
+typedef struct _sipc_server                    sipc_server_t;
+typedef struct _sipc_channel_key       sipc_channel_key_t;
+
+typedef struct _sipc_marshal_object sipc_marshal_object_t;
+
+
+sipc_channel_key_t*            sipc_channel_key_create( void );
+gboolean                               sipc_channel_key_destroy( sipc_channel_key_t *k );
+
+sipc_channel_t*                        sipc_channel_open( sipc_channel_key_t *k );
+gboolean                               sipc_channel_set_type( sipc_channel_t *ch, sipc_channel_type_e t );
+gboolean                               sipc_channel_connect( sipc_channel_t *ch, char *path );
+gboolean                               sipc_channel_register_rx_callback( sipc_channel_t *ch, sipc_callback_t *cb );
+gboolean                               sipc_channel_close( sipc_channel_t *ch, sipc_channel_key_t *k );
+int                                            sipc_channel_send( sipc_channel_t *ch, void *in_d, unsigned int in_data_len, void **out_d, sipc_data_type_e t );
+unsigned int                   sipc_channel_get_channel_id( sipc_channel_t *ch );
+
+
+
+sipc_server_t*                 sipc_server_open( char *path );
+gboolean                               sipc_server_register_rx_callback ( sipc_server_t *s, sipc_callback_t *cb );
+gboolean                               sipc_server_run( sipc_server_t *s );
+gboolean                               sipc_server_close( sipc_server_t *s );
+int                                            sipc_server_send( sipc_server_t *s, unsigned int ch_id, const void *data, unsigned int data_len, int option );
+gboolean                               sipc_server_broadcast( sipc_server_t *s, const void *data, unsigned int data_len );
+
+
+
+sipc_marshal_object_t* sipc_util_marshal_object_create(void);
+gboolean                               sipc_util_marshal_object_add_data(sipc_marshal_object_t *mo, const gchar* key, const void *data,
+                                                       sipc_marshal_data_type_e type);
+gboolean                               sipc_util_marshal_object_get_data(sipc_marshal_object_t *mo, const gchar* key, void **data,
+                                                       sipc_marshal_data_type_e type);
+gchar                                  sipc_util_marshal_object_get_char(struct _sipc_marshal_object *mo, const gchar* key);
+gboolean                               sipc_util_marshal_object_get_boolean(struct _sipc_marshal_object *mo, const gchar* key);
+gint                                   sipc_util_marshal_object_get_int(struct _sipc_marshal_object *mo, const gchar* key);
+gdouble                                        sipc_util_marshal_object_get_double(struct _sipc_marshal_object *mo, const gchar* key);
+gchar*                                 sipc_util_marshal_object_get_string(struct _sipc_marshal_object *mo, const gchar* key);
+sipc_marshal_object_t* sipc_util_marshal_object_get_object(struct _sipc_marshal_object *mo, const gchar* key);
+gboolean                               sipc_util_marshal_object_remove_data(sipc_marshal_object_t *mo, const gchar* key);
+gboolean                               sipc_util_marshal_object_remove_alldata(sipc_marshal_object_t *mo);
+gboolean                               sipc_util_marshal_object_destory(sipc_marshal_object_t *mo);
+
+gchar*                                 sipc_util_marshal_object_serializer(sipc_marshal_object_t *mo);
+sipc_marshal_object_t* sipc_util_marshal_object_deserializer(const gchar *inparam);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/common/include/sipc_common.h b/common/include/sipc_common.h
new file mode 100644 (file)
index 0000000..5620136
--- /dev/null
@@ -0,0 +1,61 @@
+/*
+ * tel-plugin-socket-communicator
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Ja-young Gu <jygu@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __SIPC_COMMON_H__
+#define __SIPC_COMMON_H__
+
+__BEGIN_DECLS
+
+#include <glib.h>
+
+#include "sipc_log.h"
+#include "sipc_type.h"
+
+struct _sipc_channel {
+       unsigned int            id;
+       sipc_channel_type_e type;               // sipc_channel_type_e
+       int                                     fd;
+       guint                           tag;
+};
+
+struct _sipc_header {
+       unsigned int             ch_id;
+       sipc_channel_type_e      ch_type;       // sipc_channel_type_e
+       sipc_command_e           cmd;           // sipc_command_e
+       sipc_encoding_type_e en_type;   // sipc_encoding_type_e
+       unsigned int             data_len;
+};
+
+#define SIPC_CHECK_DATA_NULL( data, ret ) { \
+       if ( !data ) { \
+               return ret; \
+       } \
+} 
+
+#define SIPC_CHECK_DATA_RANGE( data, min, max, ret ) { \
+       if ( data < min || data > max ) { \
+               return ret; \
+       } \
+}
+
+__END_DECLS
+
+#endif
+
diff --git a/common/include/sipc_log.h b/common/include/sipc_log.h
new file mode 100644 (file)
index 0000000..aac69ef
--- /dev/null
@@ -0,0 +1,58 @@
+/*
+ * tel-plugin-socket-communicator
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Ja-young Gu <jygu@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __TPAPI_LOG_H__
+#define __TPAPI_LOG_H__
+
+__BEGIN_DECLS
+
+#define ANSI_COLOR_NORMAL "\e[0m"
+
+#define ANSI_COLOR_BLACK "\e[0;30m"
+#define ANSI_COLOR_RED "\e[0;31m"
+#define ANSI_COLOR_GREEN "\e[0;32m"
+#define ANSI_COLOR_BROWN "\e[0;33m"
+#define ANSI_COLOR_BLUE "\e[0;34m"
+#define ANSI_COLOR_MAGENTA "\e[0;35m"
+#define ANSI_COLOR_CYAN "\e[0;36m"
+#define ANSI_COLOR_LIGHTGRAY "\e[0;37m"
+
+#define ANSI_COLOR_DARKGRAY "\e[1;30m"
+#define ANSI_COLOR_LIGHTRED "\e[1;31m"
+#define ANSI_COLOR_LIGHTGREEN "\e[1;32m"
+#define ANSI_COLOR_YELLOW "\e[1;33m"
+#define ANSI_COLOR_LIGHTBLUE "\e[1;34m"
+#define ANSI_COLOR_LIGHTMAGENTA "\e[1;35m"
+#define ANSI_COLOR_LIGHTCYAN "\e[1;36m"
+#define ANSI_COLOR_WHITE "\e[1;37m"
+
+#ifndef TELEPHONY_LOG_FILE
+#define TELEPHONY_LOG_FILE stdout
+#endif
+#if 0
+#define msg(fmt,args...)  { fprintf(TELEPHONY_LOG_FILE, fmt "\n", ##args); fflush(TELEPHONY_LOG_FILE); }
+#define dbg(fmt,args...)  { fprintf(TELEPHONY_LOG_FILE, ANSI_COLOR_LIGHTGRAY "<%s:%s> " ANSI_COLOR_NORMAL fmt "\n", __FILE__, __FUNCTION__, ##args); fflush(TELEPHONY_LOG_FILE); }
+#define warn(fmt,args...) { fprintf(TELEPHONY_LOG_FILE, ANSI_COLOR_YELLOW "<%s:%s> " ANSI_COLOR_NORMAL fmt "\n", __FILE__, __FUNCTION__, ##args); fflush(TELEPHONY_LOG_FILE); }
+#define err(fmt,args...)  { fprintf(TELEPHONY_LOG_FILE, ANSI_COLOR_LIGHTRED "<%s:%s> " ANSI_COLOR_NORMAL fmt "\n", __FILE__, __FUNCTION__, ##args); fflush(TELEPHONY_LOG_FILE); }
+#endif
+
+__END_DECLS
+
+#endif
diff --git a/common/include/sipc_type.h b/common/include/sipc_type.h
new file mode 100644 (file)
index 0000000..785bc88
--- /dev/null
@@ -0,0 +1,75 @@
+/*
+ * tel-plugin-socket-communicator
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Ja-young Gu <jygu@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __SIPC_TYPE_H__
+#define __SIPC_TYPE_H__
+
+__BEGIN_DECLS
+
+#include <glib.h>
+#include <glib-object.h>
+
+typedef enum {
+       SIPC_CHANNEL_TYPE_TX = 0x01,
+       SIPC_CHANNEL_TYPE_RX,
+} sipc_channel_type_e;
+
+typedef enum {
+       SIPC_SEND_DATA_SYNC = 0x01,
+       SIPC_SEND_DATA_ASYNC,
+       SIPC_SEND_DATA_BROADCAST,
+       SIPC_REGISTER_CHANNEL,
+       SIPC_DEREGISTER_CHANNEL,
+
+       SIPC_ACK_SUCCESS,
+       SIPC_ACK_FAIL,
+} sipc_command_e;
+
+typedef enum {
+       SIPC_DATA_TYPE_SYNC = 0x01,
+       SIPC_DATA_TYPE_ASYNC,
+} sipc_data_type_e;
+
+typedef enum {
+       SIPC_ENCODING_TYPE,
+} sipc_encoding_type_e;
+
+typedef enum {
+       SIPC_MARSHAL_DATA_CHAR_TYPE = G_TYPE_CHAR,
+       SIPC_MARSHAL_DATA_BOOLEAN_TYPE = G_TYPE_BOOLEAN,
+       SIPC_MARSHAL_DATA_INT_TYPE = G_TYPE_INT,
+       SIPC_MARSHAL_DATA_DOUBLE_TYPE = G_TYPE_DOUBLE,
+       SIPC_MARSHAL_DATA_STRING_TYPE = G_TYPE_STRING,
+       SIPC_MARSHAL_DATA_OBJECT_TYPE = G_TYPE_BOXED,
+       SIPC_MARSHAL_DATA_STRING_MAX = 0xFF,
+} sipc_marshal_data_type_e;
+
+typedef int(*sipc_cb)( unsigned int id, void *inparam, unsigned int inparam_len, void** outparam, void *cb_data );
+
+typedef struct {
+       sipc_cb func;
+       void *data;
+} sipc_callback_t;
+
+
+__END_DECLS
+
+#endif
+
diff --git a/common/include/tapi_common.h b/common/include/tapi_common.h
new file mode 100644 (file)
index 0000000..584ad3b
--- /dev/null
@@ -0,0 +1,68 @@
+/*
+ * tel-plugin-socket-communicator
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Ja-young Gu <jygu@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __TAPI_COMMON_H__
+#define __TAPI_COMMON_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <glib.h>
+#include <glib-object.h>
+
+#include "sipc.h"
+#include "tapi_type.h"
+
+struct _tapi_handle {
+       char                            app_name[ 16 ];
+       char                            cp_name[ 16 ];
+       char                            cookie[ 20 ];
+       sipc_channel_key_t* key;
+       sipc_channel_t*         tx_ch;
+       sipc_channel_t*         rx_ch;
+       GSList*                         cfrms;
+       GSList*                         notis;
+};
+
+struct _tapi_header {
+       char                                    cookie[ 20 ];
+       char                                    app_name[ 16 ];
+       char                                    cp_name[ 16 ];
+       tapi_service_command_e  cmd;
+       unsigned int                    data_len;
+};
+
+struct _tapi_event {
+       unsigned int    event;
+       tapi_cb                 cb;
+       void*                   cb_data;
+};
+
+struct _tapi_service_object {
+       tapi_service_command_e  cmd;
+       sipc_marshal_object_t*  mo;
+};
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/common/include/tapi_type.h b/common/include/tapi_type.h
new file mode 100644 (file)
index 0000000..0c8c401
--- /dev/null
@@ -0,0 +1,228 @@
+/*
+ * tel-plugin-socket-communicator
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Ja-young Gu <jygu@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __TAPI_TYPE_H__
+#define __TAPI_TYPE_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define TCORE_REQUEST          0x10000000
+//#define TCORE_RESPONSE               0x20000000
+#define TCORE_NOTIFICATION     0x30000000
+
+#define TAPI_TYPE_SERVER       0x00200000
+#define TAPI_TYPE_MODEM                0x00300000
+#define TAPI_TYPE_CALL         0x01000000
+#define TAPI_TYPE_NETWORK      0x01100000
+#define TAPI_TYPE_PS           0x01200000
+#define TAPI_TYPE_PDP          0x01300000
+#define TAPI_TYPE_SIM          0x01400000
+#define TAPI_TYPE_SAT          0x01500000
+#define TAPI_TYPE_SAP          0x01600000
+#define TAPI_TYPE_SMS          0x01700000
+#define TAPI_TYPE_PHONEBOOK    0x01800000
+#define TAPI_TYPE_SS           0x01900000
+#define TAPI_TYPE_SOUND                0x01A00000
+#define TAPI_TYPE_GPS          0x01B00000
+#define TAPI_TYPE_CUSTOM       0x0F000000
+
+typedef enum {
+       TAPI_SERVICE_UNKNOWN = 0,
+
+       TAPI_SERVICE_MODEM = TCORE_REQUEST | TAPI_TYPE_MODEM,
+       TAPI_SERVICE_MODEM_SET_FLIGHTMODE,
+       TAPI_SERVICE_MODEM_GET_FLIGHTMODE,
+       TAPI_SERVICE_MODEM_GET_IMEI,
+       TAPI_SERVICE_MODEM_GET_VERSION,
+
+       TAPI_SERVICE_CALL = TCORE_REQUEST | TAPI_TYPE_CALL,
+       TAPI_SERVICE_CALL_DIAL,
+       TAPI_SERVICE_ANSWER,
+       TAPI_SERVICE_END,
+       TAPI_SERVICE_HOLD,
+       TAPI_SERVICE_ACTIVE,
+       TAPI_SERVICE_SWAP,
+       TAPI_SERVICE_JOIN,
+       TAPI_SERVICE_SPLIT,
+       TAPI_SERVICE_DEFLECT,
+       TAPI_SERVICE_TRANSFER,
+       TAPI_SERVICE_SEND_DTMF,
+       TAPI_SERVICE_SET_SOUND_PATH,
+       TAPI_SERVICE_GET_SOUND_VOLUME_LEVEL,
+       TAPI_SERVICE_SET_SOUND_VOLUME_LEVEL,
+       TAPI_SERVICE_MUTE,
+       TAPI_SERVICE_UNMUTE,
+       TAPI_SERVICE_GET_MUTE_STATUS,
+
+       TAPI_SERVICE_SIM = TCORE_REQUEST | TAPI_TYPE_SIM,
+       TAPI_SERVICE_SIM_GET_SIMINITINFO,
+       TAPI_SERVICE_SIM_GET_IMSI,
+       TAPI_SERVICE_SIM_GET_TYPE,
+       TAPI_SERVICE_SIM_GET_ECC,
+       TAPI_SERVICE_SIM_GET_ICCID,
+       TAPI_SERVICE_SIM_GET_LANGUAGE,
+       TAPI_SERVICE_SIM_SET_LANGUAGE,
+       TAPI_SERVICE_SIM_GET_CF,
+       TAPI_SERVICE_SIM_SET_CF,
+       TAPI_SERVICE_SIM_GET_MW,
+       TAPI_SERVICE_SIM_SET_MW,
+       TAPI_SERVICE_SIM_GET_MB,
+       TAPI_SERVICE_SIM_SET_MB,
+       TAPI_SERVICE_SIM_GET_CPHSINFO,
+       TAPI_SERVICE_SIM_AUTHENTICATION,
+       TAPI_SERVICE_SIM_VERIFYSEC,
+       TAPI_SERVICE_SIM_VERIFYPUK,
+       TAPI_SERVICE_SIM_CHANGEPIN,
+       TAPI_SERVICE_SIM_DISABLE_FACILITY,
+       TAPI_SERVICE_SIM_ENABLE_FACILITY,
+       TAPI_SERVICE_SIM_GET_FACILITY,
+       TAPI_SERVICE_SIM_APDU,
+       TAPI_SERVICE_SIM_ATR,
+
+       TAPI_SERVICE_SAP = TCORE_REQUEST | TAPI_TYPE_SAP,
+       TAPI_SERVICE_SAP_CONNECT,
+       TAPI_SERVICE_SAP_DISCONNECT,
+       TAPI_SERVICE_SAP_GET_CONNECTSTATUS,
+       TAPI_SERVICE_SAP_GET_ATR,
+       TAPI_SERVICE_SAP_TRANSFER_APDU,
+       TAPI_SERVICE_SAP_SET_PROTOCOL,
+       TAPI_SERVICE_SAP_SET_POWER,
+       TAPI_SERVICE_SAP_GET_READERSTATUS,
+
+       TAPI_SERVICE_PB = TCORE_REQUEST | TAPI_TYPE_PHONEBOOK,
+       TAPI_SERVICE_PB_GET_INITINFO,
+       TAPI_SERVICE_PB_GET_COUNT,
+       TAPI_SERVICE_PB_GET_META,
+       TAPI_SERVICE_PB_READ_RECORD,
+       TAPI_SERVICE_PB_UPDATE_RECORD,
+       TAPI_SERVICE_PB_DELETE_RECORD,
+
+       TAPI_SERVICE_NETWORK = TCORE_REQUEST | TAPI_TYPE_NETWORK,
+       TAPI_SERVICE_NETWORK_SEARCH,
+       TAPI_SERVICE_NETWORK_SET_PLMN_SELECTION_MODE,
+       TAPI_SERVICE_NETWORK_GET_PLMN_SELECTION_MODE,
+       TAPI_SERVICE_NETWORK_SET_SERVICE_DOMAIN,
+       TAPI_SERVICE_NETWORK_GET_SERVICE_DOMAIN,
+       TAPI_SERVICE_NETWORK_SET_BAND,
+       TAPI_SERVICE_NETWORK_GET_BAND,
+       TAPI_SERVICE_NETWORK_SET_PREFERRED_PLMN,
+       TAPI_SERVICE_NETWORK_GET_PREFERRED_PLMN,
+       TAPI_SERVICE_NETWORK_SET_ORDER,
+       TAPI_SERVICE_NETWORK_GET_ORDER,
+       TAPI_SERVICE_NETWORK_SET_POWER_ON_ATTACH,
+       TAPI_SERVICE_NETWORK_GET_POWER_ON_ATTACH,
+       TAPI_SERVICE_NETWORK_SET_CANCEL_MANUAL_SEARCH,
+       TAPI_SERVICE_NETWORK_GET_SERVING_NETWORK,
+
+       TAPI_SERVICE_PS = TCORE_REQUEST | TAPI_TYPE_PS,
+       TAPI_SERVICE_PS_SET_DUN_PIN_CONTROL,
+
+       TAPI_SERVICE_SMS = TCORE_REQUEST | TAPI_TYPE_SMS,
+       TAPI_SERVICE_SMS_SEND_UMTS_MSG, /* Send the SMS-SUBMIT, SMS-COMMAND or SMS-SUBMIT-REPORT message */
+       TAPI_SERVICE_SMS_READ_MSG, /* Read the message from the phone flash or SIM */
+       TAPI_SERVICE_SMS_SAVE_MSG, /* Stores a message to memory storage */
+       TAPI_SERVICE_SMS_DELETE_MSG, /* Deletes message from preferred message storage */
+       TAPI_SERVICE_SMS_GET_COUNT, /* Get SMS Count Stored in Memory */
+       TAPI_SERVICE_SMS_GET_SCA, /* Get SMS Service Center Address */
+       TAPI_SERVICE_SMS_SET_SCA, /* Set SMS Service Center Address */
+       TAPI_SERVICE_SMS_GET_CB_CONFIG, /* Get Cell Broadcast Configuration */
+       TAPI_SERVICE_SMS_SET_CB_CONFIG, /* Set Cell Broadcast Configuration */
+       TAPI_SERVICE_SMS_SET_MEM_STATUS, /* Memory Storage Status message*/
+       TAPI_SERVICE_SMS_GET_PREF_BEARER, /* Get SMS Service Option like CS/PS bearer */
+       TAPI_SERVICE_SMS_SET_PREF_BEARER, /* Set SMS Service Option like CS/PS bearer */
+       TAPI_SERVICE_SMS_SET_DELIVERY_REPORT, /* Send the SMS-DELIVER-REPORT message to the network for the SMS-DELIVER message. */
+       TAPI_SERVICE_SMS_SET_MSG_STATUS, /* SMS Status Stored in Memory message */
+       TAPI_SERVICE_SMS_GET_PARAMS,
+       TAPI_SERVICE_SMS_SET_PARAMS,
+       TAPI_SERVICE_SMS_GET_PARAMCNT,
+       TAPI_SERVICE_SMS_SEND_CDMA_MSG,
+
+       TAPI_SERVICE_CUSTOM =  TCORE_REQUEST | TAPI_TYPE_CUSTOM,
+} tapi_service_command_e;
+
+typedef enum {
+       TAPI_NOTI_UNKNOWN = 0,
+
+       TAPI_NOTI_CALL = TCORE_NOTIFICATION | TAPI_TYPE_CALL,
+       TAPI_NOTI_CALL_STATUS_IDLE,
+       TAPI_NOTI_CALL_STATUS_ACTIVE,
+       TAPI_NOTI_CALL_STATUS_HELD,
+       TAPI_NOTI_CALL_STATUS_DIALING,
+       TAPI_NOTI_CALL_STATUS_ALERT,
+       TAPI_NOTI_CALL_STATUS_INCOMING,
+       TAPI_NOTI_CALL_STATUS_WAITING,
+       TAPI_NOTI_CALL_FORWARD,
+       TAPI_NOTI_CALL_BARRING,
+
+       TAPI_NOTI_SIM = TCORE_NOTIFICATION | TAPI_TYPE_SIM,
+       TAPI_NOTI_SIM_STATUS,
+
+       TAPI_NOTI_SAP = TCORE_NOTIFICATION | TAPI_TYPE_SAP,
+       TAPI_NOTI_SAP_STATUS,
+       TAPI_NOTI_SAP_DISCONNECT,
+
+       TAPI_NOTI_PB = TCORE_NOTIFICATION | TAPI_TYPE_PHONEBOOK,
+       TAPI_NOTI_PB_STATUS,
+
+       TAPI_NOTI_NETWORK = TCORE_NOTIFICATION | TAPI_TYPE_NETWORK,
+       TAPI_NOTI_NETWORK_REGISTRATION_STATUS,
+       TAPI_NOTI_NETWORK_LOCATION_CELLINFO,
+       TAPI_NOTI_NETWORK_ICON_INFO,
+       TAPI_NOTI_NETWORK_CHANGE,
+       TAPI_NOTI_NETWORK_TIMEINFO,
+
+       TAPI_NOTI_PS = TCORE_NOTIFICATION | TAPI_TYPE_PS,
+       TAPI_NOTI_PS_DUN_PIN_CONTROL,
+       TAPI_NOTI_PS_EXTERNAL_CALL,
+
+       TAPI_NOTI_SMS = TCORE_NOTIFICATION | TAPI_TYPE_SMS,
+       TAPI_NOTI_SMS_INCOM_MSG,                        /* This is an unsolicited Incoming SMS Event*/
+       TAPI_NOTI_SMS_CB_INCOM_MSG,             /* This is an unsolicited Incoming cell broadcast message*/
+       TAPI_NOTI_SMS_INCOM_EX_MSG,             /* This is an extended unsolicited Incoming SMS Event*/
+       TAPI_NOTI_SMS_CB_INCOM_EX_MSG,  /* This is an extended unsolicited Incoming cell broadcast message*/
+       TAPI_NOTI_SMS_MEMORY_STATUS,            /* This event is an unsolicited event indicating SIM memory status */
+       TAPI_NOTI_SMS_DEVICE_READY,             /* Device Ready indication */
+       TAPI_NOTI_SMS_IND_MAX,
+
+       TAPI_NOTI_CUSTOM =  TCORE_NOTIFICATION | TAPI_TYPE_CUSTOM,
+} tapi_service_notification_e;
+
+typedef enum {
+       TAPI_OBJECT_DATA_TYPE_CHAR,
+       TAPI_OBJECT_DATA_TYPE_BOOLEAN,
+       TAPI_OBJECT_DATA_TYPE_INT,
+       TAPI_OBJECT_DATA_TYPE_DOUBLE,
+       TAPI_OBJECT_DATA_TYPE_STRING,
+       TAPI_OBJECT_DATA_TYPE_OBJECT,
+       TAPI_OBJECT_DATA_TYPE_MAX
+} tapi_object_data_type_e;
+
+typedef struct _tapi_handle tapi_handle_t;
+typedef struct _tapi_service_object tapi_service_object_t;
+
+typedef gboolean (*tapi_cb)(tapi_service_object_t *data, void *cb_data);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/common/src/sipc_channel.c b/common/src/sipc_channel.c
new file mode 100644 (file)
index 0000000..126c052
--- /dev/null
@@ -0,0 +1,404 @@
+/*
+ * tel-plugin-socket-communicator
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Ja-young Gu <jygu@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdio.h>
+#include <string.h>
+
+#include <errno.h>
+#include <sys/un.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/stat.h>
+
+#include "sipc_common.h"
+#include "sipc.h"
+
+struct _sipc_channel_key {
+       unsigned int id;
+       int fd;
+};
+
+static gboolean _check_key_info(struct _sipc_channel_key *k)
+{
+       struct stat buf;
+       int ret = 0;
+
+       SIPC_CHECK_DATA_NULL( k, FALSE);
+
+       memset(&buf, '\0', sizeof(struct stat));
+
+       errno = 0;
+       ret = fstat(k->fd, &buf);
+       if (ret < 0) {
+               // debug msg using strerror( errno );
+               return FALSE;
+       }
+
+       if ((buf.st_mode & S_IFMT) != S_IFSOCK) {
+               // debug msg : it's not socket fd
+               return FALSE;
+       }
+
+       if (k->id == (unsigned int) buf.st_ino)
+               return TRUE;
+
+       return FALSE;
+}
+
+static gboolean _check_channel_type(struct _sipc_channel *ch, sipc_channel_type_e t)
+{
+       SIPC_CHECK_DATA_NULL( ch, FALSE);
+       SIPC_CHECK_DATA_RANGE( t, SIPC_CHANNEL_TYPE_TX, SIPC_CHANNEL_TYPE_RX, FALSE);
+
+       if (ch->type != t)
+               return FALSE;
+
+       return TRUE;
+}
+
+static gboolean _check_channel_rx_type(struct _sipc_channel *ch)
+{
+       SIPC_CHECK_DATA_NULL( ch, FALSE);
+
+       if (!_check_channel_type(ch, SIPC_CHANNEL_TYPE_RX))
+               return FALSE;
+
+       return TRUE;
+}
+
+static gboolean _check_channel_info(struct _sipc_channel *ch)
+{
+       SIPC_CHECK_DATA_NULL( ch, FALSE);
+
+       if (!ch->id || !ch->fd || !ch->type) {
+               return FALSE;
+       }
+
+       return TRUE;
+}
+
+static struct _sipc_header* _create_header(struct _sipc_channel *ch, sipc_command_e c, int data_type, int data_len)
+{
+       struct _sipc_header *h;
+
+       SIPC_CHECK_DATA_NULL( ch, 0);
+       SIPC_CHECK_DATA_RANGE( c, SIPC_SEND_DATA_SYNC, SIPC_DEREGISTER_CHANNEL, 0);
+
+       h = g_new0( struct _sipc_header, 1 );
+       h->ch_id = ch->id;
+       h->ch_type = ch->type;
+       h->cmd = c;
+       h->en_type = data_type;
+       h->data_len = data_len;
+
+       return h;
+}
+
+static int _channel_send(int fd, struct _sipc_header *h, void* in_d, void** out_d)
+{
+       int p_len;
+       char *p;
+       int ret = -1;
+
+       SIPC_CHECK_DATA_NULL( (fd && h), -1);
+       // 1 will be wrong input
+
+       p_len = sizeof(struct _sipc_header) + h->data_len;
+       p = g_new0( char, p_len );
+
+       memcpy(p, h, sizeof(struct _sipc_header));
+
+       if (in_d && h->data_len)
+               memcpy(p + sizeof(struct _sipc_header), (char*) in_d, h->data_len);
+
+       ret = send(fd, p, p_len, MSG_NOSIGNAL);
+       dbg("send data (%d) to server", ret);
+       if (ret < 0) {
+               g_free(p);
+               g_free(h);
+               return -1;
+       }
+
+       memset(h, 0, sizeof(struct _sipc_header));
+       ret = recv(fd, h, sizeof(struct _sipc_header), MSG_NOSIGNAL);
+       if (ret < 0) {
+               dbg("fail to read ack data from server");
+               g_free(p);
+               g_free(h);
+               return -1;
+       }
+
+       if (h->cmd != SIPC_ACK_SUCCESS) {
+               dbg("fail to request");
+               g_free(p);
+               g_free(h);
+               return -1;
+       }
+
+       if (h->data_len > 0) {
+               *out_d = g_new0( char, (h->data_len)+1 );
+               ret = recv(fd, *out_d, h->data_len, MSG_NOSIGNAL);
+               //dbg("server returns data\n (%s)\n", *out_d);
+       }
+
+       g_free(p);
+       g_free(h);
+       return 1;
+}
+
+static int _channel_deliver_data(struct _sipc_header *h, void *data, sipc_callback_t *cb)
+{
+       int ret = -1;
+       
+       SIPC_CHECK_DATA_NULL( (h && cb), -1);
+
+       ret = cb->func(h->ch_id, data, h->data_len, NULL, cb->data);
+
+       return ret;
+}
+
+static gboolean _channel_recv(GIOChannel *ch, GIOCondition con, gpointer data)
+{
+       int fd = 0;
+       int ret = -1;
+       char *in_d = NULL;
+       struct _sipc_header h_rsp = { 0, };
+       sipc_callback_t* cb;
+       gboolean ack = 0;
+
+       fd = g_io_channel_unix_get_fd(ch);
+       memset(&h_rsp, 0, sizeof(struct _sipc_header));
+
+       ret = recv(fd, &h_rsp, sizeof(struct _sipc_header), MSG_NOSIGNAL);
+       if (ret < 0) {
+               dbg("recv() fail. ret = %d", ret);
+               return FALSE;
+       }
+
+       if (h_rsp.data_len > 0) {
+               in_d = g_new0( char, (h_rsp.data_len)+1 );
+               ret = recv(fd, in_d, h_rsp.data_len, MSG_NOSIGNAL);
+               if (ret < 0) {
+                       dbg("error to get header in socket");
+                       g_free(in_d);
+                       return FALSE;
+               }
+               dbg("recv data (%d)", ret);
+       }
+
+       cb = (sipc_callback_t*) data;
+       ack = _channel_deliver_data(&h_rsp, (void*) in_d, cb);
+       g_free(in_d);
+
+       if (ack < 0)
+               return FALSE;
+
+       return TRUE;
+}
+
+// API SET
+
+struct _sipc_channel_key* sipc_channel_key_create()
+{
+       struct _sipc_channel_key *k;
+       int ret = 0;
+       struct stat buf;
+
+       k = g_new0( struct _sipc_channel_key, 1 );
+
+       k->fd = socket(AF_UNIX, SOCK_STREAM, 0);
+       if (k->fd < 0)
+               return 0;
+
+       memset(&buf, '\0', sizeof(struct stat));
+
+       errno = 0;
+       ret = fstat(k->fd, &buf);
+       if (ret < 0) {
+               // debug msg using strerror( errno );
+               close(k->fd);
+               return 0;
+       }
+
+       if ((buf.st_mode & S_IFMT) != S_IFSOCK) {
+               // debug msg : it's not socket fd
+               close(k->fd);
+               return 0;
+       }
+
+       k->id = (unsigned int) buf.st_ino;
+
+       return k;
+}
+
+struct _sipc_channel* sipc_channel_open(struct _sipc_channel_key *k)
+{
+       int fd = 0;
+       struct _sipc_channel *ch = 0;
+
+       SIPC_CHECK_DATA_NULL( k, 0);
+
+       if (!_check_key_info(k))
+               return 0;
+
+       fd = socket(AF_UNIX, SOCK_STREAM, 0);
+       if (fd < 0) {
+               return 0;
+       }
+
+       ch = g_new0( struct _sipc_channel, 1 );
+       ch->fd = fd;
+       ch->id = k->id;
+
+       return ch;
+}
+
+gboolean sipc_channel_set_type(struct _sipc_channel *ch, sipc_channel_type_e t)
+{
+       SIPC_CHECK_DATA_NULL( ch, FALSE);
+       SIPC_CHECK_DATA_RANGE( t, SIPC_CHANNEL_TYPE_TX, SIPC_CHANNEL_TYPE_RX, FALSE);
+
+       ch->type = t;
+
+       return TRUE;
+}
+
+gboolean sipc_channel_connect(struct _sipc_channel *ch, char *path)
+{
+       struct sockaddr_un server_addr;
+       int ret = -1;
+       struct _sipc_header *h = 0;
+
+       if (!_check_channel_info(ch))
+               return FALSE;
+
+       memset(&server_addr, 0, sizeof(server_addr));
+
+       server_addr.sun_family = AF_UNIX;
+       strcpy((char*) server_addr.sun_path, path);
+
+       ret = connect(ch->fd, (struct sockaddr*) &server_addr, sizeof(server_addr));
+       if (ret < 0)
+               return FALSE;
+
+       h = _create_header(ch, SIPC_REGISTER_CHANNEL, 0, 0);
+
+       ret = send(ch->fd, h, sizeof(struct _sipc_header), MSG_NOSIGNAL);
+       dbg("send register data(%d) ch->fd(%d), ch->type(%d)", ret, ch->fd, ch->type);
+       if (ret < 0) {
+               g_free(h);
+               return FALSE;
+       }
+
+       memset(h, 0, sizeof(struct _sipc_header));
+       ret = recv(ch->fd, h, sizeof(struct _sipc_header), MSG_NOSIGNAL);
+       dbg("recv register data(%d) ch->fd(%d), h->command(%d)", ret, ch->fd, h->cmd);
+       if (ret < 0) {
+               g_free(h);
+               return FALSE;
+       }
+
+       if (h->cmd != SIPC_ACK_SUCCESS) {
+               g_free(h);
+               return FALSE;
+       }
+
+       g_free(h);
+       return TRUE;
+}
+
+gboolean sipc_channel_register_rx_callback(struct _sipc_channel *ch, sipc_callback_t *cb)
+{
+       guint tag = 0;
+       GIOChannel *c = 0;
+
+       if (!_check_channel_info(ch))
+               return FALSE;
+
+       if (!_check_channel_rx_type(ch))
+               return FALSE;
+
+       SIPC_CHECK_DATA_NULL( cb, FALSE);
+
+       dbg("g_io_channel_unix_new(fd = %d)", ch->fd);
+       c = g_io_channel_unix_new(ch->fd);
+       if (!c) {
+               // debug msg
+               dbg("g_io_channel_unix_new failed.");
+               return FALSE;
+       }
+
+       tag = g_io_add_watch(c, (G_IO_IN | G_IO_ERR | G_IO_HUP | G_IO_NVAL), (GIOFunc) _channel_recv, cb);
+       if (!tag) {
+               // debug msg
+               dbg("g_io_add_watch failed.");
+               return FALSE;
+       }
+
+       ch->tag = tag;
+
+       return TRUE;
+}
+
+int sipc_channel_send(struct _sipc_channel *ch, void *in_d, unsigned int in_data_len, void **out_d, sipc_data_type_e t)
+{
+       struct _sipc_header *h = 0;
+
+       if (!_check_channel_info(ch))
+               return -1;
+
+       SIPC_CHECK_DATA_RANGE(t, SIPC_DATA_TYPE_SYNC, SIPC_DATA_TYPE_ASYNC, -1);
+
+       h = _create_header(ch, (sipc_command_e) t, 0, in_data_len);
+
+       return _channel_send(ch->fd, h, in_d, out_d);
+}
+
+gboolean sipc_channel_close(struct _sipc_channel *ch, struct _sipc_channel_key *k)
+{
+       if (!_check_key_info(k))
+               return FALSE;
+
+       if (!_check_channel_info(ch))
+               return FALSE;
+
+       sipc_channel_send(ch, 0, 0, NULL, SIPC_DEREGISTER_CHANNEL);
+
+       close(ch->fd);
+
+       return TRUE;
+}
+
+gboolean sipc_channel_key_destroy(struct _sipc_channel_key *k)
+{
+       if (!_check_key_info(k))
+               return FALSE;
+
+       close(k->fd);
+
+       return TRUE;
+}
+
+unsigned int sipc_channel_get_channel_id(struct _sipc_channel *ch)
+{
+       SIPC_CHECK_DATA_NULL( ch, -1);
+
+       return ch->id;
+}
diff --git a/common/src/sipc_marshal.c b/common/src/sipc_marshal.c
new file mode 100644 (file)
index 0000000..d8397ce
--- /dev/null
@@ -0,0 +1,435 @@
+/*
+ * tel-plugin-socket-communicator
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Ja-young Gu <jygu@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "sipc_common.h"
+#include "sipc.h"
+
+static GHashTable* _sipc_util_marshal_object_deserializer(const gchar *inparam);
+
+struct _sipc_marshal_object {
+       GHashTable *ht;
+};
+
+static void _sipc_util_remove_hashtable_value(gpointer value)
+{
+       unsigned int gtype = 0;
+       struct _sipc_marshal_object *tmp_obj = value;
+
+       gtype = ((GValue *) value)->g_type;
+       if (gtype == G_TYPE_HASH_TABLE) {
+               tmp_obj = g_value_get_boxed(value);
+               g_hash_table_destroy(tmp_obj->ht);
+       }
+
+       g_value_unset((GValue *) value);
+       return;
+}
+
+static gboolean _sipc_util_create_gvalue(GValue *value, const void *data, sipc_marshal_data_type_e type)
+{
+
+       switch (type) {
+               case SIPC_MARSHAL_DATA_CHAR_TYPE:
+                       g_value_init(value, type);
+                       g_value_set_char(value, *((gchar *) data));
+                       break;
+
+               case SIPC_MARSHAL_DATA_BOOLEAN_TYPE:
+                       g_value_init(value, type);
+                       g_value_set_boolean(value, *((gboolean *) data));
+                       break;
+
+               case SIPC_MARSHAL_DATA_INT_TYPE:
+                       g_value_init(value, type);
+                       g_value_set_int(value, *((gint *) data));
+                       break;
+
+               case SIPC_MARSHAL_DATA_DOUBLE_TYPE:
+                       g_value_init(value, type);
+                       g_value_set_double(value, *((gdouble *) data));
+                       break;
+
+               case SIPC_MARSHAL_DATA_STRING_TYPE:
+                       g_value_init(value, type);
+                       g_value_set_string(value, (gchar *) data);
+                       break;
+
+               case SIPC_MARSHAL_DATA_OBJECT_TYPE:
+                       g_value_init(value, G_TYPE_HASH_TABLE);
+                       g_value_set_boxed(value, (gpointer) data);
+                       break;
+
+               default:
+                       return FALSE;
+                       break;
+       }
+
+       return TRUE;
+}
+
+static gboolean _sipc_util_return_value(GValue *src, void **dest, sipc_marshal_data_type_e type)
+{
+       gboolean rv = FALSE;
+       struct _sipc_marshal_object *tmp = NULL;
+
+       switch (type) {
+               case SIPC_MARSHAL_DATA_CHAR_TYPE:
+                       *dest = g_new0(gchar, 1);
+                       *((gchar *) *dest) = g_value_get_char(src);
+                       break;
+
+               case SIPC_MARSHAL_DATA_BOOLEAN_TYPE:
+                       *dest = g_new0(gboolean, 1);
+                       *((gboolean *) *dest) = g_value_get_boolean(src);
+                       break;
+
+               case SIPC_MARSHAL_DATA_INT_TYPE:
+                       *dest = g_new0(gint, 1);
+                       *((gint *) *dest) = g_value_get_int(src);
+                       break;
+
+               case SIPC_MARSHAL_DATA_DOUBLE_TYPE:
+                       *dest = g_new0(gdouble, 1);
+                       *((gdouble *) *dest) = g_value_get_double(src);
+                       break;
+
+               case SIPC_MARSHAL_DATA_STRING_TYPE:
+                       *dest = g_value_dup_string(src);
+                       break;
+
+               case SIPC_MARSHAL_DATA_OBJECT_TYPE:
+                       tmp = g_new0(struct _sipc_marshal_object, 1);
+                       tmp->ht = g_value_dup_boxed(src);
+                       *dest = tmp;
+                       //*dest = g_value_dup_boxed(src);
+                       break;
+
+               default:
+                       return FALSE;
+                       break;
+       }
+
+       return TRUE;
+}
+
+static gboolean _sipc_util_str_to_type(GValue *src, GValue *dest, unsigned int dest_type)
+{
+       gboolean rv = FALSE;
+
+       if(dest_type == G_TYPE_HASH_TABLE)
+               dest_type = G_TYPE_BOXED;
+
+       switch (dest_type) {
+               case G_TYPE_INT: {
+                       gint64 tmp = 0;
+                       tmp = g_ascii_strtoll(g_value_get_string(src), NULL, 10);
+                       g_value_set_int(dest, tmp);
+               }
+                       break;
+               case G_TYPE_BOOLEAN: {
+                       gboolean tmp = FALSE;
+                       tmp = g_ascii_strncasecmp(g_value_get_string(src), "TRUE", 4) == 0 ? TRUE : FALSE;
+                       g_value_set_boolean(dest, tmp);
+               }
+                       break;
+               case G_TYPE_STRING: {
+                       const gchar* tmp = NULL;
+                       tmp = g_value_get_string(src);
+                       g_value_set_string(dest, tmp);
+               }
+                       break;
+               case G_TYPE_DOUBLE: {
+                       gdouble tmp = 0;
+                       tmp = g_ascii_strtod(g_value_get_string(src), NULL);
+                       g_value_set_double(dest, tmp);
+               }
+                       break;
+               case G_TYPE_BOXED:{
+                       GHashTable* tmp;
+                       tmp = _sipc_util_marshal_object_deserializer(g_value_get_string(src));
+                       g_value_set_boxed(dest, tmp);
+               }
+                       break;
+               default: {
+                       return FALSE;
+               }
+                       break;
+       }
+
+       return TRUE;
+}
+
+static GHashTable* _sipc_util_marshal_object_deserializer(const gchar *inparam)
+{
+       int index = 0;
+       gchar **tuple = NULL;
+       GHashTable *ht = NULL;
+
+       ht = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, _sipc_util_remove_hashtable_value);
+       if (strlen(inparam) == 0) {
+               return ht;
+       }
+
+       tuple = g_strsplit((gchar *) inparam, "/", 0);
+
+       while (strlen(tuple[index]) > 3) {
+               int tmp = 0;
+               gchar *content = NULL;
+               gchar **inner_tuple = NULL;
+               GValue *src = g_new0(GValue, 1);
+               GValue *dest = g_new0(GValue, 1);
+               unsigned int type = 0;
+
+               inner_tuple = g_strsplit(tuple[index], ":", 0);
+               type = atoi(inner_tuple[1]);
+               content = g_base64_decode(inner_tuple[2], &tmp);
+
+               g_value_init(src, G_TYPE_STRING);
+               g_value_init(dest, type);
+
+               g_value_set_string(src, content);
+               _sipc_util_str_to_type(src, dest, type);
+               g_hash_table_insert(ht, g_strdup(inner_tuple[0]), dest);
+
+               g_free(content);
+               g_strfreev(inner_tuple);
+               index++;
+       }
+
+       g_strfreev(tuple);
+       return ht;
+}
+
+struct _sipc_marshal_object* sipc_util_marshal_object_create()
+{
+       struct _sipc_marshal_object *mo = 0;
+
+       mo = g_new0( struct _sipc_marshal_object, 1 );
+       mo->ht = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, _sipc_util_remove_hashtable_value);
+
+       return mo;
+}
+
+gboolean sipc_util_marshal_object_add_data(struct _sipc_marshal_object *mo, const gchar* key, const void *data,
+               sipc_marshal_data_type_e type)
+{
+       gboolean rv = FALSE;
+       GValue *value;
+
+       SIPC_CHECK_DATA_NULL( (mo&&key&&data), FALSE);
+
+       dbg("key=%s, data type (%d)", key, type);
+       if (type >= SIPC_MARSHAL_DATA_STRING_MAX)
+               return FALSE;
+
+       value = g_new0(GValue, 1);
+
+       if(type != SIPC_MARSHAL_DATA_OBJECT_TYPE)
+               rv = _sipc_util_create_gvalue(value, data, type);
+       else
+               rv = _sipc_util_create_gvalue(value, ((struct _sipc_marshal_object*)data)->ht, type);
+
+       if (!rv)
+               return FALSE;
+
+       g_hash_table_insert(mo->ht, g_strdup(key), value);
+
+       return TRUE;
+}
+
+gboolean sipc_util_marshal_object_get_data(struct _sipc_marshal_object *mo, const gchar* key, void **data,
+               sipc_marshal_data_type_e type)
+{
+       gboolean rv = FALSE;
+       gpointer value;
+
+       SIPC_CHECK_DATA_NULL((mo&&key), FALSE);
+
+       value = g_hash_table_lookup(mo->ht, key);
+       rv = _sipc_util_return_value((GValue *) value, data, type);
+       if (!rv)
+               FALSE;
+
+       return TRUE;
+}
+
+gchar sipc_util_marshal_object_get_char(struct _sipc_marshal_object *mo, const gchar* key)
+{
+       gboolean rv = FALSE;
+       gchar rvalue, *tmp = NULL;
+       SIPC_CHECK_DATA_NULL((mo&&key), 0);
+
+       rv = sipc_util_marshal_object_get_data(mo, key, (void **)&tmp, SIPC_MARSHAL_DATA_CHAR_TYPE);
+       if (!rv) 0; if(!tmp) 0;
+
+       rvalue = *tmp;
+       g_free(tmp);
+
+       return rvalue;
+}
+
+gboolean sipc_util_marshal_object_get_boolean(struct _sipc_marshal_object *mo, const gchar* key)
+{
+       gboolean rv = FALSE;
+       gboolean rvalue, *tmp = NULL;
+       SIPC_CHECK_DATA_NULL((mo&&key), FALSE);
+
+       rv = sipc_util_marshal_object_get_data(mo, key, (void **)&tmp, SIPC_MARSHAL_DATA_BOOLEAN_TYPE);
+       if (!rv) FALSE; if(!tmp) FALSE;
+
+       rvalue = *tmp;
+       g_free(tmp);
+
+       return rvalue;
+}
+
+gint sipc_util_marshal_object_get_int(struct _sipc_marshal_object *mo, const gchar* key)
+{
+       gboolean rv = FALSE;
+       gint rvalue, *tmp = NULL;
+       SIPC_CHECK_DATA_NULL((mo&&key), 0);
+
+       rv = sipc_util_marshal_object_get_data(mo, key, (void **)&tmp, SIPC_MARSHAL_DATA_INT_TYPE);
+       if (!rv) 0; if(!tmp) 0;
+
+       rvalue = *tmp;
+       g_free(tmp);
+
+       return rvalue;
+}
+
+gdouble sipc_util_marshal_object_get_double(struct _sipc_marshal_object *mo, const gchar* key)
+{
+       gboolean rv = FALSE;
+       gdouble rvalue, *tmp = NULL;
+       SIPC_CHECK_DATA_NULL((mo&&key), 0);
+
+       rv = sipc_util_marshal_object_get_data(mo, key, (void **)&tmp, SIPC_MARSHAL_DATA_DOUBLE_TYPE);
+       if (!rv) 0; if(!tmp) 0;
+
+       rvalue = *tmp;
+       g_free(tmp);
+
+       return rvalue;
+}
+
+gchar* sipc_util_marshal_object_get_string(struct _sipc_marshal_object *mo, const gchar* key)
+{
+       gboolean rv = FALSE;
+       gchar *rvalue = NULL;
+       SIPC_CHECK_DATA_NULL((mo&&key), NULL);
+
+       rv = sipc_util_marshal_object_get_data(mo, key, (void **)&rvalue, SIPC_MARSHAL_DATA_STRING_TYPE);
+       if (!rv) NULL;
+
+       return rvalue;
+}
+
+struct _sipc_marshal_object * sipc_util_marshal_object_get_object(struct _sipc_marshal_object *mo, const gchar* key)
+{
+       gboolean rv = FALSE;
+       struct _sipc_marshal_object *rvalue = NULL;
+       SIPC_CHECK_DATA_NULL((mo&&key), NULL);
+
+       rv = sipc_util_marshal_object_get_data(mo, key, (void **)&rvalue, SIPC_MARSHAL_DATA_OBJECT_TYPE);
+       if (!rv) NULL;
+
+       return rvalue;
+}
+
+gboolean sipc_util_marshal_object_remove_data(struct _sipc_marshal_object *mo, const gchar* key)
+{
+       SIPC_CHECK_DATA_NULL((mo), TRUE);
+
+       return g_hash_table_remove(mo->ht, key);
+}
+
+gboolean sipc_util_marshal_object_remove_alldata(struct _sipc_marshal_object *mo)
+{
+       SIPC_CHECK_DATA_NULL((mo), TRUE);
+
+       g_hash_table_remove_all(mo->ht);
+       return TRUE;
+}
+
+gboolean sipc_util_marshal_object_destory(struct _sipc_marshal_object *mo)
+{
+       SIPC_CHECK_DATA_NULL((mo), TRUE);
+
+       g_hash_table_destroy(mo->ht);
+       g_free(mo);
+
+       return TRUE;
+}
+
+gchar* sipc_util_marshal_object_serializer(struct _sipc_marshal_object *mo)
+{
+       gchar *rv_str = NULL;
+       GHashTableIter iter;
+       gpointer key, value;
+       GString *gstring_tmp = NULL;
+
+       gstring_tmp = g_string_new(NULL);
+       g_hash_table_iter_init(&iter, mo->ht);
+       while (g_hash_table_iter_next(&iter, &key, &value) == TRUE) {
+               unsigned int gtype = 0;
+               gchar *tmp = NULL, *encoded_d = NULL;
+               GValue gval = { 0, { { 0 } } };
+               g_value_init(&gval, G_TYPE_STRING);
+
+               gtype = ((GValue *) value)->g_type;
+               if (gtype != G_TYPE_HASH_TABLE) {
+                       g_value_transform((GValue *) value, &gval);
+                       tmp = g_value_dup_string(&gval);
+                       dbg("gtype = %d, tmp = [%s]", gtype, tmp);
+               }
+               else {
+                       struct _sipc_marshal_object *tmp_obj;
+                       tmp_obj = g_value_get_boxed((GValue *) value);
+                       dbg("tmp_obj.ht = %p", tmp_obj->ht);
+                       tmp = sipc_util_marshal_object_serializer(tmp_obj);
+               }
+
+               encoded_d = g_base64_encode(tmp, strlen(tmp));
+               g_free(tmp);
+
+               g_string_append_printf(gstring_tmp, "%s:%d:%s/", key, gtype, encoded_d);
+               g_free(encoded_d);
+               g_value_unset(&gval);
+       }
+
+       rv_str = g_strdup(gstring_tmp->str);
+       g_string_free(gstring_tmp, TRUE);
+
+       return rv_str;
+}
+
+struct _sipc_marshal_object* sipc_util_marshal_object_deserializer(const gchar *inparam)
+{
+       struct _sipc_marshal_object *obj = NULL;
+       obj = g_new0(struct _sipc_marshal_object, 1);
+       obj->ht = _sipc_util_marshal_object_deserializer(inparam);
+
+       return obj;
+}
diff --git a/common/src/sipc_server.c b/common/src/sipc_server.c
new file mode 100644 (file)
index 0000000..ae9dab3
--- /dev/null
@@ -0,0 +1,507 @@
+/*
+ * tel-plugin-socket-communicator
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Ja-young Gu <jygu@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdio.h>
+#include <string.h>
+
+#include <errno.h>
+#include <sys/un.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/stat.h>
+
+#include "sipc_common.h"
+#include "sipc.h"
+
+typedef struct sockaddr_un server_addr_t;
+
+struct _sipc_server {
+       int fd;
+       server_addr_t*   addr;
+       GSList*                  tx_chs;
+       GSList*                  rx_chs;
+       sipc_callback_t* cb;
+       guint                    tag;
+};
+
+
+// Utility
+#if 0
+static struct _sipc_channel* _find_channel_by_fd(GSList *l, int fd)
+{
+       int ret = -1;
+       struct _sipc_channel *c = 0;
+
+       SIPC_CHECK_DATA_NULL( l, 0);
+
+       while (l) {
+               c = (struct _sipc_channel *) l->data;
+               if (c->fd == fd) {
+                       return c;
+               }
+       }
+
+       return 0;
+}
+#endif
+
+static struct _sipc_channel* _find_channel_by_id(GSList *l, unsigned int id)
+{
+       int ret = -1;
+       struct _sipc_channel *c = 0;
+
+       SIPC_CHECK_DATA_NULL( l, 0);
+
+       while (l) {
+               c = (struct _sipc_channel *) l->data;
+               if (c->id == id) {
+                       return c;
+               }
+
+               l = l->next;
+       }
+
+       return 0;
+}
+
+static void _free_channel(gpointer data)
+{
+       struct _sipc_channel *c = 0;
+       c = (struct _sipc_channel*) data;
+
+       c->id = 0;
+       close(c->fd);
+
+       if (!c->tag)
+               g_source_remove(c->tag);
+
+       g_free(c);
+}
+
+
+// Static Function
+
+static int _server_deliver_data(struct _sipc_header *h, void *inparam, void **outparam, sipc_callback_t *cb)
+{
+       int ret = -1;
+
+       SIPC_CHECK_DATA_NULL( ( h && cb ), -1);
+
+       ret = cb->func(h->ch_id, inparam, h->data_len, outparam, cb->data);
+
+       return ret;
+}
+
+static gboolean _server_deregister_channel(struct _sipc_server *s, unsigned int ch_id, sipc_channel_type_e t)
+{
+       struct _sipc_channel *ch = 0;
+
+       SIPC_CHECK_DATA_NULL( s, FALSE);
+       SIPC_CHECK_DATA_RANGE( t, SIPC_CHANNEL_TYPE_TX, SIPC_CHANNEL_TYPE_RX, FALSE);
+
+       switch (t) {
+               case SIPC_CHANNEL_TYPE_TX:
+                       ch = _find_channel_by_id(s->tx_chs, ch_id);
+                       g_source_remove(ch->tag);
+                       close(ch->fd);
+
+                       s->tx_chs = g_slist_remove(s->tx_chs, ch);
+                       break;
+
+               case SIPC_CHANNEL_TYPE_RX:
+                       ch = _find_channel_by_id(s->rx_chs, ch_id);
+                       close(ch->fd);
+
+                       s->rx_chs = g_slist_remove(s->rx_chs, ch);
+                       break;
+
+               default:
+                       return FALSE;
+       }
+
+       if (!ch)
+               g_free(ch);
+
+       return TRUE;
+}
+
+static int _server_send(int fd, struct _sipc_header *h, const void *data)
+{
+       int p_len;
+       char *p;
+       int ret = -1;
+
+       SIPC_CHECK_DATA_NULL( h, FALSE);
+
+       p_len = sizeof(struct _sipc_header) + h->data_len;
+       p = g_new0(char, p_len);
+
+       memcpy(p, h, sizeof(struct _sipc_header));
+
+       if ((data && h->data_len))
+               memcpy(p + sizeof(struct _sipc_header), (char*) data, h->data_len);
+
+       ret = send(fd, p, p_len, MSG_NOSIGNAL);
+       if (ret < 0) {
+               g_free(p);
+               return -1;
+       }
+
+       g_free(p);
+       return 0;
+}
+
+static gboolean _server_recv(int fd, struct _sipc_server *s)
+{
+       int ret = -1;
+       struct _sipc_header h_req = { 0, };
+       struct _sipc_header h_rsp = { 0, };
+
+       dbg("recv from fd(%d)", fd);
+
+       memset(&h_req, 0, sizeof(struct _sipc_header));
+       memset(&h_rsp, 0, sizeof(struct _sipc_header));
+
+       ret = recv(fd, &h_req, sizeof(struct _sipc_header), MSG_NOSIGNAL);
+       if (ret < 0) {
+               dbg("error to get header in socket");
+               h_rsp.cmd = SIPC_ACK_FAIL;
+               _server_send(fd, &h_rsp, NULL);
+               return FALSE;
+       }
+       dbg("recv header (size=%d)", ret);
+
+       switch (h_req.cmd) {
+               case SIPC_SEND_DATA_SYNC:
+               case SIPC_SEND_DATA_ASYNC: {
+                       char *in_d = NULL;
+                       char *out_d = NULL;
+
+                       if (h_req.data_len > 0) {
+                               in_d = g_new0( char, h_req.data_len+1 );
+                               ret = recv(fd, in_d, h_req.data_len, MSG_NOSIGNAL);
+                               if (ret < 0) {
+                                       dbg("error to get header in socket");
+                                       h_rsp.cmd = SIPC_ACK_FAIL;
+                                       _server_send(fd, &h_rsp, NULL);
+                                       g_free(in_d);
+                                       return FALSE;
+                               }
+
+                               dbg("recv data (size=%d)", ret);
+                       }
+
+                       ret = _server_deliver_data(&h_req, (void*) in_d, (void **) &out_d, s->cb);
+                       if (ret < 0) {
+                               dbg("error to send data to communicator");
+                               h_rsp.cmd = SIPC_ACK_FAIL;
+                               _server_send(fd, &h_rsp, NULL);
+                               g_free(in_d);
+                               return FALSE;
+                       }
+
+                       h_rsp.cmd = SIPC_ACK_SUCCESS;
+                       if (out_d) {
+                               //dbg("out data (%s)", out_d);
+                               h_rsp.data_len = strlen(out_d);
+                       }
+
+                       _server_send(fd, &h_rsp, out_d);
+                       g_free(in_d);
+                       g_free(out_d);
+                       return TRUE;
+               }
+                       break;
+
+               case SIPC_DEREGISTER_CHANNEL:
+                       return _server_deregister_channel(s, h_req.ch_id, h_req.ch_type);
+                       break;
+
+               default:
+                       break;
+       }
+
+       return FALSE;
+}
+
+static gboolean _server_io_inspector(GIOChannel *ch, GIOCondition con, gpointer data)
+{
+       int fd = 0;
+       fd = g_io_channel_unix_get_fd(ch);
+
+       switch (con) {
+               case G_IO_IN:
+                       _server_recv(fd, (struct _sipc_server*) data);
+                       return TRUE;
+
+               case G_IO_OUT:
+                       // data can be written ( without blocking )
+               case G_IO_PRI:
+                       // there is urgent data to read
+               case G_IO_ERR:
+                       // error condition
+               case G_IO_HUP:
+                       // hung up ( the connection has been broken, usually for pipe and sockets )
+
+                       // close channel
+                       dbg("channel has been changed");
+                       return FALSE;
+
+               case G_IO_NVAL:
+                       dbg("Invalid channel action happened");
+                       return FALSE;
+
+               default:
+                       // unknown err
+                       break;
+       }
+
+       return FALSE;
+}
+
+static gboolean _server_register_channel(struct _sipc_channel *ch, struct _sipc_server *s)
+{
+       int ret = -1;
+       struct _sipc_header h_req = { 0, };
+       struct _sipc_header h_rsp = { 0, };
+
+       SIPC_CHECK_DATA_NULL( (ch && s), FALSE);
+
+       memset(&h_req, 0, sizeof(struct _sipc_header));
+       memset(&h_rsp, 0, sizeof(struct _sipc_header));
+
+       ret = recv(ch->fd, &h_req, sizeof(struct _sipc_header), MSG_NOSIGNAL);
+
+       //dbg("recv data(%d) for register ch->fd(%d), id(%d) command(%d) type(%d)", ret, ch->fd, h.ch_id, h.cmd, h.ch_type);
+       if (ret < 0) {
+               dbg("error in socket");
+               h_rsp.cmd = SIPC_ACK_FAIL;
+               h_rsp.data_len = 0;
+               _server_send(ch->fd, &h_rsp, NULL);
+               return FALSE;
+       }
+
+       ch->id = h_req.ch_id;
+       ch->type = h_req.ch_type;
+
+       switch (ch->type) {
+               case SIPC_CHANNEL_TYPE_TX: {
+                       GIOChannel *gch;
+
+                       gch = g_io_channel_unix_new(ch->fd);
+                       if (!gch) {
+                               dbg("error to create channel");
+                               h_rsp.cmd = SIPC_ACK_FAIL;
+                               h_rsp.data_len = 0;
+                               _server_send(ch->fd, &h_rsp, NULL);
+                               return FALSE;
+                       }
+
+                       ch->tag = g_io_add_watch(gch, (G_IO_IN | G_IO_ERR | G_IO_HUP | G_IO_NVAL), (GIOFunc) _server_io_inspector, s);
+
+                       s->tx_chs = g_slist_append(s->tx_chs, ch);
+                       dbg("tx channel(fd=%d) is registered", ch->fd);
+               }
+                       break;
+
+               case SIPC_CHANNEL_TYPE_RX:
+                       s->rx_chs = g_slist_append(s->rx_chs, ch);
+                       dbg("rx channel(fd=%d) is registered", ch->fd);
+                       break;
+       }
+
+       h_rsp.cmd = SIPC_ACK_SUCCESS;
+       h_rsp.data_len = 0;
+       _server_send(ch->fd, &h_rsp, NULL);
+
+       return TRUE;
+}
+
+static gboolean _server_accept(GIOChannel *ch, GIOCondition con, gpointer data)
+{
+       struct _sipc_server *s = 0;
+       struct _sipc_channel *c = 0;
+       int fd = 0;
+       int addr_len;
+
+       s = (struct _sipc_server *) data;
+
+       addr_len = sizeof(s->addr);
+
+       errno = 0;
+       fd = accept(s->fd, (struct sockaddr*) s->addr, &addr_len);
+       if (fd < 0) {
+               printf("error : accept(), %s", strerror(errno));
+               return FALSE;
+       }
+
+       c = g_new0( struct _sipc_channel, 1 );
+       c->fd = fd;
+
+       return _server_register_channel(c, s);
+}
+
+
+// API Set
+
+struct _sipc_server* sipc_server_open(char *path)
+{
+       int ret = -1;
+       int len = 0;
+       struct _sipc_server *s;
+
+       SIPC_CHECK_DATA_NULL( path, 0);
+
+       unlink(path);
+
+       s = g_new0( struct _sipc_server, 1 );
+
+       errno = 0;
+       s->fd = socket(AF_UNIX, SOCK_STREAM, 0);
+       if (s->fd < 0) {
+               dbg("error : socket(), %s", strerror(errno));
+               return 0;
+       }
+
+       s->addr = g_new0(server_addr_t, 1 );
+       s->addr->sun_family = AF_UNIX;
+       strncpy(s->addr->sun_path, path, sizeof(s->addr->sun_path));
+
+       len = sizeof(s->addr->sun_family) + strlen(path);
+
+       errno = 0;
+       ret = bind(s->fd, (struct sockaddr *) s->addr, len);
+       if (ret < 0) {
+               dbg("error : bind(), %s", strerror(errno));
+               return 0;
+       }
+
+       errno = 0;
+       ret = chmod(path, S_IRWXU | S_IRWXG | S_IRWXO);
+       if (ret < 0) {
+               dbg("error : chmod(), %s", strerror(errno));
+               return 0;
+       }
+
+       errno = 0;
+       ret = listen(s->fd, 255);
+       if (ret < 0) {
+               dbg("error : listen(), %s", strerror(errno));
+               return 0;
+       }
+
+       return s;
+}
+
+gboolean sipc_server_register_rx_callback(struct _sipc_server *s, sipc_callback_t *cb)
+{
+       SIPC_CHECK_DATA_NULL( (s && cb), FALSE);
+
+       s->cb = cb;
+
+       return TRUE;
+}
+
+gboolean sipc_server_run(struct _sipc_server *s)
+{
+       GIOChannel *ch = 0;
+       int tag = 0;
+
+       SIPC_CHECK_DATA_NULL( s, FALSE);
+
+       ch = g_io_channel_unix_new(s->fd);
+       if (!ch) {
+               return FALSE;
+       }
+
+       tag = g_io_add_watch(ch, G_IO_IN, (GIOFunc) _server_accept, s);
+       if (!tag) {
+               return FALSE;
+       }
+
+       s->tag = tag;
+
+       return TRUE;
+}
+
+gboolean sipc_server_close(struct _sipc_server *s)
+{
+       SIPC_CHECK_DATA_NULL( s, FALSE);
+
+       g_source_remove(s->tag);
+       close(s->fd);
+
+       g_free(s->addr);
+       g_free(s->cb);
+
+       g_slist_free_full(s->tx_chs, _free_channel);
+       g_slist_free_full(s->rx_chs, _free_channel);
+
+       g_free(s);
+
+       return TRUE;
+}
+
+int sipc_server_send(struct _sipc_server *s, unsigned int ch_id, const void *data, unsigned int data_len, int option)
+{
+       struct _sipc_header h = { 0, };
+       struct _sipc_channel *c = 0;
+
+       SIPC_CHECK_DATA_NULL( s, FALSE);
+
+       h.ch_id = ch_id;
+       h.cmd = option;
+       h.data_len = data_len;
+
+       c = _find_channel_by_id(s->rx_chs, ch_id);
+       if (!c)
+               return -1;
+
+       return _server_send(c->fd, &h, data);
+}
+
+gboolean sipc_server_broadcast(struct _sipc_server *s, const void *data, unsigned int data_len)
+{
+       int ret = -1;
+       struct _sipc_header h = { 0, };
+       struct _sipc_channel *c = 0;
+       GSList *list;
+
+       SIPC_CHECK_DATA_NULL( s, FALSE);
+
+       list = s->rx_chs;
+       while (list) {
+               c = (struct _sipc_channel *) list->data;
+
+               h.cmd = SIPC_SEND_DATA_BROADCAST;
+               h.data_len = data_len;
+
+               errno = 0;
+               ret = _server_send(c->fd, &h, data);
+               if (ret < 0) {
+                       // dbg
+                       dbg("send fail. ret = %d", ret);
+               }
+
+               list = g_slist_next(list);
+       }
+
+       return 0;
+}
diff --git a/libclient/CMakeLists.txt b/libclient/CMakeLists.txt
new file mode 100644 (file)
index 0000000..7a3a8c3
--- /dev/null
@@ -0,0 +1,45 @@
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+PROJECT(libclient C)
+
+SET(PREFIX ${CMAKE_INSTALL_PREFIX})
+SET(EXEC_PREFIX "\${prefix}")
+SET(LIBDIR "\${prefix}/lib")
+SET(INCLUDEDIR "\${prefix}/include")
+
+# Set required packages
+INCLUDE(FindPkgConfig)
+pkg_check_modules(pkgs REQUIRED glib-2.0 tcore security-server)
+
+FOREACH(flag ${pkgs_CFLAGS})
+       SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+ENDFOREACH(flag)
+
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include/ ${CMAKE_SOURCE_DIR}/../common/include)
+
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -Werror -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Wdeclaration-after-statement -Wmissing-declarations -Wredundant-decls -Wcast-align")
+
+MESSAGE(${CMAKE_C_FLAGS})
+MESSAGE(${CMAKE_EXE_LINKER_FLAGS})
+
+SET(SRCS
+               ../common/src/sipc_server.c
+               ../common/src/sipc_channel.c
+               ../common/src/sipc_marshal.c
+               src/tapi_sipc.c
+               src/tapi_common_sipc.c
+)
+
+# library build
+ADD_LIBRARY(socket-comm-client SHARED ${SRCS})
+TARGET_LINK_LIBRARIES(socket-comm-client ${pkgs_LDFLAGS})
+SET_TARGET_PROPERTIES(socket-comm-client PROPERTIES VERSION 0.0.0 SOVERSION 0 OUTPUT_NAME socket-comm-client)
+
+# pkgconfig file
+SET(PREFIX ${CMAKE_INSTALL_PREFIX})
+CONFIGURE_FILE(libsocket-comm-client.pc.in libsocket-comm-client.pc @ONLY)
+
+# install
+INSTALL(TARGETS socket-comm-client LIBRARY DESTINATION lib)
+INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/libsocket-comm-client.pc DESTINATION lib/pkgconfig)
+INSTALL(FILES ${CMAKE_SOURCE_DIR}/../common/include/tapi_type.h DESTINATION include/telephony)
+INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/ DESTINATION include/telephony)
diff --git a/libclient/debian/changelog b/libclient/debian/changelog
new file mode 100644 (file)
index 0000000..c028ad1
--- /dev/null
@@ -0,0 +1,7 @@
+libsocket-comm-client (0.1.0) unstable; urgency=low
+
+  * Initial
+  * Git: pkgs/t/tel-plugin-socket_communicator
+  * Tag: libsocket-comm-client_0.1.0
+
+ -- Inho Oh <inho48.oh@samsung.com>  Thu, 15 Mar 2012 23:40:55 +0900
diff --git a/libclient/debian/compat b/libclient/debian/compat
new file mode 100644 (file)
index 0000000..7ed6ff8
--- /dev/null
@@ -0,0 +1 @@
+5
diff --git a/libclient/debian/control b/libclient/debian/control
new file mode 100644 (file)
index 0000000..2e3da85
--- /dev/null
@@ -0,0 +1,25 @@
+Source: libsocket-comm-client
+Section: libs
+Priority: extra
+Maintainer: Jongman Park <jman.park@samsung.com>
+Uploaders: Jayoung Gu <jygu@samsung.com>, Kyeongchul Kim <kyeongchul.kim@samsung.com>, Youngman Park <youngman.park@samsung.com>, Inho Oh <inho48.oh@samsung.com>,  DongHoo Park <donghoo.park@samsung.com>
+Build-Depends: debhelper (>= 5), libglib2.0-dev, libtcore-dev, libsecurity-server-client-dev, dlog-dev
+Standards-Version: 0.0.0
+
+Package: libsocket-comm-client-dev
+Section: libs
+Architecture: any
+Depends: libsocket-comm-client-0 (= ${Source-Version}), libglib2.0-dev
+Description: Client library of Socket based Communicator (Development)
+
+Package: libsocket-comm-client-0
+Section: libs
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}
+Description: Client library of Socket based Communicator (Shared Object)
+
+Package: libsocket-comm-client-0-dbg
+Section: debug
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}, libsocket-comm-client-0 (= ${Source-Version})
+Description: Client library of Socket based Communicator (dbg package)
diff --git a/libclient/debian/copyright b/libclient/debian/copyright
new file mode 100644 (file)
index 0000000..d5a0cca
--- /dev/null
@@ -0,0 +1,7 @@
+Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License version 2.1.
+
+The full text of the LGPL 2.1 can be found in
+/usr/share/common-licenses.
diff --git a/libclient/debian/dirs b/libclient/debian/dirs
new file mode 100644 (file)
index 0000000..ca882bb
--- /dev/null
@@ -0,0 +1,2 @@
+usr/bin
+usr/sbin
diff --git a/libclient/debian/docs b/libclient/debian/docs
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/libclient/debian/libsocket-comm-client-0.install.in b/libclient/debian/libsocket-comm-client-0.install.in
new file mode 100644 (file)
index 0000000..a43f0f0
--- /dev/null
@@ -0,0 +1 @@
+@PREFIX@/lib/libsocket-comm-client.*
diff --git a/libclient/debian/libsocket-comm-client-dev.install.in b/libclient/debian/libsocket-comm-client-dev.install.in
new file mode 100644 (file)
index 0000000..6d6c1d4
--- /dev/null
@@ -0,0 +1,2 @@
+@PREFIX@/include/telephony/*
+@PREFIX@/lib/pkgconfig/libsocket-comm-client.pc
diff --git a/libclient/debian/rules b/libclient/debian/rules
new file mode 100755 (executable)
index 0000000..ba0fa76
--- /dev/null
@@ -0,0 +1,118 @@
+#!/usr/bin/make -f
+# -*- makefile -*-
+# Sample debian/rules that uses debhelper.
+# This file was originally written by Joey Hess and Craig Small.
+# As a special exception, when this file is copied by dh-make into a
+# dh-make output file, you may use that output file without restriction.
+# This special exception was added by Craig Small in version 0.37 of dh-make.
+
+# Uncomment this to turn on verbose mode.
+#export DH_VERBOSE=1
+
+CFLAGS ?= -Wall -g
+CXXFLAGS ?=  -Wall -g
+LDFLAGS ?=
+PREFIX ?= /usr
+DATADIR ?= /opt
+
+ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
+       CFLAGS += -O0
+       CXXFLAGS += -O0
+else
+       CFLAGS += -O2
+       CXXFLAGS += -O2
+endif
+
+#CFLAGS += -fvisibility=hidden -fPIC
+CFLAGS += -fvisibility=default -fPIC
+LDFLAGS += -rdynamic -fPIC -Wl,--rpath=$(PREFIX)/lib -Wl,--as-needed
+#LDFLAGS += -Wl,--unresolved-symbols=ignore-in-shared-libs,--as-needed
+
+CMAKE_TMP_DIR = $(CURDIR)/cmake_tmp
+
+configure: configure-stamp
+configure-stamp:
+       dh_testdir
+       # Add here commands to configure the package.
+       mkdir -p $(CMAKE_TMP_DIR);
+       cd $(CMAKE_TMP_DIR); CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" cmake .. -DCMAKE_INSTALL_PREFIX=$(PREFIX)
+
+       touch configure-stamp
+
+build: build-stamp
+
+build-stamp: configure-stamp
+       dh_testdir
+
+       # Add here commands to compile the package.
+       cd $(CMAKE_TMP_DIR) && $(MAKE) all
+
+       for f in `find $(CURDIR)/debian/ -name "*.in"`; do \
+               cat $$f > $${f%.in}; \
+               sed -i -e "s#@PREFIX@#$(PREFIX)#g" $${f%.in}; \
+               sed -i -e "s#@DATADIR@#$(DATADIR)#g" $${f%.in}; \
+       done
+
+       touch $@
+
+clean:
+       dh_testdir
+       dh_testroot
+       rm -f build-stamp configure-stamp
+
+       # Add here commands to clean up after the build process.
+       rm -rf $(CMAKE_TMP_DIR)
+
+       for f in `find $(CURDIR)/debian/ -name "*.in"`; do \
+               rm -f $${f%.in}; \
+       done
+
+       dh_clean
+
+install: build
+       dh_testdir
+       dh_testroot
+       dh_clean -k
+       dh_installdirs
+
+       # Add here commands to install the package into debian/wavplayer.
+       cd $(CMAKE_TMP_DIR) && $(MAKE) DESTDIR=$(CURDIR)/debian/tmp install
+
+
+# Build architecture-independent files here.
+binary-indep: build install
+# We have nothing to do by default.
+
+# Build architecture-dependent files here.
+binary-arch: build install
+       dh_testdir
+       dh_testroot
+       dh_installchangelogs
+       dh_installdocs
+       dh_installexamples
+       dh_install --sourcedir=debian/tmp
+#      dh_installmenu
+#      dh_installdebconf
+#      dh_installlogrotate
+#      dh_installemacsen
+#      dh_installpam
+#      dh_installmime
+#      dh_python
+#      dh_installinit
+#      dh_installcron
+#      dh_installinfo
+       dh_installman
+       dh_link
+       dh_strip --dbg-package=libsocket-comm-client-0-dbg
+       dh_compress
+       dh_fixperms
+#      dh_perl
+       dh_makeshlibs
+       dh_installdeb
+       dh_shlibdeps
+       dh_gencontrol
+       dh_md5sums
+       dh_builddeb
+
+binary: binary-indep binary-arch
+.PHONY: build clean binary-indep binary-arch binary install configure
diff --git a/libclient/include/tapi_sipc.h b/libclient/include/tapi_sipc.h
new file mode 100644 (file)
index 0000000..8881bf3
--- /dev/null
@@ -0,0 +1,54 @@
+/*
+ * tel-plugin-socket-communicator
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Ja-young Gu <jygu@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __TAPI_SIPC_H__
+#define __TAPI_SIPC_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <tapi_type.h>
+
+tapi_handle_t* tapi_init( char *app_name, char *cp_name );
+gboolean               tapi_deinit( tapi_handle_t *h );
+gboolean               tapi_register_notification( tapi_handle_t *h, tapi_service_notification_e noti, tapi_cb cb, void *cb_data);
+
+tapi_service_object_t* tapi_create_service_object(tapi_service_command_e cmd);
+gboolean               tapi_service_object_add_data(tapi_service_object_t* obj, const gchar* key, void *in_data, tapi_object_data_type_e type);
+gboolean               tapi_service_object_get_data(tapi_service_object_t* obj, const gchar* key, void **out_data, tapi_object_data_type_e type);
+gchar                  tapi_service_object_get_char(tapi_service_object_t* obj, const gchar* key);
+gboolean               tapi_service_object_get_boolean(tapi_service_object_t* obj, const gchar* key);
+gint                   tapi_service_object_get_int(tapi_service_object_t* obj, const gchar* key);
+gdouble                        tapi_service_object_get_double(tapi_service_object_t* obj, const gchar* key);
+gchar*                 tapi_service_object_get_string(tapi_service_object_t* obj, const gchar* key);
+tapi_service_object_t* tapi_service_object_get_object(tapi_service_object_t* obj, const gchar* key);
+gboolean               tapi_service_object_remove_data(tapi_service_object_t* obj, const gchar* key);
+gboolean               tapi_service_object_remove_alldata(tapi_service_object_t* obj);
+gboolean               tapi_service_object_destory(tapi_service_object_t* obj);
+
+gboolean               tel_processing_command_sync(tapi_handle_t *h, tapi_service_object_t* in_obj, tapi_service_object_t* out_obj);
+gboolean               tel_processing_command_async(tapi_handle_t *h, tapi_service_object_t* in_obj, tapi_cb cb, void *user_data);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/libclient/libsocket-comm-client.pc.in b/libclient/libsocket-comm-client.pc.in
new file mode 100644 (file)
index 0000000..d7435b2
--- /dev/null
@@ -0,0 +1,11 @@
+prefix=@PREFIX@
+exec_prefix=${prefix}
+libdir=${exec_prefix}/lib
+includedir=${prefix}/include
+
+Name: SOCKET_COMMUNICATOR_CLIENT
+Description: Telephony Socket Communicator Client library
+Requires: glib-2.0 gobject-2.0
+Version: 1.0
+Libs: -L${libdir} -lsocket-comm-client
+Cflags: -I${includedir}/telephony
diff --git a/libclient/src/tapi_common_sipc.c b/libclient/src/tapi_common_sipc.c
new file mode 100644 (file)
index 0000000..9675bdb
--- /dev/null
@@ -0,0 +1,235 @@
+/*
+ * tel-plugin-socket-communicator
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Ja-young Gu <jygu@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "tapi_common_sipc.h"
+
+static sipc_marshal_data_type_e _convert_marshal_data_type(tapi_object_data_type_e type)
+{
+       switch(type){
+               case TAPI_OBJECT_DATA_TYPE_CHAR:{
+                       return SIPC_MARSHAL_DATA_CHAR_TYPE;
+               }
+               case TAPI_OBJECT_DATA_TYPE_BOOLEAN:{
+                       return SIPC_MARSHAL_DATA_BOOLEAN_TYPE;
+               }
+               case TAPI_OBJECT_DATA_TYPE_INT:{
+                       return SIPC_MARSHAL_DATA_INT_TYPE;
+               }
+               case TAPI_OBJECT_DATA_TYPE_DOUBLE:{
+                       return SIPC_MARSHAL_DATA_DOUBLE_TYPE;
+               }
+               case TAPI_OBJECT_DATA_TYPE_STRING:{
+                       return SIPC_MARSHAL_DATA_STRING_TYPE;
+               }
+               case TAPI_OBJECT_DATA_TYPE_OBJECT:{
+                       return SIPC_MARSHAL_DATA_OBJECT_TYPE;
+               }
+       }
+
+       return SIPC_MARSHAL_DATA_STRING_MAX;
+}
+
+static struct _tapi_header* _create_header( struct _tapi_handle *hdl, tapi_service_command_e c, unsigned int data_len )
+{
+       struct _tapi_header *hdr = 0;
+       hdr = g_new0( struct _tapi_header, 1 );
+
+       memcpy( hdr->cookie, hdl->cookie, 20 );
+       memcpy( hdr->app_name, hdl->app_name, 16 );
+       memcpy( hdr->cp_name, hdl->cp_name, 16 );
+
+       hdr->cmd = c;
+       hdr->data_len = data_len;
+
+       return hdr;
+}
+
+static gchar* _tapi_service_object_serializer(struct _tapi_service_object *so)
+{
+       return sipc_util_marshal_object_serializer(so->mo);
+}
+
+static sipc_marshal_object_t* _tapi_service_object_deserializer(const gchar* inparam)
+{
+       return sipc_util_marshal_object_deserializer(inparam);
+}
+
+struct _tapi_service_object* _tapi_service_object_create( tapi_service_command_e c )
+{
+       struct _tapi_service_object *so = 0;
+       so = g_new0( struct _tapi_service_object, 1 );
+
+       so->cmd = c;
+       so->mo  = sipc_util_marshal_object_create();
+       if ( !so->mo ) {
+               g_free( so );
+
+               return 0;
+       }
+
+       return so;
+}
+
+gboolean _tapi_service_object_add_data(struct _tapi_service_object *so, const gchar* key, void *data, tapi_object_data_type_e type)
+{
+       if(type != TAPI_OBJECT_DATA_TYPE_OBJECT)
+               return sipc_util_marshal_object_add_data(so->mo, key, data, _convert_marshal_data_type(type) );
+
+       return sipc_util_marshal_object_add_data(so->mo, key, ((struct _tapi_service_object *)data)->mo , _convert_marshal_data_type(type) );
+}
+
+gboolean _tapi_service_object_get_data(struct _tapi_service_object *so, const gchar* key, void **data, tapi_object_data_type_e type)
+{
+       if(type == TAPI_OBJECT_DATA_TYPE_OBJECT){
+               *data = g_new0( struct _tapi_service_object, 1 );
+               ((struct _tapi_service_object *)(*data))->cmd = TAPI_SERVICE_UNKNOWN;
+               sipc_util_marshal_object_get_data(so->mo, key, (void **)&(((struct _tapi_service_object *)(*data))->mo), _convert_marshal_data_type(type) );
+               return TRUE;
+       }
+
+       return sipc_util_marshal_object_get_data(so->mo, key, data, _convert_marshal_data_type(type) );
+}
+
+gchar _tapi_service_object_get_char(struct _tapi_service_object *so, const gchar* key)
+{
+       return sipc_util_marshal_object_get_char(so->mo, key);
+}
+
+gboolean _tapi_service_object_get_boolean(struct _tapi_service_object *so, const gchar* key)
+{
+       return sipc_util_marshal_object_get_boolean(so->mo, key);
+}
+
+gint _tapi_service_object_get_int(struct _tapi_service_object *so, const gchar* key)
+{
+       return sipc_util_marshal_object_get_int(so->mo, key);
+}
+
+gdouble _tapi_service_object_get_double(struct _tapi_service_object *so, const gchar* key)
+{
+       return sipc_util_marshal_object_get_double(so->mo, key);
+}
+
+gchar* _tapi_service_object_get_string(struct _tapi_service_object *so, const gchar* key)
+{
+       return sipc_util_marshal_object_get_string(so->mo, key);
+}
+
+struct _tapi_service_object* _tapi_service_object_get_object(struct _tapi_service_object *so, const gchar* key)
+{
+       struct _tapi_service_object *rvalue = 0;
+       rvalue = g_new0( struct _tapi_service_object, 1 );
+
+       rvalue->cmd = TAPI_SERVICE_UNKNOWN;
+       rvalue->mo  = sipc_util_marshal_object_get_object(so->mo, key);
+       if ( !rvalue->mo ) {
+               g_free( rvalue );
+               return NULL;
+       }
+
+       return rvalue;
+}
+
+struct _tapi_service_object* _tapi_service_object_extract_async_data(const gchar *data)
+{
+       struct _tapi_service_object *so = 0;
+       so = g_new0( struct _tapi_service_object, 1 );
+
+       so->cmd = 0;
+       so->mo  = _tapi_service_object_deserializer(data);
+       if ( !so->mo ) {
+               g_free( so );
+               return NULL;
+       }
+
+       return so;
+}
+
+gboolean _tapi_service_object_remove_data(struct _tapi_service_object *so, const gchar* key)
+{
+       return sipc_util_marshal_object_remove_data(so->mo, key);
+}
+
+gboolean _tapi_service_object_remove_alldata(struct _tapi_service_object *so)
+{
+       return sipc_util_marshal_object_remove_alldata(so->mo);
+}
+
+gboolean _tapi_service_object_destory(struct _tapi_service_object *so)
+{
+       gboolean rv = FALSE;
+       if(!so) return TRUE;
+
+       rv = sipc_util_marshal_object_destory(so->mo);
+       g_free(so);
+
+       return TRUE;
+}
+
+gboolean _tapi_send_service_request_sync(struct _tapi_handle *h, struct _tapi_service_object *in_d, struct _tapi_service_object *out_d)
+{
+       int ret = 0;
+       int serialized_data_len = 0, data_len = 0;
+       gchar *data = NULL, *o_data = NULL;
+       gchar *serialized_d = NULL;
+       struct _tapi_header *hdr;
+
+       serialized_d = _tapi_service_object_serializer(in_d);
+       if(serialized_d){
+               serialized_data_len = strlen(serialized_d);
+               //dbg("serialized data (%s)", serialized_d);
+       }
+
+       hdr = _create_header( h, in_d->cmd, serialized_data_len );
+
+       data = g_new0(char, sizeof(struct _tapi_header)+serialized_data_len);
+       memcpy(data, hdr, sizeof(struct _tapi_header));
+       data_len = sizeof(struct _tapi_header);
+
+       if(serialized_data_len > 0){
+               memcpy( (data+data_len), serialized_d, serialized_data_len);
+               data_len = data_len+serialized_data_len;
+       }
+
+       g_free(hdr);
+       g_free(serialized_d);
+
+       ret = sipc_channel_send( h->tx_ch, data, data_len, (void **)&o_data, SIPC_DATA_TYPE_SYNC );
+       if(ret < 0){
+               dbg("fail to send data");
+               return FALSE;
+       }
+
+       if(o_data && out_d){
+               //dbg("return data (%s)", o_data);
+               sipc_util_marshal_object_destory(out_d->mo);
+               out_d->mo = _tapi_service_object_deserializer(o_data);
+               g_free(o_data);
+       }
+
+       dbg("success to send data (%d)", data_len);
+       g_free(data);
+
+       return TRUE;
+}
diff --git a/libclient/src/tapi_common_sipc.h b/libclient/src/tapi_common_sipc.h
new file mode 100644 (file)
index 0000000..b010f6b
--- /dev/null
@@ -0,0 +1,57 @@
+/*
+ * tel-plugin-socket-communicator
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Ja-young Gu <jygu@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __TAPI_COMMON_SIPC_H__
+#define __TAPI_COMMON_SIPC_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <glib.h>
+#include <glib-object.h>
+#include <sipc.h>
+
+#include "tapi_type.h"
+#include "tapi_common.h"
+
+struct _tapi_service_object*   _tapi_service_object_create( tapi_service_command_e c );
+gboolean                                               _tapi_service_object_add_data(struct _tapi_service_object *so, const gchar* key,
+                                                                       void *in_data, tapi_object_data_type_e type);
+gboolean                                               _tapi_service_object_get_data(struct _tapi_service_object *so, const gchar* key,
+                                                                       void **out_data, tapi_object_data_type_e type);
+gchar                                                  _tapi_service_object_get_char(struct _tapi_service_object *so, const gchar* key);
+gboolean                                               _tapi_service_object_get_boolean(struct _tapi_service_object *so, const gchar* key);
+gint                                                   _tapi_service_object_get_int(struct _tapi_service_object *so, const gchar* key);
+gdouble                                                        _tapi_service_object_get_double(struct _tapi_service_object *so, const gchar* key);
+gchar*                                                 _tapi_service_object_get_string(struct _tapi_service_object *so, const gchar* key);
+struct _tapi_service_object*   _tapi_service_object_get_object(struct _tapi_service_object *so, const gchar* key);
+struct _tapi_service_object*   _tapi_service_object_extract_async_data(const gchar *data);
+gboolean                                               _tapi_service_object_remove_data(struct _tapi_service_object *so, const gchar* key);
+gboolean                                               _tapi_service_object_remove_alldata(struct _tapi_service_object *so);
+gboolean                                               _tapi_service_object_destory(struct _tapi_service_object *so);
+
+gboolean                                               _tapi_send_service_request_sync(struct _tapi_handle *h, struct _tapi_service_object *in_d,
+                                                                       struct _tapi_service_object *out_d);
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/libclient/src/tapi_log.h b/libclient/src/tapi_log.h
new file mode 100644 (file)
index 0000000..f014572
--- /dev/null
@@ -0,0 +1,58 @@
+/*
+ * tel-plugin-socket-communicator
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Ja-young Gu <jygu@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __TPAPI_LOG_H__
+#define __TPAPI_LOG_H__
+
+__BEGIN_DECLS
+
+#define ANSI_COLOR_NORMAL "\e[0m"
+
+#define ANSI_COLOR_BLACK "\e[0;30m"
+#define ANSI_COLOR_RED "\e[0;31m"
+#define ANSI_COLOR_GREEN "\e[0;32m"
+#define ANSI_COLOR_BROWN "\e[0;33m"
+#define ANSI_COLOR_BLUE "\e[0;34m"
+#define ANSI_COLOR_MAGENTA "\e[0;35m"
+#define ANSI_COLOR_CYAN "\e[0;36m"
+#define ANSI_COLOR_LIGHTGRAY "\e[0;37m"
+
+#define ANSI_COLOR_DARKGRAY "\e[1;30m"
+#define ANSI_COLOR_LIGHTRED "\e[1;31m"
+#define ANSI_COLOR_LIGHTGREEN "\e[1;32m"
+#define ANSI_COLOR_YELLOW "\e[1;33m"
+#define ANSI_COLOR_LIGHTBLUE "\e[1;34m"
+#define ANSI_COLOR_LIGHTMAGENTA "\e[1;35m"
+#define ANSI_COLOR_LIGHTCYAN "\e[1;36m"
+#define ANSI_COLOR_WHITE "\e[1;37m"
+
+#ifndef TELEPHONY_LOG_FILE
+#define TELEPHONY_LOG_FILE stdout
+#endif
+
+#define msg(fmt,args...)  fprintf(TELEPHONY_LOG_FILE, fmt "\n", ##args); fflush(TELEPHONY_LOG_FILE);
+#define dbg(fmt,args...)  fprintf(TELEPHONY_LOG_FILE, ANSI_COLOR_LIGHTGRAY "<%s:%s> " ANSI_COLOR_NORMAL fmt "\n", __FILE__, __FUNCTION__, ##args); fflush(TELEPHONY_LOG_FILE);
+#define warn(fmt,args...) fprintf(TELEPHONY_LOG_FILE, ANSI_COLOR_YELLOW "<%s:%s> " ANSI_COLOR_NORMAL fmt "\n", __FILE__, __FUNCTION__, ##args); fflush(TELEPHONY_LOG_FILE);
+#define err(fmt,args...)  fprintf(TELEPHONY_LOG_FILE, ANSI_COLOR_LIGHTRED "<%s:%s> " ANSI_COLOR_NORMAL fmt "\n", __FILE__, __FUNCTION__, ##args); fflush(TELEPHONY_LOG_FILE);
+
+
+__END_DECLS
+
+#endif
diff --git a/libclient/src/tapi_sipc.c b/libclient/src/tapi_sipc.c
new file mode 100644 (file)
index 0000000..e5cf781
--- /dev/null
@@ -0,0 +1,368 @@
+/*
+ * tel-plugin-socket-communicator
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Ja-young Gu <jygu@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <security-server.h>
+
+#include "tapi_common_sipc.h"
+#include "tapi_sipc.h"
+
+#define SERVER_PATH "/tmp/telephony"
+
+#if 0
+static void _free_event(gpointer data)
+{
+       struct _tapi_event *e = 0;
+
+       e = (struct _tapi_event *) data;
+       if (e->cb_data)
+               g_free(e->cb_data);
+}
+#endif
+
+static struct _tapi_event* _find_event(GSList *list, unsigned int event)
+{
+       struct _tapi_event *e = 0;
+
+       while (list) {
+
+               e = (struct _tapi_event *) list->data;
+               if (!e)
+                       return 0;
+
+               if (e->event == event) {
+                       return e;
+               }
+
+               list = g_slist_next( list );
+       }
+
+       return 0;
+}
+
+static void _dump_cookie(char *data, int size)
+{
+       char buf[255] = { 0, };
+       char tmp[3] = { 0, };
+       int i = 0;
+
+       for (i = 0; i < size; i++) {
+               snprintf(tmp, 3, "%02X", data[i]);
+               strncat(buf, tmp, 3);
+               if ((i + 1) % 8 == 0)
+                       strncat(buf, "  ", 2);
+       }
+}
+
+static gboolean _get_cookie(char *out)
+{
+       int ret;
+
+       memset(out, 0, 20);
+       ret = security_server_request_cookie(out, 20);
+       if (ret < 0) {
+               return FALSE;
+       }
+
+       _dump_cookie(out, 20);
+
+       return TRUE;
+}
+
+static void _register_name(char* dest, char* src)
+{
+       /*int len = strlen( src );
+        *dest = g_new0( char, len + 1 );*/
+       memset(dest, 0, 16);
+       memcpy(dest, src, 16);
+}
+
+static int _tapi_cb(unsigned int id, void *data, unsigned int data_len, void **_unused_, void *cb_data)
+{
+       struct _tapi_handle* hdl = (struct _tapi_handle*) cb_data;
+       struct _tapi_header hdr = { 0, };
+       struct _tapi_service_object* o_data = NULL;
+
+       int hdr_len = sizeof(struct _tapi_header);
+       char *d;
+       struct _tapi_event* e = NULL;
+       GSList *l = NULL;
+
+       memcpy(&hdr, (char*) data, hdr_len);
+
+       d = g_new0( char, hdr.data_len );
+       memcpy(d, (char*) (data + hdr_len), hdr.data_len);
+
+       if ((hdr.cmd & 0xF0000000) == TCORE_NOTIFICATION) {
+               l = hdl->notis;
+               dbg("notification cmd = 0x%x", hdr.cmd);
+       }
+
+       if ((hdr.cmd & 0xF0000000) == TCORE_REQUEST) {
+               l = hdl->cfrms;
+               dbg("response cmd = 0x%x", hdr.cmd);
+       }
+
+       e = _find_event(l, hdr.cmd);
+
+       //extract data;
+       o_data = _tapi_service_object_extract_async_data(d);
+       o_data->cmd = hdr.cmd;
+
+       g_free(d);
+
+       if (e) {
+               if (e->cb) {
+                       e->cb(o_data, e->cb_data);
+               }
+               else {
+                       dbg("e->cb is NULL");
+               }
+       }
+       else {
+               dbg("e is NULL");
+       }
+
+       return 1;
+}
+
+// API SET
+
+struct _tapi_handle* tapi_init(char *app_name, char *cp_name)
+{
+       struct _tapi_handle *h = 0;
+       sipc_callback_t *cb = NULL;
+
+       dbg("tapi init");
+       g_type_init();
+
+       h = g_new0( struct _tapi_handle, 1 );
+
+       // create channel key
+       h->key = sipc_channel_key_create();
+       if (!h->key) {
+               dbg("key is NULL");
+               return 0;
+       }
+
+       // create tx channel & init 
+       h->tx_ch = sipc_channel_open(h->key);
+       sipc_channel_set_type(h->tx_ch, SIPC_CHANNEL_TYPE_TX);
+       if (!sipc_channel_connect(h->tx_ch, SERVER_PATH))
+               return 0;
+
+       // create rx channel & init
+       h->rx_ch = sipc_channel_open(h->key);
+       sipc_channel_set_type(h->rx_ch, SIPC_CHANNEL_TYPE_RX);
+       if (!sipc_channel_connect(h->rx_ch, SERVER_PATH))
+               return 0;
+
+       cb = g_new0( sipc_callback_t, 1 );
+       cb->func = (sipc_cb) _tapi_cb;
+       cb->data = (void*) h;
+       sipc_channel_register_rx_callback(h->rx_ch, cb);
+
+       if (!_get_cookie(h->cookie))
+               return 0;
+
+       // register app_name, cp_name
+       _register_name(h->app_name, app_name);
+       _register_name(h->cp_name, cp_name);
+
+       return h;
+}
+
+gboolean tapi_deinit(struct _tapi_handle *h)
+{
+//     g_free( h->app_name );
+//     g_free( h->cp_name );
+
+       sipc_channel_close(h->tx_ch, h->key);
+       sipc_channel_close(h->rx_ch, h->key);
+       g_free(h->tx_ch);
+       g_free(h->rx_ch);
+
+       sipc_channel_key_destroy(h->key);
+       g_free(h->key);
+
+       g_slist_free(h->cfrms);
+       g_slist_free(h->notis);
+
+       g_free(h);
+
+       return TRUE;
+}
+
+struct _tapi_service_object* tapi_create_service_object(tapi_service_command_e cmd)
+{
+       struct _tapi_service_object *obj = 0;
+
+       obj = g_new0( struct _tapi_service_object, 1 );
+       obj = _tapi_service_object_create(cmd);
+
+       return obj;
+}
+
+gboolean tapi_service_object_add_data(struct _tapi_service_object* obj, const gchar* key, void *in_data,
+               tapi_object_data_type_e type)
+{
+       gboolean rv = FALSE;
+
+       rv = _tapi_service_object_add_data(obj, key, in_data, type);
+       if (!rv)
+               return FALSE;
+
+       return TRUE;
+}
+
+gboolean tapi_service_object_get_data(struct _tapi_service_object* obj, const gchar* key, void **out_data,
+               tapi_object_data_type_e type)
+{
+       gboolean rv = FALSE;
+
+       rv = _tapi_service_object_get_data(obj, key, out_data, type);
+       if (!rv)
+               return FALSE;
+
+       return TRUE;
+}
+
+gchar tapi_service_object_get_char(tapi_service_object_t* obj, const gchar* key)
+{
+       return _tapi_service_object_get_char(obj, key);
+}
+
+gboolean tapi_service_object_get_boolean(tapi_service_object_t* obj, const gchar* key)
+{
+       return _tapi_service_object_get_boolean(obj, key);
+}
+
+gint tapi_service_object_get_int(tapi_service_object_t* obj, const gchar* key)
+{
+       return _tapi_service_object_get_int(obj, key);
+}
+
+gdouble tapi_service_object_get_double(tapi_service_object_t* obj, const gchar* key)
+{
+       return _tapi_service_object_get_double(obj, key);
+}
+
+gchar* tapi_service_object_get_string(tapi_service_object_t* obj, const gchar* key)
+{
+       return _tapi_service_object_get_string(obj, key);
+}
+
+struct _tapi_service_object* tapi_service_object_get_object(tapi_service_object_t* obj, const gchar* key)
+{
+       return _tapi_service_object_get_object(obj, key);
+}
+
+gboolean tapi_service_object_remove_data(struct _tapi_service_object* obj, const gchar* key)
+{
+       gboolean rv = FALSE;
+
+       rv = _tapi_service_object_remove_data(obj, key);
+       if (!rv)
+               return FALSE;
+
+       return TRUE;
+}
+
+gboolean tapi_service_object_remove_alldata(struct _tapi_service_object* obj)
+{
+       gboolean rv = FALSE;
+
+       rv = _tapi_service_object_remove_alldata(obj);
+       if (!rv)
+               return FALSE;
+
+       return TRUE;
+}
+
+gboolean tapi_service_object_destory(struct _tapi_service_object* obj)
+{
+       gboolean rv = FALSE;
+
+       rv = _tapi_service_object_destory(obj);
+       if (!rv)
+               return FALSE;
+
+       return TRUE;
+}
+
+gboolean tel_processing_command_sync(struct _tapi_handle *h, struct _tapi_service_object *in_obj,
+               struct _tapi_service_object *out_obj)
+{
+       gboolean rv = FALSE;
+
+       rv = _tapi_send_service_request_sync(h, in_obj, out_obj);
+       if (!rv)
+               return FALSE;
+
+       return TRUE;
+}
+
+gboolean tel_processing_command_async(struct _tapi_handle *h, struct _tapi_service_object *in_obj, tapi_cb cb,
+               void *user_data)
+{
+       gboolean rv = FALSE;
+       struct _tapi_event *e = 0;
+
+       e = g_new0( struct _tapi_event, 1 );
+       e->event = in_obj->cmd;
+       e->cb = cb;
+       e->cb_data = user_data;
+
+       if( e->event & TCORE_REQUEST){
+               h->cfrms = g_slist_append(h->cfrms, e);
+       }
+       else{
+               return FALSE;
+       }
+
+       rv = _tapi_send_service_request_sync(h, in_obj, NULL);
+       if (!rv)
+               return FALSE;
+
+       return TRUE;
+}
+
+gboolean tapi_register_notification(struct _tapi_handle *h, tapi_service_notification_e noti, tapi_cb cb, void *cb_data)
+{
+       struct _tapi_event *e = 0;
+
+       e = g_new0( struct _tapi_event, 1 );
+       e->event = noti;
+       e->cb = cb;
+       e->cb_data = cb_data;
+
+       if ((e->event & 0xF0000000) == TCORE_NOTIFICATION) {
+               h->notis = g_slist_append(h->notis, e);
+       }
+       else {
+               return FALSE;
+       }
+
+       return TRUE;
+}
+
diff --git a/packaging/tel-plugin-socket_communicator.spec b/packaging/tel-plugin-socket_communicator.spec
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/packaging/unused b/packaging/unused
new file mode 100644 (file)
index 0000000..5364927
--- /dev/null
@@ -0,0 +1 @@
+this package is not used in OBS
diff --git a/plugin/CMakeLists.txt b/plugin/CMakeLists.txt
new file mode 100644 (file)
index 0000000..e2820c8
--- /dev/null
@@ -0,0 +1,48 @@
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+PROJECT(socket-communicator C)
+
+SET(PREFIX ${CMAKE_INSTALL_PREFIX})
+SET(EXEC_PREFIX "\${prefix}")
+SET(LIBDIR "\${prefix}/lib")
+SET(INCLUDEDIR "\${prefix}/include")
+
+# Set required packages
+INCLUDE(FindPkgConfig)
+pkg_check_modules(pkgs REQUIRED glib-2.0 tcore security-server aul)
+
+FOREACH(flag ${pkgs_CFLAGS})
+       SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+ENDFOREACH(flag)
+
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include/ ${CMAKE_SOURCE_DIR}/../common/include)
+
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -Werror -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Wdeclaration-after-statement -Wmissing-declarations -Wredundant-decls -Wcast-align")
+
+MESSAGE(${CMAKE_C_FLAGS})
+MESSAGE(${CMAKE_EXE_LINKER_FLAGS})
+
+SET(SRCS
+               ../common/src/sipc_server.c
+               ../common/src/sipc_channel.c
+               ../common/src/sipc_marshal.c
+               src/desc-sipc.c
+               src/socket_sim.c
+               src/socket_sap.c
+               src/socket_pb.c
+               src/socket_ps.c
+               src/socket_network.c
+               src/socket_call.c
+               src/socket_sms.c
+               src/socket_custom.c
+)
+
+# library build
+ADD_LIBRARY(socket-communicator SHARED ${SOCKET_IPC_LIB_SRCS} ${SRCS})
+TARGET_LINK_LIBRARIES(socket-communicator ${pkgs_LDFLAGS})
+SET_TARGET_PROPERTIES(socket-communicator PROPERTIES PREFIX "" OUTPUT_NAME socket-communicator)
+
+# pkgconfig file
+SET(PREFIX ${CMAKE_INSTALL_PREFIX})
+
+# install
+INSTALL(TARGETS socket-communicator LIBRARY DESTINATION lib/telephony/plugins)
diff --git a/plugin/debian/changelog b/plugin/debian/changelog
new file mode 100644 (file)
index 0000000..9674311
--- /dev/null
@@ -0,0 +1,7 @@
+tel-plugin-socket-communicator (0.1.0) unstable; urgency=low
+
+  * Initial
+  * Git: pkgs/t/tel-plugin-socket_communicator
+  * Tag: tel-plugin-socket-communicator_0.1.0-1
+
+ -- Inho Oh <inho48.oh@samsung.com>  Thu, 15 Mar 2012 23:40:55 +0900
diff --git a/plugin/debian/compat b/plugin/debian/compat
new file mode 100644 (file)
index 0000000..7ed6ff8
--- /dev/null
@@ -0,0 +1 @@
+5
diff --git a/plugin/debian/control b/plugin/debian/control
new file mode 100644 (file)
index 0000000..eea4dad
--- /dev/null
@@ -0,0 +1,19 @@
+Source: tel-plugin-socket-communicator
+Section: libs
+Priority: extra
+Maintainer: Jongman Park <jman.park@samsung.com>
+Uploaders: Jayoung Gu <jygu@samsung.com>, Kyeongchul Kim <kyeongchul.kim@samsung.com>, Youngman Park <youngman.park@samsung.com>, Inho Oh <inho48.oh@samsung.com>,  DongHoo Park <donghoo.park@samsung.com>
+Build-Depends: debhelper (>= 5), libglib2.0-dev, libtcore-dev, libsecurity-server-client-dev, libaul-1-dev, dlog-dev
+Standards-Version: 0.0.0
+
+Package: tel-plugin-socket-communicator
+Section: libs
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends},
+Description: Socket based Communicator (Shared Object)
+
+Package: tel-plugin-socket-communicator-dbg
+Section: debug
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}, tel-plugin-socket-communicator (= ${Source-Version})
+Description: Socket based Communicator (dbg package)
diff --git a/plugin/debian/copyright b/plugin/debian/copyright
new file mode 100644 (file)
index 0000000..d5a0cca
--- /dev/null
@@ -0,0 +1,7 @@
+Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License version 2.1.
+
+The full text of the LGPL 2.1 can be found in
+/usr/share/common-licenses.
diff --git a/plugin/debian/dirs b/plugin/debian/dirs
new file mode 100644 (file)
index 0000000..ca882bb
--- /dev/null
@@ -0,0 +1,2 @@
+usr/bin
+usr/sbin
diff --git a/plugin/debian/docs b/plugin/debian/docs
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/plugin/debian/rules b/plugin/debian/rules
new file mode 100755 (executable)
index 0000000..901cf20
--- /dev/null
@@ -0,0 +1,118 @@
+#!/usr/bin/make -f
+# -*- makefile -*-
+# Sample debian/rules that uses debhelper.
+# This file was originally written by Joey Hess and Craig Small.
+# As a special exception, when this file is copied by dh-make into a
+# dh-make output file, you may use that output file without restriction.
+# This special exception was added by Craig Small in version 0.37 of dh-make.
+
+# Uncomment this to turn on verbose mode.
+#export DH_VERBOSE=1
+
+CFLAGS ?= -Wall -g
+CXXFLAGS ?=  -Wall -g
+LDFLAGS ?=
+PREFIX ?= /usr
+DATADIR ?= /opt
+
+ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
+       CFLAGS += -O0
+       CXXFLAGS += -O0
+else
+       CFLAGS += -O2
+       CXXFLAGS += -O2
+endif
+
+#CFLAGS += -fvisibility=hidden -fPIC
+CFLAGS += -fvisibility=default -fPIC
+LDFLAGS += -rdynamic -fPIC -Wl,--rpath=$(PREFIX)/lib -Wl,--as-needed
+#LDFLAGS += -Wl,--unresolved-symbols=ignore-in-shared-libs,--as-needed
+
+CMAKE_TMP_DIR = $(CURDIR)/cmake_tmp
+
+configure: configure-stamp
+configure-stamp:
+       dh_testdir
+       # Add here commands to configure the package.
+       mkdir -p $(CMAKE_TMP_DIR);
+       cd $(CMAKE_TMP_DIR); CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" cmake .. -DCMAKE_INSTALL_PREFIX=$(PREFIX)
+
+       touch configure-stamp
+
+build: build-stamp
+
+build-stamp: configure-stamp
+       dh_testdir
+
+       # Add here commands to compile the package.
+       cd $(CMAKE_TMP_DIR) && $(MAKE) all
+
+       for f in `find $(CURDIR)/debian/ -name "*.in"`; do \
+               cat $$f > $${f%.in}; \
+               sed -i -e "s#@PREFIX@#$(PREFIX)#g" $${f%.in}; \
+               sed -i -e "s#@DATADIR@#$(DATADIR)#g" $${f%.in}; \
+       done
+
+       touch $@
+
+clean:
+       dh_testdir
+       dh_testroot
+       rm -f build-stamp configure-stamp
+
+       # Add here commands to clean up after the build process.
+       rm -rf $(CMAKE_TMP_DIR)
+
+       for f in `find $(CURDIR)/debian/ -name "*.in"`; do \
+               rm -f $${f%.in}; \
+       done
+
+       dh_clean
+
+install: build
+       dh_testdir
+       dh_testroot
+       dh_clean -k
+       dh_installdirs
+
+       # Add here commands to install the package into debian/wavplayer.
+       cd $(CMAKE_TMP_DIR) && $(MAKE) DESTDIR=$(CURDIR)/debian/tmp install
+
+
+# Build architecture-independent files here.
+binary-indep: build install
+# We have nothing to do by default.
+
+# Build architecture-dependent files here.
+binary-arch: build install
+       dh_testdir
+       dh_testroot
+       dh_installchangelogs
+       dh_installdocs
+       dh_installexamples
+       dh_install --sourcedir=debian/tmp
+#      dh_installmenu
+#      dh_installdebconf
+#      dh_installlogrotate
+#      dh_installemacsen
+#      dh_installpam
+#      dh_installmime
+#      dh_python
+#      dh_installinit
+#      dh_installcron
+#      dh_installinfo
+       dh_installman
+       dh_link
+       dh_strip --dbg-package=tel-plugin-socket-communicator-dbg
+       dh_compress
+       dh_fixperms
+#      dh_perl
+       dh_makeshlibs
+       dh_installdeb
+       dh_shlibdeps
+       dh_gencontrol
+       dh_md5sums
+       dh_builddeb
+
+binary: binary-indep binary-arch
+.PHONY: build clean binary-indep binary-arch binary install configure
diff --git a/plugin/debian/tel-plugin-socket-communicator.install.in b/plugin/debian/tel-plugin-socket-communicator.install.in
new file mode 100644 (file)
index 0000000..112242d
--- /dev/null
@@ -0,0 +1 @@
+@PREFIX@/lib/*
diff --git a/plugin/src/desc-sipc.c b/plugin/src/desc-sipc.c
new file mode 100644 (file)
index 0000000..1d0d753
--- /dev/null
@@ -0,0 +1,322 @@
+/*
+ * tel-plugin-socket-communicator
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Ja-young Gu <jygu@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <glib-object.h>
+
+#include <tcore.h>
+#include <server.h>
+#include <plugin.h>
+#include <hal.h>
+#include <communicator.h>
+#include <queue.h>
+#include <user_request.h>
+#include <util.h>
+
+#include "sipc.h"
+#include "tapi_common.h"
+#include "module_req.h"
+
+#define SERVER_PATH "/tmp/telephony"
+
+
+static int _dispatch_service_request(unsigned int ch_id, struct _tapi_header *hdr, gchar *data, void **outparam, void *cb_data)
+{
+       TcorePlugin *plugin = NULL;
+       struct custom_data *d = (struct custom_data*)cb_data;
+
+       plugin = tcore_server_find_plugin(d->server, hdr->cp_name);
+
+       switch (hdr->cmd & 0x0FF00000) {
+               case TCORE_TYPE_CALL:
+                       dbg("call request");
+                       scomm_service_reqeust_call(ch_id, d->comm, plugin, hdr->cmd, data, outparam);
+                       break;
+
+               case TCORE_TYPE_SIM:
+                       dbg("sim request");
+                       scomm_service_reqeust_sim(ch_id, d->comm, plugin, hdr->cmd, data, outparam);
+                       break;
+
+               case TCORE_TYPE_SAP:
+                       dbg("sap request");
+                       scomm_service_reqeust_sap(ch_id, d->comm, plugin, hdr->cmd, data, outparam);
+                       break;
+
+               case TCORE_TYPE_PHONEBOOK:
+                       dbg("phonebook request");
+                       scomm_service_reqeust_pb(ch_id, d->comm, plugin, hdr->cmd, data, outparam);
+                       break;
+
+               case TCORE_TYPE_NETWORK:
+                       dbg("network request");
+                       scomm_service_request_network(ch_id, d->comm, plugin, hdr->cmd, data, outparam);
+                       break;
+
+               case TCORE_TYPE_PS:
+                       dbg("packet service request");
+                       scomm_service_request_ps(ch_id, d->comm, plugin, hdr->cmd, data, outparam);
+                       break;
+
+               case TCORE_TYPE_SMS:
+                       dbg("sms request");
+                       scomm_service_request_sms(ch_id, d->comm, plugin, hdr->cmd, data, outparam);
+                       break;
+
+               case TCORE_TYPE_CUSTOM:
+                       dbg("custom request");
+                       scomm_service_request_custom(ch_id, d->comm, plugin, hdr->cmd, data, outparam);
+                       break;
+
+               default:
+                       dbg("unknown request (0x%x)", hdr->cmd);
+                       break;
+       }
+
+       return 1;
+}
+
+static gboolean sipc_send_response(Communicator *comm, UserRequest *ur, enum tcore_response_command command, unsigned int data_len, const void *data)
+{
+       switch (command & (TCORE_RESPONSE | 0x0FF00000)) {
+               case TRESP_CALL:
+                       dbg("TRESP_CALL");
+                       scomm_service_response_call(comm, ur, command, data_len, data);
+                       break;
+
+               case TRESP_PS:
+                       dbg("TRESP_PS");
+                       scomm_service_response_ps(comm, ur, command, data_len, data);
+                       break;
+
+               case TRESP_SIM:
+                       dbg("TRESP_SIM");
+                       scomm_service_response_sim(comm, ur, command, data_len, data);
+                       break;
+
+               case TRESP_SAP:
+                       dbg("TRESP_SAP");
+                       scomm_service_response_sap(comm, ur, command, data_len, data);
+                       break;
+
+               case TRESP_PHONEBOOK:
+                       dbg("TRESP_PHONEBOOK");
+                       scomm_service_response_pb(comm, ur, command, data_len, data);
+                       break;
+
+               case TRESP_NETWORK:
+                       dbg("TRESP_NETWORK");
+                       scomm_service_response_network(comm, ur, command, data_len, data);
+                       break;
+
+               case TRESP_MODEM:
+                       dbg("TRESP_MODEM");
+                       break;
+
+               case TRESP_SMS:
+                       dbg("TRESP_SMS");
+                       scomm_service_response_sms(comm, ur, command, data_len, data);
+                       break;
+
+               case TRESP_CUSTOM:
+                       dbg("TRESP_CUSTOM");
+                       scomm_service_response_custom(comm, ur, command, data_len, data);
+                       break;
+
+               default:
+                       warn("unknown command (0x%x)", command);
+                       break;
+       }
+
+       return TRUE;
+}
+
+static gboolean sipc_send_notification(Communicator *comm, CoreObject *source, enum tcore_notification_command command, unsigned int data_len, const void *data)
+{
+       switch (command & (TCORE_NOTIFICATION | 0x0FF00000)) {
+               case TNOTI_CALL:
+                       dbg("TNOTI_CALL");
+                       scomm_service_notification_call(comm, source, command, data_len, data);
+                       break;
+
+               case TNOTI_PS:
+                       dbg("TNOTI_PS");
+                       scomm_service_notification_ps(comm, source, command, data_len, data);
+                       break;
+
+               case TNOTI_SIM:
+                       dbg("TNOTI_SIM");
+                       scomm_service_notification_sim(comm, source, command, data_len, data);
+                       break;
+
+               case TNOTI_SAP:
+                       dbg("TNOTI_SAP");
+                       scomm_service_notification_sap(comm, source, command, data_len, data);
+                       break;
+
+               case TNOTI_PHONEBOOK:
+                       dbg("TNOTI_PHONEBOOK");
+                       scomm_service_notification_pb(comm, source, command, data_len, data);
+                       break;
+
+               case TNOTI_NETWORK:
+                       dbg("TNOTI_NETWORK");
+                       scomm_service_notification_network(comm, source, command, data_len, data);
+                       break;
+
+               case TNOTI_SERVER:
+                       dbg("TNOTI_SERVER");
+                       return TRUE;
+
+               case TNOTI_MODEM:
+                       dbg("TNOTI_MODEM");
+                       break;
+
+               case TNOTI_SMS:
+                       dbg("TNOTI_SMS");
+                       scomm_service_notification_sms(comm, source, command, data_len, data);
+                       break;
+
+               case TNOTI_CUSTOM:
+                       dbg("TNOTI_CUSTOM");
+                       scomm_service_notification_custom(comm, source, command, data_len, data);
+                       break;
+
+               default:
+                       warn("unknown command (0x%x)", command);
+                       break;
+       }
+
+       return TRUE;
+}
+
+struct tcore_communitor_operations ops = {
+       .send_response = sipc_send_response,
+       .send_notification = sipc_send_notification,
+};
+
+static int on_recv( unsigned int ch_id, void* inparam, unsigned int inparam_len, void **outparam, void *cb_data )
+{
+       int rv = 1;
+       int o_data_len = 0;
+       gchar *data = NULL;
+       gchar *o_data = NULL;
+       struct _tapi_header hdr;
+
+       memcpy(&hdr, inparam, sizeof(struct _tapi_header));
+       data = g_new0(char , hdr.data_len+1);
+       memcpy(data, (inparam+sizeof(struct _tapi_header)), hdr.data_len );
+
+       if( !(hdr.cmd & TCORE_REQUEST) ){
+               dbg("does not request command");
+               return -1;
+       }
+
+       //check cookie, if cookie is wrong return -1 ( send fail? , or return another?)
+/*     if( cookie does not matched)
+       {
+               dbg("cookie is not matched");
+               return -1;
+       }*/
+
+#if 1
+       rv = _dispatch_service_request(ch_id, &hdr, data, (void **)&o_data, cb_data);
+       g_free(data);
+
+       o_data_len = strlen(o_data);
+       *outparam = g_new0(char, o_data_len);
+       memcpy(*outparam, o_data, o_data_len);
+       g_free(o_data);
+#else
+       *outparam = g_new0(char, hdr.data_len+1);
+       memcpy(*outparam, data, hdr.data_len);
+#endif
+
+       return rv;
+}
+
+static gboolean on_load(void)
+{
+       dbg("socket communicator plug-in load!");
+       return TRUE;
+}
+
+static gboolean on_init(TcorePlugin *p)
+{
+       gboolean rv = FALSE;
+
+       Communicator *comm;
+       struct custom_data *data = NULL;
+       sipc_server_t *sk_server = NULL;
+       sipc_callback_t *cbck = NULL;
+
+       if (!p)
+               return FALSE;
+
+       g_type_init();
+
+       dbg("func entrance");
+
+       sk_server = sipc_server_open(SERVER_PATH);
+       if (!sk_server) {
+               warn("error : fail to open server");
+               return FALSE;
+       }
+
+       comm = tcore_communicator_new(p, "socket_communicator", &ops);
+
+       data = g_new0( struct custom_data, 1 );
+       data->server = tcore_plugin_ref_server(p);
+       data->plugin = p;
+       data->comm = comm;
+       data->sk_server = (void*) sk_server;
+       tcore_communicator_link_user_data(comm, data);
+
+       cbck = g_new0( sipc_callback_t, 1 );
+       cbck->func = on_recv;
+       cbck->data = data;
+       sipc_server_register_rx_callback(sk_server, cbck);
+
+       rv = sipc_server_run(sk_server);
+       if (!rv)
+               return FALSE;
+
+       dbg("server is running");
+       return TRUE;
+}
+
+static void on_unload(TcorePlugin *p)
+{
+       dbg("i'm unload!");
+       return;
+}
+
+struct tcore_plugin_define_desc plugin_define_desc =
+{
+       .name     = "SOCKET_COMMUNICATOR",
+       .priority = TCORE_PLUGIN_PRIORITY_HIGH,
+       .version  = 1,
+       .load     = on_load,
+       .init     = on_init,
+       .unload   = on_unload,
+};
diff --git a/plugin/src/module_req.h b/plugin/src/module_req.h
new file mode 100644 (file)
index 0000000..0b44715
--- /dev/null
@@ -0,0 +1,109 @@
+/*
+ * tel-plugin-socket-communicator
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Ja-young Gu <jygu@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __MODULE_REQ_H__
+#define __MODULE_REQ_H__
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <glib-object.h>
+
+#include <tcore.h>
+#include <server.h>
+#include <plugin.h>
+#include <hal.h>
+#include <communicator.h>
+#include <queue.h>
+#include <user_request.h>
+#include <util.h>
+
+#include "sipc.h"
+#include "tapi_common.h"
+
+__BEGIN_DECLS
+
+struct custom_data {
+       Server*                         server;
+       TcorePlugin*    plugin;
+       Communicator*       comm;
+       sipc_server_t*      sk_server;
+};
+
+gboolean scomm_service_reqeust_sim(unsigned int ch_id, Communicator *c, TcorePlugin *plugin,
+               tapi_service_command_e cmd, gchar *data, void **outparam);
+gboolean scomm_service_response_sim(Communicator *comm, UserRequest *ur, enum tcore_response_command command,
+               unsigned int data_len, const void *data);
+gboolean scomm_service_notification_sim(Communicator *comm, CoreObject *source, enum tcore_notification_command command,
+               unsigned int data_len, const void *data);
+
+gboolean scomm_service_reqeust_sap(unsigned int ch_id, Communicator *c, TcorePlugin *plugin,
+               tapi_service_command_e cmd, gchar *data, void **outparam);
+gboolean scomm_service_response_sap(Communicator *comm, UserRequest *ur, enum tcore_response_command command,
+               unsigned int data_len, const void *data);
+gboolean scomm_service_notification_sap(Communicator *comm, CoreObject *source, enum tcore_notification_command command,
+               unsigned int data_len, const void *data);
+
+gboolean scomm_service_reqeust_pb(unsigned int ch_id, Communicator *c, TcorePlugin *plugin,
+               tapi_service_command_e cmd, gchar *data, void **outparam);
+gboolean scomm_service_response_pb(Communicator *comm, UserRequest *ur, enum tcore_response_command command,
+               unsigned int data_len, const void *data);
+gboolean scomm_service_notification_pb(Communicator *comm, CoreObject *source, enum tcore_notification_command command,
+               unsigned int data_len, const void *data);
+
+gboolean scomm_service_reqeust_call(unsigned int ch_id, Communicator *c, TcorePlugin *plugin,
+               tapi_service_command_e cmd, gchar *data, void **outparam);
+gboolean scomm_service_response_call(Communicator *comm, UserRequest *ur, enum tcore_response_command command,
+               unsigned int data_len, const void *data);
+gboolean scomm_service_notification_call(Communicator *comm, CoreObject *source, enum tcore_notification_command command,
+               unsigned int data_len, const void *data);
+
+gboolean scomm_service_request_network(unsigned int ch_id, Communicator *c, TcorePlugin *plugin,
+               tapi_service_command_e cmd, gchar *data, void **outparam);
+gboolean scomm_service_response_network(Communicator *comm, UserRequest *ur, enum tcore_response_command command,
+               unsigned int data_len, const void *data);
+gboolean scomm_service_notification_network(Communicator *comm, CoreObject *source, enum tcore_notification_command command,
+               unsigned int data_len, const void *data);
+
+gboolean scomm_service_request_ps(unsigned int ch_id, Communicator *c, TcorePlugin *plugin,
+               tapi_service_command_e cmd, gchar *data, void **outparam);
+gboolean scomm_service_response_ps(Communicator *comm, UserRequest *ur, enum tcore_response_command command,
+               unsigned int data_len, const void *data);
+gboolean scomm_service_notification_ps(Communicator *comm, CoreObject *source, enum tcore_notification_command command,
+               unsigned int data_len, const void *data);
+
+gboolean scomm_service_request_sms(unsigned int ch_id, Communicator *c, TcorePlugin *plugin,
+               tapi_service_command_e cmd, gchar *data, void **outparam);
+gboolean scomm_service_response_sms(Communicator *comm, UserRequest *ur, enum tcore_response_command command,
+               unsigned int data_len, const void *data);
+gboolean scomm_service_notification_sms(Communicator *comm, CoreObject *source, enum tcore_notification_command command,
+               unsigned int data_len, const void *data);
+
+gboolean scomm_service_request_custom(unsigned int ch_id, Communicator *c, TcorePlugin *plugin,
+               tapi_service_command_e cmd, gchar *data, void **outparam);
+gboolean scomm_service_response_custom(Communicator *comm, UserRequest *ur, enum tcore_response_command command,
+               unsigned int data_len, const void *data);
+gboolean scomm_service_notification_custom(Communicator *comm, CoreObject *source, enum tcore_notification_command command,
+               unsigned int data_len, const void *data);
+
+__END_DECLS
+
+#endif
diff --git a/plugin/src/socket_call.c b/plugin/src/socket_call.c
new file mode 100644 (file)
index 0000000..b76600a
--- /dev/null
@@ -0,0 +1,764 @@
+/*
+ * tel-plugin-socket-communicator
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Ja-young Gu <jygu@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <glib-object.h>
+
+#include <aul.h>
+#include <bundle.h>
+#include <tcore.h>
+#include <server.h>
+#include <plugin.h>
+#include <hal.h>
+#include <communicator.h>
+#include <core_object.h>
+#include <queue.h>
+#include <user_request.h>
+#include <util.h>
+#include <co_call.h>
+
+#include "sipc.h"
+#include "tapi_common.h"
+#include "module_req.h"
+
+gboolean scomm_service_reqeust_call(unsigned int ch_id, Communicator *c, TcorePlugin *plugin, tapi_service_command_e cmd, gchar *data, void **outparam)
+{
+       int ret = 0;
+       gboolean result = TRUE; int err_cause = 0;
+       int s_data_len = 0;
+       gchar *serial_d = NULL;
+
+       GSList *co_list = NULL;
+       CoreObject *co_call = NULL;
+       UserRequest *ur = NULL;
+       struct tcore_user_info ui = { 0, 0, 0, NULL,0,0, NULL };
+
+       struct _sipc_marshal_object *out_obj;
+       struct _sipc_marshal_object *in_obj;
+
+       co_list = tcore_plugin_get_core_objects_bytype(plugin, CORE_OBJECT_TYPE_CALL);
+       if (!co_list) {
+               return FALSE;
+       }
+
+       co_call = (CoreObject *)co_list->data;
+       if (!co_call) {
+               return FALSE;
+       }
+       g_slist_free(co_list);
+
+       in_obj = sipc_util_marshal_object_deserializer(data);
+       if(in_obj){
+               return FALSE;
+       }
+
+       ui.channel_id = ch_id;
+       ui.client_cmd = (unsigned int)cmd;
+       ur = tcore_user_request_new(c, tcore_plugin_get_description(plugin)->name);
+       if (!ur) {
+               return FALSE;
+       }
+       tcore_user_request_set_user_info(ur, &ui);
+
+       switch (cmd) {
+               case TAPI_SERVICE_CALL_DIAL: {
+                       struct treq_call_dial data;
+                       /*
+                        * COMMON CODE
+                        * get_data from in_obj
+                        *
+                        * ONLY SYNC API & RETURN DATA
+                        * out_obj = sipc_util_marshal_object_create();
+                        * sipc_util_marshal_object_add_data(out_obj, "result", &result, SIPC_MARSHAL_DATA_BOOLEAN_TYPE);
+                        * sipc_util_marshal_object_add_data(out_obj, "err_cause", &err_cause, SIPC_MARSHAL_DATA_BOOLEAN_INT);
+                        *
+                        * serial_d = sipc_util_marshal_object_serializer(out_obj);
+                        * s_data_len = strlen(serial_d);
+                        * sipc_util_marshal_object_destory(out_obj);
+                        *
+                        * *outparam = g_new0(char, s_data_len);
+                        * memcpy(*outparam, serial_d, hdr.s_data_len);
+                        * g_free(serial_d);
+                        * return;
+                        *
+                        */
+                       tcore_user_request_set_data(ur, sizeof( struct treq_call_dial ), &data);
+                       tcore_user_request_set_command(ur, TREQ_CALL_DIAL);
+               }break;
+               case TAPI_SERVICE_ANSWER: {
+                       struct treq_call_answer data;
+                       /*
+                        * COMMON CODE
+                        * get_data from in_obj
+                        *
+                        * ONLY SYNC API & RETURN DATA
+                        * out_obj = sipc_util_marshal_object_create();
+                        * sipc_util_marshal_object_add_data(out_obj, "result", &result, SIPC_MARSHAL_DATA_BOOLEAN_TYPE);
+                        * sipc_util_marshal_object_add_data(out_obj, "err_cause", &err_cause, SIPC_MARSHAL_DATA_BOOLEAN_INT);
+                        *
+                        * serial_d = sipc_util_marshal_object_serializer(out_obj);
+                        * s_data_len = strlen(serial_d);
+                        * sipc_util_marshal_object_destory(out_obj);
+                        *
+                        * *outparam = g_new0(char, s_data_len);
+                        * memcpy(*outparam, serial_d, hdr.s_data_len);
+                        * g_free(serial_d);
+                        * return;
+                        *
+                        */
+                       tcore_user_request_set_data(ur, sizeof( struct treq_call_answer ), &data);
+                       tcore_user_request_set_command(ur, TREQ_CALL_ANSWER);
+               }break;
+               case TAPI_SERVICE_END: {
+                       //TAPI_CS_CALL_RELEASEALL
+                       //TAPI_CS_CALL_RELEASEALL_ACTIVE
+                       //TAPI_CS_CALL_RELEASEALL_HELD
+                       struct treq_call_end data;
+                       /*
+                        * COMMON CODE
+                        * get_data from in_obj
+                        *
+                        * ONLY SYNC API & RETURN DATA
+                        * out_obj = sipc_util_marshal_object_create();
+                        * sipc_util_marshal_object_add_data(out_obj, "result", &result, SIPC_MARSHAL_DATA_BOOLEAN_TYPE);
+                        * sipc_util_marshal_object_add_data(out_obj, "err_cause", &err_cause, SIPC_MARSHAL_DATA_BOOLEAN_INT);
+                        *
+                        * serial_d = sipc_util_marshal_object_serializer(out_obj);
+                        * s_data_len = strlen(serial_d);
+                        * sipc_util_marshal_object_destory(out_obj);
+                        *
+                        * *outparam = g_new0(char, s_data_len);
+                        * memcpy(*outparam, serial_d, hdr.s_data_len);
+                        * g_free(serial_d);
+                        * return;
+                        *
+                        */
+                       tcore_user_request_set_data(ur, sizeof( struct treq_call_end ), &data);
+                       tcore_user_request_set_command(ur, TREQ_CALL_END);
+               }break;
+
+               //TAPI_CS_CALL_DTMF
+
+               case TAPI_SERVICE_HOLD: {
+                       unsigned int id = 0;
+                       /*
+                        * COMMON CODE
+                        * get_data from in_obj
+                        *
+                        * ONLY SYNC API & RETURN DATA
+                        * out_obj = sipc_util_marshal_object_create();
+                        * sipc_util_marshal_object_add_data(out_obj, "result", &result, SIPC_MARSHAL_DATA_BOOLEAN_TYPE);
+                        * sipc_util_marshal_object_add_data(out_obj, "err_cause", &err_cause, SIPC_MARSHAL_DATA_BOOLEAN_INT);
+                        *
+                        * serial_d = sipc_util_marshal_object_serializer(out_obj);
+                        * s_data_len = strlen(serial_d);
+                        * sipc_util_marshal_object_destory(out_obj);
+                        *
+                        * *outparam = g_new0(char, s_data_len);
+                        * memcpy(*outparam, serial_d, hdr.s_data_len);
+                        * g_free(serial_d);
+                        * return;
+                        *
+                        */
+                       tcore_user_request_set_data(ur, sizeof( unsigned int ), &id);
+                       tcore_user_request_set_command(ur, TREQ_CALL_HOLD);
+               }break;
+               case TAPI_SERVICE_ACTIVE: {
+                       unsigned int id = 0;
+                       /*
+                        * COMMON CODE
+                        * get_data from in_obj
+                        *
+                        * ONLY SYNC API & RETURN DATA
+                        * out_obj = sipc_util_marshal_object_create();
+                        * sipc_util_marshal_object_add_data(out_obj, "result", &result, SIPC_MARSHAL_DATA_BOOLEAN_TYPE);
+                        * sipc_util_marshal_object_add_data(out_obj, "err_cause", &err_cause, SIPC_MARSHAL_DATA_BOOLEAN_INT);
+                        *
+                        * serial_d = sipc_util_marshal_object_serializer(out_obj);
+                        * s_data_len = strlen(serial_d);
+                        * sipc_util_marshal_object_destory(out_obj);
+                        *
+                        * *outparam = g_new0(char, s_data_len);
+                        * memcpy(*outparam, serial_d, hdr.s_data_len);
+                        * g_free(serial_d);
+                        * return;
+                        *
+                        */
+                       tcore_user_request_set_data(ur, sizeof( unsigned int ), &id);
+                       tcore_user_request_set_command(ur, TREQ_CALL_ACTIVE);
+               }break;
+               case TAPI_SERVICE_SWAP: {
+                       unsigned int id = 0;
+                       /*
+                        * COMMON CODE
+                        * get_data from in_obj
+                        *
+                        * ONLY SYNC API & RETURN DATA
+                        * out_obj = sipc_util_marshal_object_create();
+                        * sipc_util_marshal_object_add_data(out_obj, "result", &result, SIPC_MARSHAL_DATA_BOOLEAN_TYPE);
+                        * sipc_util_marshal_object_add_data(out_obj, "err_cause", &err_cause, SIPC_MARSHAL_DATA_BOOLEAN_INT);
+                        *
+                        * serial_d = sipc_util_marshal_object_serializer(out_obj);
+                        * s_data_len = strlen(serial_d);
+                        * sipc_util_marshal_object_destory(out_obj);
+                        *
+                        * *outparam = g_new0(char, s_data_len);
+                        * memcpy(*outparam, serial_d, hdr.s_data_len);
+                        * g_free(serial_d);
+                        * return;
+                        *
+                        */
+                       tcore_user_request_set_data(ur, sizeof( unsigned int ), &id);
+                       tcore_user_request_set_command(ur, TREQ_CALL_SWAP);
+               }break;
+               case TAPI_SERVICE_JOIN: {
+                       unsigned int id = 0;
+                       /*
+                        * COMMON CODE
+                        * get_data from in_obj
+                        *
+                        * ONLY SYNC API & RETURN DATA
+                        * out_obj = sipc_util_marshal_object_create();
+                        * sipc_util_marshal_object_add_data(out_obj, "result", &result, SIPC_MARSHAL_DATA_BOOLEAN_TYPE);
+                        * sipc_util_marshal_object_add_data(out_obj, "err_cause", &err_cause, SIPC_MARSHAL_DATA_BOOLEAN_INT);
+                        *
+                        * serial_d = sipc_util_marshal_object_serializer(out_obj);
+                        * s_data_len = strlen(serial_d);
+                        * sipc_util_marshal_object_destory(out_obj);
+                        *
+                        * *outparam = g_new0(char, s_data_len);
+                        * memcpy(*outparam, serial_d, hdr.s_data_len);
+                        * g_free(serial_d);
+                        * return;
+                        *
+                        */
+                       tcore_user_request_set_data(ur, sizeof( unsigned int ), &id);
+                       tcore_user_request_set_command(ur, TREQ_CALL_JOIN);
+               }break;
+               case TAPI_SERVICE_SPLIT: {
+                       unsigned int id = 0;
+                       /*
+                        * COMMON CODE
+                        * get_data from in_obj
+                        *
+                        * ONLY SYNC API & RETURN DATA
+                        * out_obj = sipc_util_marshal_object_create();
+                        * sipc_util_marshal_object_add_data(out_obj, "result", &result, SIPC_MARSHAL_DATA_BOOLEAN_TYPE);
+                        * sipc_util_marshal_object_add_data(out_obj, "err_cause", &err_cause, SIPC_MARSHAL_DATA_BOOLEAN_INT);
+                        *
+                        * serial_d = sipc_util_marshal_object_serializer(out_obj);
+                        * s_data_len = strlen(serial_d);
+                        * sipc_util_marshal_object_destory(out_obj);
+                        *
+                        * *outparam = g_new0(char, s_data_len);
+                        * memcpy(*outparam, serial_d, hdr.s_data_len);
+                        * g_free(serial_d);
+                        * return;
+                        *
+                        */
+                       tcore_user_request_set_data(ur, sizeof( unsigned int ), &id);
+                       tcore_user_request_set_command(ur, TREQ_CALL_SPLIT);
+               }break;
+               case TAPI_SERVICE_DEFLECT: {
+                       /*
+                        * COMMON CODE
+                        * get_data from in_obj
+                        *
+                        * ONLY SYNC API & RETURN DATA
+                        * out_obj = sipc_util_marshal_object_create();
+                        * sipc_util_marshal_object_add_data(out_obj, "result", &result, SIPC_MARSHAL_DATA_BOOLEAN_TYPE);
+                        * sipc_util_marshal_object_add_data(out_obj, "err_cause", &err_cause, SIPC_MARSHAL_DATA_BOOLEAN_INT);
+                        *
+                        * serial_d = sipc_util_marshal_object_serializer(out_obj);
+                        * s_data_len = strlen(serial_d);
+                        * sipc_util_marshal_object_destory(out_obj);
+                        *
+                        * *outparam = g_new0(char, s_data_len);
+                        * memcpy(*outparam, serial_d, hdr.s_data_len);
+                        * g_free(serial_d);
+                        * return;
+                        *
+                        */
+                       tcore_user_request_set_command(ur, TREQ_CALL_DEFLECT);
+               }break;
+               case TAPI_SERVICE_TRANSFER: {
+                       unsigned int id = 0;
+                       /*
+                        * COMMON CODE
+                        * get_data from in_obj
+                        *
+                        * ONLY SYNC API & RETURN DATA
+                        * out_obj = sipc_util_marshal_object_create();
+                        * sipc_util_marshal_object_add_data(out_obj, "result", &result, SIPC_MARSHAL_DATA_BOOLEAN_TYPE);
+                        * sipc_util_marshal_object_add_data(out_obj, "err_cause", &err_cause, SIPC_MARSHAL_DATA_BOOLEAN_INT);
+                        *
+                        * serial_d = sipc_util_marshal_object_serializer(out_obj);
+                        * s_data_len = strlen(serial_d);
+                        * sipc_util_marshal_object_destory(out_obj);
+                        *
+                        * *outparam = g_new0(char, s_data_len);
+                        * memcpy(*outparam, serial_d, hdr.s_data_len);
+                        * g_free(serial_d);
+                        * return;
+                        *
+                        */
+                       tcore_user_request_set_data(ur, sizeof( unsigned int ), &id);
+                       tcore_user_request_set_command(ur, TREQ_CALL_TRANSFER);
+               }break;
+
+               //TAPI_CS_CALL_GETACTIVELINE
+               //TAPI_CS_CALL_SETACTIVELINE
+
+               case TAPI_SERVICE_SEND_DTMF: {}break;
+               case TAPI_SERVICE_SET_SOUND_PATH: {}break;
+               case TAPI_SERVICE_GET_SOUND_VOLUME_LEVEL: {}break;
+               case TAPI_SERVICE_SET_SOUND_VOLUME_LEVEL: {}break;
+               case TAPI_SERVICE_MUTE: {}break;
+               case TAPI_SERVICE_UNMUTE: {}break;
+               case TAPI_SERVICE_GET_MUTE_STATUS: {}break;
+       }
+
+       ret = tcore_communicator_dispatch_request(c, ur);
+       if (ret != TCORE_RETURN_SUCCESS) {
+               return FALSE;
+       }
+
+       return TRUE;
+}
+
+gboolean scomm_service_response_call(Communicator *comm, UserRequest *ur, enum tcore_response_command command, unsigned int data_len, const void *data)
+{
+       int ret = 0;
+
+       gboolean result = TRUE; int err_cause = 0;
+       gchar *out_d= NULL, *serial_d = NULL;
+       struct custom_data *ctx = NULL;
+       const struct tcore_user_info *ui;
+
+       sipc_server_t *s = NULL;
+       struct _tapi_header hdr;
+       struct _sipc_marshal_object* out_obj = NULL;
+
+       memset(&hdr, 0, sizeof(struct _tapi_header));
+
+       ctx = tcore_communicator_ref_user_data(comm);
+       if (!ctx) {
+               dbg("user_data is NULL");
+               return FALSE;
+       }
+
+       ui = tcore_user_request_ref_user_info(ur);
+       s = ctx->sk_server;
+
+       dbg("application channel id(%d), Command = [0x%x], data_len = %d", ui->channel_id, command, data_len);
+       hdr.cmd = (tapi_service_command_e)ui->client_cmd;
+
+       switch (command) {
+               case TRESP_CALL_DIAL: {
+                       struct tresp_call_general* resp_data = 0;
+                       resp_data = (struct tresp_call_general*)data;
+
+                       /*{create output data and create serialized data}
+                               out_obj = sipc_util_marshal_object_create();
+                               sipc_util_marshal_object_add_data(out_obj, "result", &result, SIPC_MARSHAL_DATA_BOOLEAN_TYPE);
+                               sipc_util_marshal_object_add_data(out_obj, "err_cause", &err_cause, SIPC_MARSHAL_DATA_BOOLEAN_INT);
+                               .......
+                       */
+               } break;
+
+               case TRESP_CALL_ANSWER: {
+                       struct tresp_call_general* resp_data = 0;
+                       resp_data = (struct tresp_call_general*)data;
+
+                       /*{create output data and create serialized data}
+                               out_obj = sipc_util_marshal_object_create();
+                               sipc_util_marshal_object_add_data(out_obj, "result", &result, SIPC_MARSHAL_DATA_BOOLEAN_TYPE);
+                               sipc_util_marshal_object_add_data(out_obj, "err_cause", &err_cause, SIPC_MARSHAL_DATA_BOOLEAN_INT);
+                               .......
+                       */
+               } break;
+
+               case TRESP_CALL_END: {
+                       struct tresp_call_general* resp_data = 0;
+                       resp_data = (struct tresp_call_general*)data;
+
+                       /*{create output data and create serialized data}
+                               out_obj = sipc_util_marshal_object_create();
+                               sipc_util_marshal_object_add_data(out_obj, "result", &result, SIPC_MARSHAL_DATA_BOOLEAN_TYPE);
+                               sipc_util_marshal_object_add_data(out_obj, "err_cause", &err_cause, SIPC_MARSHAL_DATA_BOOLEAN_INT);
+                               .......
+                       */
+
+               } break;
+               case TRESP_CALL_END_ALL: {
+                       struct tresp_call_general* resp_data = 0;
+                       resp_data = (struct tresp_call_general*)data;
+
+                       /*{create output data and create serialized data}
+                               out_obj = sipc_util_marshal_object_create();
+                               sipc_util_marshal_object_add_data(out_obj, "result", &result, SIPC_MARSHAL_DATA_BOOLEAN_TYPE);
+                               sipc_util_marshal_object_add_data(out_obj, "err_cause", &err_cause, SIPC_MARSHAL_DATA_BOOLEAN_INT);
+                               .......
+                       */
+
+               } break;
+               case TRESP_CALL_END_ALL_ACTIVE: {
+                       struct tresp_call_general* resp_data = 0;
+                       resp_data = (struct tresp_call_general*)data;
+
+                       /*{create output data and create serialized data}
+                               out_obj = sipc_util_marshal_object_create();
+                               sipc_util_marshal_object_add_data(out_obj, "result", &result, SIPC_MARSHAL_DATA_BOOLEAN_TYPE);
+                               sipc_util_marshal_object_add_data(out_obj, "err_cause", &err_cause, SIPC_MARSHAL_DATA_BOOLEAN_INT);
+                               .......
+                       */
+               } break;
+               case TRESP_CALL_END_ALL_HELD: {
+                       struct tresp_call_general* resp_data = 0;
+                       resp_data = (struct tresp_call_general*)data;
+
+                       /*{create output data and create serialized data}
+                               out_obj = sipc_util_marshal_object_create();
+                               sipc_util_marshal_object_add_data(out_obj, "result", &result, SIPC_MARSHAL_DATA_BOOLEAN_TYPE);
+                               sipc_util_marshal_object_add_data(out_obj, "err_cause", &err_cause, SIPC_MARSHAL_DATA_BOOLEAN_INT);
+                               .......
+                       */
+               } break;
+               case TRESP_CALL_HOLD: {
+                       struct tresp_call_general* resp_data = 0;
+                       resp_data = (struct tresp_call_general*)data;
+
+                       /*{create output data and create serialized data}
+                               out_obj = sipc_util_marshal_object_create();
+                               sipc_util_marshal_object_add_data(out_obj, "result", &result, SIPC_MARSHAL_DATA_BOOLEAN_TYPE);
+                               sipc_util_marshal_object_add_data(out_obj, "err_cause", &err_cause, SIPC_MARSHAL_DATA_BOOLEAN_INT);
+                               .......
+                       */
+               } break;
+               case TRESP_CALL_ACTIVE: {
+                       struct tresp_call_general* resp_data = 0;
+                       resp_data = (struct tresp_call_general*)data;
+
+                       /*{create output data and create serialized data}
+                               out_obj = sipc_util_marshal_object_create();
+                               sipc_util_marshal_object_add_data(out_obj, "result", &result, SIPC_MARSHAL_DATA_BOOLEAN_TYPE);
+                               sipc_util_marshal_object_add_data(out_obj, "err_cause", &err_cause, SIPC_MARSHAL_DATA_BOOLEAN_INT);
+                               .......
+                       */
+               } break;
+               case TRESP_CALL_SWAP: {
+                       struct tresp_call_general* resp_data = 0;
+                       resp_data = (struct tresp_call_general*)data;
+
+                       /*{create output data and create serialized data}
+                               out_obj = sipc_util_marshal_object_create();
+                               sipc_util_marshal_object_add_data(out_obj, "result", &result, SIPC_MARSHAL_DATA_BOOLEAN_TYPE);
+                               sipc_util_marshal_object_add_data(out_obj, "err_cause", &err_cause, SIPC_MARSHAL_DATA_BOOLEAN_INT);
+                               .......
+                       */
+               } break;
+               case TRESP_CALL_JOIN: {
+                       struct tresp_call_general* resp_data = 0;
+                       resp_data = (struct tresp_call_general*)data;
+
+                       /*{create output data and create serialized data}
+                               out_obj = sipc_util_marshal_object_create();
+                               sipc_util_marshal_object_add_data(out_obj, "result", &result, SIPC_MARSHAL_DATA_BOOLEAN_TYPE);
+                               sipc_util_marshal_object_add_data(out_obj, "err_cause", &err_cause, SIPC_MARSHAL_DATA_BOOLEAN_INT);
+                               .......
+                       */
+               } break;
+               case TRESP_CALL_SPLIT: {
+                       struct tresp_call_general* resp_data = 0;
+                       resp_data = (struct tresp_call_general*)data;
+
+                       /*{create output data and create serialized data}
+                               out_obj = sipc_util_marshal_object_create();
+                               sipc_util_marshal_object_add_data(out_obj, "result", &result, SIPC_MARSHAL_DATA_BOOLEAN_TYPE);
+                               sipc_util_marshal_object_add_data(out_obj, "err_cause", &err_cause, SIPC_MARSHAL_DATA_BOOLEAN_INT);
+                               .......
+                       */
+               } break;
+               case TRESP_CALL_DEFLECT: {
+
+               } break;
+               case TRESP_CALL_TRANSFER: {
+                       struct tresp_call_general* resp_data = 0;
+                       resp_data = (struct tresp_call_general*)data;
+
+                       /*{create output data and create serialized data}
+                               out_obj = sipc_util_marshal_object_create();
+                               sipc_util_marshal_object_add_data(out_obj, "result", &result, SIPC_MARSHAL_DATA_BOOLEAN_TYPE);
+                               sipc_util_marshal_object_add_data(out_obj, "err_cause", &err_cause, SIPC_MARSHAL_DATA_BOOLEAN_INT);
+                               .......
+                       */
+               } break;
+               case TRESP_CALL_SEND_DTMF: {
+
+               } break;
+               case TRESP_CALL_SET_SOUND_PATH: {
+                       struct tresp_call_sound_general* resp_data = 0;
+                       //tapi_sound_error_info_t error_info = { 0 };
+
+                       resp_data = (struct tresp_call_sound_general*)data;
+
+                       /*{create output data and create serialized data}
+                               out_obj = sipc_util_marshal_object_create();
+                               sipc_util_marshal_object_add_data(out_obj, "result", &result, SIPC_MARSHAL_DATA_BOOLEAN_TYPE);
+                               sipc_util_marshal_object_add_data(out_obj, "err_cause", &err_cause, SIPC_MARSHAL_DATA_BOOLEAN_INT);
+                               .......
+                       */
+               } break;
+
+               case TRESP_CALL_SET_SOUND_VOLUME_LEVEL: {
+                       struct tresp_call_sound_general* resp_data = 0;
+                       //tapi_sound_error_info_t error_info = { 0 };
+                       unsigned int err = 0;
+
+                       resp_data = (struct tresp_call_sound_general*)data;
+
+                       /*{create output data and create serialized data}
+                               out_obj = sipc_util_marshal_object_create();
+                               sipc_util_marshal_object_add_data(out_obj, "result", &result, SIPC_MARSHAL_DATA_BOOLEAN_TYPE);
+                               sipc_util_marshal_object_add_data(out_obj, "err_cause", &err_cause, SIPC_MARSHAL_DATA_BOOLEAN_INT);
+                               .......
+                       */
+               } break;
+
+               case TRESP_CALL_GET_SOUND_VOLUME_LEVEL: {
+
+               } break;
+
+               case TRESP_CALL_MUTE:
+               case TRESP_CALL_UNMUTE: {
+                       struct tresp_call_sound_general* resp_data = 0;
+                       //tapi_sound_error_info_t error_info = { 0 };
+                       unsigned int err = 0;
+
+                       resp_data = (struct tresp_call_sound_general*)data;
+
+                       /*{create output data and create serialized data}
+                               out_obj = sipc_util_marshal_object_create();
+                               sipc_util_marshal_object_add_data(out_obj, "result", &result, SIPC_MARSHAL_DATA_BOOLEAN_TYPE);
+                               sipc_util_marshal_object_add_data(out_obj, "err_cause", &err_cause, SIPC_MARSHAL_DATA_BOOLEAN_INT);
+                               .......
+                       */
+               } break;
+
+               case TRESP_CALL_GET_MUTE_STATUS: {
+
+               } break;
+
+               default:
+                       break;
+       }
+
+       if(out_obj){
+               serial_d = sipc_util_marshal_object_serializer(out_obj);
+               hdr.data_len = strlen(serial_d);
+               sipc_util_marshal_object_destory(out_obj);
+       }
+
+       out_d = g_new0(char, sizeof(struct _tapi_header)+hdr.data_len);
+       memcpy(out_d, &hdr, sizeof(struct _tapi_header));
+       if(serial_d){
+               memcpy(out_d+sizeof(struct _tapi_header), serial_d, hdr.data_len);
+               g_free(serial_d);
+       }
+
+       ret = sipc_server_send(s, ui->channel_id, out_d, sizeof(struct _tapi_header)+hdr.data_len, SIPC_SEND_DATA_ASYNC);
+       g_free(out_d);
+
+       if(ret < 0){
+               return FALSE;
+       }
+
+       return TRUE;
+}
+
+gboolean scomm_service_notification_call(Communicator *comm, CoreObject *source, enum tcore_notification_command command, unsigned int data_len, const void *data)
+{
+       int ret = 0;
+       gboolean result = TRUE; int err_cause = 0;
+       gchar *out_d= NULL, *serial_d = NULL;
+
+       struct custom_data *ctx = NULL;
+       sipc_server_t *s = NULL;
+
+       struct _tapi_header hdr;
+       struct _sipc_marshal_object* out_obj = NULL;
+
+       memset(&hdr, 0, sizeof(struct _tapi_header));
+
+       ctx = tcore_communicator_ref_user_data(comm);
+       if (!ctx) {
+               dbg("user_data is NULL");
+               return FALSE;
+       }
+
+       s = ctx->sk_server;
+       dbg("notification !!! (command = 0x%x, data_len = %d)", command, data_len);
+
+       switch (command) {
+               case TNOTI_CALL_STATUS_IDLE: {
+                       //TelCallEndInfo_t resp_data;
+                       int *id = (int*)data;
+
+                       //resp_data.CallEndCause        = 0;
+                       //resp_data.pCallHandle = *id;
+                       //resp_data.CallStartTime = 0;
+                       //resp_data.CallEndTime = 0;
+
+                       /*{create output data and create serialized data}
+                               hdr->cmd = ;
+                               out_obj = sipc_util_marshal_object_create();
+                               sipc_util_marshal_object_add_data(out_obj, "result", &result, SIPC_MARSHAL_DATA_BOOLEAN_TYPE);
+                               sipc_util_marshal_object_add_data(out_obj, "err_cause", &err_cause, SIPC_MARSHAL_DATA_BOOLEAN_INT);
+                               .......
+                       */
+
+                       //TAPI_EVENT_CLASS_CALL_VOICE,
+                       //TAPI_EVENT_CALL_END_IND,
+               }
+                       break;
+
+               case TNOTI_CALL_STATUS_DIALING:
+                       break;
+
+               case TNOTI_CALL_STATUS_ALERT:
+
+                       /*{create output data and create serialized data}
+                               hdr->cmd = ;
+                               out_obj = sipc_util_marshal_object_create();
+                               sipc_util_marshal_object_add_data(out_obj, "result", &result, SIPC_MARSHAL_DATA_BOOLEAN_TYPE);
+                               sipc_util_marshal_object_add_data(out_obj, "err_cause", &err_cause, SIPC_MARSHAL_DATA_BOOLEAN_INT);
+                               .......
+                       */
+
+                       //TAPI_EVENT_CLASS_CALL_VOICE,
+                       //TAPI_EVENT_CALL_ALERT_IND,
+                       break;
+
+               case TNOTI_CALL_STATUS_ACTIVE:
+
+                       /*{create output data and create serialized data}
+                               hdr->cmd = ;
+                               out_obj = sipc_util_marshal_object_create();
+                               sipc_util_marshal_object_add_data(out_obj, "result", &result, SIPC_MARSHAL_DATA_BOOLEAN_TYPE);
+                               sipc_util_marshal_object_add_data(out_obj, "err_cause", &err_cause, SIPC_MARSHAL_DATA_BOOLEAN_INT);
+                               .......
+                       */
+
+                       //TAPI_EVENT_CLASS_CALL_VOICE,
+                       //TAPI_EVENT_CALL_CONNECTED_IND,
+                       break;
+
+               case TNOTI_CALL_STATUS_HELD:
+
+                       /*{create output data and create serialized data}
+                               hdr->cmd = ;
+                               out_obj = sipc_util_marshal_object_create();
+                               sipc_util_marshal_object_add_data(out_obj, "result", &result, SIPC_MARSHAL_DATA_BOOLEAN_TYPE);
+                               sipc_util_marshal_object_add_data(out_obj, "err_cause", &err_cause, SIPC_MARSHAL_DATA_BOOLEAN_INT);
+                               .......
+                       */
+
+                       //TAPI_EVENT_CLASS_CALL_VOICE,
+                       //TAPI_EVENT_CALL_HOLD_IND,
+                       break;
+
+               case TNOTI_CALL_STATUS_INCOMING: {
+                       struct tnoti_call_status_incoming *incoming = 0;
+                       char id[2] = {0, };
+                       char cli[2] = {0, };
+                       char forward[2] = {0, };
+                       char active_line[2] = {0, };
+                       char cna[2] = {0, };
+                       char number[83] = {0, };
+                       char name[83] = {0, };
+                       int ret = 0;
+
+                       bundle *kb  = 0;
+
+                       incoming = (struct tnoti_call_status_incoming*)data;
+
+                       snprintf( id, 2, "%d", incoming->id );
+                       dbg("id : [%s]", id );
+                       snprintf( cli, 2, "%d", incoming->cli.mode );
+                       dbg("cli : [%s]", id );
+                       snprintf( number, 83, "%s", incoming->cli.number );
+                       dbg("number : [%s]", number );
+                       snprintf( forward, 2, "%d", incoming->forward );
+                       dbg("forward : [%s]", forward );
+                       snprintf( active_line, 2, "%d", incoming->active_line );
+                       dbg("active_line : [%s]", active_line );
+                       snprintf( cna, 2, "%d", incoming->cna.mode );
+                       dbg("cna : [%s]", cna );
+                       snprintf( name, 83, "%s", incoming->cna.name );
+                       dbg("name : [%s]", name );
+
+                       kb = bundle_create();
+                       bundle_add(kb, "launch-type", "MT");
+                       bundle_add(kb, "handle", id);
+                       bundle_add(kb, "number", number);
+                       bundle_add(kb, "name_mode", cna);
+                       bundle_add(kb, "name", name);
+                       bundle_add(kb, "clicause", cli);
+                       bundle_add(kb, "fwded", forward);
+                       bundle_add(kb, "activeline", active_line);
+
+                       ret = aul_launch_app("com.samsung.call", kb);
+                       bundle_free(kb);
+
+                       dbg("aul_launch_app [ voice call ] : %d", ret);
+                       return TRUE;
+               }
+                       break;
+
+               case TNOTI_CALL_STATUS_WAITING:
+               default:
+                       break;
+       }
+
+       if(out_obj){
+               serial_d = sipc_util_marshal_object_serializer(out_obj);
+               hdr.data_len = strlen(serial_d);
+               sipc_util_marshal_object_destory(out_obj);
+       }
+
+       out_d = g_new0(char, sizeof(struct _tapi_header)+hdr.data_len);
+       memcpy(out_d, &hdr, sizeof(struct _tapi_header));
+       if(serial_d){
+               memcpy(out_d+sizeof(struct _tapi_header), serial_d, hdr.data_len);
+               g_free(serial_d);
+       }
+
+       ret = sipc_server_broadcast(s, out_d, sizeof(struct _tapi_header)+hdr.data_len);
+       g_free(out_d);
+
+       if(ret < 0){
+               return FALSE;
+       }
+
+       return TRUE;
+}
diff --git a/plugin/src/socket_custom.c b/plugin/src/socket_custom.c
new file mode 100644 (file)
index 0000000..b7d40b2
--- /dev/null
@@ -0,0 +1,113 @@
+/*
+ * tel-plugin-socket-communicator
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Ja-young Gu <jygu@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <glib-object.h>
+
+#include <tcore.h>
+#include <server.h>
+#include <plugin.h>
+#include <hal.h>
+#include <communicator.h>
+#include <core_object.h>
+#include <queue.h>
+#include <user_request.h>
+#include <util.h>
+#include <co_ps.h>
+
+#include "sipc.h"
+#include "tapi_common.h"
+#include "module_req.h"
+
+gboolean scomm_service_request_custom(unsigned int ch_id, Communicator *c, TcorePlugin *plugin,
+               tapi_service_command_e cmd, gchar *data, void **outparam)
+{
+       int ret = 0;
+       UserRequest *ur = NULL;
+       struct tcore_user_info ui = { 0, 0, 0, NULL,0,0, NULL };
+
+       ur = tcore_user_request_new(c, tcore_plugin_get_description(plugin)->name);
+       if (!ur) {
+               return FALSE;
+       }
+
+       ui.channel_id = ch_id;
+       tcore_user_request_set_user_info(ur, &ui);
+
+       tcore_user_request_set_command(ur, TREQ_CUSTOM);
+       tcore_user_request_set_data(ur, strlen(data), data);
+
+       ret = tcore_communicator_dispatch_request(c, ur);
+       if (ret != TCORE_RETURN_SUCCESS) {
+               return FALSE;
+       }
+
+       return TRUE;
+}
+
+gboolean scomm_service_response_custom(Communicator *comm, UserRequest *ur, enum tcore_response_command command,
+               unsigned int data_len, const void *data)
+{
+       int ret = 0;
+       struct custom_data *ctx = NULL;
+       const struct tcore_user_info *ui;
+
+       ctx = tcore_communicator_ref_user_data(comm);
+       if (!ctx) {
+               dbg("user_data is NULL");
+               return FALSE;
+       }
+
+       ui = tcore_user_request_ref_user_info(ur);
+
+       dbg("application channel id(%d), Command = [0x%x], data_len = %d", ui->channel_id, command, data_len);
+
+       ret = sipc_server_send(ctx->sk_server, ui->channel_id, data, data_len, SIPC_SEND_DATA_ASYNC);
+       if(ret < 0){
+               return FALSE;
+       }
+
+       return TRUE;
+}
+
+gboolean scomm_service_notification_custom(Communicator *comm, CoreObject *source, enum tcore_notification_command command,
+               unsigned int data_len, const void *data)
+{
+       int ret = 0;
+       struct custom_data *ctx = NULL;
+
+       ctx = tcore_communicator_ref_user_data(comm);
+       if (!ctx) {
+               dbg("user_data is NULL");
+               return FALSE;
+       }
+
+       dbg("notification !!! (command = 0x%x, data_len = %d)", command, data_len);
+
+       ret = sipc_server_broadcast(ctx->sk_server, data, data_len);
+       if (ret < 0) {
+               return FALSE;
+       }
+
+       return TRUE;
+}
diff --git a/plugin/src/socket_network.c b/plugin/src/socket_network.c
new file mode 100644 (file)
index 0000000..46c0648
--- /dev/null
@@ -0,0 +1,676 @@
+/*
+ * tel-plugin-socket-communicator
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Ja-young Gu <jygu@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <glib-object.h>
+
+#include <tcore.h>
+#include <server.h>
+#include <plugin.h>
+#include <hal.h>
+#include <communicator.h>
+#include <core_object.h>
+#include <queue.h>
+#include <user_request.h>
+#include <util.h>
+#include <co_network.h>
+
+#include "sipc.h"
+#include "tapi_common.h"
+#include "module_req.h"
+
+static void _request_fail(UserRequest *ur, int cmd, int resp_len, void *resp)
+{
+       tcore_user_request_send_response(ur, cmd, resp_len, resp);
+       tcore_user_request_free(ur);
+}
+
+gboolean scomm_service_request_network(unsigned int ch_id, Communicator *c, TcorePlugin *plugin,
+               tapi_service_command_e cmd, gchar *data, void **outparam)
+{
+       int ret = 0;
+       struct _sipc_marshal_object *out_obj;
+       struct _sipc_marshal_object *in_obj;
+       gboolean result = TRUE;
+       UserRequest *ur = NULL;
+       struct tcore_user_info ui = { 0, 0, 0, NULL, 0, 0, NULL };
+
+       in_obj = sipc_util_marshal_object_deserializer(data);
+       if (!in_obj) {
+               dbg("in_obj is NULL");
+               result = FALSE;
+               goto RETURN;
+       }
+
+       ur = tcore_user_request_new(c, tcore_plugin_get_description(plugin)->name);
+       if (!ur) {
+               dbg("ur is NULL");
+               result = FALSE;
+               goto RETURN;
+       }
+
+       ui.channel_id = ch_id;
+       ui.client_cmd = cmd;
+       tcore_user_request_set_user_info(ur, &ui);
+
+       switch (cmd) {
+               case TAPI_SERVICE_NETWORK_SEARCH:
+                       tcore_user_request_set_data(ur, 0, NULL);
+                       tcore_user_request_set_command(ur, TREQ_NETWORK_SEARCH);
+                       break;
+
+               case TAPI_SERVICE_NETWORK_SET_PLMN_SELECTION_MODE: {
+                       struct treq_network_set_plmn_selection_mode data_plmn_select;
+                       struct tresp_network_set_plmn_selection_mode resp;
+                       gchar *mode = NULL;
+                       gchar *plmn = NULL;
+
+                       mode = sipc_util_marshal_object_get_string(in_obj, "mode");
+                       if (!mode) {
+                               resp.result = TCORE_RETURN_EINVAL;
+                               _request_fail(ur, TRESP_NETWORK_SET_PLMN_SELECTION_MODE, sizeof(struct tresp_network_set_plmn_selection_mode), &resp);
+                               result = FALSE;
+                               break;
+                       }
+
+                       plmn = sipc_util_marshal_object_get_string(in_obj, "plmn");
+
+                       memset(&data_plmn_select, 0, sizeof(struct treq_network_set_plmn_selection_mode));
+                       if (!g_strcmp0(mode, "automatic")) {
+                               data_plmn_select.mode = NETWORK_SELECT_MODE_GSM_AUTOMATIC;
+                       }
+                       else if (!g_strcmp0(mode, "manual")) {
+                               data_plmn_select.mode = NETWORK_SELECT_MODE_GSM_MANUAL;
+                               snprintf(data_plmn_select.plmn, 6, "%s", plmn);
+                               if (strlen(data_plmn_select.plmn) <= 5)
+                                       data_plmn_select.plmn[5] = '#';
+                       }
+                       else {
+                               /* fail */
+                               g_free(mode);
+                               g_free(plmn);
+
+                               resp.result = TCORE_RETURN_EINVAL;
+                               _request_fail(ur, TRESP_NETWORK_SET_PLMN_SELECTION_MODE, sizeof(struct tresp_network_set_plmn_selection_mode), &resp);
+                               result = FALSE;
+                               break;
+                       }
+
+                       g_free(mode);
+                       g_free(plmn);
+
+                       tcore_user_request_set_data(ur, sizeof(struct treq_network_set_plmn_selection_mode), &data_plmn_select);
+                       tcore_user_request_set_command(ur, TREQ_NETWORK_SET_PLMN_SELECTION_MODE);
+               }
+                       break;
+
+               case TAPI_SERVICE_NETWORK_GET_PLMN_SELECTION_MODE:
+                       tcore_user_request_set_data(ur, 0, NULL);
+                       tcore_user_request_set_command(ur, TREQ_NETWORK_GET_PLMN_SELECTION_MODE);
+                       break;
+
+               case TAPI_SERVICE_NETWORK_SET_SERVICE_DOMAIN: {
+                       struct treq_network_set_service_domain data_service_domain;
+                       struct tresp_network_set_service_domain resp;
+                       gchar *domain = NULL;
+
+                       domain = sipc_util_marshal_object_get_string(in_obj, "domain");
+                       if (!domain) {
+                               resp.result = TCORE_RETURN_EINVAL;
+                               _request_fail(ur, TRESP_NETWORK_SET_SERVICE_DOMAIN, sizeof(struct tresp_network_set_service_domain), &resp);
+                               result = FALSE;
+                               break;
+                       }
+
+                       if (!g_strcmp0(domain, "circuit")) {
+                               data_service_domain.domain = NETWORK_SERVICE_DOMAIN_CS;
+                       }
+                       else if (!g_strcmp0(domain, "packet")) {
+                               data_service_domain.domain = NETWORK_SERVICE_DOMAIN_PS;
+                       }
+                       else if (!g_strcmp0(domain, "combined")) {
+                               data_service_domain.domain = NETWORK_SERVICE_DOMAIN_COMBINED;
+                       }
+                       else {
+                               /* fail */
+                               g_free(domain);
+                               result = FALSE;
+                               resp.result = TCORE_RETURN_EINVAL;
+                               _request_fail(ur, TRESP_NETWORK_SET_SERVICE_DOMAIN, sizeof(struct tresp_network_set_service_domain), &resp);
+                               break;
+                       }
+
+                       g_free(domain);
+
+                       tcore_user_request_set_data(ur, sizeof(struct treq_network_set_service_domain), &data_service_domain);
+                       tcore_user_request_set_command(ur, TREQ_NETWORK_SET_SERVICE_DOMAIN);
+               }
+                       break;
+
+               case TAPI_SERVICE_NETWORK_GET_SERVICE_DOMAIN:
+                       tcore_user_request_set_data(ur, 0, NULL);
+                       tcore_user_request_set_command(ur, TREQ_NETWORK_GET_SERVICE_DOMAIN);
+                       break;
+
+               case TAPI_SERVICE_NETWORK_SET_BAND :{
+                       struct treq_network_set_band data_band;
+                       struct tresp_network_set_band resp;
+                       gchar *mode = NULL;
+                       gint band;
+
+                       mode = sipc_util_marshal_object_get_string(in_obj, "mode");
+                       if (!mode) {
+                               result = FALSE;
+                               resp.result = TCORE_RETURN_EINVAL;
+                               _request_fail(ur, TRESP_NETWORK_SET_BAND, sizeof(struct tresp_network_set_band), &resp);
+                               break;
+                       }
+
+                       band = sipc_util_marshal_object_get_int(in_obj, "band");
+
+                       if (!g_strcmp0(mode, "only")) {
+                               data_band.mode = NETWORK_BAND_MODE_ONLY;
+                       }
+                       else if (!g_strcmp0(mode, "preferred")) {
+                               data_band.mode = NETWORK_BAND_MODE_PREFERRED;
+                       }
+                       else {
+                               /* fail */
+                               g_free(mode);
+                               result = FALSE;
+                               resp.result = TCORE_RETURN_EINVAL;
+                               _request_fail(ur, TRESP_NETWORK_SET_BAND, sizeof(struct tresp_network_set_band), &resp);
+                               break;
+                       }
+
+                       data_band.band = band;
+
+                       g_free(mode);
+
+                       tcore_user_request_set_data(ur, sizeof(struct treq_network_set_band), &data_band);
+                       tcore_user_request_set_command(ur, TREQ_NETWORK_SET_BAND);
+               }
+                       break;
+
+               case TAPI_SERVICE_NETWORK_GET_BAND:
+                       tcore_user_request_set_data(ur, 0, NULL);
+                       tcore_user_request_set_command(ur, TREQ_NETWORK_GET_BAND);
+                       break;
+
+               case TAPI_SERVICE_NETWORK_SET_PREFERRED_PLMN :{
+                       struct treq_network_set_preferred_plmn data_preferred_plmn;
+                       struct tresp_network_set_preferred_plmn resp;
+                       gchar *mode = NULL;
+                       gchar *plmn = NULL;
+                       gint act;
+                       gint ef_index;
+
+                       mode = sipc_util_marshal_object_get_string(in_obj, "mode");
+                       if (!mode) {
+                               result = FALSE;
+                               resp.result = TCORE_RETURN_EINVAL;
+                               _request_fail(ur, TRESP_NETWORK_SET_PREFERRED_PLMN, sizeof(struct tresp_network_set_preferred_plmn), &resp);
+                               break;
+                       }
+
+                       plmn = sipc_util_marshal_object_get_string(in_obj, "plmn");
+                       if (!plmn) {
+                               g_free(mode);
+                               result = FALSE;
+                               resp.result = TCORE_RETURN_EINVAL;
+                               _request_fail(ur, TRESP_NETWORK_SET_PREFERRED_PLMN, sizeof(struct tresp_network_set_preferred_plmn), &resp);
+                               break;
+                       }
+
+                       act = sipc_util_marshal_object_get_int(in_obj, "act");
+                       ef_index = sipc_util_marshal_object_get_int(in_obj, "ef_index");
+
+                       if (!g_strcmp0(mode, "add")) {
+                               data_preferred_plmn.operation = NETWORK_PREF_PLMN_ADD;
+
+                       }
+                       else if (!g_strcmp0(mode, "edit")) {
+                               data_preferred_plmn.operation = NETWORK_PREF_PLMN_EDIT;
+
+                       }
+                       else if (!g_strcmp0(mode, "delete")) {
+                               data_preferred_plmn.operation = NETWORK_PREF_PLMN_DELETE;
+                       }
+                       else {
+                               /* fail */
+                               g_free(mode);
+                               g_free(plmn);
+                               result = FALSE;
+                               resp.result = TCORE_RETURN_EINVAL;
+                               _request_fail(ur, TRESP_NETWORK_SET_PREFERRED_PLMN, sizeof(struct tresp_network_set_preferred_plmn), &resp);
+                               break;
+                       }
+
+                       snprintf(data_preferred_plmn.plmn, 6, "%s", plmn);
+                       if (strlen(data_preferred_plmn.plmn) <= 5)
+                               data_preferred_plmn.plmn[5] = '#';
+
+                       data_preferred_plmn.act = act;
+                       data_preferred_plmn.ef_index = ef_index;
+
+                       g_free(mode);
+                       g_free(plmn);
+
+                       tcore_user_request_set_data(ur, sizeof(struct treq_network_set_preferred_plmn), &data_preferred_plmn);
+                       tcore_user_request_set_command(ur, TREQ_NETWORK_SET_PREFERRED_PLMN);
+               }
+                       break;
+
+               case TAPI_SERVICE_NETWORK_GET_PREFERRED_PLMN:
+                       tcore_user_request_set_data(ur, 0, NULL);
+                       tcore_user_request_set_command(ur, TREQ_NETWORK_GET_PREFERRED_PLMN);
+                       break;
+
+               case TAPI_SERVICE_NETWORK_SET_ORDER :{
+                       struct treq_network_set_order data_order;
+                       struct tresp_network_set_order resp;
+                       gchar *order = NULL;
+
+                       order = sipc_util_marshal_object_get_string(in_obj, "order");
+                       if (!order) {
+                               result = FALSE;
+                               resp.result = TCORE_RETURN_EINVAL;
+                               _request_fail(ur, TRESP_NETWORK_SET_ORDER, sizeof(struct tresp_network_set_order), &resp);
+                               break;
+                       }
+
+                       if (!g_strcmp0(order, "auto")) {
+                               data_order.order = NETWORK_ORDER_AUTO;
+                       }
+                       else if (!g_strcmp0(order, "gsm")) {
+                               data_order.order = NETWORK_ORDER_GSM_FIRST;
+                       }
+                       else if (!g_strcmp0(order, "wcdma")) {
+                               data_order.order = NETWORK_ORDER_WCDMA_FIRST;
+                       }
+                       else if (!g_strcmp0(order, "no_change")) {
+                               data_order.order = NETWORK_ORDER_NO_CHANGE;
+                       }
+                       else {
+                               g_free(order);
+                               result = FALSE;
+                               resp.result = TCORE_RETURN_EINVAL;
+                               _request_fail(ur, TRESP_NETWORK_SET_ORDER, sizeof(struct tresp_network_set_order), &resp);
+                               break;
+                       }
+
+                       g_free(order);
+
+                       tcore_user_request_set_data(ur, sizeof(struct treq_network_set_order), &data_order);
+                       tcore_user_request_set_command(ur, TREQ_NETWORK_SET_ORDER);
+               }
+                       break;
+
+               case TAPI_SERVICE_NETWORK_GET_ORDER:
+                       tcore_user_request_set_data(ur, 0, NULL);
+                       tcore_user_request_set_command(ur, TREQ_NETWORK_GET_ORDER);
+                       break;
+
+               case TAPI_SERVICE_NETWORK_SET_POWER_ON_ATTACH :{
+                       struct treq_network_set_power_on_attach data_power_on_attach;
+                       gboolean enable;
+
+                       enable = sipc_util_marshal_object_get_boolean(in_obj, "enable");
+
+                       data_power_on_attach.enable = enable;
+
+                       tcore_user_request_set_data(ur, sizeof(struct treq_network_set_power_on_attach), &data_power_on_attach);
+                       tcore_user_request_set_command(ur, TREQ_NETWORK_SET_POWER_ON_ATTACH);
+               }
+                       break;
+
+               case TAPI_SERVICE_NETWORK_GET_POWER_ON_ATTACH:
+                       tcore_user_request_set_data(ur, 0, NULL);
+                       tcore_user_request_set_command(ur, TREQ_NETWORK_GET_POWER_ON_ATTACH);
+                       break;
+
+               case TAPI_SERVICE_NETWORK_SET_CANCEL_MANUAL_SEARCH:
+                       tcore_user_request_set_data(ur, 0, NULL);
+                       tcore_user_request_set_command(ur, TREQ_NETWORK_SET_CANCEL_MANUAL_SEARCH);
+                       break;
+
+               case TAPI_SERVICE_NETWORK_GET_SERVING_NETWORK:
+                       tcore_user_request_set_data(ur, 0, NULL);
+                       tcore_user_request_set_command(ur, TREQ_NETWORK_GET_SERVING_NETWORK);
+                       break;
+       }
+
+RETURN:
+       sipc_util_marshal_object_destory(in_obj);
+       out_obj = sipc_util_marshal_object_create();
+       sipc_util_marshal_object_add_data(out_obj, "result", &result, SIPC_MARSHAL_DATA_BOOLEAN_TYPE);
+
+       dbg("result = %d", result);
+
+       *outparam = sipc_util_marshal_object_serializer(out_obj);
+       sipc_util_marshal_object_destory(out_obj);
+
+       if (result == FALSE) {
+               tcore_user_request_free(ur);
+               return FALSE;
+       }
+
+       ret = tcore_communicator_dispatch_request(c, ur);
+       if (ret != TCORE_RETURN_SUCCESS) {
+               return FALSE;
+       }
+
+       return TRUE;
+}
+
+gboolean scomm_service_response_network(Communicator *comm, UserRequest *ur, enum tcore_response_command command,
+               unsigned int data_len, const void *data)
+{
+       const struct tresp_network_search *resp_network_search = data;
+       const struct tresp_network_set_plmn_selection_mode *resp_set_plmn_selection_mode = data;
+       const struct tresp_network_get_plmn_selection_mode *resp_get_plmn_selection_mode = data;
+       const struct tresp_network_set_service_domain *resp_set_service_domain = data;
+       const struct tresp_network_get_service_domain *resp_get_service_domain = data;
+       const struct tresp_network_set_band *resp_set_band = data;
+       const struct tresp_network_get_band *resp_get_band = data;
+       const struct tresp_network_set_preferred_plmn *resp_set_preferred_plmn = data;
+       const struct tresp_network_get_preferred_plmn *resp_get_preferred_plmn = data;
+       const struct tresp_network_set_order *resp_set_order = data;
+       const struct tresp_network_get_order *resp_get_order = data;
+       const struct tresp_network_set_power_on_attach *resp_set_power_on_attach = data;
+       const struct tresp_network_get_power_on_attach *resp_get_power_on_attach = data;
+       const struct tresp_network_set_cancel_manual_search *resp_set_cancel_manual_search = data;
+
+       int ret = 0;
+       int i = 0;
+       gchar *out_d = NULL;
+       gchar *serial_d = NULL;
+       gchar entry_key[10] = { 0, };
+       struct custom_data *ctx = NULL;
+       const struct tcore_user_info *ui;
+       struct _tapi_header hdr;
+       struct _sipc_marshal_object* out_obj = NULL;
+       struct _sipc_marshal_object* entry_obj = NULL;
+       struct _sipc_marshal_object* in_obj = NULL;
+
+       ctx = tcore_communicator_ref_user_data(comm);
+       if (!ctx) {
+               dbg("ctx is NULL");
+               return FALSE;
+       }
+
+       ui = tcore_user_request_ref_user_info(ur);
+
+       dbg("response command = [0x%x], data_len = %d", command, data_len);
+       dbg("channel_id = %d, client_cmd = %d", ui->channel_id, ui->client_cmd);
+
+       memset(&hdr, 0, sizeof(struct _tapi_header));
+       hdr.cmd = (tapi_service_command_e) ui->client_cmd;
+
+       out_obj = sipc_util_marshal_object_create();
+
+       switch (command) {
+               case TRESP_NETWORK_SEARCH:
+                       sipc_util_marshal_object_add_data(out_obj, "count", &resp_network_search->list_count,
+                                       SIPC_MARSHAL_DATA_INT_TYPE);
+
+                       dbg("count = %d", resp_network_search->list_count);
+                       entry_obj = sipc_util_marshal_object_create();
+                       for (i = 0; i < resp_network_search->list_count; i++) {
+                               sipc_util_marshal_object_add_data(entry_obj, "plmn", resp_network_search->list[0].plmn,
+                                               SIPC_MARSHAL_DATA_STRING_TYPE);
+                               sipc_util_marshal_object_add_data(entry_obj, "status", &resp_network_search->list[0].status,
+                                               SIPC_MARSHAL_DATA_INT_TYPE);
+                               sipc_util_marshal_object_add_data(entry_obj, "act", &resp_network_search->list[0].act,
+                                               SIPC_MARSHAL_DATA_INT_TYPE);
+
+                               snprintf(entry_key, 10, "%d", i);
+                               sipc_util_marshal_object_add_data(out_obj, entry_key, entry_obj, SIPC_MARSHAL_DATA_OBJECT_TYPE);
+
+                               dbg(
+                                               "key=%s, plmn=%s, status=%d, act=%d",
+                                               entry_key, resp_network_search->list[0].plmn, resp_network_search->list[0].status, resp_network_search->list[0].act);
+                       }
+                       break;
+
+               case TRESP_NETWORK_SET_PLMN_SELECTION_MODE:
+                       sipc_util_marshal_object_add_data(out_obj, "result", &resp_set_plmn_selection_mode->result,
+                                       SIPC_MARSHAL_DATA_INT_TYPE);
+                       break;
+
+               case TRESP_NETWORK_GET_PLMN_SELECTION_MODE:
+                       sipc_util_marshal_object_add_data(out_obj, "mode", &resp_get_plmn_selection_mode->mode,
+                                       SIPC_MARSHAL_DATA_INT_TYPE);
+                       break;
+
+               case TRESP_NETWORK_SET_SERVICE_DOMAIN:
+                       sipc_util_marshal_object_add_data(out_obj, "result", &resp_set_service_domain->result,
+                                       SIPC_MARSHAL_DATA_INT_TYPE);
+                       break;
+
+               case TRESP_NETWORK_GET_SERVICE_DOMAIN:
+                       sipc_util_marshal_object_add_data(out_obj, "domain", &resp_get_service_domain->domain,
+                                       SIPC_MARSHAL_DATA_INT_TYPE);
+                       break;
+
+               case TRESP_NETWORK_SET_BAND:
+                       sipc_util_marshal_object_add_data(out_obj, "result", &resp_set_band->result, SIPC_MARSHAL_DATA_INT_TYPE);
+                       break;
+
+               case TRESP_NETWORK_GET_BAND:
+                       sipc_util_marshal_object_add_data(out_obj, "band", &resp_get_band->band, SIPC_MARSHAL_DATA_INT_TYPE);
+                       break;
+
+               case TRESP_NETWORK_SET_PREFERRED_PLMN:
+                       sipc_util_marshal_object_add_data(out_obj, "result", &resp_set_preferred_plmn->result,
+                                       SIPC_MARSHAL_DATA_INT_TYPE);
+                       break;
+
+               case TRESP_NETWORK_GET_PREFERRED_PLMN:
+                       sipc_util_marshal_object_add_data(out_obj, "count", &resp_get_preferred_plmn->list_count,
+                                       SIPC_MARSHAL_DATA_INT_TYPE);
+
+                       entry_obj = sipc_util_marshal_object_create();
+                       for (i = 0; i < resp_network_search->list_count; i++) {
+                               sipc_util_marshal_object_add_data(entry_obj, "plmn", resp_get_preferred_plmn->list[0].plmn,
+                                               SIPC_MARSHAL_DATA_STRING_TYPE);
+                               sipc_util_marshal_object_add_data(entry_obj, "ef_index", &resp_get_preferred_plmn->list[0].ef_index,
+                                               SIPC_MARSHAL_DATA_INT_TYPE);
+                               sipc_util_marshal_object_add_data(entry_obj, "act", &resp_get_preferred_plmn->list[0].act,
+                                               SIPC_MARSHAL_DATA_INT_TYPE);
+                               snprintf(entry_key, 10, "%d", i);
+                               sipc_util_marshal_object_add_data(out_obj, entry_key, entry_obj, SIPC_MARSHAL_DATA_OBJECT_TYPE);
+                       }
+                       break;
+
+               case TRESP_NETWORK_SET_ORDER:
+                       sipc_util_marshal_object_add_data(out_obj, "result", &resp_set_order->result, SIPC_MARSHAL_DATA_INT_TYPE);
+                       break;
+
+               case TRESP_NETWORK_GET_ORDER:
+                       sipc_util_marshal_object_add_data(out_obj, "result", &resp_get_order->order, SIPC_MARSHAL_DATA_INT_TYPE);
+                       break;
+
+               case TRESP_NETWORK_SET_POWER_ON_ATTACH:
+                       sipc_util_marshal_object_add_data(out_obj, "result", &resp_set_power_on_attach->result,
+                                       SIPC_MARSHAL_DATA_INT_TYPE);
+                       break;
+
+               case TRESP_NETWORK_GET_POWER_ON_ATTACH:
+                       sipc_util_marshal_object_add_data(out_obj, "enabled", &resp_get_power_on_attach->enabled,
+                                       SIPC_MARSHAL_DATA_INT_TYPE);
+                       break;
+
+               case TRESP_NETWORK_SET_CANCEL_MANUAL_SEARCH:
+                       sipc_util_marshal_object_add_data(out_obj, "result", &resp_set_cancel_manual_search->result,
+                                       SIPC_MARSHAL_DATA_INT_TYPE);
+                       break;
+
+               case TRESP_NETWORK_GET_SERVING_NETWORK:
+                       //
+                       break;
+       }
+
+       if (out_obj) {
+               serial_d = sipc_util_marshal_object_serializer(out_obj);
+               hdr.data_len = strlen(serial_d);
+               dbg("data_len = %d", hdr.data_len);
+               sipc_util_marshal_object_destory(out_obj);
+       }
+
+       if (entry_obj) {
+               sipc_util_marshal_object_destory(out_obj);
+       }
+
+       out_d = g_new0(char, sizeof(struct _tapi_header) + hdr.data_len);
+       memcpy(out_d, &hdr, sizeof(struct _tapi_header));
+
+       if (serial_d) {
+               memcpy(out_d + sizeof(struct _tapi_header), serial_d, hdr.data_len);
+               dbg("serial_d = [%s]", serial_d);
+               g_free(serial_d);
+       }
+
+       ret = sipc_server_send(ctx->sk_server, ui->channel_id, out_d, sizeof(struct _tapi_header) + hdr.data_len,
+                       SIPC_SEND_DATA_ASYNC);
+       g_free(out_d);
+
+       if (ret < 0) {
+               dbg("ret = %d", ret);
+               return FALSE;
+       }
+
+       return TRUE;
+}
+
+gboolean scomm_service_notification_network(Communicator *comm, CoreObject *source, enum tcore_notification_command command,
+               unsigned int data_len, const void *data)
+{
+       const struct tnoti_network_registration_status *noti_registration_status = data;
+       const struct tnoti_network_location_cellinfo *noti_location_cellinfo = data;
+       const struct tnoti_network_icon_info *noti_icon_info = data;
+       const struct tnoti_network_change *noti_change = data;
+       const struct tnoti_network_timeinfo *noti_timeinfo = data;
+
+       int ret = 0;
+       struct custom_data *ctx = NULL;
+       struct _tapi_header hdr;
+       struct _sipc_marshal_object* out_obj = NULL;
+       gchar *out_d = NULL, *serial_d = NULL;
+
+       ctx = tcore_communicator_ref_user_data(comm);
+       if (!ctx) {
+               dbg("user_data is NULL");
+               return FALSE;
+       }
+
+       dbg("notification !!! (command = 0x%x, data_len = %d)", command, data_len);
+
+       switch (command) {
+               case TNOTI_NETWORK_REGISTRATION_STATUS:
+                       hdr.cmd = TAPI_NOTI_NETWORK_REGISTRATION_STATUS;
+
+                       out_obj = sipc_util_marshal_object_create();
+                       sipc_util_marshal_object_add_data(out_obj, "cs_domain_status", &noti_registration_status->cs_domain_status, SIPC_MARSHAL_DATA_INT_TYPE);
+                       sipc_util_marshal_object_add_data(out_obj, "ps_domain_status", &noti_registration_status->ps_domain_status, SIPC_MARSHAL_DATA_INT_TYPE);
+                       sipc_util_marshal_object_add_data(out_obj, "service_type", &noti_registration_status->service_type, SIPC_MARSHAL_DATA_INT_TYPE);
+                       sipc_util_marshal_object_add_data(out_obj, "roaming_status", &noti_registration_status->roaming_status, SIPC_MARSHAL_DATA_INT_TYPE);
+                       break;
+
+               case TNOTI_NETWORK_LOCATION_CELLINFO:
+                       hdr.cmd = TAPI_NOTI_NETWORK_LOCATION_CELLINFO;
+
+                       out_obj = sipc_util_marshal_object_create();
+                       sipc_util_marshal_object_add_data(out_obj, "lac", &noti_location_cellinfo->lac, SIPC_MARSHAL_DATA_INT_TYPE);
+                       sipc_util_marshal_object_add_data(out_obj, "cell_id", &noti_location_cellinfo->cell_id, SIPC_MARSHAL_DATA_INT_TYPE);
+                       break;
+
+               case TNOTI_NETWORK_ICON_INFO:
+                       hdr.cmd = TAPI_NOTI_NETWORK_ICON_INFO;
+
+                       out_obj = sipc_util_marshal_object_create();
+                       sipc_util_marshal_object_add_data(out_obj, "type", &noti_icon_info->type, SIPC_MARSHAL_DATA_INT_TYPE);
+                       sipc_util_marshal_object_add_data(out_obj, "rssi", &noti_icon_info->rssi, SIPC_MARSHAL_DATA_INT_TYPE);
+                       sipc_util_marshal_object_add_data(out_obj, "battery", &noti_icon_info->battery, SIPC_MARSHAL_DATA_INT_TYPE);
+                       sipc_util_marshal_object_add_data(out_obj, "hdr_rssi", &noti_icon_info->hdr_rssi, SIPC_MARSHAL_DATA_INT_TYPE);
+                       break;
+
+               case TNOTI_NETWORK_CHANGE:
+                       hdr.cmd = TAPI_NOTI_NETWORK_CHANGE;
+
+                       out_obj = sipc_util_marshal_object_create();
+                       sipc_util_marshal_object_add_data(out_obj, "plmn", noti_change->plmn, SIPC_MARSHAL_DATA_STRING_TYPE);
+                       sipc_util_marshal_object_add_data(out_obj, "act", &noti_change->act, SIPC_MARSHAL_DATA_INT_TYPE);
+                       sipc_util_marshal_object_add_data(out_obj, "lac", &noti_change->gsm.lac, SIPC_MARSHAL_DATA_INT_TYPE);
+                       sipc_util_marshal_object_add_data(out_obj, "carrier", &noti_change->cdma.carrier, SIPC_MARSHAL_DATA_INT_TYPE);
+                       sipc_util_marshal_object_add_data(out_obj, "sid", &noti_change->cdma.sid, SIPC_MARSHAL_DATA_INT_TYPE);
+                       sipc_util_marshal_object_add_data(out_obj, "nid", &noti_change->cdma.nid, SIPC_MARSHAL_DATA_INT_TYPE);
+                       sipc_util_marshal_object_add_data(out_obj, "bs_id", &noti_change->cdma.bs_id, SIPC_MARSHAL_DATA_INT_TYPE);
+                       sipc_util_marshal_object_add_data(out_obj, "bs_lat", &noti_change->cdma.bs_lat, SIPC_MARSHAL_DATA_INT_TYPE);
+                       sipc_util_marshal_object_add_data(out_obj, "bs_long", &noti_change->cdma.bs_long, SIPC_MARSHAL_DATA_INT_TYPE);
+                       sipc_util_marshal_object_add_data(out_obj, "reg_sonze", &noti_change->cdma.reg_sonze, SIPC_MARSHAL_DATA_INT_TYPE);
+                       sipc_util_marshal_object_add_data(out_obj, "pilot_pn", &noti_change->cdma.pilot_pn, SIPC_MARSHAL_DATA_INT_TYPE);
+                       break;
+
+               case TNOTI_NETWORK_TIMEINFO:
+                       hdr.cmd = TAPI_NOTI_NETWORK_TIMEINFO;
+
+                       out_obj = sipc_util_marshal_object_create();
+                       sipc_util_marshal_object_add_data(out_obj, "plmn", noti_timeinfo->plmn, SIPC_MARSHAL_DATA_STRING_TYPE);
+                       sipc_util_marshal_object_add_data(out_obj, "year", &noti_timeinfo->year, SIPC_MARSHAL_DATA_INT_TYPE);
+                       sipc_util_marshal_object_add_data(out_obj, "month", &noti_timeinfo->month, SIPC_MARSHAL_DATA_INT_TYPE);
+                       sipc_util_marshal_object_add_data(out_obj, "day", &noti_timeinfo->day, SIPC_MARSHAL_DATA_INT_TYPE);
+                       sipc_util_marshal_object_add_data(out_obj, "hour", &noti_timeinfo->hour, SIPC_MARSHAL_DATA_INT_TYPE);
+                       sipc_util_marshal_object_add_data(out_obj, "minute", &noti_timeinfo->minute, SIPC_MARSHAL_DATA_INT_TYPE);
+                       sipc_util_marshal_object_add_data(out_obj, "second", &noti_timeinfo->second, SIPC_MARSHAL_DATA_INT_TYPE);
+                       sipc_util_marshal_object_add_data(out_obj, "wday", &noti_timeinfo->wday, SIPC_MARSHAL_DATA_INT_TYPE);
+                       sipc_util_marshal_object_add_data(out_obj, "gmtoff", &noti_timeinfo->gmtoff, SIPC_MARSHAL_DATA_INT_TYPE);
+                       sipc_util_marshal_object_add_data(out_obj, "dstoff", &noti_timeinfo->dstoff, SIPC_MARSHAL_DATA_INT_TYPE);
+                       sipc_util_marshal_object_add_data(out_obj, "isdst", &noti_timeinfo->isdst, SIPC_MARSHAL_DATA_INT_TYPE);
+                       break;
+
+               default:
+                       break;
+       }
+
+       if (out_obj) {
+               serial_d = sipc_util_marshal_object_serializer(out_obj);
+               hdr.data_len = strlen(serial_d);
+               sipc_util_marshal_object_destory(out_obj);
+       }
+
+       out_d = g_new0(char, sizeof(struct _tapi_header)+hdr.data_len);
+       memcpy(out_d, &hdr, sizeof(struct _tapi_header));
+       if (serial_d) {
+               memcpy(out_d + sizeof(struct _tapi_header), serial_d, hdr.data_len);
+               g_free(serial_d);
+       }
+
+       dbg("len = %d, out_d = [%s]", sizeof(struct _tapi_header) + hdr.data_len, out_d);
+
+       ret = sipc_server_broadcast(ctx->sk_server, out_d, sizeof(struct _tapi_header) + hdr.data_len);
+       dbg("ret = %d", ret);
+       g_free(out_d);
+
+       return TRUE;
+}
diff --git a/plugin/src/socket_pb.c b/plugin/src/socket_pb.c
new file mode 100644 (file)
index 0000000..8231c53
--- /dev/null
@@ -0,0 +1,424 @@
+/*
+ * tel-plugin-socket-communicator
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Ja-young Gu <jygu@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <glib-object.h>
+
+#include <tcore.h>
+#include <server.h>
+#include <plugin.h>
+#include <hal.h>
+#include <communicator.h>
+#include <core_object.h>
+#include <queue.h>
+#include <user_request.h>
+#include <util.h>
+#include <co_phonebook.h>
+#include <co_sim.h>
+
+#include "sipc.h"
+#include "tapi_common.h"
+#include "module_req.h"
+
+gboolean scomm_service_reqeust_pb(unsigned int ch_id, Communicator *c, TcorePlugin *plugin, tapi_service_command_e cmd, gchar *data, void **outparam)
+{
+       GSList *co_list = NULL;
+       CoreObject *co_pb = NULL;
+       UserRequest *ur = NULL;
+       struct tcore_user_info ui = { 0, 0, 0, NULL,0,0, NULL };
+       int ret = 0;
+
+       gchar *tmp = NULL;
+       int tmp_len = 0;
+       struct _tapi_service_object out_o = {0,};
+       struct _sipc_marshal_object *in_o;
+
+       co_list = tcore_plugin_get_core_objects_bytype(plugin, CORE_OBJECT_TYPE_PHONEBOOK);
+       if (!co_list) {
+               dbg("err-no phonebook core object list in current plugin");
+               return FALSE;
+       }
+
+       co_pb = (CoreObject *)co_list->data;
+       if (!co_pb) {
+               dbg("err-no phonebook core object in current plugin");
+               return FALSE;
+       }
+
+       g_slist_free(co_list);
+
+       if (cmd == TAPI_SERVICE_PB_GET_INITINFO ) {
+               /*synchronous data return case*/
+               out_o.cmd = cmd;
+               out_o.mo = sipc_util_marshal_object_create();
+       } else {
+               /*asynchronous data return case*/
+               ur = tcore_user_request_new(c, tcore_plugin_get_description(plugin)->name);
+               if (!ur) {
+                       dbg("err - ur creation failed");
+                       return FALSE;
+               }
+
+               ui.channel_id = ch_id;
+               ui.client_cmd = cmd;
+               tcore_user_request_set_user_info(ur, &ui);
+
+               in_o = sipc_util_marshal_object_deserializer(data);
+               if(in_o){
+                       dbg("err - data deserializer failed");
+                       return FALSE;
+               }
+       }
+
+       switch (cmd) {
+               case TAPI_SERVICE_PB_GET_INITINFO : {
+                       gboolean g_init;
+                       struct tel_phonebook_support_list *g_pb_list;
+                       g_init = tcore_phonebook_get_status(co_pb);
+                       g_pb_list = (struct tel_phonebook_support_list*)tcore_phonebook_get_support_list(co_pb);
+                       sipc_util_marshal_object_add_data(out_o.mo, "status", (void*)&g_init,   SIPC_MARSHAL_DATA_BOOLEAN_TYPE);
+                       sipc_util_marshal_object_add_data(out_o.mo, "support_fdn", (void*)&g_pb_list->b_fdn, SIPC_MARSHAL_DATA_BOOLEAN_TYPE);
+                       sipc_util_marshal_object_add_data(out_o.mo, "support_adn", (void*)&g_pb_list->b_adn, SIPC_MARSHAL_DATA_BOOLEAN_TYPE);
+                       sipc_util_marshal_object_add_data(out_o.mo, "support_sdn", (void*)&g_pb_list->b_sdn, SIPC_MARSHAL_DATA_BOOLEAN_TYPE);
+                       sipc_util_marshal_object_add_data(out_o.mo, "support_usim", (void*)&g_pb_list->b_usim, SIPC_MARSHAL_DATA_BOOLEAN_TYPE);
+                       sipc_util_marshal_object_add_data(out_o.mo, "support_grp", (void*)&g_pb_list->b_gas, SIPC_MARSHAL_DATA_BOOLEAN_TYPE);
+
+                       tmp = sipc_util_marshal_object_serializer(out_o.mo);
+                       tmp_len = strlen(tmp);
+                       *outparam = g_new0(char, tmp_len+1);
+                       memcpy(*outparam, tmp, tmp_len);
+                       g_free(tmp);
+               }
+                       break;
+
+               case TAPI_SERVICE_PB_GET_COUNT : {
+                       struct treq_phonebook_get_count pb_count;
+                       enum tel_phonebook_type g_pb_type;
+                       g_pb_type = sipc_util_marshal_object_get_int(in_o, "type");
+                       pb_count.phonebook_type = g_pb_type;
+
+                       tcore_user_request_set_data(ur, sizeof(struct treq_phonebook_get_count), &pb_count);
+                       tcore_user_request_set_command(ur, TREQ_PHONEBOOK_GETCOUNT);
+               }
+                       break;
+
+               case TAPI_SERVICE_PB_GET_META : {
+                       struct treq_phonebook_get_info pb_info;
+                       struct treq_phonebook_get_usim_info pb_usim;
+                       enum tel_phonebook_type g_pb_type;
+                       g_pb_type = sipc_util_marshal_object_get_int(in_o, "type");
+                       pb_info.phonebook_type = g_pb_type;
+
+                       tcore_user_request_set_data(ur, sizeof(struct treq_phonebook_get_info), &pb_info);
+                       tcore_user_request_set_command(ur, TREQ_PHONEBOOK_GETMETAINFO);
+               }
+                       break;
+
+               case TAPI_SERVICE_PB_READ_RECORD : {
+                       struct treq_phonebook_read_record pb_read;
+                       enum tel_phonebook_type g_pb_type;
+                       gint g_index = 0;
+                       g_index = sipc_util_marshal_object_get_int(in_o, "index");
+                       g_pb_type = sipc_util_marshal_object_get_int(in_o, "type");
+                       pb_read.index = (unsigned short)g_index;
+                       pb_read.phonebook_type = g_pb_type;
+
+                       tcore_user_request_set_data(ur, sizeof(struct treq_phonebook_read_record), &pb_read);
+                       tcore_user_request_set_command(ur, TREQ_PHONEBOOK_READRECORD);
+               }
+                       break;
+
+               case TAPI_SERVICE_PB_UPDATE_RECORD : {
+                       struct treq_phonebook_update_record pb_update;
+                       enum tel_phonebook_type g_pb_type;
+                       gint g_index = 0;
+                       gchar *g_name = NULL;
+                       gint g_dcs = 0;
+                       gchar *g_number = NULL;
+                       gint g_ton = 0;
+                       gchar *g_number2 = NULL;
+                       gint g_number2_ton = 0;
+                       gchar *g_number3 = NULL;
+                       gint g_number3_ton = 0;
+                       gchar *g_number4 = NULL;
+                       gint g_number4_ton = 0;
+                       gchar *g_email1 = NULL;
+                       gchar *g_email2 = NULL;
+                       gchar *g_email3 = NULL;
+                       gchar *g_email4 = NULL;
+                       gint g_group_index =0;
+                       g_index = sipc_util_marshal_object_get_int(in_o, "index");
+                       g_pb_type = sipc_util_marshal_object_get_int(in_o, "type");
+                       g_name = sipc_util_marshal_object_get_string(in_o, "name");
+                       g_dcs = sipc_util_marshal_object_get_int(in_o, "dcs");
+                       g_number = sipc_util_marshal_object_get_string(in_o, "number");
+                       g_ton = sipc_util_marshal_object_get_int(in_o, "ton");
+                       g_number2 = sipc_util_marshal_object_get_string(in_o, "number2");
+                       g_number2_ton = sipc_util_marshal_object_get_int(in_o, "number2_ton");
+                       g_number3 = sipc_util_marshal_object_get_string(in_o, "number3");
+                       g_number3_ton = sipc_util_marshal_object_get_int(in_o, "number3_ton");
+                       g_number4 = sipc_util_marshal_object_get_string(in_o, "number4");
+                       g_number4_ton = sipc_util_marshal_object_get_int(in_o, "number4_ton");
+                       g_email1 = sipc_util_marshal_object_get_string(in_o, "email1");
+                       g_email2 = sipc_util_marshal_object_get_string(in_o, "email2");
+                       g_email3 = sipc_util_marshal_object_get_string(in_o, "email3");
+                       g_email4 = sipc_util_marshal_object_get_string(in_o, "email4");
+                       g_group_index = sipc_util_marshal_object_get_int(in_o, "group_index");
+
+                       pb_update.index = (unsigned short)g_index;
+                       pb_update.phonebook_type = g_pb_type;
+                       if(strlen(g_name)){
+                               snprintf(pb_update.name, strlen(g_name)+1, g_name);
+                               pb_update.dcs = g_dcs;
+                       }
+                       if(strlen(g_number)){
+                               snprintf(pb_update.number, strlen(g_number)+1, g_number);
+                               pb_update.ton = g_ton;
+                       }
+                       if(strlen(g_number2)){
+                               snprintf(pb_update.anr1, strlen(g_number2)+1, g_number2);
+                               pb_update.anr1_ton = g_number2_ton;
+                       }
+                       if(strlen(g_number3)){
+                               snprintf(pb_update.anr2, strlen(g_number3)+1, g_number3);
+                               pb_update.anr2_ton = g_number3_ton;
+                       }
+                       if(strlen(g_number4)){
+                               snprintf(pb_update.anr3, strlen(g_number4)+1, g_number4);
+                               pb_update.anr3_ton = g_number4_ton;
+                       }
+                       pb_update.group_index = (unsigned short)g_group_index;
+
+                       tcore_user_request_set_data(ur, sizeof(struct treq_phonebook_update_record), &pb_update);
+                       tcore_user_request_set_command(ur, TREQ_PHONEBOOK_UPDATERECORD);
+               }
+                       break;
+
+               case TAPI_SERVICE_PB_DELETE_RECORD : {
+                       struct treq_phonebook_delete_record pb_delete;
+                       enum tel_phonebook_type g_pb_type;
+                       gint g_index = 0;
+                       g_index = sipc_util_marshal_object_get_int(in_o, "index");
+                       g_pb_type = sipc_util_marshal_object_get_int(in_o, "type");
+                       pb_delete.index = (unsigned short)g_index;
+                       pb_delete.phonebook_type = g_pb_type;
+
+                       tcore_user_request_set_data(ur, sizeof(struct treq_phonebook_delete_record), &pb_delete);
+                       tcore_user_request_set_command(ur, TREQ_PHONEBOOK_DELETERECORD);
+               }
+                       break;
+
+               default :
+                       dbg("not handled command [%d] here",cmd);
+                       break;
+       }
+
+       if (cmd == TAPI_SERVICE_PB_GET_INITINFO  ) {
+               /*synchronous data return case*/
+       } else {
+               /*asynchronous data return case*/
+               ret = tcore_communicator_dispatch_request(c, ur);
+               if (ret != TCORE_RETURN_SUCCESS) {
+                       return FALSE;
+               }
+       }
+
+       return TRUE;
+}
+
+gboolean scomm_service_response_pb(Communicator *comm, UserRequest *ur, enum tcore_response_command command,
+               unsigned int data_len, const void *data)
+{
+       const struct tresp_phonebook_get_count *resp_pbcnt = data;
+       const struct tresp_phonebook_get_info *resp_entry = data;
+       const struct tresp_phonebook_get_usim_info *resp_capa = data;
+       const struct tresp_phonebook_read_record *resp_pbread = data;
+       const struct tresp_phonebook_update_record *resp_pbupdate = data;
+       const struct tresp_phonebook_delete_record *resp_pbdelete = data;
+       int count =0;
+       int ret = 0, i;
+       gchar *out_d= NULL, *serial_d = NULL;
+       gchar *entry_key = NULL;
+       struct custom_data *ctx = NULL;
+       const struct tcore_user_info *ui;
+       sipc_server_t *s = NULL;
+       struct _tapi_header hdr;
+       struct _sipc_marshal_object* out_o = NULL;
+       struct _sipc_marshal_object* entry_o = NULL;
+
+       memset(&hdr, 0, sizeof(struct _tapi_header));
+
+       ctx = tcore_communicator_ref_user_data(comm);
+       if (!ctx) {
+               dbg("user_data is NULL");
+               return FALSE;
+       }
+
+       ui = tcore_user_request_ref_user_info(ur);
+       s = ctx->sk_server;
+
+       dbg("application channel id(%d), Command = [0x%x], data_len = %d", ui->channel_id, command, data_len);
+       hdr.cmd = (tapi_service_command_e)ui->client_cmd;
+
+       out_o = sipc_util_marshal_object_create();
+
+       switch (command) {
+               case TRESP_PHONEBOOK_GETCOUNT:
+                       dbg("dbus comm - TRESP_PHONEBOOK_GETCOUNT");
+                       sipc_util_marshal_object_add_data(out_o, "result", (void*)&resp_pbcnt->result, SIPC_MARSHAL_DATA_INT_TYPE);
+                       sipc_util_marshal_object_add_data(out_o, "type", (void*)&resp_pbcnt->type, SIPC_MARSHAL_DATA_INT_TYPE);
+                       sipc_util_marshal_object_add_data(out_o, "used", (void*)&resp_pbcnt->used_count, SIPC_MARSHAL_DATA_INT_TYPE);
+                       sipc_util_marshal_object_add_data(out_o, "total", (void*)&resp_pbcnt->total_count, SIPC_MARSHAL_DATA_INT_TYPE);
+                       break;
+
+               case TRESP_PHONEBOOK_GETMETAINFO:
+               case TRESP_PHONEBOOK_GETUSIMINFO:
+                       dbg("dbus comm - TRESP_PHONEBOOK_GETMETAINFO");
+                       sipc_util_marshal_object_add_data(out_o, "result", (void*)&resp_entry->result, SIPC_MARSHAL_DATA_INT_TYPE);
+                       sipc_util_marshal_object_add_data(out_o, "type", (void*)&resp_entry->type, SIPC_MARSHAL_DATA_INT_TYPE);
+                       sipc_util_marshal_object_add_data(out_o, "index_min", (void*)&resp_entry->index_min, SIPC_MARSHAL_DATA_INT_TYPE);
+                       sipc_util_marshal_object_add_data(out_o, "index_max", (void*)&resp_entry->index_max, SIPC_MARSHAL_DATA_INT_TYPE);
+                       sipc_util_marshal_object_add_data(out_o, "number_length_max", (void*)&resp_entry->number_length_max, SIPC_MARSHAL_DATA_INT_TYPE);
+                       sipc_util_marshal_object_add_data(out_o, "text_length_max", (void*)&resp_entry->text_length_max, SIPC_MARSHAL_DATA_INT_TYPE);
+                       break;
+
+               case TRESP_PHONEBOOK_READRECORD:
+                       dbg("dbus comm - TRESP_PHONEBOOK_READRECORD");
+                       sipc_util_marshal_object_add_data(out_o, "result", (void*)&resp_pbread->result, SIPC_MARSHAL_DATA_INT_TYPE);
+                       sipc_util_marshal_object_add_data(out_o, "index", (void*)&resp_pbread->index, SIPC_MARSHAL_DATA_INT_TYPE);
+                       sipc_util_marshal_object_add_data(out_o, "next_index", (void*)&resp_pbread->next_index, SIPC_MARSHAL_DATA_INT_TYPE);
+                       sipc_util_marshal_object_add_data(out_o, "name", (void*)&resp_pbread->name, SIPC_MARSHAL_DATA_STRING_TYPE);
+                       sipc_util_marshal_object_add_data(out_o, "dcs", (void*)&resp_pbread->dcs, SIPC_MARSHAL_DATA_INT_TYPE);
+                       sipc_util_marshal_object_add_data(out_o, "number", (void*)&resp_pbread->number, SIPC_MARSHAL_DATA_STRING_TYPE);
+                       sipc_util_marshal_object_add_data(out_o, "ton", (void*)&resp_pbread->ton, SIPC_MARSHAL_DATA_INT_TYPE);
+                       sipc_util_marshal_object_add_data(out_o, "number2", (void*)&resp_pbread->anr1, SIPC_MARSHAL_DATA_STRING_TYPE);
+                       sipc_util_marshal_object_add_data(out_o, "number2_ton", (void*)&resp_pbread->anr1_ton, SIPC_MARSHAL_DATA_INT_TYPE);
+                       sipc_util_marshal_object_add_data(out_o, "number3", (void*)&resp_pbread->anr2, SIPC_MARSHAL_DATA_STRING_TYPE);
+                       sipc_util_marshal_object_add_data(out_o, "number3_ton", (void*)&resp_pbread->anr2_ton, SIPC_MARSHAL_DATA_INT_TYPE);
+                       sipc_util_marshal_object_add_data(out_o, "number4", (void*)&resp_pbread->anr3, SIPC_MARSHAL_DATA_STRING_TYPE);
+                       sipc_util_marshal_object_add_data(out_o, "number4_ton", (void*)&resp_pbread->anr3_ton, SIPC_MARSHAL_DATA_INT_TYPE);
+                       sipc_util_marshal_object_add_data(out_o, "email1", (void*)&resp_pbread->email1, SIPC_MARSHAL_DATA_STRING_TYPE);
+                       sipc_util_marshal_object_add_data(out_o, "email2", (void*)&resp_pbread->email2, SIPC_MARSHAL_DATA_STRING_TYPE);
+                       sipc_util_marshal_object_add_data(out_o, "email3", (void*)&resp_pbread->email3, SIPC_MARSHAL_DATA_STRING_TYPE);
+                       sipc_util_marshal_object_add_data(out_o, "email4", (void*)&resp_pbread->email4, SIPC_MARSHAL_DATA_STRING_TYPE);
+                       sipc_util_marshal_object_add_data(out_o, "group_index", (void*)&resp_pbread->group_index, SIPC_MARSHAL_DATA_INT_TYPE);
+                       break;
+
+               case TRESP_PHONEBOOK_UPDATERECORD:
+                       dbg("dbus comm - TRESP_PHONEBOOK_UPDATERECORD");
+                       sipc_util_marshal_object_add_data(out_o, "result", (void*)&resp_pbupdate->result, SIPC_MARSHAL_DATA_INT_TYPE);
+                       break;
+
+               case TRESP_PHONEBOOK_DELETERECORD:
+                       dbg("dbus comm - TRESP_PHONEBOOK_DELETERECORD");
+                       sipc_util_marshal_object_add_data(out_o, "result", (void*)&resp_pbdelete->result, SIPC_MARSHAL_DATA_INT_TYPE);
+                       break;
+       }
+
+       if(out_o){
+               serial_d = sipc_util_marshal_object_serializer(out_o);
+               hdr.data_len = strlen(serial_d);
+               sipc_util_marshal_object_destory(out_o);
+       }
+
+       out_d = g_new0(char, sizeof(struct _tapi_header)+hdr.data_len);
+       memcpy(out_d, &hdr, sizeof(struct _tapi_header));
+       if(serial_d){
+               memcpy(out_d+sizeof(struct _tapi_header), serial_d, hdr.data_len);
+               g_free(serial_d);
+       }
+
+       ret = sipc_server_send(s, ui->channel_id, out_d, sizeof(struct _tapi_header)+hdr.data_len, SIPC_SEND_DATA_ASYNC);
+       g_free(out_d);
+
+       if(ret < 0){
+               return FALSE;
+       }
+
+       return TRUE;
+}
+
+
+gboolean scomm_service_notification_pb(Communicator *comm, CoreObject *source, enum tcore_notification_command command,
+               unsigned int data_len, const void *data)
+{
+       const struct tnoti_phonebook_status *n_pb_status = data;
+       int ret = 0;
+       gchar *out_d = NULL, *serial_d = NULL;
+
+       struct custom_data *ctx = NULL;
+       sipc_server_t *s = NULL;
+
+       struct _tapi_header hdr;
+       struct _sipc_marshal_object* out_o = NULL;
+
+       memset(&hdr, 0, sizeof(struct _tapi_header));
+
+       ctx = tcore_communicator_ref_user_data(comm);
+       if (!ctx) {
+               dbg("user_data is NULL");
+               return FALSE;
+       }
+
+       s = ctx->sk_server;
+       dbg("notification !!! (command = 0x%x, data_len = %d)", command, data_len);
+
+       out_o = sipc_util_marshal_object_create();
+
+       switch (command) {
+               case TNOTI_PHONEBOOK_STATUS :
+                       dbg("notified sim_status[%d]", n_pb_status->b_init);
+                       sipc_util_marshal_object_add_data(out_o, "status", (void*)&n_pb_status->b_init, SIPC_MARSHAL_DATA_BOOLEAN_TYPE);
+                       sipc_util_marshal_object_add_data(out_o, "support_fdn", (void*)&n_pb_status->support_list.b_fdn, SIPC_MARSHAL_DATA_BOOLEAN_TYPE);
+                       sipc_util_marshal_object_add_data(out_o, "support_adn", (void*)&n_pb_status->support_list.b_adn, SIPC_MARSHAL_DATA_BOOLEAN_TYPE);
+                       sipc_util_marshal_object_add_data(out_o, "support_sdn", (void*)&n_pb_status->support_list.b_sdn, SIPC_MARSHAL_DATA_BOOLEAN_TYPE);
+                       sipc_util_marshal_object_add_data(out_o, "support_usim", (void*)&n_pb_status->support_list.b_usim, SIPC_MARSHAL_DATA_BOOLEAN_TYPE);
+                       sipc_util_marshal_object_add_data(out_o, "support_grp", (void*)&n_pb_status->support_list.b_gas, SIPC_MARSHAL_DATA_BOOLEAN_TYPE);
+                       break;
+
+               default :
+                       dbg("not handled command [%d] here",command);
+                       break;
+       }
+
+       if(out_o){
+               serial_d = sipc_util_marshal_object_serializer(out_o);
+               hdr.data_len = strlen(serial_d);
+               sipc_util_marshal_object_destory(out_o);
+       }
+
+       out_d = g_new0(char, sizeof(struct _tapi_header)+hdr.data_len);
+       memcpy(out_d, &hdr, sizeof(struct _tapi_header));
+       if(serial_d){
+               memcpy(out_d+sizeof(struct _tapi_header), serial_d, hdr.data_len);
+               g_free(serial_d);
+       }
+
+       ret = sipc_server_broadcast(s, out_d, sizeof(struct _tapi_header)+hdr.data_len);
+       g_free(out_d);
+
+       if(ret < 0){
+               return FALSE;
+       }
+       return TRUE;
+}
diff --git a/plugin/src/socket_ps.c b/plugin/src/socket_ps.c
new file mode 100644 (file)
index 0000000..99601a4
--- /dev/null
@@ -0,0 +1,310 @@
+/*
+ * tel-plugin-socket-communicator
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Ja-young Gu <jygu@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <glib-object.h>
+
+#include <tcore.h>
+#include <server.h>
+#include <plugin.h>
+#include <hal.h>
+#include <communicator.h>
+#include <core_object.h>
+#include <queue.h>
+#include <user_request.h>
+#include <util.h>
+#include <co_ps.h>
+
+#include "sipc.h"
+#include "tapi_common.h"
+#include "module_req.h"
+
+static void _request_fail(UserRequest *ur, int cmd, int resp_len, void *resp)
+{
+       tcore_user_request_send_response(ur, cmd, resp_len, resp);
+       tcore_user_request_free(ur);
+}
+
+gboolean scomm_service_request_ps(unsigned int ch_id, Communicator *c, TcorePlugin *plugin,
+               tapi_service_command_e cmd, gchar *data, void **outparam)
+{
+       int ret = 0;
+       struct _sipc_marshal_object *out_obj;
+       struct _sipc_marshal_object *in_obj;
+       gboolean result = TRUE;
+       UserRequest *ur = NULL;
+       struct tcore_user_info ui = { 0, 0, 0, NULL, 0, 0, NULL };
+
+       in_obj = sipc_util_marshal_object_deserializer(data);
+       if (!in_obj) {
+               dbg("in_obj is NULL");
+               result = FALSE;
+               goto RETURN;
+       }
+
+       ur = tcore_user_request_new(c, tcore_plugin_get_description(plugin)->name);
+       if (!ur) {
+               dbg("ur is NULL");
+               result = FALSE;
+               goto RETURN;
+       }
+
+       ui.channel_id = ch_id;
+       ui.client_cmd = cmd;
+       tcore_user_request_set_user_info(ur, &ui);
+
+       switch (cmd) {
+               case TAPI_SERVICE_PS_SET_DUN_PIN_CONTROL: {
+                       struct treq_ps_set_dun_pin_control data_pincontrol;
+                       struct tresp_ps_set_dun_pin_control resp;
+                       gchar *str_signal = NULL;
+                       gboolean status;
+                       enum telephony_ps_dun_pincontrol_signal in_signal = DUN_PINCONTROL_SIGNAL_DCD;
+
+                       str_signal = sipc_util_marshal_object_get_string(in_obj, "signal");
+                       status = sipc_util_marshal_object_get_boolean(in_obj, "status");
+
+                       if (!str_signal) {
+                               /* fail */
+                               resp.result = TCORE_RETURN_EINVAL;
+                               _request_fail(ur, TRESP_PS_SET_DUN_PIN_CONTROL, sizeof(struct tresp_ps_set_dun_pin_control), &resp);
+                               result = FALSE;
+                               break;
+                       }
+                       else {
+                               dbg("signal = [%s]", str_signal);
+                       }
+
+                       if (!g_strcmp0(str_signal, "dcd")) {
+                               in_signal = DUN_PINCONTROL_SIGNAL_DCD;
+                       }
+                       else if (!g_strcmp0(str_signal, "dtr")) {
+                               in_signal = DUN_PINCONTROL_SIGNAL_DTR;
+                       }
+                       else if (!g_strcmp0(str_signal, "dsr")) {
+                               in_signal = DUN_PINCONTROL_SIGNAL_DSR;
+                       }
+                       else if (!g_strcmp0(str_signal, "rts")) {
+                               in_signal = DUN_PINCONTROL_SIGNAL_RTS;
+                       }
+                       else if (!g_strcmp0(str_signal, "cts")) {
+                               in_signal = DUN_PINCONTROL_SIGNAL_CTS;
+                       }
+                       else if (!g_strcmp0(str_signal, "ri")) {
+                               in_signal = DUN_PINCONTROL_SIGNAL_RI;
+                       }
+                       else {
+                               /* fail */
+                               g_free(str_signal);
+                               resp.result = TCORE_RETURN_EINVAL;
+                               _request_fail(ur, TRESP_PS_SET_DUN_PIN_CONTROL, sizeof(struct tresp_ps_set_dun_pin_control), &resp);
+                               result = FALSE;
+                               break;
+                       }
+
+                       g_free(str_signal);
+
+                       dbg("signal = %d, status = %d", in_signal, status);
+
+                       data_pincontrol.signal = in_signal;
+                       data_pincontrol.status = status;
+
+                       tcore_user_request_set_data(ur, sizeof(struct treq_ps_set_dun_pin_control), &data_pincontrol);
+                       tcore_user_request_set_command(ur, TREQ_PS_SET_DUN_PIN_CONTROL);
+               }
+                       break;
+       }
+
+RETURN:
+       sipc_util_marshal_object_destory(in_obj);
+       out_obj = sipc_util_marshal_object_create();
+       sipc_util_marshal_object_add_data(out_obj, "result", &result, SIPC_MARSHAL_DATA_BOOLEAN_TYPE);
+
+       dbg("result = %d", result);
+
+       *outparam = sipc_util_marshal_object_serializer(out_obj);
+       sipc_util_marshal_object_destory(out_obj);
+
+       if (result == FALSE) {
+               return FALSE;
+       }
+
+       ret = tcore_communicator_dispatch_request(c, ur);
+       if (ret != TCORE_RETURN_SUCCESS) {
+               return FALSE;
+       }
+
+       return TRUE;
+}
+
+gboolean scomm_service_response_ps(Communicator *comm, UserRequest *ur, enum tcore_response_command command,
+               unsigned int data_len, const void *data)
+{
+       const struct tresp_ps_set_dun_pin_control *resp_dun_pin_control = data;
+       int ret = 0;
+       gchar *out_d = NULL, *serial_d = NULL;
+       struct custom_data *ctx = NULL;
+       const struct tcore_user_info *ui;
+       struct _tapi_header hdr;
+       struct _sipc_marshal_object* out_obj = NULL;
+       struct _sipc_marshal_object* in_obj = NULL;
+
+       ctx = tcore_communicator_ref_user_data(comm);
+       if (!ctx) {
+               dbg("user_data is NULL");
+               return FALSE;
+       }
+
+       ui = tcore_user_request_ref_user_info(ur);
+
+       dbg("response command = [0x%x], data_len = %d", command, data_len);
+       dbg("channel_id = %d, client_cmd = %d", ui->channel_id, ui->client_cmd);
+
+       memset(&hdr, 0, sizeof(struct _tapi_header));
+       hdr.cmd = (tapi_service_command_e) ui->client_cmd;
+
+       out_obj = sipc_util_marshal_object_create();
+
+       switch (command) {
+               case TRESP_PS_SET_DUN_PIN_CONTROL:
+                       dbg("TRESP_PS_SET_DUN_PIN_CONTROL");
+                       sipc_util_marshal_object_add_data(out_obj, "result", (void*) &resp_dun_pin_control->result,
+                                       SIPC_MARSHAL_DATA_INT_TYPE);
+                       break;
+       }
+
+       if (out_obj) {
+               serial_d = sipc_util_marshal_object_serializer(out_obj);
+               hdr.data_len = strlen(serial_d);
+               sipc_util_marshal_object_destory(out_obj);
+       }
+
+       out_d = g_new0(char, sizeof(struct _tapi_header) + hdr.data_len);
+       memcpy(out_d, &hdr, sizeof(struct _tapi_header));
+
+       if (serial_d) {
+               memcpy(out_d + sizeof(struct _tapi_header), serial_d, hdr.data_len);
+               dbg("serial_d = [%s]", serial_d);
+               g_free(serial_d);
+       }
+
+       ret = sipc_server_send(ctx->sk_server, ui->channel_id, out_d, sizeof(struct _tapi_header) + hdr.data_len,
+                       SIPC_SEND_DATA_ASYNC);
+       g_free(out_d);
+
+       if (ret < 0) {
+               dbg("ret = %d", ret);
+               return FALSE;
+       }
+
+       return TRUE;
+}
+
+gboolean scomm_service_notification_ps(Communicator *comm, CoreObject *source, enum tcore_notification_command command,
+               unsigned int data_len, const void *data)
+{
+       const struct tnoti_ps_dun_pin_control *noti_pin_info = data;
+
+       int ret = 0;
+       struct custom_data *ctx = NULL;
+       struct _tapi_header hdr;
+       struct _sipc_marshal_object* out_obj = NULL;
+       gchar *out_d = NULL, *serial_d = NULL;
+
+       ctx = tcore_communicator_ref_user_data(comm);
+       if (!ctx) {
+               dbg("user_data is NULL");
+               return FALSE;
+       }
+
+       dbg("notification !!! (command = 0x%x, data_len = %d)", command, data_len);
+
+       switch (command) {
+               case TNOTI_PS_DUN_PIN_CONTROL: {
+                       gchar *str_signal = NULL;
+                       gint status;
+
+                       switch (noti_pin_info->signal) {
+                               case DUN_PINCONTROL_SIGNAL_DCD:
+                                       str_signal = strdup("dcd");
+                                       break;
+
+                               case DUN_PINCONTROL_SIGNAL_DTR:
+                                       str_signal = strdup("dtr");
+                                       break;
+
+                               case DUN_PINCONTROL_SIGNAL_DSR:
+                                       str_signal = strdup("dsr");
+                                       break;
+
+                               case DUN_PINCONTROL_SIGNAL_RTS:
+                                       str_signal = strdup("rts");
+                                       break;
+
+                               case DUN_PINCONTROL_SIGNAL_CTS:
+                                       str_signal = strdup("cts");
+                                       break;
+
+                               case DUN_PINCONTROL_SIGNAL_RI:
+                                       str_signal = strdup("ri");
+                                       break;
+                       }
+                       status = noti_pin_info->status;
+
+                       hdr.cmd = TAPI_NOTI_PS_DUN_PIN_CONTROL;
+
+                       dbg("signal = [%s], status = %d", str_signal, status);
+
+                       out_obj = sipc_util_marshal_object_create();
+                       sipc_util_marshal_object_add_data(out_obj, "signal", str_signal, SIPC_MARSHAL_DATA_STRING_TYPE);
+                       sipc_util_marshal_object_add_data(out_obj, "status", &status, SIPC_MARSHAL_DATA_BOOLEAN_TYPE);
+               }
+                       break;
+
+               case TNOTI_PS_EXTERNAL_CALL:
+                       hdr.cmd = TAPI_NOTI_PS_EXTERNAL_CALL;
+                       /* no data */
+                       break;
+       }
+
+       if (out_obj) {
+               serial_d = sipc_util_marshal_object_serializer(out_obj);
+               hdr.data_len = strlen(serial_d);
+               sipc_util_marshal_object_destory(out_obj);
+       }
+
+       out_d = g_new0(char, sizeof(struct _tapi_header)+hdr.data_len);
+       memcpy(out_d, &hdr, sizeof(struct _tapi_header));
+       if (serial_d) {
+               memcpy(out_d + sizeof(struct _tapi_header), serial_d, hdr.data_len);
+               g_free(serial_d);
+       }
+
+       dbg("len = %d, out_d = [%s]", sizeof(struct _tapi_header) + hdr.data_len, out_d);
+
+       ret = sipc_server_broadcast(ctx->sk_server, out_d, sizeof(struct _tapi_header) + hdr.data_len);
+       dbg("ret = %d", ret);
+       g_free(out_d);
+
+       return TRUE;
+}
diff --git a/plugin/src/socket_sap.c b/plugin/src/socket_sap.c
new file mode 100644 (file)
index 0000000..d5ab25b
--- /dev/null
@@ -0,0 +1,330 @@
+/*
+ * tel-plugin-socket-communicator
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Ja-young Gu <jygu@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <glib-object.h>
+
+#include <tcore.h>
+#include <server.h>
+#include <plugin.h>
+#include <hal.h>
+#include <communicator.h>
+#include <core_object.h>
+#include <queue.h>
+#include <user_request.h>
+#include <util.h>
+#include <co_sap.h>
+#include <co_sim.h>
+
+#include "sipc.h"
+#include "tapi_common.h"
+#include "module_req.h"
+
+gboolean scomm_service_reqeust_sap(unsigned int ch_id, Communicator *c, TcorePlugin *plugin, tapi_service_command_e cmd, gchar *data, void **outparam)
+{
+       GSList *co_list = NULL;
+       CoreObject *co_sap = NULL;
+       UserRequest *ur = NULL;
+       struct tcore_user_info ui = { 0, 0, 0, NULL,0,0, NULL };
+       int ret = 0;
+
+       gchar *tmp = NULL;
+       int tmp_len = 0;
+       struct _sipc_marshal_object *in_o;
+
+       co_list = tcore_plugin_get_core_objects_bytype(plugin, CORE_OBJECT_TYPE_SAP);
+       if (!co_list) {
+               dbg("err-no sap core object list in current plugin");
+               return FALSE;
+       }
+
+       co_sap = (CoreObject *)co_list->data;
+       if (!co_sap) {
+               dbg("err-no sap core object in current plugin");
+               return FALSE;
+       }
+
+       g_slist_free(co_list);
+
+       ur = tcore_user_request_new(c, tcore_plugin_get_description(plugin)->name);
+       if (!ur) {
+               dbg("err - ur creation failed");
+               return FALSE;
+       }
+
+       ui.channel_id = ch_id;
+       ui.client_cmd = cmd;
+       tcore_user_request_set_user_info(ur, &ui);
+
+       in_o = sipc_util_marshal_object_deserializer(data);
+       if(in_o){
+               dbg("err - data deserializer failed");
+               return FALSE;
+       }
+
+       switch (cmd) {
+               case TAPI_SERVICE_SAP_CONNECT :{
+                       struct treq_sap_req_connect req_conn = {0, };
+                       gint g_max_size;
+                       g_max_size = sipc_util_marshal_object_get_int(in_o, "max_size");
+                       req_conn.max_msg_size = (unsigned short)g_max_size;
+                       tcore_user_request_set_data(ur, sizeof(struct treq_sap_req_connect), &req_conn);
+                       tcore_user_request_set_command(ur, TREQ_SIM_SET_LANGUAGE);
+               }
+                       break;
+
+               case TAPI_SERVICE_SAP_DISCONNECT: {
+                       struct treq_sap_req_disconnect req_disconn;
+                       tcore_user_request_set_data(ur, sizeof(struct treq_sap_req_disconnect), &req_disconn);
+                       tcore_user_request_set_command(ur, TREQ_SAP_REQ_DISCONNECT);
+               }
+                       break;
+
+               case TAPI_SERVICE_SAP_GET_CONNECTSTATUS: {
+                       struct treq_sap_req_status req_status;
+                       tcore_user_request_set_data(ur, sizeof(struct treq_sap_req_status), &req_status);
+                       tcore_user_request_set_command(ur, TREQ_SAP_REQ_STATUS);
+               }
+                       break;
+
+               case TAPI_SERVICE_SAP_GET_ATR : {
+                       struct treq_sap_req_atr req_atr;
+                       tcore_user_request_set_data(ur, sizeof(struct treq_sap_req_atr), &req_atr);
+                       tcore_user_request_set_command(ur, TREQ_SAP_REQ_ATR);
+               }
+                       break;
+
+               case TAPI_SERVICE_SAP_TRANSFER_APDU : {
+                       struct treq_sap_transfer_apdu t_apdu = {0, };
+                       gchar *apdu_data = NULL;
+                       apdu_data = sipc_util_marshal_object_get_string(in_o, "apdu");
+                       t_apdu.apdu_length = strlen(apdu_data);
+                       memcpy(t_apdu.apdu_data, apdu_data, t_apdu.apdu_length);
+
+                       tcore_user_request_set_data(ur, sizeof(struct treq_sap_transfer_apdu), &t_apdu);
+                       tcore_user_request_set_command(ur, TREQ_SAP_TRANSFER_APDU);
+               }
+                       break;
+
+               case TAPI_SERVICE_SAP_SET_PROTOCOL : {
+                       struct treq_sap_set_protocol set_protocol;
+                       enum tel_sap_protocol_type g_protocol = 0;
+                       g_protocol = sipc_util_marshal_object_get_int(in_o, "protocol");
+                       set_protocol.protocol = g_protocol;
+
+                       tcore_user_request_set_data(ur, sizeof(struct treq_sap_set_protocol), &set_protocol);
+                       tcore_user_request_set_command(ur, TREQ_SAP_SET_PROTOCOL);
+               }
+                       break;
+
+               case TAPI_SERVICE_SAP_SET_POWER : {
+                       struct treq_sap_set_power set_power;
+                       enum tel_sap_power_mode g_mode = SAP_POWER_ON;
+                       g_mode = sipc_util_marshal_object_get_int(in_o, "mode");
+                       set_power.mode = g_mode;
+
+                       tcore_user_request_set_data(ur, sizeof(struct treq_sap_set_power), &set_power);
+                       tcore_user_request_set_command(ur, TREQ_SAP_SET_POWER);
+               }
+                       break;
+
+               case TAPI_SERVICE_SAP_GET_READERSTATUS : {
+                       struct treq_sap_req_cardreaderstatus req_reader;
+                       tcore_user_request_set_data(ur, sizeof(struct treq_sap_req_cardreaderstatus), &req_reader);
+                       tcore_user_request_set_command(ur, TREQ_SAP_REQ_CARDREADERSTATUS);
+               }
+                       break;
+
+               default :
+                       dbg("not handled command[%d] here",cmd);
+                       break;
+       }
+
+       ret = tcore_communicator_dispatch_request(c, ur);
+       if (ret != TCORE_RETURN_SUCCESS) {
+               return FALSE;
+       }
+       return TRUE;
+}
+
+gboolean scomm_service_response_sap(Communicator *comm, UserRequest *ur, enum tcore_response_command command,
+               unsigned int data_len, const void *data)
+{
+       const struct tresp_sap_req_connect *sap_conn = data;
+       const struct tresp_sap_req_disconnect *sap_disconn = data;
+       const struct tresp_sap_req_status *sap_status = data;
+       const struct tresp_sap_req_atr *sap_atr = data;
+       const struct tresp_sap_transfer_apdu *sap_apdu = data;
+       const struct tresp_sap_set_protocol *sap_protocol = data;
+       const struct tresp_sap_set_power *sap_power = data;
+       const struct tresp_sap_req_cardreaderstatus *sap_reader = data;
+       int ret = 0;
+       gchar *out_d= NULL, *serial_d = NULL;
+       struct custom_data *ctx = NULL;
+       const struct tcore_user_info *ui;
+       sipc_server_t *s = NULL;
+       struct _tapi_header hdr;
+       struct _sipc_marshal_object* out_o = NULL;
+
+       memset(&hdr, 0, sizeof(struct _tapi_header));
+
+       ctx = tcore_communicator_ref_user_data(comm);
+       if (!ctx) {
+               dbg("user_data is NULL");
+               return FALSE;
+       }
+
+       ui = tcore_user_request_ref_user_info(ur);
+       s = ctx->sk_server;
+
+       dbg("application channel id(%d), Command = [0x%x], data_len = %d", ui->channel_id, command, data_len);
+       hdr.cmd = (tapi_service_command_e)ui->client_cmd;
+
+       out_o = sipc_util_marshal_object_create();
+
+       switch (command) {
+               case TRESP_SAP_REQ_CONNECT:
+                       sipc_util_marshal_object_add_data(out_o, "result", (void*)&sap_conn->status, SIPC_MARSHAL_DATA_INT_TYPE);
+                       sipc_util_marshal_object_add_data(out_o, "max_size", (void*)&sap_conn->max_msg_size , SIPC_MARSHAL_DATA_INT_TYPE);
+                       break;
+
+               case TRESP_SAP_REQ_DISCONNECT:
+                       sipc_util_marshal_object_add_data(out_o, "result", (void*)&sap_disconn->result, SIPC_MARSHAL_DATA_INT_TYPE);
+                       break;
+
+               case TRESP_SAP_REQ_STATUS:
+                       sipc_util_marshal_object_add_data(out_o, "status", (void*)&sap_status->status, SIPC_MARSHAL_DATA_INT_TYPE);
+                       break;
+
+               case TRESP_SAP_REQ_ATR:
+                       sipc_util_marshal_object_add_data(out_o, "result", (void*)&sap_atr->result, SIPC_MARSHAL_DATA_INT_TYPE);
+                       sipc_util_marshal_object_add_data(out_o, "atr", (void*)&sap_atr->atr, SIPC_MARSHAL_DATA_STRING_TYPE);
+                       break;
+
+               case TRESP_SAP_TRANSFER_APDU:
+                       sipc_util_marshal_object_add_data(out_o, "result", (void*)&sap_apdu->result, SIPC_MARSHAL_DATA_INT_TYPE);
+                       sipc_util_marshal_object_add_data(out_o, "apdu", (void*)&sap_apdu->resp_adpdu, SIPC_MARSHAL_DATA_STRING_TYPE);
+                       break;
+
+               case TRESP_SAP_SET_PROTOCOL:
+                       sipc_util_marshal_object_add_data(out_o, "result", (void*)&sap_protocol->result, SIPC_MARSHAL_DATA_INT_TYPE);
+                       break;
+
+               case TRESP_SAP_SET_POWER:
+                       sipc_util_marshal_object_add_data(out_o, "result", (void*)&sap_power->result, SIPC_MARSHAL_DATA_INT_TYPE);
+                       break;
+
+               case TRESP_SAP_REQ_CARDREADERSTATUS:
+                       sipc_util_marshal_object_add_data(out_o, "result", (void*)&sap_reader->result, SIPC_MARSHAL_DATA_INT_TYPE);
+                       sipc_util_marshal_object_add_data(out_o, "status", (void*)&sap_reader->reader_status, SIPC_MARSHAL_DATA_INT_TYPE);
+                       break;
+       }
+
+
+       if(out_o){
+               serial_d = sipc_util_marshal_object_serializer(out_o);
+               hdr.data_len = strlen(serial_d);
+               sipc_util_marshal_object_destory(out_o);
+       }
+
+       out_d = g_new0(char, sizeof(struct _tapi_header)+hdr.data_len);
+       memcpy(out_d, &hdr, sizeof(struct _tapi_header));
+       if(serial_d){
+               memcpy(out_d+sizeof(struct _tapi_header), serial_d, hdr.data_len);
+               g_free(serial_d);
+       }
+
+       ret = sipc_server_send(s, ui->channel_id, out_d, sizeof(struct _tapi_header)+hdr.data_len, SIPC_SEND_DATA_ASYNC);
+       g_free(out_d);
+
+       if(ret < 0){
+               return FALSE;
+       }
+
+       return TRUE;
+}
+
+
+gboolean scomm_service_notification_sap(Communicator *comm, CoreObject *source, enum tcore_notification_command command,
+               unsigned int data_len, const void *data)
+{
+       const struct tnoti_sap_status_changed *n_sap_status = data;
+       const struct tnoti_sap_disconnect *n_sap_disconn = data;
+       int ret = 0;
+       gchar *out_d = NULL, *serial_d = NULL;
+       struct custom_data *ctx = NULL;
+       sipc_server_t *s = NULL;
+
+       struct _tapi_header hdr;
+       struct _sipc_marshal_object* out_o = NULL;
+
+       memset(&hdr, 0, sizeof(struct _tapi_header));
+
+       ctx = tcore_communicator_ref_user_data(comm);
+       if (!ctx) {
+               dbg("user_data is NULL");
+               return FALSE;
+       }
+
+       s = ctx->sk_server;
+       dbg("notification !!! (command = 0x%x, data_len = %d)", command, data_len);
+
+       out_o = sipc_util_marshal_object_create();
+
+       switch (command) {
+               case TNOTI_SAP_STATUS :
+                       dbg("notified sap_status[%d]", n_sap_status->status);
+                       sipc_util_marshal_object_add_data(out_o, "status", (void*)&n_sap_status->status, SIPC_MARSHAL_DATA_INT_TYPE);
+                       break;
+
+               case TNOTI_SAP_DISCONNECT :
+                       dbg("notified sap_disconnect type[%d]", n_sap_disconn->type);
+                       sipc_util_marshal_object_add_data(out_o, "type", (void*)&n_sap_disconn->type, SIPC_MARSHAL_DATA_INT_TYPE);
+                       break;
+
+               default :
+                       dbg("not handled command [%d] here",command);
+                       break;
+       }
+
+       if(out_o){
+               serial_d = sipc_util_marshal_object_serializer(out_o);
+               hdr.data_len = strlen(serial_d);
+               sipc_util_marshal_object_destory(out_o);
+       }
+
+       out_d = g_new0(char, sizeof(struct _tapi_header)+hdr.data_len);
+       memcpy(out_d, &hdr, sizeof(struct _tapi_header));
+       if(serial_d){
+               memcpy(out_d+sizeof(struct _tapi_header), serial_d, hdr.data_len);
+               g_free(serial_d);
+       }
+
+       ret = sipc_server_broadcast(s, out_d, sizeof(struct _tapi_header)+hdr.data_len);
+       g_free(out_d);
+
+       if(ret < 0){
+               return FALSE;
+       }
+       return TRUE;
+}
diff --git a/plugin/src/socket_sim.c b/plugin/src/socket_sim.c
new file mode 100644 (file)
index 0000000..fe95de9
--- /dev/null
@@ -0,0 +1,709 @@
+/*
+ * tel-plugin-socket-communicator
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Ja-young Gu <jygu@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <glib-object.h>
+
+#include <tcore.h>
+#include <server.h>
+#include <plugin.h>
+#include <hal.h>
+#include <communicator.h>
+#include <core_object.h>
+#include <queue.h>
+#include <user_request.h>
+#include <util.h>
+#include <co_sim.h>
+
+#include "sipc.h"
+#include "tapi_common.h"
+#include "module_req.h"
+
+gboolean scomm_service_reqeust_sim(unsigned int ch_id, Communicator *c, TcorePlugin *plugin, tapi_service_command_e cmd, gchar *data, void **outparam)
+{
+       GSList *co_list = NULL;
+       CoreObject *co_sim = NULL;
+       UserRequest *ur = NULL;
+       struct tcore_user_info ui = { 0, 0, 0, NULL,0,0, NULL };
+       int ret = 0;
+
+       gchar *tmp = NULL;
+       int tmp_len = 0;
+       struct _tapi_service_object out_o = {0,};
+       struct _sipc_marshal_object *in_o;
+
+       co_list = tcore_plugin_get_core_objects_bytype(plugin, CORE_OBJECT_TYPE_SIM);
+       if (!co_list) {
+               dbg("err-no sim core object list in current plugin");
+               return FALSE;
+       }
+
+       co_sim = (CoreObject *)co_list->data;
+       if (!co_sim) {
+               dbg("err-no sim core object in current plugin");
+               return FALSE;
+       }
+
+       g_slist_free(co_list);
+
+       if (cmd == TAPI_SERVICE_SIM_GET_SIMINITINFO || cmd == TAPI_SERVICE_SIM_GET_TYPE
+                       || cmd == TAPI_SERVICE_SIM_GET_IMSI ) {
+               /*synchronous data return case*/
+               out_o.cmd = cmd;
+               out_o.mo = sipc_util_marshal_object_create();
+       } else {
+               /*asynchronous data return case*/
+               ur = tcore_user_request_new(c, tcore_plugin_get_description(plugin)->name);
+               if (!ur) {
+                       dbg("err - ur creation failed");
+                       return FALSE;
+               }
+
+               ui.channel_id = ch_id;
+               ui.client_cmd = cmd;
+               tcore_user_request_set_user_info(ur, &ui);
+
+               in_o = sipc_util_marshal_object_deserializer(data);
+               if(in_o){
+                       dbg("err - data deserializer failed");
+                       return FALSE;
+               }
+       }
+
+       switch (cmd) {
+               case TAPI_SERVICE_SIM_GET_SIMINITINFO : {
+                       enum tel_sim_status sim_status = SIM_STATUS_UNKNOWN;
+                       gboolean sim_changed = FALSE;
+                       sim_status = tcore_sim_get_status(co_sim);
+                       sipc_util_marshal_object_add_data(out_o.mo, "status", &sim_status,
+                                       SIPC_MARSHAL_DATA_INT_TYPE);
+                       sipc_util_marshal_object_add_data(out_o.mo, "new_sim", &sim_changed,
+                                       SIPC_MARSHAL_DATA_BOOLEAN_TYPE);
+                       tmp = sipc_util_marshal_object_serializer(out_o.mo);
+                       tmp_len = strlen(tmp);
+                       *outparam = g_new0(char, tmp_len+1);
+                       memcpy(*outparam, tmp, tmp_len);
+                       g_free(tmp);
+               }
+                       break;
+
+               case TAPI_SERVICE_SIM_GET_TYPE : {
+                       enum tel_sim_type type = SIM_TYPE_UNKNOWN;
+                       type = tcore_sim_get_type(co_sim);
+                       sipc_util_marshal_object_add_data(out_o.mo, "type", &type,
+                                       SIPC_MARSHAL_DATA_INT_TYPE);
+                       tmp = sipc_util_marshal_object_serializer(out_o.mo);
+                       tmp_len = strlen(tmp);
+                       *outparam = g_new0(char, tmp_len+1);
+                       memcpy(*outparam, tmp, tmp_len);
+                       g_free(tmp);
+               }
+                       break;
+
+               case TAPI_SERVICE_SIM_GET_IMSI : {
+                       struct tel_sim_imsi *n_imsi = NULL;
+                       n_imsi = tcore_sim_get_imsi(co_sim);
+                       if (n_imsi != NULL) {
+                               dbg("n_imsi->plmn[%s]", n_imsi->plmn);
+                               sipc_util_marshal_object_add_data(out_o.mo, "mcc", n_imsi->plmn,
+                                               SIPC_MARSHAL_DATA_STRING_TYPE);
+                               sipc_util_marshal_object_add_data(out_o.mo, "mnc", n_imsi->plmn + 3,
+                                               SIPC_MARSHAL_DATA_STRING_TYPE);
+                               sipc_util_marshal_object_add_data(out_o.mo, "msin", n_imsi->msin,
+                                               SIPC_MARSHAL_DATA_STRING_TYPE);
+                               tmp = sipc_util_marshal_object_serializer(out_o.mo);
+                               tmp_len = strlen(tmp);
+                               *outparam = g_new0(char, tmp_len+1);
+                               memcpy(*outparam, tmp, tmp_len);
+                               g_free(tmp);
+                       }
+               }
+                       break;
+
+               case TAPI_SERVICE_SIM_GET_ECC :
+                       tcore_user_request_set_command(ur, TREQ_SIM_GET_ECC);
+                       break;
+
+               case TAPI_SERVICE_SIM_GET_ICCID :
+                       tcore_user_request_set_command(ur, TREQ_SIM_GET_ICCID);
+                       break;
+
+               case TAPI_SERVICE_SIM_GET_LANGUAGE :
+                       tcore_user_request_set_command(ur, TREQ_SIM_GET_LANGUAGE);
+                       break;
+
+               case TAPI_SERVICE_SIM_SET_LANGUAGE : {
+                       struct treq_sim_set_language set_language = { 0, };
+                       enum tel_sim_language_type      g_language;
+                       g_language = sipc_util_marshal_object_get_int(in_o, "language");
+
+                       set_language.language = g_language;
+
+                       tcore_user_request_set_data(ur, sizeof(struct treq_sim_set_language), &set_language);
+                       tcore_user_request_set_command(ur, TREQ_SIM_SET_LANGUAGE);
+               }
+                       break;
+
+               case TAPI_SERVICE_SIM_GET_CF :
+                       tcore_user_request_set_command(ur, TREQ_SIM_GET_CALLFORWARDING);
+                       break;
+
+               case TAPI_SERVICE_SIM_SET_CF :
+                       /*not defined value yet*/
+                       break;
+
+               case TAPI_SERVICE_SIM_GET_MW :
+                       tcore_user_request_set_command(ur, TREQ_SIM_GET_MESSAGEWAITING);
+                       break;
+
+               case TAPI_SERVICE_SIM_SET_MW :
+                       /*not defined value yet*/
+                       break;
+
+               case TAPI_SERVICE_SIM_GET_MB :
+                       tcore_user_request_set_command(ur, TREQ_SIM_GET_MAILBOX);
+                       break;
+
+               case TAPI_SERVICE_SIM_SET_MB :
+                       /*not defined value yet*/
+                       break;
+
+               case TAPI_SERVICE_SIM_GET_CPHSINFO :
+                       tcore_user_request_set_command(ur, TREQ_SIM_GET_CPHS_INFO);
+                       break;
+
+               case TAPI_SERVICE_SIM_AUTHENTICATION : {
+                       struct treq_sim_req_authentication req_auth = { 0, };
+                       enum tel_sim_auth_type g_auth_type;
+                       unsigned int g_autn_length;
+                       unsigned char *g_autn_data;
+                       unsigned int g_rand_length;
+                       unsigned char *g_rand_data;
+                       g_auth_type = sipc_util_marshal_object_get_int(in_o, "type");
+                       g_autn_data = sipc_util_marshal_object_get_string(in_o, "autn_data");
+                       g_autn_length = strlen(g_autn_data);
+                       g_rand_data = sipc_util_marshal_object_get_string(in_o, "rand_data");
+                       g_rand_length = strlen(g_rand_data);
+
+                       req_auth.auth_type = g_auth_type;
+                       req_auth.autn_length = g_autn_length;
+                       if(req_auth.autn_length)
+                               memcpy(req_auth.autn_data, g_autn_data, req_auth.autn_length);
+                       req_auth.rand_length = g_rand_length;
+                       if(req_auth.rand_length)
+                               memcpy(req_auth.rand_data, g_rand_data, req_auth.rand_length);
+
+                       tcore_user_request_set_data(ur, sizeof(struct treq_sim_req_authentication), &req_auth);
+                       tcore_user_request_set_command(ur, TREQ_SIM_REQ_AUTHENTICATION);
+               }
+                       break;
+
+               case TAPI_SERVICE_SIM_VERIFYSEC : {
+                       struct treq_sim_verify_pins verify_pins = { 0, };
+                       enum tel_sim_pin_type g_pin_type;
+                       unsigned int g_pin_length;
+                       unsigned char *g_pin;
+                       g_pin_type = sipc_util_marshal_object_get_int(in_o, "type");
+                       g_pin = sipc_util_marshal_object_get_string(in_o, "pw");
+                       g_pin_length = strlen(g_pin);
+
+                       verify_pins.pin_type = g_pin_type;
+                       verify_pins.pin_length = g_pin_length;
+                       memcpy(verify_pins.pin, g_pin, verify_pins.pin_length);
+
+                       tcore_user_request_set_data(ur, sizeof(struct treq_sim_verify_pins), &verify_pins);
+                       tcore_user_request_set_command(ur, TREQ_SIM_VERIFY_PINS);
+               }
+                       break;
+
+               case TAPI_SERVICE_SIM_VERIFYPUK : {
+                       struct treq_sim_verify_puks verify_puks = { 0, };
+                       enum tel_sim_pin_type g_puk_type;
+                       unsigned int g_puk_length;
+                       unsigned char *g_puk;
+                       unsigned int g_pin_length;
+                       unsigned char *g_pin;
+                       g_puk_type = sipc_util_marshal_object_get_int(in_o, "type");
+                       g_puk = sipc_util_marshal_object_get_string(in_o, "puk");
+                       g_puk_length = strlen(g_puk);
+                       g_pin = sipc_util_marshal_object_get_string(in_o, "pin");
+                       g_pin_length = strlen(g_pin);
+
+                       verify_puks.puk_type = g_puk_type;
+                       verify_puks.puk_length = g_puk_length;
+                       memcpy(verify_puks.puk, g_puk, verify_puks.puk_length);
+                       verify_puks.pin_length = g_pin_length;
+                       memcpy(verify_puks.pin, g_pin, verify_puks.pin_length);
+
+                       tcore_user_request_set_data(ur, sizeof(struct treq_sim_verify_puks), &verify_puks);
+                       tcore_user_request_set_command(ur, TREQ_SIM_VERIFY_PUKS);
+               }
+                       break;
+
+               case TAPI_SERVICE_SIM_CHANGEPIN : {
+                       struct treq_sim_change_pins change_pins = { 0, };
+                       enum tel_sim_pin_type g_type;
+                       unsigned int g_old_pw_length;
+                       unsigned char *g_old_pw;
+                       unsigned int g_new_pw_length;
+                       unsigned char *g_new_pw;
+                       g_type = sipc_util_marshal_object_get_int(in_o, "type");
+                       g_old_pw = sipc_util_marshal_object_get_string(in_o, "old_pw");
+                       g_old_pw_length = strlen(g_old_pw);
+                       g_new_pw = sipc_util_marshal_object_get_string(in_o, "new_pw");
+                       g_new_pw_length = strlen(g_new_pw);
+
+                       change_pins.type = g_type;
+                       change_pins.old_pin_length = g_old_pw_length;
+                       memcpy(change_pins.old_pin, g_old_pw, change_pins.old_pin_length);
+                       change_pins.new_pin_length = g_new_pw_length;
+                       memcpy(change_pins.new_pin, g_new_pw, change_pins.new_pin_length);
+
+                       tcore_user_request_set_data(ur, sizeof(struct treq_sim_change_pins), &change_pins);
+                       tcore_user_request_set_command(ur, TREQ_SIM_CHANGE_PINS);
+               }
+                       break;
+
+               case TAPI_SERVICE_SIM_DISABLE_FACILITY : {
+                       struct treq_sim_disable_facility dis_facility = { 0, };
+                       enum tel_sim_facility_type g_dis_type;
+                       unsigned int g_dis_pw_length;
+                       unsigned char *g_dis_pw;
+                       g_dis_type = sipc_util_marshal_object_get_int(in_o, "type");
+                       g_dis_pw = sipc_util_marshal_object_get_string(in_o, "pw");
+                       g_dis_pw_length = strlen(g_dis_pw);
+
+                       dis_facility.type = g_dis_type;
+                       dis_facility.password_length = g_dis_pw_length;
+                       memcpy(dis_facility.password, g_dis_pw, dis_facility.password_length);
+
+                       tcore_user_request_set_data(ur, sizeof(struct treq_sim_disable_facility), &dis_facility);
+                       tcore_user_request_set_command(ur, TREQ_SIM_DISABLE_FACILITY);
+               }
+                       break;
+
+               case TAPI_SERVICE_SIM_ENABLE_FACILITY : {
+                       struct treq_sim_enable_facility en_facility = { 0, };
+                       enum tel_sim_facility_type g_en_type;
+                       unsigned int g_en_pw_length;
+                       unsigned char *g_en_pw;
+                       g_en_type = sipc_util_marshal_object_get_int(in_o, "type");
+                       g_en_pw = sipc_util_marshal_object_get_string(in_o, "pw");
+                       g_en_pw_length = strlen(g_en_pw);
+
+                       en_facility.type = g_en_type;
+                       en_facility.password_length = g_en_pw_length;
+                       memcpy(en_facility.password, g_en_pw, en_facility.password_length);
+
+                       tcore_user_request_set_data(ur, sizeof(struct treq_sim_enable_facility), &en_facility);
+                       tcore_user_request_set_command(ur, TREQ_SIM_ENABLE_FACILITY);
+               }
+                       break;
+
+               case TAPI_SERVICE_SIM_GET_FACILITY : {
+                       struct treq_sim_get_facility_status facility = { 0, };
+                       enum tel_sim_facility_type g_facility_type;
+                       sipc_util_marshal_object_get_data(in_o, "type", (void **)&g_facility_type, TAPI_OBJECT_DATA_TYPE_INT);
+
+                       facility.type = g_facility_type;
+
+                       tcore_user_request_set_data(ur, sizeof(struct treq_sim_get_facility_status), &facility);
+                       tcore_user_request_set_command(ur, TREQ_SIM_GET_FACILITY_STATUS);
+               }
+                       break;
+
+               case TAPI_SERVICE_SIM_APDU : {
+                       struct treq_sim_transmit_apdu send_apdu ={ 0, };
+                       gint g_apdu_length;
+                       gchar *g_apdu;
+                       g_apdu = sipc_util_marshal_object_get_string(in_o, "apdu");
+                       g_apdu_length = strlen(g_apdu);
+
+                       send_apdu.apdu_length = (unsigned int)g_apdu_length;
+                       memcpy(send_apdu.apdu, g_apdu, send_apdu.apdu_length);
+
+                       tcore_user_request_set_data(ur, sizeof(struct treq_sim_transmit_apdu), &send_apdu);
+                       tcore_user_request_set_command(ur, TREQ_SIM_TRANSMIT_APDU);
+               }
+                       break;
+
+               case TAPI_SERVICE_SIM_ATR :
+                       tcore_user_request_set_command(ur, TREQ_SIM_GET_ATR);
+                       break;
+
+               default :
+                       dbg("not handled command [%d] here",cmd);
+                       break;
+       }
+
+       if (cmd == TAPI_SERVICE_SIM_GET_SIMINITINFO || cmd == TAPI_SERVICE_SIM_GET_TYPE
+                       || cmd == TAPI_SERVICE_SIM_GET_IMSI ) {
+               /*synchronous data return case*/
+
+       } else {
+               /*asynchronous data return case*/
+               ret = tcore_communicator_dispatch_request(c, ur);
+               if (ret != TCORE_RETURN_SUCCESS) {
+                       return FALSE;
+               }
+       }
+
+       return TRUE;
+}
+
+gboolean scomm_service_response_sim(Communicator *comm, UserRequest *ur, enum tcore_response_command command,
+               unsigned int data_len, const void *data)
+{
+       const struct tresp_sim_verify_pins *resp_verify_pins = data;
+       const struct tresp_sim_verify_puks *resp_verify_puks = data;
+       const struct tresp_sim_change_pins *resp_change_pins = data;
+       const struct tresp_sim_get_facility_status *resp_get_facility = data;
+       const struct tresp_sim_disable_facility *resp_dis_facility = data;
+       const struct tresp_sim_enable_facility *resp_en_facility = data;
+       const struct tresp_sim_transmit_apdu *resp_apdu = data;
+       const struct tresp_sim_get_atr *resp_get_atr = data;
+       const struct tresp_sim_read *resp_read = data;
+       const struct tresp_sim_req_authentication *resp_auth = data;
+       const struct tresp_sim_set_language *resp_set_language = data;
+       int count =0;
+       int ret = 0, i;
+       gchar *out_d= NULL, *serial_d = NULL;
+       gchar *entry_key = NULL;
+       struct custom_data *ctx = NULL;
+       const struct tcore_user_info *ui;
+       sipc_server_t *s = NULL;
+       struct _tapi_header hdr;
+       struct _sipc_marshal_object* out_o = NULL;
+       struct _sipc_marshal_object* entry_o = NULL;
+
+       memset(&hdr, 0, sizeof(struct _tapi_header));
+
+       ctx = tcore_communicator_ref_user_data(comm);
+       if (!ctx) {
+               dbg("user_data is NULL");
+               return FALSE;
+       }
+
+       ui = tcore_user_request_ref_user_info(ur);
+       s = ctx->sk_server;
+
+       dbg("application channel id(%d), Command = [0x%x], data_len = %d", ui->channel_id, command, data_len);
+       hdr.cmd = (tapi_service_command_e)ui->client_cmd;
+
+       out_o = sipc_util_marshal_object_create();
+
+       switch (command) {
+               case TRESP_SIM_VERIFY_PINS:
+                       dbg("resp comm - TRESP_SIM_VERIFY_PINS");
+                       sipc_util_marshal_object_add_data(out_o, "result", (void*)&resp_verify_pins->result, SIPC_MARSHAL_DATA_INT_TYPE);
+                       sipc_util_marshal_object_add_data(out_o, "type", (void*)&resp_verify_pins->pin_type, SIPC_MARSHAL_DATA_INT_TYPE);
+                       sipc_util_marshal_object_add_data(out_o, "remain_count", (void*)&resp_verify_pins->retry_count, SIPC_MARSHAL_DATA_INT_TYPE);
+                       break;
+
+               case TRESP_SIM_VERIFY_PUKS:
+                       dbg("resp comm - TRESP_SIM_VERIFY_PUKS");
+                       sipc_util_marshal_object_add_data(out_o, "result", (void*)&resp_verify_puks->result, SIPC_MARSHAL_DATA_INT_TYPE);
+                       sipc_util_marshal_object_add_data(out_o, "type", (void*)&resp_verify_puks->pin_type, SIPC_MARSHAL_DATA_INT_TYPE);
+                       sipc_util_marshal_object_add_data(out_o, "remain_count", (void*)&resp_verify_puks->retry_count, SIPC_MARSHAL_DATA_INT_TYPE);
+                       break;
+
+               case TRESP_SIM_CHANGE_PINS:
+                       dbg("resp comm - TRESP_SIM_CHANGE_PINS");
+                       sipc_util_marshal_object_add_data(out_o, "result", (void*)&resp_change_pins->result, SIPC_MARSHAL_DATA_INT_TYPE);
+                       sipc_util_marshal_object_add_data(out_o, "type", (void*)&resp_change_pins->pin_type, SIPC_MARSHAL_DATA_INT_TYPE);
+                       sipc_util_marshal_object_add_data(out_o, "remain_count", (void*)&resp_change_pins->retry_count, SIPC_MARSHAL_DATA_INT_TYPE);
+                       break;
+
+               case TRESP_SIM_GET_FACILITY_STATUS:
+                       dbg("resp comm - TRESP_SIM_GET_FACILITY_STATUS");
+                       sipc_util_marshal_object_add_data(out_o, "result", (void*)&resp_get_facility->result, SIPC_MARSHAL_DATA_INT_TYPE);
+                       sipc_util_marshal_object_add_data(out_o, "type", (void*)&resp_get_facility->type, SIPC_MARSHAL_DATA_INT_TYPE);
+                       sipc_util_marshal_object_add_data(out_o, "enabled", (void*)&resp_get_facility->b_enable, SIPC_MARSHAL_DATA_BOOLEAN_TYPE);
+                       break;
+
+               case TRESP_SIM_DISABLE_FACILITY:
+                       dbg("resp comm - TRESP_SIM_DISABLE_FACILITY");
+                       sipc_util_marshal_object_add_data(out_o, "result", (void*)&resp_dis_facility->result, SIPC_MARSHAL_DATA_INT_TYPE);
+                       sipc_util_marshal_object_add_data(out_o, "type", (void*)&resp_dis_facility->type, SIPC_MARSHAL_DATA_INT_TYPE);
+                       sipc_util_marshal_object_add_data(out_o, "remain_count", (void*)&resp_dis_facility->retry_count, SIPC_MARSHAL_DATA_INT_TYPE);
+                       break;
+
+               case TRESP_SIM_ENABLE_FACILITY:
+                       dbg("resp comm - TRESP_SIM_ENABLE_FACILITY");
+                       sipc_util_marshal_object_add_data(out_o, "result", (void*)&resp_en_facility->result, SIPC_MARSHAL_DATA_INT_TYPE);
+                       sipc_util_marshal_object_add_data(out_o, "type", (void*)&resp_en_facility->type, SIPC_MARSHAL_DATA_INT_TYPE);
+                       sipc_util_marshal_object_add_data(out_o, "remain_count", (void*)&resp_en_facility->retry_count, SIPC_MARSHAL_DATA_INT_TYPE);
+                       break;
+
+               case TRESP_SIM_TRANSMIT_APDU:
+                       dbg("resp comm - TRESP_SIM_TRANSMIT_APDU");
+                       sipc_util_marshal_object_add_data(out_o, "result", (void*)&resp_apdu->result, SIPC_MARSHAL_DATA_INT_TYPE);
+                       sipc_util_marshal_object_add_data(out_o, "apdu", (void*)&resp_apdu->apdu_resp, SIPC_MARSHAL_DATA_STRING_TYPE);
+                       break;
+
+               case TRESP_SIM_GET_ATR:
+                       dbg("resp comm - TRESP_SIM_GET_ATR");
+                       sipc_util_marshal_object_add_data(out_o, "result", (void*)&resp_get_atr->result, SIPC_MARSHAL_DATA_INT_TYPE);
+                       sipc_util_marshal_object_add_data(out_o, "atr", (void*)&resp_get_atr->atr, SIPC_MARSHAL_DATA_STRING_TYPE);
+                       break;
+
+               case TRESP_SIM_REQ_AUTHENTICATION:
+                       dbg("resp comm - TRESP_SIM_REQ_AUTHENTICATION");
+                       sipc_util_marshal_object_add_data(out_o, "result", (void*)&resp_auth->auth_result, SIPC_MARSHAL_DATA_INT_TYPE);
+                       sipc_util_marshal_object_add_data(out_o, "type", (void*)&resp_auth->auth_type, SIPC_MARSHAL_DATA_STRING_TYPE);
+                       if(resp_auth->authentication_key_length)
+                               sipc_util_marshal_object_add_data(out_o, "authentication_key", (void*)&resp_auth->authentication_key, SIPC_MARSHAL_DATA_STRING_TYPE);
+                       if(resp_auth->cipher_length)
+                               sipc_util_marshal_object_add_data(out_o, "cipher_data", (void*)&resp_auth->cipher_data, SIPC_MARSHAL_DATA_STRING_TYPE);
+                       if(resp_auth->integrity_length)
+                               sipc_util_marshal_object_add_data(out_o, "integrity_data", (void*)&resp_auth->integrity_data, SIPC_MARSHAL_DATA_STRING_TYPE);
+                       if(resp_auth->resp_length)
+                               sipc_util_marshal_object_add_data(out_o, "resp_data", (void*)&resp_auth->resp_data, SIPC_MARSHAL_DATA_STRING_TYPE);
+                       break;
+
+               case TRESP_SIM_SET_LANGUAGE:
+                       dbg("resp comm - TRESP_SIM_SET_LANGUAGE");
+                       sipc_util_marshal_object_add_data(out_o, "result", (void*)&resp_set_language->result, SIPC_MARSHAL_DATA_INT_TYPE);
+                       break;
+
+               case TRESP_SIM_GET_ECC:
+                       dbg("resp comm - TRESP_SIM_GET_ECC");
+                       sipc_util_marshal_object_add_data(out_o, "result", (void*)&resp_read->result, SIPC_MARSHAL_DATA_INT_TYPE);
+                       sipc_util_marshal_object_add_data(out_o, "count", (void*)&resp_read->data.ecc.ecc_count, SIPC_MARSHAL_DATA_INT_TYPE);
+                       entry_o = sipc_util_marshal_object_create();
+                       for(i=0;i < resp_read->data.ecc.ecc_count; i++){
+                               gchar *entry_key = NULL;
+                               sipc_util_marshal_object_add_data(entry_o, "name", (void*)&resp_read->data.ecc.ecc[i].ecc_string, SIPC_MARSHAL_DATA_STRING_TYPE);
+                               sipc_util_marshal_object_add_data(entry_o, "number", (void*)&resp_read->data.ecc.ecc[i].ecc_num, SIPC_MARSHAL_DATA_STRING_TYPE);
+                               sipc_util_marshal_object_add_data(entry_o, "category", (void*)&resp_read->data.ecc.ecc[i].ecc_category, SIPC_MARSHAL_DATA_INT_TYPE);
+                               entry_key = g_strdup_printf("%d", i);
+                               sipc_util_marshal_object_add_data(out_o, entry_key, entry_o, SIPC_MARSHAL_DATA_OBJECT_TYPE);
+                       }
+                       break;
+
+               case TRESP_SIM_GET_LANGUAGE:
+                       dbg("resp comm - TRESP_SIM_GET_LANGUAGE");
+                       sipc_util_marshal_object_add_data(out_o, "result", (void*)&resp_read->result, SIPC_MARSHAL_DATA_INT_TYPE);
+                       sipc_util_marshal_object_add_data(out_o, "language", (void*)&resp_read->data.language.language[0] , SIPC_MARSHAL_DATA_INT_TYPE);
+                       break;
+
+               case TRESP_SIM_GET_ICCID:
+                       dbg("resp comm - TRESP_SIM_GET_ICCID");
+                       sipc_util_marshal_object_add_data(out_o, "result", (void*)&resp_read->result, SIPC_MARSHAL_DATA_INT_TYPE);
+                       sipc_util_marshal_object_add_data(out_o, "iccid", (void*)&resp_read->data.iccid.iccid , SIPC_MARSHAL_DATA_STRING_TYPE);
+                       break;
+
+               case TRESP_SIM_GET_MAILBOX:
+                       dbg("resp comm - TRESP_SIM_GET_MAILBOX");
+                       sipc_util_marshal_object_add_data(out_o, "result", (void*)&resp_read->result, SIPC_MARSHAL_DATA_INT_TYPE);
+                       entry_o = sipc_util_marshal_object_create();
+                       if(resp_read->data.mailbox.voice1.DiallingnumLength){
+                               count ++;
+                               sipc_util_marshal_object_add_data(entry_o, "type", "voice1", SIPC_MARSHAL_DATA_STRING_TYPE);
+                               sipc_util_marshal_object_add_data(entry_o, "name", (void*)&resp_read->data.mailbox.voice1.AlphaId, SIPC_MARSHAL_DATA_STRING_TYPE);
+                               sipc_util_marshal_object_add_data(entry_o, "number", (void*)&resp_read->data.mailbox.voice1.DiallingNum , SIPC_MARSHAL_DATA_STRING_TYPE);
+                               sipc_util_marshal_object_add_data(entry_o, "ton", (void*)&resp_read->data.mailbox.voice1.TypeOfNumber , SIPC_MARSHAL_DATA_INT_TYPE);
+                               sipc_util_marshal_object_add_data(entry_o, "npi", (void*)&resp_read->data.mailbox.voice1.NumberingPlanIdent , SIPC_MARSHAL_DATA_INT_TYPE);
+                               entry_key = g_strdup_printf("%d", count);
+                               sipc_util_marshal_object_add_data(out_o, entry_key, entry_o, SIPC_MARSHAL_DATA_OBJECT_TYPE);
+                       }
+
+                       if(resp_read->data.mailbox.voice2.DiallingnumLength){
+                               count ++;
+                               sipc_util_marshal_object_add_data(entry_o, "type", "voice2", SIPC_MARSHAL_DATA_STRING_TYPE);
+                               sipc_util_marshal_object_add_data(entry_o, "name", (void*)&resp_read->data.mailbox.voice2.AlphaId, SIPC_MARSHAL_DATA_STRING_TYPE);
+                               sipc_util_marshal_object_add_data(entry_o, "number", (void*)&resp_read->data.mailbox.voice2.DiallingNum , SIPC_MARSHAL_DATA_STRING_TYPE);
+                               sipc_util_marshal_object_add_data(entry_o, "ton", (void*)&resp_read->data.mailbox.voice2.TypeOfNumber , SIPC_MARSHAL_DATA_INT_TYPE);
+                               sipc_util_marshal_object_add_data(entry_o, "npi", (void*)&resp_read->data.mailbox.voice2.NumberingPlanIdent , SIPC_MARSHAL_DATA_INT_TYPE);
+                               entry_key = g_strdup_printf("%d", count);
+                               sipc_util_marshal_object_add_data(out_o, entry_key, entry_o, SIPC_MARSHAL_DATA_OBJECT_TYPE);
+                       }
+
+                       if(resp_read->data.mailbox.fax.DiallingnumLength){
+                               count ++;
+                               sipc_util_marshal_object_add_data(entry_o, "type", "fax", SIPC_MARSHAL_DATA_STRING_TYPE);
+                               sipc_util_marshal_object_add_data(entry_o, "name", (void*)&resp_read->data.mailbox.fax.AlphaId, SIPC_MARSHAL_DATA_STRING_TYPE);
+                               sipc_util_marshal_object_add_data(entry_o, "number", (void*)&resp_read->data.mailbox.fax.DiallingNum , SIPC_MARSHAL_DATA_STRING_TYPE);
+                               sipc_util_marshal_object_add_data(entry_o, "ton", (void*)&resp_read->data.mailbox.fax.TypeOfNumber , SIPC_MARSHAL_DATA_INT_TYPE);
+                               sipc_util_marshal_object_add_data(entry_o, "npi", (void*)&resp_read->data.mailbox.fax.NumberingPlanIdent , SIPC_MARSHAL_DATA_INT_TYPE);
+                               entry_key = g_strdup_printf("%d", count);
+                               sipc_util_marshal_object_add_data(out_o, entry_key, entry_o, SIPC_MARSHAL_DATA_OBJECT_TYPE);
+                       }
+
+                       if(resp_read->data.mailbox.video.DiallingnumLength){
+                               count ++;
+                               sipc_util_marshal_object_add_data(entry_o, "type", "video", SIPC_MARSHAL_DATA_STRING_TYPE);
+                               sipc_util_marshal_object_add_data(entry_o, "name", (void*)&resp_read->data.mailbox.video.AlphaId, SIPC_MARSHAL_DATA_STRING_TYPE);
+                               sipc_util_marshal_object_add_data(entry_o, "number", (void*)&resp_read->data.mailbox.video.DiallingNum , SIPC_MARSHAL_DATA_STRING_TYPE);
+                               sipc_util_marshal_object_add_data(entry_o, "ton", (void*)&resp_read->data.mailbox.video.TypeOfNumber , SIPC_MARSHAL_DATA_INT_TYPE);
+                               sipc_util_marshal_object_add_data(entry_o, "npi", (void*)&resp_read->data.mailbox.video.NumberingPlanIdent , SIPC_MARSHAL_DATA_INT_TYPE);
+                               entry_key = g_strdup_printf("%d", count);
+                               sipc_util_marshal_object_add_data(out_o, entry_key, entry_o, SIPC_MARSHAL_DATA_OBJECT_TYPE);
+                       }
+                       break;
+
+               case TRESP_SIM_GET_CALLFORWARDING:
+                       dbg("resp comm - TRESP_SIM_GET_CALLFORWARDING");
+                       sipc_util_marshal_object_add_data(out_o, "result", (void*)&resp_read->result, SIPC_MARSHAL_DATA_INT_TYPE);
+                       sipc_util_marshal_object_add_data(out_o, "line1_status", (void*)&resp_read->data.cf.voice1, SIPC_MARSHAL_DATA_BOOLEAN_TYPE);
+                       sipc_util_marshal_object_add_data(out_o, "line2_status", (void*)&resp_read->data.cf.voice2, SIPC_MARSHAL_DATA_BOOLEAN_TYPE);
+                       break;
+
+               case TRESP_SIM_GET_MESSAGEWAITING:
+                       dbg("resp comm - TRESP_SIM_GET_MESSAGEWAITING");
+                       sipc_util_marshal_object_add_data(out_o, "result", (void*)&resp_read->result, SIPC_MARSHAL_DATA_INT_TYPE);
+                       if (resp_read->data.mw.b_cphs) {
+                               sipc_util_marshal_object_add_data(out_o, "line1_count", (void*)&resp_read->data.mw.mw_data_u.cphs_mw.b_voice1, SIPC_MARSHAL_DATA_INT_TYPE);
+                               sipc_util_marshal_object_add_data(out_o, "line2_count", (void*)&resp_read->data.mw.mw_data_u.cphs_mw.b_voice2, SIPC_MARSHAL_DATA_INT_TYPE);
+                               sipc_util_marshal_object_add_data(out_o, "fax_count", (void*)&resp_read->data.mw.mw_data_u.cphs_mw.b_fax, SIPC_MARSHAL_DATA_INT_TYPE);
+                               sipc_util_marshal_object_add_data(out_o, "video_count", (void*)&resp_read->data.mw.mw_data_u.cphs_mw.b_data, SIPC_MARSHAL_DATA_INT_TYPE);
+                       } else {
+                               sipc_util_marshal_object_add_data(out_o, "line1_count", (void*)&resp_read->data.mw.mw_data_u.mw.voice_count, SIPC_MARSHAL_DATA_INT_TYPE);
+/*                             sipc_util_marshal_object_add_data(out_o, "line2_count", (void*)&resp_read->result, SIPC_MARSHAL_DATA_INT_TYPE);*/
+                               sipc_util_marshal_object_add_data(out_o, "fax_count", (void*)&resp_read->data.mw.mw_data_u.mw.fax_count, SIPC_MARSHAL_DATA_INT_TYPE);
+                               sipc_util_marshal_object_add_data(out_o, "video_count", (void*)&resp_read->data.mw.mw_data_u.mw.video_count, SIPC_MARSHAL_DATA_INT_TYPE);
+                       }
+                       break;
+
+               case TRESP_SIM_GET_CPHS_INFO:
+                       dbg("resp comm - TRESP_SIM_GET_CPHS_INFO");
+                       sipc_util_marshal_object_add_data(out_o, "result", (void*)&resp_read->result, SIPC_MARSHAL_DATA_INT_TYPE);
+                       break;
+
+               case TRESP_SIM_GET_MSISDN:
+                       dbg("resp comm - TRESP_SIM_GET_MSISDN");
+                       sipc_util_marshal_object_add_data(out_o, "result", (void*)&resp_read->result, SIPC_MARSHAL_DATA_INT_TYPE);
+                       sipc_util_marshal_object_add_data(out_o, "count", (void*)&resp_read->data.msisdn_list.count, SIPC_MARSHAL_DATA_INT_TYPE);
+                       entry_o = sipc_util_marshal_object_create();
+                       for(i=0;i < resp_read->data.msisdn_list.count; i++){
+                               gchar *entry_key = NULL;
+                               sipc_util_marshal_object_add_data(entry_o, "name", (void*)&resp_read->data.msisdn_list.msisdn[i].name, SIPC_MARSHAL_DATA_STRING_TYPE);
+                               sipc_util_marshal_object_add_data(entry_o, "number", (void*)&resp_read->data.msisdn_list.msisdn[i].num, SIPC_MARSHAL_DATA_STRING_TYPE);
+                               entry_key = g_strdup_printf("%d", i);
+                               sipc_util_marshal_object_add_data(out_o, entry_key, entry_o, SIPC_MARSHAL_DATA_OBJECT_TYPE);
+                       }
+                       break;
+
+               case TRESP_SIM_GET_OPLMNWACT:
+                       dbg("resp comm - TRESP_SIM_GET_OPLMNWACT");
+                       sipc_util_marshal_object_add_data(out_o, "result", (void*)&resp_read->result, SIPC_MARSHAL_DATA_INT_TYPE);
+                       sipc_util_marshal_object_add_data(out_o, "count", (void*)&resp_read->data.opwa.opwa_count, SIPC_MARSHAL_DATA_INT_TYPE);
+                       entry_o = sipc_util_marshal_object_create();
+                       for(i=0;i < resp_read->data.opwa.opwa_count; i++){
+                               gchar *entry_key = NULL;
+                               sipc_util_marshal_object_add_data(entry_o, "plmn", (void*)&resp_read->data.opwa.opwa[i].plmn, SIPC_MARSHAL_DATA_STRING_TYPE);
+                               sipc_util_marshal_object_add_data(entry_o, "b_umts", (void*)&resp_read->data.opwa.opwa[i].b_umts, SIPC_MARSHAL_DATA_BOOLEAN_TYPE);
+                               sipc_util_marshal_object_add_data(entry_o, "b_gsm", (void*)&resp_read->data.opwa.opwa[i].b_gsm, SIPC_MARSHAL_DATA_BOOLEAN_TYPE);
+                               entry_key = g_strdup_printf("%d", i);
+                               sipc_util_marshal_object_add_data(out_o, entry_key, entry_o, SIPC_MARSHAL_DATA_OBJECT_TYPE);
+                       }
+                       break;
+
+               default:
+                       dbg("not handled command [%d] here",command);
+                       break;
+       }
+
+       if(out_o){
+               serial_d = sipc_util_marshal_object_serializer(out_o);
+               hdr.data_len = strlen(serial_d);
+               sipc_util_marshal_object_destory(out_o);
+       }
+
+       out_d = g_new0(char, sizeof(struct _tapi_header)+hdr.data_len);
+       memcpy(out_d, &hdr, sizeof(struct _tapi_header));
+       if(serial_d){
+               memcpy(out_d+sizeof(struct _tapi_header), serial_d, hdr.data_len);
+               g_free(serial_d);
+       }
+
+       ret = sipc_server_send(s, ui->channel_id, out_d, sizeof(struct _tapi_header)+hdr.data_len, SIPC_SEND_DATA_ASYNC);
+       g_free(out_d);
+
+       if(ret < 0){
+               return FALSE;
+       }
+
+       return TRUE;
+}
+
+
+gboolean scomm_service_notification_sim(Communicator *comm, CoreObject *source, enum tcore_notification_command command,
+               unsigned int data_len, const void *data)
+{
+       const struct tnoti_sim_status *n_sim_status = data;
+       int ret = 0;
+       gchar *out_d = NULL, *serial_d = NULL;
+
+       struct custom_data *ctx = NULL;
+       sipc_server_t *s = NULL;
+
+       struct _tapi_header hdr;
+       struct _sipc_marshal_object* out_o = NULL;
+
+       memset(&hdr, 0, sizeof(struct _tapi_header));
+
+       ctx = tcore_communicator_ref_user_data(comm);
+       if (!ctx) {
+               dbg("user_data is NULL");
+               return FALSE;
+       }
+
+       s = ctx->sk_server;
+       dbg("notification !!! (command = 0x%x, data_len = %d)", command, data_len);
+
+       out_o = sipc_util_marshal_object_create();
+
+       switch (command) {
+               case TNOTI_SIM_STATUS :
+                       dbg("notified sim_status[%d]", n_sim_status->sim_status);
+                       sipc_util_marshal_object_add_data(out_o, "status", (void*)&n_sim_status->sim_status, SIPC_MARSHAL_DATA_INT_TYPE);
+                       sipc_util_marshal_object_add_data(out_o, "new_sim", (void*)&n_sim_status->b_changed, SIPC_MARSHAL_DATA_BOOLEAN_TYPE);
+                       break;
+
+               default :
+                       dbg("not handled command [%d] here",command);
+                       break;
+       }
+
+       if(out_o){
+               serial_d = sipc_util_marshal_object_serializer(out_o);
+               hdr.data_len = strlen(serial_d);
+               sipc_util_marshal_object_destory(out_o);
+       }
+
+       out_d = g_new0(char, sizeof(struct _tapi_header)+hdr.data_len);
+       memcpy(out_d, &hdr, sizeof(struct _tapi_header));
+       if(serial_d){
+               memcpy(out_d+sizeof(struct _tapi_header), serial_d, hdr.data_len);
+               g_free(serial_d);
+       }
+
+       ret = sipc_server_broadcast(s, out_d, sizeof(struct _tapi_header)+hdr.data_len);
+       g_free(out_d);
+
+       if(ret < 0){
+               return FALSE;
+       }
+       return TRUE;
+}
diff --git a/plugin/src/socket_sms.c b/plugin/src/socket_sms.c
new file mode 100644 (file)
index 0000000..a2a105d
--- /dev/null
@@ -0,0 +1,1127 @@
+/*
+ * tel-plugin-socket-communicator
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Ja-young Gu <jygu@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <glib-object.h>
+
+#include <aul.h>
+#include <bundle.h>
+#include <tcore.h>
+#include <server.h>
+#include <plugin.h>
+#include <hal.h>
+#include <communicator.h>
+#include <core_object.h>
+#include <queue.h>
+#include <user_request.h>
+#include <util.h>
+#include <co_call.h>
+
+#include "sipc.h"
+#include "tapi_common.h"
+#include "module_req.h"
+
+gboolean scomm_service_request_sms(unsigned int ch_id, Communicator *comm, TcorePlugin *plugin,  tapi_service_command_e cmd, gchar *data, void **outparam)
+{
+       struct _sipc_marshal_object *reqObj;
+       GSList *co_smslist = NULL;
+       CoreObject *co_sms = NULL;
+       UserRequest *ur = NULL;
+       struct tcore_user_info ui = { 0, 0, 0, NULL, 0, 0, NULL };
+       TReturn ret = TCORE_RETURN_SUCCESS;
+       int request_id = 0;
+
+       struct treq_sms_send_umts_msg sendUmtsMsg = {0,};
+       struct treq_sms_send_cdma_msg cdmaMsg = {0,};
+       struct treq_sms_read_msg readMsg = {0,};
+       struct treq_sms_save_msg saveMsg = {0,};
+       struct treq_sms_delete_msg deleteMsg = {0,};
+       struct treq_sms_get_msg_count getMsgCnt;
+       struct treq_sms_get_sca getSca = {0,};
+       struct treq_sms_set_sca setSca = {0,};
+       struct treq_sms_get_cb_config getCbConfig;
+       struct treq_sms_set_cb_config setCbConfig = {0,};
+       struct treq_sms_set_mem_status memStatus = {0,};
+       struct treq_sms_get_pref_brearer getPrefBrearer;
+       struct treq_sms_set_pref_brearer setPrefBrearer = {0,};
+       struct treq_sms_set_delivery_report deliveryReport = {0,};
+       struct treq_sms_set_msg_status msgStatus = {0,};
+       struct treq_sms_get_params getParams = {0,};
+       struct treq_sms_set_params setParams = {0,};
+       struct treq_sms_get_paramcnt getParamCnt;
+
+       co_smslist = tcore_plugin_get_core_objects_bytype(plugin, CORE_OBJECT_TYPE_SMS);
+       if (!co_smslist) {
+               err("[tcore_SMS] plugin_get_core_objects_bytype is NULL");
+               return FALSE;
+       }
+
+       co_sms = (CoreObject *)co_smslist->data;
+       g_slist_free(co_smslist);
+
+       if (!co_sms) {
+               err("[tcore_SMS] co_sms is NULL !!!");
+               return FALSE;
+       }
+
+       ur = tcore_user_request_new(comm, tcore_plugin_get_description(plugin)->name);
+       ui.channel_id = ch_id;
+       ui.client_cmd = (unsigned int)cmd;
+
+       tcore_user_request_set_user_info(ur, &ui);
+
+       reqObj = sipc_util_marshal_object_deserializer(data);
+
+       switch (cmd) {
+               case TAPI_SERVICE_SMS_SEND_UMTS_MSG: {
+                       gchar *sca;
+                       gchar *szData;
+
+                       sca = sipc_util_marshal_object_get_string(reqObj, "Sca");
+                       memcpy(&(sendUmtsMsg.msgDataPackage.sca[0]), sca, SMS_SMSP_ADDRESS_LEN);
+                       sendUmtsMsg.msgDataPackage.msgLength = sipc_util_marshal_object_get_int(reqObj, "MsgLength");
+                       szData = sipc_util_marshal_object_get_string(reqObj, "szData");
+                       memcpy(&(sendUmtsMsg.msgDataPackage.tpduData[0]), szData, SMS_SMDATA_SIZE_MAX + 1);
+                       sendUmtsMsg.more = sipc_util_marshal_object_get_int(reqObj, "More");
+                       
+                       tcore_user_request_set_data(ur, sizeof(struct treq_sms_send_umts_msg), &sendUmtsMsg);
+                       tcore_user_request_set_command(ur, TREQ_SMS_SEND_UMTS_MSG);
+
+                       ret = tcore_communicator_dispatch_request(comm, ur);
+                       if (ret != TCORE_RETURN_SUCCESS) {
+                               // api_err = TAPI_API_OPERATION_FAILED;
+                               err("[tcore_SMS] communicator_dispatch_request is fail [0x%x] !!!", ret);
+                       }
+                       
+                       }
+                       break;
+
+               case TAPI_SERVICE_SMS_SEND_CDMA_MSG: {
+                       
+                       cdmaMsg.more = sipc_util_marshal_object_get_int(reqObj, "More");
+                       cdmaMsg.cdmaMsgInfo.ParamMask = sipc_util_marshal_object_get_int(reqObj, "ParamMask");
+                       cdmaMsg.cdmaMsgInfo.MsgType = sipc_util_marshal_object_get_int(reqObj, "MsgType");
+                       
+                       switch(cdmaMsg.cdmaMsgInfo.MsgType)
+                       {
+                               case SMS_MESSAGETYPE_SUBMIT: {
+                                       gchar *dstAddr_szAddress;
+                                       gchar *dstSubAddr_szAddress;
+                                       gchar *szData;
+                                       gchar *callBackNumer_szAddress;
+                                       
+                                       /* Origination address */
+                                       cdmaMsg.cdmaMsgInfo.MsgData.outSubmit.DstAddr.Digit = sipc_util_marshal_object_get_int(reqObj, "DstAddr.Digit");
+                                       cdmaMsg.cdmaMsgInfo.MsgData.outSubmit.DstAddr.NumberMode = sipc_util_marshal_object_get_int(reqObj, "DstAddr.NumberMode"); 
+                                       cdmaMsg.cdmaMsgInfo.MsgData.outSubmit.DstAddr.NumberType = sipc_util_marshal_object_get_int(reqObj, "DstAddr.NumberType"); 
+                                       cdmaMsg.cdmaMsgInfo.MsgData.outSubmit.DstAddr.NumberPlan = sipc_util_marshal_object_get_int(reqObj, "DstAddr.NumberPlan"); 
+                                       cdmaMsg.cdmaMsgInfo.MsgData.outSubmit.DstAddr.szAddrLength = sipc_util_marshal_object_get_char(reqObj, "DstAddr.szAddrLength"); 
+                                       dstAddr_szAddress = sipc_util_marshal_object_get_string(reqObj, "DstAddr.szAddress"); 
+                                       memcpy(&(cdmaMsg.cdmaMsgInfo.MsgData.outSubmit.DstAddr.szAddress[0]), dstAddr_szAddress, SMS_MAXLENGTH_SMS_ADDRESS);
+                                       
+                                       /* Origination subaddress */
+                                       cdmaMsg.cdmaMsgInfo.MsgData.outSubmit.DstSubAddr.SubType = sipc_util_marshal_object_get_int(reqObj, "DstSubAddr.SubType");
+                                       cdmaMsg.cdmaMsgInfo.MsgData.outSubmit.DstSubAddr.Odd = sipc_util_marshal_object_get_char(reqObj, "DstSubAddr.Odd"); 
+                                       cdmaMsg.cdmaMsgInfo.MsgData.outSubmit.DstSubAddr.szAddrLength = sipc_util_marshal_object_get_char(reqObj, "DstSubAddr.szAddrLength"); 
+                                       dstSubAddr_szAddress = sipc_util_marshal_object_get_string(reqObj, "DstSubAddr.szAddress");
+                                       memcpy(&(cdmaMsg.cdmaMsgInfo.MsgData.outSubmit.DstSubAddr.szAddress[0]), dstSubAddr_szAddress, SMS_MAXLENGTH_SMS_ADDRESS);
+                                       
+                                       cdmaMsg.cdmaMsgInfo.MsgData.outSubmit.TeleService = sipc_util_marshal_object_get_int(reqObj, "TeleService");
+                                       cdmaMsg.cdmaMsgInfo.MsgData.outSubmit.bBearerReplySeqRequest = sipc_util_marshal_object_get_int(reqObj, "bBearerReplySeqRequest");
+                                       cdmaMsg.cdmaMsgInfo.MsgData.outSubmit.ReplySeqNumber = sipc_util_marshal_object_get_char(reqObj, "ReplySeqNumber");
+                                       cdmaMsg.cdmaMsgInfo.MsgData.outSubmit.MsgId = sipc_util_marshal_object_get_int(reqObj, "MsgId");
+                                       cdmaMsg.cdmaMsgInfo.MsgData.outSubmit.MsgEncoding = sipc_util_marshal_object_get_int(reqObj, "MsgEncoding");
+                                       cdmaMsg.cdmaMsgInfo.MsgData.outSubmit.MsgLength = sipc_util_marshal_object_get_int(reqObj, "MsgLength");
+                                       szData = sipc_util_marshal_object_get_string(reqObj, "szData");
+                                       memcpy(&(cdmaMsg.cdmaMsgInfo.MsgData.outSubmit.szData[0]), szData, SMS_MAXLENGTH_SMS_MO_USER_DATA);
+
+                                       /* Validity period - Absolute */
+                                       cdmaMsg.cdmaMsgInfo.MsgData.outSubmit.ValidityPeriodAbs.year = sipc_util_marshal_object_get_int(reqObj, "ValidityPeriodAbs.year");
+                                       cdmaMsg.cdmaMsgInfo.MsgData.outSubmit.ValidityPeriodAbs.month = sipc_util_marshal_object_get_int(reqObj, "ValidityPeriodAbs.month");
+                                       cdmaMsg.cdmaMsgInfo.MsgData.outSubmit.ValidityPeriodAbs.day = sipc_util_marshal_object_get_int(reqObj, "ValidityPeriodAbs.day");
+                                       cdmaMsg.cdmaMsgInfo.MsgData.outSubmit.ValidityPeriodAbs.hours = sipc_util_marshal_object_get_int(reqObj, "ValidityPeriodAbs.hours");
+                                       cdmaMsg.cdmaMsgInfo.MsgData.outSubmit.ValidityPeriodAbs.minutes = sipc_util_marshal_object_get_int(reqObj, "ValidityPeriodAbs.minutes");
+                                       cdmaMsg.cdmaMsgInfo.MsgData.outSubmit.ValidityPeriodAbs.seconds = sipc_util_marshal_object_get_int(reqObj, "ValidityPeriodAbs.seconds");
+
+                                       cdmaMsg.cdmaMsgInfo.MsgData.outSubmit.ValidityPeriodRel = sipc_util_marshal_object_get_char(reqObj, "ValidityPeriodRel");
+
+                                       /* Deferred delivery time - Absolute (not supported) */
+                                       cdmaMsg.cdmaMsgInfo.MsgData.outSubmit.DeferredDelTimeAbs.year = sipc_util_marshal_object_get_int(reqObj, "DeferredDelTimeAbs.year");
+                                       cdmaMsg.cdmaMsgInfo.MsgData.outSubmit.DeferredDelTimeAbs.month = sipc_util_marshal_object_get_int(reqObj, "DeferredDelTimeAbs.month");
+                                       cdmaMsg.cdmaMsgInfo.MsgData.outSubmit.DeferredDelTimeAbs.day = sipc_util_marshal_object_get_int(reqObj, "DeferredDelTimeAbs.day");
+                                       cdmaMsg.cdmaMsgInfo.MsgData.outSubmit.DeferredDelTimeAbs.hours = sipc_util_marshal_object_get_int(reqObj, "DeferredDelTimeAbs.hours");
+                                       cdmaMsg.cdmaMsgInfo.MsgData.outSubmit.DeferredDelTimeAbs.minutes = sipc_util_marshal_object_get_int(reqObj, "DeferredDelTimeAbs.minutes");
+                                       cdmaMsg.cdmaMsgInfo.MsgData.outSubmit.DeferredDelTimeAbs.seconds = sipc_util_marshal_object_get_int(reqObj, "DeferredDelTimeAbs.seconds");
+
+                                       /* Deferred delivery time - Relative (not supported) */
+                                       cdmaMsg.cdmaMsgInfo.MsgData.outSubmit.DeferredDelTimeRel = sipc_util_marshal_object_get_char(reqObj, "DeferredDelTimeRel");
+                                       
+                                       cdmaMsg.cdmaMsgInfo.MsgData.outSubmit.Priority = sipc_util_marshal_object_get_int(reqObj, "Priority");
+                                       cdmaMsg.cdmaMsgInfo.MsgData.outSubmit.Privacy = sipc_util_marshal_object_get_int(reqObj, "Privacy");
+                                       cdmaMsg.cdmaMsgInfo.MsgData.outSubmit.bUserAckRequest = sipc_util_marshal_object_get_int(reqObj, "bUserAckRequest");
+                                       cdmaMsg.cdmaMsgInfo.MsgData.outSubmit.bDeliveryAckRequest = sipc_util_marshal_object_get_int(reqObj, "bDeliveryAckRequest");
+                                       cdmaMsg.cdmaMsgInfo.MsgData.outSubmit.AlertPriority= sipc_util_marshal_object_get_int(reqObj, "AlertPriority");
+                                       cdmaMsg.cdmaMsgInfo.MsgData.outSubmit.MsgLang= sipc_util_marshal_object_get_int(reqObj, "MsgLang");
+
+                                       /* Callback number address */
+                                       cdmaMsg.cdmaMsgInfo.MsgData.outSubmit.CallBackNumber.Digit = sipc_util_marshal_object_get_int(reqObj, "CallBackNumer.Digit");
+                                       cdmaMsg.cdmaMsgInfo.MsgData.outSubmit.CallBackNumber.NumberMode = sipc_util_marshal_object_get_int(reqObj, "CallBackNumer.NumberMode");
+                                       cdmaMsg.cdmaMsgInfo.MsgData.outSubmit.CallBackNumber.NumberType = sipc_util_marshal_object_get_int(reqObj, "CallBackNumer.NumberType");
+                                       cdmaMsg.cdmaMsgInfo.MsgData.outSubmit.CallBackNumber.NumberPlan = sipc_util_marshal_object_get_int(reqObj, "CallBackNumer.NumberPlan");
+                                       cdmaMsg.cdmaMsgInfo.MsgData.outSubmit.CallBackNumber.szAddrLength = sipc_util_marshal_object_get_char(reqObj, "CallBackNumer.szAddrLength");
+                                       callBackNumer_szAddress = sipc_util_marshal_object_get_string(reqObj, "CallBackNumer.szAddress");
+                                       memcpy(&(cdmaMsg.cdmaMsgInfo.MsgData.outSubmit.CallBackNumber.szAddress[0]), callBackNumer_szAddress, SMS_MAXLENGTH_SMS_ADDRESS);
+
+                                       }
+                                       break;
+                                       
+                               case SMS_MESSAGETYPE_CANCEL: {
+                                       gchar *dstAddr_szAddress;
+                                       gchar *dstSubAddr_szAddress;
+                                       
+                                       /* Origination address */
+                                       cdmaMsg.cdmaMsgInfo.MsgData.outCancel.DstAddr.Digit = sipc_util_marshal_object_get_int(reqObj, "DstAddr.Digit");
+                                       cdmaMsg.cdmaMsgInfo.MsgData.outCancel.DstAddr.NumberMode = sipc_util_marshal_object_get_int(reqObj, "DstAddr.NumberMode"); 
+                                       cdmaMsg.cdmaMsgInfo.MsgData.outCancel.DstAddr.NumberType = sipc_util_marshal_object_get_int(reqObj, "DstAddr.NumberType"); 
+                                       cdmaMsg.cdmaMsgInfo.MsgData.outCancel.DstAddr.NumberPlan = sipc_util_marshal_object_get_int(reqObj, "DstAddr.NumberPlan"); 
+                                       cdmaMsg.cdmaMsgInfo.MsgData.outCancel.DstAddr.szAddrLength = sipc_util_marshal_object_get_char(reqObj, "DstAddr.szAddrLength"); 
+                                       dstAddr_szAddress = sipc_util_marshal_object_get_string(reqObj, "DstAddr.szAddress"); 
+                                       memcpy(&(cdmaMsg.cdmaMsgInfo.MsgData.outCancel.DstAddr.szAddress[0]), dstAddr_szAddress, SMS_MAXLENGTH_SMS_ADDRESS);
+                                       
+                                       /* Origination subaddress */
+                                       cdmaMsg.cdmaMsgInfo.MsgData.outCancel.DstSubAddr.SubType = sipc_util_marshal_object_get_int(reqObj, "DstSubAddr.SubType");
+                                       cdmaMsg.cdmaMsgInfo.MsgData.outCancel.DstSubAddr.Odd = sipc_util_marshal_object_get_char(reqObj, "DstSubAddr.Odd"); 
+                                       cdmaMsg.cdmaMsgInfo.MsgData.outCancel.DstSubAddr.szAddrLength = sipc_util_marshal_object_get_char(reqObj, "DstSubAddr.szAddrLength"); 
+                                       dstSubAddr_szAddress = sipc_util_marshal_object_get_string(reqObj, "DstSubAddr.szAddress");
+                                       memcpy(&(cdmaMsg.cdmaMsgInfo.MsgData.outCancel.DstSubAddr.szAddress[0]), dstSubAddr_szAddress, SMS_MAXLENGTH_SMS_ADDRESS);
+                                       
+                                       cdmaMsg.cdmaMsgInfo.MsgData.outCancel.TeleService = sipc_util_marshal_object_get_int(reqObj, "TeleService");
+                                       cdmaMsg.cdmaMsgInfo.MsgData.outCancel.bBearerReplySeqRequest = sipc_util_marshal_object_get_int(reqObj, "bBearerReplySeqRequest");
+                                       cdmaMsg.cdmaMsgInfo.MsgData.outCancel.ReplySeqNumber = sipc_util_marshal_object_get_char(reqObj, "ReplySeqNumber");
+                                       cdmaMsg.cdmaMsgInfo.MsgData.outCancel.MsgId = sipc_util_marshal_object_get_int(reqObj, "MsgId");
+
+                                       }
+                                       break;
+                                       
+                               case SMS_MESSAGETYPE_USER_ACK: {
+                                       gchar *dstAddr_szAddress;
+                                       gchar *dstSubAddr_szAddress;
+                                       gchar *szData;
+                                       
+                                       /* Origination address */
+                                       cdmaMsg.cdmaMsgInfo.MsgData.outAck.DstAddr.Digit = sipc_util_marshal_object_get_int(reqObj, "DstAddr.Digit");
+                                       cdmaMsg.cdmaMsgInfo.MsgData.outAck.DstAddr.NumberMode = sipc_util_marshal_object_get_int(reqObj, "DstAddr.NumberMode"); 
+                                       cdmaMsg.cdmaMsgInfo.MsgData.outAck.DstAddr.NumberType = sipc_util_marshal_object_get_int(reqObj, "DstAddr.NumberType"); 
+                                       cdmaMsg.cdmaMsgInfo.MsgData.outAck.DstAddr.NumberPlan = sipc_util_marshal_object_get_int(reqObj, "DstAddr.NumberPlan"); 
+                                       cdmaMsg.cdmaMsgInfo.MsgData.outAck.DstAddr.szAddrLength = sipc_util_marshal_object_get_char(reqObj, "DstAddr.szAddrLength"); 
+                                       dstAddr_szAddress = sipc_util_marshal_object_get_string(reqObj, "DstAddr.szAddress"); 
+                                       memcpy(&(cdmaMsg.cdmaMsgInfo.MsgData.outAck.DstAddr.szAddress[0]), dstAddr_szAddress, SMS_MAXLENGTH_SMS_ADDRESS);
+                                       
+                                       /* Origination subaddress */
+                                       cdmaMsg.cdmaMsgInfo.MsgData.outAck.DstSubAddr.SubType = sipc_util_marshal_object_get_int(reqObj, "DstSubAddr.SubType");
+                                       cdmaMsg.cdmaMsgInfo.MsgData.outAck.DstSubAddr.Odd = sipc_util_marshal_object_get_char(reqObj, "DstSubAddr.Odd"); 
+                                       cdmaMsg.cdmaMsgInfo.MsgData.outAck.DstSubAddr.szAddrLength = sipc_util_marshal_object_get_char(reqObj, "DstSubAddr.szAddrLength"); 
+                                       dstSubAddr_szAddress = sipc_util_marshal_object_get_string(reqObj, "DstSubAddr.szAddress");
+                                       memcpy(&(cdmaMsg.cdmaMsgInfo.MsgData.outAck.DstSubAddr.szAddress[0]), dstSubAddr_szAddress, SMS_MAXLENGTH_SMS_ADDRESS);
+                                       
+                                       cdmaMsg.cdmaMsgInfo.MsgData.outAck.TeleService = sipc_util_marshal_object_get_int(reqObj, "TeleService");
+                                       cdmaMsg.cdmaMsgInfo.MsgData.outAck.bBearerReplySeqRequest = sipc_util_marshal_object_get_int(reqObj, "bBearerReplySeqRequest");
+                                       cdmaMsg.cdmaMsgInfo.MsgData.outAck.ReplySeqNumber = sipc_util_marshal_object_get_char(reqObj, "ReplySeqNumber");
+                                       cdmaMsg.cdmaMsgInfo.MsgData.outAck.MsgId = sipc_util_marshal_object_get_int(reqObj, "MsgId");
+                                       cdmaMsg.cdmaMsgInfo.MsgData.outAck.MsgEncoding = sipc_util_marshal_object_get_int(reqObj, "MsgEncoding");
+                                       cdmaMsg.cdmaMsgInfo.MsgData.outAck.MsgLength = sipc_util_marshal_object_get_int(reqObj, "MsgLength");
+                                       szData = sipc_util_marshal_object_get_string(reqObj, "szData");
+                                       memcpy(&(cdmaMsg.cdmaMsgInfo.MsgData.outAck.szData[0]), szData, SMS_MAXLENGTH_SMS_MO_USER_DATA);
+                                       cdmaMsg.cdmaMsgInfo.MsgData.outAck.UserResponseCode = sipc_util_marshal_object_get_char(reqObj, "UserResponseCode");
+
+                                       }
+                                       break;
+                               default:
+                                       break;
+                       }
+                       
+                       tcore_user_request_set_data(ur, sizeof(struct treq_sms_send_cdma_msg), &cdmaMsg);
+                       tcore_user_request_set_command(ur, TREQ_SMS_SEND_CDMA_MSG);
+
+                       ret = tcore_communicator_dispatch_request(comm, ur);
+                       if (ret != TCORE_RETURN_SUCCESS) {
+                               // api_err = TAPI_API_OPERATION_FAILED;
+                               err("[tcore_SMS] communicator_dispatch_request is fail [0x%x] !!!", ret);                               
+                       }
+                       
+                       }
+                       break;
+
+               case TAPI_SERVICE_SMS_READ_MSG: {
+                       
+                       readMsg.index = sipc_util_marshal_object_get_int(reqObj, "Index");
+
+                       tcore_user_request_set_data(ur, sizeof(struct treq_sms_read_msg), &readMsg);
+                       tcore_user_request_set_command(ur, TREQ_SMS_READ_MSG);
+
+                       ret = tcore_communicator_dispatch_request(comm, ur);
+                       if (ret != TCORE_RETURN_SUCCESS) {
+                               // api_err = TAPI_API_OPERATION_FAILED;
+                               err("[tcore_SMS] communicator_dispatch_request is fail [0x%x] !!!", ret);                               
+                       }
+
+                       }
+                       break;
+
+               case TAPI_SERVICE_SMS_SAVE_MSG: {
+                       gchar *sca;
+                       gchar *szData;
+
+                       saveMsg.simIndex = sipc_util_marshal_object_get_int(reqObj, "Index");
+                       saveMsg.msgStatus = sipc_util_marshal_object_get_int(reqObj, "MsgStatus");
+                       sca = sipc_util_marshal_object_get_string(reqObj, "Sca");
+                       memcpy(&(saveMsg.msgDataPackage.sca[0]), sca, SMS_SMSP_ADDRESS_LEN);
+                       saveMsg.msgDataPackage.msgLength = sipc_util_marshal_object_get_int(reqObj, "MsgLength");
+                       szData = sipc_util_marshal_object_get_string(reqObj, "szData");
+                       memcpy(saveMsg.msgDataPackage.tpduData, szData, SMS_SMDATA_SIZE_MAX + 1);
+
+                       tcore_user_request_set_data(ur, sizeof(struct treq_sms_save_msg), &saveMsg);
+                       tcore_user_request_set_command(ur, TREQ_SMS_SAVE_MSG);
+
+                       ret = tcore_communicator_dispatch_request(comm, ur);
+                       if (ret != TCORE_RETURN_SUCCESS) {
+                               // api_err = TAPI_API_OPERATION_FAILED;
+                               err("[tcore_SMS] communicator_dispatch_request is fail [0x%x] !!!", ret);                               
+                       }
+
+                       }
+                       break;
+
+               case TAPI_SERVICE_SMS_DELETE_MSG: {
+
+                       deleteMsg.index = sipc_util_marshal_object_get_int(reqObj, "Index");
+                               
+                       tcore_user_request_set_data(ur, sizeof(struct treq_sms_delete_msg), &deleteMsg);
+                       tcore_user_request_set_command(ur, TREQ_SMS_DELETE_MSG);
+
+                       ret = tcore_communicator_dispatch_request(comm, ur);
+                       if (ret != TCORE_RETURN_SUCCESS) {
+                               // api_err = TAPI_API_OPERATION_FAILED;
+                               err("[tcore_SMS] communicator_dispatch_request is fail [0x%x] !!!", ret);                               
+                       }
+
+                       }
+                       break;
+
+               case TAPI_SERVICE_SMS_GET_COUNT:
+                       tcore_user_request_set_data(ur, sizeof(struct treq_sms_get_msg_count), &getMsgCnt);
+                       tcore_user_request_set_command(ur, TREQ_SMS_GET_COUNT);
+
+                       ret = tcore_communicator_dispatch_request(comm, ur);
+                       if (ret != TCORE_RETURN_SUCCESS) {
+                               // api_err = TAPI_API_OPERATION_FAILED;
+                               err("[tcore_SMS] communicator_dispatch_request is fail [0x%x] !!!", ret);                               
+                       }
+
+                       break;
+
+               case TAPI_SERVICE_SMS_GET_SCA: {
+                       
+                       getSca.index = sipc_util_marshal_object_get_int(reqObj, "Index");                       
+
+                       tcore_user_request_set_data(ur, sizeof(struct treq_sms_get_sca), &getSca);
+                       tcore_user_request_set_command(ur, TREQ_SMS_GET_SCA);
+
+                       ret = tcore_communicator_dispatch_request(comm, ur);
+                       if (ret != TCORE_RETURN_SUCCESS) {
+                               // api_err = TAPI_API_OPERATION_FAILED;
+                               err("[tcore_SMS] communicator_dispatch_request is fail [0x%x] !!!", ret);                               
+                       }
+
+                       }
+                       break;
+
+               case TAPI_SERVICE_SMS_SET_SCA: {
+                       gchar *szDiallingNum;                   
+
+                       setSca.index = sipc_util_marshal_object_get_int(reqObj, "Index");
+                       setSca.scaInfo.dialNumLen = sipc_util_marshal_object_get_int(reqObj, "DialNumLen");
+                       setSca.scaInfo.typeOfNum = sipc_util_marshal_object_get_int(reqObj, "Ton");
+                       setSca.scaInfo.numPlanId = sipc_util_marshal_object_get_int(reqObj, "Npi");
+                       szDiallingNum = sipc_util_marshal_object_get_string(reqObj, "szDiallingNum");
+                       memcpy(&(setSca.scaInfo.diallingNum[0]), szDiallingNum, SMS_SMSP_ADDRESS_LEN + 1);
+
+                       if ((setSca.scaInfo.dialNumLen <= 0) || (setSca.scaInfo.dialNumLen > (SMS_MAX_SMS_SERVICE_CENTER_ADDR + 1)))
+                       {
+                               err("[tcore_SMS] TAPI_API_INVALID_INPUT !!!");
+                       }
+                       else if(setSca.index != 0)
+                       {
+                               err("[tcore_SMS] Index except 0 is supported");
+                               // api_err = TAPI_API_NOT_SUPPORTED;
+                       }
+                       else
+                       {
+                               tcore_user_request_set_data(ur, sizeof(struct treq_sms_set_sca), &setSca);
+                               tcore_user_request_set_command(ur, TREQ_SMS_SET_SCA);
+
+                               ret = tcore_communicator_dispatch_request(comm, ur);
+                               if (ret != TCORE_RETURN_SUCCESS) {
+                                       //api_err = TAPI_API_OPERATION_FAILED;
+                                       err("[tcore_SMS] communicator_dispatch_request is fail [0x%x] !!!", ret);
+                               }
+                       }
+
+                       }
+                       break;
+
+               case TAPI_SERVICE_SMS_GET_CB_CONFIG:
+                       tcore_user_request_set_data(ur, sizeof(struct treq_sms_get_cb_config), &getCbConfig);
+                       tcore_user_request_set_command(ur, TREQ_SMS_GET_CB_CONFIG);
+
+                       ret = tcore_communicator_dispatch_request(comm, ur);
+                       if (ret != TCORE_RETURN_SUCCESS) {
+                               //api_err = TAPI_API_OPERATION_FAILED;
+                               err("[tcore_SMS] communicator_dispatch_request is fail [0x%x] !!!", ret);
+                       }
+
+                       break;
+
+               case TAPI_SERVICE_SMS_SET_CB_CONFIG: {
+                       gchar *msgIDs;                  
+
+                       setCbConfig.bCBEnabled = sipc_util_marshal_object_get_int(reqObj, "bCBEnabled");
+                       setCbConfig.selectedId = sipc_util_marshal_object_get_char(reqObj, "SelectedId");
+                       setCbConfig.msgIdMaxCount = sipc_util_marshal_object_get_char(reqObj, "MsgIdMaxCount");
+                       setCbConfig.msgIdCount = sipc_util_marshal_object_get_int(reqObj, "MsgIdCount");
+                       msgIDs = sipc_util_marshal_object_get_string(reqObj, "MsgIDs");
+                       memcpy(&(setCbConfig.msgIDs[0]), msgIDs, SMS_GSM_SMS_CBMI_LIST_SIZE_MAX);
+
+                       tcore_user_request_set_data(ur, sizeof(struct treq_sms_set_cb_config), &setCbConfig);
+                       tcore_user_request_set_command(ur, TREQ_SMS_SET_CB_CONFIG);
+
+                       ret = tcore_communicator_dispatch_request(comm, ur);
+                       if (ret != TCORE_RETURN_SUCCESS) {
+                               //api_err = TAPI_API_OPERATION_FAILED;
+                               err("[tcore_SMS] communicator_dispatch_request is fail [0x%x] !!!", ret);
+                       }
+
+                       }
+                       break;
+
+               case TAPI_SERVICE_SMS_SET_MEM_STATUS: {
+
+                       memStatus.memory_status = sipc_util_marshal_object_get_int(reqObj, "memoryStatus");
+
+                       tcore_user_request_set_data(ur, sizeof(struct treq_sms_set_mem_status), &memStatus);
+                       tcore_user_request_set_command(ur, TREQ_SMS_SET_MEM_STATUS);
+
+                       ret = tcore_communicator_dispatch_request(comm, ur);
+                       if (ret != TCORE_RETURN_SUCCESS) {
+                               //api_err = TAPI_API_OPERATION_FAILED;
+                               err("[tcore_SMS] communicator_dispatch_request is fail [0x%x] !!!", ret);
+                       }
+
+                       }
+                       break;
+
+               case TAPI_SERVICE_SMS_GET_PREF_BEARER:
+                       tcore_user_request_set_data(ur, sizeof(struct treq_sms_get_pref_brearer), &getPrefBrearer);
+                       tcore_user_request_set_command(ur, TREQ_SMS_GET_PREF_BEARER);
+
+                       ret = tcore_communicator_dispatch_request(comm, ur);
+                       if (ret != TCORE_RETURN_SUCCESS) {
+                               //api_err = TAPI_API_OPERATION_FAILED;
+                               err("[tcore_SMS] communicator_dispatch_request is fail [0x%x] !!!", ret);
+                       }
+
+                       break;
+
+               case TAPI_SERVICE_SMS_SET_PREF_BEARER: {
+
+                       setPrefBrearer.svc = sipc_util_marshal_object_get_int(reqObj, "BearerType");            
+
+                       tcore_user_request_set_data(ur, sizeof(struct treq_sms_set_pref_brearer), &setPrefBrearer);
+                       tcore_user_request_set_command(ur, TREQ_SMS_SET_PREF_BEARER);
+
+                       ret = tcore_communicator_dispatch_request(comm, ur);
+                       if (ret != TCORE_RETURN_SUCCESS) {
+                               //api_err = TAPI_API_OPERATION_FAILED;
+                               err("[tcore_SMS] communicator_dispatch_request is fail [0x%x] !!!", ret);
+                       }
+
+                       }
+                       break;
+
+               case TAPI_SERVICE_SMS_SET_DELIVERY_REPORT: {
+                       gchar *sca;
+                       gchar *szData;
+                       
+                       sca = sipc_util_marshal_object_get_string(reqObj, "Sca");
+                       memcpy(&(deliveryReport.dataInfo.sca[0]), sca, SMS_SMSP_ADDRESS_LEN);
+                       deliveryReport.dataInfo.msgLength = sipc_util_marshal_object_get_int(reqObj, "MsgLength");
+                       szData = sipc_util_marshal_object_get_string(reqObj, "szData");
+                       memcpy(&(deliveryReport.dataInfo.tpduData[0]), szData, SMS_SMDATA_SIZE_MAX + 1);
+                       deliveryReport.rspType = sipc_util_marshal_object_get_int(reqObj, "RPCause");
+
+                       tcore_user_request_set_data(ur, sizeof(struct treq_sms_set_delivery_report), &deliveryReport);
+                       tcore_user_request_set_command(ur, TREQ_SMS_SET_DELIVERY_REPORT);
+
+                       ret = tcore_communicator_dispatch_request(comm, ur);
+                       if (ret != TCORE_RETURN_SUCCESS) {
+                               //api_err = TAPI_API_OPERATION_FAILED;
+                               err("[tcore_SMS] communicator_dispatch_request is fail [0x%x] !!!", ret);
+                       }
+                       
+                       }
+                       break;
+
+               case TAPI_SERVICE_SMS_SET_MSG_STATUS: {
+
+                       msgStatus.index = sipc_util_marshal_object_get_int(reqObj, "Index");
+                       msgStatus.msgStatus = sipc_util_marshal_object_get_int(reqObj, "MsgStatus");
+                       
+                       tcore_user_request_set_data(ur, sizeof(struct treq_sms_set_msg_status), &msgStatus);
+                       tcore_user_request_set_command(ur, TREQ_SMS_SET_MSG_STATUS);
+
+                       ret = tcore_communicator_dispatch_request(comm, ur);
+                       if (ret != TCORE_RETURN_SUCCESS) {
+                               //api_err = TAPI_API_OPERATION_FAILED;
+                               err("[tcore_SMS] communicator_dispatch_request is fail [0x%x] !!!", ret);
+                       }
+
+                       }
+                       break;
+
+               case TAPI_SERVICE_SMS_GET_PARAMS: {
+
+                       getParams.index = sipc_util_marshal_object_get_int(reqObj, "Index");
+
+                       tcore_user_request_set_data(ur, sizeof(struct treq_sms_get_params), &getParams);
+                       tcore_user_request_set_command(ur, TREQ_SMS_GET_PARAMS);
+
+                       ret = tcore_communicator_dispatch_request(comm, ur);
+                       if (ret != TCORE_RETURN_SUCCESS) {
+                               //api_err = TAPI_API_OPERATION_FAILED;
+                               err("[tcore_SMS] communicator_dispatch_request is fail [0x%x] !!!", ret);
+                       }
+
+                       }
+                       break;
+
+               case TAPI_SERVICE_SMS_SET_PARAMS: {
+                       gchar   *szAlphaId;
+                       gchar   *destAddr_szDiallingNum;
+                       gchar   *svcCntrAddr_szDiallingNum;
+
+                       setParams.params.recordIndex = sipc_util_marshal_object_get_char(reqObj, "RecordIndex");
+                       setParams.params.recordLen = sipc_util_marshal_object_get_char(reqObj, "RecordLen");
+                       setParams.params.alphaIdLen = sipc_util_marshal_object_get_int(reqObj, "AlphaIdLen");
+                       szAlphaId = sipc_util_marshal_object_get_string(reqObj, "szAlphaId");
+                       memcpy(&(setParams.params.szAlphaId[0]), szAlphaId, SMS_SMSP_ALPHA_ID_LEN_MAX + 1);
+                       setParams.params.paramIndicator = sipc_util_marshal_object_get_char(reqObj, "ParamIndicator");
+                       
+                       setParams.params.tpDestAddr.dialNumLen = sipc_util_marshal_object_get_int(reqObj, "DestAddr.DialNumLen");
+                       setParams.params.tpDestAddr.typeOfNum = sipc_util_marshal_object_get_int(reqObj, "DestAddr.Ton");
+                       setParams.params.tpDestAddr.numPlanId = sipc_util_marshal_object_get_int(reqObj, "DestAddr.Npi");
+                       destAddr_szDiallingNum = sipc_util_marshal_object_get_string(reqObj, "DestAddr.szDiallingNum");
+                       memcpy(&(setParams.params.tpDestAddr.diallingNum[0]), destAddr_szDiallingNum, SMS_SMSP_ADDRESS_LEN + 1);
+                       
+                       setParams.params.tpSvcCntrAddr.dialNumLen = sipc_util_marshal_object_get_int(reqObj, "SvcCntrAddr.DialNumLen");
+                       setParams.params.tpSvcCntrAddr.typeOfNum = sipc_util_marshal_object_get_int(reqObj, "SvcCntrAddr.Ton");
+                       setParams.params.tpSvcCntrAddr.numPlanId = sipc_util_marshal_object_get_int(reqObj, "SvcCntrAddr.Npi");
+                       svcCntrAddr_szDiallingNum = sipc_util_marshal_object_get_string(reqObj, "SvcCntrAddr.szDiallingNum");
+                       memcpy(&(setParams.params.tpSvcCntrAddr.diallingNum[0]), svcCntrAddr_szDiallingNum, SMS_SMSP_ADDRESS_LEN + 1);
+
+                       setParams.params.tpProtocolId = sipc_util_marshal_object_get_int(reqObj, "ProtocolId");
+                       setParams.params.tpDataCodingScheme = sipc_util_marshal_object_get_int(reqObj, "DataCodingScheme");
+                       setParams.params.tpValidityPeriod = sipc_util_marshal_object_get_int(reqObj, "ValidityPeriod");
+                       
+                       tcore_user_request_set_data(ur, sizeof(struct treq_sms_set_params), &setParams);
+                       tcore_user_request_set_command(ur, TREQ_SMS_SET_PARAMS);
+
+                       ret = tcore_communicator_dispatch_request(comm, ur);
+                       if (ret != TCORE_RETURN_SUCCESS) {
+                               //api_err = TAPI_API_OPERATION_FAILED;
+                               err("[tcore_SMS] communicator_dispatch_request is fail [0x%x] !!!", ret);
+                       }
+
+                       }
+                       break;
+
+               case TAPI_SERVICE_SMS_GET_PARAMCNT:
+                       tcore_user_request_set_data(ur, sizeof(struct treq_sms_get_paramcnt), &getParamCnt);
+                       tcore_user_request_set_command(ur, TREQ_SMS_GET_PARAMCNT);
+
+                       ret = tcore_communicator_dispatch_request(comm, ur);
+                       if (ret != TCORE_RETURN_SUCCESS) {
+                               //api_err = TAPI_API_OPERATION_FAILED;
+                               err("[tcore_SMS] communicator_dispatch_request is fail [0x%x] !!!", ret);
+                       }
+
+                       break;
+#if 0  // JYGU need to check TAPI_CS_NETTEXT_DEVICEREADY, TAPI_CS_NETTEXT_DEVICESTATUS with MMFW
+               case TAPI_CS_NETTEXT_DEVICEREADY:
+                       dbg("[tcore_SMS] internal operation, please check TAPI_CS_NETTEXT_DEVICEREADY with MMFW !!!");
+                       api_err = TAPI_API_OPERATION_FAILED;
+                       break;
+
+               case TAPI_CS_NETTEXT_DEVICESTATUS:
+                       {
+                               int device_status = 0x01;
+                               dbg("[tcore_SMS] internal operation, please check TAPI_CS_NETTEXT_DEVICESTATUS with MMFW !!!");
+                               // JYGU g_array_append_vals(*out_param3, &device_status, sizeof(int));
+                       }
+                       break;
+#endif
+               default:
+                       //api_err = TAPI_API_NOT_SUPPORTED;
+                       err("[tcore_SMS] NOT support command  [0x%x] !!!", cmd);
+                       break;
+       }
+
+       dbg("[tcore_SMS] request command[0x%x], ret = 0x%x", cmd, ret);
+
+       return TRUE;
+}
+
+gboolean scomm_service_response_sms(Communicator *comm, UserRequest *ur, enum tcore_response_command command, unsigned int data_len, const void *data)
+{
+       int ret = 0;
+
+       gboolean result = TRUE; int err_cause = 0;
+       gchar *out_d= NULL, *serial_d = NULL;
+       struct custom_data *ctx = NULL;
+       const struct tcore_user_info *ui;
+
+       sipc_server_t *s = NULL;
+       struct _tapi_header hdr;
+       struct _sipc_marshal_object* respObj = NULL;
+
+       memset(&hdr, 0, sizeof(struct _tapi_header));
+
+       ctx = tcore_communicator_ref_user_data(comm);
+       if (!ctx) {
+               dbg("user_data is NULL");
+               return FALSE;
+       }
+
+       ui = tcore_user_request_ref_user_info(ur);
+       s = ctx->sk_server;
+
+       dbg("[tcore_SMS] application channel id(%d), Command = [0x%x], data_len = %d", ui->channel_id, command, data_len);
+       hdr.cmd = (tapi_service_command_e)ui->client_cmd;
+       
+       respObj = sipc_util_marshal_object_create();
+
+       switch (command) {
+               case TRESP_SMS_SEND_UMTS_MSG: {
+                       const struct tresp_sms_send_umts_msg *resp = data;
+
+                       dbg("resp->result = 0x%x", resp->result);
+
+                       sipc_util_marshal_object_add_data(respObj, "Result", (void *)&(resp->result), SIPC_MARSHAL_DATA_INT_TYPE);
+                       sipc_util_marshal_object_add_data(respObj, "Sca", (void *)&(resp->dataInfo.sca[0]), TAPI_OBJECT_DATA_TYPE_STRING);
+                       sipc_util_marshal_object_add_data(respObj, "MsgLength", (void *)&(resp->dataInfo.msgLength), TAPI_OBJECT_DATA_TYPE_INT);
+                       sipc_util_marshal_object_add_data(respObj, "szData", (void *)&(resp->dataInfo.tpduData[0]), TAPI_OBJECT_DATA_TYPE_STRING);
+                       }
+                       break;
+
+               case TRESP_SMS_SEND_CDMA_MSG: {
+                       const struct tresp_sms_send_cdma_msg *resp = data;
+
+                       dbg("resp->result = 0x%x", resp->result);
+
+                       sipc_util_marshal_object_add_data(respObj, "Result", (void *)&(resp->result), TAPI_OBJECT_DATA_TYPE_INT);
+                       sipc_util_marshal_object_add_data(respObj, "ReplySeqNumber", (void *)&(resp->causeCode.ReplySeqNumber), TAPI_OBJECT_DATA_TYPE_CHAR);
+                       sipc_util_marshal_object_add_data(respObj, "ErrClass", (void *)&(resp->causeCode.ErrClass), TAPI_OBJECT_DATA_TYPE_INT);
+                       sipc_util_marshal_object_add_data(respObj, "Cause", (void *)&(resp->causeCode.Cause), TAPI_OBJECT_DATA_TYPE_CHAR);                                      
+                       }
+                       break;
+
+               case TRESP_SMS_READ_MSG: {
+                       const struct tresp_sms_read_msg *resp = data;
+
+                       dbg("resp->result = 0x%x", resp->result);
+
+                       sipc_util_marshal_object_add_data(respObj, "Result", (void *)&(resp->result), SIPC_MARSHAL_DATA_INT_TYPE);
+                       sipc_util_marshal_object_add_data(respObj, "Index", (void *)&(resp->dataInfo.simIndex), SIPC_MARSHAL_DATA_INT_TYPE);
+                       sipc_util_marshal_object_add_data(respObj, "MsgStatus", (void *)&(resp->dataInfo.msgStatus), SIPC_MARSHAL_DATA_INT_TYPE);
+                       sipc_util_marshal_object_add_data(respObj, "Sca", (void *)&(resp->dataInfo.smsData.sca[0]), TAPI_OBJECT_DATA_TYPE_STRING);
+                       sipc_util_marshal_object_add_data(respObj, "MsgLength", (void *)&(resp->dataInfo.smsData.msgLength), TAPI_OBJECT_DATA_TYPE_INT);
+                       sipc_util_marshal_object_add_data(respObj, "szData", (void *)&(resp->dataInfo.smsData.tpduData[0]), TAPI_OBJECT_DATA_TYPE_STRING);
+                       }
+                       break;
+
+               case TRESP_SMS_SAVE_MSG: {
+                       const struct tresp_sms_save_msg *resp = data;
+
+                       dbg("resp->result = 0x%x", resp->result);
+
+                       sipc_util_marshal_object_add_data(respObj, "Result", (void *)&(resp->result), SIPC_MARSHAL_DATA_INT_TYPE);
+                       sipc_util_marshal_object_add_data(respObj, "Index", (void *)&(resp->index), SIPC_MARSHAL_DATA_INT_TYPE);
+                       }
+                       break;
+
+               case TRESP_SMS_DELETE_MSG: {
+                       const struct tresp_sms_delete_msg *resp = data;
+
+                       dbg("resp->result = 0x%x", resp->result);
+
+                       sipc_util_marshal_object_add_data(respObj, "Result", (void *)&(resp->result), SIPC_MARSHAL_DATA_INT_TYPE);
+                       sipc_util_marshal_object_add_data(respObj, "Index", (void *)&(resp->index), SIPC_MARSHAL_DATA_INT_TYPE);
+                       }
+                       break;
+
+               case TRESP_SMS_GET_STORED_MSG_COUNT: {
+                       const struct tresp_sms_get_storedMsgCnt *resp = data;
+
+                       dbg("resp->result = 0x%x", resp->result);
+
+                       sipc_util_marshal_object_add_data(respObj, "Result", (void *)&(resp->result), SIPC_MARSHAL_DATA_INT_TYPE);
+                       sipc_util_marshal_object_add_data(respObj, "TotalCount", (void *)&(resp->storedMsgCnt.totalCount), SIPC_MARSHAL_DATA_INT_TYPE);
+                       sipc_util_marshal_object_add_data(respObj, "UsedCount", (void *)&(resp->storedMsgCnt.usedCount), SIPC_MARSHAL_DATA_INT_TYPE);
+                       sipc_util_marshal_object_add_data(respObj, "IndexList", (void *)&(resp->storedMsgCnt.indexList[0]), TAPI_OBJECT_DATA_TYPE_STRING);
+                       }
+                       break;
+
+               case TRESP_SMS_GET_SCA: {
+                       const struct tresp_sms_get_sca *resp = data;
+
+                       dbg("resp->result = 0x%x", resp->result);
+
+                       sipc_util_marshal_object_add_data(respObj, "Result", (void *)&(resp->result), TAPI_OBJECT_DATA_TYPE_INT);
+                       sipc_util_marshal_object_add_data(respObj, "DialNumLen", (void *)&(resp->scaAddress.dialNumLen), TAPI_OBJECT_DATA_TYPE_INT);
+                       sipc_util_marshal_object_add_data(respObj, "Ton", (void *)&(resp->scaAddress.typeOfNum), TAPI_OBJECT_DATA_TYPE_INT);
+                       sipc_util_marshal_object_add_data(respObj, "Npi", (void *)&(resp->scaAddress.numPlanId), TAPI_OBJECT_DATA_TYPE_INT);
+                       sipc_util_marshal_object_add_data(respObj, "szDiallingNum", (void *)&(resp->scaAddress.diallingNum[0]), TAPI_OBJECT_DATA_TYPE_STRING);                          
+                       }
+                       break;
+
+               case TRESP_SMS_SET_SCA: {
+                       const struct tresp_sms_set_sca *resp = data;
+
+                       dbg("resp->result = 0x%x", resp->result);
+
+                       sipc_util_marshal_object_add_data(respObj, "Result", (void *)&(resp->result), TAPI_OBJECT_DATA_TYPE_INT);
+                       }
+                       break;
+
+               case TRESP_SMS_GET_CB_CONFIG: {
+                       const struct tresp_sms_get_cb_config *resp = data;
+
+                       dbg("resp->result = 0x%x", resp->result);
+
+                       sipc_util_marshal_object_add_data(respObj, "Result", (void *)&(resp->result), TAPI_OBJECT_DATA_TYPE_INT);
+                       sipc_util_marshal_object_add_data(respObj, "bCBEnabled", (void *)&(resp->cbConfig.bCBEnabled), TAPI_OBJECT_DATA_TYPE_INT);
+                       sipc_util_marshal_object_add_data(respObj, "SelectedId", (void *)&(resp->cbConfig.selectedId), TAPI_OBJECT_DATA_TYPE_CHAR);
+                       sipc_util_marshal_object_add_data(respObj, "MsgIdMaxCount", (void *)&(resp->cbConfig.msgIdMaxCount), TAPI_OBJECT_DATA_TYPE_CHAR);
+                       sipc_util_marshal_object_add_data(respObj, "MsgIdCount", (void *)&(resp->cbConfig.msgIdCount), TAPI_OBJECT_DATA_TYPE_INT);
+                       sipc_util_marshal_object_add_data(respObj, "MsgIDs", (void *)&(resp->cbConfig.msgIDs[0]), TAPI_OBJECT_DATA_TYPE_STRING);
+                       }
+                       break;
+
+               case TRESP_SMS_SET_CB_CONFIG: {
+                       const struct tresp_sms_set_cb_config *resp = data;
+
+                       dbg("resp->result = 0x%x", resp->result);
+
+                       sipc_util_marshal_object_add_data(respObj, "Result", (void *)&(resp->result), TAPI_OBJECT_DATA_TYPE_INT);
+                       }
+                       break;
+
+               case TRESP_SMS_SET_MEM_STATUS: {
+                       const struct tresp_sms_set_mem_status *resp = data;
+
+                       dbg("resp->result = 0x%x", resp->result);
+
+                       sipc_util_marshal_object_add_data(respObj, "Result", (void *)&(resp->result), TAPI_OBJECT_DATA_TYPE_INT);
+                       }
+                       break;
+#if 0
+               case TRESP_SMS_GET_PREF_BEARER:
+                       ts_delivery_event(ctx->EvtDeliveryHandle, TAPI_EVENT_CLASS_NETTEXT, TAPI_EVENT_NETTEXT_GET_SMSBEARER_CNF,
+                                       appname, RequestId, status, sizeof(TelSmsBearerType_t), (void *) bearer);
+                       break;
+
+               case TRESP_SMS_SET_PREF_BEARER:
+                       ts_delivery_event(ctx->EvtDeliveryHandle, TAPI_EVENT_CLASS_NETTEXT, TAPI_EVENT_NETTEXT_SET_REQUEST_CNF,
+                                       appname, RequestId, Status, sizeof(TelSmsCause_t), (void *) &RequestType);
+                       break;
+#endif
+               case TRESP_SMS_SET_DELIVERY_REPORT: {
+                       const struct tresp_sms_set_delivery_report *resp = data;
+
+                       dbg("resp->result = 0x%x", resp->result);
+
+                       sipc_util_marshal_object_add_data(respObj, "Result", (void *)&(resp->result), TAPI_OBJECT_DATA_TYPE_INT);
+                       }
+                       break;
+
+               case TRESP_SMS_SET_MSG_STATUS: {
+                       const struct tresp_sms_set_mem_status *resp = data;
+
+                       dbg("resp->result = 0x%x", resp->result);
+
+                       sipc_util_marshal_object_add_data(respObj, "Result", (void *)&(resp->result), TAPI_OBJECT_DATA_TYPE_INT);
+                       }
+                       break;
+
+               case TRESP_SMS_GET_PARAMS: {
+                       const struct tresp_sms_get_params *resp = data;
+
+                       dbg("resp->result = 0x%x", resp->result);
+
+                       sipc_util_marshal_object_add_data(respObj, "Result", (void *)&(resp->result), TAPI_OBJECT_DATA_TYPE_INT);
+                       sipc_util_marshal_object_add_data(respObj, "RecordIndex", (void *)&(resp->paramsInfo.recordIndex), TAPI_OBJECT_DATA_TYPE_CHAR);
+                       sipc_util_marshal_object_add_data(respObj, "RecordLen", (void *)&(resp->paramsInfo.recordLen), TAPI_OBJECT_DATA_TYPE_CHAR);
+                       sipc_util_marshal_object_add_data(respObj, "AlphaIdLen", (void *)&(resp->paramsInfo.alphaIdLen), TAPI_OBJECT_DATA_TYPE_INT);
+                       sipc_util_marshal_object_add_data(respObj, "szAlphaId", (void *)&(resp->paramsInfo.szAlphaId), TAPI_OBJECT_DATA_TYPE_STRING);
+                       sipc_util_marshal_object_add_data(respObj, "ParamIndicator", (void *)&(resp->paramsInfo.paramIndicator), TAPI_OBJECT_DATA_TYPE_CHAR);
+                       
+                       sipc_util_marshal_object_add_data(respObj, "DestAddr.DialNumLen", (void *)&(resp->paramsInfo.tpDestAddr.dialNumLen), TAPI_OBJECT_DATA_TYPE_INT);
+                       sipc_util_marshal_object_add_data(respObj, "DestAddr.Ton", (void *)&(resp->paramsInfo.tpDestAddr.typeOfNum), TAPI_OBJECT_DATA_TYPE_INT);
+                       sipc_util_marshal_object_add_data(respObj, "DestAddr.Npi", (void *)&(resp->paramsInfo.tpDestAddr.numPlanId), TAPI_OBJECT_DATA_TYPE_INT);
+                       sipc_util_marshal_object_add_data(respObj, "DestAddr.szDiallingNum", (void *)&(resp->paramsInfo.tpDestAddr.diallingNum), TAPI_OBJECT_DATA_TYPE_STRING);
+                       
+                       sipc_util_marshal_object_add_data(respObj, "SvcCntrAddr.DialNumLen", (void *)&(resp->paramsInfo.tpSvcCntrAddr.dialNumLen), TAPI_OBJECT_DATA_TYPE_INT);
+                       sipc_util_marshal_object_add_data(respObj, "SvcCntrAddr.Ton", (void *)&(resp->paramsInfo.tpSvcCntrAddr.typeOfNum), TAPI_OBJECT_DATA_TYPE_INT);
+                       sipc_util_marshal_object_add_data(respObj, "SvcCntrAddr.Npi", (void *)&(resp->paramsInfo.tpSvcCntrAddr.numPlanId), TAPI_OBJECT_DATA_TYPE_INT);
+                       sipc_util_marshal_object_add_data(respObj, "SvcCntrAddr.szDiallingNum", (void *)&(resp->paramsInfo.tpSvcCntrAddr.diallingNum), TAPI_OBJECT_DATA_TYPE_STRING);
+
+                       sipc_util_marshal_object_add_data(respObj, "ProtocolId", (void *)&(resp->paramsInfo.tpProtocolId), TAPI_OBJECT_DATA_TYPE_INT);
+                       sipc_util_marshal_object_add_data(respObj, "DataCodingScheme", (void *)&(resp->paramsInfo.tpDataCodingScheme), TAPI_OBJECT_DATA_TYPE_INT);
+                       sipc_util_marshal_object_add_data(respObj, "ValidityPeriod", (void *)&(resp->paramsInfo.tpValidityPeriod), TAPI_OBJECT_DATA_TYPE_INT);                          
+                       }
+                       break;
+
+               case TRESP_SMS_SET_PARAMS:{
+                       const struct tresp_sms_set_params *resp = data;
+
+                       dbg("resp->result = 0x%x", resp->result);
+
+                       sipc_util_marshal_object_add_data(respObj, "Result", (void *)&(resp->result), TAPI_OBJECT_DATA_TYPE_INT);
+                       }
+                       break;
+
+               case TRESP_SMS_GET_PARAMCNT: {
+                       const struct tresp_sms_get_paramcnt *resp = data;
+
+                       dbg("resp->result = 0x%x", resp->result);
+
+                       sipc_util_marshal_object_add_data(respObj, "Result", (void *)&(resp->result), TAPI_OBJECT_DATA_TYPE_INT);
+                       sipc_util_marshal_object_add_data(respObj, "RecordCount", (void *)&(resp->recordCount), TAPI_OBJECT_DATA_TYPE_INT);
+                       }
+                       break;
+
+               default:
+                       break;
+       }
+
+       if(respObj){
+               serial_d = sipc_util_marshal_object_serializer(respObj);
+               hdr.data_len = strlen(serial_d);
+               sipc_util_marshal_object_destory(respObj);
+       }
+
+       out_d = g_new0(char, sizeof(struct _tapi_header)+hdr.data_len);
+       memcpy(out_d, &hdr, sizeof(struct _tapi_header));
+       if(serial_d){
+               memcpy(out_d+sizeof(struct _tapi_header), serial_d, hdr.data_len);
+               g_free(serial_d);
+       }
+
+       ret = sipc_server_send(s, ui->channel_id, out_d, sizeof(struct _tapi_header)+hdr.data_len, SIPC_SEND_DATA_ASYNC);
+       g_free(out_d);
+
+       if(ret < 0){
+               return FALSE;
+       }
+
+       return TRUE;
+}
+
+gboolean scomm_service_notification_sms(Communicator *comm, CoreObject *source, enum tcore_notification_command command, unsigned int data_len, const void *data)
+{
+       int ret = 0;
+       gboolean result = TRUE; int err_cause = 0;
+       gchar *out_d= NULL, *serial_d = NULL;
+
+       struct custom_data *ctx = NULL;
+       sipc_server_t *s = NULL;
+
+       struct _tapi_header hdr;
+       struct _sipc_marshal_object* notiObj = NULL;
+
+       memset(&hdr, 0, sizeof(struct _tapi_header));
+
+       ctx = tcore_communicator_ref_user_data(comm);
+       if (!ctx) {
+               dbg("user_data is NULL");
+               return FALSE;
+       }
+
+       s = ctx->sk_server;
+       dbg("[tcore_SMS]notification !!! (command = 0x%x, data_len = %d)", command, data_len);
+
+       notiObj = sipc_util_marshal_object_create();
+       
+       switch (command) {
+               case TNOTI_SMS_INCOM_MSG: {
+                       const struct tnoti_sms_umts_msg *noti = data;
+
+                       sipc_util_marshal_object_add_data(notiObj, "Sca", (void *)&(noti->msgInfo.sca[0]), TAPI_OBJECT_DATA_TYPE_STRING);
+                       sipc_util_marshal_object_add_data(notiObj, "MsgLength", (void *)&(noti->msgInfo.msgLength), TAPI_OBJECT_DATA_TYPE_INT);
+                       sipc_util_marshal_object_add_data(notiObj, "szData", (void *)&(noti->msgInfo.tpduData[0]), TAPI_OBJECT_DATA_TYPE_STRING);                                               
+                       }
+                       break;
+               case TNOTI_SMS_CB_INCOM_MSG: {
+                       const struct tnoti_sms_cellBroadcast_msg *noti = data;
+
+                       sipc_util_marshal_object_add_data(notiObj, "CbMsgType", (void *)&(noti->cbMsg.cbMsgType), TAPI_OBJECT_DATA_TYPE_INT);
+                       sipc_util_marshal_object_add_data(notiObj, "Length", (void *)&(noti->cbMsg.length), TAPI_OBJECT_DATA_TYPE_INT);
+                       sipc_util_marshal_object_add_data(notiObj, "szMsgData", (void *)&(noti->cbMsg.msgData[0]), TAPI_OBJECT_DATA_TYPE_STRING);                       
+                       }
+                       break;
+               case TNOTI_SMS_INCOM_EX_MSG: {
+                        const struct tnoti_sms_cdma_msg *noti = data;
+
+                       sipc_util_marshal_object_add_data(notiObj, "ParamMask", (void *)&(noti->cdmaMsg.ParamMask), TAPI_OBJECT_DATA_TYPE_INT);
+                       sipc_util_marshal_object_add_data(notiObj, "MsgType", (void *)&(noti->cdmaMsg.MsgType), TAPI_OBJECT_DATA_TYPE_INT);
+
+                       switch(noti->cdmaMsg.MsgType)
+                       {
+                               case SMS_MESSAGETYPE_DELIVER:
+                                       /* Origination address */
+                                       sipc_util_marshal_object_add_data(notiObj, "OrigAddr.Digit", (void *)&(noti->cdmaMsg.MsgData.inDeliver.OrigAddr.Digit), TAPI_OBJECT_DATA_TYPE_INT);
+                                       sipc_util_marshal_object_add_data(notiObj, "OrigAddr.NumberMode", (void *)&(noti->cdmaMsg.MsgData.inDeliver.OrigAddr.NumberMode), TAPI_OBJECT_DATA_TYPE_INT); 
+                                       sipc_util_marshal_object_add_data(notiObj, "OrigAddr.NumberType", (void *)&(noti->cdmaMsg.MsgData.inDeliver.OrigAddr.NumberType), TAPI_OBJECT_DATA_TYPE_INT); 
+                                       sipc_util_marshal_object_add_data(notiObj, "OrigAddr.NumberPlan", (void *)&(noti->cdmaMsg.MsgData.inDeliver.OrigAddr.NumberPlan), TAPI_OBJECT_DATA_TYPE_INT); 
+                                       sipc_util_marshal_object_add_data(notiObj, "OrigAddr.szAddrLength", (void *)&(noti->cdmaMsg.MsgData.inDeliver.OrigAddr.szAddrLength), TAPI_OBJECT_DATA_TYPE_CHAR); 
+                                       sipc_util_marshal_object_add_data(notiObj, "OrigAddr.szAddress", (void *)&(noti->cdmaMsg.MsgData.inDeliver.OrigAddr.szAddress[0]), TAPI_OBJECT_DATA_TYPE_STRING); 
+
+                                       /* Origination subaddress */
+                                       sipc_util_marshal_object_add_data(notiObj, "OrigSubAddr.SubType", (void *)&(noti->cdmaMsg.MsgData.inDeliver.OrigSubAddr.SubType), TAPI_OBJECT_DATA_TYPE_INT);
+                                       sipc_util_marshal_object_add_data(notiObj, "OrigSubAddr.Odd", (void *)&(noti->cdmaMsg.MsgData.inDeliver.OrigSubAddr.Odd), TAPI_OBJECT_DATA_TYPE_CHAR); 
+                                       sipc_util_marshal_object_add_data(notiObj, "OrigSubAddr.szAddrLength", (void *)&(noti->cdmaMsg.MsgData.inDeliver.OrigSubAddr.szAddrLength), TAPI_OBJECT_DATA_TYPE_CHAR); 
+                                       sipc_util_marshal_object_add_data(notiObj, "OrigSubAddr.szAddress", (void *)&(noti->cdmaMsg.MsgData.inDeliver.OrigSubAddr.szAddress[0]), TAPI_OBJECT_DATA_TYPE_STRING);
+
+                                       sipc_util_marshal_object_add_data(notiObj, "TeleService", (void *)&(noti->cdmaMsg.MsgData.inDeliver.TeleService), TAPI_OBJECT_DATA_TYPE_INT);
+                                       sipc_util_marshal_object_add_data(notiObj, "bBearerReplySeqRequest", (void *)&(noti->cdmaMsg.MsgData.inDeliver.bBearerReplySeqRequest), TAPI_OBJECT_DATA_TYPE_INT);
+                                       sipc_util_marshal_object_add_data(notiObj, "ReplySeqNumber", (void *)&(noti->cdmaMsg.MsgData.inDeliver.ReplySeqNumber), TAPI_OBJECT_DATA_TYPE_CHAR);
+                                       sipc_util_marshal_object_add_data(notiObj, "MsgId", (void *)&(noti->cdmaMsg.MsgData.inDeliver.MsgId), TAPI_OBJECT_DATA_TYPE_INT);
+                                       sipc_util_marshal_object_add_data(notiObj, "MsgEncoding", (void *)&(noti->cdmaMsg.MsgData.inDeliver.MsgEncoding), TAPI_OBJECT_DATA_TYPE_INT);
+                                       sipc_util_marshal_object_add_data(notiObj, "MsgLength", (void *)&(noti->cdmaMsg.MsgData.inDeliver.MsgLength), TAPI_OBJECT_DATA_TYPE_INT);
+                                       sipc_util_marshal_object_add_data(notiObj, "szData", (void *)&(noti->cdmaMsg.MsgData.inDeliver.szData[0]), TAPI_OBJECT_DATA_TYPE_STRING);
+
+                                       /* Message center time stamp */
+                                       sipc_util_marshal_object_add_data(notiObj, "MessageCenterTimeStamp.year", (void *)&(noti->cdmaMsg.MsgData.inDeliver.MessageCenterTimeStamp.year), TAPI_OBJECT_DATA_TYPE_INT);
+                                       sipc_util_marshal_object_add_data(notiObj, "MessageCenterTimeStamp.month", (void *)&(noti->cdmaMsg.MsgData.inDeliver.MessageCenterTimeStamp.month), TAPI_OBJECT_DATA_TYPE_INT);
+                                       sipc_util_marshal_object_add_data(notiObj, "MessageCenterTimeStamp.day", (void *)&(noti->cdmaMsg.MsgData.inDeliver.MessageCenterTimeStamp.day), TAPI_OBJECT_DATA_TYPE_INT);
+                                       sipc_util_marshal_object_add_data(notiObj, "MessageCenterTimeStamp.hours", (void *)&(noti->cdmaMsg.MsgData.inDeliver.MessageCenterTimeStamp.hours), TAPI_OBJECT_DATA_TYPE_INT);
+                                       sipc_util_marshal_object_add_data(notiObj, "MessageCenterTimeStamp.minutes", (void *)&(noti->cdmaMsg.MsgData.inDeliver.MessageCenterTimeStamp.minutes), TAPI_OBJECT_DATA_TYPE_INT);
+                                       sipc_util_marshal_object_add_data(notiObj, "MessageCenterTimeStamp.seconds", (void *)&(noti->cdmaMsg.MsgData.inDeliver.MessageCenterTimeStamp.seconds), TAPI_OBJECT_DATA_TYPE_INT);
+
+                                       /* Validity period - Absolute */
+                                       sipc_util_marshal_object_add_data(notiObj, "ValidityPeriodAbs.year", (void *)&(noti->cdmaMsg.MsgData.inDeliver.ValidityPeriodAbs.year), TAPI_OBJECT_DATA_TYPE_INT);
+                                       sipc_util_marshal_object_add_data(notiObj, "ValidityPeriodAbs.month", (void *)&(noti->cdmaMsg.MsgData.inDeliver.ValidityPeriodAbs.month), TAPI_OBJECT_DATA_TYPE_INT);
+                                       sipc_util_marshal_object_add_data(notiObj, "ValidityPeriodAbs.day", (void *)&(noti->cdmaMsg.MsgData.inDeliver.ValidityPeriodAbs.day), TAPI_OBJECT_DATA_TYPE_INT);
+                                       sipc_util_marshal_object_add_data(notiObj, "ValidityPeriodAbs.hours", (void *)&(noti->cdmaMsg.MsgData.inDeliver.ValidityPeriodAbs.hours), TAPI_OBJECT_DATA_TYPE_INT);
+                                       sipc_util_marshal_object_add_data(notiObj, "ValidityPeriodAbs.minutes", (void *)&(noti->cdmaMsg.MsgData.inDeliver.ValidityPeriodAbs.minutes), TAPI_OBJECT_DATA_TYPE_INT);
+                                       sipc_util_marshal_object_add_data(notiObj, "ValidityPeriodAbs.seconds", (void *)&(noti->cdmaMsg.MsgData.inDeliver.ValidityPeriodAbs.seconds), TAPI_OBJECT_DATA_TYPE_INT);
+
+                                       sipc_util_marshal_object_add_data(notiObj, "ValidityPeriodRel", (void *)&(noti->cdmaMsg.MsgData.inDeliver.ValidityPeriodRel), TAPI_OBJECT_DATA_TYPE_CHAR);
+
+                                       /* Deferred delivery time - Absolute (not supported) */
+                                       sipc_util_marshal_object_add_data(notiObj, "DeferredDelTimeAbs.year", (void *)&(noti->cdmaMsg.MsgData.inDeliver.DeferredDelTimeAbs.year), TAPI_OBJECT_DATA_TYPE_INT);
+                                       sipc_util_marshal_object_add_data(notiObj, "DeferredDelTimeAbs.month", (void *)&(noti->cdmaMsg.MsgData.inDeliver.DeferredDelTimeAbs.month), TAPI_OBJECT_DATA_TYPE_INT);
+                                       sipc_util_marshal_object_add_data(notiObj, "DeferredDelTimeAbs.day", (void *)&(noti->cdmaMsg.MsgData.inDeliver.DeferredDelTimeAbs.day), TAPI_OBJECT_DATA_TYPE_INT);
+                                       sipc_util_marshal_object_add_data(notiObj, "DeferredDelTimeAbs.hours", (void *)&(noti->cdmaMsg.MsgData.inDeliver.DeferredDelTimeAbs.hours), TAPI_OBJECT_DATA_TYPE_INT);
+                                       sipc_util_marshal_object_add_data(notiObj, "DeferredDelTimeAbs.minutes", (void *)&(noti->cdmaMsg.MsgData.inDeliver.DeferredDelTimeAbs.minutes), TAPI_OBJECT_DATA_TYPE_INT);
+                                       sipc_util_marshal_object_add_data(notiObj, "DeferredDelTimeAbs.seconds", (void *)&(noti->cdmaMsg.MsgData.inDeliver.DeferredDelTimeAbs.seconds), TAPI_OBJECT_DATA_TYPE_INT);
+
+                                       /* Deferred delivery time - Relative (not supported) */
+                                       sipc_util_marshal_object_add_data(notiObj, "DeferredDelTimeRel", (void *)&(noti->cdmaMsg.MsgData.inDeliver.DeferredDelTimeRel), TAPI_OBJECT_DATA_TYPE_CHAR);
+                                       
+                                       sipc_util_marshal_object_add_data(notiObj, "Priority", (void *)&(noti->cdmaMsg.MsgData.inDeliver.Priority), TAPI_OBJECT_DATA_TYPE_INT);
+                                       sipc_util_marshal_object_add_data(notiObj, "Privacy", (void *)&(noti->cdmaMsg.MsgData.inDeliver.Privacy), TAPI_OBJECT_DATA_TYPE_INT);
+                                       sipc_util_marshal_object_add_data(notiObj, "NumMsg", (void *)&(noti->cdmaMsg.MsgData.inDeliver.NumMsg), TAPI_OBJECT_DATA_TYPE_CHAR);
+                                       sipc_util_marshal_object_add_data(notiObj, "bUserAckRequest", (void *)&(noti->cdmaMsg.MsgData.inDeliver.bUserAckRequest), TAPI_OBJECT_DATA_TYPE_INT);
+                                       sipc_util_marshal_object_add_data(notiObj, "bDeliveryAckRequest", (void *)&(noti->cdmaMsg.MsgData.inDeliver.bDeliveryAckRequest), TAPI_OBJECT_DATA_TYPE_INT);
+                                       sipc_util_marshal_object_add_data(notiObj, "AlertPriority", (void *)&(noti->cdmaMsg.MsgData.inDeliver.AlertPriority), TAPI_OBJECT_DATA_TYPE_INT);
+                                       sipc_util_marshal_object_add_data(notiObj, "MsgLang", (void *)&(noti->cdmaMsg.MsgData.inDeliver.MsgLang), TAPI_OBJECT_DATA_TYPE_INT);
+
+                                       /* Callback number address */
+                                       sipc_util_marshal_object_add_data(notiObj, "CallBackNumer.Digit", (void *)&(noti->cdmaMsg.MsgData.inDeliver.CallBackNumer.Digit), TAPI_OBJECT_DATA_TYPE_INT);
+                                       sipc_util_marshal_object_add_data(notiObj, "CallBackNumer.NumberMode", (void *)&(noti->cdmaMsg.MsgData.inDeliver.CallBackNumer.NumberMode), TAPI_OBJECT_DATA_TYPE_INT); 
+                                       sipc_util_marshal_object_add_data(notiObj, "CallBackNumer.NumberType", (void *)&(noti->cdmaMsg.MsgData.inDeliver.CallBackNumer.NumberType), TAPI_OBJECT_DATA_TYPE_INT); 
+                                       sipc_util_marshal_object_add_data(notiObj, "CallBackNumer.NumberPlan", (void *)&(noti->cdmaMsg.MsgData.inDeliver.CallBackNumer.NumberPlan), TAPI_OBJECT_DATA_TYPE_INT); 
+                                       sipc_util_marshal_object_add_data(notiObj, "CallBackNumer.szAddrLength", (void *)&(noti->cdmaMsg.MsgData.inDeliver.CallBackNumer.szAddrLength), TAPI_OBJECT_DATA_TYPE_CHAR); 
+                                       sipc_util_marshal_object_add_data(notiObj, "CallBackNumer.szAddress", (void *)&(noti->cdmaMsg.MsgData.inDeliver.CallBackNumer.szAddress[0]), TAPI_OBJECT_DATA_TYPE_STRING);
+
+                                       sipc_util_marshal_object_add_data(notiObj, "Display", (void *)&(noti->cdmaMsg.MsgData.inDeliver.Display), TAPI_OBJECT_DATA_TYPE_INT);
+       
+                                       break;
+                                       
+                               case SMS_MESSAGETYPE_DELIVERY_ACK:
+                                       /* Origination address */
+                                       sipc_util_marshal_object_add_data(notiObj, "OrigAddr.Digit", (void *)&(noti->cdmaMsg.MsgData.inAck.OrigAddr.Digit), TAPI_OBJECT_DATA_TYPE_INT);
+                                       sipc_util_marshal_object_add_data(notiObj, "OrigAddr.NumberMode", (void *)&(noti->cdmaMsg.MsgData.inAck.OrigAddr.NumberMode), TAPI_OBJECT_DATA_TYPE_INT); 
+                                       sipc_util_marshal_object_add_data(notiObj, "OrigAddr.NumberType", (void *)&(noti->cdmaMsg.MsgData.inAck.OrigAddr.NumberType), TAPI_OBJECT_DATA_TYPE_INT); 
+                                       sipc_util_marshal_object_add_data(notiObj, "OrigAddr.NumberPlan", (void *)&(noti->cdmaMsg.MsgData.inAck.OrigAddr.NumberPlan), TAPI_OBJECT_DATA_TYPE_INT); 
+                                       sipc_util_marshal_object_add_data(notiObj, "OrigAddr.szAddrLength", (void *)&(noti->cdmaMsg.MsgData.inAck.OrigAddr.szAddrLength), TAPI_OBJECT_DATA_TYPE_CHAR); 
+                                       sipc_util_marshal_object_add_data(notiObj, "OrigAddr.szAddress", (void *)&(noti->cdmaMsg.MsgData.inAck.OrigAddr.szAddress[0]), TAPI_OBJECT_DATA_TYPE_STRING); 
+
+                                       /* Origination subaddress */
+                                       sipc_util_marshal_object_add_data(notiObj, "OrigSubAddr.SubType", (void *)&(noti->cdmaMsg.MsgData.inAck.OrigSubAddr.SubType), TAPI_OBJECT_DATA_TYPE_INT);
+                                       sipc_util_marshal_object_add_data(notiObj, "OrigSubAddr.Odd", (void *)&(noti->cdmaMsg.MsgData.inAck.OrigSubAddr.Odd), TAPI_OBJECT_DATA_TYPE_CHAR); 
+                                       sipc_util_marshal_object_add_data(notiObj, "OrigSubAddr.szAddrLength", (void *)&(noti->cdmaMsg.MsgData.inAck.OrigSubAddr.szAddrLength), TAPI_OBJECT_DATA_TYPE_CHAR); 
+                                       sipc_util_marshal_object_add_data(notiObj, "OrigSubAddr.szAddress", (void *)&(noti->cdmaMsg.MsgData.inAck.OrigSubAddr.szAddress), TAPI_OBJECT_DATA_TYPE_CHAR);
+
+                                       sipc_util_marshal_object_add_data(notiObj, "TeleService", (void *)&(noti->cdmaMsg.MsgData.inAck.TeleService), TAPI_OBJECT_DATA_TYPE_INT);
+                                       sipc_util_marshal_object_add_data(notiObj, "bBearerReplySeqRequest", (void *)&(noti->cdmaMsg.MsgData.inAck.bBearerReplySeqRequest), TAPI_OBJECT_DATA_TYPE_INT);
+                                       sipc_util_marshal_object_add_data(notiObj, "ReplySeqNumber", (void *)&(noti->cdmaMsg.MsgData.inAck.ReplySeqNumber), TAPI_OBJECT_DATA_TYPE_CHAR);
+                                       sipc_util_marshal_object_add_data(notiObj, "MsgId", (void *)&(noti->cdmaMsg.MsgData.inAck.MsgId), TAPI_OBJECT_DATA_TYPE_INT);
+                                       sipc_util_marshal_object_add_data(notiObj, "MsgEncoding", (void *)&(noti->cdmaMsg.MsgData.inAck.MsgEncoding), TAPI_OBJECT_DATA_TYPE_INT);
+                                       sipc_util_marshal_object_add_data(notiObj, "MsgLength", (void *)&(noti->cdmaMsg.MsgData.inAck.MsgLength), TAPI_OBJECT_DATA_TYPE_INT);
+                                       sipc_util_marshal_object_add_data(notiObj, "szData", (void *)&(noti->cdmaMsg.MsgData.inAck.szData[0]), TAPI_OBJECT_DATA_TYPE_STRING);
+
+                                       sipc_util_marshal_object_add_data(notiObj, "UserResponseCode", (void *)&(noti->cdmaMsg.MsgData.inAck.UserResponseCode), TAPI_OBJECT_DATA_TYPE_CHAR);
+
+                                       /* Message center time stamp */
+                                       sipc_util_marshal_object_add_data(notiObj, "MessageCenterTimeStamp.year", (void *)&(noti->cdmaMsg.MsgData.inAck.MessageCenterTimeStamp.year), TAPI_OBJECT_DATA_TYPE_INT);
+                                       sipc_util_marshal_object_add_data(notiObj, "MessageCenterTimeStamp.month", (void *)&(noti->cdmaMsg.MsgData.inAck.MessageCenterTimeStamp.month), TAPI_OBJECT_DATA_TYPE_INT);
+                                       sipc_util_marshal_object_add_data(notiObj, "MessageCenterTimeStamp.day", (void *)&(noti->cdmaMsg.MsgData.inAck.MessageCenterTimeStamp.day), TAPI_OBJECT_DATA_TYPE_INT);
+                                       sipc_util_marshal_object_add_data(notiObj, "MessageCenterTimeStamp.hours", (void *)&(noti->cdmaMsg.MsgData.inAck.MessageCenterTimeStamp.hours), TAPI_OBJECT_DATA_TYPE_INT);
+                                       sipc_util_marshal_object_add_data(notiObj, "MessageCenterTimeStamp.minutes", (void *)&(noti->cdmaMsg.MsgData.inAck.MessageCenterTimeStamp.minutes), TAPI_OBJECT_DATA_TYPE_INT);
+                                       sipc_util_marshal_object_add_data(notiObj, "MessageCenterTimeStamp.seconds", (void *)&(noti->cdmaMsg.MsgData.inAck.MessageCenterTimeStamp.seconds), TAPI_OBJECT_DATA_TYPE_INT);
+
+                                       break;
+                                       
+                               case SMS_MESSAGETYPE_USER_ACK:
+                                       /* Origination address */
+                                       sipc_util_marshal_object_add_data(notiObj, "OrigAddr.Digit", (void *)&(noti->cdmaMsg.MsgData.inDeliverAck.OrigAddr.Digit), TAPI_OBJECT_DATA_TYPE_INT);
+                                       sipc_util_marshal_object_add_data(notiObj, "OrigAddr.NumberMode", (void *)&(noti->cdmaMsg.MsgData.inDeliverAck.OrigAddr.NumberMode), TAPI_OBJECT_DATA_TYPE_INT); 
+                                       sipc_util_marshal_object_add_data(notiObj, "OrigAddr.NumberType", (void *)&(noti->cdmaMsg.MsgData.inDeliverAck.OrigAddr.NumberType), TAPI_OBJECT_DATA_TYPE_INT); 
+                                       sipc_util_marshal_object_add_data(notiObj, "OrigAddr.NumberPlan", (void *)&(noti->cdmaMsg.MsgData.inDeliverAck.OrigAddr.NumberPlan), TAPI_OBJECT_DATA_TYPE_INT); 
+                                       sipc_util_marshal_object_add_data(notiObj, "OrigAddr.szAddrLength", (void *)&(noti->cdmaMsg.MsgData.inDeliverAck.OrigAddr.szAddrLength), TAPI_OBJECT_DATA_TYPE_CHAR); 
+                                       sipc_util_marshal_object_add_data(notiObj, "OrigAddr.szAddress", (void *)&(noti->cdmaMsg.MsgData.inDeliverAck.OrigAddr.szAddress[0]), TAPI_OBJECT_DATA_TYPE_STRING); 
+
+                                       /* Origination subaddress */
+                                       sipc_util_marshal_object_add_data(notiObj, "OrigSubAddr.SubType", (void *)&(noti->cdmaMsg.MsgData.inDeliverAck.OrigSubAddr.SubType), TAPI_OBJECT_DATA_TYPE_INT);
+                                       sipc_util_marshal_object_add_data(notiObj, "OrigSubAddr.Odd", (void *)&(noti->cdmaMsg.MsgData.inDeliverAck.OrigSubAddr.Odd), TAPI_OBJECT_DATA_TYPE_CHAR); 
+                                       sipc_util_marshal_object_add_data(notiObj, "OrigSubAddr.szAddrLength", (void *)&(noti->cdmaMsg.MsgData.inDeliverAck.OrigSubAddr.szAddrLength), TAPI_OBJECT_DATA_TYPE_CHAR); 
+                                       sipc_util_marshal_object_add_data(notiObj, "OrigSubAddr.szAddress", (void *)&(noti->cdmaMsg.MsgData.inDeliverAck.OrigSubAddr.szAddress), TAPI_OBJECT_DATA_TYPE_CHAR);
+
+                                       sipc_util_marshal_object_add_data(notiObj, "TeleService", (void *)&(noti->cdmaMsg.MsgData.inDeliverAck.TeleService), TAPI_OBJECT_DATA_TYPE_INT);
+                                       sipc_util_marshal_object_add_data(notiObj, "bBearerReplySeqRequest", (void *)&(noti->cdmaMsg.MsgData.inDeliverAck.bBearerReplySeqRequest), TAPI_OBJECT_DATA_TYPE_INT);
+                                       sipc_util_marshal_object_add_data(notiObj, "ReplySeqNumber", (void *)&(noti->cdmaMsg.MsgData.inDeliverAck.ReplySeqNumber), TAPI_OBJECT_DATA_TYPE_CHAR);
+                                       sipc_util_marshal_object_add_data(notiObj, "MsgId", (void *)&(noti->cdmaMsg.MsgData.inDeliverAck.MsgId), TAPI_OBJECT_DATA_TYPE_INT);
+                                       sipc_util_marshal_object_add_data(notiObj, "MsgEncoding", (void *)&(noti->cdmaMsg.MsgData.inDeliverAck.MsgEncoding), TAPI_OBJECT_DATA_TYPE_INT);
+                                       sipc_util_marshal_object_add_data(notiObj, "MsgLength", (void *)&(noti->cdmaMsg.MsgData.inDeliverAck.MsgLength), TAPI_OBJECT_DATA_TYPE_INT);
+                                       sipc_util_marshal_object_add_data(notiObj, "szData", (void *)&(noti->cdmaMsg.MsgData.inDeliverAck.szData[0]), TAPI_OBJECT_DATA_TYPE_STRING);
+
+                                       /* Message center time stamp */
+                                       sipc_util_marshal_object_add_data(notiObj, "MessageCenterTimeStamp.year", (void *)&(noti->cdmaMsg.MsgData.inDeliverAck.MessageCenterTimeStamp.year), TAPI_OBJECT_DATA_TYPE_INT);
+                                       sipc_util_marshal_object_add_data(notiObj, "MessageCenterTimeStamp.month", (void *)&(noti->cdmaMsg.MsgData.inDeliverAck.MessageCenterTimeStamp.month), TAPI_OBJECT_DATA_TYPE_INT);
+                                       sipc_util_marshal_object_add_data(notiObj, "MessageCenterTimeStamp.day", (void *)&(noti->cdmaMsg.MsgData.inDeliverAck.MessageCenterTimeStamp.day), TAPI_OBJECT_DATA_TYPE_INT);
+                                       sipc_util_marshal_object_add_data(notiObj, "MessageCenterTimeStamp.hours", (void *)&(noti->cdmaMsg.MsgData.inDeliverAck.MessageCenterTimeStamp.hours), TAPI_OBJECT_DATA_TYPE_INT);
+                                       sipc_util_marshal_object_add_data(notiObj, "MessageCenterTimeStamp.minutes", (void *)&(noti->cdmaMsg.MsgData.inDeliverAck.MessageCenterTimeStamp.minutes), TAPI_OBJECT_DATA_TYPE_INT);
+                                       sipc_util_marshal_object_add_data(notiObj, "MessageCenterTimeStamp.seconds", (void *)&(noti->cdmaMsg.MsgData.inDeliverAck.MessageCenterTimeStamp.seconds), TAPI_OBJECT_DATA_TYPE_INT);  
+                                       
+                                       break;
+                               default:
+                                       break;
+                       }
+                       }
+                       break;
+               case TNOTI_SMS_CB_INCOM_EX_MSG: {
+                        const struct tnoti_sms_cdma_msg *noti = data;
+
+                       sipc_util_marshal_object_add_data(notiObj, "ServiceCategory", (void *)&(noti->cdmaMsg.MsgData.inBc.ServiceCategory), TAPI_OBJECT_DATA_TYPE_INT);
+
+                       sipc_util_marshal_object_add_data(notiObj, "MsgId", (void *)&(noti->cdmaMsg.MsgData.inBc.MsgId), TAPI_OBJECT_DATA_TYPE_INT);
+                       sipc_util_marshal_object_add_data(notiObj, "bBearerReplySeqRequest", (void *)&(noti->cdmaMsg.MsgData.inBc.bBearerReplySeqRequest), TAPI_OBJECT_DATA_TYPE_INT);
+                       sipc_util_marshal_object_add_data(notiObj, "ReplySeqNumber", (void *)&(noti->cdmaMsg.MsgData.inBc.ReplySeqNumber), TAPI_OBJECT_DATA_TYPE_CHAR);
+                       sipc_util_marshal_object_add_data(notiObj, "MsgEncoding", (void *)&(noti->cdmaMsg.MsgData.inBc.MsgEncoding), TAPI_OBJECT_DATA_TYPE_INT);
+                       sipc_util_marshal_object_add_data(notiObj, "MsgLength", (void *)&(noti->cdmaMsg.MsgData.inBc.MsgLength), TAPI_OBJECT_DATA_TYPE_INT);
+                       sipc_util_marshal_object_add_data(notiObj, "szData", (void *)&(noti->cdmaMsg.MsgData.inBc.szData[0]), TAPI_OBJECT_DATA_TYPE_STRING);
+
+                       /* Message center time stamp */
+                       sipc_util_marshal_object_add_data(notiObj, "MessageCenterTimeStamp.year", (void *)&(noti->cdmaMsg.MsgData.inBc.MessageCenterTimeStamp.year), TAPI_OBJECT_DATA_TYPE_INT);
+                       sipc_util_marshal_object_add_data(notiObj, "MessageCenterTimeStamp.month", (void *)&(noti->cdmaMsg.MsgData.inBc.MessageCenterTimeStamp.month), TAPI_OBJECT_DATA_TYPE_INT);
+                       sipc_util_marshal_object_add_data(notiObj, "MessageCenterTimeStamp.day", (void *)&(noti->cdmaMsg.MsgData.inBc.MessageCenterTimeStamp.day), TAPI_OBJECT_DATA_TYPE_INT);
+                       sipc_util_marshal_object_add_data(notiObj, "MessageCenterTimeStamp.hours", (void *)&(noti->cdmaMsg.MsgData.inBc.MessageCenterTimeStamp.hours), TAPI_OBJECT_DATA_TYPE_INT);
+                       sipc_util_marshal_object_add_data(notiObj, "MessageCenterTimeStamp.minutes", (void *)&(noti->cdmaMsg.MsgData.inBc.MessageCenterTimeStamp.minutes), TAPI_OBJECT_DATA_TYPE_INT);
+                       sipc_util_marshal_object_add_data(notiObj, "MessageCenterTimeStamp.seconds", (void *)&(noti->cdmaMsg.MsgData.inBc.MessageCenterTimeStamp.seconds), TAPI_OBJECT_DATA_TYPE_INT);
+
+                       /* Validity period - Absolute */
+                       sipc_util_marshal_object_add_data(notiObj, "ValidityPeriodAbs.year", (void *)&(noti->cdmaMsg.MsgData.inBc.ValidityPeriodAbs.year), TAPI_OBJECT_DATA_TYPE_INT);
+                       sipc_util_marshal_object_add_data(notiObj, "ValidityPeriodAbs.month", (void *)&(noti->cdmaMsg.MsgData.inBc.ValidityPeriodAbs.month), TAPI_OBJECT_DATA_TYPE_INT);
+                       sipc_util_marshal_object_add_data(notiObj, "ValidityPeriodAbs.day", (void *)&(noti->cdmaMsg.MsgData.inBc.ValidityPeriodAbs.day), TAPI_OBJECT_DATA_TYPE_INT);
+                       sipc_util_marshal_object_add_data(notiObj, "ValidityPeriodAbs.hours", (void *)&(noti->cdmaMsg.MsgData.inBc.ValidityPeriodAbs.hours), TAPI_OBJECT_DATA_TYPE_INT);
+                       sipc_util_marshal_object_add_data(notiObj, "ValidityPeriodAbs.minutes", (void *)&(noti->cdmaMsg.MsgData.inBc.ValidityPeriodAbs.minutes), TAPI_OBJECT_DATA_TYPE_INT);
+                       sipc_util_marshal_object_add_data(notiObj, "ValidityPeriodAbs.seconds", (void *)&(noti->cdmaMsg.MsgData.inBc.ValidityPeriodAbs.seconds), TAPI_OBJECT_DATA_TYPE_INT);
+
+                       sipc_util_marshal_object_add_data(notiObj, "ValidityPeriodRel", (void *)&(noti->cdmaMsg.MsgData.inBc.ValidityPeriodRel), TAPI_OBJECT_DATA_TYPE_CHAR);
+                       
+                       sipc_util_marshal_object_add_data(notiObj, "Priority", (void *)&(noti->cdmaMsg.MsgData.inBc.Priority), TAPI_OBJECT_DATA_TYPE_INT);
+                       sipc_util_marshal_object_add_data(notiObj, "AlertPriority", (void *)&(noti->cdmaMsg.MsgData.inBc.AlertPriority), TAPI_OBJECT_DATA_TYPE_INT);
+                       sipc_util_marshal_object_add_data(notiObj, "MsgLang", (void *)&(noti->cdmaMsg.MsgData.inBc.MsgLang), TAPI_OBJECT_DATA_TYPE_INT);
+                       sipc_util_marshal_object_add_data(notiObj, "Display", (void *)&(noti->cdmaMsg.MsgData.inBc.Display), TAPI_OBJECT_DATA_TYPE_INT);
+                       
+                       }
+                       break;
+               case TNOTI_SMS_MEMORY_STATUS: {
+                       const struct tnoti_sms_memory_status *noti = data;
+
+                       sipc_util_marshal_object_add_data(notiObj, "MemStatus", (void *)&(noti->status), TAPI_OBJECT_DATA_TYPE_INT);
+                       }
+                       break;
+               case TNOTI_SMS_DEVICE_READY: {
+                       const struct tnoti_sms_device_ready_status *noti = data;
+
+                       sipc_util_marshal_object_add_data(notiObj, "DeviceStatus", (void *)&(noti->status), TAPI_OBJECT_DATA_TYPE_INT);
+                       }
+                       break;
+               default:
+                       break;
+       }
+       
+       if(notiObj){
+               serial_d = sipc_util_marshal_object_serializer(notiObj);
+               hdr.data_len = strlen(serial_d);
+               sipc_util_marshal_object_destory(notiObj);
+       }
+
+       out_d = g_new0(char, sizeof(struct _tapi_header)+hdr.data_len);
+       memcpy(out_d, &hdr, sizeof(struct _tapi_header));
+       if(serial_d){
+               memcpy(out_d+sizeof(struct _tapi_header), serial_d, hdr.data_len);
+               g_free(serial_d);
+       }
+
+       ret = sipc_server_broadcast(s, out_d, sizeof(struct _tapi_header)+hdr.data_len);
+       g_free(out_d);
+
+       if(ret < 0){
+               return FALSE;
+       }
+
+       return TRUE;
+}
diff --git a/test/Makefile b/test/Makefile
new file mode 100644 (file)
index 0000000..2ee5e47
--- /dev/null
@@ -0,0 +1,20 @@
+TARGET = teltest
+
+SRCS   = main.c menu.c gprs.c network.c modem.c custom.c
+OBJS   = $(SRCS:.c=.o)
+PKGS   = libsocket-comm-client glib-2.0 gobject-2.0 libsocket-comm-client
+
+CC             = gcc
+CFLAGS = -Wall -g `pkg-config --cflags $(PKGS)`
+LIBS   = `pkg-config --libs $(PKGS)`
+
+all: $(TARGET)
+
+$(TARGET): $(OBJS)
+       $(CC) $(OBJS) $(LIBS) -o $(TARGET)
+
+.c.o: $(SRCS)
+       $(CC) $(CFLAGS) -c $^ -o $@
+
+clean:
+       rm -f $(OBJS) $(TARGET)
diff --git a/test/custom.c b/test/custom.c
new file mode 100644 (file)
index 0000000..bd37aed
--- /dev/null
@@ -0,0 +1,36 @@
+/*
+ * tel-plugin-socket-communicator
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Ja-young Gu <jygu@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/time.h>
+#include <unistd.h>
+#include <glib.h>
+#include <glib-object.h>
+
+#include "menu.h"
+
+
+struct menu_data menu_custom[] = {
+       { "1", "None", NULL, NULL, NULL},
+       { NULL, NULL, },
+};
+
diff --git a/test/gprs.c b/test/gprs.c
new file mode 100644 (file)
index 0000000..ea482e0
--- /dev/null
@@ -0,0 +1,117 @@
+/*
+ * tel-plugin-socket-communicator
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Ja-young Gu <jygu@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/time.h>
+#include <unistd.h>
+#include <glib.h>
+#include <glib-object.h>
+
+#include <tapi_sipc.h>
+
+#include "menu.h"
+#include "noti.h"
+
+static char data_gprs_dun_signal[MENU_DATA_SIZE + 1] = "dtr";
+static char data_gprs_dun_status[MENU_DATA_SIZE + 1] = "off";
+
+
+
+gboolean on_noti_ps_dun_pin_control(tapi_service_object_t *data, void *user_data)
+{
+       gchar *str_signal;
+       gboolean status;
+
+       msg("TAPI_NOTI_PS_DUN_PIN_CONTROL receive !!");
+
+       str_signal = tapi_service_object_get_string(data, "signal");
+       status = tapi_service_object_get_boolean(data, "status");
+
+       msg("signal = %s", str_signal);
+       msg("status = %d", status);
+       return TRUE;
+}
+
+
+gboolean on_noti_ps_external_call(tapi_service_object_t *data, void *user_data)
+{
+       msg("TAPI_NOTI_PS_EXTERNAL_CALL receive !!");
+
+       /* no data */
+
+       return TRUE;
+}
+
+static gboolean on_gprs_dun_callback(tapi_service_object_t *data, void *cb_data)
+{
+       int result;
+
+       msg("TAPI_SERVICE_PS_SET_DUN_PIN_CONTROL response receive");
+       result = tapi_service_object_get_int(data, "result");
+
+       msg("result = %d (0 = success)", result);
+
+       return TRUE;
+}
+
+static int run_gprs_dun(MManager *mm, struct menu_data *menu)
+{
+       tapi_handle_t *handle = menu_manager_ref_user_data(mm);
+       tapi_service_object_t *in = NULL;
+       gboolean in_status = FALSE;
+
+       if (!g_strcmp0(data_gprs_dun_status, "on")) {
+               in_status = TRUE;
+       }
+       else if (!g_strcmp0(data_gprs_dun_status, "off")) {
+               in_status = FALSE;
+       }
+       else {
+               msg("wrong value in STATUS");
+               return -1;
+       }
+
+       msg("SIGNAL = %s", data_gprs_dun_signal);
+       msg("STATUS = %s (convert to boolean = %d)", data_gprs_dun_status, in_status);
+       msg("call [%s] tapi service !!!", menu->title);
+
+       in = tapi_create_service_object(TAPI_SERVICE_PS_SET_DUN_PIN_CONTROL);
+       tapi_service_object_add_data(in, "signal", data_gprs_dun_signal, TAPI_OBJECT_DATA_TYPE_STRING);
+       tapi_service_object_add_data(in, "status", &in_status, TAPI_OBJECT_DATA_TYPE_BOOLEAN);
+
+       tel_processing_command_async(handle, in, on_gprs_dun_callback, NULL);
+
+       return 0;
+}
+
+struct menu_data menu_gprs_dun[] = {
+       { "1", "SIGNAL (dcd / dtr / dsr / rts / cts / ri)", NULL, NULL, data_gprs_dun_signal},
+       { "2", "STATUS (on / off)", NULL, NULL, data_gprs_dun_status},
+       { "3", "run", NULL, run_gprs_dun, NULL},
+       { NULL, NULL, },
+};
+
+struct menu_data menu_gprs[] = {
+       { "1", "DUN Pin Control", menu_gprs_dun, NULL, NULL},
+       { NULL, NULL, },
+};
+
diff --git a/test/main.c b/test/main.c
new file mode 100644 (file)
index 0000000..9311fad
--- /dev/null
@@ -0,0 +1,135 @@
+/*
+ * tel-plugin-socket-communicator
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Ja-young Gu <jygu@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/time.h>
+#include <unistd.h>
+#include <glib.h>
+#include <glib-object.h>
+
+#include <tapi_sipc.h>
+
+#include "menu.h"
+#include "noti.h"
+
+extern struct menu_data menu_modem[];
+extern struct menu_data menu_gprs[];
+extern struct menu_data menu_net[];
+extern struct menu_data menu_custom[];
+
+static struct menu_data menu_xxx[] = {
+       { "1", "XXX",           NULL,   NULL,           NULL},
+       { NULL, NULL, },
+};
+
+static struct menu_data menu_main[] = {
+       { "1", "Common",        menu_xxx,       NULL,           NULL},
+       { "2", "Modem",         menu_modem,     NULL,           NULL},
+       { "3", "Call",          menu_xxx,       NULL,           NULL},
+       { "4", "SIM",           menu_xxx,       NULL,           NULL},
+       { "5", "SS",            menu_xxx,       NULL,           NULL},
+       { "6", "SMS",           menu_xxx,       NULL,           NULL},
+       { "7", "Network",       menu_net,       NULL,           NULL},
+       { "8", "SAT",           menu_xxx,       NULL,           NULL},
+       { "9", "GPRS",          menu_gprs,      NULL,           NULL},
+       { "a", "SOUND",         menu_xxx,       NULL,           NULL},
+       { "b", "Custom",        menu_custom,NULL,               NULL},
+       { NULL, NULL, },
+};
+
+tapi_handle_t *register_client(void)
+{
+       tapi_handle_t *handle;
+
+       handle = tapi_init("com.xxx.test", "default");
+       if (!handle) {
+               printf("fail to register server\n");
+               return NULL;
+       }
+
+       printf("success to register server\n");
+       return handle;
+}
+
+void register_event(tapi_handle_t *handle)
+{
+       int ret;
+
+       /* PS */
+       ret = tapi_register_notification(handle, TAPI_NOTI_PS_DUN_PIN_CONTROL, on_noti_ps_dun_pin_control, NULL);
+       ret = tapi_register_notification(handle, TAPI_NOTI_PS_EXTERNAL_CALL, on_noti_ps_external_call, NULL);
+
+       /* Network */
+       ret = tapi_register_notification(handle, TAPI_NOTI_NETWORK_REGISTRATION_STATUS, on_noti_network_registration_status, NULL);
+       ret = tapi_register_notification(handle, TAPI_NOTI_NETWORK_LOCATION_CELLINFO, on_noti_network_location_cellinfo, NULL);
+       ret = tapi_register_notification(handle, TAPI_NOTI_NETWORK_ICON_INFO, on_noti_network_icon_info, NULL);
+       ret = tapi_register_notification(handle, TAPI_NOTI_NETWORK_CHANGE, on_noti_network_change, NULL);
+       ret = tapi_register_notification(handle, TAPI_NOTI_NETWORK_TIMEINFO, on_noti_network_timeinfo, NULL);
+}
+
+void deregister_client(tapi_handle_t *handle)
+{
+       gboolean rv = FALSE;
+
+       if (!handle)
+               return;
+
+       rv = tapi_deinit(handle);
+       if (!rv) {
+               printf("fail to deregister server\n");
+               return;
+       }
+
+       printf("success to deregister server\n");
+       return;
+}
+
+int main(int arg, char **argv)
+{
+       GMainLoop *mainloop;
+       GIOChannel *channel = g_io_channel_unix_new(STDIN_FILENO);
+       MManager *manager;
+       tapi_handle_t *handle;
+
+       mainloop = g_main_loop_new(NULL, FALSE);
+       handle = register_client();
+
+       register_event(handle);
+
+       printf("******* Integrated TAPI Test Application: Version 0.4  *****\n");
+       printf("******* Buid On: %s  %s  ********\n", __DATE__, __TIME__);
+
+       manager = menu_manager_new(menu_main, mainloop);
+       menu_manager_set_user_data(manager, handle);
+       menu_manager_run(manager);
+
+       g_io_add_watch(channel, (G_IO_IN | G_IO_ERR | G_IO_HUP | G_IO_NVAL), on_menu_manager_keyboard, manager);
+
+       g_main_loop_run(mainloop);
+
+       printf("******* Bye bye *******\n");
+
+       deregister_client(handle);
+
+       return 0;
+}
+
diff --git a/test/menu.c b/test/menu.c
new file mode 100644 (file)
index 0000000..5c82451
--- /dev/null
@@ -0,0 +1,249 @@
+/*
+ * tel-plugin-socket-communicator
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Ja-young Gu <jygu@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+#include <glib-object.h>
+
+#include "menu.h"
+
+#define DEFAULT_MENU_MENU      "m"
+#define DEFAULT_MENU_PREV      "p"
+#define DEFAULT_MENU_QUIT      "q"
+
+
+struct menu_manager {
+       GQueue *stack;
+       GQueue *title_stack;
+
+       struct menu_data *menu;
+
+       char *buf;
+
+       void *user_data;
+       GMainLoop *mainloop;
+};
+
+
+char key_buffer[MENU_DATA_SIZE];
+
+static void _show_prompt()
+{
+       msgn(" >> ");
+}
+
+static void _show_reserved_menu()
+{
+       msg(ANSI_COLOR_DARKGRAY "--------------------------------------------" ANSI_COLOR_NORMAL);
+       msg(" [%3s] Previous menu ", DEFAULT_MENU_PREV);
+       msg(" [%3s] Show Menu ", DEFAULT_MENU_MENU);
+       msg(" [%3s] Quit ", DEFAULT_MENU_QUIT);
+}
+
+static void _show_input_ok()
+{
+       msg("OK.");
+}
+
+static void _show_menu(MManager *m, struct menu_data menu[])
+{
+       int i = 0;
+       int len = 0;
+       struct menu_data *item;
+
+       if (!menu)
+               return;
+
+       msg("");
+       msg("============================================");
+       len = g_queue_get_length(m->title_stack);
+       msgn(ANSI_COLOR_YELLOW " Main");
+       if (len > 0) {
+               for (i = 0; i < len; i++) {
+                       msgn(ANSI_COLOR_NORMAL " >> " ANSI_COLOR_YELLOW "%s", (char *)g_queue_peek_nth(m->title_stack, i));
+               }
+       }
+       msg(ANSI_COLOR_NORMAL);
+       msg("--------------------------------------------");
+
+       i = 0;
+       while (1) {
+               item = menu + i;
+               if (item->key == NULL)
+                       break;
+
+               //msgn(" [%p][%3s] ", item, item->key);
+               msgn(" [%3s] ", item->key);
+               if (item->data) {
+                       msg("%s " ANSI_COLOR_LIGHTBLUE "(%s)" ANSI_COLOR_NORMAL, item->title, item->data);
+               }
+               else {
+                       msg("%s", item->title);
+               }
+
+               i++;
+       }
+
+       _show_reserved_menu();
+
+       msg("============================================");
+
+       _show_prompt();
+}
+
+static void _show_item_data_input_msg(struct menu_data *item)
+{
+       msg("");
+       msg("============================================");
+       msg(" Input [%s] data ", item->title);
+       msg("--------------------------------------------");
+       msg(" current = [%s]", item->data);
+       msgn(" new >> ");
+}
+
+static void _move_menu(MManager *mm, struct menu_data menu[], char *key)
+{
+       struct menu_data *item;
+       int i = 0;
+
+       if (!mm->menu)
+               return;
+
+       if (!g_strcmp0(DEFAULT_MENU_PREV, key)) {
+               if (g_queue_get_length(mm->stack) > 0) {
+                       mm->menu = g_queue_pop_tail(mm->stack);
+                       g_queue_pop_tail(mm->title_stack);
+               }
+               _show_menu(mm, mm->menu);
+               mm->buf = key_buffer;
+       }
+       else if (!g_strcmp0(DEFAULT_MENU_MENU, key)) {
+               _show_menu(mm, mm->menu);
+       }
+       else if (!g_strcmp0(DEFAULT_MENU_QUIT, key)) {
+               g_main_loop_quit(mm->mainloop);
+       }
+
+       while (1) {
+               item = menu + i;
+               if (item->key == NULL)
+                       break;
+
+               if (!g_strcmp0(item->key, key)) {
+                       if (item->sub_menu) {
+                               g_queue_push_tail(mm->stack, mm->menu);
+                               g_queue_push_tail(mm->title_stack, item->title);
+
+                               mm->menu = item->sub_menu;
+                               _show_menu(mm, mm->menu);
+                               mm->buf = key_buffer;
+                       }
+
+                       if (item->callback)
+                               item->callback(mm, item);
+
+                       if (item->data) {
+                               _show_item_data_input_msg(item);
+                               mm->buf = item->data;
+                       }
+                       return;
+               }
+
+               i++;
+       }
+
+       _show_prompt();
+}
+
+MManager *menu_manager_new(struct menu_data items[], GMainLoop *mainloop)
+{
+       MManager *mm;
+
+       mm = calloc(sizeof(struct menu_manager), 1);
+       mm->stack = g_queue_new();
+       mm->title_stack = g_queue_new();
+       mm->menu = items;
+       mm->mainloop = mainloop;
+
+       return mm;
+}
+
+int menu_manager_run(MManager *mm)
+{
+       _show_menu(mm, mm->menu);
+
+       mm->buf = key_buffer;
+
+       return 0;
+}
+
+int menu_manager_set_user_data(MManager *mm, void *user_data)
+{
+       if (!mm)
+               return -1;
+
+       mm->user_data = user_data;
+
+       return 0;
+}
+
+void *menu_manager_ref_user_data(MManager *mm)
+{
+       if (!mm)
+               return NULL;
+
+       return mm->user_data;
+}
+
+gboolean on_menu_manager_keyboard(GIOChannel *src, GIOCondition con, gpointer data)
+{
+       MManager *mm = data;
+       char local_buf[MENU_DATA_SIZE + 1] = {
+                       0, };
+
+       fgets(local_buf, MENU_DATA_SIZE, stdin);
+
+       if (strlen(local_buf) > 0) {
+               if (local_buf[strlen(local_buf) - 1] == '\n')
+                       local_buf[strlen(local_buf) - 1] = '\0';
+       }
+
+       if (mm->buf == key_buffer) {
+               if (strlen(local_buf) < 1) {
+                       _show_prompt();
+                       return TRUE;
+               }
+
+               _move_menu(mm, mm->menu, local_buf);
+       }
+       else {
+               if (mm->buf) {
+                       memset(mm->buf, 0, MENU_DATA_SIZE);
+                       memcpy(mm->buf, local_buf, MENU_DATA_SIZE);
+                       _show_input_ok();
+               }
+               mm->buf = key_buffer;
+               _move_menu(mm, mm->menu, DEFAULT_MENU_MENU);
+       }
+
+       return TRUE;
+}
diff --git a/test/menu.h b/test/menu.h
new file mode 100644 (file)
index 0000000..c84fc1a
--- /dev/null
@@ -0,0 +1,70 @@
+/*
+ * tel-plugin-socket-communicator
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Ja-young Gu <jygu@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __MENU_H__
+#define __MENU_H__
+
+__BEGIN_DECLS
+
+#define ANSI_COLOR_NORMAL "\e[0m"
+
+#define ANSI_COLOR_BLACK "\e[0;30m"
+#define ANSI_COLOR_RED "\e[0;31m"
+#define ANSI_COLOR_GREEN "\e[0;32m"
+#define ANSI_COLOR_BROWN "\e[0;33m"
+#define ANSI_COLOR_BLUE "\e[0;34m"
+#define ANSI_COLOR_MAGENTA "\e[0;35m"
+#define ANSI_COLOR_CYAN "\e[0;36m"
+#define ANSI_COLOR_LIGHTGRAY "\e[0;37m"
+
+#define ANSI_COLOR_DARKGRAY "\e[1;30m"
+#define ANSI_COLOR_LIGHTRED "\e[1;31m"
+#define ANSI_COLOR_LIGHTGREEN "\e[1;32m"
+#define ANSI_COLOR_YELLOW "\e[1;33m"
+#define ANSI_COLOR_LIGHTBLUE "\e[1;34m"
+#define ANSI_COLOR_LIGHTMAGENTA "\e[1;35m"
+#define ANSI_COLOR_LIGHTCYAN "\e[1;36m"
+#define ANSI_COLOR_WHITE "\e[1;37m"
+
+#define msg(fmt,args...)  { fprintf(stdout, fmt "\n", ##args); fflush(stdout); }
+#define msgn(fmt,args...)  { fprintf(stdout, fmt, ##args); fflush(stdout); }
+
+#define MENU_DATA_SIZE         255
+
+typedef struct menu_manager MManager;
+
+struct menu_data {
+       char *key;
+       char *title;
+       struct menu_data *sub_menu;
+       int (*callback)(MManager *mm, struct menu_data *menu);
+       char *data;
+};
+
+MManager* menu_manager_new(struct menu_data items[], GMainLoop *mainloop);
+int       menu_manager_run(MManager *mm);
+int       menu_manager_set_user_data(MManager *mm, void *user_data);
+void*     menu_manager_ref_user_data(MManager *mm);
+
+gboolean  on_menu_manager_keyboard(GIOChannel *src, GIOCondition con, gpointer data);
+
+__END_DECLS
+
+#endif
diff --git a/test/modem.c b/test/modem.c
new file mode 100644 (file)
index 0000000..0fabe74
--- /dev/null
@@ -0,0 +1,93 @@
+/*
+ * tel-plugin-socket-communicator
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Ja-young Gu <jygu@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/time.h>
+#include <unistd.h>
+#include <glib.h>
+#include <glib-object.h>
+
+#include "menu.h"
+
+static char data_modem_set_flight_mode_enable[MENU_DATA_SIZE + 1] = "true";
+
+
+static int run_modem_set_flight_mode(MManager *mm, struct menu_data *menu)
+{
+       msg("enable = %s", data_modem_set_flight_mode_enable);
+       msg("call [%s] tapi service !!!", menu->title);
+
+       return 0;
+}
+
+static int run_modem_get_flight_mode(MManager *mm, struct menu_data *menu)
+{
+       msg("call [%s] tapi service !!!", menu->title);
+
+       return 0;
+}
+
+static int run_modem_get_imei(MManager *mm, struct menu_data *menu)
+{
+       msg("call [%s] tapi service !!!", menu->title);
+
+       return 0;
+}
+
+static int run_modem_get_version(MManager *mm, struct menu_data *menu)
+{
+       msg("call [%s] tapi service !!!", menu->title);
+
+       return 0;
+}
+
+
+static struct menu_data menu_modem_set_flight_mode[] = {
+       { "1", "enable (true / false)", NULL, NULL, data_modem_set_flight_mode_enable},
+       { "2", "run", NULL, run_modem_set_flight_mode, NULL},
+       { NULL, NULL, },
+};
+
+static struct menu_data menu_modem_get_flight_mode[] = {
+       { "1", "run", NULL, run_modem_get_flight_mode, NULL},
+       { NULL, NULL, },
+};
+
+
+static struct menu_data menu_modem_get_imei[] = {
+       { "1", "run", NULL, run_modem_get_imei, NULL},
+       { NULL, NULL, },
+};
+
+static struct menu_data menu_modem_get_version[] = {
+       { "1", "run", NULL, run_modem_get_version, NULL},
+       { NULL, NULL, },
+};
+
+
+struct menu_data menu_modem[] = {
+       { "1", "SET Flight mode", menu_modem_set_flight_mode, NULL, NULL},
+       { "2", "GET Flight mode", menu_modem_get_flight_mode, NULL, NULL},
+       { "3", "GET IMEI", menu_modem_get_imei, NULL, NULL},
+       { "4", "GET Version", menu_modem_get_version, NULL, NULL},
+       { NULL, NULL, },
+};
diff --git a/test/network.c b/test/network.c
new file mode 100644 (file)
index 0000000..5a894cf
--- /dev/null
@@ -0,0 +1,428 @@
+/*
+ * tel-plugin-socket-communicator
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Ja-young Gu <jygu@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/time.h>
+#include <unistd.h>
+#include <glib.h>
+#include <glib-object.h>
+
+#include <tapi_sipc.h>
+
+#include "menu.h"
+#include "noti.h"
+
+static char data_menu_net_set_plmn_mode_mode[MENU_DATA_SIZE + 1] = "automatic";
+static char data_menu_net_set_plmn_mode_plmn[MENU_DATA_SIZE + 1] = "450001";
+
+static char data_net_set_service_domain_domain[MENU_DATA_SIZE + 1] = "combined";
+
+static char data_net_set_band_mode[MENU_DATA_SIZE + 1] = "only";
+static char data_net_set_band_band[MENU_DATA_SIZE + 1] = "1";
+
+static char data_net_set_preferred_plmn_mode[MENU_DATA_SIZE + 1] = "add";
+static char data_net_set_preferred_plmn_plmn[MENU_DATA_SIZE + 1] = "45001";
+static char data_net_set_preferred_plmn_act[MENU_DATA_SIZE + 1] = "1";
+static char data_net_set_preferred_plmn_ef_index[MENU_DATA_SIZE + 1] = "0";
+
+static char data_net_set_order_order[MENU_DATA_SIZE + 1] = "auto";
+
+static char data_net_set_poa_enable[MENU_DATA_SIZE + 1] = "true";
+
+
+gboolean on_noti_network_registration_status(tapi_service_object_t *data, void *user_data)
+{
+       gint cs_domain_status, ps_domain_status, service_type, roaming_status;
+
+       msg("TAPI_NOTI_NETWORK_REGISTRATION_STATUS receive !!");
+
+       cs_domain_status = tapi_service_object_get_int(data, "cs_domain_status");
+       ps_domain_status = tapi_service_object_get_int(data, "ps_domain_status");
+       service_type = tapi_service_object_get_int(data, "service_type");
+       roaming_status = tapi_service_object_get_int(data, "roaming_status");
+
+       msg("cs_domain_status = %d", cs_domain_status);
+       msg("ps_domain_status = %d", ps_domain_status);
+       msg("service_type = %d", service_type);
+       msg("roaming_status = %d", roaming_status);
+
+       return TRUE;
+}
+
+gboolean on_noti_network_location_cellinfo(tapi_service_object_t *data, void *user_data)
+{
+       gint lac, cell_id;
+
+       msg("TAPI_NOTI_NETWORK_LOCATION_CELLINFO receive !!");
+
+       lac = tapi_service_object_get_int(data, "lac");
+       cell_id = tapi_service_object_get_int(data, "cell_id");
+
+       msg("lac = %d", lac);
+       msg("cell_id = %d", cell_id);
+
+       return TRUE;
+}
+
+gboolean on_noti_network_icon_info(tapi_service_object_t *data, void *user_data)
+{
+       gint type, rssi, battery, hdr_rssi;
+
+       msg("TAPI_NOTI_NETWORK_ICON_INFO receive !!");
+
+       type = tapi_service_object_get_int(data, "type");
+       rssi = tapi_service_object_get_int(data, "rssi");
+       battery = tapi_service_object_get_int(data, "battery");
+       hdr_rssi = tapi_service_object_get_int(data, "hdr_rssi");
+
+       msg("type = %d", type);
+       msg("rssi = %d", rssi);
+       msg("battery = %d", battery);
+       msg("hdr_rssi = %d", hdr_rssi);
+
+       return TRUE;
+}
+
+gboolean on_noti_network_change(tapi_service_object_t *data, void *user_data)
+{
+       gchar *plmn;
+       gint act, lac, carrier, sid, nid, bs_id, bs_lat, bs_long, reg_sonze, pilot_pn;
+
+       msg("TAPI_NOTI_NETWORK_CHANGE receive !!");
+
+       plmn = tapi_service_object_get_string(data, "plmn");
+       act = tapi_service_object_get_int(data, "act");
+       lac = tapi_service_object_get_int(data, "lac");
+       carrier = tapi_service_object_get_int(data, "carrier");
+       sid = tapi_service_object_get_int(data, "sid");
+       nid = tapi_service_object_get_int(data, "nid");
+       bs_id = tapi_service_object_get_int(data, "bs_id");
+       bs_lat = tapi_service_object_get_int(data, "bs_lat");
+       bs_long = tapi_service_object_get_int(data, "bs_long");
+       reg_sonze = tapi_service_object_get_int(data, "reg_sonze");
+       pilot_pn = tapi_service_object_get_int(data, "pilot_pn");
+
+       msg("plmn = %s", plmn);
+       msg("act = %d", act);
+       msg("lac = %d", lac);
+       msg("carrier = %d", carrier);
+       msg("sid = %d", sid);
+       msg("nid = %d", nid);
+       msg("bs_id = %d", bs_id);
+       msg("bs_lat = %d", bs_lat);
+       msg("bs_long = %d", bs_long);
+       msg("reg_sonze = %d", reg_sonze);
+       msg("pilot_pn = %d", pilot_pn);
+
+       return TRUE;
+}
+
+gboolean on_noti_network_timeinfo(tapi_service_object_t *data, void *user_data)
+{
+       gchar *plmn;
+       gint year, month, day, hour, minute, second, wday, gmtoff, dstoff, isdst;
+
+       msg("TAPI_NOTI_NETWORK_TIMEINFO receive !!");
+
+       plmn = tapi_service_object_get_string(data, "plmn");
+       year = tapi_service_object_get_int(data, "year");
+       month = tapi_service_object_get_int(data, "month");
+       day = tapi_service_object_get_int(data, "day");
+       hour = tapi_service_object_get_int(data, "hour");
+       minute = tapi_service_object_get_int(data, "minute");
+       second = tapi_service_object_get_int(data, "second");
+       wday = tapi_service_object_get_int(data, "wday");
+       gmtoff = tapi_service_object_get_int(data, "gmtoff");
+       dstoff = tapi_service_object_get_int(data, "dstoff");
+       isdst = tapi_service_object_get_int(data, "isdst");
+
+       msg("plmn = %s", plmn);
+       msg("year = %d", year);
+       msg("month = %d", month);
+       msg("day = %d", day);
+       msg("hour = %d", hour);
+       msg("minute = %d", minute);
+       msg("second = %d", second);
+       msg("wday = %d", wday);
+       msg("gmtoff = %d", gmtoff);
+       msg("dstoff = %d", dstoff);
+       msg("isdst = %d", isdst);
+
+       return TRUE;
+}
+
+static gboolean on_net_search(tapi_service_object_t *data, void *cb_data)
+{
+       int count;
+       int i;
+       char buf[10] = {0, };
+       char *plmn;
+       int status;
+       int act;
+       tapi_service_object_t *entry;
+
+       msg("TAPI_SERVICE_NETWORK_SEARCH response receive");
+       count = tapi_service_object_get_int(data, "count");
+
+       msg("count = %d", count);
+       for (i = 0; i < count; i++) {
+               snprintf(buf, 10, "%d", i);
+               entry = tapi_service_object_get_object(data, buf);
+               if (!entry)
+                       continue;
+
+               plmn = tapi_service_object_get_string(entry, "plmn");
+               status = tapi_service_object_get_int(entry, "status");
+               act = tapi_service_object_get_int(entry, "act");
+               msg("[%2d] plmn=[%s], status=%d, act=%d", i, plmn, status, act);
+       }
+
+       return TRUE;
+}
+
+static int run_net_search(MManager *mm, struct menu_data *menu)
+{
+       tapi_handle_t *handle = menu_manager_ref_user_data(mm);
+       tapi_service_object_t *in = NULL;
+
+       msg("call [%s] tapi service !!!", menu->title);
+
+       in = tapi_create_service_object(TAPI_SERVICE_NETWORK_SEARCH);
+
+       tel_processing_command_async(handle, in, on_net_search, NULL);
+
+       return 0;
+}
+
+static int run_net_set_plmn_mode(MManager *mm, struct menu_data *menu)
+{
+       msg("mode = %s", data_menu_net_set_plmn_mode_mode);
+       msg("plmn = %s", data_menu_net_set_plmn_mode_plmn);
+       msg("call [%s] tapi service !!!", menu->title);
+
+       return 0;
+}
+
+static int run_net_get_plmn_mode(MManager *mm, struct menu_data *menu)
+{
+       msg("call [%s] tapi service !!!", menu->title);
+
+       return 0;
+}
+
+static int run_net_set_service_domain(MManager *mm, struct menu_data *menu)
+{
+       msg("call [%s] tapi service !!!", menu->title);
+
+       return 0;
+}
+
+static int run_net_get_service_domain(MManager *mm, struct menu_data *menu)
+{
+       msg("call [%s] tapi service !!!", menu->title);
+
+       return 0;
+}
+
+static int run_net_set_band(MManager *mm, struct menu_data *menu)
+{
+       msg("call [%s] tapi service !!!", menu->title);
+
+       return 0;
+}
+
+static int run_net_get_band(MManager *mm, struct menu_data *menu)
+{
+       msg("call [%s] tapi service !!!", menu->title);
+
+       return 0;
+}
+
+static int run_net_set_preferred_plmn(MManager *mm, struct menu_data *menu)
+{
+       msg("call [%s] tapi service !!!", menu->title);
+
+       return 0;
+}
+
+static int run_net_get_preferred_plmn(MManager *mm, struct menu_data *menu)
+{
+       msg("call [%s] tapi service !!!", menu->title);
+
+       return 0;
+}
+
+static int run_net_set_order(MManager *mm, struct menu_data *menu)
+{
+       msg("call [%s] tapi service !!!", menu->title);
+
+       return 0;
+}
+
+static int run_net_get_order(MManager *mm, struct menu_data *menu)
+{
+       msg("call [%s] tapi service !!!", menu->title);
+
+       return 0;
+}
+
+static int run_net_set_poa(MManager *mm, struct menu_data *menu)
+{
+       msg("call [%s] tapi service !!!", menu->title);
+
+       return 0;
+}
+
+static int run_net_get_poa(MManager *mm, struct menu_data *menu)
+{
+       msg("call [%s] tapi service !!!", menu->title);
+
+       return 0;
+}
+
+static int run_net_set_cancel_manual_search(MManager *mm, struct menu_data *menu)
+{
+       msg("call [%s] tapi service !!!", menu->title);
+
+       return 0;
+}
+
+static int run_net_get_serving_network(MManager *mm, struct menu_data *menu)
+{
+       msg("call [%s] tapi service !!!", menu->title);
+
+       return 0;
+}
+
+
+static struct menu_data menu_net_search[] = {
+       { "1", "run", NULL, run_net_search, NULL},
+       { NULL, NULL, },
+};
+
+static struct menu_data menu_net_set_plmn_mode[] = {
+       { "1", "mode (automatic / manual)", NULL, NULL, data_menu_net_set_plmn_mode_mode},
+       { "2", "plmn (45001)", NULL, NULL, data_menu_net_set_plmn_mode_plmn},
+       { "3", "run", NULL, run_net_set_plmn_mode, NULL},
+       { NULL, NULL, },
+};
+
+static struct menu_data menu_net_get_plmn_mode[] = {
+       { "1", "run", NULL, run_net_get_plmn_mode, NULL},
+       { NULL, NULL, },
+};
+
+
+static struct menu_data menu_net_set_service_domain[] = {
+       { "1", "domain (circuit / packet / combined)", NULL, NULL, data_net_set_service_domain_domain},
+       { "2", "run", NULL, run_net_set_service_domain, NULL},
+       { NULL, NULL, },
+};
+
+static struct menu_data menu_net_get_service_domain[] = {
+       { "1", "run", NULL, run_net_get_service_domain, NULL},
+       { NULL, NULL, },
+};
+
+
+static struct menu_data menu_net_set_band[] = {
+       { "1", "mode (only / preferred)", NULL, NULL, data_net_set_band_mode},
+       { "2", "band (1=.., 2=..)", NULL, NULL, data_net_set_band_band},
+       { "3", "run", NULL, run_net_set_band, NULL},
+       { NULL, NULL, },
+};
+
+static struct menu_data menu_net_get_band[] = {
+       { "1", "run", NULL, run_net_get_band, NULL},
+       { NULL, NULL, },
+};
+
+
+static struct menu_data menu_net_set_preferred_plmn[] = {
+       { "1", "mode (add / edit / delete)", NULL, NULL, data_net_set_preferred_plmn_mode},
+       { "2", "plmn (45001)", NULL, NULL, data_net_set_preferred_plmn_plmn},
+       { "3", "act (1=.., 2=..)", NULL, NULL, data_net_set_preferred_plmn_act},
+       { "4", "ef_index (0,...)", NULL, NULL, data_net_set_preferred_plmn_ef_index},
+       { "5", "run", NULL, run_net_set_preferred_plmn, NULL},
+       { NULL, NULL, },
+};
+
+static struct menu_data menu_net_get_preferred_plmn[] = {
+       { "1", "run", NULL, run_net_get_preferred_plmn, NULL},
+       { NULL, NULL, },
+};
+
+
+static struct menu_data menu_net_set_order[] = {
+       { "1", "order (auto / gsm / wcdma / no_change)", NULL, NULL, data_net_set_order_order},
+       { "2", "run", NULL, run_net_set_order, NULL},
+       { NULL, NULL, },
+};
+
+static struct menu_data menu_net_get_order[] = {
+       { "1", "run", NULL, run_net_get_order, NULL},
+       { NULL, NULL, },
+};
+
+
+static struct menu_data menu_net_set_poa[] = {
+       { "1", "enable (true / false)", NULL, NULL, data_net_set_poa_enable},
+       { "2", "run", NULL, run_net_set_poa, NULL},
+       { NULL, NULL, },
+};
+
+static struct menu_data menu_net_get_poa[] = {
+       { "1", "run", NULL, run_net_get_poa, NULL},
+       { NULL, NULL, },
+};
+
+
+static struct menu_data menu_net_set_cancel_manual_search[] = {
+       { "1", "run", NULL, run_net_set_cancel_manual_search, NULL},
+       { NULL, NULL, },
+};
+
+
+static struct menu_data menu_net_get_serving_network[] = {
+       { "1", "run", NULL, run_net_get_serving_network, NULL},
+       { NULL, NULL, },
+};
+
+
+struct menu_data menu_net[] = {
+       { "1", "Search", menu_net_search, NULL, NULL},
+       { "2s", "SET PLMN Selection mode", menu_net_set_plmn_mode, NULL, NULL},
+       { "2g", "GET PLMN Selection mode", menu_net_get_plmn_mode, NULL, NULL},
+       { "3s", "SET Service Domain", menu_net_set_service_domain, NULL, NULL},
+       { "3g", "GET_Service Domain", menu_net_get_service_domain, NULL, NULL},
+       { "4s", "SET Band", menu_net_set_band, NULL, NULL},
+       { "4g", "GET Band", menu_net_get_band, NULL, NULL},
+       { "5s", "SET Preferred PLMN", menu_net_set_preferred_plmn, NULL, NULL},
+       { "5g", "GET Preferred PLMN", menu_net_get_preferred_plmn, NULL, NULL},
+       { "6s", "SET Order", menu_net_set_order, NULL, NULL},
+       { "6g", "GET Order", menu_net_get_order, NULL, NULL},
+       { "7s", "SET Power on attach", menu_net_set_poa, NULL, NULL},
+       { "7g", "GET Power on attach", menu_net_get_poa, NULL, NULL},
+       { "8s", "SET Cancel manual search", menu_net_set_cancel_manual_search, NULL, NULL},
+       { "9g", "GET Serving network", menu_net_get_serving_network, NULL, NULL},
+       { NULL, NULL, },
+};
diff --git a/test/noti.h b/test/noti.h
new file mode 100644 (file)
index 0000000..d8e3bd3
--- /dev/null
@@ -0,0 +1,33 @@
+/*
+ * tel-plugin-socket-communicator
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Ja-young Gu <jygu@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __NOTI_H__
+#define __NOTI_H__
+
+gboolean on_noti_ps_dun_pin_control(tapi_service_object_t *data, void *user_data);
+gboolean on_noti_ps_external_call(tapi_service_object_t *data, void *user_data);
+
+gboolean on_noti_network_registration_status(tapi_service_object_t *data, void *user_data);
+gboolean on_noti_network_location_cellinfo(tapi_service_object_t *data, void *user_data);
+gboolean on_noti_network_icon_info(tapi_service_object_t *data, void *user_data);
+gboolean on_noti_network_change(tapi_service_object_t *data, void *user_data);
+gboolean on_noti_network_timeinfo(tapi_service_object_t *data, void *user_data);
+
+#endif