1 /* |
|
2 * gabble-connection-manager.h - Header for GabbleConnectionManager |
|
3 * Copyright (C) 2005 Collabora Ltd. |
|
4 * |
|
5 * |
|
6 * This library is free software; you can redistribute it and/or |
|
7 * modify it under the terms of the GNU Lesser General Public |
|
8 * License as published by the Free Software Foundation; either |
|
9 * version 2.1 of the License, or (at your option) any later version. |
|
10 * |
|
11 * This library is distributed in the hope that it will be useful, |
|
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
14 * Lesser General Public License for more details. |
|
15 * |
|
16 * You should have received a copy of the GNU Lesser General Public |
|
17 * License along with this library; if not, write to the Free Software |
|
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
19 */ |
|
20 |
|
21 #ifndef __GABBLE_CONNECTION_MANAGER_H__ |
|
22 #define __GABBLE_CONNECTION_MANAGER_H__ |
|
23 |
|
24 #include <glib-object.h> |
|
25 //vinod |
|
26 #include <dbus/dbus-glib.h> |
|
27 #include <dbus/dbus-protocol.h> |
|
28 #include <stdio.h> |
|
29 #include <stdlib.h> |
|
30 #include <string.h> |
|
31 |
|
32 #include "gabble-connection.h" |
|
33 #include "telepathy-constants.h" |
|
34 #include "telepathy-errors.h" |
|
35 #include "telepathy-helpers.h" |
|
36 //end |
|
37 #define GABBLE_CONN_MGR_BUS_NAME "org.freedesktop.Telepathy.ConnectionManager.gabble" |
|
38 #define GABBLE_CONN_MGR_OBJECT_PATH "/org/freedesktop/Telepathy/ConnectionManager/gabble" |
|
39 |
|
40 G_BEGIN_DECLS |
|
41 |
|
42 typedef struct _GabbleConnectionManager GabbleConnectionManager; |
|
43 typedef struct _GabbleConnectionManagerClass GabbleConnectionManagerClass; |
|
44 |
|
45 struct _GabbleConnectionManagerClass { |
|
46 GObjectClass parent_class; |
|
47 }; |
|
48 |
|
49 struct _GabbleConnectionManager { |
|
50 GObject parent; |
|
51 |
|
52 gpointer priv; |
|
53 }; |
|
54 |
|
55 typedef struct { |
|
56 const gchar *name; /* name as passed over dbus */ |
|
57 const gchar *dtype; /* D-Bus type string */ |
|
58 const GType gtype; /* glib type string */ |
|
59 guint flags; /* combination of TP_CONN_MGR_PARAM_FLAG_foo */ |
|
60 const gpointer def; /* default - gchar * or GINT_TO_POINTER */ |
|
61 const gsize offset; /* internal use only */ |
|
62 } GabbleParamSpec; |
|
63 |
|
64 typedef struct { |
|
65 const gchar *name; |
|
66 const GabbleParamSpec *parameters; /* terminated by a NULL name */ |
|
67 } GabbleProtocolSpec; |
|
68 |
|
69 //start: vinod |
|
70 /* private data */ |
|
71 |
|
72 typedef struct _GabbleParams GabbleParams; |
|
73 |
|
74 struct _GabbleParams { |
|
75 guint set_mask; |
|
76 |
|
77 gchar *account; |
|
78 gchar *password; |
|
79 gchar *server; |
|
80 gchar *resource; |
|
81 gint priority; |
|
82 guint port; |
|
83 gboolean old_ssl; |
|
84 gboolean do_register; |
|
85 gboolean low_bandwidth; |
|
86 gchar *https_proxy_server; |
|
87 guint https_proxy_port; |
|
88 gchar *fallback_conference_server; |
|
89 gchar *stun_server; |
|
90 guint stun_port; |
|
91 gboolean ignore_ssl_errors; |
|
92 gchar *alias; |
|
93 }; |
|
94 |
|
95 //const GabbleProtocolSpec *gabble_protocols; /* terminated by a NULL name */ |
|
96 static const GabbleParamSpec jabber_params[] = { |
|
97 { "account", DBUS_TYPE_STRING_AS_STRING, G_TYPE_STRING, TP_CONN_MGR_PARAM_FLAG_REQUIRED | TP_CONN_MGR_PARAM_FLAG_REGISTER, NULL, G_STRUCT_OFFSET(GabbleParams, account) }, |
|
98 { "password", DBUS_TYPE_STRING_AS_STRING, G_TYPE_STRING, TP_CONN_MGR_PARAM_FLAG_REQUIRED | TP_CONN_MGR_PARAM_FLAG_REGISTER, NULL, G_STRUCT_OFFSET(GabbleParams, password) }, |
|
99 { "server", DBUS_TYPE_STRING_AS_STRING, G_TYPE_STRING, 0, NULL, G_STRUCT_OFFSET(GabbleParams, server) }, |
|
100 { "resource", DBUS_TYPE_STRING_AS_STRING, G_TYPE_STRING, TP_CONN_MGR_PARAM_FLAG_HAS_DEFAULT, GABBLE_PARAMS_DEFAULT_RESOURCE, G_STRUCT_OFFSET(GabbleParams, resource) }, |
|
101 { "priority", DBUS_TYPE_INT16_AS_STRING, G_TYPE_INT, TP_CONN_MGR_PARAM_FLAG_HAS_DEFAULT, GINT_TO_POINTER(0), G_STRUCT_OFFSET(GabbleParams, priority) }, |
|
102 { "port", DBUS_TYPE_UINT16_AS_STRING, G_TYPE_UINT, TP_CONN_MGR_PARAM_FLAG_HAS_DEFAULT, GINT_TO_POINTER(GABBLE_PARAMS_DEFAULT_PORT), G_STRUCT_OFFSET(GabbleParams, port) }, |
|
103 { "old-ssl", DBUS_TYPE_BOOLEAN_AS_STRING, G_TYPE_BOOLEAN, TP_CONN_MGR_PARAM_FLAG_HAS_DEFAULT, GINT_TO_POINTER(FALSE), G_STRUCT_OFFSET(GabbleParams, old_ssl) }, |
|
104 { "register", DBUS_TYPE_BOOLEAN_AS_STRING, G_TYPE_BOOLEAN, TP_CONN_MGR_PARAM_FLAG_HAS_DEFAULT, GINT_TO_POINTER(FALSE), G_STRUCT_OFFSET(GabbleParams, do_register) }, |
|
105 { "low-bandwidth", DBUS_TYPE_BOOLEAN_AS_STRING, G_TYPE_BOOLEAN, TP_CONN_MGR_PARAM_FLAG_HAS_DEFAULT, GINT_TO_POINTER(FALSE), G_STRUCT_OFFSET(GabbleParams, low_bandwidth) }, |
|
106 { "https-proxy-server", DBUS_TYPE_STRING_AS_STRING, G_TYPE_STRING, 0, NULL, G_STRUCT_OFFSET(GabbleParams, https_proxy_server) }, |
|
107 { "https-proxy-port", DBUS_TYPE_UINT16_AS_STRING, G_TYPE_UINT, TP_CONN_MGR_PARAM_FLAG_HAS_DEFAULT, GINT_TO_POINTER(GABBLE_PARAMS_DEFAULT_HTTPS_PROXY_PORT), G_STRUCT_OFFSET(GabbleParams, https_proxy_port) }, |
|
108 { "fallback-conference-server", DBUS_TYPE_STRING_AS_STRING, G_TYPE_STRING, 0, NULL, G_STRUCT_OFFSET(GabbleParams, fallback_conference_server) }, |
|
109 { "stun-server", DBUS_TYPE_STRING_AS_STRING, G_TYPE_STRING, 0, NULL, G_STRUCT_OFFSET(GabbleParams, stun_server) }, |
|
110 { "stun-port", DBUS_TYPE_UINT16_AS_STRING, G_TYPE_UINT, TP_CONN_MGR_PARAM_FLAG_HAS_DEFAULT, GINT_TO_POINTER(GABBLE_PARAMS_DEFAULT_STUN_PORT), G_STRUCT_OFFSET(GabbleParams, stun_port) }, |
|
111 { "ignore-ssl-errors", DBUS_TYPE_BOOLEAN_AS_STRING, G_TYPE_BOOLEAN, TP_CONN_MGR_PARAM_FLAG_HAS_DEFAULT, GINT_TO_POINTER(FALSE), G_STRUCT_OFFSET(GabbleParams, ignore_ssl_errors) }, |
|
112 { "alias", DBUS_TYPE_STRING_AS_STRING, G_TYPE_STRING, 0, NULL, G_STRUCT_OFFSET(GabbleParams, alias) }, |
|
113 { NULL, NULL, 0, 0, NULL, 0 } |
|
114 }; |
|
115 |
|
116 static const GabbleProtocolSpec _gabble_protocols[] = { |
|
117 { "jabber", jabber_params }, |
|
118 //{ "jabber", jabber_params } |
|
119 { NULL, NULL } //vinod |
|
120 |
|
121 }; |
|
122 |
|
123 const GabbleProtocolSpec *gabble_protocols = _gabble_protocols; |
|
124 |
|
125 //end: vinod |
|
126 |
|
127 IMPORT_C GType gabble_connection_manager_get_type(void); |
|
128 |
|
129 /* TYPE MACROS */ |
|
130 #define GABBLE_TYPE_CONNECTION_MANAGER \ |
|
131 (gabble_connection_manager_get_type()) |
|
132 #define GABBLE_CONNECTION_MANAGER(obj) \ |
|
133 (G_TYPE_CHECK_INSTANCE_CAST((obj), GABBLE_TYPE_CONNECTION_MANAGER, GabbleConnectionManager)) |
|
134 #define GABBLE_CONNECTION_MANAGER_CLASS(klass) \ |
|
135 (G_TYPE_CHECK_CLASS_CAST((klass), GABBLE_TYPE_CONNECTION_MANAGER, GabbleConnectionManagerClass)) |
|
136 #define GABBLE_IS_CONNECTION_MANAGER(obj) \ |
|
137 (G_TYPE_CHECK_INSTANCE_TYPE((obj), GABBLE_TYPE_CONNECTION_MANAGER)) |
|
138 #define GABBLE_IS_CONNECTION_MANAGER_CLASS(klass) \ |
|
139 (G_TYPE_CHECK_CLASS_TYPE((klass), GABBLE_TYPE_CONNECTION_MANAGER)) |
|
140 #define GABBLE_CONNECTION_MANAGER_GET_CLASS(obj) \ |
|
141 (G_TYPE_INSTANCE_GET_CLASS ((obj), GABBLE_TYPE_CONNECTION_MANAGER, GabbleConnectionManagerClass)) |
|
142 |
|
143 #ifdef SYMBIAN |
|
144 IMPORT_C |
|
145 #endif |
|
146 void _gabble_connection_manager_register (GabbleConnectionManager *self); |
|
147 |
|
148 gboolean |
|
149 gabble_connection_manager_get_parameters (GabbleConnectionManager *self, |
|
150 const gchar *proto, |
|
151 GPtrArray **ret, |
|
152 GError **error); |
|
153 |
|
154 gboolean |
|
155 gabble_connection_manager_list_protocols (GabbleConnectionManager *self, |
|
156 gchar ***ret, |
|
157 GError **error); |
|
158 |
|
159 gboolean |
|
160 gabble_connection_manager_request_connection (GabbleConnectionManager *self, |
|
161 const gchar *proto, |
|
162 GHashTable *parameters, |
|
163 gchar **ret, |
|
164 gchar **ret1, |
|
165 GError **error); |
|
166 |
|
167 |
|
168 |
|
169 G_END_DECLS |
|
170 |
|
171 #endif /* #ifndef __GABBLE_CONNECTION_MANAGER_H__*/ |
|