4 * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
6 * Contact: Ja-young Gu <jygu@samsung.com>
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
21 #ifndef __TCORE_SERVER_H__
22 #define __TCORE_SERVER_H__
26 typedef enum tcore_hook_return (*TcoreServerRequestHook)(Server *s,
27 UserRequest *ur, void *user_data);
28 typedef enum tcore_hook_return (*TcoreServerNotificationHook)(Server *s,
29 CoreObject *source, enum tcore_notification_command command,
30 unsigned int data_len, void *data, void *user_data);
32 Server* tcore_server_new();
33 void tcore_server_free(Server *s);
35 TReturn tcore_server_run(Server *s);
36 TReturn tcore_server_exit(Server *s);
38 TReturn tcore_server_add_plugin(Server *s, TcorePlugin *plugin);
39 GSList* tcore_server_ref_plugins(Server *s);
40 TcorePlugin* tcore_server_find_plugin(Server *s, const char *name);
42 TReturn tcore_server_add_communicator(Server *s, Communicator *comm);
43 GSList* tcore_server_ref_communicators(Server *s);
44 Communicator* tcore_server_find_communicator(Server *s, const char *name);
46 TReturn tcore_server_add_storage(Server *s, Storage *strg);
47 GSList* tcore_server_ref_storages(Server *s);
48 Storage* tcore_server_find_storage(Server *s, const char *name);
50 TReturn tcore_server_add_hal(Server *s, TcoreHal *hal);
51 GSList* tcore_server_ref_hals(Server *s);
52 TcoreHal* tcore_server_find_hal(Server *s, const char *name);
54 TReturn tcore_server_link_udev(Server *s, TcoreUdev *udev);
55 TcoreUdev* tcore_server_ref_udev(Server *s);
57 TReturn tcore_server_dispatch_request(Server *s, UserRequest *ur);
58 TReturn tcore_server_send_notification(Server *s, CoreObject *source,
59 enum tcore_notification_command command,
60 unsigned int data_len, void *data);
62 TReturn tcore_server_add_request_hook(Server *s,
63 enum tcore_request_command command,
64 TcoreServerRequestHook func, void *user_data);
65 TReturn tcore_server_remove_request_hook(Server *s,
66 TcoreServerRequestHook func);
67 TReturn tcore_server_add_notification_hook(Server *s,
68 enum tcore_notification_command command,
69 TcoreServerNotificationHook func, void *user_data);
70 TReturn tcore_server_remove_notification_hook(Server *s,
71 TcoreServerNotificationHook func);