f6949a1817defc295a410d85a77854071544863d
[platform/framework/web/web-provider.git] / src / Plugin / box_plugin_interface.h
1 /*
2  * Copyright (c) 2013 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  *    Licensed under the Flora License, Version 1.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://floralicense.org/license/
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  * @file    box_plugin_interface.h
18  * @author  Yunchan Cho (yunchan.cho@samsung.com)
19  */
20 #ifndef BOX_PLUGIN_INTERFACE_H
21 #define BOX_PLUGIN_INTERFACE_H
22
23 #include <string>
24 #include <Core/BoxData.h>
25
26 #define EXPORT_API  __attribute__((visibility("default")))
27
28 #define WEB_PROVIDER_PLUGIN_INTERFACE_SYM_INITIALIZE "web_provider_plugin_interface_initialize"
29 #define WEB_PROVIDER_PLUGIN_INTERFACE_SYM_COMMAND    "web_provider_plugin_interface_command"
30 #define WEB_PROVIDER_PLUGIN_INTERFACE_SYM_SHUTDOWN   "web_provider_plugin_interface_shutdown"
31
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35
36 typedef enum {
37     REQUEST_CMD_ADD_BOX,
38     REQUEST_CMD_REMOVE_BOX,
39     REQUEST_CMD_OPEN_PD,
40     REQUEST_CMD_CLOSE_PD,
41     REQUEST_CMD_RESIZE_BOX,
42     REQUEST_CMD_RESUME_BOX,
43     REQUEST_CMD_PAUSE_BOX,
44     REQUEST_CMD_RESUME_ALL,
45     REQUEST_CMD_PAUSE_ALL,
46     REQUEST_CMD_CHANGE_PERIOD,
47 } request_cmd_type;
48
49 // definition of interface function type
50 typedef int (*plugin_interface_func_initialize)(void);
51 typedef int (*plugin_interface_func_command)(
52         const request_cmd_type type, const BoxInfoPtr& boxInfo);
53 typedef int (*plugin_interface_func_shutdown)(void);
54
55 typedef struct {
56     void* handle;
57     const char* service_boxid;
58     plugin_interface_func_initialize initialize;
59     plugin_interface_func_command command;
60     plugin_interface_func_shutdown shutdown;
61 } plugin_interfaces;
62
63 // inteface functions that should be implemented by each plugin
64 EXPORT_API int web_provider_plugin_interface_initialize();
65 EXPORT_API int web_provider_plugin_interface_command(
66         const request_cmd_type type, const BoxInfoPtr& boxInfo);
67 EXPORT_API int web_provider_plugin_interface_shutdown();
68
69 #ifdef __cplusplus
70 }
71 #endif
72
73 #endif // BOX_PLUGIN_INTERFACE_H