autoreconf
[moonshot-ui.git] / src / dbus-client.c
1 /* dbus-client.c generated by valac 0.10.4, the Vala compiler
2  * generated from dbus-client.vala, do not modify */
3
4
5 #include <glib.h>
6 #include <glib-object.h>
7 #include <stdlib.h>
8 #include <string.h>
9 #include <dbus/dbus-glib-lowlevel.h>
10 #include <dbus/dbus-glib.h>
11 #include <dbus/dbus.h>
12 #include <stdio.h>
13
14
15 #define TYPE_MOONSHOT (moonshot_get_type ())
16 #define MOONSHOT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MOONSHOT, Moonshot))
17 #define IS_MOONSHOT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MOONSHOT))
18 #define MOONSHOT_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TYPE_MOONSHOT, MoonshotIface))
19
20 typedef struct _Moonshot Moonshot;
21 typedef struct _MoonshotIface MoonshotIface;
22 typedef struct _DBusObjectVTable _DBusObjectVTable;
23 #define _g_free0(var) (var = (g_free (var), NULL))
24 typedef struct _MoonshotDBusProxy MoonshotDBusProxy;
25 typedef DBusGProxyClass MoonshotDBusProxyClass;
26 #define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
27 #define _dbus_g_connection_unref0(var) ((var == NULL) ? NULL : (var = (dbus_g_connection_unref (var), NULL)))
28 #define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
29
30 struct _MoonshotIface {
31         GTypeInterface parent_iface;
32         gboolean (*get_identity) (Moonshot* self, const char* nai, const char* password, const char* service, char** nai_out, char** password_out, char** server_certificate_hash, char** ca_certificate, char** subject_name_constraint, char** subject_alt_name_constraint, GError** error);
33         gboolean (*get_default_identity) (Moonshot* self, char** nai_out, char** password_out, GError** error);
34 };
35
36 struct _DBusObjectVTable {
37         void (*register_object) (DBusConnection*, const char*, void*);
38 };
39
40 struct _MoonshotDBusProxy {
41         DBusGProxy parent_instance;
42         gboolean disposed;
43 };
44
45
46
47 Moonshot* moonshot_dbus_proxy_new (DBusGConnection* connection, const char* name, const char* path);
48 GType moonshot_get_type (void) G_GNUC_CONST;
49 gboolean moonshot_get_identity (Moonshot* self, const char* nai, const char* password, const char* service, char** nai_out, char** password_out, char** server_certificate_hash, char** ca_certificate, char** subject_name_constraint, char** subject_alt_name_constraint, GError** error);
50 gboolean moonshot_get_default_identity (Moonshot* self, char** nai_out, char** password_out, GError** error);
51 static void _vala_dbus_register_object (DBusConnection* connection, const char* path, void* object);
52 static void _vala_dbus_unregister_object (gpointer connection, GObject* object);
53 void moonshot_dbus_register_object (DBusConnection* connection, const char* path, void* object);
54 void _moonshot_dbus_unregister (DBusConnection* connection, void* _user_data_);
55 DBusHandlerResult moonshot_dbus_message (DBusConnection* connection, DBusMessage* message, void* object);
56 static DBusHandlerResult _dbus_moonshot_introspect (Moonshot* self, DBusConnection* connection, DBusMessage* message);
57 static DBusHandlerResult _dbus_moonshot_property_get_all (Moonshot* self, DBusConnection* connection, DBusMessage* message);
58 static DBusHandlerResult _dbus_moonshot_get_identity (Moonshot* self, DBusConnection* connection, DBusMessage* message);
59 static DBusHandlerResult _dbus_moonshot_get_default_identity (Moonshot* self, DBusConnection* connection, DBusMessage* message);
60 GType moonshot_dbus_proxy_get_type (void) G_GNUC_CONST;
61 DBusHandlerResult moonshot_dbus_proxy_filter (DBusConnection* connection, DBusMessage* message, void* user_data);
62 enum  {
63         MOONSHOT_DBUS_PROXY_DUMMY_PROPERTY
64 };
65 static gboolean moonshot_dbus_proxy_get_identity (Moonshot* self, const char* nai, const char* password, const char* service, char** nai_out, char** password_out, char** server_certificate_hash, char** ca_certificate, char** subject_name_constraint, char** subject_alt_name_constraint, GError** error);
66 static gboolean moonshot_dbus_proxy_get_default_identity (Moonshot* self, char** nai_out, char** password_out, GError** error);
67 static void moonshot_dbus_proxy_moonshot__interface_init (MoonshotIface* iface);
68 static void moonshot_dbus_proxy_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
69 static void moonshot_dbus_proxy_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec);
70 void _vala_main (void);
71
72 static const DBusObjectPathVTable _moonshot_dbus_path_vtable = {_moonshot_dbus_unregister, moonshot_dbus_message};
73 static const _DBusObjectVTable _moonshot_dbus_vtable = {moonshot_dbus_register_object};
74
75
76 gboolean moonshot_get_identity (Moonshot* self, const char* nai, const char* password, const char* service, char** nai_out, char** password_out, char** server_certificate_hash, char** ca_certificate, char** subject_name_constraint, char** subject_alt_name_constraint, GError** error) {
77         return MOONSHOT_GET_INTERFACE (self)->get_identity (self, nai, password, service, nai_out, password_out, server_certificate_hash, ca_certificate, subject_name_constraint, subject_alt_name_constraint, error);
78 }
79
80
81 gboolean moonshot_get_default_identity (Moonshot* self, char** nai_out, char** password_out, GError** error) {
82         return MOONSHOT_GET_INTERFACE (self)->get_default_identity (self, nai_out, password_out, error);
83 }
84
85
86 static void _vala_dbus_register_object (DBusConnection* connection, const char* path, void* object) {
87         const _DBusObjectVTable * vtable;
88         vtable = g_type_get_qdata (G_TYPE_FROM_INSTANCE (object), g_quark_from_static_string ("DBusObjectVTable"));
89         if (vtable) {
90                 vtable->register_object (connection, path, object);
91         } else {
92                 g_warning ("Object does not implement any D-Bus interface");
93         }
94 }
95
96
97 static void _vala_dbus_unregister_object (gpointer connection, GObject* object) {
98         char* path;
99         path = g_object_steal_data ((GObject*) object, "dbus_object_path");
100         dbus_connection_unregister_object_path (connection, path);
101         g_free (path);
102 }
103
104
105 void _moonshot_dbus_unregister (DBusConnection* connection, void* _user_data_) {
106 }
107
108
109 static DBusHandlerResult _dbus_moonshot_introspect (Moonshot* self, DBusConnection* connection, DBusMessage* message) {
110         DBusMessage* reply;
111         DBusMessageIter iter;
112         GString* xml_data;
113         char** children;
114         int i;
115         reply = dbus_message_new_method_return (message);
116         dbus_message_iter_init_append (reply, &iter);
117         xml_data = g_string_new ("<!DOCTYPE node PUBLIC \"-//freedesktop//DTD D-BUS Object Introspection 1.0//EN\" \"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd\">\n");
118         g_string_append (xml_data, "<node>\n<interface name=\"org.freedesktop.DBus.Introspectable\">\n  <method name=\"Introspect\">\n    <arg name=\"data\" direction=\"out\" type=\"s\"/>\n  </method>\n</interface>\n<interface name=\"org.freedesktop.DBus.Properties\">\n  <method name=\"Get\">\n    <arg name=\"interface\" direction=\"in\" type=\"s\"/>\n    <arg name=\"propname\" direction=\"in\" type=\"s\"/>\n    <arg name=\"value\" direction=\"out\" type=\"v\"/>\n  </method>\n  <method name=\"Set\">\n    <arg name=\"interface\" direction=\"in\" type=\"s\"/>\n    <arg name=\"propname\" direction=\"in\" type=\"s\"/>\n    <arg name=\"value\" direction=\"in\" type=\"v\"/>\n  </method>\n  <method name=\"GetAll\">\n    <arg name=\"interface\" direction=\"in\" type=\"s\"/>\n    <arg name=\"props\" direction=\"out\" type=\"a{sv}\"/>\n  </method>\n</interface>\n<interface name=\"org.janet.Moonshot\">\n  <method name=\"GetIdentity\">\n    <arg name=\"nai\" type=\"s\" direction=\"in\"/>\n    <arg name=\"password\" type=\"s\" direction=\"in\"/>\n    <arg name=\"service\" type=\"s\" direction=\"in\"/>\n    <arg name=\"nai_out\" type=\"s\" direction=\"out\"/>\n    <arg name=\"password_out\" type=\"s\" direction=\"out\"/>\n    <arg name=\"server_certificate_hash\" type=\"s\" direction=\"out\"/>\n    <arg name=\"ca_certificate\" type=\"s\" direction=\"out\"/>\n    <arg name=\"subject_name_constraint\" type=\"s\" direction=\"out\"/>\n    <arg name=\"subject_alt_name_constraint\" type=\"s\" direction=\"out\"/>\n    <arg name=\"result\" type=\"b\" direction=\"out\"/>\n  </method>\n  <method name=\"GetDefaultIdentity\">\n    <arg name=\"nai_out\" type=\"s\" direction=\"out\"/>\n    <arg name=\"password_out\" type=\"s\" direction=\"out\"/>\n    <arg name=\"result\" type=\"b\" direction=\"out\"/>\n  </method>\n</interface>\n");
119         dbus_connection_list_registered (connection, g_object_get_data ((GObject *) self, "dbus_object_path"), &children);
120         for (i = 0; children[i]; i++) {
121                 g_string_append_printf (xml_data, "<node name=\"%s\"/>\n", children[i]);
122         }
123         dbus_free_string_array (children);
124         g_string_append (xml_data, "</node>\n");
125         dbus_message_iter_append_basic (&iter, DBUS_TYPE_STRING, &xml_data->str);
126         g_string_free (xml_data, TRUE);
127         if (reply) {
128                 dbus_connection_send (connection, reply, NULL);
129                 dbus_message_unref (reply);
130                 return DBUS_HANDLER_RESULT_HANDLED;
131         } else {
132                 return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
133         }
134 }
135
136
137 static DBusHandlerResult _dbus_moonshot_property_get_all (Moonshot* self, DBusConnection* connection, DBusMessage* message) {
138         DBusMessage* reply;
139         DBusMessageIter iter, reply_iter, subiter;
140         char* interface_name;
141         const char* _tmp0_;
142         if (strcmp (dbus_message_get_signature (message), "s")) {
143                 return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
144         }
145         dbus_message_iter_init (message, &iter);
146         reply = dbus_message_new_method_return (message);
147         dbus_message_iter_init_append (reply, &reply_iter);
148         dbus_message_iter_get_basic (&iter, &_tmp0_);
149         dbus_message_iter_next (&iter);
150         interface_name = g_strdup (_tmp0_);
151         if (strcmp (interface_name, "org.janet.Moonshot") == 0) {
152                 dbus_message_iter_open_container (&reply_iter, DBUS_TYPE_ARRAY, "{sv}", &subiter);
153                 dbus_message_iter_close_container (&reply_iter, &subiter);
154         } else {
155                 dbus_message_unref (reply);
156                 reply = NULL;
157         }
158         g_free (interface_name);
159         if (reply) {
160                 dbus_connection_send (connection, reply, NULL);
161                 dbus_message_unref (reply);
162                 return DBUS_HANDLER_RESULT_HANDLED;
163         } else {
164                 return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
165         }
166 }
167
168
169 static DBusHandlerResult _dbus_moonshot_get_identity (Moonshot* self, DBusConnection* connection, DBusMessage* message) {
170         DBusMessageIter iter;
171         GError* error;
172         char* nai = NULL;
173         const char* _tmp1_;
174         char* password = NULL;
175         const char* _tmp2_;
176         char* service = NULL;
177         const char* _tmp3_;
178         char* nai_out = NULL;
179         char* password_out = NULL;
180         char* server_certificate_hash = NULL;
181         char* ca_certificate = NULL;
182         char* subject_name_constraint = NULL;
183         char* subject_alt_name_constraint = NULL;
184         gboolean result;
185         DBusMessage* reply;
186         const char* _tmp4_;
187         const char* _tmp5_;
188         const char* _tmp6_;
189         const char* _tmp7_;
190         const char* _tmp8_;
191         const char* _tmp9_;
192         dbus_bool_t _tmp10_;
193         error = NULL;
194         if (strcmp (dbus_message_get_signature (message), "sss")) {
195                 return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
196         }
197         dbus_message_iter_init (message, &iter);
198         dbus_message_iter_get_basic (&iter, &_tmp1_);
199         dbus_message_iter_next (&iter);
200         nai = g_strdup (_tmp1_);
201         dbus_message_iter_get_basic (&iter, &_tmp2_);
202         dbus_message_iter_next (&iter);
203         password = g_strdup (_tmp2_);
204         dbus_message_iter_get_basic (&iter, &_tmp3_);
205         dbus_message_iter_next (&iter);
206         service = g_strdup (_tmp3_);
207         result = moonshot_get_identity (self, nai, password, service, &nai_out, &password_out, &server_certificate_hash, &ca_certificate, &subject_name_constraint, &subject_alt_name_constraint, &error);
208         if (error) {
209                 if (error->domain == DBUS_GERROR) {
210                         switch (error->code) {
211                                 case DBUS_GERROR_FAILED:
212                                 reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.Failed", error->message);
213                                 break;
214                                 case DBUS_GERROR_NO_MEMORY:
215                                 reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.NoMemory", error->message);
216                                 break;
217                                 case DBUS_GERROR_SERVICE_UNKNOWN:
218                                 reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.ServiceUnknown", error->message);
219                                 break;
220                                 case DBUS_GERROR_NAME_HAS_NO_OWNER:
221                                 reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.NameHasNoOwner", error->message);
222                                 break;
223                                 case DBUS_GERROR_NO_REPLY:
224                                 reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.NoReply", error->message);
225                                 break;
226                                 case DBUS_GERROR_IO_ERROR:
227                                 reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.IOError", error->message);
228                                 break;
229                                 case DBUS_GERROR_BAD_ADDRESS:
230                                 reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.BadAddress", error->message);
231                                 break;
232                                 case DBUS_GERROR_NOT_SUPPORTED:
233                                 reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.NotSupported", error->message);
234                                 break;
235                                 case DBUS_GERROR_LIMITS_EXCEEDED:
236                                 reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.LimitsExceeded", error->message);
237                                 break;
238                                 case DBUS_GERROR_ACCESS_DENIED:
239                                 reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.AccessDenied", error->message);
240                                 break;
241                                 case DBUS_GERROR_AUTH_FAILED:
242                                 reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.AuthFailed", error->message);
243                                 break;
244                                 case DBUS_GERROR_NO_SERVER:
245                                 reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.NoServer", error->message);
246                                 break;
247                                 case DBUS_GERROR_TIMEOUT:
248                                 reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.Timeout", error->message);
249                                 break;
250                                 case DBUS_GERROR_NO_NETWORK:
251                                 reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.NoNetwork", error->message);
252                                 break;
253                                 case DBUS_GERROR_ADDRESS_IN_USE:
254                                 reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.AddressInUse", error->message);
255                                 break;
256                                 case DBUS_GERROR_DISCONNECTED:
257                                 reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.Disconnected", error->message);
258                                 break;
259                                 case DBUS_GERROR_INVALID_ARGS:
260                                 reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.InvalidArgs", error->message);
261                                 break;
262                                 case DBUS_GERROR_FILE_NOT_FOUND:
263                                 reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.FileNotFound", error->message);
264                                 break;
265                                 case DBUS_GERROR_FILE_EXISTS:
266                                 reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.FileExists", error->message);
267                                 break;
268                                 case DBUS_GERROR_UNKNOWN_METHOD:
269                                 reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.UnknownMethod", error->message);
270                                 break;
271                                 case DBUS_GERROR_TIMED_OUT:
272                                 reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.TimedOut", error->message);
273                                 break;
274                                 case DBUS_GERROR_MATCH_RULE_NOT_FOUND:
275                                 reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.MatchRuleNotFound", error->message);
276                                 break;
277                                 case DBUS_GERROR_MATCH_RULE_INVALID:
278                                 reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.MatchRuleInvalid", error->message);
279                                 break;
280                                 case DBUS_GERROR_SPAWN_EXEC_FAILED:
281                                 reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.Spawn.ExecFailed", error->message);
282                                 break;
283                                 case DBUS_GERROR_SPAWN_FORK_FAILED:
284                                 reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.Spawn.ForkFailed", error->message);
285                                 break;
286                                 case DBUS_GERROR_SPAWN_CHILD_EXITED:
287                                 reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.Spawn.ChildExited", error->message);
288                                 break;
289                                 case DBUS_GERROR_SPAWN_CHILD_SIGNALED:
290                                 reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.Spawn.ChildSignaled", error->message);
291                                 break;
292                                 case DBUS_GERROR_SPAWN_FAILED:
293                                 reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.Spawn.Failed", error->message);
294                                 break;
295                                 case DBUS_GERROR_UNIX_PROCESS_ID_UNKNOWN:
296                                 reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.UnixProcessIdUnknown", error->message);
297                                 break;
298                                 case DBUS_GERROR_INVALID_SIGNATURE:
299                                 reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.InvalidSignature", error->message);
300                                 break;
301                                 case DBUS_GERROR_INVALID_FILE_CONTENT:
302                                 reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.InvalidFileContent", error->message);
303                                 break;
304                                 case DBUS_GERROR_SELINUX_SECURITY_CONTEXT_UNKNOWN:
305                                 reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.SELinuxSecurityContextUnknown", error->message);
306                                 break;
307                                 case DBUS_GERROR_REMOTE_EXCEPTION:
308                                 reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.RemoteException", error->message);
309                                 break;
310                         }
311                 }
312                 dbus_connection_send (connection, reply, NULL);
313                 dbus_message_unref (reply);
314                 return DBUS_HANDLER_RESULT_HANDLED;
315         }
316         reply = dbus_message_new_method_return (message);
317         dbus_message_iter_init_append (reply, &iter);
318         _g_free0 (nai);
319         _g_free0 (password);
320         _g_free0 (service);
321         _tmp4_ = nai_out;
322         dbus_message_iter_append_basic (&iter, DBUS_TYPE_STRING, &_tmp4_);
323         _g_free0 (nai_out);
324         _tmp5_ = password_out;
325         dbus_message_iter_append_basic (&iter, DBUS_TYPE_STRING, &_tmp5_);
326         _g_free0 (password_out);
327         _tmp6_ = server_certificate_hash;
328         dbus_message_iter_append_basic (&iter, DBUS_TYPE_STRING, &_tmp6_);
329         _g_free0 (server_certificate_hash);
330         _tmp7_ = ca_certificate;
331         dbus_message_iter_append_basic (&iter, DBUS_TYPE_STRING, &_tmp7_);
332         _g_free0 (ca_certificate);
333         _tmp8_ = subject_name_constraint;
334         dbus_message_iter_append_basic (&iter, DBUS_TYPE_STRING, &_tmp8_);
335         _g_free0 (subject_name_constraint);
336         _tmp9_ = subject_alt_name_constraint;
337         dbus_message_iter_append_basic (&iter, DBUS_TYPE_STRING, &_tmp9_);
338         _g_free0 (subject_alt_name_constraint);
339         _tmp10_ = result;
340         dbus_message_iter_append_basic (&iter, DBUS_TYPE_BOOLEAN, &_tmp10_);
341         if (reply) {
342                 dbus_connection_send (connection, reply, NULL);
343                 dbus_message_unref (reply);
344                 return DBUS_HANDLER_RESULT_HANDLED;
345         } else {
346                 return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
347         }
348 }
349
350
351 static DBusHandlerResult _dbus_moonshot_get_default_identity (Moonshot* self, DBusConnection* connection, DBusMessage* message) {
352         DBusMessageIter iter;
353         GError* error;
354         char* nai_out = NULL;
355         char* password_out = NULL;
356         gboolean result;
357         DBusMessage* reply;
358         const char* _tmp11_;
359         const char* _tmp12_;
360         dbus_bool_t _tmp13_;
361         error = NULL;
362         if (strcmp (dbus_message_get_signature (message), "")) {
363                 return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
364         }
365         dbus_message_iter_init (message, &iter);
366         result = moonshot_get_default_identity (self, &nai_out, &password_out, &error);
367         if (error) {
368                 if (error->domain == DBUS_GERROR) {
369                         switch (error->code) {
370                                 case DBUS_GERROR_FAILED:
371                                 reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.Failed", error->message);
372                                 break;
373                                 case DBUS_GERROR_NO_MEMORY:
374                                 reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.NoMemory", error->message);
375                                 break;
376                                 case DBUS_GERROR_SERVICE_UNKNOWN:
377                                 reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.ServiceUnknown", error->message);
378                                 break;
379                                 case DBUS_GERROR_NAME_HAS_NO_OWNER:
380                                 reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.NameHasNoOwner", error->message);
381                                 break;
382                                 case DBUS_GERROR_NO_REPLY:
383                                 reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.NoReply", error->message);
384                                 break;
385                                 case DBUS_GERROR_IO_ERROR:
386                                 reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.IOError", error->message);
387                                 break;
388                                 case DBUS_GERROR_BAD_ADDRESS:
389                                 reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.BadAddress", error->message);
390                                 break;
391                                 case DBUS_GERROR_NOT_SUPPORTED:
392                                 reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.NotSupported", error->message);
393                                 break;
394                                 case DBUS_GERROR_LIMITS_EXCEEDED:
395                                 reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.LimitsExceeded", error->message);
396                                 break;
397                                 case DBUS_GERROR_ACCESS_DENIED:
398                                 reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.AccessDenied", error->message);
399                                 break;
400                                 case DBUS_GERROR_AUTH_FAILED:
401                                 reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.AuthFailed", error->message);
402                                 break;
403                                 case DBUS_GERROR_NO_SERVER:
404                                 reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.NoServer", error->message);
405                                 break;
406                                 case DBUS_GERROR_TIMEOUT:
407                                 reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.Timeout", error->message);
408                                 break;
409                                 case DBUS_GERROR_NO_NETWORK:
410                                 reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.NoNetwork", error->message);
411                                 break;
412                                 case DBUS_GERROR_ADDRESS_IN_USE:
413                                 reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.AddressInUse", error->message);
414                                 break;
415                                 case DBUS_GERROR_DISCONNECTED:
416                                 reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.Disconnected", error->message);
417                                 break;
418                                 case DBUS_GERROR_INVALID_ARGS:
419                                 reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.InvalidArgs", error->message);
420                                 break;
421                                 case DBUS_GERROR_FILE_NOT_FOUND:
422                                 reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.FileNotFound", error->message);
423                                 break;
424                                 case DBUS_GERROR_FILE_EXISTS:
425                                 reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.FileExists", error->message);
426                                 break;
427                                 case DBUS_GERROR_UNKNOWN_METHOD:
428                                 reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.UnknownMethod", error->message);
429                                 break;
430                                 case DBUS_GERROR_TIMED_OUT:
431                                 reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.TimedOut", error->message);
432                                 break;
433                                 case DBUS_GERROR_MATCH_RULE_NOT_FOUND:
434                                 reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.MatchRuleNotFound", error->message);
435                                 break;
436                                 case DBUS_GERROR_MATCH_RULE_INVALID:
437                                 reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.MatchRuleInvalid", error->message);
438                                 break;
439                                 case DBUS_GERROR_SPAWN_EXEC_FAILED:
440                                 reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.Spawn.ExecFailed", error->message);
441                                 break;
442                                 case DBUS_GERROR_SPAWN_FORK_FAILED:
443                                 reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.Spawn.ForkFailed", error->message);
444                                 break;
445                                 case DBUS_GERROR_SPAWN_CHILD_EXITED:
446                                 reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.Spawn.ChildExited", error->message);
447                                 break;
448                                 case DBUS_GERROR_SPAWN_CHILD_SIGNALED:
449                                 reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.Spawn.ChildSignaled", error->message);
450                                 break;
451                                 case DBUS_GERROR_SPAWN_FAILED:
452                                 reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.Spawn.Failed", error->message);
453                                 break;
454                                 case DBUS_GERROR_UNIX_PROCESS_ID_UNKNOWN:
455                                 reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.UnixProcessIdUnknown", error->message);
456                                 break;
457                                 case DBUS_GERROR_INVALID_SIGNATURE:
458                                 reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.InvalidSignature", error->message);
459                                 break;
460                                 case DBUS_GERROR_INVALID_FILE_CONTENT:
461                                 reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.InvalidFileContent", error->message);
462                                 break;
463                                 case DBUS_GERROR_SELINUX_SECURITY_CONTEXT_UNKNOWN:
464                                 reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.SELinuxSecurityContextUnknown", error->message);
465                                 break;
466                                 case DBUS_GERROR_REMOTE_EXCEPTION:
467                                 reply = dbus_message_new_error (message, "org.freedesktop.DBus.Error.RemoteException", error->message);
468                                 break;
469                         }
470                 }
471                 dbus_connection_send (connection, reply, NULL);
472                 dbus_message_unref (reply);
473                 return DBUS_HANDLER_RESULT_HANDLED;
474         }
475         reply = dbus_message_new_method_return (message);
476         dbus_message_iter_init_append (reply, &iter);
477         _tmp11_ = nai_out;
478         dbus_message_iter_append_basic (&iter, DBUS_TYPE_STRING, &_tmp11_);
479         _g_free0 (nai_out);
480         _tmp12_ = password_out;
481         dbus_message_iter_append_basic (&iter, DBUS_TYPE_STRING, &_tmp12_);
482         _g_free0 (password_out);
483         _tmp13_ = result;
484         dbus_message_iter_append_basic (&iter, DBUS_TYPE_BOOLEAN, &_tmp13_);
485         if (reply) {
486                 dbus_connection_send (connection, reply, NULL);
487                 dbus_message_unref (reply);
488                 return DBUS_HANDLER_RESULT_HANDLED;
489         } else {
490                 return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
491         }
492 }
493
494
495 DBusHandlerResult moonshot_dbus_message (DBusConnection* connection, DBusMessage* message, void* object) {
496         DBusHandlerResult result;
497         result = DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
498         if (dbus_message_is_method_call (message, "org.freedesktop.DBus.Introspectable", "Introspect")) {
499                 result = _dbus_moonshot_introspect (object, connection, message);
500         } else if (dbus_message_is_method_call (message, "org.freedesktop.DBus.Properties", "GetAll")) {
501                 result = _dbus_moonshot_property_get_all (object, connection, message);
502         } else if (dbus_message_is_method_call (message, "org.janet.Moonshot", "GetIdentity")) {
503                 result = _dbus_moonshot_get_identity (object, connection, message);
504         } else if (dbus_message_is_method_call (message, "org.janet.Moonshot", "GetDefaultIdentity")) {
505                 result = _dbus_moonshot_get_default_identity (object, connection, message);
506         }
507         if (result == DBUS_HANDLER_RESULT_HANDLED) {
508                 return result;
509         } else {
510                 return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
511         }
512 }
513
514
515 void moonshot_dbus_register_object (DBusConnection* connection, const char* path, void* object) {
516         if (!g_object_get_data (object, "dbus_object_path")) {
517                 g_object_set_data (object, "dbus_object_path", g_strdup (path));
518                 dbus_connection_register_object_path (connection, path, &_moonshot_dbus_path_vtable, object);
519                 g_object_weak_ref (object, _vala_dbus_unregister_object, connection);
520         }
521 }
522
523
524 static void moonshot_base_init (MoonshotIface * iface) {
525         static gboolean initialized = FALSE;
526         if (!initialized) {
527                 initialized = TRUE;
528                 g_type_set_qdata (TYPE_MOONSHOT, g_quark_from_static_string ("DBusObjectVTable"), (void*) (&_moonshot_dbus_vtable));
529         }
530 }
531
532
533 GType moonshot_get_type (void) {
534         static volatile gsize moonshot_type_id__volatile = 0;
535         if (g_once_init_enter (&moonshot_type_id__volatile)) {
536                 static const GTypeInfo g_define_type_info = { sizeof (MoonshotIface), (GBaseInitFunc) moonshot_base_init, (GBaseFinalizeFunc) NULL, (GClassInitFunc) NULL, (GClassFinalizeFunc) NULL, NULL, 0, 0, (GInstanceInitFunc) NULL, NULL };
537                 GType moonshot_type_id;
538                 moonshot_type_id = g_type_register_static (G_TYPE_INTERFACE, "Moonshot", &g_define_type_info, 0);
539                 g_type_interface_add_prerequisite (moonshot_type_id, G_TYPE_OBJECT);
540                 g_type_set_qdata (moonshot_type_id, g_quark_from_string ("ValaDBusInterfaceProxyType"), &moonshot_dbus_proxy_get_type);
541                 g_once_init_leave (&moonshot_type_id__volatile, moonshot_type_id);
542         }
543         return moonshot_type_id__volatile;
544 }
545
546
547 G_DEFINE_TYPE_EXTENDED (MoonshotDBusProxy, moonshot_dbus_proxy, DBUS_TYPE_G_PROXY, 0, G_IMPLEMENT_INTERFACE (TYPE_MOONSHOT, moonshot_dbus_proxy_moonshot__interface_init) );
548 Moonshot* moonshot_dbus_proxy_new (DBusGConnection* connection, const char* name, const char* path) {
549         Moonshot* self;
550         self = g_object_new (moonshot_dbus_proxy_get_type (), "connection", connection, "name", name, "path", path, "interface", "org.janet.Moonshot", NULL);
551         return self;
552 }
553
554
555 static GObject* moonshot_dbus_proxy_construct (GType gtype, guint n_properties, GObjectConstructParam* properties) {
556         GObject* self;
557         DBusGConnection *connection;
558         char* path;
559         char* filter;
560         self = G_OBJECT_CLASS (moonshot_dbus_proxy_parent_class)->constructor (gtype, n_properties, properties);
561         g_object_get (self, "connection", &connection, NULL);
562         g_object_get (self, "path", &path, NULL);
563         dbus_connection_add_filter (dbus_g_connection_get_connection (connection), moonshot_dbus_proxy_filter, self, NULL);
564         filter = g_strdup_printf ("type='signal',path='%s',interface='org.janet.Moonshot'", path);
565         dbus_bus_add_match (dbus_g_connection_get_connection (connection), filter, NULL);
566         dbus_g_connection_unref (connection);
567         g_free (path);
568         g_free (filter);
569         return self;
570 }
571
572
573 DBusHandlerResult moonshot_dbus_proxy_filter (DBusConnection* connection, DBusMessage* message, void* user_data) {
574         if (dbus_message_has_path (message, dbus_g_proxy_get_path (user_data))) {
575         }
576         return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
577 }
578
579
580 static void moonshot_dbus_proxy_dispose (GObject* self) {
581         DBusGConnection *connection;
582         if (((MoonshotDBusProxy*) self)->disposed) {
583                 return;
584         }
585         ((MoonshotDBusProxy*) self)->disposed = TRUE;
586         g_object_get (self, "connection", &connection, NULL);
587         dbus_connection_remove_filter (dbus_g_connection_get_connection (connection), moonshot_dbus_proxy_filter, self);
588         G_OBJECT_CLASS (moonshot_dbus_proxy_parent_class)->dispose (self);
589 }
590
591
592 static void moonshot_dbus_proxy_class_init (MoonshotDBusProxyClass* klass) {
593         G_OBJECT_CLASS (klass)->constructor = moonshot_dbus_proxy_construct;
594         G_OBJECT_CLASS (klass)->dispose = moonshot_dbus_proxy_dispose;
595         G_OBJECT_CLASS (klass)->get_property = moonshot_dbus_proxy_get_property;
596         G_OBJECT_CLASS (klass)->set_property = moonshot_dbus_proxy_set_property;
597 }
598
599
600 static void moonshot_dbus_proxy_init (MoonshotDBusProxy* self) {
601 }
602
603
604 static gboolean moonshot_dbus_proxy_get_identity (Moonshot* self, const char* nai, const char* password, const char* service, char** nai_out, char** password_out, char** server_certificate_hash, char** ca_certificate, char** subject_name_constraint, char** subject_alt_name_constraint, GError** error) {
605         DBusError _dbus_error;
606         DBusGConnection *_connection;
607         DBusMessage *_message, *_reply;
608         DBusMessageIter _iter;
609         const char* _tmp0_;
610         const char* _tmp1_;
611         const char* _tmp2_;
612         char* _nai_out;
613         const char* _tmp3_;
614         char* _password_out;
615         const char* _tmp4_;
616         char* _server_certificate_hash;
617         const char* _tmp5_;
618         char* _ca_certificate;
619         const char* _tmp6_;
620         char* _subject_name_constraint;
621         const char* _tmp7_;
622         char* _subject_alt_name_constraint;
623         const char* _tmp8_;
624         gboolean _result;
625         dbus_bool_t _tmp9_;
626         if (((MoonshotDBusProxy*) self)->disposed) {
627                 g_set_error (error, DBUS_GERROR, DBUS_GERROR_DISCONNECTED, "%s", "Connection is closed");
628                 return FALSE;
629         }
630         _message = dbus_message_new_method_call (dbus_g_proxy_get_bus_name ((DBusGProxy*) self), dbus_g_proxy_get_path ((DBusGProxy*) self), "org.janet.Moonshot", "GetIdentity");
631         dbus_message_iter_init_append (_message, &_iter);
632         _tmp0_ = nai;
633         dbus_message_iter_append_basic (&_iter, DBUS_TYPE_STRING, &_tmp0_);
634         _tmp1_ = password;
635         dbus_message_iter_append_basic (&_iter, DBUS_TYPE_STRING, &_tmp1_);
636         _tmp2_ = service;
637         dbus_message_iter_append_basic (&_iter, DBUS_TYPE_STRING, &_tmp2_);
638         g_object_get (self, "connection", &_connection, NULL);
639         dbus_error_init (&_dbus_error);
640         _reply = dbus_connection_send_with_reply_and_block (dbus_g_connection_get_connection (_connection), _message, -1, &_dbus_error);
641         dbus_g_connection_unref (_connection);
642         dbus_message_unref (_message);
643         if (dbus_error_is_set (&_dbus_error)) {
644                 GQuark _edomain = 0;
645                 gint _ecode = 0;
646                 if (strstr (_dbus_error.name, "org.freedesktop.DBus.Error") == _dbus_error.name) {
647                         const char* _tmp10_;
648                         _edomain = DBUS_GERROR;
649                         _tmp10_ = _dbus_error.name + 27;
650                         if (strcmp (_tmp10_, "Failed") == 0) {
651                                 _ecode = DBUS_GERROR_FAILED;
652                         } else if (strcmp (_tmp10_, "NoMemory") == 0) {
653                                 _ecode = DBUS_GERROR_NO_MEMORY;
654                         } else if (strcmp (_tmp10_, "ServiceUnknown") == 0) {
655                                 _ecode = DBUS_GERROR_SERVICE_UNKNOWN;
656                         } else if (strcmp (_tmp10_, "NameHasNoOwner") == 0) {
657                                 _ecode = DBUS_GERROR_NAME_HAS_NO_OWNER;
658                         } else if (strcmp (_tmp10_, "NoReply") == 0) {
659                                 _ecode = DBUS_GERROR_NO_REPLY;
660                         } else if (strcmp (_tmp10_, "IOError") == 0) {
661                                 _ecode = DBUS_GERROR_IO_ERROR;
662                         } else if (strcmp (_tmp10_, "BadAddress") == 0) {
663                                 _ecode = DBUS_GERROR_BAD_ADDRESS;
664                         } else if (strcmp (_tmp10_, "NotSupported") == 0) {
665                                 _ecode = DBUS_GERROR_NOT_SUPPORTED;
666                         } else if (strcmp (_tmp10_, "LimitsExceeded") == 0) {
667                                 _ecode = DBUS_GERROR_LIMITS_EXCEEDED;
668                         } else if (strcmp (_tmp10_, "AccessDenied") == 0) {
669                                 _ecode = DBUS_GERROR_ACCESS_DENIED;
670                         } else if (strcmp (_tmp10_, "AuthFailed") == 0) {
671                                 _ecode = DBUS_GERROR_AUTH_FAILED;
672                         } else if (strcmp (_tmp10_, "NoServer") == 0) {
673                                 _ecode = DBUS_GERROR_NO_SERVER;
674                         } else if (strcmp (_tmp10_, "Timeout") == 0) {
675                                 _ecode = DBUS_GERROR_TIMEOUT;
676                         } else if (strcmp (_tmp10_, "NoNetwork") == 0) {
677                                 _ecode = DBUS_GERROR_NO_NETWORK;
678                         } else if (strcmp (_tmp10_, "AddressInUse") == 0) {
679                                 _ecode = DBUS_GERROR_ADDRESS_IN_USE;
680                         } else if (strcmp (_tmp10_, "Disconnected") == 0) {
681                                 _ecode = DBUS_GERROR_DISCONNECTED;
682                         } else if (strcmp (_tmp10_, "InvalidArgs") == 0) {
683                                 _ecode = DBUS_GERROR_INVALID_ARGS;
684                         } else if (strcmp (_tmp10_, "FileNotFound") == 0) {
685                                 _ecode = DBUS_GERROR_FILE_NOT_FOUND;
686                         } else if (strcmp (_tmp10_, "FileExists") == 0) {
687                                 _ecode = DBUS_GERROR_FILE_EXISTS;
688                         } else if (strcmp (_tmp10_, "UnknownMethod") == 0) {
689                                 _ecode = DBUS_GERROR_UNKNOWN_METHOD;
690                         } else if (strcmp (_tmp10_, "TimedOut") == 0) {
691                                 _ecode = DBUS_GERROR_TIMED_OUT;
692                         } else if (strcmp (_tmp10_, "MatchRuleNotFound") == 0) {
693                                 _ecode = DBUS_GERROR_MATCH_RULE_NOT_FOUND;
694                         } else if (strcmp (_tmp10_, "MatchRuleInvalid") == 0) {
695                                 _ecode = DBUS_GERROR_MATCH_RULE_INVALID;
696                         } else if (strcmp (_tmp10_, "Spawn.ExecFailed") == 0) {
697                                 _ecode = DBUS_GERROR_SPAWN_EXEC_FAILED;
698                         } else if (strcmp (_tmp10_, "Spawn.ForkFailed") == 0) {
699                                 _ecode = DBUS_GERROR_SPAWN_FORK_FAILED;
700                         } else if (strcmp (_tmp10_, "Spawn.ChildExited") == 0) {
701                                 _ecode = DBUS_GERROR_SPAWN_CHILD_EXITED;
702                         } else if (strcmp (_tmp10_, "Spawn.ChildSignaled") == 0) {
703                                 _ecode = DBUS_GERROR_SPAWN_CHILD_SIGNALED;
704                         } else if (strcmp (_tmp10_, "Spawn.Failed") == 0) {
705                                 _ecode = DBUS_GERROR_SPAWN_FAILED;
706                         } else if (strcmp (_tmp10_, "UnixProcessIdUnknown") == 0) {
707                                 _ecode = DBUS_GERROR_UNIX_PROCESS_ID_UNKNOWN;
708                         } else if (strcmp (_tmp10_, "InvalidSignature") == 0) {
709                                 _ecode = DBUS_GERROR_INVALID_SIGNATURE;
710                         } else if (strcmp (_tmp10_, "InvalidFileContent") == 0) {
711                                 _ecode = DBUS_GERROR_INVALID_FILE_CONTENT;
712                         } else if (strcmp (_tmp10_, "SELinuxSecurityContextUnknown") == 0) {
713                                 _ecode = DBUS_GERROR_SELINUX_SECURITY_CONTEXT_UNKNOWN;
714                         } else if (strcmp (_tmp10_, "RemoteException") == 0) {
715                                 _ecode = DBUS_GERROR_REMOTE_EXCEPTION;
716                         }
717                 }
718                 g_set_error (error, _edomain, _ecode, "%s", _dbus_error.message);
719                 dbus_error_free (&_dbus_error);
720                 return FALSE;
721         }
722         if (strcmp (dbus_message_get_signature (_reply), "ssssssb")) {
723                 g_set_error (error, DBUS_GERROR, DBUS_GERROR_INVALID_SIGNATURE, "Invalid signature, expected \"%s\", got \"%s\"", "ssssssb", dbus_message_get_signature (_reply));
724                 dbus_message_unref (_reply);
725                 return FALSE;
726         }
727         dbus_message_iter_init (_reply, &_iter);
728         dbus_message_iter_get_basic (&_iter, &_tmp3_);
729         dbus_message_iter_next (&_iter);
730         _nai_out = g_strdup (_tmp3_);
731         *nai_out = _nai_out;
732         dbus_message_iter_get_basic (&_iter, &_tmp4_);
733         dbus_message_iter_next (&_iter);
734         _password_out = g_strdup (_tmp4_);
735         *password_out = _password_out;
736         dbus_message_iter_get_basic (&_iter, &_tmp5_);
737         dbus_message_iter_next (&_iter);
738         _server_certificate_hash = g_strdup (_tmp5_);
739         *server_certificate_hash = _server_certificate_hash;
740         dbus_message_iter_get_basic (&_iter, &_tmp6_);
741         dbus_message_iter_next (&_iter);
742         _ca_certificate = g_strdup (_tmp6_);
743         *ca_certificate = _ca_certificate;
744         dbus_message_iter_get_basic (&_iter, &_tmp7_);
745         dbus_message_iter_next (&_iter);
746         _subject_name_constraint = g_strdup (_tmp7_);
747         *subject_name_constraint = _subject_name_constraint;
748         dbus_message_iter_get_basic (&_iter, &_tmp8_);
749         dbus_message_iter_next (&_iter);
750         _subject_alt_name_constraint = g_strdup (_tmp8_);
751         *subject_alt_name_constraint = _subject_alt_name_constraint;
752         dbus_message_iter_get_basic (&_iter, &_tmp9_);
753         dbus_message_iter_next (&_iter);
754         _result = _tmp9_;
755         dbus_message_unref (_reply);
756         return _result;
757 }
758
759
760 static gboolean moonshot_dbus_proxy_get_default_identity (Moonshot* self, char** nai_out, char** password_out, GError** error) {
761         DBusError _dbus_error;
762         DBusGConnection *_connection;
763         DBusMessage *_message, *_reply;
764         DBusMessageIter _iter;
765         char* _nai_out;
766         const char* _tmp11_;
767         char* _password_out;
768         const char* _tmp12_;
769         gboolean _result;
770         dbus_bool_t _tmp13_;
771         if (((MoonshotDBusProxy*) self)->disposed) {
772                 g_set_error (error, DBUS_GERROR, DBUS_GERROR_DISCONNECTED, "%s", "Connection is closed");
773                 return FALSE;
774         }
775         _message = dbus_message_new_method_call (dbus_g_proxy_get_bus_name ((DBusGProxy*) self), dbus_g_proxy_get_path ((DBusGProxy*) self), "org.janet.Moonshot", "GetDefaultIdentity");
776         dbus_message_iter_init_append (_message, &_iter);
777         g_object_get (self, "connection", &_connection, NULL);
778         dbus_error_init (&_dbus_error);
779         _reply = dbus_connection_send_with_reply_and_block (dbus_g_connection_get_connection (_connection), _message, -1, &_dbus_error);
780         dbus_g_connection_unref (_connection);
781         dbus_message_unref (_message);
782         if (dbus_error_is_set (&_dbus_error)) {
783                 GQuark _edomain = 0;
784                 gint _ecode = 0;
785                 if (strstr (_dbus_error.name, "org.freedesktop.DBus.Error") == _dbus_error.name) {
786                         const char* _tmp14_;
787                         _edomain = DBUS_GERROR;
788                         _tmp14_ = _dbus_error.name + 27;
789                         if (strcmp (_tmp14_, "Failed") == 0) {
790                                 _ecode = DBUS_GERROR_FAILED;
791                         } else if (strcmp (_tmp14_, "NoMemory") == 0) {
792                                 _ecode = DBUS_GERROR_NO_MEMORY;
793                         } else if (strcmp (_tmp14_, "ServiceUnknown") == 0) {
794                                 _ecode = DBUS_GERROR_SERVICE_UNKNOWN;
795                         } else if (strcmp (_tmp14_, "NameHasNoOwner") == 0) {
796                                 _ecode = DBUS_GERROR_NAME_HAS_NO_OWNER;
797                         } else if (strcmp (_tmp14_, "NoReply") == 0) {
798                                 _ecode = DBUS_GERROR_NO_REPLY;
799                         } else if (strcmp (_tmp14_, "IOError") == 0) {
800                                 _ecode = DBUS_GERROR_IO_ERROR;
801                         } else if (strcmp (_tmp14_, "BadAddress") == 0) {
802                                 _ecode = DBUS_GERROR_BAD_ADDRESS;
803                         } else if (strcmp (_tmp14_, "NotSupported") == 0) {
804                                 _ecode = DBUS_GERROR_NOT_SUPPORTED;
805                         } else if (strcmp (_tmp14_, "LimitsExceeded") == 0) {
806                                 _ecode = DBUS_GERROR_LIMITS_EXCEEDED;
807                         } else if (strcmp (_tmp14_, "AccessDenied") == 0) {
808                                 _ecode = DBUS_GERROR_ACCESS_DENIED;
809                         } else if (strcmp (_tmp14_, "AuthFailed") == 0) {
810                                 _ecode = DBUS_GERROR_AUTH_FAILED;
811                         } else if (strcmp (_tmp14_, "NoServer") == 0) {
812                                 _ecode = DBUS_GERROR_NO_SERVER;
813                         } else if (strcmp (_tmp14_, "Timeout") == 0) {
814                                 _ecode = DBUS_GERROR_TIMEOUT;
815                         } else if (strcmp (_tmp14_, "NoNetwork") == 0) {
816                                 _ecode = DBUS_GERROR_NO_NETWORK;
817                         } else if (strcmp (_tmp14_, "AddressInUse") == 0) {
818                                 _ecode = DBUS_GERROR_ADDRESS_IN_USE;
819                         } else if (strcmp (_tmp14_, "Disconnected") == 0) {
820                                 _ecode = DBUS_GERROR_DISCONNECTED;
821                         } else if (strcmp (_tmp14_, "InvalidArgs") == 0) {
822                                 _ecode = DBUS_GERROR_INVALID_ARGS;
823                         } else if (strcmp (_tmp14_, "FileNotFound") == 0) {
824                                 _ecode = DBUS_GERROR_FILE_NOT_FOUND;
825                         } else if (strcmp (_tmp14_, "FileExists") == 0) {
826                                 _ecode = DBUS_GERROR_FILE_EXISTS;
827                         } else if (strcmp (_tmp14_, "UnknownMethod") == 0) {
828                                 _ecode = DBUS_GERROR_UNKNOWN_METHOD;
829                         } else if (strcmp (_tmp14_, "TimedOut") == 0) {
830                                 _ecode = DBUS_GERROR_TIMED_OUT;
831                         } else if (strcmp (_tmp14_, "MatchRuleNotFound") == 0) {
832                                 _ecode = DBUS_GERROR_MATCH_RULE_NOT_FOUND;
833                         } else if (strcmp (_tmp14_, "MatchRuleInvalid") == 0) {
834                                 _ecode = DBUS_GERROR_MATCH_RULE_INVALID;
835                         } else if (strcmp (_tmp14_, "Spawn.ExecFailed") == 0) {
836                                 _ecode = DBUS_GERROR_SPAWN_EXEC_FAILED;
837                         } else if (strcmp (_tmp14_, "Spawn.ForkFailed") == 0) {
838                                 _ecode = DBUS_GERROR_SPAWN_FORK_FAILED;
839                         } else if (strcmp (_tmp14_, "Spawn.ChildExited") == 0) {
840                                 _ecode = DBUS_GERROR_SPAWN_CHILD_EXITED;
841                         } else if (strcmp (_tmp14_, "Spawn.ChildSignaled") == 0) {
842                                 _ecode = DBUS_GERROR_SPAWN_CHILD_SIGNALED;
843                         } else if (strcmp (_tmp14_, "Spawn.Failed") == 0) {
844                                 _ecode = DBUS_GERROR_SPAWN_FAILED;
845                         } else if (strcmp (_tmp14_, "UnixProcessIdUnknown") == 0) {
846                                 _ecode = DBUS_GERROR_UNIX_PROCESS_ID_UNKNOWN;
847                         } else if (strcmp (_tmp14_, "InvalidSignature") == 0) {
848                                 _ecode = DBUS_GERROR_INVALID_SIGNATURE;
849                         } else if (strcmp (_tmp14_, "InvalidFileContent") == 0) {
850                                 _ecode = DBUS_GERROR_INVALID_FILE_CONTENT;
851                         } else if (strcmp (_tmp14_, "SELinuxSecurityContextUnknown") == 0) {
852                                 _ecode = DBUS_GERROR_SELINUX_SECURITY_CONTEXT_UNKNOWN;
853                         } else if (strcmp (_tmp14_, "RemoteException") == 0) {
854                                 _ecode = DBUS_GERROR_REMOTE_EXCEPTION;
855                         }
856                 }
857                 g_set_error (error, _edomain, _ecode, "%s", _dbus_error.message);
858                 dbus_error_free (&_dbus_error);
859                 return FALSE;
860         }
861         if (strcmp (dbus_message_get_signature (_reply), "ssb")) {
862                 g_set_error (error, DBUS_GERROR, DBUS_GERROR_INVALID_SIGNATURE, "Invalid signature, expected \"%s\", got \"%s\"", "ssb", dbus_message_get_signature (_reply));
863                 dbus_message_unref (_reply);
864                 return FALSE;
865         }
866         dbus_message_iter_init (_reply, &_iter);
867         dbus_message_iter_get_basic (&_iter, &_tmp11_);
868         dbus_message_iter_next (&_iter);
869         _nai_out = g_strdup (_tmp11_);
870         *nai_out = _nai_out;
871         dbus_message_iter_get_basic (&_iter, &_tmp12_);
872         dbus_message_iter_next (&_iter);
873         _password_out = g_strdup (_tmp12_);
874         *password_out = _password_out;
875         dbus_message_iter_get_basic (&_iter, &_tmp13_);
876         dbus_message_iter_next (&_iter);
877         _result = _tmp13_;
878         dbus_message_unref (_reply);
879         return _result;
880 }
881
882
883 static void moonshot_dbus_proxy_moonshot__interface_init (MoonshotIface* iface) {
884         iface->get_identity = moonshot_dbus_proxy_get_identity;
885         iface->get_default_identity = moonshot_dbus_proxy_get_default_identity;
886 }
887
888
889 static void moonshot_dbus_proxy_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
890 }
891
892
893 static void moonshot_dbus_proxy_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) {
894 }
895
896
897 void _vala_main (void) {
898         GError * _inner_error_ = NULL;
899         {
900                 char* nai_out;
901                 char* password_out;
902                 char* certificate_out;
903                 char* a;
904                 char* b;
905                 char* c;
906                 DBusGConnection* conn;
907                 Moonshot* demo;
908                 char* _tmp0_ = NULL;
909                 gboolean _tmp1_;
910                 char* _tmp2_;
911                 char* _tmp3_ = NULL;
912                 gboolean _tmp4_;
913                 char* _tmp5_;
914                 gboolean _tmp6_;
915                 char* _tmp7_ = NULL;
916                 gboolean _tmp8_;
917                 char* _tmp9_;
918                 char* _tmp10_ = NULL;
919                 gboolean _tmp11_;
920                 char* _tmp12_;
921                 char* _tmp13_ = NULL;
922                 gboolean _tmp14_;
923                 char* _tmp15_;
924                 char* _tmp16_ = NULL;
925                 gboolean _tmp17_;
926                 char* _tmp18_;
927                 char* _tmp19_ = NULL;
928                 gboolean _tmp20_;
929                 char* _tmp21_;
930                 char* _tmp22_ = NULL;
931                 gboolean _tmp23_;
932                 char* _tmp24_;
933                 gboolean _tmp25_;
934                 nai_out = NULL;
935                 password_out = NULL;
936                 certificate_out = NULL;
937                 a = NULL;
938                 b = NULL;
939                 c = NULL;
940                 conn = dbus_g_bus_get (DBUS_BUS_SESSION, &_inner_error_);
941                 if (_inner_error_ != NULL) {
942                         _g_free0 (c);
943                         _g_free0 (b);
944                         _g_free0 (a);
945                         _g_free0 (certificate_out);
946                         _g_free0 (password_out);
947                         _g_free0 (nai_out);
948                         if (_inner_error_->domain == DBUS_GERROR) {
949                                 goto __catch0_dbus_gerror;
950                         }
951                         _g_free0 (c);
952                         _g_free0 (b);
953                         _g_free0 (a);
954                         _g_free0 (certificate_out);
955                         _g_free0 (password_out);
956                         _g_free0 (nai_out);
957                         g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
958                         g_clear_error (&_inner_error_);
959                         return;
960                 }
961                 demo = moonshot_dbus_proxy_new (conn, "org.janet.Moonshot", "/org/janet/moonshot");
962                 _tmp6_ = (_tmp4_ = (_tmp1_ = moonshot_get_default_identity (demo, &_tmp0_, &_tmp3_, &_inner_error_), nai_out = (_tmp2_ = _tmp0_, _g_free0 (nai_out), _tmp2_), _tmp1_), password_out = (_tmp5_ = _tmp3_, _g_free0 (password_out), _tmp5_), _tmp4_);
963                 if (_inner_error_ != NULL) {
964                         _g_object_unref0 (demo);
965                         _dbus_g_connection_unref0 (conn);
966                         _g_free0 (c);
967                         _g_free0 (b);
968                         _g_free0 (a);
969                         _g_free0 (certificate_out);
970                         _g_free0 (password_out);
971                         _g_free0 (nai_out);
972                         if (_inner_error_->domain == DBUS_GERROR) {
973                                 goto __catch0_dbus_gerror;
974                         }
975                         _g_object_unref0 (demo);
976                         _dbus_g_connection_unref0 (conn);
977                         _g_free0 (c);
978                         _g_free0 (b);
979                         _g_free0 (a);
980                         _g_free0 (certificate_out);
981                         _g_free0 (password_out);
982                         _g_free0 (nai_out);
983                         g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
984                         g_clear_error (&_inner_error_);
985                         return;
986                 }
987                 if (_tmp6_) {
988                         fprintf (stdout, "default identity: %s %s\n", nai_out, password_out);
989                 } else {
990                         fprintf (stdout, "Unable to get default identity.\n");
991                 }
992                 _tmp25_ = (_tmp23_ = (_tmp20_ = (_tmp17_ = (_tmp14_ = (_tmp11_ = (_tmp8_ = moonshot_get_identity (demo, "username@issuer", "pass", "", &_tmp7_, &_tmp10_, &_tmp13_, &_tmp16_, &_tmp19_, &_tmp22_, &_inner_error_), nai_out = (_tmp9_ = _tmp7_, _g_free0 (nai_out), _tmp9_), _tmp8_), password_out = (_tmp12_ = _tmp10_, _g_free0 (password_out), _tmp12_), _tmp11_), certificate_out = (_tmp15_ = _tmp13_, _g_free0 (certificate_out), _tmp15_), _tmp14_), a = (_tmp18_ = _tmp16_, _g_free0 (a), _tmp18_), _tmp17_), b = (_tmp21_ = _tmp19_, _g_free0 (b), _tmp21_), _tmp20_), c = (_tmp24_ = _tmp22_, _g_free0 (c), _tmp24_), _tmp23_);
993                 if (_inner_error_ != NULL) {
994                         _g_object_unref0 (demo);
995                         _dbus_g_connection_unref0 (conn);
996                         _g_free0 (c);
997                         _g_free0 (b);
998                         _g_free0 (a);
999                         _g_free0 (certificate_out);
1000                         _g_free0 (password_out);
1001                         _g_free0 (nai_out);
1002                         if (_inner_error_->domain == DBUS_GERROR) {
1003                                 goto __catch0_dbus_gerror;
1004                         }
1005                         _g_object_unref0 (demo);
1006                         _dbus_g_connection_unref0 (conn);
1007                         _g_free0 (c);
1008                         _g_free0 (b);
1009                         _g_free0 (a);
1010                         _g_free0 (certificate_out);
1011                         _g_free0 (password_out);
1012                         _g_free0 (nai_out);
1013                         g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
1014                         g_clear_error (&_inner_error_);
1015                         return;
1016                 }
1017                 if (_tmp25_) {
1018                         fprintf (stdout, "%s %s %s\n", nai_out, password_out, certificate_out);
1019                 } else {
1020                         fprintf (stdout, "The nai, password or service doesnt match the selected id_card\n");
1021                 }
1022                 _g_object_unref0 (demo);
1023                 _dbus_g_connection_unref0 (conn);
1024                 _g_free0 (c);
1025                 _g_free0 (b);
1026                 _g_free0 (a);
1027                 _g_free0 (certificate_out);
1028                 _g_free0 (password_out);
1029                 _g_free0 (nai_out);
1030         }
1031         goto __finally0;
1032         __catch0_dbus_gerror:
1033         {
1034                 GError * e;
1035                 e = _inner_error_;
1036                 _inner_error_ = NULL;
1037                 {
1038                         fprintf (stderr, "%s\n", e->message);
1039                         _g_error_free0 (e);
1040                 }
1041         }
1042         __finally0:
1043         if (_inner_error_ != NULL) {
1044                 g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
1045                 g_clear_error (&_inner_error_);
1046                 return;
1047         }
1048 }
1049
1050
1051 int main (int argc, char ** argv) {
1052         g_type_init ();
1053         _vala_main ();
1054         return 0;
1055 }
1056
1057
1058
1059