/* component.c generated by valac 0.56.19, the Vala compiler
 * generated from component.vala, do not modify */

#include "xmpp-vala.h"
#include <glib.h>
#include <gio/gio.h>
#include <stdlib.h>
#include <string.h>
#include <glib-object.h>
#include <gee.h>

#if !defined(VALA_STRICT_C)
#if !defined(__clang__) && defined(__GNUC__) && (__GNUC__ >= 14)
#pragma GCC diagnostic warning "-Wincompatible-pointer-types"
#elif defined(__clang__) && (__clang_major__ >= 16)
#pragma clang diagnostic ignored "-Wincompatible-function-pointer-types"
#pragma clang diagnostic ignored "-Wincompatible-pointer-types"
#endif
#endif

enum  {
	XMPP_XEP_JINGLE_COMPONENT_CONNECTION_0_PROPERTY,
	XMPP_XEP_JINGLE_COMPONENT_CONNECTION_COMPONENT_ID_PROPERTY,
	XMPP_XEP_JINGLE_COMPONENT_CONNECTION_BYTES_SENT_PROPERTY,
	XMPP_XEP_JINGLE_COMPONENT_CONNECTION_BYTES_RECEIVED_PROPERTY,
	XMPP_XEP_JINGLE_COMPONENT_CONNECTION_NUM_PROPERTIES
};
static GParamSpec* xmpp_xep_jingle_component_connection_properties[XMPP_XEP_JINGLE_COMPONENT_CONNECTION_NUM_PROPERTIES];
enum  {
	XMPP_XEP_JINGLE_COMPONENT_CONNECTION_CONNECTION_CLOSED_SIGNAL,
	XMPP_XEP_JINGLE_COMPONENT_CONNECTION_CONNECTION_ERROR_SIGNAL,
	XMPP_XEP_JINGLE_COMPONENT_CONNECTION_NUM_SIGNALS
};
static guint xmpp_xep_jingle_component_connection_signals[XMPP_XEP_JINGLE_COMPONENT_CONNECTION_NUM_SIGNALS] = {0};
enum  {
	XMPP_XEP_JINGLE_DATAGRAM_CONNECTION_0_PROPERTY,
	XMPP_XEP_JINGLE_DATAGRAM_CONNECTION_READY_PROPERTY,
	XMPP_XEP_JINGLE_DATAGRAM_CONNECTION_NUM_PROPERTIES
};
static GParamSpec* xmpp_xep_jingle_datagram_connection_properties[XMPP_XEP_JINGLE_DATAGRAM_CONNECTION_NUM_PROPERTIES];
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
typedef struct _XmppXepJingleDatagramConnectionTerminateData XmppXepJingleDatagramConnectionTerminateData;
enum  {
	XMPP_XEP_JINGLE_DATAGRAM_CONNECTION_DATAGRAM_RECEIVED_SIGNAL,
	XMPP_XEP_JINGLE_DATAGRAM_CONNECTION_NUM_SIGNALS
};
static guint xmpp_xep_jingle_datagram_connection_signals[XMPP_XEP_JINGLE_DATAGRAM_CONNECTION_NUM_SIGNALS] = {0};
enum  {
	XMPP_XEP_JINGLE_STREAMING_CONNECTION_0_PROPERTY,
	XMPP_XEP_JINGLE_STREAMING_CONNECTION_STREAM_PROPERTY,
	XMPP_XEP_JINGLE_STREAMING_CONNECTION_NUM_PROPERTIES
};
static GParamSpec* xmpp_xep_jingle_streaming_connection_properties[XMPP_XEP_JINGLE_STREAMING_CONNECTION_NUM_PROPERTIES];
#define _gee_promise_unref0(var) ((var == NULL) ? NULL : (var = (gee_promise_unref (var), NULL)))
typedef struct _XmppXepJingleStreamingConnectionSetStreamData XmppXepJingleStreamingConnectionSetStreamData;
typedef struct _XmppXepJingleStreamingConnectionTerminateData XmppXepJingleStreamingConnectionTerminateData;
#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 _XmppXepJingleComponentConnectionPrivate {
	guint8 _component_id;
	gulong _bytes_sent;
	gulong _bytes_received;
};

struct _XmppXepJingleDatagramConnectionPrivate {
	gboolean _ready;
	gchar* terminate_reason_name;
	gchar* terminate_reason_text;
	gboolean terminated;
};

struct _XmppXepJingleDatagramConnectionTerminateData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	XmppXepJingleDatagramConnection* self;
	gboolean we_terminated;
	gchar* reason_string;
	gchar* reason_text;
	gchar* _tmp0_;
	gchar* _tmp1_;
};

struct _XmppXepJingleStreamingConnectionPrivate {
	gchar* terminated;
};

struct _XmppXepJingleStreamingConnectionSetStreamData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	XmppXepJingleStreamingConnection* self;
	GIOStream* stream;
	GeePromise* _tmp0_;
	GError* _tmp1_;
	GeeFuture* _tmp2_;
	GeeFuture* _tmp3_;
	gboolean _tmp4_;
	gboolean _tmp5_;
	GeePromise* _tmp6_;
	GIOStream* _tmp7_;
	const gchar* _tmp8_;
	GError* _inner_error0_;
};

struct _XmppXepJingleStreamingConnectionTerminateData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	XmppXepJingleStreamingConnection* self;
	gboolean we_terminated;
	gchar* reason_name;
	gchar* reason_text;
	const gchar* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	gchar* _tmp6_;
	gchar* _tmp7_;
	gchar* _tmp8_;
	gchar* _tmp9_;
	gchar* _tmp10_;
	gchar* _tmp11_;
	GeeFuture* _tmp12_;
	GeeFuture* _tmp13_;
	gboolean _tmp14_;
	gboolean _tmp15_;
	GeeFuture* _tmp16_;
	GeeFuture* _tmp17_;
	gconstpointer _tmp18_;
	gconstpointer _tmp19_;
	GeePromise* _tmp20_;
	GError* _tmp21_;
	GError* _inner_error0_;
};

static gint XmppXepJingleComponentConnection_private_offset;
static gpointer xmpp_xep_jingle_component_connection_parent_class = NULL;
static gint XmppXepJingleDatagramConnection_private_offset;
static gpointer xmpp_xep_jingle_datagram_connection_parent_class = NULL;
static gint XmppXepJingleStreamingConnection_private_offset;
static gpointer xmpp_xep_jingle_streaming_connection_parent_class = NULL;

static void xmpp_xep_jingle_component_connection_finalize (GObject * obj);
static GType xmpp_xep_jingle_component_connection_get_type_once (void);
static void _vala_xmpp_xep_jingle_component_connection_get_property (GObject * object,
                                                              guint property_id,
                                                              GValue * value,
                                                              GParamSpec * pspec);
static void _vala_xmpp_xep_jingle_component_connection_set_property (GObject * object,
                                                              guint property_id,
                                                              const GValue * value,
                                                              GParamSpec * pspec);
static void xmpp_xep_jingle_datagram_connection_real_terminate_data_free (gpointer _data);
static void xmpp_xep_jingle_datagram_connection_real_terminate (XmppXepJingleComponentConnection* base,
                                                         gboolean we_terminated,
                                                         const gchar* reason_string,
                                                         const gchar* reason_text,
                                                         GAsyncReadyCallback _callback_,
                                                         gpointer _user_data_);
static gboolean xmpp_xep_jingle_datagram_connection_real_terminate_co (XmppXepJingleDatagramConnectionTerminateData* _data_);
static void xmpp_xep_jingle_datagram_connection_real_send_datagram (XmppXepJingleDatagramConnection* self,
                                                             GBytes* datagram);
static void xmpp_xep_jingle_datagram_connection_finalize (GObject * obj);
static GType xmpp_xep_jingle_datagram_connection_get_type_once (void);
static void _vala_xmpp_xep_jingle_datagram_connection_get_property (GObject * object,
                                                             guint property_id,
                                                             GValue * value,
                                                             GParamSpec * pspec);
static void _vala_xmpp_xep_jingle_datagram_connection_set_property (GObject * object,
                                                             guint property_id,
                                                             const GValue * value,
                                                             GParamSpec * pspec);
static void xmpp_xep_jingle_streaming_connection_set_stream_data_free (gpointer _data);
static gboolean xmpp_xep_jingle_streaming_connection_set_stream_co (XmppXepJingleStreamingConnectionSetStreamData* _data_);
static void xmpp_xep_jingle_streaming_connection_set_stream_ready (GObject* source_object,
                                                            GAsyncResult* _res_,
                                                            gpointer _user_data_);
static void xmpp_xep_jingle_streaming_connection_real_terminate_data_free (gpointer _data);
static void xmpp_xep_jingle_streaming_connection_real_terminate (XmppXepJingleComponentConnection* base,
                                                          gboolean we_terminated,
                                                          const gchar* reason_name,
                                                          const gchar* reason_text,
                                                          GAsyncReadyCallback _callback_,
                                                          gpointer _user_data_);
static gboolean xmpp_xep_jingle_streaming_connection_real_terminate_co (XmppXepJingleStreamingConnectionTerminateData* _data_);
static void xmpp_xep_jingle_streaming_connection_terminate_ready (GObject* source_object,
                                                           GAsyncResult* _res_,
                                                           gpointer _user_data_);
static void xmpp_xep_jingle_streaming_connection_finalize (GObject * obj);
static GType xmpp_xep_jingle_streaming_connection_get_type_once (void);
static void _vala_xmpp_xep_jingle_streaming_connection_get_property (GObject * object,
                                                              guint property_id,
                                                              GValue * value,
                                                              GParamSpec * pspec);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static inline gpointer
xmpp_xep_jingle_component_connection_get_instance_private (XmppXepJingleComponentConnection* self)
{
	return G_STRUCT_MEMBER_P (self, XmppXepJingleComponentConnection_private_offset);
}

void
xmpp_xep_jingle_component_connection_terminate (XmppXepJingleComponentConnection* self,
                                                gboolean we_terminated,
                                                const gchar* reason_name,
                                                const gchar* reason_text,
                                                GAsyncReadyCallback _callback_,
                                                gpointer _user_data_)
{
	XmppXepJingleComponentConnectionClass* _klass_;
	_klass_ = XMPP_XEP_JINGLE_COMPONENT_CONNECTION_GET_CLASS (self);
	if (_klass_->terminate) {
		_klass_->terminate (self, we_terminated, reason_name, reason_text, _callback_, _user_data_);
	}
}

void
xmpp_xep_jingle_component_connection_terminate_finish (XmppXepJingleComponentConnection* self,
                                                       GAsyncResult* _res_)
{
	XmppXepJingleComponentConnectionClass* _klass_;
	_klass_ = XMPP_XEP_JINGLE_COMPONENT_CONNECTION_GET_CLASS (self);
	if (_klass_->terminate_finish) {
		_klass_->terminate_finish (self, _res_);
	}
}

XmppXepJingleComponentConnection*
xmpp_xep_jingle_component_connection_construct (GType object_type)
{
	XmppXepJingleComponentConnection * self = NULL;
	self = (XmppXepJingleComponentConnection*) g_object_new (object_type, NULL);
	return self;
}

guint8
xmpp_xep_jingle_component_connection_get_component_id (XmppXepJingleComponentConnection* self)
{
	guint8 result;
	g_return_val_if_fail (self != NULL, 0U);
	result = self->priv->_component_id;
	return result;
}

void
xmpp_xep_jingle_component_connection_set_component_id (XmppXepJingleComponentConnection* self,
                                                       guint8 value)
{
	guint8 old_value;
	g_return_if_fail (self != NULL);
	old_value = xmpp_xep_jingle_component_connection_get_component_id (self);
	if (old_value != value) {
		self->priv->_component_id = value;
		g_object_notify_by_pspec ((GObject *) self, xmpp_xep_jingle_component_connection_properties[XMPP_XEP_JINGLE_COMPONENT_CONNECTION_COMPONENT_ID_PROPERTY]);
	}
}

gulong
xmpp_xep_jingle_component_connection_get_bytes_sent (XmppXepJingleComponentConnection* self)
{
	gulong result;
	g_return_val_if_fail (self != NULL, 0UL);
	result = self->priv->_bytes_sent;
	return result;
}

void
xmpp_xep_jingle_component_connection_set_bytes_sent (XmppXepJingleComponentConnection* self,
                                                     gulong value)
{
	gulong old_value;
	g_return_if_fail (self != NULL);
	old_value = xmpp_xep_jingle_component_connection_get_bytes_sent (self);
	if (old_value != value) {
		self->priv->_bytes_sent = value;
		g_object_notify_by_pspec ((GObject *) self, xmpp_xep_jingle_component_connection_properties[XMPP_XEP_JINGLE_COMPONENT_CONNECTION_BYTES_SENT_PROPERTY]);
	}
}

gulong
xmpp_xep_jingle_component_connection_get_bytes_received (XmppXepJingleComponentConnection* self)
{
	gulong result;
	g_return_val_if_fail (self != NULL, 0UL);
	result = self->priv->_bytes_received;
	return result;
}

void
xmpp_xep_jingle_component_connection_set_bytes_received (XmppXepJingleComponentConnection* self,
                                                         gulong value)
{
	gulong old_value;
	g_return_if_fail (self != NULL);
	old_value = xmpp_xep_jingle_component_connection_get_bytes_received (self);
	if (old_value != value) {
		self->priv->_bytes_received = value;
		g_object_notify_by_pspec ((GObject *) self, xmpp_xep_jingle_component_connection_properties[XMPP_XEP_JINGLE_COMPONENT_CONNECTION_BYTES_RECEIVED_PROPERTY]);
	}
}

static void
xmpp_xep_jingle_component_connection_class_init (XmppXepJingleComponentConnectionClass * klass,
                                                 gpointer klass_data)
{
	xmpp_xep_jingle_component_connection_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &XmppXepJingleComponentConnection_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_xmpp_xep_jingle_component_connection_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_xmpp_xep_jingle_component_connection_set_property;
	G_OBJECT_CLASS (klass)->finalize = xmpp_xep_jingle_component_connection_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), XMPP_XEP_JINGLE_COMPONENT_CONNECTION_COMPONENT_ID_PROPERTY, xmpp_xep_jingle_component_connection_properties[XMPP_XEP_JINGLE_COMPONENT_CONNECTION_COMPONENT_ID_PROPERTY] = g_param_spec_uchar ("component-id", "component-id", "component-id", 0, G_MAXUINT8, (guint8) 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), XMPP_XEP_JINGLE_COMPONENT_CONNECTION_BYTES_SENT_PROPERTY, xmpp_xep_jingle_component_connection_properties[XMPP_XEP_JINGLE_COMPONENT_CONNECTION_BYTES_SENT_PROPERTY] = g_param_spec_ulong ("bytes-sent", "bytes-sent", "bytes-sent", 0, G_MAXULONG, (gulong) 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), XMPP_XEP_JINGLE_COMPONENT_CONNECTION_BYTES_RECEIVED_PROPERTY, xmpp_xep_jingle_component_connection_properties[XMPP_XEP_JINGLE_COMPONENT_CONNECTION_BYTES_RECEIVED_PROPERTY] = g_param_spec_ulong ("bytes-received", "bytes-received", "bytes-received", 0, G_MAXULONG, (gulong) 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	xmpp_xep_jingle_component_connection_signals[XMPP_XEP_JINGLE_COMPONENT_CONNECTION_CONNECTION_CLOSED_SIGNAL] = g_signal_new ("connection-closed", XMPP_XEP_JINGLE_TYPE_COMPONENT_CONNECTION, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
	xmpp_xep_jingle_component_connection_signals[XMPP_XEP_JINGLE_COMPONENT_CONNECTION_CONNECTION_ERROR_SIGNAL] = g_signal_new ("connection-error", XMPP_XEP_JINGLE_TYPE_COMPONENT_CONNECTION, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__BOXED, G_TYPE_NONE, 1, G_TYPE_ERROR);
}

static void
xmpp_xep_jingle_component_connection_instance_init (XmppXepJingleComponentConnection * self,
                                                    gpointer klass)
{
	self->priv = xmpp_xep_jingle_component_connection_get_instance_private (self);
	self->priv->_component_id = (guint8) 0;
	self->priv->_bytes_sent = (gulong) 0;
	self->priv->_bytes_received = (gulong) 0;
}

static void
xmpp_xep_jingle_component_connection_finalize (GObject * obj)
{
	XmppXepJingleComponentConnection * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, XMPP_XEP_JINGLE_TYPE_COMPONENT_CONNECTION, XmppXepJingleComponentConnection);
	G_OBJECT_CLASS (xmpp_xep_jingle_component_connection_parent_class)->finalize (obj);
}

static GType
xmpp_xep_jingle_component_connection_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (XmppXepJingleComponentConnectionClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) xmpp_xep_jingle_component_connection_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (XmppXepJingleComponentConnection), 0, (GInstanceInitFunc) xmpp_xep_jingle_component_connection_instance_init, NULL };
	GType xmpp_xep_jingle_component_connection_type_id;
	xmpp_xep_jingle_component_connection_type_id = g_type_register_static (G_TYPE_OBJECT, "XmppXepJingleComponentConnection", &g_define_type_info, G_TYPE_FLAG_ABSTRACT);
	XmppXepJingleComponentConnection_private_offset = g_type_add_instance_private (xmpp_xep_jingle_component_connection_type_id, sizeof (XmppXepJingleComponentConnectionPrivate));
	return xmpp_xep_jingle_component_connection_type_id;
}

GType
xmpp_xep_jingle_component_connection_get_type (void)
{
	static volatile gsize xmpp_xep_jingle_component_connection_type_id__once = 0;
	if (g_once_init_enter (&xmpp_xep_jingle_component_connection_type_id__once)) {
		GType xmpp_xep_jingle_component_connection_type_id;
		xmpp_xep_jingle_component_connection_type_id = xmpp_xep_jingle_component_connection_get_type_once ();
		g_once_init_leave (&xmpp_xep_jingle_component_connection_type_id__once, xmpp_xep_jingle_component_connection_type_id);
	}
	return xmpp_xep_jingle_component_connection_type_id__once;
}

static void
_vala_xmpp_xep_jingle_component_connection_get_property (GObject * object,
                                                         guint property_id,
                                                         GValue * value,
                                                         GParamSpec * pspec)
{
	XmppXepJingleComponentConnection * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, XMPP_XEP_JINGLE_TYPE_COMPONENT_CONNECTION, XmppXepJingleComponentConnection);
	switch (property_id) {
		case XMPP_XEP_JINGLE_COMPONENT_CONNECTION_COMPONENT_ID_PROPERTY:
		g_value_set_uchar (value, xmpp_xep_jingle_component_connection_get_component_id (self));
		break;
		case XMPP_XEP_JINGLE_COMPONENT_CONNECTION_BYTES_SENT_PROPERTY:
		g_value_set_ulong (value, xmpp_xep_jingle_component_connection_get_bytes_sent (self));
		break;
		case XMPP_XEP_JINGLE_COMPONENT_CONNECTION_BYTES_RECEIVED_PROPERTY:
		g_value_set_ulong (value, xmpp_xep_jingle_component_connection_get_bytes_received (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_xmpp_xep_jingle_component_connection_set_property (GObject * object,
                                                         guint property_id,
                                                         const GValue * value,
                                                         GParamSpec * pspec)
{
	XmppXepJingleComponentConnection * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, XMPP_XEP_JINGLE_TYPE_COMPONENT_CONNECTION, XmppXepJingleComponentConnection);
	switch (property_id) {
		case XMPP_XEP_JINGLE_COMPONENT_CONNECTION_COMPONENT_ID_PROPERTY:
		xmpp_xep_jingle_component_connection_set_component_id (self, g_value_get_uchar (value));
		break;
		case XMPP_XEP_JINGLE_COMPONENT_CONNECTION_BYTES_SENT_PROPERTY:
		xmpp_xep_jingle_component_connection_set_bytes_sent (self, g_value_get_ulong (value));
		break;
		case XMPP_XEP_JINGLE_COMPONENT_CONNECTION_BYTES_RECEIVED_PROPERTY:
		xmpp_xep_jingle_component_connection_set_bytes_received (self, g_value_get_ulong (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static inline gpointer
xmpp_xep_jingle_datagram_connection_get_instance_private (XmppXepJingleDatagramConnection* self)
{
	return G_STRUCT_MEMBER_P (self, XmppXepJingleDatagramConnection_private_offset);
}

static void
xmpp_xep_jingle_datagram_connection_real_terminate_data_free (gpointer _data)
{
	XmppXepJingleDatagramConnectionTerminateData* _data_;
	_data_ = _data;
	_g_free0 (_data_->reason_string);
	_g_free0 (_data_->reason_text);
	_g_object_unref0 (_data_->self);
	g_slice_free (XmppXepJingleDatagramConnectionTerminateData, _data_);
}

static gpointer
_g_object_ref0 (gpointer self)
{
	return self ? g_object_ref (self) : NULL;
}

static void
xmpp_xep_jingle_datagram_connection_real_terminate (XmppXepJingleComponentConnection* base,
                                                    gboolean we_terminated,
                                                    const gchar* reason_string,
                                                    const gchar* reason_text,
                                                    GAsyncReadyCallback _callback_,
                                                    gpointer _user_data_)
{
	XmppXepJingleDatagramConnection * self;
	XmppXepJingleDatagramConnectionTerminateData* _data_;
	XmppXepJingleDatagramConnection* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	self = (XmppXepJingleDatagramConnection*) base;
	_data_ = g_slice_new0 (XmppXepJingleDatagramConnectionTerminateData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, xmpp_xep_jingle_datagram_connection_real_terminate_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_data_->we_terminated = we_terminated;
	_tmp1_ = g_strdup (reason_string);
	_g_free0 (_data_->reason_string);
	_data_->reason_string = _tmp1_;
	_tmp2_ = g_strdup (reason_text);
	_g_free0 (_data_->reason_text);
	_data_->reason_text = _tmp2_;
	xmpp_xep_jingle_datagram_connection_real_terminate_co (_data_);
}

static void
xmpp_xep_jingle_datagram_connection_terminate_finish (XmppXepJingleComponentConnection* base,
                                                      GAsyncResult* _res_)
{
	XmppXepJingleDatagramConnectionTerminateData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static gboolean
xmpp_xep_jingle_datagram_connection_real_terminate_co (XmppXepJingleDatagramConnectionTerminateData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	if (!_data_->self->priv->terminated) {
		_data_->self->priv->terminated = TRUE;
		_data_->_tmp0_ = g_strdup (_data_->reason_string);
		_g_free0 (_data_->self->priv->terminate_reason_name);
		_data_->self->priv->terminate_reason_name = _data_->_tmp0_;
		_data_->_tmp1_ = g_strdup (_data_->reason_text);
		_g_free0 (_data_->self->priv->terminate_reason_text);
		_data_->self->priv->terminate_reason_text = _data_->_tmp1_;
		g_signal_emit ((XmppXepJingleComponentConnection*) _data_->self, xmpp_xep_jingle_component_connection_signals[XMPP_XEP_JINGLE_COMPONENT_CONNECTION_CONNECTION_CLOSED_SIGNAL], 0);
	}
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

static void
xmpp_xep_jingle_datagram_connection_real_send_datagram (XmppXepJingleDatagramConnection* self,
                                                        GBytes* datagram)
{
	g_critical ("Type `%s' does not implement abstract method `xmpp_xep_jingle_datagram_connection_send_datagram'", g_type_name (G_TYPE_FROM_INSTANCE (self)));
	return;
}

void
xmpp_xep_jingle_datagram_connection_send_datagram (XmppXepJingleDatagramConnection* self,
                                                   GBytes* datagram)
{
	XmppXepJingleDatagramConnectionClass* _klass_;
	g_return_if_fail (self != NULL);
	_klass_ = XMPP_XEP_JINGLE_DATAGRAM_CONNECTION_GET_CLASS (self);
	if (_klass_->send_datagram) {
		_klass_->send_datagram (self, datagram);
	}
}

XmppXepJingleDatagramConnection*
xmpp_xep_jingle_datagram_connection_construct (GType object_type)
{
	XmppXepJingleDatagramConnection * self = NULL;
	self = (XmppXepJingleDatagramConnection*) xmpp_xep_jingle_component_connection_construct (object_type);
	return self;
}

gboolean
xmpp_xep_jingle_datagram_connection_get_ready (XmppXepJingleDatagramConnection* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_ready;
	return result;
}

void
xmpp_xep_jingle_datagram_connection_set_ready (XmppXepJingleDatagramConnection* self,
                                               gboolean value)
{
	gboolean old_value;
	g_return_if_fail (self != NULL);
	old_value = xmpp_xep_jingle_datagram_connection_get_ready (self);
	if (old_value != value) {
		self->priv->_ready = value;
		g_object_notify_by_pspec ((GObject *) self, xmpp_xep_jingle_datagram_connection_properties[XMPP_XEP_JINGLE_DATAGRAM_CONNECTION_READY_PROPERTY]);
	}
}

static void
xmpp_xep_jingle_datagram_connection_class_init (XmppXepJingleDatagramConnectionClass * klass,
                                                gpointer klass_data)
{
	xmpp_xep_jingle_datagram_connection_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &XmppXepJingleDatagramConnection_private_offset);
	((XmppXepJingleComponentConnectionClass *) klass)->terminate = (void (*) (XmppXepJingleComponentConnection*, gboolean, const gchar*, const gchar*, GAsyncReadyCallback, gpointer)) xmpp_xep_jingle_datagram_connection_real_terminate;
	((XmppXepJingleComponentConnectionClass *) klass)->terminate_finish = (void (*) (XmppXepJingleComponentConnection*, GAsyncResult*)) xmpp_xep_jingle_datagram_connection_terminate_finish;
	((XmppXepJingleDatagramConnectionClass *) klass)->send_datagram = (void (*) (XmppXepJingleDatagramConnection*, GBytes*)) xmpp_xep_jingle_datagram_connection_real_send_datagram;
	G_OBJECT_CLASS (klass)->get_property = _vala_xmpp_xep_jingle_datagram_connection_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_xmpp_xep_jingle_datagram_connection_set_property;
	G_OBJECT_CLASS (klass)->finalize = xmpp_xep_jingle_datagram_connection_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), XMPP_XEP_JINGLE_DATAGRAM_CONNECTION_READY_PROPERTY, xmpp_xep_jingle_datagram_connection_properties[XMPP_XEP_JINGLE_DATAGRAM_CONNECTION_READY_PROPERTY] = g_param_spec_boolean ("ready", "ready", "ready", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	xmpp_xep_jingle_datagram_connection_signals[XMPP_XEP_JINGLE_DATAGRAM_CONNECTION_DATAGRAM_RECEIVED_SIGNAL] = g_signal_new ("datagram-received", XMPP_XEP_JINGLE_TYPE_DATAGRAM_CONNECTION, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__BOXED, G_TYPE_NONE, 1, G_TYPE_BYTES);
}

static void
xmpp_xep_jingle_datagram_connection_instance_init (XmppXepJingleDatagramConnection * self,
                                                   gpointer klass)
{
	self->priv = xmpp_xep_jingle_datagram_connection_get_instance_private (self);
	self->priv->_ready = FALSE;
	self->priv->terminate_reason_name = NULL;
	self->priv->terminate_reason_text = NULL;
	self->priv->terminated = FALSE;
}

static void
xmpp_xep_jingle_datagram_connection_finalize (GObject * obj)
{
	XmppXepJingleDatagramConnection * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, XMPP_XEP_JINGLE_TYPE_DATAGRAM_CONNECTION, XmppXepJingleDatagramConnection);
	_g_free0 (self->priv->terminate_reason_name);
	_g_free0 (self->priv->terminate_reason_text);
	G_OBJECT_CLASS (xmpp_xep_jingle_datagram_connection_parent_class)->finalize (obj);
}

static GType
xmpp_xep_jingle_datagram_connection_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (XmppXepJingleDatagramConnectionClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) xmpp_xep_jingle_datagram_connection_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (XmppXepJingleDatagramConnection), 0, (GInstanceInitFunc) xmpp_xep_jingle_datagram_connection_instance_init, NULL };
	GType xmpp_xep_jingle_datagram_connection_type_id;
	xmpp_xep_jingle_datagram_connection_type_id = g_type_register_static (XMPP_XEP_JINGLE_TYPE_COMPONENT_CONNECTION, "XmppXepJingleDatagramConnection", &g_define_type_info, G_TYPE_FLAG_ABSTRACT);
	XmppXepJingleDatagramConnection_private_offset = g_type_add_instance_private (xmpp_xep_jingle_datagram_connection_type_id, sizeof (XmppXepJingleDatagramConnectionPrivate));
	return xmpp_xep_jingle_datagram_connection_type_id;
}

GType
xmpp_xep_jingle_datagram_connection_get_type (void)
{
	static volatile gsize xmpp_xep_jingle_datagram_connection_type_id__once = 0;
	if (g_once_init_enter (&xmpp_xep_jingle_datagram_connection_type_id__once)) {
		GType xmpp_xep_jingle_datagram_connection_type_id;
		xmpp_xep_jingle_datagram_connection_type_id = xmpp_xep_jingle_datagram_connection_get_type_once ();
		g_once_init_leave (&xmpp_xep_jingle_datagram_connection_type_id__once, xmpp_xep_jingle_datagram_connection_type_id);
	}
	return xmpp_xep_jingle_datagram_connection_type_id__once;
}

static void
_vala_xmpp_xep_jingle_datagram_connection_get_property (GObject * object,
                                                        guint property_id,
                                                        GValue * value,
                                                        GParamSpec * pspec)
{
	XmppXepJingleDatagramConnection * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, XMPP_XEP_JINGLE_TYPE_DATAGRAM_CONNECTION, XmppXepJingleDatagramConnection);
	switch (property_id) {
		case XMPP_XEP_JINGLE_DATAGRAM_CONNECTION_READY_PROPERTY:
		g_value_set_boolean (value, xmpp_xep_jingle_datagram_connection_get_ready (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_xmpp_xep_jingle_datagram_connection_set_property (GObject * object,
                                                        guint property_id,
                                                        const GValue * value,
                                                        GParamSpec * pspec)
{
	XmppXepJingleDatagramConnection * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, XMPP_XEP_JINGLE_TYPE_DATAGRAM_CONNECTION, XmppXepJingleDatagramConnection);
	switch (property_id) {
		case XMPP_XEP_JINGLE_DATAGRAM_CONNECTION_READY_PROPERTY:
		xmpp_xep_jingle_datagram_connection_set_ready (self, g_value_get_boolean (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static inline gpointer
xmpp_xep_jingle_streaming_connection_get_instance_private (XmppXepJingleStreamingConnection* self)
{
	return G_STRUCT_MEMBER_P (self, XmppXepJingleStreamingConnection_private_offset);
}

static void
xmpp_xep_jingle_streaming_connection_set_stream_data_free (gpointer _data)
{
	XmppXepJingleStreamingConnectionSetStreamData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->stream);
	_g_object_unref0 (_data_->self);
	g_slice_free (XmppXepJingleStreamingConnectionSetStreamData, _data_);
}

void
xmpp_xep_jingle_streaming_connection_set_stream (XmppXepJingleStreamingConnection* self,
                                                 GIOStream* stream,
                                                 GAsyncReadyCallback _callback_,
                                                 gpointer _user_data_)
{
	XmppXepJingleStreamingConnectionSetStreamData* _data_;
	XmppXepJingleStreamingConnection* _tmp0_;
	GIOStream* _tmp1_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (XmppXepJingleStreamingConnectionSetStreamData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, xmpp_xep_jingle_streaming_connection_set_stream_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (stream);
	_g_object_unref0 (_data_->stream);
	_data_->stream = _tmp1_;
	xmpp_xep_jingle_streaming_connection_set_stream_co (_data_);
}

void
xmpp_xep_jingle_streaming_connection_set_stream_finish (XmppXepJingleStreamingConnection* self,
                                                        GAsyncResult* _res_)
{
	XmppXepJingleStreamingConnectionSetStreamData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static void
xmpp_xep_jingle_streaming_connection_set_stream_ready (GObject* source_object,
                                                       GAsyncResult* _res_,
                                                       gpointer _user_data_)
{
	XmppXepJingleStreamingConnectionSetStreamData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	xmpp_xep_jingle_streaming_connection_set_stream_co (_data_);
}

static gboolean
xmpp_xep_jingle_streaming_connection_set_stream_co (XmppXepJingleStreamingConnectionSetStreamData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	if (_data_->stream == NULL) {
		_data_->_tmp0_ = _data_->self->promise;
		_data_->_tmp1_ = g_error_new_literal (G_IO_ERROR, G_IO_ERROR_FAILED, "Jingle connection failed");
		gee_promise_set_exception (_data_->_tmp0_, _data_->_tmp1_);
		g_task_return_pointer (_data_->_async_result, _data_, NULL);
		if (_data_->_state_ != 0) {
			while (!g_task_get_completed (_data_->_async_result)) {
				g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
			}
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp2_ = xmpp_xep_jingle_streaming_connection_get_stream (_data_->self);
	_data_->_tmp3_ = _data_->_tmp2_;
	_data_->_tmp4_ = gee_future_get_ready (_data_->_tmp3_);
	_data_->_tmp5_ = _data_->_tmp4_;
	_vala_assert (!_data_->_tmp5_, "!this.stream.ready");
	_data_->_tmp6_ = _data_->self->promise;
	_data_->_tmp7_ = _g_object_ref0 (_data_->stream);
	gee_promise_set_value (_data_->_tmp6_, _data_->_tmp7_);
	_data_->_tmp8_ = _data_->self->priv->terminated;
	if (_data_->_tmp8_ != NULL) {
		_data_->_state_ = 1;
		g_io_stream_close_async (_data_->stream, G_PRIORITY_DEFAULT, NULL, xmpp_xep_jingle_streaming_connection_set_stream_ready, _data_);
		return FALSE;
		_state_1:
		g_io_stream_close_finish (_data_->stream, _data_->_res_, &_data_->_inner_error0_);
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
			g_clear_error (&_data_->_inner_error0_);
			g_object_unref (_data_->_async_result);
			return FALSE;
		}
	}
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

static gpointer
_g_error_copy0 (gpointer self)
{
	return self ? g_error_copy (self) : NULL;
}

void
xmpp_xep_jingle_streaming_connection_set_error (XmppXepJingleStreamingConnection* self,
                                                GError* e)
{
	GeePromise* _tmp0_;
	GError* _tmp1_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->promise;
	_tmp1_ = _g_error_copy0 (e);
	gee_promise_set_exception (_tmp0_, _tmp1_);
}

static void
xmpp_xep_jingle_streaming_connection_real_terminate_data_free (gpointer _data)
{
	XmppXepJingleStreamingConnectionTerminateData* _data_;
	_data_ = _data;
	_g_free0 (_data_->reason_name);
	_g_free0 (_data_->reason_text);
	_g_object_unref0 (_data_->self);
	g_slice_free (XmppXepJingleStreamingConnectionTerminateData, _data_);
}

static void
xmpp_xep_jingle_streaming_connection_real_terminate (XmppXepJingleComponentConnection* base,
                                                     gboolean we_terminated,
                                                     const gchar* reason_name,
                                                     const gchar* reason_text,
                                                     GAsyncReadyCallback _callback_,
                                                     gpointer _user_data_)
{
	XmppXepJingleStreamingConnection * self;
	XmppXepJingleStreamingConnectionTerminateData* _data_;
	XmppXepJingleStreamingConnection* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	self = (XmppXepJingleStreamingConnection*) base;
	_data_ = g_slice_new0 (XmppXepJingleStreamingConnectionTerminateData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, xmpp_xep_jingle_streaming_connection_real_terminate_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_data_->we_terminated = we_terminated;
	_tmp1_ = g_strdup (reason_name);
	_g_free0 (_data_->reason_name);
	_data_->reason_name = _tmp1_;
	_tmp2_ = g_strdup (reason_text);
	_g_free0 (_data_->reason_text);
	_data_->reason_text = _tmp2_;
	xmpp_xep_jingle_streaming_connection_real_terminate_co (_data_);
}

static void
xmpp_xep_jingle_streaming_connection_terminate_finish (XmppXepJingleComponentConnection* base,
                                                       GAsyncResult* _res_)
{
	XmppXepJingleStreamingConnectionTerminateData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static gchar*
bool_to_string (gboolean self)
{
	gchar* result;
	if (self) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup ("true");
		result = _tmp0_;
		return result;
	} else {
		gchar* _tmp1_;
		_tmp1_ = g_strdup ("false");
		result = _tmp1_;
		return result;
	}
}

static void
xmpp_xep_jingle_streaming_connection_terminate_ready (GObject* source_object,
                                                      GAsyncResult* _res_,
                                                      gpointer _user_data_)
{
	XmppXepJingleStreamingConnectionTerminateData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	xmpp_xep_jingle_streaming_connection_real_terminate_co (_data_);
}

static gboolean
xmpp_xep_jingle_streaming_connection_real_terminate_co (XmppXepJingleStreamingConnectionTerminateData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = _data_->self->priv->terminated;
	if (_data_->_tmp0_ == NULL) {
		_data_->_tmp1_ = _data_->reason_name;
		if (_data_->_tmp1_ == NULL) {
			_data_->_tmp1_ = "";
		}
		_data_->_tmp2_ = _data_->reason_text;
		if (_data_->_tmp2_ == NULL) {
			_data_->_tmp2_ = "";
		}
		_data_->_tmp3_ = g_strconcat (_data_->_tmp1_, " - ", NULL);
		_data_->_tmp4_ = _data_->_tmp3_;
		_data_->_tmp5_ = g_strconcat (_data_->_tmp4_, _data_->_tmp2_, NULL);
		_data_->_tmp6_ = _data_->_tmp5_;
		_data_->_tmp7_ = bool_to_string (_data_->we_terminated);
		_data_->_tmp8_ = _data_->_tmp7_;
		_data_->_tmp9_ = g_strconcat ("we terminated? ", _data_->_tmp8_, NULL);
		_data_->_tmp10_ = _data_->_tmp9_;
		_data_->_tmp11_ = g_strconcat (_data_->_tmp6_, _data_->_tmp10_, NULL);
		_g_free0 (_data_->self->priv->terminated);
		_data_->self->priv->terminated = _data_->_tmp11_;
		_g_free0 (_data_->_tmp10_);
		_g_free0 (_data_->_tmp8_);
		_g_free0 (_data_->_tmp6_);
		_g_free0 (_data_->_tmp4_);
		_data_->_tmp12_ = xmpp_xep_jingle_streaming_connection_get_stream (_data_->self);
		_data_->_tmp13_ = _data_->_tmp12_;
		_data_->_tmp14_ = gee_future_get_ready (_data_->_tmp13_);
		_data_->_tmp15_ = _data_->_tmp14_;
		if (_data_->_tmp15_) {
			_data_->_tmp16_ = xmpp_xep_jingle_streaming_connection_get_stream (_data_->self);
			_data_->_tmp17_ = _data_->_tmp16_;
			_data_->_tmp18_ = gee_future_get_value (_data_->_tmp17_);
			_data_->_tmp19_ = _data_->_tmp18_;
			_data_->_state_ = 1;
			g_io_stream_close_async ((GIOStream*) _data_->_tmp19_, G_PRIORITY_DEFAULT, NULL, xmpp_xep_jingle_streaming_connection_terminate_ready, _data_);
			return FALSE;
			_state_1:
			g_io_stream_close_finish ((GIOStream*) _data_->_tmp19_, _data_->_res_, &_data_->_inner_error0_);
			if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
				g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
				g_clear_error (&_data_->_inner_error0_);
				g_object_unref (_data_->_async_result);
				return FALSE;
			}
		} else {
			_data_->_tmp20_ = _data_->self->promise;
			_data_->_tmp21_ = g_error_new_literal (G_IO_ERROR, G_IO_ERROR_FAILED, "Jingle connection failed");
			gee_promise_set_exception (_data_->_tmp20_, _data_->_tmp21_);
		}
	}
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

XmppXepJingleStreamingConnection*
xmpp_xep_jingle_streaming_connection_construct (GType object_type)
{
	XmppXepJingleStreamingConnection * self = NULL;
	self = (XmppXepJingleStreamingConnection*) xmpp_xep_jingle_component_connection_construct (object_type);
	return self;
}

XmppXepJingleStreamingConnection*
xmpp_xep_jingle_streaming_connection_new (void)
{
	return xmpp_xep_jingle_streaming_connection_construct (XMPP_XEP_JINGLE_TYPE_STREAMING_CONNECTION);
}

GeeFuture*
xmpp_xep_jingle_streaming_connection_get_stream (XmppXepJingleStreamingConnection* self)
{
	GeeFuture* result;
	GeePromise* _tmp0_;
	GeeFuture* _tmp1_;
	GeeFuture* _tmp2_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->promise;
	_tmp1_ = gee_promise_get_future (_tmp0_);
	_tmp2_ = _tmp1_;
	result = _tmp2_;
	return result;
}

static void
xmpp_xep_jingle_streaming_connection_class_init (XmppXepJingleStreamingConnectionClass * klass,
                                                 gpointer klass_data)
{
	xmpp_xep_jingle_streaming_connection_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &XmppXepJingleStreamingConnection_private_offset);
	((XmppXepJingleComponentConnectionClass *) klass)->terminate = (void (*) (XmppXepJingleComponentConnection*, gboolean, const gchar*, const gchar*, GAsyncReadyCallback, gpointer)) xmpp_xep_jingle_streaming_connection_real_terminate;
	((XmppXepJingleComponentConnectionClass *) klass)->terminate_finish = (void (*) (XmppXepJingleComponentConnection*, GAsyncResult*)) xmpp_xep_jingle_streaming_connection_terminate_finish;
	G_OBJECT_CLASS (klass)->get_property = _vala_xmpp_xep_jingle_streaming_connection_get_property;
	G_OBJECT_CLASS (klass)->finalize = xmpp_xep_jingle_streaming_connection_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), XMPP_XEP_JINGLE_STREAMING_CONNECTION_STREAM_PROPERTY, xmpp_xep_jingle_streaming_connection_properties[XMPP_XEP_JINGLE_STREAMING_CONNECTION_STREAM_PROPERTY] = g_param_spec_object ("stream", "stream", "stream", GEE_TYPE_FUTURE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
}

static void
xmpp_xep_jingle_streaming_connection_instance_init (XmppXepJingleStreamingConnection * self,
                                                    gpointer klass)
{
	GeePromise* _tmp0_;
	self->priv = xmpp_xep_jingle_streaming_connection_get_instance_private (self);
	_tmp0_ = gee_promise_new (g_io_stream_get_type (), (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref);
	self->promise = _tmp0_;
	self->priv->terminated = NULL;
}

static void
xmpp_xep_jingle_streaming_connection_finalize (GObject * obj)
{
	XmppXepJingleStreamingConnection * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, XMPP_XEP_JINGLE_TYPE_STREAMING_CONNECTION, XmppXepJingleStreamingConnection);
	_gee_promise_unref0 (self->promise);
	_g_free0 (self->priv->terminated);
	G_OBJECT_CLASS (xmpp_xep_jingle_streaming_connection_parent_class)->finalize (obj);
}

static GType
xmpp_xep_jingle_streaming_connection_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (XmppXepJingleStreamingConnectionClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) xmpp_xep_jingle_streaming_connection_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (XmppXepJingleStreamingConnection), 0, (GInstanceInitFunc) xmpp_xep_jingle_streaming_connection_instance_init, NULL };
	GType xmpp_xep_jingle_streaming_connection_type_id;
	xmpp_xep_jingle_streaming_connection_type_id = g_type_register_static (XMPP_XEP_JINGLE_TYPE_COMPONENT_CONNECTION, "XmppXepJingleStreamingConnection", &g_define_type_info, 0);
	XmppXepJingleStreamingConnection_private_offset = g_type_add_instance_private (xmpp_xep_jingle_streaming_connection_type_id, sizeof (XmppXepJingleStreamingConnectionPrivate));
	return xmpp_xep_jingle_streaming_connection_type_id;
}

GType
xmpp_xep_jingle_streaming_connection_get_type (void)
{
	static volatile gsize xmpp_xep_jingle_streaming_connection_type_id__once = 0;
	if (g_once_init_enter (&xmpp_xep_jingle_streaming_connection_type_id__once)) {
		GType xmpp_xep_jingle_streaming_connection_type_id;
		xmpp_xep_jingle_streaming_connection_type_id = xmpp_xep_jingle_streaming_connection_get_type_once ();
		g_once_init_leave (&xmpp_xep_jingle_streaming_connection_type_id__once, xmpp_xep_jingle_streaming_connection_type_id);
	}
	return xmpp_xep_jingle_streaming_connection_type_id__once;
}

static void
_vala_xmpp_xep_jingle_streaming_connection_get_property (GObject * object,
                                                         guint property_id,
                                                         GValue * value,
                                                         GParamSpec * pspec)
{
	XmppXepJingleStreamingConnection * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, XMPP_XEP_JINGLE_TYPE_STREAMING_CONNECTION, XmppXepJingleStreamingConnection);
	switch (property_id) {
		case XMPP_XEP_JINGLE_STREAMING_CONNECTION_STREAM_PROPERTY:
		g_value_set_object (value, xmpp_xep_jingle_streaming_connection_get_stream (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static inline gpointer
_vala_memdup2 (gconstpointer mem,
               gsize byte_size)
{
	gpointer new_mem;
	if (mem && byte_size != 0) {
		new_mem = g_malloc (byte_size);
		memcpy (new_mem, mem, byte_size);
	} else {
		new_mem = NULL;
	}
	return new_mem;
}

