e82f7527dc9e74f7e307bf06cf13ecf5c0976d2b
[profile/ivi/message-port.git] / lib / msgport-manager.h
1 /* vi: set et sw=4 ts=4 cino=t0,(0: */
2 /* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 /*
4  * Copyright (C) 2013 Intel Corporation.
5  *
6  * Contact: Amarnath Valluri <amarnath.valluri@linux.intel.com>
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2.1 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful, but
14  * WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with this library; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
21  * 02110-1301 USA
22  */
23
24 #ifndef __MSGPORT_MANAGER_H
25 #define __MSGPORT_MANAGER_H
26
27 #include <glib.h>
28 #include <glib-object.h>
29 #include <message-port.h>
30
31 #define MSGPORT_TYPE_MANAGER (msgport_manager_get_type())
32 #define MSGPORT_MANAGER(obj)          (G_TYPE_CHECK_INSTANCE_CAST((obj), MSGPORT_TYPE_MANAGER, MsgPortManager))
33 #define MSGPORT_MANAGER_CLASS(kls)    (G_TYPE_CHECK_CLASS_CAST((kls), MSGPORT_TYPE_MANAGER, MsgPortManagerClass))
34 #define MSGPORT_IS_MANAGER(obj)       (G_TYPE_CHECK_INSTANCE_TYPE((obj), MSGPORT_TYPE_MANAGER))
35 #define MSGPORT_IS_MANAGER_CLASS(kls) (G_TYPE_CHECK_CLASS_TYPE((kls), MSGPORT_TYPE_MANAGER)
36
37 typedef struct _MsgPortManager MsgPortManager;
38 typedef struct _MsgPortManagerClass MsgPortManagerClass;
39 typedef struct _MsgPortService MsgPortService;
40
41 G_BEGIN_DECLS
42
43 struct _MsgPortManagerClass
44 {
45     GObjectClass parent_class;
46 };
47
48 GType msgport_manager_get_type (void);
49
50 MsgPortManager *
51 msgport_manager_new ();
52
53 messageport_error_e
54 msgport_manager_register_service (MsgPortManager *manager, const gchar *port_name, gboolean is_trusted, messageport_message_cb cb, int *service_id_out);
55
56 messageport_error_e
57 msgport_manager_check_remote_service (MsgPortManager *manager, const gchar *remote_app_id, const gchar *port_name, gboolean is_trusted, guint *service_id_out);
58
59 messageport_error_e
60 msgport_manager_get_service_name (MsgPortManager *manager, int port_id, gchar **name_out);
61
62 messageport_error_e
63 msgport_manager_get_service_is_trusted (MsgPortManager *manager, int port_id, gboolean *is_trusted_out);
64
65 messageport_error_e
66 msgport_manager_unregister_service (MsgPortManager *manager, int service_id);
67
68 messageport_error_e
69 msgport_manager_send_message (MsgPortManager *manager, const gchar *remote_app_id, const gchar *port_name, gboolean is_trusted, GVariant *data);
70
71 messageport_error_e
72 msgport_manager_send_bidirectional_message (MsgPortManager *manager, int from_id, const gchar *remote_app_id, const gchar *port_name, gboolean is_trusted, GVariant *data);
73
74 G_END_DECLS
75
76 #endif /* __MSGPORT_MANAGER_PROXY_H */