Add 3.0 APIs and sync APIs same as 2.4
[platform/core/convergence/service-adaptor.git] / adaptor / storage-adaptor / posix_service.h
1 /*
2  * POSIX Service
3  *
4  * Copyright (c) 2014 - 2015 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  *
18  */
19
20 #ifndef __POSIX_SERVICE_H__
21 #define __POSIX_SERVICE_H__
22
23 #ifndef API
24 #define API __attribute__ ((visibility("default")))
25 #endif
26
27 #ifdef __cplusplus
28 extern "C"
29 {
30 #endif
31
32 #include <glib.h>
33
34 /**
35  * @brief Describes infromation about Cloud Service
36  * @key name, ...
37  */
38 typedef struct _posix_service_s
39 {
40         int (*posix_open_service)(void *plugin,
41                         const char *path,
42                         int flags,
43                         void *user_data);
44
45         int (*posix_read_service)(void *plugin,
46                         const char *path,
47                         char **buf,
48                         size_t size,
49                         off_t offset,
50                         void *user_data);
51
52         int (*posix_write_service)(void *plugin,
53                         const char *path,
54                         const char *buf,
55                         size_t size,
56                         off_t offset,
57                         void *user_data);
58
59         int (*posix_close_service)(void *plugin,
60                         const char *path,
61                         int flags,
62                         void *user_data);
63 } posix_service_s;
64 typedef struct _posix_service_s *posix_service_h;
65
66 /*==================================================================================================
67                                          FUNCTION PROTOTYPES
68 ==================================================================================================*/
69
70 /**
71 * @brief Register Posix Service
72 * @since_tizen 3.0
73 *
74 * @param[in]    cloud  The Cloud service handle
75 * @param[in]    service
76 * @remarks
77 * @see          cloud_unregister_service()
78 * @return 0 on success, otherwise a negative error value
79 * @retval #SERVICE_ADAPTOR_ERROR_NONE Successful
80 * @retval #SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER Invalid parameter
81 * @retval #SERVICE_ADAPTOR_ERROR_UNKNOWN Unknown error
82 */
83 int posix_register_service(posix_service_h posix, GHashTable *service);
84
85 /**
86 * @brief Unregister Cloud Service
87 * @since_tizen 3.0
88 *
89 * @param[in]    cloud  The Cloud service handle
90 * @remarks
91 * @see          cloud_register_service()
92 * @return 0 on success, otherwise a negative error value
93 * @retval #SERVICE_ADAPTOR_ERROR_NONE Successful
94 * @retval #SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER Invalid parameter
95 * @retval #SERVICE_ADAPTOR_ERROR_UNKNOWN Unknown error
96 */
97 int posix_unregister_service(posix_service_h posix);
98
99 #ifdef __cplusplus
100 }
101 #endif
102
103 #endif /* __POSIX_SERVICE_H__ */