2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 #include "parameter.h"
18 #include "sdbd_plugin.h"
19 #include "default_plugin.h"
22 #define MAX_OUT_BUF_SIZE 128
24 eventfunc event_handler = NULL;
26 int default_plugin_init ( eventfunc event_cb, registerfunc register_func )
28 // default plugin do not need to register command
29 // because unsupported command by plugin should be called with default plugin anyway
30 event_handler = event_cb;
32 if (is_supported_by_plugin(PLUGIN_EVENT_PWLOCK) == 0) {
33 create_pwlock_thread();
36 return PLUGIN_CMD_SUCCESS;
39 int default_plugin_sync_proc ( int cmd, parameters* in, parameters* out )
41 int ret = PLUGIN_CMD_NOT_SUPPORT;
43 if ( cmd == PLUGIN_SYNC_CMD_CAPABILITY ) {
44 ret = get_plugin_capability ( in, out );
45 } else if ( cmd == PLUGIN_SYNC_CMD_VERIFY_SHELLCMD ) {
46 ret = verify_shell_cmd ( in, out );
47 } else if ( cmd == PLUGIN_SYNC_CMD_CONVERT_SHELLCMD ) {
48 ret = convert_shell_cmd ( in, out );
49 } else if ( cmd == PLUGIN_SYNC_CMD_VERIFY_PEERIP ) {
50 ret = verify_peer_ip ( in, out );
51 } else if ( cmd == PLUGIN_SYNC_CMD_VERIFY_LAUNCH ) {
52 ret = verify_sdbd_launch ( in, out );
53 } else if ( cmd == PLUGIN_SYNC_CMD_VERIFY_ROOTCMD ) {
54 ret = verify_root_cmd ( in, out );
55 } else if ( cmd == PLUGIN_SYNC_CMD_AUTH_SUPPORT ) {
56 ret = auth_support ( in, out );
57 } else if ( cmd == PLUGIN_SYNC_CMD_AUTH_GET_KEY_FILEPATHS ) {
58 ret = auth_get_key_file_paths ( in, out );
59 } else if ( cmd == PLUGIN_SYNC_CMD_GET_LOCK_STATE ) {
60 ret = get_lock_state ( in, out );
62 ret = PLUGIN_CMD_NOT_SUPPORT;
68 int default_plugin_async_proc ( int cmd, parameters* in, int out_fd )
70 int ret = PLUGIN_CMD_NOT_SUPPORT;
72 if ( cmd == PLUGIN_ASYNC_CMD_AUTH_CONFIRM_PUBLIC ) {
73 ret = confirm_public_key ( in, out_fd );
74 } else if ( cmd == PLUGIN_ASYNC_CMD_APPCMD_SERVICE ) {
75 ret = appcmd_service ( in, out_fd );
77 ret = PLUGIN_CMD_NOT_SUPPORT;