--- /dev/null
+/*
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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
+
+#include <bundle.h>
+#include <sys/types.h>
+
+#include "aul_svc.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief The AUL Service information handle.
+ * @since_tizen 5.5
+ * @remarks This API is only for App Framework internally.
+ */
+typedef void *aul_svc_info_h;
+
+/**
+ * @brief Creates the AUL Service information handle.
+ * @since_tizen 5.5
+ *
+ * @param[in] b The bundle object
+ * @param[out] h The AUL Service information handle
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #AUL_SVC_RET_OK Successful
+ * @retval #AUL_SVC_RET_EINVAL Invalid parameter
+ * @retval #AUL_SVC_RET_ERROR Out of memory
+ */
+int aul_svc_info_create(bundle *b, aul_svc_info_h *h);
+
+/**
+ * @brief Gets the operation to be performed.
+ * @since_tizen 5.5
+ *
+ * @param[in] h The AUL Service information handle
+ * @param[out] operation The operation to be performed
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #AUL_SVC_RET_OK Successful
+ * @retval #AUL_SVC_RET_EINVAL Invalid parameter
+ * @retval #AUL_SVC_RET_ERROR Out of memory
+ */
+int aul_svc_info_get_operation(aul_svc_info_h h, char **operation);
+
+/**
+ * @brief Gets the URI of the data.
+ * @since_tizen 5.5
+ *
+ * @param[in] h The AUL Service information handle
+ * @param[out] uri The URI of the data
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #AUL_SVC_RET_OK Successful
+ * @retval #AUL_SVC_RET_EINVAL Invalid parameter
+ * @retval #AUL_SVC_RET_ERROR Out of memory
+ */
+int aul_svc_info_get_uri(aul_svc_info_h h, char **uri);
+
+/**
+ * @brief Gets the scheme of the URI.
+ * @since_tizen 5.5
+ *
+ * @param[in] h The AUL Service information handle
+ * @param[out] uri_scheme The scheme of the URI
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #AUL_SVC_RET_OK Successful
+ * @retval #AUL_SVC_RET_EINVAL Invalid parameter
+ * @retval #AUL_SVC_RET_ERROR Out of memory
+ */
+int aul_svc_info_get_uri_scheme(aul_svc_info_h h, char **uri_scheme);
+
+/**
+ * @brief Gets the host of the URI.
+ * @since_tizen 5.5
+ *
+ * @param[in] h The AUL Service information handle
+ * @param[out] uri_host The host of the URI
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #AUL_SVC_RET_OK Successful
+ * @retval #AUL_SVC_RET_EINVAL Invalid parameter
+ * @retval #AUL_SVC_RET_ERROR Out of memory
+ */
+int aul_svc_info_get_uri_host(aul_svc_info_h h, char **uri_host);
+
+/**
+ * @brief Gets the explicit MIME type of the data.
+ * @since_tizen 5.5
+ *
+ * @param[in] h The AUL Service information handle
+ * @param[out] mime The explicit MIME type of the data
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #AUL_SVC_RET_OK Successful
+ * @retval #AUL_SVC_RET_EINVAL Invalid parameter
+ * @retval #AUL_SVC_RET_ERROR Out of memory
+ */
+int aul_svc_info_get_mime(aul_svc_info_h h, char **mime);
+
+/**
+ * @brief Gets the type of the MIME type.
+ * @since_tizen 5.5
+ *
+ * @param[in] h The AUL Service information handle
+ * @param[out] mime_type The type of the MIME type
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #AUL_SVC_RET_OK Successful
+ * @retval #AUL_SVC_RET_EINVAL Invalid parameter
+ * @retval #AUL_SVC_RET_ERROR Out of memory
+ */
+int aul_svc_info_get_mime_type(aul_svc_info_h h, char **mime_type);
+
+/**
+ * @brief Gets the subtype of the MIME type.
+ * @since_tizen 5.5
+ *
+ * @param[in] h The AUL Service information handle
+ * @param[out] mime_subtype The subtype of the MIME type
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #AUL_SVC_RET_OK Successful
+ * @retval #AUL_SVC_RET_EINVAL Invalid parameter
+ * @retval #AUL_SVC_RET_ERROR Out of memory
+ */
+int aul_svc_info_get_mime_subtype(aul_svc_info_h h, char **mime_subtype);
+
+/**
+ * @brief Destroys the AUL Service information handle.
+ * @since_tizen 5.5
+ *
+ * @param[in] h The AUL Service information handle
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #AUL_SVC_RET_OK Successful
+ * @retval #AUL_SVC_RET_EINVAL Invalid parameter
+ */
+int aul_svc_info_destroy(aul_svc_info_h h);
+
+#ifdef __cplusplus
+}
+#endif
#include "aul_util.h"
#include "aul_svc_priv_key.h"
#include "launch.h"
+#include "aul_svc_internal.h"
#define MAX_CHECKSUM_BUF 2048
#define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))
return ret;
}
+
+API int aul_svc_info_create(bundle *b, aul_svc_info_h *h)
+{
+ aul_svc_resolve_info_t *info;
+ int r;
+
+ if (!b || !h) {
+ _E("Invalid parameter");
+ return AUL_SVC_RET_EINVAL;
+ }
+
+ info = calloc(1, sizeof(aul_svc_resolve_info_t));
+ if (!info) {
+ _E("Out of memory");
+ return AUL_SVC_RET_ERROR;
+ }
+
+ r = __get_resolve_info(b, info);
+ if (r < 0) {
+ _E("Failed to get resolving info");
+ __free_resolve_info_data(info);
+ free(info);
+ return r;
+ }
+
+ *h = info;
+
+ return AUL_SVC_RET_OK;
+}
+
+API int aul_svc_info_get_operation(aul_svc_info_h h, char **operation)
+{
+ aul_svc_resolve_info_t *info;
+
+ if (!h || !operation) {
+ _E("Invalid parameter");
+ return AUL_SVC_RET_EINVAL;
+ }
+
+ info = (aul_svc_resolve_info_t *)h;
+ *operation = strdup(info->op ? info->op : "NULL");
+ if (*operation == NULL) {
+ _E("Failed to duplicate operation");
+ return AUL_SVC_RET_ERROR;
+ }
+
+ return AUL_SVC_RET_OK;
+}
+
+API int aul_svc_info_get_uri(aul_svc_info_h h, char **uri)
+{
+ aul_svc_resolve_info_t *info;
+
+ if (!h || !uri) {
+ _E("Invalid parameter");
+ return AUL_SVC_RET_EINVAL;
+ }
+
+ info = (aul_svc_resolve_info_t *)h;
+ *uri = strdup(info->uri ? info->uri : "NULL");
+ if (*uri == NULL) {
+ _E("Failed to duplicate URI");
+ return AUL_SVC_RET_ERROR;
+ }
+
+ return AUL_SVC_RET_OK;
+}
+
+API int aul_svc_info_get_uri_scheme(aul_svc_info_h h, char **uri_scheme)
+{
+ aul_svc_resolve_info_t *info;
+
+ if (!h || !uri_scheme) {
+ _E("Invalid parameter");
+ return AUL_SVC_RET_EINVAL;
+ }
+
+ info = (aul_svc_resolve_info_t *)h;
+ *uri_scheme = strdup(info->scheme ? info->scheme : "NULL");
+ if (*uri_scheme == NULL) {
+ _E("Failed to duplicate URI scheme");
+ return AUL_SVC_RET_ERROR;
+ }
+
+ return AUL_SVC_RET_OK;
+}
+
+API int aul_svc_info_get_uri_host(aul_svc_info_h h, char **uri_host)
+{
+ aul_svc_resolve_info_t *info;
+
+ if (!h || !uri_host) {
+ _E("Invalid parameter");
+ return AUL_SVC_RET_EINVAL;
+ }
+
+ info = (aul_svc_resolve_info_t *)h;
+ *uri_host = strdup(info->host ? info->host : "NULL");
+ if (*uri_host == NULL) {
+ _E("Failed to duplicate URI host");
+ return AUL_SVC_RET_ERROR;
+ }
+
+ return AUL_SVC_RET_OK;
+}
+
+API int aul_svc_info_get_mime(aul_svc_info_h h, char **mime)
+{
+ aul_svc_resolve_info_t *info;
+
+ if (!h || !mime) {
+ _E("Invalid parameter");
+ return AUL_SVC_RET_EINVAL;
+ }
+
+ info = (aul_svc_resolve_info_t *)h;
+ *mime = strdup(info->mime ? info->mime : "NULL");
+ if (*mime == NULL) {
+ _E("Failed to duplicate MIME-Type");
+ return AUL_SVC_RET_ERROR;
+ }
+
+ return AUL_SVC_RET_OK;
+}
+
+API int aul_svc_info_get_mime_type(aul_svc_info_h h, char **mime_type)
+{
+ aul_svc_resolve_info_t *info;
+
+ if (!h || !mime_type) {
+ _E("Invalid parameter");
+ return AUL_SVC_RET_EINVAL;
+ }
+
+ info = (aul_svc_resolve_info_t *)h;
+ *mime_type = strdup(info->m_type ? info->m_type : "NULL");
+ if (*mime_type == NULL) {
+ _E("Failed to duplicate the type of MIME-Type");
+ return AUL_SVC_RET_ERROR;
+ }
+
+ return AUL_SVC_RET_OK;
+}
+
+API int aul_svc_info_get_mime_subtype(aul_svc_info_h h, char **mime_subtype)
+{
+ aul_svc_resolve_info_t *info;
+
+ if (!h || !mime_subtype) {
+ _E("Invalid parameter");
+ return AUL_SVC_RET_EINVAL;
+ }
+
+ info = (aul_svc_resolve_info_t *)h;
+ *mime_subtype = strdup(info->s_type ? info->s_type : "NULL");
+ if (*mime_subtype == NULL) {
+ _E("Failed to duplicate the subtype of MIME-Type");
+ return AUL_SVC_RET_ERROR;
+ }
+
+ return AUL_SVC_RET_OK;
+}
+
+API int aul_svc_info_destroy(aul_svc_info_h h)
+{
+ aul_svc_resolve_info_t *info;
+
+ if (!h) {
+ _E("Invalid parameter");
+ return AUL_SVC_RET_EINVAL;
+ }
+
+ info = (aul_svc_resolve_info_t *)h;
+ __free_resolve_info_data(info);
+ free(info);
+
+ return AUL_SVC_RET_OK;
+}