Release version 0.4.17
[platform/core/appfw/data-control.git] / include / data_control_provider_internal.h
1 /*
2  * Copyright (c) 2013 - 2017 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  * Licensed under the Apache License, Version 2.0 (the License);
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an AS IS BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 /**
18  * @file data-control-provider.h
19  * @brief This is the header file for the data control provider.
20  */
21
22 #ifndef _APPFW_DATA_CONTROL_PROVIDER_H_
23 #define _APPFW_DATA_CONTROL_PROVIDER_H_
24
25 #include <data_control_types.h>
26 #include <data_control_provider.h>
27
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31
32 /**
33  * @brief  Sends select result without selected data.
34  * @details This function is made for C# API. C# API has a different select flow. \n
35  *          It will send select result after provider's select callback and \n
36  *          do not get db handle for sending result to remove db dependancy. \n
37  *          So, this function just send provider's select callback result and pass \n
38  *          connected socket fd for sending selected data to consumer.
39  *
40  * @param[in]  request_id The request ID
41  * @param[out] fd The socket fd
42  *
43  * @return  @c 0 on success,
44  *          otherwise a negative error value
45  *
46  * @retval #DATACONTROL_ERROR_NONE              Successful
47  * @retval #DATACONTROL_ERROR_INVALID_PARAMETER Invalid parameter
48  * @retval #DATACONTROL_ERROR_IO_ERROR          I/O error
49  * @retval #DATACONTROL_ERROR_OUT_OF_MEMORY Out of memory
50  */
51 int datacontrol_provider_send_select_result_without_data(int request_id, int *fd);
52
53 /**
54  * @brief Writes data to socket.
55  * @details This function is made for C# API. C# API has a different select flow. \n
56  *          It will send select result after provider's select callback and \n
57  *          do not get db handle for sending result to remove db dependancy. \n
58  *          So, C# API need native API which get buffer and send it to the consumer.
59  *
60  * @param[in] fd The socket fd
61  * @param[in] buffer The data for sending to the consumer application
62  * @param[in] nbytes The data size
63  * @param[out] bytes_write The data size of sent successfully to the consumer
64  *
65  * @return  @c 0 on success,
66  *          otherwise a negative error value
67  *
68  * @retval #DATACONTROL_ERROR_NONE              Successful
69  * @retval #DATACONTROL_ERROR_IO_ERROR          I/O error
70  */
71 int datacontrol_provider_write_socket(int fd, void *buffer, unsigned int nbytes,
72                 unsigned int *bytes_write);
73
74 /**
75  * @brief Gets select request page info.
76  * @details This function is made for C# API. C# API can control selected page in proivder's callback. \n
77  *          This function provide request page info to the provider application so that provider application \n
78  *          can manage which page should be sent to the consumer.
79  *
80  * @param[in]  request_id The request ID
81  * @param[out] page_num The requested page number
82  * @param[out] count_per_page The requested count per page
83  *
84  * @return  @c 0 on success,
85  *          otherwise a negative error value
86  *
87  * @retval #DATACONTROL_ERROR_NONE              Successful
88  * @retval #DATACONTROL_ERROR_INVALID_PARAMETER Invalid parameter
89  * @retval #DATACONTROL_ERROR_IO_ERROR          I/O error
90  */
91 int datacontrol_provider_get_select_page_info(int request_id, int *page_num, int *count_per_page);
92
93 #ifdef __cplusplus
94 }
95 #endif
96
97 #endif /* _APPFW_DATA_CONTROL_PROVIDER_H_ */
98