summaryrefslogtreecommitdiff
path: root/src/include/app-sharing.h
blob: 8bf8a4a5946db38f87199ac52c280bd4eac0d474 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
/*
 * Copyright (c) 2016-2020 Samsung Electronics Co., Ltd. All rights reserved.
 *
 * This file is licensed under the terms of MIT License or the Apache License
 * Version 2.0 of your choice. See the LICENSE.MIT file for MIT license details.
 * See the LICENSE file or the notice below for Apache License Version 2.0
 * details.
 *
 * 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 "security-manager-types.h"

#ifdef __cplusplus
extern "C" {
#endif

/**
 * This function is responsible for initialize private_sharing_req data structure
 * It uses dynamic allocation inside and user responsibility is to call
 * private_sharing_req_free() for freeing allocated resources
 *
 * \param[out] pp_req  Address of pointer for handle private_sharing_req structure
 * \return API return code or error code
 */
int security_manager_private_sharing_req_new(private_sharing_req **pp_req);

/**
 * This function is used to free resources allocated by calling private_sharing_req_new()
 *
 * \param[in] p_req  Pointer handling allocated app_inst_req structure
 */
void security_manager_private_sharing_req_free(private_sharing_req *p_req);

/**
 * This function is used to set up package identifier of paths owner application
 * in private_sharing_req structure
 *
 * \param[in] p_req   Pointer handling private_sharing_req structure
 * \param[in] app_id  Application identifier
 * \return API return code or error code: it would be
 * - SECURITY_MANAGER_SUCCESS on success,
 * - SECURITY_MANAGER_ERROR_REQ_NOT_COMPLETE when either owner app_id, target app_id
 *   or paths are not set,
 * - SECURITY_MANAGER_ERROR_UNKNOWN on other errors.
 */
int security_manager_private_sharing_req_set_owner_appid(private_sharing_req *p_req,
                                                         const char *app_id);

/**
 * This function is used to set up package identifier of sharing target application
 * in private_sharing_req structure
 *
 * \param[in] p_req   Pointer handling private_sharing_req structure
 * \param[in] app_id  Application identifier
 * \return API return code or error code
 */
int security_manager_private_sharing_req_set_target_appid(private_sharing_req *p_req,
                                                          const char *app_id);

/**
 * This function is used to add path list to be shared in private_sharing_req structure
 *
 * \param[in] p_req       Pointer handling private_sharing_req structure
 * \param[in] pp_paths    Path list
 * \param[in] path_count  Path count
 * \return API return code or error code
 */
int security_manager_private_sharing_req_add_paths(private_sharing_req *p_req,
                                                   const char **pp_paths,
                                                   size_t path_count);

/**
 * This function is used to apply private sharing based on given private_sharing_req.
 * One path can be shared with multiple applications at the same time.
 *
 * Required privileges:
 * - http://tizen.org/privilege/notexist
 *
 * \param[in] p_req  Pointer handling private_sharing_req structure
 * \return API return code or error code: it would be
 * - SECURITY_MANAGER_SUCCESS on success,
 * - SECURITY_MANAGER_ERROR_INPUT_PARAM when either owner app_id, target app_id or paths are not set,
 * - SECURITY_MANAGER_ERROR_UNKNOWN on other errors.
 */
int security_manager_private_sharing_apply(const private_sharing_req *p_req);

/**
 * This function is used to drop private sharing based on given private_sharing_req.
 *
 * Required privileges:
 * - http://tizen.org/privilege/notexist
 *
 * \param[in] p_req  Pointer handling private_sharing_req structure
 * \return API return code or error code: it would be
 * - SECURITY_MANAGER_SUCCESS on success,
 * - SECURITY_MANAGER_ERROR_REQ_NOT_COMPLETE when either owner app_id, target app_id
 *   or paths are not set,
 * - SECURITY_MANAGER_ERROR_UNKNOWN on other errors.
 */
int security_manager_private_sharing_drop(const private_sharing_req *p_req);

#ifdef __cplusplus
}
#endif