2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the License);
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an AS IS BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
23 #include <sys/types.h>
24 #include <sys/socket.h>
26 #include <netinet/in.h>
27 #include <arpa/inet.h>
28 #include <glib-object.h>
29 #include <glib-unix.h>
31 #include "service-adaptor.h"
32 #include "service-adaptor-auth.h"
33 #include "service-adaptor-contact.h"
34 #include "service-adaptor-message.h"
35 #include "service-adaptor-shop.h"
36 #include "service-adaptor-storage.h"
37 #include "service-adaptor-push.h"
38 #include "service-adaptor-plugin.h"
39 #include "service-adaptor-type.h"
40 #include "service-adaptor-log.h"
42 #include "dbus-server.h"
43 #include "dbus-service-adaptor.h"
44 #include "util/client_checker.h"
45 #include "util/ping_manager.h"
49 service_adaptor_h g_service_adaptor = (void *) NULL;
51 static char *safe_strdup(const char *str)
60 static void safe_free(void **ptrptr)
62 if (ptrptr != NULL && *ptrptr != NULL) {
68 /******************************************************************************
69 * Global variables and defines
70 ******************************************************************************/
72 static GMainLoop *g_default_loop = NULL;
74 /******************************************************************************
76 ******************************************************************************/
78 #define __init_context_info_s(x) do { \
81 (x).service_id = 0U; \
85 (x).access_token = NULL; \
86 (x).refresh_token = NULL; \
87 (x).property = NULL; \
91 /******************************************************************************
92 * Private interface definition
93 ******************************************************************************/
95 /******************************************************************************
96 * Public interface definition
97 ******************************************************************************/
99 service_adaptor_h service_adaptor_get_handle()
101 service_adaptor_debug("Get adaptor handle");
103 return g_service_adaptor;
106 void debug_service_context(GList *service_list)
108 #ifdef SERVICE_ADAPTOR_DEBUG_CONTEXT
109 if (NULL == service_list) {
113 int service_count = g_list_length(service_list);
115 for (int i = 0; i < service_count; i++) {
116 service_adaptor_service_context_h service = g_list_nth_data(service_list, i);
118 service_adaptor_debug_func("[CONTEXT_DEBUG] ============ index %d =============", i);
120 service_adaptor_debug_func("[CONTEXT_DEBUG] service_name(%s)", service->service_name);
121 service_adaptor_debug_func("[CONTEXT_DEBUG] plugin_uri (%s)", service->plugin_uri);
122 service_adaptor_debug_func("[CONTEXT_DEBUG] ctx [auth(%p) contact(%p) storage(%p) message(%p) push(%p) shop(%p)]",
123 service->auth_context, service->contact_context, service->storage_context,
124 service->message_context, service->push_context, service->shop_context);
125 service_adaptor_debug_func("[CONTEXT_DEBUG] server_info (%p)", service->server_info);
126 service_adaptor_debug_func("[CONTEXT_DEBUG] connected (%d)", (int)service->connected);
127 service_adaptor_debug_func("[CONTEXT_DEBUG]==========================================");
133 static void __glog_handler_cb(const gchar *log_domain,
134 GLogLevelFlags log_level,
135 const gchar *message,
138 service_adaptor_error("============================================================");
139 service_adaptor_error("============================================================");
140 service_adaptor_error("================== Critical GLib Error =====================");
141 service_adaptor_error("============================================================");
142 service_adaptor_error("============================================================");
143 service_adaptor_error("=== Log Domain : %s", log_domain);
144 service_adaptor_error("=== Level : %d", (int)log_level);
145 service_adaptor_error("=== Message : %s", message);
146 service_adaptor_error("============================================================");
147 service_adaptor_error("============================================================");
150 static void glog_handler_init()
152 service_adaptor_info("glib log handler init : %d",
153 (int)g_log_set_handler("GLib", G_LOG_LEVEL_CRITICAL, __glog_handler_cb, NULL));
156 service_adaptor_service_context_h service_adaptor_get_service_context(service_adaptor_h service_adaptor,
157 const char *service_name)
160 service_adaptor_debug("Get service context");
162 if ((NULL == service_adaptor) || (NULL == service_name)) {
163 service_adaptor_error("Invalid argument");
167 int service_count = g_list_length(service_adaptor->service_list);
168 /* debug_service_context(service_adaptor->service_list); */
170 for (int i = 0; i < service_count; i++) {
171 service_adaptor_service_context_h service = g_list_nth_data(service_adaptor->service_list, i);
173 if ((NULL != service) && (0 == strncmp(service->service_name, service_name, strlen(service_name)))) {
178 service_adaptor_warning("First time connected : service_name(%s)", service_name);
184 GList *service_adaptor_get_services_by_plugin_uri(service_adaptor_h service_adaptor,
185 const char *plugin_uri)
188 service_adaptor_debug("Get service context");
190 if (NULL == service_adaptor) {
191 service_adaptor_error("Invalid argument");
195 GList *service_list = NULL;
196 int service_count = g_list_length(service_adaptor->service_list);
197 service_adaptor_debug("service count : %d", service_count);
199 for (int i = 0; i < service_count; i++) {
200 service_adaptor_service_context_h service = g_list_nth_data(service_adaptor->service_list, i);
201 if (NULL != service) {
202 service_adaptor_debug("service name : %s", service->service_name);
205 if ((NULL != service) && (0 == strncmp(service->plugin_uri, plugin_uri, strlen(plugin_uri)))) {
206 service_list = g_list_append(service_list, service);
210 if (NULL == service_list) {
211 service_adaptor_info("Could not get service context with plugin_uri(%s)", plugin_uri);
218 service_adaptor_internal_error_code_e service_adaptor_bind_storage_context(service_adaptor_h service_adaptor,
219 service_adaptor_service_context_h service_src,
220 service_adaptor_service_context_h service_dst)
223 service_adaptor_debug("START");
225 if ((NULL == service_adaptor) || (NULL == service_src) || (NULL == service_dst)) {
226 service_adaptor_error("Invalid parameter");
227 return SERVICE_ADAPTOR_INTERNAL_ERROR_INVALID_ARGUMENT;
230 storage_adaptor_plugin_h plugin = storage_adaptor_get_plugin_by_name(service_adaptor->storage_handle, service_dst->plugin_uri);
231 if (NULL != service_dst->storage_context) {
232 storage_adaptor_destroy_plugin_context(plugin, service_dst->storage_context);
235 service_dst->storage_context = service_src->storage_context;
237 service_adaptor_debug("END");
240 return SERVICE_ADAPTOR_INTERNAL_ERROR_NONE;
243 service_adaptor_internal_error_code_e service_adaptor_bind_push_context(service_adaptor_h service_adaptor,
244 service_adaptor_service_context_h service_src,
245 service_adaptor_service_context_h service_dst)
248 service_adaptor_debug("START");
250 if ((NULL == service_adaptor) || (NULL == service_src) || (NULL == service_dst)) {
251 service_adaptor_error("Invalid parameter");
252 return SERVICE_ADAPTOR_INTERNAL_ERROR_INVALID_ARGUMENT;
255 /*push_adaptor_plugin_h plugin = push_adaptor_get_plugin_by_name(service_adaptor->push_handle, service_dst->plugin_uri);*/
256 if (NULL != service_dst->push_context) {
257 service_dst->push_context = NULL;
260 service_dst->push_context = service_src->push_context;
262 service_adaptor_debug("END");
265 return SERVICE_ADAPTOR_INTERNAL_ERROR_NONE;
268 service_adaptor_internal_error_code_e service_adaptor_bind_context(service_adaptor_h service_adaptor,
269 service_adaptor_service_context_h service_src,
270 service_adaptor_service_context_h service_dst)
273 service_adaptor_debug("START");
275 if ((NULL == service_adaptor) || (NULL == service_src) || (NULL == service_dst)) {
276 service_adaptor_error("Invalid parameter");
277 return SERVICE_ADAPTOR_INTERNAL_ERROR_INVALID_ARGUMENT;
280 if (NULL == service_dst->auth_context) {
281 service_dst->auth_context = service_src->auth_context;
284 if (NULL == service_dst->contact_context) {
285 service_dst->contact_context = service_src->contact_context;
288 if (NULL == service_dst->message_context) {
289 service_dst->message_context = service_src->message_context;
292 if (NULL == service_dst->shop_context) {
293 service_dst->shop_context = service_src->shop_context;
296 if (NULL == service_dst->storage_context) {
297 service_dst->storage_context = service_src->storage_context;
300 if (NULL == service_dst->push_context) {
301 service_dst->push_context = service_src->push_context;
304 service_adaptor_debug("END");
307 return SERVICE_ADAPTOR_INTERNAL_ERROR_NONE;
311 * @brief Check service_context is binded
312 * @param[in] service_adaptor specifies Service-adaptor handle
313 * @param[in] app_id specifies app_id
314 * @param[in] service_id specifies service_id
315 * @return count of context, otherwise a negative error value
317 int service_adaptor_is_service_binded(service_adaptor_h service_adaptor,
318 const char *service_package_id)
321 if ((NULL == service_adaptor) || (NULL == service_package_id)) {
325 if ((NULL == service_adaptor->service_list) || (0 >= g_list_length(service_adaptor->service_list))) {
330 char *temp_service_name;
331 for (list = g_list_first(service_adaptor->service_list); NULL != list; list = g_list_next(list)) {
332 if (NULL != list->data) {
333 temp_service_name = ((service_adaptor_service_context_h) list->data)->service_name;
334 if ((NULL != temp_service_name)) {
335 if (0 == strcmp(temp_service_name, service_package_id)) {
345 service_adaptor_internal_error_code_e service_adaptor_connect(service_adaptor_h service_adaptor,
346 service_adaptor_context_info_s *context_info,
347 const char *service_name,
348 const char *plugin_uri,
349 const char *user_password,
350 const char *app_secret,
360 service_adaptor_debug("Connect to adaptors: %s", plugin_uri);
362 if ((NULL == service_adaptor) || (NULL == context_info) || (NULL == service_name)
363 || (NULL == plugin_uri)) {
364 service_adaptor_error("Invalid parameter");
365 return SERVICE_ADAPTOR_INTERNAL_ERROR_INVALID_ARGUMENT;
368 service_adaptor_service_context_h service =
369 service_adaptor_get_service_context(service_adaptor, service_name);
371 if (NULL != service) {
372 service_adaptor_info("Already connected to adaptors: %s", service_name);
373 return SERVICE_ADAPTOR_INTERNAL_ERROR_NONE;
375 service_adaptor_debug("Create service_context_h");
376 service = (service_adaptor_service_context_h) calloc(1, sizeof(service_adaptor_service_context_s));
377 service_adaptor_context_info_s *_context_info =
378 (service_adaptor_context_info_s *) calloc(1, sizeof(service_adaptor_context_info_s));
380 if ((NULL == service) || (NULL == _context_info)) {
381 service_adaptor_error("Critical : Memory allocation failed");
384 snprintf(ret_msg, 2048, "Critical : There is no memory remained");
385 return SERVICE_ADAPTOR_INTERNAL_ERROR_ADAPTOR_INTERNAL;
388 g_mutex_init(&service->service_context_mutex);
389 g_cond_init(&service->service_context_cond);
391 service->auth_context = NULL;
392 service->contact_context = NULL;
393 service->message_context = NULL;
394 service->shop_context = NULL;
395 service->push_context = NULL;
396 service->storage_context = NULL;
398 service->service_name = safe_strdup(service_name);
399 service->plugin_uri = safe_strdup(plugin_uri);
401 service->context_info = _context_info;
403 service->context_info->user_id = safe_strdup(context_info->user_id);
404 service->context_info->app_id = safe_strdup(context_info->app_id);
405 service->context_info->imsi = safe_strdup(context_info->imsi);
406 service->context_info->service_id = context_info->service_id;
407 service->context_info->property = context_info->property; /* Not dup */
408 context_info->property = NULL;
410 service->connected = 0x0000000;
414 /* 1) Connect to AUTH PLUGIN */
415 int ret = SERVICE_ADAPTOR_INTERNAL_ERROR_NONE;
416 int last_res = SERVICE_ADAPTOR_INTERNAL_ERROR_NONE;
420 ret += (last_res = service_adaptor_connect_auth_plugin(service_adaptor, service->context_info, service_name,
421 plugin_uri, user_password, app_secret, &service, ret_msg));
423 if ((SERVICE_ADAPTOR_INTERNAL_ERROR_NONE != ret) || (NULL == service)) {
424 service_adaptor_error("Could not connect to auth plugin: %d", ret);
425 goto CONNECT_API_CHECK_RESULT;
429 /* 2) Connect to CONTACT PLUGIN */
430 if (contact_enable) {
432 ret += (last_res = service_adaptor_connect_contact_plugin(service_adaptor, service, ret_msg));
434 if (SERVICE_ADAPTOR_INTERNAL_ERROR_NONE != ret) {
435 service_adaptor_warning("Could not connect to contact plugin: %d", ret);
436 goto CONNECT_API_CHECK_RESULT;
440 /* 3) Connect to MESSAGE PLUGIN */
441 if (message_enable) {
443 ret += (last_res = service_adaptor_connect_message_plugin(service_adaptor, service, ret_msg));
445 if (SERVICE_ADAPTOR_INTERNAL_ERROR_NONE != ret) {
446 service_adaptor_warning("Could not connect to message plugin: %d", ret);
447 goto CONNECT_API_CHECK_RESULT;
451 /* 4) Connect to SHOP PLUGIN */
454 ret += (last_res = service_adaptor_connect_shop_plugin(service_adaptor, service, ret_msg));
456 if (SERVICE_ADAPTOR_INTERNAL_ERROR_NONE != ret) {
457 service_adaptor_warning("Could not connect to shop plugin: %d", ret);
458 goto CONNECT_API_CHECK_RESULT;
462 /* 5) Connect to STORAGE PLUGIN */
463 if (storage_enable) {
465 ret += (last_res = service_adaptor_connect_storage_plugin(service_adaptor, service, app_secret, ret_msg));
467 if (SERVICE_ADAPTOR_INTERNAL_ERROR_NONE != ret) {
468 service_adaptor_warning("Could not connect to storage plugin: %d", ret);
469 goto CONNECT_API_CHECK_RESULT;
473 /* 6) Connect to PUSH PLUGIN */
476 ret += (last_res = service_adaptor_connect_push_plugin(service_adaptor, service, ret_msg));
478 if (SERVICE_ADAPTOR_INTERNAL_ERROR_NONE != ret) {
479 service_adaptor_warning("Could not connect to push plugin: %d", ret);
480 goto CONNECT_API_CHECK_RESULT;
484 CONNECT_API_CHECK_RESULT:
485 if (ret || (0 == service->connected)) {
486 service_adaptor_warning("Plugin Connect failed : ret(%d) connected(%d)", ret, service->connected);
487 service_adaptor_warning("<service_name : %s>", service_name);
489 g_mutex_clear(&service->service_context_mutex);
490 g_cond_clear(&service->service_context_cond);
492 free(service->context_info->user_id);
493 free(service->context_info->app_id);
494 free(service->context_info->imsi);
496 free(service->context_info);
498 free(service->service_name);
499 free(service->plugin_uri);
507 service_adaptor->service_list = g_list_append(service_adaptor->service_list, service);
509 service_adaptor_debug_func("Connect success <service_name : %s>", service_name);
510 debug_service_context(service_adaptor->service_list);
512 return SERVICE_ADAPTOR_INTERNAL_ERROR_NONE;
515 service_adaptor_internal_error_code_e service_adaptor_disconnect(service_adaptor_h service_adaptor,
516 const char *service_name)
519 service_adaptor_debug("Disconnects adaptor contexts");
521 service_adaptor_service_context_h service = NULL;
522 while (NULL != (service = service_adaptor_get_service_context(service_adaptor, service_name))) {
524 if (NULL == service) {
525 service_adaptor_debug("service context already released");
526 return SERVICE_ADAPTOR_INTERNAL_ERROR_NONE;
529 service_adaptor_internal_error_code_e ret = SERVICE_ADAPTOR_INTERNAL_ERROR_NONE;
530 ret = service_adaptor_disconnect_message_plugin(service_adaptor, service);
531 service_adaptor_debug("Disconnected message (%d)", ret);
533 ret = service_adaptor_disconnect_contact_plugin(service_adaptor, service);
534 service_adaptor_debug("Disconnected contact (%d)", ret);
536 ret = service_adaptor_disconnect_shop_plugin(service_adaptor, service);
537 service_adaptor_debug("Disconnected shop (%d)", ret);
539 ret = service_adaptor_disconnect_storage_plugin(service_adaptor, service);
540 service_adaptor_debug("Disconnected storage (%d)", ret);
542 ret = service_adaptor_disconnect_push_plugin(service_adaptor, service);
543 service_adaptor_debug("Disconnected push (%d)", ret);
545 ret = service_adaptor_disconnect_auth_plugin(service_adaptor, service);
546 service_adaptor_debug("Disconnected auth (%d)", ret);
548 if ((NULL != service) && (NULL != service->server_info)) {
549 g_hash_table_destroy(service->server_info);
552 service_adaptor_debug_func("Clears mutex & cond");
553 g_mutex_clear(&service->service_context_mutex);
554 g_cond_clear(&service->service_context_cond);
556 free(service->service_name);
557 free(service->plugin_uri);
559 service_adaptor_debug_func("Clears context info");
560 if (NULL != (service->context_info)) {
561 free(service->context_info->user_id);
562 free(service->context_info->app_id);
563 free(service->context_info->imsi);
564 free(service->context_info->duid);
565 free(service->context_info->msisdn);
566 free(service->context_info->access_token);
567 free(service->context_info->refresh_token);
568 if (service->context_info->property) {
569 bundle_free((bundle *)(service->context_info->property));
572 free(service->context_info);
574 service_adaptor_debug_func("Removes from service list");
575 service_adaptor->service_list = g_list_remove(service_adaptor->service_list, service);
579 service_adaptor_debug("Disconnected from adaptors");
582 return SERVICE_ADAPTOR_INTERNAL_ERROR_NONE;
586 service_adaptor_internal_error_code_e service_adaptor_start(service_adaptor_h service_adaptor)
589 service_adaptor_debug("Service Adaptor: Start");
591 if (NULL == service_adaptor) {
592 service_adaptor_error("Invalid argument");
593 return SERVICE_ADAPTOR_INTERNAL_ERROR_INVALID_ARGUMENT;
596 int ret = auth_adaptor_start(service_adaptor->auth_handle);
598 if (AUTH_ADAPTOR_ERROR_NONE != ret) {
599 service_adaptor_error("Could not start auth adaptor");
600 service_adaptor_info("Auth-adaptor is mandatory");
601 /* return SERVICE_ADAPTOR_INTERNAL_ERROR_LAUNCH; */
604 service_adaptor_debug("Auth Adaptor: Started");
606 ret = contact_adaptor_start(service_adaptor->contact_handle);
608 if (CONTACT_ADAPTOR_ERROR_NONE != ret) {
609 service_adaptor_warning("Could not start contact adaptor");
610 /* return SERVICE_ADAPTOR_INTERNAL_ERROR_LAUNCH; */
613 service_adaptor_debug("Contact Adaptor: Started");
615 ret = message_adaptor_start(service_adaptor->message_handle);
617 if (MESSAGE_ADAPTOR_ERROR_NONE != ret) {
618 service_adaptor_warning("Could not start message adaptor");
619 /* return SERVICE_ADAPTOR_INTERNAL_ERROR_LAUNCH; */
622 service_adaptor_debug("Message Adaptor: Started");
624 ret = shop_adaptor_start(service_adaptor->shop_handle);
626 if (SHOP_ADAPTOR_ERROR_NONE != ret) {
627 service_adaptor_warning("Could not start shop adaptor");
628 /* return SERVICE_ADAPTOR_INTERNAL_ERROR_LAUNCH; */
631 service_adaptor_debug("Shop Adaptor: Started");
633 ret = storage_adaptor_start(service_adaptor->storage_handle);
635 if (STORAGE_ADAPTOR_ERROR_NONE != ret) {
636 service_adaptor_warning("Could not start storage adaptor");
637 /* return SERVICE_ADAPTOR_INTERNAL_ERROR_LAUNCH; */
640 service_adaptor_debug("Storage Adaptor: Started");
642 ret = push_adaptor_start(service_adaptor->push_handle);
644 if (PUSH_ADAPTOR_ERROR_NONE != ret) {
645 service_adaptor_warning("Could not start push adaptor");
646 /* return SERVICE_ADAPTOR_INTERNAL_ERROR_LAUNCH; */
649 service_adaptor_debug("Push Adaptor: Started");
651 ret = service_adaptor_scan_all_packages_async(service_adaptor);
652 service_adaptor_debug("Scan all packages ret(%d)", ret);
654 ret = service_adaptor_set_package_installed_callback(service_adaptor);
655 service_adaptor_debug("Sets package installed callback ret(%d)", ret);
657 g_mutex_lock(&service_adaptor->service_adaptor_mutex);
658 service_adaptor->started = 1;
659 g_cond_signal(&service_adaptor->service_adaptor_cond);
660 g_mutex_unlock(&service_adaptor->service_adaptor_mutex);
663 return SERVICE_ADAPTOR_INTERNAL_ERROR_NONE;
666 service_adaptor_internal_error_code_e service_adaptor_stop(service_adaptor_h service_adaptor)
669 service_adaptor_debug("Service Adaptor: Stop");
671 if (NULL == service_adaptor) {
672 service_adaptor_error("Invalid argument");
673 return SERVICE_ADAPTOR_INTERNAL_ERROR_INVALID_ARGUMENT;
676 if (0 <= service_adaptor->started) {
677 service_adaptor_error("Service Adaptor is not running");
678 return SERVICE_ADAPTOR_INTERNAL_ERROR_START;
682 int ret = auth_adaptor_stop(service_adaptor->auth_handle);
683 ret += contact_adaptor_stop(service_adaptor->contact_handle);
684 ret += message_adaptor_stop(service_adaptor->message_handle);
685 ret += shop_adaptor_stop(service_adaptor->shop_handle);
686 ret += storage_adaptor_stop(service_adaptor->storage_handle);
687 ret += push_adaptor_stop(service_adaptor->push_handle);
689 service_adaptor->started = 0;
692 service_adaptor_error("Error while stopping adaptors");
693 return SERVICE_ADAPTOR_INTERNAL_ERROR_CORRUPTED;
696 service_adaptor_debug("Service Adaptor: Stopped");
699 return SERVICE_ADAPTOR_INTERNAL_ERROR_NONE;
702 /**************************************************************************
703 * Create / Destroy Adaptors
704 **************************************************************************/
705 service_adaptor_h service_adaptor_create()
708 service_adaptor_debug("Service Adaptor: Create");
710 /* create handle of adaptor */
711 auth_adaptor_h auth_handle = service_adaptor_create_auth();
713 if (NULL == auth_handle) {
714 service_adaptor_error("Could not create auth adaptor");
718 contact_adaptor_h contact_handle = service_adaptor_create_contact();
720 if (NULL == contact_handle) {
721 service_adaptor_error("Could not create contact adaptor");
722 auth_adaptor_destroy(auth_handle);
726 message_adaptor_h message_handle = service_adaptor_create_message();
728 if (NULL == message_handle) {
729 service_adaptor_error("Could not create message adaptor");
730 auth_adaptor_destroy(auth_handle);
731 contact_adaptor_destroy(contact_handle);
735 shop_adaptor_h shop_handle = service_adaptor_create_shop();
737 if (NULL == shop_handle) {
738 service_adaptor_error("Could not create shop adaptor");
739 auth_adaptor_destroy(auth_handle);
740 contact_adaptor_destroy(contact_handle);
741 message_adaptor_destroy(message_handle);
745 storage_adaptor_h storage_handle = service_adaptor_create_storage();
747 if (NULL == storage_handle) {
748 service_adaptor_error("Could not create storage adaptor");
749 auth_adaptor_destroy(auth_handle);
750 contact_adaptor_destroy(contact_handle);
751 message_adaptor_destroy(message_handle);
752 shop_adaptor_destroy(shop_handle);
756 push_adaptor_h push_handle = service_adaptor_create_push();
758 if (NULL == push_handle) {
759 service_adaptor_error("Could not create push adaptor");
760 auth_adaptor_destroy(auth_handle);
761 contact_adaptor_destroy(contact_handle);
762 message_adaptor_destroy(message_handle);
763 shop_adaptor_destroy(shop_handle);
764 storage_adaptor_destroy(storage_handle);
768 /* register listener of adaptor */
769 auth_adaptor_listener_h auth_listener = service_adaptor_register_auth_listener(auth_handle);
771 if (NULL == auth_listener) {
772 service_adaptor_error("Could not create auth listener");
773 auth_adaptor_destroy(auth_handle);
774 contact_adaptor_destroy(contact_handle);
775 message_adaptor_destroy(message_handle);
776 shop_adaptor_destroy(shop_handle);
777 storage_adaptor_destroy(storage_handle);
778 push_adaptor_destroy(push_handle);
782 contact_adaptor_listener_h contact_listener = service_adaptor_register_contact_listener(contact_handle);
784 if (NULL == contact_listener) {
785 service_adaptor_error("Could not create contact listener");
786 auth_adaptor_unregister_listener(auth_handle, auth_listener);
788 auth_adaptor_destroy(auth_handle);
789 contact_adaptor_destroy(contact_handle);
790 message_adaptor_destroy(message_handle);
791 shop_adaptor_destroy(shop_handle);
792 storage_adaptor_destroy(storage_handle);
793 push_adaptor_destroy(push_handle);
797 message_adaptor_listener_h message_listener = service_adaptor_register_message_listener(message_handle);
799 if (NULL == message_listener) {
800 service_adaptor_error("Could not create message listener");
801 auth_adaptor_unregister_listener(auth_handle, auth_listener);
802 contact_adaptor_unregister_listener(contact_handle, contact_listener);
804 auth_adaptor_destroy(auth_handle);
805 contact_adaptor_destroy(contact_handle);
806 message_adaptor_destroy(message_handle);
807 shop_adaptor_destroy(shop_handle);
808 storage_adaptor_destroy(storage_handle);
809 push_adaptor_destroy(push_handle);
813 shop_adaptor_listener_h shop_listener = service_adaptor_register_shop_listener(shop_handle);
815 if (NULL == shop_listener) {
816 service_adaptor_error("Could not create shop listener");
817 auth_adaptor_unregister_listener(auth_handle, auth_listener);
818 contact_adaptor_unregister_listener(contact_handle, contact_listener);
819 message_adaptor_unregister_listener(message_handle, message_listener);
821 auth_adaptor_destroy(auth_handle);
822 contact_adaptor_destroy(contact_handle);
823 message_adaptor_destroy(message_handle);
824 shop_adaptor_destroy(shop_handle);
825 storage_adaptor_destroy(storage_handle);
826 push_adaptor_destroy(push_handle);
830 storage_adaptor_listener_h storage_listener = service_adaptor_register_storage_listener(storage_handle);
832 if (NULL == storage_listener) {
833 service_adaptor_error("Could not create storage listener");
834 auth_adaptor_unregister_listener(auth_handle, auth_listener);
835 contact_adaptor_unregister_listener(contact_handle, contact_listener);
836 message_adaptor_unregister_listener(message_handle, message_listener);
837 shop_adaptor_unregister_listener(shop_handle, shop_listener);
839 auth_adaptor_destroy(auth_handle);
840 contact_adaptor_destroy(contact_handle);
841 message_adaptor_destroy(message_handle);
842 shop_adaptor_destroy(shop_handle);
843 storage_adaptor_destroy(storage_handle);
844 push_adaptor_destroy(push_handle);
848 push_adaptor_listener_h push_listener = service_adaptor_register_push_listener(push_handle);
850 if (NULL == push_listener) {
851 service_adaptor_error("Could not create push listener");
852 auth_adaptor_unregister_listener(auth_handle, auth_listener);
853 contact_adaptor_unregister_listener(contact_handle, contact_listener);
854 message_adaptor_unregister_listener(message_handle, message_listener);
855 shop_adaptor_unregister_listener(shop_handle, shop_listener);
856 storage_adaptor_unregister_listener(storage_handle, storage_listener);
858 auth_adaptor_destroy(auth_handle);
859 contact_adaptor_destroy(contact_handle);
860 message_adaptor_destroy(message_handle);
861 shop_adaptor_destroy(shop_handle);
862 storage_adaptor_destroy(storage_handle);
863 push_adaptor_destroy(push_handle);
867 /* create Service Adaptor */
868 service_adaptor_h service_adaptor = (service_adaptor_h) g_malloc0(sizeof(service_adaptor_s));
870 if (NULL == service_adaptor) {
871 service_adaptor_error("Could not create service adaptor");
872 auth_adaptor_unregister_listener(auth_handle, auth_listener);
873 contact_adaptor_unregister_listener(contact_handle, contact_listener);
874 message_adaptor_unregister_listener(message_handle, message_listener);
875 shop_adaptor_unregister_listener(shop_handle, shop_listener);
876 storage_adaptor_unregister_listener(storage_handle, storage_listener);
877 push_adaptor_unregister_listener(push_handle, push_listener);
879 auth_adaptor_destroy(auth_handle);
880 contact_adaptor_destroy(contact_handle);
881 message_adaptor_destroy(message_handle);
882 shop_adaptor_destroy(shop_handle);
883 storage_adaptor_destroy(storage_handle);
884 push_adaptor_destroy(push_handle);
889 service_adaptor->auth_handle = auth_handle;
890 service_adaptor->contact_handle = contact_handle;
891 service_adaptor->message_handle = message_handle;
892 service_adaptor->shop_handle = shop_handle;
893 service_adaptor->storage_handle = storage_handle;
894 service_adaptor->push_handle = push_handle;
896 service_adaptor->auth_listener = auth_listener;
897 service_adaptor->push_listener = push_listener;
898 service_adaptor->shop_listener = shop_listener;
899 service_adaptor->contact_listener = contact_listener;
900 service_adaptor->storage_listener = storage_listener;
901 service_adaptor->message_listener = message_listener;
903 service_adaptor->service_list = NULL;
904 service_adaptor->started = 0;
906 g_mutex_init(&service_adaptor->service_adaptor_mutex);
907 g_cond_init(&service_adaptor->service_adaptor_cond);
909 service_adaptor_debug("Service Adaptor: Created");
911 service_adaptor_info("Init client checker (%d)", client_checker_init());
914 return service_adaptor;
917 void service_adaptor_destroy(service_adaptor_h service_adaptor)
920 service_adaptor_debug("Service Adaptor: Destroy");
921 client_checker_deinit();
922 service_adaptor_info("Deinit client checker");
924 if ((void *) NULL == service_adaptor) {
925 service_adaptor_debug("Invalid argument");
929 /* 1) deinit D-Bus */
930 dbus_ipc_server_layer_deinit();
932 service_adaptor_debug("Service adaptor destroyed: D-Bus");
934 /* 2) destroy service list */
935 if (NULL != service_adaptor->service_list) {
936 g_list_free(service_adaptor->service_list);
937 service_adaptor->service_list = NULL;
940 service_adaptor_debug("Service adaptor destroyed: service list");
942 /* 3) stop service adaptor */
943 if (0 < service_adaptor->started) {
944 service_adaptor_error("Service Adaptor is running. Force stopping before destroy");
945 service_adaptor_stop(service_adaptor);
948 service_adaptor_safe_free(service_adaptor);
950 service_adaptor_debug("Service Adaptor: Destroyed");
954 void *servive_adaptor_preload_service_files(void *data)
957 service_adaptor_debug("5 sec sleep for load service files (TODO change)");
959 service_adaptor_internal_error_code_e ret;
960 push_activate_h *services = NULL;
962 ret = service_adaptor_ref_enabled_push_services(&services, &svc_len);
964 service_adaptor_debug_func("### Preload service len : %d", svc_len);
965 if (SERVICE_ADAPTOR_INTERNAL_ERROR_NONE == ret) {
966 for (int i = 0; i < svc_len; i++) {
967 service_adaptor_context_info_s new_context_info;
968 __init_context_info_s(new_context_info);
969 new_context_info.app_id = services[i]->app_id;
970 char service_name[1024] = {0, };
971 snprintf(service_name, 1024, "preloaded_service/plugin='%s'&app_id='%s'",
972 services[i]->plugin_uri, services[i]->app_id);
973 char ret_msg[2048] = {0, };
974 ret = service_adaptor_connect(g_service_adaptor, &new_context_info, service_name,
975 services[i]->plugin_uri, "", "",
976 false, false, false, false, true, false, ret_msg);
977 service_adaptor_debug_func("### Preload service : ret(%d) service_name(%s)", ret, service_name);
987 * @brief init service adaptor
991 service_adaptor_internal_error_code_e service_adaptor_init()
994 service_adaptor_debug("Service Adaptor: Initialize");
996 int ret = SERVICE_ADAPTOR_INTERNAL_ERROR_NONE;
1000 /* 1) create adaptor (memory allocation) */
1001 service_adaptor_h service_adaptor = service_adaptor_create();
1003 if (NULL == service_adaptor) {
1004 service_adaptor_error("Could not create Service Adaptor");
1005 return SERVICE_ADAPTOR_INTERNAL_ERROR_CREATE;
1008 service_adaptor_debug("Service Adaptor: created");
1010 /* 2) start adaptor (plugin load, get IMIS list) */
1011 ret = service_adaptor_start(service_adaptor);
1013 if (SERVICE_ADAPTOR_INTERNAL_ERROR_NONE != ret) {
1014 service_adaptor_error("Could not load Adaptors: %d", ret);
1015 return SERVICE_ADAPTOR_INTERNAL_ERROR_START;
1018 service_adaptor_debug("Service Adaptor: started");
1019 /* TODO it will be activated for on-demand */
1020 ping_manager_init(5, g_default_loop);
1022 /* 3) assign to global service adaptor handle */
1023 g_service_adaptor = service_adaptor;
1026 ret = dbus_ipc_server_layer_init();
1028 if (SERVICE_ADAPTOR_INTERNAL_ERROR_NONE != ret) {
1029 service_adaptor_error("Could not init D-Bus IPC server: %d", ret);
1030 return SERVICE_ADAPTOR_INTERNAL_ERROR_DBUS;
1033 service_adaptor_debug("Service Adaptor: init D-Bus");
1034 service_adaptor_debug("Service Adaptor: Initialized (%d)", service_adaptor->started);
1036 service_adaptor_debug("Service Adaptor: init preload service");
1038 pthread_create(&job, NULL, servive_adaptor_preload_service_files, NULL);
1040 return SERVICE_ADAPTOR_INTERNAL_ERROR_NONE;
1044 * @brief deinit service adaptor
1046 * @param[in] service_adaptor specifies handle of service adaptor
1049 void service_adaptor_deinit()
1051 service_adaptor_debug("Service Adaptor: Deinitialize");
1053 if (NULL == g_service_adaptor) {
1054 service_adaptor_error("Invalid argument");
1058 service_adaptor_h service_adaptor = g_service_adaptor;
1059 g_service_adaptor = NULL;
1060 service_adaptor_destroy(service_adaptor);
1061 service_adaptor_debug("Service Adaptor: Deinitialized");
1065 * @brief main signal function
1067 * @param[in] data specifies user data passed by main function
1070 static gint sigterm_callback(void *data)
1072 service_adaptor_info("Service Adaptor Shutdown");
1074 g_main_loop_quit((GMainLoop *)data);
1079 /******************************************************************************
1080 Public interface definition
1081 *****************************************************************************/
1083 service_adaptor_internal_error_code_e service_adaptor_auth_refresh(service_adaptor_h service_adaptor,
1084 const char *service_name,
1085 const char *plugin_uri)
1088 service_adaptor_debug("Auth refresh Start");
1090 service_adaptor_service_context_h service_context =
1091 service_adaptor_get_service_context(service_adaptor, service_name);
1094 return service_adaptor_auth_refresh_with_service_context(service_adaptor, service_context, plugin_uri);
1097 service_adaptor_internal_error_code_e service_adaptor_auth_refresh_with_service_context(service_adaptor_h service_adaptor,
1098 service_adaptor_service_context_h service_context,
1099 const char *plugin_uri)
1102 service_adaptor_debug("Auth refresh with service context Start");
1104 if (NULL == service_context) {
1105 service_adaptor_warning("Parameter is NULL (service_adaptor_h service_adaptor)");
1106 return SERVICE_ADAPTOR_INTERNAL_ERROR_INVALID_HANDLE;
1109 if (NULL == service_context->auth_context) {
1110 service_adaptor_warning("Parameter is NULL (service_context->auth_context)");
1111 return SERVICE_ADAPTOR_INTERNAL_ERROR_INVALID_HANDLE;
1114 int ret = SERVICE_ADAPTOR_INTERNAL_ERROR_NONE;
1115 char *old_access_token = NULL;
1116 char *new_access_token = NULL;
1117 char *new_uid = NULL;
1119 service_adaptor_debug("Get contexts and plugins from service_adaptor_h");
1120 if (NULL != service_context->context_info) {
1121 old_access_token = service_context->context_info->access_token;
1123 service_adaptor_warning("Element is NULL (service_context->context->info)");
1124 return SERVICE_ADAPTOR_INTERNAL_ERROR_INVALID_HANDLE;
1126 auth_adaptor_plugin_h auth_plugin =
1127 auth_adaptor_get_plugin_by_name(service_adaptor->auth_handle, plugin_uri);
1128 auth_adaptor_error_code_h auth_error = NULL;
1131 service_adaptor_debug("Call is_auth");
1132 ret = auth_adaptor_is_auth(auth_plugin, service_context->auth_context, NULL, &is_auth, &auth_error, NULL);
1135 service_adaptor_error("Auth was withdrew (Can not use all service)");
1136 /*TODO change context_info's auth flag */
1137 return SERVICE_ADAPTOR_INTERNAL_ERROR_NOT_AUTHORIZED;
1139 auth_adaptor_destroy_error_code(&auth_error);
1141 service_adaptor_debug("Call auth_adaptor_login");
1142 ret = auth_adaptor_login(auth_plugin, service_context->auth_context, is_auth, NULL, &auth_error, NULL);
1144 if ((NULL != old_access_token) && (AUTH_ADAPTOR_ERROR_NONE == ret)) {
1145 if (NULL == service_context->auth_context->access_token) {
1146 service_adaptor_error("auth_plugin returns login success but auth_access token is empty");
1147 service_context->auth_context->access_token = strdup(old_access_token);
1148 ret = SERVICE_ADAPTOR_INTERNAL_ERROR_NOT_AUTHORIZED;
1150 if (0 == strcmp(old_access_token, service_context->auth_context->access_token)) {
1151 service_adaptor_debug("Call auth_adaptor_login_refresh");
1152 ret = auth_adaptor_login_refresh(auth_plugin, service_context->auth_context, NULL, &auth_error, NULL);
1155 if ((AUTH_ADAPTOR_ERROR_NONE == ret) &&
1156 (NULL != service_context->auth_context->access_token) &&
1157 (0 == strcmp(old_access_token, service_context->auth_context->access_token))) {
1158 service_adaptor_debug("Access token was not changed");
1159 } else if (AUTH_ADAPTOR_ERROR_NONE == ret) {
1160 service_adaptor_debug("Changing access token start");
1162 new_access_token = auth_adaptor_get_access_token_dup(service_context->auth_context);
1163 if (NULL != new_access_token) {
1164 service_adaptor_debug_secure("New access token : %s", new_access_token);
1165 free(service_context->context_info->access_token);
1166 service_context->context_info->access_token = new_access_token;
1167 service_adaptor_debug("service_context->context_info->access_token was changed");
1169 ret = contact_adaptor_refresh_access_token(service_context->contact_context, new_access_token);
1171 service_adaptor_debug("service_context->contact_context was changed");
1174 ret = storage_adaptor_refresh_access_token(service_context->storage_context, new_access_token);
1176 service_adaptor_debug("service_context->storage_context was changed");
1179 ret = message_adaptor_refresh_access_token(service_context->message_context, new_access_token);
1181 service_adaptor_debug("service_context->message_context was changed");
1184 ret = shop_adaptor_refresh_access_token(service_context->shop_context, new_access_token);
1186 service_adaptor_debug("service_context->shop_context was changed");
1190 new_uid = auth_adaptor_get_uid_dup(service_context->auth_context);
1191 if (NULL != new_uid) {
1192 service_adaptor_debug_secure("New unique id : %s", new_uid);
1193 free(service_context->context_info->duid);
1194 service_context->context_info->duid = new_uid;
1195 service_adaptor_debug("service_context->context_info->uid was changed");
1197 ret = contact_adaptor_refresh_uid(service_context->contact_context, new_uid);
1199 service_adaptor_debug("service_context->contact_context was changed");
1202 ret = storage_adaptor_refresh_uid(service_context->storage_context, new_uid);
1204 service_adaptor_debug("service_context->storage_context was changed");
1207 ret = message_adaptor_refresh_uid(service_context->message_context, new_uid);
1209 service_adaptor_debug("service_context->message_context was changed");
1212 ret = shop_adaptor_refresh_uid(service_context->shop_context, new_uid);
1214 service_adaptor_debug("service_context->shop_context was changed");
1218 service_adaptor_error("Login refresh failed");
1219 if (NULL != auth_error) {
1220 service_adaptor_error("Auth error code(%lld) message(%s)", auth_error->code, auth_error->msg);
1225 service_adaptor_error("Login refresh failed");
1226 if (NULL != auth_error) {
1227 service_adaptor_error("Auth error code(%lld) message(%s)", auth_error->code, auth_error->msg);
1231 service_adaptor_debug("Auth refresh End");
1238 * @brief main function
1240 * @param[in] argc specifies count of arguments
1241 * @param[in] argv specifies value list of arguments
1244 int main(int argc, char *argv[])
1246 int ret = SERVICE_ADAPTOR_INTERNAL_ERROR_NONE;
1249 #if !GLIB_CHECK_VERSION(2, 32, 0)
1250 g_thread_init(NULL);
1252 #if !GLIB_CHECK_VERSION(2, 35, 0)
1256 /* mainloop of main thread */
1257 loop = g_main_loop_new(NULL, FALSE);
1258 g_default_loop = loop;
1260 ret = service_adaptor_init();
1262 if (SERVICE_ADAPTOR_INTERNAL_ERROR_NONE != ret) {
1263 service_adaptor_error("Service Adaptor initialize error: %d\n", ret);
1267 /* installing signal handlers */
1268 g_unix_signal_add_full(G_PRIORITY_HIGH, SIGINT,
1269 sigterm_callback, loop, NULL);
1270 g_unix_signal_add_full(G_PRIORITY_HIGH, SIGTERM,
1271 sigterm_callback, loop, NULL);
1273 /* start application's main loop */
1274 g_main_loop_run(loop);
1276 /* cleanup after mainloop */
1277 g_main_loop_unref(loop);
1279 service_adaptor_h service_adaptor = service_adaptor_get_handle();
1280 service_adaptor_deinit(service_adaptor);
1285 #ifdef SERVICE_ADAPTOR_DEBUG_TIME_CHECK
1287 #include <sys/time.h>
1288 /******************* for debug func *************/
1291 static __thread long start_time = 0;
1292 static __thread long now_time = 0;
1293 static __thread long delayed_time = 0;
1296 static __thread long a_start_time = 0;
1297 static __thread long a_now_time = 0;
1298 static __thread long a_delayed_time = 0;
1301 static __thread long s_start_time = 0;
1302 static __thread long s_now_time = 0;
1303 static __thread long s_delayed_time = 0;
1306 static __thread long c_start_time = 0;
1307 static __thread long c_now_time = 0;
1308 static __thread long c_delayed_time = 0;
1311 static __thread long m_start_time = 0;
1312 static __thread long m_now_time = 0;
1313 static __thread long m_delayed_time = 0;
1316 static __thread long p_start_time = 0;
1317 static __thread long p_now_time = 0;
1318 static __thread long p_delayed_time = 0;
1321 static __thread long h_start_time = 0;
1322 static __thread long h_now_time = 0;
1323 static __thread long h_delayed_time = 0;
1325 static __thread int a_count = 0;
1326 static __thread int s_count = 0;
1327 static __thread int c_count = 0;
1328 static __thread int m_count = 0;
1329 static __thread int p_count = 0;
1330 static __thread int h_count = 0;
1332 static __thread struct timeval tv;
1335 void SERVICE_ADAPTOR_API_TIME_CHECK_START()
1337 #ifdef SERVICE_ADAPTOR_DEBUG_TIME_CHECK
1338 gettimeofday(&tv, NULL);
1339 start_time = tv.tv_sec;
1342 void SERVICE_ADAPTOR_API_TIME_CHECK_PAUSE()
1344 #ifdef SERVICE_ADAPTOR_DEBUG_TIME_CHECK
1345 gettimeofday(&tv, NULL);
1346 now_time = tv.tv_sec;
1348 delayed_time += (now_time - start_time);
1352 void SERVICE_ADAPTOR_PLUGIN_API_TIME_CHECK_START(sa_time_check_flag_e flag)
1354 #ifdef SERVICE_ADAPTOR_DEBUG_TIME_CHECK
1355 if (SA_TIME_CHECK_FLAG_AUTH == flag) {
1356 gettimeofday(&tv, NULL);
1357 a_start_time = tv.tv_sec;
1359 if (SA_TIME_CHECK_FLAG_STORAGE == flag) {
1360 gettimeofday(&tv, NULL);
1361 s_start_time = tv.tv_sec;
1363 if (SA_TIME_CHECK_FLAG_CONTACT == flag) {
1364 gettimeofday(&tv, NULL);
1365 c_start_time = tv.tv_sec;
1367 if (SA_TIME_CHECK_FLAG_MESSAGE == flag) {
1368 gettimeofday(&tv, NULL);
1369 m_start_time = tv.tv_sec;
1371 if (SA_TIME_CHECK_FLAG_PUSH == flag) {
1372 gettimeofday(&tv, NULL);
1373 p_start_time = tv.tv_sec;
1375 if (SA_TIME_CHECK_FLAG_SHOP == flag) {
1376 gettimeofday(&tv, NULL);
1377 h_start_time = tv.tv_sec;
1381 void SERVICE_ADAPTOR_PLUGIN_API_TIME_CHECK_PAUSE(sa_time_check_flag_e flag)
1383 #ifdef SERVICE_ADAPTOR_DEBUG_TIME_CHECK
1384 if (SA_TIME_CHECK_FLAG_AUTH == flag) {
1385 gettimeofday(&tv, NULL);
1386 a_now_time = tv.tv_sec;
1388 a_delayed_time += (a_now_time - a_start_time);
1391 if (SA_TIME_CHECK_FLAG_STORAGE == flag) {
1392 gettimeofday(&tv, NULL);
1393 s_now_time = tv.tv_sec;
1395 s_delayed_time += (s_now_time - s_start_time);
1398 if (SA_TIME_CHECK_FLAG_CONTACT == flag) {
1399 gettimeofday(&tv, NULL);
1400 c_now_time = tv.tv_sec;
1402 c_delayed_time += (c_now_time - c_start_time);
1405 if (SA_TIME_CHECK_FLAG_MESSAGE == flag) {
1406 gettimeofday(&tv, NULL);
1407 m_now_time = tv.tv_sec;
1409 m_delayed_time += (m_now_time - m_start_time);
1412 if (SA_TIME_CHECK_FLAG_PUSH == flag) {
1413 gettimeofday(&tv, NULL);
1414 p_now_time = tv.tv_sec;
1416 p_delayed_time += (p_now_time - p_start_time);
1419 if (SA_TIME_CHECK_FLAG_SHOP == flag) {
1420 gettimeofday(&tv, NULL);
1421 h_now_time = tv.tv_sec;
1423 h_delayed_time += (h_now_time - h_start_time);
1428 void SERVICE_ADAPTOR_API_TIME_CHECK_TOTAL_REPORT(const char *service_name)
1430 #ifdef SERVICE_ADAPTOR_DEBUG_TIME_CHECK
1431 service_adaptor_debug_func("[TIMECHECK]================================================");
1432 service_adaptor_debug_func("[TIMECHECK]================================================");
1433 service_adaptor_debug_func("[TIMECHECK] Total set_auth time report (TID : %lld)", (long long int)syscall(__NR_gettid));
1434 service_adaptor_debug_func("[TIMECHECK] Service name : %s", service_name);
1435 service_adaptor_debug_func("[TIMECHECK] Total delay time : %ld sec",
1436 (delayed_time + a_delayed_time + s_delayed_time + c_delayed_time + m_delayed_time + p_delayed_time + h_delayed_time));
1437 service_adaptor_debug_func("[TIMECHECK] Adaptor : %ld sec", delayed_time);
1438 service_adaptor_debug_func("[TIMECHECK] Auth plugin : %ld sec, called : %d", a_delayed_time, a_count);
1439 service_adaptor_debug_func("[TIMECHECK] Storage plugin : %ld sec, called : %d", s_delayed_time, s_count);
1440 service_adaptor_debug_func("[TIMECHECK] Contact plugin : %ld sec, called : %d", c_delayed_time, c_count);
1441 service_adaptor_debug_func("[TIMECHECK] Message plugin : %ld sec, called : %d", m_delayed_time, m_count);
1442 service_adaptor_debug_func("[TIMECHECK] Push plugin : %ld sec, called : %d", p_delayed_time, p_count);
1443 service_adaptor_debug_func("[TIMECHECK] Shop plugin : %ld sec, called : %d", h_delayed_time, h_count);
1444 service_adaptor_debug_func("[TIMECHECK]================================================");
1445 service_adaptor_debug_func("[TIMECHECK]================================================");