Revert "Revert "Add the appcmd protocol for product extended routine.""
[sdk/target/sdbd.git] / src / plugin.h
1 /*
2  * Copyright (c) 2011 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 #ifndef __PLUGIN_H
18 #define __PLUGIN_H
19
20 #include "sdbd_plugin.h"
21
22 #define PLUGIN_PATH    "/usr/lib/libsdbd_plugin.so"
23
24 int default_plugin_init ( eventfunc event_cb, registerfunc register_func );
25 int default_plugin_sync_proc ( int cmd, parameters* in, parameters* out );
26 int default_plugin_async_proc ( int cmd, parameters* in, int out_fd );
27
28 void load_sdbd_plugin();
29 void unload_sdbd_plugin();
30
31 // return 1 if plugin support given command
32 // return 0 if plugin does not support given command
33 int is_supported_by_plugin ( int cmd );
34
35 // return 1 if succeed to get capability from plugin
36 // return 0 otherwise
37 int request_capability_to_plugin ( int cap, char* out_buf, unsigned int out_len );
38
39 // return 1 if allowed by plugin (valid)
40 // return 0 if disallowed by plugin (invalid)
41 int request_validity_to_plugin ( int cmd, const char* in_buf );
42
43 // return 1 if succeed to convert
44 // return 0 otherwise
45 int request_conversion_to_plugin ( int cmd, const char* in_buf, char* out_buf, unsigned int out_len );
46
47 // return 1 if locked
48 // return 0 if unlocked
49 // return -1 if request failed
50 int request_lock_state_to_plugin ( int lock_type );
51
52 // return nonnegative integer that is a socket descriptor for communication
53 //        with async proc thread if success to create async proc thread
54 // return -1 if failed to create async proc thread
55 int request_appcmd_to_plugin ( const char* in_buf );
56
57 #endif //__PLUGIN_H