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

#include "ice.h"
#include <nice.h>
#include <glib.h>
#include <gee.h>
#include <glib-object.h>
#include "xmpp-vala.h"
#include <stdlib.h>
#include <string.h>
#include <gio/gio.h>
#include "crypto-vala.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

#define DINO_PLUGINS_ICE_TRANSPORT_PARAMETERS_TYPE_DATAGRAM_CONNECTION (dino_plugins_ice_transport_parameters_datagram_connection_get_type ())
#define DINO_PLUGINS_ICE_TRANSPORT_PARAMETERS_DATAGRAM_CONNECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), DINO_PLUGINS_ICE_TRANSPORT_PARAMETERS_TYPE_DATAGRAM_CONNECTION, DinoPluginsIceTransportParametersDatagramConnection))
#define DINO_PLUGINS_ICE_TRANSPORT_PARAMETERS_DATAGRAM_CONNECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), DINO_PLUGINS_ICE_TRANSPORT_PARAMETERS_TYPE_DATAGRAM_CONNECTION, DinoPluginsIceTransportParametersDatagramConnectionClass))
#define DINO_PLUGINS_ICE_TRANSPORT_PARAMETERS_IS_DATAGRAM_CONNECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DINO_PLUGINS_ICE_TRANSPORT_PARAMETERS_TYPE_DATAGRAM_CONNECTION))
#define DINO_PLUGINS_ICE_TRANSPORT_PARAMETERS_IS_DATAGRAM_CONNECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DINO_PLUGINS_ICE_TRANSPORT_PARAMETERS_TYPE_DATAGRAM_CONNECTION))
#define DINO_PLUGINS_ICE_TRANSPORT_PARAMETERS_DATAGRAM_CONNECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), DINO_PLUGINS_ICE_TRANSPORT_PARAMETERS_TYPE_DATAGRAM_CONNECTION, DinoPluginsIceTransportParametersDatagramConnectionClass))

typedef struct _DinoPluginsIceTransportParametersDatagramConnection DinoPluginsIceTransportParametersDatagramConnection;
typedef struct _DinoPluginsIceTransportParametersDatagramConnectionClass DinoPluginsIceTransportParametersDatagramConnectionClass;
enum  {
	DINO_PLUGINS_ICE_TRANSPORT_PARAMETERS_0_PROPERTY,
	DINO_PLUGINS_ICE_TRANSPORT_PARAMETERS_NUM_PROPERTIES
};
static GParamSpec* dino_plugins_ice_transport_parameters_properties[DINO_PLUGINS_ICE_TRANSPORT_PARAMETERS_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _dino_plugins_ice_dtls_srtp_handler_unref0(var) ((var == NULL) ? NULL : (var = (dino_plugins_ice_dtls_srtp_handler_unref (var), NULL)))
#define _g_main_context_unref0(var) ((var == NULL) ? NULL : (var = (g_main_context_unref (var), NULL)))
#define _g_main_loop_unref0(var) ((var == NULL) ? NULL : (var = (g_main_loop_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_thread_unref0(var) ((var == NULL) ? NULL : (var = (g_thread_unref (var), NULL)))
typedef struct _Block3Data Block3Data;
#define _xmpp_xep_jingle_ice_udp_candidate_unref0(var) ((var == NULL) ? NULL : (var = (xmpp_xep_jingle_ice_udp_candidate_unref (var), NULL)))
#define _nice_candidate_free0(var) ((var == NULL) ? NULL : (var = (nice_candidate_free (var), NULL)))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
#define _g_bytes_unref0(var) ((var == NULL) ? NULL : (var = (g_bytes_unref (var), NULL)))
typedef struct _DinoPluginsIceTransportParametersDatagramConnectionPrivate DinoPluginsIceTransportParametersDatagramConnectionPrivate;
enum  {
	DINO_PLUGINS_ICE_TRANSPORT_PARAMETERS_DATAGRAM_CONNECTION_0_PROPERTY,
	DINO_PLUGINS_ICE_TRANSPORT_PARAMETERS_DATAGRAM_CONNECTION_NUM_PROPERTIES
};
static GParamSpec* dino_plugins_ice_transport_parameters_datagram_connection_properties[DINO_PLUGINS_ICE_TRANSPORT_PARAMETERS_DATAGRAM_CONNECTION_NUM_PROPERTIES];
typedef struct _DinoPluginsIceTransportParametersDatagramConnectionTerminateData DinoPluginsIceTransportParametersDatagramConnectionTerminateData;

struct _DinoPluginsIceTransportParametersPrivate {
	NiceAgent* agent;
	guint stream_id;
	gboolean we_want_connection;
	gboolean remote_credentials_set;
	GeeMap* connections;
	DinoPluginsIceDtlsSrtpHandler* dtls_srtp_handler;
	GMainContext* thread_context;
	GMainLoop* thread_loop;
};

struct _Block3Data {
	int _ref_count_;
	GWeakRef weak_self;
};

struct _DinoPluginsIceTransportParametersDatagramConnection {
	XmppXepJingleDatagramConnection parent_instance;
	DinoPluginsIceTransportParametersDatagramConnectionPrivate * priv;
};

struct _DinoPluginsIceTransportParametersDatagramConnectionClass {
	XmppXepJingleDatagramConnectionClass parent_class;
};

struct _DinoPluginsIceTransportParametersDatagramConnectionPrivate {
	NiceAgent* agent;
	DinoPluginsIceDtlsSrtpHandler* dtls_srtp_handler;
	guint stream_id;
	gchar* error;
	gulong datagram_received_id;
};

struct _DinoPluginsIceTransportParametersDatagramConnectionTerminateData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	DinoPluginsIceTransportParametersDatagramConnection* self;
	gboolean we_terminated;
	gchar* reason_string;
	gchar* reason_text;
};

static gint DinoPluginsIceTransportParameters_private_offset;
static gpointer dino_plugins_ice_transport_parameters_parent_class = NULL;
static gint DinoPluginsIceTransportParametersDatagramConnection_private_offset;
static gpointer dino_plugins_ice_transport_parameters_datagram_connection_parent_class = NULL;

static GType dino_plugins_ice_transport_parameters_datagram_connection_get_type (void) G_GNUC_CONST  G_GNUC_UNUSED ;
static DinoPluginsIceDtlsSrtpHandler* dino_plugins_ice_transport_parameters_setup_dtls (DinoPluginsIceTransportParameters* tp,
                                                                                 DinoPluginsIceDtlsSrtpCredentialsCapsule* credentials);
static guint8* _vala_array_dup6 (guint8* self,
                          gssize length);
static void ____lambda7_ (DinoPluginsIceTransportParameters* self,
                   GObject* _,
                   GAsyncResult* res);
static void _____lambda7__gasync_ready_callback (GObject* source_object,
                                          GAsyncResult* res,
                                          gpointer self);
static void dino_plugins_ice_transport_parameters_on_candidate_gathering_done (DinoPluginsIceTransportParameters* self,
                                                                        guint stream_id);
static void _dino_plugins_ice_transport_parameters_on_candidate_gathering_done_nice_agent_candidate_gathering_done (NiceAgent* _sender,
                                                                                                             guint stream_id,
                                                                                                             gpointer self);
static void dino_plugins_ice_transport_parameters_on_initial_binding_request_received (DinoPluginsIceTransportParameters* self,
                                                                                guint stream_id);
static void _dino_plugins_ice_transport_parameters_on_initial_binding_request_received_nice_agent_initial_binding_request_received (NiceAgent* _sender,
                                                                                                                             guint stream_id,
                                                                                                                             gpointer self);
static void dino_plugins_ice_transport_parameters_on_component_state_changed (DinoPluginsIceTransportParameters* self,
                                                                       guint stream_id,
                                                                       guint component_id,
                                                                       guint state);
static void _dino_plugins_ice_transport_parameters_on_component_state_changed_nice_agent_component_state_changed (NiceAgent* _sender,
                                                                                                           guint stream_id,
                                                                                                           guint component_id,
                                                                                                           guint state,
                                                                                                           gpointer self);
static void dino_plugins_ice_transport_parameters_on_new_selected_pair_full (DinoPluginsIceTransportParameters* self,
                                                                      guint stream_id,
                                                                      guint component_id,
                                                                      NiceCandidate* p1,
                                                                      NiceCandidate* p2);
static void _dino_plugins_ice_transport_parameters_on_new_selected_pair_full_nice_agent_new_selected_pair_full (NiceAgent* _sender,
                                                                                                         guint stream_id,
                                                                                                         guint component_id,
                                                                                                         NiceCandidate* lcandidate,
                                                                                                         NiceCandidate* rcandidate,
                                                                                                         gpointer self);
static void dino_plugins_ice_transport_parameters_on_new_candidate (DinoPluginsIceTransportParameters* self,
                                                             NiceCandidate* nc);
static void _dino_plugins_ice_transport_parameters_on_new_candidate_nice_agent_new_candidate_full (NiceAgent* _sender,
                                                                                            NiceCandidate* candidate,
                                                                                            gpointer self);
static void* __lambda9_ (DinoPluginsIceTransportParameters* self);
static gpointer ___lambda9__gthread_func (gpointer self);
static void dino_plugins_ice_transport_parameters_on_recv (DinoPluginsIceTransportParameters* self,
                                                    NiceAgent* agent,
                                                    guint stream_id,
                                                    guint component_id,
                                                    guint8* data,
                                                    gint data_length1);
static void _dino_plugins_ice_transport_parameters_on_recv_nice_agent_recv_func (NiceAgent* agent,
                                                                          guint stream_id,
                                                                          guint component_id,
                                                                          guint len,
                                                                          gchar* buf,
                                                                          gpointer self);
static Block3Data* block3_data_ref (Block3Data* _data3_);
static void block3_data_unref (void * _userdata_);
static void __lambda6_ (Block3Data* _data3_,
                 guint8* data,
                 gint data_length1);
static void ___lambda6__dino_plugins_ice_dtls_srtp_handler_send_data (DinoPluginsIceDtlsSrtpHandler* _sender,
                                                               guint8* data,
                                                               gint data_length1,
                                                               gpointer self);
static XmppXepJingleIceUdpCandidate* dino_plugins_ice_transport_parameters_candidate_to_jingle (NiceCandidate* nc);
static void _nice_candidate_free0_ (gpointer var);
static inline void _g_slist_free__nice_candidate_free0_ (GSList* self);
static gboolean dino_plugins_ice_transport_parameters_bytes_equal (DinoPluginsIceTransportParameters* self,
                                                            guint8* a1,
                                                            gint a1_length1,
                                                            guint8* a2,
                                                            gint a2_length1);
static void dino_plugins_ice_transport_parameters_real_handle_transport_accept (XmppXepJingleIceUdpIceUdpTransportParameters* base,
                                                                         XmppStanzaNode* transport,
                                                                         GError** error);
static guint8* _vala_array_dup7 (guint8* self,
                          gssize length);
static void ____lambda10_ (DinoPluginsIceTransportParameters* self,
                    GObject* _,
                    GAsyncResult* res);
static void _____lambda10__gasync_ready_callback (GObject* source_object,
                                           GAsyncResult* res,
                                           gpointer self);
static void dino_plugins_ice_transport_parameters_real_handle_transport_info (XmppXepJingleIceUdpIceUdpTransportParameters* base,
                                                                       XmppStanzaNode* transport,
                                                                       GError** error);
static guint8* _vala_array_dup8 (guint8* self,
                          gssize length);
static NiceCandidate* dino_plugins_ice_transport_parameters_candidate_to_nice (XmppXepJingleIceUdpCandidate* c);
static void dino_plugins_ice_transport_parameters_real_create_transport_connection (XmppXepJingleIceUdpIceUdpTransportParameters* base,
                                                                             XmppXmppStream* stream,
                                                                             XmppXepJingleContent* content);
static DinoPluginsIceTransportParametersDatagramConnection* dino_plugins_ice_transport_parameters_datagram_connection_new (NiceAgent* agent,
                                                                                                                    DinoPluginsIceDtlsSrtpHandler* dtls_srtp_handler,
                                                                                                                    guint stream_id,
                                                                                                                    guint8 component_id);
static DinoPluginsIceTransportParametersDatagramConnection* dino_plugins_ice_transport_parameters_datagram_connection_construct (GType object_type,
                                                                                                                          NiceAgent* agent,
                                                                                                                          DinoPluginsIceDtlsSrtpHandler* dtls_srtp_handler,
                                                                                                                          guint stream_id,
                                                                                                                          guint8 component_id);
static void dino_plugins_ice_transport_parameters_may_consider_ready (DinoPluginsIceTransportParameters* self,
                                                               guint stream_id,
                                                               guint component_id);
VALA_EXTERN gboolean dino_plugins_ice_is_component_ready (NiceAgent* agent,
                                              guint stream_id,
                                              guint component_id);
static void ___lambda8_ (DinoPluginsIceTransportParameters* self,
                  GObject* _,
                  GAsyncResult* res);
static void ____lambda8__gasync_ready_callback (GObject* source_object,
                                         GAsyncResult* res,
                                         gpointer self);
static void dino_plugins_ice_transport_parameters_real_dispose (GObject* base);
static void __lambda5_ (DinoPluginsIceTransportParametersDatagramConnection* self,
                 GBytes* datagram);
static void ___lambda5__xmpp_xep_jingle_datagram_connection_datagram_received (XmppXepJingleDatagramConnection* _sender,
                                                                        GBytes* datagram,
                                                                        gpointer self);
static void dino_plugins_ice_transport_parameters_datagram_connection_real_terminate_data_free (gpointer _data);
static void dino_plugins_ice_transport_parameters_datagram_connection_real_terminate (XmppXepJingleComponentConnection* base,
                                                                               gboolean we_terminated,
                                                                               const gchar* reason_string,
                                                                               const gchar* reason_text,
                                                                               GAsyncReadyCallback _callback_,
                                                                               gpointer _user_data_);
static gboolean dino_plugins_ice_transport_parameters_datagram_connection_real_terminate_co (DinoPluginsIceTransportParametersDatagramConnectionTerminateData* _data_);
static void dino_plugins_ice_transport_parameters_datagram_connection_terminate_ready (GObject* source_object,
                                                                                GAsyncResult* _res_,
                                                                                gpointer _user_data_);
static void dino_plugins_ice_transport_parameters_datagram_connection_real_send_datagram (XmppXepJingleDatagramConnection* base,
                                                                                   GBytes* datagram);
static void dino_plugins_ice_transport_parameters_datagram_connection_finalize (GObject * obj);
static GType dino_plugins_ice_transport_parameters_datagram_connection_get_type_once (void);
static void dino_plugins_ice_transport_parameters_finalize (GObject * obj);
static GType dino_plugins_ice_transport_parameters_get_type_once (void);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static inline gpointer
dino_plugins_ice_transport_parameters_get_instance_private (DinoPluginsIceTransportParameters* self)
{
	return G_STRUCT_MEMBER_P (self, DinoPluginsIceTransportParameters_private_offset);
}

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

static guint8*
_vala_array_dup6 (guint8* self,
                  gssize length)
{
	if (length > 0) {
		return _vala_memdup2 (self, length * sizeof (guint8));
	}
	return NULL;
}

static void
____lambda7_ (DinoPluginsIceTransportParameters* self,
              GObject* _,
              GAsyncResult* res)
{
	XmppXepJingleContentEncryption* content_encryption = NULL;
	DinoPluginsIceDtlsSrtpHandler* _tmp0_;
	XmppXepJingleContentEncryption* _tmp1_;
	XmppXepJingleContentEncryption* _tmp2_;
	g_return_if_fail (res != NULL);
	_tmp0_ = self->priv->dtls_srtp_handler;
	_tmp1_ = dino_plugins_ice_dtls_srtp_handler_setup_dtls_connection_finish (_tmp0_, res);
	content_encryption = _tmp1_;
	_tmp2_ = content_encryption;
	if (_tmp2_ != NULL) {
		XmppXepJingleContent* _tmp3_;
		GeeHashMap* _tmp4_;
		XmppXepJingleContentEncryption* _tmp5_;
		const gchar* _tmp6_;
		XmppXepJingleContentEncryption* _tmp7_;
		_tmp3_ = ((XmppXepJingleIceUdpIceUdpTransportParameters*) self)->content;
		_tmp4_ = _tmp3_->encryptions;
		_tmp5_ = content_encryption;
		_tmp6_ = _tmp5_->encryption_ns;
		_tmp7_ = content_encryption;
		gee_abstract_map_set ((GeeAbstractMap*) _tmp4_, _tmp6_, _tmp7_);
	}
	_g_object_unref0 (content_encryption);
}

static void
_____lambda7__gasync_ready_callback (GObject* source_object,
                                     GAsyncResult* res,
                                     gpointer self)
{
	____lambda7_ ((DinoPluginsIceTransportParameters*) self, source_object, res);
	g_object_unref (self);
}

static void
_dino_plugins_ice_transport_parameters_on_candidate_gathering_done_nice_agent_candidate_gathering_done (NiceAgent* _sender,
                                                                                                        guint stream_id,
                                                                                                        gpointer self)
{
	dino_plugins_ice_transport_parameters_on_candidate_gathering_done ((DinoPluginsIceTransportParameters*) self, stream_id);
}

static void
_dino_plugins_ice_transport_parameters_on_initial_binding_request_received_nice_agent_initial_binding_request_received (NiceAgent* _sender,
                                                                                                                        guint stream_id,
                                                                                                                        gpointer self)
{
	dino_plugins_ice_transport_parameters_on_initial_binding_request_received ((DinoPluginsIceTransportParameters*) self, stream_id);
}

static void
_dino_plugins_ice_transport_parameters_on_component_state_changed_nice_agent_component_state_changed (NiceAgent* _sender,
                                                                                                      guint stream_id,
                                                                                                      guint component_id,
                                                                                                      guint state,
                                                                                                      gpointer self)
{
	dino_plugins_ice_transport_parameters_on_component_state_changed ((DinoPluginsIceTransportParameters*) self, stream_id, component_id, state);
}

static void
_dino_plugins_ice_transport_parameters_on_new_selected_pair_full_nice_agent_new_selected_pair_full (NiceAgent* _sender,
                                                                                                    guint stream_id,
                                                                                                    guint component_id,
                                                                                                    NiceCandidate* lcandidate,
                                                                                                    NiceCandidate* rcandidate,
                                                                                                    gpointer self)
{
	dino_plugins_ice_transport_parameters_on_new_selected_pair_full ((DinoPluginsIceTransportParameters*) self, stream_id, component_id, lcandidate, rcandidate);
}

static void
_dino_plugins_ice_transport_parameters_on_new_candidate_nice_agent_new_candidate_full (NiceAgent* _sender,
                                                                                       NiceCandidate* candidate,
                                                                                       gpointer self)
{
	dino_plugins_ice_transport_parameters_on_new_candidate ((DinoPluginsIceTransportParameters*) self, candidate);
}

static void*
__lambda9_ (DinoPluginsIceTransportParameters* self)
{
	GMainContext* _tmp0_;
	GMainContext* _tmp1_;
	GMainLoop* _tmp2_;
	GMainLoop* _tmp3_;
	GMainContext* _tmp4_;
	void* result;
	_tmp0_ = self->priv->thread_context;
	g_main_context_push_thread_default (_tmp0_);
	_tmp1_ = self->priv->thread_context;
	_tmp2_ = g_main_loop_new (_tmp1_, FALSE);
	_g_main_loop_unref0 (self->priv->thread_loop);
	self->priv->thread_loop = _tmp2_;
	_tmp3_ = self->priv->thread_loop;
	g_main_loop_run (_tmp3_);
	_tmp4_ = self->priv->thread_context;
	g_main_context_pop_thread_default (_tmp4_);
	result = NULL;
	return result;
}

static gpointer
___lambda9__gthread_func (gpointer self)
{
	gpointer result;
	result = __lambda9_ ((DinoPluginsIceTransportParameters*) self);
	g_object_unref (self);
	return result;
}

static void
_dino_plugins_ice_transport_parameters_on_recv_nice_agent_recv_func (NiceAgent* agent,
                                                                     guint stream_id,
                                                                     guint component_id,
                                                                     guint len,
                                                                     gchar* buf,
                                                                     gpointer self)
{
	dino_plugins_ice_transport_parameters_on_recv ((DinoPluginsIceTransportParameters*) self, agent, stream_id, component_id, buf, len);
}

DinoPluginsIceTransportParameters*
dino_plugins_ice_transport_parameters_construct (GType object_type,
                                                 NiceAgent* agent,
                                                 DinoPluginsIceDtlsSrtpCredentialsCapsule* credentials,
                                                 XmppXepExternalServiceDiscoveryService* turn_service,
                                                 const gchar* turn_ip,
                                                 guint8 components,
                                                 XmppJid* local_full_jid,
                                                 XmppJid* peer_full_jid,
                                                 XmppStanzaNode* node)
{
	DinoPluginsIceTransportParameters * self = NULL;
	NiceAgent* _tmp0_;
	gboolean _tmp1_ = FALSE;
	guint8* _tmp2_;
	gint _tmp2__length1;
	gboolean _tmp22_;
	gboolean _tmp23_;
	GMainContext* _tmp24_;
	gchar* _tmp25_;
	gchar* _tmp26_;
	gchar* _tmp27_;
	gchar* _tmp28_;
	GThread* _tmp29_;
	GThread* _tmp30_;
	gchar* ufrag = NULL;
	gchar* pwd = NULL;
	gchar* _tmp41_ = NULL;
	gchar* _tmp42_ = NULL;
	const gchar* _tmp43_;
	const gchar* _tmp44_;
	g_return_val_if_fail (agent != NULL, NULL);
	g_return_val_if_fail (local_full_jid != NULL, NULL);
	g_return_val_if_fail (peer_full_jid != NULL, NULL);
	self = (DinoPluginsIceTransportParameters*) xmpp_xep_jingle_ice_udp_ice_udp_transport_parameters_construct (object_type, components, local_full_jid, peer_full_jid, node);
	self->priv->we_want_connection = node == NULL;
	_tmp0_ = _g_object_ref0 (agent);
	_g_object_unref0 (self->priv->agent);
	self->priv->agent = _tmp0_;
	_tmp2_ = ((XmppXepJingleIceUdpIceUdpTransportParameters*) self)->peer_fingerprint;
	_tmp2__length1 = ((XmppXepJingleIceUdpIceUdpTransportParameters*) self)->peer_fingerprint_length1;
	if (_tmp2_ != NULL) {
		_tmp1_ = TRUE;
	} else {
		gboolean _tmp3_;
		gboolean _tmp4_;
		_tmp3_ = xmpp_xep_jingle_ice_udp_ice_udp_transport_parameters_get_incoming ((XmppXepJingleIceUdpIceUdpTransportParameters*) self);
		_tmp4_ = _tmp3_;
		_tmp1_ = !_tmp4_;
	}
	if (_tmp1_) {
		DinoPluginsIceDtlsSrtpHandler* _tmp5_;
		DinoPluginsIceDtlsSrtpHandler* _tmp6_;
		guint8* _tmp7_;
		gint _tmp7__length1;
		gint _tmp8_ = 0;
		guint8* _tmp9_;
		gint _tmp9__length1;
		guint8* _tmp10_;
		gint _tmp10__length1;
		gboolean _tmp11_;
		gboolean _tmp12_;
		_tmp5_ = dino_plugins_ice_transport_parameters_setup_dtls (self, credentials);
		_dino_plugins_ice_dtls_srtp_handler_unref0 (self->priv->dtls_srtp_handler);
		self->priv->dtls_srtp_handler = _tmp5_;
		_tmp6_ = self->priv->dtls_srtp_handler;
		_tmp7_ = dino_plugins_ice_dtls_srtp_handler_get_own_fingerprint (_tmp6_, &_tmp8_);
		_tmp7__length1 = _tmp8_;
		_tmp9_ = _tmp7_;
		_tmp9__length1 = _tmp7__length1;
		_tmp10_ = (_tmp9_ != NULL) ? _vala_array_dup6 (_tmp9_, _tmp9__length1) : _tmp9_;
		_tmp10__length1 = _tmp9__length1;
		((XmppXepJingleIceUdpIceUdpTransportParameters*) self)->own_fingerprint = (g_free (((XmppXepJingleIceUdpIceUdpTransportParameters*) self)->own_fingerprint), NULL);
		((XmppXepJingleIceUdpIceUdpTransportParameters*) self)->own_fingerprint = _tmp10_;
		((XmppXepJingleIceUdpIceUdpTransportParameters*) self)->own_fingerprint_length1 = _tmp10__length1;
		_tmp11_ = xmpp_xep_jingle_ice_udp_ice_udp_transport_parameters_get_incoming ((XmppXepJingleIceUdpIceUdpTransportParameters*) self);
		_tmp12_ = _tmp11_;
		if (_tmp12_) {
			gchar* _tmp13_;
			DinoPluginsIceDtlsSrtpHandler* _tmp14_;
			DinoPluginsIceDtlsSrtpHandler* _tmp15_;
			guint8* _tmp16_;
			gint _tmp16__length1;
			DinoPluginsIceDtlsSrtpHandler* _tmp17_;
			const gchar* _tmp18_;
			_tmp13_ = g_strdup ("active");
			_g_free0 (((XmppXepJingleIceUdpIceUdpTransportParameters*) self)->own_setup);
			((XmppXepJingleIceUdpIceUdpTransportParameters*) self)->own_setup = _tmp13_;
			_tmp14_ = self->priv->dtls_srtp_handler;
			dino_plugins_ice_dtls_srtp_handler_set_mode (_tmp14_, DINO_PLUGINS_ICE_DTLS_SRTP_MODE_CLIENT);
			_tmp15_ = self->priv->dtls_srtp_handler;
			_tmp16_ = ((XmppXepJingleIceUdpIceUdpTransportParameters*) self)->peer_fingerprint;
			_tmp16__length1 = ((XmppXepJingleIceUdpIceUdpTransportParameters*) self)->peer_fingerprint_length1;
			dino_plugins_ice_dtls_srtp_handler_set_peer_fingerprint (_tmp15_, _tmp16_, _tmp16__length1);
			_tmp17_ = self->priv->dtls_srtp_handler;
			_tmp18_ = ((XmppXepJingleIceUdpIceUdpTransportParameters*) self)->peer_fp_algo;
			dino_plugins_ice_dtls_srtp_handler_set_peer_fp_algo (_tmp17_, _tmp18_);
		} else {
			gchar* _tmp19_;
			DinoPluginsIceDtlsSrtpHandler* _tmp20_;
			DinoPluginsIceDtlsSrtpHandler* _tmp21_;
			_tmp19_ = g_strdup ("actpass");
			_g_free0 (((XmppXepJingleIceUdpIceUdpTransportParameters*) self)->own_setup);
			((XmppXepJingleIceUdpIceUdpTransportParameters*) self)->own_setup = _tmp19_;
			_tmp20_ = self->priv->dtls_srtp_handler;
			dino_plugins_ice_dtls_srtp_handler_set_mode (_tmp20_, DINO_PLUGINS_ICE_DTLS_SRTP_MODE_SERVER);
			_tmp21_ = self->priv->dtls_srtp_handler;
			dino_plugins_ice_dtls_srtp_handler_setup_dtls_connection (_tmp21_, _____lambda7__gasync_ready_callback, g_object_ref (self));
		}
	}
	g_signal_connect_object (agent, "candidate-gathering-done", (GCallback) _dino_plugins_ice_transport_parameters_on_candidate_gathering_done_nice_agent_candidate_gathering_done, self, 0);
	g_signal_connect_object (agent, "initial-binding-request-received", (GCallback) _dino_plugins_ice_transport_parameters_on_initial_binding_request_received_nice_agent_initial_binding_request_received, self, 0);
	g_signal_connect_object (agent, "component-state-changed", (GCallback) _dino_plugins_ice_transport_parameters_on_component_state_changed_nice_agent_component_state_changed, self, 0);
	g_signal_connect_object (agent, "new-selected-pair-full", (GCallback) _dino_plugins_ice_transport_parameters_on_new_selected_pair_full_nice_agent_new_selected_pair_full, self, 0);
	g_signal_connect_object (agent, "new-candidate-full", (GCallback) _dino_plugins_ice_transport_parameters_on_new_candidate_nice_agent_new_candidate_full, self, 0);
	_tmp22_ = xmpp_xep_jingle_ice_udp_ice_udp_transport_parameters_get_incoming ((XmppXepJingleIceUdpIceUdpTransportParameters*) self);
	_tmp23_ = _tmp22_;
	g_object_set (agent, "controlling-mode", !_tmp23_, NULL);
	self->priv->stream_id = nice_agent_add_stream (agent, (guint) components);
	_tmp24_ = g_main_context_new ();
	_g_main_context_unref0 (self->priv->thread_context);
	self->priv->thread_context = _tmp24_;
	_tmp25_ = g_strdup_printf ("%u", self->priv->stream_id);
	_tmp26_ = _tmp25_;
	_tmp27_ = g_strconcat ("ice-thread-", _tmp26_, NULL);
	_tmp28_ = _tmp27_;
	_tmp29_ = g_thread_new (_tmp28_, ___lambda9__gthread_func, g_object_ref (self));
	_tmp30_ = _tmp29_;
	_g_thread_unref0 (_tmp30_);
	_g_free0 (_tmp28_);
	_g_free0 (_tmp26_);
	if (turn_ip != NULL) {
		{
			guint8 component_id = 0U;
			component_id = (guint8) 1;
			{
				gboolean _tmp31_ = FALSE;
				_tmp31_ = TRUE;
				while (TRUE) {
					guint _tmp33_;
					guint _tmp34_;
					const gchar* _tmp35_;
					const gchar* _tmp36_;
					const gchar* _tmp37_;
					const gchar* _tmp38_;
					guint _tmp39_;
					guint _tmp40_;
					if (!_tmp31_) {
						guint8 _tmp32_;
						_tmp32_ = component_id;
						component_id = _tmp32_ + 1;
					}
					_tmp31_ = FALSE;
					if (!(component_id <= components)) {
						break;
					}
					_tmp33_ = xmpp_xep_external_service_discovery_service_get_port (turn_service);
					_tmp34_ = _tmp33_;
					_tmp35_ = xmpp_xep_external_service_discovery_service_get_username (turn_service);
					_tmp36_ = _tmp35_;
					_tmp37_ = xmpp_xep_external_service_discovery_service_get_password (turn_service);
					_tmp38_ = _tmp37_;
					nice_agent_set_relay_info (agent, self->priv->stream_id, (guint) component_id, turn_ip, _tmp34_, _tmp36_, _tmp38_, NICE_RELAY_TYPE_TURN_UDP);
					_tmp39_ = xmpp_xep_external_service_discovery_service_get_port (turn_service);
					_tmp40_ = _tmp39_;
					g_debug ("transport_parameters.vala:111: TURN info (component %i) %s:%u", (gint) component_id, turn_ip, _tmp40_);
				}
			}
		}
	}
	nice_agent_get_local_credentials (agent, self->priv->stream_id, &_tmp41_, &_tmp42_);
	_g_free0 (ufrag);
	ufrag = _tmp41_;
	_g_free0 (pwd);
	pwd = _tmp42_;
	_tmp43_ = ufrag;
	_tmp44_ = pwd;
	xmpp_xep_jingle_ice_udp_ice_udp_transport_parameters_init ((XmppXepJingleIceUdpIceUdpTransportParameters*) self, _tmp43_, _tmp44_);
	{
		guint8 component_id = 0U;
		component_id = (guint8) 1;
		{
			gboolean _tmp45_ = FALSE;
			_tmp45_ = TRUE;
			while (TRUE) {
				GMainContext* _tmp47_;
				if (!_tmp45_) {
					guint8 _tmp46_;
					_tmp46_ = component_id;
					component_id = _tmp46_ + 1;
				}
				_tmp45_ = FALSE;
				if (!(component_id <= components)) {
					break;
				}
				_tmp47_ = self->priv->thread_context;
				nice_agent_attach_recv (agent, self->priv->stream_id, (guint) component_id, _tmp47_, _dino_plugins_ice_transport_parameters_on_recv_nice_agent_recv_func, self);
			}
		}
	}
	nice_agent_gather_candidates (agent, self->priv->stream_id);
	_g_free0 (pwd);
	_g_free0 (ufrag);
	return self;
}

DinoPluginsIceTransportParameters*
dino_plugins_ice_transport_parameters_new (NiceAgent* agent,
                                           DinoPluginsIceDtlsSrtpCredentialsCapsule* credentials,
                                           XmppXepExternalServiceDiscoveryService* turn_service,
                                           const gchar* turn_ip,
                                           guint8 components,
                                           XmppJid* local_full_jid,
                                           XmppJid* peer_full_jid,
                                           XmppStanzaNode* node)
{
	return dino_plugins_ice_transport_parameters_construct (DINO_PLUGINS_ICE_TYPE_TRANSPORT_PARAMETERS, agent, credentials, turn_service, turn_ip, components, local_full_jid, peer_full_jid, node);
}

static Block3Data*
block3_data_ref (Block3Data* _data3_)
{
	g_atomic_int_inc (&_data3_->_ref_count_);
	return _data3_;
}

static void
block3_data_unref (void * _userdata_)
{
	Block3Data* _data3_;
	_data3_ = (Block3Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data3_->_ref_count_)) {
		g_weak_ref_clear (&_data3_->weak_self);
		g_slice_free (Block3Data, _data3_);
	}
}

static void
__lambda6_ (Block3Data* _data3_,
            guint8* data,
            gint data_length1)
{
	DinoPluginsIceTransportParameters* _self_ = NULL;
	GObject* _tmp0_;
	DinoPluginsIceTransportParameters* _tmp1_;
	_tmp0_ = g_weak_ref_get (&_data3_->weak_self);
	_self_ = G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, DINO_PLUGINS_ICE_TYPE_TRANSPORT_PARAMETERS, DinoPluginsIceTransportParameters);
	_tmp1_ = _self_;
	if (_tmp1_ != NULL) {
		DinoPluginsIceTransportParameters* _tmp2_;
		NiceAgent* _tmp3_;
		DinoPluginsIceTransportParameters* _tmp4_;
		_tmp2_ = _self_;
		_tmp3_ = _tmp2_->priv->agent;
		_tmp4_ = _self_;
		nice_agent_send (_tmp3_, _tmp4_->priv->stream_id, (guint) 1, (guint) data_length1, (const gchar*) data);
	}
	_g_object_unref0 (_self_);
}

static void
___lambda6__dino_plugins_ice_dtls_srtp_handler_send_data (DinoPluginsIceDtlsSrtpHandler* _sender,
                                                          guint8* data,
                                                          gint data_length1,
                                                          gpointer self)
{
	__lambda6_ (self, data, data_length1);
}

static DinoPluginsIceDtlsSrtpHandler*
dino_plugins_ice_transport_parameters_setup_dtls (DinoPluginsIceTransportParameters* tp,
                                                  DinoPluginsIceDtlsSrtpCredentialsCapsule* credentials)
{
	Block3Data* _data3_;
	DinoPluginsIceDtlsSrtpHandler* dtls_srtp = NULL;
	DinoPluginsIceDtlsSrtpHandler* _tmp0_;
	DinoPluginsIceDtlsSrtpHandler* result;
	g_return_val_if_fail (tp != NULL, NULL);
	g_return_val_if_fail (credentials != NULL, NULL);
	_data3_ = g_slice_new0 (Block3Data);
	_data3_->_ref_count_ = 1;
	g_weak_ref_init (&_data3_->weak_self, (GObject*) tp);
	_tmp0_ = dino_plugins_ice_dtls_srtp_handler_new_with_cert (credentials);
	dtls_srtp = _tmp0_;
	g_signal_connect_data (dtls_srtp, "send-data", (GCallback) ___lambda6__dino_plugins_ice_dtls_srtp_handler_send_data, block3_data_ref (_data3_), (GClosureNotify) block3_data_unref, 0);
	result = dtls_srtp;
	block3_data_unref (_data3_);
	_data3_ = NULL;
	return result;
}

static void
_nice_candidate_free0_ (gpointer var)
{
	(var == NULL) ? NULL : (var = (nice_candidate_free (var), NULL));
}

static inline void
_g_slist_free__nice_candidate_free0_ (GSList* self)
{
	g_slist_free_full (self, (GDestroyNotify) _nice_candidate_free0_);
}

static void
dino_plugins_ice_transport_parameters_on_candidate_gathering_done (DinoPluginsIceTransportParameters* self,
                                                                   guint stream_id)
{
	g_return_if_fail (self != NULL);
	if (stream_id != self->priv->stream_id) {
		return;
	}
	g_debug ("transport_parameters.vala:139: on_candidate_gathering_done in %u", stream_id);
	{
		guint8 i = 0U;
		i = (guint8) 1;
		{
			gboolean _tmp0_ = FALSE;
			_tmp0_ = TRUE;
			while (TRUE) {
				guint8 _tmp2_;
				guint8 _tmp3_;
				NiceAgent* _tmp4_;
				GSList* _tmp5_;
				if (!_tmp0_) {
					guint8 _tmp1_;
					_tmp1_ = i;
					i = _tmp1_ + 1;
				}
				_tmp0_ = FALSE;
				_tmp2_ = xmpp_xep_jingle_transport_parameters_get_components ((XmppXepJingleTransportParameters*) self);
				_tmp3_ = _tmp2_;
				if (!(i <= _tmp3_)) {
					break;
				}
				_tmp4_ = self->priv->agent;
				_tmp5_ = nice_agent_get_local_candidates (_tmp4_, stream_id, (guint) i);
				{
					GSList* nc_collection = NULL;
					GSList* nc_it = NULL;
					nc_collection = _tmp5_;
					for (nc_it = nc_collection; nc_it != NULL; nc_it = nc_it->next) {
						NiceCandidate* nc = NULL;
						nc = (NiceCandidate*) nc_it->data;
						{
							NiceCandidate* _tmp6_;
							_tmp6_ = nc;
							if (_tmp6_->transport == NICE_CANDIDATE_TRANSPORT_UDP) {
								XmppXepJingleIceUdpCandidate* candidate = NULL;
								NiceCandidate* _tmp7_;
								XmppXepJingleIceUdpCandidate* _tmp8_;
								XmppXepJingleIceUdpCandidate* _tmp9_;
								NiceAgent* _tmp10_;
								NiceCandidate* _tmp11_;
								gchar* _tmp12_;
								gchar* _tmp13_;
								_tmp7_ = nc;
								_tmp8_ = dino_plugins_ice_transport_parameters_candidate_to_jingle (_tmp7_);
								candidate = _tmp8_;
								_tmp9_ = candidate;
								if (_tmp9_ == NULL) {
									_xmpp_xep_jingle_ice_udp_candidate_unref0 (candidate);
									continue;
								}
								_tmp10_ = self->priv->agent;
								_tmp11_ = nc;
								_tmp12_ = nice_agent_generate_local_candidate_sdp (_tmp10_, _tmp11_);
								_tmp13_ = _tmp12_;
								g_debug ("transport_parameters.vala:146: Local candidate summary: %s", _tmp13_);
								_g_free0 (_tmp13_);
								_xmpp_xep_jingle_ice_udp_candidate_unref0 (candidate);
							}
						}
					}
					(nc_collection == NULL) ? NULL : (nc_collection = (_g_slist_free__nice_candidate_free0_ (nc_collection), NULL));
				}
			}
		}
	}
}

static void
dino_plugins_ice_transport_parameters_on_new_candidate (DinoPluginsIceTransportParameters* self,
                                                        NiceCandidate* nc)
{
	XmppXepJingleIceUdpCandidate* candidate = NULL;
	XmppXepJingleIceUdpCandidate* _tmp0_;
	XmppXepJingleIceUdpCandidate* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (nc != NULL);
	if (nc->stream_id != self->priv->stream_id) {
		return;
	}
	_tmp0_ = dino_plugins_ice_transport_parameters_candidate_to_jingle (nc);
	candidate = _tmp0_;
	_tmp1_ = candidate;
	if (_tmp1_ == NULL) {
		_xmpp_xep_jingle_ice_udp_candidate_unref0 (candidate);
		return;
	}
	if (nc->transport == NICE_CANDIDATE_TRANSPORT_UDP) {
		XmppXepJingleIceUdpCandidate* _tmp2_;
		_tmp2_ = candidate;
		xmpp_xep_jingle_ice_udp_ice_udp_transport_parameters_add_local_candidate_threadsafe ((XmppXepJingleIceUdpIceUdpTransportParameters*) self, _tmp2_);
	}
	_xmpp_xep_jingle_ice_udp_candidate_unref0 (candidate);
}

static gboolean
dino_plugins_ice_transport_parameters_bytes_equal (DinoPluginsIceTransportParameters* self,
                                                   guint8* a1,
                                                   gint a1_length1,
                                                   guint8* a2,
                                                   gint a2_length1)
{
	gboolean _tmp0_ = FALSE;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	if (a1_length1 == a2_length1) {
		_tmp0_ = memcmp (a1, a2, (gsize) a1_length1) == 0;
	} else {
		_tmp0_ = FALSE;
	}
	result = _tmp0_;
	return result;
}

static guint8*
_vala_array_dup7 (guint8* self,
                  gssize length)
{
	if (length > 0) {
		return _vala_memdup2 (self, length * sizeof (guint8));
	}
	return NULL;
}

static void
____lambda10_ (DinoPluginsIceTransportParameters* self,
               GObject* _,
               GAsyncResult* res)
{
	XmppXepJingleContentEncryption* content_encryption = NULL;
	DinoPluginsIceDtlsSrtpHandler* _tmp0_;
	XmppXepJingleContentEncryption* _tmp1_;
	XmppXepJingleContentEncryption* _tmp2_;
	g_return_if_fail (res != NULL);
	_tmp0_ = self->priv->dtls_srtp_handler;
	_tmp1_ = dino_plugins_ice_dtls_srtp_handler_setup_dtls_connection_finish (_tmp0_, res);
	content_encryption = _tmp1_;
	_tmp2_ = content_encryption;
	if (_tmp2_ != NULL) {
		XmppXepJingleContent* _tmp3_;
		GeeHashMap* _tmp4_;
		XmppXepJingleContentEncryption* _tmp5_;
		const gchar* _tmp6_;
		XmppXepJingleContentEncryption* _tmp7_;
		_tmp3_ = ((XmppXepJingleIceUdpIceUdpTransportParameters*) self)->content;
		_tmp4_ = _tmp3_->encryptions;
		_tmp5_ = content_encryption;
		_tmp6_ = _tmp5_->encryption_ns;
		_tmp7_ = content_encryption;
		gee_abstract_map_set ((GeeAbstractMap*) _tmp4_, _tmp6_, _tmp7_);
	}
	_g_object_unref0 (content_encryption);
}

static void
_____lambda10__gasync_ready_callback (GObject* source_object,
                                      GAsyncResult* res,
                                      gpointer self)
{
	____lambda10_ ((DinoPluginsIceTransportParameters*) self, source_object, res);
	g_object_unref (self);
}

static void
dino_plugins_ice_transport_parameters_real_handle_transport_accept (XmppXepJingleIceUdpIceUdpTransportParameters* base,
                                                                    XmppStanzaNode* transport,
                                                                    GError** error)
{
	DinoPluginsIceTransportParameters * self;
	XmppJid* _tmp0_;
	XmppJid* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	gboolean _tmp4_ = FALSE;
	DinoPluginsIceDtlsSrtpHandler* _tmp5_;
	GError* _inner_error0_ = NULL;
	self = (DinoPluginsIceTransportParameters*) base;
	g_return_if_fail (transport != NULL);
	_tmp0_ = xmpp_xep_jingle_ice_udp_ice_udp_transport_parameters_get_peer_full_jid ((XmppXepJingleIceUdpIceUdpTransportParameters*) self);
	_tmp1_ = _tmp0_;
	_tmp2_ = xmpp_jid_to_string (_tmp1_);
	_tmp3_ = _tmp2_;
	g_debug ("transport_parameters.vala:168: on_transport_accept from %s", _tmp3_);
	_g_free0 (_tmp3_);
	XMPP_XEP_JINGLE_ICE_UDP_ICE_UDP_TRANSPORT_PARAMETERS_CLASS (dino_plugins_ice_transport_parameters_parent_class)->handle_transport_accept (G_TYPE_CHECK_INSTANCE_CAST (self, XMPP_XEP_JINGLE_ICE_UDP_TYPE_ICE_UDP_TRANSPORT_PARAMETERS, XmppXepJingleIceUdpIceUdpTransportParameters), transport, &_inner_error0_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		if (_inner_error0_->domain == XMPP_XEP_JINGLE_IQ_ERROR) {
			g_propagate_error (error, _inner_error0_);
			return;
		} else {
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
			g_clear_error (&_inner_error0_);
			return;
		}
	}
	_tmp5_ = self->priv->dtls_srtp_handler;
	if (_tmp5_ != NULL) {
		guint8* _tmp6_;
		gint _tmp6__length1;
		_tmp6_ = ((XmppXepJingleIceUdpIceUdpTransportParameters*) self)->peer_fingerprint;
		_tmp6__length1 = ((XmppXepJingleIceUdpIceUdpTransportParameters*) self)->peer_fingerprint_length1;
		_tmp4_ = _tmp6_ != NULL;
	} else {
		_tmp4_ = FALSE;
	}
	if (_tmp4_) {
		DinoPluginsIceDtlsSrtpHandler* _tmp7_;
		guint8* _tmp8_;
		gint _tmp8__length1;
		gint _tmp9_ = 0;
		guint8* _tmp10_;
		gint _tmp10__length1;
		const gchar* _tmp29_;
		_tmp7_ = self->priv->dtls_srtp_handler;
		_tmp8_ = dino_plugins_ice_dtls_srtp_handler_get_peer_fingerprint (_tmp7_, &_tmp9_);
		_tmp8__length1 = _tmp9_;
		_tmp10_ = _tmp8_;
		_tmp10__length1 = _tmp8__length1;
		if (_tmp10_ != NULL) {
			DinoPluginsIceDtlsSrtpHandler* _tmp11_;
			guint8* _tmp12_;
			gint _tmp12__length1;
			gint _tmp13_ = 0;
			guint8* _tmp14_;
			gint _tmp14__length1;
			guint8* _tmp15_;
			gint _tmp15__length1;
			_tmp11_ = self->priv->dtls_srtp_handler;
			_tmp12_ = dino_plugins_ice_dtls_srtp_handler_get_peer_fingerprint (_tmp11_, &_tmp13_);
			_tmp12__length1 = _tmp13_;
			_tmp14_ = _tmp12_;
			_tmp14__length1 = _tmp12__length1;
			_tmp15_ = ((XmppXepJingleIceUdpIceUdpTransportParameters*) self)->peer_fingerprint;
			_tmp15__length1 = ((XmppXepJingleIceUdpIceUdpTransportParameters*) self)->peer_fingerprint_length1;
			if (!dino_plugins_ice_transport_parameters_bytes_equal (self, _tmp14_, (gint) _tmp14__length1, _tmp15_, (gint) _tmp15__length1)) {
				DinoPluginsIceDtlsSrtpHandler* _tmp16_;
				guint8* _tmp17_;
				gint _tmp17__length1;
				gint _tmp18_ = 0;
				guint8* _tmp19_;
				gint _tmp19__length1;
				guint8* _tmp20_;
				gint _tmp20__length1;
				DinoPluginsIceDtlsSrtpHandler* _tmp21_;
				const gchar* _tmp22_;
				const gchar* _tmp23_;
				gchar* _tmp24_;
				g_warning ("transport_parameters.vala:174: Tried to replace certificate fingerprin" \
"t mid use. We don't allow that.");
				_tmp16_ = self->priv->dtls_srtp_handler;
				_tmp17_ = dino_plugins_ice_dtls_srtp_handler_get_peer_fingerprint (_tmp16_, &_tmp18_);
				_tmp17__length1 = _tmp18_;
				_tmp19_ = _tmp17_;
				_tmp19__length1 = _tmp17__length1;
				_tmp20_ = (_tmp19_ != NULL) ? _vala_array_dup7 (_tmp19_, _tmp19__length1) : _tmp19_;
				_tmp20__length1 = _tmp19__length1;
				((XmppXepJingleIceUdpIceUdpTransportParameters*) self)->peer_fingerprint = (g_free (((XmppXepJingleIceUdpIceUdpTransportParameters*) self)->peer_fingerprint), NULL);
				((XmppXepJingleIceUdpIceUdpTransportParameters*) self)->peer_fingerprint = _tmp20_;
				((XmppXepJingleIceUdpIceUdpTransportParameters*) self)->peer_fingerprint_length1 = _tmp20__length1;
				_tmp21_ = self->priv->dtls_srtp_handler;
				_tmp22_ = dino_plugins_ice_dtls_srtp_handler_get_peer_fp_algo (_tmp21_);
				_tmp23_ = _tmp22_;
				_tmp24_ = g_strdup (_tmp23_);
				_g_free0 (((XmppXepJingleIceUdpIceUdpTransportParameters*) self)->peer_fp_algo);
				((XmppXepJingleIceUdpIceUdpTransportParameters*) self)->peer_fp_algo = _tmp24_;
			}
		} else {
			DinoPluginsIceDtlsSrtpHandler* _tmp25_;
			guint8* _tmp26_;
			gint _tmp26__length1;
			DinoPluginsIceDtlsSrtpHandler* _tmp27_;
			const gchar* _tmp28_;
			_tmp25_ = self->priv->dtls_srtp_handler;
			_tmp26_ = ((XmppXepJingleIceUdpIceUdpTransportParameters*) self)->peer_fingerprint;
			_tmp26__length1 = ((XmppXepJingleIceUdpIceUdpTransportParameters*) self)->peer_fingerprint_length1;
			dino_plugins_ice_dtls_srtp_handler_set_peer_fingerprint (_tmp25_, _tmp26_, _tmp26__length1);
			_tmp27_ = self->priv->dtls_srtp_handler;
			_tmp28_ = ((XmppXepJingleIceUdpIceUdpTransportParameters*) self)->peer_fp_algo;
			dino_plugins_ice_dtls_srtp_handler_set_peer_fp_algo (_tmp27_, _tmp28_);
		}
		_tmp29_ = ((XmppXepJingleIceUdpIceUdpTransportParameters*) self)->peer_setup;
		if (g_strcmp0 (_tmp29_, "passive") == 0) {
			DinoPluginsIceDtlsSrtpHandler* _tmp30_;
			DinoPluginsIceDtlsSrtpHandler* _tmp31_;
			DinoPluginsIceDtlsSrtpHandler* _tmp32_;
			_tmp30_ = self->priv->dtls_srtp_handler;
			dino_plugins_ice_dtls_srtp_handler_set_mode (_tmp30_, DINO_PLUGINS_ICE_DTLS_SRTP_MODE_CLIENT);
			_tmp31_ = self->priv->dtls_srtp_handler;
			dino_plugins_ice_dtls_srtp_handler_stop_dtls_connection (_tmp31_);
			_tmp32_ = self->priv->dtls_srtp_handler;
			dino_plugins_ice_dtls_srtp_handler_setup_dtls_connection (_tmp32_, _____lambda10__gasync_ready_callback, g_object_ref (self));
		}
	} else {
		_dino_plugins_ice_dtls_srtp_handler_unref0 (self->priv->dtls_srtp_handler);
		self->priv->dtls_srtp_handler = NULL;
	}
}

static guint8*
_vala_array_dup8 (guint8* self,
                  gssize length)
{
	if (length > 0) {
		return _vala_memdup2 (self, length * sizeof (guint8));
	}
	return NULL;
}

static void
dino_plugins_ice_transport_parameters_real_handle_transport_info (XmppXepJingleIceUdpIceUdpTransportParameters* base,
                                                                  XmppStanzaNode* transport,
                                                                  GError** error)
{
	DinoPluginsIceTransportParameters * self;
	XmppJid* _tmp0_;
	XmppJid* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	gboolean _tmp4_ = FALSE;
	DinoPluginsIceDtlsSrtpHandler* _tmp5_;
	gboolean _tmp29_ = FALSE;
	gboolean _tmp30_ = FALSE;
	const gchar* _tmp31_;
	const gchar* _tmp32_;
	GError* _inner_error0_ = NULL;
	self = (DinoPluginsIceTransportParameters*) base;
	g_return_if_fail (transport != NULL);
	_tmp0_ = xmpp_xep_jingle_ice_udp_ice_udp_transport_parameters_get_peer_full_jid ((XmppXepJingleIceUdpIceUdpTransportParameters*) self);
	_tmp1_ = _tmp0_;
	_tmp2_ = xmpp_jid_to_string (_tmp1_);
	_tmp3_ = _tmp2_;
	g_debug ("transport_parameters.vala:198: on_transport_info from %s", _tmp3_);
	_g_free0 (_tmp3_);
	XMPP_XEP_JINGLE_ICE_UDP_ICE_UDP_TRANSPORT_PARAMETERS_CLASS (dino_plugins_ice_transport_parameters_parent_class)->handle_transport_info (G_TYPE_CHECK_INSTANCE_CAST (self, XMPP_XEP_JINGLE_ICE_UDP_TYPE_ICE_UDP_TRANSPORT_PARAMETERS, XmppXepJingleIceUdpIceUdpTransportParameters), transport, &_inner_error0_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		if (_inner_error0_->domain == XMPP_XEP_JINGLE_IQ_ERROR) {
			g_propagate_error (error, _inner_error0_);
			return;
		} else {
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
			g_clear_error (&_inner_error0_);
			return;
		}
	}
	_tmp5_ = self->priv->dtls_srtp_handler;
	if (_tmp5_ != NULL) {
		guint8* _tmp6_;
		gint _tmp6__length1;
		_tmp6_ = ((XmppXepJingleIceUdpIceUdpTransportParameters*) self)->peer_fingerprint;
		_tmp6__length1 = ((XmppXepJingleIceUdpIceUdpTransportParameters*) self)->peer_fingerprint_length1;
		_tmp4_ = _tmp6_ != NULL;
	} else {
		_tmp4_ = FALSE;
	}
	if (_tmp4_) {
		DinoPluginsIceDtlsSrtpHandler* _tmp7_;
		guint8* _tmp8_;
		gint _tmp8__length1;
		gint _tmp9_ = 0;
		guint8* _tmp10_;
		gint _tmp10__length1;
		_tmp7_ = self->priv->dtls_srtp_handler;
		_tmp8_ = dino_plugins_ice_dtls_srtp_handler_get_peer_fingerprint (_tmp7_, &_tmp9_);
		_tmp8__length1 = _tmp9_;
		_tmp10_ = _tmp8_;
		_tmp10__length1 = _tmp8__length1;
		if (_tmp10_ != NULL) {
			DinoPluginsIceDtlsSrtpHandler* _tmp11_;
			guint8* _tmp12_;
			gint _tmp12__length1;
			gint _tmp13_ = 0;
			guint8* _tmp14_;
			gint _tmp14__length1;
			guint8* _tmp15_;
			gint _tmp15__length1;
			_tmp11_ = self->priv->dtls_srtp_handler;
			_tmp12_ = dino_plugins_ice_dtls_srtp_handler_get_peer_fingerprint (_tmp11_, &_tmp13_);
			_tmp12__length1 = _tmp13_;
			_tmp14_ = _tmp12_;
			_tmp14__length1 = _tmp12__length1;
			_tmp15_ = ((XmppXepJingleIceUdpIceUdpTransportParameters*) self)->peer_fingerprint;
			_tmp15__length1 = ((XmppXepJingleIceUdpIceUdpTransportParameters*) self)->peer_fingerprint_length1;
			if (!dino_plugins_ice_transport_parameters_bytes_equal (self, _tmp14_, (gint) _tmp14__length1, _tmp15_, (gint) _tmp15__length1)) {
				DinoPluginsIceDtlsSrtpHandler* _tmp16_;
				guint8* _tmp17_;
				gint _tmp17__length1;
				gint _tmp18_ = 0;
				guint8* _tmp19_;
				gint _tmp19__length1;
				guint8* _tmp20_;
				gint _tmp20__length1;
				DinoPluginsIceDtlsSrtpHandler* _tmp21_;
				const gchar* _tmp22_;
				const gchar* _tmp23_;
				gchar* _tmp24_;
				g_warning ("transport_parameters.vala:204: Tried to replace certificate fingerprin" \
"t mid use. We don't allow that.");
				_tmp16_ = self->priv->dtls_srtp_handler;
				_tmp17_ = dino_plugins_ice_dtls_srtp_handler_get_peer_fingerprint (_tmp16_, &_tmp18_);
				_tmp17__length1 = _tmp18_;
				_tmp19_ = _tmp17_;
				_tmp19__length1 = _tmp17__length1;
				_tmp20_ = (_tmp19_ != NULL) ? _vala_array_dup8 (_tmp19_, _tmp19__length1) : _tmp19_;
				_tmp20__length1 = _tmp19__length1;
				((XmppXepJingleIceUdpIceUdpTransportParameters*) self)->peer_fingerprint = (g_free (((XmppXepJingleIceUdpIceUdpTransportParameters*) self)->peer_fingerprint), NULL);
				((XmppXepJingleIceUdpIceUdpTransportParameters*) self)->peer_fingerprint = _tmp20_;
				((XmppXepJingleIceUdpIceUdpTransportParameters*) self)->peer_fingerprint_length1 = _tmp20__length1;
				_tmp21_ = self->priv->dtls_srtp_handler;
				_tmp22_ = dino_plugins_ice_dtls_srtp_handler_get_peer_fp_algo (_tmp21_);
				_tmp23_ = _tmp22_;
				_tmp24_ = g_strdup (_tmp23_);
				_g_free0 (((XmppXepJingleIceUdpIceUdpTransportParameters*) self)->peer_fp_algo);
				((XmppXepJingleIceUdpIceUdpTransportParameters*) self)->peer_fp_algo = _tmp24_;
			}
		} else {
			DinoPluginsIceDtlsSrtpHandler* _tmp25_;
			guint8* _tmp26_;
			gint _tmp26__length1;
			DinoPluginsIceDtlsSrtpHandler* _tmp27_;
			const gchar* _tmp28_;
			_tmp25_ = self->priv->dtls_srtp_handler;
			_tmp26_ = ((XmppXepJingleIceUdpIceUdpTransportParameters*) self)->peer_fingerprint;
			_tmp26__length1 = ((XmppXepJingleIceUdpIceUdpTransportParameters*) self)->peer_fingerprint_length1;
			dino_plugins_ice_dtls_srtp_handler_set_peer_fingerprint (_tmp25_, _tmp26_, _tmp26__length1);
			_tmp27_ = self->priv->dtls_srtp_handler;
			_tmp28_ = ((XmppXepJingleIceUdpIceUdpTransportParameters*) self)->peer_fp_algo;
			dino_plugins_ice_dtls_srtp_handler_set_peer_fp_algo (_tmp27_, _tmp28_);
		}
	}
	if (!self->priv->we_want_connection) {
		return;
	}
	_tmp31_ = xmpp_xep_jingle_ice_udp_ice_udp_transport_parameters_get_remote_ufrag ((XmppXepJingleIceUdpIceUdpTransportParameters*) self);
	_tmp32_ = _tmp31_;
	if (_tmp32_ != NULL) {
		const gchar* _tmp33_;
		const gchar* _tmp34_;
		_tmp33_ = xmpp_xep_jingle_ice_udp_ice_udp_transport_parameters_get_remote_pwd ((XmppXepJingleIceUdpIceUdpTransportParameters*) self);
		_tmp34_ = _tmp33_;
		_tmp30_ = _tmp34_ != NULL;
	} else {
		_tmp30_ = FALSE;
	}
	if (_tmp30_) {
		_tmp29_ = !self->priv->remote_credentials_set;
	} else {
		_tmp29_ = FALSE;
	}
	if (_tmp29_) {
		NiceAgent* _tmp35_;
		const gchar* _tmp36_;
		const gchar* _tmp37_;
		const gchar* _tmp38_;
		const gchar* _tmp39_;
		_tmp35_ = self->priv->agent;
		_tmp36_ = xmpp_xep_jingle_ice_udp_ice_udp_transport_parameters_get_remote_ufrag ((XmppXepJingleIceUdpIceUdpTransportParameters*) self);
		_tmp37_ = _tmp36_;
		_tmp38_ = xmpp_xep_jingle_ice_udp_ice_udp_transport_parameters_get_remote_pwd ((XmppXepJingleIceUdpIceUdpTransportParameters*) self);
		_tmp39_ = _tmp38_;
		nice_agent_set_remote_credentials (_tmp35_, self->priv->stream_id, _tmp37_, _tmp39_);
		self->priv->remote_credentials_set = TRUE;
	}
	{
		guint8 i = 0U;
		i = (guint8) 1;
		{
			gboolean _tmp40_ = FALSE;
			_tmp40_ = TRUE;
			while (TRUE) {
				guint8 _tmp42_;
				guint8 _tmp43_;
				GSList* candidates = NULL;
				gint new_candidates = 0;
				NiceAgent* _tmp55_;
				GSList* _tmp56_;
				if (!_tmp40_) {
					guint8 _tmp41_;
					_tmp41_ = i;
					i = _tmp41_ + 1;
				}
				_tmp40_ = FALSE;
				_tmp42_ = xmpp_xep_jingle_transport_parameters_get_components ((XmppXepJingleTransportParameters*) self);
				_tmp43_ = _tmp42_;
				if (!(i <= _tmp43_)) {
					break;
				}
				candidates = NULL;
				{
					GeeList* _candidate_list = NULL;
					GeeList* _tmp44_;
					gint _candidate_size = 0;
					GeeList* _tmp45_;
					gint _tmp46_;
					gint _tmp47_;
					gint _candidate_index = 0;
					_tmp44_ = ((XmppXepJingleIceUdpIceUdpTransportParameters*) self)->remote_candidates;
					_candidate_list = _tmp44_;
					_tmp45_ = _candidate_list;
					_tmp46_ = gee_collection_get_size ((GeeCollection*) _tmp45_);
					_tmp47_ = _tmp46_;
					_candidate_size = _tmp47_;
					_candidate_index = -1;
					while (TRUE) {
						gint _tmp48_;
						gint _tmp49_;
						XmppXepJingleIceUdpCandidate* candidate = NULL;
						GeeList* _tmp50_;
						gpointer _tmp51_;
						XmppXepJingleIceUdpCandidate* _tmp52_;
						_candidate_index = _candidate_index + 1;
						_tmp48_ = _candidate_index;
						_tmp49_ = _candidate_size;
						if (!(_tmp48_ < _tmp49_)) {
							break;
						}
						_tmp50_ = _candidate_list;
						_tmp51_ = gee_list_get (_tmp50_, _candidate_index);
						candidate = (XmppXepJingleIceUdpCandidate*) _tmp51_;
						_tmp52_ = candidate;
						if (_tmp52_->component == i) {
							XmppXepJingleIceUdpCandidate* _tmp53_;
							NiceCandidate* _tmp54_;
							_tmp53_ = candidate;
							_tmp54_ = dino_plugins_ice_transport_parameters_candidate_to_nice (_tmp53_);
							candidates = g_slist_append (candidates, _tmp54_);
						}
						_xmpp_xep_jingle_ice_udp_candidate_unref0 (candidate);
					}
				}
				_tmp55_ = self->priv->agent;
				_tmp56_ = candidates;
				new_candidates = nice_agent_set_remote_candidates (_tmp55_, self->priv->stream_id, (guint) i, _tmp56_);
				g_debug ("transport_parameters.vala:228: Updated to %i remote candidates for can" \
"didate %u via transport info", new_candidates, (guint) i);
				(candidates == NULL) ? NULL : (candidates = (_g_slist_free__nice_candidate_free0_ (candidates), NULL));
			}
		}
	}
}

static void
dino_plugins_ice_transport_parameters_real_create_transport_connection (XmppXepJingleIceUdpIceUdpTransportParameters* base,
                                                                        XmppXmppStream* stream,
                                                                        XmppXepJingleContent* content)
{
	DinoPluginsIceTransportParameters * self;
	XmppXepJingleSession* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	const gchar* _tmp4_;
	const gchar* _tmp5_;
	const gchar* _tmp6_;
	const gchar* _tmp7_;
	const gchar* _tmp8_;
	const gchar* _tmp9_;
	const gchar* _tmp10_;
	const gchar* _tmp11_;
	const gchar* _tmp12_;
	gchar* _tmp13_;
	gchar* _tmp14_;
	const gchar* _tmp15_;
	const gchar* _tmp16_;
	gchar* _tmp17_;
	gchar* _tmp18_;
	const gchar* _tmp19_;
	const gchar* _tmp20_;
	const gchar* _tmp21_;
	const gchar* _tmp22_;
	gchar* _tmp23_;
	gchar* _tmp24_;
	const gchar* _tmp25_;
	const gchar* _tmp26_;
	gchar* _tmp27_;
	gchar* _tmp28_;
	const gchar* _tmp29_;
	const gchar* _tmp30_;
	gboolean _tmp31_ = FALSE;
	gboolean _tmp32_ = FALSE;
	const gchar* _tmp33_;
	const gchar* _tmp34_;
	self = (DinoPluginsIceTransportParameters*) base;
	g_return_if_fail (stream != NULL);
	g_return_if_fail (content != NULL);
	_tmp0_ = content->session;
	_tmp1_ = xmpp_xep_jingle_session_get_sid (_tmp0_);
	_tmp2_ = _tmp1_;
	g_debug ("transport_parameters.vala:233: create_transport_connection: %s", _tmp2_);
	_tmp3_ = xmpp_xep_jingle_ice_udp_ice_udp_transport_parameters_get_local_ufrag ((XmppXepJingleIceUdpIceUdpTransportParameters*) self);
	_tmp4_ = _tmp3_;
	_tmp5_ = xmpp_xep_jingle_ice_udp_ice_udp_transport_parameters_get_local_pwd ((XmppXepJingleIceUdpIceUdpTransportParameters*) self);
	_tmp6_ = _tmp5_;
	g_debug ("transport_parameters.vala:234: local_credentials: %s %s", _tmp4_, _tmp6_);
	_tmp7_ = xmpp_xep_jingle_ice_udp_ice_udp_transport_parameters_get_remote_ufrag ((XmppXepJingleIceUdpIceUdpTransportParameters*) self);
	_tmp8_ = _tmp7_;
	_tmp9_ = xmpp_xep_jingle_ice_udp_ice_udp_transport_parameters_get_remote_pwd ((XmppXepJingleIceUdpIceUdpTransportParameters*) self);
	_tmp10_ = _tmp9_;
	g_debug ("transport_parameters.vala:235: remote_credentials: %s %s", _tmp8_, _tmp10_);
	_tmp11_ = xmpp_xep_jingle_ice_udp_ice_udp_transport_parameters_get_local_ufrag ((XmppXepJingleIceUdpIceUdpTransportParameters*) self);
	_tmp12_ = _tmp11_;
	_tmp13_ = g_strconcat (_tmp12_, ":", NULL);
	_tmp14_ = _tmp13_;
	_tmp15_ = xmpp_xep_jingle_ice_udp_ice_udp_transport_parameters_get_remote_ufrag ((XmppXepJingleIceUdpIceUdpTransportParameters*) self);
	_tmp16_ = _tmp15_;
	_tmp17_ = g_strconcat (_tmp14_, _tmp16_, NULL);
	_tmp18_ = _tmp17_;
	_tmp19_ = xmpp_xep_jingle_ice_udp_ice_udp_transport_parameters_get_local_pwd ((XmppXepJingleIceUdpIceUdpTransportParameters*) self);
	_tmp20_ = _tmp19_;
	g_debug ("transport_parameters.vala:236: expected incoming credentials: %s %s", _tmp18_, _tmp20_);
	_g_free0 (_tmp18_);
	_g_free0 (_tmp14_);
	_tmp21_ = xmpp_xep_jingle_ice_udp_ice_udp_transport_parameters_get_remote_ufrag ((XmppXepJingleIceUdpIceUdpTransportParameters*) self);
	_tmp22_ = _tmp21_;
	_tmp23_ = g_strconcat (_tmp22_, ":", NULL);
	_tmp24_ = _tmp23_;
	_tmp25_ = xmpp_xep_jingle_ice_udp_ice_udp_transport_parameters_get_local_ufrag ((XmppXepJingleIceUdpIceUdpTransportParameters*) self);
	_tmp26_ = _tmp25_;
	_tmp27_ = g_strconcat (_tmp24_, _tmp26_, NULL);
	_tmp28_ = _tmp27_;
	_tmp29_ = xmpp_xep_jingle_ice_udp_ice_udp_transport_parameters_get_remote_pwd ((XmppXepJingleIceUdpIceUdpTransportParameters*) self);
	_tmp30_ = _tmp29_;
	g_debug ("transport_parameters.vala:237: expected outgoing credentials: %s %s", _tmp28_, _tmp30_);
	_g_free0 (_tmp28_);
	_g_free0 (_tmp24_);
	self->priv->we_want_connection = TRUE;
	_tmp33_ = xmpp_xep_jingle_ice_udp_ice_udp_transport_parameters_get_remote_ufrag ((XmppXepJingleIceUdpIceUdpTransportParameters*) self);
	_tmp34_ = _tmp33_;
	if (_tmp34_ != NULL) {
		const gchar* _tmp35_;
		const gchar* _tmp36_;
		_tmp35_ = xmpp_xep_jingle_ice_udp_ice_udp_transport_parameters_get_remote_pwd ((XmppXepJingleIceUdpIceUdpTransportParameters*) self);
		_tmp36_ = _tmp35_;
		_tmp32_ = _tmp36_ != NULL;
	} else {
		_tmp32_ = FALSE;
	}
	if (_tmp32_) {
		_tmp31_ = !self->priv->remote_credentials_set;
	} else {
		_tmp31_ = FALSE;
	}
	if (_tmp31_) {
		NiceAgent* _tmp37_;
		const gchar* _tmp38_;
		const gchar* _tmp39_;
		const gchar* _tmp40_;
		const gchar* _tmp41_;
		_tmp37_ = self->priv->agent;
		_tmp38_ = xmpp_xep_jingle_ice_udp_ice_udp_transport_parameters_get_remote_ufrag ((XmppXepJingleIceUdpIceUdpTransportParameters*) self);
		_tmp39_ = _tmp38_;
		_tmp40_ = xmpp_xep_jingle_ice_udp_ice_udp_transport_parameters_get_remote_pwd ((XmppXepJingleIceUdpIceUdpTransportParameters*) self);
		_tmp41_ = _tmp40_;
		nice_agent_set_remote_credentials (_tmp37_, self->priv->stream_id, _tmp39_, _tmp41_);
		self->priv->remote_credentials_set = TRUE;
	}
	{
		guint8 i = 0U;
		i = (guint8) 1;
		{
			gboolean _tmp42_ = FALSE;
			_tmp42_ = TRUE;
			while (TRUE) {
				guint8 _tmp44_;
				guint8 _tmp45_;
				GSList* candidates = NULL;
				gint new_candidates = 0;
				NiceAgent* _tmp65_;
				GSList* _tmp66_;
				GeeMap* _tmp67_;
				NiceAgent* _tmp68_;
				DinoPluginsIceDtlsSrtpHandler* _tmp69_;
				DinoPluginsIceTransportParametersDatagramConnection* _tmp70_;
				DinoPluginsIceTransportParametersDatagramConnection* _tmp71_;
				GeeMap* _tmp72_;
				gpointer _tmp73_;
				DinoPluginsIceTransportParametersDatagramConnection* _tmp74_;
				if (!_tmp42_) {
					guint8 _tmp43_;
					_tmp43_ = i;
					i = _tmp43_ + 1;
				}
				_tmp42_ = FALSE;
				_tmp44_ = xmpp_xep_jingle_transport_parameters_get_components ((XmppXepJingleTransportParameters*) self);
				_tmp45_ = _tmp44_;
				if (!(i <= _tmp45_)) {
					break;
				}
				candidates = NULL;
				{
					GeeList* _candidate_list = NULL;
					GeeList* _tmp46_;
					gint _candidate_size = 0;
					GeeList* _tmp47_;
					gint _tmp48_;
					gint _tmp49_;
					gint _candidate_index = 0;
					_tmp46_ = ((XmppXepJingleIceUdpIceUdpTransportParameters*) self)->remote_candidates;
					_candidate_list = _tmp46_;
					_tmp47_ = _candidate_list;
					_tmp48_ = gee_collection_get_size ((GeeCollection*) _tmp47_);
					_tmp49_ = _tmp48_;
					_candidate_size = _tmp49_;
					_candidate_index = -1;
					while (TRUE) {
						gint _tmp50_;
						gint _tmp51_;
						XmppXepJingleIceUdpCandidate* candidate = NULL;
						GeeList* _tmp52_;
						gpointer _tmp53_;
						XmppXepJingleIceUdpCandidate* _tmp54_;
						const gchar* _tmp55_;
						XmppXepJingleIceUdpCandidate* _tmp56_;
						_candidate_index = _candidate_index + 1;
						_tmp50_ = _candidate_index;
						_tmp51_ = _candidate_size;
						if (!(_tmp50_ < _tmp51_)) {
							break;
						}
						_tmp52_ = _candidate_list;
						_tmp53_ = gee_list_get (_tmp52_, _candidate_index);
						candidate = (XmppXepJingleIceUdpCandidate*) _tmp53_;
						_tmp54_ = candidate;
						_tmp55_ = _tmp54_->ip;
						if (g_str_has_prefix (_tmp55_, "fe80::")) {
							_xmpp_xep_jingle_ice_udp_candidate_unref0 (candidate);
							continue;
						}
						_tmp56_ = candidate;
						if (_tmp56_->component == i) {
							XmppXepJingleIceUdpCandidate* _tmp57_;
							NiceCandidate* _tmp58_;
							NiceAgent* _tmp59_;
							XmppXepJingleIceUdpCandidate* _tmp60_;
							NiceCandidate* _tmp61_;
							NiceCandidate* _tmp62_;
							gchar* _tmp63_;
							gchar* _tmp64_;
							_tmp57_ = candidate;
							_tmp58_ = dino_plugins_ice_transport_parameters_candidate_to_nice (_tmp57_);
							candidates = g_slist_append (candidates, _tmp58_);
							_tmp59_ = self->priv->agent;
							_tmp60_ = candidate;
							_tmp61_ = dino_plugins_ice_transport_parameters_candidate_to_nice (_tmp60_);
							_tmp62_ = _tmp61_;
							_tmp63_ = nice_agent_generate_local_candidate_sdp (_tmp59_, _tmp62_);
							_tmp64_ = _tmp63_;
							g_debug ("transport_parameters.vala:251: remote candidate: %s", _tmp64_);
							_g_free0 (_tmp64_);
							_nice_candidate_free0 (_tmp62_);
						}
						_xmpp_xep_jingle_ice_udp_candidate_unref0 (candidate);
					}
				}
				_tmp65_ = self->priv->agent;
				_tmp66_ = candidates;
				new_candidates = nice_agent_set_remote_candidates (_tmp65_, self->priv->stream_id, (guint) i, _tmp66_);
				g_debug ("transport_parameters.vala:255: Initiated component %u with %i remote c" \
"andidates", (guint) i, new_candidates);
				_tmp67_ = self->priv->connections;
				_tmp68_ = self->priv->agent;
				_tmp69_ = self->priv->dtls_srtp_handler;
				_tmp70_ = dino_plugins_ice_transport_parameters_datagram_connection_new (_tmp68_, _tmp69_, self->priv->stream_id, i);
				_tmp71_ = _tmp70_;
				gee_map_set (_tmp67_, (gpointer) ((guintptr) i), _tmp71_);
				_g_object_unref0 (_tmp71_);
				_tmp72_ = self->priv->connections;
				_tmp73_ = gee_map_get (_tmp72_, (gpointer) ((guintptr) i));
				_tmp74_ = (DinoPluginsIceTransportParametersDatagramConnection*) _tmp73_;
				xmpp_xep_jingle_content_set_transport_connection (content, (XmppXepJingleComponentConnection*) _tmp74_, i);
				_g_object_unref0 (_tmp74_);
				(candidates == NULL) ? NULL : (candidates = (_g_slist_free__nice_candidate_free0_ (candidates), NULL));
			}
		}
	}
	XMPP_XEP_JINGLE_ICE_UDP_ICE_UDP_TRANSPORT_PARAMETERS_CLASS (dino_plugins_ice_transport_parameters_parent_class)->create_transport_connection (G_TYPE_CHECK_INSTANCE_CAST (self, XMPP_XEP_JINGLE_ICE_UDP_TYPE_ICE_UDP_TRANSPORT_PARAMETERS, XmppXepJingleIceUdpIceUdpTransportParameters), stream, content);
}

static void
___lambda8_ (DinoPluginsIceTransportParameters* self,
             GObject* _,
             GAsyncResult* res)
{
	XmppXepJingleContentEncryption* encryption = NULL;
	DinoPluginsIceDtlsSrtpHandler* _tmp0_;
	XmppXepJingleContentEncryption* _tmp1_;
	XmppXepJingleContentEncryption* _tmp2_;
	g_return_if_fail (res != NULL);
	_tmp0_ = self->priv->dtls_srtp_handler;
	_tmp1_ = dino_plugins_ice_dtls_srtp_handler_setup_dtls_connection_finish (_tmp0_, res);
	encryption = _tmp1_;
	_tmp2_ = encryption;
	if (_tmp2_ != NULL) {
		XmppXepJingleContent* _tmp3_;
		GeeHashMap* _tmp4_;
		XmppXepJingleContentEncryption* _tmp5_;
		const gchar* _tmp6_;
		XmppXepJingleContentEncryption* _tmp7_;
		_tmp3_ = ((XmppXepJingleIceUdpIceUdpTransportParameters*) self)->content;
		_tmp4_ = _tmp3_->encryptions;
		_tmp5_ = encryption;
		_tmp6_ = _tmp5_->encryption_ns;
		_tmp7_ = encryption;
		gee_abstract_map_set ((GeeAbstractMap*) _tmp4_, _tmp6_, _tmp7_);
	}
	_g_object_unref0 (encryption);
}

static void
____lambda8__gasync_ready_callback (GObject* source_object,
                                    GAsyncResult* res,
                                    gpointer self)
{
	___lambda8_ ((DinoPluginsIceTransportParameters*) self, source_object, res);
	g_object_unref (self);
}

static void
dino_plugins_ice_transport_parameters_on_component_state_changed (DinoPluginsIceTransportParameters* self,
                                                                  guint stream_id,
                                                                  guint component_id,
                                                                  guint state)
{
	NiceAgent* _tmp0_;
	const gchar* _tmp1_;
	gboolean _tmp2_ = FALSE;
	gboolean _tmp3_ = FALSE;
	gboolean _tmp4_ = FALSE;
	gboolean _tmp5_ = FALSE;
	gboolean _tmp6_;
	gboolean _tmp7_;
	g_return_if_fail (self != NULL);
	if (stream_id != self->priv->stream_id) {
		return;
	}
	_tmp0_ = self->priv->agent;
	_tmp1_ = nice_component_state_to_string (nice_agent_get_component_state (_tmp0_, stream_id, component_id));
	g_debug ("transport_parameters.vala:266: stream %u component %u state changed to" \
" %s", stream_id, component_id, _tmp1_);
	dino_plugins_ice_transport_parameters_may_consider_ready (self, stream_id, component_id);
	_tmp6_ = xmpp_xep_jingle_ice_udp_ice_udp_transport_parameters_get_incoming ((XmppXepJingleIceUdpIceUdpTransportParameters*) self);
	_tmp7_ = _tmp6_;
	if (_tmp7_) {
		DinoPluginsIceDtlsSrtpHandler* _tmp8_;
		_tmp8_ = self->priv->dtls_srtp_handler;
		_tmp5_ = _tmp8_ != NULL;
	} else {
		_tmp5_ = FALSE;
	}
	if (_tmp5_) {
		DinoPluginsIceDtlsSrtpHandler* _tmp9_;
		gboolean _tmp10_;
		gboolean _tmp11_;
		_tmp9_ = self->priv->dtls_srtp_handler;
		_tmp10_ = dino_plugins_ice_dtls_srtp_handler_get_ready (_tmp9_);
		_tmp11_ = _tmp10_;
		_tmp4_ = !_tmp11_;
	} else {
		_tmp4_ = FALSE;
	}
	if (_tmp4_) {
		NiceAgent* _tmp12_;
		_tmp12_ = self->priv->agent;
		_tmp3_ = dino_plugins_ice_is_component_ready (_tmp12_, stream_id, component_id);
	} else {
		_tmp3_ = FALSE;
	}
	if (_tmp3_) {
		DinoPluginsIceDtlsSrtpHandler* _tmp13_;
		DinoPluginsIceDtlsSrtpMode _tmp14_;
		DinoPluginsIceDtlsSrtpMode _tmp15_;
		_tmp13_ = self->priv->dtls_srtp_handler;
		_tmp14_ = dino_plugins_ice_dtls_srtp_handler_get_mode (_tmp13_);
		_tmp15_ = _tmp14_;
		_tmp2_ = _tmp15_ == DINO_PLUGINS_ICE_DTLS_SRTP_MODE_CLIENT;
	} else {
		_tmp2_ = FALSE;
	}
	if (_tmp2_) {
		DinoPluginsIceDtlsSrtpHandler* _tmp16_;
		_tmp16_ = self->priv->dtls_srtp_handler;
		dino_plugins_ice_dtls_srtp_handler_setup_dtls_connection (_tmp16_, ____lambda8__gasync_ready_callback, g_object_ref (self));
	}
}

static void
dino_plugins_ice_transport_parameters_may_consider_ready (DinoPluginsIceTransportParameters* self,
                                                          guint stream_id,
                                                          guint component_id)
{
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_ = FALSE;
	gboolean _tmp2_ = FALSE;
	GeeMap* _tmp3_;
	g_return_if_fail (self != NULL);
	if (stream_id != self->priv->stream_id) {
		return;
	}
	_tmp3_ = self->priv->connections;
	if (gee_map_has_key (_tmp3_, (gpointer) ((guintptr) component_id))) {
		GeeMap* _tmp4_;
		gpointer _tmp5_;
		DinoPluginsIceTransportParametersDatagramConnection* _tmp6_;
		gboolean _tmp7_;
		gboolean _tmp8_;
		_tmp4_ = self->priv->connections;
		_tmp5_ = gee_map_get (_tmp4_, (gpointer) ((guintptr) component_id));
		_tmp6_ = (DinoPluginsIceTransportParametersDatagramConnection*) _tmp5_;
		_tmp7_ = xmpp_xep_jingle_datagram_connection_get_ready ((XmppXepJingleDatagramConnection*) _tmp6_);
		_tmp8_ = _tmp7_;
		_tmp2_ = !_tmp8_;
		_g_object_unref0 (_tmp6_);
	} else {
		_tmp2_ = FALSE;
	}
	if (_tmp2_) {
		NiceAgent* _tmp9_;
		_tmp9_ = self->priv->agent;
		_tmp1_ = dino_plugins_ice_is_component_ready (_tmp9_, stream_id, component_id);
	} else {
		_tmp1_ = FALSE;
	}
	if (_tmp1_) {
		gboolean _tmp10_ = FALSE;
		DinoPluginsIceDtlsSrtpHandler* _tmp11_;
		_tmp11_ = self->priv->dtls_srtp_handler;
		if (_tmp11_ == NULL) {
			_tmp10_ = TRUE;
		} else {
			DinoPluginsIceDtlsSrtpHandler* _tmp12_;
			gboolean _tmp13_;
			gboolean _tmp14_;
			_tmp12_ = self->priv->dtls_srtp_handler;
			_tmp13_ = dino_plugins_ice_dtls_srtp_handler_get_ready (_tmp12_);
			_tmp14_ = _tmp13_;
			_tmp10_ = _tmp14_;
		}
		_tmp0_ = _tmp10_;
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		GeeMap* _tmp15_;
		gpointer _tmp16_;
		DinoPluginsIceTransportParametersDatagramConnection* _tmp17_;
		_tmp15_ = self->priv->connections;
		_tmp16_ = gee_map_get (_tmp15_, (gpointer) ((guintptr) component_id));
		_tmp17_ = (DinoPluginsIceTransportParametersDatagramConnection*) _tmp16_;
		xmpp_xep_jingle_datagram_connection_set_ready ((XmppXepJingleDatagramConnection*) _tmp17_, TRUE);
		_g_object_unref0 (_tmp17_);
	}
}

static void
dino_plugins_ice_transport_parameters_on_initial_binding_request_received (DinoPluginsIceTransportParameters* self,
                                                                           guint stream_id)
{
	g_return_if_fail (self != NULL);
	if (stream_id != self->priv->stream_id) {
		return;
	}
	g_debug ("transport_parameters.vala:287: initial_binding_request_received");
}

static void
dino_plugins_ice_transport_parameters_on_new_selected_pair_full (DinoPluginsIceTransportParameters* self,
                                                                 guint stream_id,
                                                                 guint component_id,
                                                                 NiceCandidate* p1,
                                                                 NiceCandidate* p2)
{
	NiceAgent* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	NiceAgent* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (p1 != NULL);
	g_return_if_fail (p2 != NULL);
	if (stream_id != self->priv->stream_id) {
		return;
	}
	_tmp0_ = self->priv->agent;
	_tmp1_ = nice_agent_generate_local_candidate_sdp (_tmp0_, p1);
	_tmp2_ = _tmp1_;
	_tmp3_ = self->priv->agent;
	_tmp4_ = nice_agent_generate_local_candidate_sdp (_tmp3_, p2);
	_tmp5_ = _tmp4_;
	g_debug ("transport_parameters.vala:292: new_selected_pair_full %u [%s, %s]", component_id, _tmp2_, _tmp5_);
	_g_free0 (_tmp5_);
	_g_free0 (_tmp2_);
}

static void
dino_plugins_ice_transport_parameters_on_recv (DinoPluginsIceTransportParameters* self,
                                               NiceAgent* agent,
                                               guint stream_id,
                                               guint component_id,
                                               guint8* data,
                                               gint data_length1)
{
	guint8* decrypt_data = NULL;
	gint decrypt_data_length1;
	gint _decrypt_data_size_;
	DinoPluginsIceDtlsSrtpHandler* _tmp0_;
	GeeMap* _tmp9_;
	GError* _inner_error0_ = NULL;
	g_return_if_fail (self != NULL);
	g_return_if_fail (agent != NULL);
	if (stream_id != self->priv->stream_id) {
		return;
	}
	decrypt_data = NULL;
	decrypt_data_length1 = 0;
	_decrypt_data_size_ = decrypt_data_length1;
	_tmp0_ = self->priv->dtls_srtp_handler;
	if (_tmp0_ != NULL) {
		{
			guint8* _tmp1_ = NULL;
			DinoPluginsIceDtlsSrtpHandler* _tmp2_;
			gint _tmp3_ = 0;
			guint8* _tmp4_;
			gint _tmp1__length1;
			gint __tmp1__size_;
			guint8* _tmp5_;
			gint _tmp5__length1;
			guint8* _tmp6_;
			gint _tmp6__length1;
			_tmp2_ = self->priv->dtls_srtp_handler;
			_tmp4_ = dino_plugins_ice_dtls_srtp_handler_process_incoming_data (_tmp2_, component_id, data, (gint) data_length1, &_tmp3_, &_inner_error0_);
			_tmp1_ = _tmp4_;
			_tmp1__length1 = _tmp3_;
			__tmp1__size_ = _tmp1__length1;
			if (G_UNLIKELY (_inner_error0_ != NULL)) {
				if (_inner_error0_->domain == CRYPTO_ERROR) {
					goto __catch0_crypto_error;
				}
				decrypt_data = (g_free (decrypt_data), NULL);
				g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
				g_clear_error (&_inner_error0_);
				return;
			}
			_tmp5_ = _tmp1_;
			_tmp5__length1 = _tmp1__length1;
			_tmp1_ = NULL;
			_tmp1__length1 = 0;
			decrypt_data = (g_free (decrypt_data), NULL);
			decrypt_data = _tmp5_;
			decrypt_data_length1 = _tmp5__length1;
			_decrypt_data_size_ = decrypt_data_length1;
			_tmp6_ = decrypt_data;
			_tmp6__length1 = decrypt_data_length1;
			if (_tmp6_ == NULL) {
				_tmp1_ = (g_free (_tmp1_), NULL);
				decrypt_data = (g_free (decrypt_data), NULL);
				return;
			}
			_tmp1_ = (g_free (_tmp1_), NULL);
		}
		goto __finally0;
		__catch0_crypto_error:
		{
			GError* e = NULL;
			GError* _tmp7_;
			const gchar* _tmp8_;
			e = _inner_error0_;
			_inner_error0_ = NULL;
			_tmp7_ = e;
			_tmp8_ = _tmp7_->message;
			g_warning ("transport_parameters.vala:303: %s while on_recv stream %u component %u", _tmp8_, stream_id, component_id);
			_g_error_free0 (e);
			decrypt_data = (g_free (decrypt_data), NULL);
			return;
		}
		__finally0:
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			decrypt_data = (g_free (decrypt_data), NULL);
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
			g_clear_error (&_inner_error0_);
			return;
		}
	}
	dino_plugins_ice_transport_parameters_may_consider_ready (self, stream_id, component_id);
	_tmp9_ = self->priv->connections;
	if (gee_map_has_key (_tmp9_, (gpointer) ((guintptr) component_id))) {
		GeeMap* _tmp10_;
		gpointer _tmp11_;
		DinoPluginsIceTransportParametersDatagramConnection* _tmp12_;
		gboolean _tmp13_;
		gboolean _tmp14_;
		gboolean _tmp15_;
		guint8* _tmp17_ = NULL;
		guint8* _tmp18_;
		gint _tmp18__length1;
		gint _tmp17__length1;
		gint __tmp17__size_;
		GeeMap* _tmp19_;
		gpointer _tmp20_;
		DinoPluginsIceTransportParametersDatagramConnection* _tmp21_;
		GBytes* _tmp22_;
		GBytes* _tmp23_;
		_tmp10_ = self->priv->connections;
		_tmp11_ = gee_map_get (_tmp10_, (gpointer) ((guintptr) component_id));
		_tmp12_ = (DinoPluginsIceTransportParametersDatagramConnection*) _tmp11_;
		_tmp13_ = xmpp_xep_jingle_datagram_connection_get_ready ((XmppXepJingleDatagramConnection*) _tmp12_);
		_tmp14_ = _tmp13_;
		_tmp15_ = !_tmp14_;
		_g_object_unref0 (_tmp12_);
		if (_tmp15_) {
			const gchar* _tmp16_;
			_tmp16_ = nice_component_state_to_string (nice_agent_get_component_state (agent, stream_id, component_id));
			g_debug ("transport_parameters.vala:310: on_recv stream %u component %u when sta" \
"te %s", stream_id, component_id, _tmp16_);
		}
		_tmp18_ = decrypt_data;
		_tmp18__length1 = decrypt_data_length1;
		_tmp17_ = _tmp18_;
		_tmp17__length1 = _tmp18__length1;
		__tmp17__size_ = _tmp17__length1;
		if (_tmp17_ == NULL) {
			_tmp17_ = data;
			_tmp17__length1 = data_length1;
			__tmp17__size_ = _tmp17__length1;
		}
		_tmp19_ = self->priv->connections;
		_tmp20_ = gee_map_get (_tmp19_, (gpointer) ((guintptr) component_id));
		_tmp21_ = (DinoPluginsIceTransportParametersDatagramConnection*) _tmp20_;
		_tmp22_ = g_bytes_new (_tmp17_, _tmp17__length1);
		_tmp23_ = _tmp22_;
		g_signal_emit_by_name ((XmppXepJingleDatagramConnection*) _tmp21_, "datagram-received", _tmp23_);
		_g_bytes_unref0 (_tmp23_);
		_g_object_unref0 (_tmp21_);
	} else {
		g_debug ("transport_parameters.vala:314: on_recv stream %u component %u length %" \
"u", stream_id, component_id, (guint) data_length1);
	}
	decrypt_data = (g_free (decrypt_data), NULL);
}

static guint8*
string_get_data (const gchar* self,
                 gint* result_length1)
{
	guint8* result;
	guint8* res = NULL;
	gint res_length1;
	gint _res_size_;
	gint _tmp0_;
	gint _tmp1_;
	guint8* _tmp2_;
	gint _tmp2__length1;
	g_return_val_if_fail (self != NULL, NULL);
	res = (guint8*) self;
	res_length1 = -1;
	_res_size_ = res_length1;
	_tmp0_ = strlen (self);
	_tmp1_ = _tmp0_;
	res_length1 = (gint) _tmp1_;
	_tmp2_ = res;
	_tmp2__length1 = res_length1;
	if (result_length1) {
		*result_length1 = _tmp2__length1;
	}
	result = _tmp2_;
	return result;
}

static NiceCandidate*
dino_plugins_ice_transport_parameters_candidate_to_nice (XmppXepJingleIceUdpCandidate* c)
{
	NiceCandidateType type = 0;
	NiceCandidate* candidate = NULL;
	NiceCandidate* _tmp0_;
	NiceCandidate* _tmp1_;
	gchar* foundation = NULL;
	gchar* _tmp2_;
	gint foundation_length1;
	gint _foundation_size_;
	gchar* _tmp3_;
	gint _tmp3__length1;
	const gchar* _tmp4_;
	guint8* _tmp5_;
	gint _tmp5__length1;
	gint _tmp6_ = 0;
	guint8* _tmp7_;
	gint _tmp7__length1;
	const gchar* _tmp8_;
	gint _tmp9_;
	gint _tmp10_;
	NiceCandidate* _tmp11_;
	gchar* _tmp12_;
	gint _tmp12__length1;
	NiceCandidate* _tmp13_;
	NiceCandidate* _tmp14_;
	NiceCandidate* _tmp15_;
	const gchar* _tmp16_;
	NiceCandidate* _tmp17_;
	NiceCandidate* _tmp18_;
	const gchar* _tmp19_;
	NiceCandidate* _tmp25_;
	NiceCandidate* result;
	g_return_val_if_fail (c != NULL, NULL);
	switch (c->type_) {
		case XMPP_XEP_JINGLE_ICE_UDP_CANDIDATE_TYPE_HOST:
		{
			type = NICE_CANDIDATE_TYPE_HOST;
			break;
		}
		case XMPP_XEP_JINGLE_ICE_UDP_CANDIDATE_TYPE_PRFLX:
		{
			type = NICE_CANDIDATE_TYPE_PEER_REFLEXIVE;
			break;
		}
		case XMPP_XEP_JINGLE_ICE_UDP_CANDIDATE_TYPE_RELAY:
		{
			type = NICE_CANDIDATE_TYPE_RELAYED;
			break;
		}
		case XMPP_XEP_JINGLE_ICE_UDP_CANDIDATE_TYPE_SRFLX:
		{
			type = NICE_CANDIDATE_TYPE_SERVER_REFLEXIVE;
			break;
		}
		default:
		{
			g_assert_not_reached ();
		}
	}
	_tmp0_ = nice_candidate_new (type);
	candidate = _tmp0_;
	_tmp1_ = candidate;
	_tmp1_->component_id = (guint) c->component;
	_tmp2_ = g_new0 (gchar, NICE_CANDIDATE_MAX_FOUNDATION);
	foundation = _tmp2_;
	foundation_length1 = NICE_CANDIDATE_MAX_FOUNDATION;
	_foundation_size_ = foundation_length1;
	_tmp3_ = foundation;
	_tmp3__length1 = foundation_length1;
	_tmp4_ = c->foundation;
	_tmp5_ = string_get_data (_tmp4_, &_tmp6_);
	_tmp5__length1 = _tmp6_;
	_tmp7_ = _tmp5_;
	_tmp7__length1 = _tmp5__length1;
	_tmp8_ = c->foundation;
	_tmp9_ = strlen (_tmp8_);
	_tmp10_ = _tmp9_;
	memcpy (_tmp3_, _tmp7_, MIN ((gsize) _tmp10_, (gsize) (NICE_CANDIDATE_MAX_FOUNDATION - 1)));
	_tmp11_ = candidate;
	_tmp12_ = foundation;
	_tmp12__length1 = foundation_length1;
	memcpy (_tmp11_->foundation, _tmp12_, 33 * sizeof (gchar));
	_tmp13_ = candidate;
	memset (&_tmp13_->addr, 0, sizeof (NiceAddress));
	_tmp14_ = candidate;
	nice_address_init (&_tmp14_->addr);
	_tmp15_ = candidate;
	_tmp16_ = c->ip;
	nice_address_set_from_string (&_tmp15_->addr, _tmp16_);
	_tmp17_ = candidate;
	nice_address_set_port (&_tmp17_->addr, (guint) c->port);
	_tmp18_ = candidate;
	_tmp18_->priority = c->priority;
	_tmp19_ = c->rel_addr;
	if (_tmp19_ != NULL) {
		NiceCandidate* _tmp20_;
		NiceCandidate* _tmp21_;
		NiceCandidate* _tmp22_;
		const gchar* _tmp23_;
		NiceCandidate* _tmp24_;
		_tmp20_ = candidate;
		memset (&_tmp20_->base_addr, 0, sizeof (NiceAddress));
		_tmp21_ = candidate;
		nice_address_init (&_tmp21_->base_addr);
		_tmp22_ = candidate;
		_tmp23_ = c->rel_addr;
		nice_address_set_from_string (&_tmp22_->base_addr, _tmp23_);
		_tmp24_ = candidate;
		nice_address_set_port (&_tmp24_->base_addr, (guint) c->rel_port);
	}
	_tmp25_ = candidate;
	_tmp25_->transport = NICE_CANDIDATE_TRANSPORT_UDP;
	result = candidate;
	foundation = (g_free (foundation), NULL);
	return result;
}

static XmppXepJingleIceUdpCandidate*
dino_plugins_ice_transport_parameters_candidate_to_jingle (NiceCandidate* nc)
{
	XmppXepJingleIceUdpCandidate* candidate = NULL;
	XmppXepJingleIceUdpCandidate* _tmp0_;
	XmppXepJingleIceUdpCandidate* _tmp5_;
	XmppXepJingleIceUdpCandidate* _tmp6_;
	gchar* _tmp7_;
	XmppXepJingleIceUdpCandidate* _tmp8_;
	XmppXepJingleIceUdpCandidate* _tmp9_;
	gchar* _tmp10_;
	gchar* res = NULL;
	gchar* _tmp11_;
	gint res_length1;
	gint _res_size_;
	gchar* _tmp12_;
	gint _tmp12__length1;
	XmppXepJingleIceUdpCandidate* _tmp13_;
	gchar* _tmp14_;
	gint _tmp14__length1;
	gchar* _tmp15_;
	XmppXepJingleIceUdpCandidate* _tmp16_;
	XmppXepJingleIceUdpCandidate* _tmp17_;
	XmppXepJingleIceUdpCandidate* _tmp18_;
	XmppXepJingleIceUdpCandidate* _tmp19_;
	gchar* _tmp20_;
	gboolean _tmp21_ = FALSE;
	XmppXepJingleIceUdpCandidate* _tmp29_;
	const gchar* _tmp30_;
	XmppXepJingleIceUdpCandidate* result;
	g_return_val_if_fail (nc != NULL, NULL);
	_tmp0_ = xmpp_xep_jingle_ice_udp_candidate_new ();
	candidate = _tmp0_;
	switch (nc->type) {
		case NICE_CANDIDATE_TYPE_HOST:
		{
			XmppXepJingleIceUdpCandidate* _tmp1_;
			_tmp1_ = candidate;
			_tmp1_->type_ = XMPP_XEP_JINGLE_ICE_UDP_CANDIDATE_TYPE_HOST;
			break;
		}
		case NICE_CANDIDATE_TYPE_PEER_REFLEXIVE:
		{
			XmppXepJingleIceUdpCandidate* _tmp2_;
			_tmp2_ = candidate;
			_tmp2_->type_ = XMPP_XEP_JINGLE_ICE_UDP_CANDIDATE_TYPE_PRFLX;
			break;
		}
		case NICE_CANDIDATE_TYPE_RELAYED:
		{
			XmppXepJingleIceUdpCandidate* _tmp3_;
			_tmp3_ = candidate;
			_tmp3_->type_ = XMPP_XEP_JINGLE_ICE_UDP_CANDIDATE_TYPE_RELAY;
			break;
		}
		case NICE_CANDIDATE_TYPE_SERVER_REFLEXIVE:
		{
			XmppXepJingleIceUdpCandidate* _tmp4_;
			_tmp4_ = candidate;
			_tmp4_->type_ = XMPP_XEP_JINGLE_ICE_UDP_CANDIDATE_TYPE_SRFLX;
			break;
		}
		default:
		{
			g_assert_not_reached ();
		}
	}
	_tmp5_ = candidate;
	_tmp5_->component = (guint8) nc->component_id;
	_tmp6_ = candidate;
	_tmp7_ = g_strdup ((const gchar*) nc->foundation);
	_g_free0 (_tmp6_->foundation);
	_tmp6_->foundation = _tmp7_;
	_tmp8_ = candidate;
	_tmp8_->generation = (guint8) 0;
	_tmp9_ = candidate;
	_tmp10_ = g_strdup_printf ("%08x", g_random_int ());
	_g_free0 (_tmp9_->id);
	_tmp9_->id = _tmp10_;
	_tmp11_ = g_new0 (gchar, NICE_ADDRESS_STRING_LEN);
	res = _tmp11_;
	res_length1 = NICE_ADDRESS_STRING_LEN;
	_res_size_ = res_length1;
	_tmp12_ = res;
	_tmp12__length1 = res_length1;
	nice_address_to_string (&nc->addr, (gchar*) _tmp12_);
	_tmp13_ = candidate;
	_tmp14_ = res;
	_tmp14__length1 = res_length1;
	_tmp15_ = g_strdup ((const gchar*) _tmp14_);
	_g_free0 (_tmp13_->ip);
	_tmp13_->ip = _tmp15_;
	_tmp16_ = candidate;
	_tmp16_->network = (guint8) 0;
	_tmp17_ = candidate;
	_tmp17_->port = (guint16) nice_address_get_port (&nc->addr);
	_tmp18_ = candidate;
	_tmp18_->priority = nc->priority;
	_tmp19_ = candidate;
	_tmp20_ = g_strdup ("udp");
	_g_free0 (_tmp19_->protocol);
	_tmp19_->protocol = _tmp20_;
	if (nice_address_is_valid (&nc->base_addr)) {
		NiceAddress _tmp22_;
		_tmp22_ = nc->addr;
		_tmp21_ = !nice_address_equal (&nc->base_addr, &_tmp22_);
	} else {
		_tmp21_ = FALSE;
	}
	if (_tmp21_) {
		gchar* _tmp23_;
		gchar* _tmp24_;
		gint _tmp24__length1;
		XmppXepJingleIceUdpCandidate* _tmp25_;
		gchar* _tmp26_;
		gint _tmp26__length1;
		gchar* _tmp27_;
		XmppXepJingleIceUdpCandidate* _tmp28_;
		_tmp23_ = g_new0 (gchar, NICE_ADDRESS_STRING_LEN);
		res = (g_free (res), NULL);
		res = _tmp23_;
		res_length1 = NICE_ADDRESS_STRING_LEN;
		_res_size_ = res_length1;
		_tmp24_ = res;
		_tmp24__length1 = res_length1;
		nice_address_to_string (&nc->base_addr, (gchar*) _tmp24_);
		_tmp25_ = candidate;
		_tmp26_ = res;
		_tmp26__length1 = res_length1;
		_tmp27_ = g_strdup ((const gchar*) _tmp26_);
		_g_free0 (_tmp25_->rel_addr);
		_tmp25_->rel_addr = _tmp27_;
		_tmp28_ = candidate;
		_tmp28_->rel_port = (guint16) nice_address_get_port (&nc->base_addr);
	}
	_tmp29_ = candidate;
	_tmp30_ = _tmp29_->ip;
	if (g_str_has_prefix (_tmp30_, "fe80::")) {
		result = NULL;
		res = (g_free (res), NULL);
		_xmpp_xep_jingle_ice_udp_candidate_unref0 (candidate);
		return result;
	}
	result = candidate;
	res = (g_free (res), NULL);
	return result;
}

static void
dino_plugins_ice_transport_parameters_real_dispose (GObject* base)
{
	DinoPluginsIceTransportParameters * self;
	GeeMap* _tmp0_;
	GMainLoop* _tmp1_;
	self = (DinoPluginsIceTransportParameters*) base;
	G_OBJECT_CLASS (dino_plugins_ice_transport_parameters_parent_class)->dispose ((GObject*) G_TYPE_CHECK_INSTANCE_CAST (self, XMPP_XEP_JINGLE_ICE_UDP_TYPE_ICE_UDP_TRANSPORT_PARAMETERS, XmppXepJingleIceUdpIceUdpTransportParameters));
	_g_object_unref0 (self->priv->agent);
	self->priv->agent = NULL;
	_dino_plugins_ice_dtls_srtp_handler_unref0 (self->priv->dtls_srtp_handler);
	self->priv->dtls_srtp_handler = NULL;
	_tmp0_ = self->priv->connections;
	gee_map_clear (_tmp0_);
	_tmp1_ = self->priv->thread_loop;
	if (_tmp1_ != NULL) {
		GMainLoop* _tmp2_;
		_tmp2_ = self->priv->thread_loop;
		g_main_loop_quit (_tmp2_);
	}
}

static inline gpointer
dino_plugins_ice_transport_parameters_datagram_connection_get_instance_private (DinoPluginsIceTransportParametersDatagramConnection* self)
{
	return G_STRUCT_MEMBER_P (self, DinoPluginsIceTransportParametersDatagramConnection_private_offset);
}

static gpointer
_dino_plugins_ice_dtls_srtp_handler_ref0 (gpointer self)
{
	return self ? dino_plugins_ice_dtls_srtp_handler_ref (self) : NULL;
}

static gint
_vala_g_bytes_get_length (GBytes* self)
{
	gint result;
	g_return_val_if_fail (self != NULL, -1);
	result = (gint) g_bytes_get_size (self);
	return result;
}

static void
__lambda5_ (DinoPluginsIceTransportParametersDatagramConnection* self,
            GBytes* datagram)
{
	gulong _tmp0_;
	gulong _tmp1_;
	gint _tmp2_;
	gint _tmp3_;
	g_return_if_fail (datagram != NULL);
	_tmp0_ = xmpp_xep_jingle_component_connection_get_bytes_received ((XmppXepJingleComponentConnection*) self);
	_tmp1_ = _tmp0_;
	_tmp2_ = _vala_g_bytes_get_length (datagram);
	_tmp3_ = _tmp2_;
	xmpp_xep_jingle_component_connection_set_bytes_received ((XmppXepJingleComponentConnection*) self, _tmp1_ + _tmp3_);
}

static void
___lambda5__xmpp_xep_jingle_datagram_connection_datagram_received (XmppXepJingleDatagramConnection* _sender,
                                                                   GBytes* datagram,
                                                                   gpointer self)
{
	__lambda5_ ((DinoPluginsIceTransportParametersDatagramConnection*) self, datagram);
}

static DinoPluginsIceTransportParametersDatagramConnection*
dino_plugins_ice_transport_parameters_datagram_connection_construct (GType object_type,
                                                                     NiceAgent* agent,
                                                                     DinoPluginsIceDtlsSrtpHandler* dtls_srtp_handler,
                                                                     guint stream_id,
                                                                     guint8 component_id)
{
	DinoPluginsIceTransportParametersDatagramConnection * self = NULL;
	NiceAgent* _tmp0_;
	DinoPluginsIceDtlsSrtpHandler* _tmp1_;
	gulong _tmp2_;
	g_return_val_if_fail (agent != NULL, NULL);
	self = (DinoPluginsIceTransportParametersDatagramConnection*) xmpp_xep_jingle_datagram_connection_construct (object_type);
	_tmp0_ = _g_object_ref0 (agent);
	_g_object_unref0 (self->priv->agent);
	self->priv->agent = _tmp0_;
	_tmp1_ = _dino_plugins_ice_dtls_srtp_handler_ref0 (dtls_srtp_handler);
	_dino_plugins_ice_dtls_srtp_handler_unref0 (self->priv->dtls_srtp_handler);
	self->priv->dtls_srtp_handler = _tmp1_;
	self->priv->stream_id = stream_id;
	xmpp_xep_jingle_component_connection_set_component_id ((XmppXepJingleComponentConnection*) self, component_id);
	_tmp2_ = g_signal_connect_object ((XmppXepJingleDatagramConnection*) self, "datagram-received", (GCallback) ___lambda5__xmpp_xep_jingle_datagram_connection_datagram_received, self, 0);
	self->priv->datagram_received_id = _tmp2_;
	return self;
}

static DinoPluginsIceTransportParametersDatagramConnection*
dino_plugins_ice_transport_parameters_datagram_connection_new (NiceAgent* agent,
                                                               DinoPluginsIceDtlsSrtpHandler* dtls_srtp_handler,
                                                               guint stream_id,
                                                               guint8 component_id)
{
	return dino_plugins_ice_transport_parameters_datagram_connection_construct (DINO_PLUGINS_ICE_TRANSPORT_PARAMETERS_TYPE_DATAGRAM_CONNECTION, agent, dtls_srtp_handler, stream_id, component_id);
}

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

static void
dino_plugins_ice_transport_parameters_datagram_connection_real_terminate (XmppXepJingleComponentConnection* base,
                                                                          gboolean we_terminated,
                                                                          const gchar* reason_string,
                                                                          const gchar* reason_text,
                                                                          GAsyncReadyCallback _callback_,
                                                                          gpointer _user_data_)
{
	DinoPluginsIceTransportParametersDatagramConnection * self;
	DinoPluginsIceTransportParametersDatagramConnectionTerminateData* _data_;
	DinoPluginsIceTransportParametersDatagramConnection* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	self = (DinoPluginsIceTransportParametersDatagramConnection*) base;
	_data_ = g_slice_new0 (DinoPluginsIceTransportParametersDatagramConnectionTerminateData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, dino_plugins_ice_transport_parameters_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_;
	dino_plugins_ice_transport_parameters_datagram_connection_real_terminate_co (_data_);
}

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

static void
dino_plugins_ice_transport_parameters_datagram_connection_terminate_ready (GObject* source_object,
                                                                           GAsyncResult* _res_,
                                                                           gpointer _user_data_)
{
	DinoPluginsIceTransportParametersDatagramConnectionTerminateData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	dino_plugins_ice_transport_parameters_datagram_connection_real_terminate_co (_data_);
}

static gboolean
dino_plugins_ice_transport_parameters_datagram_connection_real_terminate_co (DinoPluginsIceTransportParametersDatagramConnectionTerminateData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_state_ = 1;
	XMPP_XEP_JINGLE_COMPONENT_CONNECTION_CLASS (dino_plugins_ice_transport_parameters_datagram_connection_parent_class)->terminate ((XmppXepJingleComponentConnection*) G_TYPE_CHECK_INSTANCE_CAST (_data_->self, XMPP_XEP_JINGLE_TYPE_DATAGRAM_CONNECTION, XmppXepJingleDatagramConnection), _data_->we_terminated, _data_->reason_string, _data_->reason_text, dino_plugins_ice_transport_parameters_datagram_connection_terminate_ready, _data_);
	return FALSE;
	_state_1:
	XMPP_XEP_JINGLE_COMPONENT_CONNECTION_CLASS (dino_plugins_ice_transport_parameters_datagram_connection_parent_class)->terminate_finish ((XmppXepJingleComponentConnection*) G_TYPE_CHECK_INSTANCE_CAST (_data_->self, XMPP_XEP_JINGLE_TYPE_DATAGRAM_CONNECTION, XmppXepJingleDatagramConnection), _data_->_res_);
	g_signal_handler_disconnect ((GObject*) _data_->self, _data_->self->priv->datagram_received_id);
	_g_object_unref0 (_data_->self->priv->agent);
	_data_->self->priv->agent = NULL;
	_dino_plugins_ice_dtls_srtp_handler_unref0 (_data_->self->priv->dtls_srtp_handler);
	_data_->self->priv->dtls_srtp_handler = NULL;
	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
dino_plugins_ice_transport_parameters_datagram_connection_real_send_datagram (XmppXepJingleDatagramConnection* base,
                                                                              GBytes* datagram)
{
	DinoPluginsIceTransportParametersDatagramConnection * self;
	gboolean _tmp0_ = FALSE;
	NiceAgent* _tmp1_;
	GError* _inner_error0_ = NULL;
	self = (DinoPluginsIceTransportParametersDatagramConnection*) base;
	g_return_if_fail (datagram != NULL);
	_tmp1_ = self->priv->agent;
	if (_tmp1_ != NULL) {
		NiceAgent* _tmp2_;
		guint8 _tmp3_;
		guint8 _tmp4_;
		_tmp2_ = self->priv->agent;
		_tmp3_ = xmpp_xep_jingle_component_connection_get_component_id ((XmppXepJingleComponentConnection*) self);
		_tmp4_ = _tmp3_;
		_tmp0_ = dino_plugins_ice_is_component_ready (_tmp2_, self->priv->stream_id, (guint) _tmp4_);
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		{
			DinoPluginsIceDtlsSrtpHandler* _tmp5_;
			gulong _tmp40_;
			gulong _tmp41_;
			gint _tmp42_;
			gint _tmp43_;
			_tmp5_ = self->priv->dtls_srtp_handler;
			if (_tmp5_ != NULL) {
				guint8* encrypted_data = NULL;
				DinoPluginsIceDtlsSrtpHandler* _tmp6_;
				guint8 _tmp7_;
				guint8 _tmp8_;
				gsize _tmp9_ = 0;
				guint8* _tmp10_;
				gint _tmp11_ = 0;
				guint8* _tmp12_;
				gint encrypted_data_length1;
				gint _encrypted_data_size_;
				guint8* _tmp13_;
				gint _tmp13__length1;
				GOutputVector vector = {0};
				guint8* _tmp14_;
				gint _tmp14__length1;
				guint8* _tmp15_;
				gint _tmp15__length1;
				GOutputVector _tmp16_ = {0};
				GOutputVector* vectors = NULL;
				GOutputVector _tmp17_;
				GOutputVector* _tmp18_;
				gint vectors_length1;
				gint _vectors_size_;
				NiceOutputMessage message = {0};
				GOutputVector* _tmp19_;
				gint _tmp19__length1;
				NiceOutputMessage _tmp20_ = {0};
				NiceOutputMessage* messages = NULL;
				NiceOutputMessage _tmp21_;
				NiceOutputMessage* _tmp22_;
				gint messages_length1;
				gint _messages_size_;
				NiceAgent* _tmp23_;
				guint8 _tmp24_;
				guint8 _tmp25_;
				NiceOutputMessage* _tmp26_;
				gint _tmp26__length1;
				_tmp6_ = self->priv->dtls_srtp_handler;
				_tmp7_ = xmpp_xep_jingle_component_connection_get_component_id ((XmppXepJingleComponentConnection*) self);
				_tmp8_ = _tmp7_;
				_tmp10_ = g_bytes_get_data (datagram, &_tmp9_);
				_tmp12_ = dino_plugins_ice_dtls_srtp_handler_process_outgoing_data (_tmp6_, (guint) _tmp8_, _tmp10_, (gint) _tmp9_, &_tmp11_, &_inner_error0_);
				encrypted_data = _tmp12_;
				encrypted_data_length1 = _tmp11_;
				_encrypted_data_size_ = encrypted_data_length1;
				if (G_UNLIKELY (_inner_error0_ != NULL)) {
					goto __catch0_g_error;
				}
				_tmp13_ = encrypted_data;
				_tmp13__length1 = encrypted_data_length1;
				if (_tmp13_ == NULL) {
					encrypted_data = (g_free (encrypted_data), NULL);
					return;
				}
				_tmp14_ = encrypted_data;
				_tmp14__length1 = encrypted_data_length1;
				_tmp15_ = encrypted_data;
				_tmp15__length1 = encrypted_data_length1;
				_tmp16_.buffer = _tmp14_;
				_tmp16_.size = (gsize) _tmp15__length1;
				vector = _tmp16_;
				_tmp17_ = vector;
				_tmp18_ = g_new0 (GOutputVector, 1);
				_tmp18_[0] = _tmp17_;
				vectors = _tmp18_;
				vectors_length1 = 1;
				_vectors_size_ = vectors_length1;
				_tmp19_ = vectors;
				_tmp19__length1 = vectors_length1;
				_tmp20_.buffers = _tmp19_;
				_tmp20_.n_buffers = _tmp19__length1;
				message = _tmp20_;
				_tmp21_ = message;
				_tmp22_ = g_new0 (NiceOutputMessage, 1);
				_tmp22_[0] = _tmp21_;
				messages = _tmp22_;
				messages_length1 = 1;
				_messages_size_ = messages_length1;
				_tmp23_ = self->priv->agent;
				_tmp24_ = xmpp_xep_jingle_component_connection_get_component_id ((XmppXepJingleComponentConnection*) self);
				_tmp25_ = _tmp24_;
				_tmp26_ = messages;
				_tmp26__length1 = messages_length1;
				nice_agent_send_messages_nonblocking (_tmp23_, self->priv->stream_id, (guint) _tmp25_, _tmp26_, (guint) _tmp26__length1, NULL, &_inner_error0_);
				if (G_UNLIKELY (_inner_error0_ != NULL)) {
					messages = (g_free (messages), NULL);
					vectors = (g_free (vectors), NULL);
					encrypted_data = (g_free (encrypted_data), NULL);
					goto __catch0_g_error;
				}
				messages = (g_free (messages), NULL);
				vectors = (g_free (vectors), NULL);
				encrypted_data = (g_free (encrypted_data), NULL);
			} else {
				GOutputVector vector = {0};
				gsize _tmp27_ = 0;
				guint8* _tmp28_;
				GOutputVector _tmp29_ = {0};
				GOutputVector* vectors = NULL;
				GOutputVector _tmp30_;
				GOutputVector* _tmp31_;
				gint vectors_length1;
				gint _vectors_size_;
				NiceOutputMessage message = {0};
				GOutputVector* _tmp32_;
				gint _tmp32__length1;
				NiceOutputMessage _tmp33_ = {0};
				NiceOutputMessage* messages = NULL;
				NiceOutputMessage _tmp34_;
				NiceOutputMessage* _tmp35_;
				gint messages_length1;
				gint _messages_size_;
				NiceAgent* _tmp36_;
				guint8 _tmp37_;
				guint8 _tmp38_;
				NiceOutputMessage* _tmp39_;
				gint _tmp39__length1;
				_tmp28_ = g_bytes_get_data (datagram, &_tmp27_);
				_tmp29_.buffer = _tmp28_;
				_tmp29_.size = g_bytes_get_size (datagram);
				vector = _tmp29_;
				_tmp30_ = vector;
				_tmp31_ = g_new0 (GOutputVector, 1);
				_tmp31_[0] = _tmp30_;
				vectors = _tmp31_;
				vectors_length1 = 1;
				_vectors_size_ = vectors_length1;
				_tmp32_ = vectors;
				_tmp32__length1 = vectors_length1;
				_tmp33_.buffers = _tmp32_;
				_tmp33_.n_buffers = _tmp32__length1;
				message = _tmp33_;
				_tmp34_ = message;
				_tmp35_ = g_new0 (NiceOutputMessage, 1);
				_tmp35_[0] = _tmp34_;
				messages = _tmp35_;
				messages_length1 = 1;
				_messages_size_ = messages_length1;
				_tmp36_ = self->priv->agent;
				_tmp37_ = xmpp_xep_jingle_component_connection_get_component_id ((XmppXepJingleComponentConnection*) self);
				_tmp38_ = _tmp37_;
				_tmp39_ = messages;
				_tmp39__length1 = messages_length1;
				nice_agent_send_messages_nonblocking (_tmp36_, self->priv->stream_id, (guint) _tmp38_, _tmp39_, (guint) _tmp39__length1, NULL, &_inner_error0_);
				if (G_UNLIKELY (_inner_error0_ != NULL)) {
					messages = (g_free (messages), NULL);
					vectors = (g_free (vectors), NULL);
					goto __catch0_g_error;
				}
				messages = (g_free (messages), NULL);
				vectors = (g_free (vectors), NULL);
			}
			_tmp40_ = xmpp_xep_jingle_component_connection_get_bytes_sent ((XmppXepJingleComponentConnection*) self);
			_tmp41_ = _tmp40_;
			_tmp42_ = _vala_g_bytes_get_length (datagram);
			_tmp43_ = _tmp42_;
			xmpp_xep_jingle_component_connection_set_bytes_sent ((XmppXepJingleComponentConnection*) self, _tmp41_ + _tmp43_);
		}
		goto __finally0;
		__catch0_g_error:
		{
			GError* e = NULL;
			GError* _tmp44_;
			const gchar* _tmp45_;
			guint8 _tmp46_;
			guint8 _tmp47_;
			e = _inner_error0_;
			_inner_error0_ = NULL;
			_tmp44_ = e;
			_tmp45_ = _tmp44_->message;
			_tmp46_ = xmpp_xep_jingle_component_connection_get_component_id ((XmppXepJingleComponentConnection*) self);
			_tmp47_ = _tmp46_;
			g_warning ("transport_parameters.vala:60: %s while send_datagram stream %u compone" \
"nt %u", _tmp45_, self->priv->stream_id, (guint) _tmp47_);
			_g_error_free0 (e);
		}
		__finally0:
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
			g_clear_error (&_inner_error0_);
			return;
		}
	}
}

static void
dino_plugins_ice_transport_parameters_datagram_connection_class_init (DinoPluginsIceTransportParametersDatagramConnectionClass * klass,
                                                                      gpointer klass_data)
{
	dino_plugins_ice_transport_parameters_datagram_connection_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &DinoPluginsIceTransportParametersDatagramConnection_private_offset);
	((XmppXepJingleComponentConnectionClass *) klass)->terminate = (void (*) (XmppXepJingleComponentConnection*, gboolean, const gchar*, const gchar*, GAsyncReadyCallback, gpointer)) dino_plugins_ice_transport_parameters_datagram_connection_real_terminate;
	((XmppXepJingleComponentConnectionClass *) klass)->terminate_finish = (void (*) (XmppXepJingleComponentConnection*, GAsyncResult*)) dino_plugins_ice_transport_parameters_datagram_connection_terminate_finish;
	((XmppXepJingleDatagramConnectionClass *) klass)->send_datagram = (void (*) (XmppXepJingleDatagramConnection*, GBytes*)) dino_plugins_ice_transport_parameters_datagram_connection_real_send_datagram;
	G_OBJECT_CLASS (klass)->finalize = dino_plugins_ice_transport_parameters_datagram_connection_finalize;
}

static void
dino_plugins_ice_transport_parameters_datagram_connection_instance_init (DinoPluginsIceTransportParametersDatagramConnection * self,
                                                                         gpointer klass)
{
	self->priv = dino_plugins_ice_transport_parameters_datagram_connection_get_instance_private (self);
}

static void
dino_plugins_ice_transport_parameters_datagram_connection_finalize (GObject * obj)
{
	DinoPluginsIceTransportParametersDatagramConnection * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, DINO_PLUGINS_ICE_TRANSPORT_PARAMETERS_TYPE_DATAGRAM_CONNECTION, DinoPluginsIceTransportParametersDatagramConnection);
	_g_object_unref0 (self->priv->agent);
	_dino_plugins_ice_dtls_srtp_handler_unref0 (self->priv->dtls_srtp_handler);
	_g_free0 (self->priv->error);
	G_OBJECT_CLASS (dino_plugins_ice_transport_parameters_datagram_connection_parent_class)->finalize (obj);
}

static GType
dino_plugins_ice_transport_parameters_datagram_connection_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (DinoPluginsIceTransportParametersDatagramConnectionClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) dino_plugins_ice_transport_parameters_datagram_connection_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DinoPluginsIceTransportParametersDatagramConnection), 0, (GInstanceInitFunc) dino_plugins_ice_transport_parameters_datagram_connection_instance_init, NULL };
	GType dino_plugins_ice_transport_parameters_datagram_connection_type_id;
	dino_plugins_ice_transport_parameters_datagram_connection_type_id = g_type_register_static (XMPP_XEP_JINGLE_TYPE_DATAGRAM_CONNECTION, "DinoPluginsIceTransportParametersDatagramConnection", &g_define_type_info, 0);
	DinoPluginsIceTransportParametersDatagramConnection_private_offset = g_type_add_instance_private (dino_plugins_ice_transport_parameters_datagram_connection_type_id, sizeof (DinoPluginsIceTransportParametersDatagramConnectionPrivate));
	return dino_plugins_ice_transport_parameters_datagram_connection_type_id;
}

static GType
dino_plugins_ice_transport_parameters_datagram_connection_get_type (void)
{
	static volatile gsize dino_plugins_ice_transport_parameters_datagram_connection_type_id__once = 0;
	if (g_once_init_enter (&dino_plugins_ice_transport_parameters_datagram_connection_type_id__once)) {
		GType dino_plugins_ice_transport_parameters_datagram_connection_type_id;
		dino_plugins_ice_transport_parameters_datagram_connection_type_id = dino_plugins_ice_transport_parameters_datagram_connection_get_type_once ();
		g_once_init_leave (&dino_plugins_ice_transport_parameters_datagram_connection_type_id__once, dino_plugins_ice_transport_parameters_datagram_connection_type_id);
	}
	return dino_plugins_ice_transport_parameters_datagram_connection_type_id__once;
}

static void
dino_plugins_ice_transport_parameters_class_init (DinoPluginsIceTransportParametersClass * klass,
                                                  gpointer klass_data)
{
	dino_plugins_ice_transport_parameters_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &DinoPluginsIceTransportParameters_private_offset);
	((XmppXepJingleIceUdpIceUdpTransportParametersClass *) klass)->handle_transport_accept = (void (*) (XmppXepJingleIceUdpIceUdpTransportParameters*, XmppStanzaNode*, GError**)) dino_plugins_ice_transport_parameters_real_handle_transport_accept;
	((XmppXepJingleIceUdpIceUdpTransportParametersClass *) klass)->handle_transport_info = (void (*) (XmppXepJingleIceUdpIceUdpTransportParameters*, XmppStanzaNode*, GError**)) dino_plugins_ice_transport_parameters_real_handle_transport_info;
	((XmppXepJingleIceUdpIceUdpTransportParametersClass *) klass)->create_transport_connection = (void (*) (XmppXepJingleIceUdpIceUdpTransportParameters*, XmppXmppStream*, XmppXepJingleContent*)) dino_plugins_ice_transport_parameters_real_create_transport_connection;
	((GObjectClass *) klass)->dispose = (void (*) (GObject*)) dino_plugins_ice_transport_parameters_real_dispose;
	G_OBJECT_CLASS (klass)->finalize = dino_plugins_ice_transport_parameters_finalize;
}

static void
dino_plugins_ice_transport_parameters_instance_init (DinoPluginsIceTransportParameters * self,
                                                     gpointer klass)
{
	GeeHashMap* _tmp0_;
	self->priv = dino_plugins_ice_transport_parameters_get_instance_private (self);
	_tmp0_ = gee_hash_map_new (G_TYPE_UCHAR, NULL, NULL, DINO_PLUGINS_ICE_TRANSPORT_PARAMETERS_TYPE_DATAGRAM_CONNECTION, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
	self->priv->connections = (GeeMap*) _tmp0_;
}

static void
dino_plugins_ice_transport_parameters_finalize (GObject * obj)
{
	DinoPluginsIceTransportParameters * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, DINO_PLUGINS_ICE_TYPE_TRANSPORT_PARAMETERS, DinoPluginsIceTransportParameters);
	_g_object_unref0 (self->priv->agent);
	_g_object_unref0 (self->priv->connections);
	_dino_plugins_ice_dtls_srtp_handler_unref0 (self->priv->dtls_srtp_handler);
	_g_main_context_unref0 (self->priv->thread_context);
	_g_main_loop_unref0 (self->priv->thread_loop);
	G_OBJECT_CLASS (dino_plugins_ice_transport_parameters_parent_class)->finalize (obj);
}

static GType
dino_plugins_ice_transport_parameters_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (DinoPluginsIceTransportParametersClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) dino_plugins_ice_transport_parameters_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DinoPluginsIceTransportParameters), 0, (GInstanceInitFunc) dino_plugins_ice_transport_parameters_instance_init, NULL };
	GType dino_plugins_ice_transport_parameters_type_id;
	dino_plugins_ice_transport_parameters_type_id = g_type_register_static (XMPP_XEP_JINGLE_ICE_UDP_TYPE_ICE_UDP_TRANSPORT_PARAMETERS, "DinoPluginsIceTransportParameters", &g_define_type_info, 0);
	DinoPluginsIceTransportParameters_private_offset = g_type_add_instance_private (dino_plugins_ice_transport_parameters_type_id, sizeof (DinoPluginsIceTransportParametersPrivate));
	return dino_plugins_ice_transport_parameters_type_id;
}

GType
dino_plugins_ice_transport_parameters_get_type (void)
{
	static volatile gsize dino_plugins_ice_transport_parameters_type_id__once = 0;
	if (g_once_init_enter (&dino_plugins_ice_transport_parameters_type_id__once)) {
		GType dino_plugins_ice_transport_parameters_type_id;
		dino_plugins_ice_transport_parameters_type_id = dino_plugins_ice_transport_parameters_get_type_once ();
		g_once_init_leave (&dino_plugins_ice_transport_parameters_type_id__once, dino_plugins_ice_transport_parameters_type_id);
	}
	return dino_plugins_ice_transport_parameters_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;
}

