tizen 2.3.1 release
[framework/telephony/libtcore.git] / include / server.h
1 /*
2  * libtcore
3  *
4  * Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Contact: Ja-young Gu <jygu@samsung.com>
7  *
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
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
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.
19  */
20
21 #ifndef __TCORE_SERVER_H__
22 #define __TCORE_SERVER_H__
23
24 __BEGIN_DECLS
25
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);
31
32 Server*       tcore_server_new();
33 void          tcore_server_free(Server *s);
34
35 TReturn       tcore_server_run(Server *s);
36 TReturn       tcore_server_exit(Server *s);
37
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);
41
42 TReturn       tcore_server_add_communicator(Server *s, Communicator *comm);
43 TReturn       tcore_server_remove_communicator(Server *s, Communicator *comm);
44 GSList*       tcore_server_ref_communicators(Server *s);
45 Communicator* tcore_server_find_communicator(Server *s, const char *name);
46
47 TReturn       tcore_server_add_storage(Server *s, Storage *strg);
48 GSList*       tcore_server_ref_storages(Server *s);
49 Storage*      tcore_server_find_storage(Server *s, const char *name);
50
51 TReturn       tcore_server_add_hal(Server *s, TcoreHal *hal);
52 TReturn       tcore_server_remove_hal(Server *s, TcoreHal *hal);
53 GSList*       tcore_server_ref_hals(Server *s);
54 TcoreHal*     tcore_server_find_hal(Server *s, const char *name);
55
56 CoreObject *tcore_server_find_template_object(Server *s, unsigned int type);
57
58 TReturn       tcore_server_link_udev(Server *s, TcoreUdev *udev);
59 TcoreUdev*    tcore_server_ref_udev(Server *s);
60
61 TReturn       tcore_server_dispatch_request(Server *s, UserRequest *ur);
62 TReturn       tcore_server_send_notification(Server *s, CoreObject *source,
63                   enum tcore_notification_command command,
64                   unsigned int data_len, void *data);
65
66 TReturn       tcore_server_add_request_hook(Server *s,
67                   enum tcore_request_command command,
68                   TcoreServerRequestHook func, void *user_data);
69 TReturn       tcore_server_remove_request_hook(Server *s,
70                   TcoreServerRequestHook func);
71 TReturn       tcore_server_add_notification_hook(Server *s,
72                   enum tcore_notification_command command,
73                   TcoreServerNotificationHook func, void *user_data);
74 TReturn       tcore_server_remove_notification_hook(Server *s,
75                   TcoreServerNotificationHook func);
76
77 TcoreModem *tcore_server_register_modem(Server *s, TcorePlugin *modem_iface_plugin);
78 void tcore_server_unregister_modem(Server *s, TcoreModem *modem);
79 gboolean tcore_server_update_modem_plugin(TcorePlugin *modem_iface_plugin,
80                                                         TcorePlugin *modem_plugin);
81 GSList *tcore_server_get_cp_name_list(Server *s);
82 const char *tcore_server_get_cp_name_by_plugin(TcorePlugin *modem_plugin);
83
84 gboolean tcore_server_add_cp_mapping_tbl_entry(TcoreModem *modem,
85                                         unsigned int co_type, TcoreHal *hal);
86 void tcore_server_remove_cp_mapping_tbl(TcoreModem *modem);
87 void tcore_server_remove_cp_mapping_tbl_entry(TcoreModem *modem,
88                                         TcoreHal *hal);
89 void *tcore_server_get_cp_mapping_tbl(TcorePlugin *modem_plugin);
90 void tcore_server_print_modems(Server *s);
91
92 TReturn tcore_server_load_modem_plugin(Server *s,
93                                         TcoreModem *modem,
94                                         const char *name)
95 ;
96 void tcore_server_unload_modem_plugin(Server *s, TcoreModem *modem);
97 GSList *tcore_server_get_modem_plugin_list(Server *s);
98 __END_DECLS
99
100 #endif