f4eded29fa8aa6a58330c44ea56ff469b9cde22a
[framework/telephony/libtcore.git] / include / plugin.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_PLUGIN_H__
22 #define __TCORE_PLUGIN_H__
23
24 __BEGIN_DECLS
25
26 enum tcore_plugin_priority {
27         TCORE_PLUGIN_PRIORITY_HIGH = -100,
28         TCORE_PLUGIN_PRIORITY_MID = 0,
29         TCORE_PLUGIN_PRIORITY_LOW = +100
30 };
31
32 struct tcore_plugin_define_desc {
33         gchar *name;
34         enum tcore_plugin_priority priority;
35         int version;
36         gboolean (*load)();
37         gboolean (*init)(TcorePlugin *);
38         void (*unload)(TcorePlugin *);
39 };
40
41
42 TcorePlugin* tcore_plugin_new(Server *server,
43                  const struct tcore_plugin_define_desc *desc,
44                  const char *filename, void *handle);
45 void         tcore_plugin_free(TcorePlugin *plugin);
46
47 const struct tcore_plugin_define_desc*
48              tcore_plugin_get_description(TcorePlugin *plugin);
49
50 char*        tcore_plugin_get_filename(TcorePlugin *plugin);
51 char*        tcore_plugin_ref_plugin_name(TcorePlugin *plugin);
52 Server*      tcore_plugin_ref_server(TcorePlugin *plugin);
53
54 TReturn      tcore_plugin_link_user_data(TcorePlugin *plugin, void *user_data);
55 void*        tcore_plugin_ref_user_data(TcorePlugin *plugin);
56
57 TReturn      tcore_plugin_add_core_object(TcorePlugin *plugin, CoreObject *co);
58 CoreObject*  tcore_plugin_ref_core_object(TcorePlugin *plugin, const char *name);
59 GSList*      tcore_plugin_get_core_objects_bytype(TcorePlugin *plugin,
60                  unsigned int type);
61
62 TReturn      tcore_plugin_core_object_event_emit(TcorePlugin *plugin,
63                  const char *event, const void *event_info);
64
65 TReturn      tcore_plugin_link_property(TcorePlugin *plugin, const char *key,
66                  void *data);
67 void*        tcore_plugin_ref_property(TcorePlugin *plugin, const char *key);
68
69 __END_DECLS
70
71 #endif