### Install ###
-INSTALL(TARGETS appsvc DESTINATION lib COMPONENT RuntimeLibraries)
+INSTALL(TARGETS appsvc DESTINATION ${LIB_INSTALL_DIR} COMPONENT RuntimeLibraries)
INSTALL(TARGETS ${AVATAR_NAME} DESTINATION bin)
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/appsvc.h DESTINATION include/appsvc)
-INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/appsvc.pc DESTINATION lib/pkgconfig)
+INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/appsvc.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/data/appsvc_db.sql DESTINATION /opt/share )
* @brief Return values in appsvc.
*/
typedef enum _appsvc_return_val {
+ APPSVC_RET_EILLACC = -5, /**< Illegal Access */
APPSVC_RET_ELAUNCH = -4, /**< Failure on launching the app */
APPSVC_RET_ENOMATCH = -3, /**< No matching result Error */
APPSVC_RET_EINVAL = -2, /**< Invalid argument */
-#sbs-git:slp/pkgs/a/app-svc app-svc 0.1.19 de68cdc468eaded317b4f5be9cdafebb01639aa0
Name: app-svc
Summary: App svc
-Version: 0.1.42
+Version: 0.1.48
Release: 1
Group: System/Libraries
License: Apache License, Version 2.0
%build
-
-CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS" cmake . -DCMAKE_INSTALL_PREFIX=/usr
-
+%cmake .
make %{?jobs:-j%jobs}
%install
-rm -rf %{buildroot}
%make_install
%defattr(-,root,root,-)
/opt/share/appsvc_db.sql
/usr/bin/appsvc_test
-/usr/lib/libappsvc.so.0
-/usr/lib/libappsvc.so.0.1.0
+%{_libdir}/libappsvc.so.0
+%{_libdir}/libappsvc.so.0.1.0
%files devel
%defattr(-,root,root,-)
-/usr/lib/pkgconfig/appsvc.pc
-/usr/lib/libappsvc.so
+%{_libdir}/pkgconfig/appsvc.pc
+%{_libdir}/libappsvc.so
/usr/include/appsvc/appsvc.h
cb_info = __create_rescb(request_code, cbfunc, data);
ret = aul_launch_app_with_result(pkgname, b, __aul_cb, cb_info);
- if(ret < 0)
+ if(ret == AUL_R_EILLACC) {
+ ret = APPSVC_RET_EILLACC;
+ } else if(ret < 0) {
ret = APPSVC_RET_ELAUNCH;
+ }
} else {
_D("pkg_name : %s - no result", pkgname);
ret = aul_launch_app(pkgname, b);
tmp = malloc(MAX_MIME_STR_SIZE);
__get_list_with_condition(op, uri, mime, pkg_list);
-
if ((strncmp(mime, "NULL", 4) != 0) && (strncmp(s_type, "%", 1) != 0)) {
snprintf(tmp, MAX_MIME_STR_SIZE-1, "%s/*", m_type);
__get_list_with_condition(op, uri, tmp, pkg_list);
}
-
if ((strncmp(mime, "NULL", 4) != 0) && (strncmp(m_type, "%", 1) != 0)) {
snprintf(tmp, MAX_MIME_STR_SIZE-1, "*/*");
__get_list_with_condition(op, uri, tmp, pkg_list);
}
-
free(tmp);
return 0;
static int __get_list_with_condition_mime_extened_with_collation(char *op, char *uri, char *mime,
char *m_type, char *s_type, GSList **pkg_list)
{
+ char *tmp;
+
+ tmp = malloc(MAX_MIME_STR_SIZE);
+
_svc_db_get_list_with_collation(op, uri, mime, pkg_list);
+ if ((strncmp(mime, "NULL", 4) != 0) && (strncmp(s_type, "%", 1) != 0)) {
+ snprintf(tmp, MAX_MIME_STR_SIZE-1, "%s/*", m_type);
+ _svc_db_get_list_with_collation(op, uri, tmp, pkg_list);
+ }
+ if ((strncmp(mime, "NULL", 4) != 0) && (strncmp(m_type, "%", 1) != 0)) {
+ snprintf(tmp, MAX_MIME_STR_SIZE-1, "*/*");
+ _svc_db_get_list_with_collation(op, uri, tmp, pkg_list);
+ }
+ free(tmp);
return 0;
}
return APPSVC_RET_EINVAL;
}
- memset(&info, 0, sizeof(appsvc_resolve_info_t));
- ret = __get_resolve_info(b, &info);
- if(ret < 0)
- return ret;
-
- pkgname = info.pkgname;
- _D("op - %s / mime - %s / shceme - %s\n", info.op, info.origin_mime, info.scheme);
+ pkgname = (char *)appsvc_get_pkgname(b);
/* explict*/
if(pkgname) {
if(appsvc_get_operation(b) == NULL)
appsvc_set_operation(b,APPSVC_OPERATION_DEFAULT);
ret = __run_svc_with_pkgname(pkgname, b, request_code, cbfunc, data);
- __free_resolve_info_data(&info);
return ret;
}
+ memset(&info, 0, sizeof(appsvc_resolve_info_t));
+ ret = __get_resolve_info(b, &info);
+ if(ret < 0)
+ return ret;
+
+ _D("op - %s / mime - %s / shceme - %s\n", info.op, info.origin_mime, info.scheme);
+
/*uri*/
pkgname = _svc_db_get_app(info.op, info.origin_mime, info.uri);
if(pkgname==NULL){
__get_list_with_condition_mime_extened(info.op, info.scheme,
info.mime, info.m_type, info.s_type, &pkg_list);
+ __get_list_with_condition_mime_extened(info.op, "*",
+ info.mime, info.m_type, info.s_type, &pkg_list);
+
if(info.category) {
__get_list_with_category(info.category, &pkg_list);
}
__get_list_with_condition_mime_extened(info.op, info.scheme,
info.mime, info.m_type, info.s_type, &pkg_list);
+ __get_list_with_condition_mime_extened(info.op, "*",
+ info.mime, info.m_type, info.s_type, &pkg_list);
+
if(info.category) {
__get_list_with_category(info.category, &pkg_list);
}
__get_list_with_condition_mime_extened(info.op, info.scheme,
info.mime, info.m_type, info.s_type, &pkg_list);
+ __get_list_with_condition_mime_extened(info.op, "*",
+ info.mime, info.m_type, info.s_type, &pkg_list);
+
if(info.category) {
__get_list_with_category(info.category, &pkg_list);
}
#define SVC_DB_PATH "/opt/dbspace/.appsvc.db"
#define APP_INFO_DB_PATH "/opt/dbspace/.app_info.db"
-#define QUERY_MAXLEN 4096
+#define QUERY_MAX_LEN 8192
+#define URI_MAX_LEN 4096
#define BUF_MAX_LEN 1024
#define APPSVC_COLLATION "appsvc_collation"
int _svc_db_add_app(const char *op, const char *mime_type, const char *uri, const char *pkg_name)
{
char m[BUF_MAX_LEN];
- char u[BUF_MAX_LEN];
- char query[BUF_MAX_LEN];
+ char u[URI_MAX_LEN];
+ char query[QUERY_MAX_LEN];
char* error_message = NULL;
if(__init()<0)
strncpy(m,mime_type,BUF_MAX_LEN-1);
if(uri==NULL)
- strncpy(u,"NULL",BUF_MAX_LEN-1);
+ strncpy(u,"NULL",URI_MAX_LEN-1);
else
- strncpy(u,uri,BUF_MAX_LEN-1);
-
- sprintf(query,"insert into appsvc( operation, mime_type, uri, pkg_name) \
+ strncpy(u,uri,URI_MAX_LEN-1);
+
+ snprintf(query, QUERY_MAX_LEN, "insert into appsvc( operation, mime_type, uri, pkg_name) \
values('%s','%s','%s','%s')",op,m,u,pkg_name);
if (SQLITE_OK != sqlite3_exec(svc_db, query, NULL, NULL, &error_message))
int _svc_db_delete_with_pkgname(const char *pkg_name)
{
- char query[BUF_MAX_LEN];
+ char query[QUERY_MAX_LEN];
char* error_message = NULL;
if(pkg_name == NULL) {
if(__init()<0)
return -1;
- snprintf(query, BUF_MAX_LEN, "delete from appsvc where pkg_name = '%s';", pkg_name);
+ snprintf(query, QUERY_MAX_LEN, "delete from appsvc where pkg_name = '%s';", pkg_name);
if (SQLITE_OK != sqlite3_exec(svc_db, query, NULL, NULL, &error_message))
{
int _svc_db_is_defapp(const char *pkg_name)
{
- char query[BUF_MAX_LEN];
+ char query[QUERY_MAX_LEN];
sqlite3_stmt *stmt;
int cnt = 0;
int ret = -1;
if(__init()<0)
return 0;
- snprintf(query, BUF_MAX_LEN,
+ snprintf(query, QUERY_MAX_LEN,
"select count(*) from appsvc where pkg_name = '%s';", pkg_name);
ret = sqlite3_prepare(svc_db, query, sizeof(query), &stmt, NULL);
char* _svc_db_get_app(const char *op, const char *mime_type, const char *uri)
{
char m[BUF_MAX_LEN];
- char u[BUF_MAX_LEN];
- char query[BUF_MAX_LEN];
+ char u[URI_MAX_LEN];
+ char query[QUERY_MAX_LEN];
sqlite3_stmt* stmt;
int ret;
char* pkgname;
strncpy(m,mime_type,BUF_MAX_LEN-1);
if(uri==NULL)
- strncpy(u,"NULL",BUF_MAX_LEN-1);
+ strncpy(u,"NULL",URI_MAX_LEN-1);
else
- strncpy(u,uri,BUF_MAX_LEN-1);
+ strncpy(u,uri,URI_MAX_LEN-1);
// if(doubt_sql_injection(mime_type))
// return NULL;
return NULL;
- sprintf(query,"select pkg_name from appsvc where operation='%s' and mime_type='%s' and uri='%s'",\
+ snprintf(query, QUERY_MAX_LEN, "select pkg_name from appsvc where operation='%s' and mime_type='%s' and uri='%s'",\
op,m,u);
_D("query : %s\n",query);
int _svc_db_get_list_with_collation(char *op, char *uri, char *mime, GSList **pkg_list)
{
- char query[BUF_MAX_LEN];
+ char query[QUERY_MAX_LEN];
sqlite3_stmt* stmt;
int ret;
GSList *iter = NULL;
if(__init_app_info_db()<0)
return 0;
- sprintf(query,"select package from app_info where x_slp_svc='%s|%s|%s' collate appsvc_collation", op,uri,mime);
+ snprintf(query, QUERY_MAX_LEN, "select package from app_info where x_slp_svc='%s|%s|%s' collate appsvc_collation", op,uri,mime);
_D("query : %s\n",query);
ret = sqlite3_prepare(app_info_db, query, strlen(query), &stmt, NULL);