1 /*
2  * base-connection-manager.h - Header for TpBaseConnectionManager
3  *
4  * Copyright (C) 2007 Collabora Ltd.
5  * Copyright (C) 2007 Nokia Corporation
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this library; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
20  */
21 
22 #if defined (TP_DISABLE_SINGLE_INCLUDE) && !defined (_TP_IN_META_HEADER) && !defined (_TP_COMPILATION)
23 #error "Only <telepathy-glib/telepathy-glib.h> and <telepathy-glib/telepathy-glib-dbus.h> can be included directly."
24 #endif
25 
26 #ifndef __TP_BASE_CONNECTION_MANAGER_H__
27 #define __TP_BASE_CONNECTION_MANAGER_H__
28 
29 #include <dbus/dbus-glib.h>
30 #include <glib-object.h>
31 
32 #include <telepathy-glib/base-connection.h>
33 #include <telepathy-glib/base-protocol.h>
34 #include <telepathy-glib/defs.h>
35 #include <telepathy-glib/proxy.h>
36 #include <telepathy-glib/svc-connection-manager.h>
37 
38 G_BEGIN_DECLS
39 
40 void tp_cm_param_setter_offset (const TpCMParamSpec *paramspec,
41     const GValue *value, gpointer params);
42 
43 typedef struct {
44     const gchar *name;
45     const TpCMParamSpec *parameters;
46     gpointer (*params_new) (void);
47     void (*params_free) (gpointer);
48     TpCMParamSetter set_param;
49 
50     /*<private>*/
51     gpointer _future1;
52     gpointer _future2;
53     gpointer _future3;
54 } TpCMProtocolSpec;
55 
56 typedef struct _TpBaseConnectionManager TpBaseConnectionManager;
57 typedef struct _TpBaseConnectionManagerPrivate TpBaseConnectionManagerPrivate;
58 typedef struct _TpBaseConnectionManagerClass TpBaseConnectionManagerClass;
59 typedef struct _TpBaseConnectionManagerClassPrivate
60     TpBaseConnectionManagerClassPrivate;
61 
62 typedef TpBaseConnection *(*TpBaseConnectionManagerNewConnFunc)(
63     TpBaseConnectionManager *self, const gchar *proto,
64     TpIntset *params_present, void *parsed_params, GError **error);
65 
66 typedef GPtrArray * (*TpBaseConnectionManagerGetInterfacesFunc) (
67     TpBaseConnectionManager *self);
68 
69 struct _TpBaseConnectionManagerClass {
70     GObjectClass parent_class;
71 
72     const char *cm_dbus_name;
73     /*<private>*/
74     const TpCMProtocolSpec *_TP_SEAL (protocol_params);
75     TpBaseConnectionManagerNewConnFunc _TP_SEAL (new_connection);
76     /*< public >*/
77 
78     /*<private>*/
79     const gchar * const *_TP_SEAL (interfaces);
80     /*<public>*/
81     TpBaseConnectionManagerGetInterfacesFunc get_interfaces;
82 
83     /*<private>*/
84     gpointer _future3;
85     gpointer _future4;
86 
87     TpBaseConnectionManagerClassPrivate *priv;
88 };
89 
90 struct _TpBaseConnectionManager {
91     /*<private>*/
92     GObject parent;
93 
94     TpBaseConnectionManagerPrivate *priv;
95 };
96 
97 GType tp_base_connection_manager_get_type (void);
98 
99 gboolean tp_base_connection_manager_register (TpBaseConnectionManager *self);
100 
101 
102 TpDBusDaemon *tp_base_connection_manager_get_dbus_daemon (
103     TpBaseConnectionManager *self);
104 
105 void tp_base_connection_manager_add_protocol (TpBaseConnectionManager *self,
106     TpBaseProtocol *protocol);
107 
108 /* TYPE MACROS */
109 #define TP_TYPE_BASE_CONNECTION_MANAGER \
110   (tp_base_connection_manager_get_type ())
111 #define TP_BASE_CONNECTION_MANAGER(obj) \
112   (G_TYPE_CHECK_INSTANCE_CAST((obj), TP_TYPE_BASE_CONNECTION_MANAGER, \
113                               TpBaseConnectionManager))
114 #define TP_BASE_CONNECTION_MANAGER_CLASS(klass) \
115   (G_TYPE_CHECK_CLASS_CAST((klass), TP_TYPE_BASE_CONNECTION_MANAGER, \
116                            TpBaseConnectionManagerClass))
117 #define TP_IS_BASE_CONNECTION_MANAGER(obj) \
118   (G_TYPE_CHECK_INSTANCE_TYPE((obj), TP_TYPE_BASE_CONNECTION_MANAGER))
119 #define TP_IS_BASE_CONNECTION_MANAGER_CLASS(klass) \
120   (G_TYPE_CHECK_CLASS_TYPE((klass), TP_TYPE_BASE_CONNECTION_MANAGER))
121 #define TP_BASE_CONNECTION_MANAGER_GET_CLASS(obj) \
122   (G_TYPE_INSTANCE_GET_CLASS ((obj), TP_TYPE_BASE_CONNECTION_MANAGER, \
123                               TpBaseConnectionManagerClass))
124 
125 G_END_DECLS
126 
127 #endif /* #ifndef __TP_BASE_CONNECTION_MANAGER_H__*/
128