Revise llcp, step 1
authorWonkyu Kwon <wonkyu.kwon@samsung.com>
Wed, 11 Sep 2013 09:01:19 +0000 (18:01 +0900)
committerYoungjae Shin <yj99.shin@samsung.com>
Thu, 12 Sep 2013 05:16:08 +0000 (14:16 +0900)
 - add llcp accept, reject funtion
 - remove unused parameter
 - add signal for socket error and result of listen

Change-Id: I048a6dab9f3a4f9fd86e711ebdbda3fb85781aee

13 files changed:
CMakeLists.txt
client/include/net_nfc_client_llcp.h
client/net_nfc_client_llcp.c
common/net_nfc.xml
daemon/net_nfc_server_common.c
daemon/net_nfc_server_controller.c
daemon/net_nfc_server_controller.h
daemon/net_nfc_server_llcp.c
daemon/net_nfc_server_llcp.h
daemon/net_nfc_server_p2p.c
daemon/net_nfc_server_process_snep.c
tests/main.c
tests/net_nfc_test_llcp.c

index dbe25c2..c5ff1a3 100644 (file)
@@ -15,7 +15,7 @@ IF("${ARCH}" MATCHES "^arm.*")
        ADD_DEFINITIONS("-DTARGET")
        MESSAGE("add -DTARGET")
        SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${ARM_CFLAGS}")
-ENDIF()
+ENDIF("${ARCH}" MATCHES "^arm.*")
 
 SET(CMAKE_SHARED_LINKER_FLAGS " -Wl,--as-needed -Wl,--rpath=${LIB_INSTALL_DIR}")
 SET(CMAKE_EXE_LINKER_FLAGS " -Wl,--as-needed -Wl,--rpath=${LIB_INSTALL_DIR}")
index e31e790..3e127fb 100644 (file)
@@ -25,6 +25,12 @@ typedef void (*net_nfc_client_llcp_listen_completed) (net_nfc_error_e result,
                net_nfc_llcp_socket_t client_socket,
                void *user_data);
 
+typedef void (*net_nfc_client_llcp_accept_completed)(net_nfc_error_e result,
+               void *user_data);
+
+typedef void (*net_nfc_client_llcp_reject_completed)(net_nfc_error_e result,
+               void *user_data);
+
 typedef void (*net_nfc_client_llcp_connect_completed) (net_nfc_error_e result,
                net_nfc_llcp_socket_t client_socket,
                void *user_data);
@@ -35,11 +41,9 @@ typedef void (*net_nfc_client_llcp_connect_sap_completed) (
                void *user_data);
 
 typedef void (*net_nfc_client_llcp_send_completed) (net_nfc_error_e result,
-               net_nfc_llcp_socket_t client_socket,
                void *user_data);
 
 typedef void (*net_nfc_client_llcp_send_to_completed) (net_nfc_error_e result,
-               net_nfc_llcp_socket_t client_socket,
                void *user_data);
 
 typedef void (*net_nfc_client_llcp_receive_completed) (net_nfc_error_e result,
@@ -53,20 +57,19 @@ typedef void (*net_nfc_client_llcp_receive_from_completed) (
                void *user_data);
 
 typedef void (*net_nfc_client_llcp_close_completed) (net_nfc_error_e result,
-               net_nfc_llcp_socket_t client_socket,
                void *user_data);
 
 typedef void (*net_nfc_client_llcp_disconnect_completed)(net_nfc_error_e result,
-               net_nfc_llcp_socket_t client_socket, void *user_data);
+               void *user_data);
 
 net_nfc_error_e net_nfc_client_llcp_config(net_nfc_llcp_config_info_h config,
                net_nfc_client_llcp_config_completed callback, void *user_data);
 
 net_nfc_error_e net_nfc_client_llcp_config_sync
-                                       (net_nfc_llcp_config_info_h config);
+(net_nfc_llcp_config_info_h config);
 
 net_nfc_error_e net_nfc_client_llcp_get_config
-                                       (net_nfc_llcp_config_info_h *config);
+(net_nfc_llcp_config_info_h *config);
 
 net_nfc_error_e net_nfc_client_llcp_listen(net_nfc_llcp_socket_t socket,
                const char *service_name,
@@ -79,6 +82,18 @@ net_nfc_error_e net_nfc_client_llcp_listen_sync(net_nfc_llcp_socket_t socket,
                sap_t sap,
                net_nfc_llcp_socket_t *out_socket);
 
+net_nfc_error_e net_nfc_client_llcp_accept(net_nfc_llcp_socket_t socket,
+               net_nfc_client_llcp_accept_completed callback,
+               void *user_data);
+
+net_nfc_error_e net_nfc_client_llcp_accept_sync(net_nfc_llcp_socket_t socket);
+
+net_nfc_error_e net_nfc_client_llcp_reject(net_nfc_llcp_socket_t socket,
+               net_nfc_client_llcp_reject_completed callback,
+               void *user_data);
+
+net_nfc_error_e net_nfc_client_llcp_reject_sync(net_nfc_llcp_socket_t socket);
+
 net_nfc_error_e net_nfc_client_llcp_connect(net_nfc_llcp_socket_t socket,
                const char *service_name,
                net_nfc_client_llcp_connect_completed callback,
@@ -94,8 +109,7 @@ net_nfc_error_e net_nfc_client_llcp_send(net_nfc_llcp_socket_t socket,
                void *user_data);
 
 net_nfc_error_e net_nfc_client_llcp_send_sync(net_nfc_llcp_socket_t socket,
-               data_h data,
-               net_nfc_llcp_socket_t *out_socket);
+               data_h data);
 
 net_nfc_error_e net_nfc_client_llcp_send_to(net_nfc_llcp_socket_t socket,
                sap_t sap,
@@ -104,9 +118,7 @@ net_nfc_error_e net_nfc_client_llcp_send_to(net_nfc_llcp_socket_t socket,
                void *user_data);
 
 net_nfc_error_e net_nfc_client_llcp_send_to_sync(net_nfc_llcp_socket_t socket,
-               sap_t sap,
-               data_h data,
-               net_nfc_llcp_socket_t *out_socket);
+               sap_t sap, data_h data);
 
 net_nfc_error_e net_nfc_client_llcp_receive(net_nfc_llcp_socket_t socket,
                size_t request_length,
@@ -123,24 +135,22 @@ net_nfc_error_e net_nfc_client_llcp_receive_from(net_nfc_llcp_socket_t socket,
                void *user_data);
 
 net_nfc_error_e net_nfc_client_llcp_receive_from_sync(net_nfc_llcp_socket_t socket,
-                size_t request_length,
-                sap_t *out_sap,
-                data_h *out_data);
+               size_t request_length,
+               sap_t *out_sap,
+               data_h *out_data);
 
 net_nfc_error_e net_nfc_client_llcp_close(net_nfc_llcp_socket_t socket,
                net_nfc_client_llcp_close_completed callback,
                void *user_data);
 
-net_nfc_error_e net_nfc_client_llcp_close_sync(net_nfc_llcp_socket_t socket,
-               net_nfc_llcp_socket_t *out_socket);
+net_nfc_error_e net_nfc_client_llcp_close_sync(net_nfc_llcp_socket_t socket);
 
 net_nfc_error_e net_nfc_client_llcp_disconnect(net_nfc_llcp_socket_t socket,
                net_nfc_client_llcp_disconnect_completed callback,
                void *user_data);
 
 net_nfc_error_e net_nfc_client_llcp_disconnect_sync(
-               net_nfc_llcp_socket_t socket,
-               net_nfc_llcp_socket_t *out_socket);
+               net_nfc_llcp_socket_t socket);
 
 void net_nfc_client_llcp_create_socket(net_nfc_llcp_socket_t *socket,
                net_nfc_llcp_socket_option_h option);
index c0986b0..3e0c15a 100644 (file)
@@ -89,10 +89,14 @@ static void llcp_call_disconnect(GObject *source_object,
 static void llcp_error(NetNfcGDbusLlcp *object,
                guint arg_handle,
                guint client_socket,
-               guint oal_socket,
                gint error,
                gpointer user_data);
 
+static void llcp_incoming(NetNfcGDbusLlcp *object,
+               guint arg_handle,
+               guint client_socket,
+               guint incoming_socket,
+               gpointer user_data);
 
 void llcp_socket_data_append(net_nfc_llcp_internal_socket_s *socket_data)
 {
@@ -151,71 +155,65 @@ static void llcp_call_config(GObject *source_object,
                GAsyncResult *res,
                gpointer user_data)
 {
-       LlcpFuncData *func_data;
-
-       net_nfc_error_e result = NET_NFC_OK;
+       LlcpFuncData *func_data = user_data;
+       net_nfc_error_e result;
        GError *error = NULL;
 
-       net_nfc_client_llcp_config_completed callback;
+       g_assert(func_data != NULL);
 
        if (net_nfc_gdbus_llcp_call_config_finish(
                                NET_NFC_GDBUS_LLCP(source_object),
+                               &result,
                                res,
                                &error) == FALSE)
        {
-               result = NET_NFC_UNKNOWN_ERROR;
-
                DEBUG_ERR_MSG("Can not finish config: %s",
                                error->message);
+
                g_error_free(error);
-       }
 
-       func_data = user_data;
-       if (func_data == NULL)
-       {
-               DEBUG_ERR_MSG("can not get LlcpFuncData");
-               return;
+               result = NET_NFC_IPC_FAIL;
        }
 
-       if (func_data->callback == NULL)
+       if (func_data->callback != NULL)
        {
-               DEBUG_CLIENT_MSG("callback function is not available");
-               g_free(func_data);
-               return;
+               net_nfc_client_llcp_config_completed callback =
+                       (net_nfc_client_llcp_config_completed)func_data->callback;
+
+               callback(result, func_data->user_data);
        }
 
-       callback = (net_nfc_client_llcp_config_completed)func_data->callback;
-       callback(result, func_data->user_data);
+       g_free(func_data);
 }
 
 static void llcp_call_listen(GObject *source_object,
                GAsyncResult *res,
                gpointer user_data)
 {
-       LlcpFuncData *func_data;
-
-       net_nfc_error_e result = NET_NFC_OK;
+       LlcpFuncData *func_data = user_data;
+       net_nfc_error_e result;
+       guint32 out_client_socket;
        GError *error = NULL;
 
-       guint32 out_client_socket;
        guint32 out_oal_socket;
 
        net_nfc_llcp_internal_socket_s *socket_data = NULL;
 
-       net_nfc_client_llcp_listen_completed callback;
+       g_assert(func_data != NULL);
 
        if (net_nfc_gdbus_llcp_call_listen_finish(
                                NET_NFC_GDBUS_LLCP(source_object),
+                               &result,
                                &out_client_socket,
-                               &out_oal_socket,
                                res,
                                &error) == FALSE)
        {
-               result = NET_NFC_UNKNOWN_ERROR;
-
                DEBUG_ERR_MSG("Can not finish listen: %s",
                                error->message);
+
                g_error_free(error);
+
+               result = NET_NFC_IPC_FAIL;
        }
 
        socket_data = llcp_socket_data_find(out_client_socket);
@@ -227,52 +225,115 @@ static void llcp_call_listen(GObject *source_object,
 
        socket_data->oal_socket = out_oal_socket;
 
-       func_data = user_data;
-       if (func_data == NULL)
+       if (func_data->callback != NULL)
        {
-               DEBUG_ERR_MSG("can not get LlcpFuncData");
-               return;
+               net_nfc_client_llcp_listen_completed callback =
+                       (net_nfc_client_llcp_listen_completed)func_data->callback;
+
+               callback(result, out_client_socket, func_data->user_data);
        }
 
-       if (func_data->callback == NULL)
+       /* TODO : release resource when socket is closed */
+       //      g_free(func_data);
+}
+
+static void llcp_call_accept(GObject *source_object,
+               GAsyncResult *res,
+               gpointer user_data)
+{
+       LlcpFuncData *func_data = user_data;
+       net_nfc_error_e result;
+       GError *error = NULL;
+
+       g_assert(func_data != NULL);
+
+       if (net_nfc_gdbus_llcp_call_accept_finish(
+                               NET_NFC_GDBUS_LLCP(source_object),
+                               &result,
+                               res,
+                               &error) == FALSE)
        {
-               DEBUG_CLIENT_MSG("callback function is not available");
-               g_free(func_data);
-               return;
+               DEBUG_ERR_MSG("Can not finish accept: %s",
+                               error->message);
+
+               g_error_free(error);
+
+               result = NET_NFC_IPC_FAIL;
        }
 
-       callback = (net_nfc_client_llcp_listen_completed)func_data->callback;
-       callback(result, out_client_socket, func_data->user_data);
+       if (func_data->callback != NULL)
+       {
+               net_nfc_client_llcp_accept_completed callback =
+                       (net_nfc_client_llcp_accept_completed)func_data->callback;
+
+               callback(result, func_data->user_data);
+       }
+
+       g_free(func_data);
 }
 
-static void llcp_call_connect(GObject *source_object,
+static void llcp_call_reject(GObject *source_object,
                GAsyncResult *res,
                gpointer user_data)
 {
-       LlcpFuncData *func_data;
-
-       net_nfc_error_e result = NET_NFC_OK;
+       LlcpFuncData *func_data = user_data;
+       net_nfc_error_e result;
        GError *error = NULL;
 
+       g_assert(func_data != NULL);
+
+       if (net_nfc_gdbus_llcp_call_reject_finish(
+                               NET_NFC_GDBUS_LLCP(source_object),
+                               &result,
+                               res,
+                               &error) == FALSE)
+       {
+               DEBUG_ERR_MSG("Can not finish reject: %s",
+                               error->message);
+
+               g_error_free(error);
+
+               result = NET_NFC_IPC_FAIL;
+       }
+
+       if (func_data->callback != NULL)
+       {
+               net_nfc_client_llcp_reject_completed callback =
+                       (net_nfc_client_llcp_reject_completed)func_data->callback;
+
+               callback(result, func_data->user_data);
+       }
+
+       g_free(func_data);
+}
+
+static void llcp_call_connect(GObject *source_object,
+               GAsyncResult *res,
+               gpointer user_data)
+{
+       LlcpFuncData *func_data = user_data;
+       net_nfc_error_e result;
        guint32 out_client_socket;
+       GError *error = NULL;
+
        guint32 out_oal_socket;
 
        net_nfc_llcp_internal_socket_s *socket_data = NULL;
 
-       net_nfc_client_llcp_connect_completed callback;
+       g_assert(func_data != NULL);
 
        if (net_nfc_gdbus_llcp_call_connect_finish(
                                NET_NFC_GDBUS_LLCP(source_object),
+                               &result,
                                &out_client_socket,
-                               &out_oal_socket,
                                res,
                                &error) == FALSE)
        {
-               result = NET_NFC_UNKNOWN_ERROR;
+               DEBUG_ERR_MSG("Can not finish connect: %s", error->message);
 
-               DEBUG_ERR_MSG("Can not finish connect: %s",
-                               error->message);
                g_error_free(error);
+
+               result = NET_NFC_IPC_FAIL;
        }
 
        socket_data = llcp_socket_data_find(out_client_socket);
@@ -284,52 +345,44 @@ static void llcp_call_connect(GObject *source_object,
 
        socket_data->oal_socket = out_oal_socket;
 
-       func_data = user_data;
-       if (func_data == NULL)
+       if (func_data->callback != NULL)
        {
-               DEBUG_ERR_MSG("can not get LlcpFuncData");
-               return;
-       }
+               net_nfc_client_llcp_connect_completed callback =
+                       (net_nfc_client_llcp_connect_completed)func_data->callback;
 
-       if (func_data->callback == NULL)
-       {
-               DEBUG_CLIENT_MSG("callback function is not available");
-               g_free(func_data);
-               return;
+               callback(result, out_client_socket, func_data->user_data);
        }
 
-       callback = (net_nfc_client_llcp_connect_completed)func_data->callback;
-       callback(result, out_client_socket, func_data->user_data);
+       /* TODO : release resource when socket is closed */
+       //      g_free(func_data);
 }
 
 static void llcp_call_connect_sap(GObject *source_object,
                GAsyncResult *res,
                gpointer user_data)
 {
-       LlcpFuncData *func_data;
-
-       net_nfc_error_e result = NET_NFC_OK;
+       LlcpFuncData *func_data = user_data;
+       net_nfc_error_e result;
+       guint32 out_client_socket;
        GError *error = NULL;
 
-       guint32 out_client_socket;
        guint32 out_oal_socket;
 
        net_nfc_llcp_internal_socket_s *socket_data = NULL;
 
-       net_nfc_client_llcp_connect_sap_completed callback;
+       g_assert(func_data != NULL);
 
        if (net_nfc_gdbus_llcp_call_connect_sap_finish(
                                NET_NFC_GDBUS_LLCP(source_object),
+                               &result,
                                &out_client_socket,
-                               &out_oal_socket,
                                res,
                                &error) == FALSE)
        {
-               result = NET_NFC_UNKNOWN_ERROR;
-
-               DEBUG_ERR_MSG("Can not finish connect sap: %s",
-                               error->message);
+               DEBUG_ERR_MSG("Can not finish connect sap: %s", error->message);
                g_error_free(error);
+
+               result = NET_NFC_IPC_FAIL;
        }
 
        socket_data = llcp_socket_data_find(out_client_socket);
@@ -341,163 +394,128 @@ static void llcp_call_connect_sap(GObject *source_object,
 
        socket_data->oal_socket = out_oal_socket;
 
-       func_data = user_data;
-       if (func_data == NULL)
+       if (func_data->callback != NULL)
        {
-               DEBUG_ERR_MSG("can not get LlcpFuncData");
-               return;
-       }
+               net_nfc_client_llcp_connect_sap_completed callback =
+                       (net_nfc_client_llcp_connect_sap_completed)func_data->callback;
 
-       if (func_data->callback == NULL)
-       {
-               DEBUG_CLIENT_MSG("callback function is not available");
-               g_free(func_data);
-               return;
+               callback(result, out_client_socket, func_data->user_data);
        }
 
-       callback = (net_nfc_client_llcp_connect_sap_completed)
-               func_data->callback;
-       callback(result, out_client_socket, func_data->user_data);
+       /* TODO : release resource when socket is closed */
+       //      g_free(func_data);
 }
 
-
 static void llcp_call_send(GObject *source_object,
                GAsyncResult *res,
                gpointer user_data)
 {
-       LlcpFuncData *func_data;
-
+       LlcpFuncData *func_data = user_data;
+       net_nfc_error_e result;
        guint32 out_client_socket;
-
-       net_nfc_error_e result = NET_NFC_OK;
        GError *error = NULL;
 
-       net_nfc_client_llcp_send_completed callback;
+       g_assert(func_data != NULL);
 
        if (net_nfc_gdbus_llcp_call_send_finish(
                                NET_NFC_GDBUS_LLCP(source_object),
+                               &result,
                                &out_client_socket,
                                res,
                                &error) == FALSE)
        {
-               result = NET_NFC_UNKNOWN_ERROR;
-
                DEBUG_ERR_MSG("Can not finish send: %s",
                                error->message);
 
                g_error_free(error);
-       }
 
-       func_data = user_data;
-       if (func_data == NULL)
-       {
-               DEBUG_ERR_MSG("can not get LlcpFuncData");
-               return;
+               result = NET_NFC_IPC_FAIL;
        }
 
-       if (func_data->callback == NULL)
+       if (func_data->callback != NULL)
        {
-               DEBUG_CLIENT_MSG("callback function is not available");
-               g_free(func_data);
-               return;
+               net_nfc_client_llcp_send_completed callback =
+                       (net_nfc_client_llcp_send_completed)func_data->callback;
+
+               callback(result, func_data->user_data);
        }
 
-       callback = (net_nfc_client_llcp_send_completed)func_data->callback;
-       callback(result, out_client_socket, func_data->user_data);
+       g_free(func_data);
 }
 
 static void llcp_call_send_to(GObject *source_object,
                GAsyncResult *res,
                gpointer user_data)
 {
-       LlcpFuncData *func_data;
-
+       LlcpFuncData *func_data = user_data;
+       net_nfc_error_e result;
        guint32 out_client_socket;
-
-       net_nfc_error_e result = NET_NFC_OK;
        GError *error = NULL;
 
-       net_nfc_client_llcp_send_to_completed callback;
+       g_assert(func_data != NULL);
 
        if (net_nfc_gdbus_llcp_call_send_to_finish(
                                NET_NFC_GDBUS_LLCP(source_object),
+                               &result,
                                &out_client_socket,
                                res,
                                &error) == FALSE)
        {
-               result = NET_NFC_UNKNOWN_ERROR;
-
-               DEBUG_ERR_MSG("Can not finish send to: %s",
-                               error->message);
+               DEBUG_ERR_MSG("Can not finish send to: %s", error->message);
 
                g_error_free(error);
-       }
-       func_data = user_data;
-       if (func_data == NULL)
-       {
-               DEBUG_ERR_MSG("can not get LlcpFuncData");
-               return;
+
+               result = NET_NFC_IPC_FAIL;
        }
 
-       if (func_data->callback == NULL)
+       if (func_data->callback != NULL)
        {
-               DEBUG_CLIENT_MSG("callback function is not available");
-               g_free(func_data);
-               return;
+               net_nfc_client_llcp_send_to_completed callback =
+                       (net_nfc_client_llcp_send_to_completed)func_data->callback;
+
+               callback(result, func_data->user_data);
        }
 
-       callback = (net_nfc_client_llcp_send_to_completed)func_data->callback;
-       callback(result, out_client_socket, func_data->user_data);
+       g_free(func_data);
 }
 
 static void llcp_call_receive(GObject *source_object,
                GAsyncResult *res,
                gpointer user_data)
 {
-       LlcpFuncData *func_data;
-
-       GVariant *variant = NULL;
-       data_s data;
-
-       net_nfc_error_e result = NET_NFC_OK;
+       LlcpFuncData *func_data = user_data;
+       net_nfc_error_e result;
+       GVariant *variant;
        GError *error = NULL;
 
-       net_nfc_client_llcp_receive_completed callback;
+       g_assert(func_data != NULL);
 
        if (net_nfc_gdbus_llcp_call_receive_finish(
                                NET_NFC_GDBUS_LLCP(source_object),
+                               &result,
                                &variant,
                                res,
                                &error) == FALSE)
        {
-               result = NET_NFC_UNKNOWN_ERROR;
-
-               DEBUG_ERR_MSG("Can not finish receive: %s",
-                               error->message);
+               DEBUG_ERR_MSG("Can not finish receive: %s", error->message);
 
                g_error_free(error);
-       }
 
-       func_data = user_data;
-       if (func_data == NULL)
-       {
-               DEBUG_ERR_MSG("can not get LlcpFuncData");
-               return;
+               result = NET_NFC_IPC_FAIL;
        }
 
-       if (func_data->callback == NULL)
+       if (func_data->callback != NULL)
        {
-               DEBUG_CLIENT_MSG("callback function is not available");
-               g_free(func_data);
-               return;
-       }
+               net_nfc_client_llcp_receive_completed callback =
+                       (net_nfc_client_llcp_receive_completed)func_data->callback;
+               data_s data = { NULL, 0 };
 
-       net_nfc_util_gdbus_variant_to_data_s(variant, &data);
+               net_nfc_util_gdbus_variant_to_data_s(variant, &data);
 
-       callback = (net_nfc_client_llcp_receive_completed)func_data->callback;
-       callback(result, &data, func_data->user_data);
+               callback(result, &data, func_data->user_data);
 
-       net_nfc_util_free_data(&data);
+               net_nfc_util_free_data(&data);
+       }
 
        g_free(func_data);
 }
@@ -506,54 +524,42 @@ static void llcp_call_receive_from(GObject *source_object,
                GAsyncResult *res,
                gpointer user_data)
 {
-       LlcpFuncData *func_data;
-
-       GVariant *variant = NULL;
-
+       LlcpFuncData *func_data = user_data;
+       net_nfc_error_e result;
        sap_t sap;
-       data_s data;
-
-       net_nfc_error_e result = NET_NFC_OK;
+       GVariant *variant;
        GError *error = NULL;
 
-       net_nfc_client_llcp_receive_from_completed callback;
+       g_assert(func_data != NULL);
 
        if (net_nfc_gdbus_llcp_call_receive_from_finish(
                                NET_NFC_GDBUS_LLCP(source_object),
+                               &result,
                                &sap,
                                &variant,
                                res,
                                &error) == FALSE)
        {
-               result = NET_NFC_UNKNOWN_ERROR;
-
                DEBUG_ERR_MSG("Can not finish receive from: %s",
                                error->message);
 
                g_error_free(error);
-       }
 
-       func_data = user_data;
-       if (func_data == NULL)
-       {
-               DEBUG_ERR_MSG("can not get LlcpFuncData");
-               return;
+               result = NET_NFC_IPC_FAIL;
        }
 
-       if (func_data->callback == NULL)
+       if (func_data->callback != NULL)
        {
-               DEBUG_CLIENT_MSG("callback function is not available");
-               g_free(func_data);
-               return;
-       }
+               net_nfc_client_llcp_receive_from_completed callback =
+                       (net_nfc_client_llcp_receive_from_completed)func_data->callback;
+               data_s data = { NULL, 0 };
 
-       net_nfc_util_gdbus_variant_to_data_s(variant, &data);
+               net_nfc_util_gdbus_variant_to_data_s(variant, &data);
 
-       callback = (net_nfc_client_llcp_receive_from_completed)
-               func_data->callback;
-       callback(result, sap, &data, func_data->user_data);
+               callback(result, sap, &data, func_data->user_data);
 
-       net_nfc_util_free_data(&data);
+               net_nfc_util_free_data(&data);
+       }
 
        g_free(func_data);
 }
@@ -562,28 +568,27 @@ static void llcp_call_close(GObject *source_object,
                GAsyncResult *res,
                gpointer user_data)
 {
-       LlcpFuncData *func_data;
-
-       net_nfc_error_e result = NET_NFC_OK;
-       GError *error = NULL;
-
+       LlcpFuncData *func_data = user_data;
+       net_nfc_error_e result;
        guint32 out_client_socket;
+       GError *error = NULL;
 
        net_nfc_llcp_internal_socket_s *socket_data = NULL;
 
-       net_nfc_client_llcp_close_completed callback;
+       g_assert(func_data != NULL);
 
        if (net_nfc_gdbus_llcp_call_close_finish(
                                NET_NFC_GDBUS_LLCP(source_object),
+                               &result,
                                &out_client_socket,
                                res,
                                &error) == FALSE)
        {
-               result = NET_NFC_UNKNOWN_ERROR;
+               DEBUG_ERR_MSG("Can not finish close: %s", error->message);
 
-               DEBUG_ERR_MSG("Can not finish close: %s",
-                               error->message);
                g_error_free(error);
+
+               result = NET_NFC_IPC_FAIL;
        }
 
        socket_data = llcp_socket_data_find(out_client_socket);
@@ -593,50 +598,42 @@ static void llcp_call_close(GObject *source_object,
                return;
        }
 
-       func_data = user_data;
-       if (func_data == NULL)
+       if (func_data->callback != NULL)
        {
-               DEBUG_ERR_MSG("can not get LlcpFuncData");
-               return;
-       }
+               net_nfc_client_llcp_close_completed callback =
+                       (net_nfc_client_llcp_close_completed)func_data->callback;
 
-       if (func_data->callback == NULL)
-       {
-               DEBUG_CLIENT_MSG("callback function is not available");
-               g_free(func_data);
-               return;
+               callback(result, func_data->user_data);
        }
 
-       callback = (net_nfc_client_llcp_close_completed)func_data->callback;
-       callback(result, out_client_socket, func_data->user_data);
+       g_free(func_data);
 }
 
 static void llcp_call_disconnect(GObject *source_object,
                GAsyncResult *res,
                gpointer user_data)
 {
-       LlcpFuncData *func_data;
-
-       net_nfc_error_e result = NET_NFC_OK;
-       GError *error = NULL;
-
+       LlcpFuncData *func_data = user_data;
+       net_nfc_error_e result;
        guint32 out_client_socket;
+       GError *error = NULL;
 
        net_nfc_llcp_internal_socket_s *socket_data = NULL;
 
-       net_nfc_client_llcp_disconnect_completed callback;
+       g_assert(func_data != NULL);
 
        if (net_nfc_gdbus_llcp_call_disconnect_finish(
                                NET_NFC_GDBUS_LLCP(source_object),
+                               &result,
                                &out_client_socket,
                                res,
                                &error) == FALSE)
        {
-               result = NET_NFC_UNKNOWN_ERROR;
+               DEBUG_ERR_MSG("Can not finish disconnect: %s", error->message);
 
-               DEBUG_ERR_MSG("Can not finish disconnect: %s",
-                               error->message);
                g_error_free(error);
+
+               result = NET_NFC_IPC_FAIL;
        }
 
        socket_data = llcp_socket_data_find(out_client_socket);
@@ -646,54 +643,51 @@ static void llcp_call_disconnect(GObject *source_object,
                return;
        }
 
-       func_data = user_data;
-       if (func_data == NULL)
-       {
-               DEBUG_ERR_MSG("can not get LlcpFuncData");
-               return;
-       }
+       if (func_data->callback != NULL) {
+               net_nfc_client_llcp_disconnect_completed callback =
+                       (net_nfc_client_llcp_disconnect_completed)func_data->callback;
 
-       if (func_data->callback == NULL)
-       {
-               DEBUG_CLIENT_MSG("callback function is not available");
-               g_free(func_data);
-               return;
+               callback(result, func_data->user_data);
        }
 
-       callback = (net_nfc_client_llcp_disconnect_completed)
-               func_data->callback;
-       callback(result, out_client_socket, func_data->user_data);
+       g_free(func_data);
 }
 
-
 static void llcp_error(NetNfcGDbusLlcp *object,
                guint arg_handle,
                guint client_socket,
-               guint oal_socket,
                gint error,
                gpointer user_data)
 {
        INFO_MSG(">>> SIGNAL arrived");
 }
 
+static void llcp_incoming(NetNfcGDbusLlcp *object,
+               guint arg_handle,
+               guint client_socket,
+               guint incoming_socket,
+               gpointer user_data)
+{
+       INFO_MSG(">>> SIGNAL arrived");
+}
+
 /* Public APIs */
 API net_nfc_error_e net_nfc_client_llcp_config(net_nfc_llcp_config_info_h config,
                net_nfc_client_llcp_config_completed callback,
                void *user_data)
 {
        LlcpFuncData *func_data;
-       GVariant *variant = NULL;
+       GVariant *variant;
+
+       if (config == NULL) {
+               return NET_NFC_NULL_PARAMETER;
+       }
 
        if (llcp_proxy == NULL)
        {
                DEBUG_ERR_MSG("Can not get LlcpProxy");
-               return NET_NFC_UNKNOWN_ERROR;
-       }
 
-       if (config == NULL)
-       {
-               DEBUG_ERR_MSG("Config is empty");
-               return NET_NFC_UNKNOWN_ERROR;
+               return NET_NFC_NOT_INITIALIZED;
        }
 
        /* prevent executing daemon when nfc is off */
@@ -702,6 +696,12 @@ API net_nfc_error_e net_nfc_client_llcp_config(net_nfc_llcp_config_info_h config
        }
 
        func_data = g_new0(LlcpFuncData, 1);
+       if (func_data == NULL) {
+               DEBUG_ERR_MSG("g_new0 failed");
+
+               return NET_NFC_ALLOC_FAIL;
+       }
+
        func_data->callback = (gpointer)callback;
        func_data->user_data = user_data;
 
@@ -726,13 +726,15 @@ API net_nfc_error_e net_nfc_client_llcp_config(net_nfc_llcp_config_info_h config
 API net_nfc_error_e net_nfc_client_llcp_config_sync(
                net_nfc_llcp_config_info_h config)
 {
+       net_nfc_error_e result;
        GVariant *variant = NULL;
        GError *error = NULL;
 
        if (llcp_proxy == NULL)
        {
                DEBUG_ERR_MSG("Can not get LlcpProxy");
-               return NET_NFC_UNKNOWN_ERROR;
+
+               return NET_NFC_NOT_INITIALIZED;
        }
 
        /* prevent executing daemon when nfc is off */
@@ -751,15 +753,18 @@ API net_nfc_error_e net_nfc_client_llcp_config_sync(
        if (net_nfc_gdbus_llcp_call_config_sync(llcp_proxy,
                                variant,
                                net_nfc_client_gdbus_get_privilege(),
+                               &result,
                                NULL,
                                &error) == FALSE)
        {
                DEBUG_ERR_MSG("can not config: %s", error->message);
+
                g_error_free(error);
-               return NET_NFC_UNKNOWN_ERROR;
+
+               result = NET_NFC_IPC_FAIL;
        }
 
-       return NET_NFC_OK;
+       return result;
 }
 
 API net_nfc_error_e net_nfc_client_llcp_get_config(
@@ -785,13 +790,8 @@ API net_nfc_error_e net_nfc_client_llcp_listen(net_nfc_llcp_socket_t socket,
        if (llcp_proxy == NULL)
        {
                DEBUG_ERR_MSG("Can not get LlcpProxy");
-               return NET_NFC_UNKNOWN_ERROR;
-       }
 
-       if (service_name == NULL)
-       {
-               DEBUG_ERR_MSG("service_name is empty");
-               return NET_NFC_UNKNOWN_ERROR;
+               return NET_NFC_NOT_INITIALIZED;
        }
 
        socket_data = llcp_socket_data_find(socket);
@@ -811,13 +811,18 @@ API net_nfc_error_e net_nfc_client_llcp_listen(net_nfc_llcp_socket_t socket,
        }
 
        func_data = g_new0(LlcpFuncData, 1);
+       if (func_data == NULL) {
+               DEBUG_ERR_MSG("g_new0 failed");
+
+               return NET_NFC_ALLOC_FAIL;
+       }
+
        func_data->callback = (gpointer)callback;
        func_data->user_data = user_data;
 
        net_nfc_gdbus_llcp_call_listen(llcp_proxy,
                        GPOINTER_TO_UINT(llcp_handle),
                        socket_data->client_socket,
-                       socket_data->oal_socket,
                        socket_data->miu,
                        socket_data->rw,
                        socket_data->type,
@@ -836,17 +841,22 @@ API net_nfc_error_e net_nfc_client_llcp_listen_sync(net_nfc_llcp_socket_t socket
                sap_t sap,
                net_nfc_llcp_socket_t *out_socket)
 {
+       net_nfc_error_e result;
        GError *error = NULL;
        guint32 out_client_socket;
-       guint32 out_oal_socket;
 
        net_nfc_llcp_internal_socket_s *socket_data = NULL;
        net_nfc_llcp_internal_socket_s *out_socket_data = NULL;
 
+       if (out_socket == NULL) {
+               return NET_NFC_NULL_PARAMETER;
+       }
+
        if (llcp_proxy == NULL)
        {
                DEBUG_ERR_MSG("Can not get LlcpProxy");
-               return NET_NFC_UNKNOWN_ERROR;
+
+               return NET_NFC_NOT_INITIALIZED;
        }
 
        if (service_name == NULL)
@@ -874,39 +884,183 @@ API net_nfc_error_e net_nfc_client_llcp_listen_sync(net_nfc_llcp_socket_t socket
        if (net_nfc_gdbus_llcp_call_listen_sync(llcp_proxy,
                                GPOINTER_TO_UINT(llcp_handle),
                                socket_data->client_socket,
-                               socket_data->oal_socket,
                                socket_data->miu,
                                socket_data->rw,
                                socket_data->type,
                                socket_data->sap,
                                service_name,
                                net_nfc_client_gdbus_get_privilege(),
+                               &result,
                                &out_client_socket,
-                               &out_oal_socket,
                                NULL,
-                               &error) == FALSE)
+                               &error) == true) {
+               out_socket_data = llcp_socket_data_find(out_client_socket);
+               if (out_socket_data == NULL || out_socket_data !=  socket_data)
+               {
+                       DEBUG_ERR_MSG("Wrong client socket is returned");
+                       return NET_NFC_UNKNOWN_ERROR;
+               }
+
+               //              out_socket_data->oal_socket = out_oal_socket;
+
+               if (out_socket)
+                       *out_socket = out_client_socket;
+       } else {
+               DEBUG_ERR_MSG("can not listen: %s", error->message);
+
+               g_error_free(error);
+
+               result = NET_NFC_IPC_FAIL;
+       }
+
+       return result;
+}
+
+API net_nfc_error_e net_nfc_client_llcp_accept(net_nfc_llcp_socket_t socket,
+               net_nfc_client_llcp_accept_completed callback, void *user_data)
+{
+       LlcpFuncData *func_data;
+
+       if (llcp_proxy == NULL)
        {
-               DEBUG_ERR_MSG("can not listen: %s",
-                               error->message);
+               DEBUG_ERR_MSG("Can not get LlcpProxy");
+
+               return NET_NFC_NOT_INITIALIZED;
+       }
+
+       /* prevent executing daemon when nfc is off */
+       if (net_nfc_client_manager_is_activated() == false) {
+               return NET_NFC_INVALID_STATE;
+       }
+
+       func_data = g_new0(LlcpFuncData, 1);
+       if (func_data == NULL) {
+               DEBUG_ERR_MSG("g_new0 failed");
+
+               return NET_NFC_ALLOC_FAIL;
+       }
+
+       func_data->callback = (gpointer)callback;
+       func_data->user_data = user_data;
+
+       net_nfc_gdbus_llcp_call_accept(llcp_proxy,
+                       GPOINTER_TO_UINT(llcp_handle),
+                       socket,
+                       net_nfc_client_gdbus_get_privilege(),
+                       NULL,
+                       llcp_call_accept,
+                       func_data);
+
+       return NET_NFC_OK;
+}
+
+API net_nfc_error_e net_nfc_client_llcp_accept_sync(net_nfc_llcp_socket_t socket)
+{
+       net_nfc_error_e result;
+       GError *error = NULL;
+
+       if (llcp_proxy == NULL)
+       {
+               DEBUG_ERR_MSG("Can not get LlcpProxy");
+
+               return NET_NFC_NOT_INITIALIZED;
+       }
+
+       /* prevent executing daemon when nfc is off */
+       if (net_nfc_client_manager_is_activated() == false) {
+               return NET_NFC_INVALID_STATE;
+       }
+
+       if (net_nfc_gdbus_llcp_call_accept_sync(llcp_proxy,
+                               GPOINTER_TO_UINT(llcp_handle),
+                               socket,
+                               net_nfc_client_gdbus_get_privilege(),
+                               &result,
+                               NULL,
+                               &error) == false) {
+               DEBUG_ERR_MSG("can not connect: %s", error->message);
+
                g_error_free(error);
-               return NET_NFC_UNKNOWN_ERROR;
+
+               result = NET_NFC_IPC_FAIL;
        }
 
-       out_socket_data = llcp_socket_data_find(out_client_socket);
-       if (out_socket_data == NULL || out_socket_data !=  socket_data)
+       return result;
+}
+
+API net_nfc_error_e net_nfc_client_llcp_reject(net_nfc_llcp_socket_t socket,
+               net_nfc_client_llcp_reject_completed callback,
+               void *user_data)
+{
+       LlcpFuncData *func_data;
+
+       if (llcp_proxy == NULL)
        {
-               DEBUG_ERR_MSG("Wrong client socket is returned");
-               return NET_NFC_UNKNOWN_ERROR;
+               DEBUG_ERR_MSG("Can not get LlcpProxy");
+
+               return NET_NFC_NOT_INITIALIZED;
        }
 
-       out_socket_data->oal_socket = out_oal_socket;
+       /* prevent executing daemon when nfc is off */
+       if (net_nfc_client_manager_is_activated() == false) {
+               return NET_NFC_INVALID_STATE;
+       }
 
-       if (out_socket)
-               *out_socket = out_client_socket;
+       func_data = g_new0(LlcpFuncData, 1);
+       if (func_data == NULL) {
+               DEBUG_ERR_MSG("g_new0 failed");
+
+               return NET_NFC_ALLOC_FAIL;
+       }
+
+       func_data->callback = (gpointer)callback;
+       func_data->user_data = user_data;
+
+       net_nfc_gdbus_llcp_call_reject(llcp_proxy,
+                       GPOINTER_TO_UINT(llcp_handle),
+                       socket,
+                       net_nfc_client_gdbus_get_privilege(),
+                       NULL,
+                       llcp_call_reject,
+                       func_data);
 
        return NET_NFC_OK;
 }
 
+API net_nfc_error_e net_nfc_client_llcp_reject_sync(net_nfc_llcp_socket_t socket)
+{
+       net_nfc_error_e result;
+       GError *error = NULL;
+
+       if (llcp_proxy == NULL)
+       {
+               DEBUG_ERR_MSG("Can not get LlcpProxy");
+
+               return NET_NFC_NOT_INITIALIZED;
+       }
+
+       /* prevent executing daemon when nfc is off */
+       if (net_nfc_client_manager_is_activated() == false) {
+               return NET_NFC_INVALID_STATE;
+       }
+
+       if (net_nfc_gdbus_llcp_call_reject_sync(llcp_proxy,
+                               GPOINTER_TO_UINT(llcp_handle),
+                               socket,
+                               net_nfc_client_gdbus_get_privilege(),
+                               &result,
+                               NULL,
+                               &error) == false) {
+               DEBUG_ERR_MSG("can not connect: %s", error->message);
+
+               g_error_free(error);
+
+               result = NET_NFC_IPC_FAIL;
+       }
+
+       return result;
+}
+
 API net_nfc_error_e net_nfc_client_llcp_connect(net_nfc_llcp_socket_t socket,
                const char *service_name,
                net_nfc_client_llcp_connect_completed callback,
@@ -915,16 +1069,15 @@ API net_nfc_error_e net_nfc_client_llcp_connect(net_nfc_llcp_socket_t socket,
        LlcpFuncData *func_data;
        net_nfc_llcp_internal_socket_s *socket_data = NULL;
 
+       if (service_name == NULL) {
+               return NET_NFC_NULL_PARAMETER;
+       }
+
        if (llcp_proxy == NULL)
        {
                DEBUG_ERR_MSG("Can not get LlcpProxy");
-               return NET_NFC_UNKNOWN_ERROR;
-       }
 
-       if (service_name == NULL)
-       {
-               DEBUG_ERR_MSG("service_name is empty");
-               return NET_NFC_UNKNOWN_ERROR;
+               return NET_NFC_NOT_INITIALIZED;
        }
 
        socket_data = llcp_socket_data_find(socket);
@@ -940,13 +1093,18 @@ API net_nfc_error_e net_nfc_client_llcp_connect(net_nfc_llcp_socket_t socket,
        }
 
        func_data = g_new0(LlcpFuncData, 1);
+       if (func_data == NULL) {
+               DEBUG_ERR_MSG("g_new0 failed");
+
+               return NET_NFC_ALLOC_FAIL;
+       }
+
        func_data->callback = (gpointer)callback;
        func_data->user_data = user_data;
 
        net_nfc_gdbus_llcp_call_connect(llcp_proxy,
                        GPOINTER_TO_UINT(llcp_handle),
                        socket_data->client_socket,
-                       socket_data->oal_socket,
                        socket_data->miu,
                        socket_data->rw,
                        socket_data->type,
@@ -963,23 +1121,22 @@ API net_nfc_error_e net_nfc_client_llcp_connect_sync(net_nfc_llcp_socket_t socke
                const char *service_name,
                net_nfc_llcp_socket_t *out_socket)
 {
+       net_nfc_error_e result;
        GError *error = NULL;
        guint32 out_client_socket;
-       guint32 out_oal_socket;
 
        net_nfc_llcp_internal_socket_s *socket_data = NULL;
        net_nfc_llcp_internal_socket_s *out_socket_data = NULL;
 
+       if (service_name == NULL || out_socket == NULL) {
+               return NET_NFC_NULL_PARAMETER;
+       }
+
        if (llcp_proxy == NULL)
        {
                DEBUG_ERR_MSG("Can not get LlcpProxy");
-               return NET_NFC_UNKNOWN_ERROR;
-       }
 
-       if (service_name == NULL)
-       {
-               DEBUG_ERR_MSG("service_name is empty");
-               return NET_NFC_UNKNOWN_ERROR;
+               return NET_NFC_NOT_INITIALIZED;
        }
 
        socket_data = llcp_socket_data_find(socket);
@@ -997,36 +1154,35 @@ API net_nfc_error_e net_nfc_client_llcp_connect_sync(net_nfc_llcp_socket_t socke
        if (net_nfc_gdbus_llcp_call_connect_sync(llcp_proxy,
                                GPOINTER_TO_UINT(llcp_handle),
                                socket_data->client_socket,
-                               socket_data->oal_socket,
                                socket_data->miu,
                                socket_data->rw,
                                socket_data->type,
                                service_name,
                                net_nfc_client_gdbus_get_privilege(),
+                               &result,
                                &out_client_socket,
-                               &out_oal_socket,
                                NULL,
-                               &error) == FALSE)
-       {
-               DEBUG_ERR_MSG("can not connect: %s",
-                               error->message);
-               g_error_free(error);
-               return NET_NFC_UNKNOWN_ERROR;
-       }
+                               &error) == true) {
+               out_socket_data = llcp_socket_data_find(out_client_socket);
+               if (out_socket_data == NULL || out_socket_data !=  socket_data)
+               {
+                       DEBUG_ERR_MSG("Wrong client socket is returned");
+                       return NET_NFC_UNKNOWN_ERROR;
+               }
 
-       out_socket_data = llcp_socket_data_find(out_client_socket);
-       if (out_socket_data == NULL || out_socket_data !=  socket_data)
-       {
-               DEBUG_ERR_MSG("Wrong client socket is returned");
-               return NET_NFC_UNKNOWN_ERROR;
-       }
+               //              out_socket_data->oal_socket = out_oal_socket;
 
-       out_socket_data->oal_socket = out_oal_socket;
+               if (out_socket)
+                       *out_socket = out_client_socket;
+       } else {
+               DEBUG_ERR_MSG("can not connect: %s", error->message);
 
-       if (out_socket)
-               *out_socket = out_client_socket;
+               g_error_free(error);
 
-       return NET_NFC_OK;
+               result = NET_NFC_IPC_FAIL;
+       }
+
+       return result;
 }
 
 API net_nfc_error_e net_nfc_client_llcp_connect_sap(net_nfc_llcp_socket_t socket,
@@ -1037,10 +1193,15 @@ API net_nfc_error_e net_nfc_client_llcp_connect_sap(net_nfc_llcp_socket_t socket
        LlcpFuncData *func_data;
        net_nfc_llcp_internal_socket_s *socket_data = NULL;
 
+       if (sap == 0) {
+               return NET_NFC_INVALID_PARAM;
+       }
+
        if (llcp_proxy == NULL)
        {
                DEBUG_ERR_MSG("Can not get LlcpProxy");
-               return NET_NFC_UNKNOWN_ERROR;
+
+               return NET_NFC_NOT_INITIALIZED;
        }
 
        socket_data = llcp_socket_data_find(socket);
@@ -1056,13 +1217,18 @@ API net_nfc_error_e net_nfc_client_llcp_connect_sap(net_nfc_llcp_socket_t socket
        }
 
        func_data = g_new0(LlcpFuncData, 1);
+       if (func_data == NULL) {
+               DEBUG_ERR_MSG("g_new0 failed");
+
+               return NET_NFC_ALLOC_FAIL;
+       }
+
        func_data->callback = (gpointer)callback;
        func_data->user_data = user_data;
 
        net_nfc_gdbus_llcp_call_connect_sap(llcp_proxy,
                        GPOINTER_TO_UINT(llcp_handle),
                        socket_data->client_socket,
-                       socket_data->oal_socket,
                        socket_data->miu,
                        socket_data->rw,
                        socket_data->type,
@@ -1080,17 +1246,26 @@ API net_nfc_error_e net_nfc_client_llcp_connect_sap_sync(
                sap_t sap,
                net_nfc_llcp_socket_t *out_socket)
 {
+       net_nfc_error_e result;
        GError *error = NULL;
        guint32 out_client_socket;
-       guint32 out_oal_socket;
 
        net_nfc_llcp_internal_socket_s *socket_data = NULL;
        net_nfc_llcp_internal_socket_s *out_socket_data = NULL;
 
+       if (out_socket == NULL) {
+               return NET_NFC_NULL_PARAMETER;
+       }
+
+       if (sap == 0) {
+               return NET_NFC_INVALID_PARAM;
+       }
+
        if (llcp_proxy == NULL)
        {
                DEBUG_ERR_MSG("Can not get LlcpProxy");
-               return NET_NFC_UNKNOWN_ERROR;
+
+               return NET_NFC_NOT_INITIALIZED;
        }
 
        socket_data = llcp_socket_data_find(socket);
@@ -1108,36 +1283,35 @@ API net_nfc_error_e net_nfc_client_llcp_connect_sap_sync(
        if (net_nfc_gdbus_llcp_call_connect_sap_sync(llcp_proxy,
                                GPOINTER_TO_UINT(llcp_handle),
                                socket_data->client_socket,
-                               socket_data->oal_socket,
                                socket_data->miu,
                                socket_data->rw,
                                socket_data->type,
                                sap,
                                net_nfc_client_gdbus_get_privilege(),
+                               &result,
                                &out_client_socket,
-                               &out_oal_socket,
                                NULL,
-                               &error) == FALSE)
-       {
-               DEBUG_ERR_MSG("can not connect: %s",
-                               error->message);
-               g_error_free(error);
-               return NET_NFC_UNKNOWN_ERROR;
-       }
+                               &error) == true) {
+               out_socket_data = llcp_socket_data_find(out_client_socket);
+               if (out_socket_data == NULL || out_socket_data !=  socket_data)
+               {
+                       DEBUG_ERR_MSG("Wrong client socket is returned");
+                       return NET_NFC_UNKNOWN_ERROR;
+               }
 
-       out_socket_data = llcp_socket_data_find(out_client_socket);
-       if (out_socket_data == NULL || out_socket_data !=  socket_data)
-       {
-               DEBUG_ERR_MSG("Wrong client socket is returned");
-               return NET_NFC_UNKNOWN_ERROR;
-       }
+               //              out_socket_data->oal_socket = out_oal_socket;
 
-       out_socket_data->oal_socket = out_oal_socket;
+               if (out_socket)
+                       *out_socket = out_client_socket;
+       } else {
+               DEBUG_ERR_MSG("can not connect: %s", error->message);
 
-       if (out_socket)
-               *out_socket = out_client_socket;
+               g_error_free(error);
 
-       return NET_NFC_OK;
+               result = NET_NFC_IPC_FAIL;
+       }
+
+       return result;
 }
 
 API net_nfc_error_e net_nfc_client_llcp_send(net_nfc_llcp_socket_t socket,
@@ -1146,13 +1320,22 @@ API net_nfc_error_e net_nfc_client_llcp_send(net_nfc_llcp_socket_t socket,
                void *user_data)
 {
        LlcpFuncData *func_data;
-       GVariant *variant = NULL;
+       GVariant *variant;
        net_nfc_llcp_internal_socket_s *socket_data = NULL;
 
+       if (data == NULL) {
+               return NET_NFC_NULL_PARAMETER;
+       }
+
+       if (socket <= 0) {
+               return NET_NFC_INVALID_PARAM;
+       }
+
        if (llcp_proxy == NULL)
        {
                DEBUG_ERR_MSG("Can not get LlcpProxy");
-               return NET_NFC_UNKNOWN_ERROR;
+
+               return NET_NFC_NOT_INITIALIZED;
        }
 
        /* prevent executing daemon when nfc is off */
@@ -1167,28 +1350,21 @@ API net_nfc_error_e net_nfc_client_llcp_send(net_nfc_llcp_socket_t socket,
                return NET_NFC_LLCP_INVALID_SOCKET;
        }
 
-       if (data == NULL)
-       {
-               DEBUG_ERR_MSG("data is empty");
-               return NET_NFC_INVALID_PARAM;
-       }
+       func_data = g_new0(LlcpFuncData, 1);
+       if (func_data == NULL) {
+               DEBUG_ERR_MSG("g_new0 failed");
 
-       variant = net_nfc_util_gdbus_data_to_variant(data);
-       if (variant == NULL)
-       {
-               DEBUG_ERR_MSG("Can not convert to variant");
-               return NET_NFC_INVALID_PARAM;
+               return NET_NFC_ALLOC_FAIL;
        }
 
-
-       func_data = g_new0(LlcpFuncData, 1);
        func_data->callback = (gpointer)callback;
        func_data->user_data = user_data;
 
+       variant = net_nfc_util_gdbus_data_to_variant(data);
+
        net_nfc_gdbus_llcp_call_send(llcp_proxy,
                        GPOINTER_TO_UINT(llcp_handle),
                        socket_data->client_socket,
-                       socket_data->oal_socket,
                        variant,
                        net_nfc_client_gdbus_get_privilege(),
                        NULL,
@@ -1199,9 +1375,9 @@ API net_nfc_error_e net_nfc_client_llcp_send(net_nfc_llcp_socket_t socket,
 }
 
 API net_nfc_error_e net_nfc_client_llcp_send_sync(net_nfc_llcp_socket_t socket,
-               data_h data,
-               net_nfc_llcp_socket_t *out_socket)
+               data_h data)
 {
+       net_nfc_error_e result;
        GVariant *variant;
        GError *error = NULL;
        guint32 out_client_socket;
@@ -1209,10 +1385,19 @@ API net_nfc_error_e net_nfc_client_llcp_send_sync(net_nfc_llcp_socket_t socket,
        net_nfc_llcp_internal_socket_s *socket_data;
        net_nfc_llcp_internal_socket_s *out_socket_data;
 
+       if (data == NULL) {
+               return NET_NFC_NULL_PARAMETER;
+       }
+
+       if (socket <= 0) {
+               return NET_NFC_INVALID_PARAM;
+       }
+
        if (llcp_proxy == NULL)
        {
                DEBUG_ERR_MSG("Can not get LlcpProxy");
-               return NET_NFC_UNKNOWN_ERROR;
+
+               return NET_NFC_NOT_INITIALIZED;
        }
 
        socket_data = llcp_socket_data_find(socket);
@@ -1234,42 +1419,33 @@ API net_nfc_error_e net_nfc_client_llcp_send_sync(net_nfc_llcp_socket_t socket,
        }
 
        variant = net_nfc_util_gdbus_data_to_variant(data);
-       if (variant == NULL)
-       {
-               DEBUG_ERR_MSG("Can not convert to variant");
-               return NET_NFC_INVALID_PARAM;
-       }
 
        if (net_nfc_gdbus_llcp_call_send_sync(llcp_proxy,
                                GPOINTER_TO_UINT(llcp_handle),
                                socket_data->client_socket,
-                               socket_data->oal_socket,
                                variant,
                                net_nfc_client_gdbus_get_privilege(),
+                               &result,
                                &out_client_socket,
                                NULL,
-                               &error) == FALSE)
-       {
-               DEBUG_ERR_MSG("can not call send: %s",
-                               error->message);
+                               &error) == true) {
+               out_socket_data = llcp_socket_data_find(out_client_socket);
+               if (out_socket_data == NULL)
+               {
+                       DEBUG_ERR_MSG("can not find socket_data");
+                       return NET_NFC_UNKNOWN_ERROR;
+               }
+       } else {
+               DEBUG_ERR_MSG("can not call send: %s", error->message);
+
                g_error_free(error);
-               return NET_NFC_UNKNOWN_ERROR;
-       }
 
-       out_socket_data = llcp_socket_data_find(out_client_socket);
-       if (out_socket_data == NULL)
-       {
-               DEBUG_ERR_MSG("can not find socket_data");
-               return NET_NFC_UNKNOWN_ERROR;
+               result = NET_NFC_IPC_FAIL;
        }
 
-       if (out_socket)
-               *out_socket = out_client_socket;
-
-       return NET_NFC_OK;
+       return result;
 }
 
-
 API net_nfc_error_e net_nfc_client_llcp_send_to(net_nfc_llcp_socket_t socket,
                sap_t sap,
                data_h data,
@@ -1277,13 +1453,22 @@ API net_nfc_error_e net_nfc_client_llcp_send_to(net_nfc_llcp_socket_t socket,
                void *user_data)
 {
        LlcpFuncData *func_data;
-       GVariant *variant = NULL;
+       GVariant *variant;
        net_nfc_llcp_internal_socket_s *socket_data = NULL;
 
+       if (data == NULL) {
+               return NET_NFC_NULL_PARAMETER;
+       }
+
+       if (socket <= 0 || sap == 0) {
+               return NET_NFC_INVALID_PARAM;
+       }
+
        if (llcp_proxy == NULL)
        {
                DEBUG_ERR_MSG("Can not get LlcpProxy");
-               return NET_NFC_UNKNOWN_ERROR;
+
+               return NET_NFC_NOT_INITIALIZED;
        }
 
        socket_data = llcp_socket_data_find(socket);
@@ -1293,32 +1478,26 @@ API net_nfc_error_e net_nfc_client_llcp_send_to(net_nfc_llcp_socket_t socket,
                return NET_NFC_LLCP_INVALID_SOCKET;
        }
 
-       if (data == NULL)
-       {
-               DEBUG_ERR_MSG("data is empty");
-               return NET_NFC_INVALID_PARAM;
-       }
-
-       variant = net_nfc_util_gdbus_data_to_variant(data);
-       if (variant == NULL)
-       {
-               DEBUG_ERR_MSG("Can not convert to variant");
-               return NET_NFC_INVALID_PARAM;
-       }
-
        /* prevent executing daemon when nfc is off */
        if (net_nfc_client_manager_is_activated() == false) {
                return NET_NFC_INVALID_STATE;
        }
 
        func_data = g_new0(LlcpFuncData, 1);
+       if (func_data == NULL) {
+               DEBUG_ERR_MSG("g_new0 failed");
+
+               return NET_NFC_ALLOC_FAIL;
+       }
+
        func_data->callback = (gpointer)callback;
        func_data->user_data = user_data;
 
+       variant = net_nfc_util_gdbus_data_to_variant(data);
+
        net_nfc_gdbus_llcp_call_send_to(llcp_proxy,
                        GPOINTER_TO_UINT(llcp_handle),
                        socket_data->client_socket,
-                       socket_data->oal_socket,
                        sap,
                        variant,
                        net_nfc_client_gdbus_get_privilege(),
@@ -1330,10 +1509,9 @@ API net_nfc_error_e net_nfc_client_llcp_send_to(net_nfc_llcp_socket_t socket,
 }
 
 API net_nfc_error_e net_nfc_client_llcp_send_to_sync(net_nfc_llcp_socket_t socket,
-               sap_t sap,
-               data_h data,
-               net_nfc_llcp_socket_t *out_socket)
+               sap_t sap, data_h data)
 {
+       net_nfc_error_e result;
        GVariant *variant;
        GError *error = NULL;
        guint32 out_client_socket;
@@ -1341,10 +1519,19 @@ API net_nfc_error_e net_nfc_client_llcp_send_to_sync(net_nfc_llcp_socket_t socke
        net_nfc_llcp_internal_socket_s *socket_data;
        net_nfc_llcp_internal_socket_s *out_socket_data;
 
+       if (data == NULL) {
+               return NET_NFC_NULL_PARAMETER;
+       }
+
+       if (socket <= 0 || sap == 0) {
+               return NET_NFC_INVALID_PARAM;
+       }
+
        if (llcp_proxy == NULL)
        {
                DEBUG_ERR_MSG("Can not get LlcpProxy");
-               return NET_NFC_UNKNOWN_ERROR;
+
+               return NET_NFC_NOT_INITIALIZED;
        }
 
        socket_data = llcp_socket_data_find(socket);
@@ -1354,52 +1541,38 @@ API net_nfc_error_e net_nfc_client_llcp_send_to_sync(net_nfc_llcp_socket_t socke
                return NET_NFC_LLCP_INVALID_SOCKET;
        }
 
-       if (data == NULL)
-       {
-               DEBUG_ERR_MSG("data is empty");
-               return NET_NFC_INVALID_PARAM;
-       }
-
        /* prevent executing daemon when nfc is off */
        if (net_nfc_client_manager_is_activated() == false) {
                return NET_NFC_INVALID_STATE;
        }
 
        variant = net_nfc_util_gdbus_data_to_variant(data);
-       if (variant == NULL)
-       {
-               DEBUG_ERR_MSG("Can not convert to variant");
-               return NET_NFC_INVALID_PARAM;
-       }
 
        if (net_nfc_gdbus_llcp_call_send_to_sync(llcp_proxy,
                                GPOINTER_TO_UINT(llcp_handle),
                                socket_data->client_socket,
-                               socket_data->oal_socket,
                                sap,
                                variant,
                                net_nfc_client_gdbus_get_privilege(),
+                               &result,
                                &out_client_socket,
                                NULL,
-                               &error) == FALSE)
-       {
-               DEBUG_ERR_MSG("can not call send to: %s",
-                               error->message);
+                               &error) == true) {
+               out_socket_data = llcp_socket_data_find(out_client_socket);
+               if (out_socket_data == NULL)
+               {
+                       DEBUG_ERR_MSG("can not find socket_data");
+                       return NET_NFC_UNKNOWN_ERROR;
+               }
+       } else {
+               DEBUG_ERR_MSG("can not call send to: %s", error->message);
+
                g_error_free(error);
-               return NET_NFC_UNKNOWN_ERROR;
-       }
 
-       out_socket_data = llcp_socket_data_find(out_client_socket);
-       if (out_socket_data == NULL)
-       {
-               DEBUG_ERR_MSG("can not find socket_data");
-               return NET_NFC_UNKNOWN_ERROR;
+               result = NET_NFC_IPC_FAIL;
        }
 
-       if (out_socket)
-               *out_socket = out_client_socket;
-
-       return NET_NFC_OK;
+       return result;
 }
 
 API net_nfc_error_e net_nfc_client_llcp_receive(net_nfc_llcp_socket_t socket,
@@ -1410,10 +1583,15 @@ API net_nfc_error_e net_nfc_client_llcp_receive(net_nfc_llcp_socket_t socket,
        LlcpFuncData *func_data;
        net_nfc_llcp_internal_socket_s *socket_data = NULL;
 
+       if (socket <= 0 || request_length == 0) {
+               return NET_NFC_INVALID_PARAM;
+       }
+
        if (llcp_proxy == NULL)
        {
                DEBUG_ERR_MSG("Can not get LlcpProxy");
-               return NET_NFC_UNKNOWN_ERROR;
+
+               return NET_NFC_NOT_INITIALIZED;
        }
 
        socket_data = llcp_socket_data_find(socket);
@@ -1429,13 +1607,18 @@ API net_nfc_error_e net_nfc_client_llcp_receive(net_nfc_llcp_socket_t socket,
        }
 
        func_data = g_new0(LlcpFuncData, 1);
+       if (func_data == NULL) {
+               DEBUG_ERR_MSG("g_new0 failed");
+
+               return NET_NFC_ALLOC_FAIL;
+       }
+
        func_data->callback = (gpointer)callback;
        func_data->user_data = user_data;
 
        net_nfc_gdbus_llcp_call_receive(llcp_proxy,
                        GPOINTER_TO_UINT(llcp_handle),
                        socket_data->client_socket,
-                       socket_data->oal_socket,
                        request_length,
                        net_nfc_client_gdbus_get_privilege(),
                        NULL,
@@ -1449,14 +1632,26 @@ API net_nfc_error_e net_nfc_client_llcp_receive_sync(net_nfc_llcp_socket_t socke
                size_t request_length,
                data_h *out_data)
 {
-       GVariant *variant = NULL;
+       net_nfc_error_e result;
+       GVariant *variant;
        GError *error = NULL;
        net_nfc_llcp_internal_socket_s *socket_data;
 
+       if (out_data == NULL) {
+               return NET_NFC_NULL_PARAMETER;
+       }
+
+       *out_data = NULL;
+
+       if (socket <= 0 || request_length == 0) {
+               return NET_NFC_INVALID_PARAM;
+       }
+
        if (llcp_proxy == NULL)
        {
                DEBUG_ERR_MSG("Can not get LlcpProxy");
-               return NET_NFC_UNKNOWN_ERROR;
+
+               return NET_NFC_NOT_INITIALIZED;
        }
 
        socket_data = llcp_socket_data_find(socket);
@@ -1474,25 +1669,22 @@ API net_nfc_error_e net_nfc_client_llcp_receive_sync(net_nfc_llcp_socket_t socke
        if (net_nfc_gdbus_llcp_call_receive_sync(llcp_proxy,
                                GPOINTER_TO_UINT(llcp_handle),
                                socket_data->client_socket,
-                               socket_data->oal_socket,
                                request_length,
                                net_nfc_client_gdbus_get_privilege(),
+                               &result,
                                &variant,
                                NULL,
-                               &error) == FALSE)
-       {
-               DEBUG_ERR_MSG("can not call receive: %s",
-                               error->message);
+                               &error) == true) {
+               *out_data = net_nfc_util_gdbus_variant_to_data(variant);
+       } else {
+               DEBUG_ERR_MSG("can not call receive: %s", error->message);
+
                g_error_free(error);
-               return NET_NFC_UNKNOWN_ERROR;
-       }
 
-       if (out_data)
-       {
-               *out_data = net_nfc_util_gdbus_variant_to_data(variant);
+               result = NET_NFC_IPC_FAIL;
        }
 
-       return NET_NFC_OK;
+       return result;
 }
 
 API net_nfc_error_e net_nfc_client_llcp_receive_from(net_nfc_llcp_socket_t socket,
@@ -1503,10 +1695,15 @@ API net_nfc_error_e net_nfc_client_llcp_receive_from(net_nfc_llcp_socket_t socke
        LlcpFuncData *func_data;
        net_nfc_llcp_internal_socket_s *socket_data = NULL;
 
+       if (socket <= 0 || request_length == 0) {
+               return NET_NFC_INVALID_PARAM;
+       }
+
        if (llcp_proxy == NULL)
        {
                DEBUG_ERR_MSG("Can not get LlcpProxy");
-               return NET_NFC_UNKNOWN_ERROR;
+
+               return NET_NFC_NOT_INITIALIZED;
        }
 
        socket_data = llcp_socket_data_find(socket);
@@ -1517,13 +1714,18 @@ API net_nfc_error_e net_nfc_client_llcp_receive_from(net_nfc_llcp_socket_t socke
        }
 
        func_data = g_new0(LlcpFuncData, 1);
+       if (func_data == NULL) {
+               DEBUG_ERR_MSG("g_new0 failed");
+
+               return NET_NFC_ALLOC_FAIL;
+       }
+
        func_data->callback = (gpointer)callback;
        func_data->user_data = user_data;
 
        net_nfc_gdbus_llcp_call_receive_from(llcp_proxy,
                        GPOINTER_TO_UINT(llcp_handle),
                        socket_data->client_socket,
-                       socket_data->oal_socket,
                        request_length,
                        net_nfc_client_gdbus_get_privilege(),
                        NULL,
@@ -1539,16 +1741,29 @@ API net_nfc_error_e net_nfc_client_llcp_receive_from_sync(
                sap_t *out_sap,
                data_h *out_data)
 {
-       GVariant *variant = NULL;
+       net_nfc_error_e result;
        GError *error = NULL;
+       GVariant *variant;
        sap_t sap;
 
        net_nfc_llcp_internal_socket_s *socket_data;
 
+       if (out_sap == NULL || out_data == NULL) {
+               return NET_NFC_NULL_PARAMETER;
+       }
+
+       *out_data = NULL;
+       *out_sap = 0;
+
+       if (socket <= 0 || request_length == 0) {
+               return NET_NFC_INVALID_PARAM;
+       }
+
        if (llcp_proxy == NULL)
        {
                DEBUG_ERR_MSG("Can not get LlcpProxy");
-               return NET_NFC_UNKNOWN_ERROR;
+
+               return NET_NFC_NOT_INITIALIZED;
        }
 
        socket_data = llcp_socket_data_find(socket);
@@ -1566,29 +1781,24 @@ API net_nfc_error_e net_nfc_client_llcp_receive_from_sync(
        if (net_nfc_gdbus_llcp_call_receive_from_sync(llcp_proxy,
                                GPOINTER_TO_UINT(llcp_handle),
                                socket_data->client_socket,
-                               socket_data->oal_socket,
                                request_length,
                                net_nfc_client_gdbus_get_privilege(),
+                               &result,
                                &sap,
                                &variant,
                                NULL,
-                               &error) == FALSE)
-       {
-               DEBUG_ERR_MSG("can not call receive from: %s",
-                               error->message);
-               g_error_free(error);
-               return NET_NFC_UNKNOWN_ERROR;
-       }
-
-       if (*out_sap)
+                               &error) == true) {
                *out_sap = sap;
-
-       if (out_data)
-       {
                *out_data = net_nfc_util_gdbus_variant_to_data(variant);
+       } else {
+               DEBUG_ERR_MSG("can not call receive from: %s", error->message);
+
+               g_error_free(error);
+
+               result = NET_NFC_IPC_FAIL;
        }
 
-       return NET_NFC_OK;
+       return result;
 }
 
 API net_nfc_error_e net_nfc_client_llcp_close(net_nfc_llcp_socket_t socket,
@@ -1598,10 +1808,15 @@ API net_nfc_error_e net_nfc_client_llcp_close(net_nfc_llcp_socket_t socket,
        LlcpFuncData *func_data;
        net_nfc_llcp_internal_socket_s *socket_data = NULL;
 
+       if (socket <= 0) {
+               return NET_NFC_INVALID_PARAM;
+       }
+
        if (llcp_proxy == NULL)
        {
                DEBUG_ERR_MSG("Can not get LlcpProxy");
-               return NET_NFC_UNKNOWN_ERROR;
+
+               return NET_NFC_NOT_INITIALIZED;
        }
 
        socket_data = llcp_socket_data_find(socket);
@@ -1617,13 +1832,18 @@ API net_nfc_error_e net_nfc_client_llcp_close(net_nfc_llcp_socket_t socket,
        }
 
        func_data = g_new0(LlcpFuncData, 1);
+       if (func_data == NULL) {
+               DEBUG_ERR_MSG("g_new0 failed");
+
+               return NET_NFC_ALLOC_FAIL;
+       }
+
        func_data->callback = (gpointer)callback;
        func_data->user_data = user_data;
 
        net_nfc_gdbus_llcp_call_close(llcp_proxy,
                        GPOINTER_TO_UINT(llcp_handle),
                        socket_data->client_socket,
-                       socket_data->oal_socket,
                        net_nfc_client_gdbus_get_privilege(),
                        NULL,
                        llcp_call_close,
@@ -1632,19 +1852,24 @@ API net_nfc_error_e net_nfc_client_llcp_close(net_nfc_llcp_socket_t socket,
        return NET_NFC_OK;
 }
 
-API net_nfc_error_e net_nfc_client_llcp_close_sync(net_nfc_llcp_socket_t socket,
-               net_nfc_llcp_socket_t *out_socket)
+API net_nfc_error_e net_nfc_client_llcp_close_sync(net_nfc_llcp_socket_t socket)
 {
+       net_nfc_error_e result;
        GError *error = NULL;
        guint32 out_client_socket;
 
        net_nfc_llcp_internal_socket_s *socket_data = NULL;
        net_nfc_llcp_internal_socket_s *out_socket_data = NULL;
 
+       if (socket <= 0) {
+               return NET_NFC_INVALID_PARAM;
+       }
+
        if (llcp_proxy == NULL)
        {
                DEBUG_ERR_MSG("Can not get LlcpProxy");
-               return NET_NFC_UNKNOWN_ERROR;
+
+               return NET_NFC_NOT_INITIALIZED;
        }
 
        socket_data = llcp_socket_data_find(socket);
@@ -1662,29 +1887,26 @@ API net_nfc_error_e net_nfc_client_llcp_close_sync(net_nfc_llcp_socket_t socket,
        if (net_nfc_gdbus_llcp_call_close_sync(llcp_proxy,
                                GPOINTER_TO_UINT(llcp_handle),
                                socket_data->client_socket,
-                               socket_data->oal_socket,
                                net_nfc_client_gdbus_get_privilege(),
+                               &result,
                                &out_client_socket,
                                NULL,
-                               &error) == FALSE)
-       {
-               DEBUG_ERR_MSG("can not close: %s",
-                               error->message);
+                               &error) == true) {
+               out_socket_data = llcp_socket_data_find(out_client_socket);
+               if (out_socket_data == NULL || out_socket_data !=  socket_data)
+               {
+                       DEBUG_ERR_MSG("Wrong client socket is returned");
+                       return NET_NFC_UNKNOWN_ERROR;
+               }
+       } else {
+               DEBUG_ERR_MSG("can not close: %s", error->message);
+
                g_error_free(error);
-               return NET_NFC_UNKNOWN_ERROR;
-       }
 
-       out_socket_data = llcp_socket_data_find(out_client_socket);
-       if (out_socket_data == NULL || out_socket_data !=  socket_data)
-       {
-               DEBUG_ERR_MSG("Wrong client socket is returned");
-               return NET_NFC_UNKNOWN_ERROR;
+               result = NET_NFC_IPC_FAIL;
        }
 
-       if (out_socket)
-               *out_socket = out_client_socket;
-
-       return NET_NFC_OK;
+       return result;
 }
 
 API net_nfc_error_e net_nfc_client_llcp_disconnect(net_nfc_llcp_socket_t socket,
@@ -1694,10 +1916,15 @@ API net_nfc_error_e net_nfc_client_llcp_disconnect(net_nfc_llcp_socket_t socket,
        LlcpFuncData *func_data;
        net_nfc_llcp_internal_socket_s *socket_data = NULL;
 
+       if (socket <= 0) {
+               return NET_NFC_INVALID_PARAM;
+       }
+
        if (llcp_proxy == NULL)
        {
                DEBUG_ERR_MSG("Can not get LlcpProxy");
-               return NET_NFC_UNKNOWN_ERROR;
+
+               return NET_NFC_NOT_INITIALIZED;
        }
 
        socket_data = llcp_socket_data_find(socket);
@@ -1713,13 +1940,18 @@ API net_nfc_error_e net_nfc_client_llcp_disconnect(net_nfc_llcp_socket_t socket,
        }
 
        func_data = g_new0(LlcpFuncData, 1);
+       if (func_data == NULL) {
+               DEBUG_ERR_MSG("g_new0 failed");
+
+               return NET_NFC_ALLOC_FAIL;
+       }
+
        func_data->callback = (gpointer)callback;
        func_data->user_data = user_data;
 
        net_nfc_gdbus_llcp_call_disconnect(llcp_proxy,
                        GPOINTER_TO_UINT(llcp_handle),
                        socket_data->client_socket,
-                       socket_data->oal_socket,
                        net_nfc_client_gdbus_get_privilege(),
                        NULL,
                        llcp_call_disconnect,
@@ -1729,19 +1961,24 @@ API net_nfc_error_e net_nfc_client_llcp_disconnect(net_nfc_llcp_socket_t socket,
 }
 
 API net_nfc_error_e net_nfc_client_llcp_disconnect_sync(
-               net_nfc_llcp_socket_t socket,
-               net_nfc_llcp_socket_t *out_socket)
+               net_nfc_llcp_socket_t socket)
 {
+       net_nfc_error_e result;
        GError *error = NULL;
        guint32 out_client_socket;
 
        net_nfc_llcp_internal_socket_s *socket_data = NULL;
        net_nfc_llcp_internal_socket_s *out_socket_data = NULL;
 
+       if (socket <= 0) {
+               return NET_NFC_INVALID_PARAM;
+       }
+
        if (llcp_proxy == NULL)
        {
                DEBUG_ERR_MSG("Can not get LlcpProxy");
-               return NET_NFC_UNKNOWN_ERROR;
+
+               return NET_NFC_NOT_INITIALIZED;
        }
 
        socket_data = llcp_socket_data_find(socket);
@@ -1759,29 +1996,26 @@ API net_nfc_error_e net_nfc_client_llcp_disconnect_sync(
        if (net_nfc_gdbus_llcp_call_disconnect_sync(llcp_proxy,
                                GPOINTER_TO_UINT(llcp_handle),
                                socket_data->client_socket,
-                               socket_data->oal_socket,
                                net_nfc_client_gdbus_get_privilege(),
+                               &result,
                                &out_client_socket,
                                NULL,
-                               &error) == FALSE)
-       {
-               DEBUG_ERR_MSG("can not disconnect: %s",
-                               error->message);
+                               &error) == true) {
+               out_socket_data = llcp_socket_data_find(out_client_socket);
+               if (out_socket_data == NULL || out_socket_data !=  socket_data)
+               {
+                       DEBUG_ERR_MSG("Wrong client socket is returned");
+                       return NET_NFC_UNKNOWN_ERROR;
+               }
+       } else {
+               DEBUG_ERR_MSG("can not disconnect: %s", error->message);
+
                g_error_free(error);
-               return NET_NFC_UNKNOWN_ERROR;
-       }
 
-       out_socket_data = llcp_socket_data_find(out_client_socket);
-       if (out_socket_data == NULL || out_socket_data !=  socket_data)
-       {
-               DEBUG_ERR_MSG("Wrong client socket is returned");
-               return NET_NFC_UNKNOWN_ERROR;
+               result = NET_NFC_IPC_FAIL;
        }
 
-       if (out_socket)
-               *out_socket = out_client_socket;
-
-       return NET_NFC_OK;
+       return result;
 }
 
 API void net_nfc_client_llcp_create_socket(net_nfc_llcp_socket_t *socket,
@@ -1896,13 +2130,16 @@ API net_nfc_error_e net_nfc_client_llcp_get_socket_option_miu(
                net_nfc_llcp_socket_option_h option,
                uint16_t *miu)
 {
+       net_nfc_llcp_socket_option_s *struct_option =
+               (net_nfc_llcp_socket_option_s *)option;
+
        if (option == NULL || miu == NULL)
        {
                return NET_NFC_NULL_PARAMETER;
        }
-       net_nfc_llcp_socket_option_s *struct_option = (net_nfc_llcp_socket_option_s *)option;
 
        *miu = struct_option->miu;
+
        return NET_NFC_OK;
 }
 
@@ -1910,13 +2147,16 @@ API net_nfc_error_e net_nfc_client_llcp_set_socket_option_miu(
                net_nfc_llcp_socket_option_h option,
                uint16_t miu)
 {
+       net_nfc_llcp_socket_option_s *struct_option =
+               (net_nfc_llcp_socket_option_s *)option;
+
        if (option == NULL)
        {
                return NET_NFC_NULL_PARAMETER;
        }
-       net_nfc_llcp_socket_option_s *struct_option = (net_nfc_llcp_socket_option_s *)option;
 
        struct_option->miu = miu;
+
        return NET_NFC_OK;
 }
 
@@ -2172,7 +2412,11 @@ net_nfc_error_e net_nfc_client_llcp_init(void)
                return NET_NFC_UNKNOWN_ERROR;
        }
 
-       g_signal_connect(llcp_proxy, "error", G_CALLBACK(llcp_error), NULL);
+       g_signal_connect(llcp_proxy, "error",
+                       G_CALLBACK(llcp_error), NULL);
+
+       g_signal_connect(llcp_proxy, "incoming",
+                       G_CALLBACK(llcp_incoming), NULL);
 
        return NET_NFC_OK;
 }
index fb8f738..293d760 100644 (file)
     <method name="Config">
       <arg type="(qqyy)" name="config" direction="in" />
       <arg type="a(y)" name="privilege" direction="in" />
+      <arg type="i" name="result" direction="out" />
     </method>
     <!--
       Listen
     <method name="Listen">
       <arg type="u" name="handle" direction="in" />
       <arg type="u" name="client_socket" direction="in" />
-      <arg type="u" name="oal_socket" direction="in" />
       <arg type="q" name="miu" direction="in" />
       <arg type="y" name="rw" direction="in" />
       <arg type="i" name="type" direction="in" />
       <arg type="y" name="sap" direction="in" />
       <arg type="s" name="service_name" direction="in" />
       <arg type="a(y)" name="privilege" direction="in" />
+      <arg type="i" name="result" direction="out" />
       <arg type="u" name="client_socket" direction="out" />
-      <arg type="u" name="oal_socket" direction="out" />
+    </method>
+
+    <!--
+      Accept
+    -->
+    <method name="Accept">
+      <arg type="u" name="handle" direction="in" />
+      <arg type="u" name="client_socket" direction="in" />
+      <arg type="a(y)" name="privilege" direction="in" />
+      <arg type="i" name="result" direction="out" />
+    </method>
+
+    <!--
+      Reject
+    -->
+    <method name="Reject">
+      <arg type="u" name="handle" direction="in" />
+      <arg type="u" name="client_socket" direction="in" />
+      <arg type="a(y)" name="privilege" direction="in" />
+      <arg type="i" name="result" direction="out" />
     </method>
 
     <!--
     <method name="Connect">
       <arg type="u" name="handle" direction="in" />
       <arg type="u" name="client_socket" direction="in" />
-      <arg type="u" name="oal_socket" direction="in" />
       <arg type="q" name="miu" direction="in" />
       <arg type="y" name="rw" direction="in" />
       <arg type="i" name="type" direction="in" />
       <arg type="s" name="service_name" direction="in" />
       <arg type="a(y)" name="privilege" direction="in" />
+      <arg type="i" name="result" direction="out" />
       <arg type="u" name="client_socket" direction="out" />
-      <arg type="u" name="oal_socket" direction="out" />
     </method>
 
     <!--
     <method name="ConnectSap">
       <arg type="u" name="handle" direction="in" />
       <arg type="u" name="client_socket" direction="in" />
-      <arg type="u" name="oal_socket" direction="in" />
       <arg type="q" name="miu" direction="in" />
       <arg type="y" name="rw" direction="in" />
       <arg type="i" name="type" direction="in" />
       <arg type="y" name="sap" direction="in" />
       <arg type="a(y)" name="privilege" direction="in" />
+      <arg type="i" name="result" direction="out" />
       <arg type="u" name="client_socket" direction="out" />
-      <arg type="u" name="oal_socket" direction="out" />
     </method>
 
     <!--
     <method name="Send">
       <arg type="u" name="handle" direction="in" />
       <arg type="u" name="client_socket" direction="in" />
-      <arg type="u" name="oal_socket" direction="in" />
       <arg type="a(y)" name="data" direction="in" />
       <arg type="a(y)" name="privilege" direction="in" />
+      <arg type="i" name="result" direction="out" />
       <arg type="u" name="client_socket" direction="out" />
     </method>
 
     <method name="SendTo">
       <arg type="u" name="handle" direction="in" />
       <arg type="u" name="client_socket" direction="in" />
-      <arg type="u" name="oal_socket" direction="in" />
       <arg type="y" name="sap" direction="in" />
       <arg type="a(y)" name="data" direction="in" />
       <arg type="a(y)" name="privilege" direction="in" />
+      <arg type="i" name="result" direction="out" />
       <arg type="u" name="client_socket" direction="out" />
     </method>
 
     <method name="Receive">
       <arg type="u" name="handle" direction="in" />
       <arg type="u" name="client_socket" direction="in" />
-      <arg type="u" name="oal_socket" direction="in" />
       <arg type="u" name="request_length" direction="in" />
       <arg type="a(y)" name="privilege" direction="in" />
+      <arg type="i" name="result" direction="out" />
       <arg type="a(y)" name="data" direction="out" />
     </method>
 
     <method name="ReceiveFrom">
       <arg type="u" name="handle" direction="in" />
       <arg type="u" name="client_socket" direction="in" />
-      <arg type="u" name="oal_socket" direction="in" />
       <arg type="u" name="request_length" direction="in" />
       <arg type="a(y)" name="privilege" direction="in" />
+      <arg type="i" name="result" direction="out" />
       <arg type="y" name="sap" direction="out" />
       <arg type="a(y)" name="data" direction="out" />
     </method>
     <method name="Close">
       <arg type="u" name="handle" direction="in" />
       <arg type="u" name="client_socket" direction="in" />
-      <arg type="u" name="oal_socket" direction="in" />
       <arg type="a(y)" name="privilege" direction="in" />
+      <arg type="i" name="result" direction="out" />
       <arg type="u" name="client_socket" direction="out" />
     </method>
 
     <method name="Disconnect">
       <arg type="u" name="handle" direction="in" />
       <arg type="u" name="client_socket" direction="in" />
-      <arg type="u" name="oal_socket" direction="in" />
       <arg type="a(y)" name="privilege" direction="in" />
+      <arg type="i" name="result" direction="out" />
       <arg type="u" name="client_socket" direction="out" />
     </method>
 
     <signal name="Error">
       <arg type="u" name="handle" />
       <arg type="u" name="client_socket" />
-      <arg type="u" name="oal_socket" />
       <arg type="i" name="error" />
     </signal>
+
+    <!--
+      Incoming
+    -->
+    <signal name="Incoming">
+      <arg type="u" name="handle" />
+      <arg type="u" name="client_socket" />
+      <arg type="u" name="incoming_socket" />
+    </signal>
   </interface>
 
   <interface name="org.tizen.NetNfcService.P2p">
index 8c14c1a..3831c6a 100644 (file)
@@ -161,57 +161,112 @@ static void controller_se_transaction_cb(void *info,
        }
 }
 
-static void controller_llcp_event_cb(void *info,
-               void *user_context)
+static void _controller_llcp_event_cb(gpointer user_data)
 {
-       net_nfc_request_llcp_msg_t *req_llcp_msg;
-       net_nfc_request_msg_t *req_msg;
+       net_nfc_request_llcp_msg_t *req_msg =
+               (net_nfc_request_llcp_msg_t *)user_data;
 
-       if (info == NULL)
+       if (req_msg == NULL)
        {
                DEBUG_ERR_MSG("can not get llcp_event info");
+
                return;
        }
 
-       req_llcp_msg = (net_nfc_request_llcp_msg_t *)info;
-       req_llcp_msg->user_param = (uint32_t) user_context;
-
-       req_msg = (net_nfc_request_msg_t *)req_llcp_msg;
-
        switch (req_msg->request_type)
        {
        case NET_NFC_MESSAGE_SERVICE_LLCP_DEACTIVATED:
-               net_nfc_server_llcp_deactivated(req_msg);
+               net_nfc_server_llcp_deactivated(NULL);
                break;
+
        case NET_NFC_MESSAGE_SERVICE_LLCP_LISTEN:
-               net_nfc_server_llcp_listen(req_msg);
+               {
+                       net_nfc_request_listen_socket_t *msg =
+                               (net_nfc_request_listen_socket_t *)user_data;
+
+                       net_nfc_controller_llcp_incoming_cb(msg->client_socket,
+                                       msg->result, NULL, (void *)req_msg->user_param);
+               }
                break;
+
        case NET_NFC_MESSAGE_SERVICE_LLCP_SOCKET_ERROR:
        case NET_NFC_MESSAGE_SERVICE_LLCP_SOCKET_ACCEPTED_ERROR:
-               net_nfc_server_llcp_socket_error(req_msg);
+               net_nfc_controller_llcp_socket_error_cb(
+                               req_msg->llcp_socket,
+                               req_msg->result,
+                               NULL,
+                               (void *)req_msg->user_param);
                break;
+
        case NET_NFC_MESSAGE_SERVICE_LLCP_SEND:
        case NET_NFC_MESSAGE_SERVICE_LLCP_SEND_TO:
-               net_nfc_server_llcp_send(req_msg);
+               net_nfc_controller_llcp_sent_cb(
+                               req_msg->llcp_socket,
+                               req_msg->result,
+                               NULL,
+                               (void *)req_msg->user_param);
                break;
+
        case NET_NFC_MESSAGE_SERVICE_LLCP_RECEIVE:
-               net_nfc_server_llcp_receive(req_msg);
+               {
+                       net_nfc_request_receive_socket_t *msg =
+                               (net_nfc_request_receive_socket_t *)user_data;
+                       data_s data = { msg->data.buffer, msg->data.length };
+
+                       net_nfc_controller_llcp_received_cb(msg->client_socket,
+                                       msg->result,
+                                       &data,
+                                       (void *)req_msg->user_param);
+               }
                break;
+
        case NET_NFC_MESSAGE_SERVICE_LLCP_RECEIVE_FROM:
-               net_nfc_server_llcp_receive_from(req_msg);
+               {
+                       net_nfc_request_receive_from_socket_t *msg =
+                               (net_nfc_request_receive_from_socket_t *)user_data;
+                       data_s data = { msg->data.buffer, msg->data.length };
+
+                       /* FIXME : pass sap */
+                       net_nfc_controller_llcp_received_cb(msg->client_socket,
+                                       msg->result,
+                                       &data,
+                                       (void *)req_msg->user_param);
+               }
                break;
+
        case NET_NFC_MESSAGE_SERVICE_LLCP_CONNECT:
        case NET_NFC_MESSAGE_SERVICE_LLCP_CONNECT_SAP:
-               net_nfc_server_llcp_connect(req_msg);
+               net_nfc_controller_llcp_connected_cb(
+                               req_msg->llcp_socket,
+                               req_msg->result,
+                               NULL,
+                               (void *)req_msg->user_param);
                break;
+
        case NET_NFC_MESSAGE_SERVICE_LLCP_DISCONNECT:
-               net_nfc_server_llcp_disconnect(req_msg);
-               break;
-       case NET_NFC_MESSAGE_SERVICE_LLCP_ACCEPT: /* currently not used */
+               net_nfc_controller_llcp_disconnected_cb(
+                               req_msg->llcp_socket,
+                               req_msg->result,
+                               NULL,
+                               (void *)req_msg->user_param);
                break;
+
        default:
                break;
        }
+
+       /* FIXME : should be removed when plugins would be fixed*/
+       _net_nfc_util_free_mem(req_msg);
+}
+
+/* FIXME : net_nfc_dispatcher_queue_push() need to be removed */
+static void controller_llcp_event_cb(void *info, void *user_context)
+{
+       if(net_nfc_server_controller_async_queue_push(
+                               _controller_llcp_event_cb, info) == FALSE)
+       {
+               DEBUG_ERR_MSG("Failed to push onto the queue");
+       }
 }
 
 static void controller_init_thread_func(gpointer user_data)
@@ -236,6 +291,7 @@ static void controller_init_thread_func(gpointer user_data)
                DEBUG_ERR_MSG("net_nfc_contorller_register_listener failed [%d]",
                                result);
        }
+
        INFO_MSG("net_nfc_contorller_register_listener success");
 
        result = net_nfc_server_llcp_set_config(NULL);
@@ -284,17 +340,16 @@ static void restart_polling_loop_thread_func(gpointer user_data)
 
        if (vconf_get_bool(VCONFKEY_NFC_STATE, &state) != 0)
                DEBUG_ERR_MSG("%s does not exist", "VCONFKEY_NFC_STATE");
+
        if (state == 0)
                return;
 
        if (vconf_get_int(VCONFKEY_PM_STATE, &pm_state) != 0)
                DEBUG_ERR_MSG("%s does not exist", "VCONFKEY_PM_STATE");
 
-
        DEBUG_SERVER_MSG("net_nfc_service_restart_polling, state = [%d]",
                        pm_state);
 
-
        if (pm_state == VCONFKEY_PM_STATE_NORMAL)
        {
                if (net_nfc_controller_configure_discovery(
@@ -393,6 +448,7 @@ gboolean net_nfc_server_controller_async_queue_push(
        if(controller_async_queue == NULL)
        {
                DEBUG_ERR_MSG("controller_async_queue is not initialized");
+
                return FALSE;
        }
 
index 9ba30dc..a576aa7 100644 (file)
@@ -648,7 +648,7 @@ static gint _compare_socket_info(gconstpointer a, gconstpointer b)
        return result;
 }
 
-socket_info_t *_get_socket_info(net_nfc_llcp_socket_t socket)
+static socket_info_t* _get_socket_info(net_nfc_llcp_socket_t socket)
 {
        socket_info_t *result;
        GSList *item;
@@ -664,7 +664,7 @@ socket_info_t *_get_socket_info(net_nfc_llcp_socket_t socket)
        return result;
 }
 
-socket_info_t* _add_socket_info(net_nfc_llcp_socket_t socket)
+static socket_info_t* _add_socket_info(net_nfc_llcp_socket_t socket)
 {
        socket_info_t *result;
 
index 610e792..9e8f4c6 100644 (file)
@@ -194,7 +194,4 @@ bool net_nfc_test_sim(void);
 bool net_nfc_controller_eedata_register_set(net_nfc_error_e *result,
                uint32_t mode, uint32_t reg_id, data_s *data);
 
-socket_info_t *_get_socket_info(net_nfc_llcp_socket_t socket);
-socket_info_t *_add_socket_info(net_nfc_llcp_socket_t socket);
-
-#endif //__NET_NFC_SERVER_CONTROLLER_H__
\ No newline at end of file
+#endif //__NET_NFC_SERVER_CONTROLLER_H__
index 5996716..9e1f519 100644 (file)
  */
 #include <pmapi.h>/*for pm lock*/
 
+#include "net_nfc_debug_internal.h"
+#include "net_nfc_util_internal.h"
+#include "net_nfc_util_gdbus_internal.h"
 #include "net_nfc_gdbus.h"
+
+#include "net_nfc_server_controller.h"
 #include "net_nfc_server_common.h"
-#include "net_nfc_server_p2p.h"
+#include "net_nfc_server_context.h"
+#include "net_nfc_server_tag.h"
 #include "net_nfc_server_llcp.h"
-
+#include "net_nfc_server_p2p.h"
 #include "net_nfc_server_process_snep.h"
 #include "net_nfc_server_process_npp.h"
 #include "net_nfc_server_process_handover.h"
-#include "net_nfc_server_tag.h"
-
-#include "net_nfc_debug_internal.h"
-#include "net_nfc_server_controller.h"
-#include "net_nfc_util_gdbus_internal.h"
-#include "net_nfc_server_context.h"
 
 /* default llcp configurations */
 #define NET_NFC_LLCP_MIU       128
@@ -46,6 +46,18 @@ static net_nfc_llcp_config_info_s llcp_config =
        NET_NFC_LLCP_OPT,
 };
 
+
+typedef struct _llcp_client_data
+{
+       GDBusConnection *connection;
+       char *id;
+       net_nfc_target_handle_h handle;
+       net_nfc_llcp_socket_t socket;
+       void *user_data;
+}
+llcp_client_data;
+
+
 typedef struct _LlcpData LlcpData;
 
 struct _LlcpData
@@ -76,7 +88,6 @@ struct _LlcpListenData
 
        guint32 handle;
        guint32 client_socket;
-       guint32 oal_socket;
        guint16 miu;
        guint8 rw;
        guint type;
@@ -84,6 +95,17 @@ struct _LlcpListenData
        gchar *service_name;
 };
 
+typedef struct _LlcpAcceptData LlcpAcceptData;
+
+struct _LlcpAcceptData
+{
+       NetNfcGDbusLlcp *llcp;
+       GDBusMethodInvocation *invocation;
+
+       guint handle;
+       guint client_socket;
+};
+
 typedef struct _LlcpConnectData LlcpConnectData;
 
 struct _LlcpConnectData
@@ -93,7 +115,6 @@ struct _LlcpConnectData
 
        guint32 handle;
        guint32 client_socket;
-       guint32 oal_socket;
        guint16 miu;
        guint8 rw;
        guint type;
@@ -109,7 +130,6 @@ struct _LlcpConnectSapData
 
        guint32 handle;
        guint32 client_socket;
-       guint32 oal_socket;
        guint16 miu;
        guint8 rw;
        guint type;
@@ -125,9 +145,8 @@ struct _LlcpSendData
 
        guint32 handle;
        guint32 client_socket;
-       guint32 oal_socket;
 
-       data_s *data;
+       data_s data;
 };
 
 typedef struct _LlcpSendToData LlcpSendToData;
@@ -139,10 +158,9 @@ struct _LlcpSendToData
 
        guint32 handle;
        guint32 client_socket;
-       guint32 oal_socket;
        guint8 sap;
 
-       data_s *data;
+       data_s data;
 };
 
 typedef struct _LlcpReceiveData LlcpReceiveData;
@@ -154,7 +172,6 @@ struct _LlcpReceiveData
 
        guint32 handle;
        guint32 client_socket;
-       guint32 oal_socket;
        guint32 req_length;
 };
 
@@ -167,7 +184,6 @@ struct _LlcpCloseData
 
        guint32 handle;
        guint32 client_socket;
-       guint32 oal_socket;
 };
 
 typedef struct _LlcpDisconnectData LlcpDisconnectData;
@@ -179,16 +195,6 @@ struct _LlcpDisconnectData
 
        guint32 handle;
        guint32 client_socket;
-       guint32 oal_socket;
-};
-
-/* server_side */
-typedef struct _ServerLlcpData ServerLlcpData;
-
-struct _ServerLlcpData
-{
-       NetNfcGDbusLlcp *llcp;
-       net_nfc_request_msg_t *req_msg;
 };
 
 typedef struct _LlcpSimpleData LlcpSimpleData;
@@ -203,17 +209,13 @@ struct _LlcpSimpleData
        gpointer user_data;
 };
 
-
-static void llcp_add_async_queue(net_nfc_request_msg_t *req_msg,
-               net_nfc_server_controller_func func);
-
 static void llcp_socket_error_cb(net_nfc_llcp_socket_t socket,
                net_nfc_error_e result,
                data_s *data,
                void *extra,
                void *user_param);
 
-static void llcp_listen_cb(net_nfc_llcp_socket_t socket,
+static void llcp_incoming_cb(net_nfc_llcp_socket_t socket,
                net_nfc_error_e result,
                data_s *data,
                void *extra,
@@ -237,6 +239,12 @@ static void llcp_send_cb(net_nfc_llcp_socket_t socket,
                void *extra,
                void *user_param);
 
+static void llcp_send_to_cb(net_nfc_llcp_socket_t socket,
+               net_nfc_error_e result,
+               data_s *data,
+               void *extra,
+               void *user_param);
+
 static void llcp_receive_cb(net_nfc_llcp_socket_t socket,
                net_nfc_error_e result,
                data_s *data,
@@ -260,6 +268,10 @@ static void llcp_handle_config_thread_func(gpointer user_data);
 
 static void llcp_handle_listen_thread_func(gpointer user_data);
 
+static void llcp_handle_accept_thread_func(gpointer user_data);
+
+static void llcp_handle_reject_thread_func(gpointer user_data);
+
 static void llcp_handle_connect_thread_func(gpointer user_data);
 
 static void llcp_handle_connect_sap_thread_func(gpointer user_data);
@@ -287,7 +299,6 @@ static gboolean llcp_handle_listen(NetNfcGDbusLlcp *llcp,
                GDBusMethodInvocation *invocation,
                guint32 arg_handle,
                guint32 arg_client_socket,
-               guint32 arg_oal_socket,
                guint16 arg_miu,
                guint8 arg_rw,
                gint32 arg_type,
@@ -300,7 +311,6 @@ static gboolean llcp_handle_connect(NetNfcGDbusLlcp *llcp,
                GDBusMethodInvocation *invocation,
                guint32 arg_handle,
                guint32 arg_client_socket,
-               guint32 arg_oal_socket,
                guint16 arg_miu,
                guint8 arg_rw,
                gint32 arg_type,
@@ -312,7 +322,6 @@ static gboolean llcp_handle_connect_sap(NetNfcGDbusLlcp *llcp,
                GDBusMethodInvocation *invocation,
                guint32 arg_handle,
                guint32 arg_client_socket,
-               guint32 arg_oal_socket,
                guint16 arg_miu,
                guint8 arg_rw,
                gint32 arg_type,
@@ -324,7 +333,6 @@ static gboolean llcp_handle_send(NetNfcGDbusLlcp *llcp,
                GDBusMethodInvocation *invocation,
                guint32 arg_handle,
                guint32 arg_client_socket,
-               guint32 arg_oal_socket,
                GVariant *arg_data,
                GVariant *smack_privilege,
                gpointer user_data);
@@ -333,7 +341,6 @@ static gboolean llcp_handle_send_to(NetNfcGDbusLlcp *llcp,
                GDBusMethodInvocation *invocation,
                guint32 arg_handle,
                guint32 arg_client_socket,
-               guint32 arg_oal_socket,
                guint8 arg_sap,
                GVariant *arg_data,
                GVariant *smack_privilege,
@@ -343,7 +350,6 @@ static gboolean llcp_handle_receive(NetNfcGDbusLlcp *llcp,
                GDBusMethodInvocation *invocation,
                guint32 arg_handle,
                guint32 arg_client_socket,
-               guint32 arg_oal_socket,
                guint32 arg_req_length,
                GVariant *smack_privilege,
                gpointer user_data);
@@ -352,7 +358,6 @@ static gboolean llcp_handle_receive_from(NetNfcGDbusLlcp *llcp,
                GDBusMethodInvocation *invocation,
                guint32 arg_handle,
                guint32 arg_client_socket,
-               guint32 arg_oal_socket,
                guint32 arg_req_length,
                GVariant *smack_privilege,
                gpointer user_data);
@@ -361,7 +366,6 @@ static gboolean llcp_handle_close(NetNfcGDbusLlcp *llcp,
                GDBusMethodInvocation *invocation,
                guint32 arg_handle,
                guint32 arg_client_socket,
-               guint32 arg_oal_socket,
                GVariant *smack_privilege,
                gpointer user_data);
 
@@ -369,28 +373,10 @@ static gboolean llcp_handle_disconnect(NetNfcGDbusLlcp *llcp,
                GDBusMethodInvocation *invocation,
                guint32 arg_handle,
                guint32 arg_client_socket,
-               guint32 arg_oal_socket,
                GVariant *smack_privilege,
                gpointer user_data);
 
 
-/* server side */
-static void llcp_deactivated_thread_func(gpointer user_data);
-
-static void llcp_listen_thread_func(gpointer user_data);
-
-static void llcp_socket_error_thread_func(gpointer user_data);
-
-static void llcp_send_thread_func(gpointer user_data);
-
-static void llcp_receive_thread_func(gpointer user_data);
-
-static void llcp_receive_from_thread_func(gpointer user_data);
-
-static void llcp_connect_thread_func(gpointer user_data);
-
-static void llcp_disconnect_thread_func(gpointer user_data);
-
 /* simple */
 static void llcp_simple_socket_error_cb(net_nfc_llcp_socket_t socket,
                net_nfc_error_e result,
@@ -410,12 +396,6 @@ static void llcp_simple_connect_cb(net_nfc_llcp_socket_t socket,
                void *extra,
                void *user_param);
 
-static void llcp_simple_server_error_cb(net_nfc_llcp_socket_t socket,
-               net_nfc_error_e result,
-               data_s *data,
-               void *extra,
-               void *user_param);
-
 static void llcp_simple_send_cb(net_nfc_llcp_socket_t socket,
                net_nfc_error_e result,
                data_s *data,
@@ -429,194 +409,159 @@ static void llcp_simple_receive_cb(net_nfc_llcp_socket_t socket,
                void *user_param);
 
 
-static void llcp_add_async_queue(net_nfc_request_msg_t *req_msg,
-               net_nfc_server_controller_func func)
+static void llcp_socket_error_cb(net_nfc_llcp_socket_t socket,
+               net_nfc_error_e result,
+               data_s *data,
+               void *extra,
+               void *user_param)
 {
-       ServerLlcpData *data = NULL;
-
-       if (llcp_skeleton == NULL)
-       {
-               DEBUG_ERR_MSG("%s is not initialized",
-                               "net_nfc_server_llcp");
-               return;
-       }
-
-       if (req_msg == NULL)
-       {
-               DEBUG_ERR_MSG("req msg is null");
-       }
-
-       data = g_new0(ServerLlcpData, 1);
-       if(data == NULL)
-       {
-               DEBUG_ERR_MSG("Memory allocation failed");
-               return;
-       }
-       data->llcp = g_object_ref(llcp_skeleton);
-       data->req_msg = req_msg;
-
-       if (net_nfc_server_controller_async_queue_push(func, data) == FALSE)
-       {
-               DEBUG_ERR_MSG("can not push to controller thread");
+       llcp_client_data *client_data = (llcp_client_data *)user_param;
+       GError *error = NULL;
 
-               if (data)
-               {
-                       g_object_unref(data->llcp);
-                       g_free(data->req_msg);
-                       g_free(data);
+       if (g_dbus_connection_emit_signal(
+                               client_data->connection,
+                               client_data->id,
+                               "/org/tizen/NetNfcService/Llcp",
+                               "org.tizen.NetNfcService.Llcp",
+                               "Error",
+                               g_variant_new("(uui)",
+                                       GPOINTER_TO_UINT(client_data->handle),
+                                       socket,
+                                       result),
+                               &error) == false) {
+               if (error != NULL && error->message != NULL) {
+                       DEBUG_ERR_MSG("g_dbus_connection_emit_signal failed : %s", error->message);
+               } else {
+                       DEBUG_ERR_MSG("g_dbus_connection_emit_signal failed");
                }
        }
 }
 
-static void llcp_socket_error_cb(net_nfc_llcp_socket_t socket,
+static void llcp_incoming_cb(net_nfc_llcp_socket_t socket,
                net_nfc_error_e result,
                data_s *data,
                void *extra,
                void *user_param)
 {
-       LlcpData *llcp_data;
-
-       llcp_data = (LlcpData *)user_param;
-
-       if (llcp_data->invocation)
-       {
-               g_dbus_method_invocation_return_dbus_error(
-                               llcp_data->invocation,
-                               "org.tizen.NetNfcService.SocketError",
-                               "socket error");
+       llcp_client_data *client_data = (llcp_client_data *)user_param;
+       GError *error = NULL;
 
-               g_object_unref(llcp_data->invocation);
+       if (g_dbus_connection_emit_signal(
+                               client_data->connection,
+                               client_data->id,
+                               "/org/tizen/NetNfcService/Llcp",
+                               "org.tizen.NetNfcService.Llcp",
+                               "Incoming",
+                               g_variant_new("(uuu)",
+                                       GPOINTER_TO_UINT(client_data->handle),
+                                       client_data->socket,
+                                       socket),
+                               &error) == false) {
+               if (error != NULL && error->message != NULL) {
+                       DEBUG_ERR_MSG("g_dbus_connection_emit_signal failed : %s", error->message);
+               } else {
+                       DEBUG_ERR_MSG("g_dbus_connection_emit_signal failed");
+               }
        }
-
-       if (llcp_data->llcp)
-               g_object_unref(llcp_data->llcp);
-
-       g_free(llcp_data);
 }
 
-static void llcp_listen_cb(net_nfc_llcp_socket_t socket,
+static void llcp_connect_by_url_cb(net_nfc_llcp_socket_t socket,
                net_nfc_error_e result,
                data_s *data,
                void *extra,
                void *user_param)
 {
-       LlcpListenData *llcp_data;
+       LlcpConnectData *llcp_data = (LlcpConnectData *)user_param;
 
-       llcp_data = (LlcpListenData *)user_param;
+       g_assert(llcp_data != NULL);
+       g_assert(llcp_data->llcp != NULL);
+       g_assert(llcp_data->invocation != NULL);
 
-       if (llcp_data == NULL)
-               return;
-
-       if (llcp_data->llcp)
-       {
+       net_nfc_gdbus_llcp_complete_connect(llcp_data->llcp,
+                       llcp_data->invocation,
+                       result,
+                       socket);
 
-               if (llcp_data->invocation)
-               {
-                       net_nfc_gdbus_llcp_complete_listen(llcp_data->llcp,
-                                       llcp_data->invocation,
-                                       llcp_data->client_socket,
-                                       socket);
-                       g_object_unref(llcp_data->invocation);
-               }
+       g_free(llcp_data->service_name);
 
-               g_object_unref(llcp_data->llcp);
-       }
+       g_object_unref(llcp_data->invocation);
+       g_object_unref(llcp_data->llcp);
 
-       g_free(llcp_data->service_name);
        g_free(llcp_data);
 }
 
-static void llcp_connect_by_url_cb(net_nfc_llcp_socket_t socket,
+static void llcp_connect_cb(net_nfc_llcp_socket_t socket,
                net_nfc_error_e result,
                data_s *data,
                void *extra,
                void *user_param)
 {
-       LlcpConnectData *llcp_data;
-
-       llcp_data = (LlcpConnectData *)user_param;
-
-       if (llcp_data == NULL)
-               return;
+       LlcpConnectSapData *llcp_data = (LlcpConnectSapData *)user_param;
 
-       if (llcp_data->llcp)
-       {
+       g_assert(llcp_data != NULL);
+       g_assert(llcp_data->llcp != NULL);
+       g_assert(llcp_data->invocation != NULL);
 
-               if (llcp_data->invocation)
-               {
-                       net_nfc_gdbus_llcp_complete_connect(llcp_data->llcp,
-                                       llcp_data->invocation,
-                                       llcp_data->client_socket,
-                                       socket);
-                       g_object_unref(llcp_data->invocation);
-               }
+       net_nfc_gdbus_llcp_complete_connect_sap(
+                       llcp_data->llcp,
+                       llcp_data->invocation,
+                       result,
+                       socket);
 
-               g_object_unref(llcp_data->llcp);
-       }
+       g_object_unref(llcp_data->invocation);
+       g_object_unref(llcp_data->llcp);
 
-       g_free(llcp_data->service_name);
        g_free(llcp_data);
 }
 
-static void llcp_connect_cb(net_nfc_llcp_socket_t socket,
+static void llcp_send_cb(net_nfc_llcp_socket_t socket,
                net_nfc_error_e result,
                data_s *data,
                void *extra,
                void *user_param)
 {
-       LlcpConnectSapData *llcp_data;
+       LlcpSendData *llcp_data = (LlcpSendData *)user_param;
 
-       llcp_data = (LlcpConnectSapData *)user_param;
+       g_assert(llcp_data != NULL);
+       g_assert(llcp_data->llcp != NULL);
+       g_assert(llcp_data->invocation != NULL);
 
-       if (llcp_data == NULL)
-               return;
-
-       if (llcp_data->llcp)
-       {
+       net_nfc_gdbus_llcp_complete_send(
+                       llcp_data->llcp,
+                       llcp_data->invocation,
+                       result,
+                       socket);
 
-               if (llcp_data->invocation)
-               {
-                       net_nfc_gdbus_llcp_complete_connect_sap(
-                                       llcp_data->llcp,
-                                       llcp_data->invocation,
-                                       llcp_data->client_socket,
-                                       socket);
-                       g_object_unref(llcp_data->invocation);
-               }
+       net_nfc_util_free_data(&llcp_data->data);
 
-               g_object_unref(llcp_data->llcp);
-       }
+       g_object_unref(llcp_data->invocation);
+       g_object_unref(llcp_data->llcp);
 
        g_free(llcp_data);
 }
 
-static void llcp_send_cb(net_nfc_llcp_socket_t socket,
+static void llcp_send_to_cb(net_nfc_llcp_socket_t socket,
                net_nfc_error_e result,
                data_s *data,
                void *extra,
                void *user_param)
 {
-       LlcpData *llcp_data;
-
-       llcp_data = (LlcpData *)user_param;
+       LlcpSendToData *llcp_data = (LlcpSendToData *)user_param;
 
-       if (llcp_data == NULL)
-               return;
+       g_assert(llcp_data != NULL);
+       g_assert(llcp_data->llcp != NULL);
+       g_assert(llcp_data->invocation != NULL);
 
-       if (llcp_data->llcp)
-       {
+       net_nfc_gdbus_llcp_complete_send_to(
+                       llcp_data->llcp,
+                       llcp_data->invocation,
+                       result,
+                       socket);
 
-               if (llcp_data->invocation)
-               {
-                       net_nfc_gdbus_llcp_complete_send(
-                                       llcp_data->llcp,
-                                       llcp_data->invocation,
-                                       socket);
-                       g_object_unref(llcp_data->invocation);
-               }
+       net_nfc_util_free_data(&llcp_data->data);
 
-               g_object_unref(llcp_data->llcp);
-       }
+       g_object_unref(llcp_data->invocation);
+       g_object_unref(llcp_data->llcp);
 
        g_free(llcp_data);
 }
@@ -627,30 +572,22 @@ static void llcp_receive_cb(net_nfc_llcp_socket_t socket,
                void *extra,
                void *user_param)
 {
-       LlcpData *llcp_data;
-
-       llcp_data = (LlcpData *)user_param;
-
-       if (llcp_data == NULL)
-               return;
+       LlcpReceiveData *llcp_data = (LlcpReceiveData *)user_param;
+       GVariant *variant;
 
-       if (llcp_data->llcp)
-       {
-               if (llcp_data->invocation)
-               {
-                       GVariant *variant;
+       g_assert(llcp_data != NULL);
+       g_assert(llcp_data->llcp != NULL);
+       g_assert(llcp_data->invocation != NULL);
 
-                       variant = net_nfc_util_gdbus_data_to_variant(data);
-                       net_nfc_gdbus_llcp_complete_receive(
-                                       llcp_data->llcp,
-                                       llcp_data->invocation,
-                                       variant);
-
-                       g_object_unref(llcp_data->invocation);
-               }
+       variant = net_nfc_util_gdbus_data_to_variant(data);
+       net_nfc_gdbus_llcp_complete_receive(
+                       llcp_data->llcp,
+                       llcp_data->invocation,
+                       result,
+                       variant);
 
-               g_object_unref(llcp_data->llcp);
-       }
+       g_object_unref(llcp_data->invocation);
+       g_object_unref(llcp_data->llcp);
 
        g_free(llcp_data);
 }
@@ -661,32 +598,23 @@ static void llcp_receive_from_cb(net_nfc_llcp_socket_t socket,
                void *extra,
                void *user_param)
 {
-       LlcpData *llcp_data;
-
-       llcp_data = (LlcpData *)user_param;
-
-       if (llcp_data == NULL)
-               return;
+       LlcpReceiveData *llcp_data = (LlcpReceiveData *)user_param;
+       GVariant *variant;
 
-       if (llcp_data->llcp)
-       {
-
-               if (llcp_data->invocation)
-               {
-                       GVariant *variant;
-
-                       variant = net_nfc_util_gdbus_data_to_variant(data);
-                       net_nfc_gdbus_llcp_complete_receive_from(
-                                       llcp_data->llcp,
-                                       llcp_data->invocation,
-                                       (guint8) (int)extra,
-                                       variant);
+       g_assert(llcp_data != NULL);
+       g_assert(llcp_data->llcp != NULL);
+       g_assert(llcp_data->invocation != NULL);
 
-                       g_object_unref(llcp_data->invocation);
-               }
+       variant = net_nfc_util_gdbus_data_to_variant(data);
+       net_nfc_gdbus_llcp_complete_receive_from(
+                       llcp_data->llcp,
+                       llcp_data->invocation,
+                       result,
+                       (guint8) (int)extra,
+                       variant);
 
-               g_object_unref(llcp_data->llcp);
-       }
+       g_object_unref(llcp_data->invocation);
+       g_object_unref(llcp_data->llcp);
 
        g_free(llcp_data);
 }
@@ -698,28 +626,20 @@ static void llcp_disconnect_cb(net_nfc_llcp_socket_t socket,
                void *extra,
                void *user_param)
 {
-       LlcpData *llcp_data;
-
-       llcp_data = (LlcpData *)user_param;
-
-       if (llcp_data == NULL)
-               return;
-
-       if (llcp_data->llcp)
-       {
+       LlcpDisconnectData *llcp_data = (LlcpDisconnectData *)user_param;
 
-               if (llcp_data->invocation)
-               {
-                       net_nfc_gdbus_llcp_complete_disconnect(
-                                       llcp_data->llcp,
-                                       llcp_data->invocation,
-                                       socket);
+       g_assert(llcp_data != NULL);
+       g_assert(llcp_data->llcp != NULL);
+       g_assert(llcp_data->invocation != NULL);
 
-                       g_object_unref(llcp_data->invocation);
-               }
+       net_nfc_gdbus_llcp_complete_disconnect(
+                       llcp_data->llcp,
+                       llcp_data->invocation,
+                       result,
+                       socket);
 
-               g_object_unref(llcp_data->llcp);
-       }
+       g_object_unref(llcp_data->invocation);
+       g_object_unref(llcp_data->llcp);
 
        g_free(llcp_data);
 }
@@ -727,114 +647,55 @@ static void llcp_disconnect_cb(net_nfc_llcp_socket_t socket,
 
 static void llcp_handle_config_thread_func(gpointer user_data)
 {
+       LlcpConfigData *data = (LlcpConfigData *)user_data;
+       net_nfc_error_e result;
        net_nfc_llcp_config_info_s config;
-       LlcpConfigData *data = user_data;
-
-       if (data == NULL)
-       {
-               DEBUG_ERR_MSG("can not get LlcpConfigData");
-               return;
-       }
-
-       if (data->llcp == NULL)
-       {
-               DEBUG_ERR_MSG("can not get llcp");
-               if (data->invocation)
-               {
-                       g_dbus_method_invocation_return_dbus_error(
-                                       data->invocation,
-                                       "org.tizen.NetNfcService.ConfigError",
-                                       "can not get llcp");
-
-                       g_object_unref(data->invocation);
-               }
-               g_free(data);
 
-               return;
-       }
+       g_assert(data != NULL);
+       g_assert(data->llcp != NULL);
+       g_assert(data->invocation != NULL);
 
        config.miu = data->miu;
        config.wks = data->wks;
        config.lto = data->lto;
        config.option = data->option;
 
-       if (net_nfc_server_llcp_set_config(&config) != NET_NFC_OK)
-       {
-               if (data->invocation)
-               {
-                       g_dbus_method_invocation_return_dbus_error(
-                                       data->invocation,
-                                       "org.tizen.NetNfcService.ConfigError",
-                                       "can not get llcp");
-
-                       g_object_unref(data->invocation);
-               }
-
-               g_object_unref(data->llcp);
-               g_free(data);
-               return;
-       }
+       result = net_nfc_server_llcp_set_config(&config);
 
-       if (data->invocation)
-       {
-               net_nfc_gdbus_llcp_complete_config(data->llcp,
-                               data->invocation);
-
-               g_object_unref(data->invocation);
-       }
+       net_nfc_gdbus_llcp_complete_config(data->llcp,
+                       data->invocation,
+                       result);
 
+       g_object_unref(data->invocation);
        g_object_unref(data->llcp);
-       g_free(data);
 
-       return;
+       g_free(data);
 }
 
 static void llcp_handle_listen_thread_func(gpointer user_data)
 {
-       LlcpListenData *data;
-       LlcpData *error_data;
+       LlcpListenData *data = (LlcpListenData *)user_data;
+       llcp_client_data *client_data;
 
        net_nfc_llcp_socket_t socket = -1;
-       net_nfc_error_e result = NET_NFC_OK;
-
-       data = (LlcpListenData *)user_data;
-
-       if (data == NULL)
-       {
-               DEBUG_ERR_MSG("can not get LlcpListenData");
-               return;
-       }
-
-       if (data->llcp == NULL)
-       {
-               DEBUG_ERR_MSG("can not get llcp");
-               if (data->invocation)
-               {
-                       g_dbus_method_invocation_return_dbus_error(
-                                       data->invocation,
-                                       "org.tizen.NetNfcService.ListenError",
-                                       "can not get llcp");
+       net_nfc_error_e result;
 
-                       g_object_unref(data->invocation);
-               }
+       g_assert(data != NULL);
+       g_assert(data->llcp != NULL);
+       g_assert(data->invocation != NULL);
 
-               g_free(data->service_name);
-               g_free(data);
+       client_data = g_try_new0(llcp_client_data, 1);
+       if (client_data == NULL) {
+               result = NET_NFC_ALLOC_FAIL;
 
-               return;
+               goto ERROR;
        }
 
-       error_data = g_new0(LlcpData, 1);
-       if(error_data == NULL)
-       {
-               DEBUG_ERR_MSG("Memory allocation failed");
-               g_dbus_method_invocation_return_dbus_error(data->invocation,
-                               "org.tizen.NetNfcService.AllocationError",
-                               "Can not allocate memory");
-               return;
-       }
-       error_data->llcp = g_object_ref(data->llcp);
-       error_data->invocation = g_object_ref(data->invocation);
+       client_data->connection = g_dbus_method_invocation_get_connection(
+                       data->invocation);
+       client_data->id = g_strdup(
+                       g_dbus_method_invocation_get_sender(data->invocation));
+       client_data->handle = (net_nfc_target_handle_h)data->handle;
 
        if (net_nfc_controller_llcp_create_socket(&socket,
                                data->type,
@@ -842,142 +703,167 @@ static void llcp_handle_listen_thread_func(gpointer user_data)
                                data->rw,
                                &result,
                                llcp_socket_error_cb,
-                               error_data) == false)
+                               client_data) == false)
        {
-               DEBUG_ERR_MSG("%s fiailed [%d]",
-                               "net_nfc_controller_llcp_create_socket" ,result);
-
-               if (data->invocation)
-               {
-                       g_dbus_method_invocation_return_dbus_error(
-                                       data->invocation,
-                                       "org.tizen.NetNfcService.ListenError",
-                                       "can not create socket");
-
-                       g_object_unref(data->invocation);
-               }
-
-               g_object_unref(data->llcp);
-
-               g_free(data->service_name);
-               g_free(data);
+               DEBUG_ERR_MSG("net_nfc_controller_llcp_create_socket failed [%d]", result);
 
-               g_free(error_data);
-
-               return;
+               goto ERROR;
        }
 
+       client_data->socket = socket;
+
        if (net_nfc_controller_llcp_bind(socket,
                                data->sap,
                                &result) == false)
        {
-               DEBUG_ERR_MSG("%s fiailed [%d]",
-                               "net_nfc_controller_llcp_create_socket" ,result);
-
-               if (data->invocation)
-               {
-                       g_dbus_method_invocation_return_dbus_error(
-                                       data->invocation,
-                                       "org.tizen.NetNfcService.ListenError",
-                                       "can not bind socket");
-
-                       g_object_unref(data->invocation);
-               }
-
-               g_object_unref(data->llcp);
-
-               g_free(data->service_name);
-               g_free(data);
-
-               g_free(error_data);
-
-               if (socket != -1)
-                       net_nfc_controller_llcp_socket_close(socket, &result);
+               DEBUG_ERR_MSG("net_nfc_controller_llcp_bind failed [%d]", result);
 
-               return;
+               goto ERROR;
        }
 
-       DEBUG_SERVER_MSG("OAL socket in Listen : %d\n", socket);
-
        if (net_nfc_controller_llcp_listen(GUINT_TO_POINTER(data->handle),
                                (uint8_t *)data->service_name,
                                socket,
                                &result,
-                               llcp_listen_cb,
-                               data) == false)
+                               llcp_incoming_cb,
+                               client_data) == false)
        {
-               DEBUG_ERR_MSG("%s failed [%d]",
-                               "net_nfc_controller_llcp_listen",
-                               result);
+               DEBUG_ERR_MSG("net_nfc_controller_llcp_listen failed [%d]", result);
 
-               if (data->invocation)
-               {
-                       g_dbus_method_invocation_return_dbus_error(
-                                       data->invocation,
-                                       "org.tizen.NetNfcService.ListenError",
-                                       "can not listen socket");
+               goto ERROR;
+       }
 
-                       g_object_unref(data->invocation);
-               }
+       net_nfc_gdbus_llcp_complete_listen(data->llcp, data->invocation,
+                       result,
+                       GPOINTER_TO_UINT(socket));
 
-               g_object_unref(data->llcp);
+       g_object_unref(data->invocation);
+       g_object_unref(data->llcp);
 
-               g_free(data->service_name);
-               g_free(data);
+       g_free(data);
+
+       return;
 
-               g_free(error_data);
+ERROR :
+       net_nfc_gdbus_llcp_complete_listen(data->llcp, data->invocation,
+                       result,
+                       -1);
 
-               if (socket != -1)
-                       net_nfc_controller_llcp_socket_close(socket, &result);
-       }
+       if (socket != -1)
+               net_nfc_controller_llcp_socket_close(socket, &result);
+
+       g_free(client_data);
+
+       g_free(data->service_name);
+
+       g_object_unref(data->invocation);
+       g_object_unref(data->llcp);
+
+       g_free(data);
 }
 
-static void llcp_handle_connect_thread_func(gpointer user_data)
+static void llcp_handle_accept_thread_func(gpointer user_data)
 {
-       LlcpConnectData *data;
-       LlcpData *error_data;
+       LlcpAcceptData *data = (LlcpAcceptData *)user_data;
+       llcp_client_data *client_data;
+       net_nfc_error_e result;
 
-       net_nfc_llcp_socket_t socket = -1;
-       net_nfc_error_e result = NET_NFC_OK;
+       g_assert(data != NULL);
+       g_assert(data->llcp != NULL);
+       g_assert(data->invocation != NULL);
 
-       data = (LlcpConnectData *)user_data;
+       client_data = g_try_new0(llcp_client_data, 1);
+       if (client_data == NULL) {
+               result = NET_NFC_ALLOC_FAIL;
 
-       if (data == NULL)
-       {
-               DEBUG_ERR_MSG("can not get LlcpListenData");
-               return;
+               goto ERROR;
        }
 
-       if (data->llcp == NULL)
-       {
-               DEBUG_ERR_MSG("can not get llcp");
-               if (data->invocation)
-               {
-                       g_dbus_method_invocation_return_dbus_error(
-                                       data->invocation,
-                                       "org.tizen.NetNfcService.ConnectError",
-                                       "can not get llcp");
+       client_data->connection = g_dbus_method_invocation_get_connection(
+                       data->invocation);
+       client_data->id = g_strdup(
+                       g_dbus_method_invocation_get_sender(data->invocation));
+       client_data->handle = (net_nfc_target_handle_h)data->handle;
+       client_data->socket = data->client_socket;
 
-                       g_object_unref(data->invocation);
-               }
+       if (net_nfc_controller_llcp_accept(data->client_socket, &result,
+                               llcp_socket_error_cb,
+                               client_data) == false) {
+               DEBUG_ERR_MSG("net_nfc_controller_llcp_accept failed [%d]", result);
 
-               g_free(data->service_name);
-               g_free(data);
+               goto ERROR;
+       }
 
-               return;
+       net_nfc_gdbus_llcp_complete_accept(data->llcp, data->invocation,
+                       result);
+
+       g_object_unref(data->invocation);
+       g_object_unref(data->llcp);
+
+       g_free(data);
+
+       return;
+
+ERROR :
+       net_nfc_gdbus_llcp_complete_accept(data->llcp, data->invocation,
+                       result);
+
+       g_free(client_data);
+
+       g_object_unref(data->invocation);
+       g_object_unref(data->llcp);
+
+       g_free(data);
+}
+
+static void llcp_handle_reject_thread_func(gpointer user_data)
+{
+       LlcpAcceptData *data = (LlcpAcceptData *)user_data;
+       net_nfc_error_e result;
+
+       g_assert(data != NULL);
+       g_assert(data->llcp != NULL);
+       g_assert(data->invocation != NULL);
+
+       if (net_nfc_controller_llcp_reject(GUINT_TO_POINTER(data->handle),
+                               data->client_socket,
+                               &result) == false) {
+               DEBUG_ERR_MSG("net_nfc_controller_llcp_reject failed [%d]", result);
        }
 
-       error_data = g_new0(LlcpData, 1);
-       if(error_data == NULL)
-       {
-               DEBUG_ERR_MSG("Memory allocation failed");
-               g_dbus_method_invocation_return_dbus_error(data->invocation,
-                               "org.tizen.NetNfcService.AllocationError",
-                               "Can not allocate memory");
-               return;
+       net_nfc_gdbus_llcp_complete_reject(data->llcp, data->invocation,
+                       result);
+
+       g_object_unref(data->invocation);
+       g_object_unref(data->llcp);
+
+       g_free(data);
+}
+
+
+static void llcp_handle_connect_thread_func(gpointer user_data)
+{
+       LlcpConnectData *data = (LlcpConnectData *)user_data;
+       llcp_client_data *client_data;
+       net_nfc_llcp_socket_t socket = -1;
+       net_nfc_error_e result;
+
+       g_assert(data != NULL);
+       g_assert(data->llcp != NULL);
+       g_assert(data->invocation != NULL);
+
+       client_data = g_try_new0(llcp_client_data, 1);
+       if (client_data == NULL) {
+               result = NET_NFC_ALLOC_FAIL;
+
+               goto ERROR;
        }
-       error_data->llcp = g_object_ref(data->llcp);
-       error_data->invocation = g_object_ref(data->invocation);
+
+       client_data->connection = g_dbus_method_invocation_get_connection(
+                       data->invocation);
+       client_data->id = g_strdup(
+                       g_dbus_method_invocation_get_sender(data->invocation));
+       client_data->handle = (net_nfc_target_handle_h)data->handle;
 
        if (net_nfc_controller_llcp_create_socket(&socket,
                                data->type,
@@ -985,32 +871,14 @@ static void llcp_handle_connect_thread_func(gpointer user_data)
                                data->rw,
                                &result,
                                llcp_socket_error_cb,
-                               error_data) == false)
+                               client_data) == false)
        {
-               DEBUG_ERR_MSG("%s fiailed [%d]",
-                               "net_nfc_controller_llcp_create_socket" ,result);
-
-               if (data->invocation)
-               {
-                       g_dbus_method_invocation_return_dbus_error(
-                                       data->invocation,
-                                       "org.tizen.NetNfcService.ConnectError",
-                                       "can not create socket");
+               DEBUG_ERR_MSG("net_nfc_controller_llcp_create_socket failed [%d]", result);
 
-                       g_object_unref(data->invocation);
-               }
-
-               g_object_unref(data->llcp);
-
-               g_free(data->service_name);
-               g_free(data);
-
-               g_free(error_data);
-
-               return;
+               goto ERROR;
        }
 
-       DEBUG_SERVER_MSG("OAL socket in Listen :%d", socket);
+       client_data->socket = socket;
 
        if (net_nfc_controller_llcp_connect_by_url(
                                GUINT_TO_POINTER(data->handle),
@@ -1020,77 +888,60 @@ static void llcp_handle_connect_thread_func(gpointer user_data)
                                llcp_connect_by_url_cb,
                                data) == false)
        {
-               DEBUG_ERR_MSG("%s failed, [%d]",
-                               "net_nfc_controller_llcp_connect_by_url",
-                               result);
+               DEBUG_ERR_MSG("net_nfc_controller_llcp_listen failed [%d]", result);
 
-               if (data->invocation)
-               {
-                       g_dbus_method_invocation_return_dbus_error(
-                                       data->invocation,
-                                       "org.tizen.NetNfcService.ConnectError",
-                                       "can not listen socket");
+               goto ERROR;
+       }
 
-                       g_object_unref(data->invocation);
-               }
+       g_object_unref(data->invocation);
+       g_object_unref(data->llcp);
 
-               g_object_unref(data->llcp);
+       g_free(data);
 
-               g_free(data->service_name);
-               g_free(data);
+       return;
 
-               g_free(error_data);
+ERROR :
+       net_nfc_gdbus_llcp_complete_connect(data->llcp, data->invocation,
+                       result,
+                       -1);
 
-               if (socket != -1)
-                       net_nfc_controller_llcp_socket_close(socket, &result);
-       }
+       if (socket != -1)
+               net_nfc_controller_llcp_socket_close(socket, &result);
+
+       g_free(client_data);
+
+       g_free(data->service_name);
+
+       g_object_unref(data->invocation);
+       g_object_unref(data->llcp);
+
+       g_free(data);
 }
 
 static void llcp_handle_connect_sap_thread_func(gpointer user_data)
 {
-       LlcpConnectSapData *data;
-       LlcpData *error_data;
+       LlcpConnectSapData *data = (LlcpConnectSapData *)user_data;
+       llcp_client_data *client_data;
 
        net_nfc_llcp_socket_t socket = -1;
        net_nfc_error_e result = NET_NFC_OK;
 
-       data = (LlcpConnectSapData *)user_data;
-
-       if (data == NULL)
-       {
-               DEBUG_ERR_MSG("can not get LlcpConnectSapData");
-               return;
-       }
-
-       if (data->llcp == NULL)
-       {
-               DEBUG_ERR_MSG("can not get llcp");
-               if (data->invocation)
-               {
-                       g_dbus_method_invocation_return_dbus_error(
-                                       data->invocation,
-                                       "org.tizen.NetNfcService.ConnectSapError",
-                                       "can not get llcp");
-
-                       g_object_unref(data->invocation);
-               }
+       g_assert(data != NULL);
+       g_assert(data->llcp != NULL);
+       g_assert(data->invocation != NULL);
 
-               g_free(data);
+       client_data = g_try_new0(llcp_client_data, 1);
+       if (client_data == NULL) {
+               result = NET_NFC_ALLOC_FAIL;
 
-               return;
+               goto ERROR;
        }
 
-       error_data = g_new0(LlcpData, 1);
-       if(error_data == NULL)
-       {
-               DEBUG_ERR_MSG("Memory allocation failed");
-               g_dbus_method_invocation_return_dbus_error(data->invocation,
-                               "org.tizen.NetNfcService.AllocationError",
-                               "Can not allocate memory");
-               return;
-       }
-       error_data->llcp = g_object_ref(data->llcp);
-       error_data->invocation = g_object_ref(data->invocation);
+       client_data->connection = g_dbus_method_invocation_get_connection(
+                       data->invocation);
+       client_data->id = g_strdup(
+                       g_dbus_method_invocation_get_sender(data->invocation));
+       client_data->handle = (net_nfc_target_handle_h)data->handle;
 
        if (net_nfc_controller_llcp_create_socket(&socket,
                                data->type,
@@ -1098,31 +949,14 @@ static void llcp_handle_connect_sap_thread_func(gpointer user_data)
                                data->rw,
                                &result,
                                llcp_socket_error_cb,
-                               error_data) == false)
+                               client_data) == false)
        {
-               DEBUG_ERR_MSG("%s fiailed [%d]",
-                               "net_nfc_controller_llcp_create_socket" ,result);
-
-               if (data->invocation)
-               {
-                       g_dbus_method_invocation_return_dbus_error(
-                                       data->invocation,
-                                       "org.tizen.NetNfcService.ConnectSapError",
-                                       "can not create socket");
-
-                       g_object_unref(data->invocation);
-               }
-
-               g_object_unref(data->llcp);
-
-               g_free(data);
-
-               g_free(error_data);
+               DEBUG_ERR_MSG("net_nfc_controller_llcp_create_socket failed [%d]", result);
 
-               return;
+               goto ERROR;
        }
 
-       DEBUG_SERVER_MSG("OAL socket in Listen :%d", socket);
+       client_data->socket = socket;
 
        if (net_nfc_controller_llcp_connect(GUINT_TO_POINTER(data->handle),
                                socket,
@@ -1131,524 +965,214 @@ static void llcp_handle_connect_sap_thread_func(gpointer user_data)
                                llcp_connect_cb,
                                data) == false)
        {
-               DEBUG_ERR_MSG("%s failed, [%d]",
-                               "net_nfc_controller_llcp_connect",
-                               result);
+               DEBUG_ERR_MSG("net_nfc_controller_llcp_listen failed [%d]", result);
 
-               if (data->invocation)
-               {
-                       g_dbus_method_invocation_return_dbus_error(
-                                       data->invocation,
-                                       "org.tizen.NetNfcService.ConnectSapError",
-                                       "can not connect socket");
+               goto ERROR;
+       }
 
-                       g_object_unref(data->invocation);
-               }
+       g_object_unref(data->invocation);
+       g_object_unref(data->llcp);
 
-               g_object_unref(data->llcp);
+       g_free(data);
 
-               g_free(data);
+       return;
 
-               g_free(error_data);
+ERROR :
+       net_nfc_gdbus_llcp_complete_connect_sap(data->llcp, data->invocation,
+                       result,
+                       -1);
 
-               if (socket != -1)
-                       net_nfc_controller_llcp_socket_close(socket, &result);
+       if (socket != -1)
+               net_nfc_controller_llcp_socket_close(socket, &result);
 
-       }
+       g_free(client_data);
+
+       g_object_unref(data->invocation);
+       g_object_unref(data->llcp);
+
+       g_free(data);
 }
 
 static void llcp_handle_send_thread_func(gpointer user_data)
 {
-       LlcpSendData *data;
-       LlcpData *llcp_data;
-
-       net_nfc_error_e result = NET_NFC_OK;
+       LlcpSendData *data = (LlcpSendData *)user_data;
+       net_nfc_error_e result;
 
-       data = (LlcpSendData *)user_data;
+       g_assert(data != NULL);
+       g_assert(data->llcp != NULL);
+       g_assert(data->invocation != NULL);
 
-       if (data == NULL)
+       if (net_nfc_controller_llcp_send(GUINT_TO_POINTER(data->handle),
+                               data->client_socket,
+                               &data->data,
+                               &result,
+                               llcp_send_cb,
+                               data) == false)
        {
-               DEBUG_ERR_MSG("can not get LlcpSendData");
-               return;
-       }
+               DEBUG_ERR_MSG("net_nfc_controller_llcp_send failed [%d]", result);
 
-       if (data->llcp == NULL)
-       {
-               DEBUG_ERR_MSG("can not get llcp");
-               if (data->invocation)
-               {
-                       g_dbus_method_invocation_return_dbus_error(
-                                       data->invocation,
-                                       "org.tizen.NetNfcService.SendError",
-                                       "can not get llcp");
+               net_nfc_gdbus_llcp_complete_send(data->llcp,
+                               data->invocation,
+                               result,
+                               data->client_socket);
 
-                       g_object_unref(data->invocation);
-               }
+               net_nfc_util_free_data(&data->data);
 
-               if (data->data)
-               {
-                       g_free(data->data->buffer);
-                       g_free(data->data);
-               }
+               g_object_unref(data->invocation);
+               g_object_unref(data->llcp);
 
                g_free(data);
-
-               return;
        }
+}
 
-       llcp_data = g_new0(LlcpData, 1);
-       if(llcp_data == NULL)
-       {
-               DEBUG_ERR_MSG("Memory allocation failed");
-               g_dbus_method_invocation_return_dbus_error(data->invocation,
-                               "org.tizen.NetNfcService.AllocationError",
-                               "Can not allocate memory");
-               return;
-       }
-       llcp_data->llcp = g_object_ref(data->llcp);
-       llcp_data->invocation = g_object_ref(data->invocation);
+static void llcp_handle_send_to_thread_func(gpointer user_data)
+{
+       LlcpSendToData *data = (LlcpSendToData *)user_data;
+       net_nfc_error_e result;
 
-       if (net_nfc_controller_llcp_send(GUINT_TO_POINTER(data->handle),
-                               data->oal_socket,
-                               data->data,
+       g_assert(data != NULL);
+       g_assert(data->llcp != NULL);
+       g_assert(data->invocation != NULL);
+
+       if (net_nfc_controller_llcp_send_to(GUINT_TO_POINTER(data->handle),
+                               data->client_socket,
+                               &data->data,
+                               data->sap,
                                &result,
-                               llcp_send_cb,
-                               llcp_data) == false)
+                               llcp_send_to_cb,
+                               data) == false)
        {
-               DEBUG_ERR_MSG("%s failed, [%d]",
-                               "net_nfc_controller_llcp_send",
-                               result);
+               DEBUG_ERR_MSG("net_nfc_controller_llcp_send_to failed [%d]", result);
 
-               if (data->invocation)
-               {
-                       g_dbus_method_invocation_return_dbus_error(
-                                       data->invocation,
-                                       "org.tizen.NetNfcService.SendError",
-                                       "can not send socket");
+               net_nfc_gdbus_llcp_complete_send_to(data->llcp,
+                               data->invocation,
+                               result,
+                               data->client_socket);
 
-                       g_object_unref(data->invocation);
-               }
+               net_nfc_util_free_data(&data->data);
 
+               g_object_unref(data->invocation);
                g_object_unref(data->llcp);
 
-               if (data->data)
-               {
-                       g_free(data->data->buffer);
-                       g_free(data->data);
-               }
-
                g_free(data);
-
-               g_free(llcp_data);
-
-               return;
-       }
-
-       g_object_unref(data->llcp);
-       g_object_unref(data->invocation);
-
-       if (data->data)
-       {
-               g_free(data->data->buffer);
-               g_free(data->data);
        }
-
-       g_free(data);
-
-       g_free(llcp_data);
 }
 
-static void llcp_handle_send_to_thread_func(gpointer user_data)
+static void llcp_handle_receive_thread_func(gpointer user_data)
 {
-       LlcpSendToData *data;
-       LlcpData *llcp_data;
-
-       net_nfc_error_e result = NET_NFC_OK;
-
-       data = (LlcpSendToData *)user_data;
+       LlcpReceiveData *data = (LlcpReceiveData *)user_data;
+       net_nfc_error_e result;
 
-       if (data == NULL)
-       {
-               DEBUG_ERR_MSG("can not get LlcpSendToData");
-               return;
-       }
+       g_assert(data != NULL);
+       g_assert(data->llcp != NULL);
+       g_assert(data->invocation != NULL);
 
-       if (data->llcp == NULL)
+       if (net_nfc_controller_llcp_recv(GUINT_TO_POINTER(data->handle),
+                               data->client_socket,
+                               data->req_length,
+                               &result,
+                               llcp_receive_cb,
+                               data) == false)
        {
-               DEBUG_ERR_MSG("can not get llcp");
-               if (data->invocation)
-               {
-                       g_dbus_method_invocation_return_dbus_error(
-                                       data->invocation,
-                                       "org.tizen.NetNfcService.SendToError",
-                                       "can not get llcp");
+               DEBUG_ERR_MSG("net_nfc_controller_llcp_recv failed [%d]", result);
 
-                       g_object_unref(data->invocation);
-               }
+               net_nfc_gdbus_llcp_complete_receive(data->llcp,
+                               data->invocation,
+                               result,
+                               net_nfc_util_gdbus_buffer_to_variant(NULL, 0));
 
-               if (data->data)
-               {
-                       g_free(data->data->buffer);
-                       g_free(data->data);
-               }
+               g_object_unref(data->invocation);
+               g_object_unref(data->llcp);
 
                g_free(data);
-
-               return;
        }
+}
 
-       llcp_data = g_new0(LlcpData, 1);
-       if(llcp_data == NULL)
-       {
-               DEBUG_ERR_MSG("Memory allocation failed");
-               g_dbus_method_invocation_return_dbus_error(data->invocation,
-                               "org.tizen.NetNfcService.AllocationError",
-                               "Can not allocate memory");
-               return;
-       }
-       llcp_data->llcp = g_object_ref(data->llcp);
-       llcp_data->invocation = g_object_ref(data->invocation);
+static void llcp_handle_receive_from_thread_func(gpointer user_data)
+{
+       LlcpReceiveData *data = (LlcpReceiveData *)user_data;
+       net_nfc_error_e result;
 
-       if (net_nfc_controller_llcp_send_to(GUINT_TO_POINTER(data->handle),
-                               data->oal_socket,
-                               data->data,
-                               data->sap,
+       g_assert(data != NULL);
+       g_assert(data->llcp != NULL);
+       g_assert(data->invocation != NULL);
+
+       if (net_nfc_controller_llcp_recv_from(GUINT_TO_POINTER(data->handle),
+                               data->client_socket,
+                               data->req_length,
                                &result,
-                               llcp_send_cb,
-                               llcp_data) == false)
+                               llcp_receive_from_cb,
+                               data) == false)
        {
-               DEBUG_ERR_MSG("%s failed, [%d]",
-                               "net_nfc_controller_llcp_send_to",
-                               result);
-
-               if (data->invocation)
-               {
-                       g_dbus_method_invocation_return_dbus_error(
-                                       data->invocation,
-                                       "org.tizen.NetNfcService.SendToError",
-                                       "can not send socket");
+               DEBUG_ERR_MSG("net_nfc_controller_llcp_recv_from failed [%d]", result);
 
-                       g_object_unref(data->invocation);
-               }
+               net_nfc_gdbus_llcp_complete_receive_from(data->llcp,
+                               data->invocation,
+                               result,
+                               -1,
+                               net_nfc_util_gdbus_buffer_to_variant(NULL, 0));
 
+               g_object_unref(data->invocation);
                g_object_unref(data->llcp);
 
-               if (data->data)
-               {
-                       g_free(data->data->buffer);
-                       g_free(data->data);
-               }
-
                g_free(data);
-
-               g_free(llcp_data);
-
-               return;
        }
+}
 
-       g_object_unref(data->llcp);
-       g_object_unref(data->invocation);
+static void llcp_handle_close_thread_func(gpointer user_data)
+{
+       LlcpCloseData *data = (LlcpCloseData *)user_data;
+       net_nfc_error_e result;
 
-       if (data->data)
-       {
-               g_free(data->data->buffer);
-               g_free(data->data);
-       }
+       g_assert(data != NULL);
+       g_assert(data->llcp != NULL);
+       g_assert(data->invocation != NULL);
 
-       g_free(data);
+       net_nfc_controller_llcp_socket_close(data->client_socket, &result);
 
-       g_free(llcp_data);
+       net_nfc_gdbus_llcp_complete_close(data->llcp,
+                       data->invocation,
+                       result,
+                       data->client_socket);
 }
 
-static void llcp_handle_receive_thread_func(gpointer user_data)
+static void llcp_handle_disconnect_thread_func(gpointer user_data)
 {
-       LlcpReceiveData *data;
-       LlcpData *llcp_data;
-
-       net_nfc_error_e result = NET_NFC_OK;
+       LlcpDisconnectData *data = (LlcpDisconnectData *)user_data;
+       net_nfc_error_e result;
 
-       data = (LlcpReceiveData *)user_data;
+       g_assert(data != NULL);
+       g_assert(data->llcp != NULL);
+       g_assert(data->invocation != NULL);
 
-       if (data == NULL)
+       if (GUINT_TO_POINTER(data->handle) == 0)
        {
-               DEBUG_ERR_MSG("can not get LlcpReceiveData");
-               return;
+               int ret_val;
+
+               net_nfc_server_free_target_info();
+               ret_val = pm_unlock_state(LCD_NORMAL, PM_RESET_TIMER);
+               DEBUG_SERVER_MSG("net_nfc_controller_disconnect pm_unlock_state"
+                               "[%d]!!", ret_val);
        }
 
-       if (data->llcp == NULL)
+       if (net_nfc_controller_llcp_disconnect(GUINT_TO_POINTER(data->handle),
+                               data->client_socket,
+                               &result,
+                               llcp_disconnect_cb,
+                               data) == false)
        {
-               DEBUG_ERR_MSG("can not get llcp");
-               if (data->invocation)
-               {
-                       g_dbus_method_invocation_return_dbus_error(
-                                       data->invocation,
-                                       "org.tizen.NetNfcService.ReceiveError",
-                                       "can not get llcp");
+               DEBUG_ERR_MSG("net_nfc_controller_llcp_disconnect failed [%d]", result);
 
-                       g_object_unref(data->invocation);
-               }
-
-               g_free(data);
-
-               return;
-       }
-
-       llcp_data = g_new0(LlcpData, 1);
-       if(llcp_data == NULL)
-       {
-               DEBUG_ERR_MSG("Memory allocation failed");
-               g_dbus_method_invocation_return_dbus_error(data->invocation,
-                               "org.tizen.NetNfcService.AllocationError",
-                               "Can not allocate memory");
-               return;
-       }
-       llcp_data->llcp = g_object_ref(data->llcp);
-       llcp_data->invocation = g_object_ref(data->invocation);
-
-       if (net_nfc_controller_llcp_recv(GUINT_TO_POINTER(data->handle),
-                               data->oal_socket,
-                               data->req_length,
-                               &result,
-                               llcp_receive_cb,
-                               llcp_data) == false)
-       {
-               DEBUG_ERR_MSG("%s failed, [%d]",
-                               "net_nfc_controller_llcp_receive",
-                               result);
-
-               if (data->invocation)
-               {
-                       g_dbus_method_invocation_return_dbus_error(
-                                       data->invocation,
-                                       "org.tizen.NetNfcService.ReceiveError",
-                                       "can not receive");
-
-                       g_object_unref(data->invocation);
-               }
-
-               g_object_unref(data->llcp);
-               g_free(data);
-
-               g_free(llcp_data);
-
-               return;
-       }
-
-       g_object_unref(data->llcp);
-       g_object_unref(data->invocation);
-
-       g_free(data);
-
-       g_free(llcp_data);
-}
-
-static void llcp_handle_receive_from_thread_func(gpointer user_data)
-{
-       LlcpReceiveData *data;
-       LlcpData *llcp_data;
-
-       net_nfc_error_e result = NET_NFC_OK;
-
-       data = (LlcpReceiveData *)user_data;
-
-       if (data == NULL)
-       {
-               DEBUG_ERR_MSG("can not get LlcpReceiveData");
-               return;
-       }
-
-       if (data->llcp == NULL)
-       {
-               DEBUG_ERR_MSG("can not get llcp");
-               if (data->invocation)
-               {
-                       g_dbus_method_invocation_return_dbus_error(
-                                       data->invocation,
-                                       "org.tizen.NetNfcService.ReceiveFromError",
-                                       "can not get llcp");
-
-                       g_object_unref(data->invocation);
-               }
-
-               g_free(data);
-
-               return;
-       }
-
-       llcp_data = g_new0(LlcpData, 1);
-       if(llcp_data == NULL)
-       {
-               DEBUG_ERR_MSG("Memory allocation failed");
-               g_dbus_method_invocation_return_dbus_error(data->invocation,
-                               "org.tizen.NetNfcService.AllocationError",
-                               "Can not allocate memory");
-               return;
-       }
-       llcp_data->llcp = g_object_ref(data->llcp);
-       llcp_data->invocation = g_object_ref(data->invocation);
-
-       if (net_nfc_controller_llcp_recv_from(GUINT_TO_POINTER(data->handle),
-                               data->oal_socket,
-                               data->req_length,
-                               &result,
-                               llcp_receive_from_cb,
-                               llcp_data) == false)
-       {
-               DEBUG_ERR_MSG("%s failed, [%d]",
-                               "net_nfc_controller_llcp_receive",
-                               result);
-
-               if (data->invocation)
-               {
-                       g_dbus_method_invocation_return_dbus_error(
-                                       data->invocation,
-                                       "org.tizen.NetNfcService.ReceiveFromError",
-                                       "can not receive");
-
-                       g_object_unref(data->invocation);
-               }
+               net_nfc_gdbus_llcp_complete_disconnect(data->llcp,
+                               data->invocation,
+                               result,
+                               data->client_socket);
 
+               g_object_unref(data->invocation);
                g_object_unref(data->llcp);
-               g_free(data);
-
-               g_free(llcp_data);
-
-               return;
-       }
-
-       g_object_unref(data->llcp);
-       g_object_unref(data->invocation);
-
-       g_free(data);
-
-       g_free(llcp_data);
-}
-
-static void llcp_handle_close_thread_func(gpointer user_data)
-{
-       LlcpCloseData *data;
-
-       net_nfc_error_e result = NET_NFC_OK;
-
-       data = (LlcpCloseData *)user_data;
-
-       if (data == NULL)
-       {
-               DEBUG_ERR_MSG("can not get LlcpCloseData");
-               return;
-       }
-
-       if (data->llcp == NULL)
-       {
-               DEBUG_ERR_MSG("can not get llcp");
-               if (data->invocation)
-               {
-                       g_dbus_method_invocation_return_dbus_error(
-                                       data->invocation,
-                                       "org.tizen.NetNfcService.CloseError",
-                                       "can not get llcp");
-
-                       g_object_unref(data->invocation);
-               }
-
-               g_free(data);
-
-               return;
-       }
-
-       net_nfc_controller_llcp_socket_close(data->oal_socket,
-                       &result);
-
-       net_nfc_gdbus_llcp_complete_close(data->llcp,
-                       data->invocation,
-                       data->client_socket);
-}
-
-static void llcp_handle_disconnect_thread_func(gpointer user_data)
-{
-       LlcpDisconnectData *data;
-       LlcpData *llcp_data;
-       int ret_val = 0;
-
-       net_nfc_error_e result = NET_NFC_OK;
-
-       data = (LlcpDisconnectData *)user_data;
-
-       if (data == NULL)
-       {
-               DEBUG_ERR_MSG("can not get LlcpDisconnectData");
-               return;
-       }
-
-       if (data->llcp == NULL)
-       {
-               DEBUG_ERR_MSG("can not get llcp");
-               if (data->invocation)
-               {
-                       g_dbus_method_invocation_return_dbus_error(
-                                       data->invocation,
-                                       "org.tizen.NetNfcService.DisconnectError",
-                                       "can not get llcp");
-
-                       g_object_unref(data->invocation);
-               }
-
-               g_free(data);
-
-               return;
-       }
-
-       if(GUINT_TO_POINTER(data->handle) == 0)
-       {
-               net_nfc_server_free_target_info();
-               ret_val = pm_unlock_state(LCD_NORMAL, PM_RESET_TIMER);
-               DEBUG_SERVER_MSG("net_nfc_controller_disconnect pm_unlock_state"
-                               "[%d]!!", ret_val);
-       }
-
-       llcp_data = g_new0(LlcpData, 1);
-       if(llcp_data == NULL)
-       {
-               DEBUG_ERR_MSG("Memory allocation failed");
-               return;
-       }
-       llcp_data->llcp = g_object_ref(data->llcp);
-       llcp_data->invocation = g_object_ref(data->invocation);
-
-       if (net_nfc_controller_llcp_disconnect(GUINT_TO_POINTER(data->handle),
-                               data->oal_socket,
-                               &result,
-                               llcp_disconnect_cb,
-                               llcp_data) == false)
-       {
-               DEBUG_ERR_MSG("%s failed, [%d]",
-                               "net_nfc_controller_llcp_receive",
-                               result);
-
-               if (data->invocation)
-               {
-                       g_dbus_method_invocation_return_dbus_error(
-                                       data->invocation,
-                                       "org.tizen.NetNfcService.DisconnectError",
-                                       "can not disconnect socket");
-
-                       g_object_unref(data->invocation);
-               }
 
-               g_object_unref(data->llcp);
                g_free(data);
-
-               g_free(llcp_data);
-
-               return;
        }
-
-       g_object_unref(data->llcp);
-       g_object_unref(data->invocation);
-
-       g_free(data);
-
-       g_free(llcp_data);
 }
 
 
@@ -1658,6 +1182,7 @@ static gboolean llcp_handle_config(NetNfcGDbusLlcp *llcp,
                GVariant *smack_privilege,
                gpointer user_data)
 {
+       gboolean result;
        LlcpConfigData *data;
 
        INFO_MSG(">>> REQUEST from [%s]",
@@ -1670,18 +1195,18 @@ static gboolean llcp_handle_config(NetNfcGDbusLlcp *llcp,
                                "w") == false) {
                DEBUG_ERR_MSG("permission denied, and finished request");
 
-               return TRUE;
+               return FALSE;
        }
 
-       data = g_new0(LlcpConfigData, 1);
-       if(data == NULL)
-       {
-               DEBUG_ERR_MSG("Memory allocation failed");
+       data = g_try_new0(LlcpConfigData, 1);
+       if (data == NULL) {
                g_dbus_method_invocation_return_dbus_error(invocation,
                                "org.tizen.NetNfcService.AllocationError",
                                "Can not allocate memory");
+
                return FALSE;
        }
+
        data->llcp = g_object_ref(llcp);
        data->invocation = g_object_ref(invocation);
 
@@ -1692,29 +1217,28 @@ static gboolean llcp_handle_config(NetNfcGDbusLlcp *llcp,
                        &data->lto,
                        &data->option);
 
-       if (net_nfc_server_controller_async_queue_push(
-                               llcp_handle_config_thread_func,
-                               data) == FALSE)
+       result = net_nfc_server_controller_async_queue_push(
+                       llcp_handle_config_thread_func,
+                       data);
+       if (result == FALSE)
        {
                g_dbus_method_invocation_return_dbus_error(invocation,
-                               "org.tizen.NetNfcService.ThreadError",
+                               "org.tizen.NetNfcService.Llcp.ThreadError",
                                "can not push to controller thread");
-               g_object_unref(data->llcp);
+
                g_object_unref(data->invocation);
+               g_object_unref(data->llcp);
 
                g_free(data);
-
-               return FALSE;
        }
 
-       return TRUE;
+       return result;
 }
 
 static gboolean llcp_handle_listen(NetNfcGDbusLlcp *llcp,
                GDBusMethodInvocation *invocation,
                guint32 arg_handle,
                guint32 arg_client_socket,
-               guint32 arg_oal_socket,
                guint16 arg_miu,
                guint8 arg_rw,
                gint32 arg_type,
@@ -1723,6 +1247,7 @@ static gboolean llcp_handle_listen(NetNfcGDbusLlcp *llcp,
                GVariant *smack_privilege,
                gpointer user_data)
 {
+       gboolean result;
        LlcpListenData *data;
 
        INFO_MSG(">>> REQUEST from [%s]",
@@ -1735,62 +1260,57 @@ static gboolean llcp_handle_listen(NetNfcGDbusLlcp *llcp,
                                "rw") == false) {
                DEBUG_ERR_MSG("permission denied, and finished request");
 
-               return TRUE;
+               return FALSE;
        }
 
-       data = g_new0(LlcpListenData, 1);
-       if(data == NULL)
-       {
-               DEBUG_ERR_MSG("Memory allocation failed");
+       data = g_try_new0(LlcpListenData, 1);
+       if (data == NULL) {
                g_dbus_method_invocation_return_dbus_error(invocation,
                                "org.tizen.NetNfcService.AllocationError",
                                "Can not allocate memory");
+
                return FALSE;
        }
+
        data->llcp = g_object_ref(llcp);
        data->invocation = g_object_ref(invocation);
        data->handle = arg_handle;
        data->client_socket = arg_client_socket;
-       data->oal_socket = arg_oal_socket;
        data->miu = arg_miu;
        data->rw = arg_rw;
        data->type = arg_type;
        data->sap = arg_sap;
        data->service_name = g_strdup(arg_service_name);
 
-       if (net_nfc_server_controller_async_queue_push(
-                               llcp_handle_listen_thread_func,
-                               data) == FALSE)
+       result = net_nfc_server_controller_async_queue_push(
+                       llcp_handle_listen_thread_func,
+                       data);
+       if (result == FALSE)
        {
                g_dbus_method_invocation_return_dbus_error(invocation,
-                               "org.tizen.NetNfcService.ThreadError",
+                               "org.tizen.NetNfcService.Llcp.ThreadError",
                                "can not push to controller thread");
 
-               g_object_unref(data->llcp);
+               g_free(data->service_name);
+
                g_object_unref(data->invocation);
+               g_object_unref(data->llcp);
 
-               g_free(data->service_name);
                g_free(data);
-
-               return FALSE;
        }
 
-       return TRUE;
+       return result;
 }
 
-static gboolean llcp_handle_connect(NetNfcGDbusLlcp *llcp,
+static gboolean llcp_handle_accept(NetNfcGDbusLlcp *llcp,
                GDBusMethodInvocation *invocation,
                guint32 arg_handle,
                guint32 arg_client_socket,
-               guint32 arg_oal_socket,
-               guint16 arg_miu,
-               guint8 arg_rw,
-               gint32 arg_type,
-               const gchar *arg_service_name,
                GVariant *smack_privilege,
                gpointer user_data)
 {
-       LlcpConnectData *data;
+       gboolean result;
+       LlcpAcceptData *data;
 
        INFO_MSG(">>> REQUEST from [%s]",
                        g_dbus_method_invocation_get_sender(invocation));
@@ -1802,61 +1322,50 @@ static gboolean llcp_handle_connect(NetNfcGDbusLlcp *llcp,
                                "rw") == false) {
                DEBUG_ERR_MSG("permission denied, and finished request");
 
-               return TRUE;
+               return FALSE;
        }
 
-       data = g_new0(LlcpConnectData, 1);
-       if(data == NULL)
-       {
-               DEBUG_ERR_MSG("Memory allocation failed");
+       data = g_try_new0(LlcpAcceptData, 1);
+       if (data == NULL) {
                g_dbus_method_invocation_return_dbus_error(invocation,
-                               "org.tizen.NetNfcService.AllocationError",
-                               "Can not allocate memory");
+                               "org.tizen.NetNfcService.Llcp.MemoryError",
+                               "Out of memory");
+
                return FALSE;
        }
+
        data->llcp = g_object_ref(llcp);
        data->invocation = g_object_ref(invocation);
        data->handle = arg_handle;
        data->client_socket = arg_client_socket;
-       data->oal_socket = arg_oal_socket;
-       data->miu = arg_miu;
-       data->rw = arg_rw;
-       data->type = arg_type;
-       data->service_name = g_strdup(arg_service_name);
 
-       if (net_nfc_server_controller_async_queue_push(
-                               llcp_handle_connect_thread_func,
-                               data) == FALSE)
+       result = net_nfc_server_controller_async_queue_push(
+                       llcp_handle_accept_thread_func,
+                       data);
+       if (result == FALSE)
        {
                g_dbus_method_invocation_return_dbus_error(invocation,
-                               "org.tizen.NetNfcService.ThreadError",
+                               "org.tizen.NetNfcService.Llcp.ThreadError",
                                "can not push to controller thread");
 
-               g_object_unref(data->llcp);
                g_object_unref(data->invocation);
+               g_object_unref(data->llcp);
 
-               g_free(data->service_name);
                g_free(data);
-
-               return FALSE;
        }
 
-       return TRUE;
+       return result;
 }
 
-static gboolean llcp_handle_connect_sap(NetNfcGDbusLlcp *llcp,
+static gboolean llcp_handle_reject(NetNfcGDbusLlcp *llcp,
                GDBusMethodInvocation *invocation,
                guint32 arg_handle,
                guint32 arg_client_socket,
-               guint32 arg_oal_socket,
-               guint16 arg_miu,
-               guint8 arg_rw,
-               gint32 arg_type,
-               guint8 arg_sap,
                GVariant *smack_privilege,
                gpointer user_data)
 {
-       LlcpConnectSapData *data;
+       gboolean result;
+       LlcpAcceptData *data;
 
        INFO_MSG(">>> REQUEST from [%s]",
                        g_dbus_method_invocation_get_sender(invocation));
@@ -1868,57 +1377,54 @@ static gboolean llcp_handle_connect_sap(NetNfcGDbusLlcp *llcp,
                                "rw") == false) {
                DEBUG_ERR_MSG("permission denied, and finished request");
 
-               return TRUE;
+               return FALSE;
        }
 
-       data = g_new0(LlcpConnectSapData, 1);
-       if(data == NULL)
-       {
-               DEBUG_ERR_MSG("Memory allocation failed");
+       data = g_try_new0(LlcpAcceptData, 1);
+       if (data == NULL) {
                g_dbus_method_invocation_return_dbus_error(invocation,
-                               "org.tizen.NetNfcService.AllocationError",
-                               "Can not allocate memory");
+                               "org.tizen.NetNfcService.Llcp.MemoryError",
+                               "Out of memory");
+
                return FALSE;
        }
+
        data->llcp = g_object_ref(llcp);
        data->invocation = g_object_ref(invocation);
        data->handle = arg_handle;
        data->client_socket = arg_client_socket;
-       data->oal_socket = arg_oal_socket;
-       data->miu = arg_miu;
-       data->rw = arg_rw;
-       data->type = arg_type;
-       data->sap = arg_sap;
 
-       if(net_nfc_server_controller_async_queue_push(
-                               llcp_handle_connect_sap_thread_func,
-                               data) == FALSE)
+       result = net_nfc_server_controller_async_queue_push(
+                       llcp_handle_reject_thread_func,
+                       data);
+       if (result == FALSE)
        {
                g_dbus_method_invocation_return_dbus_error(invocation,
-                               "org.tizen.NetNfcService.ThreadError",
+                               "org.tizen.NetNfcService.Llcp.ThreadError",
                                "can not push to controller thread");
 
-               g_object_unref(data->llcp);
                g_object_unref(data->invocation);
+               g_object_unref(data->llcp);
 
                g_free(data);
-
-               return FALSE;
        }
 
-       return TRUE;
+       return result;
 }
 
-static gboolean llcp_handle_send(NetNfcGDbusLlcp *llcp,
+static gboolean llcp_handle_connect(NetNfcGDbusLlcp *llcp,
                GDBusMethodInvocation *invocation,
                guint32 arg_handle,
                guint32 arg_client_socket,
-               guint32 arg_oal_socket,
-               GVariant *arg_data,
+               guint16 arg_miu,
+               guint8 arg_rw,
+               gint32 arg_type,
+               const gchar *arg_service_name,
                GVariant *smack_privilege,
                gpointer user_data)
 {
-       LlcpSendData *data;
+       gboolean result;
+       LlcpConnectData *data;
 
        INFO_MSG(">>> REQUEST from [%s]",
                        g_dbus_method_invocation_get_sender(invocation));
@@ -1927,65 +1433,63 @@ static gboolean llcp_handle_send(NetNfcGDbusLlcp *llcp,
        if (net_nfc_server_gdbus_check_privilege(invocation,
                                smack_privilege,
                                "nfc-manager::p2p",
-                               "w") == false) {
+                               "rw") == false) {
                DEBUG_ERR_MSG("permission denied, and finished request");
 
-               return TRUE;
+               return FALSE;
        }
 
-       data = g_new0(LlcpSendData, 1);
-       if(data == NULL)
-       {
-               DEBUG_ERR_MSG("Memory allocation failed");
+       data = g_try_new0(LlcpConnectData, 1);
+       if (data == NULL) {
                g_dbus_method_invocation_return_dbus_error(invocation,
                                "org.tizen.NetNfcService.AllocationError",
                                "Can not allocate memory");
+
                return FALSE;
        }
+
        data->llcp = g_object_ref(llcp);
        data->invocation = g_object_ref(invocation);
        data->handle = arg_handle;
        data->client_socket = arg_client_socket;
-       data->oal_socket = arg_oal_socket;
-
-       data->data = net_nfc_util_gdbus_variant_to_data(arg_data);
+       data->miu = arg_miu;
+       data->rw = arg_rw;
+       data->type = arg_type;
+       data->service_name = g_strdup(arg_service_name);
 
-       if (net_nfc_server_controller_async_queue_push(
-                               llcp_handle_send_thread_func,
-                               data) == FALSE)
+       result = net_nfc_server_controller_async_queue_push(
+                       llcp_handle_connect_thread_func,
+                       data);
+       if (result == FALSE)
        {
                g_dbus_method_invocation_return_dbus_error(invocation,
-                               "org.tizen.NetNfcService.ThreadError",
+                               "org.tizen.NetNfcService.Llcp.ThreadError",
                                "can not push to controller thread");
 
-               g_object_unref(data->llcp);
-               g_object_unref(data->invocation);
+               g_free(data->service_name);
 
-               if (data->data != NULL)
-               {
-                       g_free(data->data->buffer);
-                       g_free(data->data);
-               }
+               g_object_unref(data->invocation);
+               g_object_unref(data->llcp);
 
                g_free(data);
-
-               return FALSE;
        }
 
-       return TRUE;
+       return result;
 }
 
-static gboolean llcp_handle_send_to(NetNfcGDbusLlcp *llcp,
+static gboolean llcp_handle_connect_sap(NetNfcGDbusLlcp *llcp,
                GDBusMethodInvocation *invocation,
                guint32 arg_handle,
                guint32 arg_client_socket,
-               guint32 arg_oal_socket,
+               guint16 arg_miu,
+               guint8 arg_rw,
+               gint32 arg_type,
                guint8 arg_sap,
-               GVariant *arg_data,
                GVariant *smack_privilege,
                gpointer user_data)
 {
-       LlcpSendToData *data;
+       gboolean result;
+       LlcpConnectSapData *data;
 
        INFO_MSG(">>> REQUEST from [%s]",
                        g_dbus_method_invocation_get_sender(invocation));
@@ -1997,62 +1501,55 @@ static gboolean llcp_handle_send_to(NetNfcGDbusLlcp *llcp,
                                "rw") == false) {
                DEBUG_ERR_MSG("permission denied, and finished request");
 
-               return TRUE;
+               return FALSE;
        }
 
-       data = g_new0(LlcpSendToData, 1);
-       if(data == NULL)
-       {
-               DEBUG_ERR_MSG("Memory allocation failed");
+       data = g_try_new0(LlcpConnectSapData, 1);
+       if (data == NULL) {
                g_dbus_method_invocation_return_dbus_error(invocation,
                                "org.tizen.NetNfcService.AllocationError",
                                "Can not allocate memory");
+
                return FALSE;
        }
+
        data->llcp = g_object_ref(llcp);
        data->invocation = g_object_ref(invocation);
        data->handle = arg_handle;
        data->client_socket = arg_client_socket;
-       data->oal_socket = arg_oal_socket;
+       data->miu = arg_miu;
+       data->rw = arg_rw;
+       data->type = arg_type;
        data->sap = arg_sap;
 
-       data->data = net_nfc_util_gdbus_variant_to_data(arg_data);
-
-       if(net_nfc_server_controller_async_queue_push(
-                               llcp_handle_send_to_thread_func,
-                               data) == FALSE)
+       result = net_nfc_server_controller_async_queue_push(
+                       llcp_handle_connect_sap_thread_func,
+                       data);
+       if (result == FALSE)
        {
                g_dbus_method_invocation_return_dbus_error(invocation,
-                               "org.tizen.NetNfcService.ThreadError",
+                               "org.tizen.NetNfcService.Llcp.ThreadError",
                                "can not push to controller thread");
 
-               g_object_unref(data->llcp);
                g_object_unref(data->invocation);
-
-               if (data->data != NULL)
-               {
-                       g_free(data->data->buffer);
-                       g_free(data->data);
-               }
+               g_object_unref(data->llcp);
 
                g_free(data);
-
-               return FALSE;
        }
 
-       return TRUE;
+       return result;
 }
 
-static gboolean llcp_handle_receive(NetNfcGDbusLlcp *llcp,
+static gboolean llcp_handle_send(NetNfcGDbusLlcp *llcp,
                GDBusMethodInvocation *invocation,
                guint32 arg_handle,
                guint32 arg_client_socket,
-               guint32 arg_oal_socket,
-               guint32 arg_req_length,
+               GVariant *arg_data,
                GVariant *smack_privilege,
                gpointer user_data)
 {
-       LlcpReceiveData *data;
+       gboolean result;
+       LlcpSendData *data;
 
        INFO_MSG(">>> REQUEST from [%s]",
                        g_dbus_method_invocation_get_sender(invocation));
@@ -2064,54 +1561,56 @@ static gboolean llcp_handle_receive(NetNfcGDbusLlcp *llcp,
                                "w") == false) {
                DEBUG_ERR_MSG("permission denied, and finished request");
 
-               return TRUE;
+               return FALSE;
        }
 
-       data = g_new0(LlcpReceiveData, 1);
-       if(data == NULL)
-       {
-               DEBUG_ERR_MSG("Memory allocation failed");
+       data = g_try_new0(LlcpSendData, 1);
+       if (data == NULL) {
                g_dbus_method_invocation_return_dbus_error(invocation,
                                "org.tizen.NetNfcService.AllocationError",
                                "Can not allocate memory");
+
                return FALSE;
        }
+
        data->llcp = g_object_ref(llcp);
        data->invocation = g_object_ref(invocation);
        data->handle = arg_handle;
        data->client_socket = arg_client_socket;
-       data->oal_socket = arg_oal_socket;
-       data->req_length = arg_req_length;
 
-       if(net_nfc_server_controller_async_queue_push(
-                               llcp_handle_receive_thread_func,
-                               data) == FALSE)
+       net_nfc_util_gdbus_variant_to_data_s(arg_data, &data->data);
+
+       result = net_nfc_server_controller_async_queue_push(
+                       llcp_handle_send_thread_func,
+                       data);
+       if (result == FALSE)
        {
                g_dbus_method_invocation_return_dbus_error(invocation,
-                               "org.tizen.NetNfcService.ThreadError",
+                               "org.tizen.NetNfcService.Llcp.ThreadError",
                                "can not push to controller thread");
 
-               g_object_unref(data->llcp);
+               net_nfc_util_free_data(&data->data);
+
                g_object_unref(data->invocation);
+               g_object_unref(data->llcp);
 
                g_free(data);
-
-               return FALSE;
        }
 
-       return TRUE;
+       return result;
 }
 
-static gboolean llcp_handle_receive_from(NetNfcGDbusLlcp *llcp,
+static gboolean llcp_handle_send_to(NetNfcGDbusLlcp *llcp,
                GDBusMethodInvocation *invocation,
                guint32 arg_handle,
                guint32 arg_client_socket,
-               guint32 arg_oal_socket,
-               guint32 arg_req_length,
+               guint8 arg_sap,
+               GVariant *arg_data,
                GVariant *smack_privilege,
                gpointer user_data)
 {
-       LlcpReceiveData *data;
+       gboolean result;
+       LlcpSendToData *data;
 
        INFO_MSG(">>> REQUEST from [%s]",
                        g_dbus_method_invocation_get_sender(invocation));
@@ -2120,56 +1619,59 @@ static gboolean llcp_handle_receive_from(NetNfcGDbusLlcp *llcp,
        if (net_nfc_server_gdbus_check_privilege(invocation,
                                smack_privilege,
                                "nfc-manager::p2p",
-                               "w") == false) {
+                               "rw") == false) {
                DEBUG_ERR_MSG("permission denied, and finished request");
 
-               return TRUE;
+               return FALSE;
        }
 
-       data = g_new0(LlcpReceiveData, 1);
-       if(data == NULL)
-       {
-               DEBUG_ERR_MSG("Memory allocation failed");
+       data = g_try_new0(LlcpSendToData, 1);
+       if (data == NULL) {
                g_dbus_method_invocation_return_dbus_error(invocation,
                                "org.tizen.NetNfcService.AllocationError",
                                "Can not allocate memory");
+
                return FALSE;
        }
+
        data->llcp = g_object_ref(llcp);
        data->invocation = g_object_ref(invocation);
        data->handle = arg_handle;
        data->client_socket = arg_client_socket;
-       data->oal_socket = arg_oal_socket;
-       data->req_length = arg_req_length;
+       data->sap = arg_sap;
+
+       net_nfc_util_gdbus_variant_to_data_s(arg_data, &data->data);
 
-       if(net_nfc_server_controller_async_queue_push(
-                               llcp_handle_receive_from_thread_func,
-                               data) == FALSE)
+       result = net_nfc_server_controller_async_queue_push(
+                       llcp_handle_send_to_thread_func,
+                       data);
+       if (result == FALSE)
        {
                g_dbus_method_invocation_return_dbus_error(invocation,
-                               "org.tizen.NetNfcService.ThreadError",
+                               "org.tizen.NetNfcService.Llcp.ThreadError",
                                "can not push to controller thread");
 
-               g_object_unref(data->llcp);
+               net_nfc_util_free_data(&data->data);
+
                g_object_unref(data->invocation);
+               g_object_unref(data->llcp);
 
                g_free(data);
-
-               return FALSE;
        }
 
-       return TRUE;
+       return result;
 }
 
-static gboolean llcp_handle_close(NetNfcGDbusLlcp *llcp,
+static gboolean llcp_handle_receive(NetNfcGDbusLlcp *llcp,
                GDBusMethodInvocation *invocation,
                guint32 arg_handle,
                guint32 arg_client_socket,
-               guint32 arg_oal_socket,
+               guint32 arg_req_length,
                GVariant *smack_privilege,
                gpointer user_data)
 {
-       LlcpCloseData *data;
+       gboolean result;
+       LlcpReceiveData *data;
 
        INFO_MSG(">>> REQUEST from [%s]",
                        g_dbus_method_invocation_get_sender(invocation));
@@ -2181,52 +1683,52 @@ static gboolean llcp_handle_close(NetNfcGDbusLlcp *llcp,
                                "w") == false) {
                DEBUG_ERR_MSG("permission denied, and finished request");
 
-               return TRUE;
+               return FALSE;
        }
 
-       data = g_new0(LlcpCloseData, 1);
-       if(data == NULL)
-       {
-               DEBUG_ERR_MSG("Memory allocation failed");
+       data = g_try_new0(LlcpReceiveData, 1);
+       if (data == NULL) {
                g_dbus_method_invocation_return_dbus_error(invocation,
                                "org.tizen.NetNfcService.AllocationError",
                                "Can not allocate memory");
+
                return FALSE;
        }
+
        data->llcp = g_object_ref(llcp);
        data->invocation = g_object_ref(invocation);
        data->handle = arg_handle;
        data->client_socket = arg_client_socket;
-       data->oal_socket = arg_oal_socket;
+       data->req_length = arg_req_length;
 
-       if (net_nfc_server_controller_async_queue_push(
-                               llcp_handle_close_thread_func,
-                               data) == FALSE)
+       result = net_nfc_server_controller_async_queue_push(
+                       llcp_handle_receive_thread_func,
+                       data);
+       if (result == FALSE)
        {
                g_dbus_method_invocation_return_dbus_error(invocation,
-                               "org.tizen.NetNfcService.ThreadError",
+                               "org.tizen.NetNfcService.Llcp.ThreadError",
                                "can not push to controller thread");
 
-               g_object_unref(data->llcp);
                g_object_unref(data->invocation);
+               g_object_unref(data->llcp);
 
                g_free(data);
-
-               return FALSE;
        }
 
-       return TRUE;
+       return result;
 }
 
-static gboolean llcp_handle_disconnect(NetNfcGDbusLlcp *llcp,
+static gboolean llcp_handle_receive_from(NetNfcGDbusLlcp *llcp,
                GDBusMethodInvocation *invocation,
                guint32 arg_handle,
                guint32 arg_client_socket,
-               guint32 arg_oal_socket,
+               guint32 arg_req_length,
                GVariant *smack_privilege,
                gpointer user_data)
 {
-       LlcpDisconnectData *data;
+       gboolean result;
+       LlcpReceiveData *data;
 
        INFO_MSG(">>> REQUEST from [%s]",
                        g_dbus_method_invocation_get_sender(invocation));
@@ -2238,537 +1740,181 @@ static gboolean llcp_handle_disconnect(NetNfcGDbusLlcp *llcp,
                                "w") == false) {
                DEBUG_ERR_MSG("permission denied, and finished request");
 
-               return TRUE;
+               return FALSE;
        }
 
-       data = g_new0(LlcpDisconnectData, 1);
-       if(data == NULL)
-       {
-               DEBUG_ERR_MSG("Memory allocation failed");
+       data = g_try_new0(LlcpReceiveData, 1);
+       if (data == NULL) {
                g_dbus_method_invocation_return_dbus_error(invocation,
                                "org.tizen.NetNfcService.AllocationError",
                                "Can not allocate memory");
+
                return FALSE;
        }
+
        data->llcp = g_object_ref(llcp);
        data->invocation = g_object_ref(invocation);
        data->handle = arg_handle;
        data->client_socket = arg_client_socket;
-       data->oal_socket = arg_oal_socket;
+       data->req_length = arg_req_length;
 
-       if (net_nfc_server_controller_async_queue_push(
-                               llcp_handle_disconnect_thread_func,
-                               data) == FALSE)
+       result = net_nfc_server_controller_async_queue_push(
+                       llcp_handle_receive_from_thread_func,
+                       data);
+       if (result == FALSE)
        {
                g_dbus_method_invocation_return_dbus_error(invocation,
-                               "org.tizen.NetNfcService.ThreadError",
+                               "org.tizen.NetNfcService.Llcp.ThreadError",
                                "can not push to controller thread");
 
-               g_object_unref(data->llcp);
                g_object_unref(data->invocation);
-
-               g_free(data);
-
-               return FALSE;
-       }
-
-       return TRUE;
-}
-
-
-static void llcp_deactivated_thread_func(gpointer user_data)
-{
-       ServerLlcpData *data;
-
-       net_nfc_request_llcp_msg_t *req_llcp_msg;
-       net_nfc_target_handle_s *handle;
-
-       data = (ServerLlcpData *)user_data;
-
-       if (data == NULL)
-       {
-               DEBUG_ERR_MSG("can not get ServerLlcpData");
-
-               return;
-       }
-
-       if (data->llcp == NULL)
-       {
-               DEBUG_ERR_MSG("can not get llcp");
-
-               g_free(data->req_msg);
-               g_free(data);
-
-               return;
-       }
-
-       if (data->req_msg == NULL)
-       {
-               DEBUG_ERR_MSG("can not get request msg");
-
-               g_object_unref(data->llcp);
-               g_free(data);
-
-               return;
-       }
-
-       req_llcp_msg = (net_nfc_request_llcp_msg_t *)data->req_msg;
-
-       handle = (net_nfc_target_handle_s*)req_llcp_msg->user_param;
-       if (handle == NULL)
-       {
-               DEBUG_SERVER_MSG(
-                               "the target ID = [0x%p] was not connected before."
-                               "current device may be a TARGET", handle);
-       }
-       else
-       {
-               net_nfc_error_e result = NET_NFC_OK;
-
-               if (net_nfc_controller_disconnect(handle, &result) == false)
-               {
-                       if (result != NET_NFC_NOT_CONNECTED)
-                       {
-                               net_nfc_controller_exception_handler();
-                       }
-                       else
-                       {
-                               DEBUG_SERVER_MSG("target was not connected.");
-                       }
-               }
-
-               net_nfc_server_set_state(NET_NFC_SERVER_IDLE);
-       }
-
-       /* send p2p detatch */
-       net_nfc_server_p2p_detached();
-
-       g_object_unref(data->llcp);
-
-       g_free(data->req_msg);
-       g_free(data);
-}
-
-static void llcp_listen_thread_func(gpointer user_data)
-{
-       ServerLlcpData *data;
-
-       socket_info_t *info = NULL;
-       net_nfc_request_listen_socket_t *listen_socket;
-
-       data = (ServerLlcpData *)user_data;
-
-       if (data == NULL)
-       {
-               DEBUG_ERR_MSG("can not get ServerLlcpData");
-               return;
-       }
-
-       if (data->llcp == NULL)
-       {
-               DEBUG_ERR_MSG("can not get llcp");
-
-               g_free(data->req_msg);
-               g_free(data);
-
-               return;
-       }
-
-       if (data->req_msg == NULL)
-       {
-               DEBUG_ERR_MSG("can not get request msg");
-
-               g_object_unref(data->llcp);
-               g_free(data);
-
-               return;
-       }
-
-       listen_socket = (net_nfc_request_listen_socket_t *)data->req_msg;
-
-       info = (socket_info_t *)listen_socket->user_param;
-       info = _get_socket_info(info->socket);
-
-       if (info != NULL)
-       {
-               if (_add_socket_info(listen_socket->client_socket) != NULL)
-               {
-                       if (info->work_cb != NULL)
-                       {
-                               info->work_cb(listen_socket->client_socket,
-                                               listen_socket->result, NULL, NULL,info->work_param);
-                       }
-               }
-               else
-               {
-                       DEBUG_ERR_MSG("_net_nfc_util_alloc_mem failed");
-               }
-       }
-
-       g_object_unref(data->llcp);
-
-       g_free(data->req_msg);
-       g_free(data);
-}
-
-static void llcp_socket_error_thread_func(gpointer user_data)
-{
-       ServerLlcpData *data;
-
-       net_nfc_request_llcp_msg_t *req_llcp_msg;
-       net_nfc_llcp_param_t *param;
-
-       data = (ServerLlcpData *)user_data;
-
-       if (data == NULL)
-       {
-               DEBUG_ERR_MSG("can not get ServerLlcpData");
-               return;
-       }
-
-       if (data->llcp == NULL)
-       {
-               DEBUG_ERR_MSG("can not get llcp");
-
-               g_free(data->req_msg);
-               g_free(data);
-
-               return;
-       }
-
-       if (data->req_msg == NULL)
-       {
-               DEBUG_ERR_MSG("can not get request msg");
-
                g_object_unref(data->llcp);
-               g_free(data);
 
-               return;
-       }
-
-       req_llcp_msg = (net_nfc_request_llcp_msg_t *)data->req_msg;
-       param = (net_nfc_llcp_param_t *)req_llcp_msg->user_param;
-
-       if (param)
-       {
-               if (param->cb)
-               {
-                       param->cb(req_llcp_msg->llcp_socket,
-                                       req_llcp_msg->result,
-                                       NULL,
-                                       NULL,
-                                       param->user_param);
-               }
-
-               g_free(param);
-       }
-
-       g_object_unref(data->llcp);
-
-       g_free(data->req_msg);
-       g_free(data);
-}
-
-static void llcp_send_thread_func(gpointer user_data)
-{
-       ServerLlcpData *data;
-
-       net_nfc_request_llcp_msg_t *req_llcp_msg;
-       net_nfc_llcp_param_t *param;
-
-       data = (ServerLlcpData *)user_data;
-
-       if (data == NULL)
-       {
-               DEBUG_ERR_MSG("can not get ServerLlcpData");
-
-               return;
-       }
-
-       if (data->llcp == NULL)
-       {
-               DEBUG_ERR_MSG("can not get llcp");
-
-               g_free(data->req_msg);
                g_free(data);
-
-               return;
-       }
-
-       if (data->req_msg == NULL)
-       {
-               DEBUG_ERR_MSG("can not get request msg");
-
-               g_object_unref(data->llcp);
-               g_free(data);
-
-               return;
        }
 
-       req_llcp_msg = (net_nfc_request_llcp_msg_t *)data->req_msg;
-       param = (net_nfc_llcp_param_t *)req_llcp_msg->user_param;
-
-       if (param)
-       {
-               if (param->cb)
-               {
-                       param->cb(param->socket,
-                                       req_llcp_msg->result,
-                                       NULL,
-                                       NULL,
-                                       param->user_param);
-               }
-
-               g_free(param);
-       }
-
-       g_object_unref(data->llcp);
-
-       g_free(data->req_msg);
-       g_free(data);
+       return result;
 }
 
-static void llcp_receive_thread_func(gpointer user_data)
+static gboolean llcp_handle_close(NetNfcGDbusLlcp *llcp,
+               GDBusMethodInvocation *invocation,
+               guint32 arg_handle,
+               guint32 arg_client_socket,
+               GVariant *smack_privilege,
+               gpointer user_data)
 {
-       ServerLlcpData *data;
-
-       net_nfc_request_receive_socket_t *req_receive_socket;
-       net_nfc_llcp_param_t *param;
-
-       data = (ServerLlcpData *)user_data;
-
-       if (data == NULL)
-       {
-               DEBUG_ERR_MSG("can not get ServerLlcpData");
-
-               return;
-       }
-
-       if (data->llcp == NULL)
-       {
-               DEBUG_ERR_MSG("can not get llcp");
-
-               g_free(data->req_msg);
-               g_free(data);
-
-               return;
-       }
-
-       if (data->req_msg == NULL)
-       {
-               DEBUG_ERR_MSG("can not get request msg");
-
-               g_object_unref(data->llcp);
-               g_free(data);
-
-               return;
-       }
-
-       req_receive_socket = (net_nfc_request_receive_socket_t *)data->req_msg;
-       param = (net_nfc_llcp_param_t *)req_receive_socket->user_param;
+       gboolean result;
+       LlcpCloseData *data;
 
-       if (param)
-       {
-               if (param->cb)
-               {
-                       param->cb(param->socket,
-                                       req_receive_socket->result,
-                                       &param->data,
-                                       NULL,
-                                       param->user_param);
-               }
+       INFO_MSG(">>> REQUEST from [%s]",
+                       g_dbus_method_invocation_get_sender(invocation));
 
-               if (param->data.buffer)
-                       g_free(param->data.buffer);
+       /* check privilege and update client context */
+       if (net_nfc_server_gdbus_check_privilege(invocation,
+                               smack_privilege,
+                               "nfc-manager::p2p",
+                               "w") == false) {
+               DEBUG_ERR_MSG("permission denied, and finished request");
 
-               g_free(param);
+               return FALSE;
        }
 
-       g_object_unref(data->llcp);
-
-       g_free(data->req_msg);
-       g_free(data);
-}
-
-static void llcp_receive_from_thread_func(gpointer user_data)
-{
-       ServerLlcpData *data;
-
-       net_nfc_request_receive_from_socket_t *req_receive_from_socket;
-       net_nfc_llcp_param_t *param;
-
-       data = (ServerLlcpData *)user_data;
-
-       if (data == NULL)
-       {
-               DEBUG_ERR_MSG("can not get ServerLlcpData");
+       data = g_try_new0(LlcpCloseData, 1);
+       if (data == NULL) {
+               g_dbus_method_invocation_return_dbus_error(invocation,
+                               "org.tizen.NetNfcService.AllocationError",
+                               "Can not allocate memory");
 
-               return;
+               return FALSE;
        }
 
-       if (data->llcp == NULL)
-       {
-               DEBUG_ERR_MSG("can not get llcp");
-
-               g_free(data->req_msg);
-               g_free(data);
-
-               return;
-       }
+       data->llcp = g_object_ref(llcp);
+       data->invocation = g_object_ref(invocation);
+       data->handle = arg_handle;
+       data->client_socket = arg_client_socket;
 
-       if (data->req_msg == NULL)
+       result = net_nfc_server_controller_async_queue_push(
+                       llcp_handle_close_thread_func,
+                       data);
+       if (result == FALSE)
        {
-               DEBUG_ERR_MSG("can not get request msg");
+               g_dbus_method_invocation_return_dbus_error(invocation,
+                               "org.tizen.NetNfcService.Llcp.ThreadError",
+                               "can not push to controller thread");
 
                g_object_unref(data->llcp);
-               g_free(data);
-
-               return;
-       }
-
-       req_receive_from_socket = (net_nfc_request_receive_from_socket_t *)
-               data->req_msg;
-       param = (net_nfc_llcp_param_t *)req_receive_from_socket->user_param;
-
-       if (param)
-       {
-               if (param->cb)
-               {
-                       param->cb(param->socket,
-                                       req_receive_from_socket->result,
-                                       &param->data,
-                                       (void *)(int)req_receive_from_socket->sap,
-                                       param->user_param);
-               }
-
-               if (param->data.buffer)
-                       g_free(param->data.buffer);
-
-               g_free(param);
-       }
-
-       g_object_unref(data->llcp);
-
-       g_free(data->req_msg);
-       g_free(data);
-}
-
-static void llcp_connect_thread_func(gpointer user_data)
-{
-       ServerLlcpData *data;
-
-       net_nfc_request_llcp_msg_t *req_llcp_msg;
-       net_nfc_llcp_param_t *param;
-
-       data = (ServerLlcpData *)user_data;
-
-       if (data == NULL)
-       {
-               DEBUG_ERR_MSG("can not get ServerLlcpData");
-
-               return;
-       }
-
-       if (data->llcp == NULL)
-       {
-               DEBUG_ERR_MSG("can not get llcp");
-
-               g_free(data->req_msg);
-               g_free(data);
-
-               return;
-       }
-
-       if (data->req_msg == NULL)
-       {
-               DEBUG_ERR_MSG("can not get request msg");
+               g_object_unref(data->invocation);
 
-               g_object_unref(data->llcp);
                g_free(data);
-
-               return;
-       }
-
-       req_llcp_msg = (net_nfc_request_llcp_msg_t *)data->req_msg;
-       param = (net_nfc_llcp_param_t *)req_llcp_msg->user_param;
-
-       if (param)
-       {
-               if (param->cb)
-               {
-                       param->cb(param->socket,
-                                       req_llcp_msg->result,
-                                       NULL,
-                                       NULL,
-                                       param->user_param);
-               }
-
-               g_free(param);
        }
 
-       g_object_unref(data->llcp);
-
-       g_free(data->req_msg);
-       g_free(data);
+       return result;
 }
 
-static void llcp_disconnect_thread_func(gpointer user_data)
+static gboolean llcp_handle_disconnect(NetNfcGDbusLlcp *llcp,
+               GDBusMethodInvocation *invocation,
+               guint32 arg_handle,
+               guint32 arg_client_socket,
+               GVariant *smack_privilege,
+               gpointer user_data)
 {
-       ServerLlcpData *data;
-
-       net_nfc_request_llcp_msg_t *req_llcp_msg;
-       net_nfc_llcp_param_t *param;
+       gboolean result;
+       LlcpDisconnectData *data;
 
-       data = (ServerLlcpData *)user_data;
+       INFO_MSG(">>> REQUEST from [%s]",
+                       g_dbus_method_invocation_get_sender(invocation));
 
-       if (data == NULL)
-       {
-               DEBUG_ERR_MSG("can not get ServerLlcpData");
+       /* check privilege and update client context */
+       if (net_nfc_server_gdbus_check_privilege(invocation,
+                               smack_privilege,
+                               "nfc-manager::p2p",
+                               "w") == false) {
+               DEBUG_ERR_MSG("permission denied, and finished request");
 
-               return;
+               return FALSE;
        }
 
-       if (data->llcp == NULL)
-       {
-               DEBUG_ERR_MSG("can not get llcp");
-
-               g_free(data->req_msg);
-               g_free(data);
+       data = g_try_new0(LlcpDisconnectData, 1);
+       if (data == NULL) {
+               g_dbus_method_invocation_return_dbus_error(invocation,
+                               "org.tizen.NetNfcService.AllocationError",
+                               "Can not allocate memory");
 
-               return;
+               return FALSE;
        }
 
-       if (data->req_msg == NULL)
+       data->llcp = g_object_ref(llcp);
+       data->invocation = g_object_ref(invocation);
+       data->handle = arg_handle;
+       data->client_socket = arg_client_socket;
+
+       result = net_nfc_server_controller_async_queue_push(
+                       llcp_handle_disconnect_thread_func,
+                       data);
+       if (result == FALSE)
        {
-               DEBUG_ERR_MSG("can not get request msg");
+               g_dbus_method_invocation_return_dbus_error(invocation,
+                               "org.tizen.NetNfcService.Llcp.ThreadError",
+                               "can not push to controller thread");
 
+               g_object_unref(data->invocation);
                g_object_unref(data->llcp);
-               g_free(data);
 
-               return;
+               g_free(data);
        }
 
-       req_llcp_msg = (net_nfc_request_llcp_msg_t *)data->req_msg;
-       param = (net_nfc_llcp_param_t *)req_llcp_msg->user_param;
+       return result;
+}
+
+void net_nfc_server_llcp_deactivated(gpointer user_data)
+{
+       net_nfc_target_handle_s *handle = (net_nfc_target_handle_s *)user_data;
 
-       if (param)
+       if (handle != NULL)
        {
-               if (param->cb)
+               net_nfc_error_e result = NET_NFC_OK;
+
+               if (net_nfc_controller_disconnect(handle, &result) == false)
                {
-                       param->cb(param->socket,
-                                       req_llcp_msg->result,
-                                       NULL,
-                                       NULL,
-                                       param->user_param);
+                       if (result != NET_NFC_NOT_CONNECTED)
+                       {
+                               net_nfc_controller_exception_handler();
+                       }
+                       else
+                       {
+                               DEBUG_SERVER_MSG("target was not connected.");
+                       }
                }
 
-               g_free(param);
+               net_nfc_server_set_state(NET_NFC_SERVER_IDLE);
+       }
+       else
+       {
+               DEBUG_SERVER_MSG("the target was disconnected");
        }
 
-       g_object_unref(data->llcp);
-
-       g_free(data->req_msg);
-       g_free(data);
+       /* send p2p detatch */
+       net_nfc_server_p2p_detached();
 }
 
 static void llcp_simple_socket_error_cb(net_nfc_llcp_socket_t socket,
@@ -2777,9 +1923,9 @@ static void llcp_simple_socket_error_cb(net_nfc_llcp_socket_t socket,
                void *extra,
                void *user_param)
 {
-       LlcpSimpleData *simple_data;
+       LlcpSimpleData *simple_data = (LlcpSimpleData *)user_param;
 
-       simple_data = (LlcpSimpleData *)user_param;
+       g_assert(simple_data != NULL);
 
        if (simple_data->error_callback)
        {
@@ -2799,9 +1945,9 @@ static void llcp_simple_listen_cb(net_nfc_llcp_socket_t socket,
                void *extra,
                void *user_param)
 {
-       LlcpSimpleData *simple_data;
+       LlcpSimpleData *simple_data = (LlcpSimpleData *)user_param;
 
-       simple_data = (LlcpSimpleData *)user_param;
+       g_assert(simple_data != NULL);
 
        if (result != NET_NFC_OK) {
                DEBUG_ERR_MSG("listen socket failed, [%d]", result);
@@ -2825,9 +1971,9 @@ static void llcp_simple_connect_cb(net_nfc_llcp_socket_t socket,
                void *extra,
                void *user_param)
 {
-       LlcpSimpleData *simple_data;
+       LlcpSimpleData *simple_data = (LlcpSimpleData *)user_param;
 
-       simple_data = (LlcpSimpleData *)user_param;
+       g_assert(simple_data != NULL);
 
        if (result != NET_NFC_OK) {
                DEBUG_ERR_MSG("connect socket failed, [%d]", result);
@@ -2845,37 +1991,15 @@ static void llcp_simple_connect_cb(net_nfc_llcp_socket_t socket,
        /* 'simple_data' will be freed in socket error callback */
 }
 
-static void llcp_simple_server_error_cb(net_nfc_llcp_socket_t socket,
-               net_nfc_error_e result,
-               data_s *data,
-               void *extra,
-               void *user_param)
-{
-       LlcpSimpleData *simple_data;
-
-       simple_data = (LlcpSimpleData *)user_param;
-
-       if (simple_data->error_callback)
-       {
-               simple_data->error_callback(result,
-                               simple_data->handle,
-                               socket,
-                               data,
-                               simple_data->user_data);
-       }
-
-       g_free(simple_data);
-}
-
 static void llcp_simple_send_cb(net_nfc_llcp_socket_t socket,
                net_nfc_error_e result,
                data_s *data,
                void *extra,
                void *user_param)
 {
-       LlcpSimpleData *simple_data;
+       LlcpSimpleData *simple_data = (LlcpSimpleData *)user_param;
 
-       simple_data = (LlcpSimpleData *)user_param;
+       g_assert(simple_data != NULL);
 
        if (simple_data->callback)
        {
@@ -2895,9 +2019,9 @@ static void llcp_simple_receive_cb(net_nfc_llcp_socket_t socket,
                void *extra,
                void *user_param)
 {
-       LlcpSimpleData *simple_data;
+       LlcpSimpleData *simple_data = (LlcpSimpleData *)user_param;
 
-       simple_data = (LlcpSimpleData *)user_param;
+       g_assert(simple_data != NULL);
 
        if (simple_data->callback)
        {
@@ -2914,6 +2038,7 @@ static void llcp_simple_receive_cb(net_nfc_llcp_socket_t socket,
 /* Public Function */
 gboolean net_nfc_server_llcp_init(GDBusConnection *connection)
 {
+       gboolean result;
        GError *error = NULL;
 
        if (llcp_skeleton)
@@ -2932,6 +2057,16 @@ gboolean net_nfc_server_llcp_init(GDBusConnection *connection)
                        NULL);
 
        g_signal_connect(llcp_skeleton,
+                       "handle-accept",
+                       G_CALLBACK(llcp_handle_accept),
+                       NULL);
+
+       g_signal_connect(llcp_skeleton,
+                       "handle-reject",
+                       G_CALLBACK(llcp_handle_reject),
+                       NULL);
+
+       g_signal_connect(llcp_skeleton,
                        "handle-connect",
                        G_CALLBACK(llcp_handle_connect),
                        NULL);
@@ -2971,20 +2106,19 @@ gboolean net_nfc_server_llcp_init(GDBusConnection *connection)
                        G_CALLBACK(llcp_handle_disconnect),
                        NULL);
 
-       if(g_dbus_interface_skeleton_export(
-                               G_DBUS_INTERFACE_SKELETON(llcp_skeleton),
-                               connection,
-                               "/org/tizen/NetNfcService/Llcp",
-                               &error) == FALSE)
+       result = g_dbus_interface_skeleton_export(
+                       G_DBUS_INTERFACE_SKELETON(llcp_skeleton),
+                       connection,
+                       "/org/tizen/NetNfcService/Llcp",
+                       &error);
+       if (result == FALSE)
        {
                g_error_free(error);
-               g_object_unref(llcp_skeleton);
-               llcp_skeleton = NULL;
 
-               return FALSE;
+               net_nfc_server_llcp_deinit();
        }
 
-       return TRUE;
+       return result;
 }
 
 void net_nfc_server_llcp_deinit(void)
@@ -2996,47 +2130,8 @@ void net_nfc_server_llcp_deinit(void)
        }
 }
 
-void net_nfc_server_llcp_deactivated(net_nfc_request_msg_t *req_msg)
-{
-       llcp_add_async_queue(req_msg, llcp_deactivated_thread_func);
-}
-
-void net_nfc_server_llcp_listen(net_nfc_request_msg_t *req_msg)
-{
-       llcp_add_async_queue(req_msg, llcp_listen_thread_func);
-}
-
-void net_nfc_server_llcp_socket_error(net_nfc_request_msg_t *req_msg)
-{
-       llcp_add_async_queue(req_msg, llcp_socket_error_thread_func);
-}
-
-void net_nfc_server_llcp_send(net_nfc_request_msg_t *req_msg)
-{
-       llcp_add_async_queue(req_msg, llcp_send_thread_func);
-}
-
-void net_nfc_server_llcp_receive(net_nfc_request_msg_t *req_msg)
-{
-       llcp_add_async_queue(req_msg, llcp_receive_thread_func);
-}
-
-void net_nfc_server_llcp_receive_from(net_nfc_request_msg_t *req_msg)
-{
-       llcp_add_async_queue(req_msg, llcp_receive_from_thread_func);
-}
-
-void net_nfc_server_llcp_connect(net_nfc_request_msg_t *req_msg)
-{
-       llcp_add_async_queue(req_msg, llcp_connect_thread_func);
-}
-
-void net_nfc_server_llcp_disconnect(net_nfc_request_msg_t *req_msg)
-{
-       llcp_add_async_queue(req_msg, llcp_disconnect_thread_func);
-}
-
-net_nfc_error_e net_nfc_server_llcp_set_config(net_nfc_llcp_config_info_s *config)
+net_nfc_error_e net_nfc_server_llcp_set_config(
+               net_nfc_llcp_config_info_s *config)
 {
        net_nfc_error_e result;
 
@@ -3080,35 +2175,31 @@ net_nfc_error_e net_nfc_server_llcp_simple_server(net_nfc_target_handle_s *handl
                gpointer user_data)
 {
        net_nfc_error_e result = NET_NFC_OK;
-
+       LlcpSimpleData *simple_data = NULL;
        net_nfc_llcp_socket_t socket = -1;
        net_nfc_llcp_config_info_s config;
 
-       LlcpSimpleData *simple_data = NULL;
-
        if (handle == NULL)
                return NET_NFC_NULL_PARAMETER;
 
-       if (san == NULL)
-               return NET_NFC_NULL_PARAMETER;
-
        if (net_nfc_controller_llcp_get_remote_config(handle,
                                &config,
                                &result) == false)
        {
-               DEBUG_ERR_MSG("%s failed [%d]",
-                               "net_nfc_controller_llcp_get_remote_config",
-                               result);
-               return result;
+               DEBUG_ERR_MSG("net_nfc_controller_llcp_get_remote_config failed [%d]", result);
+
+               goto ERROR;
        }
 
-       simple_data = g_new0(LlcpSimpleData, 1);
-       if(simple_data == NULL)
-       {
-               DEBUG_ERR_MSG("Memory allocation failed");
+       simple_data = g_try_new0(LlcpSimpleData, 1);
+       if (simple_data == NULL) {
+               DEBUG_ERR_MSG("g_try_new0 failed");
 
-               return NET_NFC_ALLOC_FAIL;
+               result = NET_NFC_ALLOC_FAIL;
+
+               goto ERROR;
        }
+
        simple_data->handle = handle;
        simple_data->callback = callback;
        simple_data->error_callback = error_callback;
@@ -3124,12 +2215,9 @@ net_nfc_error_e net_nfc_server_llcp_simple_server(net_nfc_target_handle_s *handl
                                llcp_simple_socket_error_cb,
                                simple_data) == false)
        {
-               DEBUG_ERR_MSG("%s failed [%d]",
-                               "net_nfc_controller_llcp_create_socket",
-                               result);
+               DEBUG_ERR_MSG("net_nfc_controller_llcp_create_socket failed [%d]", result);
 
-               g_free(simple_data);
-               return result;
+               goto ERROR;
        }
 
        simple_data->socket = socket;
@@ -3138,16 +2226,9 @@ net_nfc_error_e net_nfc_server_llcp_simple_server(net_nfc_target_handle_s *handl
                                sap,
                                &result) == false)
        {
-               DEBUG_ERR_MSG("%s failed [%d]",
-                               "nte_nfc_controller_llcp_bind",
-                               result);
-
-               if (simple_data->socket != 1)
-                       net_nfc_controller_llcp_socket_close(socket, &result);
-
-               g_free(simple_data);
+               DEBUG_ERR_MSG("net_nfc_controller_llcp_bind failed [%d]", result);
 
-               return result;
+               goto ERROR;
        }
 
        if (net_nfc_controller_llcp_listen(handle,
@@ -3157,21 +2238,9 @@ net_nfc_error_e net_nfc_server_llcp_simple_server(net_nfc_target_handle_s *handl
                                llcp_simple_listen_cb,
                                simple_data) == false)
        {
-               DEBUG_ERR_MSG("%s failed [%d]",
-                               "net_nfc_controller_llcp_listen",
-                               result);
-
-               if (simple_data->socket != 1)
-               {
-                       net_nfc_controller_llcp_socket_close(
-                                       simple_data->socket,
-                                       &result);
-               }
-
-               g_free(simple_data);
-
-               return result;
+               DEBUG_ERR_MSG("net_nfc_controller_llcp_listen failed [%d]", result);
 
+               goto ERROR;
        }
 
        DEBUG_SERVER_MSG("result [%d]", result);
@@ -3180,6 +2249,19 @@ net_nfc_error_e net_nfc_server_llcp_simple_server(net_nfc_target_handle_s *handl
                result = NET_NFC_OK;
 
        return result;
+
+ERROR :
+       if (socket != -1) {
+               net_nfc_error_e temp;
+
+               net_nfc_controller_llcp_socket_close(socket, &temp);
+       }
+
+       if (simple_data != NULL) {
+               g_free(simple_data);
+       }
+
+       return result;
 }
 
 net_nfc_error_e net_nfc_server_llcp_simple_client(
@@ -3190,13 +2272,11 @@ net_nfc_error_e net_nfc_server_llcp_simple_client(
                net_nfc_server_llcp_callback error_callback,
                gpointer user_data)
 {
-       net_nfc_error_e result = NET_NFC_OK;
-
+       net_nfc_error_e result;
+       LlcpSimpleData *simple_data = NULL;
        net_nfc_llcp_socket_t socket = -1;
        net_nfc_llcp_config_info_s config;
 
-       LlcpSimpleData *simple_data = NULL;
-
        if (handle == NULL)
                return NET_NFC_NULL_PARAMETER;
 
@@ -3204,13 +2284,19 @@ net_nfc_error_e net_nfc_server_llcp_simple_client(
                                &config,
                                &result) == false)
        {
-               DEBUG_ERR_MSG("%s failed [%d]",
-                               "net_nfc_controller_llcp_get_remote_config",
-                               result);
-               return result;
+               DEBUG_ERR_MSG("net_nfc_controller_llcp_get_remote_config failed [%d]", result);
+
+               goto ERROR;
        }
 
-       simple_data = g_new0(LlcpSimpleData, 1);
+       simple_data = g_try_new0(LlcpSimpleData, 1);
+       if (simple_data == NULL) {
+               DEBUG_ERR_MSG("g_try_new0 failed");
+
+               result = NET_NFC_ALLOC_FAIL;
+
+               goto ERROR;
+       }
 
        simple_data->handle = handle;
        simple_data->callback = callback;
@@ -3227,12 +2313,9 @@ net_nfc_error_e net_nfc_server_llcp_simple_client(
                                llcp_simple_socket_error_cb,
                                simple_data) == false)
        {
-               DEBUG_ERR_MSG("%s failed [%d]",
-                               "net_nfc_controller_llcp_create_socket",
-                               result);
+               DEBUG_ERR_MSG("net_nfc_controller_llcp_create_socket failed [%d]", result);
 
-               g_free(simple_data);
-               return result;
+               goto ERROR;
        }
 
        simple_data->socket = socket;
@@ -3246,22 +2329,10 @@ net_nfc_error_e net_nfc_server_llcp_simple_client(
                                        llcp_simple_connect_cb,
                                        simple_data) == false)
                {
-                       DEBUG_ERR_MSG("%s failed [%d]",
-                                       "net_nfc_controller_llcp_connect",
-                                       result);
-
-                       if (simple_data->socket != -1)
-                       {
-                               net_nfc_controller_llcp_socket_close(
-                                               simple_data->socket,
-                                               &result);
-                       }
-
-                       g_free(simple_data);
+                       DEBUG_ERR_MSG("net_nfc_controller_llcp_connect failed [%d]", result);
 
-                       return result;
+                       goto ERROR;
                }
-
        }
        else
        {
@@ -3272,20 +2343,9 @@ net_nfc_error_e net_nfc_server_llcp_simple_client(
                                        llcp_simple_connect_cb,
                                        simple_data) == false)
                {
-                       DEBUG_ERR_MSG("%s failed [%d]",
-                                       "net_nfc_controller_llcp_connect_by_url",
-                                       result);
-
-                       if (simple_data->socket != -1)
-                       {
-                               net_nfc_controller_llcp_socket_close(
-                                               simple_data->socket,
-                                               &result);
-                       }
-
-                       g_free(simple_data);
+                       DEBUG_ERR_MSG("net_nfc_controller_llcp_connect_by_url failed [%d]", result);
 
-                       return result;
+                       goto ERROR;
                }
        }
 
@@ -3295,6 +2355,19 @@ net_nfc_error_e net_nfc_server_llcp_simple_client(
                result = NET_NFC_OK;
 
        return result;
+
+ERROR :
+       if (socket != -1) {
+               net_nfc_error_e temp;
+
+               net_nfc_controller_llcp_socket_close(socket, &temp);
+       }
+
+       if (simple_data != NULL) {
+               g_free(simple_data);
+       }
+
+       return result;
 }
 
 net_nfc_error_e net_nfc_server_llcp_simple_accept(
@@ -3303,30 +2376,27 @@ net_nfc_error_e net_nfc_server_llcp_simple_accept(
                net_nfc_server_llcp_callback error_callback,
                gpointer user_data)
 {
-       net_nfc_error_e result = NET_NFC_OK;
-
+       net_nfc_error_e result;
        LlcpSimpleData *simple_data;
 
-       simple_data = g_new0(LlcpSimpleData, 1);
-       if(simple_data == NULL)
-       {
-               DEBUG_ERR_MSG("Memory allocation failed");
+       simple_data = g_try_new0(LlcpSimpleData, 1);
+       if (simple_data != NULL) {
+               simple_data->handle = handle;
+               simple_data->socket = socket;
+               simple_data->error_callback = error_callback;
+               simple_data->user_data = user_data;
 
-               return NET_NFC_ALLOC_FAIL;
-       }
-       simple_data->handle = handle;
-       simple_data->socket = socket;
-       simple_data->error_callback = error_callback;
-       simple_data->user_data = user_data;
+               if (net_nfc_controller_llcp_accept(socket,
+                                       &result,
+                                       llcp_simple_socket_error_cb,
+                                       simple_data) == false)
+               {
+                       DEBUG_ERR_MSG("net_nfc_controller_llcp_accept failed [%d]", result);
+               }
+       } else {
+               DEBUG_ERR_MSG("g_try_new0 failed");
 
-       if (net_nfc_controller_llcp_accept(socket,
-                               &result,
-                               llcp_simple_server_error_cb,
-                               simple_data) == false)
-       {
-               DEBUG_ERR_MSG("%s failed [%d]",
-                               "net_nfc_controller_llcp_accept",
-                               result);
+               result = NET_NFC_ALLOC_FAIL;
        }
 
        if (result == NET_NFC_BUSY)
@@ -3342,32 +2412,30 @@ net_nfc_error_e net_nfc_server_llcp_simple_send(
                net_nfc_server_llcp_callback callback,
                gpointer user_data)
 {
-       net_nfc_error_e result = NET_NFC_OK;
-
+       net_nfc_error_e result;
        LlcpSimpleData *simple_data;
 
-       simple_data = g_new0(LlcpSimpleData, 1);
-       if(simple_data == NULL)
-       {
-               DEBUG_ERR_MSG("Memory allocation failed");
+       simple_data = g_try_new0(LlcpSimpleData, 1);
+       if (simple_data != NULL) {
+               simple_data->handle = handle;
+               simple_data->socket = socket;
+               simple_data->callback = callback;
+               simple_data->user_data = user_data;
 
-               return NET_NFC_ALLOC_FAIL;
-       }
-       simple_data->handle = handle;
-       simple_data->socket = socket;
-       simple_data->callback = callback;
-       simple_data->user_data = user_data;
+               if (net_nfc_controller_llcp_send(handle,
+                                       socket,
+                                       data,
+                                       &result,
+                                       llcp_simple_send_cb,
+                                       simple_data) == false)
+               {
+                       DEBUG_ERR_MSG("net_nfc_controller_llcp_send failed [%d]",
+                                       result);
+               }
+       } else {
+               DEBUG_ERR_MSG("g_try_new0 failed");
 
-       if (net_nfc_controller_llcp_send(handle,
-                               socket,
-                               data,
-                               &result,
-                               llcp_simple_send_cb,
-                               simple_data) == false)
-       {
-               DEBUG_ERR_MSG("%s failed [%d]",
-                               "net_nfc_controller_llcp_send",
-                               result);
+               result = NET_NFC_ALLOC_FAIL;
        }
 
        if (result == NET_NFC_BUSY)
@@ -3382,32 +2450,31 @@ net_nfc_error_e net_nfc_server_llcp_simple_receive(
                net_nfc_server_llcp_callback callback,
                gpointer user_data)
 {
-       net_nfc_error_e result = NET_NFC_OK;
-
+       net_nfc_error_e result;
        LlcpSimpleData *simple_data;
 
-       simple_data = g_new0(LlcpSimpleData, 1);
-       if(simple_data == NULL)
-       {
-               DEBUG_ERR_MSG("Memory allocation failed");
+       simple_data = g_try_new0(LlcpSimpleData, 1);
+       if (simple_data != NULL) {
+               simple_data->handle = handle;
+               simple_data->socket = socket;
+               simple_data->callback = callback;
+               simple_data->user_data = user_data;
 
-               return NET_NFC_ALLOC_FAIL;
-       }
-       simple_data->handle = handle;
-       simple_data->socket = socket;
-       simple_data->callback = callback;
-       simple_data->user_data = user_data;
+               if (net_nfc_controller_llcp_recv(handle,
+                                       socket,
+                                       net_nfc_server_llcp_get_miu(),
+                                       &result,
+                                       llcp_simple_receive_cb,
+                                       simple_data) == false)
+               {
+                       DEBUG_ERR_MSG("net_nfc_controller_llcp_recv failed [%d]", result);
 
-       if (net_nfc_controller_llcp_recv(handle,
-                               socket,
-                               net_nfc_server_llcp_get_miu(),
-                               &result,
-                               llcp_simple_receive_cb,
-                               simple_data) == false)
-       {
-               DEBUG_ERR_MSG("%s failed [%d]",
-                               "net_nfc_controller_llcp_send",
-                               result);
+                       g_free(simple_data);
+               }
+       } else {
+               DEBUG_ERR_MSG("g_try_new0 failed");
+
+               result = NET_NFC_ALLOC_FAIL;
        }
 
        if (result == NET_NFC_BUSY)
@@ -3457,7 +2524,7 @@ static net_nfc_error_e _llcp_add_service(const char *id, uint32_t sap,
        if (_llcp_find_service(sap) == NULL) {
                DEBUG_SERVER_MSG("new service, sap [%d]", sap);
 
-               service = g_new0(service_t, 1);
+               service = g_try_new0(service_t, 1);
                if (service != NULL) {
                        service->sap = sap;
                        if (san != NULL && strlen(san) > 0) {
@@ -3614,17 +2681,21 @@ net_nfc_error_e net_nfc_server_llcp_start_registered_services(
 static void net_nfc_server_llcp_process(gpointer user_data)
 {
        net_nfc_current_target_info_s *target;
+#if 0
+       net_nfc_error_e result;
+#endif
        net_nfc_target_handle_s *handle;
+       net_nfc_target_type_e dev_type;
 
        target = net_nfc_server_get_target_info();
 
        g_assert(target != NULL); /* raise exception!!! what;s wrong?? */
 
        handle = target->handle;
+       dev_type = target->devType;
+
        DEBUG_SERVER_MSG("connection type = [%d]", handle->connection_type);
 #if 0
-       net_nfc_target_type_e dev_type = target->devType;
-
        if (dev_type == NET_NFC_NFCIP1_TARGET)
        {
                DEBUG_SERVER_MSG("LLCP : target, try to connect");
index 179da48..5d6271f 100644 (file)
@@ -86,25 +86,10 @@ gboolean net_nfc_server_llcp_init(GDBusConnection *connection);
 void net_nfc_server_llcp_deinit(void);
 
 /* server side */
-void net_nfc_server_llcp_deactivated(net_nfc_request_msg_t *req_msg);
+void net_nfc_server_llcp_deactivated(gpointer user_data);
 
-void net_nfc_server_llcp_listen(net_nfc_request_msg_t *req_msg);
-
-void net_nfc_server_llcp_socket_error(net_nfc_request_msg_t *req_msg);
-
-void net_nfc_server_llcp_socket_accepted_error(net_nfc_request_msg_t *req_msg);
-
-void net_nfc_server_llcp_send(net_nfc_request_msg_t *req_msg);
-
-void net_nfc_server_llcp_receive(net_nfc_request_msg_t *req_msg);
-
-void net_nfc_server_llcp_receive_from(net_nfc_request_msg_t *req_msg);
-
-void net_nfc_server_llcp_connect(net_nfc_request_msg_t *req_msg);
-
-void net_nfc_server_llcp_disconnect(net_nfc_request_msg_t *req_msg);
-
-net_nfc_error_e net_nfc_server_llcp_set_config(net_nfc_llcp_config_info_s *config);
+net_nfc_error_e net_nfc_server_llcp_set_config(
+               net_nfc_llcp_config_info_s *config);
 
 guint16 net_nfc_server_llcp_get_miu(void);
 
index 8e18214..9a4e4de 100644 (file)
@@ -53,11 +53,14 @@ static void p2p_send_data_thread_func(gpointer user_data)
 {
        P2pSendData *p2p_data = (P2pSendData *)user_data;
        net_nfc_error_e result;
+       net_nfc_target_handle_s *handle;
 
        g_assert(p2p_data != NULL);
        g_assert(p2p_data->p2p != NULL);
        g_assert(p2p_data->invocation != NULL);
 
+       handle = GUINT_TO_POINTER(p2p_data->p2p_handle);
+
        result = net_nfc_server_snep_default_client_start(
                        GUINT_TO_POINTER(p2p_data->p2p_handle),
                        SNEP_REQ_PUT,
@@ -181,23 +184,21 @@ void net_nfc_server_p2p_deinit(void)
 
 void net_nfc_server_p2p_detached(void)
 {
-       if (p2p_skeleton == NULL)
-       {
-               DEBUG_ERR_MSG("p2p_skeleton is not initialized");
-
-               return;
-       }
-
-       DEBUG_ERR_MSG("p2p detached signal");
+       INFO_MSG("====== p2p target detached ======");
 
        /* release target information */
        net_nfc_server_free_target_info();
 
-       net_nfc_gdbus_p2p_emit_detached(p2p_skeleton);
+       if (p2p_skeleton != NULL)
+       {
+               net_nfc_gdbus_p2p_emit_detached(p2p_skeleton);
+       }
 }
 
 void net_nfc_server_p2p_discovered(net_nfc_target_handle_h handle)
 {
+       INFO_MSG("====== p2p target discovered ======");
+
        if (p2p_skeleton == NULL)
        {
                DEBUG_ERR_MSG("p2p_skeleton is not initialized");
@@ -205,8 +206,6 @@ void net_nfc_server_p2p_discovered(net_nfc_target_handle_h handle)
                return;
        }
 
-       DEBUG_ERR_MSG("Emitting p2p discovered signal");
-
        net_nfc_gdbus_p2p_emit_discovered(p2p_skeleton,
                        GPOINTER_TO_UINT(handle));
 }
index 9188723..df4c071 100644 (file)
@@ -1533,7 +1533,7 @@ static void _net_nfc_server_snep_client_recv_cb(net_nfc_error_e result,
 
 
 static void _net_nfc_server_snep_client_do_job(
-       net_nfc_server_snep_context_t *context)
+               net_nfc_server_snep_context_t *context)
 {
        if (context->state == NET_NFC_LLCP_IDLE &&
                        g_queue_is_empty(&context->queue) == false) {
@@ -1872,8 +1872,6 @@ static net_nfc_error_e _net_nfc_server_default_client_cb_(
 
                net_nfc_server_p2p_data_sent(result,
                                context->user_param);
-
-               _net_nfc_util_free_mem(context);
                break;
 
        default :
index c94422e..7e68833 100644 (file)
@@ -427,22 +427,6 @@ static TestData test_data[] = {
 
        {
                "llcp",
-               "CreateSocket",
-               net_nfc_test_llcp_create_socket,
-               NULL,
-               "Create a LLCP socket"
-       },
-
-       {
-               "llcp",
-               "CloseSocket",
-               net_nfc_test_llcp_close_socket,
-               net_nfc_test_llcp_close_socket_sync,
-               "Close the socket"
-       },
-
-       {
-               "llcp",
                "SetDefaultConfig",
                net_nfc_test_llcp_default_config,
                net_nfc_test_llcp_default_config_sync,
index e2ab811..f822f7b 100644 (file)
@@ -24,8 +24,6 @@
 
 static net_nfc_llcp_socket_t server_test_socket;
 static net_nfc_llcp_socket_t client_test_socket;
-net_nfc_llcp_socket_option_h test_option = NULL;
-
 
 static net_nfc_llcp_config_info_h llcp_config = NULL;
 static net_nfc_llcp_config_info_h llcp_config_sync = NULL;
@@ -130,10 +128,8 @@ static void llcp_connect_sap_cb(net_nfc_error_e result,
 
 
 static void llcp_send_socket_cb(net_nfc_error_e result,
-               net_nfc_llcp_socket_t client_socket,
                void *user_data)
 {
-       g_print("llcp_send_socket_cb    Completed %d\n", client_socket);
        g_print("llcp_send_socket_cb    Completed %d\n", result);
 
        run_next_callback(user_data);
@@ -141,10 +137,8 @@ static void llcp_send_socket_cb(net_nfc_error_e result,
 }
 
 static void llcp_send_to_socket_cb(net_nfc_error_e result,
-               net_nfc_llcp_socket_t client_socket,
                void *user_data)
 {
-       g_print("llcp_send_to_socket_cb Completed %d\n", client_socket);
        g_print("llcp_send_to_socket_cb Completed %d\n", result);
 
        run_next_callback(user_data);
@@ -152,26 +146,14 @@ static void llcp_send_to_socket_cb(net_nfc_error_e result,
 }
 
 static void llcp_disconnect_socket_cb(net_nfc_error_e result,
-               net_nfc_llcp_socket_t client_socket,
                void *user_data)
 {
-       g_print("llcp_send_to_socket_cb Completed %d\n", client_socket);
        g_print("llcp_send_to_socket_cb Completed %d\n", result);
 
        run_next_callback(user_data);
 
 }
 
-static void llcp_close_completed_cb(net_nfc_error_e result,
-               net_nfc_llcp_socket_t client_socket,
-               void *user_data)
-{
-
-       g_print("llcp_close_completed_cb Completed %d\n", client_socket);
-       g_print("llcp_close_completed_cb Completed %d\n", result);
-
-}
-
 
 /*********************************** Function Calls *************************************/
 
@@ -292,29 +274,29 @@ void net_nfc_test_llcp_get_local_config(gpointer data,
 
 /*commented because remote config API is not available*/
 /*
-       void net_nfc_test_llcp_get_remote_config(gpointer data,
-       gpointer user_data)
-       {
-       net_nfc_llcp_config_info_h local_config;
-       net_nfc_error_e result;
+   void net_nfc_test_llcp_get_remote_config(gpointer data,
+   gpointer user_data)
+   {
+   net_nfc_llcp_config_info_h local_config;
+   net_nfc_error_e result;
 
-       result = net_nfc_client_llcp_get_local_config(&local_config);
+   result = net_nfc_client_llcp_get_local_config(&local_config);
 
-       if(result != NET_NFC_OK)
-       {
-       g_print(" llcp create custom config failed: %d\n", result);
-       run_next_callback(user_data);
-       return;
+   if(result != NET_NFC_OK)
+   {
+   g_print(" llcp create custom config failed: %d\n", result);
+   run_next_callback(user_data);
+   return;
 
-       }
+   }
 
-       g_print(" net_nfc_test_llcp_get_local_config: %d\n", local_config->miu);
-       g_print("net_nfc_test_llcp_get_local_config: %d\n", local_config->wks);
-       g_print(" net_nfc_test_llcp_get_local_config: %d\n", local_config->lto);
-       g_print("net_nfc_test_llcp_get_local_config: %d\n", local_config->option);
+   g_print(" net_nfc_test_llcp_get_local_config: %d\n", local_config->miu);
+   g_print("net_nfc_test_llcp_get_local_config: %d\n", local_config->wks);
+   g_print(" net_nfc_test_llcp_get_local_config: %d\n", local_config->lto);
+   g_print("net_nfc_test_llcp_get_local_config: %d\n", local_config->option);
 
-       }
-       */
+   }
+   */
 
 void net_nfc_test_llcp_get_config_miu(gpointer data,
                gpointer user_data)
@@ -538,9 +520,10 @@ void net_nfc_test_llcp_free_config(gpointer data,
 void net_nfc_test_llcp_create_custom_socket_option(gpointer data,
                gpointer user_data)
 {
+       net_nfc_llcp_socket_option_h option;
        net_nfc_error_e result;
 
-       result = net_nfc_client_llcp_create_socket_option(&test_option,
+       result = net_nfc_client_llcp_create_socket_option(&option,
                        128,
                        1,
                        NET_NFC_LLCP_SOCKET_TYPE_CONNECTIONORIENTED);
@@ -561,9 +544,10 @@ void net_nfc_test_llcp_create_custom_socket_option(gpointer data,
 void net_nfc_test_llcp_create_default_socket_option(gpointer data,
                gpointer user_data)
 {
+       net_nfc_llcp_socket_option_h option;
        net_nfc_error_e result;
 
-       result = net_nfc_client_llcp_create_socket_option_default(&test_option);
+       result = net_nfc_client_llcp_create_socket_option_default(&option);
 
        if(result != NET_NFC_OK)
        {
@@ -581,9 +565,9 @@ void net_nfc_test_llcp_get_local_socket_option(gpointer data,
                gpointer user_data)
 {
        net_nfc_error_e result;
-       net_nfc_llcp_socket_option_h option_local;
+       net_nfc_llcp_socket_option_h option;
 
-       result = net_nfc_client_llcp_get_local_socket_option(client_test_socket,&option_local);
+       result = net_nfc_client_llcp_get_local_socket_option(client_test_socket,&option);
 
        if(result != NET_NFC_OK)
        {
@@ -592,9 +576,9 @@ void net_nfc_test_llcp_get_local_socket_option(gpointer data,
                return;
        }
 
-       g_print(" net_nfc_test_llcp_get_local_socket_option: %d\n", option_local->miu);
-       g_print("net_nfc_test_llcp_get_local_socket_option: %d\n", option_local->rw);
-       g_print(" net_nfc_test_llcp_get_local_socket_option: %d\n", option_local->type);
+       g_print(" net_nfc_test_llcp_get_local_socket_option: %d\n", option->miu);
+       g_print("net_nfc_test_llcp_get_local_socket_option: %d\n", option->rw);
+       g_print(" net_nfc_test_llcp_get_local_socket_option: %d\n", option->type);
 
        run_next_callback(user_data);
 }
@@ -602,10 +586,11 @@ void net_nfc_test_llcp_get_local_socket_option(gpointer data,
 void net_nfc_test_llcp_get_socket_option_miu(gpointer data,
                gpointer user_data)
 {
+       net_nfc_llcp_socket_option_s option;
        net_nfc_error_e result;
        uint16_t miu;
 
-       result = net_nfc_client_llcp_get_socket_option_miu(test_option,&miu);
+       result = net_nfc_client_llcp_get_socket_option_miu(&option,&miu);
 
        if(result != NET_NFC_OK)
        {
@@ -623,10 +608,11 @@ void net_nfc_test_llcp_get_socket_option_miu(gpointer data,
 void net_nfc_test_llcp_set_socket_option_miu(gpointer data,
                gpointer user_data)
 {
+       net_nfc_llcp_socket_option_s option;
        net_nfc_error_e result;
        uint16_t miu = 128;
 
-       result = net_nfc_client_llcp_set_socket_option_miu(test_option,miu);
+       result = net_nfc_client_llcp_set_socket_option_miu(&option,miu);
 
        if(result != NET_NFC_OK)
        {
@@ -642,10 +628,11 @@ void net_nfc_test_llcp_set_socket_option_miu(gpointer data,
 void net_nfc_test_llcp_get_socket_option_rw(gpointer data,
                gpointer user_data)
 {
+       net_nfc_llcp_socket_option_s option;
        net_nfc_error_e result;
        uint8_t rw;
 
-       result = net_nfc_client_llcp_get_socket_option_rw(test_option,&rw);
+       result = net_nfc_client_llcp_get_socket_option_rw(&option,&rw);
 
        if(result != NET_NFC_OK)
        {
@@ -662,10 +649,11 @@ void net_nfc_test_llcp_get_socket_option_rw(gpointer data,
 void net_nfc_test_llcp_set_socket_option_rw(gpointer data,
                gpointer user_data)
 {
+       net_nfc_llcp_socket_option_s option;
        net_nfc_error_e result;
        uint8_t rw = 1;
 
-       result = net_nfc_client_llcp_set_socket_option_rw(test_option,rw);
+       result = net_nfc_client_llcp_set_socket_option_rw(&option,rw);
 
        if(result != NET_NFC_OK)
        {
@@ -681,10 +669,11 @@ void net_nfc_test_llcp_set_socket_option_rw(gpointer data,
 void net_nfc_test_llcp_get_socket_option_type(gpointer data,
                gpointer user_data)
 {
+       net_nfc_llcp_socket_option_s option;
        net_nfc_error_e result;
        net_nfc_socket_type_e type;
 
-       result = net_nfc_client_llcp_get_socket_option_type(test_option,&type);
+       result = net_nfc_client_llcp_get_socket_option_type(&option,&type);
 
        if(result != NET_NFC_OK)
        {
@@ -701,10 +690,11 @@ void net_nfc_test_llcp_get_socket_option_type(gpointer data,
 void net_nfc_test_llcp_set_socket_option_type(gpointer data,
                gpointer user_data)
 {
+       net_nfc_llcp_socket_option_s option;
        net_nfc_error_e result;
        net_nfc_socket_type_e type = NET_NFC_LLCP_SOCKET_TYPE_CONNECTIONORIENTED;
 
-       result = net_nfc_client_llcp_set_socket_option_type(test_option,type);
+       result = net_nfc_client_llcp_set_socket_option_type(&option,type);
 
        if(result != NET_NFC_OK)
        {
@@ -720,9 +710,10 @@ void net_nfc_test_llcp_set_socket_option_type(gpointer data,
 void net_nfc_test_llcp_free_socket_option(gpointer data,
                gpointer user_data)
 {
+       net_nfc_llcp_socket_option_s option;
        net_nfc_error_e result;
 
-       result = net_nfc_client_llcp_free_socket_option(test_option);
+       result = net_nfc_client_llcp_free_socket_option(&option);
 
        if(result != NET_NFC_OK)
        {
@@ -869,44 +860,6 @@ void net_nfc_test_llcp_receive_from_sync(gpointer data,
 }
 
 
-void net_nfc_test_llcp_create_socket(gpointer data,
-               gpointer user_data)
-{
-
-       net_nfc_client_llcp_create_socket(&client_test_socket, NULL);
-
-       g_print(" net_nfc_test_llcp_create_socket  finished\n");
-
-}
-
-
-void net_nfc_test_llcp_close_socket(gpointer data,
-               gpointer user_data)
-{
-       net_nfc_error_e result;
-
-       result = net_nfc_client_llcp_close(client_test_socket,
-                       llcp_close_completed_cb,
-                       user_data);
-
-       g_print(" net_nfc_test_llcp_close_socket %d\n",result);
-
-}
-
-
-void net_nfc_test_llcp_close_socket_sync(gpointer data,
-               gpointer user_data)
-{
-       net_nfc_llcp_socket_t out_socket;
-       net_nfc_error_e result;
-
-       result = net_nfc_client_llcp_close_sync(client_test_socket,
-                       &out_socket);
-
-       g_print(" net_nfc_test_llcp_close_socket %d\n",result);
-
-}
-
 
 void net_nfc_test_llcp_connect(gpointer data,
                gpointer user_data)
@@ -1018,20 +971,17 @@ void net_nfc_test_llcp_send(gpointer func_data,
 
 }
 
-
 void net_nfc_test_llcp_send_sync(gpointer func_data,
                gpointer user_data)
 {
        net_nfc_error_e result;
        data_h data;
        char * str = "Client message: Hello, server!";
-       net_nfc_llcp_socket_t out_socket;
 
        net_nfc_create_data (&data, (const uint8_t*)str ,strlen (str) + 1);
 
        result = net_nfc_client_llcp_send_sync(client_test_socket,
-                       data,
-                       &out_socket);
+                       data);
 
        if(result != NET_NFC_OK)
        {
@@ -1040,7 +990,7 @@ void net_nfc_test_llcp_send_sync(gpointer func_data,
                return;
        }
 
-       g_print(" net_nfc_test_llcp_send_sync out_socket: %d\n", out_socket);
+       g_print(" net_nfc_test_llcp_send_sync success\n");
        run_next_callback(user_data);
 
 }
@@ -1076,14 +1026,12 @@ void net_nfc_test_llcp_send_to_sync(gpointer func_data,
        net_nfc_error_e result;
        data_h data;
        char * str = "Client message: Hello, server!";
-       net_nfc_llcp_socket_t out_socket;
 
        net_nfc_create_data (&data, (const uint8_t*)str ,strlen (str) + 1);
 
        result = net_nfc_client_llcp_send_to_sync(client_test_socket,
                        16,
-                       data,
-                       &out_socket);
+                       data);
 
        if(result != NET_NFC_OK)
        {
@@ -1092,7 +1040,7 @@ void net_nfc_test_llcp_send_to_sync(gpointer func_data,
                return;
        }
 
-       g_print(" net_nfc_test_llcp_send_to_sync out_socket: %d\n", out_socket);
+       g_print(" net_nfc_test_llcp_send_to_sync success\n");
        run_next_callback(user_data);
 
 }
@@ -1129,7 +1077,6 @@ void net_nfc_test_llcp_disconnect_server(gpointer func_data,
                g_print(" net_nfc_test_llcp_disconnect accepted_socket failed: %d\n", result);
                return;
        }
-
 }
 
 
@@ -1137,10 +1084,8 @@ void net_nfc_test_llcp_disconnect_sync(gpointer func_data,
                gpointer user_data)
 {
        net_nfc_error_e result;
-       net_nfc_llcp_socket_t out_socket;
 
-       result = net_nfc_client_llcp_disconnect_sync(client_test_socket,
-                       &out_socket);
+       result = net_nfc_client_llcp_disconnect_sync(client_test_socket);
 
        if(result != NET_NFC_OK)
        {
@@ -1149,10 +1094,6 @@ void net_nfc_test_llcp_disconnect_sync(gpointer func_data,
                return;
        }
 
-       g_print(" net_nfc_test_llcp_disconnect_sync out_socket: %d\n", out_socket);
+       g_print(" net_nfc_test_llcp_disconnect_sync success\n");
        run_next_callback(user_data);
-
 }
-
-
-