From 65a755959f20509220016295fb219dc4e3690c4b Mon Sep 17 00:00:00 2001 From: Simon Chung Date: Tue, 17 Dec 2024 15:48:30 +0000 Subject: [PATCH 01/18] RDKECMF-213 Add CODEOWNERS file --- .github/CODEOWNERS | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .github/CODEOWNERS diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 00000000..c7b23a3d --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1,5 @@ +# These owners will be the default owners for everything in +# the repo. Unless a later match takes precedence, +# @global-owner1 and @global-owner2 will be requested for +# review when someone opens a pull request. +* @rdkcentral/xdialserver-maintainers From 8efac8e97bb559ba246dcc354c1410dd2b88d093 Mon Sep 17 00:00:00 2001 From: apatel859 Date: Mon, 3 Feb 2025 12:26:20 -0500 Subject: [PATCH 02/18] RDKEMW-254: libsoup3 support Signed-off-by: apatel859 --- server/CMakeLists.txt | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/server/CMakeLists.txt b/server/CMakeLists.txt index 7c56967d..c506e0d7 100644 --- a/server/CMakeLists.txt +++ b/server/CMakeLists.txt @@ -27,6 +27,7 @@ find_package (PkgConfig REQUIRED) pkg_search_module (GLIB REQUIRED glib-2.0) pkg_search_module (GIO REQUIRED gio-2.0) pkg_search_module (GSSDP12 gssdp-1.2) +pkg_search_module (LIBSOUP3 libsoup-3.0) if (GSSDP12_FOUND) pkg_search_module (GSSDP REQUIRED gssdp-1.2) add_definitions(-DHAVE_GSSDP_VERSION_1_2_OR_NEWER) @@ -34,7 +35,12 @@ if (GSSDP12_FOUND) else() pkg_search_module (GSSDP REQUIRED gssdp-1.0) endif() -pkg_search_module (SOUP REQUIRED libsoup-2.4) +if (LIBSOUP3_FOUND) + pkg_search_module (SOUP REQUIRED libsoup-3.0) + message("Using libsoup-3.0") +else() + pkg_search_module (SOUP REQUIRED libsoup-2.4) +endif() pkg_search_module (XML2 REQUIRED libxml-2.0) set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -g") @@ -101,4 +107,4 @@ target_link_libraries (gdial-server add_executable (gdial-server-ut gdialserver_ut.cpp) -target_link_libraries (gdial-server-ut gdial-plat gdial-server) \ No newline at end of file +target_link_libraries (gdial-server-ut gdial-plat gdial-server) From 55650a2f912c89dc7ad8f47aafb3cc3a2350ce23 Mon Sep 17 00:00:00 2001 From: yuvaramachandran_gurusamy Date: Tue, 4 Mar 2025 13:07:03 +0000 Subject: [PATCH 03/18] RDKTV-35185: Add sync between ssdp_http_server_callback and gdial_ssdp_set_friendlyname Signed-off-by: yuvaramachandran_gurusamy --- server/gdial-ssdp.c | 94 +++++++++++++++++++++++++++++++++------------ 1 file changed, 70 insertions(+), 24 deletions(-) diff --git a/server/gdial-ssdp.c b/server/gdial-ssdp.c index 4cf34433..4b9f2119 100644 --- a/server/gdial-ssdp.c +++ b/server/gdial-ssdp.c @@ -21,6 +21,7 @@ #include #include #include +#include #include #include @@ -74,6 +75,7 @@ static const char ssdp_device_xml_template[] = "" static gchar *dd_xml_response_str_ = NULL; static gchar *app_friendly_name = NULL; static gchar *app_random_uuid = NULL; +static pthread_mutex_t ssdpServerEventSync = PTHREAD_MUTEX_INITIALIZER; static void ssdp_http_server_callback(SoupServer *server, SoupMessage *msg, const char *path, GHashTable *query, SoupClientContext *client, gpointer user_data) { /* @@ -85,6 +87,8 @@ static void ssdp_http_server_callback(SoupServer *server, SoupMessage *msg, cons GDIAL_DEBUG("warning: SSDP HTTP Method is not GET"); return; } + + pthread_mutex_lock(&ssdpServerEventSync); /* * there is no variant here, so we can cache the response. */ @@ -94,24 +98,54 @@ static void ssdp_http_server_callback(SoupServer *server, SoupMessage *msg, cons const gchar *manufacturer= gdial_plat_dev_get_manufacturer(); const gchar *model = gdial_plat_dev_get_model(); - if (manufacturer == NULL) {manufacturer = gdial_options_->manufacturer;} - if (model == NULL) {model = gdial_options_->model_name;} - if(gdial_options_->feature_friendlyname && strlen(app_friendly_name)) + if (manufacturer == NULL) { + manufacturer = gdial_options_->manufacturer; + } + + if (model == NULL) { + model = gdial_options_->model_name; + } + + if(gdial_options_->feature_friendlyname && app_friendly_name && strlen(app_friendly_name)) + { dd_xml_response_str_ = g_strdup_printf(ssdp_device_xml_template, app_friendly_name, manufacturer, model, gdial_options_->uuid); + } else + { dd_xml_response_str_ = g_strdup_printf(ssdp_device_xml_template, gdial_options_->friendly_name, manufacturer, model, gdial_options_->uuid); + } - dd_xml_response_str_len = strlen(dd_xml_response_str_); + if ( dd_xml_response_str_ ) { + dd_xml_response_str_len = strlen(dd_xml_response_str_); + } + else { + GDIAL_LOGERROR("Failed to allocate memory for dd.xml response"); + soup_message_set_status(msg, SOUP_STATUS_INTERNAL_SERVER_ERROR); + } } - gchar *application_url_str = g_strdup_printf("http://%s:%d/%s/", iface_ipv4_address, GDIAL_REST_HTTP_PORT,app_random_uuid); - soup_message_headers_replace (msg->response_headers, "Application-URL", application_url_str); - g_free(application_url_str); - application_url_str = NULL; - soup_message_set_response(msg, "text/xml; charset=utf-8", SOUP_MEMORY_STATIC, dd_xml_response_str_, dd_xml_response_str_len); - soup_message_set_status(msg, SOUP_STATUS_OK); - GDIAL_CHECK("Content-Type:text/xml"); - GDIAL_CHECK("Application-URL: exist"); + if ( dd_xml_response_str_ ) { + gchar *application_url_str = g_strdup_printf("http://%s:%d/%s/", iface_ipv4_address, GDIAL_REST_HTTP_PORT,app_random_uuid); + + if ( application_url_str ) + { + soup_message_headers_replace (msg->response_headers, "Application-URL", application_url_str); + g_free(application_url_str); + application_url_str = NULL; + + soup_message_set_response(msg, "text/xml; charset=utf-8", SOUP_MEMORY_STATIC, dd_xml_response_str_, dd_xml_response_str_len); + soup_message_set_status(msg, SOUP_STATUS_OK); + + GDIAL_CHECK("Content-Type:text/xml"); + GDIAL_CHECK("Application-URL: exist"); + } + else + { + GDIAL_LOGERROR("Failed to allocate memory for response_headers"); + soup_message_set_status(msg, SOUP_STATUS_INTERNAL_SERVER_ERROR); + } + } + pthread_mutex_unlock(&ssdpServerEventSync); } void gdial_ssdp_networkstandbymode_handler(const bool nwstandby) @@ -138,6 +172,12 @@ int gdial_ssdp_new(SoupServer *ssdp_http_server, GDialOptions *options, const gc g_return_val_if_fail(options != NULL, -1); g_return_val_if_fail(options->iface_name != NULL, -1); + if (0 != pthread_mutex_init(&ssdpServerEventSync, NULL)) + { + GDIAL_LOGERROR("Failed to initializing mutex"); + return EXIT_FAILURE; + } + gdial_options_ = options; GDIAL_LOGINFO("gdial_options_->friendly_name[%p]",gdial_options_->friendly_name); @@ -273,6 +313,7 @@ int gdial_ssdp_destroy() { g_object_unref(ssdp_client_); ssdp_client_ = NULL; } + pthread_mutex_destroy(&ssdpServerEventSync); GDIAL_LOGTRACE("Exiting ..."); return 0; } @@ -287,15 +328,20 @@ int gdial_ssdp_set_available(bool activation_status, const gchar *friendlyname) int gdial_ssdp_set_friendlyname(const gchar *friendlyname) { - if(gdial_options_ && gdial_options_->feature_friendlyname && friendlyname) - { - if (app_friendly_name != NULL) g_free(app_friendly_name); - app_friendly_name = g_strdup(friendlyname); - GDIAL_LOGINFO("gdial_ssdp_set_friendlyname app_friendly_name :%s ",app_friendly_name); - if (dd_xml_response_str_!= NULL){ - g_free(dd_xml_response_str_); - dd_xml_response_str_ = NULL; - } - } - return 0; -} + pthread_mutex_lock(&ssdpServerEventSync); + if(gdial_options_ && gdial_options_->feature_friendlyname && friendlyname) + { + if (app_friendly_name != NULL) { + g_free(app_friendly_name); + } + app_friendly_name = g_strdup(friendlyname); + + GDIAL_LOGINFO("gdial_ssdp_set_friendlyname app_friendly_name :%s ",app_friendly_name); + if (dd_xml_response_str_!= NULL){ + g_free(dd_xml_response_str_); + dd_xml_response_str_ = NULL; + } + } + pthread_mutex_unlock(&ssdpServerEventSync); + return 0; +} \ No newline at end of file From 84b8951a72c46aab831fb2efb21bb475e3c9d286 Mon Sep 17 00:00:00 2001 From: hgfell683 <107510770+hgfell683@users.noreply.github.com> Date: Mon, 17 Mar 2025 13:12:39 -0400 Subject: [PATCH 04/18] RDKEMW-2033: Fix coverity related issue Reason for change: Fix issues identified within xcast Test Procedure: Risks: low Priority: P1 Signed-off-by:Hayden Gfeller --- server/plat/gdial.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/server/plat/gdial.cpp b/server/plat/gdial.cpp index 465cf5dc..81f38cfe 100644 --- a/server/plat/gdial.cpp +++ b/server/plat/gdial.cpp @@ -78,6 +78,11 @@ class GDialCastObject reterror = GDIAL_CAST_ERROR_NONE; } } + if (nullptr != AppObj) + { + delete AppObj; + AppObj = nullptr; + } GDIAL_LOGTRACE("Exiting ..."); return reterror; } From 9257820f36ad448d08a34191cf9f227578b867e0 Mon Sep 17 00:00:00 2001 From: yuvaramachandran_gurusamy Date: Wed, 19 Mar 2025 13:47:45 +0000 Subject: [PATCH 05/18] RDK-55044: [RDKE] Implement DIAL requirement to use on EU product Reason for change: Implemented setManufacturerName and setModelName APIs for DIAL Server name configuration maintained the additional data url to specific app Test Procedure: DIAL should work Risks: None Priority: P1 Signed-off-by: yuvaramachandran_gurusamy --- server/gdial-rest.c | 28 +++-- server/gdial-rest.h | 2 +- server/gdial-ssdp.c | 46 ++++++- server/gdial-ssdp.h | 2 + server/gdialservice.cpp | 59 +++++++++ server/include/gdial-plat-app.h | 6 + server/include/gdial-plat-dev.h | 2 - server/include/gdial_app_registry.h | 3 + server/include/gdialservice.h | 4 +- server/include/gdialserviceimpl.h | 4 + server/plat/CMakeLists.txt | 2 +- server/plat/gdial-os-app.h | 2 + server/plat/gdial-plat-app.c | 30 ++++- server/plat/gdial-plat-dev.c | 8 -- server/plat/gdial.cpp | 181 ++++++++++++++++++++++------ server/plat/gdial.hpp | 5 + server/plat/gdial_app_registry.c | 34 +++++- 17 files changed, 355 insertions(+), 63 deletions(-) diff --git a/server/gdial-rest.c b/server/gdial-rest.c index 4ed904ae..2312b85a 100644 --- a/server/gdial-rest.c +++ b/server/gdial-rest.c @@ -155,9 +155,12 @@ static void gdial_soup_message_set_http_error(SoupMessage *msg, guint state_code g_string_free(value_buf, FALSE); \ } -static GList *gdial_rest_server_registered_apps_clear(GList *registered_apps, GList *found) { +static GList *gdial_rest_server_registered_apps_clear(GDialRestServer *self, GList *registered_apps, GList *found) { + GDialRestServerPrivate *priv = gdial_rest_server_get_instance_private(self); GDialAppRegistry *app_registry = (GDialAppRegistry *)found->data; registered_apps = g_list_remove_link(registered_apps, found); + GDIAL_LOGINFO("Removing handler for app[%s]", app_registry->name); + soup_server_remove_handler(priv->local_soup_instance, app_registry->app_uri); gdial_app_regstry_dispose (app_registry); g_list_free(found); return registered_apps; @@ -281,7 +284,7 @@ GDIAL_STATIC gboolean gdial_rest_server_is_allowed_origin(GDialRestServer *self, return is_allowed; } -GDIAL_STATIC gchar *gdial_rest_server_new_additional_data_url(guint listening_port, const gchar *app_name, gboolean encode) { +GDIAL_STATIC gchar *gdial_rest_server_new_additional_data_url(guint listening_port, const gchar *app_name, gboolean encode , const gchar* app_uri) { /* * The specifciation of additionalDataUrl in form of /apps//dial_data * thus the instance data must be included in the query or payload, not the path. @@ -291,7 +294,7 @@ GDIAL_STATIC gchar *gdial_rest_server_new_additional_data_url(guint listening_po * for MIME type application/x-www-form-urlencoded.]] */ GString *url_buf = g_string_new(""); - g_string_printf(url_buf, "http://%s:%d%s/%s%s", "localhost", listening_port, GDIAL_REST_HTTP_APPS_URI, app_name, GDIAL_REST_HTTP_DIAL_DATA_URI); + g_string_printf(url_buf, "http://%s:%d%s%s", "localhost", listening_port, app_uri, GDIAL_REST_HTTP_DIAL_DATA_URI); gchar *unencoded = g_string_free(url_buf, FALSE); if (encode) { gchar *encoded = soup_uri_encode(unencoded, NULL); @@ -433,7 +436,7 @@ static void gdial_rest_server_handle_POST(GDialRestServer *gdial_rest_server, So if (new_app_instance) { gchar *additional_data_url = NULL; if (app_registry->use_additional_data) { - additional_data_url = gdial_rest_server_new_additional_data_url(listening_port, app_registry->name, FALSE); + additional_data_url = gdial_rest_server_new_additional_data_url(listening_port, app_registry->name, FALSE, app_registry->app_uri ); } gchar *additional_data_url_safe = soup_uri_encode(additional_data_url, NULL); GDIAL_LOGINFO("additionalDataUrl = %s, %s", additional_data_url, additional_data_url_safe); @@ -981,7 +984,7 @@ static void gdial_rest_server_dispose(GObject *object) { g_object_unref(priv->soup_instance); g_object_unref(priv->local_soup_instance); while (priv->registered_apps) { - priv->registered_apps = gdial_rest_server_registered_apps_clear(priv->registered_apps, priv->registered_apps); + priv->registered_apps = gdial_rest_server_registered_apps_clear(object, priv->registered_apps, priv->registered_apps); } G_OBJECT_CLASS (gdial_rest_server_parent_class)->dispose (object); } @@ -1102,10 +1105,7 @@ GDialRestServer *gdial_rest_server_new(SoupServer *rest_http_server,SoupServer * */ soup_server_add_handler(rest_http_server, "/apps/system", gdial_rest_http_server_system_callback, object, NULL); #endif - GDIAL_LOGINFO("gdial_local_rest_http_server_callback add handler"); GDIAL_REST_HTTP_APPS_URI = g_strdup_printf("/%s", random_id); - - soup_server_add_handler(local_rest_http_server, GDIAL_REST_HTTP_APPS_URI, gdial_local_rest_http_server_callback, object, NULL); return object; } @@ -1147,6 +1147,12 @@ gboolean gdial_rest_server_register_app(GDialRestServer *self, const gchar *app_ } g_return_val_if_fail(priv->registered_apps != NULL, FALSE); g_return_val_if_fail(gdial_rest_server_is_app_registered(self, app_name), FALSE); + + if( 0 != strcmp(app_name,"system")) + { + GDIAL_LOGINFO("gdial_local_rest_http_server_callback add handler for app_name:[%s]",app_name); + soup_server_add_handler(priv->local_soup_instance, app_registry->app_uri, gdial_local_rest_http_server_callback, self, NULL); + } GDIAL_LOGTRACE("Exiting ..."); return TRUE; } @@ -1204,7 +1210,7 @@ gboolean gdial_rest_server_unregister_all_apps(GDialRestServer *self) { priv->registered_apps = registered_apps_head; /*Remove all registered apps before*/ while (priv->registered_apps) { - priv->registered_apps = gdial_rest_server_registered_apps_clear(priv->registered_apps, priv->registered_apps); + priv->registered_apps = gdial_rest_server_registered_apps_clear(self, priv->registered_apps, priv->registered_apps); } GDIAL_LOGTRACE("Exiting ..."); return TRUE; @@ -1219,7 +1225,7 @@ gboolean gdial_rest_server_unregister_app(GDialRestServer *self, const gchar *ap GDialRestServerPrivate *priv = gdial_rest_server_get_instance_private(self); GList *found = g_list_find_custom(priv->registered_apps, app_name, GCompareFunc_match_registry_app_name); if (found == NULL) return FALSE; - priv->registered_apps = gdial_rest_server_registered_apps_clear(priv->registered_apps, found); + priv->registered_apps = gdial_rest_server_registered_apps_clear(self, priv->registered_apps, found); return TRUE; } @@ -1334,4 +1340,4 @@ GDIAL_STATIC_INLINE void GET_APP_response_builder_destroy(void *builder) { g_free(rbuilder->additionalData); g_free(builder); -} +} \ No newline at end of file diff --git a/server/gdial-rest.h b/server/gdial-rest.h index ca6f3db9..770d2463 100644 --- a/server/gdial-rest.h +++ b/server/gdial-rest.h @@ -50,7 +50,7 @@ gboolean gdial_rest_server_unregister_all_apps(GDialRestServer *self); typedef struct _GDialAppRegistry GDialAppRegistry; GDIAL_STATIC gboolean gdial_rest_server_is_allowed_origin(GDialRestServer *self, const gchar *header_origin, const gchar *app_name); -GDIAL_STATIC gchar *gdial_rest_server_new_additional_data_url(guint listening_port, const gchar *app_name, gboolean encode); +GDIAL_STATIC gchar *gdial_rest_server_new_additional_data_url(guint listening_port, const gchar *app_name, gboolean encode, const gchar* app_uri); GDIAL_STATIC GDialAppRegistry *gdial_rest_server_find_app_registry(GDialRestServer *self, const gchar *app_name); G_END_DECLS diff --git a/server/gdial-ssdp.c b/server/gdial-ssdp.c index 4b9f2119..d2ed7808 100644 --- a/server/gdial-ssdp.c +++ b/server/gdial-ssdp.c @@ -75,6 +75,8 @@ static const char ssdp_device_xml_template[] = "" static gchar *dd_xml_response_str_ = NULL; static gchar *app_friendly_name = NULL; static gchar *app_random_uuid = NULL; +static gchar *app_manufacturer_name = NULL; +static gchar *app_model_name = NULL; static pthread_mutex_t ssdpServerEventSync = PTHREAD_MUTEX_INITIALIZER; static void ssdp_http_server_callback(SoupServer *server, SoupMessage *msg, const char *path, GHashTable *query, SoupClientContext *client, gpointer user_data) { @@ -95,8 +97,8 @@ static void ssdp_http_server_callback(SoupServer *server, SoupMessage *msg, cons static size_t dd_xml_response_str_len = 0; if (!dd_xml_response_str_) { - const gchar *manufacturer= gdial_plat_dev_get_manufacturer(); - const gchar *model = gdial_plat_dev_get_model(); + const gchar *manufacturer= app_manufacturer_name; + const gchar *model = app_model_name; if (manufacturer == NULL) { manufacturer = gdial_options_->manufacturer; @@ -344,4 +346,44 @@ int gdial_ssdp_set_friendlyname(const gchar *friendlyname) } pthread_mutex_unlock(&ssdpServerEventSync); return 0; +} + +int gdial_ssdp_set_manufacturername(const gchar *manufacturer_name) +{ + pthread_mutex_lock(&ssdpServerEventSync); + if(manufacturer_name) + { + if (app_manufacturer_name != NULL) { + g_free(app_manufacturer_name); + } + app_manufacturer_name = g_strdup(manufacturer_name); + + GDIAL_LOGINFO("app_manufacturer_name :%s ",app_manufacturer_name); + if (dd_xml_response_str_!= NULL){ + g_free(dd_xml_response_str_); + dd_xml_response_str_ = NULL; + } + } + pthread_mutex_unlock(&ssdpServerEventSync); + return 0; +} + +int gdial_ssdp_set_modelname(const gchar *model_name) +{ + pthread_mutex_lock(&ssdpServerEventSync); + if(model_name) + { + if (app_model_name != NULL) { + g_free(app_model_name); + } + app_model_name = g_strdup(model_name); + + GDIAL_LOGINFO("app_model_name :%s ",app_model_name); + if (dd_xml_response_str_!= NULL){ + g_free(dd_xml_response_str_); + dd_xml_response_str_ = NULL; + } + } + pthread_mutex_unlock(&ssdpServerEventSync); + return 0; } \ No newline at end of file diff --git a/server/gdial-ssdp.h b/server/gdial-ssdp.h index 838b148f..3522e6df 100644 --- a/server/gdial-ssdp.h +++ b/server/gdial-ssdp.h @@ -30,6 +30,8 @@ int gdial_ssdp_new(SoupServer *server, GDialOptions *options, const gchar *rando int gdial_ssdp_destroy(); int gdial_ssdp_set_available(bool activationStatus, const gchar *friendlyName); int gdial_ssdp_set_friendlyname(const gchar *friendlyName); +int gdial_ssdp_set_manufacturername(const gchar *manufacturer_name); +int gdial_ssdp_set_modelname(const gchar *model_name); G_END_DECLS #endif diff --git a/server/gdialservice.cpp b/server/gdialservice.cpp index f0b6ee88..c41cf79d 100644 --- a/server/gdialservice.cpp +++ b/server/gdialservice.cpp @@ -171,6 +171,16 @@ static void server_friendlyname_handler(const gchar * friendlyname) gdial_ssdp_set_friendlyname(friendlyname); } +static void server_manufacturername_handler(const gchar * manufacturername) +{ + gdial_ssdp_set_manufacturername(manufacturername); +} + +static void server_modelname_handler(const gchar * modelname) +{ + gdial_ssdp_set_modelname(modelname); +} + static void server_powerstate_handler(const gchar * powerState) { gdialServiceImpl::getInstance()->updatePowerState(std::string(powerState)); @@ -268,6 +278,10 @@ int gdialServiceImpl::start_GDialServer(int argc, char *argv[]) gdail_plat_register_activation_cb(server_activation_handler); gdail_plat_register_friendlyname_cb(server_friendlyname_handler); + + gdail_plat_register_manufacturername_cb(server_manufacturername_handler); + gdail_plat_register_modelname_cb(server_modelname_handler); + gdail_plat_register_registerapps_cb (server_register_application); gdail_plat_dev_register_powerstate_cb(server_powerstate_handler); @@ -678,6 +692,18 @@ void *gdialServiceImpl::requestHandlerThread(void *ctx) gdial_plat_application_update_network_standby_mode((gboolean)reqHdlrPayload.user_param1); } break; + case UPDATE_MANUFACTURER_NAME: + { + GDIAL_LOGINFO("UPDATE_MANUFACTURER_NAME : data:%s",reqHdlrPayload.manufacturer.c_str()); + gdial_plat_application_update_manufacturer_name(reqHdlrPayload.manufacturer.c_str()); + } + break; + case UPDATE_MODEL_NAME: + { + GDIAL_LOGINFO("UPDATE_MODEL_NAME : data:%s",reqHdlrPayload.model.c_str()); + gdial_plat_application_update_model_name(reqHdlrPayload.model.c_str()); + } + break; default: { @@ -1043,6 +1069,39 @@ void gdialService::setNetworkStandbyMode(bool nwStandbymode) GDIAL_LOGTRACE("Exiting ..."); } + +GDIAL_SERVICE_ERROR_CODES gdialService::setManufacturerName(string manufacturer) +{ + gdialServiceImpl* gdialImplInstance = gdialServiceImpl::getInstance(); + GDIAL_LOGTRACE("Entering ..."); + GDIAL_LOGINFO("Manufacturer[%s]",manufacturer.c_str()); + if ((nullptr != m_gdialService ) && (nullptr != gdialImplInstance)) + { + RequestHandlerPayload payload; + payload.event = UPDATE_MANUFACTURER_NAME; + payload.manufacturer = manufacturer; + gdialImplInstance->sendRequest(payload); + } + GDIAL_LOGTRACE("Exiting ..."); + return GDIAL_SERVICE_ERROR_NONE; +} + +GDIAL_SERVICE_ERROR_CODES gdialService::setModelName(string model) +{ + gdialServiceImpl* gdialImplInstance = gdialServiceImpl::getInstance(); + GDIAL_LOGTRACE("Entering ..."); + GDIAL_LOGINFO("Model[%s]",model.c_str()); + if ((nullptr != m_gdialService ) && (nullptr != gdialImplInstance)) + { + RequestHandlerPayload payload; + payload.event = UPDATE_MODEL_NAME; + payload.model = model; + gdialImplInstance->sendRequest(payload); + } + GDIAL_LOGTRACE("Exiting ..."); + return GDIAL_SERVICE_ERROR_NONE; +} + void gdialServiceImpl::sendRequest( const RequestHandlerPayload& payload ) { GDIAL_LOGTRACE("Entering ..."); diff --git a/server/include/gdial-plat-app.h b/server/include/gdial-plat-app.h index 8a5134a9..8382f3ab 100644 --- a/server/include/gdial-plat-app.h +++ b/server/include/gdial-plat-app.h @@ -32,9 +32,13 @@ typedef void * gdial_async_handler_t; typedef void (*gdial_plat_activation_cb)(gboolean, const gchar *); typedef void (*gdial_plat_friendlyname_cb)(const gchar *); typedef void (*gdial_plat_registerapps_cb)(gpointer); +typedef void (*gdial_plat_manufacturername_cb)(const gchar *); +typedef void (*gdial_plat_modelname_cb)(const gchar *); void gdail_plat_register_activation_cb(gdial_plat_activation_cb cb); void gdail_plat_register_friendlyname_cb(gdial_plat_friendlyname_cb cb); void gdail_plat_register_registerapps_cb(gdial_plat_registerapps_cb cb); +void gdail_plat_register_manufacturername_cb(gdial_plat_manufacturername_cb cb); +void gdail_plat_register_modelname_cb(gdial_plat_modelname_cb cb); GDialAppError gdial_plat_application_start(const gchar *app_name, const gchar *payload, const gchar *query, const gchar *additional_data_url, gint *instance_id); GDialAppError gdial_plat_application_hide(const gchar *app_name, gint instance_id); @@ -48,6 +52,8 @@ GDialAppError gdial_plat_application_friendlyname_changed(const char *friendlyna const char* gdial_plat_application_get_protocol_version(); GDialAppError gdial_plat_application_register_applications(void*); void gdial_plat_application_update_network_standby_mode(gboolean nwstandbyMode); +GDialAppError gdial_plat_application_update_manufacturer_name(const char *manufacturer); +GDialAppError gdial_plat_application_update_model_name(const char *model); GDialAppError gdial_plat_application_service_notification(gboolean isNotifyRequired, void* notifier); void * gdial_plat_application_start_async(const gchar *app_name, const gchar *payload, const gchar *query, const gchar *additional_data_url, void *user_data); diff --git a/server/include/gdial-plat-dev.h b/server/include/gdial-plat-dev.h index 99ca0e53..05b607d4 100644 --- a/server/include/gdial-plat-dev.h +++ b/server/include/gdial-plat-dev.h @@ -26,8 +26,6 @@ extern "C" { #endif -const char * gdial_plat_dev_get_manufacturer(); -const char * gdial_plat_dev_get_model(); bool gdial_plat_dev_set_power_state_on(); bool gdial_plat_dev_set_power_state_off(); bool gdial_plat_dev_toggle_power_state(); diff --git a/server/include/gdial_app_registry.h b/server/include/gdial_app_registry.h index 02fbae09..1a701318 100644 --- a/server/include/gdial_app_registry.h +++ b/server/include/gdial_app_registry.h @@ -32,7 +32,10 @@ G_BEGIN_DECLS +#define APP_MAX_UUID_SIZE 64 + typedef struct _GDialAppRegistry { + gchar app_uri[APP_MAX_UUID_SIZE+1]; // for storing uri gchar *name; gboolean use_additional_data; gboolean is_singleton; diff --git a/server/include/gdialservice.h b/server/include/gdialservice.h index 179a1d47..e3523868 100644 --- a/server/include/gdialservice.h +++ b/server/include/gdialservice.h @@ -41,10 +41,12 @@ class gdialService string getProtocolVersion(void); GDIAL_SERVICE_ERROR_CODES RegisterApplications(RegisterAppEntryList* appConfigList); void setNetworkStandbyMode(bool nwStandbymode); + GDIAL_SERVICE_ERROR_CODES setManufacturerName(string manufacturer); + GDIAL_SERVICE_ERROR_CODES setModelName(string model); private: GDialNotifier* m_observer{nullptr}; gdialService(){}; virtual ~gdialService(){}; }; -#endif /* gdialService_hpp */ \ No newline at end of file +#endif /* gdialService_hpp */ diff --git a/server/include/gdialserviceimpl.h b/server/include/gdialserviceimpl.h index 29fd6168..5733b43e 100644 --- a/server/include/gdialserviceimpl.h +++ b/server/include/gdialserviceimpl.h @@ -37,6 +37,8 @@ typedef enum _AppRequestEvents FRIENDLYNAME_CHANGED, REGISTER_APPLICATIONS, UPDATE_NW_STANDBY, + UPDATE_MANUFACTURER_NAME, + UPDATE_MODEL_NAME, INVALID_REQUEST } AppRequestEvents; @@ -59,6 +61,8 @@ typedef struct _RequestHandlerPayload std::string appIdOractivation; std::string state; std::string error; + std::string manufacturer; + std::string model; void* data_param; bool user_param1; AppRequestEvents event; diff --git a/server/plat/CMakeLists.txt b/server/plat/CMakeLists.txt index 341fee74..c6fa074d 100644 --- a/server/plat/CMakeLists.txt +++ b/server/plat/CMakeLists.txt @@ -69,4 +69,4 @@ if(PLATFORM) endif() add_library(gdial-plat SHARED ${GDIAL_PLAT_LIB_SOURCE_FILES}) -target_link_Libraries(gdial-plat PRIVATE ${GLIB_LIBRARIES} ${GOBJECT_LIBRARIES} -lpthread -lWPEFrameworkCore -lWPEFrameworkDefinitions -lWPEFrameworkCOM -lWPEFrameworkPlugins -lWPEFrameworkSecurityUtil -lIARMBus) +target_link_Libraries(gdial-plat PRIVATE ${GLIB_LIBRARIES} ${GOBJECT_LIBRARIES} -lpthread -lWPEFrameworkCore -lWPEFrameworkDefinitions -lWPEFrameworkCOM -lWPEFrameworkPlugins -lWPEFrameworkSecurityUtil -lIARMBus -luuid) diff --git a/server/plat/gdial-os-app.h b/server/plat/gdial-os-app.h index 43229602..c2ed67e1 100644 --- a/server/plat/gdial-os-app.h +++ b/server/plat/gdial-os-app.h @@ -39,6 +39,8 @@ int gdial_os_application_friendlyname_changed(const char *friendlyname); const char* gdial_os_application_get_protocol_version(); int gdial_os_application_register_applications(void*); void gdial_os_application_update_network_standby_mode(gboolean nwstandbyMode); +int gdial_os_application_update_manufacturer_name(const char *manufacturer); +int gdial_os_application_update_model_name(const char *model); int gdial_os_application_service_notification(gboolean isNotifyRequired, void* notifier); #ifdef __cplusplus diff --git a/server/plat/gdial-plat-app.c b/server/plat/gdial-plat-app.c index 56fef49a..0d2d0eea 100644 --- a/server/plat/gdial-plat-app.c +++ b/server/plat/gdial-plat-app.c @@ -35,6 +35,8 @@ static gpointer gdial_app_state_cb_user_data_ = NULL; static gdial_plat_activation_cb g_activation_cb = NULL; static gdial_plat_friendlyname_cb g_friendlyname_cb = NULL; static gdial_plat_registerapps_cb g_registerapps_cb = NULL; +static gdial_plat_manufacturername_cb g_manufacturername_cb = NULL; +static gdial_plat_modelname_cb g_modelname_cb = NULL; #define GDIAL_PLAT_APP_ASYNC_CONTEXT_TYPE_COMMON 0 #define GDIAL_PLAT_APP_ASYNC_CONTEXT_TYPE_START 1 @@ -151,6 +153,18 @@ void gdail_plat_register_registerapps_cb(gdial_plat_registerapps_cb cb) gdial_register_registerapps_cb(cb); } +void gdail_plat_register_manufacturername_cb(gdial_plat_manufacturername_cb cb) +{ + g_manufacturername_cb = cb; + gdial_register_manufacturername_cb(cb); +} + +void gdail_plat_register_modelname_cb(gdial_plat_modelname_cb cb) +{ + g_modelname_cb = cb; + gdial_register_modelname_cb(cb); +} + gint gdial_plat_init(GMainContext *main_context) { g_return_val_if_fail(main_context != NULL, GDIAL_APP_ERROR_INTERNAL); g_return_val_if_fail((g_main_context_ == NULL || g_main_context_ == main_context), GDIAL_APP_ERROR_INTERNAL); @@ -336,8 +350,22 @@ void gdial_plat_application_update_network_standby_mode(gboolean nwstandby) gdial_os_application_update_network_standby_mode(nwstandby); } +GDialAppError gdial_plat_application_update_manufacturer_name(const char *manufacturer) +{ + g_return_val_if_fail(manufacturer != NULL, GDIAL_APP_ERROR_BAD_REQUEST); + + return gdial_os_application_update_manufacturer_name(manufacturer); +} + +GDialAppError gdial_plat_application_update_model_name(const char *model) +{ + g_return_val_if_fail(model != NULL, GDIAL_APP_ERROR_BAD_REQUEST); + + return gdial_os_application_update_model_name(model); +} + GDialAppError gdial_plat_application_service_notification(gboolean isNotifyRequired, void* notifier) { g_return_val_if_fail((notifier != NULL)||(false == isNotifyRequired), GDIAL_APP_ERROR_BAD_REQUEST); return gdial_os_application_service_notification(isNotifyRequired,notifier); -} +} \ No newline at end of file diff --git a/server/plat/gdial-plat-dev.c b/server/plat/gdial-plat-dev.c index 55d4c40f..baef465a 100644 --- a/server/plat/gdial-plat-dev.c +++ b/server/plat/gdial-plat-dev.c @@ -25,14 +25,6 @@ static gdial_plat_dev_nwstandbymode_cb g_nwstandbymode_cb = NULL; static gdial_plat_dev_powerstate_cb g_powerstate_cb = NULL; -const char * gdial_plat_dev_get_manufacturer() { - return g_getenv("GDIAL_DEV_MANUFACTURER"); -} - -const char * gdial_plat_dev_get_model() { - return g_getenv("GDIAL_DEV_MODEL"); -} - void gdial_plat_dev_nwstandby_mode_change(gboolean NetworkStandbyMode) { if(g_nwstandbymode_cb) g_nwstandbymode_cb(NetworkStandbyMode); diff --git a/server/plat/gdial.cpp b/server/plat/gdial.cpp index 465cf5dc..175b8782 100644 --- a/server/plat/gdial.cpp +++ b/server/plat/gdial.cpp @@ -49,6 +49,8 @@ GDialAppStatusCache* AppCache = nullptr; static gdial_activation_cb g_activation_cb = NULL; static gdial_friendlyname_cb g_friendlyname_cb = NULL; static gdial_registerapps_cb g_registerapps_cb = NULL; +static gdial_manufacturername_cb g_manufacturername_cb = NULL; +static gdial_modelname_cb g_modelname_cb = NULL; #define DIAL_MAX_NUM_OF_APPS (64) #define DIAL_MAX_NUM_OF_APP_NAMES (64) @@ -68,7 +70,7 @@ class GDialCastObject AppInfo* AppObj = new AppInfo(applicationName,applicationId,state,error); if ((nullptr != AppObj) && (nullptr != AppCache)) { - GDIAL_LOGINFO("AppName : %s AppID : %s State : %s Error : %s", + GDIAL_LOGINFO("AppName[%s] AppID[%s] State[%s] Error[%s]", AppObj->appName.c_str(), AppObj->appId.c_str(), AppObj->appState.c_str(), @@ -88,7 +90,7 @@ class GDialCastObject GDialErrorCode error = GDIAL_CAST_ERROR_INTERNAL; if( g_friendlyname_cb && friendlyname ) { - GDIAL_LOGINFO("GDialCastObject::friendlyNameChanged :%s ",friendlyname); + GDIAL_LOGINFO("GDialCastObject::friendlyNameChanged:[%s]",friendlyname); g_friendlyname_cb(friendlyname); error = GDIAL_CAST_ERROR_NONE; } @@ -111,7 +113,7 @@ class GDialCastObject { break; } - GDIAL_LOGINFO("Application: %d ", i); + GDIAL_LOGINFO("Application:[%d]", i); gAppPrefxes = g_list_prepend (gAppPrefxes, g_strdup(appEntry->prefixes.c_str())); GDIAL_LOGINFO("%s, ", appEntry->prefixes.c_str()); GDIAL_LOGINFO(""); @@ -123,7 +125,7 @@ class GDialCastObject GHashTable *gProperties = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); std::string appAllowStop = appEntry->allowStop ? "true" : "false"; g_hash_table_insert(gProperties,g_strdup("allowStop"),g_strdup(appAllowStop.c_str())); - GDIAL_LOGINFO("allowStop: %s", appAllowStop.c_str()); + GDIAL_LOGINFO("allowStop:[%s]", appAllowStop.c_str()); GDIAL_LOGINFO(""); GDialAppRegistry* app_registry = gdial_app_registry_new( g_strdup(appEntry->Names.c_str()), @@ -165,7 +167,7 @@ class GDialCastObject { GDIAL_LOGTRACE("Entering ..."); GDialErrorCode error = GDIAL_CAST_ERROR_INTERNAL; - GDIAL_LOGINFO("status: %s friendlyname: %s ",status.c_str(),friendlyName.c_str()); + GDIAL_LOGINFO("status[%s] friendlyname[%s]",status.c_str(),friendlyName.c_str()); if( g_activation_cb ) { if(!strcmp(status.c_str(), "true")) @@ -176,7 +178,7 @@ class GDialCastObject { g_activation_cb(0,friendlyName.c_str()); } - GDIAL_LOGINFO("status: %s g_activation_cb :%p",status.c_str(), g_activation_cb); + GDIAL_LOGINFO("status[%s] g_activation_cb[%p]",status.c_str(), g_activation_cb); error = GDIAL_CAST_ERROR_NONE; } GDIAL_LOGTRACE("Exiting ..."); @@ -189,14 +191,48 @@ class GDialCastObject gdial_plat_dev_nwstandby_mode_change(nwstandbyMode); GDIAL_LOGTRACE("Exiting ..."); } + + GDialErrorCode updateManufacturerName(const char* manufacturerName) + { + GDIAL_LOGTRACE("Entering ..."); + GDialErrorCode error = GDIAL_CAST_ERROR_INTERNAL; + if( g_manufacturername_cb && manufacturerName ) + { + GDIAL_LOGINFO("Manufacturer[%s]",manufacturerName); + g_manufacturername_cb(manufacturerName); + error = GDIAL_CAST_ERROR_NONE; + } + GDIAL_LOGTRACE("Exiting ..."); + return error; + } + + GDialErrorCode updateModelName(const char* modelName) + { + GDIAL_LOGTRACE("Entering ..."); + GDialErrorCode error = GDIAL_CAST_ERROR_INTERNAL; + if( g_modelname_cb && modelName ) + { + GDIAL_LOGINFO("ModelName[%s]",modelName); + g_modelname_cb(modelName); + error = GDIAL_CAST_ERROR_NONE; + } + GDIAL_LOGTRACE("Exiting ..."); + return error; + } GDialErrorCode launchApplication(const char* appName, const char* args) { GDIAL_LOGTRACE("Entering ..."); std::string applicationName = "", parameter = ""; - if (nullptr!=appName) applicationName = appName; - if (nullptr!=args) parameter = args; + + if (nullptr!=appName){ + applicationName = appName; + } + + if (nullptr!=args){ + parameter = args; + } GDIAL_LOGINFO("App[%s] param[%s] observer[%p]",applicationName.c_str(),parameter.c_str(),m_observer); if (nullptr!=m_observer) @@ -215,10 +251,18 @@ class GDialCastObject additionalDataUrl = ""; GDIAL_LOGTRACE("Entering ..."); - if (nullptr!=appName) applicationName = appName; - if (nullptr!=argPayload) payLoad = argPayload; - if (nullptr!=argQueryString) queryString = argQueryString; - if (nullptr!=argAdditionalDataUrl) additionalDataUrl = argAdditionalDataUrl; + if (nullptr!=appName){ + applicationName = appName; + } + if (nullptr!=argPayload){ + payLoad = argPayload; + } + if (nullptr!=argQueryString){ + queryString = argQueryString; + } + if (nullptr!=argAdditionalDataUrl){ + additionalDataUrl = argAdditionalDataUrl; + } GDIAL_LOGINFO("App[%s] payload[%s] query_string[%s] additional_data_url[%s]observer[%p]", applicationName.c_str(), @@ -242,8 +286,12 @@ class GDialCastObject GDIAL_LOGTRACE("Entering ..."); std::string applicationName = "", applicationId = ""; - if (nullptr!=appName) applicationName = appName; - if (nullptr!=appID) applicationId = appID; + if (nullptr!=appName){ + applicationName = appName; + } + if (nullptr!=appID){ + applicationId = appID; + } GDIAL_LOGINFO("App[%s]ID[%s]observer[%p]",applicationName.c_str(),applicationId.c_str(),m_observer); if (nullptr!=m_observer) @@ -260,8 +308,12 @@ class GDialCastObject std::string applicationName = "", applicationId = ""; - if (nullptr!=appName) applicationName = appName; - if (nullptr!=appID) applicationId = appID; + if (nullptr!=appName){ + applicationName = appName; + } + if (nullptr!=appID){ + applicationId = appID; + } GDIAL_LOGINFO("App[%s]ID[%s]observer[%p]",applicationName.c_str(),applicationId.c_str(),m_observer); if (nullptr!=m_observer) @@ -278,8 +330,12 @@ class GDialCastObject std::string applicationName = "", applicationId = ""; - if (nullptr!=appName) applicationName = appName; - if (nullptr!=appID) applicationId = appID; + if (nullptr!=appName){ + applicationName = appName; + } + if (nullptr!=appID){ + applicationId = appID; + } GDIAL_LOGINFO("App[%s]ID[%s]observer[%p]",applicationName.c_str(),applicationId.c_str(),m_observer); if (nullptr!=m_observer) @@ -296,8 +352,12 @@ class GDialCastObject std::string applicationName = "", applicationId = ""; - if (nullptr!=appName) applicationName = appName; - if (nullptr!=appID) applicationId = appID; + if (nullptr!=appName){ + applicationName = appName; + } + if (nullptr!=appID){ + applicationId = appID; + } GDIAL_LOGINFO("App[%s]ID[%s]observer[%p]",applicationName.c_str(),applicationId.c_str(),m_observer); if (nullptr!=m_observer) @@ -333,6 +393,16 @@ void gdial_register_registerapps_cb(gdial_registerapps_cb cb) g_registerapps_cb = cb; } +void gdial_register_manufacturername_cb(gdial_manufacturername_cb cb) +{ + g_manufacturername_cb = cb; +} + +void gdial_register_modelname_cb(gdial_modelname_cb cb) +{ + g_modelname_cb = cb; +} + bool gdial_init(GMainContext *context) { bool returnValue = false; @@ -435,7 +505,7 @@ map parse_query(const char* query_string) { int gdial_os_application_start(const char *app_name, const char *payload, const char *query_string, const char *additional_data_url, int *instance_id) { GDIAL_LOGTRACE("Entering ..."); - GDIAL_LOGINFO("App launch req: appName: %s query: [%s], payload: [%s], additionalDataUrl [%s] instance[%p]", + GDIAL_LOGINFO("App launch req: appName[%s] query[%s], payload[%s], additionalDataUrl [%s] instance[%p]", app_name, query_string, payload, additional_data_url,instance_id); if (strcmp(app_name,"system") == 0) { @@ -508,20 +578,20 @@ std::string GetCurrentState() { } else { string sToken = (char*)buffer; string query = "token=" + sToken; - GDIAL_LOGINFO("Security token = %s ",query.c_str()); + GDIAL_LOGINFO("Security token[%s] ",query.c_str()); controllerRemoteObject = new JSONRPC::LinkType(std::string(), false, query); } } std::string nfxstatus = "status@" + nfx_callsign; if(controllerRemoteObject->Get(1000, _T(nfxstatus), pluginResponse) == Core::ERROR_NONE) { - GDIAL_LOGINFO("Obtained netflix status = %s",nfxstatus.c_str()); + GDIAL_LOGINFO("Obtained netflix status[%s]",nfxstatus.c_str()); Core::JSON::ArrayType::Iterator index(pluginResponse.Elements()); while (index.Next() == true) { netflixState = index.Current().JSONState.Data(); } //end of while loop } //end of if case for querrying - GDIAL_LOGINFO("Netflix State = %s",netflixState.c_str()); + GDIAL_LOGINFO("Netflix State[%s]",netflixState.c_str()); return netflixState; } void stop_netflix() @@ -541,7 +611,7 @@ void stop_netflix() int gdial_os_application_stop(const char *app_name, int instance_id) { bool enable_stop = false; GDIAL_LOGTRACE("Entering ..."); - GDIAL_LOGINFO("AppName = %s appID = %s",app_name,std::to_string(instance_id).c_str()); + GDIAL_LOGINFO("AppName[%s] appID[%s]",app_name,std::to_string(instance_id).c_str()); if((strcmp(app_name,"system") == 0)){ GDIAL_LOGINFO("delete not supported for system app return GDIAL_APP_ERROR_BAD_REQUEST"); return GDIAL_APP_ERROR_BAD_REQUEST; @@ -591,7 +661,7 @@ int gdial_os_application_hide(const char *app_name, int instance_id) return GDIAL_APP_ERROR_NONE; } #if 0 - GDIAL_LOGINFO("gdial_os_application_hide-->stop: appName = %s appID = %s",app_name,std::to_string(instance_id).c_str()); + GDIAL_LOGINFO("gdial_os_application_hide-->stop: appName[%s] appID[%s]",app_name,std::to_string(instance_id).c_str()); std::string State = AppCache->SearchAppStatusInCache(app_name); if (0 && State != "running") { return GDIAL_APP_ERROR_BAD_REQUEST; @@ -607,7 +677,7 @@ int gdial_os_application_hide(const char *app_name, int instance_id) } return GDIAL_APP_ERROR_NONE; #else - GDIAL_LOGINFO("gdial_os_application_hide: appName = %s appID = %s",app_name,std::to_string(instance_id).c_str()); + GDIAL_LOGINFO("gdial_os_application_hide: appName[%s] appID[%s]",app_name,std::to_string(instance_id).c_str()); std::string State = AppCache->SearchAppStatusInCache(app_name); if (State != "running") { @@ -635,7 +705,7 @@ int gdial_os_application_hide(const char *app_name, int instance_id) int gdial_os_application_resume(const char *app_name, int instance_id) { GDIAL_LOGTRACE("Entering ..."); - GDIAL_LOGINFO("appName = %s appID = %s",app_name,std::to_string(instance_id).c_str()); + GDIAL_LOGINFO("appName[%s] appID[%s]",app_name,std::to_string(instance_id).c_str()); if((strcmp(app_name,"system") == 0)){ GDIAL_LOGINFO("system app can not be resume"); @@ -668,7 +738,7 @@ int gdial_os_application_resume(const char *app_name, int instance_id) { int gdial_os_application_state(const char *app_name, int instance_id, GDialAppState *state) { GDIAL_LOGTRACE("Entering ..."); - GDIAL_LOGINFO("App = %s Id = %d",app_name,instance_id); + GDIAL_LOGINFO("App[%s] Id[%d]",app_name,instance_id); if((strcmp(app_name,"system") == 0)){ *state = GDIAL_APP_STATE_HIDE; GDIAL_LOGINFO("getApplicationState: AppState = suspended "); @@ -676,7 +746,7 @@ int gdial_os_application_state(const char *app_name, int instance_id, GDialAppSt return GDIAL_APP_ERROR_NONE; } std::string State = AppCache->SearchAppStatusInCache(app_name); - GDIAL_LOGINFO("getApplicationState: AppState = %s ",State.c_str()); + GDIAL_LOGINFO("getApplicationState: AppState[%s] ",State.c_str()); /* * return cache, but also trigger a refresh */ @@ -710,7 +780,7 @@ int gdial_os_application_state(const char *app_name, int instance_id, GDialAppSt if ( enable_stop != NULL ) { if (strcmp(app_name,"Netflix") == 0 && strcmp(enable_stop,"true") == 0) { std::string app_state = GetCurrentState(); - GDIAL_LOGINFO("Presence of Netflix thunder plugin state = %s to confirm state", app_state.c_str()); + GDIAL_LOGINFO("Presence of Netflix thunder plugin state[%s] to confirm state", app_state.c_str()); if (app_state == "deactivated") { *state = GDIAL_APP_STATE_STOPPED; GDIAL_LOGINFO("app [%s] state converted to [%d]", app_name, *state); @@ -732,7 +802,7 @@ int gdial_os_application_state(const char *app_name, int instance_id, GDialAppSt int gdial_os_application_state_changed(const char *applicationName, const char *applicationId, const char *state, const char *error) { GDIAL_LOGTRACE("Entering ..."); - GDIAL_LOGINFO("appName: %s appId: [%s], state: [%s], error [%s]",applicationName, applicationId, state, error); + GDIAL_LOGINFO("appName[%s] appId[%s], state[%s], error [%s]",applicationName, applicationId, state, error); if (nullptr == GDialObjHandle) { @@ -755,7 +825,7 @@ int gdial_os_application_state_changed(const char *applicationName, const char * int gdial_os_application_activation_changed(const char *activation, const char *friendlyname) { GDIAL_LOGTRACE("Entering ..."); - GDIAL_LOGINFO("activation: %s friendlyname: [%s]",activation, friendlyname); + GDIAL_LOGINFO("activation[%s] friendlyname[%s]",activation, friendlyname); if (nullptr == GDialObjHandle) { @@ -778,7 +848,7 @@ int gdial_os_application_activation_changed(const char *activation, const char * int gdial_os_application_friendlyname_changed(const char *friendlyname) { GDIAL_LOGTRACE("Entering ..."); - GDIAL_LOGINFO("friendlyname: [%s]",friendlyname); + GDIAL_LOGINFO("friendlyname[%s]",friendlyname); if (nullptr == GDialObjHandle) { @@ -849,6 +919,47 @@ void gdial_os_application_update_network_standby_mode(gboolean nwstandbymode) GDIAL_LOGTRACE("Exiting ..."); } +int gdial_os_application_update_manufacturer_name(const char *manufacturer) +{ + GDialErrorCode returnValue = GDIAL_CAST_ERROR_INTERNAL; + GDIAL_LOGTRACE("Entering ..."); + if ((nullptr == GDialObjHandle)||(nullptr == manufacturer)) + { + GDIAL_LOGERROR("NULL GDialObjHandle[%p] manufacturer[%p]",GDialObjHandle,manufacturer); + } + else + { + GDIAL_LOGINFO("Manufacturer[%s]", manufacturer); + returnValue = GDialObjHandle->updateManufacturerName(manufacturer); + if (returnValue != GDIAL_CAST_ERROR_NONE) { + GDIAL_LOGERROR("Failed to updateManufacturerName. Error=%x",returnValue); + } + } + + GDIAL_LOGTRACE("Exiting ..."); + return returnValue; +} + +int gdial_os_application_update_model_name(const char *model) +{ + GDialErrorCode returnValue = GDIAL_CAST_ERROR_INTERNAL; + GDIAL_LOGTRACE("Entering ..."); + if ((nullptr == GDialObjHandle)||(nullptr == model)) + { + GDIAL_LOGERROR("NULL GDialObjHandle[%p] manufacturer[%p]",GDialObjHandle,model); + } + else + { + GDIAL_LOGINFO("Model[%s]", model); + returnValue = GDialObjHandle->updateModelName(model); + if (returnValue != GDIAL_CAST_ERROR_NONE) { + GDIAL_LOGERROR("Failed to updateModelName. Error=%x",returnValue); + } + } + GDIAL_LOGTRACE("Exiting ..."); + return returnValue; +} + int gdial_os_application_service_notification(gboolean isNotifyRequired, void* notifier) { GDIAL_LOGTRACE("Entering ..."); @@ -870,4 +981,4 @@ int gdial_os_application_service_notification(gboolean isNotifyRequired, void* n } GDIAL_LOGTRACE("Exiting ..."); return GDIAL_APP_ERROR_NONE; -} +} \ No newline at end of file diff --git a/server/plat/gdial.hpp b/server/plat/gdial.hpp index dcd36d2e..6570e974 100644 --- a/server/plat/gdial.hpp +++ b/server/plat/gdial.hpp @@ -45,9 +45,14 @@ void gdial_term(); typedef void (*gdial_activation_cb)(bool, const gchar *); typedef void (*gdial_friendlyname_cb)(const gchar *); typedef void (*gdial_registerapps_cb)(gpointer); +typedef void (*gdial_manufacturername_cb)(const gchar *); +typedef void (*gdial_modelname_cb)(const gchar *); + void gdial_register_activation_cb(gdial_activation_cb cb); void gdial_register_friendlyname_cb(gdial_friendlyname_cb cb); void gdial_register_registerapps_cb(gdial_registerapps_cb cb); +void gdial_register_manufacturername_cb(gdial_manufacturername_cb cb); +void gdial_register_modelname_cb(gdial_manufacturername_cb cb); #ifdef __cplusplus } diff --git a/server/plat/gdial_app_registry.c b/server/plat/gdial_app_registry.c index c3346470..2ef69c77 100644 --- a/server/plat/gdial_app_registry.c +++ b/server/plat/gdial_app_registry.c @@ -19,9 +19,12 @@ * limitations under the License. */ +#include #include #include "gdialservicelogging.h" +#define UUID_FILE_TEMPLATE "/tmp/.dial_%s_uuid.txt" + #define GDIAL_STR_ENDS_WITH(s1, s2) ((s1 != NULL) && (s2 != NULL) && ((strlen(s2) == 0) || (g_str_has_suffix(s1, s2)))) void gdial_app_regstry_dispose (GDialAppRegistry *app_registry) { @@ -92,5 +95,34 @@ GDialAppRegistry* gdial_app_registry_new (const gchar *app_name, const GList *ap app_registry->allowed_origins = g_list_prepend(app_registry->allowed_origins, g_strdup(allowed_origins->data)); allowed_origins = allowed_origins->next; } + + char app_uuid_file_path[64] = {0}; + char uuid_data[APP_MAX_UUID_SIZE] = {0}; + snprintf( app_uuid_file_path, sizeof(app_uuid_file_path), UUID_FILE_TEMPLATE , app_name); + + FILE *fuuid = fopen(app_uuid_file_path, "r"); + if (fuuid == NULL) + { + uuid_t random_uuid; + uuid_generate_random(random_uuid); + uuid_unparse(random_uuid, uuid_data); + GDIAL_LOGINFO("generated uuid:[%s]", uuid_data); + + fuuid = fopen(app_uuid_file_path, "w"); + if (fuuid != NULL) + { + fprintf(fuuid, "%s", uuid_data); + fclose(fuuid); + } + } + else + { + fgets(uuid_data, sizeof(uuid_data), fuuid); + fclose(fuuid); + } + + snprintf( app_registry->app_uri, sizeof(app_registry->app_uri), "/%s" , uuid_data); + GDIAL_LOGINFO("App:[%s] uuid:[%s] per Bootup", app_name, uuid_data); + return app_registry; -} +} \ No newline at end of file From a503f9e66afaaf89a31ab3ba148d130625fa3fd7 Mon Sep 17 00:00:00 2001 From: yuvaramachandran_gurusamy Date: Fri, 21 Mar 2025 15:55:22 +0000 Subject: [PATCH 06/18] RDK-56672: Fix parsing issue while restrict addtionalData url per app Signed-off-by: yuvaramachandran_gurusamy --- server/gdial-rest.c | 56 ++++++++++++++++++++++++++++++--------------- server/gdial-rest.h | 1 + 2 files changed, 39 insertions(+), 18 deletions(-) diff --git a/server/gdial-rest.c b/server/gdial-rest.c index 2312b85a..ea9959a4 100644 --- a/server/gdial-rest.c +++ b/server/gdial-rest.c @@ -159,7 +159,7 @@ static GList *gdial_rest_server_registered_apps_clear(GDialRestServer *self, GLi GDialRestServerPrivate *priv = gdial_rest_server_get_instance_private(self); GDialAppRegistry *app_registry = (GDialAppRegistry *)found->data; registered_apps = g_list_remove_link(registered_apps, found); - GDIAL_LOGINFO("Removing handler for app[%s]", app_registry->name); + GDIAL_LOGINFO("gdial_local_rest_http_server_callback handler Removed for App[%s]instance[%x]", app_registry->name,priv->local_soup_instance); soup_server_remove_handler(priv->local_soup_instance, app_registry->app_uri); gdial_app_regstry_dispose (app_registry); g_list_free(found); @@ -211,6 +211,14 @@ static gint GCompareFunc_match_registry_app_name(gconstpointer a, gconstpointer return is_matched ? 0 : 1; } +static gint GCompareFunc_match_registry_app_uuid(gconstpointer a, gconstpointer b) { + GDialAppRegistry *app_registry = (GDialAppRegistry *)a; + int is_matched = 0; + /* match by exact uuid */ + is_matched = (g_strcmp0(&app_registry->app_uri[1], b) == 0); + return is_matched ? 0 : 1; +} + GDIAL_STATIC GDialAppRegistry *gdial_rest_server_find_app_registry(GDialRestServer *self, const gchar *app_name) { g_return_val_if_fail(self != NULL && app_name != NULL, FALSE); GDialRestServerPrivate *priv = gdial_rest_server_get_instance_private(self); @@ -221,6 +229,16 @@ GDIAL_STATIC GDialAppRegistry *gdial_rest_server_find_app_registry(GDialRestServ return NULL; } +GDIAL_STATIC GDialAppRegistry *gdial_rest_server_find_app_registry_by_uuid(GDialRestServer *self, const gchar *app_uuid) { + g_return_val_if_fail(self != NULL && app_uuid != NULL, FALSE); + GDialRestServerPrivate *priv = gdial_rest_server_get_instance_private(self); + GList *found = g_list_find_custom(priv->registered_apps, app_uuid, GCompareFunc_match_registry_app_uuid); + if (found) { + return (GDialAppRegistry *)found->data; + } + return NULL; + } + GDIAL_STATIC gboolean gdial_rest_server_is_allowed_youtube_origin(GDialRestServer *self, const gchar *header_origin, const gchar *app_name) { if (self == NULL) return FALSE; @@ -676,13 +694,12 @@ static void gdial_local_rest_http_server_callback(SoupServer *server, SoupMessage *msg, const gchar *path, GHashTable *query, SoupClientContext *client, gpointer user_data) { gchar *remote_address_str = g_inet_address_to_string(g_inet_socket_address_get_address(G_INET_SOCKET_ADDRESS(soup_client_context_get_remote_address(client)))); - g_print_with_timestamp("gdial_local_rest_http_server_callback() %s path=%s recv from [%s], in thread %lx", msg->method, path, remote_address_str, pthread_self()); + GDIAL_LOGINFO("method[%s] path[%s] recv from [%s], in thread %lx", msg->method, path, remote_address_str, pthread_self()); g_free(remote_address_str); GDialRestServer *gdial_rest_server = (GDIAL_REST_SERVER(user_data)); - gchar **elements = g_strsplit(&path[1], "/", 4); + gchar **elements = g_strsplit(&path[1], "/", 3); gdial_rest_server_http_return_if_fail(elements != NULL, msg, SOUP_STATUS_NOT_IMPLEMENTED); gchar base[GDIAL_REST_HTTP_PATH_COMPONENT_MAX_LEN] = {0}; - gchar app_name[GDIAL_REST_HTTP_PATH_COMPONENT_MAX_LEN] = {0}; gchar instance[GDIAL_REST_HTTP_PATH_COMPONENT_MAX_LEN] = {0}; gchar last_elem[GDIAL_REST_HTTP_PATH_COMPONENT_MAX_LEN] = {0}; int i = 0; @@ -694,37 +711,35 @@ static void gdial_local_rest_http_server_callback(SoupServer *server, GDIAL_LOGWARNING("Warn: empty elements in URI path"); continue; } - if (j == 0) g_strlcpy(base, elements[i], sizeof(base)); - else if (j == 1) { - ret = g_strlcpy(app_name, elements[i], sizeof(app_name)); - if (ret >= sizeof(app_name)) { - g_printerr("Warn: app_name too long\r\n"); - } + if (j == 0) { + g_strlcpy(base, elements[i], sizeof(base)); } - else if (j == 2) { + else if (j == 1) { ret = g_strlcpy(instance, elements[i], sizeof(instance)); if (ret >= sizeof(instance)) { - g_printerr("Warn: instance too long\r\n"); + GDIAL_LOGERROR("Warn: instance too long"); } } ret = g_strlcpy(last_elem, elements[i], sizeof(last_elem)); if (ret >= sizeof(last_elem)) { - g_printerr("Warn: last_elem too long\r\n"); + GDIAL_LOGERROR("Warn: last_elem too long"); } + GDIAL_LOGINFO("last_elem[%s]", last_elem); j++; } g_strfreev(elements); const int element_num = j; GDIAL_LOGINFO("there are %d non-empty elems", element_num); - if(element_num == 3 && g_strcmp0(instance,"dial_data") == 0) + if(element_num == 2 && g_strcmp0(instance,"dial_data") == 0) { - GDialAppRegistry *app_registry = gdial_rest_server_find_app_registry(gdial_rest_server, app_name); + GDialAppRegistry *app_registry = gdial_rest_server_find_app_registry_by_uuid(gdial_rest_server, base); + gdial_rest_server_http_return_if_fail(app_registry, msg, SOUP_STATUS_NOT_FOUND); if (msg->method == SOUP_METHOD_POST) { - gdial_rest_server_handle_POST_dial_data(gdial_rest_server, msg, query, app_name); + gdial_rest_server_handle_POST_dial_data(gdial_rest_server, msg, query, app_registry->name); } else if (msg->method == SOUP_METHOD_GET) { - gdial_rest_server_handle_GET_app(gdial_rest_server, msg, query, app_name, GDIAL_APP_INSTANCE_NULL); + gdial_rest_server_handle_GET_app(gdial_rest_server, msg, query, app_registry->name, GDIAL_APP_INSTANCE_NULL); } else { gdial_rest_server_http_return_if_fail(msg->method == SOUP_METHOD_POST, msg, SOUP_STATUS_NOT_IMPLEMENTED); @@ -1150,7 +1165,7 @@ gboolean gdial_rest_server_register_app(GDialRestServer *self, const gchar *app_ if( 0 != strcmp(app_name,"system")) { - GDIAL_LOGINFO("gdial_local_rest_http_server_callback add handler for app_name:[%s]",app_name); + GDIAL_LOGINFO("gdial_local_rest_http_server_callback handler added for App[%s]uri[%s]instance[%x]",app_name,app_registry->app_uri,priv->local_soup_instance); soup_server_add_handler(priv->local_soup_instance, app_registry->app_uri, gdial_local_rest_http_server_callback, self, NULL); } GDIAL_LOGTRACE("Exiting ..."); @@ -1180,6 +1195,11 @@ gboolean gdial_rest_server_register_app_registry(GDialRestServer *self, GDialApp g_return_val_if_fail(priv->registered_apps != NULL, FALSE); g_return_val_if_fail(gdial_rest_server_is_app_registered(self, app_registry->name), FALSE); + if( 0 != strcmp(app_registry->name,"system")) + { + GDIAL_LOGINFO("gdial_local_rest_http_server_callback handler added for App[%s]uri[%s]instance[%x]",app_registry->name,app_registry->app_uri,priv->local_soup_instance); + soup_server_add_handler(priv->local_soup_instance, app_registry->app_uri, gdial_local_rest_http_server_callback, self, NULL); + } return TRUE; } diff --git a/server/gdial-rest.h b/server/gdial-rest.h index 770d2463..8aa4f829 100644 --- a/server/gdial-rest.h +++ b/server/gdial-rest.h @@ -52,6 +52,7 @@ typedef struct _GDialAppRegistry GDialAppRegistry; GDIAL_STATIC gboolean gdial_rest_server_is_allowed_origin(GDialRestServer *self, const gchar *header_origin, const gchar *app_name); GDIAL_STATIC gchar *gdial_rest_server_new_additional_data_url(guint listening_port, const gchar *app_name, gboolean encode, const gchar* app_uri); GDIAL_STATIC GDialAppRegistry *gdial_rest_server_find_app_registry(GDialRestServer *self, const gchar *app_name); +GDIAL_STATIC GDialAppRegistry *gdial_rest_server_find_app_registry_by_uuid(GDialRestServer *self, const gchar *app_uuid); G_END_DECLS From 8e05add4289eba25842ebe05f5dadc3191b8347c Mon Sep 17 00:00:00 2001 From: tabbas651 Date: Mon, 14 Apr 2025 15:25:01 +0000 Subject: [PATCH 07/18] RDKEMW-2278: Removal of WPEFrameworkSecurity Agent Utility Reason for change: Added DISABLE_SECURITY_TOKEN Flag to disable the WPEFrameworkSecurity Token generation changes Test Procedure: please referred from the ticket Risks: Medium Signed-off-by: Thamim Razith --- Makefile | 2 +- server/plat/CMakeLists.txt | 12 +++++++++++- server/plat/gdial.cpp | 19 +++++++++++++------ 3 files changed, 25 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index 2ffd032e..32f94877 100644 --- a/Makefile +++ b/Makefile @@ -20,6 +20,6 @@ DIRS:= server all: - for dir in $(DIRS); do (cd $$dir && cmake $(PLATFORM_FLAGS) . && make || exit 1) || exit 1; done + for dir in $(DIRS); do (cd $$dir && cmake $(DISABLE_SECURITY_TOKEN) $(PLATFORM_FLAGS) . && make || exit 1) || exit 1; done clean: for dir in $(DIRS); do (cd $$dir && make clean || exit 1) || exit 1; done diff --git a/server/plat/CMakeLists.txt b/server/plat/CMakeLists.txt index c6fa074d..dcb8215c 100644 --- a/server/plat/CMakeLists.txt +++ b/server/plat/CMakeLists.txt @@ -27,6 +27,12 @@ set (GDIAL_PLAT_DEPEND_LIBRARIES "${GLIB_LIBRARIES} ${GOBJECT_LIBRARIES}") set(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_CXX_FLAGS} -std=c++11 -Wno-nonnull -DRT_PLATFORM_LINUX") +option(DISABLE_SECURITY_TOKEN "Disable security token" OFF) + +if(DISABLE_SECURITY_TOKEN) + add_definitions(-DDISABLE_SECURITY_TOKEN) +endif() + # # Template that generates .pc file # @@ -69,4 +75,8 @@ if(PLATFORM) endif() add_library(gdial-plat SHARED ${GDIAL_PLAT_LIB_SOURCE_FILES}) -target_link_Libraries(gdial-plat PRIVATE ${GLIB_LIBRARIES} ${GOBJECT_LIBRARIES} -lpthread -lWPEFrameworkCore -lWPEFrameworkDefinitions -lWPEFrameworkCOM -lWPEFrameworkPlugins -lWPEFrameworkSecurityUtil -lIARMBus -luuid) +if(DISABLE_SECURITY_TOKEN) + target_link_Libraries(gdial-plat PRIVATE ${GLIB_LIBRARIES} ${GOBJECT_LIBRARIES} -lpthread -lWPEFrameworkCore -lWPEFrameworkDefinitions -lWPEFrameworkCOM -lWPEFrameworkPlugins -lIARMBus -luuid) +else() + target_link_libraries(gdial-plat PRIVATE ${GLIB_LIBRARIES} ${GOBJECT_LIBRARIES} -lpthread -lWPEFrameworkCore -lWPEFrameworkDefinitions -lWPEFrameworkCOM -lWPEFrameworkPlugins -lWPEFrameworkSecurityUtil -lIARMBus -luuid) +endif() diff --git a/server/plat/gdial.cpp b/server/plat/gdial.cpp index d9a2f0d3..1415a2e5 100644 --- a/server/plat/gdial.cpp +++ b/server/plat/gdial.cpp @@ -32,7 +32,9 @@ #include #include #include +#ifndef DISABLE_SECURITY_TOKEN #include +#endif #include "gdial-app.h" #include "gdial-plat-dev.h" #include "gdial-os-app.h" @@ -572,21 +574,26 @@ std::string GetCurrentState() { std::string netflixState = ""; Core::JSON::ArrayType pluginResponse; Core::SystemInfo::SetEnvironment(_T("THUNDER_ACCESS"), (_T("127.0.0.1:9998"))); + string sToken = ""; + string query = ""; +#ifdef DISABLE_SECURITY_TOKEN + query = "token=" + sToken; +#else unsigned char buffer[MAX_LENGTH] = {0}; //Obtaining controller object if (NULL == controllerRemoteObject) { int ret = GetSecurityToken(MAX_LENGTH,buffer); - if(ret<0) + if(ret>0) { - controllerRemoteObject = new JSONRPC::LinkType(std::string()); - } else { - string sToken = (char*)buffer; - string query = "token=" + sToken; + sToken = (char*)buffer; + query = "token=" + sToken; GDIAL_LOGINFO("Security token[%s] ",query.c_str()); - controllerRemoteObject = new JSONRPC::LinkType(std::string(), false, query); } } +#endif + controllerRemoteObject = new JSONRPC::LinkType(std::string(), false, query); + std::string nfxstatus = "status@" + nfx_callsign; if(controllerRemoteObject->Get(1000, _T(nfxstatus), pluginResponse) == Core::ERROR_NONE) { From 81f4b8948f10b2a696c78cb16c0528a8d66f731b Mon Sep 17 00:00:00 2001 From: yuvaramachandran_gurusamy Date: Thu, 5 Jun 2025 15:31:43 +0000 Subject: [PATCH 08/18] RDKEMW-4129: Prepare native build environment Signed-off-by: yuvaramachandran_gurusamy --- .github/workflows/native_full_build.yml | 25 +++++++ build_dependencies.sh | 95 +++++++++++++++++++++++++ cov_build.sh | 23 ++++++ 3 files changed, 143 insertions(+) create mode 100755 .github/workflows/native_full_build.yml create mode 100755 build_dependencies.sh create mode 100755 cov_build.sh diff --git a/.github/workflows/native_full_build.yml b/.github/workflows/native_full_build.yml new file mode 100755 index 00000000..757298bf --- /dev/null +++ b/.github/workflows/native_full_build.yml @@ -0,0 +1,25 @@ +name: Build Component in Native Environment + +on: + push: + branches: [ main, 'sprint/**', 'release/**', topic/*, develop, topic/RDKEMW-4129 ] + pull_request: + branches: [ main, 'sprint/**', 'release/**', topic/*, develop, topic/RDKEMW-4129 ] + +jobs: + build-entservices-on-pr: + name: Build xdialserver component in github rdkcentral + runs-on: ubuntu-latest + container: + image: ghcr.io/rdkcentral/docker-rdk-ci:latest + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: native build + run: | + sh -x build_dependencies.sh + sh -x cov_build.sh + env: + GITHUB_TOKEN: ${{ secrets.RDKCM_RDKE }} diff --git a/build_dependencies.sh b/build_dependencies.sh new file mode 100755 index 00000000..c755d997 --- /dev/null +++ b/build_dependencies.sh @@ -0,0 +1,95 @@ +#!/bin/bash +set -x +set -e +############################## +GITHUB_WORKSPACE="${PWD}" +ls -la ${GITHUB_WORKSPACE} +cd ${GITHUB_WORKSPACE} + +# # ############################# +#1. Install Dependencies and packages + +apt update +#apt install -y libsqlite3-dev libcurl4-openssl-dev valgrind lcov clang libsystemd-dev libboost-all-dev libwebsocketpp-dev meson libcunit1 libcunit1-dev curl protobuf-compiler-grpc libgrpc-dev libgrpc++-dev libunwind-dev libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev +pip install jsonref + +############################ +# Build trevor-base64 +if [ ! -d "trower-base64" ]; then +git clone https://github.com/xmidt-org/trower-base64.git +fi +cd trower-base64 +meson setup --warnlevel 3 --werror build +ninja -C build +ninja -C build install +cd .. +########################################### +# Clone the required repositories + + +git clone --branch R4.4.3 https://github.com/rdkcentral/ThunderTools.git + +git clone --branch R4.4.1 https://github.com/rdkcentral/Thunder.git + +git clone --branch main https://github.com/rdkcentral/entservices-apis.git + +git clone https://$GITHUB_TOKEN@github.com/rdkcentral/entservices-testframework.git + +############################ +# Build Thunder-Tools +echo "======================================================================================" +echo "buliding thunderTools" +cd ThunderTools +patch -p1 < $GITHUB_WORKSPACE/entservices-testframework/patches/00010-R4.4-Add-support-for-project-dir.patch +cd - + + +cmake -G Ninja -S ThunderTools -B build/ThunderTools \ + -DEXCEPTIONS_ENABLE=ON \ + -DCMAKE_INSTALL_PREFIX="/usr" \ + -DCMAKE_MODULE_PATH="$GITHUB_WORKSPACE/install/tools/cmake" \ + -DGENERIC_CMAKE_MODULE_PATH="$GITHUB_WORKSPACE/install/tools/cmake" \ + +cmake --build build/ThunderTools --target install + + +############################ +# Build Thunder +echo "======================================================================================" +echo "buliding thunder" + +cd Thunder +patch -p1 < $GITHUB_WORKSPACE/entservices-testframework/patches/Use_Legact_Alt_Based_On_ThunderTools_R4.4.3.patch +patch -p1 < $GITHUB_WORKSPACE/entservices-testframework/patches/error_code_R4_4.patch +patch -p1 < $GITHUB_WORKSPACE/entservices-testframework/patches/1004-Add-support-for-project-dir.patch +patch -p1 < $GITHUB_WORKSPACE/entservices-testframework/patches/RDKEMW-733-Add-ENTOS-IDS.patch +cd - + +cmake -G Ninja -S Thunder -B build/Thunder \ + -DMESSAGING=ON \ + -DCMAKE_INSTALL_PREFIX="/usr" \ + -DCMAKE_MODULE_PATH="$GITHUB_WORKSPACE/install/tools/cmake" \ + -DGENERIC_CMAKE_MODULE_PATH="$GITHUB_WORKSPACE/install/tools/cmake" \ + -DBUILD_TYPE=Debug \ + -DBINDING=127.0.0.1 \ + -DPORT=55555 \ + -DEXCEPTIONS_ENABLE=ON \ + +cmake --build build/Thunder --target install + + +############################ +# Build entservices-apis +echo "======================================================================================" +echo "buliding entservices-apis" +cd entservices-apis +rm -rf jsonrpc/DTV.json +cd .. + +cmake -G Ninja -S entservices-apis -B build/entservices-apis \ + -DEXCEPTIONS_ENABLE=ON \ + -DCMAKE_INSTALL_PREFIX="/usr" \ + -DCMAKE_MODULE_PATH="$GITHUB_WORKSPACE/install/tools/cmake" \ + +cmake --build build/entservices-apis --target install + diff --git a/cov_build.sh b/cov_build.sh new file mode 100755 index 00000000..54f3fb84 --- /dev/null +++ b/cov_build.sh @@ -0,0 +1,23 @@ +#!/bin/bash +set -x +set -e +############################## +GITHUB_WORKSPACE="${PWD}" +ls -la ${GITHUB_WORKSPACE} +############################ +# Build xdialserver +echo "buliding xdialserver" + +cd ${GITHUB_WORKSPACE} +cmake -G Ninja -S "$GITHUB_WORKSPACE" -B build/xdialserver \ +-DUSE_THUNDER_R4=ON \ +-DCMAKE_INSTALL_PREFIX="$GITHUB_WORKSPACE/install/usr" \ +-DCMAKE_MODULE_PATH="$GITHUB_WORKSPACE/install/tools/cmake" \ +-DCMAKE_VERBOSE_MAKEFILE=ON \ +-DCMAKE_CXX_FLAGS="-DEXCEPTIONS_ENABLE=ON \ +-I ${GITHUB_WORKSPACE}/Thunder/Source \ +-I ${GITHUB_WORKSPACE}/Thunder/Source/core" \ + +cmake --build build/xdialserver --target install +echo "======================================================================================" +exit 0 From 6750ebaf408e15a46cad36f53fae7966e8f869aa Mon Sep 17 00:00:00 2001 From: yuvaramachandran_gurusamy Date: Thu, 5 Jun 2025 19:20:11 +0000 Subject: [PATCH 09/18] RDKEMW-4129: Test Signed-off-by: yuvaramachandran_gurusamy --- build_dependencies.sh | 45 ++++++- cov_build.sh | 11 +- ...010-R4.4-Add-support-for-project-dir.patch | 116 ++++++++++++++++++ .../1004-Add-support-for-project-dir.patch | 42 +++++++ .../patches/RDKEMW-733-Add-ENTOS-IDS.patch | 21 ++++ ...act_Alt_Based_On_ThunderTools_R4.4.3.patch | 20 +++ .../patches/error_code_R4_4.patch | 64 ++++++++++ server/include/gdial-config.h | 10 +- stubs/iarm_stubs.cpp | 68 ++++++++++ stubs/securityagent/SecurityTokenUtil.cpp | 56 +++++++++ stubs/securityagent/SecurityTokenUtil.h | 50 ++++++++ 11 files changed, 482 insertions(+), 21 deletions(-) create mode 100755 entservices-testframework/patches/00010-R4.4-Add-support-for-project-dir.patch create mode 100755 entservices-testframework/patches/1004-Add-support-for-project-dir.patch create mode 100755 entservices-testframework/patches/RDKEMW-733-Add-ENTOS-IDS.patch create mode 100755 entservices-testframework/patches/Use_Legact_Alt_Based_On_ThunderTools_R4.4.3.patch create mode 100644 entservices-testframework/patches/error_code_R4_4.patch create mode 100644 stubs/iarm_stubs.cpp create mode 100644 stubs/securityagent/SecurityTokenUtil.cpp create mode 100644 stubs/securityagent/SecurityTokenUtil.h diff --git a/build_dependencies.sh b/build_dependencies.sh index c755d997..041b10da 100755 --- a/build_dependencies.sh +++ b/build_dependencies.sh @@ -3,14 +3,14 @@ set -x set -e ############################## GITHUB_WORKSPACE="${PWD}" -ls -la ${GITHUB_WORKSPACE} + cd ${GITHUB_WORKSPACE} # # ############################# #1. Install Dependencies and packages apt update -#apt install -y libsqlite3-dev libcurl4-openssl-dev valgrind lcov clang libsystemd-dev libboost-all-dev libwebsocketpp-dev meson libcunit1 libcunit1-dev curl protobuf-compiler-grpc libgrpc-dev libgrpc++-dev libunwind-dev libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev +apt install -y ninja-build meson curl libsoup2.4-dev libxml2-dev libglib2.0-dev gobject-introspection libgirepository1.0-dev libgtk-3-dev valac pandoc pip install jsonref ############################ @@ -26,14 +26,36 @@ cd .. ########################################### # Clone the required repositories +rm -rf iarmbus +git clone https://github.com/rdkcentral/iarmbus.git +export IARMBUS_PATH=$GITHUB_WORKSPACE/iarmbus +rm -rf ThunderTools git clone --branch R4.4.3 https://github.com/rdkcentral/ThunderTools.git +rm -rf Thunder git clone --branch R4.4.1 https://github.com/rdkcentral/Thunder.git +rm -rf entservices-apis git clone --branch main https://github.com/rdkcentral/entservices-apis.git -git clone https://$GITHUB_TOKEN@github.com/rdkcentral/entservices-testframework.git +#git clone https://$GITHUB_TOKEN@github.com/rdkcentral/entservices-testframework.git + +rm -rf gssdp +git clone --branch gssdp-1.2.3 https://gitlab.gnome.org/GNOME/gssdp.git + +############################ +# Build gssdp-1.2 +echo "======================================================================================" +echo "buliding gssdp-1.2" +cd gssdp + +rm -rf build +meson setup build + +ninja -C build +ninja -C build install +cd - ############################ # Build Thunder-Tools @@ -77,7 +99,6 @@ cmake -G Ninja -S Thunder -B build/Thunder \ cmake --build build/Thunder --target install - ############################ # Build entservices-apis echo "======================================================================================" @@ -93,3 +114,19 @@ cmake -G Ninja -S entservices-apis -B build/entservices-apis \ cmake --build build/entservices-apis --target install +############################ + +############################ +# Build and deploy stubs for IARMBus and WPEFramework securityagent +mkdir -p /usr/include/WPEFramework/securityagent +cp $GITHUB_WORKSPACE/stubs/securityagent/* /usr/include/WPEFramework/securityagent/ -v + +echo "======================================================================================" +echo "Building IARMBus and WPEFramework securityagent stubs" +cd $GITHUB_WORKSPACE +cd ./stubs +g++ -fPIC -shared -o libIARMBus.so iarm_stubs.cpp -I$GITHUB_WORKSPACE/stubs -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I$IARMBUS_PATH/core -I$IARMBUS_PATH/core/include -fpermissive +g++ -fPIC -shared -o libWPEFrameworkSecurityUtil.so securityagent/SecurityTokenUtil.cpp -I$GITHUB_WORKSPACE/stubs -fpermissive + +cp libIARMBus.so /usr/local/lib/ +cp libWPEFrameworkSecurityUtil.so /usr/local/lib/ diff --git a/cov_build.sh b/cov_build.sh index 54f3fb84..da227aba 100755 --- a/cov_build.sh +++ b/cov_build.sh @@ -9,15 +9,8 @@ ls -la ${GITHUB_WORKSPACE} echo "buliding xdialserver" cd ${GITHUB_WORKSPACE} -cmake -G Ninja -S "$GITHUB_WORKSPACE" -B build/xdialserver \ --DUSE_THUNDER_R4=ON \ --DCMAKE_INSTALL_PREFIX="$GITHUB_WORKSPACE/install/usr" \ --DCMAKE_MODULE_PATH="$GITHUB_WORKSPACE/install/tools/cmake" \ --DCMAKE_VERBOSE_MAKEFILE=ON \ --DCMAKE_CXX_FLAGS="-DEXCEPTIONS_ENABLE=ON \ --I ${GITHUB_WORKSPACE}/Thunder/Source \ --I ${GITHUB_WORKSPACE}/Thunder/Source/core" \ -cmake --build build/xdialserver --target install +make + echo "======================================================================================" exit 0 diff --git a/entservices-testframework/patches/00010-R4.4-Add-support-for-project-dir.patch b/entservices-testframework/patches/00010-R4.4-Add-support-for-project-dir.patch new file mode 100755 index 00000000..dbb94881 --- /dev/null +++ b/entservices-testframework/patches/00010-R4.4-Add-support-for-project-dir.patch @@ -0,0 +1,116 @@ +diff --git a/JsonGenerator/source/class_emitter.py b/JsonGenerator/source/class_emitter.py +index 7f2fb01..67a6469 100644 +--- a/JsonGenerator/source/class_emitter.py ++++ b/JsonGenerator/source/class_emitter.py +@@ -113,7 +113,6 @@ + emit.Line("#include ") + emit.Line() + +- emit.Line("#include \"definitions.h\"") + + if not config.NO_INCLUDES: + if if_file.endswith(".h"): +diff --git a/ProxyStubGenerator/StubGenerator.py b/ProxyStubGenerator/StubGenerator.py +index 6e079b6..d2de681 100755 +--- a/ProxyStubGenerator/StubGenerator.py ++++ b/ProxyStubGenerator/StubGenerator.py +@@ -193,7 +193,7 @@ + + + # Generate interface information in lua +-def GenerateLuaData(emit, interfaces_list, enums_list, source_file=None, tree=None, ns=None): ++def GenerateLuaData(emit, interfaces_list, enums_list, project_dir, source_file=None, tree=None, ns=None): + + if not source_file: + assert(tree==None) +@@ -535,7 +535,7 @@ + + return tree + +-def GenerateStubs2(output_file, source_file, tree, ns, scan_only=False): ++def GenerateStubs2(output_file, source_file, project_dir, tree, ns, scan_only=False): + log.Info("Scanning '%s' (in %s)..." % (source_file, ns)) + + if not FORCE and (os.path.exists(output_file) and (os.path.getmtime(source_file) < os.path.getmtime(output_file))): +@@ -579,7 +579,7 @@ + emit.Line + emit.Line() + +- if os.path.isfile(os.path.join(os.path.dirname(source_file), "Module.h")): ++ if os.path.isfile(os.path.join(project_dir, "Module.h")): + emit.Line('#include "Module.h"') + + if os.path.isfile(os.path.join(os.path.dirname(source_file), interface_header_name)): +@@ -2085,6 +2085,8 @@ + help="include an additional C++ header file, may be used multiple times (default: include 'Ids.h')") + argparser.add_argument('-I', dest="includePaths", metavar="INCLUDE_DIR", action='append', default=[], type=str, + help='add an include search path, can be used multiple times') ++ argparser.add_argument("--projectdir",dest="project_dir",metavar="DIR",type=str,default="", ++ help="specify the project directory") + + args = argparser.parse_args(sys.argv[1:]) + SHOW_WARNINGS = not args.no_warnings +@@ -2221,7 +2223,10 @@ + + for source_file in interface_files: + try: +- _extra_includes = [ os.path.join("@" + os.path.dirname(source_file), IDS_DEFINITIONS_FILE) ] ++ if args.project_dir is not None: ++ _extra_includes = [ os.path.join("@" + args.project_dir, IDS_DEFINITIONS_FILE) ] ++ else: ++ _extra_includes = [ os.path.join("@" + os.path.dirname(source_file), IDS_DEFINITIONS_FILE) ] + _extra_includes.extend(args.extra_includes) + + tree = Parse(source_file, args.includePaths, +@@ -2242,7 +2247,7 @@ + some_omitted = False + + for ns in INTERFACE_NAMESPACES: +- output, some_omitted = GenerateStubs2(output_file, source_file, tree, ns, scan_only) ++ output, some_omitted = GenerateStubs2(output_file, source_file, args.project_dir, tree, ns, scan_only) + + new_faces += output + +@@ -2265,7 +2270,7 @@ + log.Print("(lua generator) Scanning %s..." % os.path.basename(source_file)) + + for ns in INTERFACE_NAMESPACES: +- GenerateLuaData(Emitter(lua_file, INDENT_SIZE), lua_interfaces, lua_enums, source_file, tree, ns) ++ GenerateLuaData(Emitter(lua_file, INDENT_SIZE), lua_interfaces, lua_enums, args.project_dir, source_file, tree, ns) + + except NotModifiedException as err: + log.Print("skipped file %s, up-to-date" % os.path.basename(output_file)) +@@ -2316,7 +2321,7 @@ + if args.lua_code: + # Epilogue + for ns in INTERFACE_NAMESPACES: +- GenerateLuaData(Emitter(lua_file, INDENT_SIZE), lua_interfaces, lua_enums) ++ GenerateLuaData(Emitter(lua_file, INDENT_SIZE), lua_interfaces, lua_enums,args.project_dir) + log.Print("Created %s (%s interfaces, %s enums)" % (lua_file.name, len(lua_interfaces), len(lua_enums))) + + else: + +diff --git a/cmake/FindProxyStubGenerator.cmake.in b/cmake/FindProxyStubGenerator.cmake.in +index 1344452..a8dbcea 100644 +--- a/cmake/FindProxyStubGenerator.cmake.in ++++ b/cmake/FindProxyStubGenerator.cmake.in. +@@ -31,7 +31,7 @@ function(ProxyStubGenerator) + endif() + + set(optionsArgs SECURE COHERENT TRACES VERBOSE NO_WARNINGS KEEP FORCE_GENERATE) +- set(oneValueArgs OUTDIR) ++ set(oneValueArgs OUTDIR PROJECT_DIR) + set(multiValueArgs INPUT INCLUDE INCLUDE_PATH NAMESPACE) + + cmake_parse_arguments(Argument "${optionsArgs}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} ) +@@ -81,6 +81,10 @@ function(ProxyStubGenerator) + list(APPEND _execute_command "--outdir" "${Argument_OUTDIR}") + endif() + ++ if(Argument_PROJECT_DIR) ++ list(APPEND _execute_command "--projectdir" "${Argument_PROJECT_DIR}") ++ endif() ++ + foreach(_include ${Argument_INCLUDE}) + list(APPEND _execute_command "-I" "${_include}") + endforeach(_include) diff --git a/entservices-testframework/patches/1004-Add-support-for-project-dir.patch b/entservices-testframework/patches/1004-Add-support-for-project-dir.patch new file mode 100755 index 00000000..26fdee12 --- /dev/null +++ b/entservices-testframework/patches/1004-Add-support-for-project-dir.patch @@ -0,0 +1,42 @@ +diff --git a/Source/plugins/CMakeLists.txt b/Source/plugins/CMakeLists.txt +index 4d362d545..9357c647c 100644 +--- a/Source/plugins/CMakeLists.txt ++++ b/Source/plugins/CMakeLists.txt +@@ -20,14 +20,14 @@ + string(TOLOWER ${NAMESPACE} NAMESPACE_LIB) + + option(VIRTUALINPUT_TOOLS "Build VirtualInput tools" OFF) +- +-ProxyStubGenerator(NAMESPACE "WPEFramework::PluginHost" INPUT "${CMAKE_CURRENT_SOURCE_DIR}/IPlugin.h" OUTDIR "${CMAKE_CURRENT_BINARY_DIR}/generated") +-ProxyStubGenerator(NAMESPACE "WPEFramework::PluginHost" INPUT "${CMAKE_CURRENT_SOURCE_DIR}/IShell.h" OUTDIR "${CMAKE_CURRENT_BINARY_DIR}/generated") +-ProxyStubGenerator(NAMESPACE "WPEFramework::Exchange" INPUT "${CMAKE_CURRENT_SOURCE_DIR}/IController.h" OUTDIR "${CMAKE_CURRENT_BINARY_DIR}/generated" INCLUDE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/..") +-ProxyStubGenerator(NAMESPACE "WPEFramework::PluginHost" INPUT "${CMAKE_CURRENT_SOURCE_DIR}/IControllerDeprecated.h" OUTDIR "${CMAKE_CURRENT_BINARY_DIR}/generated" INCLUDE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/..") +-ProxyStubGenerator(NAMESPACE "WPEFramework::PluginHost" INPUT "${CMAKE_CURRENT_SOURCE_DIR}/IStateControl.h" OUTDIR "${CMAKE_CURRENT_BINARY_DIR}/generated") +-ProxyStubGenerator(NAMESPACE "WPEFramework::PluginHost" INPUT "${CMAKE_CURRENT_SOURCE_DIR}/ISubSystem.h" OUTDIR "${CMAKE_CURRENT_BINARY_DIR}/generated") +-ProxyStubGenerator(NAMESPACE "WPEFramework::PluginHost" INPUT "${CMAKE_CURRENT_SOURCE_DIR}/IDispatcher.h" OUTDIR "${CMAKE_CURRENT_BINARY_DIR}/generated") ++set(PROJECT_DIR "${CMAKE_CURRENT_SOURCE_DIR}") ++ProxyStubGenerator(NAMESPACE "WPEFramework::PluginHost" INPUT "${CMAKE_CURRENT_SOURCE_DIR}/IPlugin.h" OUTDIR "${CMAKE_CURRENT_BINARY_DIR}/generated" PROJECT_DIR ${PROJECT_DIR}) ++ProxyStubGenerator(NAMESPACE "WPEFramework::PluginHost" INPUT "${CMAKE_CURRENT_SOURCE_DIR}/IShell.h" OUTDIR "${CMAKE_CURRENT_BINARY_DIR}/generated" PROJECT_DIR ${PROJECT_DIR}) ++ProxyStubGenerator(NAMESPACE "WPEFramework::Exchange" INPUT "${CMAKE_CURRENT_SOURCE_DIR}/IController.h" OUTDIR "${CMAKE_CURRENT_BINARY_DIR}/generated" INCLUDE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/.." PROJECT_DIR ${PROJECT_DIR}) ++ProxyStubGenerator(NAMESPACE "WPEFramework::PluginHost" INPUT "${CMAKE_CURRENT_SOURCE_DIR}/IControllerDeprecated.h" OUTDIR "${CMAKE_CURRENT_BINARY_DIR}/generated" INCLUDE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/.." PROJECT_DIR ${PROJECT_DIR}) ++ProxyStubGenerator(NAMESPACE "WPEFramework::PluginHost" INPUT "${CMAKE_CURRENT_SOURCE_DIR}/IStateControl.h" OUTDIR "${CMAKE_CURRENT_BINARY_DIR}/generated" PROJECT_DIR ${PROJECT_DIR}) ++ProxyStubGenerator(NAMESPACE "WPEFramework::PluginHost" INPUT "${CMAKE_CURRENT_SOURCE_DIR}/ISubSystem.h" OUTDIR "${CMAKE_CURRENT_BINARY_DIR}/generated" PROJECT_DIR ${PROJECT_DIR}) ++ProxyStubGenerator(NAMESPACE "WPEFramework::PluginHost" INPUT "${CMAKE_CURRENT_SOURCE_DIR}/IDispatcher.h" OUTDIR "${CMAKE_CURRENT_BINARY_DIR}/generated" PROJECT_DIR ${PROJECT_DIR}) + + JsonGenerator(CODE NAMESPACE WPEFramework::Exchange::Controller INPUT ${CMAKE_CURRENT_SOURCE_DIR}/IController.h OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/generated/jsonrpc" INCLUDE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/.." NO_INCLUDES LEGACY_ALT) + +diff --git a/Source/com/CMakeLists.txt b/Source/com/CMakeLists.txt +index 1de9ac176..bcf9489d1 100644 +--- a/Source/com/CMakeLists.txt ++++ b/Source/com/CMakeLists.txt +@@ -16,8 +16,8 @@ + # limitations under the License. + + set(TARGET ${NAMESPACE}COM) +- +-ProxyStubGenerator(NAMESPACE "WPEFramework::RPC" INPUT "${CMAKE_CURRENT_SOURCE_DIR}/ICOM.h" OUTDIR "${CMAKE_CURRENT_BINARY_DIR}/generated") ++set(PROJECT_DIR "${CMAKE_CURRENT_SOURCE_DIR}") ++ProxyStubGenerator(NAMESPACE "WPEFramework::RPC" INPUT "${CMAKE_CURRENT_SOURCE_DIR}/ICOM.h" OUTDIR "${CMAKE_CURRENT_BINARY_DIR}/generated" PROJECT_DIR ${PROJECT_DIR}) + + add_library(${TARGET} SHARED + Administrator.cpp diff --git a/entservices-testframework/patches/RDKEMW-733-Add-ENTOS-IDS.patch b/entservices-testframework/patches/RDKEMW-733-Add-ENTOS-IDS.patch new file mode 100755 index 00000000..c8fd3213 --- /dev/null +++ b/entservices-testframework/patches/RDKEMW-733-Add-ENTOS-IDS.patch @@ -0,0 +1,21 @@ +From: Sitaram, Soundaryaa +Date: 05 Feb 2025 17:24:43 +0000 +Subject: [PATCH] ENTOS IDs offset to be adjusted in rdkservices-apis + +Upstream-Status: None +Signed-off-by: ssitar583 +--- +diff --git a/Source/com/Ids.h b/Source/com/Ids.h +index cf2060333..75d235bbd 100644 +--- a/Source/com/Ids.h ++++ b/Source/com/Ids.h +@@ -74,7 +74,8 @@ namespace RPC { + ID_COMREQUEST_NOTIFICATION = (ID_OFFSET_INTERNAL + 0x003D), + ID_SYSTEM_METADATA = (ID_OFFSET_INTERNAL + 0x003E), + +- ID_EXTERNAL_INTERFACE_OFFSET = (ID_OFFSET_INTERNAL + 0x0040) ++ ID_EXTERNAL_INTERFACE_OFFSET = (ID_OFFSET_INTERNAL + 0x0040), ++ ID_EXTERNAL_CC_INTERFACE_OFFSET = (0xCC00) // ends on 0xDFFF + }; + } + } diff --git a/entservices-testframework/patches/Use_Legact_Alt_Based_On_ThunderTools_R4.4.3.patch b/entservices-testframework/patches/Use_Legact_Alt_Based_On_ThunderTools_R4.4.3.patch new file mode 100755 index 00000000..c5b4a36f --- /dev/null +++ b/entservices-testframework/patches/Use_Legact_Alt_Based_On_ThunderTools_R4.4.3.patch @@ -0,0 +1,20 @@ +commit 810aae64cb31c907698e468b615797750094b847 +Author: Pesala Lakshmi Jwala Priya +Date: Thu Aug 29 12:31:30 2024 +0530 + + Alt change + +diff --git a/Source/plugins/CMakeLists.txt b/Source/plugins/CMakeLists.txt +index 4d362d54..cdb53cdc 100644 +--- a/Source/plugins/CMakeLists.txt ++++ b/Source/plugins/CMakeLists.txt +@@ -29,7 +29,7 @@ ProxyStubGenerator(NAMESPACE "WPEFramework::PluginHost" INPUT "${CMAKE_CURRENT_S + ProxyStubGenerator(NAMESPACE "WPEFramework::PluginHost" INPUT "${CMAKE_CURRENT_SOURCE_DIR}/ISubSystem.h" OUTDIR "${CMAKE_CURRENT_BINARY_DIR}/generated") + ProxyStubGenerator(NAMESPACE "WPEFramework::PluginHost" INPUT "${CMAKE_CURRENT_SOURCE_DIR}/IDispatcher.h" OUTDIR "${CMAKE_CURRENT_BINARY_DIR}/generated") + +-JsonGenerator(CODE NAMESPACE WPEFramework::Exchange::Controller INPUT ${CMAKE_CURRENT_SOURCE_DIR}/IController.h OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/generated/jsonrpc" INCLUDE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/.." NO_INCLUDES) ++JsonGenerator(CODE NAMESPACE WPEFramework::Exchange::Controller INPUT ${CMAKE_CURRENT_SOURCE_DIR}/IController.h OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/generated/jsonrpc" INCLUDE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/.." NO_INCLUDES LEGACY_ALT) + + add_library(${TARGET} SHARED + Channel.cpp + diff --git a/entservices-testframework/patches/error_code_R4_4.patch b/entservices-testframework/patches/error_code_R4_4.patch new file mode 100644 index 00000000..954ca083 --- /dev/null +++ b/entservices-testframework/patches/error_code_R4_4.patch @@ -0,0 +1,64 @@ +diff --git a/Source/WPEFramework/PluginServer.h b/Source/WPEFramework/PluginServer.h +index e87933d9a..591385222 100644 +--- a/Source/WPEFramework/PluginServer.h ++++ b/Source/WPEFramework/PluginServer.h +@@ -1535,6 +1535,22 @@ namespace PluginHost { + response->Error.SetError(Core::ERROR_ILLEGAL_STATE); + response->Error.Text = _T("The service is in an illegal state!!!."); + break; ++ case Core::ERROR_INVALID_PARAMETER: ++ response->Error.SetError(Core::ERROR_INVALID_SIGNATURE); ++ response->Error.Text = _T("Invalid Parameter"); ++ break; ++ case Core::ERROR_INVALID_DEVICENAME: ++ response->Error.SetError(Core::ERROR_INVALID_DEVICENAME); ++ response->Error.Text = _T("Invalid device name"); ++ break; ++ case Core::ERROR_INVALID_MOUNTPOINT: ++ response->Error.SetError(Core::ERROR_INVALID_MOUNTPOINT); ++ response->Error.Text = _T("Invalid mount path"); ++ break; ++ case Core::ERROR_FIRMWAREUPDATE_INPROGRESS: ++ response->Error.SetError(Core::ERROR_FIRMWAREUPDATE_INPROGRESS); ++ response->Error.Text = _T("Firmware update already in progress"); ++ break; + case static_cast(~0): + response.Release(); + break; +diff --git a/Source/core/JSONRPC.h b/Source/core/JSONRPC.h +index a9c4360fb..5fcef161d 100644 +--- a/Source/core/JSONRPC.h ++++ b/Source/core/JSONRPC.h +@@ -98,6 +98,15 @@ namespace Core { + case Core::ERROR_TIMEDOUT: + Code = -32000; // Server defined, now mapped to Timed out + break; ++ case Core::ERROR_INVALID_DEVICENAME: ++ Code = -32001; // Invalid device name ++ break; ++ case Core::ERROR_INVALID_MOUNTPOINT: ++ Code = -32002; // Invalid mount path ++ break; ++ case Core::ERROR_FIRMWAREUPDATE_INPROGRESS: ++ Code = -32003; // Firmware update inprogress ++ break; + default: + Code = static_cast(frameworkError); + break; +diff --git a/Source/core/Portability.h b/Source/core/Portability.h +index 01e34d398..a5728eebf 100644 +--- a/Source/core/Portability.h ++++ b/Source/core/Portability.h +@@ -874,7 +874,11 @@ namespace Core { + ERROR_CODE(ERROR_HIBERNATED, 46) \ + ERROR_CODE(ERROR_INPROC, 47) \ + ERROR_CODE(ERROR_FAILED_REGISTERED, 48) \ +- ERROR_CODE(ERROR_FAILED_UNREGISTERED, 49) ++ ERROR_CODE(ERROR_FAILED_UNREGISTERED, 49) \ ++ ERROR_CODE(ERROR_INVALID_PARAMETER, 54) \ ++ ERROR_CODE(ERROR_INVALID_DEVICENAME, 59) \ ++ ERROR_CODE(ERROR_INVALID_MOUNTPOINT, 60) \ ++ ERROR_CODE(ERROR_FIRMWAREUPDATE_INPROGRESS,61) + + #define ERROR_CODE(CODE, VALUE) CODE = VALUE, + diff --git a/server/include/gdial-config.h b/server/include/gdial-config.h index c6b9a9bc..13dd4172 100644 --- a/server/include/gdial-config.h +++ b/server/include/gdial-config.h @@ -17,8 +17,8 @@ * limitations under the License. */ -#ifndef GDIAL_H_ -#define GDIAL_H_ +#ifndef _GDIAL_CONFIG_H_ +#define _GDIAL_CONFIG_H_ #ifdef __cplusplus extern "C" { @@ -81,12 +81,6 @@ extern "C" { #define GDIAL_THROTTLE_DELAY_US 100000 #define GDIAL_DEBUG g_print -enum { - GDIAL_ERROR_NONE = 0, - GDIAL_ERROR_NOT_REGISTERED, - GDIAL_ERROR_FAIL_TO_START, -} GDialError; - #define GDIAL_GERROR_CHECK_AND_FREE(err, msg) \ {\ if (err) {\ diff --git a/stubs/iarm_stubs.cpp b/stubs/iarm_stubs.cpp new file mode 100644 index 00000000..ef10fc2d --- /dev/null +++ b/stubs/iarm_stubs.cpp @@ -0,0 +1,68 @@ +#include "libIBus.h" +#include "libIARMCore.h" +using namespace std; + +IARM_Result_t IARM_Malloc(IARM_MemType_t type, size_t size, void **ptr) +{ + return IARM_RESULT_SUCCESS; +} + +IARM_Result_t IARM_Free(IARM_MemType_t type, void *alloc) +{ + return IARM_RESULT_SUCCESS; +} + +IARM_Result_t IARM_Bus_BroadcastEvent(const char *ownerName, IARM_EventId_t eventId, void *arg, size_t argLen) +{ + return IARM_RESULT_SUCCESS; +} + +IARM_Result_t IARM_Bus_Init(const char* name) +{ + return IARM_RESULT_SUCCESS; +} + +IARM_Result_t IARM_Bus_Connect() +{ + return IARM_RESULT_SUCCESS; +} + +IARM_Result_t IARM_Bus_IsConnected(const char* memberName, int* isRegistered) +{ + return IARM_RESULT_SUCCESS; +} + +IARM_Result_t IARM_Bus_RegisterEventHandler(const char* ownerName, IARM_EventId_t eventId, IARM_EventHandler_t handler) +{ + return IARM_RESULT_SUCCESS; +} + +IARM_Result_t IARM_Bus_UnRegisterEventHandler(const char* ownerName, IARM_EventId_t eventId) +{ + return IARM_RESULT_SUCCESS; +} + +IARM_Result_t IARM_Bus_RemoveEventHandler(const char* ownerName, IARM_EventId_t eventId, IARM_EventHandler_t handler) +{ + return IARM_RESULT_SUCCESS; +} +IARM_Result_t IARM_Bus_RegisterCall(const char *methodName, IARM_BusCall_t handler) +{ +return IARM_RESULT_SUCCESS; +} +IARM_Result_t IARM_Bus_Term(void) +{ +return IARM_RESULT_SUCCESS; +} +IARM_Result_t IARM_Bus_Disconnect(void) +{ +return IARM_RESULT_SUCCESS; +} +IARM_Result_t IARM_Bus_RegisterEvent(IARM_EventId_t maxEventId) +{ +return IARM_RESULT_SUCCESS; +} +IARM_Result_t IARM_Bus_Call(const char* ownerName, const char* methodName, void* arg, size_t argLen) +{ + return IARM_RESULT_SUCCESS; +} diff --git a/stubs/securityagent/SecurityTokenUtil.cpp b/stubs/securityagent/SecurityTokenUtil.cpp new file mode 100644 index 00000000..a743d52f --- /dev/null +++ b/stubs/securityagent/SecurityTokenUtil.cpp @@ -0,0 +1,56 @@ +/* + * If not stated otherwise in this file or this component's LICENSE file the + * following copyright and licenses apply: + * + * Copyright 2020 RDK Management + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include +#include "SecurityTokenUtil.h" +/* + * Send thunder security token for localhost. + * This token can be used by native applications to securely access rdkservices. + */ + +using namespace std; + +extern "C" { + /* + * GetSecurityToken - function to obtain a token from SecurityAgent + * + * Parameters + * maxLength - holds the maximum uint8_t length of the buffer + * Id - Buffer to hold the token. + * + * Return value + * < 0 - failure, absolute value returned is the length required to store the token + * > 0 - success, char length of the returned token + * + * Post-condition; return value 0 should not occur + * + */ + int GetSecurityToken(unsigned short maxLength, unsigned char buffer[]) + { + // get a localhost token + string payload = "http://localhost"; + + size_t len = payload.length(); + + if(!memcpy(buffer,payload.c_str(),len)) + return -1; + return 0; + } +} diff --git a/stubs/securityagent/SecurityTokenUtil.h b/stubs/securityagent/SecurityTokenUtil.h new file mode 100644 index 00000000..b32894f5 --- /dev/null +++ b/stubs/securityagent/SecurityTokenUtil.h @@ -0,0 +1,50 @@ +/* + * If not stated otherwise in this file or this component's LICENSE file the + * following copyright and licenses apply: + * + * Copyright 2020 RDK Management + * + * 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. + */ + +#pragma once + +#ifdef __WINDOWS__ +#undef EXTERNAL +#ifdef SECURITYUTILITY_EXPORTS +#define EXTERNAL EXTERNAL_EXPORT +#else +#define EXTERNAL EXTERNAL_IMPORT +#endif +#else +#undef EXTERNAL +#define EXTERNAL +#endif + +extern "C" { + /* + * GetSecurityToken - function to obtain a token from SecurityAgent + * + * Parameters + * maxLength - holds the maximum uint8_t length of the buffer + * buffer - Buffer to hold the token. + * + * Return value + * < 0 - failure, absolute value returned is the length required to store the token + * > 0 - success, char length of the returned token + * + * Post-condition; return value 0 should not occur + * + */ + int EXTERNAL GetSecurityToken(unsigned short maxLength, unsigned char buffer[]); +} From 83a1518bfc88b4528c95bdb0c65214c5157b77eb Mon Sep 17 00:00:00 2001 From: yuvaramachandran_gurusamy Date: Thu, 5 Jun 2025 19:20:11 +0000 Subject: [PATCH 10/18] RDKEMW-4129: Prepare native build script Signed-off-by: yuvaramachandran_gurusamy --- .github/workflows/native_full_build.yml | 4 +- build_dependencies.sh | 41 +++++++++++++- cov_build.sh | 11 +--- server/include/gdial-config.h | 10 +--- stubs/iarm_stubs.cpp | 68 +++++++++++++++++++++++ stubs/securityagent/SecurityTokenUtil.cpp | 56 +++++++++++++++++++ stubs/securityagent/SecurityTokenUtil.h | 50 +++++++++++++++++ 7 files changed, 218 insertions(+), 22 deletions(-) create mode 100644 stubs/iarm_stubs.cpp create mode 100644 stubs/securityagent/SecurityTokenUtil.cpp create mode 100644 stubs/securityagent/SecurityTokenUtil.h diff --git a/.github/workflows/native_full_build.yml b/.github/workflows/native_full_build.yml index 757298bf..b241c8d2 100755 --- a/.github/workflows/native_full_build.yml +++ b/.github/workflows/native_full_build.yml @@ -2,9 +2,9 @@ name: Build Component in Native Environment on: push: - branches: [ main, 'sprint/**', 'release/**', topic/*, develop, topic/RDKEMW-4129 ] + branches: [ main, 'sprint/**', 'release/**', topic/*, develop ] pull_request: - branches: [ main, 'sprint/**', 'release/**', topic/*, develop, topic/RDKEMW-4129 ] + branches: [ main, 'sprint/**', 'release/**', topic/*, develop ] jobs: build-entservices-on-pr: diff --git a/build_dependencies.sh b/build_dependencies.sh index c755d997..86d6c353 100755 --- a/build_dependencies.sh +++ b/build_dependencies.sh @@ -3,14 +3,14 @@ set -x set -e ############################## GITHUB_WORKSPACE="${PWD}" -ls -la ${GITHUB_WORKSPACE} + cd ${GITHUB_WORKSPACE} # # ############################# #1. Install Dependencies and packages apt update -#apt install -y libsqlite3-dev libcurl4-openssl-dev valgrind lcov clang libsystemd-dev libboost-all-dev libwebsocketpp-dev meson libcunit1 libcunit1-dev curl protobuf-compiler-grpc libgrpc-dev libgrpc++-dev libunwind-dev libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev +apt install -y ninja-build meson curl libsoup2.4-dev libxml2-dev libglib2.0-dev gobject-introspection libgirepository1.0-dev libgtk-3-dev valac pandoc pip install jsonref ############################ @@ -26,6 +26,11 @@ cd .. ########################################### # Clone the required repositories +rm -rf iarmbus ThunderTools Thunder entservices-apis entservices-testframework gssdp + + +git clone https://github.com/rdkcentral/iarmbus.git +export IARMBUS_PATH=$GITHUB_WORKSPACE/iarmbus git clone --branch R4.4.3 https://github.com/rdkcentral/ThunderTools.git @@ -35,6 +40,21 @@ git clone --branch main https://github.com/rdkcentral/entservices-apis.git git clone https://$GITHUB_TOKEN@github.com/rdkcentral/entservices-testframework.git +git clone --branch gssdp-1.2.3 https://gitlab.gnome.org/GNOME/gssdp.git + +############################ +# Build gssdp-1.2 +echo "======================================================================================" +echo "buliding gssdp-1.2" +cd gssdp + +rm -rf build +meson setup build + +ninja -C build +ninja -C build install +cd - + ############################ # Build Thunder-Tools echo "======================================================================================" @@ -77,7 +97,6 @@ cmake -G Ninja -S Thunder -B build/Thunder \ cmake --build build/Thunder --target install - ############################ # Build entservices-apis echo "======================================================================================" @@ -93,3 +112,19 @@ cmake -G Ninja -S entservices-apis -B build/entservices-apis \ cmake --build build/entservices-apis --target install +############################ + +############################ +# Build and deploy stubs for IARMBus and WPEFramework securityagent +mkdir -p /usr/include/WPEFramework/securityagent +cp $GITHUB_WORKSPACE/stubs/securityagent/* /usr/include/WPEFramework/securityagent/ -v + +echo "======================================================================================" +echo "Building IARMBus and WPEFramework securityagent stubs" +cd $GITHUB_WORKSPACE +cd ./stubs +g++ -fPIC -shared -o libIARMBus.so iarm_stubs.cpp -I$GITHUB_WORKSPACE/stubs -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I$IARMBUS_PATH/core -I$IARMBUS_PATH/core/include -fpermissive +g++ -fPIC -shared -o libWPEFrameworkSecurityUtil.so securityagent/SecurityTokenUtil.cpp -I$GITHUB_WORKSPACE/stubs -fpermissive + +cp libIARMBus.so /usr/local/lib/ +cp libWPEFrameworkSecurityUtil.so /usr/local/lib/ diff --git a/cov_build.sh b/cov_build.sh index 54f3fb84..da227aba 100755 --- a/cov_build.sh +++ b/cov_build.sh @@ -9,15 +9,8 @@ ls -la ${GITHUB_WORKSPACE} echo "buliding xdialserver" cd ${GITHUB_WORKSPACE} -cmake -G Ninja -S "$GITHUB_WORKSPACE" -B build/xdialserver \ --DUSE_THUNDER_R4=ON \ --DCMAKE_INSTALL_PREFIX="$GITHUB_WORKSPACE/install/usr" \ --DCMAKE_MODULE_PATH="$GITHUB_WORKSPACE/install/tools/cmake" \ --DCMAKE_VERBOSE_MAKEFILE=ON \ --DCMAKE_CXX_FLAGS="-DEXCEPTIONS_ENABLE=ON \ --I ${GITHUB_WORKSPACE}/Thunder/Source \ --I ${GITHUB_WORKSPACE}/Thunder/Source/core" \ -cmake --build build/xdialserver --target install +make + echo "======================================================================================" exit 0 diff --git a/server/include/gdial-config.h b/server/include/gdial-config.h index c6b9a9bc..13dd4172 100644 --- a/server/include/gdial-config.h +++ b/server/include/gdial-config.h @@ -17,8 +17,8 @@ * limitations under the License. */ -#ifndef GDIAL_H_ -#define GDIAL_H_ +#ifndef _GDIAL_CONFIG_H_ +#define _GDIAL_CONFIG_H_ #ifdef __cplusplus extern "C" { @@ -81,12 +81,6 @@ extern "C" { #define GDIAL_THROTTLE_DELAY_US 100000 #define GDIAL_DEBUG g_print -enum { - GDIAL_ERROR_NONE = 0, - GDIAL_ERROR_NOT_REGISTERED, - GDIAL_ERROR_FAIL_TO_START, -} GDialError; - #define GDIAL_GERROR_CHECK_AND_FREE(err, msg) \ {\ if (err) {\ diff --git a/stubs/iarm_stubs.cpp b/stubs/iarm_stubs.cpp new file mode 100644 index 00000000..ef10fc2d --- /dev/null +++ b/stubs/iarm_stubs.cpp @@ -0,0 +1,68 @@ +#include "libIBus.h" +#include "libIARMCore.h" +using namespace std; + +IARM_Result_t IARM_Malloc(IARM_MemType_t type, size_t size, void **ptr) +{ + return IARM_RESULT_SUCCESS; +} + +IARM_Result_t IARM_Free(IARM_MemType_t type, void *alloc) +{ + return IARM_RESULT_SUCCESS; +} + +IARM_Result_t IARM_Bus_BroadcastEvent(const char *ownerName, IARM_EventId_t eventId, void *arg, size_t argLen) +{ + return IARM_RESULT_SUCCESS; +} + +IARM_Result_t IARM_Bus_Init(const char* name) +{ + return IARM_RESULT_SUCCESS; +} + +IARM_Result_t IARM_Bus_Connect() +{ + return IARM_RESULT_SUCCESS; +} + +IARM_Result_t IARM_Bus_IsConnected(const char* memberName, int* isRegistered) +{ + return IARM_RESULT_SUCCESS; +} + +IARM_Result_t IARM_Bus_RegisterEventHandler(const char* ownerName, IARM_EventId_t eventId, IARM_EventHandler_t handler) +{ + return IARM_RESULT_SUCCESS; +} + +IARM_Result_t IARM_Bus_UnRegisterEventHandler(const char* ownerName, IARM_EventId_t eventId) +{ + return IARM_RESULT_SUCCESS; +} + +IARM_Result_t IARM_Bus_RemoveEventHandler(const char* ownerName, IARM_EventId_t eventId, IARM_EventHandler_t handler) +{ + return IARM_RESULT_SUCCESS; +} +IARM_Result_t IARM_Bus_RegisterCall(const char *methodName, IARM_BusCall_t handler) +{ +return IARM_RESULT_SUCCESS; +} +IARM_Result_t IARM_Bus_Term(void) +{ +return IARM_RESULT_SUCCESS; +} +IARM_Result_t IARM_Bus_Disconnect(void) +{ +return IARM_RESULT_SUCCESS; +} +IARM_Result_t IARM_Bus_RegisterEvent(IARM_EventId_t maxEventId) +{ +return IARM_RESULT_SUCCESS; +} +IARM_Result_t IARM_Bus_Call(const char* ownerName, const char* methodName, void* arg, size_t argLen) +{ + return IARM_RESULT_SUCCESS; +} diff --git a/stubs/securityagent/SecurityTokenUtil.cpp b/stubs/securityagent/SecurityTokenUtil.cpp new file mode 100644 index 00000000..a743d52f --- /dev/null +++ b/stubs/securityagent/SecurityTokenUtil.cpp @@ -0,0 +1,56 @@ +/* + * If not stated otherwise in this file or this component's LICENSE file the + * following copyright and licenses apply: + * + * Copyright 2020 RDK Management + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include +#include "SecurityTokenUtil.h" +/* + * Send thunder security token for localhost. + * This token can be used by native applications to securely access rdkservices. + */ + +using namespace std; + +extern "C" { + /* + * GetSecurityToken - function to obtain a token from SecurityAgent + * + * Parameters + * maxLength - holds the maximum uint8_t length of the buffer + * Id - Buffer to hold the token. + * + * Return value + * < 0 - failure, absolute value returned is the length required to store the token + * > 0 - success, char length of the returned token + * + * Post-condition; return value 0 should not occur + * + */ + int GetSecurityToken(unsigned short maxLength, unsigned char buffer[]) + { + // get a localhost token + string payload = "http://localhost"; + + size_t len = payload.length(); + + if(!memcpy(buffer,payload.c_str(),len)) + return -1; + return 0; + } +} diff --git a/stubs/securityagent/SecurityTokenUtil.h b/stubs/securityagent/SecurityTokenUtil.h new file mode 100644 index 00000000..b32894f5 --- /dev/null +++ b/stubs/securityagent/SecurityTokenUtil.h @@ -0,0 +1,50 @@ +/* + * If not stated otherwise in this file or this component's LICENSE file the + * following copyright and licenses apply: + * + * Copyright 2020 RDK Management + * + * 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. + */ + +#pragma once + +#ifdef __WINDOWS__ +#undef EXTERNAL +#ifdef SECURITYUTILITY_EXPORTS +#define EXTERNAL EXTERNAL_EXPORT +#else +#define EXTERNAL EXTERNAL_IMPORT +#endif +#else +#undef EXTERNAL +#define EXTERNAL +#endif + +extern "C" { + /* + * GetSecurityToken - function to obtain a token from SecurityAgent + * + * Parameters + * maxLength - holds the maximum uint8_t length of the buffer + * buffer - Buffer to hold the token. + * + * Return value + * < 0 - failure, absolute value returned is the length required to store the token + * > 0 - success, char length of the returned token + * + * Post-condition; return value 0 should not occur + * + */ + int EXTERNAL GetSecurityToken(unsigned short maxLength, unsigned char buffer[]); +} From c66ef14dcc294c10ecde5e94e3b8d12ad18d90ad Mon Sep 17 00:00:00 2001 From: apatel859 Date: Mon, 9 Jun 2025 13:12:46 -0400 Subject: [PATCH 11/18] remmove duplicates from build_xxx script Signed-off-by: apatel859 --- build_dependencies.sh | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/build_dependencies.sh b/build_dependencies.sh index 20029a67..86d6c353 100755 --- a/build_dependencies.sh +++ b/build_dependencies.sh @@ -55,21 +55,6 @@ ninja -C build ninja -C build install cd - -git clone --branch gssdp-1.2.3 https://gitlab.gnome.org/GNOME/gssdp.git - -############################ -# Build gssdp-1.2 -echo "======================================================================================" -echo "buliding gssdp-1.2" -cd gssdp - -rm -rf build -meson setup build - -ninja -C build -ninja -C build install -cd - - ############################ # Build Thunder-Tools echo "======================================================================================" From 7302ede2a9fafc17ca36b2c25999fe2156d43f89 Mon Sep 17 00:00:00 2001 From: ssitar583 Date: Thu, 26 Jun 2025 11:19:31 +0530 Subject: [PATCH 12/18] Update gdial.cpp --- server/plat/gdial.cpp | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/server/plat/gdial.cpp b/server/plat/gdial.cpp index 1415a2e5..71b9cfd1 100644 --- a/server/plat/gdial.cpp +++ b/server/plat/gdial.cpp @@ -82,11 +82,6 @@ class GDialCastObject reterror = GDIAL_CAST_ERROR_NONE; } } - if (nullptr != AppObj) - { - delete AppObj; - AppObj = nullptr; - } GDIAL_LOGTRACE("Exiting ..."); return reterror; } @@ -993,4 +988,4 @@ int gdial_os_application_service_notification(gboolean isNotifyRequired, void* n } GDIAL_LOGTRACE("Exiting ..."); return GDIAL_APP_ERROR_NONE; -} \ No newline at end of file +} From 3202ca6bbf15d9567f3ab746ba37ce7eccd18c85 Mon Sep 17 00:00:00 2001 From: Yuvaramachandran Gurusamy <123441336+yuvaramachandran-gurusamy@users.noreply.github.com> Date: Tue, 5 Aug 2025 17:19:16 +0530 Subject: [PATCH 13/18] RDKEMW-5927: Crash fix during soup_uri_to_string API call (#163) Signed-off-by: yuvaramachandran_gurusamy --- server/gdialservice.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/server/gdialservice.cpp b/server/gdialservice.cpp index c41cf79d..97606bf2 100644 --- a/server/gdialservice.cpp +++ b/server/gdialservice.cpp @@ -490,10 +490,16 @@ int gdialServiceImpl::start_GDialServer(int argc, char *argv[]) GSList *uris = soup_server_get_uris(m_servers[i]); for (GSList *uri = uris; uri != NULL; uri = uri->next) { - char *uri_string = soup_uri_to_string(uri->data, FALSE); + SoupURI *origin_uri = (SoupURI *)uri->data; + if (!origin_uri) + { + GDIAL_LOGWARNING("Failed to get SoupURI from SoupServer at index [%d]", i); + continue; + } + char *uri_string = soup_uri_to_string(origin_uri, FALSE); GDIAL_LOGINFO("Listening on %s", uri_string); g_free(uri_string); - soup_uri_free(uri->data); + soup_uri_free(origin_uri); } g_slist_free(uris); } From 206d13783924f8ea90d48dbbcc9c199e45ffa783 Mon Sep 17 00:00:00 2001 From: mukesh972 Date: Thu, 4 Sep 2025 01:34:56 +0530 Subject: [PATCH 14/18] RDKEMW-6891:Coverity errors fix for xdial (#166) * RDKEMW-6891: Coverity errors fix for xdial * Update gdial.cpp Fixed review comments --- server/gdial-rest.c | 15 ++++++++++----- server/gdialserver_ut.cpp | 8 ++++---- server/plat/gdial-plat-util.c | 2 +- server/plat/gdial.cpp | 26 +++++++++++++++++--------- server/plat/gdialappcache.cpp | 8 ++++---- 5 files changed, 36 insertions(+), 23 deletions(-) diff --git a/server/gdial-rest.c b/server/gdial-rest.c index ea9959a4..8af53e50 100644 --- a/server/gdial-rest.c +++ b/server/gdial-rest.c @@ -22,6 +22,8 @@ #include #include #include +#include +#include #include #include @@ -159,7 +161,7 @@ static GList *gdial_rest_server_registered_apps_clear(GDialRestServer *self, GLi GDialRestServerPrivate *priv = gdial_rest_server_get_instance_private(self); GDialAppRegistry *app_registry = (GDialAppRegistry *)found->data; registered_apps = g_list_remove_link(registered_apps, found); - GDIAL_LOGINFO("gdial_local_rest_http_server_callback handler Removed for App[%s]instance[%x]", app_registry->name,priv->local_soup_instance); + GDIAL_LOGINFO("gdial_local_rest_http_server_callback handler Removed for App[%s]instance[%x]", app_registry->name,(uintptr_t)priv->local_soup_instance); soup_server_remove_handler(priv->local_soup_instance, app_registry->app_uri); gdial_app_regstry_dispose (app_registry); g_list_free(found); @@ -712,7 +714,10 @@ static void gdial_local_rest_http_server_callback(SoupServer *server, continue; } if (j == 0) { - g_strlcpy(base, elements[i], sizeof(base)); + ret = g_strlcpy(base, elements[i], sizeof(base)); + if (ret >= sizeof(base)) { + GDIAL_LOGERROR("Warn: base too long"); + } } else if (j == 1) { ret = g_strlcpy(instance, elements[i], sizeof(instance)); @@ -1165,7 +1170,7 @@ gboolean gdial_rest_server_register_app(GDialRestServer *self, const gchar *app_ if( 0 != strcmp(app_name,"system")) { - GDIAL_LOGINFO("gdial_local_rest_http_server_callback handler added for App[%s]uri[%s]instance[%x]",app_name,app_registry->app_uri,priv->local_soup_instance); + GDIAL_LOGINFO("gdial_local_rest_http_server_callback handler added for App[%s]uri[%s]instance[%x]",app_name,app_registry->app_uri,(uintptr_t)priv->local_soup_instance); soup_server_add_handler(priv->local_soup_instance, app_registry->app_uri, gdial_local_rest_http_server_callback, self, NULL); } GDIAL_LOGTRACE("Exiting ..."); @@ -1197,7 +1202,7 @@ gboolean gdial_rest_server_register_app_registry(GDialRestServer *self, GDialApp g_return_val_if_fail(gdial_rest_server_is_app_registered(self, app_registry->name), FALSE); if( 0 != strcmp(app_registry->name,"system")) { - GDIAL_LOGINFO("gdial_local_rest_http_server_callback handler added for App[%s]uri[%s]instance[%x]",app_registry->name,app_registry->app_uri,priv->local_soup_instance); + GDIAL_LOGINFO("gdial_local_rest_http_server_callback handler added for App[%s]uri[%s]instance[%x]",app_registry->name,app_registry->app_uri,(uintptr_t)priv->local_soup_instance); soup_server_add_handler(priv->local_soup_instance, app_registry->app_uri, gdial_local_rest_http_server_callback, self, NULL); } return TRUE; @@ -1360,4 +1365,4 @@ GDIAL_STATIC_INLINE void GET_APP_response_builder_destroy(void *builder) { g_free(rbuilder->additionalData); g_free(builder); -} \ No newline at end of file +} diff --git a/server/gdialserver_ut.cpp b/server/gdialserver_ut.cpp index 4669ac65..217eccfa 100644 --- a/server/gdialserver_ut.cpp +++ b/server/gdialserver_ut.cpp @@ -43,7 +43,7 @@ class gdialServiceTest: public GDialNotifier { GDIAL_LOGINFO("Entering ..."); std::string activation = status ? "true" : "false"; - service->ActivationChanged(activation,"SampleTest"); + service->ActivationChanged(std::move(activation),"SampleTest"); GDIAL_LOGINFO("Exiting ..."); } @@ -137,9 +137,9 @@ class gdialServiceTest: public GDialNotifier break; } - appReq->Names = Names; + appReq->Names = std::move(Names); appReq->prefixes = prefixes; - appReq->cors = prefixes; + appReq->cors = std::move(prefixes); appReq->allowStop = allowStop; appReqList->pushBack(appReq); @@ -253,4 +253,4 @@ int main(int argc, char *argv[]) delete testObject; return 0; -} \ No newline at end of file +} diff --git a/server/plat/gdial-plat-util.c b/server/plat/gdial-plat-util.c index 9f4a07b7..774bd9ea 100644 --- a/server/plat/gdial-plat-util.c +++ b/server/plat/gdial-plat-util.c @@ -128,4 +128,4 @@ void gdial_plat_util_log(gdial_plat_util_LogLevel level, func, formatted); fflush(stderr); -} \ No newline at end of file +} diff --git a/server/plat/gdial.cpp b/server/plat/gdial.cpp index 71b9cfd1..4876b746 100644 --- a/server/plat/gdial.cpp +++ b/server/plat/gdial.cpp @@ -82,6 +82,14 @@ class GDialCastObject reterror = GDIAL_CAST_ERROR_NONE; } } + else + { + if (nullptr != AppObj) + { + delete AppObj; + AppObj = nullptr; + } + } GDIAL_LOGTRACE("Exiting ..."); return reterror; } @@ -239,7 +247,7 @@ class GDialCastObject GDIAL_LOGINFO("App[%s] param[%s] observer[%p]",applicationName.c_str(),parameter.c_str(),m_observer); if (nullptr!=m_observer) { - m_observer->onApplicationLaunchRequest(applicationName,parameter); + m_observer->onApplicationLaunchRequest(std::move(applicationName),std::move(parameter)); } GDIAL_LOGTRACE("Exiting ..."); return GDIAL_CAST_ERROR_NONE; @@ -274,10 +282,10 @@ class GDialCastObject m_observer); if (nullptr!=m_observer) { - m_observer->onApplicationLaunchRequestWithLaunchParam( applicationName, - payLoad, - queryString, - additionalDataUrl ); + m_observer->onApplicationLaunchRequestWithLaunchParam( std::move(applicationName), + std::move(payLoad), + std::move(queryString), + std::move(additionalDataUrl) ); } GDIAL_LOGTRACE("Exiting ..."); return GDIAL_CAST_ERROR_NONE; @@ -298,7 +306,7 @@ class GDialCastObject GDIAL_LOGINFO("App[%s]ID[%s]observer[%p]",applicationName.c_str(),applicationId.c_str(),m_observer); if (nullptr!=m_observer) { - m_observer->onApplicationHideRequest(applicationName,applicationId); + m_observer->onApplicationHideRequest(std::move(applicationName),std::move(applicationId)); } GDIAL_LOGTRACE("Exiting ..."); return GDIAL_CAST_ERROR_NONE; @@ -320,7 +328,7 @@ class GDialCastObject GDIAL_LOGINFO("App[%s]ID[%s]observer[%p]",applicationName.c_str(),applicationId.c_str(),m_observer); if (nullptr!=m_observer) { - m_observer->onApplicationResumeRequest(applicationName,applicationId); + m_observer->onApplicationResumeRequest(std::move(applicationName),std::move(applicationId)); } GDIAL_LOGTRACE("Exiting ..."); return GDIAL_CAST_ERROR_NONE; @@ -342,7 +350,7 @@ class GDialCastObject GDIAL_LOGINFO("App[%s]ID[%s]observer[%p]",applicationName.c_str(),applicationId.c_str(),m_observer); if (nullptr!=m_observer) { - m_observer->onApplicationStopRequest(applicationName,applicationId); + m_observer->onApplicationStopRequest(std::move(applicationName),std::move(applicationId)); } GDIAL_LOGTRACE("Exiting ..."); return GDIAL_CAST_ERROR_NONE; @@ -364,7 +372,7 @@ class GDialCastObject GDIAL_LOGINFO("App[%s]ID[%s]observer[%p]",applicationName.c_str(),applicationId.c_str(),m_observer); if (nullptr!=m_observer) { - m_observer->onApplicationStateRequest(applicationName,applicationId); + m_observer->onApplicationStateRequest(std::move(applicationName),std::move(applicationId)); } GDIAL_LOGTRACE("Exiting ..."); return GDIAL_CAST_ERROR_NONE; diff --git a/server/plat/gdialappcache.cpp b/server/plat/gdialappcache.cpp index 287d53e7..dfd08dde 100644 --- a/server/plat/gdialappcache.cpp +++ b/server/plat/gdialappcache.cpp @@ -44,12 +44,12 @@ void GDialAppStatusCache :: setAppCacheId(std::string app_name,std::string id) GDIAL_LOGTRACE("Entering ..."); if(!strcmp(app_name.c_str(),"Netflix")) { - GDialAppStatusCache::Netflix_AppCacheId = id; + GDialAppStatusCache::Netflix_AppCacheId = std::move(id); GDIAL_LOGINFO("App cache Id of Netflix updated to %s",GDialAppStatusCache::Netflix_AppCacheId.c_str()); } else if(!strcmp(app_name.c_str(),"YouTube")) { - GDialAppStatusCache::Youtube_AppCacheId = id; + GDialAppStatusCache::Youtube_AppCacheId = std::move(id); GDIAL_LOGINFO("App cache Id of Youtube updated to %s",GDialAppStatusCache::Youtube_AppCacheId.c_str()); } else @@ -75,7 +75,7 @@ AppCacheErrorCodes GDialAppStatusCache::UpdateAppStatusCache(AppInfo* appEntry) GDIAL_LOGINFO("erasing old data"); err = ObjectCache->erase(id); } - err = ObjectCache->insert(id,appEntry); + err = ObjectCache->insert(std::move(id),appEntry); GDIAL_LOGTRACE("Exiting ..."); return err; } @@ -96,7 +96,7 @@ std::string GDialAppStatusCache::SearchAppStatusInCache(const char* app_name) appEntry->appId.c_str(), appEntry->appError.c_str()); } - GDIAL_LOGINFO("App State = ",state.c_str()); + GDIAL_LOGINFO("App State = %s ",state.c_str()); GDIAL_LOGTRACE("Exiting ..."); return state; } From c48dff76657733cb73a81de73a2a886d86c1dde2 Mon Sep 17 00:00:00 2001 From: Yuvaramachandran Gurusamy <123441336+yuvaramachandran-gurusamy@users.noreply.github.com> Date: Wed, 12 Nov 2025 06:31:34 +0530 Subject: [PATCH 15/18] RDKEMW-9964: Removing onStopped GDial notification (#177) * RDKEMW-9964: Removing onStopped GDial notification handling Signed-off-by: yuvaramachandran_gurusamy * RDKEMW-9964: Fixed coverity issues Signed-off-by: yuvaramachandran_gurusamy * RDKEMW-9964: Fixed coverity issues Signed-off-by: yuvaramachandran_gurusamy * RDKEMW-9964: Fixed coverity issues Signed-off-by: yuvaramachandran_gurusamy --------- Signed-off-by: yuvaramachandran_gurusamy --- server/gdialserver_ut.cpp | 5 -- server/gdialservice.cpp | 115 ++++++++++++++-------------- server/include/gdialservicecommon.h | 1 - server/include/gdialserviceimpl.h | 3 +- 4 files changed, 60 insertions(+), 64 deletions(-) diff --git a/server/gdialserver_ut.cpp b/server/gdialserver_ut.cpp index 217eccfa..88ff7999 100644 --- a/server/gdialserver_ut.cpp +++ b/server/gdialserver_ut.cpp @@ -181,11 +181,6 @@ class gdialServiceTest: public GDialNotifier GDIAL_LOGINFO("App:%s appID:%s",appName.c_str(),appID.c_str()); } - virtual void onStopped() override - { - GDIAL_LOGINFO("~~~~~~~~~~~"); - } - virtual void updatePowerState(string powerState) override { GDIAL_LOGINFO("powerState : %s",powerState.c_str()); diff --git a/server/gdialservice.cpp b/server/gdialservice.cpp index 97606bf2..fdd64ed9 100644 --- a/server/gdialservice.cpp +++ b/server/gdialservice.cpp @@ -292,7 +292,7 @@ int gdialServiceImpl::start_GDialServer(int argc, char *argv[]) soup_server_add_handler(ssdp_http_server, "/", gdial_http_server_throttle_callback, NULL, NULL); GSocketAddress *listen_address = g_inet_socket_address_new_from_string(iface_ipv4_address_, GDIAL_REST_HTTP_PORT); - SoupServerListenOptions option = 0; + SoupServerListenOptions option = (SoupServerListenOptions)0; gboolean success = soup_server_listen(rest_http_server, listen_address, option, &error); g_object_unref (listen_address); if (!success) @@ -376,7 +376,7 @@ int gdialServiceImpl::start_GDialServer(int argc, char *argv[]) if (g_strstr_len(app_list_low, app_list_len, "netflix")) { GDIAL_LOGINFO("netflix is enabled from cmdline"); - GList *allowed_origins = g_list_prepend(NULL, ".netflix.com"); + GList *allowed_origins = g_list_prepend(NULL, (gpointer)".netflix.com"); gdial_rest_server_register_app(dial_rest_server, "Netflix", NULL, NULL, TRUE, TRUE, allowed_origins); g_list_free(allowed_origins); } @@ -388,7 +388,7 @@ int gdialServiceImpl::start_GDialServer(int argc, char *argv[]) if (g_strstr_len(app_list_low, app_list_len, "youtube")) { GDIAL_LOGINFO("youtube is enabled from cmdline"); - GList *allowed_origins = g_list_prepend(NULL, ".youtube.com"); + GList *allowed_origins = g_list_prepend(NULL, (gpointer)".youtube.com"); gdial_rest_server_register_app(dial_rest_server, "YouTube", NULL, NULL, TRUE, TRUE, allowed_origins); g_list_free(allowed_origins); } @@ -400,7 +400,7 @@ int gdialServiceImpl::start_GDialServer(int argc, char *argv[]) if (g_strstr_len(app_list_low, app_list_len, "youtubetv")) { GDIAL_LOGINFO("youtubetv is enabled from cmdline"); - GList *allowed_origins = g_list_prepend(NULL, ".youtube.com"); + GList *allowed_origins = g_list_prepend(NULL, (gpointer)".youtube.com"); gdial_rest_server_register_app(dial_rest_server, "YouTubeTV", NULL, NULL, TRUE, TRUE, allowed_origins); g_list_free(allowed_origins); } @@ -412,7 +412,7 @@ int gdialServiceImpl::start_GDialServer(int argc, char *argv[]) if (g_strstr_len(app_list_low, app_list_len, "youtubekids")) { GDIAL_LOGINFO("youtubekids is enabled from cmdline"); - GList *allowed_origins = g_list_prepend(NULL, ".youtube.com"); + GList *allowed_origins = g_list_prepend(NULL, (gpointer)".youtube.com"); gdial_rest_server_register_app(dial_rest_server, "YouTubeKids", NULL, NULL, TRUE, TRUE, allowed_origins); g_list_free(allowed_origins); } @@ -424,7 +424,7 @@ int gdialServiceImpl::start_GDialServer(int argc, char *argv[]) if (g_strstr_len(app_list_low, app_list_len, "amazoninstantvideo")) { GDIAL_LOGINFO("AmazonInstantVideo is enabled from cmdline"); - GList *allowed_origins = g_list_prepend(NULL, ".amazonprime.com"); + GList *allowed_origins = g_list_prepend(NULL, (gpointer)".amazonprime.com"); gdial_rest_server_register_app(dial_rest_server, "AmazonInstantVideo", NULL, NULL, TRUE, TRUE, allowed_origins); g_list_free(allowed_origins); } @@ -436,8 +436,8 @@ int gdialServiceImpl::start_GDialServer(int argc, char *argv[]) if (g_strstr_len(app_list_low, app_list_len, "spotify")) { GDIAL_LOGINFO("spotify is enabled from cmdline"); - GList *app_prefixes= g_list_prepend(NULL, "com.spotify"); - GList *allowed_origins = g_list_prepend(NULL, ".spotify.com"); + GList *app_prefixes= g_list_prepend(NULL, (gpointer)"com.spotify"); + GList *allowed_origins = g_list_prepend(NULL, (gpointer)".spotify.com"); gdial_rest_server_register_app(dial_rest_server, "com.spotify.Spotify.TV", app_prefixes, NULL, TRUE, TRUE, allowed_origins); g_list_free(allowed_origins); g_list_free(app_prefixes); @@ -450,7 +450,7 @@ int gdialServiceImpl::start_GDialServer(int argc, char *argv[]) if (g_strstr_len(app_list_low, app_list_len, "pairing")) { GDIAL_LOGINFO("pairing is enabled from cmdline"); - GList *allowed_origins = g_list_prepend(NULL, ".comcast.com"); + GList *allowed_origins = g_list_prepend(NULL, (gpointer)".comcast.com"); gdial_rest_server_register_app(dial_rest_server, "Pairing", NULL, NULL, TRUE, TRUE, allowed_origins); g_list_free(allowed_origins); } @@ -625,7 +625,7 @@ void *gdialServiceImpl::requestHandlerThread(void *ctx) { GDIAL_LOGTRACE("Entering ..."); gdialServiceImpl *_instance = (gdialServiceImpl *)ctx; - RequestHandlerPayload reqHdlrPayload; + RequestHandlerPayload reqHdlrPayload = {}; while(!_instance->m_RequestHandlerThreadExit) { reqHdlrPayload.appNameOrfriendlyname = ""; @@ -773,7 +773,7 @@ void *gdialServiceImpl::responseHandlerThread(void *ctx) payload.c_str(), query.c_str(), AddDataUrl.c_str()); - _instance->m_observer->onApplicationLaunchRequestWithLaunchParam(appName,payload,query,AddDataUrl); + _instance->m_observer->onApplicationLaunchRequestWithLaunchParam(std::move(appName),std::move(payload),std::move(query),std::move(AddDataUrl)); } break; case APP_LAUNCH_REQUEST: @@ -781,7 +781,7 @@ void *gdialServiceImpl::responseHandlerThread(void *ctx) std::string appName = response_data.appName, parameter = response_data.parameterOrPayload; GDIAL_LOGINFO("AppLaunch : appName:%s parameter:%s",appName.c_str(),parameter.c_str()); - _instance->m_observer->onApplicationLaunchRequest(appName,parameter); + _instance->m_observer->onApplicationLaunchRequest(std::move(appName),std::move(parameter)); } break; case APP_STOP_REQUEST: @@ -789,7 +789,7 @@ void *gdialServiceImpl::responseHandlerThread(void *ctx) std::string appName = response_data.appName, appId = response_data.appIdOrQuery; GDIAL_LOGINFO("AppStop : appName:%s appId:%s",appName.c_str(),appId.c_str()); - _instance->m_observer->onApplicationStopRequest(appName,appId); + _instance->m_observer->onApplicationStopRequest(std::move(appName),std::move(appId)); } break; case APP_HIDE_REQUEST: @@ -797,7 +797,7 @@ void *gdialServiceImpl::responseHandlerThread(void *ctx) std::string appName = response_data.appName, appId = response_data.appIdOrQuery; GDIAL_LOGINFO("AppHide : appName:%s appId:%s",appName.c_str(),appId.c_str()); - _instance->m_observer->onApplicationHideRequest(appName,appId); + _instance->m_observer->onApplicationHideRequest(std::move(appName),std::move(appId)); } break; case APP_STATE_REQUEST: @@ -805,7 +805,7 @@ void *gdialServiceImpl::responseHandlerThread(void *ctx) std::string appName = response_data.appName, appId = response_data.appIdOrQuery; GDIAL_LOGINFO("AppState : appName:%s appId:%s",appName.c_str(),appId.c_str()); - _instance->m_observer->onApplicationStateRequest(appName,appId); + _instance->m_observer->onApplicationStateRequest(std::move(appName),std::move(appId)); } break; case APP_RESUME_REQUEST: @@ -813,7 +813,7 @@ void *gdialServiceImpl::responseHandlerThread(void *ctx) std::string appName = response_data.appName, appId = response_data.appIdOrQuery; GDIAL_LOGINFO("AppResume : appName:%s appId:%s",appName.c_str(),appId.c_str()); - _instance->m_observer->onApplicationResumeRequest(appName,appId); + _instance->m_observer->onApplicationResumeRequest(std::move(appName),std::move(appId)); } break; default: @@ -825,7 +825,6 @@ void *gdialServiceImpl::responseHandlerThread(void *ctx) } } _instance->m_gdialserver_response_handler_thread = 0; - _instance->m_observer->onStopped(); pthread_exit(nullptr); } @@ -982,13 +981,14 @@ GDIAL_SERVICE_ERROR_CODES gdialService::ApplicationStateChanged(string applicati error.c_str()); if ((nullptr != m_gdialService ) && (nullptr != gdialImplInstance)) { - RequestHandlerPayload payload; + RequestHandlerPayload payload = {}; payload.event = APP_STATE_CHANGED; - - payload.appNameOrfriendlyname = applicationName; - payload.appIdOractivation = applicationId; - payload.state = appState; - payload.error = error; + payload.appNameOrfriendlyname = std::move(applicationName); + payload.appIdOractivation = std::move(applicationId); + payload.state = std::move(appState); + payload.error = std::move(error); + payload.data_param = nullptr; + payload.user_param1 = false; gdialImplInstance->sendRequest(payload); } GDIAL_LOGTRACE("Exiting ..."); @@ -1002,11 +1002,12 @@ GDIAL_SERVICE_ERROR_CODES gdialService::ActivationChanged(string activation, str GDIAL_LOGINFO("activation[%s] friendlyname[%s]",activation.c_str(),friendlyname.c_str()); if ((nullptr != m_gdialService ) && (nullptr != gdialImplInstance)) { - RequestHandlerPayload payload; + RequestHandlerPayload payload = {}; payload.event = ACTIVATION_CHANGED; - - payload.appNameOrfriendlyname = friendlyname; - payload.appIdOractivation = activation; + payload.appNameOrfriendlyname = std::move(friendlyname); + payload.appIdOractivation = std::move(activation); + payload.data_param = nullptr; + payload.user_param1 = false; GDIAL_LOGINFO("ACTIVATION_CHANGED request sent"); gdialImplInstance->sendRequest(payload); } @@ -1021,10 +1022,11 @@ GDIAL_SERVICE_ERROR_CODES gdialService::FriendlyNameChanged(string friendlyname) GDIAL_LOGINFO("friendlyname[%s]",friendlyname.c_str()); if ((nullptr != m_gdialService ) && (nullptr != gdialImplInstance)) { - RequestHandlerPayload payload; + RequestHandlerPayload payload = {}; payload.event = FRIENDLYNAME_CHANGED; - - payload.appNameOrfriendlyname = friendlyname; + payload.appNameOrfriendlyname = std::move(friendlyname); + payload.data_param = nullptr; + payload.user_param1 = false; gdialImplInstance->sendRequest(payload); } GDIAL_LOGTRACE("Exiting ..."); @@ -1051,9 +1053,10 @@ GDIAL_SERVICE_ERROR_CODES gdialService::RegisterApplications(RegisterAppEntryLis GDIAL_LOGINFO("appConfigList[%p]",appConfigList); if ((nullptr != m_gdialService ) && (nullptr != gdialImplInstance)) { - RequestHandlerPayload payload; + RequestHandlerPayload payload = {}; payload.event = REGISTER_APPLICATIONS; payload.data_param = appConfigList; + payload.user_param1 = false; gdialImplInstance->sendRequest(payload); } GDIAL_LOGTRACE("Exiting ..."); @@ -1067,9 +1070,10 @@ void gdialService::setNetworkStandbyMode(bool nwStandbymode) GDIAL_LOGINFO("nwStandbymode[%u]",nwStandbymode); if ((nullptr != m_gdialService ) && (nullptr != gdialImplInstance)) { - RequestHandlerPayload payload; + RequestHandlerPayload payload = {}; payload.event = UPDATE_NW_STANDBY; payload.user_param1 = (bool)nwStandbymode; + payload.data_param = nullptr; gdialImplInstance->sendRequest(payload); } GDIAL_LOGTRACE("Exiting ..."); @@ -1083,9 +1087,11 @@ GDIAL_SERVICE_ERROR_CODES gdialService::setManufacturerName(string manufacturer) GDIAL_LOGINFO("Manufacturer[%s]",manufacturer.c_str()); if ((nullptr != m_gdialService ) && (nullptr != gdialImplInstance)) { - RequestHandlerPayload payload; + RequestHandlerPayload payload = {}; payload.event = UPDATE_MANUFACTURER_NAME; - payload.manufacturer = manufacturer; + payload.manufacturer = std::move(manufacturer); + payload.data_param = nullptr; + payload.user_param1 = false; gdialImplInstance->sendRequest(payload); } GDIAL_LOGTRACE("Exiting ..."); @@ -1099,9 +1105,11 @@ GDIAL_SERVICE_ERROR_CODES gdialService::setModelName(string model) GDIAL_LOGINFO("Model[%s]",model.c_str()); if ((nullptr != m_gdialService ) && (nullptr != gdialImplInstance)) { - RequestHandlerPayload payload; + RequestHandlerPayload payload = {}; payload.event = UPDATE_MODEL_NAME; - payload.model = model; + payload.model = std::move(model); + payload.data_param = nullptr; + payload.user_param1 = false; gdialImplInstance->sendRequest(payload); } GDIAL_LOGTRACE("Exiting ..."); @@ -1134,10 +1142,10 @@ void gdialServiceImpl::onApplicationLaunchRequestWithLaunchParam(string appName, GDIAL_LOGTRACE("Entering ..."); payload.event = APP_LAUNCH_REQUEST_WITH_PARAMS; - payload.appName = appName; - payload.parameterOrPayload = strPayLoad; - payload.appIdOrQuery = strQuery; - payload.AddDataUrl = strAddDataUrl; + payload.appName = std::move(appName); + payload.parameterOrPayload = std::move(strPayLoad); + payload.appIdOrQuery = std::move(strQuery); + payload.AddDataUrl = std::move(strAddDataUrl); notifyResponse(payload); GDIAL_LOGTRACE("Exiting ..."); } @@ -1148,8 +1156,8 @@ void gdialServiceImpl::onApplicationLaunchRequest(string appName, string paramet GDIAL_LOGTRACE("Entering ..."); payload.event = APP_LAUNCH_REQUEST; - payload.appName = appName; - payload.parameterOrPayload = parameter; + payload.appName = std::move(appName); + payload.parameterOrPayload = std::move(parameter); notifyResponse(payload); GDIAL_LOGTRACE("Exiting ..."); } @@ -1160,8 +1168,8 @@ void gdialServiceImpl::onApplicationStopRequest(string appName, string appID) GDIAL_LOGTRACE("Entering ..."); payload.event = APP_STOP_REQUEST; - payload.appName = appName; - payload.appIdOrQuery = appID; + payload.appName = std::move(appName); + payload.appIdOrQuery = std::move(appID); notifyResponse(payload); GDIAL_LOGTRACE("Exiting ..."); } @@ -1172,8 +1180,8 @@ void gdialServiceImpl::onApplicationHideRequest(string appName, string appID) GDIAL_LOGTRACE("Entering ..."); payload.event = APP_HIDE_REQUEST; - payload.appName = appName; - payload.appIdOrQuery = appID; + payload.appName = std::move(appName); + payload.appIdOrQuery = std::move(appID); notifyResponse(payload); GDIAL_LOGTRACE("Exiting ..."); } @@ -1184,8 +1192,8 @@ void gdialServiceImpl::onApplicationResumeRequest(string appName, string appID) GDIAL_LOGTRACE("Entering ..."); payload.event = APP_RESUME_REQUEST; - payload.appName = appName; - payload.appIdOrQuery = appID; + payload.appName = std::move(appName); + payload.appIdOrQuery = std::move(appID); notifyResponse(payload); GDIAL_LOGTRACE("Exiting ..."); } @@ -1196,24 +1204,19 @@ void gdialServiceImpl::onApplicationStateRequest(string appName, string appID) GDIAL_LOGTRACE("Entering ..."); payload.event = APP_STATE_REQUEST; - payload.appName = appName; - payload.appIdOrQuery = appID; + payload.appName = std::move(appName); + payload.appIdOrQuery = std::move(appID); notifyResponse(payload); GDIAL_LOGTRACE("Exiting ..."); } -void gdialServiceImpl::onStopped() -{ - // -} - void gdialServiceImpl::updatePowerState(string powerState) { GDIAL_LOGTRACE("Entering ..."); GDIAL_LOGINFO("powerState : %s",powerState.c_str()); if (m_observer) { - m_observer->updatePowerState(powerState); + m_observer->updatePowerState(std::move(powerState)); } GDIAL_LOGTRACE("Exiting ..."); } \ No newline at end of file diff --git a/server/include/gdialservicecommon.h b/server/include/gdialservicecommon.h index 3f9dfe49..fb463373 100644 --- a/server/include/gdialservicecommon.h +++ b/server/include/gdialservicecommon.h @@ -78,7 +78,6 @@ class GDialNotifier virtual void onApplicationHideRequest(string appName, string appID)=0; virtual void onApplicationResumeRequest(string appName, string appID)=0; virtual void onApplicationStateRequest(string appName, string appID)=0; - virtual void onStopped(void)=0; virtual void updatePowerState(string powerState)=0; }; #endif /* _GDIAL_SERVICE_COMMON_H_ */ \ No newline at end of file diff --git a/server/include/gdialserviceimpl.h b/server/include/gdialserviceimpl.h index 5733b43e..26f4b430 100644 --- a/server/include/gdialserviceimpl.h +++ b/server/include/gdialserviceimpl.h @@ -97,14 +97,13 @@ class gdialServiceImpl: public GDialNotifier virtual void onApplicationHideRequest(string appName, string appID) override; virtual void onApplicationResumeRequest(string appName, string appID) override; virtual void onApplicationStateRequest(string appName, string appID) override; - virtual void onStopped() override; virtual void updatePowerState(string powerState) override; private: gdialServiceImpl(){}; virtual ~gdialServiceImpl(){}; - GDialNotifier *m_observer; + GDialNotifier *m_observer{nullptr}; pthread_t m_gdialserver_main_thread{0}; static void *mainThread(void *ctx); From 3da15c8c1d2d3bbc6f341f6451ce52ae019e4a4d Mon Sep 17 00:00:00 2001 From: srinibas15 <113517102+srinibas15@users.noreply.github.com> Date: Fri, 5 Dec 2025 07:27:04 +0530 Subject: [PATCH 16/18] RDKEMW-11024 - Using copilot identify and fix the static code analysis issues in xdial (#182) * RDKEMW-11024 - Using copilot identify and fix the static code analysis issues in xdial Reason for Change: Resolving the static code issues scanned by copilot Test Procedure: Compiled and Verified Risks: Low Priority: P1 version: minor Signed-off-by: smohap466 --------- Signed-off-by: smohap466 Co-authored-by: smohap466 Co-authored-by: dkumar798 --- server/gdial-rest.c | 5 ++++- server/plat/gdialappcache.cpp | 17 +++++++++++------ 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/server/gdial-rest.c b/server/gdial-rest.c index 8af53e50..6902dbd3 100644 --- a/server/gdial-rest.c +++ b/server/gdial-rest.c @@ -540,6 +540,8 @@ static void gdial_rest_server_handle_POST(GDialRestServer *gdial_rest_server, So } else { g_object_unref(app); + // FIX(Copilot): Set app to NULL after unref to prevent use-after-free + app = NULL; gdial_rest_server_http_return_if(start_error == GDIAL_APP_ERROR_FORBIDDEN, msg, SOUP_STATUS_FORBIDDEN); gdial_rest_server_http_return_if(start_error == GDIAL_APP_ERROR_UNAUTH, msg, SOUP_STATUS_UNAUTHORIZED); gdial_rest_server_http_return_if(TRUE, msg, SOUP_STATUS_SERVICE_UNAVAILABLE); @@ -653,7 +655,8 @@ static void gdial_rest_server_handle_POST_dial_data(GDialRestServer *gdial_rest_ if (query) { GHashTable *dupQuery = gdial_util_str_str_hashtable_dup(query); body_query = query ? gdial_util_str_str_hashtable_merge(body_query, dupQuery) : body_query; - g_hash_table_destory(dupQuery); + // FIX(Copilot): Correct typo g_hash_table_destory -> g_hash_table_destroy + g_hash_table_destroy(dupQuery); } #endif gdial_app_set_additional_dial_data(app, body_query); diff --git a/server/plat/gdialappcache.cpp b/server/plat/gdialappcache.cpp index dfd08dde..d8c380c7 100644 --- a/server/plat/gdialappcache.cpp +++ b/server/plat/gdialappcache.cpp @@ -89,12 +89,17 @@ std::string GDialAppStatusCache::SearchAppStatusInCache(const char* app_name) if(doIdExist(id)) { AppInfo* appEntry = ObjectCache->findObject(id); - - state = appEntry->appState; - GDIAL_LOGINFO("APPCache: App Name[%s] AppID[%s] Error[%s]", - appEntry->appName.c_str(), - appEntry->appId.c_str(), - appEntry->appError.c_str()); + // FIX(Copilot): Add NULL check for appEntry + if (appEntry) { + state = appEntry->appState; + GDIAL_LOGINFO("APPCache: App Name[%s] AppID[%s] Error[%s]", + appEntry->appName.c_str(), + appEntry->appId.c_str(), + appEntry->appError.c_str()); + } + else { + GDIAL_LOGERROR("Cache entry exists but findObject returned NOT_FOUND"); + } } GDIAL_LOGINFO("App State = %s ",state.c_str()); GDIAL_LOGTRACE("Exiting ..."); From 29f678989ac24e57118b5274208fa9bfaf4c22a3 Mon Sep 17 00:00:00 2001 From: dkumar798 Date: Thu, 8 Jan 2026 23:05:06 +0530 Subject: [PATCH 17/18] RDKEMW-12059: Fix Coverity identified issues (#183) * RDKEMW-12059: Fix Coverity identified issues --- server/gdial-rest.c | 6 +++--- server/gdial-ssdp.c | 4 +++- server/plat/gdial-plat-util.c | 4 ++-- server/plat/gdial.cpp | 2 +- server/plat/gdialappcache.hpp | 2 +- 5 files changed, 10 insertions(+), 8 deletions(-) diff --git a/server/gdial-rest.c b/server/gdial-rest.c index 6902dbd3..c9604e98 100644 --- a/server/gdial-rest.c +++ b/server/gdial-rest.c @@ -161,7 +161,7 @@ static GList *gdial_rest_server_registered_apps_clear(GDialRestServer *self, GLi GDialRestServerPrivate *priv = gdial_rest_server_get_instance_private(self); GDialAppRegistry *app_registry = (GDialAppRegistry *)found->data; registered_apps = g_list_remove_link(registered_apps, found); - GDIAL_LOGINFO("gdial_local_rest_http_server_callback handler Removed for App[%s]instance[%x]", app_registry->name,(uintptr_t)priv->local_soup_instance); + GDIAL_LOGINFO("gdial_local_rest_http_server_callback handler Removed for App[%s]instance[%p]", app_registry->name,(void*)priv->local_soup_instance); soup_server_remove_handler(priv->local_soup_instance, app_registry->app_uri); gdial_app_regstry_dispose (app_registry); g_list_free(found); @@ -1173,7 +1173,7 @@ gboolean gdial_rest_server_register_app(GDialRestServer *self, const gchar *app_ if( 0 != strcmp(app_name,"system")) { - GDIAL_LOGINFO("gdial_local_rest_http_server_callback handler added for App[%s]uri[%s]instance[%x]",app_name,app_registry->app_uri,(uintptr_t)priv->local_soup_instance); + GDIAL_LOGINFO("gdial_local_rest_http_server_callback handler added for App[%s]uri[%s]instance[%p]",app_name,app_registry->app_uri,(void*)priv->local_soup_instance); soup_server_add_handler(priv->local_soup_instance, app_registry->app_uri, gdial_local_rest_http_server_callback, self, NULL); } GDIAL_LOGTRACE("Exiting ..."); @@ -1205,7 +1205,7 @@ gboolean gdial_rest_server_register_app_registry(GDialRestServer *self, GDialApp g_return_val_if_fail(gdial_rest_server_is_app_registered(self, app_registry->name), FALSE); if( 0 != strcmp(app_registry->name,"system")) { - GDIAL_LOGINFO("gdial_local_rest_http_server_callback handler added for App[%s]uri[%s]instance[%x]",app_registry->name,app_registry->app_uri,(uintptr_t)priv->local_soup_instance); + GDIAL_LOGINFO("gdial_local_rest_http_server_callback handler added for App[%s]uri[%s]instance[%p]",app_registry->name,app_registry->app_uri,(void*)priv->local_soup_instance); soup_server_add_handler(priv->local_soup_instance, app_registry->app_uri, gdial_local_rest_http_server_callback, self, NULL); } return TRUE; diff --git a/server/gdial-ssdp.c b/server/gdial-ssdp.c index d2ed7808..107b42cf 100644 --- a/server/gdial-ssdp.c +++ b/server/gdial-ssdp.c @@ -257,6 +257,7 @@ int gdial_ssdp_new(SoupServer *ssdp_http_server, GDialOptions *options, const gc int gdial_ssdp_destroy() { GDIAL_LOGTRACE("Entering ..."); + pthread_mutex_lock(&ssdpServerEventSync); if (ssdp_http_server_) { soup_server_remove_handler(ssdp_http_server_, "/dd.xml"); @@ -315,6 +316,7 @@ int gdial_ssdp_destroy() { g_object_unref(ssdp_client_); ssdp_client_ = NULL; } + pthread_mutex_unlock(&ssdpServerEventSync); pthread_mutex_destroy(&ssdpServerEventSync); GDIAL_LOGTRACE("Exiting ..."); return 0; @@ -386,4 +388,4 @@ int gdial_ssdp_set_modelname(const gchar *model_name) } pthread_mutex_unlock(&ssdpServerEventSync); return 0; -} \ No newline at end of file +} diff --git a/server/plat/gdial-plat-util.c b/server/plat/gdial-plat-util.c index 774bd9ea..fd6e9594 100644 --- a/server/plat/gdial-plat-util.c +++ b/server/plat/gdial-plat-util.c @@ -120,8 +120,8 @@ void gdial_plat_util_log(gdial_plat_util_LogLevel level, va_start(argptr, format); vsnprintf(formatted, kFormatMessageSize, format, argptr); va_end(argptr); - fprintf(stderr, "[GDIAL][%d] %s [%s:%d] %s: %s \n", - (int)syscall(SYS_gettid), + fprintf(stderr, "[GDIAL][%ld] %s [%s:%d] %s: %s \n", + (long)syscall(SYS_gettid), levelMap[level], basename(file), line, diff --git a/server/plat/gdial.cpp b/server/plat/gdial.cpp index 4876b746..6e294fde 100644 --- a/server/plat/gdial.cpp +++ b/server/plat/gdial.cpp @@ -383,7 +383,7 @@ class GDialCastObject m_observer = service; } private: - GDialNotifier *m_observer; + GDialNotifier *m_observer{nullptr}; }; GDialCastObject* GDialObjHandle = nullptr; diff --git a/server/plat/gdialappcache.hpp b/server/plat/gdialappcache.hpp index a3191f5e..276b79f3 100644 --- a/server/plat/gdialappcache.hpp +++ b/server/plat/gdialappcache.hpp @@ -56,7 +56,7 @@ class GDialAppStatusCache private: GDialObjectCacheHelper* ObjectCache; - GDialNotifier* m_observer; + GDialNotifier* m_observer{nullptr}; static std::string Netflix_AppCacheId; static std::string Youtube_AppCacheId; }; From 48461dc2b8a21975cc598c4956a9fd5c621482a8 Mon Sep 17 00:00:00 2001 From: agampa263 <133222558+agampa263@users.noreply.github.com> Date: Tue, 20 Jan 2026 21:50:59 +0530 Subject: [PATCH 18/18] RDKEMW-12555 : Fix coveirty workflow scan in xdialserver repo (#187) * RDKEMW-12555 : Fix coveirty workflow scan in xdialserver repo Reason for Change: Fix coveirty scan workflow failure in xdialserver repo Test Procedure: Verify coveirty workflow Risks: Low Priority: P1 version: minor Signed-off-by:AkshayKumar_Gampa AkshayKumar_Gampa@comcast.com * RDKEMW-12555 : Fix coveirty workflow scan in xdialserver repo Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- .github/workflows/native_full_build.yml | 4 ++-- build_dependencies.sh | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/native_full_build.yml b/.github/workflows/native_full_build.yml index b241c8d2..8869a3ea 100755 --- a/.github/workflows/native_full_build.yml +++ b/.github/workflows/native_full_build.yml @@ -11,7 +11,7 @@ jobs: name: Build xdialserver component in github rdkcentral runs-on: ubuntu-latest container: - image: ghcr.io/rdkcentral/docker-rdk-ci:latest + image: ubuntu:22.04 steps: - name: Checkout code @@ -22,4 +22,4 @@ jobs: sh -x build_dependencies.sh sh -x cov_build.sh env: - GITHUB_TOKEN: ${{ secrets.RDKCM_RDKE }} + GITHUB_TOKEN: ${{ secrets.RDKCM_RDKE }} \ No newline at end of file diff --git a/build_dependencies.sh b/build_dependencies.sh index 86d6c353..1dad0973 100755 --- a/build_dependencies.sh +++ b/build_dependencies.sh @@ -10,7 +10,7 @@ cd ${GITHUB_WORKSPACE} #1. Install Dependencies and packages apt update -apt install -y ninja-build meson curl libsoup2.4-dev libxml2-dev libglib2.0-dev gobject-introspection libgirepository1.0-dev libgtk-3-dev valac pandoc +apt install -y git python3 python3-pip cmake ninja-build meson curl libsoup2.4-dev libxml2-dev libglib2.0-dev gobject-introspection libgirepository1.0-dev libgtk-3-dev libcurl4-openssl-dev libcunit1-dev valac pandoc pip install jsonref ############################