Remove request_handler from the API library implementation 70/70770/1
authorMu-Woong Lee <muwoong.lee@samsung.com>
Fri, 20 May 2016 11:04:49 +0000 (20:04 +0900)
committerMu-Woong Lee <muwoong.lee@samsung.com>
Fri, 20 May 2016 11:04:49 +0000 (20:04 +0900)
API implementations use DBusClient directly, and request_handler is moved to the testsuite.

Change-Id: Ib897e2c3a335a2f6587139b9780bcf31c1c6dc6f
Signed-off-by: Mu-Woong Lee <muwoong.lee@samsung.com>
src/context_history.cpp
src/context_trigger.cpp
src/request_handler.cpp [deleted file]
src/request_handler.h [deleted file]
src/rule_validator.cpp
testsuite/CMakeLists.txt
testsuite/src/trigger/condition.cpp
testsuite/src/trigger/event.cpp
testsuite/src/trigger/request_handler.cpp [new file with mode: 0644]
testsuite/src/trigger/request_handler.h [new file with mode: 0644]

index 8db3ba6d28441f35ecffa200f37ae75deee76cfd..3f90f427252460f3a3f64736f88f4a3a4d817ad6 100644 (file)
@@ -18,7 +18,7 @@
 #include <Json.h>
 #include <context_history.h>
 #include <context_history_types_internal.h>
-#include "request_handler.h"
+#include "DBusClient.h"
 
 #define TYPE_INT 0
 #define TYPE_STRING 1
@@ -153,7 +153,9 @@ SO_EXPORT int context_history_get_list(context_history_h handle, context_history
 
        int req_id;
        ctx::Json tmp_list;
-       int err = ctx::request_handler::read_sync(data_type_str.c_str(), (filter)? &filter->jfilter : NULL, &req_id, &tmp_list);
+       ctx::DBusClient dbusClient;
+
+       int err = dbusClient.readSync(data_type_str, filter ? filter->jfilter : NULL, &req_id, &tmp_list);
        IF_FAIL_RETURN_TAG(err == ERR_NONE, err, _E, "Getting list failed");
 
        _J("Read response", tmp_list);
index 7ad7df52426f4f01096115b4b75797361c531471..2cc7262dd08595cf272f696d2276590dbc3f5158 100644 (file)
@@ -26,7 +26,7 @@
 #include <context_trigger_internal.h>
 #include <context_trigger_types_internal.h>
 #include <pkgmgr-info.h>
-#include "request_handler.h"
+#include "DBusClient.h"
 #include "rule_validator.h"
 
 #define INITIAL_RULE "{ \"ID\" : -1, \"DESCRIPTION\" : \"\", \"DETAILS\" : {  } }"
@@ -35,6 +35,8 @@
 #define EVENT_DATA_KEY_PREFIX_STR std::string("?")
 //#define DOUBLE_PRECISION 2
 
+static ctx::DBusClient __dbusClient;
+
 static int context_trigger_rule_event_create_internal(const char* event_item, context_trigger_logical_type_e logical_type, context_trigger_rule_entry_h* entry, bool is_custom = false);
 static int context_trigger_rule_condition_create_internal(const char* condition_item, context_trigger_logical_type_e logical_type, context_trigger_rule_entry_h* entry, bool is_custom = false);
 static std::string convert_event_to_string(context_trigger_event_e item);
@@ -86,7 +88,7 @@ SO_EXPORT int context_trigger_add_rule(context_trigger_rule_h rule, int* rule_id
                return CONTEXT_TRIGGER_ERROR_INVALID_RULE;
 
        ctx::Json jrule_id;
-       int error = ctx::request_handler::write_with_reply(CONTEXT_TRIGGER_SUBJECT_ADD, &(rule->jrule), &jrule_id);
+       int error = __dbusClient.write(CONTEXT_TRIGGER_SUBJECT_ADD, rule->jrule, &jrule_id);
 
        if (error == ERR_NONE) {
                jrule_id.get(NULL, CT_RULE_ID, rule_id);
@@ -105,7 +107,7 @@ SO_EXPORT int context_trigger_remove_rule(int rule_id)
 
        ctx::Json jrule_id;
        jrule_id.set(NULL, CT_RULE_ID, rule_id);
-       int error = ctx::request_handler::write_with_reply(CONTEXT_TRIGGER_SUBJECT_REMOVE, &jrule_id, NULL);
+       int error = __dbusClient.write(CONTEXT_TRIGGER_SUBJECT_REMOVE, jrule_id, NULL);
 
        if (error == ERR_ALREADY_STARTED) {     // Rule is still enabled.
                return CONTEXT_TRIGGER_ERROR_RULE_ENABLED;
@@ -127,7 +129,7 @@ SO_EXPORT int context_trigger_enable_rule(int rule_id)
        jrule_id.set(NULL, CT_RULE_ID, rule_id);
 
        int req_id;     // Useless in context_trigger
-       int error = ctx::request_handler::subscribe(CONTEXT_TRIGGER_SUBJECT_ENABLE, &jrule_id, &req_id, NULL);
+       int error = __dbusClient.subscribe(CONTEXT_TRIGGER_SUBJECT_ENABLE, jrule_id, &req_id, NULL);
 
        if (error == ERR_NO_DATA) {
                return CONTEXT_TRIGGER_ERROR_RULE_NOT_EXIST;
@@ -145,7 +147,7 @@ SO_EXPORT int context_trigger_disable_rule(int rule_id)
 
        ctx::Json jrule_id;
        jrule_id.set(NULL, CT_RULE_ID, rule_id);
-       int error = ctx::request_handler::write_with_reply(CONTEXT_TRIGGER_SUBJECT_DISABLE, &jrule_id, NULL);
+       int error = __dbusClient.write(CONTEXT_TRIGGER_SUBJECT_DISABLE, jrule_id, NULL);
 
        if (error == ERR_NO_DATA) {
                return CONTEXT_TRIGGER_ERROR_RULE_NOT_EXIST;
@@ -161,7 +163,7 @@ SO_EXPORT int context_trigger_get_own_rule_ids(int** enabled_rule_ids, int* enab
 
        int req_id;
        ctx::Json data_read;
-       int error = ctx::request_handler::read_sync(CONTEXT_TRIGGER_SUBJECT_GET_RULE_IDS, NULL, &req_id, &data_read);
+       int error = __dbusClient.readSync(CONTEXT_TRIGGER_SUBJECT_GET_RULE_IDS, NULL, &req_id, &data_read);
 
        if (error != ERR_NONE) {
                return error;
@@ -212,7 +214,7 @@ SO_EXPORT int context_trigger_get_rule_by_id(int rule_id, context_trigger_rule_h
 
        int req_id;
        ctx::Json data_read;
-       int error = ctx::request_handler::read_sync(CONTEXT_TRIGGER_SUBJECT_GET, &option, &req_id, &data_read);
+       int error = __dbusClient.readSync(CONTEXT_TRIGGER_SUBJECT_GET, option, &req_id, &data_read);
 
        if (error == ERR_NO_DATA) {
                return CONTEXT_TRIGGER_ERROR_RULE_NOT_EXIST;
@@ -352,11 +354,11 @@ SO_EXPORT int context_trigger_rule_set_action_app_control(context_trigger_rule_h
        int error;
 
        // Privilege check
-       error = ctx::request_handler::call(METHOD_CHK_PRIV_APPLAUNCH);
+       error = __dbusClient.call(METHOD_CHK_PRIV_APPLAUNCH);
        IF_FAIL_RETURN_TAG(error == ERR_NONE, error, _E, "Privilege checking failed (%#x)", error);
 
        if (is_call_operation(app_control)) {
-               error = ctx::request_handler::call(METHOD_CHK_PRIV_CALL);
+               error = __dbusClient.call(METHOD_CHK_PRIV_CALL);
                IF_FAIL_RETURN_TAG(error == ERR_NONE, error, _E, "Privilege checking failed (%#x)", error);
        }
 
@@ -414,7 +416,7 @@ SO_EXPORT int context_trigger_rule_set_action_notification(context_trigger_rule_
        ASSERT_NOT_NULL(rule && title && content);
 
        // Privilege check
-       int error = ctx::request_handler::call(METHOD_CHK_PRIV_NOTIFICATION);
+       int error = __dbusClient.call(METHOD_CHK_PRIV_NOTIFICATION);
        IF_FAIL_RETURN_TAG(error == ERR_NONE, error, _E, "Privilege checking failed (%#x)", error);
 
        // if action arleady exists
@@ -582,7 +584,7 @@ SO_EXPORT int context_trigger_rule_event_is_supported(context_trigger_event_e ev
                return CONTEXT_TRIGGER_ERROR_INVALID_PARAMETER;
        }
 
-       int error = ctx::request_handler::is_supported(eitem_str.c_str());
+       int error = __dbusClient.isSupported(eitem_str);
 
        if (error == ERR_NONE)
                *supported = true;
@@ -657,7 +659,7 @@ SO_EXPORT int context_trigger_rule_condition_is_supported(context_trigger_condit
                return CONTEXT_TRIGGER_ERROR_INVALID_PARAMETER;
        }
 
-       int error = ctx::request_handler::is_supported(citem_str.c_str());
+       int error = __dbusClient.isSupported(citem_str);
 
        if (error == ERR_NONE)
                *supported = true;
@@ -929,7 +931,7 @@ SO_EXPORT int context_trigger_add_custom_item(const char* name, const char* attr
        data.set(NULL, CT_CUSTOM_NAME, name);
        data.set(NULL, CT_CUSTOM_ATTRIBUTES, jattr_template);
 
-       int error = ctx::request_handler::write_with_reply(CONTEXT_TRIGGER_SUBJECT_CUSTOM_ADD, &data, NULL);
+       int error = __dbusClient.write(CONTEXT_TRIGGER_SUBJECT_CUSTOM_ADD, data, NULL);
        IF_FAIL_RETURN_TAG(error == ERR_NONE, error, _E, "Failed to add custom item: %#x", error);
 
        return error;
@@ -944,7 +946,7 @@ SO_EXPORT int context_trigger_remove_custom_item(const char* name)
        data.set(NULL, CT_CUSTOM_NAME, name);
 
        ctx::Json subj;
-       int error = ctx::request_handler::write_with_reply(CONTEXT_TRIGGER_SUBJECT_CUSTOM_REMOVE, &data, &subj);
+       int error = __dbusClient.write(CONTEXT_TRIGGER_SUBJECT_CUSTOM_REMOVE, data, &subj);
        IF_FAIL_RETURN_TAG(error == ERR_NONE, error, _E, "Failed to remove custom item: %#x", error);
 
        std::string subject;
@@ -967,7 +969,7 @@ SO_EXPORT int context_trigger_publish_custom_item(const char* name, const char*
        data.set(NULL, CT_CUSTOM_NAME, name);
        data.set(NULL, CT_CUSTOM_FACT, jfact);
 
-       int error = ctx::request_handler::write_with_reply(CONTEXT_TRIGGER_SUBJECT_CUSTOM_PUBLISH, &data, NULL);
+       int error = __dbusClient.write(CONTEXT_TRIGGER_SUBJECT_CUSTOM_PUBLISH, data, NULL);
        IF_FAIL_RETURN_TAG(error == ERR_NONE, error, _E, "Failed to publish custom data");
 
        return error;
diff --git a/src/request_handler.cpp b/src/request_handler.cpp
deleted file mode 100644 (file)
index b827d98..0000000
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/* TODO: Remove this request_handler. All APIs and the testsuite should use DBusClient directly. */
-
-#include <string>
-#include <map>
-
-#include <Types.h>
-#include <ScopeMutex.h>
-#include "DBusClient.h"
-#include "request_handler.h"
-
-using namespace ctx;
-
-class DBusClientListenerImpl : public IDBusClientListener {
-public:
-       DBusClientListenerImpl() {}
-       ~DBusClientListenerImpl() {}
-       void setCb(std::string subject, request_handler::subject_response_cb cb);
-       void onPublish(std::string subject, int reqId, int error, Json event);
-private:
-       std::map<std::string, request_handler::subject_response_cb> __callbackMap;
-};
-
-void DBusClientListenerImpl::setCb(std::string subject, request_handler::subject_response_cb cb)
-{
-       __callbackMap[subject] = cb;
-}
-
-void DBusClientListenerImpl::onPublish(std::string subject, int reqId, int error, Json event)
-{
-       auto it = __callbackMap.find(subject);
-       IF_FAIL_VOID_TAG(it != __callbackMap.end(), _W, "Unregistered subject");
-       it->second(subject.c_str(), reqId, error, event);
-}
-
-static DBusClientListenerImpl __dbusListener;
-static DBusClient __dbusClient;
-
-SO_EXPORT int ctx::request_handler::subscribe(const char* subject, ctx::Json* option, int* req_id, ctx::Json* request_result)
-{
-       return __dbusClient.subscribe(subject, option ? *option : NULL, req_id, request_result);
-}
-
-SO_EXPORT int ctx::request_handler::unsubscribe(const char* subject, int req_id)
-{
-       return __dbusClient.unsubscribe(subject, req_id);
-}
-
-SO_EXPORT int ctx::request_handler::read(const char* subject, ctx::Json* option, int* req_id, ctx::Json* request_result)
-{
-       return __dbusClient.read(subject, option ? *option : NULL, req_id, request_result);
-}
-
-SO_EXPORT int ctx::request_handler::read_sync(const char* subject, ctx::Json* option, int* req_id, ctx::Json* data_read)
-{
-       return __dbusClient.readSync(subject, option ? *option : NULL, req_id, data_read);
-}
-
-SO_EXPORT int ctx::request_handler::write(const char* subject, ctx::Json* data)
-{
-       return __dbusClient.write(subject, *data);
-}
-
-SO_EXPORT int ctx::request_handler::write_with_reply(const char* subject, ctx::Json* data, ctx::Json* request_result)
-{
-       return __dbusClient.write(subject, *data, request_result);
-}
-
-SO_EXPORT int ctx::request_handler::is_supported(const char* subject)
-{
-       return __dbusClient.isSupported(subject);
-}
-
-SO_EXPORT int ctx::request_handler::call(const char* method)
-{
-       return __dbusClient.call(method);
-}
-
-SO_EXPORT bool ctx::request_handler::register_callback(const char* subject, subject_response_cb callback)
-{
-       __dbusListener.setCb(subject, callback);
-       __dbusClient.addListener(subject, &__dbusListener);
-       return true;
-}
diff --git a/src/request_handler.h b/src/request_handler.h
deleted file mode 100644 (file)
index 3d7fa41..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __CONTEXT_LIB_REQUEST_HANDLER_H__
-#define __CONTEXT_LIB_REQUEST_HANDLER_H__
-
-#include <Json.h>
-
-namespace ctx { namespace request_handler {
-
-       /*
-        */
-       typedef void(* subject_response_cb)(const char* subject, int req_id, int error, ctx::Json response);
-
-       /*
-        */
-       bool register_callback(const char* subject, subject_response_cb callback);
-
-       /*
-        */
-       int subscribe(const char* subject, ctx::Json* option, int* req_id, ctx::Json* request_result = NULL);
-
-       /*
-        */
-       int unsubscribe(const char* subject, int req_id);
-
-       /*
-        */
-       int read(const char* subject, ctx::Json* option, int* req_id, ctx::Json* request_result = NULL);
-
-       /*
-        */
-       int read_sync(const char* subject, ctx::Json* option, int* req_id, ctx::Json* data_read);
-
-       /*
-        */
-       int write(const char* subject, ctx::Json* data);
-
-       /*
-        */
-       int write_with_reply(const char* subject, ctx::Json* data, ctx::Json* request_result = NULL);
-
-       /*
-        */
-       int is_supported(const char* subject);
-
-       int call(const char* method);
-
-} }    /* namespace ctx::request_handler */
-
-#endif // __CONTEXT_LIB_REQUEST_HANDLER_H__
index 09aa8338f6224cf70a8d39fdb43ad2869e098c2f..dfee6fe050fcdca54b7bfc1b808a3aa7daf813e1 100644 (file)
@@ -20,7 +20,7 @@
 #include <Types.h>
 #include <context_trigger.h>
 #include <context_trigger_types_internal.h>
-#include "request_handler.h"
+#include "DBusClient.h"
 #include "rule_validator.h"
 
 #define KEY_TEMPLATE "templates"
@@ -72,7 +72,8 @@ int ctx::rule_validator::request_template(std::string name, bool mandatory)
 
        int req_id;
        ctx::Json tmpl;
-       int error = ctx::request_handler::read_sync(CONTEXT_TRIGGER_SUBJECT_GET_TEMPLATE, &request, &req_id, &tmpl);
+       ctx::DBusClient dbusClient;
+       int error = dbusClient.readSync(CONTEXT_TRIGGER_SUBJECT_GET_TEMPLATE, request, &req_id, &tmpl);
        if (error == ERR_NOT_SUPPORTED) {
                template_map.erase(name);
                _E("Failed to get request: not supported");
index 30e85d2fb4edc69f7a09fe705cbcfc8f5962f7e6..514be5f374cf2c45106ce5a1d7dd31cc7b41be73 100644 (file)
@@ -4,6 +4,7 @@ SET(TEST_EXEC context-test)
 
 # Source List
 FILE(GLOB_RECURSE TEST_SRCS src/*.cpp)
+SET(TEST_SRCS ${TEST_SRCS} ../src/DBusClient.cpp)
 INCLUDE_DIRECTORIES(
        ${CMAKE_SOURCE_DIR}/src
 )
index 4cadf474a254156ff789e8ad7b14ed96204250ac..5ee470f344bdf3c389155322c6bfce7868c8acb7 100644 (file)
  * limitations under the License.
  */
 
-#include <request_handler.h>
 #include <context_trigger.h>
 #include <context_trigger_types_internal.h>
 #include <context_history.h>
 
 #include "../shared.h"
+#include "request_handler.h"
 #include "condition.h"
 
 using namespace ctx::test;
index 9d843c81f596149f3b8476d6c7acc22aec39bffb..0dee837077da26cec131e07ec14e82218c35d1d0 100644 (file)
  */
 
 #include <time.h>
-#include <request_handler.h>
 #include <context_trigger.h>
 #include <context_trigger_types_internal.h>
 
 #include "../shared.h"
+#include "request_handler.h"
 #include "event.h"
 
 using namespace ctx::test;
diff --git a/testsuite/src/trigger/request_handler.cpp b/testsuite/src/trigger/request_handler.cpp
new file mode 100644 (file)
index 0000000..6969aff
--- /dev/null
@@ -0,0 +1,99 @@
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* TODO: Remove this request_handler. All APIs and the testsuite should use DBusClient directly. */
+
+#include <string>
+#include <map>
+
+#include <Types.h>
+#include <ScopeMutex.h>
+#include <DBusClient.h>
+#include "request_handler.h"
+
+using namespace ctx;
+
+class DBusClientListenerImpl : public IDBusClientListener {
+public:
+       DBusClientListenerImpl() {}
+       ~DBusClientListenerImpl() {}
+       void setCb(std::string subject, request_handler::subject_response_cb cb);
+       void onPublish(std::string subject, int reqId, int error, Json event);
+private:
+       std::map<std::string, request_handler::subject_response_cb> __callbackMap;
+};
+
+void DBusClientListenerImpl::setCb(std::string subject, request_handler::subject_response_cb cb)
+{
+       __callbackMap[subject] = cb;
+}
+
+void DBusClientListenerImpl::onPublish(std::string subject, int reqId, int error, Json event)
+{
+       auto it = __callbackMap.find(subject);
+       IF_FAIL_VOID_TAG(it != __callbackMap.end(), _W, "Unregistered subject");
+       it->second(subject.c_str(), reqId, error, event);
+}
+
+static DBusClientListenerImpl __dbusListener;
+static DBusClient __dbusClient;
+
+int ctx::request_handler::subscribe(const char* subject, ctx::Json* option, int* req_id, ctx::Json* request_result)
+{
+       return __dbusClient.subscribe(subject, option ? *option : NULL, req_id, request_result);
+}
+
+int ctx::request_handler::unsubscribe(const char* subject, int req_id)
+{
+       return __dbusClient.unsubscribe(subject, req_id);
+}
+
+int ctx::request_handler::read(const char* subject, ctx::Json* option, int* req_id, ctx::Json* request_result)
+{
+       return __dbusClient.read(subject, option ? *option : NULL, req_id, request_result);
+}
+
+int ctx::request_handler::read_sync(const char* subject, ctx::Json* option, int* req_id, ctx::Json* data_read)
+{
+       return __dbusClient.readSync(subject, option ? *option : NULL, req_id, data_read);
+}
+
+int ctx::request_handler::write(const char* subject, ctx::Json* data)
+{
+       return __dbusClient.write(subject, *data);
+}
+
+int ctx::request_handler::write_with_reply(const char* subject, ctx::Json* data, ctx::Json* request_result)
+{
+       return __dbusClient.write(subject, *data, request_result);
+}
+
+int ctx::request_handler::is_supported(const char* subject)
+{
+       return __dbusClient.isSupported(subject);
+}
+
+int ctx::request_handler::call(const char* method)
+{
+       return __dbusClient.call(method);
+}
+
+bool ctx::request_handler::register_callback(const char* subject, subject_response_cb callback)
+{
+       __dbusListener.setCb(subject, callback);
+       __dbusClient.addListener(subject, &__dbusListener);
+       return true;
+}
diff --git a/testsuite/src/trigger/request_handler.h b/testsuite/src/trigger/request_handler.h
new file mode 100644 (file)
index 0000000..3d7fa41
--- /dev/null
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __CONTEXT_LIB_REQUEST_HANDLER_H__
+#define __CONTEXT_LIB_REQUEST_HANDLER_H__
+
+#include <Json.h>
+
+namespace ctx { namespace request_handler {
+
+       /*
+        */
+       typedef void(* subject_response_cb)(const char* subject, int req_id, int error, ctx::Json response);
+
+       /*
+        */
+       bool register_callback(const char* subject, subject_response_cb callback);
+
+       /*
+        */
+       int subscribe(const char* subject, ctx::Json* option, int* req_id, ctx::Json* request_result = NULL);
+
+       /*
+        */
+       int unsubscribe(const char* subject, int req_id);
+
+       /*
+        */
+       int read(const char* subject, ctx::Json* option, int* req_id, ctx::Json* request_result = NULL);
+
+       /*
+        */
+       int read_sync(const char* subject, ctx::Json* option, int* req_id, ctx::Json* data_read);
+
+       /*
+        */
+       int write(const char* subject, ctx::Json* data);
+
+       /*
+        */
+       int write_with_reply(const char* subject, ctx::Json* data, ctx::Json* request_result = NULL);
+
+       /*
+        */
+       int is_supported(const char* subject);
+
+       int call(const char* method);
+
+} }    /* namespace ctx::request_handler */
+
+#endif // __CONTEXT_LIB_REQUEST_HANDLER_H__