Tizen 2.1 base
[platform/core/system/sync-agent.git] / src / framework / plugin / mo_plugin.h
1 /*
2  * sync-agent
3  * Copyright (c) 2012 Samsung Electronics Co., Ltd.
4  *
5  * Licensed under the Apache License, Version 2.0 (the License);
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  *     http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17
18 #ifndef MO_PLUGIN_H_
19 #define MO_PLUGIN_H_
20
21 #include "device/information.h"
22 #include "device/error.h"
23 #include "device-manager/mo_struct.h"
24
25 #include "error.h"
26 #include "struct.h"
27
28 /**
29  * @file mo_plugin.h
30  * @brief       Provides function pointer manipulate operation for mo module
31  */
32
33 /** @addtogroup plugin
34  *      @{
35  */
36
37 #define PLUGIN_MAX_MO   15
38
39 typedef char **(*plugin_get_server_id_list_cb) (int *server_id_list_cnt);
40
41 typedef int (*plugin_get_mo_value_cb) (const char *mo_pull_path, const char *mo_name, char **mo_value);
42
43 typedef void (*plugin_set_func_get_device_info) (sync_agent_get_devinfo_cb func);
44
45 typedef int (*plugin_execute_ext) (const char *mo_path, int *err_num, int check_operation);
46
47 typedef int (*plugin_initialize) ();
48
49 typedef struct {
50         plugin_get_server_id_list_cb func_get_server_id_list;
51         plugin_get_mo_value_cb func_get_mo_value;
52         plugin_set_func_get_device_info func_setfunc_get_device_info;
53         plugin_execute_ext func_execute_ext;
54         plugin_initialize func_initialize;
55 } plugin_mo_func_set_s;
56
57 typedef struct {
58         plugin_info_s plugin_info;
59         plugin_mo_func_set_s func_set;
60         sync_agent_dm_mo_type_e mo_type;
61 } plugin_mo_s;
62
63 plugin_mo_func_set_s plugin_get_mo_func_set(void *plugin_handle, plugin_error_e * error_code);
64
65 plugin_error_e plugin_register_plugin_mo(plugin_mo_s plugin);
66
67 /**
68  * @brief Clear mo plugin repository being maintained as a singleton
69  */
70 void plugin_clear_plugin_mo();
71
72 /**
73  * @brief Get mo plugin repository
74  * @param[in] count as returned by plugin_get_mo_plugin_repository() - the number of mo plugin
75  * @return mo plugin repository being maintained as a singleton
76  */
77 const plugin_mo_s *plugin_get_mo_plugin_repository(int *count);
78
79 int plugin_get_mo_plugin_id(sync_agent_dm_mo_type_e mo_type);
80
81 int plugin_get_mo_plugin_id_list(int **plugin_id_list);
82
83 plugin_get_server_id_list_cb plugin_get_function_get_server_id_list(int plugin_id);
84
85 plugin_get_mo_value_cb plugin_get_function_get_mo_value(int plugin_id);
86
87 plugin_set_func_get_device_info plugin_get_function_set_func_get_device_info(int plugin_id);
88
89 plugin_execute_ext plugin_get_function_execute_ext(int plugin_id);
90
91 plugin_initialize plugin_get_function_initialize(int plugin_id);
92
93 /**
94  *      @}
95  */
96
97 #endif                          /* MO_PLUGIN_H_ */