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

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

#define XMPP_XEP_SOCKS5_BYTESTREAMS_NS_URI "http://jabber.org/protocol/bytestreams"
#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_SOCKS5_BYTESTREAMS_PROXY_0_PROPERTY,
	XMPP_XEP_SOCKS5_BYTESTREAMS_PROXY_HOST_PROPERTY,
	XMPP_XEP_SOCKS5_BYTESTREAMS_PROXY_JID_PROPERTY,
	XMPP_XEP_SOCKS5_BYTESTREAMS_PROXY_PORT_PROPERTY,
	XMPP_XEP_SOCKS5_BYTESTREAMS_PROXY_NUM_PROPERTIES
};
static GParamSpec* xmpp_xep_socks5_bytestreams_proxy_properties[XMPP_XEP_SOCKS5_BYTESTREAMS_PROXY_NUM_PROPERTIES];
#define _g_free0(var) (var = (g_free (var), NULL))
#define _xmpp_jid_unref0(var) ((var == NULL) ? NULL : (var = (xmpp_jid_unref (var), NULL)))
enum  {
	XMPP_XEP_SOCKS5_BYTESTREAMS_MODULE_0_PROPERTY,
	XMPP_XEP_SOCKS5_BYTESTREAMS_MODULE_NUM_PROPERTIES
};
static GParamSpec* xmpp_xep_socks5_bytestreams_module_properties[XMPP_XEP_SOCKS5_BYTESTREAMS_MODULE_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _xmpp_xep_service_discovery_items_result_unref0(var) ((var == NULL) ? NULL : (var = (xmpp_xep_service_discovery_items_result_unref (var), NULL)))
#define _xmpp_xep_service_discovery_item_unref0(var) ((var == NULL) ? NULL : (var = (xmpp_xep_service_discovery_item_unref (var), NULL)))
#define _xmpp_stanza_entry_unref0(var) ((var == NULL) ? NULL : (var = (xmpp_stanza_entry_unref (var), NULL)))
typedef struct _XmppXepSocks5BytestreamsModuleQueryAvailabilityData XmppXepSocks5BytestreamsModuleQueryAvailabilityData;
enum  {
	XMPP_XEP_SOCKS5_BYTESTREAMS_FLAG_0_PROPERTY,
	XMPP_XEP_SOCKS5_BYTESTREAMS_FLAG_NUM_PROPERTIES
};
static GParamSpec* xmpp_xep_socks5_bytestreams_flag_properties[XMPP_XEP_SOCKS5_BYTESTREAMS_FLAG_NUM_PROPERTIES];

struct _XmppXepSocks5BytestreamsProxyPrivate {
	gchar* _host;
	XmppJid* _jid;
	gint _port;
};

struct _XmppXepSocks5BytestreamsModulePrivate {
	XmppXepSocks5BytestreamsGetLocalIpAddresses get_local_ip_addresses_impl;
	gpointer get_local_ip_addresses_impl_target;
	GDestroyNotify get_local_ip_addresses_impl_target_destroy_notify;
};

struct _XmppXepSocks5BytestreamsModuleQueryAvailabilityData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	XmppXepSocks5BytestreamsModule* self;
	XmppXmppStream* stream;
	XmppXepServiceDiscoveryItemsResult* items_result;
	XmppModuleIdentity* _tmp0_;
	gpointer _tmp1_;
	XmppXepServiceDiscoveryModule* _tmp2_;
	XmppJid* _tmp3_;
	XmppXepServiceDiscoveryItemsResult* _tmp4_;
	XmppXepServiceDiscoveryItemsResult* _tmp5_;
	XmppXepServiceDiscoveryItemsResult* _tmp6_;
	GeeArrayList* _item_list;
	XmppXepServiceDiscoveryItemsResult* _tmp7_;
	GeeArrayList* _tmp8_;
	GeeArrayList* _tmp9_;
	gint _item_size;
	GeeArrayList* _tmp10_;
	gint _tmp11_;
	gint _tmp12_;
	gint _item_index;
	gint _tmp13_;
	gint _tmp14_;
	XmppXepServiceDiscoveryItem* item;
	GeeArrayList* _tmp15_;
	gpointer _tmp16_;
	gboolean has_feature;
	XmppModuleIdentity* _tmp17_;
	gpointer _tmp18_;
	XmppXepServiceDiscoveryModule* _tmp19_;
	XmppXepServiceDiscoveryItem* _tmp20_;
	XmppJid* _tmp21_;
	gboolean _tmp22_;
	XmppStanzaNode* query_node;
	XmppStanzaNode* _tmp23_;
	XmppStanzaNode* _tmp24_;
	XmppStanzaNode* _tmp25_;
	XmppStanzaNode* _tmp26_;
	XmppIqStanza* iq;
	XmppStanzaNode* _tmp27_;
	XmppXepServiceDiscoveryItem* _tmp28_;
	XmppJid* _tmp29_;
	XmppJid* _tmp30_;
	XmppIqStanza* _tmp31_;
	XmppIqStanza* iq_result;
	XmppModuleIdentity* _tmp32_;
	gpointer _tmp33_;
	XmppIqModule* _tmp34_;
	XmppIqStanza* _tmp35_;
	XmppIqStanza* _tmp36_;
	XmppIqStanza* _tmp37_;
	XmppIqStanza* _tmp38_;
	XmppStanzaNode* query_result_node;
	XmppIqStanza* _tmp39_;
	XmppStanzaNode* _tmp40_;
	XmppStanzaNode* _tmp41_;
	XmppStanzaNode* _tmp42_;
	XmppStanzaNode* _tmp43_;
	XmppStanzaNode* _tmp44_;
	XmppStanzaNode* _tmp45_;
	XmppStanzaNode* stream_host;
	XmppStanzaNode* _tmp46_;
	gboolean _tmp47_;
	XmppStanzaNode* _tmp48_;
	XmppStanzaNode* _tmp49_;
	gchar* host;
	XmppStanzaNode* _tmp50_;
	const gchar* _tmp51_;
	gchar* _tmp52_;
	gchar* jid_str;
	XmppStanzaNode* _tmp53_;
	const gchar* _tmp54_;
	gchar* _tmp55_;
	XmppJid* jid;
	XmppJid* _tmp56_;
	const gchar* _tmp57_;
	const gchar* _tmp58_;
	XmppJid* _tmp59_;
	XmppJid* _tmp60_;
	gint port;
	XmppStanzaNode* _tmp61_;
	gboolean _tmp62_;
	gboolean _tmp63_;
	gboolean _tmp64_;
	const gchar* _tmp65_;
	XmppJid* _tmp66_;
	XmppFlagIdentity* _tmp67_;
	gpointer _tmp68_;
	XmppXepSocks5BytestreamsFlag* _tmp69_;
	GeeList* _tmp70_;
	const gchar* _tmp71_;
	XmppJid* _tmp72_;
	XmppXepSocks5BytestreamsProxy* _tmp73_;
	XmppXepSocks5BytestreamsProxy* _tmp74_;
	GError* _inner_error0_;
};

static gint XmppXepSocks5BytestreamsProxy_private_offset;
static gpointer xmpp_xep_socks5_bytestreams_proxy_parent_class = NULL;
static gint XmppXepSocks5BytestreamsModule_private_offset;
static gpointer xmpp_xep_socks5_bytestreams_module_parent_class = NULL;
XmppModuleIdentity* xmpp_xep_socks5_bytestreams_module_IDENTITY = NULL;
static XmppIqHandlerIface * xmpp_xep_socks5_bytestreams_module_xmpp_iq_handler_parent_iface = NULL;
static gpointer xmpp_xep_socks5_bytestreams_flag_parent_class = NULL;
XmppFlagIdentity* xmpp_xep_socks5_bytestreams_flag_IDENTITY = NULL;

static void xmpp_xep_socks5_bytestreams_proxy_set_host (XmppXepSocks5BytestreamsProxy* self,
                                                 const gchar* value);
static void xmpp_xep_socks5_bytestreams_proxy_set_jid (XmppXepSocks5BytestreamsProxy* self,
                                                XmppJid* value);
static void xmpp_xep_socks5_bytestreams_proxy_set_port (XmppXepSocks5BytestreamsProxy* self,
                                                 gint value);
static void xmpp_xep_socks5_bytestreams_proxy_finalize (GObject * obj);
static GType xmpp_xep_socks5_bytestreams_proxy_get_type_once (void);
static void _vala_xmpp_xep_socks5_bytestreams_proxy_get_property (GObject * object,
                                                           guint property_id,
                                                           GValue * value,
                                                           GParamSpec * pspec);
static void _vala_xmpp_xep_socks5_bytestreams_proxy_set_property (GObject * object,
                                                           guint property_id,
                                                           const GValue * value,
                                                           GParamSpec * pspec);
static void xmpp_xep_socks5_bytestreams_module_real_attach (XmppXmppStreamModule* base,
                                                     XmppXmppStream* stream);
static void xmpp_xep_socks5_bytestreams_module_query_availability (XmppXepSocks5BytestreamsModule* self,
                                                            XmppXmppStream* stream,
                                                            GAsyncReadyCallback _callback_,
                                                            gpointer _user_data_);
static void xmpp_xep_socks5_bytestreams_module_query_availability_finish (XmppXepSocks5BytestreamsModule* self,
                                                                   GAsyncResult* _res_);
static void xmpp_xep_socks5_bytestreams_module_real_detach (XmppXmppStreamModule* base,
                                                     XmppXmppStream* stream);
static void xmpp_xep_socks5_bytestreams_module_query_availability_data_free (gpointer _data);
static gboolean xmpp_xep_socks5_bytestreams_module_query_availability_co (XmppXepSocks5BytestreamsModuleQueryAvailabilityData* _data_);
static void xmpp_xep_socks5_bytestreams_module_query_availability_ready (GObject* source_object,
                                                                  GAsyncResult* _res_,
                                                                  gpointer _user_data_);
static gchar* xmpp_xep_socks5_bytestreams_module_real_get_ns (XmppXmppStreamModule* base);
static gchar* xmpp_xep_socks5_bytestreams_module_real_get_id (XmppXmppStreamModule* base);
static void xmpp_xep_socks5_bytestreams_module_finalize (GObject * obj);
static GType xmpp_xep_socks5_bytestreams_module_get_type_once (void);
static gchar* xmpp_xep_socks5_bytestreams_flag_real_get_ns (XmppXmppStreamFlag* base);
static gchar* xmpp_xep_socks5_bytestreams_flag_real_get_id (XmppXmppStreamFlag* base);
static void xmpp_xep_socks5_bytestreams_flag_finalize (GObject * obj);
static GType xmpp_xep_socks5_bytestreams_flag_get_type_once (void);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static inline gpointer
xmpp_xep_socks5_bytestreams_proxy_get_instance_private (XmppXepSocks5BytestreamsProxy* self)
{
	return G_STRUCT_MEMBER_P (self, XmppXepSocks5BytestreamsProxy_private_offset);
}

XmppXepSocks5BytestreamsProxy*
xmpp_xep_socks5_bytestreams_proxy_construct (GType object_type,
                                             const gchar* host,
                                             XmppJid* jid,
                                             gint port)
{
	XmppXepSocks5BytestreamsProxy * self = NULL;
	g_return_val_if_fail (host != NULL, NULL);
	g_return_val_if_fail (jid != NULL, NULL);
	self = (XmppXepSocks5BytestreamsProxy*) g_object_new (object_type, NULL);
	xmpp_xep_socks5_bytestreams_proxy_set_host (self, host);
	xmpp_xep_socks5_bytestreams_proxy_set_jid (self, jid);
	xmpp_xep_socks5_bytestreams_proxy_set_port (self, port);
	return self;
}

XmppXepSocks5BytestreamsProxy*
xmpp_xep_socks5_bytestreams_proxy_new (const gchar* host,
                                       XmppJid* jid,
                                       gint port)
{
	return xmpp_xep_socks5_bytestreams_proxy_construct (XMPP_XEP_SOCKS5_BYTESTREAMS_TYPE_PROXY, host, jid, port);
}

const gchar*
xmpp_xep_socks5_bytestreams_proxy_get_host (XmppXepSocks5BytestreamsProxy* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_host;
	result = _tmp0_;
	return result;
}

static void
xmpp_xep_socks5_bytestreams_proxy_set_host (XmppXepSocks5BytestreamsProxy* self,
                                            const gchar* value)
{
	gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = xmpp_xep_socks5_bytestreams_proxy_get_host (self);
	if (g_strcmp0 (value, old_value) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_host);
		self->priv->_host = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, xmpp_xep_socks5_bytestreams_proxy_properties[XMPP_XEP_SOCKS5_BYTESTREAMS_PROXY_HOST_PROPERTY]);
	}
}

XmppJid*
xmpp_xep_socks5_bytestreams_proxy_get_jid (XmppXepSocks5BytestreamsProxy* self)
{
	XmppJid* result;
	XmppJid* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_jid;
	result = _tmp0_;
	return result;
}

static gpointer
_xmpp_jid_ref0 (gpointer self)
{
	return self ? xmpp_jid_ref (self) : NULL;
}

static void
xmpp_xep_socks5_bytestreams_proxy_set_jid (XmppXepSocks5BytestreamsProxy* self,
                                           XmppJid* value)
{
	XmppJid* old_value;
	g_return_if_fail (self != NULL);
	old_value = xmpp_xep_socks5_bytestreams_proxy_get_jid (self);
	if (old_value != value) {
		XmppJid* _tmp0_;
		_tmp0_ = _xmpp_jid_ref0 (value);
		_xmpp_jid_unref0 (self->priv->_jid);
		self->priv->_jid = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, xmpp_xep_socks5_bytestreams_proxy_properties[XMPP_XEP_SOCKS5_BYTESTREAMS_PROXY_JID_PROPERTY]);
	}
}

gint
xmpp_xep_socks5_bytestreams_proxy_get_port (XmppXepSocks5BytestreamsProxy* self)
{
	gint result;
	g_return_val_if_fail (self != NULL, -1);
	result = self->priv->_port;
	return result;
}

static void
xmpp_xep_socks5_bytestreams_proxy_set_port (XmppXepSocks5BytestreamsProxy* self,
                                            gint value)
{
	gint old_value;
	g_return_if_fail (self != NULL);
	old_value = xmpp_xep_socks5_bytestreams_proxy_get_port (self);
	if (old_value != value) {
		self->priv->_port = value;
		g_object_notify_by_pspec ((GObject *) self, xmpp_xep_socks5_bytestreams_proxy_properties[XMPP_XEP_SOCKS5_BYTESTREAMS_PROXY_PORT_PROPERTY]);
	}
}

static void
xmpp_xep_socks5_bytestreams_proxy_class_init (XmppXepSocks5BytestreamsProxyClass * klass,
                                              gpointer klass_data)
{
	xmpp_xep_socks5_bytestreams_proxy_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &XmppXepSocks5BytestreamsProxy_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_xmpp_xep_socks5_bytestreams_proxy_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_xmpp_xep_socks5_bytestreams_proxy_set_property;
	G_OBJECT_CLASS (klass)->finalize = xmpp_xep_socks5_bytestreams_proxy_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), XMPP_XEP_SOCKS5_BYTESTREAMS_PROXY_HOST_PROPERTY, xmpp_xep_socks5_bytestreams_proxy_properties[XMPP_XEP_SOCKS5_BYTESTREAMS_PROXY_HOST_PROPERTY] = g_param_spec_string ("host", "host", "host", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), XMPP_XEP_SOCKS5_BYTESTREAMS_PROXY_JID_PROPERTY, xmpp_xep_socks5_bytestreams_proxy_properties[XMPP_XEP_SOCKS5_BYTESTREAMS_PROXY_JID_PROPERTY] = xmpp_param_spec_jid ("jid", "jid", "jid", XMPP_TYPE_JID, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), XMPP_XEP_SOCKS5_BYTESTREAMS_PROXY_PORT_PROPERTY, xmpp_xep_socks5_bytestreams_proxy_properties[XMPP_XEP_SOCKS5_BYTESTREAMS_PROXY_PORT_PROPERTY] = g_param_spec_int ("port", "port", "port", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
}

static void
xmpp_xep_socks5_bytestreams_proxy_instance_init (XmppXepSocks5BytestreamsProxy * self,
                                                 gpointer klass)
{
	self->priv = xmpp_xep_socks5_bytestreams_proxy_get_instance_private (self);
}

static void
xmpp_xep_socks5_bytestreams_proxy_finalize (GObject * obj)
{
	XmppXepSocks5BytestreamsProxy * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, XMPP_XEP_SOCKS5_BYTESTREAMS_TYPE_PROXY, XmppXepSocks5BytestreamsProxy);
	_g_free0 (self->priv->_host);
	_xmpp_jid_unref0 (self->priv->_jid);
	G_OBJECT_CLASS (xmpp_xep_socks5_bytestreams_proxy_parent_class)->finalize (obj);
}

static GType
xmpp_xep_socks5_bytestreams_proxy_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (XmppXepSocks5BytestreamsProxyClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) xmpp_xep_socks5_bytestreams_proxy_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (XmppXepSocks5BytestreamsProxy), 0, (GInstanceInitFunc) xmpp_xep_socks5_bytestreams_proxy_instance_init, NULL };
	GType xmpp_xep_socks5_bytestreams_proxy_type_id;
	xmpp_xep_socks5_bytestreams_proxy_type_id = g_type_register_static (G_TYPE_OBJECT, "XmppXepSocks5BytestreamsProxy", &g_define_type_info, 0);
	XmppXepSocks5BytestreamsProxy_private_offset = g_type_add_instance_private (xmpp_xep_socks5_bytestreams_proxy_type_id, sizeof (XmppXepSocks5BytestreamsProxyPrivate));
	return xmpp_xep_socks5_bytestreams_proxy_type_id;
}

GType
xmpp_xep_socks5_bytestreams_proxy_get_type (void)
{
	static volatile gsize xmpp_xep_socks5_bytestreams_proxy_type_id__once = 0;
	if (g_once_init_enter (&xmpp_xep_socks5_bytestreams_proxy_type_id__once)) {
		GType xmpp_xep_socks5_bytestreams_proxy_type_id;
		xmpp_xep_socks5_bytestreams_proxy_type_id = xmpp_xep_socks5_bytestreams_proxy_get_type_once ();
		g_once_init_leave (&xmpp_xep_socks5_bytestreams_proxy_type_id__once, xmpp_xep_socks5_bytestreams_proxy_type_id);
	}
	return xmpp_xep_socks5_bytestreams_proxy_type_id__once;
}

static void
_vala_xmpp_xep_socks5_bytestreams_proxy_get_property (GObject * object,
                                                      guint property_id,
                                                      GValue * value,
                                                      GParamSpec * pspec)
{
	XmppXepSocks5BytestreamsProxy * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, XMPP_XEP_SOCKS5_BYTESTREAMS_TYPE_PROXY, XmppXepSocks5BytestreamsProxy);
	switch (property_id) {
		case XMPP_XEP_SOCKS5_BYTESTREAMS_PROXY_HOST_PROPERTY:
		g_value_set_string (value, xmpp_xep_socks5_bytestreams_proxy_get_host (self));
		break;
		case XMPP_XEP_SOCKS5_BYTESTREAMS_PROXY_JID_PROPERTY:
		xmpp_value_set_jid (value, xmpp_xep_socks5_bytestreams_proxy_get_jid (self));
		break;
		case XMPP_XEP_SOCKS5_BYTESTREAMS_PROXY_PORT_PROPERTY:
		g_value_set_int (value, xmpp_xep_socks5_bytestreams_proxy_get_port (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_xmpp_xep_socks5_bytestreams_proxy_set_property (GObject * object,
                                                      guint property_id,
                                                      const GValue * value,
                                                      GParamSpec * pspec)
{
	XmppXepSocks5BytestreamsProxy * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, XMPP_XEP_SOCKS5_BYTESTREAMS_TYPE_PROXY, XmppXepSocks5BytestreamsProxy);
	switch (property_id) {
		case XMPP_XEP_SOCKS5_BYTESTREAMS_PROXY_HOST_PROPERTY:
		xmpp_xep_socks5_bytestreams_proxy_set_host (self, g_value_get_string (value));
		break;
		case XMPP_XEP_SOCKS5_BYTESTREAMS_PROXY_JID_PROPERTY:
		xmpp_xep_socks5_bytestreams_proxy_set_jid (self, xmpp_value_get_jid (value));
		break;
		case XMPP_XEP_SOCKS5_BYTESTREAMS_PROXY_PORT_PROPERTY:
		xmpp_xep_socks5_bytestreams_proxy_set_port (self, g_value_get_int (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static inline gpointer
xmpp_xep_socks5_bytestreams_module_get_instance_private (XmppXepSocks5BytestreamsModule* self)
{
	return G_STRUCT_MEMBER_P (self, XmppXepSocks5BytestreamsModule_private_offset);
}

static void
xmpp_xep_socks5_bytestreams_module_real_attach (XmppXmppStreamModule* base,
                                                XmppXmppStream* stream)
{
	XmppXepSocks5BytestreamsModule * self;
	XmppXepSocks5BytestreamsFlag* _tmp0_;
	XmppXepSocks5BytestreamsFlag* _tmp1_;
	self = (XmppXepSocks5BytestreamsModule*) base;
	g_return_if_fail (stream != NULL);
	_tmp0_ = xmpp_xep_socks5_bytestreams_flag_new ();
	_tmp1_ = _tmp0_;
	xmpp_xmpp_stream_add_flag (stream, (XmppXmppStreamFlag*) _tmp1_);
	_g_object_unref0 (_tmp1_);
	xmpp_xep_socks5_bytestreams_module_query_availability (self, stream, NULL, NULL);
}

static void
xmpp_xep_socks5_bytestreams_module_real_detach (XmppXmppStreamModule* base,
                                                XmppXmppStream* stream)
{
	XmppXepSocks5BytestreamsModule * self;
	self = (XmppXepSocks5BytestreamsModule*) base;
	g_return_if_fail (stream != NULL);
}

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

GeeList*
xmpp_xep_socks5_bytestreams_module_get_proxies (XmppXepSocks5BytestreamsModule* self,
                                                XmppXmppStream* stream)
{
	XmppFlagIdentity* _tmp0_;
	gpointer _tmp1_;
	XmppXepSocks5BytestreamsFlag* _tmp2_;
	GeeList* _tmp3_;
	GeeList* _tmp4_;
	GeeList* _tmp5_;
	GeeList* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (stream != NULL, NULL);
	_tmp0_ = xmpp_xep_socks5_bytestreams_flag_IDENTITY;
	_tmp1_ = xmpp_xmpp_stream_get_flag (stream, XMPP_XEP_SOCKS5_BYTESTREAMS_TYPE_FLAG, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _tmp0_);
	_tmp2_ = (XmppXepSocks5BytestreamsFlag*) _tmp1_;
	_tmp3_ = _tmp2_->proxies;
	_tmp4_ = _g_object_ref0 (_tmp3_);
	_tmp5_ = _tmp4_;
	_g_object_unref0 (_tmp2_);
	result = _tmp5_;
	return result;
}

void
xmpp_xep_socks5_bytestreams_module_set_local_ip_address_handler (XmppXepSocks5BytestreamsModule* self,
                                                                 XmppXepSocks5BytestreamsGetLocalIpAddresses get_local_ip_addresses,
                                                                 gpointer get_local_ip_addresses_target,
                                                                 GDestroyNotify get_local_ip_addresses_target_destroy_notify)
{
	XmppXepSocks5BytestreamsGetLocalIpAddresses _tmp0_;
	gpointer _tmp0__target;
	GDestroyNotify _tmp0__target_destroy_notify;
	g_return_if_fail (self != NULL);
	_tmp0_ = get_local_ip_addresses;
	_tmp0__target = get_local_ip_addresses_target;
	_tmp0__target_destroy_notify = get_local_ip_addresses_target_destroy_notify;
	get_local_ip_addresses = NULL;
	get_local_ip_addresses_target = NULL;
	get_local_ip_addresses_target_destroy_notify = NULL;
	(self->priv->get_local_ip_addresses_impl_target_destroy_notify == NULL) ? NULL : (self->priv->get_local_ip_addresses_impl_target_destroy_notify (self->priv->get_local_ip_addresses_impl_target), NULL);
	self->priv->get_local_ip_addresses_impl = NULL;
	self->priv->get_local_ip_addresses_impl_target = NULL;
	self->priv->get_local_ip_addresses_impl_target_destroy_notify = NULL;
	self->priv->get_local_ip_addresses_impl = _tmp0_;
	self->priv->get_local_ip_addresses_impl_target = _tmp0__target;
	self->priv->get_local_ip_addresses_impl_target_destroy_notify = _tmp0__target_destroy_notify;
	(get_local_ip_addresses_target_destroy_notify == NULL) ? NULL : (get_local_ip_addresses_target_destroy_notify (get_local_ip_addresses_target), NULL);
	get_local_ip_addresses = NULL;
	get_local_ip_addresses_target = NULL;
	get_local_ip_addresses_target_destroy_notify = NULL;
}

GeeList*
xmpp_xep_socks5_bytestreams_module_get_local_ip_addresses (XmppXepSocks5BytestreamsModule* self)
{
	XmppXepSocks5BytestreamsGetLocalIpAddresses _tmp0_;
	gpointer _tmp0__target;
	XmppXepSocks5BytestreamsGetLocalIpAddresses _tmp2_;
	gpointer _tmp2__target;
	GeeList* _tmp3_;
	GeeList* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->get_local_ip_addresses_impl;
	_tmp0__target = self->priv->get_local_ip_addresses_impl_target;
	if (_tmp0_ == NULL) {
		GeeList* _tmp1_;
		_tmp1_ = gee_list_empty (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free);
		result = _tmp1_;
		return result;
	}
	_tmp2_ = self->priv->get_local_ip_addresses_impl;
	_tmp2__target = self->priv->get_local_ip_addresses_impl_target;
	_tmp3_ = _tmp2_ (_tmp2__target);
	result = _tmp3_;
	return result;
}

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

static void
xmpp_xep_socks5_bytestreams_module_query_availability (XmppXepSocks5BytestreamsModule* self,
                                                       XmppXmppStream* stream,
                                                       GAsyncReadyCallback _callback_,
                                                       gpointer _user_data_)
{
	XmppXepSocks5BytestreamsModuleQueryAvailabilityData* _data_;
	XmppXepSocks5BytestreamsModule* _tmp0_;
	XmppXmppStream* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (stream != NULL);
	_data_ = g_slice_new0 (XmppXepSocks5BytestreamsModuleQueryAvailabilityData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, xmpp_xep_socks5_bytestreams_module_query_availability_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_socks5_bytestreams_module_query_availability_co (_data_);
}

static void
xmpp_xep_socks5_bytestreams_module_query_availability_finish (XmppXepSocks5BytestreamsModule* self,
                                                              GAsyncResult* _res_)
{
	XmppXepSocks5BytestreamsModuleQueryAvailabilityData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static void
xmpp_xep_socks5_bytestreams_module_query_availability_ready (GObject* source_object,
                                                             GAsyncResult* _res_,
                                                             gpointer _user_data_)
{
	XmppXepSocks5BytestreamsModuleQueryAvailabilityData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	xmpp_xep_socks5_bytestreams_module_query_availability_co (_data_);
}

static gboolean
xmpp_xep_socks5_bytestreams_module_query_availability_co (XmppXepSocks5BytestreamsModuleQueryAvailabilityData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		case 3:
		goto _state_3;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = xmpp_xep_service_discovery_module_IDENTITY;
	_data_->_tmp1_ = xmpp_xmpp_stream_get_module (_data_->stream, XMPP_XEP_SERVICE_DISCOVERY_TYPE_MODULE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _data_->_tmp0_);
	_data_->_tmp2_ = (XmppXepServiceDiscoveryModule*) _data_->_tmp1_;
	_data_->_tmp3_ = _data_->stream->remote_name;
	_data_->_state_ = 1;
	xmpp_xep_service_discovery_module_request_items (_data_->_tmp2_, _data_->stream, _data_->_tmp3_, xmpp_xep_socks5_bytestreams_module_query_availability_ready, _data_);
	return FALSE;
	_state_1:
	_data_->_tmp4_ = xmpp_xep_service_discovery_module_request_items_finish (_data_->_tmp2_, _data_->_res_);
	_data_->_tmp5_ = _data_->_tmp4_;
	_g_object_unref0 (_data_->_tmp2_);
	_data_->items_result = _data_->_tmp5_;
	_data_->_tmp6_ = _data_->items_result;
	if (_data_->_tmp6_ == NULL) {
		_xmpp_xep_service_discovery_items_result_unref0 (_data_->items_result);
		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_->_tmp7_ = _data_->items_result;
		_data_->_tmp8_ = xmpp_xep_service_discovery_items_result_get_items (_data_->_tmp7_);
		_data_->_tmp9_ = _data_->_tmp8_;
		_data_->_item_list = _data_->_tmp9_;
		_data_->_tmp10_ = _data_->_item_list;
		_data_->_tmp11_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _data_->_tmp10_);
		_data_->_tmp12_ = _data_->_tmp11_;
		_data_->_item_size = _data_->_tmp12_;
		_data_->_item_index = -1;
		while (TRUE) {
			_data_->_item_index = _data_->_item_index + 1;
			_data_->_tmp13_ = _data_->_item_index;
			_data_->_tmp14_ = _data_->_item_size;
			if (!(_data_->_tmp13_ < _data_->_tmp14_)) {
				break;
			}
			_data_->_tmp15_ = _data_->_item_list;
			_data_->_tmp16_ = gee_abstract_list_get ((GeeAbstractList*) _data_->_tmp15_, _data_->_item_index);
			_data_->item = (XmppXepServiceDiscoveryItem*) _data_->_tmp16_;
			_data_->_tmp17_ = xmpp_xep_service_discovery_module_IDENTITY;
			_data_->_tmp18_ = xmpp_xmpp_stream_get_module (_data_->stream, XMPP_XEP_SERVICE_DISCOVERY_TYPE_MODULE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _data_->_tmp17_);
			_data_->_tmp19_ = (XmppXepServiceDiscoveryModule*) _data_->_tmp18_;
			_data_->_tmp20_ = _data_->item;
			_data_->_tmp21_ = _data_->_tmp20_->jid;
			_data_->_state_ = 2;
			xmpp_xep_service_discovery_module_has_entity_feature (_data_->_tmp19_, _data_->stream, _data_->_tmp21_, XMPP_XEP_SOCKS5_BYTESTREAMS_NS_URI, xmpp_xep_socks5_bytestreams_module_query_availability_ready, _data_);
			return FALSE;
			_state_2:
			_data_->_tmp22_ = xmpp_xep_service_discovery_module_has_entity_feature_finish (_data_->_tmp19_, _data_->_res_);
			_g_object_unref0 (_data_->_tmp19_);
			_data_->has_feature = _data_->_tmp22_;
			if (!_data_->has_feature) {
				_xmpp_xep_service_discovery_item_unref0 (_data_->item);
				continue;
			}
			_data_->_tmp23_ = xmpp_stanza_node_new_build ("query", XMPP_XEP_SOCKS5_BYTESTREAMS_NS_URI, NULL, NULL);
			_data_->_tmp24_ = _data_->_tmp23_;
			_data_->_tmp25_ = xmpp_stanza_node_add_self_xmlns (_data_->_tmp24_);
			_data_->_tmp26_ = _data_->_tmp25_;
			_xmpp_stanza_entry_unref0 (_data_->_tmp24_);
			_data_->query_node = _data_->_tmp26_;
			_data_->_tmp27_ = _data_->query_node;
			_data_->_tmp28_ = _data_->item;
			_data_->_tmp29_ = _data_->_tmp28_->jid;
			_data_->_tmp30_ = _xmpp_jid_ref0 (_data_->_tmp29_);
			_data_->_tmp31_ = NULL;
			_data_->_tmp31_ = xmpp_iq_stanza_new_get (_data_->_tmp27_, NULL);
			xmpp_stanza_set_to ((XmppStanza*) _data_->_tmp31_, _data_->_tmp30_);
			_xmpp_jid_unref0 (_data_->_tmp30_);
			_data_->iq = _data_->_tmp31_;
			_data_->_tmp32_ = xmpp_iq_module_IDENTITY;
			_data_->_tmp33_ = xmpp_xmpp_stream_get_module (_data_->stream, XMPP_IQ_TYPE_MODULE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _data_->_tmp32_);
			_data_->_tmp34_ = (XmppIqModule*) _data_->_tmp33_;
			_data_->_tmp35_ = _data_->iq;
			_data_->_state_ = 3;
			xmpp_iq_module_send_iq_async (_data_->_tmp34_, _data_->stream, _data_->_tmp35_, G_PRIORITY_DEFAULT, NULL, xmpp_xep_socks5_bytestreams_module_query_availability_ready, _data_);
			return FALSE;
			_state_3:
			_data_->_tmp36_ = xmpp_iq_module_send_iq_finish (_data_->_tmp34_, _data_->_res_, &_data_->_inner_error0_);
			_data_->_tmp37_ = _data_->_tmp36_;
			_g_object_unref0 (_data_->_tmp34_);
			_data_->iq_result = _data_->_tmp37_;
			if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
				_g_object_unref0 (_data_->iq);
				_xmpp_stanza_entry_unref0 (_data_->query_node);
				_xmpp_xep_service_discovery_item_unref0 (_data_->item);
				_g_object_unref0 (_data_->_item_list);
				_xmpp_xep_service_discovery_items_result_unref0 (_data_->items_result);
				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;
			}
			_data_->_tmp38_ = _data_->iq_result;
			if (xmpp_stanza_is_error ((XmppStanza*) _data_->_tmp38_)) {
				_g_object_unref0 (_data_->iq_result);
				_g_object_unref0 (_data_->iq);
				_xmpp_stanza_entry_unref0 (_data_->query_node);
				_xmpp_xep_service_discovery_item_unref0 (_data_->item);
				continue;
			}
			_data_->_tmp39_ = _data_->iq_result;
			_data_->_tmp40_ = ((XmppStanza*) _data_->_tmp39_)->stanza;
			_data_->_tmp41_ = xmpp_stanza_node_get_subnode (_data_->_tmp40_, "query", XMPP_XEP_SOCKS5_BYTESTREAMS_NS_URI, FALSE);
			_data_->query_result_node = _data_->_tmp41_;
			_data_->_tmp43_ = _data_->query_result_node;
			if (_data_->_tmp43_ != NULL) {
				_data_->_tmp44_ = _data_->query_result_node;
				_data_->_tmp45_ = xmpp_stanza_node_get_subnode (_data_->_tmp44_, "streamhost", XMPP_XEP_SOCKS5_BYTESTREAMS_NS_URI, FALSE);
				_xmpp_stanza_entry_unref0 (_data_->_tmp42_);
				_data_->_tmp42_ = _data_->_tmp45_;
			} else {
				_xmpp_stanza_entry_unref0 (_data_->_tmp42_);
				_data_->_tmp42_ = NULL;
			}
			_data_->_tmp46_ = _data_->_tmp42_;
			_data_->_tmp42_ = NULL;
			_data_->stream_host = _data_->_tmp46_;
			_data_->_tmp48_ = _data_->query_result_node;
			if (_data_->_tmp48_ == NULL) {
				_data_->_tmp47_ = TRUE;
			} else {
				_data_->_tmp49_ = _data_->stream_host;
				_data_->_tmp47_ = _data_->_tmp49_ == NULL;
			}
			if (_data_->_tmp47_) {
				_xmpp_stanza_entry_unref0 (_data_->stream_host);
				_xmpp_stanza_entry_unref0 (_data_->_tmp42_);
				_xmpp_stanza_entry_unref0 (_data_->query_result_node);
				_g_object_unref0 (_data_->iq_result);
				_g_object_unref0 (_data_->iq);
				_xmpp_stanza_entry_unref0 (_data_->query_node);
				_xmpp_xep_service_discovery_item_unref0 (_data_->item);
				_g_object_unref0 (_data_->_item_list);
				_xmpp_xep_service_discovery_items_result_unref0 (_data_->items_result);
				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_->_tmp50_ = _data_->stream_host;
			_data_->_tmp51_ = xmpp_stanza_node_get_attribute (_data_->_tmp50_, "host", NULL);
			_data_->_tmp52_ = g_strdup (_data_->_tmp51_);
			_data_->host = _data_->_tmp52_;
			_data_->_tmp53_ = _data_->stream_host;
			_data_->_tmp54_ = xmpp_stanza_node_get_attribute (_data_->_tmp53_, "jid", NULL);
			_data_->_tmp55_ = g_strdup (_data_->_tmp54_);
			_data_->jid_str = _data_->_tmp55_;
			_data_->jid = NULL;
			{
				_data_->_tmp57_ = _data_->jid_str;
				if (_data_->_tmp57_ != NULL) {
					_data_->_tmp58_ = _data_->jid_str;
					_data_->_tmp59_ = xmpp_jid_new (_data_->_tmp58_, &_data_->_inner_error0_);
					_xmpp_jid_unref0 (_data_->_tmp56_);
					_data_->_tmp56_ = _data_->_tmp59_;
					if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
						_xmpp_jid_unref0 (_data_->_tmp56_);
						if (_data_->_inner_error0_->domain == XMPP_INVALID_JID_ERROR) {
							goto __catch0_xmpp_invalid_jid_error;
						}
						_xmpp_jid_unref0 (_data_->jid);
						_g_free0 (_data_->jid_str);
						_g_free0 (_data_->host);
						_xmpp_stanza_entry_unref0 (_data_->stream_host);
						_xmpp_stanza_entry_unref0 (_data_->_tmp42_);
						_xmpp_stanza_entry_unref0 (_data_->query_result_node);
						_g_object_unref0 (_data_->iq_result);
						_g_object_unref0 (_data_->iq);
						_xmpp_stanza_entry_unref0 (_data_->query_node);
						_xmpp_xep_service_discovery_item_unref0 (_data_->item);
						_g_object_unref0 (_data_->_item_list);
						_xmpp_xep_service_discovery_items_result_unref0 (_data_->items_result);
						g_critical ("file %s: line %d: unexpected 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 {
					_xmpp_jid_unref0 (_data_->_tmp56_);
					_data_->_tmp56_ = NULL;
				}
				_data_->_tmp60_ = _data_->_tmp56_;
				_data_->_tmp56_ = NULL;
				_xmpp_jid_unref0 (_data_->jid);
				_data_->jid = _data_->_tmp60_;
				_xmpp_jid_unref0 (_data_->_tmp56_);
			}
			goto __finally0;
			__catch0_xmpp_invalid_jid_error:
			{
				g_clear_error (&_data_->_inner_error0_);
			}
			__finally0:
			if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
				_xmpp_jid_unref0 (_data_->jid);
				_g_free0 (_data_->jid_str);
				_g_free0 (_data_->host);
				_xmpp_stanza_entry_unref0 (_data_->stream_host);
				_xmpp_stanza_entry_unref0 (_data_->_tmp42_);
				_xmpp_stanza_entry_unref0 (_data_->query_result_node);
				_g_object_unref0 (_data_->iq_result);
				_g_object_unref0 (_data_->iq);
				_xmpp_stanza_entry_unref0 (_data_->query_node);
				_xmpp_xep_service_discovery_item_unref0 (_data_->item);
				_g_object_unref0 (_data_->_item_list);
				_xmpp_xep_service_discovery_items_result_unref0 (_data_->items_result);
				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;
			}
			_data_->_tmp61_ = _data_->stream_host;
			_data_->port = xmpp_stanza_node_get_attribute_int (_data_->_tmp61_, "port", -1, NULL);
			_data_->_tmp65_ = _data_->host;
			if (_data_->_tmp65_ == NULL) {
				_data_->_tmp64_ = TRUE;
			} else {
				_data_->_tmp66_ = _data_->jid;
				_data_->_tmp64_ = _data_->_tmp66_ == NULL;
			}
			if (_data_->_tmp64_) {
				_data_->_tmp63_ = TRUE;
			} else {
				_data_->_tmp63_ = _data_->port <= 0;
			}
			if (_data_->_tmp63_) {
				_data_->_tmp62_ = TRUE;
			} else {
				_data_->_tmp62_ = _data_->port > 65535;
			}
			if (_data_->_tmp62_) {
				_xmpp_jid_unref0 (_data_->jid);
				_g_free0 (_data_->jid_str);
				_g_free0 (_data_->host);
				_xmpp_stanza_entry_unref0 (_data_->stream_host);
				_xmpp_stanza_entry_unref0 (_data_->_tmp42_);
				_xmpp_stanza_entry_unref0 (_data_->query_result_node);
				_g_object_unref0 (_data_->iq_result);
				_g_object_unref0 (_data_->iq);
				_xmpp_stanza_entry_unref0 (_data_->query_node);
				_xmpp_xep_service_discovery_item_unref0 (_data_->item);
				continue;
			}
			_data_->_tmp67_ = xmpp_xep_socks5_bytestreams_flag_IDENTITY;
			_data_->_tmp68_ = xmpp_xmpp_stream_get_flag (_data_->stream, XMPP_XEP_SOCKS5_BYTESTREAMS_TYPE_FLAG, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _data_->_tmp67_);
			_data_->_tmp69_ = (XmppXepSocks5BytestreamsFlag*) _data_->_tmp68_;
			_data_->_tmp70_ = _data_->_tmp69_->proxies;
			_data_->_tmp71_ = _data_->host;
			_data_->_tmp72_ = _data_->jid;
			_data_->_tmp73_ = xmpp_xep_socks5_bytestreams_proxy_new (_data_->_tmp71_, _data_->_tmp72_, _data_->port);
			_data_->_tmp74_ = _data_->_tmp73_;
			gee_collection_add ((GeeCollection*) _data_->_tmp70_, _data_->_tmp74_);
			_g_object_unref0 (_data_->_tmp74_);
			_g_object_unref0 (_data_->_tmp69_);
			_xmpp_jid_unref0 (_data_->jid);
			_g_free0 (_data_->jid_str);
			_g_free0 (_data_->host);
			_xmpp_stanza_entry_unref0 (_data_->stream_host);
			_xmpp_stanza_entry_unref0 (_data_->_tmp42_);
			_xmpp_stanza_entry_unref0 (_data_->query_result_node);
			_g_object_unref0 (_data_->iq_result);
			_g_object_unref0 (_data_->iq);
			_xmpp_stanza_entry_unref0 (_data_->query_node);
			_xmpp_xep_service_discovery_item_unref0 (_data_->item);
		}
		_g_object_unref0 (_data_->_item_list);
	}
	_xmpp_xep_service_discovery_items_result_unref0 (_data_->items_result);
	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 gchar*
xmpp_xep_socks5_bytestreams_module_real_get_ns (XmppXmppStreamModule* base)
{
	XmppXepSocks5BytestreamsModule * self;
	gchar* _tmp0_;
	gchar* result;
	self = (XmppXepSocks5BytestreamsModule*) base;
	_tmp0_ = g_strdup (XMPP_XEP_SOCKS5_BYTESTREAMS_NS_URI);
	result = _tmp0_;
	return result;
}

static gchar*
xmpp_xep_socks5_bytestreams_module_real_get_id (XmppXmppStreamModule* base)
{
	XmppXepSocks5BytestreamsModule * self;
	XmppModuleIdentity* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* result;
	self = (XmppXepSocks5BytestreamsModule*) base;
	_tmp0_ = xmpp_xep_socks5_bytestreams_module_IDENTITY;
	_tmp1_ = xmpp_module_identity_get_id (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = g_strdup (_tmp2_);
	result = _tmp3_;
	return result;
}

XmppXepSocks5BytestreamsModule*
xmpp_xep_socks5_bytestreams_module_construct (GType object_type)
{
	XmppXepSocks5BytestreamsModule * self = NULL;
	self = (XmppXepSocks5BytestreamsModule*) xmpp_xmpp_stream_module_construct (object_type);
	return self;
}

XmppXepSocks5BytestreamsModule*
xmpp_xep_socks5_bytestreams_module_new (void)
{
	return xmpp_xep_socks5_bytestreams_module_construct (XMPP_XEP_SOCKS5_BYTESTREAMS_TYPE_MODULE);
}

static void
xmpp_xep_socks5_bytestreams_module_class_init (XmppXepSocks5BytestreamsModuleClass * klass,
                                               gpointer klass_data)
{
	XmppModuleIdentity* _tmp0_;
	xmpp_xep_socks5_bytestreams_module_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &XmppXepSocks5BytestreamsModule_private_offset);
	((XmppXmppStreamModuleClass *) klass)->attach = (void (*) (XmppXmppStreamModule*, XmppXmppStream*)) xmpp_xep_socks5_bytestreams_module_real_attach;
	((XmppXmppStreamModuleClass *) klass)->detach = (void (*) (XmppXmppStreamModule*, XmppXmppStream*)) xmpp_xep_socks5_bytestreams_module_real_detach;
	((XmppXmppStreamModuleClass *) klass)->get_ns = (gchar* (*) (XmppXmppStreamModule*)) xmpp_xep_socks5_bytestreams_module_real_get_ns;
	((XmppXmppStreamModuleClass *) klass)->get_id = (gchar* (*) (XmppXmppStreamModule*)) xmpp_xep_socks5_bytestreams_module_real_get_id;
	G_OBJECT_CLASS (klass)->finalize = xmpp_xep_socks5_bytestreams_module_finalize;
	_tmp0_ = xmpp_module_identity_new (XMPP_XEP_SOCKS5_BYTESTREAMS_TYPE_MODULE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, XMPP_XEP_SOCKS5_BYTESTREAMS_NS_URI, "0065_socks5_bytestreams");
	xmpp_xep_socks5_bytestreams_module_IDENTITY = _tmp0_;
}

static void
xmpp_xep_socks5_bytestreams_module_xmpp_iq_handler_interface_init (XmppIqHandlerIface * iface,
                                                                   gpointer iface_data)
{
	xmpp_xep_socks5_bytestreams_module_xmpp_iq_handler_parent_iface = g_type_interface_peek_parent (iface);
}

static void
xmpp_xep_socks5_bytestreams_module_instance_init (XmppXepSocks5BytestreamsModule * self,
                                                  gpointer klass)
{
	self->priv = xmpp_xep_socks5_bytestreams_module_get_instance_private (self);
	self->priv->get_local_ip_addresses_impl = NULL;
	self->priv->get_local_ip_addresses_impl_target = NULL;
	self->priv->get_local_ip_addresses_impl_target_destroy_notify = NULL;
}

static void
xmpp_xep_socks5_bytestreams_module_finalize (GObject * obj)
{
	XmppXepSocks5BytestreamsModule * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, XMPP_XEP_SOCKS5_BYTESTREAMS_TYPE_MODULE, XmppXepSocks5BytestreamsModule);
	(self->priv->get_local_ip_addresses_impl_target_destroy_notify == NULL) ? NULL : (self->priv->get_local_ip_addresses_impl_target_destroy_notify (self->priv->get_local_ip_addresses_impl_target), NULL);
	self->priv->get_local_ip_addresses_impl = NULL;
	self->priv->get_local_ip_addresses_impl_target = NULL;
	self->priv->get_local_ip_addresses_impl_target_destroy_notify = NULL;
	G_OBJECT_CLASS (xmpp_xep_socks5_bytestreams_module_parent_class)->finalize (obj);
}

static GType
xmpp_xep_socks5_bytestreams_module_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (XmppXepSocks5BytestreamsModuleClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) xmpp_xep_socks5_bytestreams_module_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (XmppXepSocks5BytestreamsModule), 0, (GInstanceInitFunc) xmpp_xep_socks5_bytestreams_module_instance_init, NULL };
	static const GInterfaceInfo xmpp_iq_handler_info = { (GInterfaceInitFunc) xmpp_xep_socks5_bytestreams_module_xmpp_iq_handler_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	GType xmpp_xep_socks5_bytestreams_module_type_id;
	xmpp_xep_socks5_bytestreams_module_type_id = g_type_register_static (XMPP_TYPE_XMPP_STREAM_MODULE, "XmppXepSocks5BytestreamsModule", &g_define_type_info, 0);
	g_type_add_interface_static (xmpp_xep_socks5_bytestreams_module_type_id, XMPP_IQ_TYPE_HANDLER, &xmpp_iq_handler_info);
	XmppXepSocks5BytestreamsModule_private_offset = g_type_add_instance_private (xmpp_xep_socks5_bytestreams_module_type_id, sizeof (XmppXepSocks5BytestreamsModulePrivate));
	return xmpp_xep_socks5_bytestreams_module_type_id;
}

GType
xmpp_xep_socks5_bytestreams_module_get_type (void)
{
	static volatile gsize xmpp_xep_socks5_bytestreams_module_type_id__once = 0;
	if (g_once_init_enter (&xmpp_xep_socks5_bytestreams_module_type_id__once)) {
		GType xmpp_xep_socks5_bytestreams_module_type_id;
		xmpp_xep_socks5_bytestreams_module_type_id = xmpp_xep_socks5_bytestreams_module_get_type_once ();
		g_once_init_leave (&xmpp_xep_socks5_bytestreams_module_type_id__once, xmpp_xep_socks5_bytestreams_module_type_id);
	}
	return xmpp_xep_socks5_bytestreams_module_type_id__once;
}

static gchar*
xmpp_xep_socks5_bytestreams_flag_real_get_ns (XmppXmppStreamFlag* base)
{
	XmppXepSocks5BytestreamsFlag * self;
	gchar* _tmp0_;
	gchar* result;
	self = (XmppXepSocks5BytestreamsFlag*) base;
	_tmp0_ = g_strdup (XMPP_XEP_SOCKS5_BYTESTREAMS_NS_URI);
	result = _tmp0_;
	return result;
}

static gchar*
xmpp_xep_socks5_bytestreams_flag_real_get_id (XmppXmppStreamFlag* base)
{
	XmppXepSocks5BytestreamsFlag * self;
	XmppFlagIdentity* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* result;
	self = (XmppXepSocks5BytestreamsFlag*) base;
	_tmp0_ = xmpp_xep_socks5_bytestreams_flag_IDENTITY;
	_tmp1_ = xmpp_flag_identity_get_id (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = g_strdup (_tmp2_);
	result = _tmp3_;
	return result;
}

XmppXepSocks5BytestreamsFlag*
xmpp_xep_socks5_bytestreams_flag_construct (GType object_type)
{
	XmppXepSocks5BytestreamsFlag * self = NULL;
	self = (XmppXepSocks5BytestreamsFlag*) xmpp_xmpp_stream_flag_construct (object_type);
	return self;
}

XmppXepSocks5BytestreamsFlag*
xmpp_xep_socks5_bytestreams_flag_new (void)
{
	return xmpp_xep_socks5_bytestreams_flag_construct (XMPP_XEP_SOCKS5_BYTESTREAMS_TYPE_FLAG);
}

static void
xmpp_xep_socks5_bytestreams_flag_class_init (XmppXepSocks5BytestreamsFlagClass * klass,
                                             gpointer klass_data)
{
	XmppFlagIdentity* _tmp0_;
	xmpp_xep_socks5_bytestreams_flag_parent_class = g_type_class_peek_parent (klass);
	((XmppXmppStreamFlagClass *) klass)->get_ns = (gchar* (*) (XmppXmppStreamFlag*)) xmpp_xep_socks5_bytestreams_flag_real_get_ns;
	((XmppXmppStreamFlagClass *) klass)->get_id = (gchar* (*) (XmppXmppStreamFlag*)) xmpp_xep_socks5_bytestreams_flag_real_get_id;
	G_OBJECT_CLASS (klass)->finalize = xmpp_xep_socks5_bytestreams_flag_finalize;
	_tmp0_ = xmpp_flag_identity_new (XMPP_XEP_SOCKS5_BYTESTREAMS_TYPE_FLAG, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, XMPP_XEP_SOCKS5_BYTESTREAMS_NS_URI, "socks5_bytestreams");
	xmpp_xep_socks5_bytestreams_flag_IDENTITY = _tmp0_;
}

static void
xmpp_xep_socks5_bytestreams_flag_instance_init (XmppXepSocks5BytestreamsFlag * self,
                                                gpointer klass)
{
	GeeArrayList* _tmp0_;
	_tmp0_ = gee_array_list_new (XMPP_XEP_SOCKS5_BYTESTREAMS_TYPE_PROXY, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
	self->proxies = (GeeList*) _tmp0_;
}

static void
xmpp_xep_socks5_bytestreams_flag_finalize (GObject * obj)
{
	XmppXepSocks5BytestreamsFlag * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, XMPP_XEP_SOCKS5_BYTESTREAMS_TYPE_FLAG, XmppXepSocks5BytestreamsFlag);
	_g_object_unref0 (self->proxies);
	G_OBJECT_CLASS (xmpp_xep_socks5_bytestreams_flag_parent_class)->finalize (obj);
}

static GType
xmpp_xep_socks5_bytestreams_flag_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (XmppXepSocks5BytestreamsFlagClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) xmpp_xep_socks5_bytestreams_flag_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (XmppXepSocks5BytestreamsFlag), 0, (GInstanceInitFunc) xmpp_xep_socks5_bytestreams_flag_instance_init, NULL };
	GType xmpp_xep_socks5_bytestreams_flag_type_id;
	xmpp_xep_socks5_bytestreams_flag_type_id = g_type_register_static (XMPP_TYPE_XMPP_STREAM_FLAG, "XmppXepSocks5BytestreamsFlag", &g_define_type_info, 0);
	return xmpp_xep_socks5_bytestreams_flag_type_id;
}

GType
xmpp_xep_socks5_bytestreams_flag_get_type (void)
{
	static volatile gsize xmpp_xep_socks5_bytestreams_flag_type_id__once = 0;
	if (g_once_init_enter (&xmpp_xep_socks5_bytestreams_flag_type_id__once)) {
		GType xmpp_xep_socks5_bytestreams_flag_type_id;
		xmpp_xep_socks5_bytestreams_flag_type_id = xmpp_xep_socks5_bytestreams_flag_get_type_once ();
		g_once_init_leave (&xmpp_xep_socks5_bytestreams_flag_type_id__once, xmpp_xep_socks5_bytestreams_flag_type_id);
	}
	return xmpp_xep_socks5_bytestreams_flag_type_id__once;
}

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;
}

