/* dbus_filedescriptor_client.c generated by valac, the Vala compiler * generated from dbus_filedescriptor_client.vala, do not modify */ #include #include #include #include #include #include #include #if !defined(VALA_EXTERN) #if defined(_WIN32) || defined(__CYGWIN__) #define VALA_EXTERN __declspec(dllexport) extern #elif __GNUC__ >= 4 #define VALA_EXTERN __attribute__((visibility("default"))) extern #else #define VALA_EXTERN extern #endif #endif #define TYPE_TEST (test_get_type ()) #define TEST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TEST, Test)) #define IS_TEST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TEST)) #define TEST_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TYPE_TEST, TestIface)) typedef struct _Test Test; typedef struct _TestIface TestIface; #define TYPE_TEST_PROXY (test_proxy_get_type ()) typedef GDBusProxy TestProxy; typedef GDBusProxyClass TestProxyClass; #define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL))) #define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg); #define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return; } #define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return val; } #define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg); struct _TestIface { GTypeInterface parent_iface; GUnixInputStream* (*test_in) (Test* self, GUnixInputStream* i, GUnixInputStream** j, GError** error); }; VALA_EXTERN GType test_proxy_get_type (void) G_GNUC_CONST ; VALA_EXTERN guint test_register_object (void* object, GDBusConnection* connection, const gchar* path, GError** error); VALA_EXTERN GType test_get_type (void) G_GNUC_CONST ; G_DEFINE_AUTOPTR_CLEANUP_FUNC (Test, g_object_unref) VALA_EXTERN GUnixInputStream* test_test_in (Test* self, GUnixInputStream* i, GUnixInputStream** j, GError** error); static GType test_get_type_once (void); static void test_proxy_g_signal (GDBusProxy* proxy, const gchar* sender_name, const gchar* signal_name, GVariant* parameters); static GUnixInputStream* test_proxy_test_in (Test* self, GUnixInputStream* i, GUnixInputStream** j, GError** error); static void test_proxy_test_interface_init (TestIface* iface); static void _dbus_test_test_in (Test* self, GVariant* _parameters_, GDBusMethodInvocation* invocation); static void test_dbus_interface_method_call (GDBusConnection* connection, const gchar* sender, const gchar* object_path, const gchar* interface_name, const gchar* method_name, GVariant* parameters, GDBusMethodInvocation* invocation, gpointer user_data); static GVariant* test_dbus_interface_get_property (GDBusConnection* connection, const gchar* sender, const gchar* object_path, const gchar* interface_name, const gchar* property_name, GError** error, gpointer user_data); static gboolean test_dbus_interface_set_property (GDBusConnection* connection, const gchar* sender, const gchar* object_path, const gchar* interface_name, const gchar* property_name, GVariant* value, GError** error, gpointer user_data); static void _test_unregister_object (gpointer user_data); static void _vala_main (void); static const GDBusArgInfo _test_dbus_arg_info_test_in_i = {-1, "i", "h", NULL}; static const GDBusArgInfo _test_dbus_arg_info_test_in_j = {-1, "j", "h", NULL}; static const GDBusArgInfo _test_dbus_arg_info_test_in_result = {-1, "result", "h", NULL}; static const GDBusArgInfo * const _test_dbus_arg_info_test_in_in[] = {&_test_dbus_arg_info_test_in_i, NULL}; static const GDBusArgInfo * const _test_dbus_arg_info_test_in_out[] = {&_test_dbus_arg_info_test_in_j, &_test_dbus_arg_info_test_in_result, NULL}; static const GDBusMethodInfo _test_dbus_method_info_test_in = {-1, "TestIn", (GDBusArgInfo **) (&_test_dbus_arg_info_test_in_in), (GDBusArgInfo **) (&_test_dbus_arg_info_test_in_out), NULL}; static const GDBusMethodInfo * const _test_dbus_method_info[] = {&_test_dbus_method_info_test_in, NULL}; static const GDBusSignalInfo * const _test_dbus_signal_info[] = {NULL}; static const GDBusPropertyInfo * const _test_dbus_property_info[] = {NULL}; static const GDBusInterfaceInfo _test_dbus_interface_info = {-1, "org.example.Test", (GDBusMethodInfo **) (&_test_dbus_method_info), (GDBusSignalInfo **) (&_test_dbus_signal_info), (GDBusPropertyInfo **) (&_test_dbus_property_info), NULL}; static const GDBusInterfaceVTable _test_dbus_interface_vtable = {test_dbus_interface_method_call, test_dbus_interface_get_property, test_dbus_interface_set_property}; GUnixInputStream* test_test_in (Test* self, GUnixInputStream* i, GUnixInputStream** j, GError** error) { TestIface* _iface_; g_return_val_if_fail (IS_TEST (self), NULL); _iface_ = TEST_GET_INTERFACE (self); if (_iface_->test_in) { return _iface_->test_in (self, i, j, error); } return NULL; } static void test_default_init (TestIface * iface, gpointer iface_data) { } static GType test_get_type_once (void) { static const GTypeInfo g_define_type_info = { sizeof (TestIface), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) test_default_init, (GClassFinalizeFunc) NULL, NULL, 0, 0, (GInstanceInitFunc) NULL, NULL }; GType test_type_id; test_type_id = g_type_register_static (G_TYPE_INTERFACE, "Test", &g_define_type_info, 0); g_type_interface_add_prerequisite (test_type_id, G_TYPE_OBJECT); g_type_set_qdata (test_type_id, g_quark_from_static_string ("vala-dbus-proxy-type"), (void*) test_proxy_get_type); g_type_set_qdata (test_type_id, g_quark_from_static_string ("vala-dbus-interface-name"), "org.example.Test"); g_type_set_qdata (test_type_id, g_quark_from_static_string ("vala-dbus-interface-info"), (void*) (&_test_dbus_interface_info)); g_type_set_qdata (test_type_id, g_quark_from_static_string ("vala-dbus-register-object"), (void*) test_register_object); return test_type_id; } GType test_get_type (void) { static volatile gsize test_type_id__once = 0; if (g_once_init_enter (&test_type_id__once)) { GType test_type_id; test_type_id = test_get_type_once (); g_once_init_leave (&test_type_id__once, test_type_id); } return test_type_id__once; } G_DEFINE_TYPE_EXTENDED (TestProxy, test_proxy, G_TYPE_DBUS_PROXY, 0, G_IMPLEMENT_INTERFACE (TYPE_TEST, test_proxy_test_interface_init) ) static void test_proxy_class_init (TestProxyClass* klass) { G_DBUS_PROXY_CLASS (klass)->g_signal = test_proxy_g_signal; } static void test_proxy_g_signal (GDBusProxy* proxy, const gchar* sender_name, const gchar* signal_name, GVariant* parameters) { } static void test_proxy_init (TestProxy* self) { g_dbus_proxy_set_interface_info (G_DBUS_PROXY (self), (GDBusInterfaceInfo *) (&_test_dbus_interface_info)); } static GUnixInputStream* test_proxy_test_in (Test* self, GUnixInputStream* i, GUnixInputStream** j, GError** error) { GUnixFDList* _fd_list; GDBusMessage *_message; GVariant *_arguments; GVariantBuilder _arguments_builder; GDBusMessage *_reply_message; gint _fd_index = 0; gint _fd; GVariant *_reply; GVariantIter _reply_iter; GUnixInputStream* _vala_j = NULL; GUnixInputStream* _result = NULL; G_IO_ERROR; _message = g_dbus_message_new_method_call (g_dbus_proxy_get_name ((GDBusProxy *) self), g_dbus_proxy_get_object_path ((GDBusProxy *) self), "org.example.Test", "TestIn"); g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE); _fd_list = g_unix_fd_list_new (); g_variant_builder_add (&_arguments_builder, "h", g_unix_fd_list_append (_fd_list, g_unix_input_stream_get_fd (i), NULL)); _arguments = g_variant_builder_end (&_arguments_builder); g_dbus_message_set_body (_message, _arguments); g_dbus_message_set_unix_fd_list (_message, _fd_list); g_object_unref (_fd_list); _reply_message = g_dbus_connection_send_message_with_reply_sync (g_dbus_proxy_get_connection ((GDBusProxy *) self), _message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, g_dbus_proxy_get_default_timeout ((GDBusProxy *) self), NULL, NULL, error); g_object_unref (_message); if (!_reply_message) { return NULL; } if (g_dbus_message_to_gerror (_reply_message, error)) { g_object_unref (_reply_message); return NULL; } _reply = g_dbus_message_get_body (_reply_message); g_variant_iter_init (&_reply_iter, _reply); _fd_list = g_dbus_message_get_unix_fd_list (_reply_message); if (_fd_list) { g_variant_iter_next (&_reply_iter, "h", &_fd_index); _fd = g_unix_fd_list_get (_fd_list, _fd_index, error); if (_fd >= 0) { _vala_j = (GUnixInputStream *) g_unix_input_stream_new (_fd, TRUE); } } else { g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_FAILED, "FD List is NULL"); } *j = _vala_j; if (error && (*error)) { g_object_unref (_reply_message); return NULL; } _fd_list = g_dbus_message_get_unix_fd_list (_reply_message); if (_fd_list) { g_variant_iter_next (&_reply_iter, "h", &_fd_index); _fd = g_unix_fd_list_get (_fd_list, _fd_index, error); if (_fd >= 0) { _result = (GUnixInputStream *) g_unix_input_stream_new (_fd, TRUE); } } else { g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_FAILED, "FD List is NULL"); } if (error && (*error)) { g_object_unref (_reply_message); return NULL; } g_object_unref (_reply_message); return _result; } static void test_proxy_test_interface_init (TestIface* iface) { iface->test_in = test_proxy_test_in; } static void _dbus_test_test_in (Test* self, GVariant* _parameters_, GDBusMethodInvocation* invocation) { GUnixFDList* _fd_list; GError* error = NULL; GVariantIter _arguments_iter; gint _fd_index = 0; gint _fd; GUnixInputStream* i = NULL; GDBusMessage* _reply_message = NULL; GVariant* _reply; GVariantBuilder _reply_builder; GUnixInputStream* j = NULL; GUnixInputStream* result; g_variant_iter_init (&_arguments_iter, _parameters_); _fd_list = g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)); if (_fd_list) { g_variant_iter_next (&_arguments_iter, "h", &_fd_index); _fd = g_unix_fd_list_get (_fd_list, _fd_index, &error); if (_fd >= 0) { i = (GUnixInputStream *) g_unix_input_stream_new (_fd, TRUE); } } else { g_set_error_literal (&error, G_IO_ERROR, G_IO_ERROR_FAILED, "FD List is NULL"); } if (error) { g_dbus_method_invocation_take_error (invocation, error); goto _error; } result = test_test_in (self, i, &j, &error); if (error) { g_dbus_method_invocation_take_error (invocation, error); goto _error; } _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation)); g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE); _fd_list = g_unix_fd_list_new (); g_variant_builder_add (&_reply_builder, "h", g_unix_fd_list_append (_fd_list, g_unix_input_stream_get_fd (j), NULL)); g_variant_builder_add (&_reply_builder, "h", g_unix_fd_list_append (_fd_list, g_unix_input_stream_get_fd (result), NULL)); _g_object_unref0 (result); _reply = g_variant_builder_end (&_reply_builder); g_dbus_message_set_body (_reply_message, _reply); g_dbus_message_set_unix_fd_list (_reply_message, _fd_list); g_object_unref (_fd_list); g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL); g_object_unref (invocation); g_object_unref (_reply_message); _error: _g_object_unref0 (i); _g_object_unref0 (j); ; } static void test_dbus_interface_method_call (GDBusConnection* connection, const gchar* sender, const gchar* object_path, const gchar* interface_name, const gchar* method_name, GVariant* parameters, GDBusMethodInvocation* invocation, gpointer user_data) { gpointer* data; gpointer object; data = user_data; object = data[0]; if (strcmp (method_name, "TestIn") == 0) { _dbus_test_test_in (object, parameters, invocation); } else { g_object_unref (invocation); } } static GVariant* test_dbus_interface_get_property (GDBusConnection* connection, const gchar* sender, const gchar* object_path, const gchar* interface_name, const gchar* property_name, GError** error, gpointer user_data) { gpointer* data; gpointer object; data = user_data; object = data[0]; return NULL; } static gboolean test_dbus_interface_set_property (GDBusConnection* connection, const gchar* sender, const gchar* object_path, const gchar* interface_name, const gchar* property_name, GVariant* value, GError** error, gpointer user_data) { gpointer* data; gpointer object; data = user_data; object = data[0]; return FALSE; } guint test_register_object (gpointer object, GDBusConnection* connection, const gchar* path, GError** error) { guint result; gpointer *data; data = g_new (gpointer, 3); data[0] = g_object_ref (object); data[1] = g_object_ref (connection); data[2] = g_strdup (path); result = g_dbus_connection_register_object (connection, path, (GDBusInterfaceInfo *) (&_test_dbus_interface_info), &_test_dbus_interface_vtable, data, _test_unregister_object, error); if (!result) { return 0; } return result; } static void _test_unregister_object (gpointer user_data) { gpointer* data; data = user_data; g_object_unref (data[0]); g_object_unref (data[1]); g_free (data[2]); g_free (data); } static void _vala_main (void) { Test* test = NULL; Test* _tmp0_; guint8* buffer = NULL; guint8* _tmp1_; gint buffer_length1; gint _buffer_size_; gint* pipe1 = NULL; gint* _tmp2_; gint pipe1_length1; gint _pipe1_size_; gint* _tmp3_; gint _tmp3__length1; guint8* _tmp4_; gint _tmp4__length1; gint* _tmp5_; gint _tmp5__length1; gint _tmp6_; guint8* _tmp7_; gint _tmp7__length1; gint* _tmp8_; gint _tmp8__length1; gint _tmp9_; GUnixInputStream* j = NULL; GUnixInputStream* k = NULL; GUnixInputStream* _tmp10_ = NULL; Test* _tmp11_; gint* _tmp12_; gint _tmp12__length1; gint _tmp13_; GUnixInputStream* _tmp14_; GUnixInputStream* _tmp15_; GUnixInputStream* _tmp16_ = NULL; GUnixInputStream* _tmp17_; GUnixInputStream* _tmp18_; GUnixInputStream* _tmp19_; gssize _tmp20_ = 0L; GUnixInputStream* _tmp21_; guint8* _tmp22_; gint _tmp22__length1; guint8* _tmp23_; gint _tmp23__length1; guint8 _tmp24_; gssize _tmp25_ = 0L; GUnixInputStream* _tmp26_; guint8* _tmp27_; gint _tmp27__length1; guint8* _tmp28_; gint _tmp28__length1; guint8 _tmp29_; GError* _inner_error0_ = NULL; _tmp0_ = (Test*) g_initable_new (TYPE_TEST_PROXY, NULL, &_inner_error0_, "g-flags", 0, "g-name", "org.example.Test", "g-bus-type", G_BUS_TYPE_SESSION, "g-object-path", "/org/example/test", "g-interface-name", "org.example.Test", NULL); test = (Test*) _tmp0_; if (G_UNLIKELY (_inner_error0_ != NULL)) { g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code); g_clear_error (&_inner_error0_); return; } _tmp1_ = g_new0 (guint8, 1); buffer = _tmp1_; buffer_length1 = 1; _buffer_size_ = buffer_length1; _tmp2_ = g_new0 (gint, 2); pipe1 = _tmp2_; pipe1_length1 = 2; _pipe1_size_ = pipe1_length1; _tmp3_ = pipe1; _tmp3__length1 = pipe1_length1; _vala_assert (pipe (_tmp3_) == 0, "Posix.pipe (pipe1) == 0"); _tmp4_ = buffer; _tmp4__length1 = buffer_length1; _tmp4_[0] = (guint8) 42; _tmp5_ = pipe1; _tmp5__length1 = pipe1_length1; _tmp6_ = _tmp5_[1]; _tmp7_ = buffer; _tmp7__length1 = buffer_length1; _vala_assert (write (_tmp6_, _tmp7_, (gsize) 1) == ((gssize) 1), "Posix.write (pipe1[1], buffer, 1) == 1"); _tmp8_ = pipe1; _tmp8__length1 = pipe1_length1; _tmp9_ = _tmp8_[1]; close (_tmp9_); _tmp11_ = test; _tmp12_ = pipe1; _tmp12__length1 = pipe1_length1; _tmp13_ = _tmp12_[0]; _tmp14_ = (GUnixInputStream*) g_unix_input_stream_new (_tmp13_, TRUE); _tmp15_ = _tmp14_; _tmp17_ = test_test_in (_tmp11_, _tmp15_, &_tmp16_, &_inner_error0_); _g_object_unref0 (j); j = _tmp16_; _tmp18_ = _tmp17_; _g_object_unref0 (_tmp15_); _tmp10_ = _tmp18_; if (G_UNLIKELY (_inner_error0_ != NULL)) { _g_object_unref0 (k); _g_object_unref0 (j); pipe1 = (g_free (pipe1), NULL); buffer = (g_free (buffer), NULL); _g_object_unref0 (test); g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code); g_clear_error (&_inner_error0_); return; } _tmp19_ = _tmp10_; _tmp10_ = NULL; _g_object_unref0 (k); k = _tmp19_; _tmp21_ = j; _tmp22_ = buffer; _tmp22__length1 = buffer_length1; _tmp20_ = g_input_stream_read (G_TYPE_CHECK_INSTANCE_CAST (_tmp21_, g_input_stream_get_type (), GInputStream), _tmp22_, (gsize) _tmp22__length1, NULL, &_inner_error0_); if (G_UNLIKELY (_inner_error0_ != NULL)) { _g_object_unref0 (_tmp10_); _g_object_unref0 (k); _g_object_unref0 (j); pipe1 = (g_free (pipe1), NULL); buffer = (g_free (buffer), NULL); _g_object_unref0 (test); g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code); g_clear_error (&_inner_error0_); return; } _vala_assert (_tmp20_ == ((gssize) 1), "j.read (buffer) == 1"); _tmp23_ = buffer; _tmp23__length1 = buffer_length1; _tmp24_ = _tmp23_[0]; _vala_assert (((gint) _tmp24_) == 23, "buffer[0] == 23"); _tmp26_ = k; _tmp27_ = buffer; _tmp27__length1 = buffer_length1; _tmp25_ = g_input_stream_read (G_TYPE_CHECK_INSTANCE_CAST (_tmp26_, g_input_stream_get_type (), GInputStream), _tmp27_, (gsize) _tmp27__length1, NULL, &_inner_error0_); if (G_UNLIKELY (_inner_error0_ != NULL)) { _g_object_unref0 (_tmp10_); _g_object_unref0 (k); _g_object_unref0 (j); pipe1 = (g_free (pipe1), NULL); buffer = (g_free (buffer), NULL); _g_object_unref0 (test); g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code); g_clear_error (&_inner_error0_); return; } _vala_assert (_tmp25_ == ((gssize) 1), "k.read (buffer) == 1"); _tmp28_ = buffer; _tmp28__length1 = buffer_length1; _tmp29_ = _tmp28_[0]; _vala_assert (((gint) _tmp29_) == 11, "buffer[0] == 11"); _g_object_unref0 (_tmp10_); _g_object_unref0 (k); _g_object_unref0 (j); pipe1 = (g_free (pipe1), NULL); buffer = (g_free (buffer), NULL); _g_object_unref0 (test); } int main (int argc, char ** argv) { _vala_main (); return 0; }